synapse-react-client 4.0.37 → 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.
Files changed (226) hide show
  1. package/dist/SWC.index.js +1 -1
  2. package/dist/aridhia-queries/useAridhiaQuery.d.ts +6 -2
  3. package/dist/aridhia-queries/useAridhiaQuery.d.ts.map +1 -1
  4. package/dist/aridhia-queries/useAridhiaQuery.js +3 -0
  5. package/dist/aridhia-queries/useAridhiaQuery.js.map +1 -1
  6. package/dist/components/Aridhia/AridhiaAccessStatus.d.ts +2 -1
  7. package/dist/components/Aridhia/AridhiaAccessStatus.d.ts.map +1 -1
  8. package/dist/components/Aridhia/AridhiaAccessStatus.js +60 -37
  9. package/dist/components/Aridhia/AridhiaAccessStatus.js.map +1 -1
  10. package/dist/components/Aridhia/AridhiaDarStatusPopover.d.ts +12 -0
  11. package/dist/components/Aridhia/AridhiaDarStatusPopover.d.ts.map +1 -0
  12. package/dist/components/Aridhia/AridhiaDarStatusPopover.js +56 -0
  13. package/dist/components/Aridhia/AridhiaDarStatusPopover.js.map +1 -0
  14. package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.d.ts.map +1 -1
  15. package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.js +38 -30
  16. package/dist/components/Aridhia/DarWizard/AridhiaDarWizard.js.map +1 -1
  17. package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.js +15 -14
  18. package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.js.map +1 -1
  19. package/dist/components/Aridhia/RdcaDapEligibilityDialog.d.ts +11 -0
  20. package/dist/components/Aridhia/RdcaDapEligibilityDialog.d.ts.map +1 -0
  21. package/dist/components/Aridhia/RdcaDapEligibilityDialog.js +37 -0
  22. package/dist/components/Aridhia/RdcaDapEligibilityDialog.js.map +1 -0
  23. package/dist/components/Aridhia/aridhiaAccessStatusUtils.js +2 -2
  24. package/dist/components/Aridhia/aridhiaAccessStatusUtils.js.map +1 -1
  25. package/dist/components/Aridhia/aridhiaFairPortalUrls.d.ts +10 -0
  26. package/dist/components/Aridhia/aridhiaFairPortalUrls.d.ts.map +1 -0
  27. package/dist/components/Aridhia/aridhiaFairPortalUrls.js +11 -0
  28. package/dist/components/Aridhia/aridhiaFairPortalUrls.js.map +1 -0
  29. package/dist/components/Aridhia/rdcaDapConstants.d.ts +3 -0
  30. package/dist/components/Aridhia/rdcaDapConstants.d.ts.map +1 -0
  31. package/dist/components/Aridhia/rdcaDapConstants.js +6 -0
  32. package/dist/components/Aridhia/rdcaDapConstants.js.map +1 -0
  33. package/dist/components/DataExplorer/DataExplorer.css +1 -1
  34. package/dist/components/DataExplorer/DataExplorer.d.ts.map +1 -1
  35. package/dist/components/DataExplorer/DataExplorer.js +50 -50
  36. package/dist/components/DataExplorer/DataExplorer.js.map +1 -1
  37. package/dist/components/DataExplorer/DataExplorer.module.js +16 -16
  38. package/dist/components/DataExplorer/DataExplorer.module.js.map +1 -1
  39. package/dist/components/DataExplorer/DataExplorer.module.scss +29 -6
  40. package/dist/components/DataGrid/columns/DateTimeColumn.d.ts +16 -7
  41. package/dist/components/DataGrid/columns/DateTimeColumn.d.ts.map +1 -1
  42. package/dist/components/DataGrid/columns/DateTimeColumn.js +79 -57
  43. package/dist/components/DataGrid/columns/DateTimeColumn.js.map +1 -1
  44. package/dist/components/DataGrid/utils/columnFactory.d.ts.map +1 -1
  45. package/dist/components/DataGrid/utils/columnFactory.js +11 -8
  46. package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
  47. package/dist/components/DatePicker/DatePicker.d.ts +10 -0
  48. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -0
  49. package/dist/components/DatePicker/DatePicker.js +18 -0
  50. package/dist/components/DatePicker/DatePicker.js.map +1 -0
  51. package/dist/components/EntityCitation/EntityCitation.d.ts.map +1 -1
  52. package/dist/components/EntityCitation/EntityCitation.js +8 -5
  53. package/dist/components/EntityCitation/EntityCitation.js.map +1 -1
  54. package/dist/components/HasAccess/AccessIcon.d.ts +3 -1
  55. package/dist/components/HasAccess/AccessIcon.d.ts.map +1 -1
  56. package/dist/components/HasAccess/AccessIcon.js +11 -1
  57. package/dist/components/HasAccess/AccessIcon.js.map +1 -1
  58. package/dist/components/PortalHomePageHeader/PortalHomePageHeader.d.ts +2 -1
  59. package/dist/components/PortalHomePageHeader/PortalHomePageHeader.d.ts.map +1 -1
  60. package/dist/components/PortalHomePageHeader/PortalHomePageHeader.js +81 -53
  61. package/dist/components/PortalHomePageHeader/PortalHomePageHeader.js.map +1 -1
  62. package/dist/components/ProjectInfo/ProjectInfo.d.ts.map +1 -1
  63. package/dist/components/ProjectInfo/ProjectInfo.js +3 -2
  64. package/dist/components/ProjectInfo/ProjectInfo.js.map +1 -1
  65. package/dist/components/QueryBuilder/FilterConditionRow.css +1 -0
  66. package/dist/components/QueryBuilder/FilterConditionRow.d.ts +6 -0
  67. package/dist/components/QueryBuilder/FilterConditionRow.d.ts.map +1 -0
  68. package/dist/components/QueryBuilder/FilterConditionRow.js +257 -0
  69. package/dist/components/QueryBuilder/FilterConditionRow.js.map +1 -0
  70. package/dist/components/QueryBuilder/FilterConditionRow.module.js +17 -0
  71. package/dist/components/QueryBuilder/FilterConditionRow.module.js.map +1 -0
  72. package/dist/components/QueryBuilder/FilterConditionRow.module.scss +106 -0
  73. package/dist/components/QueryBuilder/FilterGroupNode.css +1 -0
  74. package/dist/components/QueryBuilder/FilterGroupNode.d.ts +7 -0
  75. package/dist/components/QueryBuilder/FilterGroupNode.d.ts.map +1 -0
  76. package/dist/components/QueryBuilder/FilterGroupNode.js +100 -0
  77. package/dist/components/QueryBuilder/FilterGroupNode.js.map +1 -0
  78. package/dist/components/QueryBuilder/FilterGroupNode.module.js +15 -0
  79. package/dist/components/QueryBuilder/FilterGroupNode.module.js.map +1 -0
  80. package/dist/components/QueryBuilder/FilterGroupNode.module.scss +83 -0
  81. package/dist/components/QueryBuilder/QueryBuilderControls.css +1 -0
  82. package/dist/components/QueryBuilder/QueryBuilderControls.d.ts +21 -0
  83. package/dist/components/QueryBuilder/QueryBuilderControls.d.ts.map +1 -0
  84. package/dist/components/QueryBuilder/QueryBuilderControls.js +138 -0
  85. package/dist/components/QueryBuilder/QueryBuilderControls.js.map +1 -0
  86. package/dist/components/QueryBuilder/QueryBuilderControls.module.js +17 -0
  87. package/dist/components/QueryBuilder/QueryBuilderControls.module.js.map +1 -0
  88. package/dist/components/QueryBuilder/QueryBuilderControls.module.scss +79 -0
  89. package/dist/components/QueryBuilder/QueryBuilderInternalContext.d.ts +39 -0
  90. package/dist/components/QueryBuilder/QueryBuilderInternalContext.d.ts.map +1 -0
  91. package/dist/components/QueryBuilder/QueryBuilderInternalContext.js +19 -0
  92. package/dist/components/QueryBuilder/QueryBuilderInternalContext.js.map +1 -0
  93. package/dist/components/QueryBuilder/qbTreeToReadable.d.ts +14 -0
  94. package/dist/components/QueryBuilder/qbTreeToReadable.d.ts.map +1 -0
  95. package/dist/components/QueryBuilder/qbTreeToReadable.js +89 -0
  96. package/dist/components/QueryBuilder/qbTreeToReadable.js.map +1 -0
  97. package/dist/components/QueryBuilder/queryBuilderId.d.ts +2 -0
  98. package/dist/components/QueryBuilder/queryBuilderId.d.ts.map +1 -0
  99. package/dist/components/QueryBuilder/queryBuilderId.js +9 -0
  100. package/dist/components/QueryBuilder/queryBuilderId.js.map +1 -0
  101. package/dist/components/QueryBuilder/queryBuilderMetadata.d.ts +24 -0
  102. package/dist/components/QueryBuilder/queryBuilderMetadata.d.ts.map +1 -0
  103. package/dist/components/QueryBuilder/queryBuilderMetadata.js +91 -0
  104. package/dist/components/QueryBuilder/queryBuilderMetadata.js.map +1 -0
  105. package/dist/components/QueryBuilder/queryBuilderOperations.d.ts +58 -0
  106. package/dist/components/QueryBuilder/queryBuilderOperations.d.ts.map +1 -0
  107. package/dist/components/QueryBuilder/queryBuilderOperations.js +200 -0
  108. package/dist/components/QueryBuilder/queryBuilderOperations.js.map +1 -0
  109. package/dist/components/QueryBuilder/queryBuilderTranslation.d.ts +3 -2
  110. package/dist/components/QueryBuilder/queryBuilderTranslation.d.ts.map +1 -1
  111. package/dist/components/QueryBuilder/queryBuilderTranslation.js +82 -84
  112. package/dist/components/QueryBuilder/queryBuilderTranslation.js.map +1 -1
  113. package/dist/components/QueryBuilder/useQBCombinedSql.d.ts +11 -0
  114. package/dist/components/QueryBuilder/useQBCombinedSql.d.ts.map +1 -0
  115. package/dist/components/QueryBuilder/useQBCombinedSql.js +29 -0
  116. package/dist/components/QueryBuilder/useQBCombinedSql.js.map +1 -0
  117. package/dist/components/QueryBuilder/useQBFacetSourceMetadata.d.ts +18 -0
  118. package/dist/components/QueryBuilder/useQBFacetSourceMetadata.d.ts.map +1 -0
  119. package/dist/components/QueryBuilder/useQBFacetSourceMetadata.js +27 -0
  120. package/dist/components/QueryBuilder/useQBFacetSourceMetadata.js.map +1 -0
  121. package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts +14 -1
  122. package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts.map +1 -1
  123. package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js +185 -120
  124. package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js.map +1 -1
  125. package/dist/components/RssFeedCards/RssFeedCards.d.ts +1 -0
  126. package/dist/components/RssFeedCards/RssFeedCards.d.ts.map +1 -1
  127. package/dist/components/RssFeedCards/RssFeedCards.js +11 -11
  128. package/dist/components/RssFeedCards/RssFeedCards.js.map +1 -1
  129. package/dist/components/SynapseChat/SynapseChat.d.ts +7 -1
  130. package/dist/components/SynapseChat/SynapseChat.d.ts.map +1 -1
  131. package/dist/components/SynapseChat/SynapseChat.js +76 -71
  132. package/dist/components/SynapseChat/SynapseChat.js.map +1 -1
  133. package/dist/components/SynapseChat/SynapsePortalChatDialog.d.ts +3 -1
  134. package/dist/components/SynapseChat/SynapsePortalChatDialog.d.ts.map +1 -1
  135. package/dist/components/SynapseChat/SynapsePortalChatDialog.js +24 -13
  136. package/dist/components/SynapseChat/SynapsePortalChatDialog.js.map +1 -1
  137. package/dist/components/SynapseChat/portalChatSessionStorage.d.ts +23 -0
  138. package/dist/components/SynapseChat/portalChatSessionStorage.d.ts.map +1 -0
  139. package/dist/components/SynapseChat/portalChatSessionStorage.js +29 -0
  140. package/dist/components/SynapseChat/portalChatSessionStorage.js.map +1 -0
  141. package/dist/components/SynapseHomepageV2/HotdropsAndNews.css +1 -1
  142. package/dist/components/SynapseHomepageV2/HotdropsAndNews.module.js +9 -9
  143. package/dist/components/SynapseHomepageV2/HotdropsAndNews.module.js.map +1 -1
  144. package/dist/components/SynapseHomepageV2/HotdropsAndNews.module.scss +1 -0
  145. package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.d.ts +6 -0
  146. package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.d.ts.map +1 -1
  147. package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js +92 -79
  148. package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js.map +1 -1
  149. package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts +3 -4
  150. package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts.map +1 -1
  151. package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js +2 -2
  152. package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js.map +1 -1
  153. package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.js +1 -1
  154. package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.js.map +1 -1
  155. package/dist/components/entity/page/action_menu/EntityActionMenu.d.ts.map +1 -1
  156. package/dist/components/entity/page/action_menu/EntityActionMenu.js +9 -2
  157. package/dist/components/entity/page/action_menu/EntityActionMenu.js.map +1 -1
  158. package/dist/components/entity/page/title_bar/EntityPageTitleBar.js +1 -1
  159. package/dist/components/entity/page/title_bar/EntityPageTitleBar.js.map +1 -1
  160. package/dist/components/menu/ComplexMenu.js +1 -1
  161. package/dist/components/menu/ComplexMenu.js.map +1 -1
  162. package/dist/components/menu/DropdownMenu.d.ts.map +1 -1
  163. package/dist/components/menu/DropdownMenu.js +4 -0
  164. package/dist/components/menu/DropdownMenu.js.map +1 -1
  165. package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.d.ts +10 -0
  166. package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.d.ts.map +1 -0
  167. package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.js +20 -0
  168. package/dist/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.js.map +1 -0
  169. package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.d.ts.map +1 -1
  170. package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.js +29 -20
  171. package/dist/features/entity/metadata-task/hooks/useOpenCuratorButton.js.map +1 -1
  172. package/dist/mocks/accessRequirement/mockFormTemplates.d.ts +16 -0
  173. package/dist/mocks/accessRequirement/mockFormTemplates.d.ts.map +1 -0
  174. package/dist/mocks/accessRequirement/mockFormTemplates.js +70 -0
  175. package/dist/mocks/accessRequirement/mockFormTemplates.js.map +1 -0
  176. package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.d.ts +7 -0
  177. package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.d.ts.map +1 -0
  178. package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.js +47 -0
  179. package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.js.map +1 -0
  180. package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts +24 -0
  181. package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts.map +1 -0
  182. package/dist/mocks/accessRequirement/mockJsonSchemas.js +62 -0
  183. package/dist/mocks/accessRequirement/mockJsonSchemas.js.map +1 -0
  184. package/dist/mocks/msw/handlers/aridhiaHandlers.d.ts +18 -1
  185. package/dist/mocks/msw/handlers/aridhiaHandlers.d.ts.map +1 -1
  186. package/dist/mocks/msw/handlers/aridhiaHandlers.js +39 -33
  187. package/dist/mocks/msw/handlers/aridhiaHandlers.js.map +1 -1
  188. package/dist/mocks/msw/handlers/formTemplateHandlers.d.ts +5 -0
  189. package/dist/mocks/msw/handlers/formTemplateHandlers.d.ts.map +1 -0
  190. package/dist/mocks/msw/handlers/formTemplateHandlers.js +65 -0
  191. package/dist/mocks/msw/handlers/formTemplateHandlers.js.map +1 -0
  192. package/dist/mocks/msw/handlers.d.ts.map +1 -1
  193. package/dist/mocks/msw/handlers.js +49 -47
  194. package/dist/mocks/msw/handlers.js.map +1 -1
  195. package/dist/style/abstracts/_cssVariables.scss +7 -0
  196. package/dist/style/components/_query-wrapper-plot-nav.scss +9 -0
  197. package/dist/style/main.css +1 -1
  198. package/dist/synapse-queries/KeyFactory.d.ts +6 -1
  199. package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
  200. package/dist/synapse-queries/KeyFactory.js +17 -2
  201. package/dist/synapse-queries/KeyFactory.js.map +1 -1
  202. package/dist/synapse-queries/chat/useChat.d.ts.map +1 -1
  203. package/dist/synapse-queries/chat/useChat.js +2 -4
  204. package/dist/synapse-queries/chat/useChat.js.map +1 -1
  205. package/dist/synapse-queries/dataaccess/index.d.ts +2 -0
  206. package/dist/synapse-queries/dataaccess/index.d.ts.map +1 -1
  207. package/dist/synapse-queries/dataaccess/index.js +5 -3
  208. package/dist/synapse-queries/dataaccess/useFormTemplate.d.ts +41 -0
  209. package/dist/synapse-queries/dataaccess/useFormTemplate.d.ts.map +1 -0
  210. package/dist/synapse-queries/dataaccess/useFormTemplate.js +63 -0
  211. package/dist/synapse-queries/dataaccess/useFormTemplate.js.map +1 -0
  212. package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.d.ts +21 -0
  213. package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.d.ts.map +1 -0
  214. package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.js +34 -0
  215. package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.js.map +1 -0
  216. package/dist/synapse-queries/index.js +190 -180
  217. package/dist/testutils/ReactQueryMockUtils.js.map +1 -1
  218. package/dist/tsconfig.build.tsbuildinfo +1 -1
  219. package/dist/utils/featureflag/FeatureFlags.d.ts +0 -1
  220. package/dist/utils/featureflag/FeatureFlags.d.ts.map +1 -1
  221. package/dist/utils/featureflag/FeatureFlags.js +1 -1
  222. package/dist/utils/featureflag/FeatureFlags.js.map +1 -1
  223. package/dist/utils/jsonschema/getType.d.ts.map +1 -1
  224. package/dist/utils/jsonschema/getType.js +4 -1
  225. package/dist/utils/jsonschema/getType.js.map +1 -1
  226. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"EntityActionMenu.js","names":[],"sources":["../../../../../src/components/entity/page/action_menu/EntityActionMenu.tsx"],"sourcesContent":["import { Box, ButtonProps, SxProps, Theme } from '@mui/material'\nimport { ComplexMenu, ComplexMenuButtonProps } from '../../../menu/ComplexMenu'\nimport IconSvg, { IconName } from '../../../IconSvg/IconSvg'\nimport { DropdownMenuItem, DropdownMenuProps } from '../../../menu/DropdownMenu'\nimport { MouseEvent } from 'react'\nimport { SystemStyleObject } from '@mui/system'\n\nconst outlinedButtonHoverBackgroundColor = 'rgba(0, 0, 0, 0.01)'\n\n// Represents the two types of dropdown menus that will be displayed on the entity page\ntype EntityActionMenuDropdownMenuType = 'DOWNLOAD' | 'PRIMARY'\n\ntype EntityActionMenuDropdownMenuConfiguration = {\n visible: boolean\n tooltipText?: string\n disabled?: boolean\n showFileAccessRequestNotice?: boolean\n}\n\nexport type ActionConfiguration = {\n visible: boolean\n text: string\n disabled?: boolean\n tooltipText?: string\n onClick?: (e: MouseEvent) => void\n href?: string\n}\n\nexport type ActionConfigurationMap = Record<string, ActionConfiguration>\n\nexport type MenuConfigurationMap = Record<\n EntityActionMenuDropdownMenuType,\n EntityActionMenuDropdownMenuConfiguration\n>\n\nexport type ActionViewProps = {\n action: string\n icon?: IconName\n textSx?: SxProps\n iconSx?: SxProps\n variant?: ButtonProps['variant']\n}\n\nexport type EntityActionMenuLayout = {\n buttonActions: ActionViewProps[]\n downloadMenuActions: ActionViewProps[][]\n primaryMenuActions: ActionViewProps[][]\n primaryMenuText: string\n primaryMenuEndIcon: IconName\n primaryMenuEndIconSx?: SxProps\n menuButtonSx?: SystemStyleObject<Theme>\n downloadMenuVariant?: ButtonProps['variant']\n primaryMenuVariant?: ButtonProps['variant']\n}\n\nexport type EntityActionMenuProps = {\n /* Maps a unique action string to a dynamic configuration for that particular action */\n actionConfiguration: ActionConfigurationMap\n /* Maps each dropdown menu to a dynamic configuration for that particular menu */\n menuConfiguration: MenuConfigurationMap\n /* Defines the layout of the actions. Typically depends on just the entity type and area. */\n layout: EntityActionMenuLayout\n}\n\n/*\n * All visible actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\nfunction getUnmappedActions(\n actionConfiguration: ActionConfigurationMap,\n layout: EntityActionMenuLayout,\n): ActionConfigurationMap {\n return Object.fromEntries(\n Object.entries(actionConfiguration).filter(([action, config]) => {\n // We don't care about actions that are not configured or should not be visible\n if (!config || !config.visible) {\n return false\n }\n\n const allLayoutActions: ActionViewProps[] = [\n ...layout.buttonActions,\n ...layout.primaryMenuActions.flat(),\n ...layout.downloadMenuActions.flat(),\n ]\n // Action is unmapped if it's visible and the layout doesn't have it\n return !allLayoutActions.some(\n layoutAction => layoutAction.action === action,\n )\n }),\n )\n}\n\n/**\n * Given a group of dropdown menu items and an action configuration,\n * return a list of dropdown menu items with non-visible and non-configured actions removed.\n * @param group\n * @param actionConfiguration\n */\nfunction mapAndFilterItemsInMenuGroup(\n group: ActionViewProps[],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[] {\n return group.reduce(\n (itemAcc: DropdownMenuItem[], actionViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[actionViewProps.action]\n // Only show the item if it's configured + visible\n if (configForAction?.visible) {\n itemAcc.push({\n text: configForAction.text ?? actionViewProps.action,\n onClick: configForAction.onClick,\n href: configForAction.href,\n tooltipText: configForAction.tooltipText,\n disabled: configForAction.disabled,\n icon: actionViewProps.icon,\n textSx: actionViewProps.textSx,\n iconSx: actionViewProps.iconSx,\n })\n }\n return itemAcc\n },\n [],\n )\n}\n\n/**\n * Given a list of groups of dropdown menu actions, returns a list of dropdown menu item\n * groups where non-visible actions have been removed, and groups with no visible actions\n * have been removed.\n * @param menuActions\n * @param actionConfiguration\n */\nfunction mapAndFilterMenuGroups(\n menuActions: ActionViewProps[][],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[][] {\n return menuActions.reduce(\n (groupAcc: DropdownMenuItem[][], group: ActionViewProps[]) => {\n const itemGroup = mapAndFilterItemsInMenuGroup(group, actionConfiguration)\n // Only show the group if it contains visible items\n if (itemGroup.length > 0) {\n groupAcc.push(itemGroup)\n }\n return groupAcc\n },\n [],\n )\n}\n\n/**\n * The EntityActionMenu renders a menu that displays the actions that can be invoked on an Entity page.\n */\nexport default function EntityActionMenu(props: EntityActionMenuProps) {\n const { actionConfiguration, menuConfiguration, layout } = props\n\n /*\n * All actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\n const unmappedActions = getUnmappedActions(actionConfiguration, layout)\n // Warn if unmapped actions were found and push them on to the layout.\n if (Object.entries(unmappedActions).length > 0) {\n console.warn(\n 'Actions are visible but have not been configured in the layout:',\n Object.entries(unmappedActions).map(entry => entry[0]),\n )\n // Modify the layout: put the unmapped actions in their own group at the top of the menu\n layout.primaryMenuActions.unshift(\n Object.entries(unmappedActions).map(\n (entry): ActionViewProps => ({\n action: entry[0],\n }),\n ),\n )\n }\n\n // Map button actions to a button configuration and omit non-visible actions\n const iconButtonConfigs: ComplexMenuButtonProps[] =\n layout.buttonActions.reduce(\n (acc: ComplexMenuButtonProps[], buttonViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[buttonViewProps.action]\n if (configForAction?.visible) {\n let onClick = configForAction.onClick\n if (onClick == null && !configForAction.href) {\n console.warn(`No handler registered for ${buttonViewProps.action}`)\n onClick = () => {\n console.warn(\n `No handler registered for ${buttonViewProps.action}`,\n )\n }\n }\n acc.push({\n icon: buttonViewProps.icon as IconName,\n onClick: onClick,\n tooltipText: configForAction.text,\n text: configForAction.text,\n variant: buttonViewProps.variant,\n iconSx: buttonViewProps.iconSx,\n disabled: configForAction.disabled,\n href: configForAction.href,\n })\n }\n return acc\n },\n [],\n )\n\n const downloadMenuConfig: DropdownMenuProps = {\n dropdownButtonText: 'Download Options',\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n variant: layout.downloadMenuVariant,\n showFileAccessRequestNotice:\n menuConfiguration.DOWNLOAD.showFileAccessRequestNotice ?? false,\n paperSx: {\n borderRadius: '5px',\n border: '1px solid #E2E4EA',\n width: '279px',\n padding: '12px 16px',\n },\n elevation: 3,\n buttonTooltip: menuConfiguration.DOWNLOAD.tooltipText,\n buttonProps: {\n disabled: menuConfiguration.DOWNLOAD.disabled,\n endIcon: <IconSvg icon={'expandMore'} wrap={false} />,\n },\n items: mapAndFilterMenuGroups(\n layout.downloadMenuActions,\n actionConfiguration,\n ),\n }\n\n const primaryMenuConfig: DropdownMenuProps = {\n dropdownButtonText: layout.primaryMenuText,\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n variant: layout.primaryMenuVariant,\n buttonProps: {\n endIcon: (\n <IconSvg\n icon={layout.primaryMenuEndIcon}\n wrap={false}\n sx={layout.primaryMenuEndIconSx}\n />\n ),\n },\n items: mapAndFilterMenuGroups(\n layout.primaryMenuActions,\n actionConfiguration,\n ),\n }\n\n const menuButtonSx = layout.menuButtonSx ?? {}\n\n return (\n <Box\n sx={{\n '& .MuiButton-root': {\n borderRadius: '6px',\n fontWeight: 540,\n padding: '10px 12px',\n },\n // Optional per-layout overrides (e.g. background/border color for entity\n // menu buttons).\n '& .MuiButton-outlined': {\n ...menuButtonSx,\n\n '&:hover': {\n ...menuButtonSx,\n backgroundColor: outlinedButtonHoverBackgroundColor,\n },\n },\n '& .MuiButton-text': {\n ...menuButtonSx,\n backgroundColor: 'transparent',\n\n '&:hover': {\n ...menuButtonSx,\n backgroundColor: outlinedButtonHoverBackgroundColor,\n textDecoration: 'none',\n },\n },\n '& .MuiButton-root .MuiTypography-root': {\n fontWeight: 540,\n },\n }}\n >\n <ComplexMenu\n iconButtons={iconButtonConfigs}\n dropdownMenus={[primaryMenuConfig, downloadMenuConfig]}\n />\n </Box>\n )\n}\n\nexport const EXPORTED_FOR_UNIT_TESTING = {\n getUnmappedActions,\n mapAndFilterItemsInMenuGroup,\n mapAndFilterMenuGroups,\n}\n"],"mappings":";;;;;AAOA,IAAM,IAAqC;AA6D3C,SAAS,EACP,GACA,GACwB;CACxB,OAAO,OAAO,YACZ,OAAO,QAAQ,CAAmB,EAAE,QAAQ,CAAC,GAAQ,OAE/C,CAAC,KAAU,CAAC,EAAO,UACd,KASF,CAAC;EALN,GAAG,EAAO;EACV,GAAG,EAAO,mBAAmB,KAAK;EAClC,GAAG,EAAO,oBAAoB,KAAK;CAG7B,EAAiB,MACvB,MAAgB,EAAa,WAAW,CAC1C,CACD,CACH;AACF;AAQA,SAAS,EACP,GACA,GACoB;CACpB,OAAO,EAAM,QACV,GAA6B,MAAqC;EACjE,IAAM,IAAkB,EAAoB,EAAgB;EAc5D,OAZI,GAAiB,WACnB,EAAQ,KAAK;GACX,MAAM,EAAgB,QAAQ,EAAgB;GAC9C,SAAS,EAAgB;GACzB,MAAM,EAAgB;GACtB,aAAa,EAAgB;GAC7B,UAAU,EAAgB;GAC1B,MAAM,EAAgB;GACtB,QAAQ,EAAgB;GACxB,QAAQ,EAAgB;EAC1B,CAAC,GAEI;CACT,GACA,CAAC,CACH;AACF;AASA,SAAS,EACP,GACA,GACsB;CACtB,OAAO,EAAY,QAChB,GAAgC,MAA6B;EAC5D,IAAM,IAAY,EAA6B,GAAO,CAAmB;EAKzE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F;CACF,GAEM,IAAuC;EAC3C,oBAAoB,EAAO;EAC3B,2BAA2B;EAC3B,qBAAqB;EACrB,SAAS,EAAO;EAChB,aAAa,EACX,SACE,kBAAC,GAAD;GACE,MAAM,EAAO;GACb,MAAM;GACN,IAAI,EAAO;EACZ,CAAA,EAEL;EACA,OAAO,EACL,EAAO,oBACP,CACF;CACF,GAEM,IAAe,EAAO,gBAAgB,CAAC;CAE7C,OACE,kBAAC,GAAD;EACE,IAAI;GACF,qBAAqB;IACnB,cAAc;IACd,YAAY;IACZ,SAAS;GACX;GAGA,yBAAyB;IACvB,GAAG;IAEH,WAAW;KACT,GAAG;KACH,iBAAiB;IACnB;GACF;GACA,qBAAqB;IACnB,GAAG;IACH,iBAAiB;IAEjB,WAAW;KACT,GAAG;KACH,iBAAiB;KACjB,gBAAgB;IAClB;GACF;GACA,yCAAyC,EACvC,YAAY,IACd;EACF;YAEA,kBAAC,GAAD;GACE,aAAa;GACb,eAAe,CAAC,GAAmB,CAAkB;EACtD,CAAA;CACE,CAAA;AAET;AAEA,IAAa,IAA4B;CACvC;CACA;CACA;AACF"}
