@react-native-firebase/remote-config 24.1.1 → 25.0.1

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 (86) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/android/src/reactnative/java/io/invertase/firebase/config/ReactNativeFirebaseConfigModule.java +11 -5
  3. package/dist/module/RemoteConfigValue.js +53 -0
  4. package/dist/module/RemoteConfigValue.js.map +1 -0
  5. package/dist/module/index.js +27 -0
  6. package/dist/module/index.js.map +1 -0
  7. package/dist/module/modular.js +155 -0
  8. package/dist/module/modular.js.map +1 -0
  9. package/dist/module/namespaced.js +400 -0
  10. package/dist/module/namespaced.js.map +1 -0
  11. package/dist/module/package.json +1 -0
  12. package/{lib → dist/module}/polyfills.js +26 -11
  13. package/dist/module/polyfills.js.map +1 -0
  14. package/dist/module/polyfills.web.js +3 -0
  15. package/dist/module/polyfills.web.js.map +1 -0
  16. package/{lib → dist/module}/statics.js +5 -3
  17. package/dist/module/statics.js.map +1 -0
  18. package/dist/module/types/internal.js +4 -0
  19. package/dist/module/types/internal.js.map +1 -0
  20. package/dist/module/types/namespaced.js +24 -0
  21. package/dist/module/types/namespaced.js.map +1 -0
  22. package/dist/module/types/remote-config.js +4 -0
  23. package/dist/module/types/remote-config.js.map +1 -0
  24. package/dist/module/version.js +5 -0
  25. package/dist/module/version.js.map +1 -0
  26. package/dist/module/web/RNFBConfigModule.android.js +6 -0
  27. package/dist/module/web/RNFBConfigModule.android.js.map +1 -0
  28. package/dist/module/web/RNFBConfigModule.ios.js +6 -0
  29. package/dist/module/web/RNFBConfigModule.ios.js.map +1 -0
  30. package/{lib → dist/module}/web/RNFBConfigModule.js +69 -77
  31. package/dist/module/web/RNFBConfigModule.js.map +1 -0
  32. package/dist/typescript/lib/RemoteConfigValue.d.ts +16 -0
  33. package/dist/typescript/lib/RemoteConfigValue.d.ts.map +1 -0
  34. package/dist/typescript/lib/index.d.ts +6 -0
  35. package/dist/typescript/lib/index.d.ts.map +1 -0
  36. package/dist/typescript/lib/modular.d.ts +76 -0
  37. package/dist/typescript/lib/modular.d.ts.map +1 -0
  38. package/dist/typescript/lib/namespaced.d.ts +11 -0
  39. package/dist/typescript/lib/namespaced.d.ts.map +1 -0
  40. package/dist/typescript/lib/polyfills.d.ts +2 -0
  41. package/dist/typescript/lib/polyfills.d.ts.map +1 -0
  42. package/dist/typescript/lib/polyfills.web.d.ts +1 -0
  43. package/dist/typescript/lib/polyfills.web.d.ts.map +1 -0
  44. package/dist/typescript/lib/statics.d.ts +12 -0
  45. package/dist/typescript/lib/statics.d.ts.map +1 -0
  46. package/dist/typescript/lib/types/internal.d.ts +94 -0
  47. package/dist/typescript/lib/types/internal.d.ts.map +1 -0
  48. package/dist/typescript/lib/types/namespaced.d.ts +124 -0
  49. package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
  50. package/dist/typescript/lib/types/remote-config.d.ts +37 -0
  51. package/dist/typescript/lib/types/remote-config.d.ts.map +1 -0
  52. package/dist/typescript/lib/version.d.ts +2 -0
  53. package/dist/typescript/lib/version.d.ts.map +1 -0
  54. package/dist/typescript/lib/web/RNFBConfigModule.android.d.ts +3 -0
  55. package/dist/typescript/lib/web/RNFBConfigModule.android.d.ts.map +1 -0
  56. package/dist/typescript/lib/web/RNFBConfigModule.d.ts +17 -0
  57. package/dist/typescript/lib/web/RNFBConfigModule.d.ts.map +1 -0
  58. package/dist/typescript/lib/web/RNFBConfigModule.ios.d.ts +3 -0
  59. package/dist/typescript/lib/web/RNFBConfigModule.ios.d.ts.map +1 -0
  60. package/dist/typescript/package.json +1 -0
  61. package/ios/RNFBConfig/RNFBConfigModule.m +10 -4
  62. package/lib/RemoteConfigValue.ts +66 -0
  63. package/lib/index.ts +25 -0
  64. package/lib/modular.ts +197 -0
  65. package/lib/namespaced.ts +552 -0
  66. package/lib/polyfills.ts +54 -0
  67. package/lib/statics.ts +27 -0
  68. package/lib/types/internal.ts +165 -0
  69. package/lib/types/namespaced.ts +163 -0
  70. package/lib/types/remote-config.ts +63 -0
  71. package/lib/version.ts +2 -0
  72. package/lib/web/RNFBConfigModule.android.ts +4 -0
  73. package/lib/web/RNFBConfigModule.ios.ts +4 -0
  74. package/lib/web/RNFBConfigModule.ts +254 -0
  75. package/package.json +42 -9
  76. package/tsconfig.json +21 -0
  77. package/typedoc.json +2 -3
  78. package/lib/RemoteConfigValue.js +0 -51
  79. package/lib/index.d.ts +0 -659
  80. package/lib/index.js +0 -400
  81. package/lib/modular/index.d.ts +0 -265
  82. package/lib/modular/index.js +0 -289
  83. package/lib/version.js +0 -2
  84. package/lib/web/RNFBConfigModule.android.js +0 -2
  85. package/lib/web/RNFBConfigModule.ios.js +0 -2
  86. /package/lib/{polyfills.web.js → polyfills.web.ts} +0 -0
