import { httpsCallable as rxHttpsCallable } from 'rxfire/functions' ; import { ReactFireOptions , useObservable , ObservableStatus } from './' ; import { useFunctions } from '.' ; import type { HttpsCallableOptions } from 'firebase/functions' ; param functionName param options export function useCallableFunctionResponse < RequestData , ResponseData > ( functionName , options ? ) { const functions = useFunctions ( ) ; const observableId = `functions:callableResponse:${ functionName }:${ JSON . stringify ( options ?. data ) }:${ JSON . stringify ( options ?. httpsCallableOptions ) }` ; const obsFactory = rxHttpsCallable < RequestData , ResponseData > ( functions , functionName , options ?. httpsCallableOptions ) ; const observable$ = obsFactory ( options ?. data ) ; return useObservable ( observableId , observable$ , options ) ; }