@corva/ui 3.76.0-7 → 3.76.0-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
  2. package/cjs-bundle/componentsV2/AppCommonsProvider/AppCommonsContext.js.map +1 -1
  3. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.constants.js +1 -1
  4. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.constants.js.map +1 -1
  5. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
  6. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js.map +1 -1
  7. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
  8. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js.map +1 -1
  9. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
  10. package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
  11. package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
  12. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts +2 -9
  13. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts.map +1 -1
  14. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
  15. package/componentsV2/AppCommonsProvider/AppCommonsContext.d.ts +19 -6
  16. package/componentsV2/AppCommonsProvider/AppCommonsContext.d.ts.map +1 -1
  17. package/componentsV2/AppCommonsProvider/AppCommonsContext.js.map +1 -1
  18. package/componentsV2/AppHeader/V3/Actions/Actions.constants.d.ts +1 -0
  19. package/componentsV2/AppHeader/V3/Actions/Actions.constants.d.ts.map +1 -1
  20. package/componentsV2/AppHeader/V3/Actions/Actions.constants.js +1 -1
  21. package/componentsV2/AppHeader/V3/Actions/Actions.constants.js.map +1 -1
  22. package/componentsV2/AppHeader/V3/Actions/Actions.d.ts.map +1 -1
  23. package/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
  24. package/componentsV2/AppHeader/V3/Actions/Actions.js.map +1 -1
  25. package/componentsV2/AppHeader/V3/AppHeaderV3.d.ts.map +1 -1
  26. package/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
  27. package/componentsV2/AppHeader/V3/AppHeaderV3.js.map +1 -1
  28. package/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
  29. package/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
  30. package/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
  31. package/mcp-server/server.mjs +2 -2
  32. package/package.json +1 -1
  33. 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":["_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","jsx","DevCenterRouterContext","Provider","value","children","DcFullscreenElemsCoordinatorProvider","AppCommonsProvider","maximized","setMaximized","appSettings","settings","appHeadersV3Enabled","appSettingsComponent","isInsideNewMobileApp","globalOffsetWells","globalOffsetWellsVersion","globalOffsetWellsToken","CommentsSwitchProvider","_jsxs","jsxs","classNames","isLightTheme","styles","container","PAGE_NAME","ToastContainer","containerContent","DevCenterAppView","availability","getAppAvailability","company","with_subscription","appHash","DevCenterAppDialogs","RestoreAppSizeButton","LegacyAppActions"],"mappings":"q5gBA4H8D,SAsCxDA,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAzCqCC,EAIzCC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,IACAC,IAAAA,MACAC,IAAAA,UACAC,IAAAA,YACAC,IAAAA,oCACAC,IAAAA,YACAC,IAAAA,gBACAC,IAAAA,yBACAC,IAAAA,kBACAC,IAAAA,oBACAC,IAAAA,uBACAC,IAAAA,sBACAC,IAAAA,iBACAC,IAAAA,mBACAC,IAAAA,oBACAC,KAAAA,uBAAsBC,GAAA1B,EACtB2B,iBAAAA,gBAAwBD,GACxBE,KAAAA,uBACAC,KAAAA,kBAAiBC,GAAA9B,EACjB+B,oBAAAA,eAAsBC,EAAIA,KAAAF,GAC1BG,KAAAA,YACAC,KAAAA,iBACAC,KAAAA,iBACAC,KAAAA,kBACAC,KAAAA,oBAAmBC,GAAAtC,EACnBuC,gBAAAA,eAAkBP,EAAIA,KAAAM,GAAAE,GAAAxC,EACtByC,iBAAAA,eAAmBT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AAaA,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":["_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","jsx","DevCenterRouterContext","Provider","value","children","DcFullscreenElemsCoordinatorProvider","AppCommonsProvider","maximized","setMaximized","appSettings","settings","appHeadersV3Enabled","appSettingsComponent","isInsideNewMobileApp","globalOffsetWells","globalOffsetWellsVersion","globalOffsetWellsToken","CommentsSwitchProvider","_jsxs","jsxs","classNames","isLightTheme","styles","container","PAGE_NAME","ToastContainer","containerContent","DevCenterAppView","availability","getAppAvailability","company","with_subscription","appHash","DevCenterAppDialogs","RestoreAppSizeButton","LegacyAppActions"],"mappings":"q5gBAqH8D,SAsCxDA,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAzCqCC,EAIzCC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,IACAC,IAAAA,MACAC,IAAAA,UACAC,IAAAA,YACAC,IAAAA,oCACAC,IAAAA,YACAC,IAAAA,gBACAC,IAAAA,yBACAC,IAAAA,kBACAC,IAAAA,oBACAC,IAAAA,uBACAC,IAAAA,sBACAC,IAAAA,iBACAC,IAAAA,mBACAC,IAAAA,oBACAC,KAAAA,uBAAsBC,GAAA1B,EACtB2B,iBAAAA,gBAAwBD,GACxBE,KAAAA,uBACAC,KAAAA,kBAAiBC,GAAA9B,EACjB+B,oBAAAA,eAAsBC,EAAIA,KAAAF,GAC1BG,KAAAA,YACAC,KAAAA,iBACAC,KAAAA,iBACAC,KAAAA,kBACAC,KAAAA,oBAAmBC,GAAAtC,EACnBuC,gBAAAA,eAAkBP,EAAIA,KAAAM,GAAAE,GAAAxC,EACtByC,iBAAAA,eAAmBT,EAAIA,KAAAQ,GAAAE,GAAA1C,EACvB2C,aAAAA,eAAeX,EAAIA,KAAAU,GACnBE,KAAAA,gBAAeC,GAAA7C,EACf8C,yBAAAA,eAA2Bd,EAAIA,KAAAa,GAC/BE,KAAAA,UACAC,KAAAA,wCACAC,KAAAA,cACAC,KAAAA,UACAC,KAAAA,YAKMC,GAAqDC,aAAWC,GAChEC,GAAQC,EAAAA,WACRC,GAAeC,EAAgBA,kBAAIC,mBACCC,GAAAA,EAAQA,SAAsB,IAAGC,GAAAC,EAAAA,QAAAC,GAAA,GAApEC,GAAaH,GAAA,GAAEI,GAAgBJ,GAAA,GACcD,GAAAA,EAAQA,SAAsB,IAAGM,GAAAJ,EAAAA,QAAAK,G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9BvK,EAAIsK,aACJjK,EAAYmK,QAAQC,mBAEtBlF,SAAUA,GACVvB,UAAWA,GACXO,WAAYA,GACZpD,kBAAmBA,SAAAA,GAAqB,KACxCc,aAAcA,GACdmC,QAASA,GACToC,wBAAyBA,GACzB+B,SAAUA,IAfLzE,GAAQ4G,WAkBjBjC,MAACkC,sBAAmB,CAClB3K,IAAKA,EACL8D,QAASA,GACTe,QAASA,GACTyE,qBAAsBnD,GACtBa,eAAgBA,GAChBC,qBAAsBA,GACtB5G,YAAaA,EACbE,yBAA0BA,EAC1BoG,wBAAyBA,GACzBJ,0BAA2BA,GAC3BhC,WAAYA,GACZrD,uBAAwBA,GACxBC,kBAAmBA,GACnBI,YAAaA,GACbE,iBAAkBA,GAClBM,iBAAkBA,GAClBE,aAAcA,GACd2E,sBAAuBA,GACvBJ,wBAAyBA,KAE1BvB,KAAgBgD,IACfQ,EAAAA,IAACmC,EAAoB,CAAC1F,eAAgBA,MAGtC1E,KAAuByH,IAAyBjE,KAChDyE,EAAAC,IAACmC,mBAAgB,CACf7K,IAAKA,EACLK,YAAaA,EACbC,gBAAiBA,EACjB4G,uBAAwBA,GACxB3B,SAAUA,GACVZ,kBAAmBA,GACnB4E,qBAAsBA,EAAqBA,qBAC3CtE,YAAaA,GACblC,aAAcA,GACdO,cAAeA,GACfI,mBAAoBA,GACpBhC,kBAAmBA,GACnBF,iBAAkBA,GAClBY,yBAA0BA,GAC1B8C,eAAgBA,GAChB0B,sBAAuBA,GACvBJ,wBAAyBA,gBAS3C"}
