@@ -4,13 +4,15 @@ import get from 'lodash-es/get';
44import isEmpty from 'lodash-es/isEmpty' ;
55import isNil from 'lodash-es/isNil' ;
66import isNull from 'lodash-es/isNull' ;
7+ import mapValues from 'lodash-es/mapValues' ;
78import omit from 'lodash-es/omit' ;
89import once from 'lodash-es/once' ;
910import values from 'lodash-es/values' ;
1011import { v4 as uuid } from 'uuid' ;
1112import 'firebase/analytics' ;
1213import 'firebase/auth' ;
1314import 'firebase/performance' ;
15+ import 'firebase/remote-config' ;
1416
1517import config from '../config' ;
1618import {
@@ -35,7 +37,7 @@ for (const scope of GOOGLE_SCOPES) {
3537 googleAuthProvider . addScope ( scope ) ;
3638}
3739
38- const { auth, loadDatabase} = buildFirebase ( ) ;
40+ const { auth, loadDatabase, remoteConfig } = buildFirebase ( ) ;
3941
4042async function loadDatabaseSdk ( ) {
4143 return retryingFailedImports ( ( ) =>
@@ -61,8 +63,12 @@ function buildFirebase(appName = undefined) {
6163
6264 const rest =
6365 appName === undefined
64- ? { perf : firebase . performance ( app ) , analytics : firebase . analytics ( ) }
65- : { perf : null , analytics : null } ;
66+ ? {
67+ perf : firebase . performance ( app ) ,
68+ analytics : firebase . analytics ( ) ,
69+ remoteConfig : firebase . remoteConfig ( ) ,
70+ }
71+ : { perf : null , analytics : null , remoteConfig : null } ;
6672
6773 return {
6874 auth : firebase . auth ( app ) ,
@@ -284,3 +290,9 @@ export function setSessionUid() {
284290 } ) ;
285291 }
286292}
293+
294+ export async function loadRemoteConfig ( ) {
295+ await remoteConfig . fetchAndActivate ( ) ;
296+
297+ return mapValues ( remoteConfig . getAll ( ) , value => value . asString ( ) ) ;
298+ }
0 commit comments