synapse-react-client 4.0.9 → 4.0.11
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/aridhiaTokenExchange.js.map +1 -1
- package/dist/aridhia-queries/useGetAridhiaRequests.js.map +1 -1
- package/dist/assets/icons/CloudWarning.d.ts +5 -0
- package/dist/assets/icons/CloudWarning.d.ts.map +1 -0
- package/dist/assets/icons/CloudWarning.js +47 -0
- package/dist/assets/icons/CloudWarning.js.map +1 -0
- package/dist/assets/icons/TasksIcon.d.ts.map +1 -1
- package/dist/assets/icons/TasksIcon.js +6 -10
- package/dist/assets/icons/TasksIcon.js.map +1 -1
- package/dist/components/AccessRequirementAclEditor/AccessRequirementAclEditor.d.ts.map +1 -1
- package/dist/components/AccessRequirementAclEditor/AccessRequirementAclEditor.js +69 -63
- package/dist/components/AccessRequirementAclEditor/AccessRequirementAclEditor.js.map +1 -1
- package/dist/components/AccessRequirementList/AccessApprovalCheckMark.js.map +1 -1
- package/dist/components/AccessRequirementList/AccessRequirementList.js.map +1 -1
- package/dist/components/AccessRequirementList/AccessRequirementListUtils.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsEditor.js.map +1 -1
- package/dist/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.js.map +1 -1
- package/dist/components/AccessRequirementRelatedProjectsList/AccessRequirementRelatedProjectsList.js.map +1 -1
- package/dist/components/AccessTokenPage/AccessTokenCard/AccessTokenCard.js.map +1 -1
- package/dist/components/AcknowledgementsPage/StudyAcknowledgements.js.map +1 -1
- package/dist/components/AclEditor/PermissionLevelMenu.js.map +1 -1
- package/dist/components/AclEditor/ResourceAccessAndUserGroupHeader.js.map +1 -1
- package/dist/components/AclEditor/useSortResourceAccessList.js.map +1 -1
- package/dist/components/AclEditor/useUpdateAcl.js.map +1 -1
- package/dist/components/Aridhia/AridhiaAccessStatus.js.map +1 -1
- package/dist/components/Authentication/AuthenticationMethodSelection.d.ts.map +1 -1
- package/dist/components/Authentication/AuthenticationMethodSelection.js +38 -37
- package/dist/components/Authentication/AuthenticationMethodSelection.js.map +1 -1
- package/dist/components/Authentication/Constants.d.ts +1 -0
- package/dist/components/Authentication/Constants.d.ts.map +1 -1
- package/dist/components/Authentication/Constants.js +2 -2
- package/dist/components/Authentication/Constants.js.map +1 -1
- package/dist/components/Authentication/LastLoginInfo.js.map +1 -1
- package/dist/components/Authentication/RecoveryCodeForm.js.map +1 -1
- package/dist/components/Authentication/RecoveryCodeGrid.js.map +1 -1
- package/dist/components/Authentication/RegenerateBackupCodesWarning.js.map +1 -1
- package/dist/components/Authentication/Reset2FAWarning.js.map +1 -1
- package/dist/components/Authentication/StandaloneLoginForm.js +1 -1
- 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 +2 -1
- package/dist/components/Authentication/TwoFactorEnrollmentForm.js.map +1 -1
- package/dist/components/BasePortalCard/ColorfulPortalCardWithChips/ColorfulPortalCardWithChips.js.map +1 -1
- package/dist/components/CardContainer/CardContainer.js.map +1 -1
- package/dist/components/CardDeck/CardDeck.Mobile.js.map +1 -1
- package/dist/components/CardDeck/TableQueryCardDeck.js.map +1 -1
- package/dist/components/CertificationQuiz/CertificationQuiz.js.map +1 -1
- package/dist/components/ChallengeDataDownload/ChallengeDataDownload.js.map +1 -1
- package/dist/components/ChallengeSubmission/ChallengeSubmission.js.map +1 -1
- package/dist/components/ChallengeSubmission/ChallengeSubmissionStepper.js.map +1 -1
- package/dist/components/ChallengeSubmission/EvaluationQueueCurrentRoundInfo.js.map +1 -1
- package/dist/components/ChallengeSubmission/EvaluationQueueList.js.map +1 -1
- package/dist/components/ChallengeSubmission/SubmissionDirectoryList.d.ts.map +1 -1
- package/dist/components/ChallengeSubmission/SubmissionDirectoryList.js +143 -140
- package/dist/components/ChallengeSubmission/SubmissionDirectoryList.js.map +1 -1
- package/dist/components/ChallengeTeamWizard/ChallengeTeamWizard.js.map +1 -1
- package/dist/components/ChallengeTeamWizard/CreateChallengeTeam.js.map +1 -1
- package/dist/components/ChangePassword/ChangePassword.js.map +1 -1
- package/dist/components/ChangePassword/ChangePasswordWithToken.js.map +1 -1
- package/dist/components/ChangePassword/useChangePasswordFormState.js +1 -1
- package/dist/components/ChangePassword/useChangePasswordFormState.js.map +1 -1
- package/dist/components/CitationPopover/CitationPopoverContent.js.map +1 -1
- package/dist/components/ColumnFilter/ColumnFilter.js.map +1 -1
- package/dist/components/ComponentCollapse.js.map +1 -1
- package/dist/components/CookiesNotification/CookiesNotification.js.map +1 -1
- package/dist/components/CreateProjectModal/CreateProjectModal.js.map +1 -1
- package/dist/components/CreateTableViewWizard/CreateTableViewWizardUtils.js.map +1 -1
- package/dist/components/DataGrid/DataGrid.d.ts +0 -1
- package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/DataGrid.js +72 -72
- package/dist/components/DataGrid/DataGrid.js.map +1 -1
- package/dist/components/DataGrid/DataGridWebSocket.d.ts +4 -0
- package/dist/components/DataGrid/DataGridWebSocket.d.ts.map +1 -1
- package/dist/components/DataGrid/DataGridWebSocket.js +9 -8
- package/dist/components/DataGrid/DataGridWebSocket.js.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.js +326 -268
- package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
- package/dist/components/DataGrid/columns/AutocompleteColumn.d.ts +2 -0
- package/dist/components/DataGrid/columns/AutocompleteColumn.d.ts.map +1 -1
- package/dist/components/DataGrid/columns/AutocompleteColumn.js +124 -67
- package/dist/components/DataGrid/columns/AutocompleteColumn.js.map +1 -1
- package/dist/components/DataGrid/columns/AutocompleteMultipleEnumColumn.d.ts +2 -1
- package/dist/components/DataGrid/columns/AutocompleteMultipleEnumColumn.d.ts.map +1 -1
- package/dist/components/DataGrid/columns/AutocompleteMultipleEnumColumn.js +126 -122
- package/dist/components/DataGrid/columns/AutocompleteMultipleEnumColumn.js.map +1 -1
- package/dist/components/DataGrid/columns/useGridAutocompleteState.d.ts +58 -0
- package/dist/components/DataGrid/columns/useGridAutocompleteState.d.ts.map +1 -0
- package/dist/components/DataGrid/columns/useGridAutocompleteState.js +52 -0
- package/dist/components/DataGrid/columns/useGridAutocompleteState.js.map +1 -0
- package/dist/components/DataGrid/components/ValidationAlert.d.ts +5 -2
- package/dist/components/DataGrid/components/ValidationAlert.d.ts.map +1 -1
- package/dist/components/DataGrid/components/ValidationAlert.js +429 -24
- package/dist/components/DataGrid/components/ValidationAlert.js.map +1 -1
- package/dist/components/DataGrid/hooks/useColumnResizeHandles.js.map +1 -1
- package/dist/components/DataGrid/hooks/useGetSchemaForGrid.js.map +1 -1
- package/dist/components/DataGrid/hooks/useGridUndoRedo.js.map +1 -1
- package/dist/components/DataGrid/hooks/useStack.js.map +1 -1
- package/dist/components/DataGrid/useCRDTModelView.js.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.d.ts +7 -0
- package/dist/components/DataGrid/useDataGridWebsocket.d.ts.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.js +16 -2
- package/dist/components/DataGrid/useDataGridWebsocket.js.map +1 -1
- package/dist/components/DataGrid/useInitializeGridConnection.js.map +1 -1
- package/dist/components/DataGrid/useMergeGridWithRecordSet.js.map +1 -1
- package/dist/components/DataGrid/useMergeGridWithSource.js.map +1 -1
- package/dist/components/DataGrid/useMergeGridWithTable.js.map +1 -1
- package/dist/components/DataGrid/utils/DataGridUtils.js.map +1 -1
- package/dist/components/DataGrid/utils/applyModelChange.d.ts +1 -1
- package/dist/components/DataGrid/utils/applyModelChange.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/applyModelChange.js +27 -24
- package/dist/components/DataGrid/utils/applyModelChange.js.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.d.ts +8 -0
- package/dist/components/DataGrid/utils/columnFactory.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.js +47 -44
- package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
- package/dist/components/DataGrid/utils/computeReplicaSelectionModel.js.map +1 -1
- package/dist/components/DataGrid/utils/extractColumnValidationMessages.js.map +1 -1
- package/dist/components/DataGrid/utils/getCellClassName.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/getCellClassName.js +8 -8
- package/dist/components/DataGrid/utils/getCellClassName.js.map +1 -1
- package/dist/components/DataGrid/utils/getEmptyValue.d.ts +2 -0
- package/dist/components/DataGrid/utils/getEmptyValue.d.ts.map +1 -0
- package/dist/components/DataGrid/utils/getEmptyValue.js +8 -0
- package/dist/components/DataGrid/utils/getEmptyValue.js.map +1 -0
- package/dist/components/DataGrid/utils/json-rx/JsonRx.js.map +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.js +2 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.js.map +1 -1
- package/dist/components/DataGrid/utils/modelRowsToGrid.js.map +1 -1
- package/dist/components/DataGrid/utils/parseFreeTextUsingJsonSchemaType.js.map +1 -1
- package/dist/components/DataGrid/utils/schemaAwarePasteValue.d.ts +32 -0
- package/dist/components/DataGrid/utils/schemaAwarePasteValue.d.ts.map +1 -0
- package/dist/components/DataGrid/utils/schemaAwarePasteValue.js +22 -0
- package/dist/components/DataGrid/utils/schemaAwarePasteValue.js.map +1 -0
- package/dist/components/DataGrid/utils/splitPatch.js.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/DirectDownload/DirectDownload.js.map +1 -1
- package/dist/components/DirectDownloadButton.js.map +1 -1
- package/dist/components/DownloadCart/CreatePackageV2.js.map +1 -1
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.css +1 -0
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.d.ts.map +1 -1
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.js +199 -132
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.js.map +1 -1
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.js +22 -0
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.js.map +1 -0
- package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.scss +170 -0
- package/dist/components/DownloadCart/DownloadListActionsRequired.js.map +1 -1
- package/dist/components/DownloadCart/DownloadListTable.js.map +1 -1
- package/dist/components/DownloadCart/fileNameUtils.js.map +1 -1
- package/dist/components/DraggableDialog/DraggableDialog.js.map +1 -1
- package/dist/components/DynamicForm/DynamicFormModal.js.map +1 -1
- package/dist/components/Ecosystem/TableQueryEcosystem.js.map +1 -1
- package/dist/components/EntityAclEditor/EntityAclEditor.d.ts.map +1 -1
- package/dist/components/EntityAclEditor/EntityAclEditor.js +103 -103
- package/dist/components/EntityAclEditor/EntityAclEditor.js.map +1 -1
- package/dist/components/EntityAclEditor/useNotifyNewACLUsers.js.map +1 -1
- package/dist/components/EntityBadgeIcons/EntityBadgeIcons.js.map +1 -1
- package/dist/components/EntityCitation/EntityCitation.js.map +1 -1
- package/dist/components/EntityDownloadButton/EntityDownloadButton.d.ts.map +1 -1
- package/dist/components/EntityDownloadButton/EntityDownloadButton.js +1 -0
- package/dist/components/EntityDownloadButton/EntityDownloadButton.js.map +1 -1
- package/dist/components/EntityDownloadConfirmation/EntityDownloadConfirmation.d.ts.map +1 -1
- package/dist/components/EntityDownloadConfirmation/EntityDownloadConfirmation.js +36 -30
- package/dist/components/EntityDownloadConfirmation/EntityDownloadConfirmation.js.map +1 -1
- package/dist/components/EntityFinder/EntityFinder.js.map +1 -1
- package/dist/components/EntityFinder/VersionSelectionType.js.map +1 -1
- package/dist/components/EntityFinder/details/configurations/EntityChildrenDetails.js.map +1 -1
- package/dist/components/EntityFinder/details/configurations/FavoritesDetails.js.map +1 -1
- package/dist/components/EntityFinder/details/configurations/ProjectListDetails.js.map +1 -1
- package/dist/components/EntityFinder/details/view/DetailsView.js.map +1 -1
- package/dist/components/EntityFinder/tree/EntityTree.js.map +1 -1
- package/dist/components/EntityFinder/tree/VirtualizedTree.js.map +1 -1
- package/dist/components/EntityFinder/useEntitySelection.js.map +1 -1
- package/dist/components/EntityForm/EntityForm.js.map +1 -1
- package/dist/components/EntityHeaderTable/EntityHeaderTable.js.map +1 -1
- package/dist/components/EntityHeaderTable/Filter.js.map +1 -1
- package/dist/components/EntityHeaderTable/useEntityHeaderTableState.js.map +1 -1
- package/dist/components/EntitySubjectsSelector/EntitySubjectsSelector.js.map +1 -1
- package/dist/components/EntityTreeTable/components/IdColumnHeader.js.map +1 -1
- package/dist/components/EntityTreeTable/hooks/useEntityTreeState.js.map +1 -1
- package/dist/components/EntityTreeTable/hooks/useTableColumns.js.map +1 -1
- package/dist/components/EntityTreeTable/hooks/useTableData.js.map +1 -1
- package/dist/components/EntityTreeTable/hooks/useTreeOperationsWithDirectFetch.js.map +1 -1
- package/dist/components/EntityUpload/EntityUpload.js.map +1 -1
- package/dist/components/EntityViewScopeEditor/EntityViewMaskEditor.d.ts.map +1 -1
- package/dist/components/EntityViewScopeEditor/EntityViewMaskEditor.js +15 -14
- package/dist/components/EntityViewScopeEditor/EntityViewMaskEditor.js.map +1 -1
- package/dist/components/ExperimentalMode/ExperimentalMode.js.map +1 -1
- package/dist/components/ExternalFileHandleLink/ExternalFileHandleLink.js.map +1 -1
- package/dist/components/FeaturedDataTabs/FacetPlotsCard.js.map +1 -1
- package/dist/components/FeaturedDataTabs/QueryPerFacetPlotsCard.js.map +1 -1
- package/dist/components/FeaturedDataTabs/SingleQueryFacetPlotsCards.js.map +1 -1
- package/dist/components/FeaturedResearch/FeaturedResearch.js.map +1 -1
- package/dist/components/FeaturedToolsList/FeaturedToolsList.js.map +1 -1
- package/dist/components/FilePreview/FileHandleContentRenderer.js.map +1 -1
- package/dist/components/FilePreview/HtmlPreview/HtmlPreview.js.map +1 -1
- package/dist/components/FilePreview/PreviewRendererType.js.map +1 -1
- package/dist/components/Forum/DiscussionReply.d.ts +1 -0
- package/dist/components/Forum/DiscussionReply.d.ts.map +1 -1
- package/dist/components/Forum/DiscussionReply.js +19 -19
- package/dist/components/Forum/DiscussionReply.js.map +1 -1
- package/dist/components/Forum/DiscussionSearchResult.js.map +1 -1
- package/dist/components/Forum/DiscussionThread.d.ts +1 -0
- package/dist/components/Forum/DiscussionThread.d.ts.map +1 -1
- package/dist/components/Forum/DiscussionThread.js +73 -72
- package/dist/components/Forum/DiscussionThread.js.map +1 -1
- package/dist/components/Forum/ForumTable.js.map +1 -1
- package/dist/components/Forum/ForumThreadEditor.js.map +1 -1
- package/dist/components/FullTextSearch/FullTextSearchUtils.js.map +1 -1
- package/dist/components/GenericCard/BioregistryRules.d.ts.map +1 -1
- package/dist/components/GenericCard/BioregistryRules.js +7 -3
- package/dist/components/GenericCard/BioregistryRules.js.map +1 -1
- package/dist/components/GenericCard/GenericCard.d.ts.map +1 -1
- package/dist/components/GenericCard/GenericCard.js +12 -7
- package/dist/components/GenericCard/GenericCard.js.map +1 -1
- package/dist/components/GenericCard/Linkify.js.map +1 -1
- package/dist/components/GenericCard/SynapseCardLabel.js.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.js +105 -105
- package/dist/components/GenericCard/TableRowGenericCard.js.map +1 -1
- package/dist/components/Goals/Goals.Mobile.js.map +1 -1
- package/dist/components/Goals/Goals.js.map +1 -1
- package/dist/components/GoalsV2/GoalsV2.Mobile.js.map +1 -1
- package/dist/components/GoalsV2/GoalsV2.js.map +1 -1
- package/dist/components/GoalsV3/GoalsV3.Mobile.js.map +1 -1
- package/dist/components/GoalsV3/GoalsV3.js.map +1 -1
- package/dist/components/GoogleMap/SynapseUserMarker.js.map +1 -1
- package/dist/components/HasAccess/AccessIcon.js.map +1 -1
- package/dist/components/HasAccess/useHasAccess.js.map +1 -1
- package/dist/components/HeaderCard/HeaderCardV2.js.map +1 -1
- package/dist/components/HeaderCard.d.ts +6 -1
- package/dist/components/HeaderCard.d.ts.map +1 -1
- package/dist/components/HeaderCard.js +107 -76
- package/dist/components/HeaderCard.js.map +1 -1
- package/dist/components/HexGrid/HexGrid.js.map +1 -1
- package/dist/components/IconList.js.map +1 -1
- package/dist/components/IconSvg/IconSvg.d.ts.map +1 -1
- package/dist/components/IconSvg/IconSvg.js +2 -1
- package/dist/components/IconSvg/IconSvg.js.map +1 -1
- package/dist/components/ImageCardGridWithLinks/ImageCardGridWithLinks.js.map +1 -1
- package/dist/components/ImageFromSynapseTable.js.map +1 -1
- package/dist/components/JSONArrayEditor/useParseCsv.js.map +1 -1
- package/dist/components/JsonSchemaForm/templates/ArrayFieldDescriptionTemplate.js.map +1 -1
- package/dist/components/JsonSchemaForm/templates/ArrayFieldItemTemplate.js.map +1 -1
- package/dist/components/JsonSchemaForm/templates/BaseInputTemplate.js.map +1 -1
- package/dist/components/JsonSchemaForm/templates/FieldTemplate.js.map +1 -1
- package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.js.map +1 -1
- package/dist/components/Markdown/MarkdownGithub.js.map +1 -1
- package/dist/components/Markdown/MarkdownSynapse.js.map +1 -1
- package/dist/components/Markdown/MarkdownUtils.js.map +1 -1
- package/dist/components/Markdown/SynapseWikiContext.js.map +1 -1
- package/dist/components/Markdown/UserMentionModal.js.map +1 -1
- package/dist/components/Markdown/widget/MarkdownProvenanceGraph.js.map +1 -1
- package/dist/components/MissingQueryResultsWarning/MissingQueryResultsWarning.js.map +1 -1
- package/dist/components/ModalDownload/ModalDownload.js.map +1 -1
- package/dist/components/OAuthClientAclEditor/OAuthClientAclEditor.d.ts.map +1 -1
- package/dist/components/OAuthClientAclEditor/OAuthClientAclEditor.js +45 -39
- package/dist/components/OAuthClientAclEditor/OAuthClientAclEditor.js.map +1 -1
- package/dist/components/OAuthClientManagement/OAuthManagement.js.map +1 -1
- package/dist/components/PageProgress/PageProgress.js.map +1 -1
- package/dist/components/Plot/DotPlot.js.map +1 -1
- package/dist/components/Plot/Plot.js.map +1 -1
- package/dist/components/Plot/SynapsePlot.js.map +1 -1
- package/dist/components/Plot/ThemesPlot.js.map +1 -1
- package/dist/components/Plot/UpsetPlot.js.map +1 -1
- package/dist/components/PortalAclEditor/PortalAclEditor.d.ts.map +1 -1
- package/dist/components/PortalAclEditor/PortalAclEditor.js +43 -41
- package/dist/components/PortalAclEditor/PortalAclEditor.js.map +1 -1
- package/dist/components/PortalFeaturedPartners/PortalFeaturedPartners.js.map +1 -1
- package/dist/components/PortalList/CreatePortalModal.js.map +1 -1
- package/dist/components/ProgrammaticInstructionsModal/ProgrammaticInstructionsModal.js.map +1 -1
- package/dist/components/ProgrammaticTableDownload/ProgrammaticTableDownload.js.map +1 -1
- package/dist/components/Programs/Programs.Mobile.js.map +1 -1
- package/dist/components/Programs/Programs.js.map +1 -1
- package/dist/components/ProvenanceGraph/ProvenanceExternalIcon.js.map +1 -1
- package/dist/components/ProvenanceGraph/ProvenanceGraph.js.map +1 -1
- package/dist/components/ProvenanceGraph/ProvenanceGraphUtils.js.map +1 -1
- package/dist/components/ProvenanceGraph/ProvenanceUtils.js.map +1 -1
- package/dist/components/QueryCount/QueryCount.js.map +1 -1
- package/dist/components/QueryCountButton/QueryCountButton.js.map +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js.map +1 -1
- package/dist/components/QueryWrapper/QueryWrapper.js.map +1 -1
- package/dist/components/QueryWrapper/TableQueryUseQueryOptions.js.map +1 -1
- package/dist/components/QueryWrapper/TableRowSelectionState.js.map +1 -1
- package/dist/components/QueryWrapper/generateEncodedPathAndQueryForSelectedFacetURL.js.map +1 -1
- package/dist/components/QueryWrapper/useGetQueryMetadata.js.map +1 -1
- package/dist/components/QueryWrapperErrorBoundary.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/UseRowSet.js.map +1 -1
- package/dist/components/RecentPublicationsGrid/RecentPublicationsGrid.js.map +1 -1
- package/dist/components/ReleaseCard/ReleaseCardUtils.js.map +1 -1
- package/dist/components/ResizableContainer/hooks/useResizable.js.map +1 -1
- package/dist/components/Resources/Resources.Mobile.js.map +1 -1
- package/dist/components/Resources/Resources.js.map +1 -1
- package/dist/components/RowDataTable/RowDataTableWithQuery.js.map +1 -1
- package/dist/components/SageResourcesPopover/SageResourcesPopover.js.map +1 -1
- package/dist/components/SchemaDrivenAnnotationEditor/AnnotationEditorUtils.js.map +1 -1
- package/dist/components/SetAccessRequirementCommonFields/SetAccessRequirementCommonFields.js.map +1 -1
- package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.js.map +1 -1
- package/dist/components/SmartLink/SmartButton.js.map +1 -1
- package/dist/components/SmartLink/SmartLink.js.map +1 -1
- package/dist/components/SourceAppImage.js.map +1 -1
- package/dist/components/StandaloneQueryWrapper/StandaloneQueryWrapper.js.map +1 -1
- package/dist/components/StatisticsPlot.js.map +1 -1
- package/dist/components/StorybookComponentWrapper.js.map +1 -1
- package/dist/components/SubsectionRowRenderer/SubsectionRowRenderer.js.map +1 -1
- package/dist/components/SustainabilityScorecard/SustainabilityScorecard.js.map +1 -1
- package/dist/components/SynapseChat/GridAgentChat.js.map +1 -1
- package/dist/components/SynapseChat/SynapseChatInteraction.js.map +1 -1
- package/dist/components/SynapseChat/SynapseChatMessage.js.map +1 -1
- package/dist/components/SynapseChat/extractMessageFromTraceEvent.js.map +1 -1
- package/dist/components/SynapseForm/StepsSideNav.js.map +1 -1
- package/dist/components/SynapseForm/SummaryTable.js.map +1 -1
- package/dist/components/SynapseForm/SynapseForm.js +4 -2
- package/dist/components/SynapseForm/SynapseForm.js.map +1 -1
- package/dist/components/SynapseForm/SynapseFormWrapper.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseByTheNumbersItem.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseFeatureItem.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseHomepageChatSearch.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseHomepageSearch.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseInActionItem.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapsePlans.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseTrendingProjects.js.map +1 -1
- package/dist/components/SynapseNavDrawer/SynapseNavDrawer.d.ts +8 -7
- package/dist/components/SynapseNavDrawer/SynapseNavDrawer.d.ts.map +1 -1
- package/dist/components/SynapseNavDrawer/SynapseNavDrawer.js +173 -164
- package/dist/components/SynapseNavDrawer/SynapseNavDrawer.js.map +1 -1
- package/dist/components/SynapsePortalBanners/SynapsePortalBanners.js.map +1 -1
- package/dist/components/SynapseSearchPageResults/SearchFacetPanel/SearchFacetPanel.js.map +1 -1
- package/dist/components/SynapseSearchPageResults/SearchFacetPanel/SearchFacetPanelUtils.js.map +1 -1
- package/dist/components/SynapseSearchPageResults/SynapseSearchPageResults.js.map +1 -1
- package/dist/components/SynapseTable/EntityIDColumnCopyIcon.js.map +1 -1
- package/dist/components/SynapseTable/NoContentPlaceholderType.js.map +1 -1
- package/dist/components/SynapseTable/RowSelection/RowSelectionControls.js.map +1 -1
- package/dist/components/SynapseTable/SynapseTableCell/SynapseTableCell.js.map +1 -1
- package/dist/components/SynapseTable/SynapseTableRenderers.js.map +1 -1
- package/dist/components/SynapseTable/datasets/DatasetItemsEditor.js.map +1 -1
- package/dist/components/SynapseTable/table-top/ColumnSelection.js.map +1 -1
- package/dist/components/SynapseTable/table-top/DownloadOptions.js.map +1 -1
- package/dist/components/SynapseTable/usePrefetchTableData.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/ColumnModelForm.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/ColumnModelFormFields/DefaultValueField.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/ImportTableColumnsButton.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.d.ts +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaForm.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaFormReducer.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/ColumnModelValidator.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/DatetimeSchema.js.map +1 -1
- package/dist/components/TanStackTable/ColumnHeader.d.ts +1 -0
- package/dist/components/TanStackTable/ColumnHeader.d.ts.map +1 -1
- package/dist/components/TanStackTable/ColumnHeader.js +8 -8
- package/dist/components/TanStackTable/ColumnHeader.js.map +1 -1
- package/dist/components/TanStackTable/ColumnHeaderEnumFilter.js.map +1 -1
- package/dist/components/TanStackTable/TableBody.js.map +1 -1
- package/dist/components/TeamSubjectsSelector/TeamSubjectsSelector.js.map +1 -1
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TimelinePlot/TimelinePhase.js.map +1 -1
- package/dist/components/TimelinePlot/TimelinePlot.js.map +1 -1
- package/dist/components/TimelinePlot/TimelinePlotSpeciesSelector.js.map +1 -1
- package/dist/components/UserCard/Avatar.js.map +1 -1
- package/dist/components/UserCardList/UserCardList.js.map +1 -1
- package/dist/components/UserCardList/UserCardListGroups/UserCardListGroups.Mobile.js.map +1 -1
- package/dist/components/UserCardList/UserCardListRotate.js.map +1 -1
- package/dist/components/UserOrTeamBadge/useUserOrTeam.js.map +1 -1
- package/dist/components/UserProfileLinks/UserProjects.js.map +1 -1
- package/dist/components/UserSearchBox/UserSearchBox.js.map +1 -1
- package/dist/components/Webhook/WebhookDashboard.js.map +1 -1
- package/dist/components/WikiMarkdownEditor/WikiMarkdownEditor.js.map +1 -1
- package/dist/components/WikiMarkdownEditorButton/WikiMarkdownEditorButton.js.map +1 -1
- package/dist/components/dataaccess/AccessApprovalsTable.js.map +1 -1
- package/dist/components/dataaccess/AccessRequestSubmissionTable.js.map +1 -1
- package/dist/components/dataaccess/SubmissionPage/SubmissionPage.d.ts.map +1 -1
- package/dist/components/dataaccess/SubmissionPage/SubmissionPage.js +157 -148
- package/dist/components/dataaccess/SubmissionPage/SubmissionPage.js.map +1 -1
- package/dist/components/dataaccess/UseAccessRequirementTable.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryTable.js.map +1 -1
- package/dist/components/doi/CreateOrUpdateDoiModal.d.ts.map +1 -1
- package/dist/components/doi/CreateOrUpdateDoiModal.js +20 -19
- package/dist/components/doi/CreateOrUpdateDoiModal.js.map +1 -1
- package/dist/components/entity/page/CreatedByModifiedBy.js.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.js.map +1 -1
- package/dist/components/entity/page/title_bar/useDataCiteUsage.js.map +1 -1
- package/dist/components/entity/page/title_bar/useGetMentions.js.map +1 -1
- package/dist/components/error/ErrorPage.js.map +1 -1
- package/dist/components/favorites/FavoritesPage.js.map +1 -1
- package/dist/components/file/upload/BasicFileHandleUpload.js.map +1 -1
- package/dist/components/layout/SWCHeader.d.ts +9 -0
- package/dist/components/layout/SWCHeader.d.ts.map +1 -0
- package/dist/components/layout/SWCHeader.js +19 -0
- package/dist/components/layout/SWCHeader.js.map +1 -0
- package/dist/components/layout/SWCPageLayout.d.ts +9 -0
- package/dist/components/layout/SWCPageLayout.d.ts.map +1 -0
- package/dist/components/layout/SWCPageLayout.js +14 -0
- package/dist/components/layout/SWCPageLayout.js.map +1 -0
- package/dist/components/menu/ComplexMenu.js.map +1 -1
- package/dist/components/row_renderers/utils/ChipContainer.js.map +1 -1
- package/dist/components/styled/StyledPopover.js.map +1 -1
- package/dist/components/table/CsvPreview/CsvPreview.js +2 -1
- package/dist/components/table/CsvPreview/CsvPreview.js.map +1 -1
- package/dist/components/table/CsvPreview/CsvPreviewDialog.js.map +1 -1
- package/dist/components/trash/TrashCanList.js.map +1 -1
- package/dist/components/widgets/FileHandleLink.js.map +1 -1
- package/dist/components/widgets/RangeSlider/RangeSlider.js.map +1 -1
- package/dist/components/widgets/SynapseVideo.js.map +1 -1
- package/dist/components/widgets/facet-nav/FacetNavPanel.js.map +1 -1
- package/dist/components/widgets/facet-nav/PlotsContainer.js.map +1 -1
- package/dist/components/widgets/facet-nav/SelectionCriteriaPills.js.map +1 -1
- package/dist/components/widgets/facet-nav/useFacetPlots.js.map +1 -1
- package/dist/components/widgets/query-filter/CombinedRangeFacetFilter.js.map +1 -1
- package/dist/components/widgets/query-filter/EnumFacetFilter/EnumFacetFilter.js.map +1 -1
- package/dist/components/widgets/query-filter/FacetFilterControls.js.map +1 -1
- package/dist/components/widgets/query-filter/RangeFacetFilter.js.map +1 -1
- package/dist/components/widgets/query-filter/RangeFacetFilterUI.js.map +1 -1
- package/dist/features/curator/GridPage/components/GridPageTitle.d.ts.map +1 -1
- package/dist/features/curator/GridPage/components/GridPageTitle.js +23 -30
- package/dist/features/curator/GridPage/components/GridPageTitle.js.map +1 -1
- package/dist/features/curator/dashboard/CuratorDashboard.d.ts +2 -0
- package/dist/features/curator/dashboard/CuratorDashboard.d.ts.map +1 -0
- package/dist/features/curator/dashboard/CuratorDashboard.js +45 -0
- package/dist/features/curator/dashboard/CuratorDashboard.js.map +1 -0
- package/dist/features/curator/dashboard/components/CurationTaskCard.css +1 -0
- package/dist/features/curator/dashboard/components/CurationTaskCard.d.ts +9 -0
- package/dist/features/curator/dashboard/components/CurationTaskCard.d.ts.map +1 -0
- package/dist/features/curator/dashboard/components/CurationTaskCard.js +106 -0
- package/dist/features/curator/dashboard/components/CurationTaskCard.js.map +1 -0
- package/dist/features/curator/dashboard/components/CurationTaskCard.module.js +12 -0
- package/dist/features/curator/dashboard/components/CurationTaskCard.module.js.map +1 -0
- package/dist/features/curator/dashboard/components/CurationTaskCard.module.scss +52 -0
- package/dist/features/curator/dashboard/components/NextStepButton.css +1 -0
- package/dist/features/curator/dashboard/components/NextStepButton.d.ts +14 -0
- package/dist/features/curator/dashboard/components/NextStepButton.d.ts.map +1 -0
- package/dist/features/curator/dashboard/components/NextStepButton.js +35 -0
- package/dist/features/curator/dashboard/components/NextStepButton.js.map +1 -0
- package/dist/features/curator/dashboard/components/NextStepButton.module.js +11 -0
- package/dist/features/curator/dashboard/components/NextStepButton.module.js.map +1 -0
- package/dist/features/curator/dashboard/components/NextStepButton.module.scss +57 -0
- package/dist/features/curator/dashboard/components/UserOrTeamChip.css +1 -1
- package/dist/features/curator/dashboard/components/UserOrTeamChip.module.js +1 -1
- package/dist/features/curator/dashboard/components/UserOrTeamChip.module.js.map +1 -1
- package/dist/features/curator/dashboard/components/UserOrTeamChip.module.scss +5 -5
- package/dist/features/curator/dashboard/components/shared.css +1 -0
- package/dist/features/curator/dashboard/components/shared.module.js +5 -0
- package/dist/features/curator/dashboard/components/shared.module.js.map +1 -0
- package/dist/features/curator/dashboard/components/shared.module.scss +8 -0
- package/dist/features/entity/metadata-task/components/MetadataTaskTableActionCell.d.ts +0 -2
- package/dist/features/entity/metadata-task/components/MetadataTaskTableActionCell.d.ts.map +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTaskTableActionCell.js +16 -34
- package/dist/features/entity/metadata-task/components/MetadataTaskTableActionCell.js.map +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTasksTableAssigneeCell.d.ts.map +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTasksTableAssigneeCell.js +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTasksTableAssigneeCell.js.map +1 -1
- package/dist/features/entity/metadata-task/hooks/useGetOrCreateGridSessionForSource.js.map +1 -1
- package/dist/features/entity/metadata-task/hooks/useGridSessionForCurationTask.js.map +1 -1
- package/dist/features/entity/metadata-task/hooks/useGridSessionForCurationTask_legacy.js.map +1 -1
- package/dist/features/entity/metadata-task/hooks/useMetadataTaskTable.js +1 -1
- package/dist/features/entity/metadata-task/hooks/useMetadataTaskTable.js.map +1 -1
- package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.d.ts +10 -0
- package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.d.ts.map +1 -0
- package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.js +37 -0
- package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.js.map +1 -0
- package/dist/features/entity/metadata-task/utils/constants.d.ts +5 -0
- package/dist/features/entity/metadata-task/utils/constants.d.ts.map +1 -0
- package/dist/features/entity/metadata-task/utils/constants.js +6 -0
- package/dist/features/entity/metadata-task/utils/constants.js.map +1 -0
- package/dist/mocks/challenge/mockChallenge.js.map +1 -1
- package/dist/mocks/entity/mockDataset.js.map +1 -1
- package/dist/mocks/entity/mockDatasetCollection.js.map +1 -1
- package/dist/mocks/entity/mockFileEntity.js.map +1 -1
- package/dist/mocks/entity/mockFileView.js.map +1 -1
- package/dist/mocks/entity/mockGeneratedEntityData.js.map +1 -1
- package/dist/mocks/entity/mockProject.js.map +1 -1
- package/dist/mocks/entity/mockProjectView.js.map +1 -1
- package/dist/mocks/entity/mockRootEntity.js.map +1 -1
- package/dist/mocks/entity/mockTableEntity.js.map +1 -1
- package/dist/mocks/mockWiki.js.map +1 -1
- package/dist/mocks/msw/handlers/asyncJobHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/challengeHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/changePasswordHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/discussionHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/entityHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/fileHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/gridHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/personalAccessTokenHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/subscriptionHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/teamHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/userProfileHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/wikiHandlers.js.map +1 -1
- package/dist/mocks/provenance/mockActivity.js.map +1 -1
- package/dist/mocks/query/mockReleaseCardsTableQueryResultBundle.js.map +1 -1
- package/dist/ror-client/index.js.map +1 -1
- package/dist/style/components/_cards.scss +4 -0
- package/dist/style/components/_data-grid-extra.css +1 -1
- package/dist/style/components/_data-grid-extra.scss +2 -0
- package/dist/style/main.css +1 -1
- package/dist/synapse-client/HttpClient.js.map +1 -1
- package/dist/synapse-client/SynapseClient.js.map +1 -1
- package/dist/synapse-queries/KeyFactory.d.ts +1 -0
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +3 -0
- package/dist/synapse-queries/KeyFactory.js.map +1 -1
- package/dist/synapse-queries/QueryMatching.test-utils.js.map +1 -1
- package/dist/synapse-queries/auth/useTwoFactorEnrollment.js.map +1 -1
- package/dist/synapse-queries/curation/task/useCurationTask.d.ts +1 -1
- package/dist/synapse-queries/curation/task/useCurationTask.d.ts.map +1 -1
- package/dist/synapse-queries/curation/task/useCurationTask.js +1 -1
- package/dist/synapse-queries/curation/task/useCurationTask.js.map +1 -1
- package/dist/synapse-queries/dataaccess/useRestrictionInformation.js.map +1 -1
- package/dist/synapse-queries/doi/useDOI.js.map +1 -1
- package/dist/synapse-queries/download/useDownloadList.js.map +1 -1
- package/dist/synapse-queries/entity/useEntity.js.map +1 -1
- package/dist/synapse-queries/entity/useEntityBundle.js.map +1 -1
- package/dist/synapse-queries/entity/useExportTableQueryToAnalysisPlatform.js.map +1 -1
- package/dist/synapse-queries/entity/useExportToTerra.js.map +1 -1
- package/dist/synapse-queries/entity/useGetQueryResultBundle.js.map +1 -1
- package/dist/synapse-queries/entity/useSchema.js.map +1 -1
- package/dist/synapse-queries/file/UploadToS3.js.map +1 -1
- package/dist/synapse-queries/file/useDirectUploadToS3.js.map +1 -1
- package/dist/synapse-queries/file/useFiles.js.map +1 -1
- package/dist/synapse-queries/forum/useReply.js.map +1 -1
- package/dist/synapse-queries/forum/useThread.d.ts +1 -0
- package/dist/synapse-queries/forum/useThread.d.ts.map +1 -1
- package/dist/synapse-queries/forum/useThread.js +19 -12
- package/dist/synapse-queries/forum/useThread.js.map +1 -1
- package/dist/synapse-queries/grid/useEstablishWebsocketConnection.d.ts +2 -0
- package/dist/synapse-queries/grid/useEstablishWebsocketConnection.d.ts.map +1 -1
- package/dist/synapse-queries/grid/useEstablishWebsocketConnection.js.map +1 -1
- package/dist/synapse-queries/grid/useExportGrid.js.map +1 -1
- package/dist/synapse-queries/grid/useGridSession.js.map +1 -1
- package/dist/synapse-queries/grid/useImportCsvIntoGrid.js.map +1 -1
- package/dist/synapse-queries/subscription/useSubscription.js.map +1 -1
- package/dist/synapse-queries/table/useGetCsvPreview.js.map +1 -1
- package/dist/synapse-queries/table/useTableUpdateTransaction.js.map +1 -1
- package/dist/synapse-queries/team/useTeamMembers.js.map +1 -1
- package/dist/synapse-queries/user/useGetUserChallenges.js.map +1 -1
- package/dist/synapse-queries/user/useUserBundle.js.map +1 -1
- package/dist/synapse-queries/user/useUserGroupHeader.js.map +1 -1
- package/dist/testutils/ReactQueryMockUtils.js.map +1 -1
- package/dist/theme/ThemeProvider.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/AppUtils/session/ApplicationSessionManager.d.ts.map +1 -1
- package/dist/utils/AppUtils/session/ApplicationSessionManager.js +7 -4
- package/dist/utils/AppUtils/session/ApplicationSessionManager.js.map +1 -1
- package/dist/utils/AppUtils/session/SynapseSessionManager.js.map +1 -1
- package/dist/utils/AppUtils/session/useSessionManager.js.map +1 -1
- package/dist/utils/PermissionLevelToAccessType.js.map +1 -1
- package/dist/utils/challenge/evaluation/EvaluationUtils.js.map +1 -1
- package/dist/utils/context/SynapseContext.js.map +1 -1
- package/dist/utils/functions/AccessControlListUtils.d.ts +4 -0
- package/dist/utils/functions/AccessControlListUtils.d.ts.map +1 -1
- package/dist/utils/functions/AccessControlListUtils.js +12 -1
- package/dist/utils/functions/AccessControlListUtils.js.map +1 -1
- package/dist/utils/functions/EntityTypeUtils.d.ts.map +1 -1
- package/dist/utils/functions/EntityTypeUtils.js +15 -4
- package/dist/utils/functions/EntityTypeUtils.js.map +1 -1
- package/dist/utils/functions/GridApiUtils.js.map +1 -1
- package/dist/utils/functions/QueryFilterUtils.js.map +1 -1
- package/dist/utils/functions/RealmUtils.d.ts +4 -0
- package/dist/utils/functions/RealmUtils.d.ts.map +1 -1
- package/dist/utils/functions/RealmUtils.js +9 -3
- package/dist/utils/functions/RealmUtils.js.map +1 -1
- package/dist/utils/functions/SanitizeHtmlUtils.js.map +1 -1
- package/dist/utils/functions/SanitizeHtmlUtils.test-utils.js.map +1 -1
- package/dist/utils/functions/SqlFunctions.js.map +1 -1
- package/dist/utils/functions/StringUtils.js.map +1 -1
- package/dist/utils/functions/deepLinkingUtils.js.map +1 -1
- package/dist/utils/functions/getDataFromFromStorage.js.map +1 -1
- package/dist/utils/functions/getEndpoint.js.map +1 -1
- package/dist/utils/functions/getUserData.js.map +1 -1
- package/dist/utils/functions/queryUtils.js.map +1 -1
- package/dist/utils/functions/testDownloadSpeed.js.map +1 -1
- package/dist/utils/hooks/useConfirmItems.js.map +1 -1
- package/dist/utils/hooks/useCookiePreferences.js.map +1 -1
- package/dist/utils/hooks/useCreateShortUrl.js.map +1 -1
- package/dist/utils/hooks/useDetectSSOCode.js.map +1 -1
- package/dist/utils/hooks/useDirectDownloadHandler.js.map +1 -1
- package/dist/utils/hooks/useGetGoalData.js.map +1 -1
- package/dist/utils/hooks/useGetInfoFromIds.js.map +1 -1
- package/dist/utils/hooks/useImageUrlUtils.js.map +1 -1
- package/dist/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.js.map +1 -1
- package/dist/utils/hooks/useImmutableTableQuery/useTableQueryReducer.js.map +1 -1
- package/dist/utils/hooks/useIsBot.js.map +1 -1
- package/dist/utils/hooks/useListState.js.map +1 -1
- package/dist/utils/hooks/useLogin.d.ts.map +1 -1
- package/dist/utils/hooks/useLogin.js +53 -52
- package/dist/utils/hooks/useLogin.js.map +1 -1
- package/dist/utils/hooks/useMutuallyExclusiveState.js.map +1 -1
- package/dist/utils/hooks/useOverlay.js.map +1 -1
- package/dist/utils/hooks/usePreFetchResource.js.map +1 -1
- package/dist/utils/hooks/useQuerySearchParam.js.map +1 -1
- package/dist/utils/hooks/useScrollFadeTransition.js.map +1 -1
- package/dist/utils/hooks/useSet.js.map +1 -1
- package/dist/utils/hooks/useSourceAppConfigs.js.map +1 -1
- package/dist/utils/hooks/useTableImageUrl.js.map +1 -1
- package/dist/utils/hooks/useUploadFileEntity/useCreatePathsAndGetParentId.js.map +1 -1
- package/dist/utils/hooks/useUploadFileEntity/useLinkFileEntityToURL.js.map +1 -1
- package/dist/utils/hooks/useUploadFileEntity/usePrepareFileEntityUpload.js.map +1 -1
- package/dist/utils/hooks/useUploadFileEntity/useTrackFileUploads.js.map +1 -1
- package/dist/utils/hooks/useUploadFileEntity/useUploadFileEntities.js.map +1 -1
- package/dist/utils/hooks/useUploadFileEntity/useUploadFiles.js.map +1 -1
- package/dist/utils/hooks/useUploadFileEntity/willUploadsExceedStorageLimit.js.map +1 -1
- package/dist/utils/html/TargetEnum.js.map +1 -1
- package/dist/utils/jsonschema/SchemaAnnotationUtils.js.map +1 -1
- package/package.json +5 -5
|
@@ -3,41 +3,41 @@ import { BackendDestinationEnum as e, getEndpoint as t } from "../../utils/funct
|
|
|
3
3
|
import { getAccessTypeFromPermissionLevel as n, permissionLevelToLabel as r } from "../../utils/PermissionLevelToAccessType.js";
|
|
4
4
|
import { entityTypeToFriendlyName as i } from "../../utils/functions/EntityTypeUtils.js";
|
|
5
5
|
import "../../utils/functions/index.js";
|
|
6
|
-
import
|
|
7
|
-
import { SynapseErrorBoundary as
|
|
8
|
-
import { useGetRealmPrincipals as
|
|
9
|
-
import { useSuspenseGetEntityBundle as
|
|
10
|
-
import { useCreateEntityACL as te, useDeleteEntityACL as ne, useSuspenseGetEntityBenefactorACL as
|
|
11
|
-
import { useSuspenseGetCurrentUserProfile as
|
|
6
|
+
import a from "../FullWidthAlert/index.js";
|
|
7
|
+
import { SynapseErrorBoundary as o } from "../error/ErrorBanner.js";
|
|
8
|
+
import { useGetRealmPrincipals as s } from "../../synapse-queries/realm/useRealmPrincipals.js";
|
|
9
|
+
import { useSuspenseGetEntityBundle as ee } from "../../synapse-queries/entity/useEntityBundle.js";
|
|
10
|
+
import { useCreateEntityACL as te, useDeleteEntityACL as ne, useSuspenseGetEntityBenefactorACL as re, useUpdateEntityACL as ie } from "../../synapse-queries/entity/useEntity.js";
|
|
11
|
+
import { useSuspenseGetCurrentUserProfile as ae } from "../../synapse-queries/user/useUserBundle.js";
|
|
12
12
|
import "../../synapse-queries/index.js";
|
|
13
|
-
import { isEntityPublic as
|
|
14
|
-
import { getPrincipalDisplayName as
|
|
13
|
+
import { consolidateResourceAccessList as oe, isEntityPublic as c, resourceAccessListIsEqual as l } from "../../utils/functions/AccessControlListUtils.js";
|
|
14
|
+
import { getPrincipalDisplayName as u } from "../../utils/functions/getPrincipalDisplayName.js";
|
|
15
15
|
import "../error/index.js";
|
|
16
|
-
import { AclEditorSkeleton as
|
|
17
|
-
import { AclEditor as
|
|
18
|
-
import
|
|
19
|
-
import { CreateOrDeleteLocalSharingSettingsButton as
|
|
20
|
-
import { InheritanceMessage as
|
|
16
|
+
import { AclEditorSkeleton as d } from "../AclEditor/AclEditorSkeleton.js";
|
|
17
|
+
import { AclEditor as f } from "../AclEditor/AclEditor.js";
|
|
18
|
+
import p from "../AclEditor/useUpdateAcl.js";
|
|
19
|
+
import { CreateOrDeleteLocalSharingSettingsButton as m } from "./CreateOrDeleteLocalSharingSettingsButton.js";
|
|
20
|
+
import { InheritanceMessage as h } from "./InheritanceMessage.js";
|
|
21
21
|
import g from "./OpenData.js";
|
|
22
22
|
import _ from "./useNotifyNewACLUsers.js";
|
|
23
|
-
import { Suspense as v, forwardRef as y, useEffect as b, useImperativeHandle as
|
|
24
|
-
import { Alert as
|
|
25
|
-
import { Fragment as
|
|
26
|
-
import { ALL_ENTITY_BUNDLE_FIELDS as
|
|
27
|
-
import { EntityType as
|
|
23
|
+
import { Suspense as v, forwardRef as y, useEffect as b, useImperativeHandle as se, useMemo as x, useState as S } from "react";
|
|
24
|
+
import { Alert as ce, Link as le, Stack as ue } from "@mui/material";
|
|
25
|
+
import { Fragment as de, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
26
|
+
import { ALL_ENTITY_BUNDLE_FIELDS as fe } from "@sage-bionetworks/synapse-types";
|
|
27
|
+
import { EntityType as pe } from "@sage-bionetworks/synapse-client";
|
|
28
28
|
//#region src/components/EntityAclEditor/EntityAclEditor.tsx
|
|
29
|
-
var
|
|
29
|
+
var me = [
|
|
30
30
|
"CAN_VIEW",
|
|
31
31
|
"CAN_DOWNLOAD",
|
|
32
32
|
"CAN_EDIT",
|
|
33
33
|
"CAN_EDIT_DELETE",
|
|
34
34
|
"CAN_ADMINISTER"
|
|
35
35
|
];
|
|
36
|
-
function
|
|
36
|
+
function T(e) {
|
|
37
37
|
return `${e} (shared on Synapse)`;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return `${
|
|
39
|
+
function E(n, r) {
|
|
40
|
+
return `${u({
|
|
41
41
|
userName: n.userName ?? "",
|
|
42
42
|
firstName: n.firstName,
|
|
43
43
|
lastName: n.lastName
|
|
@@ -46,105 +46,105 @@ function D(n, r) {
|
|
|
46
46
|
showUsername: !1
|
|
47
47
|
})} has shared an item with you on Synapse:\n${t(e.PORTAL_ENDPOINT)}Synapse:${r}`;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function D(e, t, n, r) {
|
|
50
50
|
return !e || t ? !1 : (e) => {
|
|
51
51
|
let t = n.ownerId === String(e.principalId), i = r !== void 0 && String(e.principalId) === r;
|
|
52
52
|
return !(t || i);
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function O(e, t, n) {
|
|
56
56
|
return !e || t ? !1 : (t) => n.ownerId === String(t.principalId) ? !1 : e;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function k(e, t) {
|
|
59
59
|
return (n) => {
|
|
60
60
|
if (t !== void 0 && String(n.principalId) === t) return e ? r.CAN_DOWNLOAD : r.CAN_VIEW;
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
var
|
|
64
|
-
let { entityId: r, onCanSaveChange:
|
|
63
|
+
var A = y(function(e, t) {
|
|
64
|
+
let { entityId: r, onCanSaveChange: o, onUpdateSuccess: u, isAfterUpload: d = !1 } = e, { data: v } = ae(), { data: y } = s(), { publicGroup: A } = y || {}, { data: j } = ee(r, void 0, fe, { staleTime: Infinity }), M = pe.project == j.entityType, { data: N } = re(j.entity.parentId, { staleTime: Infinity }), P = x(() => oe(j.benefactorAcl.resourceAccess), [j.benefactorAcl.resourceAccess]), F = x(() => N?.resourceAccess ?? [], [N]), I = j.permissions.canChangePermissions, L = j.permissions.isEntityOpenData, R = j.benefactorAcl.id != r, [z, B] = S(R), [V, he] = S(!1), [H, ge] = S(), { resourceAccessList: U, setResourceAccessList: W, addResourceAccessItem: G, updateResourceAccessItem: _e, removeResourceAccessItem: ve, resetDirtyState: K } = p({ initialResourceAccessList: P });
|
|
65
65
|
b(() => {
|
|
66
|
-
|
|
66
|
+
P && (K(), W([...P]));
|
|
67
67
|
}, [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
P,
|
|
69
|
+
K,
|
|
70
|
+
W
|
|
71
71
|
]), b(() => {
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
|
|
72
|
+
K(), B(R);
|
|
73
|
+
}, [R, K]), b(() => {
|
|
74
|
+
R == z ? W(P) : z && W(F), K();
|
|
75
75
|
}, [
|
|
76
|
-
|
|
76
|
+
R,
|
|
77
|
+
P,
|
|
77
78
|
F,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
B
|
|
79
|
+
K,
|
|
80
|
+
W,
|
|
81
|
+
z
|
|
82
82
|
]);
|
|
83
|
-
let
|
|
84
|
-
subject:
|
|
85
|
-
body:
|
|
86
|
-
initialResourceAccessList:
|
|
87
|
-
newResourceAccessList:
|
|
88
|
-
}),
|
|
83
|
+
let ye = c(U, y ?? {}), { sendNotification: be, isLoading: xe, isPending: Se } = _({
|
|
84
|
+
subject: T(j.entity.name || ""),
|
|
85
|
+
body: E(v, r),
|
|
86
|
+
initialResourceAccessList: P,
|
|
87
|
+
newResourceAccessList: U
|
|
88
|
+
}), q = {
|
|
89
89
|
onSuccess: () => {
|
|
90
|
-
|
|
90
|
+
V && be(), u();
|
|
91
91
|
},
|
|
92
92
|
onError: (e) => {
|
|
93
|
-
|
|
93
|
+
ge(e);
|
|
94
94
|
}
|
|
95
|
-
}, { mutate:
|
|
96
|
-
|
|
95
|
+
}, { mutate: J, isPending: Ce } = te(q), { mutate: Y, isPending: we } = ie(q), { mutate: X, isPending: Te } = ne(q), Z = Ce || we || Te || Se, Q = x(() => R != z || !l(P, U), [
|
|
96
|
+
P,
|
|
97
|
+
R,
|
|
97
98
|
z,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
]), $ = Q || ye || we, Te = Q && m;
|
|
99
|
+
U
|
|
100
|
+
]), $ = Q || xe || Z, Ee = Q && d;
|
|
101
101
|
return b(() => {
|
|
102
|
-
|
|
103
|
-
}, [
|
|
104
|
-
$ ?
|
|
105
|
-
...
|
|
106
|
-
resourceAccess:
|
|
107
|
-
}) :
|
|
102
|
+
o($);
|
|
103
|
+
}, [o, $]), se(t, () => ({ save() {
|
|
104
|
+
$ ? R == z ? Y({
|
|
105
|
+
...j.accessControlList,
|
|
106
|
+
resourceAccess: U
|
|
107
|
+
}) : z ? X(r) : J({
|
|
108
108
|
id: r,
|
|
109
|
-
resourceAccess:
|
|
109
|
+
resourceAccess: U
|
|
110
110
|
}) : console.error("EntityAclEditor: save() called but canSave is false");
|
|
111
111
|
} }), [
|
|
112
112
|
$,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
J,
|
|
114
|
+
X,
|
|
115
|
+
j,
|
|
116
116
|
r,
|
|
117
|
+
R,
|
|
118
|
+
Y,
|
|
117
119
|
z,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
W
|
|
121
|
-
]), /* @__PURE__ */ E(se, {
|
|
120
|
+
U
|
|
121
|
+
]), /* @__PURE__ */ w(ue, {
|
|
122
122
|
sx: { gap: 2 },
|
|
123
123
|
children: [
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
isOpenData:
|
|
126
|
-
isPublic:
|
|
127
|
-
currentUserCanUpdateSharingSettings:
|
|
124
|
+
/* @__PURE__ */ C(g, {
|
|
125
|
+
isOpenData: L,
|
|
126
|
+
isPublic: ye,
|
|
127
|
+
currentUserCanUpdateSharingSettings: I
|
|
128
128
|
}),
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
isProject:
|
|
131
|
-
isInherited:
|
|
132
|
-
benefactorId:
|
|
133
|
-
isAfterUpload:
|
|
129
|
+
/* @__PURE__ */ C(h, {
|
|
130
|
+
isProject: M,
|
|
131
|
+
isInherited: z,
|
|
132
|
+
benefactorId: z ? N?.id : r,
|
|
133
|
+
isAfterUpload: d
|
|
134
134
|
}),
|
|
135
|
-
|
|
135
|
+
Ee && /* @__PURE__ */ C(a, {
|
|
136
136
|
isGlobal: !1,
|
|
137
137
|
variant: "warning",
|
|
138
|
-
title: `Edits will affect settings of entire ${i(
|
|
139
|
-
description: /* @__PURE__ */
|
|
138
|
+
title: `Edits will affect settings of entire ${i(j?.entityType).toLowerCase()}.`,
|
|
139
|
+
description: /* @__PURE__ */ w(de, { children: [/* @__PURE__ */ w("p", { children: [
|
|
140
140
|
"Editing the settings here will impact the sharing settings for all files and folders within this",
|
|
141
141
|
" ",
|
|
142
|
-
i(
|
|
142
|
+
i(j?.entityType).toLowerCase(),
|
|
143
143
|
", not just the ones you've recently uploaded."
|
|
144
|
-
] }), /* @__PURE__ */
|
|
144
|
+
] }), /* @__PURE__ */ w("p", { children: [
|
|
145
145
|
"View the instructions above for setting your",
|
|
146
146
|
" ",
|
|
147
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ C(le, {
|
|
148
148
|
href: "https://docs.synapse.org/synapse-docs/sharing-settings-permissions-and-conditions-for-use",
|
|
149
149
|
target: "_blank",
|
|
150
150
|
children: "Local Sharing Settings"
|
|
@@ -152,44 +152,44 @@ var j = y(function(e, t) {
|
|
|
152
152
|
"."
|
|
153
153
|
] })] })
|
|
154
154
|
}),
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
isInherited:
|
|
157
|
-
canEdit:
|
|
158
|
-
canRemoveEntry:
|
|
159
|
-
resourceAccessList:
|
|
160
|
-
availablePermissionLevels:
|
|
155
|
+
/* @__PURE__ */ C(f, {
|
|
156
|
+
isInherited: z,
|
|
157
|
+
canEdit: D(I, z, v, A),
|
|
158
|
+
canRemoveEntry: O(I, z, v),
|
|
159
|
+
resourceAccessList: U,
|
|
160
|
+
availablePermissionLevels: me,
|
|
161
161
|
emptyText: "",
|
|
162
|
-
displayedPermissionLevelOverride:
|
|
162
|
+
displayedPermissionLevelOverride: k(L, A),
|
|
163
163
|
onAddPrincipalToAcl: (e) => {
|
|
164
|
-
|
|
164
|
+
A !== void 0 && String(e) === A ? G(e, n("CAN_VIEW")) : G(e, n("CAN_DOWNLOAD"));
|
|
165
165
|
},
|
|
166
|
-
updateResourceAccessItem:
|
|
167
|
-
removeResourceAccessItem:
|
|
166
|
+
updateResourceAccessItem: _e,
|
|
167
|
+
removeResourceAccessItem: ve,
|
|
168
168
|
showNotifyCheckbox: !0,
|
|
169
|
-
notifyCheckboxValue:
|
|
170
|
-
onNotifyCheckboxChange:
|
|
169
|
+
notifyCheckboxValue: V,
|
|
170
|
+
onNotifyCheckboxChange: he,
|
|
171
171
|
showAddRemovePublicButton: !0
|
|
172
172
|
}),
|
|
173
|
-
!
|
|
174
|
-
isInherited:
|
|
175
|
-
setIsInherited:
|
|
173
|
+
!d && !M && j.permissions.canEnableInheritance && /* @__PURE__ */ C(m, {
|
|
174
|
+
isInherited: z,
|
|
175
|
+
setIsInherited: B
|
|
176
176
|
}),
|
|
177
|
-
|
|
177
|
+
H && /* @__PURE__ */ C(ce, {
|
|
178
178
|
severity: "error",
|
|
179
|
-
children:
|
|
179
|
+
children: H.message
|
|
180
180
|
})
|
|
181
181
|
]
|
|
182
182
|
});
|
|
183
|
-
}),
|
|
184
|
-
return /* @__PURE__ */
|
|
185
|
-
fallback: /* @__PURE__ */
|
|
186
|
-
children: /* @__PURE__ */
|
|
183
|
+
}), j = y(function(e, t) {
|
|
184
|
+
return /* @__PURE__ */ C(o, { children: /* @__PURE__ */ C(v, {
|
|
185
|
+
fallback: /* @__PURE__ */ C(d, {}),
|
|
186
|
+
children: /* @__PURE__ */ C(A, {
|
|
187
187
|
...e,
|
|
188
188
|
ref: t
|
|
189
189
|
})
|
|
190
190
|
}) });
|
|
191
191
|
});
|
|
192
192
|
//#endregion
|
|
193
|
-
export {
|
|
193
|
+
export { j as default };
|
|
194
194
|
|
|
195
195
|
//# sourceMappingURL=EntityAclEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityAclEditor.js","names":[],"sources":["../../../src/components/EntityAclEditor/EntityAclEditor.tsx"],"sourcesContent":["import {\n useCreateEntityACL,\n useDeleteEntityACL,\n useSuspenseGetCurrentUserProfile,\n useSuspenseGetEntityBenefactorACL,\n useSuspenseGetEntityBundle,\n useUpdateEntityACL,\n} from '@/synapse-queries'\nimport { useGetRealmPrincipals } from '@/synapse-queries/realm/useRealmPrincipals'\nimport { BackendDestinationEnum, getEndpoint } from '@/utils/functions'\nimport {\n isEntityPublic,\n resourceAccessListIsEqual,\n} from '@/utils/functions/AccessControlListUtils'\nimport { getPrincipalDisplayName } from '@/utils/functions/getPrincipalDisplayName'\nimport { entityTypeToFriendlyName } from '@/utils/functions/EntityTypeUtils'\nimport {\n getAccessTypeFromPermissionLevel,\n PermissionLevel,\n permissionLevelToLabel,\n} from '@/utils/PermissionLevelToAccessType'\nimport { SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL } from '@/utils/SynapseConstants'\nimport { Alert, Link, Stack } from '@mui/material'\nimport { EntityType } from '@sage-bionetworks/synapse-client'\nimport {\n ALL_ENTITY_BUNDLE_FIELDS,\n ResourceAccess,\n UserProfile,\n} from '@sage-bionetworks/synapse-types'\nimport {\n ForwardedRef,\n forwardRef,\n Suspense,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react'\nimport { AclEditor, AclEditorProps } from '../AclEditor/AclEditor'\nimport { AclEditorSkeleton } from '../AclEditor/AclEditorSkeleton'\nimport useUpdateAcl from '../AclEditor/useUpdateAcl'\nimport { SynapseErrorBoundary } from '../error'\nimport FullWidthAlert from '../FullWidthAlert'\nimport { CreateOrDeleteLocalSharingSettingsButton } from './CreateOrDeleteLocalSharingSettingsButton'\nimport { InheritanceMessage } from './InheritanceMessage'\nimport OpenData from './OpenData'\nimport useNotifyNewACLUsers from './useNotifyNewACLUsers'\n\nconst availablePermissionLevels: PermissionLevel[] = [\n 'CAN_VIEW',\n 'CAN_DOWNLOAD',\n 'CAN_EDIT',\n 'CAN_EDIT_DELETE',\n 'CAN_ADMINISTER',\n]\n\nexport type EntityAclEditorProps = {\n /** The ID of the entity on which to view/edit the ACL. Note that the ACL may actually belong to an entity ancestor (benefactor). */\n entityId: string\n /** Invoked when the user can/cannot save the pending changes. */\n onCanSaveChange: (canSaveChanges: boolean) => void\n /** Invoked when changes are successfully made. */\n onUpdateSuccess: () => void\n /** Special case to show specific copy and allow changes to an inherited ACL immediately after a file is uploaded.\n * Note that if this is true, the entityId should be the ID of the folder or project that is the benefactor of the newly uploaded file(s)\n * @defaultValue false */\n isAfterUpload?: boolean\n}\n\nexport type EntityAclEditorHandle = {\n save: () => void\n}\n\nfunction getSubject(entityName: string) {\n return `${entityName} (shared on Synapse)`\n}\n\nfunction getBody(profile: UserProfile, entityId: string) {\n return `${getPrincipalDisplayName(\n {\n userName: profile.userName ?? '',\n firstName: profile.firstName,\n lastName: profile.lastName,\n },\n { showFullName: true, showUsername: false },\n )} has shared an item with you on Synapse:\\n${getEndpoint(\n BackendDestinationEnum.PORTAL_ENDPOINT,\n )}Synapse:${entityId}`\n}\n\nfunction getCanEditResourceAccess(\n canEdit: boolean,\n isInherited: boolean,\n ownProfile: UserProfile,\n publicGroupId: string | undefined,\n): AclEditorProps['canEdit'] {\n if (!canEdit || isInherited) {\n return false\n }\n return (resourceAccess: ResourceAccess): boolean => {\n // Users cannot change their own permissions\n const isSelf = ownProfile.ownerId === String(resourceAccess.principalId)\n // Users cannot change permission level for the public group, only add/remove it.\n // To give the public group DOWNLOAD access, ACT must mark it as anonymous access.\n const isPublicGroup =\n publicGroupId !== undefined &&\n String(resourceAccess.principalId) === publicGroupId\n if (isSelf || isPublicGroup) {\n return false\n }\n return true\n }\n}\n\nfunction getCanDeleteResourceAccess(\n canEdit: boolean,\n isInherited: boolean,\n ownProfile: UserProfile,\n): AclEditorProps['canRemoveEntry'] {\n if (!canEdit || isInherited) {\n return false\n }\n return (resourceAccess: ResourceAccess): boolean => {\n // Users cannot delete their own permissions\n const isSelf = ownProfile.ownerId === String(resourceAccess.principalId)\n if (isSelf) {\n return false\n }\n return canEdit\n }\n}\n\nfunction getDisplayedPermissionLevelOverride(\n isOpenData: boolean,\n publicGroupId: string | undefined,\n): AclEditorProps['displayedPermissionLevelOverride'] {\n return (resourceAccess: ResourceAccess) => {\n if (\n publicGroupId !== undefined &&\n String(resourceAccess.principalId) === publicGroupId\n ) {\n return isOpenData\n ? permissionLevelToLabel['CAN_DOWNLOAD']\n : permissionLevelToLabel['CAN_VIEW']\n }\n return undefined\n }\n}\n\nconst EntityAclEditor = forwardRef(function EntityAclEditor(\n props: EntityAclEditorProps,\n ref: ForwardedRef<EntityAclEditorHandle>,\n) {\n const {\n entityId,\n onCanSaveChange,\n onUpdateSuccess,\n isAfterUpload = false,\n } = props\n\n const { data: ownProfile } = useSuspenseGetCurrentUserProfile()\n const { data: realmPrincipals } = useGetRealmPrincipals()\n const { publicGroup: publicGroupId } = realmPrincipals || {}\n const { data: entityBundle } = useSuspenseGetEntityBundle(\n entityId,\n undefined,\n ALL_ENTITY_BUNDLE_FIELDS,\n { staleTime: Infinity },\n )\n const isProject = EntityType.project == entityBundle.entityType\n\n // The parent's benefactor ACL will be shown if the user removes the ACL on the current entity\n const { data: parentAcl } = useSuspenseGetEntityBenefactorACL(\n entityBundle.entity.parentId!,\n {\n staleTime: Infinity,\n },\n )\n\n const originalResourceAccess = entityBundle.benefactorAcl.resourceAccess\n const parentResourceAccess = useMemo(\n () => parentAcl?.resourceAccess ?? [],\n [parentAcl],\n )\n const canEdit = entityBundle.permissions.canChangePermissions\n const isOpenData = entityBundle.permissions.isEntityOpenData\n const originalIsInherited = !(entityBundle.benefactorAcl.id == entityId)\n const [updatedIsInherited, setUpdatedIsInherited] =\n useState(originalIsInherited)\n const [notifyNewAdditions, setNotifyNewAdditions] = useState(false)\n const [error, setError] = useState<Error>()\n\n const {\n resourceAccessList: updatedResourceAccessList,\n setResourceAccessList,\n addResourceAccessItem,\n updateResourceAccessItem,\n removeResourceAccessItem,\n resetDirtyState,\n } = useUpdateAcl({ initialResourceAccessList: originalResourceAccess })\n\n // If `originalResourceAccess` changes, reset state\n useEffect(() => {\n if (originalResourceAccess) {\n resetDirtyState()\n setResourceAccessList([...originalResourceAccess])\n }\n }, [originalResourceAccess, resetDirtyState, setResourceAccessList])\n\n // If `originalIsInherited` changes, reset state\n useEffect(() => {\n resetDirtyState()\n setUpdatedIsInherited(originalIsInherited)\n }, [originalIsInherited, resetDirtyState])\n\n // If the editor toggles the inherited state, reset the resource access list\n useEffect(() => {\n if (originalIsInherited == updatedIsInherited) {\n // The user reverted to the original state (regardless of inherited or not)\n setResourceAccessList(originalResourceAccess)\n } else if (updatedIsInherited) {\n // The user toggled to inherited, update the resource access list to match the parent\n setResourceAccessList(parentResourceAccess)\n } else {\n // The user toggled to local, no need to update the list (the parent's list is already in the editor)\n }\n resetDirtyState()\n }, [\n originalIsInherited,\n originalResourceAccess,\n parentResourceAccess,\n resetDirtyState,\n setResourceAccessList,\n updatedIsInherited,\n ])\n\n const isPublic = isEntityPublic(\n updatedResourceAccessList,\n realmPrincipals ?? {},\n )\n\n const {\n sendNotification,\n isLoading: isLoadingSendMessageToNewACLUsers,\n isPending: isPendingSendMessageToNewACLUsers,\n } = useNotifyNewACLUsers({\n subject: getSubject(entityBundle.entity.name || ''),\n body: getBody(ownProfile, entityId),\n initialResourceAccessList: originalResourceAccess,\n newResourceAccessList: updatedResourceAccessList,\n })\n\n const mutationOptions = {\n onSuccess: () => {\n if (notifyNewAdditions) {\n sendNotification()\n }\n onUpdateSuccess()\n },\n onError: (e: Error) => {\n setError(e)\n },\n }\n\n const { mutate: createAcl, isPending: isPendingCreateAcl } =\n useCreateEntityACL(mutationOptions)\n const { mutate: updateAcl, isPending: isPendingUpdateAcl } =\n useUpdateEntityACL(mutationOptions)\n const { mutate: deleteAcl, isPending: isPendingDeleteAcl } =\n useDeleteEntityACL(mutationOptions)\n\n const isPending =\n isPendingCreateAcl ||\n isPendingUpdateAcl ||\n isPendingDeleteAcl ||\n isPendingSendMessageToNewACLUsers\n\n const hasAclChanged = useMemo(() => {\n return (\n originalIsInherited != updatedIsInherited ||\n !resourceAccessListIsEqual(\n originalResourceAccess,\n updatedResourceAccessList,\n )\n )\n }, [\n originalResourceAccess,\n originalIsInherited,\n updatedIsInherited,\n updatedResourceAccessList,\n ])\n\n const canSave =\n hasAclChanged || isLoadingSendMessageToNewACLUsers || isPending\n\n const showInheritedAclUpdateWarning = hasAclChanged && isAfterUpload\n\n useEffect(() => {\n onCanSaveChange(canSave)\n }, [onCanSaveChange, canSave])\n\n useImperativeHandle(\n ref,\n () => {\n return {\n save() {\n if (canSave) {\n // Check if the inheritance changed; if so, the ACL should be created/deleted\n if (originalIsInherited != updatedIsInherited) {\n if (updatedIsInherited) {\n deleteAcl(entityId)\n } else {\n createAcl({\n id: entityId,\n resourceAccess: updatedResourceAccessList,\n })\n }\n } else {\n // Inheritance did not change; update the ACL\n updateAcl({\n // ensure we get all fields from the original ACL, including the etag\n ...entityBundle.accessControlList!,\n resourceAccess: updatedResourceAccessList,\n })\n }\n } else {\n console.error('EntityAclEditor: save() called but canSave is false')\n }\n },\n }\n },\n [\n canSave,\n createAcl,\n deleteAcl,\n entityBundle,\n entityId,\n originalIsInherited,\n updateAcl,\n updatedIsInherited,\n updatedResourceAccessList,\n ],\n )\n\n return (\n <Stack\n sx={{\n gap: 2,\n }}\n >\n <OpenData\n isOpenData={isOpenData}\n isPublic={isPublic}\n currentUserCanUpdateSharingSettings={canEdit}\n />\n <InheritanceMessage\n isProject={isProject}\n isInherited={updatedIsInherited}\n benefactorId={updatedIsInherited ? parentAcl?.id : entityId}\n isAfterUpload={isAfterUpload}\n />\n {showInheritedAclUpdateWarning && (\n <FullWidthAlert\n isGlobal={false}\n variant={'warning'}\n title={`Edits will affect settings of entire ${entityTypeToFriendlyName(\n entityBundle?.entityType,\n ).toLowerCase()}.`}\n description={\n <>\n <p>\n Editing the settings here will impact the sharing settings for\n all files and folders within this{' '}\n {entityTypeToFriendlyName(\n entityBundle?.entityType,\n ).toLowerCase()}\n , not just the ones you've recently uploaded.\n </p>\n <p>\n View the instructions above for setting your{' '}\n <Link\n href={\n SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL\n }\n target={'_blank'}\n >\n Local Sharing Settings\n </Link>\n .\n </p>\n </>\n }\n />\n )}\n <AclEditor\n isInherited={updatedIsInherited}\n canEdit={getCanEditResourceAccess(\n canEdit,\n updatedIsInherited,\n ownProfile,\n publicGroupId,\n )}\n canRemoveEntry={getCanDeleteResourceAccess(\n canEdit,\n updatedIsInherited,\n ownProfile,\n )}\n resourceAccessList={updatedResourceAccessList}\n availablePermissionLevels={availablePermissionLevels}\n emptyText={/* This should never happen */ ''}\n displayedPermissionLevelOverride={getDisplayedPermissionLevelOverride(\n isOpenData,\n publicGroupId,\n )}\n onAddPrincipalToAcl={id => {\n if (publicGroupId !== undefined && String(id) === publicGroupId) {\n addResourceAccessItem(\n id,\n getAccessTypeFromPermissionLevel('CAN_VIEW'),\n )\n } else {\n addResourceAccessItem(\n id,\n getAccessTypeFromPermissionLevel('CAN_DOWNLOAD'),\n )\n }\n }}\n updateResourceAccessItem={updateResourceAccessItem}\n removeResourceAccessItem={removeResourceAccessItem}\n showNotifyCheckbox={true}\n notifyCheckboxValue={notifyNewAdditions}\n onNotifyCheckboxChange={setNotifyNewAdditions}\n showAddRemovePublicButton={true}\n />\n {/* Create / delete local sharing settings button */}\n {!isAfterUpload &&\n !isProject &&\n entityBundle.permissions.canEnableInheritance && (\n <CreateOrDeleteLocalSharingSettingsButton\n isInherited={updatedIsInherited}\n setIsInherited={setUpdatedIsInherited}\n />\n )}\n {error && <Alert severity=\"error\">{error.message}</Alert>}\n </Stack>\n )\n})\n\nconst EntityAclEditorWithSuspense = forwardRef(\n function EntityAclEditorWithSuspense(\n props: EntityAclEditorProps,\n ref: ForwardedRef<EntityAclEditorHandle>,\n ) {\n return (\n <SynapseErrorBoundary>\n <Suspense fallback={<AclEditorSkeleton />}>\n <EntityAclEditor {...props} ref={ref} />\n </Suspense>\n </SynapseErrorBoundary>\n )\n },\n)\n\nexport default EntityAclEditorWithSuspense\n"],"mappings":";;;;;;;;;;;;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AAG,KAAK,IAChD,EACE,GACA,EAAiC,WAAW,CAC7C,GAED,EACE,GACA,EAAiC,eAAe,CACjD;;IAGqB;IACA;IAC1B,oBAAoB;IACpB,qBAAqB;IACrB,wBAAwB;IACxB,2BAA2B;IAC3B,CAAA;GAED,CAAC,KACA,CAAC,KACD,EAAa,YAAY,wBACvB,kBAAC,GAAD;IACE,aAAa;IACb,gBAAgB;IAChB,CAAA;GAEL,KAAS,kBAAC,GAAD;IAAO,UAAS;cAAS,EAAM;IAAgB,CAAA;GACnD;;EAEV,EAEI,IAA8B,EAClC,SACE,GACA,GACA;AACA,QACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAU,UAAU,kBAAC,GAAD,EAAqB,CAAA;YACvC,kBAAC,GAAD;GAAiB,GAAI;GAAY;GAAO,CAAA;EAC/B,CAAA,EACU,CAAA;EAG5B"}
|
|
1
|
+
{"version":3,"file":"EntityAclEditor.js","names":[],"sources":["../../../src/components/EntityAclEditor/EntityAclEditor.tsx"],"sourcesContent":["import {\n useCreateEntityACL,\n useDeleteEntityACL,\n useSuspenseGetCurrentUserProfile,\n useSuspenseGetEntityBenefactorACL,\n useSuspenseGetEntityBundle,\n useUpdateEntityACL,\n} from '@/synapse-queries'\nimport { useGetRealmPrincipals } from '@/synapse-queries/realm/useRealmPrincipals'\nimport { BackendDestinationEnum, getEndpoint } from '@/utils/functions'\nimport {\n consolidateResourceAccessList,\n isEntityPublic,\n resourceAccessListIsEqual,\n} from '@/utils/functions/AccessControlListUtils'\nimport { getPrincipalDisplayName } from '@/utils/functions/getPrincipalDisplayName'\nimport { entityTypeToFriendlyName } from '@/utils/functions/EntityTypeUtils'\nimport {\n getAccessTypeFromPermissionLevel,\n PermissionLevel,\n permissionLevelToLabel,\n} from '@/utils/PermissionLevelToAccessType'\nimport { SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL } from '@/utils/SynapseConstants'\nimport { Alert, Link, Stack } from '@mui/material'\nimport { EntityType } from '@sage-bionetworks/synapse-client'\nimport {\n ALL_ENTITY_BUNDLE_FIELDS,\n ResourceAccess,\n UserProfile,\n} from '@sage-bionetworks/synapse-types'\nimport {\n ForwardedRef,\n forwardRef,\n Suspense,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react'\nimport { AclEditor, AclEditorProps } from '../AclEditor/AclEditor'\nimport { AclEditorSkeleton } from '../AclEditor/AclEditorSkeleton'\nimport useUpdateAcl from '../AclEditor/useUpdateAcl'\nimport { SynapseErrorBoundary } from '../error'\nimport FullWidthAlert from '../FullWidthAlert'\nimport { CreateOrDeleteLocalSharingSettingsButton } from './CreateOrDeleteLocalSharingSettingsButton'\nimport { InheritanceMessage } from './InheritanceMessage'\nimport OpenData from './OpenData'\nimport useNotifyNewACLUsers from './useNotifyNewACLUsers'\n\nconst availablePermissionLevels: PermissionLevel[] = [\n 'CAN_VIEW',\n 'CAN_DOWNLOAD',\n 'CAN_EDIT',\n 'CAN_EDIT_DELETE',\n 'CAN_ADMINISTER',\n]\n\nexport type EntityAclEditorProps = {\n /** The ID of the entity on which to view/edit the ACL. Note that the ACL may actually belong to an entity ancestor (benefactor). */\n entityId: string\n /** Invoked when the user can/cannot save the pending changes. */\n onCanSaveChange: (canSaveChanges: boolean) => void\n /** Invoked when changes are successfully made. */\n onUpdateSuccess: () => void\n /** Special case to show specific copy and allow changes to an inherited ACL immediately after a file is uploaded.\n * Note that if this is true, the entityId should be the ID of the folder or project that is the benefactor of the newly uploaded file(s)\n * @defaultValue false */\n isAfterUpload?: boolean\n}\n\nexport type EntityAclEditorHandle = {\n save: () => void\n}\n\nfunction getSubject(entityName: string) {\n return `${entityName} (shared on Synapse)`\n}\n\nfunction getBody(profile: UserProfile, entityId: string) {\n return `${getPrincipalDisplayName(\n {\n userName: profile.userName ?? '',\n firstName: profile.firstName,\n lastName: profile.lastName,\n },\n { showFullName: true, showUsername: false },\n )} has shared an item with you on Synapse:\\n${getEndpoint(\n BackendDestinationEnum.PORTAL_ENDPOINT,\n )}Synapse:${entityId}`\n}\n\nfunction getCanEditResourceAccess(\n canEdit: boolean,\n isInherited: boolean,\n ownProfile: UserProfile,\n publicGroupId: string | undefined,\n): AclEditorProps['canEdit'] {\n if (!canEdit || isInherited) {\n return false\n }\n return (resourceAccess: ResourceAccess): boolean => {\n // Users cannot change their own permissions\n const isSelf = ownProfile.ownerId === String(resourceAccess.principalId)\n // Users cannot change permission level for the public group, only add/remove it.\n // To give the public group DOWNLOAD access, ACT must mark it as anonymous access.\n const isPublicGroup =\n publicGroupId !== undefined &&\n String(resourceAccess.principalId) === publicGroupId\n if (isSelf || isPublicGroup) {\n return false\n }\n return true\n }\n}\n\nfunction getCanDeleteResourceAccess(\n canEdit: boolean,\n isInherited: boolean,\n ownProfile: UserProfile,\n): AclEditorProps['canRemoveEntry'] {\n if (!canEdit || isInherited) {\n return false\n }\n return (resourceAccess: ResourceAccess): boolean => {\n // Users cannot delete their own permissions\n const isSelf = ownProfile.ownerId === String(resourceAccess.principalId)\n if (isSelf) {\n return false\n }\n return canEdit\n }\n}\n\nfunction getDisplayedPermissionLevelOverride(\n isOpenData: boolean,\n publicGroupId: string | undefined,\n): AclEditorProps['displayedPermissionLevelOverride'] {\n return (resourceAccess: ResourceAccess) => {\n if (\n publicGroupId !== undefined &&\n String(resourceAccess.principalId) === publicGroupId\n ) {\n return isOpenData\n ? permissionLevelToLabel['CAN_DOWNLOAD']\n : permissionLevelToLabel['CAN_VIEW']\n }\n return undefined\n }\n}\n\nconst EntityAclEditor = forwardRef(function EntityAclEditor(\n props: EntityAclEditorProps,\n ref: ForwardedRef<EntityAclEditorHandle>,\n) {\n const {\n entityId,\n onCanSaveChange,\n onUpdateSuccess,\n isAfterUpload = false,\n } = props\n\n const { data: ownProfile } = useSuspenseGetCurrentUserProfile()\n const { data: realmPrincipals } = useGetRealmPrincipals()\n const { publicGroup: publicGroupId } = realmPrincipals || {}\n const { data: entityBundle } = useSuspenseGetEntityBundle(\n entityId,\n undefined,\n ALL_ENTITY_BUNDLE_FIELDS,\n { staleTime: Infinity },\n )\n const isProject = EntityType.project == entityBundle.entityType\n\n // The parent's benefactor ACL will be shown if the user removes the ACL on the current entity\n const { data: parentAcl } = useSuspenseGetEntityBenefactorACL(\n entityBundle.entity.parentId!,\n {\n staleTime: Infinity,\n },\n )\n\n const consolidatedOriginalResourceAccess = useMemo(\n () =>\n consolidateResourceAccessList(entityBundle.benefactorAcl.resourceAccess),\n [entityBundle.benefactorAcl.resourceAccess],\n )\n\n const parentResourceAccess = useMemo(\n () => parentAcl?.resourceAccess ?? [],\n [parentAcl],\n )\n const canEdit = entityBundle.permissions.canChangePermissions\n const isOpenData = entityBundle.permissions.isEntityOpenData\n const originalIsInherited = !(entityBundle.benefactorAcl.id == entityId)\n const [updatedIsInherited, setUpdatedIsInherited] =\n useState(originalIsInherited)\n const [notifyNewAdditions, setNotifyNewAdditions] = useState(false)\n const [error, setError] = useState<Error>()\n\n const {\n resourceAccessList: updatedResourceAccessList,\n setResourceAccessList,\n addResourceAccessItem,\n updateResourceAccessItem,\n removeResourceAccessItem,\n resetDirtyState,\n } = useUpdateAcl({\n initialResourceAccessList: consolidatedOriginalResourceAccess,\n })\n\n // If `consolidatedOriginalResourceAccess` changes, reset state\n useEffect(() => {\n if (consolidatedOriginalResourceAccess) {\n resetDirtyState()\n setResourceAccessList([...consolidatedOriginalResourceAccess])\n }\n }, [\n consolidatedOriginalResourceAccess,\n resetDirtyState,\n setResourceAccessList,\n ])\n\n // If `originalIsInherited` changes, reset state\n useEffect(() => {\n resetDirtyState()\n setUpdatedIsInherited(originalIsInherited)\n }, [originalIsInherited, resetDirtyState])\n\n // If the editor toggles the inherited state, reset the resource access list\n useEffect(() => {\n if (originalIsInherited == updatedIsInherited) {\n // The user reverted to the original state (regardless of inherited or not)\n setResourceAccessList(consolidatedOriginalResourceAccess)\n } else if (updatedIsInherited) {\n // The user toggled to inherited, update the resource access list to match the parent\n setResourceAccessList(parentResourceAccess)\n } else {\n // The user toggled to local, no need to update the list (the parent's list is already in the editor)\n }\n resetDirtyState()\n }, [\n originalIsInherited,\n consolidatedOriginalResourceAccess,\n parentResourceAccess,\n resetDirtyState,\n setResourceAccessList,\n updatedIsInherited,\n ])\n\n const isPublic = isEntityPublic(\n updatedResourceAccessList,\n realmPrincipals ?? {},\n )\n\n const {\n sendNotification,\n isLoading: isLoadingSendMessageToNewACLUsers,\n isPending: isPendingSendMessageToNewACLUsers,\n } = useNotifyNewACLUsers({\n subject: getSubject(entityBundle.entity.name || ''),\n body: getBody(ownProfile, entityId),\n initialResourceAccessList: consolidatedOriginalResourceAccess,\n newResourceAccessList: updatedResourceAccessList,\n })\n\n const mutationOptions = {\n onSuccess: () => {\n if (notifyNewAdditions) {\n sendNotification()\n }\n onUpdateSuccess()\n },\n onError: (e: Error) => {\n setError(e)\n },\n }\n\n const { mutate: createAcl, isPending: isPendingCreateAcl } =\n useCreateEntityACL(mutationOptions)\n const { mutate: updateAcl, isPending: isPendingUpdateAcl } =\n useUpdateEntityACL(mutationOptions)\n const { mutate: deleteAcl, isPending: isPendingDeleteAcl } =\n useDeleteEntityACL(mutationOptions)\n\n const isPending =\n isPendingCreateAcl ||\n isPendingUpdateAcl ||\n isPendingDeleteAcl ||\n isPendingSendMessageToNewACLUsers\n\n const hasAclChanged = useMemo(() => {\n return (\n originalIsInherited != updatedIsInherited ||\n !resourceAccessListIsEqual(\n consolidatedOriginalResourceAccess,\n updatedResourceAccessList,\n )\n )\n }, [\n consolidatedOriginalResourceAccess,\n originalIsInherited,\n updatedIsInherited,\n updatedResourceAccessList,\n ])\n\n const canSave =\n hasAclChanged || isLoadingSendMessageToNewACLUsers || isPending\n\n const showInheritedAclUpdateWarning = hasAclChanged && isAfterUpload\n\n useEffect(() => {\n onCanSaveChange(canSave)\n }, [onCanSaveChange, canSave])\n\n useImperativeHandle(\n ref,\n () => {\n return {\n save() {\n if (canSave) {\n // Check if the inheritance changed; if so, the ACL should be created/deleted\n if (originalIsInherited != updatedIsInherited) {\n if (updatedIsInherited) {\n deleteAcl(entityId)\n } else {\n createAcl({\n id: entityId,\n resourceAccess: updatedResourceAccessList,\n })\n }\n } else {\n // Inheritance did not change; update the ACL\n updateAcl({\n // ensure we get all fields from the original ACL, including the etag\n ...entityBundle.accessControlList!,\n resourceAccess: updatedResourceAccessList,\n })\n }\n } else {\n console.error('EntityAclEditor: save() called but canSave is false')\n }\n },\n }\n },\n [\n canSave,\n createAcl,\n deleteAcl,\n entityBundle,\n entityId,\n originalIsInherited,\n updateAcl,\n updatedIsInherited,\n updatedResourceAccessList,\n ],\n )\n\n return (\n <Stack\n sx={{\n gap: 2,\n }}\n >\n <OpenData\n isOpenData={isOpenData}\n isPublic={isPublic}\n currentUserCanUpdateSharingSettings={canEdit}\n />\n <InheritanceMessage\n isProject={isProject}\n isInherited={updatedIsInherited}\n benefactorId={updatedIsInherited ? parentAcl?.id : entityId}\n isAfterUpload={isAfterUpload}\n />\n {showInheritedAclUpdateWarning && (\n <FullWidthAlert\n isGlobal={false}\n variant={'warning'}\n title={`Edits will affect settings of entire ${entityTypeToFriendlyName(\n entityBundle?.entityType,\n ).toLowerCase()}.`}\n description={\n <>\n <p>\n Editing the settings here will impact the sharing settings for\n all files and folders within this{' '}\n {entityTypeToFriendlyName(\n entityBundle?.entityType,\n ).toLowerCase()}\n , not just the ones you've recently uploaded.\n </p>\n <p>\n View the instructions above for setting your{' '}\n <Link\n href={\n SYNAPSE_DOCS_SHARING_SETTINGS_PERMISSIONS_CONDITIONS_FOR_USE_URL\n }\n target={'_blank'}\n >\n Local Sharing Settings\n </Link>\n .\n </p>\n </>\n }\n />\n )}\n <AclEditor\n isInherited={updatedIsInherited}\n canEdit={getCanEditResourceAccess(\n canEdit,\n updatedIsInherited,\n ownProfile,\n publicGroupId,\n )}\n canRemoveEntry={getCanDeleteResourceAccess(\n canEdit,\n updatedIsInherited,\n ownProfile,\n )}\n resourceAccessList={updatedResourceAccessList}\n availablePermissionLevels={availablePermissionLevels}\n emptyText={/* This should never happen */ ''}\n displayedPermissionLevelOverride={getDisplayedPermissionLevelOverride(\n isOpenData,\n publicGroupId,\n )}\n onAddPrincipalToAcl={id => {\n if (publicGroupId !== undefined && String(id) === publicGroupId) {\n addResourceAccessItem(\n id,\n getAccessTypeFromPermissionLevel('CAN_VIEW'),\n )\n } else {\n addResourceAccessItem(\n id,\n getAccessTypeFromPermissionLevel('CAN_DOWNLOAD'),\n )\n }\n }}\n updateResourceAccessItem={updateResourceAccessItem}\n removeResourceAccessItem={removeResourceAccessItem}\n showNotifyCheckbox={true}\n notifyCheckboxValue={notifyNewAdditions}\n onNotifyCheckboxChange={setNotifyNewAdditions}\n showAddRemovePublicButton={true}\n />\n {/* Create / delete local sharing settings button */}\n {!isAfterUpload &&\n !isProject &&\n entityBundle.permissions.canEnableInheritance && (\n <CreateOrDeleteLocalSharingSettingsButton\n isInherited={updatedIsInherited}\n setIsInherited={setUpdatedIsInherited}\n />\n )}\n {error && <Alert severity=\"error\">{error.message}</Alert>}\n </Stack>\n )\n})\n\nconst EntityAclEditorWithSuspense = forwardRef(\n function EntityAclEditorWithSuspense(\n props: EntityAclEditorProps,\n ref: ForwardedRef<EntityAclEditorHandle>,\n ) {\n return (\n <SynapseErrorBoundary>\n <Suspense fallback={<AclEditorSkeleton />}>\n <EntityAclEditor {...props} ref={ref} />\n </Suspense>\n </SynapseErrorBoundary>\n )\n },\n)\n\nexport default EntityAclEditorWithSuspense\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAM,KAA+C;CACnD;CACA;CACA;CACA;CACA;CACD;AAmBD,SAAS,EAAW,GAAoB;AACtC,QAAO,GAAG,EAAW;;AAGvB,SAAS,EAAQ,GAAsB,GAAkB;AACvD,QAAO,GAAG,EACR;EACE,UAAU,EAAQ,YAAY;EAC9B,WAAW,EAAQ;EACnB,UAAU,EAAQ;EACnB,EACD;EAAE,cAAc;EAAM,cAAc;EAAO,CAC5C,CAAC,4CA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,CAAA;GAEL,KAAS,kBAAC,IAAD;IAAO,UAAS;cAAS,EAAM;IAAgB,CAAA;GACnD;;EAEV,EAEI,IAA8B,EAClC,SACE,GACA,GACA;AACA,QACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAU,UAAU,kBAAC,GAAD,EAAqB,CAAA;YACvC,kBAAC,GAAD;GAAiB,GAAI;GAAY;GAAO,CAAA;EAC/B,CAAA,EACU,CAAA;EAG5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotifyNewACLUsers.js","names":[],"sources":["../../../src/components/EntityAclEditor/useNotifyNewACLUsers.ts"],"sourcesContent":["import {\n useGetCurrentUserProfile,\n useGetUserGroupHeaders,\n useSendMessage,\n} from '@/synapse-queries'\nimport { useGetRealmPrincipals } from '@/synapse-queries/realm/useRealmPrincipals'\nimport {\n ResourceAccess,\n UserGroupHeader,\n} from '@sage-bionetworks/synapse-types'\nimport { useCallback } from 'react'\nimport { displayToast } from '../ToastMessage'\n\ntype UseNotifyNewACLUsersOptions = {\n subject: string\n body: string\n initialResourceAccessList: ResourceAccess[]\n newResourceAccessList: ResourceAccess[]\n}\n\nexport function shouldNotifyUserInNewResourceAccess(\n principalId: number,\n initialResourceAccessList: ResourceAccess[],\n userGroupHeader: UserGroupHeader,\n currentUserId: string,\n publicPrincipalIds: string[],\n): boolean {\n const isInInitialResourceAccess = initialResourceAccessList.some(\n initialResourceAccess => principalId === initialResourceAccess.principalId,\n )\n const isIndividual = userGroupHeader.isIndividual\n const isCurrentUser = String(principalId) === currentUserId\n const isPublic = publicPrincipalIds.includes(String(principalId))\n\n return (\n !isInInitialResourceAccess && // Is not in the initial list\n isIndividual && // Is an individual, not a team (SWC-1195)\n !isCurrentUser && // do not notify the current user (SWC-5576)\n !isPublic // never try to notify all/public users\n )\n}\n\nexport default function useNotifyNewACLUsers(\n options: UseNotifyNewACLUsersOptions,\n) {\n const { subject, body, initialResourceAccessList, newResourceAccessList } =\n options\n\n const { data } = useGetRealmPrincipals()\n const realmPrincipals = data || {}\n const {\n authenticatedUsers: authenticatedUsersId,\n publicGroup: publicGroupId,\n anonymousUser: anonymousUserId,\n } = realmPrincipals\n const publicPrincipalIds = [\n authenticatedUsersId,\n publicGroupId,\n anonymousUserId,\n ].filter((id): id is string => id !== undefined)\n\n const { data: currentUserProfile, isLoading: isLoadingCurrentUserProfile } =\n useGetCurrentUserProfile()\n const { data: userGroupHeaders, isLoading: isLoadingUserGroupHeaders } =\n useGetUserGroupHeaders(\n newResourceAccessList.map(ra => String(ra.principalId)),\n )\n const isLoading = isLoadingCurrentUserProfile || isLoadingUserGroupHeaders\n\n const { mutate: sendMessage, isPending } = useSendMessage({\n onError: error => {\n displayToast(`New users couldn't be notified: ${error.reason}`)\n },\n })\n\n const sendNotification = useCallback(() => {\n if (isLoading) {\n console.error(\n 'Attempted to send notification before user profile or user group headers were loaded. This should never happen.',\n )\n return\n }\n const usersToNotify = newResourceAccessList\n .filter(newResourceAccess => {\n const userGroupHeader = userGroupHeaders!.find(\n ugh => ugh.ownerId === String(newResourceAccess.principalId),\n )!\n return shouldNotifyUserInNewResourceAccess(\n newResourceAccess.principalId,\n initialResourceAccessList,\n userGroupHeader,\n currentUserProfile!.ownerId,\n publicPrincipalIds,\n )\n })\n .map(ra => String(ra.principalId))\n\n if (usersToNotify.length > 0) {\n sendMessage({\n subject,\n body,\n recipients: usersToNotify,\n })\n }\n }, [\n body,\n currentUserProfile,\n initialResourceAccessList,\n isLoading,\n newResourceAccessList,\n publicPrincipalIds,\n sendMessage,\n subject,\n userGroupHeaders,\n ])\n\n return {\n sendNotification,\n isPending,\n isLoading,\n }\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,EACd,GACA,GACA,GACA,GACA,GACS;CACT,IAAM,IAA4B,EAA0B,MAC1D,MAAyB,MAAgB,EAAsB,YAChE,EACK,IAAe,EAAgB,cAC/B,IAAgB,OAAO,EAAY,KAAK,GACxC,IAAW,EAAmB,SAAS,OAAO,EAAY,CAAC;AAEjE,QACE,CAAC,KACD,KACA,CAAC,KACD,CAAC;;AAIL,SAAwB,EACtB,GACA;CACA,IAAM,EAAE,YAAS,SAAM,8BAA2B,6BAChD,GAEI,EAAE,YAAS,GAAuB,EAElC,EACJ,oBAAoB,GACpB,aAAa,GACb,eAAe,MAJO,KAAQ,EAAE,EAM5B,IAAqB;EACzB;EACA;EACA;EACD,CAAC,QAAQ,MAAqB,MAAO,KAAA,EAAU,EAE1C,EAAE,MAAM,GAAoB,WAAW,MAC3C,GAA0B,EACtB,EAAE,MAAM,GAAkB,WAAW,MACzC,EACE,EAAsB,KAAI,MAAM,OAAO,EAAG,YAAY,CAAC,CACxD,EACG,IAAY,KAA+B,GAE3C,EAAE,QAAQ,GAAa,iBAAc,EAAe,EACxD,UAAS,MAAS;AAChB,IAAa,mCAAmC,EAAM,SAAS;IAElE,CAAC;AA2CF,QAAO;EACL,kBA1CuB,QAAkB;AACzC,OAAI,GAAW;AACb,YAAQ,MACN,kHACD;AACD;;GAEF,IAAM,IAAgB,EACnB,QAAO,MAAqB;IAC3B,IAAM,IAAkB,EAAkB,MACxC,MAAO,EAAI,YAAY,OAAO,EAAkB,YAAY,CAC7D;AACD,WAAO,EACL,EAAkB,aAClB,GACA,GACA,EAAoB,SACpB,EACD;KACD,CACD,KAAI,MAAM,OAAO,EAAG,YAAY,CAAC;AAEpC,GAAI,EAAc,SAAS,KACzB,EAAY;IACV;IACA;IACA,YAAY;IACb,CAAC;KAEH;GACD;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,
|
|
1
|
+
{"version":3,"file":"useNotifyNewACLUsers.js","names":[],"sources":["../../../src/components/EntityAclEditor/useNotifyNewACLUsers.ts"],"sourcesContent":["import {\n useGetCurrentUserProfile,\n useGetUserGroupHeaders,\n useSendMessage,\n} from '@/synapse-queries'\nimport { useGetRealmPrincipals } from '@/synapse-queries/realm/useRealmPrincipals'\nimport {\n ResourceAccess,\n UserGroupHeader,\n} from '@sage-bionetworks/synapse-types'\nimport { useCallback } from 'react'\nimport { displayToast } from '../ToastMessage'\n\ntype UseNotifyNewACLUsersOptions = {\n subject: string\n body: string\n initialResourceAccessList: ResourceAccess[]\n newResourceAccessList: ResourceAccess[]\n}\n\nexport function shouldNotifyUserInNewResourceAccess(\n principalId: number,\n initialResourceAccessList: ResourceAccess[],\n userGroupHeader: UserGroupHeader,\n currentUserId: string,\n publicPrincipalIds: string[],\n): boolean {\n const isInInitialResourceAccess = initialResourceAccessList.some(\n initialResourceAccess => principalId === initialResourceAccess.principalId,\n )\n const isIndividual = userGroupHeader.isIndividual\n const isCurrentUser = String(principalId) === currentUserId\n const isPublic = publicPrincipalIds.includes(String(principalId))\n\n return (\n !isInInitialResourceAccess && // Is not in the initial list\n isIndividual && // Is an individual, not a team (SWC-1195)\n !isCurrentUser && // do not notify the current user (SWC-5576)\n !isPublic // never try to notify all/public users\n )\n}\n\nexport default function useNotifyNewACLUsers(\n options: UseNotifyNewACLUsersOptions,\n) {\n const { subject, body, initialResourceAccessList, newResourceAccessList } =\n options\n\n const { data } = useGetRealmPrincipals()\n const realmPrincipals = data || {}\n const {\n authenticatedUsers: authenticatedUsersId,\n publicGroup: publicGroupId,\n anonymousUser: anonymousUserId,\n } = realmPrincipals\n const publicPrincipalIds = [\n authenticatedUsersId,\n publicGroupId,\n anonymousUserId,\n ].filter((id): id is string => id !== undefined)\n\n const { data: currentUserProfile, isLoading: isLoadingCurrentUserProfile } =\n useGetCurrentUserProfile()\n const { data: userGroupHeaders, isLoading: isLoadingUserGroupHeaders } =\n useGetUserGroupHeaders(\n newResourceAccessList.map(ra => String(ra.principalId)),\n )\n const isLoading = isLoadingCurrentUserProfile || isLoadingUserGroupHeaders\n\n const { mutate: sendMessage, isPending } = useSendMessage({\n onError: error => {\n displayToast(`New users couldn't be notified: ${error.reason}`)\n },\n })\n\n const sendNotification = useCallback(() => {\n if (isLoading) {\n console.error(\n 'Attempted to send notification before user profile or user group headers were loaded. This should never happen.',\n )\n return\n }\n const usersToNotify = newResourceAccessList\n .filter(newResourceAccess => {\n const userGroupHeader = userGroupHeaders!.find(\n ugh => ugh.ownerId === String(newResourceAccess.principalId),\n )!\n return shouldNotifyUserInNewResourceAccess(\n newResourceAccess.principalId,\n initialResourceAccessList,\n userGroupHeader,\n currentUserProfile!.ownerId,\n publicPrincipalIds,\n )\n })\n .map(ra => String(ra.principalId))\n\n if (usersToNotify.length > 0) {\n sendMessage({\n subject,\n body,\n recipients: usersToNotify,\n })\n }\n }, [\n body,\n currentUserProfile,\n initialResourceAccessList,\n isLoading,\n newResourceAccessList,\n publicPrincipalIds,\n sendMessage,\n subject,\n userGroupHeaders,\n ])\n\n return {\n sendNotification,\n isPending,\n isLoading,\n }\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,EACd,GACA,GACA,GACA,GACA,GACS;CACT,IAAM,IAA4B,EAA0B,MAC1D,MAAyB,MAAgB,EAAsB,YAChE,EACK,IAAe,EAAgB,cAC/B,IAAgB,OAAO,EAAY,KAAK,GACxC,IAAW,EAAmB,SAAS,OAAO,EAAY,CAAC;AAEjE,QACE,CAAC,KACD,KACA,CAAC,KACD,CAAC;;AAIL,SAAwB,EACtB,GACA;CACA,IAAM,EAAE,YAAS,SAAM,8BAA2B,6BAChD,GAEI,EAAE,YAAS,GAAuB,EAElC,EACJ,oBAAoB,GACpB,aAAa,GACb,eAAe,MAJO,KAAQ,EAAE,EAM5B,IAAqB;EACzB;EACA;EACA;EACD,CAAC,QAAQ,MAAqB,MAAO,KAAA,EAAU,EAE1C,EAAE,MAAM,GAAoB,WAAW,MAC3C,GAA0B,EACtB,EAAE,MAAM,GAAkB,WAAW,MACzC,EACE,EAAsB,KAAI,MAAM,OAAO,EAAG,YAAY,CAAC,CACxD,EACG,IAAY,KAA+B,GAE3C,EAAE,QAAQ,GAAa,iBAAc,EAAe,EACxD,UAAS,MAAS;AAChB,IAAa,mCAAmC,EAAM,SAAS;IAElE,CAAC;AA2CF,QAAO;EACL,kBA1CuB,QAAkB;AACzC,OAAI,GAAW;AACb,YAAQ,MACN,kHACD;AACD;;GAEF,IAAM,IAAgB,EACnB,QAAO,MAAqB;IAC3B,IAAM,IAAkB,EAAkB,MACxC,MAAO,EAAI,YAAY,OAAO,EAAkB,YAAY,CAC7D;AACD,WAAO,EACL,EAAkB,aAClB,GACA,GACA,EAAoB,SACpB,EACD;KACD,CACD,KAAI,MAAM,OAAO,EAAG,YAAY,CAAC;AAEpC,GAAI,EAAc,SAAS,KACzB,EAAY;IACV;IACA;IACA,YAAY;IACb,CAAC;KAEH;GACD;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAGC;EACA;EACA;EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityBadgeIcons.js","names":[],"sources":["../../../src/components/EntityBadgeIcons/EntityBadgeIcons.tsx"],"sourcesContent":["import {\n useDeleteEntity,\n useGetEntityBundle,\n useGetJson,\n useGetSchemaBinding,\n useGetValidationResults,\n} from '@/synapse-queries'\nimport { useGetRealmPrincipals } from '@/synapse-queries/realm/useRealmPrincipals'\nimport { isEntityPublic } from '@/utils/functions/AccessControlListUtils'\nimport {\n ChatBubbleTwoTone,\n CheckTwoTone,\n DescriptionTwoTone,\n LinkOffTwoTone,\n LocalOfferTwoTone,\n LockTwoTone,\n PublicTwoTone,\n} from '@mui/icons-material'\nimport { Tooltip } from '@mui/material'\nimport { EntityType } from '@sage-bionetworks/synapse-client'\nimport { ALL_ENTITY_BUNDLE_FIELDS } from '@sage-bionetworks/synapse-types'\nimport { isEmpty } from 'lodash-es'\nimport React, { useEffect, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\nimport { getDisplayedAnnotation } from '../entity/metadata/AnnotationsTable'\nimport { EntityModal } from '../entity/metadata/EntityModal'\nimport { HoverPopover } from '../styled/HoverPopover'\nimport WarningDialog from '../SynapseForm/WarningDialog'\n\nexport type EntityBadgeIconsProps = {\n entityId: string\n versionNumber?: number\n flexWrap?: // possible settings for flex-wrap\n | 'wrap'\n | 'nowrap'\n | '-moz-initial'\n | 'inherit'\n | 'initial'\n | 'revert'\n | 'unset'\n | 'wrap-reverse'\n justifyContent?: 'flex-start' | 'flex-end' | string\n /** Shows an icon indicating if the entity is 'public' or 'private'. Default true */\n showIsPublicPrivate?: boolean\n /** Shows an icon if the entity has sharing settings set on itself. Default true */\n showHasLocalSharingSettings?: boolean\n /** Shows an icon if the entity has annotations, or if it has a validation schema (in experimental mode only). Default true */\n showHasAnnotations?: boolean\n /** Shows an icon if the entity a wiki. Default true */\n showHasWiki?: boolean\n /** Shows an icon if the entity has been mentioned in discussion threads. Default true */\n showHasDiscussionThread?: boolean\n /* Shows an 'unlink' button if the entity is a link and the user has permission to delete it. Default true */\n showUnlink?: boolean\n /* Invoked after the entity is unlinked/deleted in case there is cleanup to do. Returns the entityId */\n onUnlink?: (entityId: string) => void\n onUnlinkError?: (error: unknown) => void\n /** Whether or not the badges (e.g. Annotations) can trigger opening a modal on click */\n canOpenModal: boolean\n}\n\n/**\n * Stateless component used to show icons that show an entity's status.\n * Adapted from https://github.com/Sage-Bionetworks/SynapseWebClient/blob/46b9b717636cda2421926d96365244bbb72a05b6/src/main/java/org/sagebionetworks/web/client/widget/entity/EntityBadge.java\n */\nexport const EntityBadgeIcons = (\n props: EntityBadgeIconsProps,\n): React.ReactNode => {\n const {\n entityId,\n versionNumber,\n flexWrap = 'nowrap',\n justifyContent = 'flex-start',\n showIsPublicPrivate = true,\n showHasLocalSharingSettings = true,\n showHasAnnotations = true,\n showHasWiki = true,\n showHasDiscussionThread = true,\n showUnlink = true,\n onUnlink = () => {\n /* noop */\n },\n onUnlinkError = () => {\n /* noop */\n },\n canOpenModal,\n } = props\n\n const { data } = useGetRealmPrincipals()\n const realmPrincipals = data || {}\n\n enum SchemaConformanceState {\n NO_SCHEMA = '', // or not in experimental mode\n VALID = 'Valid',\n INVALID = 'Invalid',\n ANNOTATIONS_MISSING = 'Missing',\n }\n\n const { ref, inView } = useInView()\n\n const { data: entityData } = useGetJson(entityId, versionNumber, true, {\n enabled: inView,\n })\n const annotations = entityData?.annotations\n const { data: bundle } = useGetEntityBundle(\n entityId,\n versionNumber,\n ALL_ENTITY_BUNDLE_FIELDS,\n {\n enabled: inView,\n },\n )\n const [showModal, setShowModal] = useState(false)\n const [showUnlinkConfirmModal, setShowUnlinkConfirmModal] = useState(false)\n const [schemaConformance, setSchemaConformance] = useState(\n SchemaConformanceState.NO_SCHEMA,\n )\n\n const { data: boundSchema } = useGetSchemaBinding(entityId, {\n enabled: inView,\n staleTime: 60 * 1000, // 60 seconds\n })\n\n const { data: schemaValidationResults } = useGetValidationResults(entityId, {\n enabled: inView && !!boundSchema,\n staleTime: 60 * 1000, // 60 seconds\n })\n\n const annotationsCount =\n annotations && !isEmpty(annotations) ? Object.keys(annotations).length : 0\n useEffect(() => {\n if (schemaValidationResults) {\n if (schemaValidationResults.isValid) {\n setSchemaConformance(SchemaConformanceState.VALID)\n } else if (annotationsCount) {\n // If annotations exist, then indicate that they are invalid\n setSchemaConformance(SchemaConformanceState.INVALID)\n } else {\n // If annotations are missing, it's still invalid, but should appear differently\n setSchemaConformance(SchemaConformanceState.ANNOTATIONS_MISSING)\n }\n }\n }, [\n schemaValidationResults,\n annotationsCount,\n annotations,\n SchemaConformanceState.VALID,\n SchemaConformanceState.INVALID,\n SchemaConformanceState.ANNOTATIONS_MISSING,\n ])\n\n const { mutate: unlinkEntity } = useDeleteEntity({\n onSuccess: (_, entityId) => {\n onUnlink(entityId)\n },\n onError: onUnlinkError,\n })\n\n /**\n * Convert the list of annotations to a string of <tr>...anno1</tr><tr>...anno2</tr>...\n * If there are no annotations, this is the empty string ('')\n */\n const annotationsTableRows = (\n <>\n {annotations\n ? Object.entries(annotations ?? []).map(([key, value]) => (\n <tr key={key}>\n <td>\n <b>{key}</b>\n </td>\n <td>\n {Array.isArray(value)\n ? value.map(getDisplayedAnnotation).join(', ')\n : getDisplayedAnnotation(value as string | number | boolean)}\n </td>\n </tr>\n ))\n : ''}\n </>\n )\n // We also show the schema name if there is one (and we're in experimental mode)\n const valiationSchemaTableRow = (\n <>\n {boundSchema ? (\n <tr>\n <td>\n <b>Validation Schema</b>\n </td>\n <td>{boundSchema.jsonSchemaVersionInfo.schemaName}</td>\n </tr>\n ) : (\n ''\n )}\n </>\n )\n const annotationsTitle = schemaValidationResults\n ? `${schemaConformance} Annotations`\n : ''\n const annotationsHtml = (\n <div className=\"EntityBadgeTooltip\">\n <table>\n <tbody>\n {annotationsTableRows ? annotationsTableRows : ''}\n {valiationSchemaTableRow}\n </tbody>\n </table>\n </div>\n )\n\n return (\n <div className=\"EntityBadge\" ref={ref} style={{ flexWrap, justifyContent }}>\n {bundle && (\n <>\n <div onClick={e => e.stopPropagation()}>\n <EntityModal\n entityId={entityId}\n show={showModal}\n showTabs={false}\n onClose={() => setShowModal(false)}\n initialTab={'ANNOTATIONS'}\n />\n </div>\n {showIsPublicPrivate &&\n bundle.benefactorAcl &&\n isEntityPublic(\n bundle.benefactorAcl.resourceAccess,\n realmPrincipals,\n ) ? (\n <Tooltip title=\"Public\" enterNextDelay={100} placement=\"right\">\n <PublicTwoTone\n aria-hidden={false}\n role=\"img\"\n className=\"EntityBadge__Badge\"\n data-testid={'is-public-icon'}\n />\n </Tooltip>\n ) : null}\n {showIsPublicPrivate &&\n bundle.benefactorAcl &&\n !isEntityPublic(\n bundle.benefactorAcl.resourceAccess,\n realmPrincipals,\n ) ? (\n <Tooltip title=\"Private\" enterNextDelay={100} placement=\"right\">\n <LockTwoTone\n aria-hidden={false}\n role=\"img\"\n className=\"EntityBadge__Badge\"\n data-testid={'is-private-icon'}\n />\n </Tooltip>\n ) : null}\n {showHasLocalSharingSettings &&\n bundle.benefactorAcl &&\n entityId === bundle.benefactorAcl.id ? (\n <Tooltip\n title=\"Sharing Settings have been set\"\n enterNextDelay={100}\n placement=\"right\"\n >\n <CheckTwoTone\n aria-hidden={false}\n role=\"img\"\n className=\"EntityBadge__Badge\"\n data-testid={'sharing-settings-icon'}\n />\n </Tooltip>\n ) : null}\n\n {showHasAnnotations &&\n !!(annotationsCount || schemaValidationResults) && (\n <HoverPopover\n title={annotationsTitle}\n popoverContent={annotationsHtml}\n placement=\"right\"\n maxWidth={500}\n actionButton={\n canOpenModal\n ? {\n content: 'Edit Annotations',\n onClick: () => setShowModal(true),\n closeOnClick: true,\n }\n : undefined\n }\n >\n <LocalOfferTwoTone\n aria-hidden={false}\n role={canOpenModal ? 'button' : 'img'}\n className={`EntityBadge__Badge ${schemaConformance}`}\n data-html={true}\n data-testid={'annotations-icon'}\n />\n </HoverPopover>\n )}\n {showHasWiki && bundle.rootWikiId && (\n <Tooltip title=\"Has a wiki\" enterNextDelay={100} placement=\"right\">\n <DescriptionTwoTone\n aria-hidden={false}\n role=\"img\"\n className=\"EntityBadge__Badge\"\n data-testid={'wiki-icon'}\n />\n </Tooltip>\n )}\n {showHasDiscussionThread &&\n !!bundle.threadCount &&\n !!(bundle.threadCount > 0) && (\n <Tooltip\n title=\"Has been mentioned in discussion\"\n enterNextDelay={100}\n placement=\"right\"\n >\n <ChatBubbleTwoTone\n aria-hidden={false}\n role=\"img\"\n className=\"EntityBadge__Badge\"\n data-testid={'discussion-icon'}\n />\n </Tooltip>\n )}\n {showUnlink &&\n bundle.entityType === EntityType.link &&\n bundle.permissions?.canDelete && (\n <>\n <WarningDialog\n open={showUnlinkConfirmModal}\n title=\"Confirm Unlink\"\n content={\n 'Are you sure you want to remove this link? The original object will not be changed.'\n }\n confirmButtonText=\"Unlink\"\n confirmButtonColor=\"error\"\n onConfirm={() => {\n unlinkEntity(entityId)\n setShowUnlinkConfirmModal(false)\n }}\n onCancel={() => {\n setShowUnlinkConfirmModal(false)\n }}\n />\n <Tooltip\n title=\"Remove this link\"\n enterNextDelay={100}\n placement=\"right\"\n >\n <LinkOffTwoTone\n aria-hidden={false}\n role=\"button\"\n onClick={() => setShowUnlinkConfirmModal(true)}\n className=\"EntityBadge__Badge Unlink\"\n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BAAC,GAAD;IACE,MAAM;IACN,OAAM;IACN,SACE;IAEF,mBAAkB;IAClB,oBAAmB;IACnB,iBAAiB;AAEf,KADA,GAAa,EAAS,EACtB,EAA0B,GAAM;;IAElC,gBAAgB;AACd,OAA0B,GAAM;;IAElC,CAAA,EACF,kBAAC,GAAD;IACE,OAAM;IACN,gBAAgB;IAChB,WAAU;cAEV,kBAAC,IAAD;KACE,eAAa;KACb,MAAK;KACL,eAAe,EAA0B,GAAK;KAC9C,WAAU;KACV,eAAa;KACb,CAAA;IACM,CAAA,CACT,EAAA,CAAA;GAEN,EAAA,CAAA;EAED,CAAA"}
|
|
1
|
+
{"version":3,"file":"EntityBadgeIcons.js","names":[],"sources":["../../../src/components/EntityBadgeIcons/EntityBadgeIcons.tsx"],"sourcesContent":["import {\n useDeleteEntity,\n useGetEntityBundle,\n useGetJson,\n useGetSchemaBinding,\n useGetValidationResults,\n} from '@/synapse-queries'\nimport { useGetRealmPrincipals } from '@/synapse-queries/realm/useRealmPrincipals'\nimport { isEntityPublic } from '@/utils/functions/AccessControlListUtils'\nimport {\n ChatBubbleTwoTone,\n CheckTwoTone,\n DescriptionTwoTone,\n LinkOffTwoTone,\n LocalOfferTwoTone,\n LockTwoTone,\n PublicTwoTone,\n} from '@mui/icons-material'\nimport { Tooltip } from '@mui/material'\nimport { EntityType } from '@sage-bionetworks/synapse-client'\nimport { ALL_ENTITY_BUNDLE_FIELDS } from '@sage-bionetworks/synapse-types'\nimport { isEmpty } from 'lodash-es'\nimport React, { useEffect, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\nimport { getDisplayedAnnotation } from '../entity/metadata/AnnotationsTable'\nimport { EntityModal } from '../entity/metadata/EntityModal'\nimport { HoverPopover } from '../styled/HoverPopover'\nimport WarningDialog from '../SynapseForm/WarningDialog'\n\nexport type EntityBadgeIconsProps = {\n entityId: string\n versionNumber?: number\n flexWrap?: // possible settings for flex-wrap\n | 'wrap'\n | 'nowrap'\n | '-moz-initial'\n | 'inherit'\n | 'initial'\n | 'revert'\n | 'unset'\n | 'wrap-reverse'\n justifyContent?: 'flex-start' | 'flex-end' | string\n /** Shows an icon indicating if the entity is 'public' or 'private'. Default true */\n showIsPublicPrivate?: boolean\n /** Shows an icon if the entity has sharing settings set on itself. Default true */\n showHasLocalSharingSettings?: boolean\n /** Shows an icon if the entity has annotations, or if it has a validation schema (in experimental mode only). Default true */\n showHasAnnotations?: boolean\n /** Shows an icon if the entity a wiki. Default true */\n showHasWiki?: boolean\n /** Shows an icon if the entity has been mentioned in discussion threads. Default true */\n showHasDiscussionThread?: boolean\n /* Shows an 'unlink' button if the entity is a link and the user has permission to delete it. Default true */\n showUnlink?: boolean\n /* Invoked after the entity is unlinked/deleted in case there is cleanup to do. Returns the entityId */\n onUnlink?: (entityId: string) => void\n onUnlinkError?: (error: unknown) => void\n /** Whether or not the badges (e.g. Annotations) can trigger opening a modal on click */\n canOpenModal: boolean\n}\n\n/**\n * Stateless component used to show icons that show an entity's status.\n * Adapted from https://github.com/Sage-Bionetworks/SynapseWebClient/blob/46b9b717636cda2421926d96365244bbb72a05b6/src/main/java/org/sagebionetworks/web/client/widget/entity/EntityBadge.java\n */\nexport const EntityBadgeIcons = (\n props: EntityBadgeIconsProps,\n): React.ReactNode => {\n const {\n entityId,\n versionNumber,\n flexWrap = 'nowrap',\n justifyContent = 'flex-start',\n showIsPublicPrivate = true,\n showHasLocalSharingSettings = true,\n showHasAnnotations = true,\n showHasWiki = true,\n showHasDiscussionThread = true,\n showUnlink = true,\n onUnlink = () => {\n /* noop */\n },\n onUnlinkError = () => {\n /* noop */\n },\n canOpenModal,\n } = props\n\n const { data } = useGetRealmPrincipals()\n const realmPrincipals = data || {}\n\n enum SchemaConformanceState {\n NO_SCHEMA = '', // or not in experimental mode\n VALID = 'Valid',\n INVALID = 'Invalid',\n ANNOTATIONS_MISSING = 'Missing',\n }\n\n const { ref, inView } = useInView()\n\n const { data: entityData } = useGetJson(entityId, versionNumber, true, {\n enabled: inView,\n })\n const annotations = entityData?.annotations\n const { data: bundle } = useGetEntityBundle(\n entityId,\n versionNumber,\n ALL_ENTITY_BUNDLE_FIELDS,\n {\n enabled: inView,\n },\n )\n const [showModal, setShowModal] = useState(false)\n const [showUnlinkConfirmModal, setShowUnlinkConfirmModal] = useState(false)\n const [schemaConformance, setSchemaConformance] = useState(\n SchemaConformanceState.NO_SCHEMA,\n )\n\n const { data: boundSchema } = useGetSchemaBinding(entityId, {\n enabled: inView,\n staleTime: 60 * 1000, // 60 seconds\n })\n\n const { data: schemaValidationResults } = useGetValidationResults(entityId, {\n enabled: inView && !!boundSchema,\n staleTime: 60 * 1000, // 60 seconds\n })\n\n const annotationsCount =\n annotations && !isEmpty(annotations) ? Object.keys(annotations).length : 0\n useEffect(() => {\n if (schemaValidationResults) {\n if (schemaValidationResults.isValid) {\n setSchemaConformance(SchemaConformanceState.VALID)\n } else if (annotationsCount) {\n // If annotations exist, then indicate that they are invalid\n setSchemaConformance(SchemaConformanceState.INVALID)\n } else {\n // If annotations are missing, it's still invalid, but should appear differently\n setSchemaConformance(SchemaConformanceState.ANNOTATIONS_MISSING)\n }\n }\n }, [\n schemaValidationResults,\n annotationsCount,\n annotations,\n SchemaConformanceState.VALID,\n SchemaConformanceState.INVALID,\n SchemaConformanceState.ANNOTATIONS_MISSING,\n ])\n\n const { mutate: unlinkEntity } = useDeleteEntity({\n onSuccess: (_, entityId) => {\n onUnlink(entityId)\n },\n onError: onUnlinkError,\n })\n\n /**\n * Convert the list of annotations to a string of <tr>...anno1</tr><tr>...anno2</tr>...\n * If there are no annotations, this is the empty string ('')\n */\n const annotationsTableRows = (\n <>\n {annotations\n ? Object.entries(annotations ?? []).map(([key, value]) => (\n <tr key={key}>\n <td>\n <b>{key}</b>\n </td>\n <td>\n {Array.isArray(value)\n ? value.map(getDisplayedAnnotation).join(', ')\n : getDisplayedAnnotation(value as string | number | boolean)}\n </td>\n </tr>\n ))\n : ''}\n </>\n )\n // We also show the schema name if there is one (and we're in experimental mode)\n const valiationSchemaTableRow = (\n <>\n {boundSchema ? (\n <tr>\n <td>\n <b>Validation Schema</b>\n </td>\n <td>{boundSchema.jsonSchemaVersionInfo.schemaName}</td>\n </tr>\n ) : (\n ''\n )}\n </>\n )\n const annotationsTitle = schemaValidationResults\n ? `${schemaConformance} Annotations`\n : ''\n const annotationsHtml = (\n <div className=\"EntityBadgeTooltip\">\n <table>\n <tbody>\n {annotationsTableRows ? annotationsTableRows : ''}\n {valiationSchemaTableRow}\n </tbody>\n </table>\n </div>\n )\n\n return (\n <div className=\"EntityBadge\" ref={ref} style={{ flexWrap, justifyContent }}>\n {bundle && (\n <>\n <div onClick={e => e.stopPropagation()}>\n <EntityModal\n entityId={entityId}\n show={showModal}\n showTabs={false}\n onClose={() => setShowModal(false)}\n initialTab={'ANNOTATIONS'}\n />\n </div>\n {showIsPublicPrivate &&\n bundle.benefactorAcl &&\n isEntityPublic(\n bundle.benefactorAcl.resourceAccess,\n realmPrincipals,\n ) ? (\n <Tooltip title=\"Public\" enterNextDelay={100} placement=\"right\">\n <PublicTwoTone\n aria-hidden={false}\n role=\"img\"\n className=\"EntityBadge__Badge\"\n data-testid={'is-public-icon'}\n />\n </Tooltip>\n ) : null}\n {showIsPublicPrivate &&\n bundle.benefactorAcl &&\n !isEntityPublic(\n bundle.benefactorAcl.resourceAccess,\n realmPrincipals,\n ) ? (\n <Tooltip title=\"Private\" enterNextDelay={100} placement=\"right\">\n <LockTwoTone\n aria-hidden={false}\n role=\"img\"\n className=\"EntityBadge__Badge\"\n data-testid={'is-private-icon'}\n />\n </Tooltip>\n ) : null}\n {showHasLocalSharingSettings &&\n bundle.benefactorAcl &&\n entityId === bundle.benefactorAcl.id ? (\n <Tooltip\n title=\"Sharing Settings have been set\"\n enterNextDelay={100}\n placement=\"right\"\n >\n <CheckTwoTone\n aria-hidden={false}\n role=\"img\"\n className=\"EntityBadge__Badge\"\n data-testid={'sharing-settings-icon'}\n />\n </Tooltip>\n ) : null}\n\n {showHasAnnotations &&\n !!(annotationsCount || schemaValidationResults) && (\n <HoverPopover\n title={annotationsTitle}\n popoverContent={annotationsHtml}\n placement=\"right\"\n maxWidth={500}\n actionButton={\n canOpenModal\n ? {\n content: 'Edit Annotations',\n onClick: () => setShowModal(true),\n closeOnClick: true,\n }\n : undefined\n }\n >\n <LocalOfferTwoTone\n aria-hidden={false}\n role={canOpenModal ? 'button' : 'img'}\n className={`EntityBadge__Badge ${schemaConformance}`}\n data-html={true}\n data-testid={'annotations-icon'}\n />\n </HoverPopover>\n )}\n {showHasWiki && bundle.rootWikiId && (\n <Tooltip title=\"Has a wiki\" enterNextDelay={100} placement=\"right\">\n <DescriptionTwoTone\n aria-hidden={false}\n role=\"img\"\n className=\"EntityBadge__Badge\"\n data-testid={'wiki-icon'}\n />\n </Tooltip>\n )}\n {showHasDiscussionThread &&\n !!bundle.threadCount &&\n !!(bundle.threadCount > 0) && (\n <Tooltip\n title=\"Has been mentioned in discussion\"\n enterNextDelay={100}\n placement=\"right\"\n >\n <ChatBubbleTwoTone\n aria-hidden={false}\n role=\"img\"\n className=\"EntityBadge__Badge\"\n data-testid={'discussion-icon'}\n />\n </Tooltip>\n )}\n {showUnlink &&\n bundle.entityType === EntityType.link &&\n bundle.permissions?.canDelete && (\n <>\n <WarningDialog\n open={showUnlinkConfirmModal}\n title=\"Confirm Unlink\"\n content={\n 'Are you sure you want to remove this link? The original object will not be changed.'\n }\n confirmButtonText=\"Unlink\"\n confirmButtonColor=\"error\"\n onConfirm={() => {\n unlinkEntity(entityId)\n setShowUnlinkConfirmModal(false)\n }}\n onCancel={() => {\n setShowUnlinkConfirmModal(false)\n }}\n />\n <Tooltip\n title=\"Remove this link\"\n enterNextDelay={100}\n placement=\"right\"\n >\n <LinkOffTwoTone\n aria-hidden={false}\n role=\"button\"\n onClick={() => setShowUnlinkConfirmModal(true)}\n className=\"EntityBadge__Badge Unlink\"\n data-testid={'unlink-icon'}\n />\n </Tooltip>\n </>\n )}\n </>\n )}\n </div>\n )\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;IAClB,oBAAmB;IACnB,iBAAiB;AAEf,KADA,GAAa,EAAS,EACtB,EAA0B,GAAM;;IAElC,gBAAgB;AACd,OAA0B,GAAM;;IAElC,CAAA,EACF,kBAAC,GAAD;IACE,OAAM;IACN,gBAAgB;IAChB,WAAU;cAEV,kBAAC,IAAD;KACE,eAAa;KACb,MAAK;KACL,eAAe,EAA0B,GAAK;KAC9C,WAAU;KACV,eAAa;KACb,CAAA;IACM,CAAA,CACT,EAAA,CAAA;GAEN,EAAA,CAAA;EAED,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCitation.js","names":[],"sources":["../../../src/components/EntityCitation/EntityCitation.tsx"],"sourcesContent":["import React from 'react'\nimport { ReactComponent as DoubleQuotes } from '@/assets/icons/DoubleQuotes.svg'\nimport { Button, Skeleton } from '@mui/material'\nimport { useGetDOIAssociation } from '@/synapse-queries/doi/useDOI'\nimport { useGetEntityBundle } from '@/synapse-queries/entity'\nimport { DoiObjectType } from '@sage-bionetworks/synapse-client'\nimport CitationPopoverContent from '../CitationPopover/CitationPopoverContent'\nimport { useRef, useState } from 'react'\nimport { useGetEntityDoiAssociation } from './EntityCitationUtils'\nimport DropdownSelect from '../DropdownSelect'\n\nexport type EntityCitationProps = {\n projectId: string\n entityId: string\n versionNumber?: number\n}\n\nconst EntityCitation = ({\n projectId,\n entityId,\n versionNumber,\n}: EntityCitationProps): React.ReactNode => {\n const { data: bundle, isLoading: isEntityLoading } = useGetEntityBundle(\n entityId,\n versionNumber,\n )\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null)\n const [selectedDoi, setSelectedDoi] = useState<string | undefined>(undefined)\n const [citationAnchorEl, setCitationAnchorEl] = useState<HTMLElement | null>(\n null,\n )\n const [selectedIndex, setSelectedIndex] = useState<number | undefined>(\n undefined,\n )\n const citationButtonRef = useRef<HTMLDivElement>(null)\n\n const open = Boolean(anchorEl)\n const id = open ? 'cite-as-popover' : undefined\n\n const entityDoiAssociation = useGetEntityDoiAssociation(\n entityId,\n versionNumber,\n projectId,\n bundle,\n )\n\n // Get DOI association for the project\n // Projects are not versioned\n const { data: projectDoiAssociation, isLoading: isProjectLoading } =\n useGetDOIAssociation(\n {\n id: projectId,\n version: undefined,\n type: DoiObjectType.ENTITY,\n },\n {\n enabled: !!projectId,\n },\n )\n\n // If both project and entity have DOIs, we show the dropdown variant\n const isProjectAndEntityDoi = projectDoiAssociation && entityDoiAssociation\n\n function getButtonText() {\n if (isProjectAndEntityDoi) {\n return 'Cite as...'\n } else if (entityDoiAssociation && !projectDoiAssociation) {\n return 'Cite page'\n } else if (!entityDoiAssociation && projectDoiAssociation) {\n return 'Cite project'\n }\n return ''\n }\n\n const buttonText = getButtonText()\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (entityDoiAssociation && !projectDoiAssociation) {\n setSelectedDoi(entityDoiAssociation.doiUri)\n setCitationAnchorEl(event.currentTarget)\n } else if (!entityDoiAssociation && projectDoiAssociation) {\n setSelectedDoi(projectDoiAssociation.doiUri)\n setCitationAnchorEl(event.currentTarget)\n } else {\n // If both project and entity doi exist, show dropdown\n setAnchorEl(event.currentTarget)\n }\n }\n\n const popover = (\n <CitationPopoverContent\n doi={selectedDoi}\n anchorEl={citationAnchorEl}\n open={!!citationAnchorEl && !!selectedDoi}\n id={id}\n onClose={() => {\n setCitationAnchorEl(null)\n setSelectedDoi(undefined)\n }}\n />\n )\n\n const options: string[] = ['Cite this Project', 'Cite only this page']\n\n if (!projectDoiAssociation && !entityDoiAssociation) {\n return null\n }\n\n if (isEntityLoading || isProjectLoading) {\n return (\n <Skeleton\n sx={{\n width: { xs: '100%', sm: '140px' },\n height: '45px',\n }}\n />\n )\n }\n\n return (\n <>\n {isProjectAndEntityDoi ? (\n <DropdownSelect\n disabled={isEntityLoading && isProjectLoading}\n options={options}\n anchorRef={citationButtonRef}\n sx={{\n width: { xs: '100%', sm: 'initial' },\n }}\n buttonText=\"Cite as...\"\n variant=\"outlined\"\n buttonGroupAriaLabel=\"Citation options\"\n selectedIndex={selectedIndex}\n setSelectedIndex={(index: number) => {\n setSelectedIndex(index)\n const selected =\n index === 0\n ? projectDoiAssociation?.doiUri\n : entityDoiAssociation?.doiUri\n if (selected) {\n setSelectedDoi(selected)\n setCitationAnchorEl(citationButtonRef.current)\n }\n }}\n />\n ) : (\n <Button\n onClick={handleButtonClick}\n disabled={isEntityLoading && isProjectLoading}\n sx={{\n width: { xs: '100%', sm: 'initial' },\n }}\n variant=\"outlined\"\n startIcon={<DoubleQuotes width={18} height={18} />}\n >\n {buttonText}\n </Button>\n )}\n {popover}\n </>\n )\n}\n\nexport default EntityCitation\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAM,KAAkB,EACtB,cACA,aACA,uBAC0C;CAC1C,IAAM,EAAE,MAAM,GAAQ,WAAW,MAAoB,EACnD,GACA,EACD,EACK,CAAC,GAAU,KAAe,EAAmC,KAAK,EAClE,CAAC,GAAa,KAAkB,EAA6B,KAAA,EAAU,EACvE,CAAC,GAAkB,KAAuB,EAC9C,KACD,EACK,CAAC,GAAe,KAAoB,EACxC,KAAA,EACD,EACK,IAAoB,EAAuB,KAAK,EAGhD,IADe,IACH,oBAAoB,KAAA,GAEhC,IAAuB,EAC3B,GACA,GACA,GACA,EACD,EAIK,EAAE,MAAM,GAAuB,WAAW,MAC9C,EACE;EACE,IAAI;EACJ,SAAS,KAAA;EACT,MAAM,EAAc;EACrB,EACD,EACE,SAAS,CAAC,CAAC,GACZ,CACF,EAGG,IAAwB,KAAyB;CAEvD,SAAS,IAAgB;AAQvB,SAPI,IACK,eACE,KAAwB,CAAC,IAC3B,cACE,CAAC,KAAwB,IAC3B,iBAEF;;CAGT,IAAM,IAAa,GAAe;AA6ClC,QAfI,CAAC,KAAyB,CAAC,IACtB,OAGL,KAAmB,IAEnB,kBAAC,GAAD,EACE,IAAI;EACF,OAAO;GAAE,IAAI;GAAQ,IAAI;GAAS;EAClC,QAAQ;EACT,EACD,CAAA,GAKJ,kBAAA,GAAA,EAAA,UAAA,CACG,IACC,kBAAC,GAAD;EACE,UAAU,KAAmB;EACpB,
|
|
1
|
+
{"version":3,"file":"EntityCitation.js","names":[],"sources":["../../../src/components/EntityCitation/EntityCitation.tsx"],"sourcesContent":["import React from 'react'\nimport { ReactComponent as DoubleQuotes } from '@/assets/icons/DoubleQuotes.svg'\nimport { Button, Skeleton } from '@mui/material'\nimport { useGetDOIAssociation } from '@/synapse-queries/doi/useDOI'\nimport { useGetEntityBundle } from '@/synapse-queries/entity'\nimport { DoiObjectType } from '@sage-bionetworks/synapse-client'\nimport CitationPopoverContent from '../CitationPopover/CitationPopoverContent'\nimport { useRef, useState } from 'react'\nimport { useGetEntityDoiAssociation } from './EntityCitationUtils'\nimport DropdownSelect from '../DropdownSelect'\n\nexport type EntityCitationProps = {\n projectId: string\n entityId: string\n versionNumber?: number\n}\n\nconst EntityCitation = ({\n projectId,\n entityId,\n versionNumber,\n}: EntityCitationProps): React.ReactNode => {\n const { data: bundle, isLoading: isEntityLoading } = useGetEntityBundle(\n entityId,\n versionNumber,\n )\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null)\n const [selectedDoi, setSelectedDoi] = useState<string | undefined>(undefined)\n const [citationAnchorEl, setCitationAnchorEl] = useState<HTMLElement | null>(\n null,\n )\n const [selectedIndex, setSelectedIndex] = useState<number | undefined>(\n undefined,\n )\n const citationButtonRef = useRef<HTMLDivElement>(null)\n\n const open = Boolean(anchorEl)\n const id = open ? 'cite-as-popover' : undefined\n\n const entityDoiAssociation = useGetEntityDoiAssociation(\n entityId,\n versionNumber,\n projectId,\n bundle,\n )\n\n // Get DOI association for the project\n // Projects are not versioned\n const { data: projectDoiAssociation, isLoading: isProjectLoading } =\n useGetDOIAssociation(\n {\n id: projectId,\n version: undefined,\n type: DoiObjectType.ENTITY,\n },\n {\n enabled: !!projectId,\n },\n )\n\n // If both project and entity have DOIs, we show the dropdown variant\n const isProjectAndEntityDoi = projectDoiAssociation && entityDoiAssociation\n\n function getButtonText() {\n if (isProjectAndEntityDoi) {\n return 'Cite as...'\n } else if (entityDoiAssociation && !projectDoiAssociation) {\n return 'Cite page'\n } else if (!entityDoiAssociation && projectDoiAssociation) {\n return 'Cite project'\n }\n return ''\n }\n\n const buttonText = getButtonText()\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (entityDoiAssociation && !projectDoiAssociation) {\n setSelectedDoi(entityDoiAssociation.doiUri)\n setCitationAnchorEl(event.currentTarget)\n } else if (!entityDoiAssociation && projectDoiAssociation) {\n setSelectedDoi(projectDoiAssociation.doiUri)\n setCitationAnchorEl(event.currentTarget)\n } else {\n // If both project and entity doi exist, show dropdown\n setAnchorEl(event.currentTarget)\n }\n }\n\n const popover = (\n <CitationPopoverContent\n doi={selectedDoi}\n anchorEl={citationAnchorEl}\n open={!!citationAnchorEl && !!selectedDoi}\n id={id}\n onClose={() => {\n setCitationAnchorEl(null)\n setSelectedDoi(undefined)\n }}\n />\n )\n\n const options: string[] = ['Cite this Project', 'Cite only this page']\n\n if (!projectDoiAssociation && !entityDoiAssociation) {\n return null\n }\n\n if (isEntityLoading || isProjectLoading) {\n return (\n <Skeleton\n sx={{\n width: { xs: '100%', sm: '140px' },\n height: '45px',\n }}\n />\n )\n }\n\n return (\n <>\n {isProjectAndEntityDoi ? (\n <DropdownSelect\n disabled={isEntityLoading && isProjectLoading}\n options={options}\n anchorRef={citationButtonRef}\n sx={{\n width: { xs: '100%', sm: 'initial' },\n }}\n buttonText=\"Cite as...\"\n variant=\"outlined\"\n buttonGroupAriaLabel=\"Citation options\"\n selectedIndex={selectedIndex}\n setSelectedIndex={(index: number) => {\n setSelectedIndex(index)\n const selected =\n index === 0\n ? projectDoiAssociation?.doiUri\n : entityDoiAssociation?.doiUri\n if (selected) {\n setSelectedDoi(selected)\n setCitationAnchorEl(citationButtonRef.current)\n }\n }}\n />\n ) : (\n <Button\n onClick={handleButtonClick}\n disabled={isEntityLoading && isProjectLoading}\n sx={{\n width: { xs: '100%', sm: 'initial' },\n }}\n variant=\"outlined\"\n startIcon={<DoubleQuotes width={18} height={18} />}\n >\n {buttonText}\n </Button>\n )}\n {popover}\n </>\n )\n}\n\nexport default EntityCitation\n"],"mappings":";;;;;;;;;;;;AAiBA,IAAM,KAAkB,EACtB,cACA,aACA,uBAC0C;CAC1C,IAAM,EAAE,MAAM,GAAQ,WAAW,MAAoB,EACnD,GACA,EACD,EACK,CAAC,GAAU,KAAe,EAAmC,KAAK,EAClE,CAAC,GAAa,KAAkB,EAA6B,KAAA,EAAU,EACvE,CAAC,GAAkB,KAAuB,EAC9C,KACD,EACK,CAAC,GAAe,KAAoB,EACxC,KAAA,EACD,EACK,IAAoB,EAAuB,KAAK,EAGhD,IADe,IACH,oBAAoB,KAAA,GAEhC,IAAuB,EAC3B,GACA,GACA,GACA,EACD,EAIK,EAAE,MAAM,GAAuB,WAAW,MAC9C,EACE;EACE,IAAI;EACJ,SAAS,KAAA;EACT,MAAM,EAAc;EACrB,EACD,EACE,SAAS,CAAC,CAAC,GACZ,CACF,EAGG,IAAwB,KAAyB;CAEvD,SAAS,IAAgB;AAQvB,SAPI,IACK,eACE,KAAwB,CAAC,IAC3B,cACE,CAAC,KAAwB,IAC3B,iBAEF;;CAGT,IAAM,IAAa,GAAe;AA6ClC,QAfI,CAAC,KAAyB,CAAC,IACtB,OAGL,KAAmB,IAEnB,kBAAC,GAAD,EACE,IAAI;EACF,OAAO;GAAE,IAAI;GAAQ,IAAI;GAAS;EAClC,QAAQ;EACT,EACD,CAAA,GAKJ,kBAAA,GAAA,EAAA,UAAA,CACG,IACC,kBAAC,GAAD;EACE,UAAU,KAAmB;EACpB,UAtBU,qBAAqB,sBAsB/B;EACT,WAAW;EACX,IAAI,EACF,OAAO;GAAE,IAAI;GAAQ,IAAI;GAAW,EACrC;EACD,YAAW;EACX,SAAQ;EACR,sBAAqB;EACN;EACf,mBAAmB,MAAkB;AACnC,KAAiB,EAAM;GACvB,IAAM,IACJ,MAAU,IACN,GAAuB,SACvB,GAAsB;AAC5B,GAAI,MACF,EAAe,EAAS,EACxB,EAAoB,EAAkB,QAAQ;;EAGlD,CAAA,GAEF,kBAAC,GAAD;EACE,UAvEmB,MAA+C;AACxE,GAAI,KAAwB,CAAC,KAC3B,EAAe,EAAqB,OAAO,EAC3C,EAAoB,EAAM,cAAc,IAC/B,CAAC,KAAwB,KAClC,EAAe,EAAsB,OAAO,EAC5C,EAAoB,EAAM,cAAc,IAGxC,EAAY,EAAM,cAAc;;EA+D5B,UAAU,KAAmB;EAC7B,IAAI,EACF,OAAO;GAAE,IAAI;GAAQ,IAAI;GAAW,EACrC;EACD,SAAQ;EACR,WAAW,kBAAC,GAAD;GAAc,OAAO;GAAI,QAAQ;GAAM,CAAA;YAEjD;EACM,CAAA,EAEV,gBApEH,EAAC,GAAD;EACE,KAAK;EACL,UAAU;EACV,MAAM,CAAC,CAAC,KAAoB,CAAC,CAAC;EAC1B;EACJ,eAAe;AAEb,GADA,EAAoB,KAAK,EACzB,EAAe,KAAA,EAAU;;EAE3B,CA2DC,CACA,EAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/EntityDownloadButton/EntityDownloadButton.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAK7D,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAkB3C,eAAO,MAAM,8BAA8B,kGAEJ,CAAA;AAGvC,eAAO,MAAM,yBAAyB,+DACA,CAAA;AA2DtC,aAAK,cAAc;IACjB,YAAY,IAAA;IACZ,SAAS,IAAA;IACT,kBAAkB,IAAA;IAClB,wBAAwB,IAAA;IACxB,WAAW,IAAA;CACZ;AA6FD,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,UAAU,GACf,cAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"EntityDownloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/EntityDownloadButton/EntityDownloadButton.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAK7D,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAkB3C,eAAO,MAAM,8BAA8B,kGAEJ,CAAA;AAGvC,eAAO,MAAM,yBAAyB,+DACA,CAAA;AA2DtC,aAAK,cAAc;IACjB,YAAY,IAAA;IACZ,SAAS,IAAA;IACT,kBAAkB,IAAA;IAClB,wBAAwB,IAAA;IACxB,WAAW,IAAA;CACZ;AA6FD,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,UAAU,GACf,cAAc,EAAE,EAAE,CAoCpB;AA2ED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,6BAA6B,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,2CAgLA"}
|
|
@@ -129,6 +129,7 @@ function M(e) {
|
|
|
129
129
|
case C.submissionview:
|
|
130
130
|
case C.virtualtable: return [[k.exportTable, k.programmaticAccess]];
|
|
131
131
|
case C.link: return [[k.programmaticAccess]];
|
|
132
|
+
case C.searchindex: return [];
|
|
132
133
|
default: throw Error(`Unhandled EntityType: ${e}`);
|
|
133
134
|
}
|
|
134
135
|
}
|