@@ -0,0 +1,37 @@
1
+ import type { FirebaseApp } from '@firebase/app';
2
+ import type { ReactNativeFirebase } from '@react-native-firebase/app';
3
+ export type LogLevel = 'debug' | 'error' | 'silent';
4
+ export type FetchStatus = 'success' | 'failure' | 'no_fetch_yet' | 'throttled';
5
+ export type ValueSource = 'static' | 'default' | 'remote';
6
+ export interface Value {
7
+ getSource(): ValueSource;
8
+ asBoolean(): boolean;
9
+ asNumber(): number;
10
+ asString(): string;
11
+ }
12
+ export interface RemoteConfigSettings {
13
+ minimumFetchIntervalMillis: number;
14
+ fetchTimeoutMillis: number;
15
+ }
16
+ export interface ConfigUpdate {
17
+ getUpdatedKeys(): Set<string>;
18
+ }
19
+ export interface ConfigUpdateObserver {
20
+ next: (configUpdate: ConfigUpdate) => void;
21
+ error: (error: ReactNativeFirebase.NativeFirebaseError) => void;
22
+ complete: () => void;
23
+ }
24
+ export type Unsubscribe = () => void;
25
+ export interface CustomSignals {
26
+ [key: string]: string | number | null;
27
+ }
28
+ export interface RemoteConfig {
29
+ app: FirebaseApp;
30
+ fetchTimeMillis: number;
31
+ lastFetchStatus: FetchStatus;
32
+ settings: RemoteConfigSettings;
33
+ defaultConfig: {
34
+ [key: string]: string | number | boolean;
35
+ };
36
+ }
37
+ //# sourceMappingURL=remote-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-config.d.ts","sourceRoot":"","sources":["../../../../lib/types/remote-config.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEpD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,WAAW,CAAC;AAE/E,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D,MAAM,WAAW,KAAK;IACpB,SAAS,IAAI,WAAW,CAAC;IACzB,SAAS,IAAI,OAAO,CAAC;IACrB,QAAQ,IAAI,MAAM,CAAC;IACnB,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,0BAA0B,EAAE,MAAM,CAAC;IACnC,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,cAAc,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,KAAK,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,mBAAmB,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,WAAW,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,WAAW,CAAC;IAC7B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,aAAa,EAAE;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;KAC1C,CAAC;CACH"}
@@ -0,0 +1,2 @@
1
+ export declare const version = "25.0.1";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../lib/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const noopNativeModule: Record<string, never>;
2
+ export default noopNativeModule;
3
+ //# sourceMappingURL=RNFBConfigModule.android.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RNFBConfigModule.android.d.ts","sourceRoot":"","sources":["../../../../lib/web/RNFBConfigModule.android.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAM,CAAC;AAEnD,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import '../polyfills';
2
+ import type { RNFBConfigModule } from '../types/internal';
3
+ type WithAppName<F> = F extends (...args: infer P) => infer R ? (appName: string, ...args: P) => R : never;
4
+ interface RNFBConfigModuleWeb {
5
+ activate: WithAppName<RNFBConfigModule['activate']>;
6
+ setConfigSettings: WithAppName<RNFBConfigModule['setConfigSettings']>;
7
+ fetch: WithAppName<RNFBConfigModule['fetch']>;
8
+ fetchAndActivate: WithAppName<RNFBConfigModule['fetchAndActivate']>;
9
+ ensureInitialized: WithAppName<RNFBConfigModule['ensureInitialized']>;
10
+ setDefaults: WithAppName<RNFBConfigModule['setDefaults']>;
11
+ setCustomSignals: WithAppName<RNFBConfigModule['setCustomSignals']>;
12
+ onConfigUpdated: WithAppName<RNFBConfigModule['onConfigUpdated']>;
13
+ removeConfigUpdateRegistration: WithAppName<RNFBConfigModule['removeConfigUpdateRegistration']>;
14
+ }
15
+ declare const remoteConfigWebModule: RNFBConfigModuleWeb;
16
+ export default remoteConfigWebModule;
17
+ //# sourceMappingURL=RNFBConfigModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RNFBConfigModule.d.ts","sourceRoot":"","sources":["../../../../lib/web/RNFBConfigModule.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAmBtB,OAAO,KAAK,EAGV,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAkB3B,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACzD,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GAClC,KAAK,CAAC;AAEV,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,WAAW,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;IACpD,iBAAiB,EAAE,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACtE,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,gBAAgB,EAAE,WAAW,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACpE,iBAAiB,EAAE,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACtE,WAAW,EAAE,WAAW,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1D,gBAAgB,EAAE,WAAW,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACpE,eAAe,EAAE,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAClE,8BAA8B,EAAE,WAAW,CAAC,gBAAgB,CAAC,gCAAgC,CAAC,CAAC,CAAC;CACjG;AAyFD,QAAA,MAAM,qBAAqB,EAAE,mBA2G5B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const noopNativeModule: Record<string, never>;
2
+ export default noopNativeModule;
3
+ //# sourceMappingURL=RNFBConfigModule.ios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RNFBConfigModule.ios.d.ts","sourceRoot":"","sources":["../../../../lib/web/RNFBConfigModule.ios.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAM,CAAC;AAEnD,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -136,7 +136,7 @@ RCT_EXPORT_METHOD(ensureInitialized
136
136
  if (error) {
137
137
  [RNFBSharedUtils rejectPromiseWithNSError:reject error:error];
138
138
  } else {
139
- resolve([self resultWithConstants:[NSNull null] firebaseApp:firebaseApp]);
139
+ resolve([self resultWithVoidConstantsForApp:firebaseApp]);
140
140
  }
