@react-native-firebase/remote-config 24.1.0 → 25.0.0
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.
- package/CHANGELOG.md +33 -0
- package/android/src/reactnative/java/io/invertase/firebase/config/ReactNativeFirebaseConfigModule.java +11 -5
- package/dist/module/RemoteConfigValue.js +53 -0
- package/dist/module/RemoteConfigValue.js.map +1 -0
- package/dist/module/index.js +27 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/modular.js +155 -0
- package/dist/module/modular.js.map +1 -0
- package/dist/module/namespaced.js +400 -0
- package/dist/module/namespaced.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/{lib → dist/module}/polyfills.js +26 -11
- package/dist/module/polyfills.js.map +1 -0
- package/dist/module/polyfills.web.js +3 -0
- package/dist/module/polyfills.web.js.map +1 -0
- package/{lib → dist/module}/statics.js +5 -3
- package/dist/module/statics.js.map +1 -0
- package/dist/module/types/internal.js +4 -0
- package/dist/module/types/internal.js.map +1 -0
- package/dist/module/types/namespaced.js +24 -0
- package/dist/module/types/namespaced.js.map +1 -0
- package/dist/module/types/remote-config.js +4 -0
- package/dist/module/types/remote-config.js.map +1 -0
- package/dist/module/version.js +5 -0
- package/dist/module/version.js.map +1 -0
- package/dist/module/web/RNFBConfigModule.android.js +6 -0
- package/dist/module/web/RNFBConfigModule.android.js.map +1 -0
- package/dist/module/web/RNFBConfigModule.ios.js +6 -0
- package/dist/module/web/RNFBConfigModule.ios.js.map +1 -0
- package/{lib → dist/module}/web/RNFBConfigModule.js +69 -77
- package/dist/module/web/RNFBConfigModule.js.map +1 -0
- package/dist/typescript/lib/RemoteConfigValue.d.ts +16 -0
- package/dist/typescript/lib/RemoteConfigValue.d.ts.map +1 -0
- package/dist/typescript/lib/index.d.ts +6 -0
- package/dist/typescript/lib/index.d.ts.map +1 -0
- package/dist/typescript/lib/modular.d.ts +76 -0
- package/dist/typescript/lib/modular.d.ts.map +1 -0
- package/dist/typescript/lib/namespaced.d.ts +11 -0
- package/dist/typescript/lib/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/polyfills.d.ts +2 -0
- package/dist/typescript/lib/polyfills.d.ts.map +1 -0
- package/dist/typescript/lib/polyfills.web.d.ts +1 -0
- package/dist/typescript/lib/polyfills.web.d.ts.map +1 -0
- package/dist/typescript/lib/statics.d.ts +12 -0
- package/dist/typescript/lib/statics.d.ts.map +1 -0
- package/dist/typescript/lib/types/internal.d.ts +94 -0
- package/dist/typescript/lib/types/internal.d.ts.map +1 -0
- package/dist/typescript/lib/types/namespaced.d.ts +124 -0
- package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/types/remote-config.d.ts +37 -0
- package/dist/typescript/lib/types/remote-config.d.ts.map +1 -0
- package/dist/typescript/lib/version.d.ts +2 -0
- package/dist/typescript/lib/version.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBConfigModule.android.d.ts +3 -0
- package/dist/typescript/lib/web/RNFBConfigModule.android.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBConfigModule.d.ts +17 -0
- package/dist/typescript/lib/web/RNFBConfigModule.d.ts.map +1 -0
- package/dist/typescript/lib/web/RNFBConfigModule.ios.d.ts +3 -0
- package/dist/typescript/lib/web/RNFBConfigModule.ios.d.ts.map +1 -0
- package/dist/typescript/package.json +1 -0
- package/ios/RNFBConfig/RNFBConfigModule.m +10 -4
- package/lib/RemoteConfigValue.ts +66 -0
- package/lib/index.ts +25 -0
- package/lib/modular.ts +197 -0
- package/lib/namespaced.ts +552 -0
- package/lib/polyfills.ts +54 -0
- package/lib/statics.ts +27 -0
- package/lib/types/internal.ts +165 -0
- package/lib/types/namespaced.ts +163 -0
- package/lib/types/remote-config.ts +63 -0
- package/lib/version.ts +2 -0
- package/lib/web/RNFBConfigModule.android.ts +4 -0
- package/lib/web/RNFBConfigModule.ios.ts +4 -0
- package/lib/web/RNFBConfigModule.ts +254 -0
- package/package.json +42 -9
- package/tsconfig.json +21 -0
- package/typedoc.json +2 -3
- package/lib/RemoteConfigValue.js +0 -51
- package/lib/index.d.ts +0 -659
- package/lib/index.js +0 -400
- package/lib/modular/index.d.ts +0 -265
- package/lib/modular/index.js +0 -289
- package/lib/version.js +0 -2
- package/lib/web/RNFBConfigModule.android.js +0 -2
- package/lib/web/RNFBConfigModule.ios.js +0 -2
- /package/lib/{polyfills.web.js → polyfills.web.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [25.0.0](https://github.com/invertase/react-native-firebase/compare/v24.0.0...v25.0.0) (2026-06-23)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
- **remote-config:** remote-config types now match firebase-js-sdk as closely as possible
|
|
11
|
+
|
|
12
|
+
Please see https://rnfirebase.io/migrating-to-v25 for help migrating if needed
|
|
13
|
+
|
|
14
|
+
react-native-firebase has a goal to be a drop-in replacement for firebase-js-sdk, with native extensions and performance. It has always worked that way at the javascript level but the typescript types have been divergent
|
|
15
|
+
|
|
16
|
+
We are fixing that as we refactor to typescript. Please bear with us as we get closer to our goal of react-native-firebase matching firebase-js-sdk both in functionality where possible, but also in exact typescript typing.
|
|
17
|
+
|
|
18
|
+
Specifics for Remote Config:
|
|
19
|
+
|
|
20
|
+
the primary modular remote-config types now use Firebase JS SDK names: LogLevel, FetchStatus, Value, and RemoteConfigSettings
|
|
21
|
+
RemoteConfig.settings is now typed as RemoteConfigSettings, which uses fetchTimeoutMillis rather than the older RNFB-style fetchTimeMillis on the modular surface
|
|
22
|
+
modular getAll() and getValue() now return SDK-aligned types: Record<string, Value> and Value
|
|
23
|
+
modular setLogLevel() now matches the Firebase JS SDK signature and returns void
|
|
24
|
+
the legacy modular helper exports fetchTimeMillis(), settings(), and lastFetchStatus() have been removed from @react-native-firebase/remote-config. Modular callers should read remoteConfig.fetchTimeMillis, remoteConfig.settings, and remoteConfig.lastFetchStatus from the RemoteConfig instance instead
|
|
25
|
+
modular fetch() has been removed. Modular callers should use fetchConfig(remoteConfig) instead; the RNFB-only modular expirationDurationSeconds helper is no longer part of the public modular API
|
|
26
|
+
modular setConfigSettings() and setDefaults() have been removed. Modular callers should use remoteConfig.settings = ... and remoteConfig.defaultConfig = ... on the RemoteConfig instance instead
|
|
27
|
+
modular onConfigUpdated() has been removed. Modular callers should use onConfigUpdate(remoteConfig, observer) instead
|
|
28
|
+
deprecated RemoteConfigValue.value and .source getters have been removed. Callers should use asString() and getSource() instead
|
|
29
|
+
Remove LastFetchStatus, ValueSource, ConfigSettings, ConfigDefaults, ConfigValue, ConfigValues, LastFetchStatusType, and RemoteConfigLogLevel from modular exports
|
|
30
|
+
|
|
31
|
+
### Code Refactoring
|
|
32
|
+
|
|
33
|
+
- **remote-config:** migrate to TypeScript ([#8972](https://github.com/invertase/react-native-firebase/issues/8972)) ([4625961](https://github.com/invertase/react-native-firebase/commit/4625961bef042558d5cdf113a7d14ab6cb230f1a))
|
|
34
|
+
|
|
35
|
+
## [24.1.1](https://github.com/invertase/react-native-firebase/compare/v24.1.0...v24.1.1) (2026-06-10)
|
|
36
|
+
|
|
37
|
+
**Note:** Version bump only for package @react-native-firebase/remote-config
|
|
38
|
+
|
|
6
39
|
## [24.1.0](https://github.com/invertase/react-native-firebase/compare/v24.0.0...v24.1.0) (2026-06-05)
|
|
7
40
|
|
|
8
41
|
**Note:** Version bump only for package @react-native-firebase/remote-config
|
|
@@ -80,7 +80,7 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
80
80
|
.addOnCompleteListener(
|
|
81
81
|
task -> {
|
|
82
82
|
if (task.isSuccessful()) {
|
|
83
|
-
promise.resolve(
|
|
83
|
+
promise.resolve(resultWithVoidConstants());
|
|
84
84
|
} else {
|
|
85
85
|
rejectPromiseWithConfigException(promise, task.getException());
|
|
86
86
|
}
|
|
@@ -108,7 +108,7 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
108
108
|
.addOnCompleteListener(
|
|
109
109
|
task -> {
|
|
110
110
|
if (task.isSuccessful()) {
|
|
111
|
-
promise.resolve(
|
|
111
|
+
promise.resolve(resultWithVoidConstants());
|
|
112
112
|
} else {
|
|
113
113
|
rejectPromiseWithConfigException(promise, task.getException());
|
|
114
114
|
}
|
|
@@ -122,7 +122,7 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
122
122
|
.addOnCompleteListener(
|
|
123
123
|
task -> {
|
|
124
124
|
if (task.isSuccessful()) {
|
|
125
|
-
promise.resolve(
|
|
125
|
+
promise.resolve(resultWithVoidConstants());
|
|
126
126
|
} else {
|
|
127
127
|
rejectPromiseWithExceptionMap(promise, task.getException());
|
|
128
128
|
}
|
|
@@ -169,7 +169,7 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
169
169
|
.addOnCompleteListener(
|
|
170
170
|
task -> {
|
|
171
171
|
if (task.isSuccessful()) {
|
|
172
|
-
promise.resolve(
|
|
172
|
+
promise.resolve(resultWithVoidConstants());
|
|
173
173
|
} else {
|
|
174
174
|
rejectPromiseWithExceptionMap(promise, task.getException());
|
|
175
175
|
}
|
|
@@ -262,7 +262,7 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
262
262
|
.addOnCompleteListener(
|
|
263
263
|
task -> {
|
|
264
264
|
if (task.isSuccessful()) {
|
|
265
|
-
promise.resolve(
|
|
265
|
+
promise.resolve(resultWithVoidConstants());
|
|
266
266
|
} else {
|
|
267
267
|
rejectPromiseWithExceptionMap(promise, task.getException());
|
|
268
268
|
}
|
|
@@ -276,6 +276,12 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
276
276
|
return Arguments.makeNativeMap(responseMap);
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
private WritableMap resultWithVoidConstants() {
|
|
280
|
+
Map<String, Object> responseMap = new HashMap<>(1);
|
|
281
|
+
responseMap.put("constants", module.getConstantsForApp(FirebaseApp.DEFAULT_APP_NAME));
|
|
282
|
+
return Arguments.makeNativeMap(responseMap);
|
|
283
|
+
}
|
|
284
|
+
|
|
279
285
|
private void rejectPromiseWithConfigException(Promise promise, @Nullable Exception exception) {
|
|
280
286
|
if (exception == null) {
|
|
281
287
|
rejectPromiseWithCodeAndMessage(
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// as per firebase web sdk specification
|
|
21
|
+
const BOOL_VALUES = ['1', 'true', 't', 'yes', 'y', 'on'];
|
|
22
|
+
export default class RemoteConfigValue {
|
|
23
|
+
constructor({
|
|
24
|
+
value,
|
|
25
|
+
source
|
|
26
|
+
}) {
|
|
27
|
+
this._value = value;
|
|
28
|
+
this._source = source;
|
|
29
|
+
}
|
|
30
|
+
asBoolean() {
|
|
31
|
+
if (this._source === 'static') {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return BOOL_VALUES.includes(this._value.toLowerCase());
|
|
35
|
+
}
|
|
36
|
+
asNumber() {
|
|
37
|
+
if (this._source === 'static') {
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
const num = Number(this._value);
|
|
41
|
+
if (Number.isNaN(num)) {
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
return num;
|
|
45
|
+
}
|
|
46
|
+
asString() {
|
|
47
|
+
return this._value;
|
|
48
|
+
}
|
|
49
|
+
getSource() {
|
|
50
|
+
return this._source;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=RemoteConfigValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BOOL_VALUES","RemoteConfigValue","constructor","value","source","_value","_source","asBoolean","includes","toLowerCase","asNumber","num","Number","isNaN","asString","getSource"],"sourceRoot":"../../lib","sources":["RemoteConfigValue.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA,MAAMA,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC;AAOxD,eAAe,MAAMC,iBAAiB,CAAkB;EAItDC,WAAWA,CAAC;IAAEC,KAAK;IAAEC;EAAwB,CAAC,EAAE;IAC9C,IAAI,CAACC,MAAM,GAAGF,KAAK;IACnB,IAAI,CAACG,OAAO,GAAGF,MAAM;EACvB;EAEAG,SAASA,CAAA,EAAY;IACnB,IAAI,IAAI,CAACD,OAAO,KAAK,QAAQ,EAAE;MAC7B,OAAO,KAAK;IACd;IAEA,OAAON,WAAW,CAACQ,QAAQ,CAAC,IAAI,CAACH,MAAM,CAACI,WAAW,CAAC,CAAC,CAAC;EACxD;EAEAC,QAAQA,CAAA,EAAW;IACjB,IAAI,IAAI,CAACJ,OAAO,KAAK,QAAQ,EAAE;MAC7B,OAAO,CAAC;IACV;IAEA,MAAMK,GAAG,GAAGC,MAAM,CAAC,IAAI,CAACP,MAAM,CAAC;IAE/B,IAAIO,MAAM,CAACC,KAAK,CAACF,GAAG,CAAC,EAAE;MACrB,OAAO,CAAC;IACV;IAEA,OAAOA,GAAG;EACZ;EAEAG,QAAQA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACT,MAAM;EACpB;EAEAU,SAASA,CAAA,EAAmC;IAC1C,OAAO,IAAI,CAACT,OAAO;EACrB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// Export modular API
|
|
21
|
+
export * from "./modular.js";
|
|
22
|
+
|
|
23
|
+
// Export namespaced API
|
|
24
|
+
|
|
25
|
+
export { SDK_VERSION, firebase } from "./namespaced.js";
|
|
26
|
+
export { default } from "./namespaced.js";
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SDK_VERSION","firebase","default"],"sourceRoot":"../../lib","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,cAAW;;AAGzB;;AAEA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,iBAAc;AACpD,SAASC,OAAO,QAAQ,iBAAc","ignoreList":[]}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { getApp } from '@react-native-firebase/app';
|
|
21
|
+
import { MODULAR_DEPRECATION_ARG, withModularFlag } from '@react-native-firebase/app/dist/module/common';
|
|
22
|
+
function rc(remoteConfig) {
|
|
23
|
+
return remoteConfig;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns a RemoteConfig instance for the given app.
|
|
27
|
+
* @param app - FirebaseApp. Optional.
|
|
28
|
+
*/
|
|
29
|
+
export function getRemoteConfig(app) {
|
|
30
|
+
if (app) {
|
|
31
|
+
return withModularFlag(() => getApp(app.name).remoteConfig(MODULAR_DEPRECATION_ARG));
|
|
32
|
+
}
|
|
33
|
+
return withModularFlag(() => getApp().remoteConfig(MODULAR_DEPRECATION_ARG));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Returns a Boolean which resolves to true if the current call
|
|
38
|
+
* activated the fetched configs.
|
|
39
|
+
*/
|
|
40
|
+
export function activate(remoteConfig) {
|
|
41
|
+
return rc(remoteConfig).activate.call(remoteConfig, MODULAR_DEPRECATION_ARG);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Ensures the last activated config are available to the getters.
|
|
46
|
+
*/
|
|
47
|
+
export function ensureInitialized(remoteConfig) {
|
|
48
|
+
return rc(remoteConfig).ensureInitialized.call(remoteConfig, MODULAR_DEPRECATION_ARG);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Performs a fetch and returns a Boolean which resolves to true
|
|
53
|
+
* if the current call activated the fetched configs.
|
|
54
|
+
*/
|
|
55
|
+
export function fetchAndActivate(remoteConfig) {
|
|
56
|
+
return rc(remoteConfig).fetchAndActivate.call(remoteConfig, MODULAR_DEPRECATION_ARG);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Fetches and caches configuration from the Remote Config service.
|
|
61
|
+
*/
|
|
62
|
+
export function fetchConfig(remoteConfig) {
|
|
63
|
+
return rc(remoteConfig).fetch.call(remoteConfig, undefined, MODULAR_DEPRECATION_ARG);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Gets all config.
|
|
68
|
+
*/
|
|
69
|
+
export function getAll(remoteConfig) {
|
|
70
|
+
return rc(remoteConfig).getAll.call(remoteConfig, MODULAR_DEPRECATION_ARG);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets the value for the given key as a boolean.
|
|
75
|
+
*/
|
|
76
|
+
export function getBoolean(remoteConfig, key) {
|
|
77
|
+
return rc(remoteConfig).getBoolean.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Gets the value for the given key as a number.
|
|
82
|
+
*/
|
|
83
|
+
export function getNumber(remoteConfig, key) {
|
|
84
|
+
return rc(remoteConfig).getNumber.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Gets the value for the given key as a string.
|
|
89
|
+
*/
|
|
90
|
+
export function getString(remoteConfig, key) {
|
|
91
|
+
return rc(remoteConfig).getString.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Gets the value for the given key.
|
|
96
|
+
*/
|
|
97
|
+
export function getValue(remoteConfig, key) {
|
|
98
|
+
return rc(remoteConfig).getValue.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Defines the log level to use.
|
|
103
|
+
*/
|
|
104
|
+
export function setLogLevel(remoteConfig, logLevel) {
|
|
105
|
+
void remoteConfig;
|
|
106
|
+
void logLevel;
|
|
107
|
+
// Intentionally ignored on native. The modular API matches the JS SDK and returns void.
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Checks two different things.
|
|
112
|
+
* 1. Check if IndexedDB exists in the browser environment.
|
|
113
|
+
* 2. Check if the current browser context allows IndexedDB open() calls.
|
|
114
|
+
*/
|
|
115
|
+
export function isSupported() {
|
|
116
|
+
// always return "true" for now. Web only.
|
|
117
|
+
return Promise.resolve(true);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Deletes all activated, fetched and defaults configs and
|
|
122
|
+
* resets all Firebase Remote Config settings.
|
|
123
|
+
* Android only. iOS does not reset anything.
|
|
124
|
+
*/
|
|
125
|
+
export function reset(remoteConfig) {
|
|
126
|
+
return rc(remoteConfig).reset.call(remoteConfig, MODULAR_DEPRECATION_ARG);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Sets defaults based on a native resource.
|
|
131
|
+
*/
|
|
132
|
+
export function setDefaultsFromResource(remoteConfig, resourceName) {
|
|
133
|
+
return rc(remoteConfig).setDefaultsFromResource.call(remoteConfig, resourceName, MODULAR_DEPRECATION_ARG);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Registers a listener to changes in the configuration.
|
|
138
|
+
*
|
|
139
|
+
*/
|
|
140
|
+
export function onConfigUpdate(remoteConfig, observer) {
|
|
141
|
+
return rc(remoteConfig).onConfigUpdate.call(remoteConfig, observer, MODULAR_DEPRECATION_ARG);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Sets the custom signals for the app instance.
|
|
146
|
+
*/
|
|
147
|
+
export async function setCustomSignals(remoteConfig, customSignals) {
|
|
148
|
+
for (const [key, value] of Object.entries(customSignals)) {
|
|
149
|
+
if (typeof value !== 'string' && typeof value !== 'number' && value !== null) {
|
|
150
|
+
throw new Error(`firebase.remoteConfig().setCustomSignals(): Invalid type for custom signal '${key}': ${typeof value}. Expected 'string', 'number', or 'null'.`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return withModularFlag(() => rc(remoteConfig)._promiseWithConstants(rc(remoteConfig).native.setCustomSignals(customSignals), MODULAR_DEPRECATION_ARG));
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=modular.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getApp","MODULAR_DEPRECATION_ARG","withModularFlag","rc","remoteConfig","getRemoteConfig","app","name","activate","call","ensureInitialized","fetchAndActivate","fetchConfig","fetch","undefined","getAll","getBoolean","key","getNumber","getString","getValue","setLogLevel","logLevel","isSupported","Promise","resolve","reset","setDefaultsFromResource","resourceName","onConfigUpdate","observer","setCustomSignals","customSignals","value","Object","entries","Error","_promiseWithConstants","native"],"sourceRoot":"../../lib","sources":["modular.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,MAAM,QAAQ,4BA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