1
+ {"version":3,"file":"EntityActionMenu.js","names":[],"sources":["../../../../../src/components/entity/page/action_menu/EntityActionMenu.tsx"],"sourcesContent":["import { Box, ButtonProps, SxProps, Theme } from '@mui/material'\nimport { ComplexMenu, ComplexMenuButtonProps } from '../../../menu/ComplexMenu'\nimport IconSvg, { IconName } from '../../../IconSvg/IconSvg'\nimport { DropdownMenuItem, DropdownMenuProps } from '../../../menu/DropdownMenu'\nimport { MouseEvent } from 'react'\nimport { SystemStyleObject } from '@mui/system'\n\nconst outlinedButtonHoverBackgroundColor = 'rgba(0, 0, 0, 0.01)'\n\n// Represents the two types of dropdown menus that will be displayed on the entity page\ntype EntityActionMenuDropdownMenuType = 'DOWNLOAD' | 'PRIMARY'\n\ntype EntityActionMenuDropdownMenuConfiguration = {\n visible: boolean\n tooltipText?: string\n disabled?: boolean\n showFileAccessRequestNotice?: boolean\n}\n\nexport type ActionConfiguration = {\n visible: boolean\n text: string\n disabled?: boolean\n tooltipText?: string\n onClick?: (e: MouseEvent) => void\n href?: string\n}\n\nexport type ActionConfigurationMap = Record<string, ActionConfiguration>\n\nexport type MenuConfigurationMap = Record<\n EntityActionMenuDropdownMenuType,\n EntityActionMenuDropdownMenuConfiguration\n>\n\nexport type ActionViewProps = {\n action: string\n icon?: IconName\n textSx?: SxProps\n iconSx?: SxProps\n variant?: ButtonProps['variant']\n}\n\nexport type EntityActionMenuLayout = {\n buttonActions: ActionViewProps[]\n downloadMenuActions: ActionViewProps[][]\n primaryMenuActions: ActionViewProps[][]\n primaryMenuText: string\n primaryMenuEndIcon: IconName\n primaryMenuEndIconSx?: SxProps\n menuButtonSx?: SystemStyleObject<Theme>\n downloadMenuVariant?: ButtonProps['variant']\n primaryMenuVariant?: ButtonProps['variant']\n}\n\nexport type EntityActionMenuProps = {\n /* Maps a unique action string to a dynamic configuration for that particular action */\n actionConfiguration: ActionConfigurationMap\n /* Maps each dropdown menu to a dynamic configuration for that particular menu */\n menuConfiguration: MenuConfigurationMap\n /* Defines the layout of the actions. Typically depends on just the entity type and area. */\n layout: EntityActionMenuLayout\n}\n\n/*\n * All visible actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\nfunction getUnmappedActions(\n actionConfiguration: ActionConfigurationMap,\n layout: EntityActionMenuLayout,\n): ActionConfigurationMap {\n return Object.fromEntries(\n Object.entries(actionConfiguration).filter(([action, config]) => {\n // We don't care about actions that are not configured or should not be visible\n if (!config || !config.visible) {\n return false\n }\n\n const allLayoutActions: ActionViewProps[] = [\n ...layout.buttonActions,\n ...layout.primaryMenuActions.flat(),\n ...layout.downloadMenuActions.flat(),\n ]\n // Action is unmapped if it's visible and the layout doesn't have it\n return !allLayoutActions.some(\n layoutAction => layoutAction.action === action,\n )\n }),\n )\n}\n\n/**\n * Given a group of dropdown menu items and an action configuration,\n * return a list of dropdown menu items with non-visible and non-configured actions removed.\n * @param group\n * @param actionConfiguration\n */\nfunction mapAndFilterItemsInMenuGroup(\n group: ActionViewProps[],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[] {\n return group.reduce(\n (itemAcc: DropdownMenuItem[], actionViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[actionViewProps.action]\n // Only show the item if it's configured + visible\n if (configForAction?.visible) {\n itemAcc.push({\n text: configForAction.text ?? actionViewProps.action,\n onClick: configForAction.onClick,\n href: configForAction.href,\n tooltipText: configForAction.tooltipText,\n disabled: configForAction.disabled,\n icon: actionViewProps.icon,\n textSx: actionViewProps.textSx,\n iconSx: actionViewProps.iconSx,\n })\n }\n return itemAcc\n },\n [],\n )\n}\n\n/**\n * Given a list of groups of dropdown menu actions, returns a list of dropdown menu item\n * groups where non-visible actions have been removed, and groups with no visible actions\n * have been removed.\n * @param menuActions\n * @param actionConfiguration\n */\nfunction mapAndFilterMenuGroups(\n menuActions: ActionViewProps[][],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[][] {\n return menuActions.reduce(\n (groupAcc: DropdownMenuItem[][], group: ActionViewProps[]) => {\n const itemGroup = mapAndFilterItemsInMenuGroup(group, actionConfiguration)\n // Only show the group if it contains visible items\n if (itemGroup.length > 0) {\n groupAcc.push(itemGroup)\n }\n return groupAcc\n },\n [],\n )\n}\n\n/**\n * The EntityActionMenu renders a menu that displays the actions that can be invoked on an Entity page.\n */\nexport default function EntityActionMenu(props: EntityActionMenuProps) {\n const { actionConfiguration, menuConfiguration, layout } = props\n\n /*\n * All actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\n const unmappedActions = getUnmappedActions(actionConfiguration, layout)\n // Warn if unmapped actions were found and push them on to the layout.\n if (Object.entries(unmappedActions).length > 0) {\n console.warn(\n 'Actions are visible but have not been configured in the layout:',\n Object.entries(unmappedActions).map(entry => entry[0]),\n )\n // Modify the layout: put the unmapped actions in their own group at the top of the menu\n layout.primaryMenuActions.unshift(\n Object.entries(unmappedActions).map(\n (entry): ActionViewProps => ({\n action: entry[0],\n }),\n ),\n )\n }\n\n // Map button actions to a button configuration and omit non-visible actions\n const iconButtonConfigs: ComplexMenuButtonProps[] =\n layout.buttonActions.reduce(\n (acc: ComplexMenuButtonProps[], buttonViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[buttonViewProps.action]\n if (configForAction?.visible) {\n let onClick = configForAction.onClick\n if (onClick == null && !configForAction.href) {\n console.warn(`No handler registered for ${buttonViewProps.action}`)\n onClick = () => {\n console.warn(\n `No handler registered for ${buttonViewProps.action}`,\n )\n }\n }\n acc.push({\n icon: buttonViewProps.icon as IconName,\n onClick: onClick,\n tooltipText: configForAction.text,\n text: configForAction.text,\n variant: buttonViewProps.variant,\n iconSx: buttonViewProps.iconSx,\n disabled: configForAction.disabled,\n href: configForAction.href,\n })\n }\n return acc\n },\n [],\n )\n\n const downloadMenuConfig: DropdownMenuProps = {\n dropdownButtonText: 'Download Options',\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n variant: layout.downloadMenuVariant,\n showFileAccessRequestNotice:\n menuConfiguration.DOWNLOAD.showFileAccessRequestNotice ?? false,\n paperSx: {\n borderRadius: '5px',\n border: '1px solid #E2E4EA',\n width: '279px',\n padding: '12px 16px',\n },\n elevation: 3,\n buttonTooltip: menuConfiguration.DOWNLOAD.tooltipText,\n buttonProps: {\n disabled: menuConfiguration.DOWNLOAD.disabled,\n endIcon: <IconSvg icon={'expandMore'} wrap={false} />,\n },\n items: mapAndFilterMenuGroups(\n layout.downloadMenuActions,\n actionConfiguration,\n ),\n }\n\n const primaryMenuConfig: DropdownMenuProps = {\n dropdownButtonText: layout.primaryMenuText,\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n variant: layout.primaryMenuVariant,\n buttonProps: {\n endIcon: (\n <IconSvg\n icon={layout.primaryMenuEndIcon}\n wrap={false}\n sx={layout.primaryMenuEndIconSx}\n />\n ),\n },\n items: mapAndFilterMenuGroups(\n layout.primaryMenuActions,\n actionConfiguration,\n ),\n }\n\n const menuButtonSx = layout.menuButtonSx ?? {}\n\n return (\n <Box\n sx={{\n '& .MuiButton-root': {\n borderRadius: '6px',\n fontWeight: 540,\n padding: '8px',\n height: '28px',\n\n '& svg': {\n fontSize: '16px',\n },\n },\n // Optional per-layout overrides (e.g. background/border color for entity\n // menu buttons).\n '& .MuiButton-outlined': {\n ...menuButtonSx,\n\n '&:hover': {\n ...menuButtonSx,\n backgroundColor: outlinedButtonHoverBackgroundColor,\n },\n },\n '& .MuiButton-text': {\n ...menuButtonSx,\n backgroundColor: 'transparent',\n\n '&:hover': {\n ...menuButtonSx,\n backgroundColor: outlinedButtonHoverBackgroundColor,\n textDecoration: 'none',\n },\n },\n '& .MuiButton-root .MuiTypography-root': {\n fontWeight: 540,\n fontSize: '12px',\n lineHeight: '12px',\n letterSpacing: '-0.24px',\n },\n }}\n >\n <ComplexMenu\n iconButtons={iconButtonConfigs}\n dropdownMenus={[primaryMenuConfig, downloadMenuConfig]}\n />\n </Box>\n )\n}\n\nexport const EXPORTED_FOR_UNIT_TESTING = {\n getUnmappedActions,\n mapAndFilterItemsInMenuGroup,\n mapAndFilterMenuGroups,\n}\n"],"mappings":";;;;;AAOA,IAAM,IAAqC;AA6D3C,SAAS,EACP,GACA,GACwB;CACxB,OAAO,OAAO,YACZ,OAAO,QAAQ,CAAmB,EAAE,QAAQ,CAAC,GAAQ,OAE/C,CAAC,KAAU,CAAC,EAAO,UACd,KASF,CAAC;EALN,GAAG,EAAO;EACV,GAAG,EAAO,mBAAmB,KAAK;EAClC,GAAG,EAAO,oBAAoB,KAAK;CAG7B,EAAiB,MACvB,MAAgB,EAAa,WAAW,CAC1C,CACD,CACH;AACF;AAQA,SAAS,EACP,GACA,GACoB;CACpB,OAAO,EAAM,QACV,GAA6B,MAAqC;EACjE,IAAM,IAAkB,EAAoB,EAAgB;EAc5D,OAZI,GAAiB,WACnB,EAAQ,KAAK;GACX,M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BAAoB;EACpB,2BAA2B;EAC3B,qBAAqB;EACrB,SAAS,EAAO;EAChB,6BACE,EAAkB,SAAS,+BAA+B;EAC5D,SAAS;GACP,cAAc;GACd,QAAQ;GACR,OAAO;GACP,SAAS;EACX;EACA,WAAW;EACX,eAAe,EAAkB,SAAS;EAC1C,aAAa;GACX,UAAU,EAAkB,SAAS;GACrC,SAAS,kBAAC,GAAD;IAAS,MAAM;IAAc,MAAM;GAAQ,CAAA;EACtD;EACA,OAAO,EACL,EAAO,qBACP,CACF;CACF,GAEM,IAAuC;EAC3C,oBAAoB,EAAO;EAC3B,2BAA2B;EAC3B,qBAAqB;EACrB,SAAS,EAAO;EAChB,aAAa,EACX,SACE,kBAAC,GAAD;GACE,MAAM,EAAO;GACb,MAAM;GACN,IAAI,EAAO;EACZ,CAAA,EAEL;EACA,OAAO,EACL,EAAO,oBACP,CACF;CACF,GAEM,IAAe,EAAO,gBAAgB,CAAC;CAE7C,OACE,kBAAC,GAAD;EACE,IAAI;GACF,qBAAqB;IACnB,cAAc;IACd,YAAY;IACZ,SAAS;IACT,QAAQ;IAER,SAAS,EACP,UAAU,OACZ;GACF;GAGA,yBAAyB;IACvB,GAAG;IAEH,WAAW;KACT,GAAG;KACH,iBAAiB;IACnB;GACF;GACA,qBAAqB;IACnB,GAAG;IACH,iBAAiB;IAEjB,WAAW;KACT,GAAG;KACH,iBAAiB;KACjB,gBAAgB;IAClB;GACF;GACA,yCAAyC;IACvC,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,eAAe;GACjB;EACF;YAEA,kBAAC,GAAD;GACE,aAAa;GACb,eAAe,CAAC,GAAmB,CAAkB;EACtD,CAAA;CACE,CAAA;AAET;AAEA,IAAa,IAA4B;CACvC;CACA;CACA;AACF"}
@@ -16,7 +16,7 @@ function y(y) {
16
16
  let { entityId: b, versionNumber: x, entityActionMenuProps: S } = y, C = S?.actionConfiguration.SHOW_VERSION_HISTORY?.onClick, { data: w, isLoading: T } = t(b, x), E = w?.entity && e(w.entity) ? w.entity.repositoryName : w?.entity?.name;
17
17
  return /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h(d, {
18
18
  sx: {
19
- padding: "20px 40px",
19
+ padding: "10px 16px",
20
20
  backgroundColor: _,
21
21
  borderRadius: "5px"
22
22
  },
@@ -1 +1 @@
1
- {"version":3,"file":"EntityPageTitleBar.js","names":[],"sources":["../../../../../src/components/entity/page/title_bar/EntityPageTitleBar.tsx"],"sourcesContent":["import ConditionalWrapper from '@/components/utils/ConditionalWrapper'\nimport { useGetEntityBundle } from '@/synapse-queries'\nimport { isDockerRepository } from '@/utils/types/IsType'\nimport { Avatar, Box, Skeleton, Stack, Typography } from '@mui/material'\nimport FavoriteButton from '../../../favorites/FavoriteButton'\nimport IconSvg, { type2SvgIconName } from '../../../IconSvg/IconSvg'\nimport EntityActionMenu, {\n EntityActionMenuProps,\n} from '../action_menu/EntityActionMenu'\nimport { EntityTitleBarVersionInfo } from './EntityTitleBarVersionInfo'\nimport TitleBarProperties from './TitleBarProperties'\nimport CopyToClipboardString from '@/components/CopyToClipboardString/CopyToClipboardString'\n\nexport type EntityPageTitleBarProps = {\n entityId: string\n versionNumber?: number\n /* Props that will be passed through to an EntityActionMenu component */\n entityActionMenuProps?: EntityActionMenuProps\n /* Callback invoked when an ACT member clicks \"Add Conditions for Use\". */\n onActMemberClickAddConditionsForUse: () => void\n}\n\nconst TITLE_BAR_BACKGROUND_COLOR = '#EAF0F5'\nconst AVATAR_BACKGROUND_COLOR = '#497097'\n\n/**\n * The EntityPageTitleBar component is shown on every Entity page in Synapse, and shows an Entity's metadata and\n * provides controls to view and manipulate the Entity.\n */\nexport default function EntityPageTitleBar(props: EntityPageTitleBarProps) {\n const { entityId, versionNumber, entityActionMenuProps } = props\n\n const toggleShowVersionHistory =\n entityActionMenuProps?.actionConfiguration['SHOW_VERSION_HISTORY']?.onClick\n\n const { data: bundle, isLoading } = useGetEntityBundle(\n entityId,\n versionNumber,\n )\n\n const name =\n bundle?.entity && isDockerRepository(bundle.entity)\n ? bundle.entity.repositoryName\n : bundle?.entity?.name\n\n return (\n <div>\n <Box\n sx={{\n padding: '20px 40px',\n backgroundColor: TITLE_BAR_BACKGROUND_COLOR,\n borderRadius: '5px',\n }}\n >\n <Stack\n sx={{\n flexDirection: { xs: 'column', md: 'row' },\n alignItems: 'center',\n }}\n >\n <Stack\n direction={'row'}\n sx={{\n alignItems: 'center',\n flexGrow: 1,\n }}\n >\n <ConditionalWrapper\n condition={isLoading}\n wrapper={Skeleton}\n wrapperProps={{\n variant: 'circular',\n }}\n >\n <Avatar\n sx={{\n bgcolor: AVATAR_BACKGROUND_COLOR,\n height: 68,\n width: 68,\n borderRadius: '3px',\n svg: {\n height: '36px',\n width: '36px',\n },\n }}\n variant={'square'}\n >\n {bundle?.entityType && (\n <IconSvg\n icon={\n bundle?.entityType\n ? type2SvgIconName[bundle.entityType]\n : 'file'\n }\n wrap={false}\n />\n )}\n </Avatar>\n </ConditionalWrapper>\n <Box sx={{ marginLeft: '10px', flexGrow: 1 }}>\n <Stack\n direction={'row'}\n sx={{\n alignItems: 'center',\n gap: '3px',\n }}\n >\n <ConditionalWrapper condition={isLoading} wrapper={Skeleton}>\n <Typography\n variant={'headline2'}\n sx={{ color: 'greyV2.950', fontWeight: 540 }}\n >\n {name ?? 'Name not set'}\n </Typography>\n </ConditionalWrapper>\n {bundle?.entity?.id && (\n <FavoriteButton\n entityId={bundle.entity.id}\n iconColor={'greyV2.400'}\n />\n )}\n </Stack>\n <EntityTitleBarVersionInfo\n entityId={entityId}\n versionNumber={versionNumber}\n toggleShowVersionHistory={toggleShowVersionHistory}\n />\n <CopyToClipboardString\n value={entityId}\n icon=\"rounded\"\n sx={{\n '& .MuiTypography-root': {\n color: 'greyV2.800',\n fontWeight: 440,\n lineHeight: '20px',\n },\n }}\n />\n </Box>\n </Stack>\n {entityActionMenuProps && (\n <EntityActionMenu {...entityActionMenuProps} />\n )}\n </Stack>\n </Box>\n <TitleBarProperties {...props} />\n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GAAD;QACE,UAAU,EAAO,OAAO;QACxB,WAAW;OACZ,CAAA,CAEE;;MACP,kBAAC,GAAD;OACY;OACK;OACW;MAC3B,CAAA;MACD,kBAAC,GAAD;OACE,OAAO;OACP,MAAK;OACL,IAAI,EACF,yBAAyB;QACvB,OAAO;QACP,YAAY;QACZ,YAAY;OACd,EACF;MACD,CAAA;KACE;MACA;OACN,KACC,kBAAC,GAAD,EAAkB,GAAI,EAAwB,CAAA,CAE3C;;CACJ,CAAA,GACL,kBAAC,GAAD,EAAoB,GAAI,EAAQ,CAAA,CAC7B,EAAA,CAAA;AAET"}
1
+ {"version":3,"file":"EntityPageTitleBar.js","names":[],"sources":["../../../../../src/components/entity/page/title_bar/EntityPageTitleBar.tsx"],"sourcesContent":["import ConditionalWrapper from '@/components/utils/ConditionalWrapper'\nimport { useGetEntityBundle } from '@/synapse-queries'\nimport { isDockerRepository } from '@/utils/types/IsType'\nimport { Avatar, Box, Skeleton, Stack, Typography } from '@mui/material'\nimport FavoriteButton from '../../../favorites/FavoriteButton'\nimport IconSvg, { type2SvgIconName } from '../../../IconSvg/IconSvg'\nimport EntityActionMenu, {\n EntityActionMenuProps,\n} from '../action_menu/EntityActionMenu'\nimport { EntityTitleBarVersionInfo } from './EntityTitleBarVersionInfo'\nimport TitleBarProperties from './TitleBarProperties'\nimport CopyToClipboardString from '@/components/CopyToClipboardString/CopyToClipboardString'\n\nexport type EntityPageTitleBarProps = {\n entityId: string\n versionNumber?: number\n /* Props that will be passed through to an EntityActionMenu component */\n entityActionMenuProps?: EntityActionMenuProps\n /* Callback invoked when an ACT member clicks \"Add Conditions for Use\". */\n onActMemberClickAddConditionsForUse: () => void\n}\n\nconst TITLE_BAR_BACKGROUND_COLOR = '#EAF0F5'\nconst AVATAR_BACKGROUND_COLOR = '#497097'\n\n/**\n * The EntityPageTitleBar component is shown on every Entity page in Synapse, and shows an Entity's metadata and\n * provides controls to view and manipulate the Entity.\n */\nexport default function EntityPageTitleBar(props: EntityPageTitleBarProps) {\n const { entityId, versionNumber, entityActionMenuProps } = props\n\n const toggleShowVersionHistory =\n entityActionMenuProps?.actionConfiguration['SHOW_VERSION_HISTORY']?.onClick\n\n const { data: bundle, isLoading } = useGetEntityBundle(\n entityId,\n versionNumber,\n )\n\n const name =\n bundle?.entity && isDockerRepository(bundle.entity)\n ? bundle.entity.repositoryName\n : bundle?.entity?.name\n\n return (\n <div>\n <Box\n sx={{\n padding: '10px 16px',\n backgroundColor: TITLE_BAR_BACKGROUND_COLOR,\n borderRadius: '5px',\n }}\n >\n <Stack\n sx={{\n flexDirection: { xs: 'column', md: 'row' },\n alignItems: 'center',\n }}\n >\n <Stack\n direction={'row'}\n sx={{\n alignItems: 'center',\n flexGrow: 1,\n }}\n >\n <ConditionalWrapper\n condition={isLoading}\n wrapper={Skeleton}\n wrapperProps={{\n variant: 'circular',\n }}\n >\n <Avatar\n sx={{\n bgcolor: AVATAR_BACKGROUND_COLOR,\n height: 68,\n width: 68,\n borderRadius: '3px',\n svg: {\n height: '36px',\n width: '36px',\n },\n }}\n variant={'square'}\n >\n {bundle?.entityType && (\n <IconSvg\n icon={\n bundle?.entityType\n ? type2SvgIconName[bundle.entityType]\n : 'file'\n }\n wrap={false}\n />\n )}\n </Avatar>\n </ConditionalWrapper>\n <Box sx={{ marginLeft: '10px', flexGrow: 1 }}>\n <Stack\n direction={'row'}\n sx={{\n alignItems: 'center',\n gap: '3px',\n }}\n >\n <ConditionalWrapper condition={isLoading} wrapper={Skeleton}>\n <Typography\n variant={'headline2'}\n sx={{ color: 'greyV2.950', fontWeight: 540 }}\n >\n {name ?? 'Name not set'}\n </Typography>\n </ConditionalWrapper>\n {bundle?.entity?.id && (\n <FavoriteButton\n entityId={bundle.entity.id}\n iconColor={'greyV2.400'}\n />\n )}\n </Stack>\n <EntityTitleBarVersionInfo\n entityId={entityId}\n versionNumber={versionNumber}\n toggleShowVersionHistory={toggleShowVersionHistory}\n />\n <CopyToClipboardString\n value={entityId}\n icon=\"rounded\"\n sx={{\n '& .MuiTypography-root': {\n color: 'greyV2.800',\n fontWeight: 440,\n lineHeight: '20px',\n },\n }}\n />\n </Box>\n </Stack>\n {entityActionMenuProps && (\n <EntityActionMenu {...entityActionMenuProps} />\n )}\n </Stack>\n </Box>\n <TitleBarProperties {...props} />\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAM,IAA6B,WAC7B,IAA0B;AAMhC,SAAwB,EAAmB,GAAgC;CACzE,IAAM,EAAE,aAAU,kBAAe,6BAA0B,GAErD,IACJ,GAAuB,oBAAoB,sBAAyB,SAEhE,EAAE,MAAM,GAAQ,iBAAc,EAClC,GACA,CACF,GAEM,IACJ,GAAQ,UAAU,EAAmB,EAAO,MAAM,IAC9C,EAAO,OAAO,iBACd,GAAQ,QAAQ;CAEtB,OACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,GAAD;EACE,IAAI;GACF,SAAS;GACT,iBAAiB;GACjB,cAAc;EAChB;YAEA,kBAAC,GAAD;GACE,IAAI;IACF,eAAe;KAAE,IAAI;KAAU,IAAI;IAAM;IACzC,YAAY;GACd;aAJF,CAME,kBAAC,GAAD;IACE,WAAW;IACX,IAAI;KACF,YAAY;KACZ,UAAU;IACZ;cALF,CAOE,kBAAC,GAAD;KACE,WAAW;KACX,SAAS;KACT,cAAc,EACZ,SAAS,WACX;eAEA,kBAAC,GAAD;MACE,IAAI;OACF,SAAS;OACT,QAAQ;OACR,OAAO;OACP,cAAc;OACd,KAAK;QACH,QAAQ;QACR,OAAO;OACT;MACF;MACA,SAAS;gBAER,GAAQ,cACP,kBAAC,GAAD;OACE,MACE,GAAQ,aACJ,EAAiB,EAAO,cACxB;OAEN,MAAM;MACP,CAAA;KAEG,CAAA;IACU,CAAA,GACpB,kBAAC,GAAD;KAAK,IAAI;MAAE,YAAY;MAAQ,UAAU;KAAE;eAA3C;MACE,kBAAC,GAAD;OACE,WAAW;OACX,IAAI;QACF,YAAY;QACZ,KAAK;OACP;iBALF,CAOE,kBAAC,GAAD;QAAoB,WAAW;QAAW,SAAS;kBACjD,kBAAC,GAAD;SACE,SAAS;SACT,IAAI;UAAE,OAAO;UAAc,YAAY;SAAI;mBAE1C,KAAQ;QACC,CAAA;OACM,CAAA,GACnB,GAAQ,QAAQ,MACf,kBAAC,GAAD;QACE,UAAU,EAAO,OAAO;QACxB,WAAW;OACZ,CAAA,CAEE;;MACP,kBAAC,GAAD;OACY;OACK;OACW;MAC3B,CAAA;MACD,kBAAC,GAAD;OACE,OAAO;OACP,MAAK;OACL,IAAI,EACF,yBAAyB;QACvB,OAAO;QACP,YAAY;QACZ,YAAY;OACd,EACF;MACD,CAAA;KACE;MACA;OACN,KACC,kBAAC,GAAD,EAAkB,GAAI,EAAwB,CAAA,CAE3C;;CACJ,CAAA,GACL,kBAAC,GAAD,EAAoB,GAAI,EAAQ,CAAA,CAC7B,EAAA,CAAA;AAET"}
@@ -10,7 +10,7 @@ function u(u) {
10
10
  sx: (e) => ({
11
11
  display: "flex",
12
12
  alignItems: "center",
13
- gap: "10px",
13
+ gap: "6px",
14
14
  flexWrap: "wrap",
15
15
  justifyContent: "flex-end",
16
16
  [e.breakpoints.down("md")]: { flexDirection: "column" }
@@ -1 +1 @@
1
- {"version":3,"file":"ComplexMenu.js","names":[],"sources":["../../../src/components/menu/ComplexMenu.tsx"],"sourcesContent":["import {\n Box,\n Button,\n ButtonProps,\n SxProps,\n Typography,\n useMediaQuery,\n useTheme,\n} from '@mui/material'\nimport { DropdownMenu, DropdownMenuProps } from './DropdownMenu'\nimport { IconSvgButton, IconSvgButtonProps } from '../IconSvgButton'\nimport IconSvg from '../IconSvg'\n\nexport type ComplexMenuButtonProps = Omit<IconSvgButtonProps, 'icon'> & {\n icon?: IconSvgButtonProps['icon']\n variant?: ButtonProps['variant']\n text?: string\n iconSx?: SxProps\n}\n\nexport type ComplexMenuProps = {\n /*\n * Configuration for buttons. Each entry corresponds to one button.\n * See the ComplexMenuButtonProps type for more info.\n */\n iconButtons?: ComplexMenuButtonProps[]\n /*\n * Configuration for DropdownMenus. Each entry corresponds to one dropdown menu button, which\n * itself can contain multiple groups of items.\n * See the DropdownMenuProps type for more info.\n */\n dropdownMenus?: DropdownMenuProps[]\n}\n\n/**\n * The ComplexMenu component allows you to create a generic menu with\n * icon buttons and multiple dropdown menus that contain groups of items.\n */\nexport function ComplexMenu(props: ComplexMenuProps) {\n const { iconButtons = [], dropdownMenus = [] } = props\n const theme = useTheme()\n const isSmallScreen = useMediaQuery(theme.breakpoints.down('sm'))\n\n return (\n <Box\n sx={theme => ({\n display: 'flex',\n alignItems: 'center',\n gap: '10px',\n flexWrap: 'wrap',\n justifyContent: 'flex-end',\n [theme.breakpoints.down('md')]: {\n flexDirection: 'column',\n },\n })}\n >\n {iconButtons.map(iconButton => {\n if (iconButton.variant != null) {\n const label = iconButton.text ?? iconButton.tooltipText\n return (\n <Box\n key={label}\n sx={theme => ({\n [theme.breakpoints.down('md')]: {\n width: '100%',\n '.MuiButton-root': { width: '100%' },\n },\n })}\n >\n <Button\n variant={iconButton.variant}\n startIcon={\n iconButton.icon ? (\n <IconSvg\n icon={iconButton.icon}\n wrap={false}\n fontSize={'inherit'}\n sx={iconButton.iconSx}\n />\n ) : undefined\n }\n onClick={iconButton.onClick}\n href={iconButton.href}\n disabled={iconButton.disabled}\n >\n <Typography variant=\"buttonLink\">{label}</Typography>\n </Button>\n </Box>\n )\n }\n return isSmallScreen && iconButton.tooltipText ? (\n <Box\n sx={{\n width: '100%',\n textAlign: 'center',\n }}\n >\n <Button\n variant=\"text\"\n startIcon={\n <IconSvg\n key={iconButton.tooltipText}\n icon={iconButton.icon!}\n wrap={false}\n fontSize={'inherit'}\n />\n }\n onClick={iconButton.onClick}\n sx={{\n padding: '6px 12px',\n minWidth: 'unset',\n }}\n >\n <Typography variant=\"buttonLink\">\n {iconButton.tooltipText}\n </Typography>\n </Button>\n </Box>\n ) : (\n <IconSvgButton\n key={iconButton.tooltipText}\n {...iconButton}\n icon={iconButton.icon!}\n />\n )\n })}\n {dropdownMenus.map(\n (menuProps, index) =>\n menuProps.items &&\n menuProps.items.length > 0 && (\n <Box\n sx={theme => ({\n [theme.breakpoints.down('md')]: {\n width: '100%',\n '.MuiButton-root': { width: '100%' },\n },\n })}\n >\n <DropdownMenu key={index} {...menuProps} />\n </Box>\n ),\n )}\n </Box>\n )\n}\n"],"mappings":";;;;;;AAsCA,SAAgB,EAAY,GAAyB;CACnD,IAAM,EAAE,iBAAc,CAAC,GAAG,mBAAgB,CAAC,MAAM,GAE3C,IAAgB,EADR,EACsB,EAAM,YAAY,KAAK,IAAI,CAAC;CAEhE,OACE,kBAAC,GAAD;EACE,KAAI,OAAU;GACZ,SAAS;GACT,YAAY;GACZ,KAAK;GACL,UAAU;GACV,gBAAgB;IACf,EAAM,YAAY,KAAK,IAAI,IAAI,EAC9B,eAAe,SACjB;EACF;YAVF,CAYG,EAAY,KAAI,MAAc;GAC7B,IAAI,EAAW,WAAW,MAAM;IAC9B,IAAM,IAAQ,EAAW,QAAQ,EAAW;IAC5C,OACE,kBAAC,GAAD;KAEE,KAAI,OAAU,GACX,EAAM,YAAY,KAAK,IAAI,IAAI;MAC9B,OAAO;MACP,mBAAmB,EAAE,OAAO,OAAO;KACrC,EACF;eAEA,kBAAC,GAAD;MACE,SAAS,EAAW;MACpB,WACE,EAAW,OACT,kBAAC,GAAD;OACE,MAAM,EAAW;OACjB,MAAM;OACN,UAAU;OACV,IAAI,EAAW;MAChB,CAAA,IACC,KAAA;MAEN,SAAS,EAAW;MACpB,MAAM,EAAW;MACjB,UAAU,EAAW;gBAErB,kBAAC,GAAD;OAAY,SAAQ;iBAAc;MAAkB,CAAA;KAC9C,CAAA;IACL,GA1BE,CA0BF;GAET;GACA,OAAO,KAAiB,EAAW,cACjC,kBAAC,GAAD;IACE,IAAI;KACF,OAAO;KACP,WAAW;IACb;cAEA,kBAAC,GAAD;KACE,SAAQ;KACR,WACE,kBAAC,GAAD;MAEE,MAAM,EAAW;MACjB,MAAM;MACN,UAAU;KACX,GAJM,EAAW,WAIjB;KAEH,SAAS,EAAW;KACpB,IAAI;MACF,SAAS;MACT,UAAU;KACZ;eAEA,kBAAC,GAAD;MAAY,SAAQ;gBACjB,EAAW;KACF,CAAA;IACN,CAAA;GACL,CAAA,IAEL,kBAAC,GAAD;IAEE,GAAI;IACJ,MAAM,EAAW;GAClB,GAHM,EAAW,WAGjB;EAEL,CAAC,GACA,EAAc,KACZ,GAAW,MACV,EAAU,SACV,EAAU,MAAM,SAAS,KACvB,kBAAC,GAAD;GACE,KAAI,OAAU,GACX,EAAM,YAAY,KAAK,IAAI,IAAI;IAC9B,OAAO;IACP,mBAAmB,EAAE,OAAO,OAAO;GACrC,EACF;aAEA,kBAAC,GAAD,EAA0B,GAAI,EAAY,GAAvB,CAAuB;EACvC,CAAA,CAEX,CACG;;AAET"}
1
+ {"version":3,"file":"ComplexMenu.js","names":[],"sources":["../../../src/components/menu/ComplexMenu.tsx"],"sourcesContent":["import {\n Box,\n Button,\n ButtonProps,\n SxProps,\n Typography,\n useMediaQuery,\n useTheme,\n} from '@mui/material'\nimport { DropdownMenu, DropdownMenuProps } from './DropdownMenu'\nimport { IconSvgButton, IconSvgButtonProps } from '../IconSvgButton'\nimport IconSvg from '../IconSvg'\n\nexport type ComplexMenuButtonProps = Omit<IconSvgButtonProps, 'icon'> & {\n icon?: IconSvgButtonProps['icon']\n variant?: ButtonProps['variant']\n text?: string\n iconSx?: SxProps\n}\n\nexport type ComplexMenuProps = {\n /*\n * Configuration for buttons. Each entry corresponds to one button.\n * See the ComplexMenuButtonProps type for more info.\n */\n iconButtons?: ComplexMenuButtonProps[]\n /*\n * Configuration for DropdownMenus. Each entry corresponds to one dropdown menu button, which\n * itself can contain multiple groups of items.\n * See the DropdownMenuProps type for more info.\n */\n dropdownMenus?: DropdownMenuProps[]\n}\n\n/**\n * The ComplexMenu component allows you to create a generic menu with\n * icon buttons and multiple dropdown menus that contain groups of items.\n */\nexport function ComplexMenu(props: ComplexMenuProps) {\n const { iconButtons = [], dropdownMenus = [] } = props\n const theme = useTheme()\n const isSmallScreen = useMediaQuery(theme.breakpoints.down('sm'))\n\n return (\n <Box\n sx={theme => ({\n display: 'flex',\n alignItems: 'center',\n gap: '6px',\n flexWrap: 'wrap',\n justifyContent: 'flex-end',\n [theme.breakpoints.down('md')]: {\n flexDirection: 'column',\n },\n })}\n >\n {iconButtons.map(iconButton => {\n if (iconButton.variant != null) {\n const label = iconButton.text ?? iconButton.tooltipText\n return (\n <Box\n key={label}\n sx={theme => ({\n [theme.breakpoints.down('md')]: {\n width: '100%',\n '.MuiButton-root': { width: '100%' },\n },\n })}\n >\n <Button\n variant={iconButton.variant}\n startIcon={\n iconButton.icon ? (\n <IconSvg\n icon={iconButton.icon}\n wrap={false}\n fontSize={'inherit'}\n sx={iconButton.iconSx}\n />\n ) : undefined\n }\n onClick={iconButton.onClick}\n href={iconButton.href}\n disabled={iconButton.disabled}\n >\n <Typography variant=\"buttonLink\">{label}</Typography>\n </Button>\n </Box>\n )\n }\n return isSmallScreen && iconButton.tooltipText ? (\n <Box\n sx={{\n width: '100%',\n textAlign: 'center',\n }}\n >\n <Button\n variant=\"text\"\n startIcon={\n <IconSvg\n key={iconButton.tooltipText}\n icon={iconButton.icon!}\n wrap={false}\n fontSize={'inherit'}\n />\n }\n onClick={iconButton.onClick}\n sx={{\n padding: '6px 12px',\n minWidth: 'unset',\n }}\n >\n <Typography variant=\"buttonLink\">\n {iconButton.tooltipText}\n </Typography>\n </Button>\n </Box>\n ) : (\n <IconSvgButton\n key={iconButton.tooltipText}\n {...iconButton}\n icon={iconButton.icon!}\n />\n )\n })}\n {dropdownMenus.map(\n (menuProps, index) =>\n menuProps.items &&\n menuProps.items.length > 0 && (\n <Box\n sx={theme => ({\n [theme.breakpoints.down('md')]: {\n width: '100%',\n '.MuiButton-root': { width: '100%' },\n },\n })}\n >\n <DropdownMenu key={index} {...menuProps} />\n </Box>\n ),\n )}\n </Box>\n )\n}\n"],"mapp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,MAAM,CAAA;IAElB,2BAA2B,CAAC,EAAE,OAAO,CAAA;CACtC,CAAA;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,kDAwNpD"}
@@ -82,6 +82,10 @@ function x(x) {
82
82
  placement: "bottom-end",
83
83
  transition: !0,
84
84
  style: { zIndex: 10 },
85
+ modifiers: [{
86
+ name: "offset",
87
+ options: { offset: [0, 6] }
88
+ }],
85
89
  children: ({ TransitionProps: t }) => /* @__PURE__ */ v(c, {
86
90
  ...t,
87
91
  children: /* @__PURE__ */ v(p, {
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenu.js","names":[],"sources":["../../../src/components/menu/DropdownMenu.tsx"],"sourcesContent":["import {\n Button,\n ButtonProps,\n ClickAwayListener,\n Divider,\n Fade,\n ListItemIcon,\n ListItemText,\n MenuItem,\n MenuList,\n Paper,\n Popper,\n SxProps,\n Tooltip,\n Typography,\n Box,\n} from '@mui/material'\nimport {\n KeyboardEvent,\n MouseEvent,\n SyntheticEvent,\n useId,\n useRef,\n useState,\n} from 'react'\nimport IconSvg, { IconName } from '../IconSvg/IconSvg'\n\nconst fileAccessRequestNotice = (\n <Box\n sx={{\n backgroundColor: '#EAF0F5',\n color: '#3B4046',\n padding: '6px 8px',\n borderRadius: '3px',\n marginTop: '8px',\n }}\n >\n <Typography\n sx={{\n fontSize: '14px',\n fontWeight: '440',\n lineHeight: '20px',\n letterSpacing: '-0.07px',\n }}\n >\n <span\n style={{\n fontWeight: '700',\n }}\n >\n Note:{' '}\n </span>\n You can add this file to your download list, but you must make an access\n request before downloading.\n </Typography>\n </Box>\n)\n\n/**\n * Defines a configuration for a particular dropdown menu item\n */\nexport type DropdownMenuItem = {\n /* The text to show on the menu item. */\n text: string\n /* The icon to show for this item in the menu. */\n icon?: IconName\n /* A function invoked upon clicking the item, assuming `disabled` is falsy */\n onClick?: (e: MouseEvent) => void\n /* A link that the item should point to. */\n href?: string\n /* The optional tooltipText to show for this item. Compatible with the `disabled` prop. */\n tooltipText?: string\n /* Whether the item should be disabled from selection. */\n disabled?: boolean\n /* Additional MUI SxProps to pass to the text component */\n textSx?: SxProps\n /* Additional MUI SxProps to pass to the icon component */\n iconSx?: SxProps\n}\n\nexport type DropdownMenuProps = {\n /* Groups of menu items. Each group will be split with a divider. See DropdownMenuItem for per-item configuration */\n items: DropdownMenuItem[][]\n /* The text to show on the dropdown menu button. */\n dropdownButtonText: string\n /* The optional tooltip text for the dropdown menu button. */\n buttonTooltip?: string\n /* Any additional props to pass to the dropdown menu button. */\n buttonProps?: ButtonProps\n /* Optional MUI button variant for the dropdown button (and the single-item button). Default 'outlined'. */\n variant?: ButtonProps['variant']\n /* If true, will render a single action as a standalone button. Default true. */\n convertSingleItemToButton?: boolean\n /* If true, nothing will be rendered if no actions are passed. Default false. */\n renderMenuIfNoItems?: boolean\n paperSx?: SxProps\n elevation?: number\n /* If true, shows the file access request notice at the bottom of the menu. Default false. */\n showFileAccessRequestNotice?: boolean\n}\n\n/**\n * The DropdownMenu component provides a generic way to compose a MUI dropdown menu.\n */\nexport function DropdownMenu(props: DropdownMenuProps) {\n const {\n buttonTooltip,\n dropdownButtonText,\n items = [] as DropdownMenuItem[][],\n convertSingleItemToButton = true,\n renderMenuIfNoItems = false,\n buttonProps = {},\n variant = 'outlined',\n paperSx,\n elevation,\n showFileAccessRequestNotice = false,\n } = props\n\n const dropdownMenuId = useId()\n const [open, setOpen] = useState(false)\n const anchorRef = useRef<HTMLButtonElement>(null)\n\n const numberOfMenuItems = items.flat().length\n\n if (!renderMenuIfNoItems && numberOfMenuItems === 0) {\n // Hide menu if no actions will be in the menu\n return null\n }\n\n if (convertSingleItemToButton && numberOfMenuItems === 1) {\n // If one action is in the menu, show it as a button\n const menuItem = items.flat()[0]\n return (\n <Button\n component={menuItem.href ? 'a' : 'button'}\n title={menuItem.tooltipText}\n variant={variant}\n href={menuItem.href}\n rel={menuItem.href ? 'noopener noreferrer' : undefined}\n onClick={menuItem.onClick}\n disabled={menuItem.disabled}\n endIcon={menuItem.icon && <IconSvg icon={menuItem.icon} wrap={false} />}\n >\n <Typography variant={'buttonLink'}>{menuItem.text}</Typography>\n </Button>\n )\n }\n\n const handleToggle = () => {\n setOpen(prevOpen => !prevOpen)\n }\n\n const handleClose = (event: Event | SyntheticEvent) => {\n if (anchorRef.current?.contains(event.target as HTMLElement)) {\n return\n }\n\n setOpen(false)\n }\n\n function handleListKeyDown(event: KeyboardEvent) {\n if (event.key === 'Tab') {\n event.preventDefault()\n setOpen(false)\n } else if (event.key === 'Escape') {\n setOpen(false)\n }\n }\n\n return (\n <>\n <Tooltip\n title={\n buttonTooltip ? (\n <div style={{ whiteSpace: 'pre-line' }}>{buttonTooltip}</div>\n ) : undefined\n }\n placement={'top'}\n >\n <span>\n <Button\n variant={variant}\n ref={anchorRef}\n id={`composition-button-${dropdownMenuId}`}\n aria-controls={\n open ? `composition-menu-${dropdownMenuId}` : undefined\n }\n aria-expanded={open ? 'true' : undefined}\n aria-haspopup=\"true\"\n onClick={handleToggle}\n {...buttonProps}\n >\n <Typography variant={'buttonLink'}>{dropdownButtonText}</Typography>\n </Button>\n </span>\n </Tooltip>\n <Popper\n open={open}\n anchorEl={anchorRef.current}\n role={undefined}\n placement=\"bottom-end\"\n transition\n style={{\n // Fixes issue where react-flow (provenance) would appear above the menu\n zIndex: 10,\n }}\n >\n {({ TransitionProps }) => (\n <Fade {...TransitionProps}>\n <Paper elevation={elevation} sx={{ ...paperSx }}>\n <ClickAwayListener onClickAway={handleClose}>\n <Box>\n <MenuList\n autoFocusItem={open}\n id={`composition-menu-${dropdownMenuId}`}\n aria-labelledby={`composition-button-${dropdownMenuId}`}\n onKeyDown={handleListKeyDown}\n >\n {items.map((itemGroup, index, array) => {\n return [\n itemGroup.map(item => {\n return (\n <Tooltip\n key={item.text}\n title={item.tooltipText}\n placement={'left'}\n >\n <MenuItem\n // Always make the component an anchor in case href is defined.\n component=\"a\"\n sx={{\n // Override the anchor-specific state styles, we don't want it to look like an anchor\n '&:hover': {\n color: 'unset',\n },\n '&:focus': {\n color: 'unset',\n textDecoration: 'unset',\n },\n }}\n disabled={item.disabled}\n href={item.href}\n rel={\n item.href ? 'noopener noreferrer' : undefined\n }\n // Allow pointer events on disabled item so tooltip works.\n style={{ pointerEvents: 'auto' }}\n onClick={(e: MouseEvent) => {\n /*\n * Must check if the item is disabled because we set\n * `pointer-events: 'auto'`\n */\n if (\n !item.disabled &&\n 'onClick' in item &&\n item.onClick\n ) {\n setOpen(false)\n item.onClick(e)\n }\n }}\n >\n {item.icon && (\n <ListItemIcon\n style={{\n // MUI has specified a more specific minWidth for ListItemIcon inside a MenuList than\n // we can create with sx, so apply an inline style for this property only.\n minWidth: '30px',\n }}\n >\n <IconSvg\n icon={item.icon}\n sx={{\n width: '17px',\n height: '17px',\n ...item.iconSx,\n }}\n wrap={false}\n />\n </ListItemIcon>\n )}\n <ListItemText\n sx={{ marginTop: 0 }}\n slotProps={{\n primary: {\n variant: 'smallText1',\n sx: item.textSx,\n },\n }}\n >\n {item.text}\n </ListItemText>\n </MenuItem>\n </Tooltip>\n )\n }),\n index < array.length - 1 && <Divider />,\n ]\n })}\n </MenuList>\n {showFileAccessRequestNotice && (\n <>\n {numberOfMenuItems > 0 && <Divider />}\n {fileAccessRequestNotice}\n </>\n )}\n </Box>\n </ClickAwayListener>\n </Paper>\n </Fade>\n )}\n </Popper>\n </>\n )\n}\n"],"mappings":";;;;;AA2BA,IAAM,IACJ,kBAAC,GAAD;CACE,IAAI;EACF,iBAAiB;EACjB,OAAO;EACP,SAAS;EACT,cAAc;EACd,WAAW;CACb;WAEA,kBAAC,GAAD;EACE,IAAI;GACF,UAAU;GACV,YAAY;GACZ,YAAY;GACZ,eAAe;EACjB;YANF,CAQE,kBAAC,QAAD;GACE,OAAO,EACL,YAAY,MACd;aAHF,CAIC,SACO,GACF;MAAC,sGAGG;;AACT,CAAA;AAiDP,SAAgB,EAAa,GAA0B;CACrD,IAAM,EACJ,kBACA,u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X,EACF;mBAEC,EAAK;QACM,CAAA,CACN;;MACH,GAtEF,EAAK,IAsEH,CAEZ,GACD,IAAQ,EAAM,SAAS,KAAK,kBAAC,GAAD,CAAU,CAAA,CACxC,CACD;KACO,CAAA,GACT,KACC,kBAAA,GAAA,EAAA,UAAA,CACG,IAAoB,KAAK,kBAAC,GAAD,CAAU,CAAA,GACnC,CACD,EAAA,CAAA,CAED,EAAA,CAAA;IACY,CAAA;GACd,CAAA;EACH,CAAA;CAEF,CAAA,CACR,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"DropdownMenu.js","names":[],"sources":["../../../src/components/menu/DropdownMenu.tsx"],"sourcesContent":["import {\n Button,\n ButtonProps,\n ClickAwayListener,\n Divider,\n Fade,\n ListItemIcon,\n ListItemText,\n MenuItem,\n MenuList,\n Paper,\n Popper,\n SxProps,\n Tooltip,\n Typography,\n Box,\n} from '@mui/material'\nimport {\n KeyboardEvent,\n MouseEvent,\n SyntheticEvent,\n useId,\n useRef,\n useState,\n} from 'react'\nimport IconSvg, { IconName } from '../IconSvg/IconSvg'\n\nconst fileAccessRequestNotice = (\n <Box\n sx={{\n backgroundColor: '#EAF0F5',\n color: '#3B4046',\n padding: '6px 8px',\n borderRadius: '3px',\n marginTop: '8px',\n }}\n >\n <Typography\n sx={{\n fontSize: '14px',\n fontWeight: '440',\n lineHeight: '20px',\n letterSpacing: '-0.07px',\n }}\n >\n <span\n style={{\n fontWeight: '700',\n }}\n >\n Note:{' '}\n </span>\n You can add this file to your download list, but you must make an access\n request before downloading.\n </Typography>\n </Box>\n)\n\n/**\n * Defines a configuration for a particular dropdown menu item\n */\nexport type DropdownMenuItem = {\n /* The text to show on the menu item. */\n text: string\n /* The icon to show for this item in the menu. */\n icon?: IconName\n /* A function invoked upon clicking the item, assuming `disabled` is falsy */\n onClick?: (e: MouseEvent) => void\n /* A link that the item should point to. */\n href?: string\n /* The optional tooltipText to show for this item. Compatible with the `disabled` prop. */\n tooltipText?: string\n /* Whether the item should be disabled from selection. */\n disabled?: boolean\n /* Additional MUI SxProps to pass to the text component */\n textSx?: SxProps\n /* Additional MUI SxProps to pass to the icon component */\n iconSx?: SxProps\n}\n\nexport type DropdownMenuProps = {\n /* Groups of menu items. Each group will be split with a divider. See DropdownMenuItem for per-item configuration */\n items: DropdownMenuItem[][]\n /* The text to show on the dropdown menu button. */\n dropdownButtonText: string\n /* The optional tooltip text for the dropdown menu button. */\n buttonTooltip?: string\n /* Any additional props to pass to the dropdown menu button. */\n buttonProps?: ButtonProps\n /* Optional MUI button variant for the dropdown button (and the single-item button). Default 'outlined'. */\n variant?: ButtonProps['variant']\n /* If true, will render a single action as a standalone button. Default true. */\n convertSingleItemToButton?: boolean\n /* If true, nothing will be rendered if no actions are passed. Default false. */\n renderMenuIfNoItems?: boolean\n paperSx?: SxProps\n elevation?: number\n /* If true, shows the file access request notice at the bottom of the menu. Default false. */\n showFileAccessRequestNotice?: boolean\n}\n\n/**\n * The DropdownMenu component provides a generic way to compose a MUI dropdown menu.\n */\nexport function DropdownMenu(props: DropdownMenuProps) {\n const {\n buttonTooltip,\n dropdownButtonText,\n items = [] as DropdownMenuItem[][],\n convertSingleItemToButton = true,\n renderMenuIfNoItems = false,\n buttonProps = {},\n variant = 'outlined',\n paperSx,\n elevation,\n showFileAccessRequestNotice = false,\n } = props\n\n const dropdownMenuId = useId()\n const [open, setOpen] = useState(false)\n const anchorRef = useRef<HTMLButtonElement>(null)\n\n const numberOfMenuItems = items.flat().length\n\n if (!renderMenuIfNoItems && numberOfMenuItems === 0) {\n // Hide menu if no actions will be in the menu\n return null\n }\n\n if (convertSingleItemToButton && numberOfMenuItems === 1) {\n // If one action is in the menu, show it as a button\n const menuItem = items.flat()[0]\n return (\n <Button\n component={menuItem.href ? 'a' : 'button'}\n title={menuItem.tooltipText}\n variant={variant}\n href={menuItem.href}\n rel={menuItem.href ? 'noopener noreferrer' : undefined}\n onClick={menuItem.onClick}\n disabled={menuItem.disabled}\n endIcon={menuItem.icon && <IconSvg icon={menuItem.icon} wrap={false} />}\n >\n <Typography variant={'buttonLink'}>{menuItem.text}</Typography>\n </Button>\n )\n }\n\n const handleToggle = () => {\n setOpen(prevOpen => !prevOpen)\n }\n\n const handleClose = (event: Event | SyntheticEvent) => {\n if (anchorRef.current?.contains(event.target as HTMLElement)) {\n return\n }\n\n setOpen(false)\n }\n\n function handleListKeyDown(event: KeyboardEvent) {\n if (event.key === 'Tab') {\n event.preventDefault()\n setOpen(false)\n } else if (event.key === 'Escape') {\n setOpen(false)\n }\n }\n\n return (\n <>\n <Tooltip\n title={\n buttonTooltip ? (\n <div style={{ whiteSpace: 'pre-line' }}>{buttonTooltip}</div>\n ) : undefined\n }\n placement={'top'}\n >\n <span>\n <Button\n variant={variant}\n ref={anchorRef}\n id={`composition-button-${dropdownMenuId}`}\n aria-controls={\n open ? `composition-menu-${dropdownMenuId}` : undefined\n }\n aria-expanded={open ? 'true' : undefined}\n aria-haspopup=\"true\"\n onClick={handleToggle}\n {...buttonProps}\n >\n <Typography variant={'buttonLink'}>{dropdownButtonText}</Typography>\n </Button>\n </span>\n </Tooltip>\n <Popper\n open={open}\n anchorEl={anchorRef.current}\n role={undefined}\n placement=\"bottom-end\"\n transition\n style={{\n // Fixes issue where react-flow (provenance) would appear above the menu\n zIndex: 10,\n }}\n modifiers={[\n {\n name: 'offset',\n options: { offset: [0, 6] },\n },\n ]}\n >\n {({ TransitionProps }) => (\n <Fade {...TransitionProps}>\n <Paper elevation={elevation} sx={{ ...paperSx }}>\n <ClickAwayListener onClickAway={handleClose}>\n <Box>\n <MenuList\n autoFocusItem={open}\n id={`composition-menu-${dropdownMenuId}`}\n aria-labelledby={`composition-button-${dropdownMenuId}`}\n onKeyDown={handleListKeyDown}\n >\n {items.map((itemGroup, index, array) => {\n return [\n itemGroup.map(item => {\n return (\n <Tooltip\n key={item.text}\n title={item.tooltipText}\n placement={'left'}\n >\n <MenuItem\n // Always make the component an anchor in case href is defined.\n component=\"a\"\n sx={{\n // Override the anchor-specific state styles, we don't want it to look like an anchor\n '&:hover': {\n color: 'unset',\n },\n '&:focus': {\n color: 'unset',\n textDecoration: 'unset',\n },\n }}\n disabled={item.disabled}\n href={item.href}\n rel={\n item.href ? 'noopener noreferrer' : undefined\n }\n // Allow pointer events on disabled item so tooltip works.\n style={{ pointerEvents: 'auto' }}\n onClick={(e: MouseEvent) => {\n /*\n * Must check if the item is disabled because we set\n * `pointer-events: 'auto'`\n */\n if (\n !item.disabled &&\n 'onClick' in item &&\n item.onClick\n ) {\n setOpen(false)\n item.onClick(e)\n }\n }}\n >\n {item.icon && (\n <ListItemIcon\n style={{\n // MUI has specified a more specific minWidth for ListItemIcon inside a MenuList than\n // we can create with sx, so apply an inline style for this property only.\n minWidth: '30px',\n }}\n >\n <IconSvg\n icon={item.icon}\n sx={{\n width: '17px',\n height: '17px',\n ...item.iconSx,\n }}\n wrap={false}\n />\n </ListItemIcon>\n )}\n <ListItemText\n sx={{ marginTop: 0 }}\n slotProps={{\n primary: {\n variant: 'smallText1',\n sx: item.textSx,\n },\n }}\n >\n {item.text}\n </ListItemText>\n </MenuItem>\n </Tooltip>\n )\n }),\n index < array.length - 1 && <Divider />,\n ]\n })}\n </MenuList>\n {showFileAccessRequestNotice && (\n <>\n {numberOfMenuItems > 0 && <Divider />}\n {fileAccessRequestNotice}\n </>\n )}\n </Box>\n </ClickAwayListener>\n </Paper>\n </Fade>\n )}\n </Popper>\n </>\n )\n}\n"],"mappings":";;;;;AA2BA,IAAM,IACJ,kBAAC,GAAD;CACE,IAAI;EACF,iBAAiB;EACjB,OAAO;EACP,SAAS;EACT,cAAc;EACd,WAAW;CACb;WAEA,kBAAC,GAAD;EACE,IAAI;GACF,UAAU;GACV,YAAY;GACZ,YAAY;GACZ,eAAe;EACjB;YANF,CAQE,kBAAC,QAAD;GACE,OAAO,EACL,YAAY,MACd;aAHF,CAIC,SACO,GACF;MAAC,sGAGG;;AACT,CAAA;AAiDP,SAAgB,EAAa,GAA0B;CACrD,IAAM,E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hB,kBAAC,GAAD;SACE,IAAI,EAAE,WAAW,EAAE;SACnB,WAAW,EACT,SAAS;UACP,SAAS;UACT,IAAI,EAAK;SACX,EACF;mBAEC,EAAK;QACM,CAAA,CACN;;MACH,GAtEF,EAAK,IAsEH,CAEZ,GACD,IAAQ,EAAM,SAAS,KAAK,kBAAC,GAAD,CAAU,CAAA,CACxC,CACD;KACO,CAAA,GACT,KACC,kBAAA,GAAA,EAAA,UAAA,CACG,IAAoB,KAAK,kBAAC,GAAD,CAAU,CAAA,GACnC,CACD,EAAA,CAAA,CAED,EAAA,CAAA;IACY,CAAA;GACd,CAAA;EACH,CAAA;CAEF,CAAA,CACR,EAAA,CAAA;AAEN"}
@@ -0,0 +1,10 @@
1
+ import { SynapseClientError, TaskStatus } from '@sage-bionetworks/synapse-client';
2
+ /**
3
+ * A hook to record that work has begun on a curation task by advancing its `TaskStatus` from
4
+ * `NOT_STARTED` to `IN_PROGRESS`.
5
+ *
6
+ * @returns A mutation object taking a `taskId`. The mutation resolves to the updated `TaskStatus`,
7
+ * or to `undefined` when the task had already advanced past `NOT_STARTED` and was left untouched.
8
+ */
9
+ export default function useMarkCurationTaskInProgress(): import("@tanstack/react-query").UseMutationResult<TaskStatus | undefined, SynapseClientError, number, unknown>;
10
+ //# sourceMappingURL=useMarkCurationTaskInProgress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMarkCurationTaskInProgress.d.ts","sourceRoot":"","sources":["../../../../../src/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,UAAU,EAEX,MAAM,kCAAkC,CAAA;AAGzC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,6BAA6B,mHAsBpD"}
@@ -0,0 +1,20 @@
1
+ import { useSynapseContext as e } from "../../../../utils/context/SynapseContext.js";
2
+ import "../../../../utils/index.js";
3
+ import { useUpdateCurationTaskStatus as t } from "../../../../synapse-queries/curation/task/useCurationTask.js";
4
+ import { TaskStatusStateEnum as n } from "@sage-bionetworks/synapse-client";
5
+ import { useMutation as r } from "@tanstack/react-query";
6
+ //#region src/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.ts
7
+ function i() {
8
+ let { synapseClient: i } = e(), { mutateAsync: a } = t();
9
+ return r({ mutationFn: async (e) => {
10
+ let t = await i.curationTaskServicesClient.getRepoV1CurationTaskTaskIdStatus({ taskId: e });
11
+ if (t.state === n.NOT_STARTED) return await a({
12
+ ...t,
13
+ state: n.IN_PROGRESS
14
+ });
15
+ } });
16
+ }
17
+ //#endregion
18
+ export { i as default };
19
+
20
+ //# sourceMappingURL=useMarkCurationTaskInProgress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMarkCurationTaskInProgress.js","names":[],"sources":["../../../../../src/features/entity/metadata-task/hooks/useMarkCurationTaskInProgress.ts"],"sourcesContent":["import { useUpdateCurationTaskStatus } from '@/synapse-queries/curation/task/useCurationTask'\nimport { useSynapseContext } from '@/utils/index'\nimport {\n SynapseClientError,\n TaskStatus,\n TaskStatusStateEnum,\n} from '@sage-bionetworks/synapse-client'\nimport { useMutation } from '@tanstack/react-query'\n\n/**\n * A hook to record that work has begun on a curation task by advancing its `TaskStatus` from\n * `NOT_STARTED` to `IN_PROGRESS`.\n *\n * @returns A mutation object taking a `taskId`. The mutation resolves to the updated `TaskStatus`,\n * or to `undefined` when the task had already advanced past `NOT_STARTED` and was left untouched.\n */\nexport default function useMarkCurationTaskInProgress() {\n const { synapseClient } = useSynapseContext()\n const { mutateAsync: updateCurationTaskStatus } =\n useUpdateCurationTaskStatus()\n\n return useMutation<TaskStatus | undefined, SynapseClientError, number>({\n mutationFn: async taskId => {\n const latestStatus =\n await synapseClient.curationTaskServicesClient.getRepoV1CurationTaskTaskIdStatus(\n { taskId },\n )\n\n if (latestStatus.state !== TaskStatusStateEnum.NOT_STARTED) {\n return undefined\n }\n\n return await updateCurationTaskStatus({\n ...latestStatus,\n state: TaskStatusStateEnum.IN_PROGRESS,\n })\n },\n })\n}\n"],"mappings":";;;;;;AAgBA,SAAwB,IAAgC;CACtD,IAAM,EAAE,qBAAkB,EAAkB,GACtC,EAAE,aAAa,MACnB,EAA4B;CAE9B,OAAO,EAAgE,EACrE,YAAY,OAAM,MAAU;EAC1B,IAAM,IACJ,MAAM,EAAc,2BAA2B,kCAC7C,EAAE,UAAO,CACX;EAEE,MAAa,UAAU,EAAoB,aAI/C,OAAO,MAAM,EAAyB;GACpC,GAAG;GACH,OAAO,EAAoB;EAC7B,CAAC;CACH,EACF,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"useOpenCuratorButton.d.ts","sourceRoot":"","sources":["../../../../../src/features/entity/metadata-task/hooks/useOpenCuratorButton.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,UAAU,EACX,MAAM,kCAAkC,CAAA;AAYzC,KAAK,kCAAkC,GAAG;IACxC,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAOD,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAClD,UAAU,EAAE,UAAU,GACrB,kCAAkC,CAkFpC"}
1
+ {"version":3,"file":"useOpenCuratorButton.d.ts","sourceRoot":"","sources":["../../../../../src/features/entity/metadata-task/hooks/useOpenCuratorButton.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,UAAU,EACX,MAAM,kCAAkC,CAAA;AAazC,KAAK,kCAAkC,GAAG;IACxC,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAOD,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAClD,UAAU,EAAE,UAAU,GACrB,kCAAkC,CA+FpC"}
@@ -8,40 +8,49 @@ import { instanceOfGridSupportedTaskProperties as a } from "../utils/types.js";
8
8
  import { getGridSourceIdForTask as o } from "../utils/getGridSourceIdForTask.js";
9
9
  import s from "./useGridSessionForCurationTask.js";
10
10
  import c from "./useGridSessionForCurationTask_legacy.js";
11
- import { useCallback as l } from "react";
12
- import { SynapseClientError as u } from "@sage-bionetworks/synapse-client";
11
+ import l from "./useMarkCurationTaskInProgress.js";
12
+ import { useCallback as u } from "react";
13
+ import { SynapseClientError as d } from "@sage-bionetworks/synapse-client";
13
14
  //#region src/features/entity/metadata-task/hooks/useOpenCuratorButton.ts
14
- function d(e, t) {
15
+ function f(e, t) {
15
16
  let r = n(e, t);
16
17
  window.open(r, "_blank", "noopener");
17
18
  }
18
- function f(n) {
19
- let f = n.task, p = f.taskProperties;
20
- if (!a(p)) throw Error(`Task properties are not supported for GridSession creation: ${p?.concreteType}`);
21
- let m = (p != null && "suggestedAuthorizationMode" in p ? p.suggestedAuthorizationMode : void 0) != null, { mutateAsync: h, isPending: g } = c(), { mutateAsync: _, isPending: v } = s(), { data: y, isLoading: b } = t(o(p)), x = y?.canView, S = l(async () => {
19
+ function p(n) {
20
+ let p = n.task, m = p.taskProperties;
21
+ if (!a(m)) throw Error(`Task properties are not supported for GridSession creation: ${m?.concreteType}`);
22
+ let h = (m != null && "suggestedAuthorizationMode" in m ? m.suggestedAuthorizationMode : void 0) != null, { mutateAsync: g, isPending: _ } = c(), { mutateAsync: v, isPending: y } = s(), { mutateAsync: b } = l(), { data: x, isLoading: S } = t(o(m)), C = x?.canView, w = u(async () => {
22
23
  let t;
23
24
  try {
24
- t = m ? (await _(n)).gridSession : await h({ curationTask: f }), d(t.sessionId, f.taskId);
25
+ t = h ? (await v(n)).gridSession : await g({ curationTask: p });
25
26
  } catch (t) {
26
- t instanceof u && t.status === 403 ? (console.error(t), e(i, "danger", { title: r })) : (console.error("Error opening Curator for curation task", t), e(t instanceof Error ? t.message : String(t), "danger", { title: r }));
27
+ t instanceof d && t.status === 403 ? (console.error(t), e(i, "danger", { title: r })) : (console.error("Error opening Curator for curation task", t), e(t instanceof Error ? t.message : String(t), "danger", { title: r }));
28
+ return;
29
+ }
30
+ f(t.sessionId, p.taskId);
31
+ try {
32
+ await b(p.taskId);
33
+ } catch (e) {
34
+ console.error("Failed to mark curation task as in progress", e);
27
35
  }
28
36
  }, [
29
- f,
37
+ p,
30
38
  n,
31
- m,
32
39
  h,
33
- _
34
- ]), C = l(() => {
35
- S();
36
- }, [S]);
40
+ g,
41
+ v,
42
+ b
43
+ ]), T = u(() => {
44
+ w();
45
+ }, [w]);
37
46
  return {
38
- hasPermission: x,
39
- isLoading: b,
40
- isPending: m ? v : g,
41
- onClick: C
47
+ hasPermission: C,
48
+ isLoading: S,
49
+ isPending: h ? y : _,
50
+ onClick: T
42
51
  };
43
52
  }
44
53
  //#endregion
45
- export { f as default };
54
+ export { p as default };
46
55
 
47
56
  //# sourceMappingURL=useOpenCuratorButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useOpenCuratorButton.js","names":[],"sources":["../../../../../src/features/entity/metadata-task/hooks/useOpenCuratorButton.ts"],"sourcesContent":["import { displayToast } from '@/components'\nimport { useGetEntityPermissions } from '@/synapse-queries'\nimport {\n GridSession,\n SynapseClientError,\n TaskBundle,\n} from '@sage-bionetworks/synapse-client'\nimport { useCallback } from 'react'\nimport {\n OPEN_CURATOR_ERROR_TITLE,\n OPEN_CURATOR_UNAUTHORIZED_ERROR_MESSAGE,\n} from '../utils/constants'\nimport { getGridSourceIdForTask } from '../utils/getGridSourceIdForTask'\nimport useGridSessionForCurationTask from './useGridSessionForCurationTask'\nimport useGridSessionForCurationTask_legacy from './useGridSessionForCurationTask_legacy'\nimport { getLinkToGridSession } from '@/utils/functions/getSynapseWebClientLink'\nimport { instanceOfGridSupportedTaskProperties } from '../utils/types'\n\ntype UseOpenCuratorFromTaskButtonReturn = {\n isLoading: boolean\n isPending: boolean\n hasPermission?: boolean\n onClick: () => void\n}\n\nfunction openGridSessionInNewWindow(gridSessionId: string, taskId: number) {\n const gridUrl = getLinkToGridSession(gridSessionId, taskId)\n window.open(gridUrl, '_blank', 'noopener')\n}\n\nexport default function useOpenCuratorFromTaskButton(\n taskBundle: TaskBundle,\n): UseOpenCuratorFromTaskButtonReturn {\n const curationTask = taskBundle.task!\n\n const taskProperties = curationTask.taskProperties\n if (!instanceOfGridSupportedTaskProperties(taskProperties)) {\n throw new Error(\n `Task properties are not supported for GridSession creation: ${taskProperties?.concreteType}`,\n )\n }\n\n const suggestedAuthorizationMode =\n taskProperties != null && 'suggestedAuthorizationMode' in taskProperties\n ? taskProperties.suggestedAuthorizationMode\n : undefined\n\n const useTaskLinkedSession = suggestedAuthorizationMode != null\n\n const {\n mutateAsync: getOrCreateLegacyGridSessionForUnassignedTask,\n isPending: legacyOpenGridIsPending,\n } = useGridSessionForCurationTask_legacy()\n\n const {\n mutateAsync: getOrCreateTaskLinkedGridSession,\n isPending: taskLinkedOpenGridIsPending,\n } = useGridSessionForCurationTask()\n\n const gridSourceEntityId = getGridSourceIdForTask(taskProperties)\n const {\n data: sourceEntityPermissions,\n isLoading: isLoadingEntityPermissions,\n } = useGetEntityPermissions(gridSourceEntityId)\n\n const hasPermission = sourceEntityPermissions?.canView\n\n const openNewOrExistingCuratorSession = useCallback(async () => {\n let gridSession: GridSession\n try {\n if (useTaskLinkedSession) {\n const result = await getOrCreateTaskLinkedGridSession(taskBundle)\n gridSession = result.gridSession\n } else {\n gridSession = await getOrCreateLegacyGridSessionForUnassignedTask({\n curationTask,\n })\n }\n openGridSessionInNewWindow(gridSession.sessionId!, curationTask.taskId!)\n } catch (error) {\n if (error instanceof SynapseClientError && error.status === 403) {\n console.error(error)\n displayToast(OPEN_CURATOR_UNAUTHORIZED_ERROR_MESSAGE, 'danger', {\n title: OPEN_CURATOR_ERROR_TITLE,\n })\n } else {\n console.error('Error opening Curator for curation task', error)\n const errorMessage =\n error instanceof Error ? error.message : String(error)\n displayToast(errorMessage, 'danger', {\n title: OPEN_CURATOR_ERROR_TITLE,\n })\n }\n }\n }, [\n curationTask,\n taskBundle,\n useTaskLinkedSession,\n getOrCreateLegacyGridSessionForUnassignedTask,\n getOrCreateTaskLinkedGridSession,\n ])\n\n const handleClickOpenCurator = useCallback(() => {\n void openNewOrExistingCuratorSession()\n }, [openNewOrExistingCuratorSession])\n\n return {\n hasPermission,\n isLoading: isLoadingEntityPermissions,\n isPending: useTaskLinkedSession\n ? taskLinkedOpenGridIsPending\n : legacyOpenGridIsPending,\n onClick: handleClickOpenCurator,\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAyBA,SAAS,EAA2B,GAAuB,GAAgB;CACzE,IAAM,IAAU,EAAqB,GAAe,CAAM;CAC1D,OAAO,KAAK,GAAS,UAAU,UAAU;AAC3C;AAEA,SAAwB,EACtB,GACoC;CACpC,IAAM,IAAe,EAAW,MAE1B,IAAiB,EAAa;CACpC,IAAI,CAAC,EAAsC,CAAc,GACvD,MAAU,MACR,+DAA+D,GAAgB,cACjF;CAQF,IAAM,KAJJ,KAAkB,QAAQ,gCAAgC,IACtD,EAAe,6BACf,KAAA,MAEqD,MAErD,EACJ,aAAa,GACb,WAAW,MACT,EAAqC,GAEnC,EACJ,aAAa,GACb,WAAW,MACT,EAA8B,GAG5B,EACJ,MAAM,GACN,WAAW,MACT,EAJuB,EAAuB,CAItB,CAAkB,GAExC,IAAgB,GAAyB,SAEzC,IAAkC,EAAY,YAAY;EAC9D,IAAI;EACJ,IAAI;GASF,AARA,AAIE,IAJE,KAEY,MADO,EAAiC,CAAU,GAC3C,cAEP,MAAM,EAA8C,EAChE,gBACF,CAAC,GAEH,EAA2B,EAAY,WAAY,EAAa,MAAO;EACzE,SAAS,GAAO;GACd,AAAI,aAAiB,KAAsB,EAAM,WAAW,OAC1D,QAAQ,MAAM,CAAK,GACnB,EAAa,GAAyC,UAAU,EAC9D,OAAO,EACT,CAAC,MAED,QAAQ,MAAM,2CAA2C,CAAK,GAG9D,EADE,aAAiB,QAAQ,EAAM,UAAU,OAAO,CAAK,GAC5B,UAAU,EACnC,OAAO,EACT,CAAC;EAEL;CACF,GAAG;EACD;EACA;EACA;EACA;EACA;CACF,CAAC,GAEK,IAAyB,QAAkB;EAC/C,EAAqC;CACvC,GAAG,CAAC,CAA+B,CAAC;CAEpC,OAAO;EACL;EACA,WAAW;EACX,WAAW,IACP,IACA;EACJ,SAAS;CACX;AACF"}
1
+ {"version":3,"file":"useOpenCuratorButton.js","names":[],"sources":["../../../../../src/features/entity/metadata-task/hooks/useOpenCuratorButton.ts"],"sourcesContent":["import { displayToast } from '@/components'\nimport { useGetEntityPermissions } from '@/synapse-queries'\nimport {\n GridSession,\n SynapseClientError,\n TaskBundle,\n} from '@sage-bionetworks/synapse-client'\nimport { useCallback } from 'react'\nimport {\n OPEN_CURATOR_ERROR_TITLE,\n OPEN_CURATOR_UNAUTHORIZED_ERROR_MESSAGE,\n} from '../utils/constants'\nimport { getGridSourceIdForTask } from '../utils/getGridSourceIdForTask'\nimport useGridSessionForCurationTask from './useGridSessionForCurationTask'\nimport useGridSessionForCurationTask_legacy from './useGridSessionForCurationTask_legacy'\nimport useMarkCurationTaskInProgress from './useMarkCurationTaskInProgress'\nimport { getLinkToGridSession } from '@/utils/functions/getSynapseWebClientLink'\nimport { instanceOfGridSupportedTaskProperties } from '../utils/types'\n\ntype UseOpenCuratorFromTaskButtonReturn = {\n isLoading: boolean\n isPending: boolean\n hasPermission?: boolean\n onClick: () => void\n}\n\nfunction openGridSessionInNewWindow(gridSessionId: string, taskId: number) {\n const gridUrl = getLinkToGridSession(gridSessionId, taskId)\n window.open(gridUrl, '_blank', 'noopener')\n}\n\nexport default function useOpenCuratorFromTaskButton(\n taskBundle: TaskBundle,\n): UseOpenCuratorFromTaskButtonReturn {\n const curationTask = taskBundle.task!\n\n const taskProperties = curationTask.taskProperties\n if (!instanceOfGridSupportedTaskProperties(taskProperties)) {\n throw new Error(\n `Task properties are not supported for GridSession creation: ${taskProperties?.concreteType}`,\n )\n }\n\n const suggestedAuthorizationMode =\n taskProperties != null && 'suggestedAuthorizationMode' in taskProperties\n ? taskProperties.suggestedAuthorizationMode\n : undefined\n\n const useTaskLinkedSession = suggestedAuthorizationMode != null\n\n const {\n mutateAsync: getOrCreateLegacyGridSessionForUnassignedTask,\n isPending: legacyOpenGridIsPending,\n } = useGridSessionForCurationTask_legacy()\n\n const {\n mutateAsync: getOrCreateTaskLinkedGridSession,\n isPending: taskLinkedOpenGridIsPending,\n } = useGridSessionForCurationTask()\n\n const { mutateAsync: markTaskInProgress } = useMarkCurationTaskInProgress()\n\n const gridSourceEntityId = getGridSourceIdForTask(taskProperties)\n const {\n data: sourceEntityPermissions,\n isLoading: isLoadingEntityPermissions,\n } = useGetEntityPermissions(gridSourceEntityId)\n\n const hasPermission = sourceEntityPermissions?.canView\n\n const openNewOrExistingCuratorSession = useCallback(async () => {\n let gridSession: GridSession\n try {\n if (useTaskLinkedSession) {\n const result = await getOrCreateTaskLinkedGridSession(taskBundle)\n gridSession = result.gridSession\n } else {\n gridSession = await getOrCreateLegacyGridSessionForUnassignedTask({\n curationTask,\n })\n }\n } catch (error) {\n if (error instanceof SynapseClientError && error.status === 403) {\n console.error(error)\n displayToast(OPEN_CURATOR_UNAUTHORIZED_ERROR_MESSAGE, 'danger', {\n title: OPEN_CURATOR_ERROR_TITLE,\n })\n } else {\n console.error('Error opening Curator for curation task', error)\n const errorMessage =\n error instanceof Error ? error.message : String(error)\n displayToast(errorMessage, 'danger', {\n title: OPEN_CURATOR_ERROR_TITLE,\n })\n }\n return\n }\n\n openGridSessionInNewWindow(gridSession.sessionId!, curationTask.taskId!)\n\n // Recording that work has begun is bookkeeping that follows the window opening, so it must not\n // delay the popup, hold the button in a pending state, or surface as a failure to open Curator.\n try {\n await markTaskInProgress(curationTask.taskId!)\n } catch (error) {\n console.error('Failed to mark curation task as in progress', error)\n }\n }, [\n curationTask,\n taskBundle,\n useTaskLinkedSession,\n getOrCreateLegacyGridSessionForUnassignedTask,\n getOrCreateTaskLinkedGridSession,\n markTaskInProgress,\n ])\n\n const handleClickOpenCurator = useCallback(() => {\n void openNewOrExistingCuratorSession()\n }, [openNewOrExistingCuratorSession])\n\n return {\n hasPermission,\n isLoading: isLoadingEntityPermissions,\n isPending: useTaskLinkedSession\n ? taskLinkedOpenGridIsPending\n : legacyOpenGridIsPending,\n onClick: handleClickOpenCurator,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,SAAS,EAA2B,GAAuB,GAAgB;CACzE,IAAM,IAAU,EAAqB,GAAe,CAAM;CAC1D,OAAO,KAAK,GAAS,UAAU,UAAU;AAC3C;AAEA,SAAwB,EACtB,GACoC;CACpC,IAAM,IAAe,EAAW,MAE1B,IAAiB,EAAa;CACpC,IAAI,CAAC,EAAsC,CAAc,GACvD,MAAU,MACR,+DAA+D,GAAgB,cACjF;CAQF,IAAM,KAJJ,KAAkB,QAAQ,gCAAgC,IACtD,EAAe,6BACf,KAAA,MAEqD,MAErD,EACJ,aAAa,GACb,WAAW,MACT,EAAqC,GAEnC,EACJ,aAAa,GACb,WAAW,MACT,EAA8B,GAE5B,EAAE,aAAa,MAAuB,EAA8B,GAGpE,EACJ,MAAM,GACN,WAAW,MACT,EAJuB,EAAuB,CAItB,CAAkB,GAExC,IAAgB,GAAyB,SAEzC,IAAkC,EAAY,YAAY;EAC9D,IAAI;EACJ,IAAI;GACF,AAIE,IAJE,KAEY,MADO,EAAiC,CAAU,GAC3C,cAEP,MAAM,EAA8C,EAChE,gBACF,CAAC;EAEL,SAAS,GAAO;GACd,AAAI,aAAiB,KAAsB,EAAM,WAAW,OAC1D,QAAQ,MAAM,CAAK,GACnB,EAAa,GAAyC,UAAU,EAC9D,OAAO,EACT,CAAC,MAED,QAAQ,MAAM,2CAA2C,CAAK,GAG9D,EADE,aAAiB,QAAQ,EAAM,UAAU,OAAO,CAAK,GAC5B,UAAU,EACnC,OAAO,EACT,CAAC;GAEH;EACF;EAEA,EAA2B,EAAY,WAAY,EAAa,MAAO;EAIvE,IAAI;GACF,MAAM,EAAmB,EAAa,MAAO;EAC/C,SAAS,GAAO;GACd,QAAQ,MAAM,+CAA+C,CAAK;EACpE;CACF,GAAG;EACD;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,GAEK,IAAyB,QAAkB;EAC/C,EAAqC;CACvC,GAAG,CAAC,CAA+B,CAAC;CAEpC,OAAO;EACL;EACA,WAAW;EACX,WAAW,IACP,IACA;EACJ,SAAS;CACX;AACF"}
@@ -0,0 +1,16 @@
1
+ import { FormTemplate } from '@sage-bionetworks/synapse-client';
2
+ /**
3
+ * Renders the a Data Access schema as a 2-step form:
4
+ * Research Use → Agreements
5
+ */
6
+ export declare const mockGenomicsTemplate: FormTemplate;
7
+ /**
8
+ * Renders the Data Access schema as a 2-step form:
9
+ * Project Details → Compliance.
10
+ *
11
+ * Demonstrates a file-upload field with a downloadable template, and a
12
+ * RENEWAL_ONLY field.
13
+ */
14
+ export declare const mockClinicalTemplate: FormTemplate;
15
+ export declare const mockFormTemplates: FormTemplate[];
16
+ //# sourceMappingURL=mockFormTemplates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockFormTemplates.d.ts","sourceRoot":"","sources":["../../../src/mocks/accessRequirement/mockFormTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEb,MAAM,kCAAkC,CAAA;AAIzC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,YAqClC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,YA2ClC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,YAAY,EAG3C,CAAA"}
@@ -0,0 +1,70 @@
1
+ import { MOCK_FILE_HANDLE_ID as e } from "../mock_file_handle.js";
2
+ import { mockClinicalSchema as t, mockGenomicsSchema as n } from "./mockJsonSchemas.js";
3
+ import { FormTemplateFieldSubmissionContextEnum as r } from "@sage-bionetworks/synapse-client";
4
+ //#region src/mocks/accessRequirement/mockFormTemplates.ts
5
+ var i = {
6
+ id: "template-1",
7
+ name: "Genomics DAR",
8
+ etag: "etag-template-1",
9
+ versionNumber: 1,
10
+ schema$id: n.$id,
11
+ steps: [{
12
+ title: "Research Use",
13
+ description: "Describe your research project and how you intend to use the data.",
14
+ fields: [{
15
+ schemaPath: "/intendedDataUse",
16
+ uiDefinition: {
17
+ "ui:widget": "textarea",
18
+ "ui:options": { rows: 5 }
19
+ },
20
+ submissionContext: r.ALWAYS,
21
+ isPublic: !0
22
+ }]
23
+ }, {
24
+ title: "Agreements",
25
+ description: "Review and agree to the terms and conditions for accessing this data.",
26
+ fields: [{
27
+ schemaPath: "/agreeToTerms",
28
+ uiDefinition: {},
29
+ submissionContext: r.ALWAYS
30
+ }]
31
+ }],
32
+ deprecated: !1
33
+ }, a = {
34
+ id: "template-2",
35
+ name: "Clinical Trial DAR",
36
+ etag: "etag-template-2",
37
+ versionNumber: 1,
38
+ schema$id: t.$id,
39
+ steps: [{
40
+ title: "Project Details",
41
+ fields: [{
42
+ schemaPath: "/projectTitle",
43
+ uiDefinition: {},
44
+ submissionContext: r.ALWAYS,
45
+ isPublic: !0
46
+ }, {
47
+ schemaPath: "/dataUsePurpose",
48
+ uiDefinition: {},
49
+ submissionContext: r.ALWAYS
50
+ }]
51
+ }, {
52
+ title: "Compliance",
53
+ description: "Provide any required compliance documentation.",
54
+ fields: [{
55
+ schemaPath: "/irbApprovalNumber",
56
+ uiDefinition: {},
57
+ submissionContext: r.RENEWAL_ONLY
58
+ }, {
59
+ schemaPath: "/signedDataUseAgreement",
60
+ uiDefinition: {},
61
+ submissionContext: r.ALWAYS,
62
+ templateFileHandleId: e
63
+ }]
64
+ }],
65
+ deprecated: !1
66
+ }, o = [i, a];
67
+ //#endregion
68
+ export { a as mockClinicalTemplate, o as mockFormTemplates, i as mockGenomicsTemplate };
69
+
70
+ //# sourceMappingURL=mockFormTemplates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockFormTemplates.js","names":[],"sources":["../../../src/mocks/accessRequirement/mockFormTemplates.ts"],"sourcesContent":["import {\n FormTemplate,\n FormTemplateFieldSubmissionContextEnum,\n} from '@sage-bionetworks/synapse-client'\nimport { MOCK_FILE_HANDLE_ID } from '@/mocks/mock_file_handle'\nimport { mockClinicalSchema, mockGenomicsSchema } from './mockJsonSchemas'\n\n/**\n * Renders the a Data Access schema as a 2-step form:\n * Research Use → Agreements\n */\nexport const mockGenomicsTemplate: FormTemplate = {\n id: 'template-1',\n name: 'Genomics DAR',\n etag: 'etag-template-1',\n versionNumber: 1,\n schema$id: mockGenomicsSchema.$id as string,\n steps: [\n {\n title: 'Research Use',\n description:\n 'Describe your research project and how you intend to use the data.',\n fields: [\n {\n schemaPath: '/intendedDataUse',\n uiDefinition: {\n 'ui:widget': 'textarea',\n 'ui:options': { rows: 5 },\n },\n submissionContext: FormTemplateFieldSubmissionContextEnum.ALWAYS,\n isPublic: true,\n },\n ],\n },\n {\n title: 'Agreements',\n description:\n 'Review and agree to the terms and conditions for accessing this data.',\n fields: [\n {\n schemaPath: '/agreeToTerms',\n uiDefinition: {},\n submissionContext: FormTemplateFieldSubmissionContextEnum.ALWAYS,\n },\n ],\n },\n ],\n deprecated: false,\n}\n\n/**\n * Renders the Data Access schema as a 2-step form:\n * Project Details → Compliance.\n *\n * Demonstrates a file-upload field with a downloadable template, and a\n * RENEWAL_ONLY field.\n */\nexport const mockClinicalTemplate: FormTemplate = {\n id: 'template-2',\n name: 'Clinical Trial DAR',\n etag: 'etag-template-2',\n versionNumber: 1,\n schema$id: mockClinicalSchema.$id as string,\n steps: [\n {\n title: 'Project Details',\n fields: [\n {\n schemaPath: '/projectTitle',\n uiDefinition: {},\n submissionContext: FormTemplateFieldSubmissionContextEnum.ALWAYS,\n isPublic: true,\n },\n {\n schemaPath: '/dataUsePurpose',\n uiDefinition: {},\n submissionContext: FormTemplateFieldSubmissionContextEnum.ALWAYS,\n },\n ],\n },\n {\n title: 'Compliance',\n description: 'Provide any required compliance documentation.',\n fields: [\n {\n schemaPath: '/irbApprovalNumber',\n uiDefinition: {},\n submissionContext:\n FormTemplateFieldSubmissionContextEnum.RENEWAL_ONLY,\n },\n {\n schemaPath: '/signedDataUseAgreement',\n uiDefinition: {},\n submissionContext: FormTemplateFieldSubmissionContextEnum.ALWAYS,\n templateFileHandleId: MOCK_FILE_HANDLE_ID,\n },\n ],\n },\n ],\n deprecated: false,\n}\n\nexport const mockFormTemplates: FormTemplate[] = [\n mockGenomicsTemplate,\n mockClinicalTemplate,\n]\n"],"mappings":";;;;AAWA,IAAa,IAAqC;CAChD,IAAI;CACJ,MAAM;CACN,MAAM;CACN,eAAe;CACf,WAAW,EAAmB;CAC9B,OAAO,CACL;EACE,OAAO;EACP,aACE;EACF,QAAQ,CACN;GACE,YAAY;GACZ,cAAc;IACZ,aAAa;IACb,cAAc,EAAE,MAAM,EAAE;GAC1B;GACA,mBAAmB,EAAuC;GAC1D,UAAU;EACZ,CACF;CACF,GACA;EACE,OAAO;EACP,aACE;EACF,QAAQ,CACN;GACE,YAAY;GACZ,cAAc,CAAC;GACf,mBAAmB,EAAuC;EAC5D,CACF;CACF,CACF;CACA,YAAY;AACd,GASa,IAAqC;CAChD,IAAI;CACJ,MAAM;CACN,MAAM;CACN,eAAe;CACf,WAAW,EAAmB;CAC9B,OAAO,CACL;EACE,OAAO;EACP,QAAQ,CACN;GACE,YAAY;GACZ,cAAc,CAAC;GACf,mBAAmB,EAAuC;GAC1D,UAAU;EACZ,GACA;GACE,YAAY;GACZ,cAAc,CAAC;GACf,mBAAmB,EAAuC;EAC5D,CACF;CACF,GACA;EACE,OAAO;EACP,aAAa;EACb,QAAQ,CACN;GACE,YAAY;GACZ,cAAc,CAAC;GACf,mBACE,EAAuC;EAC3C,GACA;GACE,YAAY;GACZ,cAAc,CAAC;GACf,mBAAmB,EAAuC;GAC1D,sBAAsB;EACxB,CACF;CACF,CACF;CACA,YAAY;AACd,GAEa,IAAoC,CAC/C,GACA,CACF"}
@@ -0,0 +1,7 @@
1
+ import { JsonSchemaAccessRequirement } from '@sage-bionetworks/synapse-client';
2
+ /** AR 1: Genomics Data Access — references the Genomics FormTemplate. No DUC required. */
3
+ export declare const mockJsonSchemaAR1: JsonSchemaAccessRequirement;
4
+ /** AR 2: Clinical Trial Data Access — references the Clinical Trial FormTemplate. Requires an uploaded DUC. */
5
+ export declare const mockJsonSchemaAR2: JsonSchemaAccessRequirement;
6
+ export declare const mockJsonSchemaAccessRequirements: JsonSchemaAccessRequirement[];
7
+ //# sourceMappingURL=mockJsonSchemaAccessRequirements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockJsonSchemaAccessRequirements.d.ts","sourceRoot":"","sources":["../../../src/mocks/accessRequirement/mockJsonSchemaAccessRequirements.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAE5B,MAAM,kCAAkC,CAAA;AAMzC,0FAA0F;AAC1F,eAAO,MAAM,iBAAiB,EAAE,2BAiB/B,CAAA;AAED,+GAA+G;AAC/G,eAAO,MAAM,iBAAiB,EAAE,2BAkB/B,CAAA;AAED,eAAO,MAAM,gCAAgC,EAAE,2BAA2B,EAGzE,CAAA"}
@@ -0,0 +1,47 @@
1
+ import { MOCK_DUC_TEMPLATE_FILE_HANDLE_ID as e } from "../mock_file_handle.js";
2
+ import { JsonSchemaAccessRequirementConcreteTypeEnum as t } from "@sage-bionetworks/synapse-client";
3
+ //#region src/mocks/accessRequirement/mockJsonSchemaAccessRequirements.ts
4
+ var n = (/* @__PURE__ */ new Date()).toISOString(), r = "1234567", i = {
5
+ id: 9e3,
6
+ name: "Genomics Data Access",
7
+ etag: "etag-ar-9000",
8
+ versionNumber: 1,
9
+ createdOn: n,
10
+ modifiedOn: n,
11
+ createdBy: r,
12
+ modifiedBy: r,
13
+ concreteType: t.org_sagebionetworks_repo_model_JsonSchemaAccessRequirement,
14
+ formTemplateRef: {
15
+ templateId: "template-1",
16
+ templateVersionNumber: 1
17
+ },
18
+ expirationPeriod: 31536e6,
19
+ isCertifiedUserRequired: !0,
20
+ isValidatedProfileRequired: !1,
21
+ isTwoFaRequired: !1,
22
+ isDUCRequired: !1
23
+ }, a = {
24
+ id: 9001,
25
+ name: "Clinical Trial Data Access",
26
+ etag: "etag-ar-9001",
27
+ versionNumber: 1,
28
+ createdOn: n,
29
+ modifiedOn: n,
30
+ createdBy: r,
31
+ modifiedBy: r,
32
+ concreteType: t.org_sagebionetworks_repo_model_JsonSchemaAccessRequirement,
33
+ formTemplateRef: {
34
+ templateId: "template-2",
35
+ templateVersionNumber: 1
36
+ },
37
+ expirationPeriod: 15768e6,
38
+ isCertifiedUserRequired: !0,
39
+ isValidatedProfileRequired: !0,
40
+ isTwoFaRequired: !0,
41
+ isDUCRequired: !0,
42
+ ducTemplateFileHandleId: e
43
+ }, o = [i, a];
44
+ //#endregion
45
+ export { i as mockJsonSchemaAR1, a as mockJsonSchemaAR2, o as mockJsonSchemaAccessRequirements };
46
+
47
+ //# sourceMappingURL=mockJsonSchemaAccessRequirements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockJsonSchemaAccessRequirements.js","names":[],"sources":["../../../src/mocks/accessRequirement/mockJsonSchemaAccessRequirements.ts"],"sourcesContent":["import {\n JsonSchemaAccessRequirement,\n JsonSchemaAccessRequirementConcreteTypeEnum,\n} from '@sage-bionetworks/synapse-client'\nimport { MOCK_DUC_TEMPLATE_FILE_HANDLE_ID } from '@/mocks/mock_file_handle'\n\nconst now = new Date().toISOString()\nconst actUserId = '1234567'\n\n/** AR 1: Genomics Data Access — references the Genomics FormTemplate. No DUC required. */\nexport const mockJsonSchemaAR1: JsonSchemaAccessRequirement = {\n id: 9000,\n name: 'Genomics Data Access',\n etag: 'etag-ar-9000',\n versionNumber: 1,\n createdOn: now,\n modifiedOn: now,\n createdBy: actUserId,\n modifiedBy: actUserId,\n concreteType:\n JsonSchemaAccessRequirementConcreteTypeEnum.org_sagebionetworks_repo_model_JsonSchemaAccessRequirement,\n formTemplateRef: { templateId: 'template-1', templateVersionNumber: 1 },\n expirationPeriod: 31536000000, // 1 year\n isCertifiedUserRequired: true,\n isValidatedProfileRequired: false,\n isTwoFaRequired: false,\n isDUCRequired: false,\n}\n\n/** AR 2: Clinical Trial Data Access — references the Clinical Trial FormTemplate. Requires an uploaded DUC. */\nexport const mockJsonSchemaAR2: JsonSchemaAccessRequirement = {\n id: 9001,\n name: 'Clinical Trial Data Access',\n etag: 'etag-ar-9001',\n versionNumber: 1,\n createdOn: now,\n modifiedOn: now,\n createdBy: actUserId,\n modifiedBy: actUserId,\n concreteType:\n JsonSchemaAccessRequirementConcreteTypeEnum.org_sagebionetworks_repo_model_JsonSchemaAccessRequirement,\n formTemplateRef: { templateId: 'template-2', templateVersionNumber: 1 },\n expirationPeriod: 15768000000, // 6 months\n isCertifiedUserRequired: true,\n isValidatedProfileRequired: true,\n isTwoFaRequired: true,\n isDUCRequired: true,\n ducTemplateFileHandleId: MOCK_DUC_TEMPLATE_FILE_HANDLE_ID,\n}\n\nexport const mockJsonSchemaAccessRequirements: JsonSchemaAccessRequirement[] = [\n mockJsonSchemaAR1,\n mockJsonSchemaAR2,\n]\n"],"mappings":";;;AAMA,IAAM,qBAAM,IAAI,KAAK,GAAE,YAAY,GAC7B,IAAY,WAGL,IAAiD;CAC5D,IAAI;CACJ,MAAM;CACN,MAAM;CACN,eAAe;CACf,WAAW;CACX,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,cACE,EAA4C;CAC9C,iBAAiB;EAAE,YAAY;EAAc,uBAAuB;CAAE;CACtE,kBAAkB;CAClB,yBAAyB;CACzB,4BAA4B;CAC5B,iBAAiB;CACjB,eAAe;AACjB,GAGa,IAAiD;CAC5D,IAAI;CACJ,MAAM;CACN,MAAM;CACN,eAAe;CACf,WAAW;CACX,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,cACE,EAA4C;CAC9C,iBAAiB;EAAE,YAAY;EAAc,uBAAuB;CAAE;CACtE,kBAAkB;CAClB,yBAAyB;CACzB,4BAA4B;CAC5B,iBAAiB;CACjB,eAAe;CACf,yBAAyB;AAC3B,GAEa,IAAkE,CAC7E,GACA,CACF"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Mock JSON Schema registry for the JSON Schema-based Access Requirements demo.
3
+ *
4
+ * Each FormTemplate pins a registered JSON Schema by `$id`. The schema is the
5
+ * data contract — it owns property types, validation rules, and which properties
6
+ * are required.
7
+ *
8
+ * The FormTemplateEditor lets ACT edit the schema body alongside the template in
9
+ * a single UI; saving is conceptually a write to both the schema registry and
10
+ * the template service.
11
+ */
12
+ import { RJSFSchema } from '@rjsf/utils';
13
+ /** Genomics DAR data contract — all fields required. */
14
+ export declare const mockGenomicsSchema: RJSFSchema;
15
+ /** Clinical Trial DAR data contract — includes a file upload. */
16
+ export declare const mockClinicalSchema: RJSFSchema;
17
+ /**
18
+ * Map from `$id` (with version) to the JSON Schema body. In the real system
19
+ * this is served by the registered JSON Schema service.
20
+ */
21
+ export declare const mockJsonSchemaRegistry: Record<string, RJSFSchema>;
22
+ /** Look up a registered JSON Schema body by its `$id`. */
23
+ export declare function getMockJsonSchemaById(schema$id: string): RJSFSchema | undefined;
24
+ //# sourceMappingURL=mockJsonSchemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockJsonSchemas.d.ts","sourceRoot":"","sources":["../../../src/mocks/accessRequirement/mockJsonSchemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,EAAE,UAmBhC,CAAA;AAED,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,EAAE,UA+BhC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAG7D,CAAA;AAED,0DAA0D;AAC1D,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,GAChB,UAAU,GAAG,SAAS,CAExB"}