@corva/ui 3.76.0-0 → 3.76.0-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/useScrollOverflow.js +2 -0
- package/cjs-bundle/components/AttachmentPreview/useScrollOverflow.js.map +1 -0
- package/cjs-bundle/components/Comment/index.js +1 -1
- package/cjs-bundle/components/Comment/index.js.map +1 -1
- package/cjs-bundle/components/Comment/useComment.js +2 -0
- package/cjs-bundle/components/Comment/useComment.js.map +1 -0
- package/cjs-bundle/components/CommentCard/CommentCard.scss.js +1 -1
- package/cjs-bundle/components/CommentInput/index.js +1 -1
- package/cjs-bundle/components/CommentInput/index.js.map +1 -1
- package/cjs-bundle/components/CommentInput/useCommentInput.js +2 -0
- package/cjs-bundle/components/CommentInput/useCommentInput.js.map +1 -0
- package/cjs-bundle/components/CommentInputNext/CommentInputNext.scss.js +1 -1
- package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
- package/cjs-bundle/components/FeedCard/FeedCard.scss.js +1 -1
- package/cjs-bundle/components/FileUploadIconButton.js +1 -1
- package/cjs-bundle/components/FileUploadIconButton.js.map +1 -1
- package/cjs-bundle/components/useFileUploadIconButton.js +2 -0
- package/cjs-bundle/components/useFileUploadIconButton.js.map +1 -0
- package/cjs-bundle/componentsV2/AppCommonsProvider/AppCommonsContext.js.map +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.constants.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.constants.js.map +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js.map +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js.map +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
- package/components/AttachmentPreview/AttachmentPreview.d.ts +1 -0
- package/components/AttachmentPreview/AttachmentPreview.d.ts.map +1 -1
- package/components/AttachmentPreview/AttachmentPreview.js +1 -1
- package/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
- package/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
- package/components/AttachmentPreview/__tests__/AttachmentPreview.overflow.test.d.ts +2 -0
- package/components/AttachmentPreview/__tests__/AttachmentPreview.overflow.test.d.ts.map +1 -0
- package/components/AttachmentPreview/useScrollOverflow.d.ts +16 -0
- package/components/AttachmentPreview/useScrollOverflow.d.ts.map +1 -0
- package/components/AttachmentPreview/useScrollOverflow.js +2 -0
- package/components/AttachmentPreview/useScrollOverflow.js.map +1 -0
- package/components/Comment/__tests__/useComment.test.d.ts +2 -0
- package/components/Comment/__tests__/useComment.test.d.ts.map +1 -0
- package/components/Comment/index.d.ts +2 -22
- package/components/Comment/index.js +1 -1
- package/components/Comment/index.js.map +1 -1
- package/components/Comment/useComment.d.ts +22 -0
- package/components/Comment/useComment.d.ts.map +1 -0
- package/components/Comment/useComment.js +2 -0
- package/components/Comment/useComment.js.map +1 -0
- package/components/CommentCard/CommentCard.scss.js +1 -1
- package/components/CommentInput/__tests__/useCommentInput.test.d.ts +2 -0
- package/components/CommentInput/__tests__/useCommentInput.test.d.ts.map +1 -0
- package/components/CommentInput/index.d.ts +26 -24
- package/components/CommentInput/index.js +1 -1
- package/components/CommentInput/index.js.map +1 -1
- package/components/CommentInput/useCommentInput.d.ts +26 -0
- package/components/CommentInput/useCommentInput.d.ts.map +1 -0
- package/components/CommentInput/useCommentInput.js +2 -0
- package/components/CommentInput/useCommentInput.js.map +1 -0
- package/components/CommentInputNext/CommentInputNext.scss.js +1 -1
- package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts +2 -9
- package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts.map +1 -1
- package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
- package/components/FeedCard/FeedCard.scss.js +1 -1
- package/components/FileUploadIconButton.d.ts +4 -60
- package/components/FileUploadIconButton.d.ts.map +1 -1
- package/components/FileUploadIconButton.js +1 -1
- package/components/FileUploadIconButton.js.map +1 -1
- package/components/__tests__/useFileUploadIconButton.test.d.ts +2 -0
- package/components/__tests__/useFileUploadIconButton.test.d.ts.map +1 -0
- package/components/useFileUploadIconButton.d.ts +15 -0
- package/components/useFileUploadIconButton.d.ts.map +1 -0
- package/components/useFileUploadIconButton.js +2 -0
- package/components/useFileUploadIconButton.js.map +1 -0
- package/componentsV2/AppCommonsProvider/AppCommonsContext.d.ts +19 -6
- package/componentsV2/AppCommonsProvider/AppCommonsContext.d.ts.map +1 -1
- package/componentsV2/AppCommonsProvider/AppCommonsContext.js.map +1 -1
- package/componentsV2/AppHeader/V3/Actions/Actions.constants.d.ts +1 -0
- package/componentsV2/AppHeader/V3/Actions/Actions.constants.d.ts.map +1 -1
- package/componentsV2/AppHeader/V3/Actions/Actions.constants.js +1 -1
- package/componentsV2/AppHeader/V3/Actions/Actions.constants.js.map +1 -1
- package/componentsV2/AppHeader/V3/Actions/Actions.d.ts.map +1 -1
- package/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
- package/componentsV2/AppHeader/V3/Actions/Actions.js.map +1 -1
- package/componentsV2/AppHeader/V3/AppHeaderV3.d.ts.map +1 -1
- package/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
- package/componentsV2/AppHeader/V3/AppHeaderV3.js.map +1 -1
- package/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
- package/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
- package/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
- package/componentsV2/AppHeader/__tests__/AppHeaderEmbedded.test.d.ts +2 -0
- package/componentsV2/AppHeader/__tests__/AppHeaderEmbedded.test.d.ts.map +1 -0
- package/mcp-server/server.mjs +7 -3
- package/package.json +1 -1
- package/styles/common.scss +14 -0
- package/styles/mixins.scss +14 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevCenterAppContainer.js","sources":["../../../../src/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.tsx"],"sourcesContent":["import { useContext, useMemo, useState } from 'react';\nimport type { ComponentType, FC } from 'react';\nimport classNames from 'classnames';\nimport { noop, pick, pickBy } from 'lodash';\nimport { useTheme } from '@material-ui/core';\n\nimport AppContext from '../AppContext';\nimport { DevCenterRouterContext } from '../DevCenterRouterContext';\n\nimport {\n useAnnotationsData,\n useAnnotationsList,\n useAppMaximized,\n useAppSettings,\n useDevCenterAppProps,\n} from './effects';\nimport { DcFullscreenElemsCoordinatorProvider } from './components/DcFullscreenElemsCoordinatorProvider';\nimport { DevCenterAppDialogs } from './components/DevCenterAppDialogs';\nimport DevCenterAppView from './components/DevCenterAppView';\nimport { LegacyAppActions } from './components/LegacyAppActions';\nimport RestoreAppSizeButton from './components/RestoreAppSizeButton';\nimport { getAppAvailability, getAppVersion } from './utils';\nimport {\n APP_DATA_ASSET_KEYS,\n HOME_PATH_PREFIX,\n MOBILE_CLI_APP_GRID_WIDTH,\n PAGE_NAME,\n} from './constants';\nimport type {\n AppCoordinates,\n AppDataEntry,\n ChatActions,\n DashboardAppLastAnnotation,\n DevCenterAppResource,\n DevCenterCurrentUser,\n DevCenterMenuItem,\n DevCenterRouter,\n LayoutEnvironment,\n RegisterAITools,\n SetIsFullscreenModalMode,\n UpdateDashboardAppLastAnnotation,\n} from './types';\nimport type { FullscreenModes } from '../../../types';\n// Relative on purpose: a `~/` alias does not resolve from the published `.d.ts`.\nimport type { GlobalOffsetWell } from '../../../componentsV2/AppCommonsProvider/AppCommonsContext';\nimport { CommentsSwitchProvider } from './components/CommentsSwitch';\n\nimport styles from './DevCenterAppContainer.scss';\n\nimport { isInsideNewMobileApp, isMobileDetected, isNativeDetected } from '~/utils/mobileDetect';\nimport { ToastContainer } from '~/components/Toaster';\nimport { useDevCenterApp } from '~/effects';\nimport { DEV_CENTER_CLI_APP_ID } from '~/constants';\nimport {\n getAppName,\n getAppSegment,\n getTimestampFromQuery,\n isDCAppMultiRig,\n} from '~/utils/devcenter';\nimport { AppCommonsProvider } from '~/componentsV2/AppCommonsProvider';\n\n/**\n * `Partial<FullscreenModes>` carries the seven browser-fullscreen and separate-window members.\n * `AppCommonsProvider` derives `isExpanded` from them and republishes them to the app bundle,\n * so dropping them silently disables both features — and nothing type-checks it, because every\n * member is optional on the provider.\n */\nexport type DevCenterAppContainerProps = Partial<FullscreenModes> & {\n app: DevCenterAppResource;\n currentUser: DevCenterCurrentUser;\n /** Platform router. Not React Router — the DC shell supplies its own. */\n devCenterRouter: DevCenterRouter;\n\n /**\n * Slots for the CLI app bundle's own components. `any` rather than a narrower prop type on\n * purpose: this accepts arbitrary app components, and any narrowing would reject the concretely\n * typed ones consumers pass.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- see the note above\n CLIAppComponent?: ComponentType<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- see the note above\n CLIAppSettings?: ComponentType<any> | null;\n /** Defaults to `app.id` when omitted. */\n appId?: number;\n className?: string | null;\n chatActions?: ChatActions | null;\n coordinates?: AppCoordinates | null;\n currentDashboardAppsLastAnnotations?: DashboardAppLastAnnotation[] | null;\n dashboardMeta?: {\n isMultiAsset?: boolean;\n isMultiWell?: boolean;\n isChiplessDashboard?: boolean;\n globalOffsetWells?: GlobalOffsetWell[];\n globalOffsetWellsVersion?: number;\n globalOffsetWellsToken?: number;\n };\n disableAppAssetSelection?: boolean;\n isActionsDisabled?: boolean;\n /**\n * [REACT-18-MIGRATION-TAG] PLT-3099: the platform's isolation decision, passed only by the\n * in-process branch of DevCenterIsolatedApp; iframe mounts leave it false.\n */\n isNonIsolatedApp?: boolean;\n isSettingsDialogHidden?: boolean;\n layoutEnvironment?: LayoutEnvironment | null;\n onAppContainerClick?: () => void;\n onAppRemove?: () => void;\n onCloneDashboard?: () => void;\n onHelpCenterClick?: () => void;\n onIsMaximizedChange?: (isMaximized: boolean) => void;\n onReportBugClick?: (() => void) | null;\n onSettingChange?: (key: string, value: unknown) => void;\n onSettingsChange?: (value: unknown) => void;\n openIntercom?: () => void;\n registerAITools?: RegisterAITools;\n reloadApp?: () => void;\n setIsFullscreenModalMode?: SetIsFullscreenModalMode;\n timestamp?: number | null;\n updateCurrentDashboardAppLastAnnotation?: UpdateDashboardAppLastAnnotation;\n};\n\nconst isHomePage = (router: DevCenterRouter) =>\n !!router.location.pathname?.startsWith(HOME_PATH_PREFIX);\n\nconst DevCenterAppContainer: FC<DevCenterAppContainerProps> = ({\n CLIAppComponent,\n CLIAppSettings,\n app,\n appId,\n className,\n coordinates,\n currentDashboardAppsLastAnnotations,\n currentUser,\n devCenterRouter,\n disableAppAssetSelection,\n isActionsDisabled,\n isBrowserFullscreen,\n enterBrowserFullscreen,\n exitBrowserFullscreen,\n isSeparateWindow,\n openSeparateWindow,\n closeSeparateWindow,\n setSeparateWindowTitle,\n isNonIsolatedApp = false,\n isSettingsDialogHidden,\n layoutEnvironment,\n onAppContainerClick = noop,\n onAppRemove,\n onReportBugClick,\n onCloneDashboard,\n onHelpCenterClick,\n onIsMaximizedChange,\n onSettingChange = noop,\n onSettingsChange = noop,\n openIntercom = noop,\n registerAITools,\n setIsFullscreenModalMode = noop,\n timestamp,\n updateCurrentDashboardAppLastAnnotation,\n dashboardMeta,\n reloadApp,\n chatActions,\n}) => {\n // `AppContext` is still JavaScript and calls `createContext()` with no argument, so it hands\n // back `undefined`. Declared here rather than asserted; the real fix is a type argument on the\n // context itself, which belongs to `DevCenter/AppContext`.\n const appsData: Record<string, AppDataEntry> | undefined = useContext(AppContext);\n const theme = useTheme();\n const isMobileView = isNativeDetected || isMobileDetected;\n const [mainMenuItems, setMainMenuItems] = useState<DevCenterMenuItem[]>([]);\n const [secondaryMenuItems, setSecondaryMenuItems] = useState<DevCenterMenuItem[]>([]);\n // `||`, not `??`: DevCenterEmbeddedApp uses 0 as its unset sentinel for appId.\n const appDataKey = appId || app.id;\n const appData: AppDataEntry = (appDataKey ? appsData?.[appDataKey] : undefined) ?? {\n isLoading: true,\n };\n const application = app.package?.manifest?.application;\n const segment = getAppSegment(app);\n const isChiplessDashboard = !!dashboardMeta?.isChiplessDashboard;\n const isMultiRig = isDCAppMultiRig({\n uiSettings: application?.ui,\n isChiplessDashboard,\n });\n const isCommentsEnabled = !!application?.ui?.enable_comments;\n const appName = getAppName(app);\n const { isMaximized, setIsMaximized } = useAppMaximized({\n onIsMaximizedChange,\n devCenterRouter,\n appId,\n });\n\n // Isolated apps are mounted without the router query the timestamp normally comes from,\n // so the host passes it as a prop instead.\n const appTimestamp = timestamp || getTimestampFromQuery(devCenterRouter.location.query?.query);\n const isCLIApp = app.id === DEV_CENTER_CLI_APP_ID;\n // Memoised because the CLI-on-mobile branch builds a new object: unmemoised it would be a fresh\n // reference on every render and would keep `useDevCenterAppProps` from ever holding its memo.\n const updatedCoordinates = useMemo(\n () =>\n isCLIApp && isMobileView ? { ...coordinates, w: MOBILE_CLI_APP_GRID_WIDTH } : coordinates,\n [isCLIApp, isMobileView, coordinates]\n );\n const version = getAppVersion(app);\n\n const {\n isLoading: isAppLoading,\n AppSettings,\n AppComponent,\n } = useDevCenterApp({\n CLIAppComponent,\n CLIAppSettings,\n app,\n version,\n });\n\n const { isAppSettingsDialogOpened, toggleAppSettingsDialog } = useAppSettings({\n setIsFullscreenModalMode,\n });\n const { isAnnotationsListOpened, toggleAnnotationsList } = useAnnotationsList();\n\n const isLoading = !!(isAppLoading || !currentUser || (!isMultiRig && appData.isLoading));\n\n const {\n appLastAnnotation,\n assetCompanyId,\n assetIdForAnnotation,\n isAppSupportsAnnotations: isAnnotationsSupported,\n } = useAnnotationsData({\n app,\n appData,\n currentDashboardAppsLastAnnotations,\n });\n\n const filteredAppData = useMemo(\n () => pickBy(pick(appData, APP_DATA_ASSET_KEYS), Boolean),\n [appData]\n );\n\n const simplifiedSecondaryMenuItems = useMemo(\n () =>\n secondaryMenuItems.map(item => ({\n ...item,\n onClick: () => {\n item.onClick?.();\n if (item.to) {\n devCenterRouter.push(item.to);\n }\n },\n })),\n [secondaryMenuItems, devCenterRouter]\n );\n\n const isAppHeadersV3Enabled = !!application?.ui?.use_app_header_v3;\n const isInsideHomePage = isHomePage(devCenterRouter);\n\n const appProps = useDevCenterAppProps({\n app,\n appLastAnnotation,\n appTimestamp,\n chatActions,\n coordinates: updatedCoordinates,\n currentUser,\n devCenterRouter,\n filteredAppData,\n isMaximized,\n layoutEnvironment,\n onSettingChange,\n onSettingsChange,\n registerAITools,\n segment,\n setIsFullscreenModalMode,\n setIsMaximized,\n setMainMenuItems,\n setSecondaryMenuItems,\n toggleAnnotationsList,\n toggleAppSettingsDialog,\n updateCurrentDashboardAppLastAnnotation,\n });\n\n // Called without the native event: this crosses an iframe boundary, where a DOM event\n // cannot be serialised.\n const handleAppContainerClick = () => onAppContainerClick();\n\n // ⚠️⚠️⚠️ When adding/changing providers, also add them to/change /src/testing/AppTestWrapper\n return (\n <DevCenterRouterContext.Provider value={devCenterRouter}>\n <DcFullscreenElemsCoordinatorProvider setIsFullscreenModalMode={setIsFullscreenModalMode}>\n <AppCommonsProvider\n maximized={isMaximized}\n setMaximized={setIsMaximized}\n appId={app.app.id}\n app={app}\n appSettings={app.settings}\n onSettingChange={onSettingChange}\n onSettingsChange={onSettingsChange}\n appHeadersV3Enabled={isAppHeadersV3Enabled}\n isBrowserFullscreen={isBrowserFullscreen}\n enterBrowserFullscreen={enterBrowserFullscreen}\n exitBrowserFullscreen={exitBrowserFullscreen}\n isSeparateWindow={isSeparateWindow}\n openSeparateWindow={openSeparateWindow}\n closeSeparateWindow={closeSeparateWindow}\n setSeparateWindowTitle={setSeparateWindowTitle}\n isNonIsolatedApp={isNonIsolatedApp}\n disableAppAssetSelection={disableAppAssetSelection}\n isMultiRig={isMultiRig}\n currentUser={currentUser}\n appData={appData}\n layoutEnvironment={layoutEnvironment}\n appSettingsComponent={AppSettings}\n dashboardMeta={dashboardMeta}\n toggleAnnotationsList={isAnnotationsSupported ? toggleAnnotationsList : undefined}\n onHelpCenterClick={onHelpCenterClick}\n secondaryMenuItems={simplifiedSecondaryMenuItems}\n onAppRemove={onAppRemove}\n isInsideNewMobileApp={isInsideNewMobileApp}\n globalOffsetWells={dashboardMeta?.globalOffsetWells}\n globalOffsetWellsVersion={dashboardMeta?.globalOffsetWellsVersion}\n globalOffsetWellsToken={dashboardMeta?.globalOffsetWellsToken}\n reloadApp={reloadApp}\n {...filteredAppData}\n >\n <CommentsSwitchProvider>\n <article\n className={classNames(\n 'dc-app-container',\n isInsideNewMobileApp && 'dc-app-container--inside-new-mobile-app',\n isInsideHomePage && 'dc-app-container--inside-home-page',\n className,\n // This class is applied so that DC apps developers can style their content\n // when an app is in fullscreen\n isMaximized && 'dc-app-container__maximized',\n theme.isLightTheme && 'dc-app-container__light-theme',\n styles.container\n )}\n data-testid={`${PAGE_NAME}_${appName}`}\n onClick={handleAppContainerClick}\n >\n <ToastContainer />\n <div className={styles.containerContent}>\n <DevCenterAppView\n // DC apps keep per-asset state in mount-time hooks, so a new asset means a\n // new mount. React 18 batching collapses away the `isLoading` frame this used\n // to rely on whenever AppsDataProvider serves the asset from its cache.\n key={appData.appHash}\n AppComponent={AppComponent}\n app={app}\n appData={filteredAppData}\n availability={getAppAvailability(\n app.availability,\n currentUser.company.with_subscription\n )}\n isCLIApp={isCLIApp}\n isLoading={isLoading}\n isMultiRig={isMultiRig}\n layoutEnvironment={layoutEnvironment ?? null}\n openIntercom={openIntercom}\n segment={segment}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n appProps={appProps}\n />\n </div>\n <DevCenterAppDialogs\n app={app}\n appData={appData}\n appName={appName}\n appSettingsComponent={AppSettings}\n assetCompanyId={assetCompanyId}\n assetIdForAnnotation={assetIdForAnnotation}\n currentUser={currentUser}\n disableAppAssetSelection={disableAppAssetSelection}\n isAnnotationsListOpened={isAnnotationsListOpened}\n isAppSettingsDialogOpened={isAppSettingsDialogOpened}\n isMultiRig={isMultiRig}\n isSettingsDialogHidden={isSettingsDialogHidden}\n layoutEnvironment={layoutEnvironment}\n onAppRemove={onAppRemove}\n onCloneDashboard={onCloneDashboard}\n onSettingsChange={onSettingsChange}\n openIntercom={openIntercom}\n toggleAnnotationsList={toggleAnnotationsList}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n />\n {isMaximized && !isAppHeadersV3Enabled && (\n <RestoreAppSizeButton setIsMaximized={setIsMaximized} />\n )}\n\n {!isActionsDisabled && (!isAppHeadersV3Enabled || isLoading) && (\n <LegacyAppActions\n app={app}\n currentUser={currentUser}\n devCenterRouter={devCenterRouter}\n isAnnotationsSupported={isAnnotationsSupported}\n isCLIApp={isCLIApp}\n isCommentsEnabled={isCommentsEnabled}\n isInsideNewMobileApp={isInsideNewMobileApp}\n isMaximized={isMaximized}\n isMobileView={isMobileView}\n mainMenuItems={mainMenuItems}\n secondaryMenuItems={secondaryMenuItems}\n onHelpCenterClick={onHelpCenterClick}\n onReportBugClick={onReportBugClick}\n setIsFullscreenModalMode={setIsFullscreenModalMode}\n setIsMaximized={setIsMaximized}\n toggleAnnotationsList={toggleAnnotationsList}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n />\n )}\n </article>\n </CommentsSwitchProvider>\n </AppCommonsProvider>\n </DcFullscreenElemsCoordinatorProvider>\n </DevCenterRouterContext.Provider>\n );\n};\n\nexport default DevCenterAppContainer;\n"],"names":["DevCenterAppContainer","_ref","_ref2","_app$package","_app$package$manifest","_application$ui","_devCenterRouter$loca","_application$ui2","_router$location$path","CLIAppComponent","CLIAppSettings","app","appId","className","coordinates","currentDashboardAppsLastAnnotations","currentUser","devCenterRouter","disableAppAssetSelection","isActionsDisabled","isBrowserFullscreen","enterBrowserFullscreen","exitBrowserFullscreen","isSeparateWindow","openSeparateWindow","closeSeparateWindow","setSeparateWindowTitle","_ref$isNonIsolatedApp","isNonIsolatedApp","isSettingsDialogHidden","layoutEnvironment","_ref$onAppContainerCl","onAppContainerClick","noop","onAppRemove","onReportBugClick","onCloneDashboard","onHelpCenterClick","onIsMaximizedChange","_ref$onSettingChange","onSettingChange","_ref$onSettingsChange","onSettingsChange","_ref$openIntercom","openIntercom","registerAITools","_ref$setIsFullscreenM","setIsFullscreenModalMode","timestamp","updateCurrentDashboardAppLastAnnotation","dashboardMeta","reloadApp","chatActions","appsData","useContext","AppContext","theme","useTheme","isMobileView","isNativeDetected","isMobileDetected","useState","_useState2","_slicedToArray","_useState","mainMenuItems","setMainMenuItems","_useState4","_useState3","secondaryMenuItems","setSecondaryMenuItems","appDataKey","id","appData","undefined","isLoading","application","package","manifest","segment","getAppSegment","isChiplessDashboard","isMultiRig","isDCAppMultiRig","uiSettings","ui","isCommentsEnabled","enable_comments","appName","getAppName","_useAppMaximized","useAppMaximized","isMaximized","setIsMaximized","appTimestamp","getTimestampFromQuery","location","query","isCLIApp","DEV_CENTER_CLI_APP_ID","updatedCoordinates","useMemo","_objectSpread","w","MOBILE_CLI_APP_GRID_WIDTH","version","getAppVersion","_useDevCenterApp","useDevCenterApp","isAppLoading","AppSettings","AppComponent","_useAppSettings","useAppSettings","isAppSettingsDialogOpened","toggleAppSettingsDialog","_useAnnotationsList","useAnnotationsList","isAnnotationsListOpened","toggleAnnotationsList","_useAnnotationsData","useAnnotationsData","appLastAnnotation","assetCompanyId","assetIdForAnnotation","isAnnotationsSupported","isAppSupportsAnnotations","filteredAppData","pickBy","pick","APP_DATA_ASSET_KEYS","Boolean","simplifiedSecondaryMenuItems","map","item","onClick","_item$onClick","call","to","push","isAppHeadersV3Enabled","use_app_header_v3","isInsideHomePage","pathname","startsWith","HOME_PATH_PREFIX","appProps","useDevCenterAppProps","_jsx","DevCenterRouterContext","Provider","value","children","DcFullscreenElemsCoordinatorProvider","AppCommonsProvider","maximized","setMaximized","appSettings","settings","appHeadersV3Enabled","appSettingsComponent","isInsideNewMobileApp","globalOffsetWells","globalOffsetWellsVersion","globalOffsetWellsToken","CommentsSwitchProvider","_jsxs","classNames","isLightTheme","styles","container","PAGE_NAME","ToastContainer","containerContent","DevCenterAppView","availability","getAppAvailability","company","with_subscription","appHash","DevCenterAppDialogs","RestoreAppSizeButton","LegacyAppActions"],"mappings":"yogBAyHA,IAGMA,EAAwD,SAsCxDC,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAzCqCC,EAIzCC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,IACAC,KAAAA,MACAC,KAAAA,UACAC,KAAAA,YACAC,KAAAA,oCACAC,KAAAA,YACAC,KAAAA,gBACAC,KAAAA,yBACAC,KAAAA,kBACAC,KAAAA,oBACAC,KAAAA,uBACAC,KAAAA,sBACAC,KAAAA,iBACAC,KAAAA,mBACAC,KAAAA,oBACAC,KAAAA,uBAAsBC,GAAA1B,EACtB2B,iBAAAA,gBAAwBD,GACxBE,KAAAA,uBACAC,KAAAA,kBAAiBC,GAAA9B,EACjB+B,oBAAAA,eAAsBC,EAAIF,GAC1BG,KAAAA,YACAC,KAAAA,iBACAC,KAAAA,iBACAC,KAAAA,kBACAC,KAAAA,oBAAmBC,GAAAtC,EACnBuC,gBAAAA,eAAkBP,EAAIM,GAAAE,GAAAxC,EACtByC,iBAAAA,eAAmBT,EAAIQ,GAAAE,GAAA1C,EACvB2C,aAAAA,eAAeX,EAAIU,GACnBE,KAAAA,gBAAeC,GAAA7C,EACf8C,yBAAAA,eAA2Bd,EAAIa,GAC/BE,KAAAA,UACAC,KAAAA,wCACA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AKA,EACL8D,QAASsD,GACTgD,aAAcC,EACZrK,EAAIoK,aACJ/J,GAAYiK,QAAQC,mBAEtBhF,SAAUA,GACVvB,UAAWA,GACXO,WAAYA,GACZpD,kBAAmBA,SAAAA,GAAqB,KACxCc,aAAcA,GACdmC,QAASA,GACToC,wBAAyBA,GACzB+B,SAAUA,IAfLzE,GAAQ0G,WAkBjB/B,EAACgC,EAAmB,CAClBzK,IAAKA,EACL8D,QAASA,GACTe,QAASA,GACTwE,qBAAsBlD,GACtBa,eAAgBA,GAChBC,qBAAsBA,GACtB5G,YAAaA,GACbE,yBAA0BA,GAC1BoG,wBAAyBA,GACzBJ,0BAA2BA,GAC3BhC,WAAYA,GACZrD,uBAAwBA,GACxBC,kBAAmBA,GACnBI,YAAaA,GACbE,iBAAkBA,GAClBM,iBAAkBA,GAClBE,aAAcA,GACd2E,sBAAuBA,GACvBJ,wBAAyBA,KAE1BvB,KAAgBgD,IACfQ,EAACiC,EAAoB,CAACxF,eAAgBA,MAGtC1E,MAAuByH,IAAyBjE,KAChDyE,EAACkC,EAAgB,CACf3K,IAAKA,EACLK,YAAaA,GACbC,gBAAiBA,GACjB4G,uBAAwBA,GACxB3B,SAAUA,GACVZ,kBAAmBA,GACnB2E,qBAAsBA,EACtBrE,YAAaA,GACblC,aAAcA,GACdO,cAAeA,GACfI,mBAAoBA,GACpBhC,kBAAmBA,GACnBF,iBAAkBA,GAClBY,yBAA0BA,GAC1B8C,eAAgBA,GAChB0B,sBAAuBA,GACvBJ,wBAAyBA,gBAS3C"}
|
|
1
|
+
{"version":3,"file":"DevCenterAppContainer.js","sources":["../../../../src/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.tsx"],"sourcesContent":["import { useContext, useMemo, useState } from 'react';\nimport type { ComponentType, FC } from 'react';\nimport classNames from 'classnames';\nimport { noop, pick, pickBy } from 'lodash';\nimport { useTheme } from '@material-ui/core';\n\nimport AppContext from '../AppContext';\nimport { DevCenterRouterContext } from '../DevCenterRouterContext';\n\nimport {\n useAnnotationsData,\n useAnnotationsList,\n useAppMaximized,\n useAppSettings,\n useDevCenterAppProps,\n} from './effects';\nimport { DcFullscreenElemsCoordinatorProvider } from './components/DcFullscreenElemsCoordinatorProvider';\nimport { DevCenterAppDialogs } from './components/DevCenterAppDialogs';\nimport DevCenterAppView from './components/DevCenterAppView';\nimport { LegacyAppActions } from './components/LegacyAppActions';\nimport RestoreAppSizeButton from './components/RestoreAppSizeButton';\nimport { getAppAvailability, getAppVersion } from './utils';\nimport {\n APP_DATA_ASSET_KEYS,\n HOME_PATH_PREFIX,\n MOBILE_CLI_APP_GRID_WIDTH,\n PAGE_NAME,\n} from './constants';\nimport type {\n AppCoordinates,\n AppDataEntry,\n ChatActions,\n DashboardAppLastAnnotation,\n DevCenterAppResource,\n DevCenterCurrentUser,\n DevCenterMenuItem,\n DevCenterRouter,\n LayoutEnvironment,\n RegisterAITools,\n SetIsFullscreenModalMode,\n UpdateDashboardAppLastAnnotation,\n} from './types';\nimport type { FullscreenModes } from '../../../types';\n// Relative on purpose: a `~/` alias does not resolve from the published `.d.ts`.\nimport type { AppDashboardMeta } from '../../../componentsV2/AppCommonsProvider/AppCommonsContext';\nimport { CommentsSwitchProvider } from './components/CommentsSwitch';\n\nimport styles from './DevCenterAppContainer.scss';\n\nimport { isInsideNewMobileApp, isMobileDetected, isNativeDetected } from '~/utils/mobileDetect';\nimport { ToastContainer } from '~/components/Toaster';\nimport { useDevCenterApp } from '~/effects';\nimport { DEV_CENTER_CLI_APP_ID } from '~/constants';\nimport {\n getAppName,\n getAppSegment,\n getTimestampFromQuery,\n isDCAppMultiRig,\n} from '~/utils/devcenter';\nimport { AppCommonsProvider } from '~/componentsV2/AppCommonsProvider';\n\n/**\n * `Partial<FullscreenModes>` carries the seven browser-fullscreen and separate-window members.\n * `AppCommonsProvider` derives `isExpanded` from them and republishes them to the app bundle,\n * so dropping them silently disables both features — and nothing type-checks it, because every\n * member is optional on the provider.\n */\nexport type DevCenterAppContainerProps = Partial<FullscreenModes> & {\n app: DevCenterAppResource;\n currentUser: DevCenterCurrentUser;\n /** Platform router. Not React Router — the DC shell supplies its own. */\n devCenterRouter: DevCenterRouter;\n\n /**\n * Slots for the CLI app bundle's own components. `any` rather than a narrower prop type on\n * purpose: this accepts arbitrary app components, and any narrowing would reject the concretely\n * typed ones consumers pass.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- see the note above\n CLIAppComponent?: ComponentType<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- see the note above\n CLIAppSettings?: ComponentType<any> | null;\n /** Defaults to `app.id` when omitted. */\n appId?: number;\n className?: string | null;\n chatActions?: ChatActions | null;\n coordinates?: AppCoordinates | null;\n currentDashboardAppsLastAnnotations?: DashboardAppLastAnnotation[] | null;\n dashboardMeta?: AppDashboardMeta;\n disableAppAssetSelection?: boolean;\n isActionsDisabled?: boolean;\n /**\n * [REACT-18-MIGRATION-TAG] PLT-3099: the platform's isolation decision, passed only by the\n * in-process branch of DevCenterIsolatedApp; iframe mounts leave it false.\n */\n isNonIsolatedApp?: boolean;\n isSettingsDialogHidden?: boolean;\n layoutEnvironment?: LayoutEnvironment | null;\n onAppContainerClick?: () => void;\n onAppRemove?: () => void;\n onCloneDashboard?: () => void;\n onHelpCenterClick?: () => void;\n onIsMaximizedChange?: (isMaximized: boolean) => void;\n onReportBugClick?: (() => void) | null;\n onSettingChange?: (key: string, value: unknown) => void;\n onSettingsChange?: (value: unknown) => void;\n openIntercom?: () => void;\n registerAITools?: RegisterAITools;\n reloadApp?: () => void;\n setIsFullscreenModalMode?: SetIsFullscreenModalMode;\n timestamp?: number | null;\n updateCurrentDashboardAppLastAnnotation?: UpdateDashboardAppLastAnnotation;\n};\n\nconst isHomePage = (router: DevCenterRouter) =>\n !!router.location.pathname?.startsWith(HOME_PATH_PREFIX);\n\nconst DevCenterAppContainer: FC<DevCenterAppContainerProps> = ({\n CLIAppComponent,\n CLIAppSettings,\n app,\n appId,\n className,\n coordinates,\n currentDashboardAppsLastAnnotations,\n currentUser,\n devCenterRouter,\n disableAppAssetSelection,\n isActionsDisabled,\n isBrowserFullscreen,\n enterBrowserFullscreen,\n exitBrowserFullscreen,\n isSeparateWindow,\n openSeparateWindow,\n closeSeparateWindow,\n setSeparateWindowTitle,\n isNonIsolatedApp = false,\n isSettingsDialogHidden,\n layoutEnvironment,\n onAppContainerClick = noop,\n onAppRemove,\n onReportBugClick,\n onCloneDashboard,\n onHelpCenterClick,\n onIsMaximizedChange,\n onSettingChange = noop,\n onSettingsChange = noop,\n openIntercom = noop,\n registerAITools,\n setIsFullscreenModalMode = noop,\n timestamp,\n updateCurrentDashboardAppLastAnnotation,\n dashboardMeta,\n reloadApp,\n chatActions,\n}) => {\n // `AppContext` is still JavaScript and calls `createContext()` with no argument, so it hands\n // back `undefined`. Declared here rather than asserted; the real fix is a type argument on the\n // context itself, which belongs to `DevCenter/AppContext`.\n const appsData: Record<string, AppDataEntry> | undefined = useContext(AppContext);\n const theme = useTheme();\n const isMobileView = isNativeDetected || isMobileDetected;\n const [mainMenuItems, setMainMenuItems] = useState<DevCenterMenuItem[]>([]);\n const [secondaryMenuItems, setSecondaryMenuItems] = useState<DevCenterMenuItem[]>([]);\n // `||`, not `??`: DevCenterEmbeddedApp uses 0 as its unset sentinel for appId.\n const appDataKey = appId || app.id;\n const appData: AppDataEntry = (appDataKey ? appsData?.[appDataKey] : undefined) ?? {\n isLoading: true,\n };\n const application = app.package?.manifest?.application;\n const segment = getAppSegment(app);\n const isChiplessDashboard = !!dashboardMeta?.isChiplessDashboard;\n const isMultiRig = isDCAppMultiRig({\n uiSettings: application?.ui,\n isChiplessDashboard,\n });\n const isCommentsEnabled = !!application?.ui?.enable_comments;\n const appName = getAppName(app);\n const { isMaximized, setIsMaximized } = useAppMaximized({\n onIsMaximizedChange,\n devCenterRouter,\n appId,\n });\n\n // Isolated apps are mounted without the router query the timestamp normally comes from,\n // so the host passes it as a prop instead.\n const appTimestamp = timestamp || getTimestampFromQuery(devCenterRouter.location.query?.query);\n const isCLIApp = app.id === DEV_CENTER_CLI_APP_ID;\n // Memoised because the CLI-on-mobile branch builds a new object: unmemoised it would be a fresh\n // reference on every render and would keep `useDevCenterAppProps` from ever holding its memo.\n const updatedCoordinates = useMemo(\n () =>\n isCLIApp && isMobileView ? { ...coordinates, w: MOBILE_CLI_APP_GRID_WIDTH } : coordinates,\n [isCLIApp, isMobileView, coordinates]\n );\n const version = getAppVersion(app);\n\n const {\n isLoading: isAppLoading,\n AppSettings,\n AppComponent,\n } = useDevCenterApp({\n CLIAppComponent,\n CLIAppSettings,\n app,\n version,\n });\n\n const { isAppSettingsDialogOpened, toggleAppSettingsDialog } = useAppSettings({\n setIsFullscreenModalMode,\n });\n const { isAnnotationsListOpened, toggleAnnotationsList } = useAnnotationsList();\n\n const isLoading = !!(isAppLoading || !currentUser || (!isMultiRig && appData.isLoading));\n\n const {\n appLastAnnotation,\n assetCompanyId,\n assetIdForAnnotation,\n isAppSupportsAnnotations: isAnnotationsSupported,\n } = useAnnotationsData({\n app,\n appData,\n currentDashboardAppsLastAnnotations,\n });\n\n const filteredAppData = useMemo(\n () => pickBy(pick(appData, APP_DATA_ASSET_KEYS), Boolean),\n [appData]\n );\n\n const simplifiedSecondaryMenuItems = useMemo(\n () =>\n secondaryMenuItems.map(item => ({\n ...item,\n onClick: () => {\n item.onClick?.();\n if (item.to) {\n devCenterRouter.push(item.to);\n }\n },\n })),\n [secondaryMenuItems, devCenterRouter]\n );\n\n const isAppHeadersV3Enabled = !!application?.ui?.use_app_header_v3;\n const isInsideHomePage = isHomePage(devCenterRouter);\n\n const appProps = useDevCenterAppProps({\n app,\n appLastAnnotation,\n appTimestamp,\n chatActions,\n coordinates: updatedCoordinates,\n currentUser,\n devCenterRouter,\n filteredAppData,\n isMaximized,\n layoutEnvironment,\n onSettingChange,\n onSettingsChange,\n registerAITools,\n segment,\n setIsFullscreenModalMode,\n setIsMaximized,\n setMainMenuItems,\n setSecondaryMenuItems,\n toggleAnnotationsList,\n toggleAppSettingsDialog,\n updateCurrentDashboardAppLastAnnotation,\n });\n\n // Called without the native event: this crosses an iframe boundary, where a DOM event\n // cannot be serialised.\n const handleAppContainerClick = () => onAppContainerClick();\n\n // ⚠️⚠️⚠️ When adding/changing providers, also add them to/change /src/testing/AppTestWrapper\n return (\n <DevCenterRouterContext.Provider value={devCenterRouter}>\n <DcFullscreenElemsCoordinatorProvider setIsFullscreenModalMode={setIsFullscreenModalMode}>\n <AppCommonsProvider\n maximized={isMaximized}\n setMaximized={setIsMaximized}\n appId={app.app.id}\n app={app}\n appSettings={app.settings}\n onSettingChange={onSettingChange}\n onSettingsChange={onSettingsChange}\n appHeadersV3Enabled={isAppHeadersV3Enabled}\n isBrowserFullscreen={isBrowserFullscreen}\n enterBrowserFullscreen={enterBrowserFullscreen}\n exitBrowserFullscreen={exitBrowserFullscreen}\n isSeparateWindow={isSeparateWindow}\n openSeparateWindow={openSeparateWindow}\n closeSeparateWindow={closeSeparateWindow}\n setSeparateWindowTitle={setSeparateWindowTitle}\n isNonIsolatedApp={isNonIsolatedApp}\n disableAppAssetSelection={disableAppAssetSelection}\n isMultiRig={isMultiRig}\n currentUser={currentUser}\n appData={appData}\n layoutEnvironment={layoutEnvironment}\n appSettingsComponent={AppSettings}\n dashboardMeta={dashboardMeta}\n toggleAnnotationsList={isAnnotationsSupported ? toggleAnnotationsList : undefined}\n onHelpCenterClick={onHelpCenterClick}\n secondaryMenuItems={simplifiedSecondaryMenuItems}\n onAppRemove={onAppRemove}\n isInsideNewMobileApp={isInsideNewMobileApp}\n globalOffsetWells={dashboardMeta?.globalOffsetWells}\n globalOffsetWellsVersion={dashboardMeta?.globalOffsetWellsVersion}\n globalOffsetWellsToken={dashboardMeta?.globalOffsetWellsToken}\n reloadApp={reloadApp}\n {...filteredAppData}\n >\n <CommentsSwitchProvider>\n <article\n className={classNames(\n 'dc-app-container',\n isInsideNewMobileApp && 'dc-app-container--inside-new-mobile-app',\n isInsideHomePage && 'dc-app-container--inside-home-page',\n className,\n // This class is applied so that DC apps developers can style their content\n // when an app is in fullscreen\n isMaximized && 'dc-app-container__maximized',\n theme.isLightTheme && 'dc-app-container__light-theme',\n styles.container\n )}\n data-testid={`${PAGE_NAME}_${appName}`}\n onClick={handleAppContainerClick}\n >\n <ToastContainer />\n <div className={styles.containerContent}>\n <DevCenterAppView\n // DC apps keep per-asset state in mount-time hooks, so a new asset means a\n // new mount. React 18 batching collapses away the `isLoading` frame this used\n // to rely on whenever AppsDataProvider serves the asset from its cache.\n key={appData.appHash}\n AppComponent={AppComponent}\n app={app}\n appData={filteredAppData}\n availability={getAppAvailability(\n app.availability,\n currentUser.company.with_subscription\n )}\n isCLIApp={isCLIApp}\n isLoading={isLoading}\n isMultiRig={isMultiRig}\n layoutEnvironment={layoutEnvironment ?? null}\n openIntercom={openIntercom}\n segment={segment}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n appProps={appProps}\n />\n </div>\n <DevCenterAppDialogs\n app={app}\n appData={appData}\n appName={appName}\n appSettingsComponent={AppSettings}\n assetCompanyId={assetCompanyId}\n assetIdForAnnotation={assetIdForAnnotation}\n currentUser={currentUser}\n disableAppAssetSelection={disableAppAssetSelection}\n isAnnotationsListOpened={isAnnotationsListOpened}\n isAppSettingsDialogOpened={isAppSettingsDialogOpened}\n isMultiRig={isMultiRig}\n isSettingsDialogHidden={isSettingsDialogHidden}\n layoutEnvironment={layoutEnvironment}\n onAppRemove={onAppRemove}\n onCloneDashboard={onCloneDashboard}\n onSettingsChange={onSettingsChange}\n openIntercom={openIntercom}\n toggleAnnotationsList={toggleAnnotationsList}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n />\n {isMaximized && !isAppHeadersV3Enabled && (\n <RestoreAppSizeButton setIsMaximized={setIsMaximized} />\n )}\n\n {!isActionsDisabled && (!isAppHeadersV3Enabled || isLoading) && (\n <LegacyAppActions\n app={app}\n currentUser={currentUser}\n devCenterRouter={devCenterRouter}\n isAnnotationsSupported={isAnnotationsSupported}\n isCLIApp={isCLIApp}\n isCommentsEnabled={isCommentsEnabled}\n isInsideNewMobileApp={isInsideNewMobileApp}\n isMaximized={isMaximized}\n isMobileView={isMobileView}\n mainMenuItems={mainMenuItems}\n secondaryMenuItems={secondaryMenuItems}\n onHelpCenterClick={onHelpCenterClick}\n onReportBugClick={onReportBugClick}\n setIsFullscreenModalMode={setIsFullscreenModalMode}\n setIsMaximized={setIsMaximized}\n toggleAnnotationsList={toggleAnnotationsList}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n />\n )}\n </article>\n </CommentsSwitchProvider>\n </AppCommonsProvider>\n </DcFullscreenElemsCoordinatorProvider>\n </DevCenterRouterContext.Provider>\n );\n};\n\nexport default DevCenterAppContainer;\n"],"names":["DevCenterAppContainer","_ref","_ref2","_app$package","_app$package$manifest","_application$ui","_devCenterRouter$loca","_application$ui2","_router$location$path","CLIAppComponent","CLIAppSettings","app","appId","className","coordinates","currentDashboardAppsLastAnnotations","currentUser","devCenterRouter","disableAppAssetSelection","isActionsDisabled","isBrowserFullscreen","enterBrowserFullscreen","exitBrowserFullscreen","isSeparateWindow","openSeparateWindow","closeSeparateWindow","setSeparateWindowTitle","_ref$isNonIsolatedApp","isNonIsolatedApp","isSettingsDialogHidden","layoutEnvironment","_ref$onAppContainerCl","onAppContainerClick","noop","onAppRemove","onReportBugClick","onCloneDashboard","onHelpCenterClick","onIsMaximizedChange","_ref$onSettingChange","onSettingChange","_ref$onSettingsChange","onSettingsChange","_ref$openIntercom","openIntercom","registerAITools","_ref$setIsFullscreenM","setIsFullscreenModalMode","timestamp","updateCurrentDashboardAppLastAnnotation","dashboardMeta","reloadApp","chatActions","appsData","useContext","AppContext","theme","useTheme","isMobileView","isNativeDetected","isMobileDetected","useState","_useState2","_slicedToArray","_useState","mainMenuItems","setMainMenuItems","_useState4","_useState3","secondaryMenuItems","setSecondaryMenuItems","appDataKey","id","appData","undefined","isLoading","application","package","manifest","segment","getAppSegment","isChiplessDashboard","isMultiRig","isDCAppMultiRig","uiSettings","ui","isCommentsEnabled","enable_comments","appName","getAppName","_useAppMaximized","useAppMaximized","isMaximized","setIsMaximized","appTimestamp","getTimestampFromQuery","location","query","isCLIApp","DEV_CENTER_CLI_APP_ID","updatedCoordinates","useMemo","_objectSpread","w","MOBILE_CLI_APP_GRID_WIDTH","version","getAppVersion","_useDevCenterApp","useDevCenterApp","isAppLoading","AppSettings","AppComponent","_useAppSettings","useAppSettings","isAppSettingsDialogOpened","toggleAppSettingsDialog","_useAnnotationsList","useAnnotationsList","isAnnotationsListOpened","toggleAnnotationsList","_useAnnotationsData","useAnnotationsData","appLastAnnotation","assetCompanyId","assetIdForAnnotation","isAnnotationsSupported","isAppSupportsAnnotations","filteredAppData","pickBy","pick","APP_DATA_ASSET_KEYS","Boolean","simplifiedSecondaryMenuItems","map","item","onClick","_item$onClick","call","to","push","isAppHeadersV3Enabled","use_app_header_v3","isInsideHomePage","pathname","startsWith","HOME_PATH_PREFIX","appProps","useDevCenterAppProps","_jsx","DevCenterRouterContext","Provider","value","children","DcFullscreenElemsCoordinatorProvider","AppCommonsProvider","maximized","setMaximized","appSettings","settings","appHeadersV3Enabled","appSettingsComponent","isInsideNewMobileApp","globalOffsetWells","globalOffsetWellsVersion","globalOffsetWellsToken","CommentsSwitchProvider","_jsxs","classNames","isLightTheme","styles","container","PAGE_NAME","ToastContainer","containerContent","DevCenterAppView","availability","getAppAvailability","company","with_subscription","appHash","DevCenterAppDialogs","RestoreAppSizeButton","LegacyAppActions"],"mappings":"yogBAkHA,IAGMA,EAAwD,SAsCxDC,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAzCqCC,EAIzCC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,IACAC,KAAAA,MACAC,KAAAA,UACAC,KAAAA,YACAC,KAAAA,oCACAC,KAAAA,YACAC,KAAAA,gBACAC,KAAAA,yBACAC,KAAAA,kBACAC,KAAAA,oBACAC,KAAAA,uBACAC,KAAAA,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SAAUA,GACVZ,kBAAmBA,GACnB2E,qBAAsBA,EACtBrE,YAAaA,GACblC,aAAcA,GACdO,cAAeA,GACfI,mBAAoBA,GACpBhC,kBAAmBA,GACnBF,iBAAkBA,GAClBY,yBAA0BA,GAC1B8C,eAAgBA,GAChB0B,sBAAuBA,GACvBJ,wBAAyBA,gBAS3C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from'./../../ext-esm/style-inject/dist/style-inject.es.js';var
|
|
1
|
+
import r from'./../../ext-esm/style-inject/dist/style-inject.es.js';var o={spacing:"8",root:"FeedCard_root__3hrMo"};r(".FeedCard_root__3hrMo{overflow-clip-margin:12px;backdrop-filter:blur(2px);background:rgb(from var(--palette-background-b-6) r g b/.9);border-radius:16px;display:flex;flex-direction:column;overflow:hidden;overflow:clip}");export{o as default};
|
|
2
2
|
//# sourceMappingURL=FeedCard.scss.js.map
|
|
@@ -1,62 +1,6 @@
|
|
|
1
|
-
import { PureComponent } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
1
|
export declare const FILE_UPLOAD_BUTTON_DATA_ATTR = "data-file-upload-button";
|
|
4
|
-
/** @
|
|
5
|
-
declare
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
s3FileUrl: null;
|
|
9
|
-
s3FileName: null;
|
|
10
|
-
s3FileSize: null;
|
|
11
|
-
uploadingFileToS3: boolean;
|
|
12
|
-
openFileUploadPreviewDialog: boolean;
|
|
13
|
-
};
|
|
14
|
-
fileInput: import("react").RefObject<any>;
|
|
15
|
-
constructor(props: any);
|
|
16
|
-
onFinish: () => Promise<void>;
|
|
17
|
-
onError: (fileUploadingError: any) => void;
|
|
18
|
-
getSignedUrl: (file: any, callback: any) => Promise<void>;
|
|
19
|
-
preprocess: (file: any, next: any) => void;
|
|
20
|
-
uploadFile: (event: any) => void;
|
|
21
|
-
clearUpload(): void;
|
|
22
|
-
handleCloseFileUploadPreviewDialog: () => void;
|
|
23
|
-
handleShare: (comment: any, fileName: any, fileSize: any) => void;
|
|
24
|
-
renderUploadButton(): import("react").JSX.Element;
|
|
25
|
-
render(): import("react").JSX.Element;
|
|
26
|
-
}
|
|
27
|
-
declare namespace FileUploadIconButton {
|
|
28
|
-
var propTypes: {
|
|
29
|
-
additionalFields: PropTypes.Requireable<PropTypes.ReactNodeLike[]>;
|
|
30
|
-
classes: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
31
|
-
tooltipProps: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
32
|
-
disableRipple: PropTypes.Requireable<boolean>;
|
|
33
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
34
|
-
fileUploadIconClassName: PropTypes.Requireable<string>;
|
|
35
|
-
handleShare: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
|
-
inputId: PropTypes.Requireable<string>;
|
|
37
|
-
message: PropTypes.Requireable<string>;
|
|
38
|
-
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
|
-
onFinish: PropTypes.Requireable<(...args: any[]) => any>;
|
|
40
|
-
openPreviewDialogOnUpload: PropTypes.Requireable<boolean>;
|
|
41
|
-
requiredFields: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
42
|
-
};
|
|
43
|
-
var defaultProps: {
|
|
44
|
-
additionalFields: never[];
|
|
45
|
-
classes: {};
|
|
46
|
-
disableRipple: boolean;
|
|
47
|
-
disabled: boolean;
|
|
48
|
-
fileUploadIconClassName: undefined;
|
|
49
|
-
handleShare: undefined;
|
|
50
|
-
inputId: string;
|
|
51
|
-
message: undefined;
|
|
52
|
-
onError: undefined;
|
|
53
|
-
onFinish: undefined;
|
|
54
|
-
openPreviewDialogOnUpload: boolean;
|
|
55
|
-
requiredFields: never[];
|
|
56
|
-
tooltipProps: {
|
|
57
|
-
title: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
export default FileUploadIconButton;
|
|
2
|
+
/** @param {any} props Preserve the legacy component's permissive public prop type. */
|
|
3
|
+
declare function FileUploadIconButton({ additionalFields, tooltipProps, disableRipple, disabled, fileUploadIconClassName, handleShare: onShare, inputId, message, onError, onFinish, openPreviewDialogOnUpload, requiredFields, }: any): import("react").JSX.Element;
|
|
4
|
+
declare const _default: import("react").MemoExoticComponent<typeof FileUploadIconButton>;
|
|
5
|
+
export default _default;
|
|
62
6
|
//# sourceMappingURL=FileUploadIconButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploadIconButton.d.ts","sourceRoot":"","sources":["../../src/components/FileUploadIconButton.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileUploadIconButton.d.ts","sourceRoot":"","sources":["../../src/components/FileUploadIconButton.js"],"names":[],"mappings":"AAcA,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAKtE,sFAAsF;AACtF,iBAAS,oBAAoB,CAAC,EAC5B,gBAA8B,EAC9B,YAAkC,EAClC,aAAqB,EACrB,QAAgB,EAChB,uBAAuB,EACvB,WAAW,EAAE,OAAO,EACpB,OAA4B,EAC5B,OAAO,EACP,OAAO,EACP,QAAQ,EACR,yBAAgC,EAChC,cAA4B,GAC7B,EAdW,GAcX,+BAuDA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import{memo as o}from"react";import i from"prop-types";import r from"./useFileUploadIconButton.js";import t from"@material-ui/core/CircularProgress";import l from"@material-ui/icons/PhotoCamera";import a from"./PostPreviewDialog/index.js";import n from"./Icons/AttachIcon.js";import s from"./IconButton/index.js";import{isNativeDetected as p}from"../utils/mobileDetect.js";import{jsxs as d,Fragment as c,jsx as f}from"react/jsx-runtime";function u(e,o){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),i.push.apply(i,r)}return i}function m(o){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?u(Object(r),!0).forEach((function(i){e(o,i,r[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))}))}return o}var b="data-file-upload-button",h=[],g={title:"Attach File"};function P(o){var i,u,b=o.additionalFields,P=void 0===b?h:b,F=o.tooltipProps,O=void 0===F?g:F,v=o.disableRipple,y=void 0!==v&&v,j=o.disabled,w=void 0!==j&&j,U=o.fileUploadIconClassName,D=o.handleShare,S=o.inputId,I=void 0===S?"icon-button-file":S,C=o.message,E=o.onError,N=o.onFinish,x=o.openPreviewDialogOnUpload,q=void 0===x||x,z=o.requiredFields,B=void 0===z?h:z,R=r({onError:E,onFinish:N,openPreviewDialogOnUpload:q,handleShare:D}),A=R.state,T=R.fileInput,_=R.uploadFile,k=R.handleCloseFileUploadPreviewDialog,G=R.handleShare;return d(c,{children:[A.uploadingFileToS3?f(t,{"data-testid":"generic_uploadProgress",size:18}):(i=p?l:n,u=e({},"data-file-upload-button",""),d("label",m(m({htmlFor:I},u),{},{children:[f("input",{ref:T,id:I,type:"file",disabled:w,onChange:_,style:{display:"none"}}),f(s,{"data-testid":"".concat("fileUpload","_attachFileButton"),"aria-label":"File Upload",disabled:w,component:w?"button":"span",className:U,disableRipple:y,tooltipProps:O,children:f(i,{})})]}))),A.openFileUploadPreviewDialog&&f(a,{open:A.openFileUploadPreviewDialog,fileUrl:A.s3FileUrl,fileName:A.s3FileName,fileSize:A.s3FileSize,handleShare:G,handleClose:k,additionalFields:P,requiredFields:B,message:C})]})}P.propTypes={additionalFields:i.arrayOf(i.node),classes:i.shape({}),tooltipProps:i.shape({}),disableRipple:i.bool,disabled:i.bool,fileUploadIconClassName:i.string,handleShare:i.func,inputId:i.string,message:i.string,onError:i.func,onFinish:i.func,openPreviewDialogOnUpload:i.bool,requiredFields:i.arrayOf(i.string)};var F=o(P);export{b as FILE_UPLOAD_BUTTON_DATA_ATTR,F as default};
|
|
2
2
|
//# sourceMappingURL=FileUploadIconButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploadIconButton.js","sources":["../../src/components/FileUploadIconButton.js"],"sourcesContent":["import { createRef, PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport S3Upload from 'react-s3-uploader/s3upload';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport PhotoCameraIcon from '@material-ui/icons/PhotoCamera';\n\nimport PostPreviewDialog from '~components/PostPreviewDialog';\nimport AttachIcon from '~components/Icons/AttachIcon';\nimport IconButton from '~components/IconButton';\nimport { getS3SignedUrl, getS3DownloadLink } from '~/clients/jsonApi';\nimport { isNativeDetected } from '~/utils/mobileDetect';\n\nconst PAGE_NAME = 'fileUpload';\n\n// Data attr helps to identify the select file action; Is used to prevent the tooltip from closing\nexport const FILE_UPLOAD_BUTTON_DATA_ATTR = 'data-file-upload-button';\n\n/** @extends {PureComponent<any, any, any>} */\nclass FileUploadIconButton extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n currentUpload: null,\n\n s3FileUrl: null,\n s3FileName: null,\n s3FileSize: null,\n\n uploadingFileToS3: false,\n\n openFileUploadPreviewDialog: false,\n };\n\n this.fileInput = createRef();\n }\n\n onFinish = async () => {\n const s3DownloadLinkResponse = await getS3DownloadLink(this.state.s3FileName);\n this.setState(\n {\n currentUpload: null,\n uploadingFileToS3: false,\n openFileUploadPreviewDialog: this.props.openPreviewDialogOnUpload,\n s3FileUrl: s3DownloadLinkResponse.url,\n },\n () => {\n if (this.props.onFinish)\n this.props.onFinish(this.state.s3FileUrl, this.state.s3FileName, this.state.s3FileSize);\n }\n );\n };\n\n onError = fileUploadingError => {\n if (this.props.onError) this.props.onError(fileUploadingError);\n console.error(fileUploadingError);\n };\n\n getSignedUrl = async (file, callback) => {\n let data;\n try {\n data = await getS3SignedUrl(file.name, file.type);\n } catch (e) {\n this.setState(\n {\n uploadingFileToS3: null,\n currentUpload: null,\n },\n () => {\n this.onError(e.message);\n }\n );\n return;\n }\n\n this.setState({\n s3FileUrl: data.signed_url,\n s3FileName: data.file_name,\n s3FileSize: file.size,\n });\n\n // NOTE: Add node for 'signedUrl' which is the expected name by uploader component\n callback({\n ...data,\n signedUrl: data.signed_url,\n });\n };\n\n preprocess = (file, next) => {\n next(file);\n };\n\n uploadFile = event => {\n if (!event.target.files[0]) {\n return;\n }\n\n this.clearUpload();\n const uploader = new S3Upload({\n fileElement: this.fileInput.current,\n getSignedUrl: this.getSignedUrl,\n preprocess: this.preprocess,\n onProgress: () => {}, // NOTE: Prevents logging to console\n onFinishS3Put: this.onFinish,\n onError: this.onError,\n });\n\n this.setState({\n uploadingFileToS3: true,\n currentUpload: {\n uploader,\n },\n });\n };\n\n clearUpload() {\n const { currentUpload } = this.state;\n if (currentUpload && currentUpload.uploader) {\n currentUpload.uploader.abortUpload();\n }\n }\n\n handleCloseFileUploadPreviewDialog = () => {\n this.setState({ openFileUploadPreviewDialog: false });\n };\n\n handleShare = (comment, fileName, fileSize) => {\n this.setState({ openFileUploadPreviewDialog: false }, () => {\n if (this.props.handleShare) {\n this.props.handleShare(comment, fileName, fileSize);\n }\n });\n };\n\n renderUploadButton() {\n const Icon = isNativeDetected ? PhotoCameraIcon : AttachIcon;\n const labelDataAttributes = { [FILE_UPLOAD_BUTTON_DATA_ATTR]: '' };\n\n return (\n <label htmlFor={this.props.inputId} {...labelDataAttributes}>\n <input\n ref={this.fileInput}\n id={this.props.inputId}\n type=\"file\"\n disabled={this.props.disabled}\n onChange={this.uploadFile}\n style={{ display: 'none' }}\n />\n <IconButton\n data-testid={`${PAGE_NAME}_attachFileButton`}\n aria-label=\"File Upload\"\n disabled={this.props.disabled}\n component={this.props.disabled ? 'button' : 'span'}\n className={this.props.fileUploadIconClassName}\n disableRipple={this.props.disableRipple}\n tooltipProps={this.props.tooltipProps}\n >\n <Icon />\n </IconButton>\n </label>\n );\n }\n\n render() {\n return (\n <>\n {this.state.uploadingFileToS3 ? (\n <CircularProgress data-testid=\"generic_uploadProgress\" size={18} />\n ) : (\n this.renderUploadButton()\n )}\n\n {this.state.openFileUploadPreviewDialog && (\n <PostPreviewDialog\n open={this.state.openFileUploadPreviewDialog}\n fileUrl={this.state.s3FileUrl}\n fileName={this.state.s3FileName}\n fileSize={this.state.s3FileSize}\n handleShare={this.handleShare}\n handleClose={this.handleCloseFileUploadPreviewDialog}\n additionalFields={this.props.additionalFields}\n requiredFields={this.props.requiredFields}\n message={this.props.message}\n />\n )}\n </>\n );\n }\n}\n\nFileUploadIconButton.propTypes = {\n additionalFields: PropTypes.arrayOf(PropTypes.node),\n classes: PropTypes.shape({}),\n tooltipProps: PropTypes.shape({}),\n disableRipple: PropTypes.bool,\n disabled: PropTypes.bool,\n fileUploadIconClassName: PropTypes.string,\n handleShare: PropTypes.func,\n inputId: PropTypes.string,\n message: PropTypes.string,\n onError: PropTypes.func,\n onFinish: PropTypes.func,\n openPreviewDialogOnUpload: PropTypes.bool,\n requiredFields: PropTypes.arrayOf(PropTypes.string),\n};\n\nFileUploadIconButton.defaultProps = {\n additionalFields: [],\n classes: {},\n disableRipple: false,\n disabled: false,\n fileUploadIconClassName: undefined,\n handleShare: undefined,\n inputId: 'icon-button-file',\n message: undefined,\n onError: undefined,\n onFinish: undefined,\n openPreviewDialogOnUpload: true,\n requiredFields: [],\n tooltipProps: { title: 'Attach File' },\n};\n\nexport default FileUploadIconButton;\n"],"names":["FILE_UPLOAD_BUTTON_DATA_ATTR","FileUploadIconButton","_PureComponent","_inherits","PureComponent","_super","_createSuper","props","_this","_ref2","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","_asyncToGenerator","_regeneratorRuntime","mark","_callee","s3DownloadLinkResponse","wrap","_context","prev","next","getS3DownloadLink","state","s3FileName","sent","setState","currentUpload","uploadingFileToS3","openFileUploadPreviewDialog","openPreviewDialogOnUpload","s3FileUrl","url","onFinish","s3FileSize","stop","fileUploadingError","onError","console","error","_callee2","file","callback","data","_context2","getS3SignedUrl","name","type","t0","message","abrupt","signed_url","file_name","size","signedUrl","_x","_x2","apply","arguments","event","target","files","clearUpload","uploader","S3Upload","fileElement","fileInput","current","getSignedUrl","preprocess","onProgress","onFinishS3Put","comment","fileName","fileSize","handleShare","createRef","_createClass","key","value","abortUpload","Icon","isNativeDetected","PhotoCameraIcon","AttachIcon","labelDataAttributes","_jsxs","_objectSpread","htmlFor","inputId","children","_jsx","ref","id","disabled","onChange","uploadFile","style","display","IconButton","concat","component","className","fileUploadIconClassName","disableRipple","tooltipProps","_Fragment","CircularProgress","renderUploadButton","PostPreviewDialog","open","fileUrl","handleClose","handleCloseFileUploadPreviewDialog","additionalFields","requiredFields","propTypes","PropTypes","arrayOf","node","classes","shape","bool","string","func","defaultProps","undefined","title"],"mappings":"k+DAYA,IAGaA,EAA+B,0BAGtCC,EAAoB,SAAAC,GAAAC,EAAAF,EAASG,GAAT,IAAAC,EAAAC,EAAAL,GACxB,SAAAA,EAAYM,GAAO,IAAAC,EAuCJC,EAxBgB,OAfZC,EAAAC,KAAAV,GACjBO,EAAAH,EAAAO,KAAAD,KAAMJ,GAAOM,EAiBJC,EAAAN,GAAA,WAAAO,EAAAC,EAAAC,MAAA,SAAAC,IAAA,IAAAC,EAAA,OAAAH,EAAAI,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,OAAAF,EAAAE,KAAA,EAC4BC,EAAkBhB,EAAKiB,MAAMC,YAAW,KAAA,EAAvEP,EAAsBE,EAAAM,KAC5BnB,EAAKoB,SACH,CACEC,cAAe,KACfC,mBAAmB,EACnBC,4BAA6BvB,EAAKD,MAAMyB,0BACxCC,UAAWd,EAAuBe,MAEpC,WACM1B,EAAKD,MAAM4B,UACb3B,EAAKD,MAAM4B,SAAS3B,EAAKiB,MAAMQ,UAAWzB,EAAKiB,MAAMC,WAAYlB,EAAKiB,MAAMW,WAChF,IACA,KA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ACbrC,QAAS,mBACTxC,aAAS6E,EACTzF,aAASyF,EACT7F,cAAU6F,EACVhG,2BAA2B,EAC3BqF,eAAgB,GAChBV,aAAc,CAAEsB,MAAO"}
|
|
1
|
+
{"version":3,"file":"FileUploadIconButton.js","sources":["../../src/components/FileUploadIconButton.js"],"sourcesContent":["import { memo } from 'react';\nimport PropTypes from 'prop-types';\nimport useFileUploadIconButton from './useFileUploadIconButton';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport PhotoCameraIcon from '@material-ui/icons/PhotoCamera';\n\nimport PostPreviewDialog from '~components/PostPreviewDialog';\nimport AttachIcon from '~components/Icons/AttachIcon';\nimport IconButton from '~components/IconButton';\nimport { isNativeDetected } from '~/utils/mobileDetect';\n\nconst PAGE_NAME = 'fileUpload';\n\n// Data attr helps to identify the select file action; Is used to prevent the tooltip from closing\nexport const FILE_UPLOAD_BUTTON_DATA_ATTR = 'data-file-upload-button';\n\nconst emptyFields = [];\nconst defaultTooltipProps = { title: 'Attach File' };\n\n/** @param {any} props Preserve the legacy component's permissive public prop type. */\nfunction FileUploadIconButton({\n additionalFields = emptyFields,\n tooltipProps = defaultTooltipProps,\n disableRipple = false,\n disabled = false,\n fileUploadIconClassName,\n handleShare: onShare,\n inputId = 'icon-button-file',\n message,\n onError,\n onFinish,\n openPreviewDialogOnUpload = true,\n requiredFields = emptyFields,\n}) {\n const { state, fileInput, uploadFile, handleCloseFileUploadPreviewDialog, handleShare } =\n useFileUploadIconButton({ onError, onFinish, openPreviewDialogOnUpload, handleShare: onShare });\n const renderUploadButton = () => {\n const Icon = isNativeDetected ? PhotoCameraIcon : AttachIcon;\n const labelDataAttributes = { [FILE_UPLOAD_BUTTON_DATA_ATTR]: '' };\n\n return (\n <label htmlFor={inputId} {...labelDataAttributes}>\n <input\n ref={fileInput}\n id={inputId}\n type=\"file\"\n disabled={disabled}\n onChange={uploadFile}\n style={{ display: 'none' }}\n />\n <IconButton\n data-testid={`${PAGE_NAME}_attachFileButton`}\n aria-label=\"File Upload\"\n disabled={disabled}\n component={disabled ? 'button' : 'span'}\n className={fileUploadIconClassName}\n disableRipple={disableRipple}\n tooltipProps={tooltipProps}\n >\n <Icon />\n </IconButton>\n </label>\n );\n };\n\n return (\n <>\n {state.uploadingFileToS3 ? (\n <CircularProgress data-testid=\"generic_uploadProgress\" size={18} />\n ) : (\n renderUploadButton()\n )}\n\n {state.openFileUploadPreviewDialog && (\n <PostPreviewDialog\n open={state.openFileUploadPreviewDialog}\n fileUrl={state.s3FileUrl}\n fileName={state.s3FileName}\n fileSize={state.s3FileSize}\n handleShare={handleShare}\n handleClose={handleCloseFileUploadPreviewDialog}\n additionalFields={additionalFields}\n requiredFields={requiredFields}\n message={message}\n />\n )}\n </>\n );\n}\n\nFileUploadIconButton.propTypes = {\n additionalFields: PropTypes.arrayOf(PropTypes.node),\n classes: PropTypes.shape({}),\n tooltipProps: PropTypes.shape({}),\n disableRipple: PropTypes.bool,\n disabled: PropTypes.bool,\n fileUploadIconClassName: PropTypes.string,\n handleShare: PropTypes.func,\n inputId: PropTypes.string,\n message: PropTypes.string,\n onError: PropTypes.func,\n onFinish: PropTypes.func,\n openPreviewDialogOnUpload: PropTypes.bool,\n requiredFields: PropTypes.arrayOf(PropTypes.string),\n};\n\nexport default memo(FileUploadIconButton);\n"],"names":["FILE_UPLOAD_BUTTON_DATA_ATTR","emptyFields","defaultTooltipProps","title","FileUploadIconButton","_ref","Icon","labelDataAttributes","_ref$additionalFields","additionalFields","_ref$tooltipProps","tooltipProps","_ref$disableRipple","disableRipple","_ref$disabled","disabled","fileUploadIconClassName","onShare","handleShare","_ref$inputId","inputId","message","onError","onFinish","_ref$openPreviewDialo","openPreviewDialogOnUpload","_ref$requiredFields","requiredFields","_useFileUploadIconBut","useFileUploadIconButton","state","fileInput","uploadFile","handleCloseFileUploadPreviewDialog","_jsxs","_Fragment","children","uploadingFileToS3","_jsx","CircularProgress","size","isNativeDetected","PhotoCameraIcon","AttachIcon","_defineProperty","_objectSpread","htmlFor","ref","id","type","onChange","style","display","IconButton","concat","component","className","openFileUploadPreviewDialog","PostPreviewDialog","open","fileUrl","s3FileUrl","fileName","s3FileName","fileSize","s3FileSize","handleClose","propTypes","PropTypes","arrayOf","node","classes","shape","bool","string","func","memo"],"mappings":"yiCAWA,IAGaA,EAA+B,0BAEtCC,EAAc,GACdC,EAAsB,CAAEC,MAAO,eAGrC,SAASC,EAaNC,GAAA,IAIOC,EACAC,EALPC,EAAAH,EAZDI,iBAAAA,aAAmBR,EAAWO,EAAAE,EAAAL,EAC9BM,aAAAA,aAAeT,EAAmBQ,EAAAE,EAAAP,EAClCQ,cAAAA,cAAqBD,EAAAE,EAAAT,EACrBU,SAAAA,cAAgBD,EAChBE,IAAAA,wBACaC,IAAbC,YAAWC,EAAAd,EACXe,QAAAA,aAAU,mBAAkBD,EAC5BE,IAAAA,QACAC,IAAAA,QACAC,IAAAA,SAAQC,EAAAnB,EACRoB,0BAAAA,cAAgCD,EAAAE,EAAArB,EAChCsB,eAAAA,aAAiB1B,EAAWyB,EAE5BE,EACEC,EAAwB,CAAEP,QAAAA,EAASC,SAAAA,EAAUE,0BAAAA,EAA2BP,YAAaD,IAD/Ea,IAAAA,MAAOC,IAAAA,UAAWC,IAAAA,WAAYC,IAAAA,mCAAoCf,IAAAA,YA+B1E,OACEgB,EAAAC,EAAA,CAAAC,SAAA,CACGN,EAAMO,kBACLC,EAACC,EAAgB,CAAC,cAAY,yBAAyBC,KAAM,MA/B3DlC,EAAOmC,EAAmBC,EAAkBC,EAC5CpC,EAAmBqC,EAAA,CAAA,EAxBe,0BAwBsB,IAG5DV,EAAA,QAAAW,EAAAA,EAAA,CAAOC,QAAS1B,GAAab,GAAmB,GAAA,CAAA6B,SAC9C,CAAAE,EAAA,QAAA,CACES,IAAKhB,EACLiB,GAAI5B,EACJ6B,KAAK,OACLlC,SAAUA,EACVmC,SAAUlB,EACVmB,MAAO,CAAEC,QAAS,UAEpBd,EAACe,EAAU,CACT,cAAA,GAAAC,OAxCQ,aAwCqC,qBAC7C,aAAW,cACXvC,SAAUA,EACVwC,UAAWxC,EAAW,SAAW,OACjCyC,UAAWxC,EACXH,cAAeA,EACfF,aAAcA,EAAayB,SAE3BE,EAAChC,EAAI,WAcRwB,EAAM2B,6BACLnB,EAACoB,EAAiB,CAChBC,KAAM7B,EAAM2B,4BACZG,QAAS9B,EAAM+B,UACfC,SAAUhC,EAAMiC,WAChBC,SAAUlC,EAAMmC,WAChB/C,YAAaA,EACbgD,YAAajC,EACbxB,iBAAkBA,EAClBkB,eAAgBA,EAChBN,QAASA,MAKnB,CAEAjB,EAAqB+D,UAAY,CAC/B1D,iBAAkB2D,EAAUC,QAAQD,EAAUE,MAC9CC,QAASH,EAAUI,MAAM,IACzB7D,aAAcyD,EAAUI,MAAM,IAC9B3D,cAAeuD,EAAUK,KACzB1D,SAAUqD,EAAUK,KACpBzD,wBAAyBoD,EAAUM,OACnCxD,YAAakD,EAAUO,KACvBvD,QAASgD,EAAUM,OACnBrD,QAAS+C,EAAUM,OACnBpD,QAAS8C,EAAUO,KACnBpD,SAAU6C,EAAUO,KACpBlD,0BAA2B2C,EAAUK,KACrC9C,eAAgByC,EAAUC,QAAQD,EAAUM,SAG9C,IAAeE,EAAAA,EAAKxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileUploadIconButton.test.d.ts","sourceRoot":"","sources":["../../../src/components/__tests__/useFileUploadIconButton.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default function useFileUploadIconButton(props: any): {
|
|
2
|
+
state: {
|
|
3
|
+
currentUpload: null;
|
|
4
|
+
s3FileUrl: null;
|
|
5
|
+
s3FileName: null;
|
|
6
|
+
s3FileSize: null;
|
|
7
|
+
uploadingFileToS3: boolean;
|
|
8
|
+
openFileUploadPreviewDialog: boolean;
|
|
9
|
+
};
|
|
10
|
+
fileInput: import("react").MutableRefObject<null>;
|
|
11
|
+
uploadFile: (event: any) => void;
|
|
12
|
+
handleCloseFileUploadPreviewDialog: () => void;
|
|
13
|
+
handleShare: (comment: any, fileName: any, fileSize: any) => void;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useFileUploadIconButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileUploadIconButton.d.ts","sourceRoot":"","sources":["../../src/components/useFileUploadIconButton.js"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,KAAK,KAAA;;;;;;;;;;;;;EAmGpD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/toConsumableArray";import t from"@babel/runtime/helpers/slicedToArray";import o from"@babel/runtime/regenerator";import{useState as i,useRef as l,useLayoutEffect as a}from"react";import p from"react-s3-uploader/s3upload";import{getS3SignedUrl as s,getS3DownloadLink as u}from"../clients/jsonApi/index.js";function c(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function f(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?c(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function d(r){var c=i({currentUpload:null,s3FileUrl:null,s3FileName:null,s3FileSize:null,uploadingFileToS3:!1,openFileUploadPreviewDialog:!1}),d=t(c,2),m=d[0],g=d[1],h=l(null),b=l({props:r,state:m}),y=l([]);a((function(){b.current={props:r,state:m};var e=y.current;y.current=[],e.forEach((function(e){var r=b.current;if("finish"===e.type&&r.props.onFinish)r.props.onFinish(r.state.s3FileUrl,r.state.s3FileName,r.state.s3FileSize);else if("error"===e.type)r.props.onError&&r.props.onError(e.message),console.error(e.message);else if("share"===e.type&&r.props.handleShare){var t;(t=r.props).handleShare.apply(t,n(e.args))}}))}));var F,v,O=function(e,r){r&&y.current.push(r),g((function(r){return f(f({},r),e)}))},U=function(e){b.current.props.onError&&b.current.props.onError(e),console.error(e)},w=(F=e(o.mark((function e(r,n){var t;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,s(r.name,r.type);case 3:t=e.sent,e.next=10;break;case 6:return e.prev=6,e.t0=e.catch(0),O({uploadingFileToS3:null,currentUpload:null},{type:"error",message:e.t0.message}),e.abrupt("return");case 10:O({s3FileUrl:t.signed_url,s3FileName:t.file_name,s3FileSize:r.size}),n(f(f({},t),{},{signedUrl:t.signed_url}));case 12:case"end":return e.stop()}}),e,null,[[0,6]])}))),function(e,r){return F.apply(this,arguments)}),P=(v=e(o.mark((function e(){var r;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u(b.current.state.s3FileName);case 2:r=e.sent,O({currentUpload:null,uploadingFileToS3:!1,openFileUploadPreviewDialog:b.current.props.openPreviewDialogOnUpload,s3FileUrl:r.url},{type:"finish"});case 4:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)});return{state:m,fileInput:h,uploadFile:function(e){if(e.target.files[0]){var r=b.current.state.currentUpload;r&&r.uploader&&r.uploader.abortUpload();var n=new p({fileElement:h.current,getSignedUrl:w,preprocess:function(e,r){return r(e)},onProgress:function(){},onFinishS3Put:P,onError:U});O({uploadingFileToS3:!0,currentUpload:{uploader:n}})}},handleCloseFileUploadPreviewDialog:function(){return O({openFileUploadPreviewDialog:!1})},handleShare:function(e,r,n){return O({openFileUploadPreviewDialog:!1},{type:"share",args:[e,r,n]})}}}export{d as default};
|
|
2
|
+
//# sourceMappingURL=useFileUploadIconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileUploadIconButton.js","sources":["../../src/components/useFileUploadIconButton.js"],"sourcesContent":["import { useLayoutEffect, useRef, useState } from 'react';\nimport S3Upload from 'react-s3-uploader/s3upload';\nimport { getS3SignedUrl, getS3DownloadLink } from '~/clients/jsonApi';\n\nexport default function useFileUploadIconButton(props) {\n const [state, setState] = useState({\n currentUpload: null,\n s3FileUrl: null,\n s3FileName: null,\n s3FileSize: null,\n uploadingFileToS3: false,\n openFileUploadPreviewDialog: false,\n });\n const fileInput = useRef(null);\n const latest = useRef({ props, state });\n const notifications = useRef([]);\n\n // The uploader retains callbacks; notify with current data only after the UI commits.\n useLayoutEffect(() => {\n latest.current = { props, state };\n const pending = notifications.current;\n notifications.current = [];\n pending.forEach(notification => {\n const current = latest.current;\n if (notification.type === 'finish' && current.props.onFinish) {\n current.props.onFinish(\n current.state.s3FileUrl,\n current.state.s3FileName,\n current.state.s3FileSize\n );\n } else if (notification.type === 'error') {\n if (current.props.onError) current.props.onError(notification.message);\n console.error(notification.message);\n } else if (notification.type === 'share' && current.props.handleShare) {\n current.props.handleShare(...notification.args);\n }\n });\n });\n\n const update = (patch, notification) => {\n if (notification) notifications.current.push(notification);\n setState(current => ({ ...current, ...patch }));\n };\n\n const onError = error => {\n if (latest.current.props.onError) latest.current.props.onError(error);\n console.error(error);\n };\n\n const getSignedUrl = async (file, callback) => {\n let data;\n try {\n data = await getS3SignedUrl(file.name, file.type);\n } catch (error) {\n update(\n { uploadingFileToS3: null, currentUpload: null },\n { type: 'error', message: error.message }\n );\n return;\n }\n update({ s3FileUrl: data.signed_url, s3FileName: data.file_name, s3FileSize: file.size });\n callback({ ...data, signedUrl: data.signed_url });\n };\n\n const onFinish = async () => {\n const response = await getS3DownloadLink(latest.current.state.s3FileName);\n update(\n {\n currentUpload: null,\n uploadingFileToS3: false,\n openFileUploadPreviewDialog: latest.current.props.openPreviewDialogOnUpload,\n s3FileUrl: response.url,\n },\n { type: 'finish' }\n );\n };\n\n const uploadFile = event => {\n if (!event.target.files[0]) return;\n const { currentUpload } = latest.current.state;\n if (currentUpload && currentUpload.uploader) currentUpload.uploader.abortUpload();\n const uploader = new S3Upload({\n fileElement: fileInput.current,\n getSignedUrl,\n preprocess: (file, next) => next(file),\n onProgress: () => undefined, // Prevent the uploader's default progress logging.\n onFinishS3Put: onFinish,\n onError,\n });\n update({ uploadingFileToS3: true, currentUpload: { uploader } });\n };\n\n return {\n state,\n fileInput,\n uploadFile,\n handleCloseFileUploadPreviewDialog: () => update({ openFileUploadPreviewDialog: false }),\n handleShare: (comment, fileName, fileSize) =>\n update(\n { openFileUploadPreviewDialog: false },\n { type: 'share', args: [comment, fileName, fileSize] }\n ),\n };\n}\n"],"names":["useFileUploadIconButton","props","_useState","useState","currentUpload","s3FileUrl","s3FileName","s3FileSize","uploadingFileToS3","openFileUploadPreviewDialog","_useState2","_slicedToArray","state","setState","fileInput","useRef","latest","notifications","useLayoutEffect","current","pending","forEach","notification","type","onFinish","onError","message","console","error","handleShare","_current$props","args","_ref","_ref2","update","patch","push","getSignedUrl","_asyncToGenerator","_regeneratorRuntime","mark","_callee","file","callback","data","wrap","_context","prev","next","getS3SignedUrl","name","sent","t0","abrupt","signed_url","file_name","size","signedUrl","stop","_x","_x2","apply","this","arguments","_callee2","response","_context2","getS3DownloadLink","openPreviewDialogOnUpload","url","uploadFile","event","target","files","uploader","abortUpload","S3Upload","fileElement","preprocess","onProgress","onFinishS3Put","handleCloseFileUploadPreviewDialog","comment","fileName","fileSize"],"mappings":"igCAIe,SAASA,EAAwBC,GAC9C,IAAAC,EAA0BC,EAAS,CACjCC,cAAe,KACfC,UAAW,KACXC,WAAY,KACZC,WAAY,KACZC,mBAAmB,EACnBC,6BAA6B,IAC7BC,EAAAC,EAAAT,EAAA,GAPKU,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAQhBI,EAAYC,EAAO,MACnBC,EAASD,EAAO,CAAEd,MAAAA,EAAOW,MAAAA,IACzBK,EAAgBF,EAAO,IAG7BG,GAAgB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M,GAAI,OAAKA,EAAKN,EAAK,EACtCqC,WAAY,WAAe,EAC3BC,cAAexD,EACfC,QAAAA,IAEFS,EAAO,CAAE1B,mBAAmB,EAAMJ,cAAe,CAAEsE,SAAAA,IAXvB,GAkB5BO,mCAAoC,WAAA,OAAM/C,EAAO,CAAEzB,6BAA6B,GAAQ,EACxFoB,YAAa,SAACqD,EAASC,EAAUC,GAAQ,OACvClD,EACE,CAAEzB,6BAA6B,GAC/B,CAAEc,KAAM,QAASQ,KAAM,CAACmD,EAASC,EAAUC,IAC5C,EAEP"}
|
|
@@ -4,6 +4,24 @@ export type GlobalOffsetWell = {
|
|
|
4
4
|
id: number;
|
|
5
5
|
[key: string]: unknown;
|
|
6
6
|
};
|
|
7
|
+
/** Host-owned planning scope. Presence identifies a Well Planning dashboard. */
|
|
8
|
+
export type WellPlanningDashboardMeta = {
|
|
9
|
+
assetId: number | null;
|
|
10
|
+
dashboardId: string;
|
|
11
|
+
defaultDashboardKind?: string;
|
|
12
|
+
segment: string | null;
|
|
13
|
+
};
|
|
14
|
+
export type AppDashboardMeta = {
|
|
15
|
+
/** The host owns app identity and maximization controls. */
|
|
16
|
+
isEmbedded?: boolean;
|
|
17
|
+
isMultiAsset?: boolean;
|
|
18
|
+
isMultiWell?: boolean;
|
|
19
|
+
isChiplessDashboard?: boolean;
|
|
20
|
+
globalOffsetWells?: GlobalOffsetWell[];
|
|
21
|
+
globalOffsetWellsVersion?: number;
|
|
22
|
+
globalOffsetWellsToken?: number;
|
|
23
|
+
wellPlanning?: WellPlanningDashboardMeta;
|
|
24
|
+
};
|
|
7
25
|
export type AppCommonsContextType = {
|
|
8
26
|
maximized: boolean;
|
|
9
27
|
appId: number;
|
|
@@ -18,12 +36,7 @@ export type AppCommonsContextType = {
|
|
|
18
36
|
fracFleet?: FracFleet;
|
|
19
37
|
interventionUnit?: InterventionUnit;
|
|
20
38
|
wells?: Well[];
|
|
21
|
-
dashboardMeta?:
|
|
22
|
-
isMultiAsset?: boolean;
|
|
23
|
-
isMultiWell?: boolean;
|
|
24
|
-
isChiplessDashboard?: boolean;
|
|
25
|
-
globalOffsetWellsToken?: number;
|
|
26
|
-
};
|
|
39
|
+
dashboardMeta?: AppDashboardMeta;
|
|
27
40
|
appHeadersV3Enabled?: boolean;
|
|
28
41
|
isNonIsolatedApp?: boolean;
|
|
29
42
|
disableAppAssetSelection?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppCommonsContext.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/AppCommonsProvider/AppCommonsContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAE5E,OAAO,EACL,GAAG,EACH,WAAW,EACX,KAAK,EACL,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACL,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAIF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAE3C,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,GAAG,CAAC,EAAE,KAAK,CAAC;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IAGf,aAAa,CAAC,EAAE
|
|
1
|
+
{"version":3,"file":"AppCommonsContext.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/AppCommonsProvider/AppCommonsContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAE5E,OAAO,EACL,GAAG,EACH,WAAW,EACX,KAAK,EACL,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACL,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,4DAA4D;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,YAAY,CAAC,EAAE,yBAAyB,CAAC;CAC1C,CAAC;AAIF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,C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AI,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;IACpF,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEJ,eAAO,MAAM,iBAAiB,wDAG7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,qCAAsC,CAAC;AAEzE,eAAO,MAAM,aAAa,QAA0C,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppCommonsContext.js","sources":["../../../src/componentsV2/AppCommonsProvider/AppCommonsContext.ts"],"sourcesContent":["import { ComponentType, createContext, ReactNode, useContext } from 'react';\n\nimport {\n App,\n AppSettings,\n Asset,\n FracFleet,\n FullscreenModes,\n InterventionUnit,\n User,\n Well,\n} from '../../types';\n\nexport type GlobalOffsetWell = {\n id: number;\n [key: string]: unknown;\n};\n\n// ⚠️⚠️⚠️ Mentioned in storybook, please update when editing this type\n// Used in AppTestWrapper\nexport type AppCommonsContextType = {\n maximized: boolean;\n appId: number;\n app: App;\n appKey: string;\n appName: string;\n appSettings?: AppSettings;\n onSettingChange: (key: string, value: unknown) => void;\n onSettingsChange: (value: unknown) => void;\n\n well?: Well;\n rig?: Asset;\n fracFleet?: FracFleet;\n interventionUnit?: InterventionUnit;\n wells?: Well[];\n\n // Passed down from corva-web-frontend. May not exist, so everything must be optional\n dashboardMeta?:
|
|
1
|
+
{"version":3,"file":"AppCommonsContext.js","sources":["../../../src/componentsV2/AppCommonsProvider/AppCommonsContext.ts"],"sourcesContent":["import { ComponentType, createContext, ReactNode, useContext } from 'react';\n\nimport {\n App,\n AppSettings,\n Asset,\n FracFleet,\n FullscreenModes,\n InterventionUnit,\n User,\n Well,\n} from '../../types';\n\nexport type GlobalOffsetWell = {\n id: number;\n [key: string]: unknown;\n};\n\n/** Host-owned planning scope. Presence identifies a Well Planning dashboard. */\nexport type WellPlanningDashboardMeta = {\n assetId: number | null;\n dashboardId: string;\n defaultDashboardKind?: string;\n segment: string | null;\n};\n\nexport type AppDashboardMeta = {\n /** The host owns app identity and maximization controls. */\n isEmbedded?: boolean;\n isMultiAsset?: boolean;\n isMultiWell?: boolean;\n isChiplessDashboard?: boolean;\n globalOffsetWells?: GlobalOffsetWell[];\n globalOffsetWellsVersion?: number;\n globalOffsetWellsToken?: number;\n wellPlanning?: WellPlanningDashboardMeta;\n};\n\n// ⚠️⚠️⚠️ Mentioned in storybook, please update when editing this type\n// Used in AppTestWrapper\nexport type AppCommonsContextType = {\n maximized: boolean;\n appId: number;\n app: App;\n appKey: string;\n appName: string;\n appSettings?: AppSettings;\n onSettingChange: (key: string, value: unknown) => void;\n onSettingsChange: (value: unknown) => void;\n\n well?: Well;\n rig?: Asset;\n fracFleet?: FracFleet;\n interventionUnit?: InterventionUnit;\n wells?: Well[];\n\n // Passed down from corva-web-frontend. May not exist, so everything must be optional\n dashboardMeta?: AppDashboardMeta;\n appHeadersV3Enabled?: boolean;\n // [REACT-18-MIGRATION-TAG] PLT-3099: true when the app renders in-process on the host\n // (the platform isolation decision from DevCenterIsolatedApp); iframe realms leave it unset.\n isNonIsolatedApp?: boolean;\n disableAppAssetSelection?: boolean;\n isMultiRig?: boolean;\n currentUser?: User;\n globalOffsetWells?: GlobalOffsetWell[];\n globalOffsetWellsVersion?: number;\n globalOffsetWellsToken?: number;\n removeApp?: () => void;\n};\n\nexport type AppCommonsContextTypeInternal = AppCommonsContextType &\n Partial<FullscreenModes> & {\n /** True in any of the three modes: dashboard maximize, browser fullscreen, separate window */\n isExpanded?: boolean;\n setMaximized: (maximized: boolean) => void;\n appData?: unknown;\n layoutEnvironment?: ({ type?: string } & Record<string, unknown>) | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n appSettingsComponent?: ComponentType<any>;\n toggleAnnotationsList?: () => void;\n onHelpCenterClick?: () => void;\n secondaryMenuItems?: { title: ReactNode; onClick?: () => void; icon?: ReactNode }[];\n isInsideNewMobileApp?: boolean;\n reloadApp?: () => void;\n };\n\nexport const AppCommonsContext = createContext<AppCommonsContextTypeInternal>(\n // TODO provide defaults\n null as unknown as AppCommonsContextTypeInternal\n);\n\nexport const useAppCommonsInternal = () => useContext(AppCommonsContext);\n\nexport const useAppCommons = () => useContext(AppCommonsContext) as AppCommonsContextType;\n"],"names":["AppCommonsContext","createContext","useAppCommonsInternal","useContext","useAppCommons"],"mappings":"sDAuFO,IAAMA,EAAoBC,EAE/B,MAGWC,EAAwB,WAAH,OAASC,EAAWH,EAAkB,EAE3DI,EAAgB,WAAH,OAASD,EAAWH,EAAkB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare enum ActionsTestIds {
|
|
2
|
+
MoreButtonTestId = "CorvaUI.AppHeader.Actions.MoreButtonTestId",
|
|
2
3
|
CollapseButtonTestId = "CorvaUI.AppHeader.Actions.CollapseButtonTestId",
|
|
3
4
|
ExpandButtonTestId = "CorvaUI.AppHeader.Actions.ExpandButtonTestId",
|
|
4
5
|
AdditionalActionItemTestId = "CorvaUI.AppHeader.Actions.AdditionalActionItemTestId",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.constants.d.ts","sourceRoot":"","sources":["../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.constants.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,oBAAoB,mDAAmD;IACvE,kBAAkB,iDAAiD;IACnE,0BAA0B,yDAAyD;IACnF,wBAAwB,uDAAuD;IAC/E,sBAAsB,qDAAqD;IAC3E,kBAAkB,iDAAiD;IACnE,2BAA2B,0DAA0D;IACrF,wBAAwB,uDAAuD;CAChF"}
|
|
1
|
+
{"version":3,"file":"Actions.constants.d.ts","sourceRoot":"","sources":["../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.constants.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,gBAAgB,+CAA+C;IAC/D,oBAAoB,mDAAmD;IACvE,kBAAkB,iDAAiD;IACnE,0BAA0B,yDAAyD;IACnF,wBAAwB,uDAAuD;IAC/E,sBAAsB,qDAAqD;IAC3E,kBAAkB,iDAAiD;IACnE,2BAA2B,0DAA0D;IACrF,wBAAwB,uDAAuD;CAChF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e;!function(e){e.CollapseButtonTestId="CorvaUI.AppHeader.Actions.CollapseButtonTestId",e.ExpandButtonTestId="CorvaUI.AppHeader.Actions.ExpandButtonTestId",e.AdditionalActionItemTestId="CorvaUI.AppHeader.Actions.AdditionalActionItemTestId",e.CloseCommentButtonTestId="CorvaUI.AppHeader.Actions.CloseCommentButtonTestId",e.AddMessageButtonTestId="CorvaUI.AppHeader.Actions.AddMessageButtonTestId",e.MaximizeItemTestId="CorvaUI.AppHeader.Actions.MaximizeItemTestId",e.BrowserFullscreenItemTestId="CorvaUI.AppHeader.Actions.BrowserFullscreenItemTestId",e.SeparateWindowItemTestId="CorvaUI.AppHeader.Actions.SeparateWindowItemTestId"}(e||(e={}));export{e as ActionsTestIds};
|
|
1
|
+
var e;!function(e){e.MoreButtonTestId="CorvaUI.AppHeader.Actions.MoreButtonTestId",e.CollapseButtonTestId="CorvaUI.AppHeader.Actions.CollapseButtonTestId",e.ExpandButtonTestId="CorvaUI.AppHeader.Actions.ExpandButtonTestId",e.AdditionalActionItemTestId="CorvaUI.AppHeader.Actions.AdditionalActionItemTestId",e.CloseCommentButtonTestId="CorvaUI.AppHeader.Actions.CloseCommentButtonTestId",e.AddMessageButtonTestId="CorvaUI.AppHeader.Actions.AddMessageButtonTestId",e.MaximizeItemTestId="CorvaUI.AppHeader.Actions.MaximizeItemTestId",e.BrowserFullscreenItemTestId="CorvaUI.AppHeader.Actions.BrowserFullscreenItemTestId",e.SeparateWindowItemTestId="CorvaUI.AppHeader.Actions.SeparateWindowItemTestId"}(e||(e={}));export{e as ActionsTestIds};
|
|
2
2
|
//# sourceMappingURL=Actions.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.constants.js","sources":["../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.constants.ts"],"sourcesContent":["export enum ActionsTestIds {\n CollapseButtonTestId = 'CorvaUI.AppHeader.Actions.CollapseButtonTestId',\n ExpandButtonTestId = 'CorvaUI.AppHeader.Actions.ExpandButtonTestId',\n AdditionalActionItemTestId = 'CorvaUI.AppHeader.Actions.AdditionalActionItemTestId',\n CloseCommentButtonTestId = 'CorvaUI.AppHeader.Actions.CloseCommentButtonTestId',\n AddMessageButtonTestId = 'CorvaUI.AppHeader.Actions.AddMessageButtonTestId',\n MaximizeItemTestId = 'CorvaUI.AppHeader.Actions.MaximizeItemTestId',\n BrowserFullscreenItemTestId = 'CorvaUI.AppHeader.Actions.BrowserFullscreenItemTestId',\n SeparateWindowItemTestId = 'CorvaUI.AppHeader.Actions.SeparateWindowItemTestId',\n}\n"],"names":["ActionsTestIds"],"mappings":"AAAA,IAAYA,
|
|
1
|
+
{"version":3,"file":"Actions.constants.js","sources":["../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.constants.ts"],"sourcesContent":["export enum ActionsTestIds {\n MoreButtonTestId = 'CorvaUI.AppHeader.Actions.MoreButtonTestId',\n CollapseButtonTestId = 'CorvaUI.AppHeader.Actions.CollapseButtonTestId',\n ExpandButtonTestId = 'CorvaUI.AppHeader.Actions.ExpandButtonTestId',\n AdditionalActionItemTestId = 'CorvaUI.AppHeader.Actions.AdditionalActionItemTestId',\n CloseCommentButtonTestId = 'CorvaUI.AppHeader.Actions.CloseCommentButtonTestId',\n AddMessageButtonTestId = 'CorvaUI.AppHeader.Actions.AddMessageButtonTestId',\n MaximizeItemTestId = 'CorvaUI.AppHeader.Actions.MaximizeItemTestId',\n BrowserFullscreenItemTestId = 'CorvaUI.AppHeader.Actions.BrowserFullscreenItemTestId',\n SeparateWindowItemTestId = 'CorvaUI.AppHeader.Actions.SeparateWindowItemTestId',\n}\n"],"names":["ActionsTestIds"],"mappings":"AAAA,IAAYA,GAUX,SAVWA,GAAAA,EAAc,iBAAA,6CAAdA,EAAc,qBAAA,iDAAdA,EAAc,mBAAA,+CAAdA,EAAc,2BAAA,uDAAdA,EAAc,yBAAA,qDAAdA,EAAc,uBAAA,mDAAdA,EAAc,mBAAA,+CAAdA,EAAc,4BAAA,wDAAdA,EAAc,yBAAA,oDAAdA,CAUX,CAVWA,IAAAA,EAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.d.ts","sourceRoot":"","sources":["../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,cAAc,CAAC;AAsBxE,KAAK,YAAY,GAAG;IAClB,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAOF,eAAO,MAAM,OAAO,iFAKjB,YAAY,
|
|
1
|
+
{"version":3,"file":"Actions.d.ts","sourceRoot":"","sources":["../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,cAAc,CAAC;AAsBxE,KAAK,YAAY,GAAG;IAClB,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAOF,eAAO,MAAM,OAAO,iFAKjB,YAAY,4CAmTd,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"@babel/runtime/helpers/toConsumableArray";import s from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/typeof";import{useState as i,useRef as c,useCallback as e,useEffect as r,useMemo as m,Fragment as p}from"react";import l from"classnames";import{ButtonIcon as u}from"../../../ButtonIcon/ButtonIcon.js";import{Tooltip as a}from"../../../Tooltip/Tooltip.js";import{SettingsButton as d}from"../SettingsButton/SettingsButton.js";import"../SettingsButton/SettingsButton.constants.js";import{Menu as j}from"../../../Menu/Menu.js";import"../../../AppCommonsProvider/AppCommonsProvider.js";import{useAppCommonsInternal as I}from"../../../AppCommonsProvider/AppCommonsContext.js";import{useAppSettingsPanel as C}from"../../../AppPanel/AppPanelsContext.js";import{HideInNativeApp as f}from"../../../HideInNativeApp/index.js";import{ActionsTestIds as h}from"./Actions.constants.js";import b from"./Actions.scss.js";import{CollapseIcon as g,ExpandIcon as y,CloseSmallIcon as O,MoreOneIcon as v,MessageIcon as A,SettingTwoIcon as B}from"../../../../icons/iconParkIcons.js";import{AddMessageCustomIcon as P}from"../../../../icons/customIcons/icons/AddMessage.js";import"../../../../icons/customIcons/icons/DragOne.js";import"../../../../icons/customIcons/icons/Attention.js";import"../../../../icons/customIcons/icons/Collapse.js";import"../../../../icons/customIcons/icons/Dashboard.js";import"../../../../icons/customIcons/icons/Expand.js";import"../../../../icons/customIcons/icons/FolderClosed.js";import"../../../../icons/customIcons/icons/FolderClosedFilled.js";import"../../../../icons/customIcons/icons/FolderOpened.js";import"../../../../icons/customIcons/icons/GreaterOrEqual.js";import"../../../../icons/customIcons/icons/LessOrEqual.js";import"../../../../icons/customIcons/icons/Search.js";import"../../../../icons/customIcons/icons/SearchOne.js";import"../../../../icons/customIcons/icons/Wellhub.js";import"../../../../icons/customIcons/icons/MultiRuler.js";import"../../../../icons/customIcons/icons/Checkbox.js";import"../../../../icons/customIcons/icons/CheckboxChecked.js";import"../../../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../../../icons/customIcons/icons/Radio.js";import"../../../../icons/customIcons/icons/RadioChecked.js";import"../../../../icons/customIcons/icons/SimulFrac.js";import"../../../../icons/customIcons/icons/ZipperFrac.js";import"../../../../icons/customIcons/icons/CautionFilled.js";import"../../../../icons/customIcons/icons/InfoRounded.js";import"../../../../icons/customIcons/icons/FlameFilled.js";import"../../../../icons/customIcons/icons/MoreApp.js";import"../../../../icons/customIcons/icons/Pad.js";import"../../../../icons/customIcons/icons/DrilloutUnit.js";import"../../../../icons/customIcons/icons/FracFleet.js";import"../../../../icons/customIcons/icons/Global.js";import"../../../../icons/customIcons/icons/Program.js";import"../../../../icons/customIcons/icons/Rig.js";import"../../../../icons/customIcons/icons/Well.js";import"../../../../icons/customIcons/icons/Gap.js";import"../../../../icons/customIcons/icons/Pin.js";import"../../../../icons/customIcons/icons/PinOne.js";import"../../../../icons/customIcons/icons/PinOneCrossed.js";import"../../../../icons/customIcons/icons/CloseOneFilled.js";import"../../../../icons/customIcons/icons/AttentionFilled.js";import"../../../../icons/customIcons/icons/CheckOneFilled.js";import"../../../../icons/customIcons/icons/Archive.js";import"../../../../icons/customIcons/icons/ArchiveCancel.js";import"../../../../icons/customIcons/icons/Unarchive.js";import"../../../../icons/customIcons/icons/Archived.js";import"../../../../icons/customIcons/icons/InterventionUnit.js";import"../../../../icons/customIcons/icons/CloudDelete.js";import"../../../../icons/customIcons/icons/Lasso.js";import"../../../../icons/customIcons/icons/Radius.js";import"../../../../icons/customIcons/icons/ErrorOps.js";import"../../../../icons/customIcons/icons/DataTypeOps.js";import"../../../../icons/customIcons/icons/FalsePositiveOps.js";import"../../../../icons/customIcons/icons/CalibrationOps.js";import"../../../../icons/customIcons/icons/CriticalOps.js";import"../../../../icons/customIcons/icons/Company.js";import"../../../../icons/customIcons/icons/ArchiveOne.js";import"../../../../icons/customIcons/icons/ParseBotFusion.js";import"../../../../icons/customIcons/icons/Connect.js";import"../../../../icons/customIcons/icons/PuzzleOne.js";import"../../../../icons/customIcons/icons/Feed.js";import"../../../../icons/customIcons/icons/Prompt.js";import"../../../../icons/customIcons/icons/Companies.js";import"../../../../icons/customIcons/icons/ClipboardAi.js";import"../../../../icons/customIcons/icons/Key.js";import"../../../../icons/customIcons/icons/AtSignCrossed.js";import"../../../../icons/customIcons/icons/MappingManual.js";import"../../../../icons/customIcons/icons/Mapping.js";import"../../../../icons/customIcons/icons/Metrics.js";import"../../../../icons/customIcons/icons/Drops.js";import"../../../../icons/customIcons/icons/ClipboardSearch.js";import"../../../../icons/customIcons/icons/Template.js";import"../../../../icons/customIcons/icons/ClipboardMetrics.js";import"../../../../icons/customIcons/icons/ClipboardBuilder.js";import"../../../../icons/customIcons/icons/UnitConversion.js";import"../../../../icons/customIcons/icons/NPT.js";import"../../../../icons/customIcons/icons/GuidedFrac.js";import"../../../../clients/subscriptions/constants.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"querystring";import"uuid/v1";import"lodash";import"../../../../clients/subscriptions.v1.js";import"../../../../clients/jsonApi/index.js";import"../../../../clients/subscriptions/subscriptions-client.factory.js";import"immutable";import"query-string";import"../../../../constants/goals.js";import"../../../../constants/segment.js";import"../../../../constants/alerts.js";import"../../../../constants/apps.js";import"../../../../constants/drillstring.js";import"../../../../constants/completion.js";import"../../../../constants/appPackages.js";import"../../../../constants/notifications.js";import"../../../../constants/feed.js";import"../../../../constants/bha.js";import"../../../../constants/corvaCompanyId.js";import"../../../../components/GradientManager/configuration/constants.js";import"../../../../utils/index.js";import"uuid";import"jsona";import"../../../../utils/env.js";import"../../../../components/StatusBadge/constants.js";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../../../clients/api/apiCore.js";import"../../../../clients/constants.js";import"../../../../clients/sso/auth0.js";import"../../../../clients/sso/oauth2.js";import"../../../../clients/api/rateLimiter.js";import"lodash/isEmpty";import"lodash/sortBy";import"../../../../constants/streamSourceType.js";import{useAppCommentsMode as S,useSetAppCommentsMode as k}from"../../../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js";import{isInsideNewMobileApp as F}from"../../../../utils/mobileDetect.js";import{jsx as M,jsxs as x,Fragment as w}from"react/jsx-runtime";function T(o,s){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);s&&(t=t.filter((function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable}))),n.push.apply(n,t)}return n}function D(o){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?T(Object(t),!0).forEach((function(n){s(o,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):T(Object(t)).forEach((function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))}))}return o}var z=function(o){return!!o&&"object"===t(o)&&"title"in o},E=function(s){var t=s.additionalActions,T=s.showComments,E=s.disableSettings,W=s.hideSettingsUnderMore,N=I(),R=N.maximized,U=N.setMaximized,G=N.appSettingsComponent,q=N.isExpanded,L=N.isBrowserFullscreen,H=N.enterBrowserFullscreen,K=N.exitBrowserFullscreen,Z=N.isSeparateWindow,J=N.openSeparateWindow,Q=N.closeSeparateWindow,V=S(),X=k(),Y=i(!1),$=n(Y,2),_=$[0],oo=$[1],so=c(null),no=c(null),to=i(!0),io=n(to,2),co=io[0],eo=io[1],ro=i(!1),mo=n(ro,2),po=mo[0],lo=mo[1],uo=c(null),ao=c(!1),jo=C(),Io=jo.open,Co=jo.isOpen,fo=!!G&&!E,ho=e((function(){oo((function(o){return!o}))}),[]),bo=e((function(){X((function(o){return!o}))}),[X]),go=e((function(){ao.current=!1,lo(!1)}),[]),yo=e((function(){eo(!1),go(),Z?null==Q||Q():L?null==K||K():U(!R)}),[go,Q,K,L,Z,R,U]),Oo=Z?"Close Separate Window":q?"Restore":"Maximize",vo=e((function(){uo.current&&(clearTimeout(uo.current),uo.current=null)}),[]),Ao=e((function(){!q&&H&&(vo(),uo.current=setTimeout((function(){ao.current=!0,lo(!0)}),500))}),[vo,H,q]);r((function(){return vo}),[vo]);var Bo=e((function(){ao.current?ao.current=!1:yo()}),[yo]),Po=e((function(){go(),null==J||J()}),[go,J]),So=e((function(){go(),null==H||H()}),[go,H]);r((function(){eo(!0)}),[q]);var ko=m((function(){if(F)return[];var s=function(o){return function(){ho(),null==o||o()}},n=(t||[]).filter(z).map((function(o){return D(D({},o),{},{onClick:s(o.onClick)})})),i={icon:M(A,{}),onClick:s(bo),title:V?"Close Comments Mode":"Add Comment"},c={title:Oo,onClick:s(yo),icon:M(q?g:y,{})},e={title:"Settings",onClick:s(Io),icon:M(B,{})};return[].concat(o(n),o(T?[i]:[]),o(W&&fo?[e]:[]),[c])}),[t,V,W,q,Oo,Io,fo,T,bo,yo,ho]),Fo=ko.length>1,Mo=M(u,{size:"small",type:"tertiaryBg",ref:no,onClick:Bo,onMouseDown:Ao,onMouseUp:vo,onMouseLeave:vo,className:Fo?b.fullscreenButton:void 0,testId:q?h.CollapseButtonTestId:h.ExpandButtonTestId,children:M(q?g:y,{})});return x(w,{children:[M(f,{children:null==t?void 0:t.map((function(o,s){return z(o)?M(a,{title:o.title,children:M(u,{size:"small",type:"tertiary",onClick:o.onClick,className:l(b.additionalActionButton),testId:h.AdditionalActionItemTestId,children:o.icon})},s):M(p,{children:o},s)}))}),M(f,{children:T&&M(a,{title:V?"Close Comments Mode":"Add Comment",children:M(u,{size:"small",type:V?"secondaryBg":"tertiaryBg",onClick:bo,className:Fo?b.commentButton:void 0,testId:V?h.CloseCommentButtonTestId:h.AddMessageButtonTestId,children:V?M(O,{}):M(P,{fill:"currentColor"})})})}),fo&&M(d,{className:W&&!F?b.settingsHiddenUnderMore:void 0}),x(f,{children:[co?M(a,{title:Oo,children:Mo}):Mo,no.current&&x(j,{anchorEl:no.current,open:po,onClose:go,placement:"bottom-end",children:[M(j.Item,{onClick:yo,testId:h.MaximizeItemTestId,children:"Maximize"}),M(j.Item,{onClick:So,testId:h.BrowserFullscreenItemTestId,children:"Full Screen"}),M(j.Item,{onClick:Po,testId:h.SeparateWindowItemTestId,children:"Separate Window"})]})]}),x(f,{children:[Fo&&M(a,{title:"More",children:M(u,{type:_||W&&Co?"secondaryBg":"tertiaryBg",className:b.moreButton,ref:so,onClick:ho,size:"small",children:M(v,{})})}),Fo&&so.current&&M(j,{anchorEl:so.current,open:_,onClose:ho,placement:"bottom-end",children:ko.map((function(o,s){return M(j.Item,{size:"large",prefix:o.icon,onClick:o.onClick,children:o.title},s)}))})]})]})};export{E as Actions};
|
|
1
|
+
import o from"@babel/runtime/helpers/toConsumableArray";import s from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/typeof";import{useState as i,useRef as c,useCallback as e,useEffect as r,useMemo as m,Fragment as p}from"react";import l from"classnames";import{ButtonIcon as u}from"../../../ButtonIcon/ButtonIcon.js";import{Tooltip as a}from"../../../Tooltip/Tooltip.js";import{SettingsButton as d}from"../SettingsButton/SettingsButton.js";import"../SettingsButton/SettingsButton.constants.js";import{Menu as j}from"../../../Menu/Menu.js";import"../../../AppCommonsProvider/AppCommonsProvider.js";import{useAppCommonsInternal as I}from"../../../AppCommonsProvider/AppCommonsContext.js";import{useAppSettingsPanel as C}from"../../../AppPanel/AppPanelsContext.js";import{HideInNativeApp as f}from"../../../HideInNativeApp/index.js";import{ActionsTestIds as h}from"./Actions.constants.js";import b from"./Actions.scss.js";import{CollapseIcon as g,ExpandIcon as y,CloseSmallIcon as O,MoreOneIcon as v,MessageIcon as A,SettingTwoIcon as B}from"../../../../icons/iconParkIcons.js";import{AddMessageCustomIcon as M}from"../../../../icons/customIcons/icons/AddMessage.js";import"../../../../icons/customIcons/icons/DragOne.js";import"../../../../icons/customIcons/icons/Attention.js";import"../../../../icons/customIcons/icons/Collapse.js";import"../../../../icons/customIcons/icons/Dashboard.js";import"../../../../icons/customIcons/icons/Expand.js";import"../../../../icons/customIcons/icons/FolderClosed.js";import"../../../../icons/customIcons/icons/FolderClosedFilled.js";import"../../../../icons/customIcons/icons/FolderOpened.js";import"../../../../icons/customIcons/icons/GreaterOrEqual.js";import"../../../../icons/customIcons/icons/LessOrEqual.js";import"../../../../icons/customIcons/icons/Search.js";import"../../../../icons/customIcons/icons/SearchOne.js";import"../../../../icons/customIcons/icons/Wellhub.js";import"../../../../icons/customIcons/icons/MultiRuler.js";import"../../../../icons/customIcons/icons/Checkbox.js";import"../../../../icons/customIcons/icons/CheckboxChecked.js";import"../../../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../../../icons/customIcons/icons/Radio.js";import"../../../../icons/customIcons/icons/RadioChecked.js";import"../../../../icons/customIcons/icons/SimulFrac.js";import"../../../../icons/customIcons/icons/ZipperFrac.js";import"../../../../icons/customIcons/icons/CautionFilled.js";import"../../../../icons/customIcons/icons/InfoRounded.js";import"../../../../icons/customIcons/icons/FlameFilled.js";import"../../../../icons/customIcons/icons/MoreApp.js";import"../../../../icons/customIcons/icons/Pad.js";import"../../../../icons/customIcons/icons/DrilloutUnit.js";import"../../../../icons/customIcons/icons/FracFleet.js";import"../../../../icons/customIcons/icons/Global.js";import"../../../../icons/customIcons/icons/Program.js";import"../../../../icons/customIcons/icons/Rig.js";import"../../../../icons/customIcons/icons/Well.js";import"../../../../icons/customIcons/icons/Gap.js";import"../../../../icons/customIcons/icons/Pin.js";import"../../../../icons/customIcons/icons/PinOne.js";import"../../../../icons/customIcons/icons/PinOneCrossed.js";import"../../../../icons/customIcons/icons/CloseOneFilled.js";import"../../../../icons/customIcons/icons/AttentionFilled.js";import"../../../../icons/customIcons/icons/CheckOneFilled.js";import"../../../../icons/customIcons/icons/Archive.js";import"../../../../icons/customIcons/icons/ArchiveCancel.js";import"../../../../icons/customIcons/icons/Unarchive.js";import"../../../../icons/customIcons/icons/Archived.js";import"../../../../icons/customIcons/icons/InterventionUnit.js";import"../../../../icons/customIcons/icons/CloudDelete.js";import"../../../../icons/customIcons/icons/Lasso.js";import"../../../../icons/customIcons/icons/Radius.js";import"../../../../icons/customIcons/icons/ErrorOps.js";import"../../../../icons/customIcons/icons/DataTypeOps.js";import"../../../../icons/customIcons/icons/FalsePositiveOps.js";import"../../../../icons/customIcons/icons/CalibrationOps.js";import"../../../../icons/customIcons/icons/CriticalOps.js";import"../../../../icons/customIcons/icons/Company.js";import"../../../../icons/customIcons/icons/ArchiveOne.js";import"../../../../icons/customIcons/icons/ParseBotFusion.js";import"../../../../icons/customIcons/icons/Connect.js";import"../../../../icons/customIcons/icons/PuzzleOne.js";import"../../../../icons/customIcons/icons/Feed.js";import"../../../../icons/customIcons/icons/Prompt.js";import"../../../../icons/customIcons/icons/Companies.js";import"../../../../icons/customIcons/icons/ClipboardAi.js";import"../../../../icons/customIcons/icons/Key.js";import"../../../../icons/customIcons/icons/AtSignCrossed.js";import"../../../../icons/customIcons/icons/MappingManual.js";import"../../../../icons/customIcons/icons/Mapping.js";import"../../../../icons/customIcons/icons/Metrics.js";import"../../../../icons/customIcons/icons/Drops.js";import"../../../../icons/customIcons/icons/ClipboardSearch.js";import"../../../../icons/customIcons/icons/Template.js";import"../../../../icons/customIcons/icons/ClipboardMetrics.js";import"../../../../icons/customIcons/icons/ClipboardBuilder.js";import"../../../../icons/customIcons/icons/UnitConversion.js";import"../../../../icons/customIcons/icons/NPT.js";import"../../../../icons/customIcons/icons/GuidedFrac.js";import"../../../../clients/subscriptions/constants.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"querystring";import"uuid/v1";import"lodash";import"../../../../clients/subscriptions.v1.js";import"../../../../clients/jsonApi/index.js";import"../../../../clients/subscriptions/subscriptions-client.factory.js";import"immutable";import"query-string";import"../../../../constants/goals.js";import"../../../../constants/segment.js";import"../../../../constants/alerts.js";import"../../../../constants/apps.js";import"../../../../constants/drillstring.js";import"../../../../constants/completion.js";import"../../../../constants/appPackages.js";import"../../../../constants/notifications.js";import"../../../../constants/feed.js";import"../../../../constants/bha.js";import"../../../../constants/corvaCompanyId.js";import"../../../../components/GradientManager/configuration/constants.js";import"../../../../utils/index.js";import"uuid";import"jsona";import"../../../../utils/env.js";import"../../../../components/StatusBadge/constants.js";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../../../clients/api/apiCore.js";import"../../../../clients/constants.js";import"../../../../clients/sso/auth0.js";import"../../../../clients/sso/oauth2.js";import"../../../../clients/api/rateLimiter.js";import"lodash/isEmpty";import"lodash/sortBy";import"../../../../constants/streamSourceType.js";import{useAppCommentsMode as P,useSetAppCommentsMode as S}from"../../../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js";import{isInsideNewMobileApp as k}from"../../../../utils/mobileDetect.js";import{jsx as F,jsxs as x,Fragment as w}from"react/jsx-runtime";function T(o,s){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);s&&(t=t.filter((function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable}))),n.push.apply(n,t)}return n}function D(o){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?T(Object(t),!0).forEach((function(n){s(o,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):T(Object(t)).forEach((function(s){Object.defineProperty(o,s,Object.getOwnPropertyDescriptor(t,s))}))}return o}var z=function(o){return!!o&&"object"===t(o)&&"title"in o},E=function(s){var t=s.additionalActions,T=s.showComments,E=s.disableSettings,W=s.hideSettingsUnderMore,N=I(),R=N.maximized,U=N.setMaximized,G=N.appSettingsComponent,q=N.isExpanded,L=N.isBrowserFullscreen,H=N.enterBrowserFullscreen,K=N.exitBrowserFullscreen,Z=N.isSeparateWindow,J=N.openSeparateWindow,Q=N.closeSeparateWindow,V=N.dashboardMeta,X=!(null==V||!V.isEmbedded),Y=P(),$=S(),_=i(!1),oo=n(_,2),so=oo[0],no=oo[1],to=c(null),io=c(null),co=i(!0),eo=n(co,2),ro=eo[0],mo=eo[1],po=i(!1),lo=n(po,2),uo=lo[0],ao=lo[1],jo=c(null),Io=c(!1),Co=C(),fo=Co.open,ho=Co.isOpen,bo=!!G&&!E,go=e((function(){no((function(o){return!o}))}),[]),yo=e((function(){$((function(o){return!o}))}),[$]),Oo=e((function(){Io.current=!1,ao(!1)}),[]),vo=e((function(){mo(!1),Oo(),Z?null==Q||Q():L?null==K||K():U(!R)}),[Oo,Q,K,L,Z,R,U]),Ao=Z?"Close Separate Window":q?"Restore":"Maximize",Bo=e((function(){jo.current&&(clearTimeout(jo.current),jo.current=null)}),[]),Mo=e((function(){!q&&H&&(Bo(),jo.current=setTimeout((function(){Io.current=!0,ao(!0)}),500))}),[Bo,H,q]);r((function(){return Bo}),[Bo]);var Po=e((function(){Io.current?Io.current=!1:vo()}),[vo]),So=e((function(){Oo(),null==J||J()}),[Oo,J]),ko=e((function(){Oo(),null==H||H()}),[Oo,H]);r((function(){mo(!0)}),[q]);var Fo=m((function(){if(k)return[];var s=function(o){return function(){go(),null==o||o()}},n=(t||[]).filter(z).map((function(o){return D(D({},o),{},{onClick:s(o.onClick)})})),i={icon:F(A,{}),onClick:s(yo),title:Y?"Close Comments Mode":"Add Comment"},c={title:Ao,onClick:s(vo),icon:F(q?g:y,{})},e={title:"Settings",onClick:s(fo),icon:F(B,{})};return[].concat(o(n),o(T?[i]:[]),o(W&&bo?[e]:[]),o(X?[]:[c]))}),[t,Y,W,q,Ao,fo,bo,T,X,yo,vo,go]),xo=Fo.length>(X?0:1),wo=F(u,{size:"small",type:"tertiaryBg",ref:io,onClick:Po,onMouseDown:Mo,onMouseUp:Bo,onMouseLeave:Bo,className:xo?b.fullscreenButton:void 0,testId:q?h.CollapseButtonTestId:h.ExpandButtonTestId,children:F(q?g:y,{})}),To=ro?F(a,{title:Ao,children:wo}):wo;return x(w,{children:[F(f,{children:null==t?void 0:t.map((function(o,s){return z(o)?F(a,{title:o.title,children:F(u,{size:"small",type:"tertiary",onClick:o.onClick,className:l(b.additionalActionButton),testId:h.AdditionalActionItemTestId,children:o.icon})},s):F(p,{children:o},s)}))}),F(f,{children:T&&F(a,{title:Y?"Close Comments Mode":"Add Comment",children:F(u,{size:"small",type:Y?"secondaryBg":"tertiaryBg",onClick:yo,className:xo?b.commentButton:void 0,testId:Y?h.CloseCommentButtonTestId:h.AddMessageButtonTestId,children:Y?F(O,{}):F(M,{fill:"currentColor"})})})}),bo&&F(d,{className:W&&!k?b.settingsHiddenUnderMore:void 0}),x(f,{children:[!X&&To,!X&&io.current&&x(j,{anchorEl:io.current,open:uo,onClose:Oo,placement:"bottom-end",children:[F(j.Item,{onClick:vo,testId:h.MaximizeItemTestId,children:"Maximize"}),F(j.Item,{onClick:ko,testId:h.BrowserFullscreenItemTestId,children:"Full Screen"}),F(j.Item,{onClick:So,testId:h.SeparateWindowItemTestId,children:"Separate Window"})]})]}),x(f,{children:[xo&&F(a,{title:"More",children:F(u,{type:so||W&&ho?"secondaryBg":"tertiaryBg",className:b.moreButton,ref:to,testId:h.MoreButtonTestId,onClick:go,size:"small",children:F(v,{})})}),xo&&to.current&&F(j,{anchorEl:to.current,open:so,onClose:go,placement:"bottom-end",children:Fo.map((function(o,s){return F(j.Item,{size:"large",prefix:o.icon,onClick:o.onClick,children:o.title},s)}))})]})]})};export{E as Actions};
|
|
2
2
|
//# sourceMappingURL=Actions.js.map
|