synapse-react-client 4.0.38 → 4.0.40
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.js +1 -1
- package/dist/aridhia-queries/useAridhiaQuery.d.ts +6 -2
- package/dist/aridhia-queries/useAridhiaQuery.d.ts.map +1 -1
- package/dist/aridhia-queries/useAridhiaQuery.js +3 -0
- package/dist/aridhia-queries/useAridhiaQuery.js.map +1 -1
- package/dist/components/Aridhia/AridhiaAccessStatus.d.ts +2 -1
- package/dist/components/Aridhia/AridhiaAccessStatus.d.ts.map +1 -1
- package/dist/components/Aridhia/AridhiaAccessStatus.js +60 -37
- package/dist/components/Aridhia/AridhiaAccessStatus.js.map +1 -1
- package/dist/components/Aridhia/AridhiaDarStatusPopover.d.ts +12 -0
- package/dist/components/Aridhia/AridhiaDarStatusPopover.d.ts.map +1 -0
- package/dist/components/Aridhia/AridhiaDarStatusPopover.js +56 -0
- package/dist/components/Aridhia/AridhiaDarStatusPopover.js.map +1 -0
- package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.d.ts.map +1 -1
- package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.js +38 -30
- package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.js.map +1 -1
- package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.js +15 -14
- package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.js.map +1 -1
- package/dist/components/Aridhia/RdcaDapEligibilityDialog.d.ts +11 -0
- package/dist/components/Aridhia/RdcaDapEligibilityDialog.d.ts.map +1 -0
- package/dist/components/Aridhia/RdcaDapEligibilityDialog.js +37 -0
- package/dist/components/Aridhia/RdcaDapEligibilityDialog.js.map +1 -0
- package/dist/components/Aridhia/aridhiaAccessStatusUtils.js +2 -2
- package/dist/components/Aridhia/aridhiaAccessStatusUtils.js.map +1 -1
- package/dist/components/Aridhia/aridhiaFairPortalUrls.d.ts +10 -0
- package/dist/components/Aridhia/aridhiaFairPortalUrls.d.ts.map +1 -0
- package/dist/components/Aridhia/aridhiaFairPortalUrls.js +11 -0
- package/dist/components/Aridhia/aridhiaFairPortalUrls.js.map +1 -0
- package/dist/components/Aridhia/rdcaDapConstants.d.ts +3 -0
- package/dist/components/Aridhia/rdcaDapConstants.d.ts.map +1 -0
- package/dist/components/Aridhia/rdcaDapConstants.js +6 -0
- package/dist/components/Aridhia/rdcaDapConstants.js.map +1 -0
- package/dist/components/DataExplorer/DataExplorer.css +1 -1
- package/dist/components/DataExplorer/DataExplorer.d.ts.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.js +50 -50
- package/dist/components/DataExplorer/DataExplorer.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.module.js +16 -16
- package/dist/components/DataExplorer/DataExplorer.module.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.module.scss +29 -6
- package/dist/components/DataGrid/columns/DateTimeColumn.d.ts +16 -7
- package/dist/components/DataGrid/columns/DateTimeColumn.d.ts.map +1 -1
- package/dist/components/DataGrid/columns/DateTimeColumn.js +79 -57
- package/dist/components/DataGrid/columns/DateTimeColumn.js.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.js +11 -8
- package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +10 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -0
- package/dist/components/DatePicker/DatePicker.js +18 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/EntityCitation/EntityCitation.d.ts.map +1 -1
- package/dist/components/EntityCitation/EntityCitation.js +8 -5
- package/dist/components/EntityCitation/EntityCitation.js.map +1 -1
- package/dist/components/HasAccess/AccessIcon.d.ts +3 -1
- package/dist/components/HasAccess/AccessIcon.d.ts.map +1 -1
- package/dist/components/HasAccess/AccessIcon.js +11 -1
- package/dist/components/HasAccess/AccessIcon.js.map +1 -1
- package/dist/components/PortalHomePageHeader/PortalHomePageHeader.d.ts +2 -1
- package/dist/components/PortalHomePageHeader/PortalHomePageHeader.d.ts.map +1 -1
- package/dist/components/PortalHomePageHeader/PortalHomePageHeader.js +81 -53
- package/dist/components/PortalHomePageHeader/PortalHomePageHeader.js.map +1 -1
- package/dist/components/ProjectInfo/ProjectInfo.d.ts.map +1 -1
- package/dist/components/ProjectInfo/ProjectInfo.js +3 -2
- package/dist/components/ProjectInfo/ProjectInfo.js.map +1 -1
- package/dist/components/QueryBuilder/FilterConditionRow.css +1 -0
- package/dist/components/QueryBuilder/FilterConditionRow.d.ts +6 -0
- package/dist/components/QueryBuilder/FilterConditionRow.d.ts.map +1 -0
- package/dist/components/QueryBuilder/FilterConditionRow.js +257 -0
- package/dist/components/QueryBuilder/FilterConditionRow.js.map +1 -0
- package/dist/components/QueryBuilder/FilterConditionRow.module.js +17 -0
- package/dist/components/QueryBuilder/FilterConditionRow.module.js.map +1 -0
- package/dist/components/QueryBuilder/FilterConditionRow.module.scss +106 -0
- package/dist/components/QueryBuilder/FilterGroupNode.css +1 -0
- package/dist/components/QueryBuilder/FilterGroupNode.d.ts +7 -0
- package/dist/components/QueryBuilder/FilterGroupNode.d.ts.map +1 -0
- package/dist/components/QueryBuilder/FilterGroupNode.js +100 -0
- package/dist/components/QueryBuilder/FilterGroupNode.js.map +1 -0
- package/dist/components/QueryBuilder/FilterGroupNode.module.js +15 -0
- package/dist/components/QueryBuilder/FilterGroupNode.module.js.map +1 -0
- package/dist/components/QueryBuilder/FilterGroupNode.module.scss +83 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.css +1 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.d.ts +21 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.d.ts.map +1 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.js +138 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.js.map +1 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.module.js +17 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.module.js.map +1 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.module.scss +79 -0
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.d.ts +39 -0
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.d.ts.map +1 -0
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.js +19 -0
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.js.map +1 -0
- package/dist/components/QueryBuilder/qbTreeToReadable.d.ts +14 -0
- package/dist/components/QueryBuilder/qbTreeToReadable.d.ts.map +1 -0
- package/dist/components/QueryBuilder/qbTreeToReadable.js +89 -0
- package/dist/components/QueryBuilder/qbTreeToReadable.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderId.d.ts +2 -0
- package/dist/components/QueryBuilder/queryBuilderId.d.ts.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderId.js +9 -0
- package/dist/components/QueryBuilder/queryBuilderId.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderMetadata.d.ts +24 -0
- package/dist/components/QueryBuilder/queryBuilderMetadata.d.ts.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderMetadata.js +91 -0
- package/dist/components/QueryBuilder/queryBuilderMetadata.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderOperations.d.ts +58 -0
- package/dist/components/QueryBuilder/queryBuilderOperations.d.ts.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderOperations.js +200 -0
- package/dist/components/QueryBuilder/queryBuilderOperations.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderTranslation.d.ts +3 -2
- package/dist/components/QueryBuilder/queryBuilderTranslation.d.ts.map +1 -1
- package/dist/components/QueryBuilder/queryBuilderTranslation.js +82 -84
- package/dist/components/QueryBuilder/queryBuilderTranslation.js.map +1 -1
- package/dist/components/QueryBuilder/useQBCombinedSql.d.ts +11 -0
- package/dist/components/QueryBuilder/useQBCombinedSql.d.ts.map +1 -0
- package/dist/components/QueryBuilder/useQBCombinedSql.js +29 -0
- package/dist/components/QueryBuilder/useQBCombinedSql.js.map +1 -0
- package/dist/components/QueryBuilder/useQBFacetSourceMetadata.d.ts +18 -0
- package/dist/components/QueryBuilder/useQBFacetSourceMetadata.d.ts.map +1 -0
- package/dist/components/QueryBuilder/useQBFacetSourceMetadata.js +27 -0
- package/dist/components/QueryBuilder/useQBFacetSourceMetadata.js.map +1 -0
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts +14 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js +185 -120
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js.map +1 -1
- package/dist/components/RssFeedCards/RssFeedCards.d.ts +1 -0
- package/dist/components/RssFeedCards/RssFeedCards.d.ts.map +1 -1
- package/dist/components/RssFeedCards/RssFeedCards.js +11 -11
- package/dist/components/RssFeedCards/RssFeedCards.js.map +1 -1
- package/dist/components/SynapseChat/SynapseChat.d.ts +7 -1
- package/dist/components/SynapseChat/SynapseChat.d.ts.map +1 -1
- package/dist/components/SynapseChat/SynapseChat.js +76 -71
- package/dist/components/SynapseChat/SynapseChat.js.map +1 -1
- package/dist/components/SynapseChat/SynapsePortalChatDialog.d.ts +3 -1
- package/dist/components/SynapseChat/SynapsePortalChatDialog.d.ts.map +1 -1
- package/dist/components/SynapseChat/SynapsePortalChatDialog.js +24 -13
- package/dist/components/SynapseChat/SynapsePortalChatDialog.js.map +1 -1
- package/dist/components/SynapseChat/portalChatSessionStorage.d.ts +23 -0
- package/dist/components/SynapseChat/portalChatSessionStorage.d.ts.map +1 -0
- package/dist/components/SynapseChat/portalChatSessionStorage.js +29 -0
- package/dist/components/SynapseChat/portalChatSessionStorage.js.map +1 -0
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.d.ts +6 -0
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.d.ts.map +1 -1
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js +92 -79
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts +3 -4
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js +2 -2
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.js +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.js.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.d.ts.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.js +9 -2
- package/dist/components/entity/page/action_menu/EntityActionMenu.js.map +1 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.js +1 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.js.map +1 -1
- package/dist/components/menu/ComplexMenu.js +1 -1
- package/dist/components/menu/ComplexMenu.js.map +1 -1
- package/dist/components/menu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/menu/DropdownMenu.js +4 -0
- package/dist/components/menu/DropdownMenu.js.map +1 -1
- package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.d.ts +10 -0
- package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.d.ts.map +1 -0
- package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.js +20 -0
- package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.js.map +1 -0
- package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.d.ts.map +1 -1
- package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.js +29 -20
- package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.js.map +1 -1
- package/dist/mocks/accessRequirement/mockFormTemplates.d.ts +16 -0
- package/dist/mocks/accessRequirement/mockFormTemplates.d.ts.map +1 -0
- package/dist/mocks/accessRequirement/mockFormTemplates.js +70 -0
- package/dist/mocks/accessRequirement/mockFormTemplates.js.map +1 -0
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.d.ts +7 -0
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.d.ts.map +1 -0
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.js +47 -0
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.js.map +1 -0
- package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts +24 -0
- package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts.map +1 -0
- package/dist/mocks/accessRequirement/mockJsonSchemas.js +62 -0
- package/dist/mocks/accessRequirement/mockJsonSchemas.js.map +1 -0
- package/dist/mocks/msw/handlers/aridhiaHandlers.d.ts +18 -1
- package/dist/mocks/msw/handlers/aridhiaHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/aridhiaHandlers.js +39 -33
- package/dist/mocks/msw/handlers/aridhiaHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/formTemplateHandlers.d.ts +5 -0
- package/dist/mocks/msw/handlers/formTemplateHandlers.d.ts.map +1 -0
- package/dist/mocks/msw/handlers/formTemplateHandlers.js +65 -0
- package/dist/mocks/msw/handlers/formTemplateHandlers.js.map +1 -0
- package/dist/mocks/msw/handlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers.js +49 -47
- package/dist/mocks/msw/handlers.js.map +1 -1
- package/dist/style/abstracts/_cssVariables.scss +7 -0
- package/dist/style/components/_query-wrapper-plot-nav.scss +9 -0
- package/dist/style/main.css +1 -1
- package/dist/synapse-queries/KeyFactory.d.ts +6 -1
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +17 -2
- package/dist/synapse-queries/KeyFactory.js.map +1 -1
- package/dist/synapse-queries/chat/useChat.d.ts.map +1 -1
- package/dist/synapse-queries/chat/useChat.js +2 -4
- package/dist/synapse-queries/chat/useChat.js.map +1 -1
- package/dist/synapse-queries/dataaccess/index.d.ts +2 -0
- package/dist/synapse-queries/dataaccess/index.d.ts.map +1 -1
- package/dist/synapse-queries/dataaccess/index.js +5 -3
- package/dist/synapse-queries/dataaccess/useFormTemplate.d.ts +41 -0
- package/dist/synapse-queries/dataaccess/useFormTemplate.d.ts.map +1 -0
- package/dist/synapse-queries/dataaccess/useFormTemplate.js +63 -0
- package/dist/synapse-queries/dataaccess/useFormTemplate.js.map +1 -0
- package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.d.ts +21 -0
- package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.d.ts.map +1 -0
- package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.js +34 -0
- package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.js.map +1 -0
- package/dist/synapse-queries/index.js +190 -180
- package/dist/testutils/ReactQueryMockUtils.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/featureflag/FeatureFlags.d.ts +0 -1
- package/dist/utils/featureflag/FeatureFlags.d.ts.map +1 -1
- package/dist/utils/featureflag/FeatureFlags.js +1 -1
- package/dist/utils/featureflag/FeatureFlags.js.map +1 -1
- package/dist/utils/jsonschema/getType.d.ts.map +1 -1
- package/dist/utils/jsonschema/getType.js +4 -1
- package/dist/utils/jsonschema/getType.js.map +1 -1
- package/package.json +7 -7
package/dist/SWC.index.js
CHANGED
|
@@ -116,7 +116,7 @@ var x = { BackendDestinationEnum: r }, S = {
|
|
|
116
116
|
sendSearchResultsReturnedEvent: y,
|
|
117
117
|
sendSearchResultReturnedEvent: v,
|
|
118
118
|
sendSearchResultClickedEvent: _
|
|
119
|
-
}, T = "4.0.
|
|
119
|
+
}, T = "4.0.40";
|
|
120
120
|
//#endregion
|
|
121
121
|
export { w as Analytics, a as HttpClient, d as Palettes, o as SynapseClient, C as SynapseComponents, n as SynapseConstants, S as SynapseContext, x as SynapseEnums, m as SynapseQueries, T as SynapseReactClientVersion, p as SynapseSessionManager, i as xssOptions };
|
|
122
122
|
|
|
@@ -2,14 +2,18 @@ import { QueryKey, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQu
|
|
|
2
2
|
import { Configuration } from '@sage-bionetworks/aridhia-client/generated/runtime';
|
|
3
3
|
/**
|
|
4
4
|
* - `invalid_token` / `invalid_issuer` — the gateway's `/authenticate` rejected the Synapse
|
|
5
|
-
* token outright
|
|
5
|
+
* token outright. The gateway currently mints a token whether or not the account is linked
|
|
6
|
+
* to RDCA-DAP, but kept as a recognized shape in case that changes.
|
|
7
|
+
* - `not_authorized` — a FAIR API call (e.g. `GET /fair/requests`) rejected an otherwise-valid
|
|
8
|
+
* Aridhia token with 403 `{ error: { message: 'Not authorised for this operation' } }`. This
|
|
9
|
+
* is the actual eligibility signal in practice: it means no linked RDCA-DAP account yet.
|
|
6
10
|
* - `Invalid parameter` — the token-exchange request body was malformed. This is our bug, not
|
|
7
11
|
* the user's eligibility, so it is never treated as an eligibility failure.
|
|
8
12
|
* - `not_configured` — called without an `AridhiaContextProvider` or a Synapse access token;
|
|
9
13
|
* an environment/wiring problem, not a user-eligibility problem.
|
|
10
14
|
* - `unknown` — any other HTTP or network failure.
|
|
11
15
|
*/
|
|
12
|
-
export type AridhiaErrorCode = 'invalid_token' | 'invalid_issuer' | 'Invalid parameter' | 'not_configured' | 'unknown';
|
|
16
|
+
export type AridhiaErrorCode = 'invalid_token' | 'invalid_issuer' | 'not_authorized' | 'Invalid parameter' | 'not_configured' | 'unknown';
|
|
13
17
|
export declare class AridhiaError extends Error {
|
|
14
18
|
code: AridhiaErrorCode;
|
|
15
19
|
httpStatus?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAridhiaQuery.d.ts","sourceRoot":"","sources":["../../src/aridhia-queries/useAridhiaQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,aAAa,EAEd,MAAM,oDAAoD,CAAA;AAK3D
|
|
1
|
+
{"version":3,"file":"useAridhiaQuery.d.ts","sourceRoot":"","sources":["../../src/aridhia-queries/useAridhiaQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,aAAa,EAEd,MAAM,oDAAoD,CAAA;AAK3D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,SAAS,CAAA;AAEb,qBAAa,YAAa,SAAQ,KAAK;IACrC,IAAI,EAAE,gBAAgB,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yEAAyE;IACzE,oBAAoB,EAAE,OAAO,CAAA;gBAG3B,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;KAAE;CAQpE;AAiDD,wBAAsB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAgD1E;AAuCD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,EAC9C,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,GACrD,cAAc,CAAC,CAAC,EAAE,YAAY,CAAC,CAcjC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,EACzD,UAAU,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,KAAK,OAAO,CAAC,KAAK,CAAC,EAC5E,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,GACrE,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,CAAC,CAOpD"}
|
|
@@ -37,6 +37,9 @@ async function l(e) {
|
|
|
37
37
|
return n === "invalid_token" || n === "invalid_issuer" || n === "Invalid parameter" ? new o(n, n, {
|
|
38
38
|
httpStatus: t,
|
|
39
39
|
isEligibilityFailure: n !== "Invalid parameter"
|
|
40
|
+
}) : t === 403 && (n?.toLowerCase().includes("not authorised") || n?.toLowerCase().includes("not authorized")) ? new o("not_authorized", n, {
|
|
41
|
+
httpStatus: t,
|
|
42
|
+
isEligibilityFailure: !0
|
|
40
43
|
}) : new o("unknown", n ?? `Aridhia request failed (${t})`, { httpStatus: t });
|
|
41
44
|
}
|
|
42
45
|
let t = s(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAridhiaQuery.js","names":[],"sources":["../../src/aridhia-queries/useAridhiaQuery.ts"],"sourcesContent":["import {\n useMutation,\n useQuery,\n QueryKey,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult,\n} from '@tanstack/react-query'\nimport {\n Configuration,\n ResponseError,\n} from '@sage-bionetworks/aridhia-client/generated/runtime'\nimport { useAridhiaContextOptional } from '@/utils/context/AridhiaContext'\nimport { useSynapseContext } from '@/utils/context/SynapseContext'\nimport { createAridhiaApiConfiguration } from './aridhiaTokenExchange'\n\n/**\n * - `invalid_token` / `invalid_issuer` — the gateway's `/authenticate` rejected the Synapse\n * token outright (e.g. no linked RDCA-DAP account yet).\n * - `Invalid parameter` — the token-exchange request body was malformed. This is our bug, not\n * the user's eligibility, so it is never treated as an eligibility failure.\n * - `not_configured` — called without an `AridhiaContextProvider` or a Synapse access token;\n * an environment/wiring problem, not a user-eligibility problem.\n * - `unknown` — any other HTTP or network failure.\n */\nexport type AridhiaErrorCode =\n | 'invalid_token'\n | 'invalid_issuer'\n | 'Invalid parameter'\n | 'not_configured'\n | 'unknown'\n\nexport class AridhiaError extends Error {\n code: AridhiaErrorCode\n httpStatus?: number\n /** true when the failure means \"this user cannot use the DAP API yet\" */\n isEligibilityFailure: boolean\n\n constructor(\n code: AridhiaErrorCode,\n message: string,\n options?: { httpStatus?: number; isEligibilityFailure?: boolean },\n ) {\n super(message)\n this.name = 'AridhiaError'\n this.code = code\n this.httpStatus = options?.httpStatus\n this.isEligibilityFailure = options?.isEligibilityFailure ?? false\n }\n}\n\n/**\n * Pulls a human-usable error string out of a JSON response body:\n * - Gateway OAuth error: `{ error: 'invalid_token' }`\n * - FAIR API error envelope: `{ error: { status: 400, message: '...' } }`\n * - Direct message envelope: `{ message: '...' }`\n *\n * Returns `undefined` when the body carries no recognizable error text.\n */\nfunction extractErrorTextFromBody(body: unknown): string | undefined {\n if (!body || typeof body !== 'object') {\n return undefined\n }\n const errorField = 'error' in body ? body.error : undefined\n if (typeof errorField === 'string') {\n return errorField\n }\n if (errorField && typeof errorField === 'object') {\n if ('message' in errorField && typeof errorField.message === 'string') {\n return errorField.message\n }\n if ('error' in errorField && typeof errorField.error === 'string') {\n return errorField.error\n }\n }\n const messageField = 'message' in body ? body.message : undefined\n if (typeof messageField === 'string') {\n return messageField\n }\n return undefined\n}\n\n/**\n * Pulls a human-usable error string out of a `ResponseError`'s JSON body.\n * Returns `undefined` when the body isn't JSON, was already consumed, or carries no recognizable field.\n */\nasync function extractResponseErrorText(\n response: ResponseError['response'],\n): Promise<string | undefined> {\n try {\n const body: unknown = await response.clone().json()\n return extractErrorTextFromBody(body)\n } catch {\n // Response body wasn't JSON (or was already consumed).\n return undefined\n }\n}\n\nexport async function toAridhiaError(error: unknown): Promise<AridhiaError> {\n if (error instanceof AridhiaError) {\n return error\n }\n if (error instanceof ResponseError) {\n const httpStatus = error.response.status\n const bodyErrorText = await extractResponseErrorText(error.response)\n if (\n bodyErrorText === 'invalid_token' ||\n bodyErrorText === 'invalid_issuer' ||\n bodyErrorText === 'Invalid parameter'\n ) {\n return new AridhiaError(bodyErrorText, bodyErrorText, {\n httpStatus,\n // A malformed request body is our bug, not the user's account state.\n isEligibilityFailure: bodyErrorText !== 'Invalid parameter',\n })\n }\n // An unrecognized error shape (e.g. a FAIR-side validation error on `/requests/`, which\n // uses a different envelope than the gateway's `/authenticate`) — keep `code: 'unknown'`\n // but surface the server's own text verbatim so the caller can quote it.\n return new AridhiaError(\n 'unknown',\n bodyErrorText ?? `Aridhia request failed (${httpStatus})`,\n { httpStatus },\n )\n }\n const bodyText = extractErrorTextFromBody(error)\n if (bodyText) {\n return new AridhiaError('unknown', bodyText)\n }\n return new AridhiaError(\n 'unknown',\n error instanceof Error ? error.message : 'Unknown Aridhia error',\n )\n}\n\n/**\n * Resolves the `AridhiaContext` and the current Synapse access token, exchanges it for a fresh\n * Aridhia token (tokens are single-use — see `aridhiaTokenExchange.ts`), and returns a `run`\n * function that executes a call with the resulting `Configuration`, normalizing any failure into\n * an `AridhiaError`.\n */\nfunction useAridhiaCall(): {\n /** `!!synapseAccessToken && !!aridhiaContext` — every read and write is gated on this. */\n enabled: boolean\n run: <T>(fn: (config: Configuration) => Promise<T>) => Promise<T>\n} {\n const aridhiaContext = useAridhiaContextOptional()\n const { accessToken: synapseAccessToken } = useSynapseContext()\n\n return {\n enabled: !!synapseAccessToken && !!aridhiaContext,\n run: async <T>(fn: (config: Configuration) => Promise<T>): Promise<T> => {\n if (!synapseAccessToken || !aridhiaContext) {\n throw new AridhiaError(\n 'not_configured',\n 'AridhiaContext is not available, or no Synapse access token is present. Make sure to wrap your component with AridhiaContextProvider.',\n )\n }\n try {\n const configuration = await createAridhiaApiConfiguration(\n synapseAccessToken,\n aridhiaContext.apiBasePath,\n aridhiaContext.authenticationRequest,\n )\n return await fn(configuration)\n } catch (error) {\n throw await toAridhiaError(error)\n }\n },\n }\n}\n\n/**\n * Shared query primitive for every Aridhia (C-Path FAIR) read: resolves the `AridhiaContext` and\n * the current Synapse access token, exchanges it for a fresh Aridhia token (tokens are\n * single-use — see `aridhiaTokenExchange.ts`), runs `queryFn` with the resulting `Configuration`,\n * and normalizes any failure into an `AridhiaError`.\n */\nexport function useAridhiaQuery<T>(\n queryKey: QueryKey,\n queryFn: (config: Configuration) => Promise<T>,\n options?: Partial<UseQueryOptions<T, AridhiaError, T>>,\n): UseQueryResult<T, AridhiaError> {\n const { enabled: baseEnabled, run } = useAridhiaCall()\n // Composed, not overridden: a caller's `enabled` (e.g. \"workflowKey is known yet\") can only\n // narrow when the query runs, never bypass the token/context prerequisite.\n const { enabled: callerEnabled, ...restOptions } = options ?? {}\n const enabled =\n callerEnabled === undefined ? baseEnabled : baseEnabled && !!callerEnabled\n\n return useQuery<T, AridhiaError, T>({\n ...restOptions,\n enabled,\n queryKey,\n queryFn: () => run(queryFn),\n })\n}\n\n/**\n * Shared mutation primitive for every Aridhia (C-Path FAIR) write: resolves the `AridhiaContext`\n * and the current Synapse access token, exchanges it for a fresh Aridhia token (tokens are\n * single-use — see `aridhiaTokenExchange.ts`), runs `mutationFn` with the resulting\n * `Configuration` and the mutation variables, and normalizes any failure into an `AridhiaError`.\n */\nexport function useAridhiaMutation<TData, TVariables = void>(\n mutationFn: (config: Configuration, variables: TVariables) => Promise<TData>,\n options?: Partial<UseMutationOptions<TData, AridhiaError, TVariables>>,\n): UseMutationResult<TData, AridhiaError, TVariables> {\n const { run } = useAridhiaCall()\n\n return useMutation<TData, AridhiaError, TVariables>({\n ...options,\n mutationFn: variables => run(config => mutationFn(config, variables)),\n })\n}\n"],"mappings":";;;;;;AAiCA,IAAa,IAAb,cAAkC,MAAM;CACtC;CACA;CAEA;CAEA,YACE,GACA,GACA,GACA;EAKA,AAJA,MAAM,CAAO,GACb,KAAK,OAAO,gBACZ,KAAK,OAAO,GACZ,KAAK,aAAa,GAAS,YAC3B,KAAK,uBAAuB,GAAS,wBAAwB;CAC/D;AACF;AAUA,SAAS,EAAyB,GAAmC;CACnE,IAAI,CAAC,KAAQ,OAAO,KAAS,UAC3B;CAEF,IAAM,IAAa,WAAW,IAAO,EAAK,QAAQ,KAAA;CAClD,IAAI,OAAO,KAAe,UACxB,OAAO;CAET,IAAI,KAAc,OAAO,KAAe,UAAU;EAChD,IAAI,aAAa,KAAc,OAAO,EAAW,WAAY,UAC3D,OAAO,EAAW;EAEpB,IAAI,WAAW,KAAc,OAAO,EAAW,SAAU,UACvD,OAAO,EAAW;CAEtB;CACA,IAAM,IAAe,aAAa,IAAO,EAAK,UAAU,KAAA;CACxD,IAAI,OAAO,KAAiB,UAC1B,OAAO;AAGX;AAMA,eAAe,EACb,GAC6B;CAC7B,IAAI;EAEF,OAAO,EAAyB,MADJ,EAAS,MAAM,EAAE,KAAK,CACd;CACtC,QAAQ;EAEN;CACF;AACF;AAEA,eAAsB,EAAe,GAAuC;CAC1E,IAAI,aAAiB,GACnB,OAAO;CAET,IAAI,aAAiB,GAAe;EAClC,IAAM,IAAa,EAAM,SAAS,QAC5B,IAAgB,MAAM,EAAyB,EAAM,QAAQ;EAenE,OAbE,MAAkB,mBAClB,MAAkB,oBAClB,MAAkB,sBAEX,IAAI,EAAa,GAAe,GAAe;GACpD;GAEA,sBAAsB,MAAkB;EAC1C,CAAC,IAKI,IAAI,EACT,WACA,KAAiB,2BAA2B,EAAW,IACvD,EAAE,cAAW,CACf;CACF;CACA,IAAM,IAAW,EAAyB,CAAK;CAI/C,OAHI,IACK,IAAI,EAAa,WAAW,CAAQ,IAEtC,IAAI,EACT,WACA,aAAiB,QAAQ,EAAM,UAAU,uBAC3C;AACF;AAQA,SAAS,IAIP;CACA,IAAM,IAAiB,EAA0B,GAC3C,EAAE,aAAa,MAAuB,EAAkB;CAE9D,OAAO;EACL,SAAS,CAAC,CAAC,KAAsB,CAAC,CAAC;EACnC,KAAK,OAAU,MAA0D;GACvE,IAAI,CAAC,KAAsB,CAAC,GAC1B,MAAM,IAAI,EACR,kBACA,uIACF;GAEF,IAAI;IAMF,OAAO,MAAM,EAAG,MALY,EAC1B,GACA,EAAe,aACf,EAAe,qBACjB,CAC6B;GAC/B,SAAS,GAAO;IACd,MAAM,MAAM,EAAe,CAAK;GAClC;EACF;CACF;AACF;AAQA,SAAgB,EACd,GACA,GACA,GACiC;CACjC,IAAM,EAAE,SAAS,GAAa,WAAQ,EAAe,GAG/C,EAAE,SAAS,GAAe,GAAG,MAAgB,KAAW,CAAC,GACzD,IACJ,MAAkB,KAAA,IAAY,IAAc,KAAe,CAAC,CAAC;CAE/D,OAAO,EAA6B;EAClC,GAAG;EACH;EACA;EACA,eAAe,EAAI,CAAO;CAC5B,CAAC;AACH;AAQA,SAAgB,EACd,GACA,GACoD;CACpD,IAAM,EAAE,WAAQ,EAAe;CAE/B,OAAO,EAA6C;EAClD,GAAG;EACH,aAAY,MAAa,GAAI,MAAU,EAAW,GAAQ,CAAS,CAAC;CACtE,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"useAridhiaQuery.js","names":[],"sources":["../../src/aridhia-queries/useAridhiaQuery.ts"],"sourcesContent":["import {\n useMutation,\n useQuery,\n QueryKey,\n UseMutationOptions,\n UseMutationResult,\n UseQueryOptions,\n UseQueryResult,\n} from '@tanstack/react-query'\nimport {\n Configuration,\n ResponseError,\n} from '@sage-bionetworks/aridhia-client/generated/runtime'\nimport { useAridhiaContextOptional } from '@/utils/context/AridhiaContext'\nimport { useSynapseContext } from '@/utils/context/SynapseContext'\nimport { createAridhiaApiConfiguration } from './aridhiaTokenExchange'\n\n/**\n * - `invalid_token` / `invalid_issuer` — the gateway's `/authenticate` rejected the Synapse\n * token outright. The gateway currently mints a token whether or not the account is linked\n * to RDCA-DAP, but kept as a recognized shape in case that changes.\n * - `not_authorized` — a FAIR API call (e.g. `GET /fair/requests`) rejected an otherwise-valid\n * Aridhia token with 403 `{ error: { message: 'Not authorised for this operation' } }`. This\n * is the actual eligibility signal in practice: it means no linked RDCA-DAP account yet.\n * - `Invalid parameter` — the token-exchange request body was malformed. This is our bug, not\n * the user's eligibility, so it is never treated as an eligibility failure.\n * - `not_configured` — called without an `AridhiaContextProvider` or a Synapse access token;\n * an environment/wiring problem, not a user-eligibility problem.\n * - `unknown` — any other HTTP or network failure.\n */\nexport type AridhiaErrorCode =\n | 'invalid_token'\n | 'invalid_issuer'\n | 'not_authorized'\n | 'Invalid parameter'\n | 'not_configured'\n | 'unknown'\n\nexport class AridhiaError extends Error {\n code: AridhiaErrorCode\n httpStatus?: number\n /** true when the failure means \"this user cannot use the DAP API yet\" */\n isEligibilityFailure: boolean\n\n constructor(\n code: AridhiaErrorCode,\n message: string,\n options?: { httpStatus?: number; isEligibilityFailure?: boolean },\n ) {\n super(message)\n this.name = 'AridhiaError'\n this.code = code\n this.httpStatus = options?.httpStatus\n this.isEligibilityFailure = options?.isEligibilityFailure ?? false\n }\n}\n\n/**\n * Pulls a human-usable error string out of a JSON response body:\n * - Gateway OAuth error: `{ error: 'invalid_token' }`\n * - FAIR API error envelope: `{ error: { status: 400, message: '...' } }`\n * - Direct message envelope: `{ message: '...' }`\n *\n * Returns `undefined` when the body carries no recognizable error text.\n */\nfunction extractErrorTextFromBody(body: unknown): string | undefined {\n if (!body || typeof body !== 'object') {\n return undefined\n }\n const errorField = 'error' in body ? body.error : undefined\n if (typeof errorField === 'string') {\n return errorField\n }\n if (errorField && typeof errorField === 'object') {\n if ('message' in errorField && typeof errorField.message === 'string') {\n return errorField.message\n }\n if ('error' in errorField && typeof errorField.error === 'string') {\n return errorField.error\n }\n }\n const messageField = 'message' in body ? body.message : undefined\n if (typeof messageField === 'string') {\n return messageField\n }\n return undefined\n}\n\n/**\n * Pulls a human-usable error string out of a `ResponseError`'s JSON body.\n * Returns `undefined` when the body isn't JSON, was already consumed, or carries no recognizable field.\n */\nasync function extractResponseErrorText(\n response: ResponseError['response'],\n): Promise<string | undefined> {\n try {\n const body: unknown = await response.clone().json()\n return extractErrorTextFromBody(body)\n } catch {\n // Response body wasn't JSON (or was already consumed).\n return undefined\n }\n}\n\nexport async function toAridhiaError(error: unknown): Promise<AridhiaError> {\n if (error instanceof AridhiaError) {\n return error\n }\n if (error instanceof ResponseError) {\n const httpStatus = error.response.status\n const bodyErrorText = await extractResponseErrorText(error.response)\n if (\n bodyErrorText === 'invalid_token' ||\n bodyErrorText === 'invalid_issuer' ||\n bodyErrorText === 'Invalid parameter'\n ) {\n return new AridhiaError(bodyErrorText, bodyErrorText, {\n httpStatus,\n // A malformed request body is our bug, not the user's account state.\n isEligibilityFailure: bodyErrorText !== 'Invalid parameter',\n })\n }\n // The gateway's `/authenticate` always mints a token regardless of RDCA-DAP linkage; a FAIR\n // resource call (e.g. `/fair/requests`) is what actually rejects an unlinked account, as a\n // 403 with this message in its own `{ error: { message } }` envelope.\n if (\n httpStatus === 403 &&\n (bodyErrorText?.toLowerCase().includes('not authorised') ||\n bodyErrorText?.toLowerCase().includes('not authorized'))\n ) {\n return new AridhiaError('not_authorized', bodyErrorText, {\n httpStatus,\n isEligibilityFailure: true,\n })\n }\n // An unrecognized error shape (e.g. a FAIR-side validation error on `/requests/`, which\n // uses a different envelope than the gateway's `/authenticate`) — keep `code: 'unknown'`\n // but surface the server's own text verbatim so the caller can quote it.\n return new AridhiaError(\n 'unknown',\n bodyErrorText ?? `Aridhia request failed (${httpStatus})`,\n { httpStatus },\n )\n }\n const bodyText = extractErrorTextFromBody(error)\n if (bodyText) {\n return new AridhiaError('unknown', bodyText)\n }\n return new AridhiaError(\n 'unknown',\n error instanceof Error ? error.message : 'Unknown Aridhia error',\n )\n}\n\n/**\n * Resolves the `AridhiaContext` and the current Synapse access token, exchanges it for a fresh\n * Aridhia token (tokens are single-use — see `aridhiaTokenExchange.ts`), and returns a `run`\n * function that executes a call with the resulting `Configuration`, normalizing any failure into\n * an `AridhiaError`.\n */\nfunction useAridhiaCall(): {\n /** `!!synapseAccessToken && !!aridhiaContext` — every read and write is gated on this. */\n enabled: boolean\n run: <T>(fn: (config: Configuration) => Promise<T>) => Promise<T>\n} {\n const aridhiaContext = useAridhiaContextOptional()\n const { accessToken: synapseAccessToken } = useSynapseContext()\n\n return {\n enabled: !!synapseAccessToken && !!aridhiaContext,\n run: async <T>(fn: (config: Configuration) => Promise<T>): Promise<T> => {\n if (!synapseAccessToken || !aridhiaContext) {\n throw new AridhiaError(\n 'not_configured',\n 'AridhiaContext is not available, or no Synapse access token is present. Make sure to wrap your component with AridhiaContextProvider.',\n )\n }\n try {\n const configuration = await createAridhiaApiConfiguration(\n synapseAccessToken,\n aridhiaContext.apiBasePath,\n aridhiaContext.authenticationRequest,\n )\n return await fn(configuration)\n } catch (error) {\n throw await toAridhiaError(error)\n }\n },\n }\n}\n\n/**\n * Shared query primitive for every Aridhia (C-Path FAIR) read: resolves the `AridhiaContext` and\n * the current Synapse access token, exchanges it for a fresh Aridhia token (tokens are\n * single-use — see `aridhiaTokenExchange.ts`), runs `queryFn` with the resulting `Configuration`,\n * and normalizes any failure into an `AridhiaError`.\n */\nexport function useAridhiaQuery<T>(\n queryKey: QueryKey,\n queryFn: (config: Configuration) => Promise<T>,\n options?: Partial<UseQueryOptions<T, AridhiaError, T>>,\n): UseQueryResult<T, AridhiaError> {\n const { enabled: baseEnabled, run } = useAridhiaCall()\n // Composed, not overridden: a caller's `enabled` (e.g. \"workflowKey is known yet\") can only\n // narrow when the query runs, never bypass the token/context prerequisite.\n const { enabled: callerEnabled, ...restOptions } = options ?? {}\n const enabled =\n callerEnabled === undefined ? baseEnabled : baseEnabled && !!callerEnabled\n\n return useQuery<T, AridhiaError, T>({\n ...restOptions,\n enabled,\n queryKey,\n queryFn: () => run(queryFn),\n })\n}\n\n/**\n * Shared mutation primitive for every Aridhia (C-Path FAIR) write: resolves the `AridhiaContext`\n * and the current Synapse access token, exchanges it for a fresh Aridhia token (tokens are\n * single-use — see `aridhiaTokenExchange.ts`), runs `mutationFn` with the resulting\n * `Configuration` and the mutation variables, and normalizes any failure into an `AridhiaError`.\n */\nexport function useAridhiaMutation<TData, TVariables = void>(\n mutationFn: (config: Configuration, variables: TVariables) => Promise<TData>,\n options?: Partial<UseMutationOptions<TData, AridhiaError, TVariables>>,\n): UseMutationResult<TData, AridhiaError, TVariables> {\n const { run } = useAridhiaCall()\n\n return useMutation<TData, AridhiaError, TVariables>({\n ...options,\n mutationFn: variables => run(config => mutationFn(config, variables)),\n })\n}\n"],"mappings":";;;;;;AAsCA,IAAa,IAAb,cAAkC,MAAM;CACtC;CACA;CAEA;CAEA,YACE,GACA,GACA,GACA;EAKA,AAJA,MAAM,CAAO,GACb,KAAK,OAAO,gBACZ,KAAK,OAAO,GACZ,KAAK,aAAa,GAAS,YAC3B,KAAK,uBAAuB,GAAS,wBAAwB;CAC/D;AACF;AAUA,SAAS,EAAyB,GAAmC;CACnE,IAAI,CAAC,KAAQ,OAAO,KAAS,UAC3B;CAEF,IAAM,IAAa,WAAW,IAAO,EAAK,QAAQ,KAAA;CAClD,IAAI,OAAO,KAAe,UACxB,OAAO;CAET,IAAI,KAAc,OAAO,KAAe,UAAU;EAChD,IAAI,aAAa,KAAc,OAAO,EAAW,WAAY,UAC3D,OAAO,EAAW;EAEpB,IAAI,WAAW,KAAc,OAAO,EAAW,SAAU,UACvD,OAAO,EAAW;CAEtB;CACA,IAAM,IAAe,aAAa,IAAO,EAAK,UAAU,KAAA;CACxD,IAAI,OAAO,KAAiB,UAC1B,OAAO;AAGX;AAMA,eAAe,EACb,GAC6B;CAC7B,IAAI;EAEF,OAAO,EAAyB,MADJ,EAAS,MAAM,EAAE,KAAK,CACd;CACtC,QAAQ;EAEN;CACF;AACF;AAEA,eAAsB,EAAe,GAAuC;CAC1E,IAAI,aAAiB,GACnB,OAAO;CAET,IAAI,aAAiB,GAAe;EAClC,IAAM,IAAa,EAAM,SAAS,QAC5B,IAAgB,MAAM,EAAyB,EAAM,QAAQ;EA4BnE,OA1BE,MAAkB,mBAClB,MAAkB,oBAClB,MAAkB,sBAEX,IAAI,EAAa,GAAe,GAAe;GACpD;GAEA,sBAAsB,MAAkB;EAC1C,CAAC,IAMD,MAAe,QACd,GAAe,YAAY,EAAE,SAAS,gBAAgB,KACrD,GAAe,YAAY,EAAE,SAAS,gBAAgB,KAEjD,IAAI,EAAa,kBAAkB,GAAe;GACvD;GACA,sBAAsB;EACxB,CAAC,IAKI,IAAI,EACT,WACA,KAAiB,2BAA2B,EAAW,IACvD,EAAE,cAAW,CACf;CACF;CACA,IAAM,IAAW,EAAyB,CAAK;CAI/C,OAHI,IACK,IAAI,EAAa,WAAW,CAAQ,IAEtC,IAAI,EACT,WACA,aAAiB,QAAQ,EAAM,UAAU,uBAC3C;AACF;AAQA,SAAS,IAIP;CACA,IAAM,IAAiB,EAA0B,GAC3C,EAAE,aAAa,MAAuB,EAAkB;CAE9D,OAAO;EACL,SAAS,CAAC,CAAC,KAAsB,CAAC,CAAC;EACnC,KAAK,OAAU,MAA0D;GACvE,IAAI,CAAC,KAAsB,CAAC,GAC1B,MAAM,IAAI,EACR,kBACA,uIACF;GAEF,IAAI;IAMF,OAAO,MAAM,EAAG,MALY,EAC1B,GACA,EAAe,aACf,EAAe,qBACjB,CAC6B;GAC/B,SAAS,GAAO;IACd,MAAM,MAAM,EAAe,CAAK;GAClC;EACF;CACF;AACF;AAQA,SAAgB,EACd,GACA,GACA,GACiC;CACjC,IAAM,EAAE,SAAS,GAAa,WAAQ,EAAe,GAG/C,EAAE,SAAS,GAAe,GAAG,MAAgB,KAAW,CAAC,GACzD,IACJ,MAAkB,KAAA,IAAY,IAAc,KAAe,CAAC,CAAC;CAE/D,OAAO,EAA6B;EAClC,GAAG;EACH;EACA;EACA,eAAe,EAAI,CAAO;CAC5B,CAAC;AACH;AAQA,SAAgB,EACd,GACA,GACoD;CACpD,IAAM,EAAE,WAAQ,EAAe;CAE/B,OAAO,EAA6C;EAClD,GAAG;EACH,aAAY,MAAa,GAAI,MAAU,EAAW,GAAQ,CAAS,CAAC;CACtE,CAAC;AACH"}
|
|
@@ -3,7 +3,8 @@ export type AridhiaAccessStatusProps = {
|
|
|
3
3
|
* dataset code
|
|
4
4
|
*/
|
|
5
5
|
datasetCode: string;
|
|
6
|
-
|
|
6
|
+
/** Base URL of the RDCA-DAP FAIR portal's browsable UI, e.g. `https://fair.dap.c-path.org`. */
|
|
7
|
+
fairPortalUrl?: string;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* Component that displays the Aridhia data access request status.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AridhiaAccessStatus.d.ts","sourceRoot":"","sources":["../../../src/components/Aridhia/AridhiaAccessStatus.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AridhiaAccessStatus.d.ts","sourceRoot":"","sources":["../../../src/components/Aridhia/AridhiaAccessStatus.tsx"],"names":[],"mappings":"AAkBA,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,+FAA+F;IAC/F,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CA4J1E"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { SRC_SIGN_IN_CLASS as e } from "../../utils/SynapseConstants.js";
|
|
2
2
|
import { useSynapseContext as t } from "../../utils/context/SynapseContext.js";
|
|
3
3
|
import "../../utils/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { findRequestForDataset as s, getRestrictionUiTypeFromAridhiaRequest as c } from "./aridhiaAccessStatusUtils.js";
|
|
10
|
-
import { useGetAridhiaRequests as l } from "../../aridhia-queries/useGetAridhiaRequests.js";
|
|
4
|
+
import { DialogBase as n } from "../DialogBase.js";
|
|
5
|
+
import r, { RestrictionUiType as i } from "../HasAccess/AccessIcon.js";
|
|
6
|
+
import { findRequestForDataset as a, getRestrictionUiTypeFromAridhiaRequest as o } from "./aridhiaAccessStatusUtils.js";
|
|
7
|
+
import { getAridhiaFairPortalDatasetUrl as s } from "./aridhiaFairPortalUrls.js";
|
|
8
|
+
import { useGetAridhiaRequests as c } from "../../aridhia-queries/useGetAridhiaRequests.js";
|
|
11
9
|
import "../../aridhia-queries/index.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
10
|
+
import l from "./AridhiaDarStatusPopover.js";
|
|
11
|
+
import u from "./RdcaDapEligibilityDialog.js";
|
|
12
|
+
import { useAridhiaDarWizardParts as d } from "./DarWizard/AridhiaDarWizard.js";
|
|
13
|
+
import { useState as f } from "react";
|
|
14
|
+
import { Button as p } from "@mui/material";
|
|
15
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
16
16
|
//#region src/components/Aridhia/AridhiaAccessStatus.tsx
|
|
17
|
-
var
|
|
17
|
+
var _ = {
|
|
18
18
|
p: "0px",
|
|
19
19
|
minWidth: "unset"
|
|
20
20
|
};
|
|
21
|
-
function
|
|
22
|
-
let { datasetCode:
|
|
23
|
-
enabled:
|
|
24
|
-
onClose: () =>
|
|
21
|
+
function v(v) {
|
|
22
|
+
let { datasetCode: y, fairPortalUrl: b } = v, { isAuthenticated: x } = t(), { data: S, isLoading: C, isError: w, error: T } = c(), [E, D] = f(null), [O, k] = f(!1), [A, j] = f(!1), { content: M, actions: N } = d({ datasetCode: y }, {
|
|
23
|
+
enabled: A,
|
|
24
|
+
onClose: () => j(!1)
|
|
25
25
|
});
|
|
26
|
-
if (!
|
|
27
|
-
sx:
|
|
26
|
+
if (!x) return /* @__PURE__ */ h(p, {
|
|
27
|
+
sx: _,
|
|
28
28
|
className: e,
|
|
29
29
|
onClick: (e) => {
|
|
30
30
|
if (e.isTrusted) {
|
|
@@ -32,30 +32,53 @@ function _(_) {
|
|
|
32
32
|
e.currentTarget.dispatchEvent(t);
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
children: /* @__PURE__ */
|
|
35
|
+
children: /* @__PURE__ */ h(r, { restrictionUiType: i.AccessBlockedToAnonymous })
|
|
36
36
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
let P = null;
|
|
38
|
+
if (!C) if (w && T.isEligibilityFailure) P = /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(p, {
|
|
39
|
+
sx: _,
|
|
40
|
+
onClick: () => k(!0),
|
|
41
|
+
"aria-label": "Link your RDCA-DAP account",
|
|
42
|
+
children: /* @__PURE__ */ h(r, { restrictionUiType: i.AccessBlockedByRDCADAPAccountNotLinked })
|
|
43
|
+
}), /* @__PURE__ */ h(u, {
|
|
44
|
+
open: O,
|
|
45
|
+
onClose: () => k(!1)
|
|
46
|
+
})] });
|
|
47
|
+
else {
|
|
48
|
+
let e = a(S?.items ?? [], y), t = o(e), n = /* @__PURE__ */ h(r, { restrictionUiType: t });
|
|
49
|
+
P = t === i.AccessibleOnRDCADAP ? b ? /* @__PURE__ */ h("a", {
|
|
50
|
+
href: s(b, y),
|
|
51
|
+
target: "_blank",
|
|
52
|
+
rel: "noopener noreferrer",
|
|
53
|
+
children: n
|
|
54
|
+
}) : n : e ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(p, {
|
|
55
|
+
sx: _,
|
|
56
|
+
onClick: (e) => D(e.currentTarget),
|
|
57
|
+
"aria-label": "View data access request status",
|
|
58
|
+
children: n
|
|
59
|
+
}), /* @__PURE__ */ h(l, {
|
|
60
|
+
open: !!E,
|
|
61
|
+
anchorEl: E,
|
|
62
|
+
onClose: () => D(null),
|
|
63
|
+
request: e,
|
|
64
|
+
fairPortalUrl: b
|
|
65
|
+
})] }) : /* @__PURE__ */ h(p, {
|
|
66
|
+
sx: _,
|
|
67
|
+
onClick: () => j(!0),
|
|
68
|
+
"aria-label": "Request data access",
|
|
69
|
+
children: n
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return /* @__PURE__ */ g(m, { children: [P, /* @__PURE__ */ h(n, {
|
|
73
|
+
open: A,
|
|
74
|
+
onCancel: () => j(!1),
|
|
52
75
|
maxWidth: "md",
|
|
53
76
|
title: "Request Data Access",
|
|
54
|
-
content:
|
|
55
|
-
actions:
|
|
77
|
+
content: M,
|
|
78
|
+
actions: N
|
|
56
79
|
})] });
|
|
57
80
|
}
|
|
58
81
|
//#endregion
|
|
59
|
-
export {
|
|
82
|
+
export { v as default };
|
|
60
83
|
|
|
61
84
|
//# sourceMappingURL=AridhiaAccessStatus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AridhiaAccessStatus.js","names":[],"sources":["../../../src/components/Aridhia/AridhiaAccessStatus.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"AridhiaAccessStatus.js","names":[],"sources":["../../../src/components/Aridhia/AridhiaAccessStatus.tsx"],"sourcesContent":["import { ReactNode, useState } from 'react'\nimport { useGetAridhiaRequests } from '@/aridhia-queries'\nimport { useSynapseContext } from '@/utils'\nimport { SRC_SIGN_IN_CLASS } from '@/utils/SynapseConstants'\nimport { Button } from '@mui/material'\nimport { DialogBase } from '../DialogBase'\nimport AccessIcon, { RestrictionUiType } from '../HasAccess/AccessIcon'\nimport {\n findRequestForDataset,\n getRestrictionUiTypeFromAridhiaRequest,\n} from './aridhiaAccessStatusUtils'\nimport { getAridhiaFairPortalDatasetUrl } from './aridhiaFairPortalUrls'\nimport AridhiaDarStatusPopover from './AridhiaDarStatusPopover'\nimport { useAridhiaDarWizardParts } from './DarWizard/AridhiaDarWizard'\nimport RdcaDapEligibilityDialog from './RdcaDapEligibilityDialog'\n\nconst buttonSx = { p: '0px', minWidth: 'unset' }\n\nexport type AridhiaAccessStatusProps = {\n /**\n * dataset code\n */\n datasetCode: string\n /** Base URL of the RDCA-DAP FAIR portal's browsable UI, e.g. `https://fair.dap.c-path.org`. */\n fairPortalUrl?: string\n}\n\n/**\n * Component that displays the Aridhia data access request status.\n * If the user is not authenticated with Aridhia, shows a sign-in button.\n * Otherwise, shows the access status based on the data access requests.\n */\nexport default function AridhiaAccessStatus(props: AridhiaAccessStatusProps) {\n const { datasetCode, fairPortalUrl } = props\n const { isAuthenticated } = useSynapseContext()\n\n const {\n data: requestsResponse,\n isLoading,\n isError,\n error,\n } = useGetAridhiaRequests()\n const [popoverAnchorEl, setPopoverAnchorEl] = useState<HTMLElement | null>(\n null,\n )\n const [eligibilityDialogOpen, setEligibilityDialogOpen] = useState(false)\n const [requestDialogOpen, setRequestDialogOpen] = useState(false)\n const { content: wizardContent, actions: wizardActions } =\n useAridhiaDarWizardParts(\n { datasetCode },\n {\n enabled: requestDialogOpen,\n onClose: () => setRequestDialogOpen(false),\n },\n )\n\n if (!isAuthenticated) {\n return (\n <Button\n sx={buttonSx}\n className={SRC_SIGN_IN_CLASS}\n onClick={ev => {\n if (ev.isTrusted) {\n /*\n There is a tricky problem - \n The portals listens to click events for buttons with the class SRC_SIGN_IN_CLASS set, it listens to this event\n so that it can display the login modal.\n\n This button has an svg inside of it which is problematic because more often than not clicking this button will \n instead click that svg. The event listener in the portals will break as a result.\n\n Though the svg may get the actual click event, because of event bubbling this button will get its onClick called.\n Once onClick is called we can manually dispatch an event off of this button. This does pose a problem, we end up in a \n infinite loop because this button keeps dispatching click events, so we can use the isTrusted to recognize if onClick was\n triggered programmatically or by user click. Lastly, using { bubbles: true } ensures the event bubbles up to the document level.\n\n */\n const clickEvent = new MouseEvent('click', { bubbles: true })\n ev.currentTarget.dispatchEvent(clickEvent)\n }\n }}\n >\n <AccessIcon\n restrictionUiType={RestrictionUiType.AccessBlockedToAnonymous}\n />\n </Button>\n )\n }\n\n let content: ReactNode = null\n if (isLoading) {\n // Show loading state — nothing to render yet.\n } else if (isError && error.isEligibilityFailure) {\n // The token exchange (or any other request) failed because this user has no linked\n // RDCA-DAP account yet — the DAR wizard is unreachable until that's resolved.\n content = (\n <>\n <Button\n sx={buttonSx}\n onClick={() => setEligibilityDialogOpen(true)}\n aria-label=\"Link your RDCA-DAP account\"\n >\n <AccessIcon\n restrictionUiType={\n RestrictionUiType.AccessBlockedByRDCADAPAccountNotLinked\n }\n />\n </Button>\n <RdcaDapEligibilityDialog\n open={eligibilityDialogOpen}\n onClose={() => setEligibilityDialogOpen(false)}\n />\n </>\n )\n } else {\n // Check if there's a request for this dataset\n const entityRequest = findRequestForDataset(\n requestsResponse?.items ?? [],\n datasetCode,\n )\n const restrictionUiType =\n getRestrictionUiTypeFromAridhiaRequest(entityRequest)\n const icon = <AccessIcon restrictionUiType={restrictionUiType} />\n\n if (restrictionUiType === RestrictionUiType.AccessibleOnRDCADAP) {\n // Approved, or the RDCA-DAP request form is not yet enabled — keep the existing\n // link-out to RDCA-DAP to access or request the data.\n content = fairPortalUrl ? (\n <a\n href={getAridhiaFairPortalDatasetUrl(fairPortalUrl, datasetCode)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {icon}\n </a>\n ) : (\n icon\n )\n } else if (entityRequest) {\n // Pending or denied — click opens the status popover.\n content = (\n <>\n <Button\n sx={buttonSx}\n onClick={ev => setPopoverAnchorEl(ev.currentTarget)}\n aria-label=\"View data access request status\"\n >\n {icon}\n </Button>\n <AridhiaDarStatusPopover\n open={!!popoverAnchorEl}\n anchorEl={popoverAnchorEl}\n onClose={() => setPopoverAnchorEl(null)}\n request={entityRequest}\n fairPortalUrl={fairPortalUrl}\n />\n </>\n )\n } else {\n // No request yet — the icon opens the request wizard in a dialog. The same wizard also\n // renders at the route-based, non-modal `AridhiaDarWizard` page for a full-page entry\n // point.\n content = (\n <Button\n sx={buttonSx}\n onClick={() => setRequestDialogOpen(true)}\n aria-label=\"Request data access\"\n >\n {icon}\n </Button>\n )\n }\n }\n\n return (\n <>\n {content}\n {/* Ensure all authenticated return paths render the wizard dialog to prevent flicker as the DAR state changes (e.g. on the confirmation screen). */}\n <DialogBase\n open={requestDialogOpen}\n onCancel={() => setRequestDialogOpen(false)}\n maxWidth=\"md\"\n title=\"Request Data Access\"\n content={wizardContent}\n actions={wizardActions}\n />\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAM,IAAW;CAAE,GAAG;CAAO,UAAU;AAAQ;AAgB/C,SAAwB,EAAoB,GAAiC;CAC3E,IAAM,EAAE,gBAAa,qBAAkB,GACjC,EAAE,uBAAoB,EAAkB,GAExC,EACJ,MAAM,GACN,cACA,YACA,aACE,EAAsB,GACpB,CAAC,GAAiB,KAAsB,EAC5C,IACF,GACM,CAAC,GAAuB,KAA4B,EAAS,EAAK,GAClE,CAAC,GAAmB,KAAwB,EAAS,EAAK,GAC1D,EAAE,SAAS,GAAe,SAAS,MACvC,EACE,EAAE,eAAY,GACd;EACE,SAAS;EACT,eAAe,EAAqB,EAAK;CAC3C,CACF;CAEF,IAAI,CAAC,GACH,OACE,kBAAC,GAAD;EACE,IAAI;EACJ,WAAW;EACX,UAAS,MAAM;GACb,IAAI,EAAG,WAAW;IAehB,IAAM,IAAa,IAAI,WAAW,SAAS,EAAE,SAAS,GAAK,CAAC;IAC5D,EAAG,cAAc,cAAc,CAAU;GAC3C;EACF;YAEA,kBAAC,GAAD,EACE,mBAAmB,EAAkB,yBACtC,CAAA;CACK,CAAA;CAIZ,IAAI,IAAqB;CACzB,IAAI,IAEG,IAAI,KAAW,EAAM,sBAG1B,IACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;EACE,IAAI;EACJ,eAAe,EAAyB,EAAI;EAC5C,cAAW;YAEX,kBAAC,GAAD,EACE,mBACE,EAAkB,uCAErB,CAAA;CACK,CAAA,GACR,kBAAC,GAAD;EACE,MAAM;EACN,eAAe,EAAyB,EAAK;CAC9C,CAAA,CACD,EAAA,CAAA;MAEC;EAEL,IAAM,IAAgB,EACpB,GAAkB,SAAS,CAAC,GAC5B,CACF,GACM,IACJ,EAAuC,CAAa,GAChD,IAAO,kBAAC,GAAD,EAA+B,qBAAoB,CAAA;EAEhE,AAsCE,IAtCE,MAAsB,EAAkB,sBAGhC,IACR,kBAAC,KAAD;GACE,MAAM,EAA+B,GAAe,CAAW;GAC/D,QAAO;GACP,KAAI;aAEH;EACA,CAAA,IAEH,IAEO,IAGP,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;GACE,IAAI;GACJ,UAAS,MAAM,EAAmB,EAAG,aAAa;GAClD,cAAW;aAEV;EACK,CAAA,GACR,kBAAC,GAAD;GACE,MAAM,CAAC,CAAC;GACR,UAAU;GACV,eAAe,EAAmB,IAAI;GACtC,SAAS;GACM;EAChB,CAAA,CACD,EAAA,CAAA,IAOF,kBAAC,GAAD;GACE,IAAI;GACJ,eAAe,EAAqB,EAAI;GACxC,cAAW;aAEV;EACK,CAAA;CAGd;CAEA,OACE,kBAAA,GAAA,EAAA,UAAA,CACG,GAED,kBAAC,GAAD;EACE,MAAM;EACN,gBAAgB,EAAqB,EAAK;EAC1C,UAAS;EACT,OAAM;EACN,SAAS;EACT,SAAS;CACV,CAAA,CACD,EAAA,CAAA;AAEN"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PopoverProps } from '@mui/material';
|
|
2
|
+
import { RequestListItem } from '@sage-bionetworks/aridhia-client/generated/models';
|
|
3
|
+
export type AridhiaDarStatusPopoverProps = Pick<PopoverProps, 'anchorEl' | 'open' | 'id' | 'onClose'> & {
|
|
4
|
+
request: RequestListItem;
|
|
5
|
+
/** Base URL of the RDCA-DAP FAIR portal's browsable UI, e.g. `https://fair.dap.c-path.org`. */
|
|
6
|
+
fairPortalUrl?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Detail popover for a pending or denied DAR.
|
|
10
|
+
*/
|
|
11
|
+
export default function AridhiaDarStatusPopover(props: AridhiaDarStatusPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=AridhiaDarStatusPopover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AridhiaDarStatusPopover.d.ts","sourceRoot":"","sources":["../../../src/components/Aridhia/AridhiaDarStatusPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAIb,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAA;AAGnF,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAC7C,YAAY,EACZ,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CACvC,GAAG;IACF,OAAO,EAAE,eAAe,CAAA;IACxB,+FAA+F;IAC/F,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,KAAK,EAAE,4BAA4B,2CAwCpC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getAridhiaFairPortalRequestUrl as e } from "./aridhiaFairPortalUrls.js";
|
|
2
|
+
import { Link as t, Popover as n, Stack as r, Typography as i } from "@mui/material";
|
|
3
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/Aridhia/AridhiaDarStatusPopover.tsx
|
|
5
|
+
function s(s) {
|
|
6
|
+
let { anchorEl: c, open: l, id: u, onClose: d, request: f, fairPortalUrl: p } = s;
|
|
7
|
+
return /* @__PURE__ */ a(n, {
|
|
8
|
+
id: u,
|
|
9
|
+
open: l,
|
|
10
|
+
anchorEl: c,
|
|
11
|
+
onClose: d,
|
|
12
|
+
anchorOrigin: {
|
|
13
|
+
vertical: "bottom",
|
|
14
|
+
horizontal: "center"
|
|
15
|
+
},
|
|
16
|
+
transformOrigin: {
|
|
17
|
+
vertical: "top",
|
|
18
|
+
horizontal: "center"
|
|
19
|
+
},
|
|
20
|
+
children: /* @__PURE__ */ o(r, {
|
|
21
|
+
spacing: 1,
|
|
22
|
+
sx: {
|
|
23
|
+
p: 2,
|
|
24
|
+
maxWidth: 320
|
|
25
|
+
},
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ a(i, {
|
|
28
|
+
variant: "subtitle2",
|
|
29
|
+
children: f.name ?? f.code
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ o(i, {
|
|
32
|
+
variant: "body2",
|
|
33
|
+
children: ["Status: ", f.status]
|
|
34
|
+
}),
|
|
35
|
+
f.created_at && /* @__PURE__ */ o(i, {
|
|
36
|
+
variant: "body2",
|
|
37
|
+
children: ["Created: ", new Date(f.created_at).toLocaleDateString()]
|
|
38
|
+
}),
|
|
39
|
+
f.updated_at && /* @__PURE__ */ o(i, {
|
|
40
|
+
variant: "body2",
|
|
41
|
+
children: ["Updated: ", new Date(f.updated_at).toLocaleDateString()]
|
|
42
|
+
}),
|
|
43
|
+
p && f.code && /* @__PURE__ */ a(t, {
|
|
44
|
+
href: e(p, f.code),
|
|
45
|
+
target: "_blank",
|
|
46
|
+
rel: "noopener noreferrer",
|
|
47
|
+
children: "View on RDCA-DAP"
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { s as default };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=AridhiaDarStatusPopover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AridhiaDarStatusPopover.js","names":[],"sources":["../../../src/components/Aridhia/AridhiaDarStatusPopover.tsx"],"sourcesContent":["import {\n Popover,\n PopoverProps,\n Stack,\n Typography,\n Link as MuiLink,\n} from '@mui/material'\nimport { RequestListItem } from '@sage-bionetworks/aridhia-client/generated/models'\nimport { getAridhiaFairPortalRequestUrl } from './aridhiaFairPortalUrls'\n\nexport type AridhiaDarStatusPopoverProps = Pick<\n PopoverProps,\n 'anchorEl' | 'open' | 'id' | 'onClose'\n> & {\n request: RequestListItem\n /** Base URL of the RDCA-DAP FAIR portal's browsable UI, e.g. `https://fair.dap.c-path.org`. */\n fairPortalUrl?: string\n}\n\n/**\n * Detail popover for a pending or denied DAR.\n */\nexport default function AridhiaDarStatusPopover(\n props: AridhiaDarStatusPopoverProps,\n) {\n const { anchorEl, open, id, onClose, request, fairPortalUrl } = props\n\n return (\n <Popover\n id={id}\n open={open}\n anchorEl={anchorEl}\n onClose={onClose}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}\n transformOrigin={{ vertical: 'top', horizontal: 'center' }}\n >\n <Stack spacing={1} sx={{ p: 2, maxWidth: 320 }}>\n <Typography variant=\"subtitle2\">\n {request.name ?? request.code}\n </Typography>\n <Typography variant=\"body2\">Status: {request.status}</Typography>\n {request.created_at && (\n <Typography variant=\"body2\">\n Created: {new Date(request.created_at).toLocaleDateString()}\n </Typography>\n )}\n {request.updated_at && (\n <Typography variant=\"body2\">\n Updated: {new Date(request.updated_at).toLocaleDateString()}\n </Typography>\n )}\n {fairPortalUrl && request.code && (\n <MuiLink\n href={getAridhiaFairPortalRequestUrl(fairPortalUrl, request.code)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n View on RDCA-DAP\n </MuiLink>\n )}\n </Stack>\n </Popover>\n )\n}\n"],"mappings":";;;;AAsBA,SAAwB,EACtB,GACA;CACA,IAAM,EAAE,aAAU,SAAM,OAAI,YAAS,YAAS,qBAAkB;CAEhE,OACE,kBAAC,GAAD;EACM;EACE;EACI;EACD;EACT,cAAc;GAAE,UAAU;GAAU,YAAY;EAAS;EACzD,iBAAiB;GAAE,UAAU;GAAO,YAAY;EAAS;YAEzD,kBAAC,GAAD;GAAO,SAAS;GAAG,IAAI;IAAE,GAAG;IAAG,UAAU;GAAI;aAA7C;IACE,kBAAC,GAAD;KAAY,SAAQ;eACjB,EAAQ,QAAQ,EAAQ;IACf,CAAA;IACZ,kBAAC,GAAD;KAAY,SAAQ;eAApB,CAA4B,YAAS,EAAQ,MAAmB;;IAC/D,EAAQ,cACP,kBAAC,GAAD;KAAY,SAAQ;eAApB,CAA4B,aAChB,IAAI,KAAK,EAAQ,UAAU,EAAE,mBAAmB,CAChD;;IAEb,EAAQ,cACP,kBAAC,GAAD;KAAY,SAAQ;eAApB,CAA4B,aAChB,IAAI,KAAK,EAAQ,UAAU,EAAE,mBAAmB,CAChD;;IAEb,KAAiB,EAAQ,QACxB,kBAAC,GAAD;KACE,MAAM,EAA+B,GAAe,EAAQ,IAAI;KAChE,QAAO;KACP,KAAI;eACL;IAEQ,CAAA;GAEN;;CACA,CAAA;AAEb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AridhiaDarWizard.d.ts","sourceRoot":"","sources":["../../../../src/components/Aridhia/DarWizard/AridhiaDarWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAA;AAS/D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"AridhiaDarWizard.d.ts","sourceRoot":"","sources":["../../../../src/components/Aridhia/DarWizard/AridhiaDarWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAA;AAS/D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAkB7D,YAAY,EAAE,YAAY,EAAE,CAAA;AAE5B,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C,CAAA;AAkCD;;;GAGG;AACH,iBAAS,wBAAwB,CAC/B,KAAK,EAAE,qBAAqB,EAC5B,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,GACA;IACD,OAAO,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CA8ZA;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAY5D;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAA"}
|
|
@@ -2,19 +2,20 @@ import { useGlobalIsEditingContext as e } from "../../../utils/context/GlobalIsE
|
|
|
2
2
|
import { fairSectionToRjsf as t, parseFairFormSections as n, summarizeFormAnswers as r } from "../fairFormToRjsf.js";
|
|
3
3
|
import { useGetAridhiaDatasetSettings as i } from "../../../aridhia-queries/useGetAridhiaDatasetSettings.js";
|
|
4
4
|
import { useGetAridhiaWorkflow as a } from "../../../aridhia-queries/useGetAridhiaWorkflow.js";
|
|
5
|
-
import { useGetAridhiaDictionaries as
|
|
6
|
-
import { useGetAridhiaWorkspaces as
|
|
7
|
-
import { useGetAridhiaWorkspaceRequestForm as
|
|
8
|
-
import { useSubmitAridhiaDar as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
5
|
+
import { useGetAridhiaDictionaries as ee } from "../../../aridhia-queries/useGetAridhiaDictionaries.js";
|
|
6
|
+
import { useGetAridhiaWorkspaces as te } from "../../../aridhia-queries/useGetAridhiaWorkspaces.js";
|
|
7
|
+
import { useGetAridhiaWorkspaceRequestForm as o } from "../../../aridhia-queries/useGetAridhiaWorkspaceRequestForm.js";
|
|
8
|
+
import { useSubmitAridhiaDar as ne } from "../../../aridhia-queries/useSubmitAridhiaDar.js";
|
|
9
|
+
import { RdcaDapEligibilityExplainer as re } from "../RdcaDapEligibilityDialog.js";
|
|
10
|
+
import { useDarDraft as s } from "./useDarDraft.js";
|
|
11
|
+
import { DarDestinationStep as c } from "./DarDestinationStep.js";
|
|
12
|
+
import { DarWorkspaceStep as ie } from "./DarWorkspaceStep.js";
|
|
13
|
+
import { DarAboutStep as ae } from "./DarAboutStep.js";
|
|
14
|
+
import { DarProjectStep as oe } from "./DarProjectStep.js";
|
|
15
|
+
import { DarCompleteStep as l } from "./DarCompleteStep.js";
|
|
15
16
|
import { DarSubmittedPanel as u } from "./DarSubmittedPanel.js";
|
|
16
17
|
import { useEffect as d, useMemo as f, useState as p } from "react";
|
|
17
|
-
import { Alert as m, Box as h, Button as g, Link as
|
|
18
|
+
import { Alert as m, Box as h, Button as g, Link as se, Skeleton as _ } from "@mui/material";
|
|
18
19
|
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
19
20
|
//#region src/components/Aridhia/DarWizard/AridhiaDarWizard.tsx
|
|
20
21
|
var x = [
|
|
@@ -35,9 +36,9 @@ function w(e, r) {
|
|
|
35
36
|
}, [e, r]);
|
|
36
37
|
}
|
|
37
38
|
function T(t, n) {
|
|
38
|
-
let { datasetCode: h, datasetName: T, onSubmitted: E } = t, D = n?.enabled ?? !0, { draft: O, setDraft: k, clearDraft:
|
|
39
|
+
let { datasetCode: h, datasetName: T, onSubmitted: E } = t, D = n?.enabled ?? !0, { draft: O, setDraft: k, clearDraft: ce } = s(h), [A, le] = p(), j = D && !A && (O.step > 0 || O.selectedDictionaryCodes.length > 0 || O.workspaceRequested || O.termsAccepted || Object.keys(O.values).length > 0), { setIsEditing: M } = e();
|
|
39
40
|
d(() => (M(j), () => M(!1)), [j, M]);
|
|
40
|
-
let N = i(h, { enabled: D }), P = N.data?.workflow_key, F = a(P), I =
|
|
41
|
+
let N = i(h, { enabled: D }), P = N.data?.workflow_key, F = a(P), I = o({ enabled: O.workspaceRequested && D }), L = ee(h, { enabled: D }), R = te(h, O.workspaceLocation, { enabled: D }), z = f(() => {
|
|
41
42
|
let e = N.data;
|
|
42
43
|
return e ? x.filter((t) => e[`allow_${t}`] === !0) : [];
|
|
43
44
|
}, [N.data]);
|
|
@@ -60,14 +61,20 @@ function T(t, n) {
|
|
|
60
61
|
V,
|
|
61
62
|
H,
|
|
62
63
|
O.workspaceRequested
|
|
63
|
-
]), W =
|
|
64
|
-
|
|
64
|
+
]), W = ne({ onSuccess: (e) => {
|
|
65
|
+
ce();
|
|
65
66
|
let t = e.code ?? O.code;
|
|
66
|
-
|
|
67
|
+
le({
|
|
67
68
|
code: t,
|
|
68
69
|
status: e.status
|
|
69
70
|
}), E?.(t);
|
|
70
71
|
} });
|
|
72
|
+
if ([
|
|
73
|
+
N.error,
|
|
74
|
+
F.error,
|
|
75
|
+
L.error,
|
|
76
|
+
W.error
|
|
77
|
+
].find((e) => e?.isEligibilityFailure)) return { content: /* @__PURE__ */ y(re, {}) };
|
|
71
78
|
if (N.isLoading) return { content: /* @__PURE__ */ y(_, { height: 400 }) };
|
|
72
79
|
if (N.isError || !N.data) return { content: /* @__PURE__ */ y(m, {
|
|
73
80
|
severity: "error",
|
|
@@ -99,8 +106,8 @@ function T(t, n) {
|
|
|
99
106
|
"project",
|
|
100
107
|
"about",
|
|
101
108
|
"complete"
|
|
102
|
-
], K = G[Math.min(O.step, G.length - 1)], q = (L.data?.items ?? []).filter((e) => !!e.code), J = O.selectedDictionaryCodes.length > 0 ? q.filter((e) => O.selectedDictionaryCodes.includes(e.code)) : q,
|
|
103
|
-
function
|
|
109
|
+
], K = G[Math.min(O.step, G.length - 1)], q = (L.data?.items ?? []).filter((e) => !!e.code), J = O.selectedDictionaryCodes.length > 0 ? q.filter((e) => O.selectedDictionaryCodes.includes(e.code)) : q, ue = (R.data?.items ?? []).find((e) => e.uuid === O.workspaceUuid)?.name, de = z.length > 1, fe = B ? r(B.schema, O.values) : [], pe = V ? r(V.schema, O.values) : [];
|
|
110
|
+
function me(e) {
|
|
104
111
|
switch (e) {
|
|
105
112
|
case "destination": return !!O.transferType && (O.workspaceRequested || !!O.workspaceUuid);
|
|
106
113
|
case "workspace": return !I.isLoading && !!O.workspaceReference?.trim() && (!H || C(H.schema, O.values));
|
|
@@ -137,7 +144,7 @@ function T(t, n) {
|
|
|
137
144
|
selectedDictionaries: J
|
|
138
145
|
});
|
|
139
146
|
}
|
|
140
|
-
let Q = G.indexOf(K), $ =
|
|
147
|
+
let Q = G.indexOf(K), $ = me(K);
|
|
141
148
|
return {
|
|
142
149
|
content: /* @__PURE__ */ b(v, { children: [
|
|
143
150
|
U.length > 0 && /* @__PURE__ */ b(m, {
|
|
@@ -148,7 +155,7 @@ function T(t, n) {
|
|
|
148
155
|
U.map((e) => e.name).join(", "),
|
|
149
156
|
"). Please",
|
|
150
157
|
" ",
|
|
151
|
-
/* @__PURE__ */ y(
|
|
158
|
+
/* @__PURE__ */ y(se, {
|
|
152
159
|
href: S,
|
|
153
160
|
target: "_blank",
|
|
154
161
|
rel: "noopener noreferrer",
|
|
@@ -158,7 +165,7 @@ function T(t, n) {
|
|
|
158
165
|
"— submission is disabled until this is resolved."
|
|
159
166
|
]
|
|
160
167
|
}),
|
|
161
|
-
K === "destination" && /* @__PURE__ */ y(
|
|
168
|
+
K === "destination" && /* @__PURE__ */ y(c, {
|
|
162
169
|
datasetCode: h,
|
|
163
170
|
allowedTransferTypes: z,
|
|
164
171
|
selectedDictionaryCodes: O.selectedDictionaryCodes,
|
|
@@ -186,7 +193,7 @@ function T(t, n) {
|
|
|
186
193
|
transferType: e
|
|
187
194
|
}))
|
|
188
195
|
}),
|
|
189
|
-
K === "workspace" && (I.isLoading ? /* @__PURE__ */ y(_, { height: 200 }) : H ? /* @__PURE__ */ y(
|
|
196
|
+
K === "workspace" && (I.isLoading ? /* @__PURE__ */ y(_, { height: 200 }) : H ? /* @__PURE__ */ y(ie, {
|
|
190
197
|
schema: H.schema,
|
|
191
198
|
uiSchema: H.uiSchema,
|
|
192
199
|
formData: O.values,
|
|
@@ -200,7 +207,7 @@ function T(t, n) {
|
|
|
200
207
|
severity: "error",
|
|
201
208
|
children: "Unable to load the new-workspace request form. Please try again later."
|
|
202
209
|
})),
|
|
203
|
-
K === "project" && (F.isLoading ? /* @__PURE__ */ y(_, { height: 200 }) : V ? /* @__PURE__ */ y(
|
|
210
|
+
K === "project" && (F.isLoading ? /* @__PURE__ */ y(_, { height: 200 }) : V ? /* @__PURE__ */ y(oe, {
|
|
204
211
|
schema: V.schema,
|
|
205
212
|
uiSchema: V.uiSchema,
|
|
206
213
|
formData: O.values,
|
|
@@ -209,7 +216,7 @@ function T(t, n) {
|
|
|
209
216
|
severity: "error",
|
|
210
217
|
children: "Unable to load the project section of this request form. Please try again later."
|
|
211
218
|
})),
|
|
212
|
-
K === "about" && (F.isLoading ? /* @__PURE__ */ y(_, { height: 200 }) : B ? /* @__PURE__ */ y(
|
|
219
|
+
K === "about" && (F.isLoading ? /* @__PURE__ */ y(_, { height: 200 }) : B ? /* @__PURE__ */ y(ae, {
|
|
213
220
|
schema: B.schema,
|
|
214
221
|
uiSchema: B.uiSchema,
|
|
215
222
|
formData: O.values,
|
|
@@ -218,18 +225,18 @@ function T(t, n) {
|
|
|
218
225
|
severity: "error",
|
|
219
226
|
children: "Unable to load the \"about you\" section of this request form. Please try again later."
|
|
220
227
|
})),
|
|
221
|
-
K === "complete" && /* @__PURE__ */ y(
|
|
228
|
+
K === "complete" && /* @__PURE__ */ y(l, {
|
|
222
229
|
datasetCode: h,
|
|
223
230
|
datasetName: T,
|
|
224
231
|
selectedDictionaryNames: J.map((e) => e.name ?? e.code),
|
|
225
232
|
allTablesSelected: O.selectedDictionaryCodes.length === 0,
|
|
226
233
|
workspaceRequested: O.workspaceRequested,
|
|
227
|
-
workspaceName:
|
|
234
|
+
workspaceName: ue,
|
|
228
235
|
workspaceReference: O.workspaceReference,
|
|
229
|
-
showTransferType:
|
|
236
|
+
showTransferType: de,
|
|
230
237
|
transferType: O.transferType ?? z[0],
|
|
231
|
-
aboutAnswers:
|
|
232
|
-
projectAnswers:
|
|
238
|
+
aboutAnswers: fe,
|
|
239
|
+
projectAnswers: pe,
|
|
233
240
|
termsAccepted: O.termsAccepted,
|
|
234
241
|
onTermsAcceptedChange: (e) => k((t) => ({
|
|
235
242
|
...t,
|
|
@@ -254,7 +261,8 @@ function T(t, n) {
|
|
|
254
261
|
children: "Back"
|
|
255
262
|
}), K === "complete" ? /* @__PURE__ */ y(g, {
|
|
256
263
|
variant: "contained",
|
|
257
|
-
disabled: !$ || U.length > 0
|
|
264
|
+
disabled: !$ || U.length > 0,
|
|
265
|
+
loading: W.isPending,
|
|
258
266
|
onClick: Z,
|
|
259
267
|
children: "Submit request"
|
|
260
268
|
}) : /* @__PURE__ */ y(g, {
|