141
141
  };
142
142
 
@@ -160,7 +160,7 @@ RCT_EXPORT_METHOD(fetch
160
160
  convertFIRRemoteConfigFetchStatusToNSStringDescription(status)
161
161
  } mutableCopy]];
162
162
  } else {
163
- resolve([self resultWithConstants:[NSNull null] firebaseApp:firebaseApp]);
163
+ resolve([self resultWithVoidConstantsForApp:firebaseApp]);
164
164
  }
165
165
  };
166
166
 
@@ -236,7 +236,7 @@ RCT_EXPORT_METHOD(setConfigSettings
236
236
  }
237
237
 
238
238
  [FIRRemoteConfig remoteConfigWithApp:firebaseApp].configSettings = remoteConfigSettings;
239
- resolve([self resultWithConstants:[NSNull null] firebaseApp:firebaseApp]);
239
+ resolve([self resultWithVoidConstantsForApp:firebaseApp]);
240
240
  }
241
241
 
242
242
  RCT_EXPORT_METHOD(setDefaults
@@ -316,7 +316,7 @@ RCT_EXPORT_METHOD(setCustomSignals
316
316
  if (error != nil) {
317
317
  [RNFBSharedUtils rejectPromiseWithNSError:reject error:error];
318
318
  } else {
319
- resolve([self resultWithConstants:[NSNull null] firebaseApp:firebaseApp]);
319
+ resolve([self resultWithVoidConstantsForApp:firebaseApp]);
320
320
  }
321
321
  }];
322
322
  }
@@ -331,6 +331,12 @@ RCT_EXPORT_METHOD(setCustomSignals
331
331
  return responseDict;
332
332
  }
333
333
 
