@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
package/lib/index.d.ts
DELETED
|
@@ -1,659 +0,0 @@
|
|
|
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 { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Firebase Remote RemoteConfig package for React Native.
|
|
22
|
-
*
|
|
23
|
-
* #### Example 1
|
|
24
|
-
*
|
|
25
|
-
* Access the firebase export from the `config` package:
|
|
26
|
-
*
|
|
27
|
-
* ```js
|
|
28
|
-
* import { firebase } from '@react-native-firebase/remote-config';
|
|
29
|
-
*
|
|
30
|
-
* // firebase.remoteConfig().X
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* #### Example 2
|
|
34
|
-
*
|
|
35
|
-
* Using the default export from the `config` package:
|
|
36
|
-
*
|
|
37
|
-
* ```js
|
|
38
|
-
* import remoteConfig from '@react-native-firebase/remote-config';
|
|
39
|
-
*
|
|
40
|
-
* // remoteConfig().X
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* #### Example 3
|
|
44
|
-
*
|
|
45
|
-
* Using the default export from the `app` package:
|
|
46
|
-
*
|
|
47
|
-
* ```js
|
|
48
|
-
* import firebase from '@react-native-firebase/app';
|
|
49
|
-
* import '@react-native-firebase/remote-config';
|
|
50
|
-
*
|
|
51
|
-
* // firebase.remoteConfig().X
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @firebase remote-config
|
|
55
|
-
*/
|
|
56
|
-
export namespace FirebaseRemoteConfigTypes {
|
|
57
|
-
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
|
58
|
-
/**
|
|
59
|
-
* Defines levels of Remote Config logging. Web only.
|
|
60
|
-
*/
|
|
61
|
-
export declare type RemoteConfigLogLevel = 'debug' | 'error' | 'silent';
|
|
62
|
-
/**
|
|
63
|
-
* A pseudo-enum for usage with ConfigSettingsRead.lastFetchStatus to determine the last fetch status.
|
|
64
|
-
*
|
|
65
|
-
* #### Example
|
|
66
|
-
*
|
|
67
|
-
* ```js
|
|
68
|
-
* firebase.remoteConfig.LastFetchStatus;
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
export interface LastFetchStatus {
|
|
72
|
-
/**
|
|
73
|
-
* A value indicating that the last fetch was successful.
|
|
74
|
-
*
|
|
75
|
-
* ```js
|
|
76
|
-
* firebase.remoteConfig.LastFetchStatus.SUCCESS;
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
SUCCESS: 'success';
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* A value indicating that the last fetch failed.
|
|
83
|
-
*
|
|
84
|
-
* ```js
|
|
85
|
-
* firebase.remoteConfig.LastFetchStatus.FAILURE;
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
|
-
FAILURE: 'failure';
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* A value indicating that the last fetch was throttled.
|
|
92
|
-
*
|
|
93
|
-
* This usually occurs when calling fetch often with a low expiration duration.
|
|
94
|
-
*
|
|
95
|
-
* ```js
|
|
96
|
-
* firebase.remoteConfig.LastFetchStatus.THROTTLED;
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
THROTTLED: 'throttled';
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* A value indicating that no fetches have occurred yet.
|
|
103
|
-
*
|
|
104
|
-
* This usually means you've not called fetch yet.
|
|
105
|
-
*
|
|
106
|
-
* ```js
|
|
107
|
-
* firebase.remoteConfig.LastFetchStatus.NO_FETCH_YET;
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
NO_FETCH_YET: 'no_fetch_yet';
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* A pseudo-enum for usage with ConfigValue.source to determine the value source.
|
|
115
|
-
*
|
|
116
|
-
* #### Example
|
|
117
|
-
*
|
|
118
|
-
* ```js
|
|
119
|
-
* firebase.remoteConfig.ValueSource;
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
export interface ValueSource {
|
|
123
|
-
/**
|
|
124
|
-
* If the value was retrieved from the server.
|
|
125
|
-
*
|
|
126
|
-
* ```js
|
|
127
|
-
* firebase.remoteConfig.ValueSource.REMOTE;
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
|
-
REMOTE: 'remote';
|
|
131
|
-
/**
|
|
132
|
-
* If the value was set as a default value.
|
|
133
|
-
*
|
|
134
|
-
* ```js
|
|
135
|
-
* firebase.remoteConfig.ValueSource.DEFAULT;
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
DEFAULT: 'default';
|
|
139
|
-
/**
|
|
140
|
-
* If no value was found and a static default value was returned instead.
|
|
141
|
-
*
|
|
142
|
-
* ```js
|
|
143
|
-
* firebase.remoteConfig.ValueSource.STATIC;
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
STATIC: 'static';
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Firebase Remote RemoteConfig statics.
|
|
151
|
-
*
|
|
152
|
-
* ```js
|
|
153
|
-
* firebase.config;
|
|
154
|
-
* ```
|
|
155
|
-
*/
|
|
156
|
-
export interface Statics {
|
|
157
|
-
/**
|
|
158
|
-
* A pseudo-enum for usage with ConfigValue.source to determine the value source.
|
|
159
|
-
*
|
|
160
|
-
* #### Example
|
|
161
|
-
*
|
|
162
|
-
* ```js
|
|
163
|
-
* firebase.remoteConfig.ValueSource;
|
|
164
|
-
* ```
|
|
165
|
-
*/
|
|
166
|
-
ValueSource: ValueSource;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* A pseudo-enum for usage with `firebase.remoteConfig().lastFetchStatus` to determine the last fetch status.
|
|
170
|
-
*
|
|
171
|
-
* #### Example
|
|
172
|
-
*
|
|
173
|
-
* ```js
|
|
174
|
-
* firebase.remoteConfig.LastFetchStatus;
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
LastFetchStatus: LastFetchStatus;
|
|
178
|
-
SDK_VERSION: string;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* An Interface representing a RemoteConfig value.
|
|
183
|
-
*/
|
|
184
|
-
export interface ConfigValue {
|
|
185
|
-
/**
|
|
186
|
-
* Where the value was retrieved from.
|
|
187
|
-
*
|
|
188
|
-
* - `remote`: If the value was retrieved from the server.
|
|
189
|
-
* - `default`: If the value was set as a default value.
|
|
190
|
-
* - `static`: If no value was found and a static default value was returned instead.
|
|
191
|
-
*
|
|
192
|
-
* See the `ValueSource` statics definition.
|
|
193
|
-
*
|
|
194
|
-
* #### Example
|
|
195
|
-
*
|
|
196
|
-
* ```js
|
|
197
|
-
* const configValue = firebase.remoteConfig().getValue('beta_enabled');
|
|
198
|
-
* console.log('Value source: ', configValue.getSource());
|
|
199
|
-
* ```
|
|
200
|
-
*/
|
|
201
|
-
getSource(): 'remote' | 'default' | 'static';
|
|
202
|
-
/**
|
|
203
|
-
* The returned value.
|
|
204
|
-
*
|
|
205
|
-
* #### Example
|
|
206
|
-
*
|
|
207
|
-
* ```js
|
|
208
|
-
* const configValue = firebase.remoteConfig().getValue('dev_mode');
|
|
209
|
-
* console.log('Boolean: ', configValue.asBoolean());
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
asBoolean(): true | false;
|
|
213
|
-
/**
|
|
214
|
-
* The returned value.
|
|
215
|
-
*
|
|
216
|
-
* #### Example
|
|
217
|
-
*
|
|
218
|
-
* ```js
|
|
219
|
-
* const configValue = firebase.remoteConfig().getValue('user_count');
|
|
220
|
-
* console.log('Count: ', configValue.asNumber());
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
asNumber(): number;
|
|
224
|
-
/**
|
|
225
|
-
* The returned value.
|
|
226
|
-
*
|
|
227
|
-
* #### Example
|
|
228
|
-
*
|
|
229
|
-
* ```js
|
|
230
|
-
* const configValue = firebase.remoteConfig().getValue('username');
|
|
231
|
-
* console.log('Name: ', configValue.asString());
|
|
232
|
-
* ```
|
|
233
|
-
*/
|
|
234
|
-
asString(): string;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* An Interface representing multiple RemoteConfig Values.
|
|
239
|
-
*
|
|
240
|
-
* #### Example
|
|
241
|
-
*
|
|
242
|
-
* ```js
|
|
243
|
-
* const values = firebase.remoteConfig().getAll();
|
|
244
|
-
* ```
|
|
245
|
-
*/
|
|
246
|
-
export interface ConfigValues {
|
|
247
|
-
[key: string]: ConfigValue;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* An Interface representing settable config settings.
|
|
252
|
-
*
|
|
253
|
-
* #### Example
|
|
254
|
-
*
|
|
255
|
-
* The example below shows how to set a time limit to the length of time the request for remote config values
|
|
256
|
-
*
|
|
257
|
-
* ```js
|
|
258
|
-
* await firebase.remoteConfig().setConfigSettings({
|
|
259
|
-
* fetchTimeMillis: 6000,
|
|
260
|
-
* });
|
|
261
|
-
* ```
|
|
262
|
-
*/
|
|
263
|
-
export interface ConfigSettings {
|
|
264
|
-
/**
|
|
265
|
-
* Indicates the default value in milliseconds to set for the minimum interval that needs to elapse
|
|
266
|
-
* before a fetch request can again be made to the Remote Config server. Defaults to 43200000 (Twelve hours).
|
|
267
|
-
*/
|
|
268
|
-
minimumFetchIntervalMillis?: number;
|
|
269
|
-
/**
|
|
270
|
-
* Indicates the default value in milliseconds to abandon a pending fetch request made to the Remote Config server. Defaults to 60000 (One minute).
|
|
271
|
-
*/
|
|
272
|
-
fetchTimeMillis?: number;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Set default config values by updating `defaultConfig` with an object & the properties you require as default.
|
|
277
|
-
*
|
|
278
|
-
* #### Example
|
|
279
|
-
*
|
|
280
|
-
* ```js
|
|
281
|
-
* await firebase.remoteConfig().setDefaults({
|
|
282
|
-
* experiment_enabled: false,
|
|
283
|
-
* });
|
|
284
|
-
* ```
|
|
285
|
-
*/
|
|
286
|
-
export interface ConfigDefaults {
|
|
287
|
-
[key: string]: number | string | boolean;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* The status of the latest Remote RemoteConfig fetch action.
|
|
292
|
-
*/
|
|
293
|
-
type LastFetchStatusType = 'success' | 'failure' | 'no_fetch_yet' | 'throttled';
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Contains information about which keys have been updated.
|
|
297
|
-
*/
|
|
298
|
-
export interface ConfigUpdate {
|
|
299
|
-
/**
|
|
300
|
-
* Parameter keys whose values have been updated from the currently activated values.
|
|
301
|
-
* Includes keys that are added, deleted, or whose value, value source, or metadata has changed.
|
|
302
|
-
*/
|
|
303
|
-
getUpdatedKeys(): Set<string>;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Observer interface for receiving real-time Remote Config update notifications.
|
|
308
|
-
*
|
|
309
|
-
* NOTE: Although an `complete` callback can be provided, it will
|
|
310
|
-
* never be called because the ConfigUpdate stream is never-ending.
|
|
311
|
-
*/
|
|
312
|
-
export interface ConfigUpdateObserver {
|
|
313
|
-
/**
|
|
314
|
-
* Called when a new ConfigUpdate is available.
|
|
315
|
-
*/
|
|
316
|
-
next: (configUpdate: ConfigUpdate) => void;
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Called if an error occurs during the stream.
|
|
320
|
-
*/
|
|
321
|
-
error: (error: FirebaseError) => void;
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Called when the stream is gracefully terminated.
|
|
325
|
-
*/
|
|
326
|
-
complete: () => void;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* A function that unsubscribes from a real-time event stream.
|
|
331
|
-
*/
|
|
332
|
-
export type Unsubscribe = () => void;
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* The Firebase Remote RemoteConfig service interface.
|
|
336
|
-
*
|
|
337
|
-
* > This module is available for the default app only.
|
|
338
|
-
*
|
|
339
|
-
* #### Example
|
|
340
|
-
*
|
|
341
|
-
* Get the Remote RemoteConfig service for the default app:
|
|
342
|
-
*
|
|
343
|
-
* ```js
|
|
344
|
-
* const defaultAppRemoteConfig = firebase.remoteConfig();
|
|
345
|
-
* ```
|
|
346
|
-
*/
|
|
347
|
-
export class Module extends FirebaseModule {
|
|
348
|
-
/**
|
|
349
|
-
* The current `FirebaseApp` instance for this Firebase service.
|
|
350
|
-
*/
|
|
351
|
-
app: ReactNativeFirebase.FirebaseApp;
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* The number of milliseconds since the last Remote RemoteConfig fetch was performed.
|
|
355
|
-
*/
|
|
356
|
-
fetchTimeMillis: number;
|
|
357
|
-
/**
|
|
358
|
-
* The status of the latest Remote RemoteConfig fetch action.
|
|
359
|
-
*
|
|
360
|
-
* See the `LastFetchStatus` statics definition.
|
|
361
|
-
*/
|
|
362
|
-
lastFetchStatus: LastFetchStatusType;
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Provides an object which provides the properties `minimumFetchIntervalMillis` & `fetchTimeMillis` if they have been set
|
|
366
|
-
* using setConfigSettings({ fetchTimeMillis: number, minimumFetchIntervalMillis: number }). A description of the properties
|
|
367
|
-
* can be found above
|
|
368
|
-
*
|
|
369
|
-
*/
|
|
370
|
-
settings: ConfigSettings;
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Provides an object with the type ConfigDefaults for default configuration values
|
|
374
|
-
*/
|
|
375
|
-
defaultConfig: ConfigDefaults;
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Set the Remote RemoteConfig settings, currently able to set `fetchTimeMillis` & `minimumFetchIntervalMillis`
|
|
379
|
-
*
|
|
380
|
-
* #### Example
|
|
381
|
-
*
|
|
382
|
-
* ```js
|
|
383
|
-
* await firebase.remoteConfig().setConfigSettings({
|
|
384
|
-
* minimumFetchIntervalMillis: 30000,
|
|
385
|
-
* });
|
|
386
|
-
* ```
|
|
387
|
-
*
|
|
388
|
-
* @param configSettings A ConfigSettingsWrite instance used to set Remote RemoteConfig settings.
|
|
389
|
-
*/
|
|
390
|
-
setConfigSettings(configSettings: ConfigSettings): Promise<void>;
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Sets default values for the app to use when accessing values.
|
|
394
|
-
* Any data fetched and activated will override any default values. Any values in the defaults but not on Firebase will be untouched.
|
|
395
|
-
*
|
|
396
|
-
* #### Example
|
|
397
|
-
*
|
|
398
|
-
* ```js
|
|
399
|
-
* await firebase.remoteConfig().setDefaults({
|
|
400
|
-
* experiment_enabled: false,
|
|
401
|
-
* });
|
|
402
|
-
* ```
|
|
403
|
-
*
|
|
404
|
-
* @param defaults A ConfigDefaults instance used to set default values.
|
|
405
|
-
*/
|
|
406
|
-
setDefaults(defaults: ConfigDefaults): Promise<null>;
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Sets the default values from a resource file.
|
|
410
|
-
* On iOS this is a plist file and on Android this is an XML defaultsMap file.
|
|
411
|
-
*
|
|
412
|
-
* ```js
|
|
413
|
-
* // put in either your iOS or Android directory without the file extension included (.plist or .xml)
|
|
414
|
-
* await firebase.remoteConfig().setDefaultsFromResource('config_resource');
|
|
415
|
-
*
|
|
416
|
-
* // resource values will now be loaded in with your other config values
|
|
417
|
-
* const config = firebase.remoteConfig().getAll();
|
|
418
|
-
* ```
|
|
419
|
-
*
|
|
420
|
-
* @param resourceName The plist/xml file name with no extension.
|
|
421
|
-
*/
|
|
422
|
-
setDefaultsFromResource(resourceName: string): Promise<null>;
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Starts listening for real-time config updates from the Remote Config backend and automatically
|
|
426
|
-
* fetches updates from the Remote Config backend when they are available.
|
|
427
|
-
*
|
|
428
|
-
* @remarks
|
|
429
|
-
* If a connection to the Remote Config backend is not already open, calling this method will
|
|
430
|
-
* open it. Multiple listeners can be added by calling this method again, but subsequent calls
|
|
431
|
-
* re-use the same connection to the backend.
|
|
432
|
-
*
|
|
433
|
-
* The list of updated keys passed to the callback will include all keys not currently active,
|
|
434
|
-
* and the config update process fetches the new config but does not automatically activate
|
|
435
|
-
* it for you. Typically you will activate the config in your callback to use the new values.
|
|
436
|
-
*
|
|
437
|
-
* @param remoteConfig - The RemoteConfig instance.
|
|
438
|
-
* @param observer - The {@link ConfigUpdateObserver} to be notified of config updates.
|
|
439
|
-
* @returns An {@link Unsubscribe} function to remove the listener.
|
|
440
|
-
*/
|
|
441
|
-
onConfigUpdate(remoteConfig: RemoteConfig, observer: ConfigUpdateObserver): Unsubscribe;
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Start listening for real-time config updates from the Remote Config backend and
|
|
445
|
-
* automatically fetch updates when they’re available. Note that the list of updated keys
|
|
446
|
-
* passed to the callback will include all keys not currently active, and the config update
|
|
447
|
-
* process fetches the new config but does not automatically activate for you. Typically
|
|
448
|
-
* you will want to activate the config in your callback so the new values are in force.
|
|
449
|
-
* @param listener called with either array of updated keys or error arg when config changes
|
|
450
|
-
* @deprecated use official firebase-js-sdk onConfigUpdate now that web supports realtime
|
|
451
|
-
*/
|
|
452
|
-
onConfigUpdated(listener: CallbackOrObserver<OnConfigUpdatedListenerCallback>): () => void;
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* Moves fetched data to the apps active config.
|
|
456
|
-
* Resolves with a boolean value true if new local values were activated
|
|
457
|
-
*
|
|
458
|
-
* #### Example
|
|
459
|
-
*
|
|
460
|
-
* ```js
|
|
461
|
-
* // Fetch values
|
|
462
|
-
* await firebase.remoteConfig().fetch();
|
|
463
|
-
* const activated = await firebase.remoteConfig().activate();
|
|
464
|
-
*
|
|
465
|
-
* if (activated) {
|
|
466
|
-
* console.log('Fetched values successfully activated.');
|
|
467
|
-
* } else {
|
|
468
|
-
* console.log('Fetched values were already activated.');
|
|
469
|
-
* }
|
|
470
|
-
* ```
|
|
471
|
-
*/
|
|
472
|
-
activate(): Promise<boolean>;
|
|
473
|
-
/**
|
|
474
|
-
* Ensures the last activated config are available to the getters.
|
|
475
|
-
*
|
|
476
|
-
* #### Example
|
|
477
|
-
*
|
|
478
|
-
* ```js
|
|
479
|
-
* await firebase.remoteConfig().ensureInitialized();
|
|
480
|
-
* // get remote config values
|
|
481
|
-
* ```
|
|
482
|
-
*/
|
|
483
|
-
ensureInitialized(): Promise<void>;
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Fetches the remote config data from Firebase, as defined in the dashboard. If duration is defined (seconds), data will be locally cached for this duration.
|
|
487
|
-
*
|
|
488
|
-
* #### Example
|
|
489
|
-
*
|
|
490
|
-
* ```js
|
|
491
|
-
* // Fetch and cache for 5 minutes
|
|
492
|
-
* await firebase.remoteConfig().fetch(300);
|
|
493
|
-
* ```
|
|
494
|
-
*
|
|
495
|
-
* @param expirationDurationSeconds Duration in seconds to cache the data for. To skip cache, use a duration of 0.
|
|
496
|
-
*/
|
|
497
|
-
fetch(expirationDurationSeconds?: number): Promise<void>;
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Fetches the remote config data from Firebase, as defined in the dashboard.
|
|
501
|
-
* Once fetching is complete this method immediately calls activate and returns a boolean value true if new values were activated
|
|
502
|
-
*
|
|
503
|
-
* #### Example
|
|
504
|
-
*
|
|
505
|
-
* ```js
|
|
506
|
-
* // Fetch, cache for 5 minutes and activate
|
|
507
|
-
* const fetchedRemotely = await firebase.remoteConfig().fetchAndActivate();
|
|
508
|
-
*
|
|
509
|
-
* if (fetchedRemotely) {
|
|
510
|
-
* console.log('New configs were retrieved from the backend and activated.');
|
|
511
|
-
* } else {
|
|
512
|
-
* console.log('No new configs were fetched from the backend, and the local configs were already activated');
|
|
513
|
-
* }
|
|
514
|
-
* ```
|
|
515
|
-
*
|
|
516
|
-
*/
|
|
517
|
-
fetchAndActivate(): Promise<boolean>;
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Returns all available config values.
|
|
521
|
-
*
|
|
522
|
-
* #### Example
|
|
523
|
-
*
|
|
524
|
-
* ```js
|
|
525
|
-
* const values = firebase.remoteConfig().getAll();
|
|
526
|
-
*
|
|
527
|
-
* Object.entries(values).forEach(($) => {
|
|
528
|
-
* const [key, entry] = $;
|
|
529
|
-
* console.log('Key: ', key);
|
|
530
|
-
* console.log('Source: ', entry.getSource());
|
|
531
|
-
* console.log('Value: ', entry.asString());
|
|
532
|
-
* });
|
|
533
|
-
* ```
|
|
534
|
-
*
|
|
535
|
-
*/
|
|
536
|
-
getAll(): ConfigValues;
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* Gets a ConfigValue by key.
|
|
540
|
-
*
|
|
541
|
-
* #### Example
|
|
542
|
-
*
|
|
543
|
-
* ```js
|
|
544
|
-
* const configValue = firebase.remoteConfig().getValue('experiment');
|
|
545
|
-
* console.log('Source: ', configValue.getSource());
|
|
546
|
-
* console.log('Value: ', configValue.asString());
|
|
547
|
-
* ```
|
|
548
|
-
*
|
|
549
|
-
* @param key A key used to retrieve a specific value.
|
|
550
|
-
*/
|
|
551
|
-
getValue(key: string): ConfigValue;
|
|
552
|
-
/**
|
|
553
|
-
* Gets a config property using the key and converts to a boolean value
|
|
554
|
-
*
|
|
555
|
-
* #### Example
|
|
556
|
-
*
|
|
557
|
-
* ```js
|
|
558
|
-
* // true or false depending on truthy or falsy nature of value
|
|
559
|
-
* const configValue = firebase.remoteConfig().getBoolean('experiment');
|
|
560
|
-
* ```
|
|
561
|
-
*
|
|
562
|
-
* @param key A key used to retrieve a specific value.
|
|
563
|
-
*/
|
|
564
|
-
getBoolean(key: string): boolean;
|
|
565
|
-
/**
|
|
566
|
-
* Gets a config property using the key and converts to a string value
|
|
567
|
-
*
|
|
568
|
-
* #### Example
|
|
569
|
-
*
|
|
570
|
-
* ```js
|
|
571
|
-
* // string value of 'experiment' property
|
|
572
|
-
* const configValue = firebase.remoteConfig().getString('experiment');
|
|
573
|
-
* ```
|
|
574
|
-
*
|
|
575
|
-
* @param key A key used to retrieve a specific value.
|
|
576
|
-
*/
|
|
577
|
-
getString(key: string): string;
|
|
578
|
-
/**
|
|
579
|
-
* Gets a config property using the key and converts to a number value. It
|
|
580
|
-
* will be 0 if the value is not a number.
|
|
581
|
-
*
|
|
582
|
-
* #### Example
|
|
583
|
-
*
|
|
584
|
-
* ```js
|
|
585
|
-
* // number value of 'experiment' property
|
|
586
|
-
* const configValue = firebase.remoteConfig().getNumber('experiment');
|
|
587
|
-
* ```
|
|
588
|
-
*
|
|
589
|
-
* @param key A key used to retrieve a specific value.
|
|
590
|
-
*/
|
|
591
|
-
getNumber(key: string): number;
|
|
592
|
-
|
|
593
|
-
/**
|
|
594
|
-
* Deletes all activated, fetched and defaults configs and resets all Firebase Remote Config settings.
|
|
595
|
-
* @android Android only - iOS returns Promise<null> but does not reset anything
|
|
596
|
-
*
|
|
597
|
-
* #### Example
|
|
598
|
-
*
|
|
599
|
-
* ```js
|
|
600
|
-
* await firebase.remoteConfig().reset();
|
|
601
|
-
* // get remote config values
|
|
602
|
-
* ```
|
|
603
|
-
*
|
|
604
|
-
*/
|
|
605
|
-
reset(): Promise<void>;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
// deprecated: from pre-Web realtime remote-config support - remove with onConfigUpdated
|
|
609
|
-
export type CallbackOrObserver<T extends (...args: any[]) => any> = T | { next: T };
|
|
610
|
-
|
|
611
|
-
// deprecated: from pre-Web realtime remote-config support - remove with onConfigUpdated
|
|
612
|
-
export type OnConfigUpdatedListenerCallback = (
|
|
613
|
-
event?: { updatedKeys: string[] },
|
|
614
|
-
error?: {
|
|
615
|
-
code: string;
|
|
616
|
-
message: string;
|
|
617
|
-
nativeErrorMessage: string;
|
|
618
|
-
},
|
|
619
|
-
) => void;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
type RemoteConfigNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
|
|
623
|
-
FirebaseRemoteConfigTypes.Module,
|
|
624
|
-
FirebaseRemoteConfigTypes.Statics
|
|
625
|
-
> & {
|
|
626
|
-
firebase: ReactNativeFirebase.Module;
|
|
627
|
-
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
declare const defaultExport: RemoteConfigNamespace;
|
|
631
|
-
|
|
632
|
-
export const firebase: ReactNativeFirebase.Module & {
|
|
633
|
-
remoteConfig: typeof defaultExport;
|
|
634
|
-
app(
|
|
635
|
-
name?: string,
|
|
636
|
-
): ReactNativeFirebase.FirebaseApp & { remoteConfig(): FirebaseRemoteConfigTypes.Module };
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
export default defaultExport;
|
|
640
|
-
|
|
641
|
-
export * from './modular';
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
|
645
|
-
*/
|
|
646
|
-
declare module '@react-native-firebase/app' {
|
|
647
|
-
namespace ReactNativeFirebase {
|
|
648
|
-
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
|
649
|
-
interface Module {
|
|
650
|
-
remoteConfig: FirebaseModuleWithStatics<
|
|
651
|
-
FirebaseRemoteConfigTypes.Module,
|
|
652
|
-
FirebaseRemoteConfigTypes.Statics
|
|
653
|
-
>;
|
|
654
|
-
}
|
|
655
|
-
interface FirebaseApp {
|
|
656
|
-
remoteConfig(): FirebaseRemoteConfigTypes.Module;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
}
|