import { useRemoteConfig } from './' ; import { useObservable , ObservableStatus } from './useObservable' ; import { getValue , getString , getBoolean , getNumber , getAll , AllParameters } from 'rxfire/remote-config' ; import { Observable } from 'rxjs' ; import type { RemoteConfig , Value as RemoteConfigValue } from 'firebase/remote-config' ; type Getter$ < T > = ( remoteConfig : RemoteConfig , key : string ) => Observable < T > ; param key param getter param remoteConfig function useRemoteConfigValue_INTERNAL < T > ( key , getter ) { const remoteConfig = useRemoteConfig ( ) ; const appName = remoteConfig . app . name ; const $value = getter ( remoteConfig , key ) ; const observableId = `remoteConfig:${ key }:${ getter . name }:${ appName }` ; return useObservable < T > ( observableId , $value ) ; } param key export function useRemoteConfigValue ( key ) { return useRemoteConfigValue_INTERNAL < RemoteConfigValue > ( key , getValue ) ; } param key export function useRemoteConfigString ( key ) { return useRemoteConfigValue_INTERNAL < string > ( key , getString ) ; } param key export function useRemoteConfigNumber ( key ) { return useRemoteConfigValue_INTERNAL < number > ( key , getNumber ) ; } param key export function useRemoteConfigBoolean ( key ) { return useRemoteConfigValue_INTERNAL < boolean > ( key , getBoolean ) ; } param key export function useRemoteConfigAll ( key ) { return useRemoteConfigValue_INTERNAL < AllParameters > ( key , getAll ) ; }