334
+ - (NSDictionary *)resultWithVoidConstantsForApp:(FIRApp *)firebaseApp {
335
+ NSMutableDictionary *responseDict = [NSMutableDictionary new];
336
+ responseDict[@"constants"] = [self getConstantsForApp:firebaseApp];
337
+ return responseDict;
338
+ }
339
+
334
340
  - (NSDictionary *)getConstantsForApp:(FIRApp *)firebaseApp {
335
341
  FIRRemoteConfig *remoteConfig = [FIRRemoteConfig remoteConfigWithApp:firebaseApp];
336
342
 
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ import type { Value } from './types/remote-config';
19
+
20
+ // as per firebase web sdk specification
21
+ const BOOL_VALUES = ['1', 'true', 't', 'yes', 'y', 'on'];
22
+
23
+ interface ConfigValueInit {
24
+ value: string;
25
+ source: ReturnType<Value['getSource']>;
26
+ }
27
+
28
+ export default class RemoteConfigValue implements Value {
29
+ private readonly _value: string;
30
+ private readonly _source: ReturnType<Value['getSource']>;
31
+
32
+ constructor({ value, source }: ConfigValueInit) {
33
+ this._value = value;
34
+ this._source = source;
35
+ }
36
+
37
+ asBoolean(): boolean {
38
+ if (this._source === 'static') {
39
+ return false;
40
+ }
41
+
42
+ return BOOL_VALUES.includes(this._value.toLowerCase());
43
+ }
44
+
45
+ asNumber(): number {
46
+ if (this._source === 'static') {
47
+ return 0;
48
+ }
49
+
50
+ const num = Number(this._value);
51
+
52
+ if (Number.isNaN(num)) {
53
+ return 0;
54
+ }
55
+
56
+ return num;
57
+ }
58
+
59
+ asString(): string {
60
+ return this._value;
61
+ }
62
+
63
+ getSource(): ReturnType<Value['getSource']> {
64
+ return this._source;
65
+ }
66
+ }
package/lib/index.ts ADDED
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ // Export modular API
19
+ export * from './modular';
20
+ export type * from './types/remote-config';
21
+
22
+ // Export namespaced API
23
+ export type { FirebaseRemoteConfigTypes } from './types/namespaced';
24
+ export { SDK_VERSION, firebase } from './namespaced';
25
+ export { default } from './namespaced';
package/lib/modular.ts ADDED
@@ -0,0 +1,197 @@
1
+ /*
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ import type { FirebaseApp } from '@firebase/app';
19
+ import { getApp } from '@react-native-firebase/app';
20
+ import {
21
+ MODULAR_DEPRECATION_ARG,
22
+ withModularFlag,
23
+ } from '@react-native-firebase/app/dist/module/common';
24
+ import type {
25
+ ConfigUpdateObserver,
26
+ CustomSignals,
27
+ LogLevel,
28
+ RemoteConfig,
29
+ Unsubscribe,
30
+ Value,
31
+ } from './types/remote-config';
32
+ import type { AppWithRemoteConfigInternal, RemoteConfigInternal } from './types/internal';
33
+
34
+ function rc(remoteConfig: RemoteConfig): RemoteConfigInternal {
35
+ return remoteConfig as RemoteConfigInternal;
36
+ }
37
+
38
+ export type { CustomSignals } from './types/remote-config';
39
+
40
+ /**
41
+ * Returns a RemoteConfig instance for the given app.
42
+ * @param app - FirebaseApp. Optional.
43
+ */
44
+ export function getRemoteConfig(app?: FirebaseApp): RemoteConfig {
45
+ if (app) {
46
+ return withModularFlag(() =>
47
+ (getApp(app.name) as unknown as AppWithRemoteConfigInternal).remoteConfig(
48
+ MODULAR_DEPRECATION_ARG,
49
+ ),
50
+ );
51
+ }
52
+
53
+ return withModularFlag(() =>
54
+ (getApp() as unknown as AppWithRemoteConfigInternal).remoteConfig(MODULAR_DEPRECATION_ARG),
55
+ );
56
+ }
57
+
58
+ /**
59
+ * Returns a Boolean which resolves to true if the current call
60
+ * activated the fetched configs.
61
+ */
62
+ export function activate(remoteConfig: RemoteConfig): Promise<boolean> {
63
+ return rc(remoteConfig).activate.call(remoteConfig, MODULAR_DEPRECATION_ARG);
64
+ }
65
+
66
+ /**
67
+ * Ensures the last activated config are available to the getters.
68
+ */
69
+ export function ensureInitialized(remoteConfig: RemoteConfig): Promise<void> {
70
+ return rc(remoteConfig).ensureInitialized.call(remoteConfig, MODULAR_DEPRECATION_ARG);
71
+ }
72
+
73
+ /**
74
+ * Performs a fetch and returns a Boolean which resolves to true
75
+ * if the current call activated the fetched configs.
76
+ */
77
+ export function fetchAndActivate(remoteConfig: RemoteConfig): Promise<boolean> {
78
+ return rc(remoteConfig).fetchAndActivate.call(remoteConfig, MODULAR_DEPRECATION_ARG);
79
+ }
80
+
81
+ /**
82
+ * Fetches and caches configuration from the Remote Config service.
83
+ */
84
+ export function fetchConfig(remoteConfig: RemoteConfig): Promise<void> {
85
+ return rc(remoteConfig).fetch.call(remoteConfig, undefined, MODULAR_DEPRECATION_ARG);
86
+ }
87
+
88
+ /**
89
+ * Gets all config.
90
+ */
91
+ export function getAll(remoteConfig: RemoteConfig): Record<string, Value> {
92
+ return rc(remoteConfig).getAll.call(remoteConfig, MODULAR_DEPRECATION_ARG);
93
+ }
94
+
95
+ /**
96
+ * Gets the value for the given key as a boolean.
97
+ */
98
+ export function getBoolean(remoteConfig: RemoteConfig, key: string): boolean {
99
+ return rc(remoteConfig).getBoolean.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
100
+ }
101
+
102
+ /**
103
+ * Gets the value for the given key as a number.
104
+ */
105
+ export function getNumber(remoteConfig: RemoteConfig, key: string): number {
106
+ return rc(remoteConfig).getNumber.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
107
+ }
108
+
109
+ /**
110
+ * Gets the value for the given key as a string.
111
+ */
112
+ export function getString(remoteConfig: RemoteConfig, key: string): string {
113
+ return rc(remoteConfig).getString.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
114
+ }
115
+
116
+ /**
117
+ * Gets the value for the given key.
118
+ */
119
+ export function getValue(remoteConfig: RemoteConfig, key: string): Value {
120
+ return rc(remoteConfig).getValue.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
121
+ }
122
+
123
+ /**
124
+ * Defines the log level to use.
125
+ */
126
+ export function setLogLevel(remoteConfig: RemoteConfig, logLevel: LogLevel): void {
127
+ void remoteConfig;
128
+ void logLevel;
129
+ // Intentionally ignored on native. The modular API matches the JS SDK and returns void.
130
+ }
131
+
132
+ /**
133
+ * Checks two different things.
134
+ * 1. Check if IndexedDB exists in the browser environment.
135
+ * 2. Check if the current browser context allows IndexedDB open() calls.
136
+ */
137
+ export function isSupported(): Promise<boolean> {
138
+ // always return "true" for now. Web only.
139
+ return Promise.resolve(true);
140
+ }
141
+
142
+ /**
143
+ * Deletes all activated, fetched and defaults configs and
144
+ * resets all Firebase Remote Config settings.
145
+ * Android only. iOS does not reset anything.
146
+ */
147
+ export function reset(remoteConfig: RemoteConfig): Promise<void> {
148
+ return rc(remoteConfig).reset.call(remoteConfig, MODULAR_DEPRECATION_ARG);
149
+ }
150
+
151
+ /**
152
+ * Sets defaults based on a native resource.
153
+ */
154
+ export function setDefaultsFromResource(
155
+ remoteConfig: RemoteConfig,
156
+ resourceName: string,
157
+ ): Promise<null> {
158
+ return rc(remoteConfig).setDefaultsFromResource.call(
159
+ remoteConfig,
160
+ resourceName,
161
+ MODULAR_DEPRECATION_ARG,
162
+ );
163
+ }
164
+
165
+ /**
166
+ * Registers a listener to changes in the configuration.
167
+ *
168
+ */
169
+ export function onConfigUpdate(
170
+ remoteConfig: RemoteConfig,
171
+ observer: ConfigUpdateObserver,
172
+ ): Unsubscribe {
173
+ return rc(remoteConfig).onConfigUpdate.call(remoteConfig, observer, MODULAR_DEPRECATION_ARG);
174
+ }
175
+
176
+ /**
177
+ * Sets the custom signals for the app instance.
178
+ */
179
+ export async function setCustomSignals(
180
+ remoteConfig: RemoteConfig,
181
+ customSignals: CustomSignals,
182
+ ): Promise<void> {
183
+ for (const [key, value] of Object.entries(customSignals)) {
184
+ if (typeof value !== 'string' && typeof value !== 'number' && value !== null) {
185
+ throw new Error(
186
+ `firebase.remoteConfig().setCustomSignals(): Invalid type for custom signal '${key}': ${typeof value}. Expected 'string', 'number', or 'null'.`,
187
+ );
188
+ }
189
+ }
190
+
191
+ return withModularFlag(() =>
192
+ rc(remoteConfig)._promiseWithConstants(
193
+ rc(remoteConfig).native.setCustomSignals(customSignals),
194
+ MODULAR_DEPRECATION_ARG,
195
+ ),
196
+ );
197
+ }