@@ -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?: {\n isMultiAsset?: boolean;\n isMultiWell?: boolean;\n isChiplessDashboard?: boolean;\n globalOffsetWellsToken?: number;\n };\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","useContext"],"mappings":"2FAwEaA,EAAoBC,EAAaA,cAE5C,wDAK2B,WAAH,OAASC,EAAAA,WAAWF,EAAkB,gCAF3B,WAAH,OAASE,EAAAA,WAAWF,EAAkB"}
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","useContext"],"mappings":"2FAuFaA,EAAoBC,EAAaA,cAE5C,wDAK2B,WAAH,OAASC,EAAAA,WAAWF,EAAkB,gCAF3B,WAAH,OAASE,EAAAA,WAAWF,EAAkB"}
@@ -1,2 +1,2 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ActionsTestIds=void 0,(e=exports.ActionsTestIds||(exports.ActionsTestIds={})).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";
1
+ "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ActionsTestIds=void 0,(e=exports.ActionsTestIds||(exports.ActionsTestIds={})).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";
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":"aASC,IATWA,yDAAAA,QAAcA,oBAAA,GAAdA,EAAAA,QAAcA,iBAAdA,uBAAc,CAAA,IAAA,qBAAA,iDAAdA,EAAc,mBAAA,+CAAdA,EAAc,2BAAA,uDAAdA,EAAc,yBAAA,qDAAdA,EAAc,uBAAA,mDAAdA,EAAc,mBAAA,+CAAdA,EAAc,4BAAA,wDAAdA,EAAc,yBAAA"}
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":"aAUC,IAVWA,yDAAAA,QAAcA,oBAAA,GAAdA,EAAAA,QAAcA,iBAAdA,uBAAc,CAAA,IAAA,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"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),s=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/helpers/slicedToArray"),o=require("@babel/runtime/helpers/typeof"),i=require("react"),r=require("classnames"),c=require("../../../ButtonIcon/ButtonIcon.js"),t=require("../../../Tooltip/Tooltip.js"),u=require("../SettingsButton/SettingsButton.js");require("../SettingsButton/SettingsButton.constants.js");var l=require("../../../Menu/Menu.js");require("../../../AppCommonsProvider/AppCommonsProvider.js");var a=require("../../../AppCommonsProvider/AppCommonsContext.js"),m=require("../../../AppPanel/AppPanelsContext.js"),d=require("../../../HideInNativeApp/index.js"),j=require("./Actions.constants.js"),p=require("./Actions.scss.js"),q=require("../../../../icons/iconParkIcons.js"),I=require("../../../../icons/customIcons/icons/AddMessage.js");require("../../../../icons/customIcons/icons/DragOne.js"),require("../../../../icons/customIcons/icons/Attention.js"),require("../../../../icons/customIcons/icons/Collapse.js"),require("../../../../icons/customIcons/icons/Dashboard.js"),require("../../../../icons/customIcons/icons/Expand.js"),require("../../../../icons/customIcons/icons/FolderClosed.js"),require("../../../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../../../icons/customIcons/icons/FolderOpened.js"),require("../../../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../../../icons/customIcons/icons/LessOrEqual.js"),require("../../../../icons/customIcons/icons/Search.js"),require("../../../../icons/customIcons/icons/SearchOne.js"),require("../../../../icons/customIcons/icons/Wellhub.js"),require("../../../../icons/customIcons/icons/MultiRuler.js"),require("../../../../icons/customIcons/icons/Checkbox.js"),require("../../../../icons/customIcons/icons/CheckboxChecked.js"),require("../../../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../../../icons/customIcons/icons/Radio.js"),require("../../../../icons/customIcons/icons/RadioChecked.js"),require("../../../../icons/customIcons/icons/SimulFrac.js"),require("../../../../icons/customIcons/icons/ZipperFrac.js"),require("../../../../icons/customIcons/icons/CautionFilled.js"),require("../../../../icons/customIcons/icons/InfoRounded.js"),require("../../../../icons/customIcons/icons/FlameFilled.js"),require("../../../../icons/customIcons/icons/MoreApp.js"),require("../../../../icons/customIcons/icons/Pad.js"),require("../../../../icons/customIcons/icons/DrilloutUnit.js"),require("../../../../icons/customIcons/icons/FracFleet.js"),require("../../../../icons/customIcons/icons/Global.js"),require("../../../../icons/customIcons/icons/Program.js"),require("../../../../icons/customIcons/icons/Rig.js"),require("../../../../icons/customIcons/icons/Well.js"),require("../../../../icons/customIcons/icons/Gap.js"),require("../../../../icons/customIcons/icons/Pin.js"),require("../../../../icons/customIcons/icons/PinOne.js"),require("../../../../icons/customIcons/icons/PinOneCrossed.js"),require("../../../../icons/customIcons/icons/CloseOneFilled.js"),require("../../../../icons/customIcons/icons/AttentionFilled.js"),require("../../../../icons/customIcons/icons/CheckOneFilled.js"),require("../../../../icons/customIcons/icons/Archive.js"),require("../../../../icons/customIcons/icons/ArchiveCancel.js"),require("../../../../icons/customIcons/icons/Unarchive.js"),require("../../../../icons/customIcons/icons/Archived.js"),require("../../../../icons/customIcons/icons/InterventionUnit.js"),require("../../../../icons/customIcons/icons/CloudDelete.js"),require("../../../../icons/customIcons/icons/Lasso.js"),require("../../../../icons/customIcons/icons/Radius.js"),require("../../../../icons/customIcons/icons/ErrorOps.js"),require("../../../../icons/customIcons/icons/DataTypeOps.js"),require("../../../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../../../icons/customIcons/icons/CalibrationOps.js"),require("../../../../icons/customIcons/icons/CriticalOps.js"),require("../../../../icons/customIcons/icons/Company.js"),require("../../../../icons/customIcons/icons/ArchiveOne.js"),require("../../../../icons/customIcons/icons/ParseBotFusion.js"),require("../../../../icons/customIcons/icons/Connect.js"),require("../../../../icons/customIcons/icons/PuzzleOne.js"),require("../../../../icons/customIcons/icons/Feed.js"),require("../../../../icons/customIcons/icons/Prompt.js"),require("../../../../icons/customIcons/icons/Companies.js"),require("../../../../icons/customIcons/icons/ClipboardAi.js"),require("../../../../icons/customIcons/icons/Key.js"),require("../../../../icons/customIcons/icons/AtSignCrossed.js"),require("../../../../icons/customIcons/icons/MappingManual.js"),require("../../../../icons/customIcons/icons/Mapping.js"),require("../../../../icons/customIcons/icons/Metrics.js"),require("../../../../icons/customIcons/icons/Drops.js"),require("../../../../icons/customIcons/icons/ClipboardSearch.js"),require("../../../../icons/customIcons/icons/Template.js"),require("../../../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../../../icons/customIcons/icons/UnitConversion.js"),require("../../../../icons/customIcons/icons/NPT.js"),require("../../../../icons/customIcons/icons/GuidedFrac.js"),require("../../../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../../../clients/subscriptions.v1.js"),require("../../../../clients/jsonApi/index.js"),require("../../../../clients/subscriptions/subscriptions-client.factory.js"),require("immutable"),require("query-string"),require("../../../../constants/goals.js"),require("../../../../constants/segment.js"),require("../../../../constants/alerts.js"),require("../../../../constants/apps.js"),require("../../../../constants/drillstring.js"),require("../../../../constants/completion.js"),require("../../../../constants/appPackages.js"),require("../../../../constants/notifications.js"),require("../../../../constants/feed.js"),require("../../../../constants/bha.js"),require("../../../../constants/corvaCompanyId.js"),require("../../../../components/GradientManager/configuration/constants.js"),require("../../../../utils/index.js"),require("uuid"),require("jsona"),require("../../../../utils/env.js"),require("../../../../components/StatusBadge/constants.js"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../../../clients/api/apiCore.js"),require("../../../../clients/constants.js"),require("../../../../clients/sso/auth0.js"),require("../../../../clients/sso/oauth2.js"),require("../../../../clients/api/rateLimiter.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../../../constants/streamSourceType.js");var C=require("../../../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js"),f=require("../../../../utils/mobileDetect.js"),b=require("react/jsx-runtime");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=h(e),A=h(s),g=h(n),v=h(o),M=h(r);function y(e,s){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);s&&(o=o.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),n.push.apply(n,o)}return n}function O(e){for(var s=1;s<arguments.length;s++){var n=null!=arguments[s]?arguments[s]:{};s%2?y(Object(n),!0).forEach((function(s){A.default(e,s,n[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))}))}return e}var S=function(e){return!!e&&"object"===v.default(e)&&"title"in e};exports.Actions=function(e){var s=e.additionalActions,n=e.showComments,o=e.disableSettings,r=e.hideSettingsUnderMore,h=a.useAppCommonsInternal(),A=h.maximized,v=h.setMaximized,y=h.appSettingsComponent,k=h.isExpanded,B=h.isBrowserFullscreen,T=h.enterBrowserFullscreen,P=h.exitBrowserFullscreen,F=h.isSeparateWindow,w=h.openSeparateWindow,E=h.closeSeparateWindow,D=C.useAppCommentsMode(),N=C.useSetAppCommentsMode(),z=i.useState(!1),R=g.default(z,2),W=R[0],U=R[1],G=i.useRef(null),H=i.useRef(null),L=i.useState(!0),_=g.default(L,2),K=_[0],Z=_[1],J=i.useState(!1),Q=g.default(J,2),V=Q[0],X=Q[1],Y=i.useRef(null),$=i.useRef(!1),ee=m.useAppSettingsPanel(),se=ee.open,ne=ee.isOpen,oe=!!y&&!o,ie=i.useCallback((function(){U((function(e){return!e}))}),[]),re=i.useCallback((function(){N((function(e){return!e}))}),[N]),ce=i.useCallback((function(){$.current=!1,X(!1)}),[]),te=i.useCallback((function(){Z(!1),ce(),F?null==E||E():B?null==P||P():v(!A)}),[ce,E,P,B,F,A,v]),ue=F?"Close Separate Window":k?"Restore":"Maximize",le=i.useCallback((function(){Y.current&&(clearTimeout(Y.current),Y.current=null)}),[]),ae=i.useCallback((function(){!k&&T&&(le(),Y.current=setTimeout((function(){$.current=!0,X(!0)}),500))}),[le,T,k]);i.useEffect((function(){return le}),[le]);var me=i.useCallback((function(){$.current?$.current=!1:te()}),[te]),de=i.useCallback((function(){ce(),null==w||w()}),[ce,w]),je=i.useCallback((function(){ce(),null==T||T()}),[ce,T]);i.useEffect((function(){Z(!0)}),[k]);var pe=i.useMemo((function(){if(f.isInsideNewMobileApp)return[];var e=function(e){return function(){ie(),null==e||e()}},o=(s||[]).filter(S).map((function(s){return O(O({},s),{},{onClick:e(s.onClick)})})),i={icon:b.jsx(q.MessageIcon,{}),onClick:e(re),title:D?"Close Comments Mode":"Add Comment"},c={title:ue,onClick:e(te),icon:k?b.jsx(q.CollapseIcon,{}):b.jsx(q.ExpandIcon,{})},t={title:"Settings",onClick:e(se),icon:b.jsx(q.SettingTwoIcon,{})};return[].concat(x.default(o),x.default(n?[i]:[]),x.default(r&&oe?[t]:[]),[c])}),[s,D,r,k,ue,se,oe,n,re,te,ie]),qe=pe.length>1,Ie=b.jsx(c.ButtonIcon,{size:"small",type:"tertiaryBg",ref:H,onClick:me,onMouseDown:ae,onMouseUp:le,onMouseLeave:le,className:qe?p.fullscreenButton:void 0,testId:k?j.ActionsTestIds.CollapseButtonTestId:j.ActionsTestIds.ExpandButtonTestId,children:k?b.jsx(q.CollapseIcon,{}):b.jsx(q.ExpandIcon,{})});return b.jsxs(b.Fragment,{children:[b.jsx(d.HideInNativeApp,{children:null==s?void 0:s.map((function(e,s){return S(e)?b.jsx(t.Tooltip,{title:e.title,children:b.jsx(c.ButtonIcon,{size:"small",type:"tertiary",onClick:e.onClick,className:M.default(p.additionalActionButton),testId:j.ActionsTestIds.AdditionalActionItemTestId,children:e.icon})},s):b.jsx(i.Fragment,{children:e},s)}))}),b.jsx(d.HideInNativeApp,{children:n&&b.jsx(t.Tooltip,{title:D?"Close Comments Mode":"Add Comment",children:b.jsx(c.ButtonIcon,{size:"small",type:D?"secondaryBg":"tertiaryBg",onClick:re,className:qe?p.commentButton:void 0,testId:D?j.ActionsTestIds.CloseCommentButtonTestId:j.ActionsTestIds.AddMessageButtonTestId,children:D?b.jsx(q.CloseSmallIcon,{}):b.jsx(I.AddMessageCustomIcon,{fill:"currentColor"})})})}),oe&&b.jsx(u.SettingsButton,{className:r&&!f.isInsideNewMobileApp?p.settingsHiddenUnderMore:void 0}),b.jsxs(d.HideInNativeApp,{children:[K?b.jsx(t.Tooltip,{title:ue,children:Ie}):Ie,H.current&&b.jsxs(l.Menu,{anchorEl:H.current,open:V,onClose:ce,placement:"bottom-end",children:[b.jsx(l.Menu.Item,{onClick:te,testId:j.ActionsTestIds.MaximizeItemTestId,children:"Maximize"}),b.jsx(l.Menu.Item,{onClick:je,testId:j.ActionsTestIds.BrowserFullscreenItemTestId,children:"Full Screen"}),b.jsx(l.Menu.Item,{onClick:de,testId:j.ActionsTestIds.SeparateWindowItemTestId,children:"Separate Window"})]})]}),b.jsxs(d.HideInNativeApp,{children:[qe&&b.jsx(t.Tooltip,{title:"More",children:b.jsx(c.ButtonIcon,{type:W||r&&ne?"secondaryBg":"tertiaryBg",className:p.moreButton,ref:G,onClick:ie,size:"small",children:b.jsx(q.MoreOneIcon,{})})}),qe&&G.current&&b.jsx(l.Menu,{anchorEl:G.current,open:W,onClose:ie,placement:"bottom-end",children:pe.map((function(e,s){return b.jsx(l.Menu.Item,{size:"large",prefix:e.icon,onClick:e.onClick,children:e.title},s)}))})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),s=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/helpers/slicedToArray"),o=require("@babel/runtime/helpers/typeof"),i=require("react"),r=require("classnames"),c=require("../../../ButtonIcon/ButtonIcon.js"),t=require("../../../Tooltip/Tooltip.js"),u=require("../SettingsButton/SettingsButton.js");require("../SettingsButton/SettingsButton.constants.js");var l=require("../../../Menu/Menu.js");require("../../../AppCommonsProvider/AppCommonsProvider.js");var a=require("../../../AppCommonsProvider/AppCommonsContext.js"),m=require("../../../AppPanel/AppPanelsContext.js"),d=require("../../../HideInNativeApp/index.js"),j=require("./Actions.constants.js"),p=require("./Actions.scss.js"),q=require("../../../../icons/iconParkIcons.js"),I=require("../../../../icons/customIcons/icons/AddMessage.js");require("../../../../icons/customIcons/icons/DragOne.js"),require("../../../../icons/customIcons/icons/Attention.js"),require("../../../../icons/customIcons/icons/Collapse.js"),require("../../../../icons/customIcons/icons/Dashboard.js"),require("../../../../icons/customIcons/icons/Expand.js"),require("../../../../icons/customIcons/icons/FolderClosed.js"),require("../../../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../../../icons/customIcons/icons/FolderOpened.js"),require("../../../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../../../icons/customIcons/icons/LessOrEqual.js"),require("../../../../icons/customIcons/icons/Search.js"),require("../../../../icons/customIcons/icons/SearchOne.js"),require("../../../../icons/customIcons/icons/Wellhub.js"),require("../../../../icons/customIcons/icons/MultiRuler.js"),require("../../../../icons/customIcons/icons/Checkbox.js"),require("../../../../icons/customIcons/icons/CheckboxChecked.js"),require("../../../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../../../icons/customIcons/icons/Radio.js"),require("../../../../icons/customIcons/icons/RadioChecked.js"),require("../../../../icons/customIcons/icons/SimulFrac.js"),require("../../../../icons/customIcons/icons/ZipperFrac.js"),require("../../../../icons/customIcons/icons/CautionFilled.js"),require("../../../../icons/customIcons/icons/InfoRounded.js"),require("../../../../icons/customIcons/icons/FlameFilled.js"),require("../../../../icons/customIcons/icons/MoreApp.js"),require("../../../../icons/customIcons/icons/Pad.js"),require("../../../../icons/customIcons/icons/DrilloutUnit.js"),require("../../../../icons/customIcons/icons/FracFleet.js"),require("../../../../icons/customIcons/icons/Global.js"),require("../../../../icons/customIcons/icons/Program.js"),require("../../../../icons/customIcons/icons/Rig.js"),require("../../../../icons/customIcons/icons/Well.js"),require("../../../../icons/customIcons/icons/Gap.js"),require("../../../../icons/customIcons/icons/Pin.js"),require("../../../../icons/customIcons/icons/PinOne.js"),require("../../../../icons/customIcons/icons/PinOneCrossed.js"),require("../../../../icons/customIcons/icons/CloseOneFilled.js"),require("../../../../icons/customIcons/icons/AttentionFilled.js"),require("../../../../icons/customIcons/icons/CheckOneFilled.js"),require("../../../../icons/customIcons/icons/Archive.js"),require("../../../../icons/customIcons/icons/ArchiveCancel.js"),require("../../../../icons/customIcons/icons/Unarchive.js"),require("../../../../icons/customIcons/icons/Archived.js"),require("../../../../icons/customIcons/icons/InterventionUnit.js"),require("../../../../icons/customIcons/icons/CloudDelete.js"),require("../../../../icons/customIcons/icons/Lasso.js"),require("../../../../icons/customIcons/icons/Radius.js"),require("../../../../icons/customIcons/icons/ErrorOps.js"),require("../../../../icons/customIcons/icons/DataTypeOps.js"),require("../../../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../../../icons/customIcons/icons/CalibrationOps.js"),require("../../../../icons/customIcons/icons/CriticalOps.js"),require("../../../../icons/customIcons/icons/Company.js"),require("../../../../icons/customIcons/icons/ArchiveOne.js"),require("../../../../icons/customIcons/icons/ParseBotFusion.js"),require("../../../../icons/customIcons/icons/Connect.js"),require("../../../../icons/customIcons/icons/PuzzleOne.js"),require("../../../../icons/customIcons/icons/Feed.js"),require("../../../../icons/customIcons/icons/Prompt.js"),require("../../../../icons/customIcons/icons/Companies.js"),require("../../../../icons/customIcons/icons/ClipboardAi.js"),require("../../../../icons/customIcons/icons/Key.js"),require("../../../../icons/customIcons/icons/AtSignCrossed.js"),require("../../../../icons/customIcons/icons/MappingManual.js"),require("../../../../icons/customIcons/icons/Mapping.js"),require("../../../../icons/customIcons/icons/Metrics.js"),require("../../../../icons/customIcons/icons/Drops.js"),require("../../../../icons/customIcons/icons/ClipboardSearch.js"),require("../../../../icons/customIcons/icons/Template.js"),require("../../../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../../../icons/customIcons/icons/UnitConversion.js"),require("../../../../icons/customIcons/icons/NPT.js"),require("../../../../icons/customIcons/icons/GuidedFrac.js"),require("../../../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../../../clients/subscriptions.v1.js"),require("../../../../clients/jsonApi/index.js"),require("../../../../clients/subscriptions/subscriptions-client.factory.js"),require("immutable"),require("query-string"),require("../../../../constants/goals.js"),require("../../../../constants/segment.js"),require("../../../../constants/alerts.js"),require("../../../../constants/apps.js"),require("../../../../constants/drillstring.js"),require("../../../../constants/completion.js"),require("../../../../constants/appPackages.js"),require("../../../../constants/notifications.js"),require("../../../../constants/feed.js"),require("../../../../constants/bha.js"),require("../../../../constants/corvaCompanyId.js"),require("../../../../components/GradientManager/configuration/constants.js"),require("../../../../utils/index.js"),require("uuid"),require("jsona"),require("../../../../utils/env.js"),require("../../../../components/StatusBadge/constants.js"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../../../clients/api/apiCore.js"),require("../../../../clients/constants.js"),require("../../../../clients/sso/auth0.js"),require("../../../../clients/sso/oauth2.js"),require("../../../../clients/api/rateLimiter.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../../../constants/streamSourceType.js");var C=require("../../../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js"),f=require("../../../../utils/mobileDetect.js"),b=require("react/jsx-runtime");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=h(e),A=h(s),g=h(n),v=h(o),M=h(r);function y(e,s){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);s&&(o=o.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),n.push.apply(n,o)}return n}function O(e){for(var s=1;s<arguments.length;s++){var n=null!=arguments[s]?arguments[s]:{};s%2?y(Object(n),!0).forEach((function(s){A.default(e,s,n[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))}))}return e}var S=function(e){return!!e&&"object"===v.default(e)&&"title"in e};exports.Actions=function(e){var s=e.additionalActions,n=e.showComments,o=e.disableSettings,r=e.hideSettingsUnderMore,h=a.useAppCommonsInternal(),A=h.maximized,v=h.setMaximized,y=h.appSettingsComponent,k=h.isExpanded,B=h.isBrowserFullscreen,T=h.enterBrowserFullscreen,P=h.exitBrowserFullscreen,F=h.isSeparateWindow,w=h.openSeparateWindow,E=h.closeSeparateWindow,D=h.dashboardMeta,N=!(null==D||!D.isEmbedded),z=C.useAppCommentsMode(),R=C.useSetAppCommentsMode(),W=i.useState(!1),U=g.default(W,2),G=U[0],H=U[1],L=i.useRef(null),_=i.useRef(null),K=i.useState(!0),Z=g.default(K,2),J=Z[0],Q=Z[1],V=i.useState(!1),X=g.default(V,2),Y=X[0],$=X[1],ee=i.useRef(null),se=i.useRef(!1),ne=m.useAppSettingsPanel(),oe=ne.open,ie=ne.isOpen,re=!!y&&!o,ce=i.useCallback((function(){H((function(e){return!e}))}),[]),te=i.useCallback((function(){R((function(e){return!e}))}),[R]),ue=i.useCallback((function(){se.current=!1,$(!1)}),[]),le=i.useCallback((function(){Q(!1),ue(),F?null==E||E():B?null==P||P():v(!A)}),[ue,E,P,B,F,A,v]),ae=F?"Close Separate Window":k?"Restore":"Maximize",me=i.useCallback((function(){ee.current&&(clearTimeout(ee.current),ee.current=null)}),[]),de=i.useCallback((function(){!k&&T&&(me(),ee.current=setTimeout((function(){se.current=!0,$(!0)}),500))}),[me,T,k]);i.useEffect((function(){return me}),[me]);var je=i.useCallback((function(){se.current?se.current=!1:le()}),[le]),pe=i.useCallback((function(){ue(),null==w||w()}),[ue,w]),qe=i.useCallback((function(){ue(),null==T||T()}),[ue,T]);i.useEffect((function(){Q(!0)}),[k]);var Ie=i.useMemo((function(){if(f.isInsideNewMobileApp)return[];var e=function(e){return function(){ce(),null==e||e()}},o=(s||[]).filter(S).map((function(s){return O(O({},s),{},{onClick:e(s.onClick)})})),i={icon:b.jsx(q.MessageIcon,{}),onClick:e(te),title:z?"Close Comments Mode":"Add Comment"},c={title:ae,onClick:e(le),icon:k?b.jsx(q.CollapseIcon,{}):b.jsx(q.ExpandIcon,{})},t={title:"Settings",onClick:e(oe),icon:b.jsx(q.SettingTwoIcon,{})};return[].concat(x.default(o),x.default(n?[i]:[]),x.default(r&&re?[t]:[]),x.default(N?[]:[c]))}),[s,z,r,k,ae,oe,re,n,N,te,le,ce]),Ce=Ie.length>(N?0:1),fe=b.jsx(c.ButtonIcon,{size:"small",type:"tertiaryBg",ref:_,onClick:je,onMouseDown:de,onMouseUp:me,onMouseLeave:me,className:Ce?p.fullscreenButton:void 0,testId:k?j.ActionsTestIds.CollapseButtonTestId:j.ActionsTestIds.ExpandButtonTestId,children:k?b.jsx(q.CollapseIcon,{}):b.jsx(q.ExpandIcon,{})}),be=J?b.jsx(t.Tooltip,{title:ae,children:fe}):fe;return b.jsxs(b.Fragment,{children:[b.jsx(d.HideInNativeApp,{children:null==s?void 0:s.map((function(e,s){return S(e)?b.jsx(t.Tooltip,{title:e.title,children:b.jsx(c.ButtonIcon,{size:"small",type:"tertiary",onClick:e.onClick,className:M.default(p.additionalActionButton),testId:j.ActionsTestIds.AdditionalActionItemTestId,children:e.icon})},s):b.jsx(i.Fragment,{children:e},s)}))}),b.jsx(d.HideInNativeApp,{children:n&&b.jsx(t.Tooltip,{title:z?"Close Comments Mode":"Add Comment",children:b.jsx(c.ButtonIcon,{size:"small",type:z?"secondaryBg":"tertiaryBg",onClick:te,className:Ce?p.commentButton:void 0,testId:z?j.ActionsTestIds.CloseCommentButtonTestId:j.ActionsTestIds.AddMessageButtonTestId,children:z?b.jsx(q.CloseSmallIcon,{}):b.jsx(I.AddMessageCustomIcon,{fill:"currentColor"})})})}),re&&b.jsx(u.SettingsButton,{className:r&&!f.isInsideNewMobileApp?p.settingsHiddenUnderMore:void 0}),b.jsxs(d.HideInNativeApp,{children:[!N&&be,!N&&_.current&&b.jsxs(l.Menu,{anchorEl:_.current,open:Y,onClose:ue,placement:"bottom-end",children:[b.jsx(l.Menu.Item,{onClick:le,testId:j.ActionsTestIds.MaximizeItemTestId,children:"Maximize"}),b.jsx(l.Menu.Item,{onClick:qe,testId:j.ActionsTestIds.BrowserFullscreenItemTestId,children:"Full Screen"}),b.jsx(l.Menu.Item,{onClick:pe,testId:j.ActionsTestIds.SeparateWindowItemTestId,children:"Separate Window"})]})]}),b.jsxs(d.HideInNativeApp,{children:[Ce&&b.jsx(t.Tooltip,{title:"More",children:b.jsx(c.ButtonIcon,{type:G||r&&ie?"secondaryBg":"tertiaryBg",className:p.moreButton,ref:L,testId:j.ActionsTestIds.MoreButtonTestId,onClick:ce,size:"small",children:b.jsx(q.MoreOneIcon,{})})}),Ce&&L.current&&b.jsx(l.Menu,{anchorEl:L.current,open:G,onClose:ce,placement:"bottom-end",children:Ie.map((function(e,s){return b.jsx(l.Menu.Item,{size:"large",prefix:e.icon,onClick:e.onClick,children:e.title},s)}))})]})]})};
2
2
  //# sourceMappingURL=Actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.tsx"],"sourcesContent":["import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { ButtonIcon } from '../../../ButtonIcon';\nimport { Tooltip } from '../../../Tooltip';\nimport { SettingsButton } from '../SettingsButton';\nimport { AdditionalAction, AdditionalActionObject } from '../constants';\nimport { Menu } from '../../../Menu';\nimport { useAppCommonsInternal } from '../../../AppCommonsProvider';\nimport { useAppSettingsPanel } from '../../../AppPanel/AppPanelsContext';\nimport { HideInNativeApp } from '../../../HideInNativeApp';\n\nimport { ActionsTestIds } from './Actions.constants';\n\nimport styles from './Actions.scss';\n\nimport {\n AddMessageCustomIcon,\n CloseSmallIcon,\n CollapseIcon,\n ExpandIcon,\n MessageIcon,\n MoreOneIcon,\n SettingTwoIcon,\n} from '~/icons';\nimport { useAppCommentsMode, useSetAppCommentsMode } from '~/effects';\nimport { isInsideNewMobileApp } from '~/utils/mobileDetect';\n\ntype ActionsProps = {\n additionalActions?: AdditionalAction[];\n showComments?: boolean;\n disableSettings?: boolean;\n hideSettingsUnderMore?: boolean;\n};\n\nconst isActionObject = (action: AdditionalAction): action is AdditionalActionObject =>\n !!action && typeof action === 'object' && 'title' in action;\n\nconst LONG_PRESS_DELAY_MS = 500;\n\nexport const Actions = ({\n additionalActions,\n showComments,\n disableSettings,\n hideSettingsUnderMore,\n}: ActionsProps) => {\n const {\n maximized,\n setMaximized,\n appSettingsComponent,\n isExpanded,\n isBrowserFullscreen,\n enterBrowserFullscreen,\n exitBrowserFullscreen,\n isSeparateWindow,\n openSeparateWindow,\n closeSeparateWindow,\n } = useAppCommonsInternal();\n const commentsEnabled = useAppCommentsMode();\n const setCommentsMode = useSetAppCommentsMode();\n const [moreMenuOpen, setMoreMenuOpen] = useState(false);\n const moreButtonRef = useRef<HTMLButtonElement>(null);\n const maximizeButtonRef = useRef<HTMLButtonElement>(null);\n const [showMaximizeTooltip, setShowMaximizeTooltip] = useState(true);\n const [isModesMenuOpen, setIsModesMenuOpen] = useState(false);\n const longPressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const isLongPressRef = useRef(false);\n\n const { open, isOpen } = useAppSettingsPanel();\n const settingsVisible = !!appSettingsComponent && !disableSettings;\n\n const toggleMoreMenu = useCallback(() => {\n setMoreMenuOpen(value => !value);\n }, []);\n\n const toggleCommentsMode = useCallback(() => {\n setCommentsMode(value => !value);\n }, [setCommentsMode]);\n\n const closeModesMenu = useCallback(() => {\n isLongPressRef.current = false;\n setIsModesMenuOpen(false);\n }, []);\n\n const toggleMaximized = useCallback(() => {\n setShowMaximizeTooltip(false);\n closeModesMenu();\n\n if (isSeparateWindow) {\n closeSeparateWindow?.();\n return;\n }\n\n if (isBrowserFullscreen) {\n exitBrowserFullscreen?.();\n return;\n }\n\n setMaximized(!maximized);\n }, [\n closeModesMenu,\n closeSeparateWindow,\n exitBrowserFullscreen,\n isBrowserFullscreen,\n isSeparateWindow,\n maximized,\n setMaximized,\n ]);\n\n const maximizeTooltip = isSeparateWindow\n ? 'Close Separate Window'\n : isExpanded\n ? 'Restore'\n : 'Maximize';\n\n const cancelLongPress = useCallback(() => {\n if (longPressTimerRef.current) {\n clearTimeout(longPressTimerRef.current);\n longPressTimerRef.current = null;\n }\n }, []);\n\n const handleMaximizeMouseDown = useCallback(() => {\n if (isExpanded || !enterBrowserFullscreen) return;\n\n cancelLongPress();\n longPressTimerRef.current = setTimeout(() => {\n isLongPressRef.current = true;\n setIsModesMenuOpen(true);\n }, LONG_PRESS_DELAY_MS);\n }, [cancelLongPress, enterBrowserFullscreen, isExpanded]);\n\n useEffect(() => cancelLongPress, [cancelLongPress]);\n\n const handleMaximizeClick = useCallback(() => {\n if (isLongPressRef.current) {\n isLongPressRef.current = false;\n return;\n }\n\n toggleMaximized();\n }, [toggleMaximized]);\n\n const handleSeparateWindowClick = useCallback(() => {\n closeModesMenu();\n openSeparateWindow?.();\n }, [closeModesMenu, openSeparateWindow]);\n\n const handleBrowserFullscreenClick = useCallback(() => {\n closeModesMenu();\n enterBrowserFullscreen?.();\n }, [closeModesMenu, enterBrowserFullscreen]);\n\n useEffect(() => {\n setShowMaximizeTooltip(true);\n }, [isExpanded]);\n\n const menuActionItems = useMemo(() => {\n if (isInsideNewMobileApp) return [];\n\n const getOnClick = (handler: AdditionalActionObject['onClick']) => () => {\n toggleMoreMenu();\n handler?.();\n };\n\n const objectActions = (additionalActions || [])\n .filter(isActionObject)\n .map(item => ({ ...item, onClick: getOnClick(item.onClick) }));\n\n const commentItem: AdditionalActionObject = {\n icon: <MessageIcon />,\n onClick: getOnClick(toggleCommentsMode),\n title: commentsEnabled ? 'Close Comments Mode' : 'Add Comment',\n };\n\n const maximizeItem: AdditionalActionObject = {\n title: maximizeTooltip,\n onClick: getOnClick(toggleMaximized),\n icon: isExpanded ? <CollapseIcon /> : <ExpandIcon />,\n };\n\n const settingsItem = {\n title: 'Settings',\n onClick: getOnClick(open),\n icon: <SettingTwoIcon />,\n };\n\n return [\n ...objectActions,\n ...(showComments ? [commentItem] : []),\n ...(hideSettingsUnderMore && settingsVisible ? [settingsItem] : []),\n maximizeItem,\n ];\n }, [\n additionalActions,\n commentsEnabled,\n hideSettingsUnderMore,\n isExpanded,\n maximizeTooltip,\n open,\n settingsVisible,\n showComments,\n toggleCommentsMode,\n toggleMaximized,\n toggleMoreMenu,\n ]);\n\n // Show menu only if there's something there besides the fullscreen item\n const hasMenu = menuActionItems.length > 1;\n\n const maximizeButton = (\n <ButtonIcon\n size=\"small\"\n type=\"tertiaryBg\"\n ref={maximizeButtonRef}\n onClick={handleMaximizeClick}\n onMouseDown={handleMaximizeMouseDown}\n onMouseUp={cancelLongPress}\n onMouseLeave={cancelLongPress}\n className={hasMenu ? styles.fullscreenButton : undefined}\n testId={isExpanded ? ActionsTestIds.CollapseButtonTestId : ActionsTestIds.ExpandButtonTestId}\n >\n {isExpanded ? <CollapseIcon /> : <ExpandIcon />}\n </ButtonIcon>\n );\n\n return (\n <>\n <HideInNativeApp>\n {additionalActions?.map((action, index) =>\n !isActionObject(action) ? (\n <Fragment key={index}>{action}</Fragment>\n ) : (\n <Tooltip title={action.title} key={index}>\n <ButtonIcon\n size=\"small\"\n type=\"tertiary\"\n onClick={action.onClick}\n className={classNames(styles.additionalActionButton)}\n testId={ActionsTestIds.AdditionalActionItemTestId}\n >\n {action.icon}\n </ButtonIcon>\n </Tooltip>\n )\n )}\n </HideInNativeApp>\n\n <HideInNativeApp>\n {showComments && (\n <Tooltip title={commentsEnabled ? 'Close Comments Mode' : 'Add Comment'}>\n <ButtonIcon\n size=\"small\"\n type={commentsEnabled ? 'secondaryBg' : 'tertiaryBg'}\n onClick={toggleCommentsMode}\n className={hasMenu ? styles.commentButton : undefined}\n testId={\n commentsEnabled\n ? ActionsTestIds.CloseCommentButtonTestId\n : ActionsTestIds.AddMessageButtonTestId\n }\n >\n {commentsEnabled ? <CloseSmallIcon /> : <AddMessageCustomIcon fill=\"currentColor\" />}\n </ButtonIcon>\n </Tooltip>\n )}\n </HideInNativeApp>\n\n {settingsVisible && (\n <SettingsButton\n className={\n hideSettingsUnderMore && !isInsideNewMobileApp\n ? styles.settingsHiddenUnderMore\n : undefined\n }\n />\n )}\n\n {/* \n Our \"pseudo-fullscreen\" system gets a stroke when we try to go fullscreen when a tooltip is shown (and we're in a \"pseudo-fullscreen\" mode) \n and we change actual \"fullscreen\" status of an app.\n So we don't show tooltip when user clicks the button, and we expect the \"fullscreen\" status to change.\n */}\n <HideInNativeApp>\n {showMaximizeTooltip ? (\n <Tooltip title={maximizeTooltip}>{maximizeButton}</Tooltip>\n ) : (\n maximizeButton\n )}\n\n {maximizeButtonRef.current && (\n <Menu\n anchorEl={maximizeButtonRef.current}\n open={isModesMenuOpen}\n onClose={closeModesMenu}\n placement=\"bottom-end\"\n >\n <Menu.Item onClick={toggleMaximized} testId={ActionsTestIds.MaximizeItemTestId}>\n Maximize\n </Menu.Item>\n <Menu.Item\n onClick={handleBrowserFullscreenClick}\n testId={ActionsTestIds.BrowserFullscreenItemTestId}\n >\n Full Screen\n </Menu.Item>\n <Menu.Item\n onClick={handleSeparateWindowClick}\n testId={ActionsTestIds.SeparateWindowItemTestId}\n >\n Separate Window\n </Menu.Item>\n </Menu>\n )}\n </HideInNativeApp>\n\n <HideInNativeApp>\n {hasMenu && (\n <Tooltip title=\"More\">\n <ButtonIcon\n type={\n moreMenuOpen || (hideSettingsUnderMore && isOpen) ? 'secondaryBg' : 'tertiaryBg'\n }\n className={styles.moreButton}\n ref={moreButtonRef}\n onClick={toggleMoreMenu}\n size=\"small\"\n >\n <MoreOneIcon />\n </ButtonIcon>\n </Tooltip>\n )}\n\n {hasMenu && moreButtonRef.current && (\n <Menu\n anchorEl={moreButtonRef.current}\n open={moreMenuOpen}\n onClose={toggleMoreMenu}\n placement=\"bottom-end\"\n >\n {menuActionItems.map((item, index) => (\n <Menu.Item size=\"large\" prefix={item.icon} key={index} onClick={item.onClick}>\n {item.title}\n </Menu.Item>\n ))}\n </Menu>\n )}\n </HideInNativeApp>\n </>\n );\n};\n"],"names":["isActionObject","action","_typeof","_ref","additionalActions","showComments","disableSettings","hideSettingsUnderMore","_useAppCommonsInterna","useAppCommonsInternal","maximized","setMaximized","appSettingsComponent","isExpanded","isBrowserFullscreen","enterBrowserFullscreen","exitBrowserFullscreen","isSeparateWindow","openSeparateWindow","closeSeparateWindow","commentsEnabled","useAppCommentsMode","setCommentsMode","useSetAppCommentsMode","useState","_useState2","_slicedToArray","_useState","moreMenuOpen","setMoreMenuOpen","moreButtonRef","useRef","maximizeButtonRef","_useState4","_useState3","showMaximizeTooltip","setShowMaximizeTooltip","_useState6","_useState5","isModesMenuOpen","setIsModesMenuOpen","longPressTimerRef","isLongPressRef","_useAppSettingsPanel","useAppSettingsPanel","open","isOpen","settingsVisible","toggleMoreMenu","useCallback","value","toggleCommentsMode","closeModesMenu","current","toggleMaximized","maximizeTooltip","cancelLongPress","clearTimeout","handleMaximizeMouseDown","setTimeout","useEffect","handleMaximizeClick","handleSeparateWindowClick","handleBrowserFullscreenClick","menuActionItems","useMemo","isInsideNewMobileApp","getOnClick","handler","objectActions","filter","map","item","_objectSpread","onClick","commentItem","icon","_jsx","MessageIcon","title","maximizeItem","CollapseIcon","ExpandIcon","settingsItem","SettingTwoIcon","_toConsumableArray","hasMenu","length","maximizeButton","jsx","ButtonIcon","size","type","ref","onMouseDown","onMouseUp","onMouseLeave","className","styles","fullscreenButton","undefined","testId","ActionsTestIds","CollapseButtonTestId","ExpandButtonTestId","children","_jsxs","_Fragment","HideInNativeApp","index","Tooltip","classNames","additionalActionButton","AdditionalActionItemTestId","Fragment","commentButton","CloseCommentButtonTestId","AddMessageButtonTestId","CloseSmallIcon","AddMessageCustomIcon","fill","SettingsButton","settingsHiddenUnderMore","Menu","anchorEl","onClose","placement","Item","MaximizeItemTestId","BrowserFullscreenItemTestId","SeparateWindowItemTestId","moreButton","MoreOneIcon","prefix"],"mappings":"6uPAmCA,IAAMA,EAAiB,SAACC,GAAwB,QAC5CA,GAA4B,WAAlBC,EAAA,QAAOD,IAAuB,UAAWA,CAAM,kBAItC,SAKHE,GAAA,IAJlBC,IAAAA,kBACAC,IAAAA,aACAC,IAAAA,gBACAC,IAAAA,sBAEAC,EAWIC,EAAAA,wBAVFC,IAAAA,UACAC,IAAAA,aACAC,IAAAA,qBACAC,IAAAA,WACAC,IAAAA,oBACAC,IAAAA,uBACAC,IAAAA,sBACAC,IAAAA,iBACAC,IAAAA,mBACAC,IAAAA,oBAEIC,EAAkBC,EAAAA,qBAClBC,EAAkBC,EAAAA,wBACgBC,EAAAA,EAAQA,UAAC,GAAMC,EAAAC,EAAAA,QAAAC,EAAA,GAAhDC,EAAYH,EAAA,GAAEI,EAAeJ,EAAA,GAC9BK,EAAgBC,SAA0B,MAC1CC,EAAoBD,SAA0B,MACEP,EAAAA,EAAQA,UAAC,GAAKS,EAAAP,EAAAA,QAAAQ,EAAA,GAA7DC,EAAmBF,EAAA,GAAEG,EAAsBH,EAAA,GACJT,EAAAA,EAAQA,UAAC,GAAMa,EAAAX,EAAAA,QAAAY,EAAA,GAAtDC,EAAeF,EAAA,GAAEG,EAAkBH,EAAA,GACpCI,EAAoBV,SAA6C,MACjEW,EAAiBX,UAAO,GAE9BY,GAAyBC,EAAAA,sBAAjBC,MAAAA,KAAMC,MAAAA,OACRC,KAAoBnC,IAAyBN,EAE7C0C,GAAiBC,EAAAA,aAAY,WACjCpB,GAAgB,SAAAqB,GAAK,OAAKA,IAC3B,GAAE,IAEGC,GAAqBF,EAAAA,aAAY,WACrC3B,GAAgB,SAAA4B,GAAK,OAAKA,IAC5B,GAAG,CAAC5B,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AM,OAAM0B,SACnB5B,MAACa,aAAU,CACTE,KACEhE,GAAiBrB,GAAyBuC,GAAU,cAAgB,aAEtEmD,UAAWC,EAAOiC,WAClBtC,IAAK/D,EACL4C,QAAS1B,GACT2C,KAAK,QAAOc,SAEZ5B,EAAAA,IAACuD,EAAWA,YAAA,QAKjB9C,IAAWxD,EAAcuB,SACxBwB,EAAAA,IAAC8C,EAAAA,KAAI,CACHC,SAAU9F,EAAcuB,QACxBR,KAAMjB,EACNiG,QAAS7E,GACT8E,UAAU,aAAYrB,SAErBzC,GAAgBO,KAAI,SAACC,EAAMqC,GAAK,OAC/BhC,EAAAY,IAACkC,EAAIA,KAACI,KAAI,CAACpC,KAAK,QAAQ0C,OAAQ7D,EAAKI,KAAkBF,QAASF,EAAKE,QAAQ+B,SAC1EjC,EAAKO,OADwC8B,aAS9D"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.tsx"],"sourcesContent":["import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { ButtonIcon } from '../../../ButtonIcon';\nimport { Tooltip } from '../../../Tooltip';\nimport { SettingsButton } from '../SettingsButton';\nimport { AdditionalAction, AdditionalActionObject } from '../constants';\nimport { Menu } from '../../../Menu';\nimport { useAppCommonsInternal } from '../../../AppCommonsProvider';\nimport { useAppSettingsPanel } from '../../../AppPanel/AppPanelsContext';\nimport { HideInNativeApp } from '../../../HideInNativeApp';\n\nimport { ActionsTestIds } from './Actions.constants';\n\nimport styles from './Actions.scss';\n\nimport {\n AddMessageCustomIcon,\n CloseSmallIcon,\n CollapseIcon,\n ExpandIcon,\n MessageIcon,\n MoreOneIcon,\n SettingTwoIcon,\n} from '~/icons';\nimport { useAppCommentsMode, useSetAppCommentsMode } from '~/effects';\nimport { isInsideNewMobileApp } from '~/utils/mobileDetect';\n\ntype ActionsProps = {\n additionalActions?: AdditionalAction[];\n showComments?: boolean;\n disableSettings?: boolean;\n hideSettingsUnderMore?: boolean;\n};\n\nconst isActionObject = (action: AdditionalAction): action is AdditionalActionObject =>\n !!action && typeof action === 'object' && 'title' in action;\n\nconst LONG_PRESS_DELAY_MS = 500;\n\nexport const Actions = ({\n additionalActions,\n showComments,\n disableSettings,\n hideSettingsUnderMore,\n}: ActionsProps) => {\n const {\n maximized,\n setMaximized,\n appSettingsComponent,\n isExpanded,\n isBrowserFullscreen,\n enterBrowserFullscreen,\n exitBrowserFullscreen,\n isSeparateWindow,\n openSeparateWindow,\n closeSeparateWindow,\n dashboardMeta,\n } = useAppCommonsInternal();\n const isEmbedded = !!dashboardMeta?.isEmbedded;\n const commentsEnabled = useAppCommentsMode();\n const setCommentsMode = useSetAppCommentsMode();\n const [moreMenuOpen, setMoreMenuOpen] = useState(false);\n const moreButtonRef = useRef<HTMLButtonElement>(null);\n const maximizeButtonRef = useRef<HTMLButtonElement>(null);\n const [showMaximizeTooltip, setShowMaximizeTooltip] = useState(true);\n const [isModesMenuOpen, setIsModesMenuOpen] = useState(false);\n const longPressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const isLongPressRef = useRef(false);\n\n const { open, isOpen } = useAppSettingsPanel();\n const settingsVisible = !!appSettingsComponent && !disableSettings;\n\n const toggleMoreMenu = useCallback(() => {\n setMoreMenuOpen(value => !value);\n }, []);\n\n const toggleCommentsMode = useCallback(() => {\n setCommentsMode(value => !value);\n }, [setCommentsMode]);\n\n const closeModesMenu = useCallback(() => {\n isLongPressRef.current = false;\n setIsModesMenuOpen(false);\n }, []);\n\n const toggleMaximized = useCallback(() => {\n setShowMaximizeTooltip(false);\n closeModesMenu();\n\n if (isSeparateWindow) {\n closeSeparateWindow?.();\n return;\n }\n\n if (isBrowserFullscreen) {\n exitBrowserFullscreen?.();\n return;\n }\n\n setMaximized(!maximized);\n }, [\n closeModesMenu,\n closeSeparateWindow,\n exitBrowserFullscreen,\n isBrowserFullscreen,\n isSeparateWindow,\n maximized,\n setMaximized,\n ]);\n\n const maximizeTooltip = isSeparateWindow\n ? 'Close Separate Window'\n : isExpanded\n ? 'Restore'\n : 'Maximize';\n\n const cancelLongPress = useCallback(() => {\n if (longPressTimerRef.current) {\n clearTimeout(longPressTimerRef.current);\n longPressTimerRef.current = null;\n }\n }, []);\n\n const handleMaximizeMouseDown = useCallback(() => {\n if (isExpanded || !enterBrowserFullscreen) return;\n\n cancelLongPress();\n longPressTimerRef.current = setTimeout(() => {\n isLongPressRef.current = true;\n setIsModesMenuOpen(true);\n }, LONG_PRESS_DELAY_MS);\n }, [cancelLongPress, enterBrowserFullscreen, isExpanded]);\n\n useEffect(() => cancelLongPress, [cancelLongPress]);\n\n const handleMaximizeClick = useCallback(() => {\n if (isLongPressRef.current) {\n isLongPressRef.current = false;\n return;\n }\n\n toggleMaximized();\n }, [toggleMaximized]);\n\n const handleSeparateWindowClick = useCallback(() => {\n closeModesMenu();\n openSeparateWindow?.();\n }, [closeModesMenu, openSeparateWindow]);\n\n const handleBrowserFullscreenClick = useCallback(() => {\n closeModesMenu();\n enterBrowserFullscreen?.();\n }, [closeModesMenu, enterBrowserFullscreen]);\n\n useEffect(() => {\n setShowMaximizeTooltip(true);\n }, [isExpanded]);\n\n const menuActionItems = useMemo(() => {\n if (isInsideNewMobileApp) return [];\n\n const getOnClick = (handler: AdditionalActionObject['onClick']) => () => {\n toggleMoreMenu();\n handler?.();\n };\n\n const objectActions = (additionalActions || [])\n .filter(isActionObject)\n .map(item => ({ ...item, onClick: getOnClick(item.onClick) }));\n\n const commentItem: AdditionalActionObject = {\n icon: <MessageIcon />,\n onClick: getOnClick(toggleCommentsMode),\n title: commentsEnabled ? 'Close Comments Mode' : 'Add Comment',\n };\n\n const maximizeItem: AdditionalActionObject = {\n title: maximizeTooltip,\n onClick: getOnClick(toggleMaximized),\n icon: isExpanded ? <CollapseIcon /> : <ExpandIcon />,\n };\n\n const settingsItem = {\n title: 'Settings',\n onClick: getOnClick(open),\n icon: <SettingTwoIcon />,\n };\n\n return [\n ...objectActions,\n ...(showComments ? [commentItem] : []),\n ...(hideSettingsUnderMore && settingsVisible ? [settingsItem] : []),\n ...(!isEmbedded ? [maximizeItem] : []),\n ];\n }, [\n additionalActions,\n commentsEnabled,\n hideSettingsUnderMore,\n isExpanded,\n maximizeTooltip,\n open,\n settingsVisible,\n showComments,\n isEmbedded,\n toggleCommentsMode,\n toggleMaximized,\n toggleMoreMenu,\n ]);\n\n // Maximization is already available as a button.\n const hasMenu = menuActionItems.length > (isEmbedded ? 0 : 1);\n\n const maximizeButton = (\n <ButtonIcon\n size=\"small\"\n type=\"tertiaryBg\"\n ref={maximizeButtonRef}\n onClick={handleMaximizeClick}\n onMouseDown={handleMaximizeMouseDown}\n onMouseUp={cancelLongPress}\n onMouseLeave={cancelLongPress}\n className={hasMenu ? styles.fullscreenButton : undefined}\n testId={isExpanded ? ActionsTestIds.CollapseButtonTestId : ActionsTestIds.ExpandButtonTestId}\n >\n {isExpanded ? <CollapseIcon /> : <ExpandIcon />}\n </ButtonIcon>\n );\n\n // Hide the tooltip during maximization changes to avoid fullscreen positioning issues.\n const maximizeWithTooltip = showMaximizeTooltip ? (\n <Tooltip title={maximizeTooltip}>{maximizeButton}</Tooltip>\n ) : (\n maximizeButton\n );\n\n return (\n <>\n <HideInNativeApp>\n {additionalActions?.map((action, index) =>\n !isActionObject(action) ? (\n <Fragment key={index}>{action}</Fragment>\n ) : (\n <Tooltip title={action.title} key={index}>\n <ButtonIcon\n size=\"small\"\n type=\"tertiary\"\n onClick={action.onClick}\n className={classNames(styles.additionalActionButton)}\n testId={ActionsTestIds.AdditionalActionItemTestId}\n >\n {action.icon}\n </ButtonIcon>\n </Tooltip>\n )\n )}\n </HideInNativeApp>\n\n <HideInNativeApp>\n {showComments && (\n <Tooltip title={commentsEnabled ? 'Close Comments Mode' : 'Add Comment'}>\n <ButtonIcon\n size=\"small\"\n type={commentsEnabled ? 'secondaryBg' : 'tertiaryBg'}\n onClick={toggleCommentsMode}\n className={hasMenu ? styles.commentButton : undefined}\n testId={\n commentsEnabled\n ? ActionsTestIds.CloseCommentButtonTestId\n : ActionsTestIds.AddMessageButtonTestId\n }\n >\n {commentsEnabled ? <CloseSmallIcon /> : <AddMessageCustomIcon fill=\"currentColor\" />}\n </ButtonIcon>\n </Tooltip>\n )}\n </HideInNativeApp>\n\n {settingsVisible && (\n <SettingsButton\n className={\n hideSettingsUnderMore && !isInsideNewMobileApp\n ? styles.settingsHiddenUnderMore\n : undefined\n }\n />\n )}\n\n <HideInNativeApp>\n {!isEmbedded && maximizeWithTooltip}\n\n {!isEmbedded && maximizeButtonRef.current && (\n <Menu\n anchorEl={maximizeButtonRef.current}\n open={isModesMenuOpen}\n onClose={closeModesMenu}\n placement=\"bottom-end\"\n >\n <Menu.Item onClick={toggleMaximized} testId={ActionsTestIds.MaximizeItemTestId}>\n Maximize\n </Menu.Item>\n <Menu.Item\n onClick={handleBrowserFullscreenClick}\n testId={ActionsTestIds.BrowserFullscreenItemTestId}\n >\n Full Screen\n </Menu.Item>\n <Menu.Item\n onClick={handleSeparateWindowClick}\n testId={ActionsTestIds.SeparateWindowItemTestId}\n >\n Separate Window\n </Menu.Item>\n </Menu>\n )}\n </HideInNativeApp>\n\n <HideInNativeApp>\n {hasMenu && (\n <Tooltip title=\"More\">\n <ButtonIcon\n type={\n moreMenuOpen || (hideSettingsUnderMore && isOpen) ? 'secondaryBg' : 'tertiaryBg'\n }\n className={styles.moreButton}\n ref={moreButtonRef}\n testId={ActionsTestIds.MoreButtonTestId}\n onClick={toggleMoreMenu}\n size=\"small\"\n >\n <MoreOneIcon />\n </ButtonIcon>\n </Tooltip>\n )}\n\n {hasMenu && moreButtonRef.current && (\n <Menu\n anchorEl={moreButtonRef.current}\n open={moreMenuOpen}\n onClose={toggleMoreMenu}\n placement=\"bottom-end\"\n >\n {menuActionItems.map((item, index) => (\n <Menu.Item size=\"large\" prefix={item.icon} key={index} onClick={item.onClick}>\n {item.title}\n </Menu.Item>\n ))}\n </Menu>\n )}\n </HideInNativeApp>\n </>\n );\n};\n"],"names":["isActionObject","action","_typeof","_ref","additionalActions","showComments","disableSettings","hideSettingsUnderMore","_useAppCommonsInterna","useAppCommonsInternal","maximized","setMaximized","appSettingsComponent","isExpanded","isBrowserFullscreen","enterBrowserFullscreen","exitBrowserFullscreen","isSeparateWindow","openSeparateWindow","closeSeparateWindow","dashboardMeta","isEmbedded","commentsEnabled","useAppCommentsMode","setCommentsMode","useSetAppCommentsMode","useState","_useState2","_slicedToArray","_useState","moreMenuOpen","setMoreMenuOpen","moreButtonRef","useRef","maximizeButtonRef","_useState4","_useState3","showMaximizeTooltip","setShowMaximizeTooltip","_useState6","_useState5","isModesMenuOpen","setIsModesMenuOpen","longPressTimerRef","isLongPressRef","_useAppSettingsPanel","useAppSettingsPanel","open","isOpen","settingsVisible","toggleMoreMenu","useCallback","value","toggleCommentsMode","closeModesMenu","current","toggleMaximized","maximizeTooltip","cancelLongPress","clearTimeout","handleMaximizeMouseDown","setTimeout","useEffect","handleMaximizeClick","handleSeparateWindowClick","handleBrowserFullscreenClick","menuActionItems","useMemo","isInsideNewMobileApp","getOnClick","handler","objectActions","filter","map","item","_objectSpread","onClick","commentItem","icon","_jsx","MessageIcon","title","maximizeItem","CollapseIcon","ExpandIcon","settingsItem","SettingTwoIcon","_toConsumableArray","hasMenu","length","maximizeButton","jsx","ButtonIcon","size","type","ref","onMouseDown","onMouseUp","onMouseLeave","className","styles","fullscreenButton","undefined","testId","ActionsTestIds","CollapseButtonTestId","ExpandButtonTestId","children","maximizeWithTooltip","Tooltip","_jsxs","_Fragment","HideInNativeApp","index","classNames","additionalActionButton","AdditionalActionItemTestId","Fragment","commentButton","CloseCommentButtonTestId","AddMessageButtonTestId","CloseSmallIcon","AddMessageCustomIcon","fill","SettingsButton","settingsHiddenUnderMore","Menu","anchorEl","onClose","placement","Item","MaximizeItemTestId","BrowserFullscreenItemTestId","SeparateWindowItemTestId","moreButton","MoreButtonTestId","MoreOneIcon","prefix"],"mappings":"6uPA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hE,GAAiBvB,GAAyByC,GAAU,cAAgB,aAEtEmD,UAAWC,EAAOkC,WAClBvC,IAAK/D,EACLuE,OAAQC,EAAcA,eAAC+B,iBACvB3D,QAAS1B,GACT2C,KAAK,QAAOc,SAEZ5B,EAAAA,IAACyD,EAAWA,YAAA,QAKjBhD,IAAWxD,EAAcuB,SACxBwB,EAAAA,IAAC+C,EAAAA,KAAI,CACHC,SAAU/F,EAAcuB,QACxBR,KAAMjB,EACNkG,QAAS9E,GACT+E,UAAU,aAAYtB,SAErBzC,GAAgBO,KAAI,SAACC,EAAMuC,GAAK,OAC/BlC,EAAAY,IAACmC,EAAIA,KAACI,KAAI,CAACrC,KAAK,QAAQ4C,OAAQ/D,EAAKI,KAAkBF,QAASF,EAAKE,QAAQ+B,SAC1EjC,EAAKO,OADwCgC,aAS9D"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("react"),s=require("classnames"),i=require("lodash"),l=require("../../../constants/segment.js"),n=require("../../../utils/devcenter.js"),o=require("../../PadModeSelect/PadModeSelect.js");require("../../PadModeSelect/PadModeSelect.constants.js");var r=require("../AppHeader.constants.js");require("../../AppCommonsProvider/AppCommonsProvider.js");var d=require("../../AppCommonsProvider/AppCommonsContext.js"),a=require("../../HideInNativeApp/index.js"),u=require("../../utils.js"),p=require("./VersionSelect/VersionSelect.js"),c=require("./AssetChips/AssetChips.js"),v=require("./AppTitle/AppTitle.js");require("./AppTitle/AppTitle.constants.js");var f=require("./useResponsivity.js"),j=require("./Actions/Actions.js");require("./Actions/Actions.constants.js");var m=require("./AppHeaderV3.scss.js"),A=require("react/jsx-runtime");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=C(e),y=C(s);function b(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,i)}return s}function g(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?b(Object(s),!0).forEach((function(t){h.default(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):b(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}exports.AppHeaderV3=function(e){var s,C,h,b,q,I,x,S,P,M,N,O,R,L,w,T,H=e.elementsClassNames,E=e.className,D=e.testId,U=e.logo,V=e.additionalControls,W=e.title,k=e.padModeDisabled,B=e.padModeWells,F=e.dqData,_=e.asset,G=e.lastUpdate,z=e.additionalActions,J=e.showComments,K=e.titleControls,Q=e.disableSettings,X=e.showAssetChips,Y=e.disableAssetSelector,Z=e.titleMenuActions,$=e.titleControlsPosition,ee=void 0===$?"right":$,te=e.responsivenessConfig,se=t.useRef(null),ie=d.useAppCommonsInternal(),le=ie.app,ne=ie.appName,oe=ie.well,re=ie.wells,de=ie.rig,ae=ie.fracFleet,ue=ie.interventionUnit,pe=ie.isExpanded,ce=ie.setSeparateWindowTitle,ve=ie.isInsideNewMobileApp,fe=ie.disableAppAssetSelection,je=ie.isMultiRig,me=B||re,Ae=n.getAppSegment(le)===l.SEGMENTS.COMPLETION&&!oe,Ce=!i.isEmpty(me)&&!!ae,he=fe||je,ye=!fe&&!k&&!ve&&Ae&&Ce,be=U?"ultranarrow":ye||V||K?"narrow":void 0,ge="left"===ee&&!!K,qe=t.useRef(null),Ie=t.useRef(null),xe=t.useRef(null),Se=t.useRef(null),Pe=t.useRef(null),Me=t.useRef(null),Ne=t.useRef(null),Oe=null!==(s=null!==(C=null!==(h=null==oe?void 0:oe.name)&&void 0!==h?h:null==de?void 0:de.name)&&void 0!==C?C:null==ae?void 0:ae.name)&&void 0!==s?s:null==ue?void 0:ue.name;t.useEffect((function(){null==ce||ce([ne,Oe].filter(Boolean).join(" - "))}),[ce,ne,Oe]);var Re=f.useResponsivity({disabled:ve,titleControlsLeft:ge,rootRef:se,versionRef:qe,additionalControlsRef:xe,titleControlsRef:Se,logoRef:Me,padModeRef:Ie,chipsRef:Pe,actionsRef:Ne});return A.jsxs("div",g(g({className:y.default(m.root,E),"data-testid":D,ref:se,style:null===(b=Re.root)||void 0===b?void 0:b.style},u.AppHeaderFinderProps),{},{children:[A.jsx("div",{className:y.default(m.logoContainer,null==H?void 0:H.logoContainer),ref:Me,children:U&&"string"==typeof U?A.jsx("img",{className:m.logo,src:U,alt:"Logo"}):U}),A.jsx(v.AppTitle,{title:pe&&null!=Oe?Oe:W,asset:_,dqData:F,lastUpdate:G,className:y.default(m.title,ge&&m.titleWithControlsLeft,null==H?void 0:H.title),disableAssetSelector:Y,titleMenuActions:Z,style:null===(q=Re.title)||void 0===q?void 0:q.style}),K&&A.jsx("div",{className:y.default(m.titleControls,ge&&m.titleControlsLeft,(null===(I=Re.titleControls)||void 0===I?void 0:I.lastInLine)&&m.lastInLine,null==H?void 0:H.titleControls),ref:Se,style:null===(x=Re.titleControls)||void 0===x?void 0:x.style,children:K}),A.jsx(a.HideInNativeApp,{children:A.jsx("div",{className:m.version,ref:qe,children:A.jsx(p.VersionSelect,{className:null==H?void 0:H.versionSelect})})}),ye&&A.jsx("div",{className:y.default(m.padMode,(null===(S=Re.padMode)||void 0===S?void 0:S.lastInLine)&&m.lastInLine),ref:Ie,style:null===(P=Re.padMode)||void 0===P?void 0:P.style,children:A.jsx(o.PadModeSelect,{testId:r.AppHeaderTestIds.PadModeSelectTestId})}),V&&A.jsx("div",{className:y.default(m.additionalControls,(null===(M=Re.additionalControls)||void 0===M?void 0:M.lastInLine)&&m.lastInLine,null==H?void 0:H.additionalControls),ref:xe,style:null===(N=Re.additionalControls)||void 0===N?void 0:N.style,"data-testid":r.AppHeaderTestIds.AdditionalControlsTestId,children:V}),!he&&X&&A.jsx(a.HideInNativeApp,{children:A.jsx("div",{className:y.default(m.assetChips,(null===(O=Re.chips)||void 0===O?void 0:O.lastInLine)&&m.lastInLine,null==H?void 0:H.chips),ref:Pe,style:null===(R=Re.chips)||void 0===R?void 0:R.style,children:A.jsx(c.AssetChips,{chipsWidth:be})})}),A.jsx("div",{className:y.default(m.actions,(null===(L=Re.actions)||void 0===L?void 0:L.lastInLine)&&m.lastInLine,null==H?void 0:H.actions),ref:Ne,style:null===(w=Re.actions)||void 0===w?void 0:w.style,"data-testid":r.AppHeaderTestIds.ActionsRootTestId,children:A.jsx(j.Actions,{additionalActions:z,showComments:J,disableSettings:Q,hideSettingsUnderMore:null==te?void 0:te.hideSettingsUnderMore})}),null===(T=Re.linebreaks)||void 0===T?void 0:T.map((function(e,t){return A.jsx("div",{className:m.responsivenessLineBreak,style:e},t)}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("react"),s=require("classnames"),i=require("lodash"),l=require("../../../constants/segment.js"),n=require("../../../utils/devcenter.js"),o=require("../../PadModeSelect/PadModeSelect.js");require("../../PadModeSelect/PadModeSelect.constants.js");var r=require("../AppHeader.constants.js");require("../../AppCommonsProvider/AppCommonsProvider.js");var d=require("../../AppCommonsProvider/AppCommonsContext.js"),a=require("../../HideInNativeApp/index.js"),u=require("../../utils.js"),c=require("./VersionSelect/VersionSelect.js"),p=require("./AssetChips/AssetChips.js"),v=require("./AppTitle/AppTitle.js");require("./AppTitle/AppTitle.constants.js");var f=require("./useResponsivity.js"),j=require("./Actions/Actions.js");require("./Actions/Actions.constants.js");var m=require("./AppHeaderV3.scss.js"),A=require("react/jsx-runtime");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var C=h(e),y=h(s);function b(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,i)}return s}function g(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?b(Object(s),!0).forEach((function(t){C.default(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):b(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}exports.AppHeaderV3=function(e){var s,h,C,b,q,x,I,S,M,P,N,O,R,L,w,T,H=e.elementsClassNames,E=e.className,D=e.testId,U=e.logo,V=e.additionalControls,W=e.title,k=e.padModeDisabled,F=e.padModeWells,B=e.dqData,_=e.asset,G=e.lastUpdate,z=e.additionalActions,J=e.showComments,K=e.titleControls,Q=e.disableSettings,X=e.showAssetChips,Y=e.disableAssetSelector,Z=e.titleMenuActions,$=e.titleControlsPosition,ee=void 0===$?"right":$,te=e.responsivenessConfig,se=t.useRef(null),ie=d.useAppCommonsInternal(),le=ie.app,ne=ie.appName,oe=ie.well,re=ie.wells,de=ie.rig,ae=ie.fracFleet,ue=ie.interventionUnit,ce=ie.isExpanded,pe=ie.setSeparateWindowTitle,ve=ie.isInsideNewMobileApp,fe=ie.disableAppAssetSelection,je=ie.isMultiRig,me=ie.dashboardMeta,Ae=!(null==me||!me.isEmbedded),he=F||re,Ce=n.getAppSegment(le)===l.SEGMENTS.COMPLETION&&!oe,ye=!i.isEmpty(he)&&!!ae,be=fe||je,ge=!(Ae||fe||k||ve)&&Ce&&ye,qe=U?"ultranarrow":ge||V||K?"narrow":void 0,xe="left"===ee&&!!K,Ie=t.useRef(null),Se=t.useRef(null),Me=t.useRef(null),Pe=t.useRef(null),Ne=t.useRef(null),Oe=t.useRef(null),Re=t.useRef(null),Le=null!==(s=null!==(h=null!==(C=null==oe?void 0:oe.name)&&void 0!==C?C:null==de?void 0:de.name)&&void 0!==h?h:null==ae?void 0:ae.name)&&void 0!==s?s:null==ue?void 0:ue.name;t.useEffect((function(){null==pe||pe([ne,Le].filter(Boolean).join(" - "))}),[pe,ne,Le]);var we=f.useResponsivity({disabled:ve||Ae,titleControlsLeft:xe,rootRef:se,versionRef:Ie,additionalControlsRef:Me,titleControlsRef:Pe,logoRef:Oe,padModeRef:Se,chipsRef:Ne,actionsRef:Re});return A.jsxs("div",g(g({className:y.default(m.root,Ae&&m.embedded,E),"data-testid":D,ref:se,style:null===(b=we.root)||void 0===b?void 0:b.style},u.AppHeaderFinderProps),{},{children:[!Ae&&A.jsxs(A.Fragment,{children:[A.jsx("div",{className:y.default(m.logoContainer,null==H?void 0:H.logoContainer),ref:Oe,children:U&&"string"==typeof U?A.jsx("img",{className:m.logo,src:U,alt:"Logo"}):U}),A.jsx(v.AppTitle,{title:ce&&null!=Le?Le:W,asset:_,dqData:B,lastUpdate:G,className:y.default(m.title,xe&&m.titleWithControlsLeft,null==H?void 0:H.title),disableAssetSelector:Y,titleMenuActions:Z,style:null===(q=we.title)||void 0===q?void 0:q.style})]}),K&&A.jsx("div",{className:y.default(m.titleControls,xe&&m.titleControlsLeft,(null===(x=we.titleControls)||void 0===x?void 0:x.lastInLine)&&m.lastInLine,null==H?void 0:H.titleControls),ref:Pe,style:null===(I=we.titleControls)||void 0===I?void 0:I.style,children:K}),A.jsx(a.HideInNativeApp,{children:A.jsx("div",{className:m.version,ref:Ie,children:A.jsx(c.VersionSelect,{className:null==H?void 0:H.versionSelect})})}),ge&&A.jsx("div",{className:y.default(m.padMode,(null===(S=we.padMode)||void 0===S?void 0:S.lastInLine)&&m.lastInLine),ref:Se,style:null===(M=we.padMode)||void 0===M?void 0:M.style,children:A.jsx(o.PadModeSelect,{testId:r.AppHeaderTestIds.PadModeSelectTestId})}),V&&A.jsx("div",{className:y.default(m.additionalControls,(null===(P=we.additionalControls)||void 0===P?void 0:P.lastInLine)&&m.lastInLine,null==H?void 0:H.additionalControls),ref:Me,style:null===(N=we.additionalControls)||void 0===N?void 0:N.style,"data-testid":r.AppHeaderTestIds.AdditionalControlsTestId,children:V}),!Ae&&!be&&X&&A.jsx(a.HideInNativeApp,{children:A.jsx("div",{className:y.default(m.assetChips,(null===(O=we.chips)||void 0===O?void 0:O.lastInLine)&&m.lastInLine,null==H?void 0:H.chips),ref:Ne,style:null===(R=we.chips)||void 0===R?void 0:R.style,children:A.jsx(p.AssetChips,{chipsWidth:qe})})}),A.jsx("div",{className:y.default(m.actions,(null===(L=we.actions)||void 0===L?void 0:L.lastInLine)&&m.lastInLine,null==H?void 0:H.actions),ref:Re,style:null===(w=we.actions)||void 0===w?void 0:w.style,"data-testid":r.AppHeaderTestIds.ActionsRootTestId,children:A.jsx(j.Actions,{additionalActions:z,showComments:J,disableSettings:Q,hideSettingsUnderMore:null==te?void 0:te.hideSettingsUnderMore})}),null===(T=we.linebreaks)||void 0===T?void 0:T.map((function(e,t){return A.jsx("div",{className:m.responsivenessLineBreak,style:e},t)}))]}))};
2
2
  //# sourceMappingURL=AppHeaderV3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeaderV3.js","sources":["../../../../../src/componentsV2/AppHeader/V3/AppHeaderV3.tsx"],"sourcesContent":["import { FC, ReactElement, ReactNode, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport { isEmpty } from 'lodash';\n\nimport { SEGMENTS } from '../../../constants/segment';\nimport { getAppSegment } from '../../../utils/devcenter';\nimport { PadModeSelect } from '../../PadModeSelect';\nimport { AppHeaderTestIds, Asset, UseWellnessAlertsReturnType } from '../AppHeader.constants';\nimport { useAppCommonsInternal } from '../../AppCommonsProvider';\nimport { HideInNativeApp } from '../../HideInNativeApp';\nimport { AppHeaderFinderProps } from '../../utils';\n\nimport { VersionSelect } from './VersionSelect';\nimport { AssetChips } from './AssetChips';\nimport { AppTitle } from './AppTitle';\nimport { useResponsivity } from './useResponsivity';\nimport { AdditionalAction, TitleMenuAction } from './constants';\nimport { Actions } from './Actions';\n\nimport styles from './AppHeaderV3.scss';\n\nexport type AppHeaderV3Props = {\n logo?: string | ReactElement;\n\n additionalControls?: ReactNode;\n\n /**\n * Used to put some controls alongside title\n */\n titleControls?: ReactNode;\n titleControlsPosition?: 'right' | 'left';\n\n /**\n * An escape hatch to tweak the styling of internal elements\n *\n * `buttons`, `titleControls` and `versionSelect` are for *V3 only*\n */\n elementsClassNames?: {\n title?: string;\n additionalControls?: string;\n chips?: string;\n actions?: string;\n versionSelect?: string;\n titleControls?: string;\n logoContainer?: string;\n };\n\n title?: ReactNode;\n padModeDisabled?: boolean;\n padModeWells?: ReturnType<typeof useAppCommonsInternal>['wells'];\n\n lastUpdate?: number | string | Date;\n asset?: Asset | Asset[];\n dqData?: UseWellnessAlertsReturnType;\n showComments?: boolean;\n additionalActions?: AdditionalAction[];\n disableSettings?: boolean;\n showAssetChips?: boolean;\n disableAssetSelector?: boolean;\n titleMenuActions?: TitleMenuAction[];\n\n /**\n * Configuration for responsive behavior of header elements\n * - `hideSettingsUnderMore`: When true, settings button will be hidden under \"More\" menu at smaller screen sizes\n */\n responsivenessConfig?: {\n hideSettingsUnderMore?: boolean;\n };\n\n className?: string;\n testId?: string;\n};\n\nexport const AppHeaderV3: FC<AppHeaderV3Props> = ({\n elementsClassNames,\n className,\n testId,\n logo,\n additionalControls,\n title,\n padModeDisabled,\n padModeWells,\n dqData,\n asset,\n lastUpdate,\n additionalActions,\n showComments,\n titleControls,\n disableSettings,\n showAssetChips,\n disableAssetSelector,\n titleMenuActions,\n titleControlsPosition = 'right',\n responsivenessConfig,\n}) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const {\n app,\n appName,\n well,\n wells: contextWells,\n rig,\n fracFleet,\n interventionUnit,\n isExpanded,\n setSeparateWindowTitle,\n isInsideNewMobileApp,\n disableAppAssetSelection,\n isMultiRig,\n } = useAppCommonsInternal();\n\n const segment = getAppSegment(app);\n const wells = padModeWells || contextWells;\n const isCompletionPadMode = segment === SEGMENTS.COMPLETION && !well;\n const hasPadModeAssets = !isEmpty(wells) && !!fracFleet;\n const shouldDisableAssetControls = disableAppAssetSelection || isMultiRig;\n const canShowPadMode = !disableAppAssetSelection && !padModeDisabled && !isInsideNewMobileApp;\n const hasPadMode = canShowPadMode && isCompletionPadMode && hasPadModeAssets;\n\n const possiblyNarrowChips =\n hasPadMode || !!additionalControls || !!titleControls ? 'narrow' : undefined;\n const chipsWidth = logo ? 'ultranarrow' : possiblyNarrowChips;\n\n const titleControlsLeft = titleControlsPosition === 'left' && !!titleControls;\n\n const versionRef = useRef<HTMLDivElement>(null);\n const padModeRef = useRef<HTMLDivElement>(null);\n const additionalControlsRef = useRef<HTMLDivElement>(null);\n const titleControlsRef = useRef<HTMLDivElement>(null);\n const chipsRef = useRef<HTMLDivElement>(null);\n const logoRef = useRef<HTMLDivElement>(null);\n const actionsRef = useRef<HTMLDivElement>(null);\n\n const assetName = well?.name ?? rig?.name ?? fracFleet?.name ?? interventionUnit?.name;\n\n useEffect(() => {\n setSeparateWindowTitle?.([appName, assetName].filter(Boolean).join(' - '));\n }, [setSeparateWindowTitle, appName, assetName]);\n\n const responsivity = useResponsivity({\n disabled: isInsideNewMobileApp,\n titleControlsLeft,\n\n rootRef,\n versionRef,\n additionalControlsRef,\n titleControlsRef,\n logoRef,\n padModeRef,\n chipsRef,\n actionsRef,\n });\n\n return (\n <div\n className={classNames(styles.root, className)}\n data-testid={testId}\n ref={rootRef}\n style={responsivity.root?.style}\n {...AppHeaderFinderProps}\n >\n <div\n className={classNames(styles.logoContainer, elementsClassNames?.logoContainer)}\n ref={logoRef}\n >\n {logo && typeof logo === 'string' ? (\n <img className={styles.logo} src={logo} alt=\"Logo\" />\n ) : (\n logo\n )}\n </div>\n\n <AppTitle\n title={isExpanded ? assetName ?? title : title}\n asset={asset}\n dqData={dqData}\n lastUpdate={lastUpdate}\n className={classNames(\n styles.title,\n titleControlsLeft && styles.titleWithControlsLeft,\n elementsClassNames?.title\n )}\n disableAssetSelector={disableAssetSelector}\n titleMenuActions={titleMenuActions}\n style={responsivity.title?.style}\n />\n\n {titleControls && (\n <div\n className={classNames(\n styles.titleControls,\n titleControlsLeft && styles.titleControlsLeft,\n responsivity.titleControls?.lastInLine && styles.lastInLine,\n elementsClassNames?.titleControls\n )}\n ref={titleControlsRef}\n style={responsivity.titleControls?.style}\n >\n {titleControls}\n </div>\n )}\n\n <HideInNativeApp>\n <div className={styles.version} ref={versionRef}>\n <VersionSelect className={elementsClassNames?.versionSelect} />\n </div>\n </HideInNativeApp>\n\n {hasPadMode && (\n <div\n className={classNames(\n styles.padMode,\n responsivity.padMode?.lastInLine && styles.lastInLine\n )}\n ref={padModeRef}\n style={responsivity.padMode?.style}\n >\n <PadModeSelect testId={AppHeaderTestIds.PadModeSelectTestId} />\n </div>\n )}\n\n {additionalControls && (\n <div\n className={classNames(\n styles.additionalControls,\n responsivity.additionalControls?.lastInLine && styles.lastInLine,\n elementsClassNames?.additionalControls\n )}\n ref={additionalControlsRef}\n style={responsivity.additionalControls?.style}\n data-testid={AppHeaderTestIds.AdditionalControlsTestId}\n >\n {additionalControls}\n </div>\n )}\n\n {!shouldDisableAssetControls && showAssetChips && (\n <HideInNativeApp>\n <div\n className={classNames(\n styles.assetChips,\n responsivity.chips?.lastInLine && styles.lastInLine,\n elementsClassNames?.chips\n )}\n ref={chipsRef}\n style={responsivity.chips?.style}\n >\n <AssetChips chipsWidth={chipsWidth} />\n </div>\n </HideInNativeApp>\n )}\n\n <div\n className={classNames(\n styles.actions,\n responsivity.actions?.lastInLine && styles.lastInLine,\n elementsClassNames?.actions\n )}\n ref={actionsRef}\n style={responsivity.actions?.style}\n data-testid={AppHeaderTestIds.ActionsRootTestId}\n >\n <Actions\n additionalActions={additionalActions}\n showComments={showComments}\n disableSettings={disableSettings}\n hideSettingsUnderMore={responsivenessConfig?.hideSettingsUnderMore}\n />\n </div>\n\n {responsivity.linebreaks?.map((css, index) => (\n <div className={styles.responsivenessLineBreak} style={css} key={index} />\n ))}\n </div>\n );\n};\n"],"names":["_ref","_ref2","_ref3","_well$name","_responsivity$root","_responsivity$title","_responsivity$titleCo","_responsivity$titleCo2","_responsivity$padMode","_responsivity$padMode2","_responsivity$additio","_responsivity$additio2","_responsivity$chips","_responsivity$chips2","_responsivity$actions","_responsivity$actions2","_responsivity$linebre","elementsClassNames","className","testId","logo","additionalControls","title","padModeDisabled","padModeWells","dqData","asset","lastUpdate","additionalActions","showComments","titleControls","disableSettings","showAssetChips","disableAssetSelector","titleMenuActions","_ref$titleControlsPos","titleControlsPosition","responsivenessConfig","rootRef","useRef","_useAppCommonsInterna","useAppCommonsInternal","app","appName","well","contextWells","wells","rig","fracFleet","interventionUnit","isExpanded","setSeparateWindowTitle","isInsideNewMobileApp","disableAppAssetSelection","isMultiRig","isCompletionPadMode","getAppSegment","SEGMENTS","COMPLETION","hasPadModeAssets","isEmpty","shouldDisableAssetControls","hasPadMode","chipsWidth","undefined","titleControlsLeft","versionRef","padModeRef","additionalControlsRef","titleControlsRef","chipsRef","logoRef","actionsRef","assetName","name","useEffect","filter","Boolean","join","responsivity","useResponsivity","disabled","_jsxs","_objectSpread","classNames","styles","root","ref","style","AppHeaderFinderProps","children","_jsx","jsx","logoContainer","src","alt","AppTitle","titleWithControlsLeft","lastInLine","HideInNativeApp","version","VersionSelect","versionSelect","padMode","PadModeSelect","AppHeaderTestIds","PadModeSelectTestId","AdditionalControlsTestId","assetChips","chips","AssetChips","actions","ActionsRootTestId","Actions","hideSettingsUnderMore","linebreaks","map","css","index","responsivenessLineBreak"],"mappings":"ynDAyEiD,SAqB3CA,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EApBJC,IAAAA,mBACAC,IAAAA,UACAC,IAAAA,OACAC,IAAAA,KACAC,IAAAA,mBACAC,IAAAA,MACAC,IAAAA,gBACAC,IAAAA,aACAC,IAAAA,OACAC,IAAAA,MACAC,IAAAA,WACAC,IAAAA,kBACAC,IAAAA,aACAC,IAAAA,cACAC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,qBACAC,IAAAA,iBAAgBC,EAAAnC,EAChBoC,sBAAAA,cAAwB,QAAOD,EAC/BE,KAAAA,qBAEMC,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A,EACnBC,aAAcA,EACdE,gBAAiBA,EACjBmF,sBAAuB7E,cAAoB,EAApBA,GAAsB6E,0BAIzB,QAFlBlG,EAEL+D,GAAaoC,kBAAU,IAAAnG,OAAA,EAAvBA,EAAyBoG,KAAI,SAACC,EAAKC,GAAK,OACvC3B,EAAAA,IAAA,MAAA,CAAKzE,UAAWmE,EAAOkC,wBAAyB/B,MAAO6B,GAAUC,EAAS,OAIlF"}
1
+ {"version":3,"file":"AppHeaderV3.js","sources":["../../../../../src/componentsV2/AppHeader/V3/AppHeaderV3.tsx"],"sourcesContent":["import { FC, ReactElement, ReactNode, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport { isEmpty } from 'lodash';\n\nimport { SEGMENTS } from '../../../constants/segment';\nimport { getAppSegment } from '../../../utils/devcenter';\nimport { PadModeSelect } from '../../PadModeSelect';\nimport { AppHeaderTestIds, Asset, UseWellnessAlertsReturnType } from '../AppHeader.constants';\nimport { useAppCommonsInternal } from '../../AppCommonsProvider';\nimport { HideInNativeApp } from '../../HideInNativeApp';\nimport { AppHeaderFinderProps } from '../../utils';\n\nimport { VersionSelect } from './VersionSelect';\nimport { AssetChips } from './AssetChips';\nimport { AppTitle } from './AppTitle';\nimport { useResponsivity } from './useResponsivity';\nimport { AdditionalAction, TitleMenuAction } from './constants';\nimport { Actions } from './Actions';\n\nimport styles from './AppHeaderV3.scss';\n\nexport type AppHeaderV3Props = {\n logo?: string | ReactElement;\n\n additionalControls?: ReactNode;\n\n /**\n * Used to put some controls alongside title\n */\n titleControls?: ReactNode;\n titleControlsPosition?: 'right' | 'left';\n\n /**\n * An escape hatch to tweak the styling of internal elements\n *\n * `buttons`, `titleControls` and `versionSelect` are for *V3 only*\n */\n elementsClassNames?: {\n title?: string;\n additionalControls?: string;\n chips?: string;\n actions?: string;\n versionSelect?: string;\n titleControls?: string;\n logoContainer?: string;\n };\n\n title?: ReactNode;\n padModeDisabled?: boolean;\n padModeWells?: ReturnType<typeof useAppCommonsInternal>['wells'];\n\n lastUpdate?: number | string | Date;\n asset?: Asset | Asset[];\n dqData?: UseWellnessAlertsReturnType;\n showComments?: boolean;\n additionalActions?: AdditionalAction[];\n disableSettings?: boolean;\n showAssetChips?: boolean;\n disableAssetSelector?: boolean;\n titleMenuActions?: TitleMenuAction[];\n\n /**\n * Configuration for responsive behavior of header elements\n * - `hideSettingsUnderMore`: When true, settings button will be hidden under \"More\" menu at smaller screen sizes\n */\n responsivenessConfig?: {\n hideSettingsUnderMore?: boolean;\n };\n\n className?: string;\n testId?: string;\n};\n\nexport const AppHeaderV3: FC<AppHeaderV3Props> = ({\n elementsClassNames,\n className,\n testId,\n logo,\n additionalControls,\n title,\n padModeDisabled,\n padModeWells,\n dqData,\n asset,\n lastUpdate,\n additionalActions,\n showComments,\n titleControls,\n disableSettings,\n showAssetChips,\n disableAssetSelector,\n titleMenuActions,\n titleControlsPosition = 'right',\n responsivenessConfig,\n}) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const {\n app,\n appName,\n well,\n wells: contextWells,\n rig,\n fracFleet,\n interventionUnit,\n isExpanded,\n setSeparateWindowTitle,\n isInsideNewMobileApp,\n disableAppAssetSelection,\n isMultiRig,\n dashboardMeta,\n } = useAppCommonsInternal();\n\n const isEmbedded = !!dashboardMeta?.isEmbedded;\n const segment = getAppSegment(app);\n const wells = padModeWells || contextWells;\n const isCompletionPadMode = segment === SEGMENTS.COMPLETION && !well;\n const hasPadModeAssets = !isEmpty(wells) && !!fracFleet;\n const shouldDisableAssetControls = disableAppAssetSelection || isMultiRig;\n const canShowPadMode =\n !isEmbedded && !disableAppAssetSelection && !padModeDisabled && !isInsideNewMobileApp;\n const hasPadMode = canShowPadMode && isCompletionPadMode && hasPadModeAssets;\n\n const possiblyNarrowChips =\n hasPadMode || !!additionalControls || !!titleControls ? 'narrow' : undefined;\n const chipsWidth = logo ? 'ultranarrow' : possiblyNarrowChips;\n\n const titleControlsLeft = titleControlsPosition === 'left' && !!titleControls;\n\n const versionRef = useRef<HTMLDivElement>(null);\n const padModeRef = useRef<HTMLDivElement>(null);\n const additionalControlsRef = useRef<HTMLDivElement>(null);\n const titleControlsRef = useRef<HTMLDivElement>(null);\n const chipsRef = useRef<HTMLDivElement>(null);\n const logoRef = useRef<HTMLDivElement>(null);\n const actionsRef = useRef<HTMLDivElement>(null);\n\n const assetName = well?.name ?? rig?.name ?? fracFleet?.name ?? interventionUnit?.name;\n\n useEffect(() => {\n setSeparateWindowTitle?.([appName, assetName].filter(Boolean).join(' - '));\n }, [setSeparateWindowTitle, appName, assetName]);\n\n const responsivity = useResponsivity({\n disabled: isInsideNewMobileApp || isEmbedded,\n titleControlsLeft,\n\n rootRef,\n versionRef,\n additionalControlsRef,\n titleControlsRef,\n logoRef,\n padModeRef,\n chipsRef,\n actionsRef,\n });\n\n return (\n <div\n className={classNames(styles.root, isEmbedded && styles.embedded, className)}\n data-testid={testId}\n ref={rootRef}\n style={responsivity.root?.style}\n {...AppHeaderFinderProps}\n >\n {!isEmbedded && (\n <>\n <div\n className={classNames(styles.logoContainer, elementsClassNames?.logoContainer)}\n ref={logoRef}\n >\n {logo && typeof logo === 'string' ? (\n <img className={styles.logo} src={logo} alt=\"Logo\" />\n ) : (\n logo\n )}\n </div>\n\n <AppTitle\n title={isExpanded ? assetName ?? title : title}\n asset={asset}\n dqData={dqData}\n lastUpdate={lastUpdate}\n className={classNames(\n styles.title,\n titleControlsLeft && styles.titleWithControlsLeft,\n elementsClassNames?.title\n )}\n disableAssetSelector={disableAssetSelector}\n titleMenuActions={titleMenuActions}\n style={responsivity.title?.style}\n />\n </>\n )}\n\n {titleControls && (\n <div\n className={classNames(\n styles.titleControls,\n titleControlsLeft && styles.titleControlsLeft,\n responsivity.titleControls?.lastInLine && styles.lastInLine,\n elementsClassNames?.titleControls\n )}\n ref={titleControlsRef}\n style={responsivity.titleControls?.style}\n >\n {titleControls}\n </div>\n )}\n\n <HideInNativeApp>\n <div className={styles.version} ref={versionRef}>\n <VersionSelect className={elementsClassNames?.versionSelect} />\n </div>\n </HideInNativeApp>\n\n {hasPadMode && (\n <div\n className={classNames(\n styles.padMode,\n responsivity.padMode?.lastInLine && styles.lastInLine\n )}\n ref={padModeRef}\n style={responsivity.padMode?.style}\n >\n <PadModeSelect testId={AppHeaderTestIds.PadModeSelectTestId} />\n </div>\n )}\n\n {additionalControls && (\n <div\n className={classNames(\n styles.additionalControls,\n responsivity.additionalControls?.lastInLine && styles.lastInLine,\n elementsClassNames?.additionalControls\n )}\n ref={additionalControlsRef}\n style={responsivity.additionalControls?.style}\n data-testid={AppHeaderTestIds.AdditionalControlsTestId}\n >\n {additionalControls}\n </div>\n )}\n\n {!isEmbedded && !shouldDisableAssetControls && showAssetChips && (\n <HideInNativeApp>\n <div\n className={classNames(\n styles.assetChips,\n responsivity.chips?.lastInLine && styles.lastInLine,\n elementsClassNames?.chips\n )}\n ref={chipsRef}\n style={responsivity.chips?.style}\n >\n <AssetChips chipsWidth={chipsWidth} />\n </div>\n </HideInNativeApp>\n )}\n\n <div\n className={classNames(\n styles.actions,\n responsivity.actions?.lastInLine && styles.lastInLine,\n elementsClassNames?.actions\n )}\n ref={actionsRef}\n style={responsivity.actions?.style}\n data-testid={AppHeaderTestIds.ActionsRootTestId}\n >\n <Actions\n additionalActions={additionalActions}\n showComments={showComments}\n disableSettings={disableSettings}\n hideSettingsUnderMore={responsivenessConfig?.hideSettingsUnderMore}\n />\n </div>\n\n {responsivity.linebreaks?.map((css, index) => (\n <div className={styles.responsivenessLineBreak} style={css} key={index} />\n ))}\n </div>\n );\n};\n"],"names":["_ref","_ref2","_ref3","_well$name","_responsivity$root","_responsivity$title","_responsivity$titleCo","_responsivity$titleCo2","_responsivity$padMode","_responsivity$padMode2","_responsivity$additio","_responsivity$additio2","_responsivity$chips","_responsivity$chips2","_responsivity$actions","_responsivity$actions2","_responsivity$linebre","elementsClassNames","className","testId","logo","additionalControls","title","padModeDisabled","padModeWells","dqData","asset","lastUpdate","additionalActions","showComments","titleControls","disableSettings","showAssetChips","disableAssetSelector","titleMenuActions","_ref$titleControlsPos","titleControlsPosition","responsivenessConfig","rootRef","useRef","_useAppCommonsInterna","useAppCommonsInternal","app","appName","well","contextWells","wells","rig","fracFleet","interventionUnit","isExpanded","setSeparateWindowTitle","isInsideNewMobileApp","disableAppAssetSelection","isMultiRig","dashboardMeta","isEmbedded","isCompletionPadMode","getAppSegment","SEGMENTS","COMPLETION","hasPadModeAssets","isEmpty","shouldDisableAssetControls","hasPadMode","chipsWidth","undefined","titleControlsLeft","versionRef","padModeRef","additionalControlsRef","titleControlsRef","chipsRef","logoRef","actionsRef","assetName","name","useEffect","filter","Boolean","join","responsivity","useResponsivity","disabled","_jsxs","_objectSpread","classNames","styles","root","embedded","ref","style","AppHeaderFinderProps","children","_Fragment","_jsx","jsx","logoContainer","src","alt","AppTitle","titleWithControlsLeft","lastInLine","HideInNativeApp","version","VersionSelect","versionSelect","padMode","PadModeSelect","AppHeaderTestIds","PadModeSelectTestId","AdditionalControlsTestId","assetChips","chips","AssetChips","actions","ActionsRootTestId","Actions","hideSettingsUnderMore","linebreaks","map","css","index","responsivenessLineBreak"],"mappings":"ynDAyEiD,SAqB3CA,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EApBJC,IAAAA,mBACAC,IAAAA,UACAC,IAAAA,OACAC,IAAAA,KACAC,IAAAA,mBACAC,IAAAA,MACAC,IAAAA,gBACAC,IAAAA,aACAC,IAAAA,OACAC,IAAAA,MACAC,IAAAA,WACAC,IAAAA,kBACAC,IAAAA,aACAC,IAAAA,cACAC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,qBACAC,IAAAA,iBAAgBC,EAAAnC,EAChBoC,sBAAAA,cAAwB,QAAOD,EAC/BE,KAAAA,qBAEMC,GAAUC,SAAuB,MACvCC,GAcIC,EAAAA,wBAbFC,MAAAA,IACAC,MAAAA,QAC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C7B,cAAakB,EAAgBA,iBAACO,kBAAkBvB,SAEhDE,MAACsB,UAAO,CACNzF,kBAAmBA,EACnBC,aAAcA,EACdE,gBAAiBA,EACjBuF,sBAAuBjF,cAAoB,EAApBA,GAAsBiF,0BAIzB,QAFlBtG,EAELiE,GAAasC,kBAAU,IAAAvG,OAAA,EAAvBA,EAAyBwG,KAAI,SAACC,EAAKC,GAAK,OACvC3B,EAAAA,IAAA,MAAA,CAAK7E,UAAWqE,EAAOoC,wBAAyBhC,MAAO8B,GAAUC,EAAS,OAIlF"}
@@ -1,2 +1,2 @@
1
- "use strict";require('./../../../ext-esm/style-inject/dist/style-inject.es.js')(".AppHeaderV3_root__urLNv{--headerV3-responsivity-flexwrap:wrap;align-items:center;display:flex;flex-direction:row;flex-wrap:var(--headerV3-responsivity-flexwrap);gap:0 8px;min-height:48px;overflow:hidden;padding:6px 0;width:100%}.AppHeaderV3_logoContainer__Bv-lU{max-height:36px;max-width:130px;overflow:hidden}.AppHeaderV3_logo__0VO16{display:block;max-height:36px;max-width:100%}.AppHeaderV3_title__vVZB9{flex:1 0 90px;min-width:90px}.AppHeaderV3_titleWithControlsLeft__Mnnkm{--headerV3-responsivity-marginRight:auto;--headerV3-responsivity-maxWidth:100%;flex:0 1 auto;margin-right:var(--headerV3-responsivity-marginRight);max-width:var(--headerV3-responsivity-maxWidth);min-width:1px}.AppHeaderV3_additionalControls__-QrO4,.AppHeaderV3_assetChips__4LwGe,.AppHeaderV3_logoContainer__Bv-lU,.AppHeaderV3_padMode__-uTzy,.AppHeaderV3_titleControls__Yzl06,.AppHeaderV3_version__Acke3{align-items:center;display:flex;flex-flow:row nowrap;flex-shrink:0;gap:8px;min-height:36px;order:var(--headerV3-responsivity-order)}.AppHeaderV3_additionalControls__-QrO4:empty,.AppHeaderV3_assetChips__4LwGe:empty,.AppHeaderV3_logoContainer__Bv-lU:empty,.AppHeaderV3_padMode__-uTzy:empty,.AppHeaderV3_titleControls__Yzl06:empty,.AppHeaderV3_version__Acke3:empty{display:none}.AppHeaderV3_titleControlsLeft__NrIwI{margin-right:auto}.AppHeaderV3_actions__Q0PRr{align-items:center;display:flex;flex:0 0 auto;flex-flow:row nowrap;gap:8px;min-height:36px;order:var(--headerV3-responsivity-order)}.AppHeaderV3_responsivenessLineBreak__2QL6d{flex:0 0 100%}.AppHeaderV3_lastInLine__cbmHb{margin-left:auto}"),module.exports={spacing:"8",gap:"8px",titleMinWidth:"90px",root:"AppHeaderV3_root__urLNv",logoContainer:"AppHeaderV3_logoContainer__Bv-lU",logo:"AppHeaderV3_logo__0VO16",title:"AppHeaderV3_title__vVZB9",titleWithControlsLeft:"AppHeaderV3_titleWithControlsLeft__Mnnkm",additionalControls:"AppHeaderV3_additionalControls__-QrO4",titleControls:"AppHeaderV3_titleControls__Yzl06",assetChips:"AppHeaderV3_assetChips__4LwGe",padMode:"AppHeaderV3_padMode__-uTzy",version:"AppHeaderV3_version__Acke3",titleControlsLeft:"AppHeaderV3_titleControlsLeft__NrIwI",actions:"AppHeaderV3_actions__Q0PRr",responsivenessLineBreak:"AppHeaderV3_responsivenessLineBreak__2QL6d",lastInLine:"AppHeaderV3_lastInLine__cbmHb"};
1
+ "use strict";require('./../../../ext-esm/style-inject/dist/style-inject.es.js')(".AppHeaderV3_root__urLNv{--headerV3-responsivity-flexwrap:wrap;align-items:center;display:flex;flex-direction:row;flex-wrap:var(--headerV3-responsivity-flexwrap);gap:0 8px;min-height:48px;overflow:hidden;padding:6px 0;width:100%}.AppHeaderV3_logoContainer__Bv-lU{max-height:36px;max-width:130px;overflow:hidden}.AppHeaderV3_logo__0VO16{display:block;max-height:36px;max-width:100%}.AppHeaderV3_title__vVZB9{flex:1 0 90px;min-width:90px}.AppHeaderV3_titleWithControlsLeft__Mnnkm{--headerV3-responsivity-marginRight:auto;--headerV3-responsivity-maxWidth:100%;flex:0 1 auto;margin-right:var(--headerV3-responsivity-marginRight);max-width:var(--headerV3-responsivity-maxWidth);min-width:1px}.AppHeaderV3_additionalControls__-QrO4,.AppHeaderV3_assetChips__4LwGe,.AppHeaderV3_logoContainer__Bv-lU,.AppHeaderV3_padMode__-uTzy,.AppHeaderV3_titleControls__Yzl06,.AppHeaderV3_version__Acke3{align-items:center;display:flex;flex-flow:row nowrap;flex-shrink:0;gap:8px;min-height:36px;order:var(--headerV3-responsivity-order)}.AppHeaderV3_additionalControls__-QrO4:empty,.AppHeaderV3_assetChips__4LwGe:empty,.AppHeaderV3_logoContainer__Bv-lU:empty,.AppHeaderV3_padMode__-uTzy:empty,.AppHeaderV3_titleControls__Yzl06:empty,.AppHeaderV3_version__Acke3:empty{display:none}.AppHeaderV3_titleControlsLeft__NrIwI{margin-right:auto}.AppHeaderV3_actions__Q0PRr{align-items:center;display:flex;flex:0 0 auto;flex-flow:row nowrap;gap:8px;min-height:36px;order:var(--headerV3-responsivity-order)}.AppHeaderV3_responsivenessLineBreak__2QL6d{flex:0 0 100%}.AppHeaderV3_lastInLine__cbmHb{margin-left:auto}.AppHeaderV3_embedded__2p-8Z{gap:8px;min-height:32px;overflow:visible;padding:0}.AppHeaderV3_embedded__2p-8Z .AppHeaderV3_titleControls__Yzl06{flex:1 1 auto;flex-wrap:wrap;min-width:0}.AppHeaderV3_embedded__2p-8Z .AppHeaderV3_actions__Q0PRr,.AppHeaderV3_embedded__2p-8Z .AppHeaderV3_additionalControls__-QrO4,.AppHeaderV3_embedded__2p-8Z .AppHeaderV3_titleControls__Yzl06,.AppHeaderV3_embedded__2p-8Z .AppHeaderV3_version__Acke3{min-height:32px;order:0}.AppHeaderV3_embedded__2p-8Z .AppHeaderV3_version__Acke3{margin-left:auto}.AppHeaderV3_embedded__2p-8Z .AppHeaderV3_actions__Q0PRr{flex-wrap:wrap}"),module.exports={spacing:"8",gap:"8px",titleMinWidth:"90px",root:"AppHeaderV3_root__urLNv",logoContainer:"AppHeaderV3_logoContainer__Bv-lU",logo:"AppHeaderV3_logo__0VO16",title:"AppHeaderV3_title__vVZB9",titleWithControlsLeft:"AppHeaderV3_titleWithControlsLeft__Mnnkm",additionalControls:"AppHeaderV3_additionalControls__-QrO4",titleControls:"AppHeaderV3_titleControls__Yzl06",assetChips:"AppHeaderV3_assetChips__4LwGe",padMode:"AppHeaderV3_padMode__-uTzy",version:"AppHeaderV3_version__Acke3",titleControlsLeft:"AppHeaderV3_titleControlsLeft__NrIwI",actions:"AppHeaderV3_actions__Q0PRr",responsivenessLineBreak:"AppHeaderV3_responsivenessLineBreak__2QL6d",lastInLine:"AppHeaderV3_lastInLine__cbmHb",embedded:"AppHeaderV3_embedded__2p-8Z"};
2
2
  //# sourceMappingURL=AppHeaderV3.scss.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),n=require("lodash"),o=require("./constants.scss.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(e),l=i(r);function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){s.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var c=parseInt(o.gap,10),u=parseInt(o.titleMinWidth,10)+c,y=function(e){var r;return(null===(r=e.current)||void 0===r?void 0:r.getBoundingClientRect().width)||0},f=function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];var o=t.filter((function(e){return!!e.current&&e.current.offsetWidth>0}));return e+o.reduce((function(e,r){return e+y(r)}),0)+(o.length>1?(o.length-1)*c:0)};exports.useResponsivity=function(e){var r=e.disabled,o=e.actionsRef,i=e.chipsRef,s=e.logoRef,a=e.rootRef,y=e.titleControlsRef,p=e.additionalControlsRef,v=e.versionRef,h=e.padModeRef,b=e.titleControlsLeft,O=t.useState({}),g=l.default(O,2),V=g[0],j=g[1],w=t.useRef(-1);return t.useEffect((function(){var e=n.throttle((function(){requestAnimationFrame((function(){var e,r=(null===(e=a.current)||void 0===e?void 0:e.offsetWidth)||0,t=function(e){var t,l=b&&f(u,s,v,i,o,y,p,h)<=r?d(d({},e),{},{root:{style:d(d({},null===(t=e.root)||void 0===t?void 0:t.style),{},{"--headerV3-responsivity-flexwrap":"nowrap"})}}):e;j((function(e){return n.isEqual(e,l)?e:l}))},l=function(){if(b){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=f.apply(void 0,[0].concat(r))+c;return{"--headerV3-responsivity-maxWidth":"calc(100% - ".concat(n,"px)")}}};f(u,s,v,i,o,y,p,h)<=r?t({title:{style:{"--headerV3-responsivity-marginRight":0}}}):f(u,s,v,i,o)<=r?t({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},padMode:{style:{"--headerV3-responsivity-order":120}},additionalControls:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},title:{style:l(s,v,i,o)}}):!h.current&&f(u,s,v,i)<=r?t({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},actions:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},title:{style:l(s,v,i)}}):f(u,s,v,i)<=r&&f(0,y,p,h,o)<=r?t({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},padMode:{style:{"--headerV3-responsivity-order":130}},actions:{style:{"--headerV3-responsivity-order":140},lastInLine:!0},title:{style:l(s,v,i)}}):t({linebreaks:[{order:100},{order:200}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},actions:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},padMode:{style:{"--headerV3-responsivity-order":210}},chips:{style:{"--headerV3-responsivity-order":220},lastInLine:!0},title:{style:l(s,v)}})}))}),100,{leading:!0}),t=new ResizeObserver((function(){var r,t=(null===(r=a.current)||void 0===r?void 0:r.offsetWidth)||0;t!==w.current&&e(),w.current=t})),l=new MutationObserver(e);return a.current&&!r&&(t.observe(a.current),l.observe(a.current,{childList:!0,subtree:!0,characterData:!0}),e.cancel()),function(){t.disconnect(),l.disconnect()}}),[o,i,s,a,y,p,v,h,r,b]),V};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),n=require("lodash"),o=require("./constants.scss.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(e),l=i(r);function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach((function(r){s.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var c=parseInt(o.gap,10),u=parseInt(o.titleMinWidth,10)+c,y=function(e){var r;return(null===(r=e.current)||void 0===r?void 0:r.getBoundingClientRect().width)||0},f=function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];var o=t.filter((function(e){return!!e.current&&e.current.offsetWidth>0}));return e+o.reduce((function(e,r){return e+y(r)}),0)+(o.length>1?(o.length-1)*c:0)};exports.useResponsivity=function(e){var r=e.disabled,o=e.actionsRef,i=e.chipsRef,s=e.logoRef,a=e.rootRef,y=e.titleControlsRef,p=e.additionalControlsRef,v=e.versionRef,h=e.padModeRef,b=e.titleControlsLeft,O=t.useState({}),g=l.default(O,2),V=g[0],j=g[1],w=t.useRef(-1);return t.useEffect((function(){var e=n.throttle((function(){requestAnimationFrame((function(){var e,r=(null===(e=a.current)||void 0===e?void 0:e.offsetWidth)||0,t=function(e){var t,l=b&&f(u,s,v,i,o,y,p,h)<=r?d(d({},e),{},{root:{style:d(d({},null===(t=e.root)||void 0===t?void 0:t.style),{},{"--headerV3-responsivity-flexwrap":"nowrap"})}}):e;j((function(e){return n.isEqual(e,l)?e:l}))},l=function(){if(b){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=f.apply(void 0,[0].concat(r))+c;return{"--headerV3-responsivity-maxWidth":"calc(100% - ".concat(n,"px)")}}};f(u,s,v,i,o,y,p,h)<=r?t({title:{style:{"--headerV3-responsivity-marginRight":0}}}):f(u,s,v,i,o)<=r?t({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},padMode:{style:{"--headerV3-responsivity-order":120}},additionalControls:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},title:{style:l(s,v,i,o)}}):!h.current&&f(u,s,v,i)<=r?t({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},actions:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},title:{style:l(s,v,i)}}):f(u,s,v,i)<=r&&f(0,y,p,h,o)<=r?t({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},padMode:{style:{"--headerV3-responsivity-order":130}},actions:{style:{"--headerV3-responsivity-order":140},lastInLine:!0},title:{style:l(s,v,i)}}):t({linebreaks:[{order:100},{order:200}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},actions:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},padMode:{style:{"--headerV3-responsivity-order":210}},chips:{style:{"--headerV3-responsivity-order":220},lastInLine:!0},title:{style:l(s,v)}})}))}),100,{leading:!0}),t=new ResizeObserver((function(){var r,t=(null===(r=a.current)||void 0===r?void 0:r.offsetWidth)||0;t!==w.current&&e(),w.current=t})),l=new MutationObserver(e);return a.current&&!r&&(t.observe(a.current),l.observe(a.current,{childList:!0,subtree:!0,characterData:!0}),e.cancel()),function(){t.disconnect(),l.disconnect()}}),[o,i,s,a,y,p,v,h,r,b]),r?{}:V};
2
2
  //# sourceMappingURL=useResponsivity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useResponsivity.js","sources":["../../../../../src/componentsV2/AppHeader/V3/useResponsivity.tsx"],"sourcesContent":["import { CSSProperties, RefObject, useEffect, useRef, useState } from 'react';\nimport { isEqual, throttle } from 'lodash';\n\nimport CssConstants from './constants.scss';\n\ntype Params = {\n disabled?: boolean;\n titleControlsLeft?: boolean;\n\n rootRef: RefObject<HTMLElement>;\n versionRef: RefObject<HTMLElement>;\n padModeRef: RefObject<HTMLElement>;\n additionalControlsRef: RefObject<HTMLElement>;\n titleControlsRef: RefObject<HTMLElement>;\n chipsRef: RefObject<HTMLElement>;\n logoRef: RefObject<HTMLElement>;\n actionsRef: RefObject<HTMLElement>;\n};\n\ntype ResponsivityDataItem = {\n style?: CSSProperties & Record<`--${string}`, number | string>;\n lastInLine?: boolean;\n};\n\ntype ResponsivityData = {\n root?: ResponsivityDataItem;\n padMode?: ResponsivityDataItem;\n additionalControls?: ResponsivityDataItem;\n titleControls?: ResponsivityDataItem;\n chips?: ResponsivityDataItem;\n actions?: ResponsivityDataItem;\n title?: ResponsivityDataItem;\n\n linebreaks?: CSSProperties[];\n};\n\nconst gap = parseInt(CssConstants.gap, 10);\nconst titleMinWidth = parseInt(CssConstants.titleMinWidth, 10) + gap;\n\nconst getRefWidth = (ref: RefObject<HTMLElement>) => {\n // This causes a reflow, so if it lags too much - use the `ref.current?.offsetWidth + 1`\n // `ref.current?.offsetWidth` rounds pixel fractions so it may produce incorrect results/need adjustment\n return ref.current?.getBoundingClientRect().width || 0;\n};\n\nconst sumLineWidth = (titleMinWidth: number, ...lineRefs: RefObject<HTMLElement>[]) => {\n const filteredRefs = lineRefs.filter(ref => !!ref.current && ref.current.offsetWidth > 0);\n return (\n titleMinWidth +\n filteredRefs.reduce((acc, ref) => acc + getRefWidth(ref), 0) +\n (filteredRefs.length > 1 ? (filteredRefs.length - 1) * gap : 0)\n );\n};\n\n/**\n * Detects when child elements stop fitting in a single header line and returns CSS orders, linebreaks, & other info for header elements\n *\n * There are several possible layouts:\n *\n * 1. Everything fits in one line\n * 2. 2 lines:\n * [logo] [title] [version] [asset chips] [actions]\n * [title controls] [pad mode] [additional controls]\n * and other variants that fit into 2 lines\n * 3. 3 lines:\n * [logo] [title] [version]\n * [title controls] [additional controls] [actions]\n * [pad mode] [chips]\n */\nexport const useResponsivity = ({\n disabled,\n actionsRef,\n chipsRef,\n logoRef,\n rootRef,\n titleControlsRef,\n additionalControlsRef,\n versionRef,\n padModeRef,\n titleControlsLeft,\n}: Params) => {\n const [value, setValue] = useState<ResponsivityData>({});\n const previousWidthRef = useRef(-1);\n\n useEffect(() => {\n const calculateCss = throttle(\n () => {\n requestAnimationFrame(() => {\n const rootWidth = rootRef.current?.offsetWidth || 0;\n\n const setCss = (baseData: ResponsivityData) => {\n // We need nowrap to properly handle title when app title is very long and we have title controls to the left\n const isNowrap =\n titleControlsLeft &&\n sumLineWidth(\n titleMinWidth,\n logoRef,\n versionRef,\n chipsRef,\n actionsRef,\n titleControlsRef,\n additionalControlsRef,\n padModeRef\n ) <= rootWidth;\n\n const data = isNowrap\n ? {\n ...baseData,\n root: {\n style: {\n ...baseData.root?.style,\n '--headerV3-responsivity-flexwrap': 'nowrap',\n },\n },\n }\n : baseData;\n\n // Prevent unnecessary rerenders & rerender loop: recalc -> update values -> recalc -> update values to the same values\n setValue(value => (isEqual(value, data) ? value : data));\n };\n\n const getTitleMaxWidthStyle = (...refs: RefObject<HTMLElement>[]) => {\n if (!titleControlsLeft) {\n return undefined;\n }\n\n const pixels = sumLineWidth(0, ...refs) + gap;\n return { '--headerV3-responsivity-maxWidth': `calc(100% - ${pixels}px)` };\n };\n\n // Case 1 - everything fits\n if (\n sumLineWidth(\n titleMinWidth,\n logoRef,\n versionRef,\n chipsRef,\n actionsRef,\n titleControlsRef,\n additionalControlsRef,\n padModeRef\n ) <= rootWidth\n ) {\n setCss({\n title: { style: { '--headerV3-responsivity-marginRight': 0 } },\n });\n }\n // 2 lines\n // [logo] [title] [version] [asset chips] [actions]\n // [title controls] [pad mode] [additional controls]\n else if (\n sumLineWidth(titleMinWidth, logoRef, versionRef, chipsRef, actionsRef) <= rootWidth\n ) {\n setCss({\n linebreaks: [{ order: 100 }],\n titleControls: { style: { '--headerV3-responsivity-order': 110 } },\n padMode: { style: { '--headerV3-responsivity-order': 120 } },\n additionalControls: {\n style: { '--headerV3-responsivity-order': 130 },\n lastInLine: true,\n },\n title: { style: getTitleMaxWidthStyle(logoRef, versionRef, chipsRef, actionsRef) },\n });\n }\n // 2 lines - no padmode, has chips\n // [logo] [title] [version] [asset chips]\n // [title controls] [additional controls] [actions]\n else if (\n !padModeRef.current &&\n sumLineWidth(titleMinWidth, logoRef, versionRef, chipsRef) <= rootWidth\n ) {\n setCss({\n linebreaks: [{ order: 100 }],\n titleControls: { style: { '--headerV3-responsivity-order': 110 } },\n additionalControls: { style: { '--headerV3-responsivity-order': 120 } },\n actions: { style: { '--headerV3-responsivity-order': 130 }, lastInLine: true },\n\n title: { style: getTitleMaxWidthStyle(logoRef, versionRef, chipsRef) },\n });\n }\n // 2 lines:\n // [logo] [title] [version] [chips]\n // [title controls] [additional controls] [pad mode] [actions]\n else if (\n sumLineWidth(titleMinWidth, logoRef, versionRef, chipsRef) <= rootWidth &&\n sumLineWidth(0, titleControlsRef, additionalControlsRef, padModeRef, actionsRef) <=\n rootWidth\n ) {\n setCss({\n linebreaks: [{ order: 100 }],\n titleControls: { style: { '--headerV3-responsivity-order': 110 } },\n additionalControls: { style: { '--headerV3-responsivity-order': 120 } },\n padMode: { style: { '--headerV3-responsivity-order': 130 } },\n actions: { style: { '--headerV3-responsivity-order': 140 }, lastInLine: true },\n\n title: { style: getTitleMaxWidthStyle(logoRef, versionRef, chipsRef) },\n });\n }\n // 3 lines\n // [logo] [title] [version]\n // [title controls] [additional controls] [actions]\n // [pad mode] [chips]\n else {\n setCss({\n linebreaks: [{ order: 100 }, { order: 200 }],\n titleControls: { style: { '--headerV3-responsivity-order': 110 } },\n additionalControls: { style: { '--headerV3-responsivity-order': 120 } },\n actions: { style: { '--headerV3-responsivity-order': 130 }, lastInLine: true },\n padMode: { style: { '--headerV3-responsivity-order': 210 } },\n chips: { style: { '--headerV3-responsivity-order': 220 }, lastInLine: true },\n\n title: { style: getTitleMaxWidthStyle(logoRef, versionRef) },\n });\n }\n });\n },\n 100,\n { leading: true }\n );\n\n const resizeObserver = new ResizeObserver(() => {\n const rootWidth = rootRef.current?.offsetWidth || 0;\n if (rootWidth !== previousWidthRef.current) {\n calculateCss();\n }\n previousWidthRef.current = rootWidth;\n });\n const mutationObserver = new MutationObserver(calculateCss);\n\n if (rootRef.current && !disabled) {\n resizeObserver.observe(rootRef.current);\n mutationObserver.observe(rootRef.current, {\n childList: true,\n subtree: true,\n characterData: true,\n });\n calculateCss.cancel();\n }\n\n return () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n }, [\n actionsRef,\n chipsRef,\n logoRef,\n rootRef,\n titleControlsRef,\n additionalControlsRef,\n versionRef,\n padModeRef,\n disabled,\n titleControlsLeft,\n ]);\n\n return value;\n};\n"],"names":["gap","parseInt","CssConstants","titleMinWidth","getRefWidth","ref","_ref$current","current","getBoundingClientRect","width","sumLineWidth","_len","arguments","length","lineRefs","Array","_key","filteredRefs","filter","offsetWidth","reduce","acc","_ref","disabled","actionsRef","chipsRef","logoRef","rootRef","titleControlsRef","additionalControlsRef","versionRef","padModeRef","titleControlsLeft","_useState","useState","_useState2","_slicedToArray","value","setValue","previousWidthRef","useRef","useEffect","calculateCss","throttle","requestAnimationFrame","_rootRef$current","rootWidth","setCss","baseData","_baseData$root","data","_objectSpread","root","style","isEqual","getTitleMaxWidthStyle","_len2","refs","_key2","pixels","apply","title","linebreaks","order","titleControls","padMode","additionalControls","lastInLine","actions","chips","leading","resizeObserver","ResizeObserver","_rootRef$current2","mutationObserver","MutationObserver","observe","childList","subtree","characterData","cancel","disconnect"],"mappings":"s5BAoCA,IAAMA,EAAMC,SAASC,EAAaF,IAAK,IACjCG,EAAgBF,SAASC,EAAaC,cAAe,IAAMH,EAE3DI,EAAc,SAACC,GAAgC,IAAAC,EAGnD,OAAkB,QAAXA,EAAAD,EAAIE,eAAO,IAAAD,OAAA,EAAXA,EAAaE,wBAAwBC,QAAS,CACvD,EAEMC,EAAe,SAACP,GAAiE,IAAA,IAAAQ,EAAAC,UAAAC,OAAvCC,EAAQ,IAAAC,MAAAJ,EAAA,EAAAA,EAAA,EAAA,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAARF,EAAQE,EAAA,GAAAJ,UAAAI,GACtD,IAAMC,EAAeH,EAASI,QAAO,SAAAb,GAAG,QAAMA,EAAIE,SAAWF,EAAIE,QAAQY,YAAc,KACvF,OACEhB,EACAc,EAAaG,QAAO,SAACC,EAAKhB,GAAG,OAAKgB,EAAMjB,EAAYC,EAAI,GAAE,IACzDY,EAAaJ,OAAS,GAAKI,EAAaJ,OAAS,GAAKb,EAAM,EAEjE,0BAiB+B,SAWjBsB,GAAA,IAVZC,IAAAA,SACAC,IAAAA,WACAC,IAAAA,SACAC,IAAAA,QACAC,IAAAA,QACAC,IAAAA,iBACAC,IAAAA,sBACAC,IAAAA,WACAC,IAAAA,WACAC,IAAAA,kBAEAC,EAA0BC,EAAQA,SAAmB,IAAGC,EAAAC,EAAAA,QAAAH,EAAA,GAA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C2B,IAAcP,EAAiBhC,SACjCmC,IAEFH,EAAiBhC,QAAUuC,CAC7B,IACM4B,EAAmB,IAAIC,iBAAiBjC,GAY9C,OAVIf,EAAQpB,UAAYgB,IACtBgD,EAAeK,QAAQjD,EAAQpB,SAC/BmE,EAAiBE,QAAQjD,EAAQpB,QAAS,CACxCsE,WAAW,EACXC,SAAS,EACTC,eAAe,IAEjBrC,EAAasC,UAGR,WACLT,EAAeU,aACfP,EAAiBO,aAEpB,GAAE,CACDzD,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAR,EACAS,IAGKK,CACT"}
1
+ {"version":3,"file":"useResponsivity.js","sources":["../../../../../src/componentsV2/AppHeader/V3/useResponsivity.tsx"],"sourcesContent":["import { CSSProperties, RefObject, useEffect, useRef, useState } from 'react';\nimport { isEqual, throttle } from 'lodash';\n\nimport CssConstants from './constants.scss';\n\ntype Params = {\n disabled?: boolean;\n titleControlsLeft?: boolean;\n\n rootRef: RefObject<HTMLElement>;\n versionRef: RefObject<HTMLElement>;\n padModeRef: RefObject<HTMLElement>;\n additionalControlsRef: RefObject<HTMLElement>;\n titleControlsRef: RefObject<HTMLElement>;\n chipsRef: RefObject<HTMLElement>;\n logoRef: RefObject<HTMLElement>;\n actionsRef: RefObject<HTMLElement>;\n};\n\ntype ResponsivityDataItem = {\n style?: CSSProperties & Record<`--${string}`, number | string>;\n lastInLine?: boolean;\n};\n\ntype ResponsivityData = {\n root?: ResponsivityDataItem;\n padMode?: ResponsivityDataItem;\n additionalControls?: ResponsivityDataItem;\n titleControls?: ResponsivityDataItem;\n chips?: ResponsivityDataItem;\n actions?: ResponsivityDataItem;\n title?: ResponsivityDataItem;\n\n linebreaks?: CSSProperties[];\n};\n\nconst gap = parseInt(CssConstants.gap, 10);\nconst titleMinWidth = parseInt(CssConstants.titleMinWidth, 10) + gap;\n\nconst getRefWidth = (ref: RefObject<HTMLElement>) => {\n // This causes a reflow, so if it lags too much - use the `ref.current?.offsetWidth + 1`\n // `ref.current?.offsetWidth` rounds pixel fractions so it may produce incorrect results/need adjustment\n return ref.current?.getBoundingClientRect().width || 0;\n};\n\nconst sumLineWidth = (titleMinWidth: number, ...lineRefs: RefObject<HTMLElement>[]) => {\n const filteredRefs = lineRefs.filter(ref => !!ref.current && ref.current.offsetWidth > 0);\n return (\n titleMinWidth +\n filteredRefs.reduce((acc, ref) => acc + getRefWidth(ref), 0) +\n (filteredRefs.length > 1 ? (filteredRefs.length - 1) * gap : 0)\n );\n};\n\n/**\n * Detects when child elements stop fitting in a single header line and returns CSS orders, linebreaks, & other info for header elements\n *\n * There are several possible layouts:\n *\n * 1. Everything fits in one line\n * 2. 2 lines:\n * [logo] [title] [version] [asset chips] [actions]\n * [title controls] [pad mode] [additional controls]\n * and other variants that fit into 2 lines\n * 3. 3 lines:\n * [logo] [title] [version]\n * [title controls] [additional controls] [actions]\n * [pad mode] [chips]\n */\nexport const useResponsivity = ({\n disabled,\n actionsRef,\n chipsRef,\n logoRef,\n rootRef,\n titleControlsRef,\n additionalControlsRef,\n versionRef,\n padModeRef,\n titleControlsLeft,\n}: Params) => {\n const [value, setValue] = useState<ResponsivityData>({});\n const previousWidthRef = useRef(-1);\n\n useEffect(() => {\n const calculateCss = throttle(\n () => {\n requestAnimationFrame(() => {\n const rootWidth = rootRef.current?.offsetWidth || 0;\n\n const setCss = (baseData: ResponsivityData) => {\n // We need nowrap to properly handle title when app title is very long and we have title controls to the left\n const isNowrap =\n titleControlsLeft &&\n sumLineWidth(\n titleMinWidth,\n logoRef,\n versionRef,\n chipsRef,\n actionsRef,\n titleControlsRef,\n additionalControlsRef,\n padModeRef\n ) <= rootWidth;\n\n const data = isNowrap\n ? {\n ...baseData,\n root: {\n style: {\n ...baseData.root?.style,\n '--headerV3-responsivity-flexwrap': 'nowrap',\n },\n },\n }\n : baseData;\n\n // Prevent unnecessary rerenders & rerender loop: recalc -> update values -> recalc -> update values to the same values\n setValue(value => (isEqual(value, data) ? value : data));\n };\n\n const getTitleMaxWidthStyle = (...refs: RefObject<HTMLElement>[]) => {\n if (!titleControlsLeft) {\n return undefined;\n }\n\n const pixels = sumLineWidth(0, ...refs) + gap;\n return { '--headerV3-responsivity-maxWidth': `calc(100% - ${pixels}px)` };\n };\n\n // Case 1 - everything fits\n if (\n sumLineWidth(\n titleMinWidth,\n logoRef,\n versionRef,\n chipsRef,\n actionsRef,\n titleControlsRef,\n additionalControlsRef,\n padModeRef\n ) <= rootWidth\n ) {\n setCss({\n title: { style: { '--headerV3-responsivity-marginRight': 0 } },\n });\n }\n // 2 lines\n // [logo] [title] [version] [asset chips] [actions]\n // [title controls] [pad mode] [additional controls]\n else if (\n sumLineWidth(titleMinWidth, logoRef, versionRef, chipsRef, actionsRef) <= rootWidth\n ) {\n setCss({\n linebreaks: [{ order: 100 }],\n titleControls: { style: { '--headerV3-responsivity-order': 110 } },\n padMode: { style: { '--headerV3-responsivity-order': 120 } },\n additionalControls: {\n style: { '--headerV3-responsivity-order': 130 },\n lastInLine: true,\n },\n title: { style: getTitleMaxWidthStyle(logoRef, versionRef, chipsRef, actionsRef) },\n });\n }\n // 2 lines - no padmode, has chips\n // [logo] [title] [version] [asset chips]\n // [title controls] [additional controls] [actions]\n else if (\n !padModeRef.current &&\n sumLineWidth(titleMinWidth, logoRef, versionRef, chipsRef) <= rootWidth\n ) {\n setCss({\n linebreaks: [{ order: 100 }],\n titleControls: { style: { '--headerV3-responsivity-order': 110 } },\n additionalControls: { style: { '--headerV3-responsivity-order': 120 } },\n actions: { style: { '--headerV3-responsivity-order': 130 }, lastInLine: true },\n\n title: { style: getTitleMaxWidthStyle(logoRef, versionRef, chipsRef) },\n });\n }\n // 2 lines:\n // [logo] [title] [version] [chips]\n // [title controls] [additional controls] [pad mode] [actions]\n else if (\n sumLineWidth(titleMinWidth, logoRef, versionRef, chipsRef) <= rootWidth &&\n sumLineWidth(0, titleControlsRef, additionalControlsRef, padModeRef, actionsRef) <=\n rootWidth\n ) {\n setCss({\n linebreaks: [{ order: 100 }],\n titleControls: { style: { '--headerV3-responsivity-order': 110 } },\n additionalControls: { style: { '--headerV3-responsivity-order': 120 } },\n padMode: { style: { '--headerV3-responsivity-order': 130 } },\n actions: { style: { '--headerV3-responsivity-order': 140 }, lastInLine: true },\n\n title: { style: getTitleMaxWidthStyle(logoRef, versionRef, chipsRef) },\n });\n }\n // 3 lines\n // [logo] [title] [version]\n // [title controls] [additional controls] [actions]\n // [pad mode] [chips]\n else {\n setCss({\n linebreaks: [{ order: 100 }, { order: 200 }],\n titleControls: { style: { '--headerV3-responsivity-order': 110 } },\n additionalControls: { style: { '--headerV3-responsivity-order': 120 } },\n actions: { style: { '--headerV3-responsivity-order': 130 }, lastInLine: true },\n padMode: { style: { '--headerV3-responsivity-order': 210 } },\n chips: { style: { '--headerV3-responsivity-order': 220 }, lastInLine: true },\n\n title: { style: getTitleMaxWidthStyle(logoRef, versionRef) },\n });\n }\n });\n },\n 100,\n { leading: true }\n );\n\n const resizeObserver = new ResizeObserver(() => {\n const rootWidth = rootRef.current?.offsetWidth || 0;\n if (rootWidth !== previousWidthRef.current) {\n calculateCss();\n }\n previousWidthRef.current = rootWidth;\n });\n const mutationObserver = new MutationObserver(calculateCss);\n\n if (rootRef.current && !disabled) {\n resizeObserver.observe(rootRef.current);\n mutationObserver.observe(rootRef.current, {\n childList: true,\n subtree: true,\n characterData: true,\n });\n calculateCss.cancel();\n }\n\n return () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n }, [\n actionsRef,\n chipsRef,\n logoRef,\n rootRef,\n titleControlsRef,\n additionalControlsRef,\n versionRef,\n padModeRef,\n disabled,\n titleControlsLeft,\n ]);\n\n return disabled ? {} : value;\n};\n"],"names":["gap","parseInt","CssConstants","titleMinWidth","getRefWidth","ref","_ref$current","current","getBoundingClientRect","width","sumLineWidth","_len","arguments","length","lineRefs","Array","_key","filteredRefs","filter","offsetWidth","reduce","acc","_ref","disabled","actionsRef","chipsRef","logoRef","rootRef","titleControlsRef","additionalControlsRef","versionRef","padModeRef","titleControlsLeft","_useState","useState","_useState2","_slicedToArray","value","setValue","previousWidthRef","useRef","useEffect","calculateCss","throttle","requestAnimationFrame","_rootRef$current","rootWidth","setCss","baseData","_baseData$root","data","_objectSpread","root","style","isEqual","getTitleMaxWidthStyle","_len2","refs","_key2","pixels","apply","title","linebreaks","order","titleControls","padMode","additionalControls","lastInLine","actions","chips","leading","resizeObserver","ResizeObserver","_rootRef$current2","mutationObserver","MutationObserver","observe","childList","subtree","characterData","cancel","disconnect"],"mappings":"s5BAoCA,IAAMA,EAAMC,SAASC,EAAaF,IAAK,IACjCG,EAAgBF,SAASC,EAAaC,cAAe,IAAMH,EAE3DI,EAAc,SAACC,GAAgC,IAAAC,EAGnD,OAAkB,QAAXA,EAAAD,EAAIE,eAAO,IAAAD,OAAA,EAAXA,EAAaE,wBAAwBC,QAAS,CACvD,EAEMC,EAAe,SAACP,GAAiE,IAAA,IAAAQ,EAAAC,UAAAC,OAAvCC,EAAQ,IAAAC,MAAAJ,EAAA,EAAAA,EAAA,EAAA,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAARF,EAAQE,EAAA,GAAAJ,UAAAI,GACtD,IAAMC,EAAeH,EAASI,QAAO,SAAAb,GAAG,QAAMA,EAAIE,SAAWF,EAAIE,QAAQY,YAAc,KACvF,OACEhB,EACAc,EAAaG,QAAO,SAACC,EAAKhB,GAAG,OAAKgB,EAAMjB,EAAYC,EAAI,GAAE,IACzDY,EAAaJ,OAAS,GAAKI,EAAaJ,OAAS,GAAKb,EAAM,EAEjE,0BAiB+B,SAWjBsB,GAAA,IAVZC,IAAAA,SACAC,IAAAA,WACAC,IAAAA,SACAC,IAAAA,QACAC,IAAAA,QACAC,IAAAA,iBACAC,IAAAA,sBACAC,IAAAA,WACAC,IAAAA,WACAC,IAAAA,kBAEAC,EAA0BC,EAAQA,SAAmB,IAAGC,EAAAC,EAAAA,QAAAH,EAAA,GAAjDI,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GA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