import type { DropdownOption } from '@opentrons/components' ; import type { State } from '../types' ; import type { Config , FeatureFlags , UpdateChannel } from './types' ; export const getConfig = ( state ) : Config | null => state . config ; export const getDevtoolsEnabled = ( state ) : boolean => { return state . config ?. devtools ?? false ; } ; export const getFeatureFlags = ( state ) : FeatureFlags => { return state . config ?. devInternal ?? { } ; } ; export const getUpdateChannel = ( state ) : UpdateChannel => { return state . config ?. update . channel ?? 'latest' ; } ; export const getUseTrashSurfaceForTipCal = ( state ) : boolean | null => { return state . config ?. calibration . useTrashSurfaceForTipCal ?? null ; } ; export const getHasCalibrationBlock = ( state ) : boolean | null => { const useTrashSurface = getUseTrashSurfaceForTipCal ( state ) ; return useTrashSurface === null ? null : ! useTrashSurface ; } ; const UPDATE_CHANNEL_OPTS = [ { name : 'Stable' , value : 'latest' as UpdateChannel } , { name : 'Beta' , value : 'beta' as UpdateChannel } , ] ; const UPDATE_CHANNEL_OPTS_WITH_ALPHA = [ ... UPDATE_CHANNEL_OPTS , { name : 'Alpha' , value : 'alpha' as UpdateChannel } , ] ; export const getUpdateChannelOptions = ( state ) : DropdownOption [ ] => { return state . config ?. devtools || state . config ?. update . channel === 'alpha' ? UPDATE_CHANNEL_OPTS_WITH_ALPHA : UPDATE_CHANNEL_OPTS ; } ;