@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.
- 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
|
@@ -0,0 +1,400 @@
|
|
|
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 { hasOwnProperty, isFunction, isIOS, isNumber, isObject, isString, isUndefined, parseListenerOrObserver } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
+
import { createModuleNamespace, FirebaseModule, getFirebaseRoot } from '@react-native-firebase/app/dist/module/internal';
|
|
22
|
+
import NativeFirebaseError from '@react-native-firebase/app/dist/module/internal/NativeFirebaseError';
|
|
23
|
+
import { setReactNativeModule } from '@react-native-firebase/app/dist/module/internal/nativeModule';
|
|
24
|
+
import RemoteConfigValue from "./RemoteConfigValue.js";
|
|
25
|
+
import { LastFetchStatus, ValueSource } from "./statics.js";
|
|
26
|
+
import { version } from "./version.js";
|
|
27
|
+
import fallBackModule from './web/RNFBConfigModule';
|
|
28
|
+
function isSuccessEvent(event) {
|
|
29
|
+
return event.resultType === 'success';
|
|
30
|
+
}
|
|
31
|
+
function toConfigUpdate(updatedKeys) {
|
|
32
|
+
return {
|
|
33
|
+
getUpdatedKeys: () => new Set(updatedKeys)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function toNativeFirebaseError(errorEvent) {
|
|
37
|
+
return NativeFirebaseError.fromEvent(errorEvent, namespace);
|
|
38
|
+
}
|
|
39
|
+
const statics = {
|
|
40
|
+
LastFetchStatus,
|
|
41
|
+
ValueSource
|
|
42
|
+
};
|
|
43
|
+
const namespace = 'remoteConfig';
|
|
44
|
+
const nativeModuleName = 'RNFBConfigModule';
|
|
45
|
+
class FirebaseConfigModule extends FirebaseModule {
|
|
46
|
+
constructor(app, config, customUrlOrRegion) {
|
|
47
|
+
super(app, config, customUrlOrRegion);
|
|
48
|
+
this._settings = {
|
|
49
|
+
// defaults to 1 minute.
|
|
50
|
+
fetchTimeoutMillis: 60000,
|
|
51
|
+
// defaults to 12 hours.
|
|
52
|
+
minimumFetchIntervalMillis: 43200000
|
|
53
|
+
};
|
|
54
|
+
this._lastFetchTime = -1;
|
|
55
|
+
this._lastFetchStatus = 'no_fetch_yet';
|
|
56
|
+
this._values = {};
|
|
57
|
+
this._configUpdateListenerCount = 0;
|
|
58
|
+
this._nativeMutationQueue = Promise.resolve();
|
|
59
|
+
}
|
|
60
|
+
get defaultConfig() {
|
|
61
|
+
const updatedDefaultConfig = {};
|
|
62
|
+
Object.keys(this._values).forEach(key => {
|
|
63
|
+
// Need to make it an object with key and literal value. Not `Value` instance.
|
|
64
|
+
const configValue = this._values[key];
|
|
65
|
+
if (configValue) {
|
|
66
|
+
updatedDefaultConfig[key] = configValue.value;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return updatedDefaultConfig;
|
|
70
|
+
}
|
|
71
|
+
set defaultConfig(defaults) {
|
|
72
|
+
if (!isObject(defaults)) {
|
|
73
|
+
throw new Error("firebase.remoteConfig().defaultConfig: 'defaults' must be an object.");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// To make Firebase web v9 API compatible, we update the config first so it immediately
|
|
77
|
+
// updates defaults on the instance. We then pass to underlying SDK to update. We do this because
|
|
78
|
+
// there is no way to "await" a setter.
|
|
79
|
+
const nonDefaultValues = Object.fromEntries(Object.entries(this._values).filter(([, configValue]) => configValue?.source !== 'default'));
|
|
80
|
+
this._values = Object.freeze({
|
|
81
|
+
...Object.fromEntries(Object.entries(defaults).map(([key, value]) => [key, {
|
|
82
|
+
value,
|
|
83
|
+
source: 'default'
|
|
84
|
+
}])),
|
|
85
|
+
...nonDefaultValues
|
|
86
|
+
});
|
|
87
|
+
void this.setDefaults(defaults, true);
|
|
88
|
+
}
|
|
89
|
+
get settings() {
|
|
90
|
+
return {
|
|
91
|
+
minimumFetchIntervalMillis: this._settings.minimumFetchIntervalMillis,
|
|
92
|
+
fetchTimeoutMillis: this._settings.fetchTimeoutMillis,
|
|
93
|
+
fetchTimeMillis: this._settings.fetchTimeoutMillis
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
set settings(settings) {
|
|
97
|
+
// To make Firebase web v9 API compatible, we update the settings first so it immediately
|
|
98
|
+
// updates settings on the instance. We then pass to underlying SDK to update. We do this because
|
|
99
|
+
// there is no way to "await" a setter. We can't delegate to `setConfigSettings()` as it is setup
|
|
100
|
+
// for native.
|
|
101
|
+
this._settings = {
|
|
102
|
+
minimumFetchIntervalMillis: settings.minimumFetchIntervalMillis ?? this._settings.minimumFetchIntervalMillis,
|
|
103
|
+
fetchTimeoutMillis: ('fetchTimeoutMillis' in settings ? settings.fetchTimeoutMillis : undefined) ?? ('fetchTimeMillis' in settings ? settings.fetchTimeMillis : undefined) ?? this._settings.fetchTimeoutMillis
|
|
104
|
+
};
|
|
105
|
+
void this.setConfigSettings(settings, true);
|
|
106
|
+
}
|
|
107
|
+
getValue(key) {
|
|
108
|
+
if (!isString(key)) {
|
|
109
|
+
throw new Error("firebase.remoteConfig().getValue(): 'key' must be a string value.");
|
|
110
|
+
}
|
|
111
|
+
if (typeof this._values === 'undefined' || !hasOwnProperty(this._values, key)) {
|
|
112
|
+
return new RemoteConfigValue({
|
|
113
|
+
value: '',
|
|
114
|
+
source: 'static'
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const configValue = this._values[key];
|
|
118
|
+
return new RemoteConfigValue({
|
|
119
|
+
value: `${configValue.value}`,
|
|
120
|
+
source: configValue.source
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
getBoolean(key) {
|
|
124
|
+
return this.getValue(key).asBoolean();
|
|
125
|
+
}
|
|
126
|
+
getNumber(key) {
|
|
127
|
+
return this.getValue(key).asNumber();
|
|
128
|
+
}
|
|
129
|
+
getString(key) {
|
|
130
|
+
return this.getValue(key).asString();
|
|
131
|
+
}
|
|
132
|
+
getAll() {
|
|
133
|
+
const values = {};
|
|
134
|
+
Object.keys(this._values).forEach(key => {
|
|
135
|
+
values[key] = this.getValue(key);
|
|
136
|
+
});
|
|
137
|
+
return values;
|
|
138
|
+
}
|
|
139
|
+
get fetchTimeMillis() {
|
|
140
|
+
// android returns -1 if no fetch yet and iOS returns 0
|
|
141
|
+
return this._lastFetchTime;
|
|
142
|
+
}
|
|
143
|
+
get lastFetchStatus() {
|
|
144
|
+
return this._lastFetchStatus;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Deletes all activated, fetched and defaults configs and resets all Firebase Remote Config settings.
|
|
149
|
+
* @returns {Promise<void>}
|
|
150
|
+
*/
|
|
151
|
+
reset() {
|
|
152
|
+
if (isIOS) {
|
|
153
|
+
return Promise.resolve();
|
|
154
|
+
}
|
|
155
|
+
return this._enqueueNativeMutation(() => this._promiseWithConstants(this.native.reset()));
|
|
156
|
+
}
|
|
157
|
+
setConfigSettings(settings, fromSettingsSetter = false) {
|
|
158
|
+
const updatedSettings = {
|
|
159
|
+
fetchTimeout: this._settings.fetchTimeoutMillis / 1000,
|
|
160
|
+
minimumFetchInterval: this._settings.minimumFetchIntervalMillis / 1000
|
|
161
|
+
};
|
|
162
|
+
const apiCalled = fromSettingsSetter ? 'settings' : 'setConfigSettings';
|
|
163
|
+
if (!isObject(settings)) {
|
|
164
|
+
throw new Error(`firebase.remoteConfig().${apiCalled}(*): settings must set an object.`);
|
|
165
|
+
}
|
|
166
|
+
if (hasOwnProperty(settings, 'minimumFetchIntervalMillis')) {
|
|
167
|
+
if (!isNumber(settings.minimumFetchIntervalMillis)) {
|
|
168
|
+
throw new Error(`firebase.remoteConfig().${apiCalled}(): 'settings.minimumFetchIntervalMillis' must be a number type in milliseconds.`);
|
|
169
|
+
} else {
|
|
170
|
+
updatedSettings.minimumFetchInterval = settings.minimumFetchIntervalMillis / 1000;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (hasOwnProperty(settings, 'fetchTimeMillis')) {
|
|
174
|
+
if (!isNumber(settings.fetchTimeMillis)) {
|
|
175
|
+
throw new Error(`firebase.remoteConfig().${apiCalled}(): 'settings.fetchTimeMillis' must be a number type in milliseconds.`);
|
|
176
|
+
}
|
|
177
|
+
updatedSettings.fetchTimeout = settings.fetchTimeMillis / 1000;
|
|
178
|
+
} else if (hasOwnProperty(settings, 'fetchTimeoutMillis')) {
|
|
179
|
+
if (!isNumber(settings.fetchTimeoutMillis)) {
|
|
180
|
+
throw new Error(`firebase.remoteConfig().${apiCalled}(): 'settings.fetchTimeoutMillis' must be a number type in milliseconds.`);
|
|
181
|
+
}
|
|
182
|
+
updatedSettings.fetchTimeout = settings.fetchTimeoutMillis / 1000;
|
|
183
|
+
}
|
|
184
|
+
const nextSettings = {
|
|
185
|
+
fetchTimeoutMillis: updatedSettings.fetchTimeout * 1000,
|
|
186
|
+
minimumFetchIntervalMillis: updatedSettings.minimumFetchInterval * 1000
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// Keep JS reads in sync immediately. Native can report stale settings constants
|
|
190
|
+
// for this call because native setConfigSettingsAsync completes after the bridge resolves.
|
|
191
|
+
this._settings = nextSettings;
|
|
192
|
+
return this._enqueueNativeMutation(() => this.native.setConfigSettings(updatedSettings).then(({
|
|
193
|
+
result,
|
|
194
|
+
constants
|
|
195
|
+
}) => {
|
|
196
|
+
// Preserve the eagerly computed settings above and only refresh the rest of the cache.
|
|
197
|
+
this._updateFromConstants({
|
|
198
|
+
...constants,
|
|
199
|
+
fetchTimeout: undefined,
|
|
200
|
+
minimumFetchInterval: undefined
|
|
201
|
+
});
|
|
202
|
+
return result;
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Activates the Fetched RemoteConfig, so that the fetched key-values take effect.
|
|
208
|
+
* @returns {Promise<boolean>}
|
|
209
|
+
*/
|
|
210
|
+
activate() {
|
|
211
|
+
return this._promiseWithConstants(this.native.activate());
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Fetches parameter values for your app.
|
|
216
|
+
*
|
|
217
|
+
* @param expirationDurationSeconds
|
|
218
|
+
* @returns {Promise}
|
|
219
|
+
*/
|
|
220
|
+
fetch(expirationDurationSeconds) {
|
|
221
|
+
if (!isUndefined(expirationDurationSeconds) && !isNumber(expirationDurationSeconds)) {
|
|
222
|
+
throw new Error("firebase.remoteConfig().fetch(): 'expirationDurationSeconds' must be a number value.");
|
|
223
|
+
}
|
|
224
|
+
return this._promiseWithConstants(this.native.fetch(expirationDurationSeconds !== undefined ? expirationDurationSeconds : -1));
|
|
225
|
+
}
|
|
226
|
+
fetchAndActivate() {
|
|
227
|
+
return this._promiseWithConstants(this.native.fetchAndActivate());
|
|
228
|
+
}
|
|
229
|
+
ensureInitialized() {
|
|
230
|
+
return this._promiseWithConstants(this.native.ensureInitialized());
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Sets defaults.
|
|
235
|
+
*
|
|
236
|
+
* @param defaults
|
|
237
|
+
*/
|
|
238
|
+
setDefaults(defaults, fromDefaultConfigSetter = false) {
|
|
239
|
+
const apiCalled = fromDefaultConfigSetter ? 'defaultConfig' : 'setDefaults';
|
|
240
|
+
if (!isObject(defaults)) {
|
|
241
|
+
throw new Error(`firebase.remoteConfig().${apiCalled}(): 'defaults' must be an object.`);
|
|
242
|
+
}
|
|
243
|
+
return this._enqueueNativeMutation(() => this._promiseWithConstants(this.native.setDefaults(defaults)));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Sets defaults based on resource.
|
|
248
|
+
* @param resourceName
|
|
249
|
+
*/
|
|
250
|
+
setDefaultsFromResource(resourceName) {
|
|
251
|
+
if (!isString(resourceName)) {
|
|
252
|
+
throw new Error("firebase.remoteConfig().setDefaultsFromResource(): 'resourceName' must be a string value.");
|
|
253
|
+
}
|
|
254
|
+
return this._enqueueNativeMutation(() => this._promiseWithConstants(this.native.setDefaultsFromResource(resourceName)));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Registers an observer to changes in the configuration.
|
|
259
|
+
*
|
|
260
|
+
* @param observer - The observer to be notified of config updates.
|
|
261
|
+
* @returns An unsubscribe function to remove the listener.
|
|
262
|
+
*/
|
|
263
|
+
onConfigUpdate(observer) {
|
|
264
|
+
if (!isObject(observer) || !isFunction(observer.next) || !isFunction(observer.error)) {
|
|
265
|
+
throw new Error("'observer' expected an object with 'next' and 'error' functions.");
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// We maintaine our pre-web-support native interface but bend it to match
|
|
269
|
+
// the official JS SDK API by assuming the callback is an Observer, and sending it a ConfigUpdate
|
|
270
|
+
// compatible parameter that implements the `getUpdatedKeys` method
|
|
271
|
+
let unsubscribed = false;
|
|
272
|
+
const subscription = this.emitter.addListener(this.eventNameForApp('on_config_updated'), event => {
|
|
273
|
+
if (isSuccessEvent(event)) {
|
|
274
|
+
observer.next(toConfigUpdate(event.updatedKeys));
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
observer.error(toNativeFirebaseError(event));
|
|
278
|
+
});
|
|
279
|
+
if (this._configUpdateListenerCount === 0) {
|
|
280
|
+
this.native.onConfigUpdated();
|
|
281
|
+
}
|
|
282
|
+
this._configUpdateListenerCount++;
|
|
283
|
+
return () => {
|
|
284
|
+
if (unsubscribed) {
|
|
285
|
+
// there is no harm in calling this multiple times to unsubscribe,
|
|
286
|
+
// but anything after the first call is a no-op
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
unsubscribed = true;
|
|
290
|
+
subscription.remove();
|
|
291
|
+
this._configUpdateListenerCount--;
|
|
292
|
+
if (this._configUpdateListenerCount === 0) {
|
|
293
|
+
this.native.removeConfigUpdateRegistration();
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Registers a listener to changes in the configuration.
|
|
300
|
+
*
|
|
301
|
+
* @param listenerOrObserver - function called on config change
|
|
302
|
+
* @returns unsubscribe listener
|
|
303
|
+
* @deprecated use official firebase-js-sdk onConfigUpdate now that web supports realtime
|
|
304
|
+
*/
|
|
305
|
+
onConfigUpdated(listenerOrObserver) {
|
|
306
|
+
const listener = parseListenerOrObserver(listenerOrObserver);
|
|
307
|
+
let unsubscribed = false;
|
|
308
|
+
const subscription = this.emitter.addListener(this.eventNameForApp('on_config_updated'), event => {
|
|
309
|
+
if (isSuccessEvent(event)) {
|
|
310
|
+
listener({
|
|
311
|
+
updatedKeys: event.updatedKeys
|
|
312
|
+
}, undefined);
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
listener(undefined, {
|
|
316
|
+
code: event.code,
|
|
317
|
+
message: event.message,
|
|
318
|
+
nativeErrorMessage: event.nativeErrorMessage
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
if (this._configUpdateListenerCount === 0) {
|
|
322
|
+
this.native.onConfigUpdated();
|
|
323
|
+
}
|
|
324
|
+
this._configUpdateListenerCount++;
|
|
325
|
+
return () => {
|
|
326
|
+
if (unsubscribed) {
|
|
327
|
+
// there is no harm in calling this multiple times to unsubscribe,
|
|
328
|
+
// but anything after the first call is a no-op
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
unsubscribed = true;
|
|
332
|
+
subscription.remove();
|
|
333
|
+
this._configUpdateListenerCount--;
|
|
334
|
+
if (this._configUpdateListenerCount === 0) {
|
|
335
|
+
this.native.removeConfigUpdateRegistration();
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
_updateFromConstants(constants) {
|
|
340
|
+
// Wrapped this as we update using sync getters initially for `defaultConfig` & `settings`
|
|
341
|
+
if (constants.lastFetchTime !== undefined) {
|
|
342
|
+
this._lastFetchTime = constants.lastFetchTime;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Wrapped this as we update using sync getters initially for `defaultConfig` & `settings`
|
|
346
|
+
if (constants.lastFetchStatus !== undefined) {
|
|
347
|
+
this._lastFetchStatus = constants.lastFetchStatus;
|
|
348
|
+
}
|
|
349
|
+
if (constants.fetchTimeout !== undefined && constants.minimumFetchInterval !== undefined) {
|
|
350
|
+
this._settings = {
|
|
351
|
+
fetchTimeoutMillis: constants.fetchTimeout * 1000,
|
|
352
|
+
minimumFetchIntervalMillis: constants.minimumFetchInterval * 1000
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
if (constants.values !== undefined) {
|
|
356
|
+
this._values = Object.freeze(constants.values);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
_promiseWithConstants(promise) {
|
|
360
|
+
return promise.then(({
|
|
361
|
+
result,
|
|
362
|
+
constants
|
|
363
|
+
}) => {
|
|
364
|
+
this._updateFromConstants(constants);
|
|
365
|
+
return result;
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
_enqueueNativeMutation(task) {
|
|
369
|
+
// Some callers (like property setters) discard the returned promise; serialize all mutations
|
|
370
|
+
// so later writes like reset() cannot be overwritten by an earlier async completion.
|
|
371
|
+
const next = this._nativeMutationQueue.then(task, task);
|
|
372
|
+
this._nativeMutationQueue = next.then(() => undefined, () => undefined);
|
|
373
|
+
return next;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// import { SDK_VERSION } from '@react-native-firebase/remote-config';
|
|
378
|
+
export const SDK_VERSION = version;
|
|
379
|
+
const remoteConfigNamespace = createModuleNamespace({
|
|
380
|
+
statics,
|
|
381
|
+
version,
|
|
382
|
+
namespace,
|
|
383
|
+
nativeModuleName,
|
|
384
|
+
nativeEvents: ['on_config_updated'],
|
|
385
|
+
hasMultiAppSupport: true,
|
|
386
|
+
hasCustomUrlOrRegionSupport: false,
|
|
387
|
+
ModuleClass: FirebaseConfigModule
|
|
388
|
+
});
|
|
389
|
+
// import remoteConfig from '@react-native-firebase/remote-config';
|
|
390
|
+
// remoteConfig().X(...);
|
|
391
|
+
export default remoteConfigNamespace;
|
|
392
|
+
|
|
393
|
+
// import remoteConfig, { firebase } from '@react-native-firebase/remote-config';
|
|
394
|
+
// remoteConfig().X(...);
|
|
395
|
+
// firebase.remoteConfig().X(...);
|
|
396
|
+
export const firebase = getFirebaseRoot();
|
|
397
|
+
|
|
398
|
+
// Register the interop module for non-native platforms.
|
|
399
|
+
setReactNativeModule(nativeModuleName, fallBackModule);
|
|
400
|
+
//# sourceMappingURL=namespaced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hasOwnProperty","isFunction","isIOS","isNumber","isObject","isString","isUndefined","parseListenerOrObserver","createModuleNamespace","FirebaseModule","getFirebaseRoot","NativeFirebaseError","setReactNativeModule","RemoteConfigValue","LastFetchStatus","ValueSource","version","fallBackModule","isSuccessEvent","event","resultType","toConfigUpdate","updatedKeys","getUpdatedKeys","Set","toNativeFirebaseError","errorEvent","fromEvent","namespace","statics","nativeModuleName","FirebaseConfigModule","constructor","app","config","customUrlOrRegion","_settings","fetchTimeoutMillis","minimumFetchIntervalMillis","_lastFetchTime","_lastFetchStatus","_values","_configUpdateListenerCount","_nativeMutationQueue","Promise","resolve","defaultConfig","updatedDefaultConfig","Object","keys","forEach","key","configValue","value","defaults","Error","nonDefaultValues","fromEntries","entries","filter","source","freeze","map","setDefaults","settings","fetchTimeMillis","undefined","setConfigSettings","getValue","getBoolean","asBoolean","getNumber","asNumber","getString","asString","getAll","values","lastFetchStatus","reset","_enqueueNativeMutation","_promiseWithConstants","native","fromSettingsSetter","updatedSettings","fetchTimeout","minimumFetchInterval","apiCalled","nextSettings","then","result","constants","_updateFromConstants","activate","fetch","expirationDurationSeconds","fetchAndActivate","ensureInitialized","fromDefaultConfigSetter","setDefaultsFromResource","resourceName","onConfigUpdate","observer","next","error","unsubscribed","subscription","emitter","addListener","eventNameForApp","onConfigUpdated","remove","removeConfigUpdateRegistration","listenerOrObserver","listener","code","message","nativeErrorMessage","lastFetchTime","promise","task","SDK_VERSION","remoteConfigNamespace","nativeEvents","hasMultiAppSupport","hasCustomUrlOrRegionSupport","ModuleClass","firebase"],"sourceRoot":"../../lib","sources":["namespaced.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,cAAc,EACdC,UAAU,EACVC,KAAK,EACLC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,WAAW,EACXC,uBAAuB,QAClB,+CAA+C;AACtD,SACEC,qBAAqB,EACrBC,cAAc,EACdC,eAAe,QAEV,iDAAiD;AACxD,OAAOC,mBAAmB,MAAM,qEAAqE;AACrG,SAASC,oBAAoB,QAAQ,8DAA8D;AAEnG,OAAOC,iBAAiB,MAAM,wBAAqB;AACnD,SAASC,eAAe,EAAEC,WAAW,QAAQ,cAAW;AAiBxD,SAASC,OAAO,QAAQ,cAAW;AACnC,OAAOC,cAAc,MAAM,wBAAwB;AAQnD,SAASC,cAAcA,CACrBC,KAAoF,EACnC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,2BAA2B,EAAE,KAAK;EAClCC,WAAW,EAAE9F;AACf,CAAC,CAAC;AAUF;AACA;AACA,eAAe0F,qBAAqB;;AAEpC;AACA;AACA;AACA,OAAO,MAAMK,QAAQ,GACnBpH,eAAe,CAAC,CAKf;;AAEH;AACAE,oBAAoB,CAACkB,gBAAgB,EAAEb,cAAoD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* @license
|
|
3
5
|
* Copyright 2024 Google LLC
|
|
@@ -14,19 +16,32 @@
|
|
|
14
16
|
* See the License for the specific language governing permissions and
|
|
15
17
|
* limitations under the License.
|
|
16
18
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
const {
|
|
20
|
+
polyfillGlobal
|
|
21
|
+
} = require('react-native/Libraries/Utilities/PolyfillFunctions');
|
|
22
|
+
const {
|
|
23
|
+
fetch,
|
|
24
|
+
Headers,
|
|
25
|
+
Request,
|
|
26
|
+
Response
|
|
27
|
+
} = require('react-native-fetch-api');
|
|
28
|
+
const {
|
|
29
|
+
ReadableStream
|
|
30
|
+
} = require('web-streams-polyfill/dist/ponyfill');
|
|
31
|
+
const fetchWithTextStreaming = (...args) => {
|
|
32
|
+
const [input, init] = args;
|
|
33
|
+
const nextInit = {
|
|
34
|
+
...init,
|
|
35
|
+
reactNative: {
|
|
36
|
+
textStreaming: true
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return fetch(input, nextInit);
|
|
40
|
+
};
|
|
41
|
+
polyfillGlobal('fetch', () => fetchWithTextStreaming);
|
|
27
42
|
polyfillGlobal('Headers', () => Headers);
|
|
28
43
|
polyfillGlobal('Request', () => Request);
|
|
29
44
|
polyfillGlobal('Response', () => Response);
|
|
30
45
|
polyfillGlobal('ReadableStream', () => ReadableStream);
|
|
31
|
-
|
|
32
46
|
import 'text-encoding';
|
|
47
|
+
//# sourceMappingURL=polyfills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["polyfillGlobal","require","fetch","Headers","Request","Response","ReadableStream","fetchWithTextStreaming","args","input","init","nextInit","reactNative","textStreaming"],"sourceRoot":"../../lib","sources":["polyfills.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;EAAEA;AAAe,CAAC,GAAGC,OAAO,CAAC,oDAAoD,CAEtF;AACD,MAAM;EAAEC,KAAK;EAAEC,OAAO;EAAEC,OAAO;EAAEC;AAAS,CAAC,GAAGJ,OAAO,CAAC,wBAAwB,CAK7E;AACD,MAAM;EAAEK;AAAe,CAAC,GAAGL,OAAO,CAAC,oCAAoC,CAEtE;AAUD,MAAMM,sBAAuC,GAAGA,CAAC,GAAGC,IAAI,KAAK;EAC3D,MAAM,CAACC,KAAK,EAAEC,IAAI,CAAC,GAAGF,IAAI;EAC1B,MAAMG,QAA4B,GAAG;IACnC,GAAID,IAAuC;IAC3CE,WAAW,EAAE;MAAEC,aAAa,EAAE;IAAK;EACrC,CAAC;EAED,OAAOX,KAAK,CAACO,KAAK,EAAEE,QAAQ,CAAC;AAC/B,CAAC;AAEDX,cAAc,CAAC,OAAO,EAAE,MAAuBO,sBAAsB,CAAC;AACtEP,cAAc,CAAC,SAAS,EAAE,MAAMG,OAAO,CAAC;AACxCH,cAAc,CAAC,SAAS,EAAE,MAAMI,OAAO,CAAC;AACxCJ,cAAc,CAAC,UAAU,EAAE,MAAMK,QAAQ,CAAC;AAC1CL,cAAc,CAAC,gBAAgB,EAAE,MAAMM,cAAc,CAAC;AAEtD,OAAO,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../lib","sources":["polyfills.web.ts"],"mappings":"AAAA;AAAA","ignoreList":[]}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
export const LastFetchStatus = {
|
|
2
4
|
SUCCESS: 'success',
|
|
3
5
|
FAILURE: 'failure',
|
|
4
6
|
THROTTLED: 'throttled',
|
|
5
|
-
NO_FETCH_YET: 'no_fetch_yet'
|
|
7
|
+
NO_FETCH_YET: 'no_fetch_yet'
|
|
6
8
|
};
|
|
7
|
-
|
|
8
9
|
export const ValueSource = {
|
|
9
10
|
REMOTE: 'remote',
|
|
10
11
|
DEFAULT: 'default',
|
|
11
|
-
STATIC: 'static'
|
|
12
|
+
STATIC: 'static'
|
|
12
13
|
};
|
|
14
|
+
//# sourceMappingURL=statics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LastFetchStatus","SUCCESS","FAILURE","THROTTLED","NO_FETCH_YET","ValueSource","REMOTE","DEFAULT","STATIC"],"sourceRoot":"../../lib","sources":["statics.ts"],"mappings":";;AAeA,OAAO,MAAMA,eAAe,GAAG;EAC7BC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,SAAS,EAAE,WAAW;EACtBC,YAAY,EAAE;AAChB,CAA2C;AAE3C,OAAO,MAAMC,WAAW,GAAG;EACzBC,MAAM,EAAE,QAAQ;EAChBC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE;AACV,CAAuC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../lib","sources":["types/internal.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 file 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 { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
23
|
+
export let FirebaseRemoteConfigTypes;
|
|
24
|
+
//# sourceMappingURL=namespaced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ReactNativeFirebase","FirebaseRemoteConfigTypes"],"sourceRoot":"../../../lib","sources":["types/namespaced.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,4BAA4B;;AAEhE;AAAA,WACiBC,yBAAyB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../lib","sources":["types/remote-config.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["version"],"sourceRoot":"../../lib","sources":["version.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["noopNativeModule"],"sourceRoot":"../../../lib","sources":["web/RNFBConfigModule.android.ts"],"mappings":";;AAAA;AACA,MAAMA,gBAAuC,GAAG,CAAC,CAAC;AAElD,eAAeA,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["noopNativeModule"],"sourceRoot":"../../../lib","sources":["web/RNFBConfigModule.ios.ts"],"mappings":";;AAAA;AACA,MAAMA,gBAAuC,GAAG,CAAC,CAAC;AAElD,eAAeA,gBAAgB","ignoreList":[]}
|