@depup/firebase__remote-config 0.8.1-depup.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.
Files changed (54) hide show
  1. package/README.md +31 -0
  2. package/changes.json +10 -0
  3. package/dist/esm/index.esm.js +2199 -0
  4. package/dist/esm/index.esm.js.map +1 -0
  5. package/dist/esm/package.json +1 -0
  6. package/dist/esm/src/abt/experiment.d.ts +13 -0
  7. package/dist/esm/src/api.d.ts +144 -0
  8. package/dist/esm/src/api2.d.ts +40 -0
  9. package/dist/esm/src/client/caching_client.d.ts +46 -0
  10. package/dist/esm/src/client/eventEmitter.d.ts +39 -0
  11. package/dist/esm/src/client/realtime_handler.d.ts +141 -0
  12. package/dist/esm/src/client/remote_config_fetch_client.d.ts +104 -0
  13. package/dist/esm/src/client/rest_client.d.ts +41 -0
  14. package/dist/esm/src/client/retrying_client.d.ts +50 -0
  15. package/dist/esm/src/client/visibility_monitor.d.ts +23 -0
  16. package/dist/esm/src/constants.d.ts +20 -0
  17. package/dist/esm/src/errors.d.ts +87 -0
  18. package/dist/esm/src/index.d.ts +14 -0
  19. package/dist/esm/src/language.d.ts +26 -0
  20. package/dist/esm/src/public_types.d.ts +274 -0
  21. package/dist/esm/src/register.d.ts +2 -0
  22. package/dist/esm/src/remote_config.d.ts +98 -0
  23. package/dist/esm/src/storage/storage.d.ts +118 -0
  24. package/dist/esm/src/storage/storage_cache.d.ts +51 -0
  25. package/dist/esm/src/value.d.ts +26 -0
  26. package/dist/esm/test/setup.d.ts +17 -0
  27. package/dist/index.cjs.js +2216 -0
  28. package/dist/index.cjs.js.map +1 -0
  29. package/dist/remote-config-public.d.ts +441 -0
  30. package/dist/remote-config.d.ts +441 -0
  31. package/dist/src/abt/experiment.d.ts +13 -0
  32. package/dist/src/api.d.ts +144 -0
  33. package/dist/src/api2.d.ts +40 -0
  34. package/dist/src/client/caching_client.d.ts +46 -0
  35. package/dist/src/client/eventEmitter.d.ts +39 -0
  36. package/dist/src/client/realtime_handler.d.ts +141 -0
  37. package/dist/src/client/remote_config_fetch_client.d.ts +104 -0
  38. package/dist/src/client/rest_client.d.ts +41 -0
  39. package/dist/src/client/retrying_client.d.ts +50 -0
  40. package/dist/src/client/visibility_monitor.d.ts +23 -0
  41. package/dist/src/constants.d.ts +20 -0
  42. package/dist/src/errors.d.ts +87 -0
  43. package/dist/src/global_index.d.ts +674 -0
  44. package/dist/src/index.d.ts +14 -0
  45. package/dist/src/language.d.ts +26 -0
  46. package/dist/src/public_types.d.ts +274 -0
  47. package/dist/src/register.d.ts +2 -0
  48. package/dist/src/remote_config.d.ts +98 -0
  49. package/dist/src/storage/storage.d.ts +118 -0
  50. package/dist/src/storage/storage_cache.d.ts +51 -0
  51. package/dist/src/tsdoc-metadata.json +11 -0
  52. package/dist/src/value.d.ts +26 -0
  53. package/dist/test/setup.d.ts +17 -0
  54. package/package.json +93 -0
@@ -0,0 +1,674 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ interface VersionService {
18
+ library: string;
19
+ version: string;
20
+ }
21
+ interface PlatformLoggerService {
22
+ getPlatformInfoString(): string;
23
+ }
24
+ interface HeartbeatService {
25
+ /**
26
+ * Called to report a heartbeat. The function will generate
27
+ * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
28
+ * to IndexedDB.
29
+ * Note that we only store one heartbeat per day. So if a heartbeat for today is
30
+ * already logged, subsequent calls to this function in the same day will be ignored.
31
+ */
32
+ triggerHeartbeat(): Promise<void>;
33
+ /**
34
+ * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
35
+ * It also clears all heartbeats from memory as well as in IndexedDB.
36
+ */
37
+ getHeartbeatsHeader(): Promise<string>;
38
+ }
39
+
40
+ /**
41
+ * @license
42
+ * Copyright 2020 Google LLC
43
+ *
44
+ * Licensed under the Apache License, Version 2.0 (the "License");
45
+ * you may not use this file except in compliance with the License.
46
+ * You may obtain a copy of the License at
47
+ *
48
+ * http://www.apache.org/licenses/LICENSE-2.0
49
+ *
50
+ * Unless required by applicable law or agreed to in writing, software
51
+ * distributed under the License is distributed on an "AS IS" BASIS,
52
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53
+ * See the License for the specific language governing permissions and
54
+ * limitations under the License.
55
+ */
56
+
57
+ /**
58
+ * A {@link @firebase/app#FirebaseApp} holds the initialization information for a collection of
59
+ * services.
60
+ *
61
+ * Do not call this constructor directly. Instead, use
62
+ * {@link (initializeApp:1) | initializeApp()} to create an app.
63
+ *
64
+ * @public
65
+ */
66
+ interface FirebaseApp {
67
+ /**
68
+ * The (read-only) name for this app.
69
+ *
70
+ * The default app's name is `"[DEFAULT]"`.
71
+ *
72
+ * @example
73
+ * ```javascript
74
+ * // The default app's name is "[DEFAULT]"
75
+ * const app = initializeApp(defaultAppConfig);
76
+ * console.log(app.name); // "[DEFAULT]"
77
+ * ```
78
+ *
79
+ * @example
80
+ * ```javascript
81
+ * // A named app's name is what you provide to initializeApp()
82
+ * const otherApp = initializeApp(otherAppConfig, "other");
83
+ * console.log(otherApp.name); // "other"
84
+ * ```
85
+ */
86
+ readonly name: string;
87
+ /**
88
+ * The (read-only) configuration options for this app. These are the original
89
+ * parameters given in {@link (initializeApp:1) | initializeApp()}.
90
+ *
91
+ * @example
92
+ * ```javascript
93
+ * const app = initializeApp(config);
94
+ * console.log(app.options.databaseURL === config.databaseURL); // true
95
+ * ```
96
+ */
97
+ readonly options: FirebaseOptions;
98
+ /**
99
+ * The settable config flag for GDPR opt-in/opt-out
100
+ */
101
+ automaticDataCollectionEnabled: boolean;
102
+ }
103
+ /**
104
+ * @public
105
+ *
106
+ * Firebase configuration object. Contains a set of parameters required by
107
+ * services in order to successfully communicate with Firebase server APIs
108
+ * and to associate client data with your Firebase project and
109
+ * Firebase application. Typically this object is populated by the Firebase
110
+ * console at project setup. See also:
111
+ * {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}.
112
+ */
113
+ interface FirebaseOptions {
114
+ /**
115
+ * An encrypted string used when calling certain APIs that don't need to
116
+ * access private user data
117
+ * (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`).
118
+ */
119
+ apiKey?: string;
120
+ /**
121
+ * Auth domain for the project ID.
122
+ */
123
+ authDomain?: string;
124
+ /**
125
+ * Default Realtime Database URL.
126
+ */
127
+ databaseURL?: string;
128
+ /**
129
+ * The unique identifier for the project across all of Firebase and
130
+ * Google Cloud.
131
+ */
132
+ projectId?: string;
133
+ /**
134
+ * The default Cloud Storage bucket name.
135
+ */
136
+ storageBucket?: string;
137
+ /**
138
+ * Unique numerical value used to identify each sender that can send
139
+ * Firebase Cloud Messaging messages to client apps.
140
+ */
141
+ messagingSenderId?: string;
142
+ /**
143
+ * Unique identifier for the app.
144
+ */
145
+ appId?: string;
146
+ /**
147
+ * An ID automatically created when you enable Analytics in your
148
+ * Firebase project and register a web app. In versions 7.20.0
149
+ * and higher, this parameter is optional.
150
+ */
151
+ measurementId?: string;
152
+ }
153
+ declare module '@firebase/component' {
154
+ interface NameServiceMapping {
155
+ 'app': FirebaseApp;
156
+ 'app-version': VersionService;
157
+ 'heartbeat': HeartbeatService;
158
+ 'platform-logger': PlatformLoggerService;
159
+ }
160
+ }
161
+
162
+ /**
163
+ * An object that can be injected into the environment as __FIREBASE_DEFAULTS__,
164
+ * either as a property of globalThis, a shell environment variable, or a
165
+ * cookie.
166
+ *
167
+ * This object can be used to automatically configure and initialize
168
+ * a Firebase app as well as any emulators.
169
+ *
170
+ * @public
171
+ */
172
+ interface FirebaseDefaults {
173
+ config?: Record<string, string>;
174
+ emulatorHosts?: Record<string, string>;
175
+ _authTokenSyncURL?: string;
176
+ _authIdTokenMaxAge?: number;
177
+ /**
178
+ * Override Firebase's runtime environment detection and
179
+ * force the SDK to act as if it were in the specified environment.
180
+ */
181
+ forceEnvironment?: 'browser' | 'node';
182
+ [key: string]: unknown;
183
+ }
184
+ declare global {
185
+ var __FIREBASE_DEFAULTS__: FirebaseDefaults | undefined;
186
+ }
187
+
188
+ declare class FirebaseError extends Error {
189
+ /** The error code for this error. */
190
+ readonly code: string;
191
+ /** Custom data for this error. */
192
+ customData?: Record<string, unknown> | undefined;
193
+ /** The custom name for all FirebaseErrors. */
194
+ readonly name: string;
195
+ constructor(
196
+ /** The error code for this error. */
197
+ code: string, message: string,
198
+ /** Custom data for this error. */
199
+ customData?: Record<string, unknown> | undefined);
200
+ }
201
+
202
+ /**
203
+ * @license
204
+ * Copyright 2020 Google LLC
205
+ *
206
+ * Licensed under the Apache License, Version 2.0 (the "License");
207
+ * you may not use this file except in compliance with the License.
208
+ * You may obtain a copy of the License at
209
+ *
210
+ * http://www.apache.org/licenses/LICENSE-2.0
211
+ *
212
+ * Unless required by applicable law or agreed to in writing, software
213
+ * distributed under the License is distributed on an "AS IS" BASIS,
214
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
215
+ * See the License for the specific language governing permissions and
216
+ * limitations under the License.
217
+ */
218
+
219
+ /**
220
+ * The Firebase Remote Config service interface.
221
+ *
222
+ * @public
223
+ */
224
+ interface RemoteConfig {
225
+ /**
226
+ * The {@link @firebase/app#FirebaseApp} this `RemoteConfig` instance is associated with.
227
+ */
228
+ app: FirebaseApp;
229
+ /**
230
+ * Defines configuration for the Remote Config SDK.
231
+ */
232
+ settings: RemoteConfigSettings;
233
+ /**
234
+ * Object containing default values for configs.
235
+ */
236
+ defaultConfig: {
237
+ [key: string]: string | number | boolean;
238
+ };
239
+ /**
240
+ * The Unix timestamp in milliseconds of the last <i>successful</i> fetch, or negative one if
241
+ * the {@link RemoteConfig} instance either hasn't fetched or initialization
242
+ * is incomplete.
243
+ */
244
+ fetchTimeMillis: number;
245
+ /**
246
+ * The status of the last fetch <i>attempt</i>.
247
+ */
248
+ lastFetchStatus: FetchStatus;
249
+ }
250
+ /**
251
+ * Defines a self-descriptive reference for config key-value pairs.
252
+ *
253
+ * @public
254
+ */
255
+ interface FirebaseRemoteConfigObject {
256
+ [key: string]: string;
257
+ }
258
+ /**
259
+ * Defines experiment and variant attached to a config parameter.
260
+ *
261
+ * @public
262
+ */
263
+ interface FirebaseExperimentDescription {
264
+ experimentId: string;
265
+ variantId: string;
266
+ experimentStartTime: string;
267
+ triggerTimeoutMillis: string;
268
+ timeToLiveMillis: string;
269
+ affectedParameterKeys?: string[];
270
+ }
271
+ /**
272
+ * Defines a successful response (200 or 304).
273
+ *
274
+ * <p>Modeled after the native `Response` interface, but simplified for Remote Config's
275
+ * use case.
276
+ *
277
+ * @public
278
+ */
279
+ interface FetchResponse {
280
+ /**
281
+ * The HTTP status, which is useful for differentiating success responses with data from
282
+ * those without.
283
+ *
284
+ * <p>The Remote Config client is modeled after the native `Fetch` interface, so
285
+ * HTTP status is first-class.
286
+ *
287
+ * <p>Disambiguation: the fetch response returns a legacy "state" value that is redundant with the
288
+ * HTTP status code. The former is normalized into the latter.
289
+ */
290
+ status: number;
291
+ /**
292
+ * Defines the ETag response header value.
293
+ *
294
+ * <p>Only defined for 200 and 304 responses.
295
+ */
296
+ eTag?: string;
297
+ /**
298
+ * Defines the map of parameters returned as "entries" in the fetch response body.
299
+ *
300
+ * <p>Only defined for 200 responses.
301
+ */
302
+ config?: FirebaseRemoteConfigObject;
303
+ /**
304
+ * The version number of the config template fetched from the server.
305
+ */
306
+ templateVersion?: number;
307
+ /**
308
+ * Metadata for A/B testing and Remote Config Rollout experiments.
309
+ *
310
+ * @remarks Only defined for 200 responses.
311
+ */
312
+ experiments?: FirebaseExperimentDescription[];
313
+ }
314
+ /**
315
+ * Options for Remote Config initialization.
316
+ *
317
+ * @public
318
+ */
319
+ interface RemoteConfigOptions {
320
+ /**
321
+ * The ID of the template to use. If not provided, defaults to "firebase".
322
+ */
323
+ templateId?: string;
324
+ /**
325
+ * Hydrates the state with an initial fetch response.
326
+ */
327
+ initialFetchResponse?: FetchResponse;
328
+ }
329
+ /**
330
+ * Indicates the source of a value.
331
+ *
332
+ * <ul>
333
+ * <li>"static" indicates the value was defined by a static constant.</li>
334
+ * <li>"default" indicates the value was defined by default config.</li>
335
+ * <li>"remote" indicates the value was defined by fetched config.</li>
336
+ * </ul>
337
+ *
338
+ * @public
339
+ */
340
+ type ValueSource = 'static' | 'default' | 'remote';
341
+ /**
342
+ * Wraps a value with metadata and type-safe getters.
343
+ *
344
+ * @public
345
+ */
346
+ interface Value {
347
+ /**
348
+ * Gets the value as a boolean.
349
+ *
350
+ * The following values (case-insensitive) are interpreted as true:
351
+ * "1", "true", "t", "yes", "y", "on". Other values are interpreted as false.
352
+ */
353
+ asBoolean(): boolean;
354
+ /**
355
+ * Gets the value as a number. Comparable to calling <code>Number(value) || 0</code>.
356
+ */
357
+ asNumber(): number;
358
+ /**
359
+ * Gets the value as a string.
360
+ */
361
+ asString(): string;
362
+ /**
363
+ * Gets the {@link ValueSource} for the given key.
364
+ */
365
+ getSource(): ValueSource;
366
+ }
367
+ /**
368
+ * Defines configuration options for the Remote Config SDK.
369
+ *
370
+ * @public
371
+ */
372
+ interface RemoteConfigSettings {
373
+ /**
374
+ * Defines the maximum age in milliseconds of an entry in the config cache before
375
+ * it is considered stale. Defaults to 43200000 (Twelve hours).
376
+ */
377
+ minimumFetchIntervalMillis: number;
378
+ /**
379
+ * Defines the maximum amount of milliseconds to wait for a response when fetching
380
+ * configuration from the Remote Config server. Defaults to 60000 (One minute).
381
+ */
382
+ fetchTimeoutMillis: number;
383
+ }
384
+ /**
385
+ * Summarizes the outcome of the last attempt to fetch config from the Firebase Remote Config server.
386
+ *
387
+ * <ul>
388
+ * <li>"no-fetch-yet" indicates the {@link RemoteConfig} instance has not yet attempted
389
+ * to fetch config, or that SDK initialization is incomplete.</li>
390
+ * <li>"success" indicates the last attempt succeeded.</li>
391
+ * <li>"failure" indicates the last attempt failed.</li>
392
+ * <li>"throttle" indicates the last attempt was rate-limited.</li>
393
+ * </ul>
394
+ *
395
+ * @public
396
+ */
397
+ type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle';
398
+ /**
399
+ * Defines levels of Remote Config logging.
400
+ *
401
+ * @public
402
+ */
403
+ type LogLevel = 'debug' | 'error' | 'silent';
404
+ /**
405
+ * Defines the type for representing custom signals and their values.
406
+ *
407
+ * <p>The values in CustomSignals must be one of the following types:
408
+ *
409
+ * <ul>
410
+ * <li><code>string</code>
411
+ * <li><code>number</code>
412
+ * <li><code>null</code>
413
+ * </ul>
414
+ *
415
+ * @public
416
+ */
417
+ interface CustomSignals {
418
+ [key: string]: string | number | null;
419
+ }
420
+ /**
421
+ * Contains information about which keys have been updated.
422
+ *
423
+ * @public
424
+ */
425
+ interface ConfigUpdate {
426
+ /**
427
+ * Parameter keys whose values have been updated from the currently activated values.
428
+ * Includes keys that are added, deleted, or whose value, value source, or metadata has changed.
429
+ */
430
+ getUpdatedKeys(): Set<string>;
431
+ }
432
+ /**
433
+ * Observer interface for receiving real-time Remote Config update notifications.
434
+ *
435
+ * NOTE: Although an `complete` callback can be provided, it will
436
+ * never be called because the ConfigUpdate stream is never-ending.
437
+ *
438
+ * @public
439
+ */
440
+ interface ConfigUpdateObserver {
441
+ /**
442
+ * Called when a new ConfigUpdate is available.
443
+ */
444
+ next: (configUpdate: ConfigUpdate) => void;
445
+ /**
446
+ * Called if an error occurs during the stream.
447
+ */
448
+ error: (error: FirebaseError) => void;
449
+ /**
450
+ * Called when the stream is gracefully terminated.
451
+ */
452
+ complete: () => void;
453
+ }
454
+ /**
455
+ * A function that unsubscribes from a real-time event stream.
456
+ *
457
+ * @public
458
+ */
459
+ type Unsubscribe = () => void;
460
+ /**
461
+ * Indicates the type of fetch request.
462
+ *
463
+ * <ul>
464
+ * <li>"BASE" indicates a standard fetch request.</li>
465
+ * <li>"REALTIME" indicates a fetch request triggered by a real-time update.</li>
466
+ * </ul>
467
+ *
468
+ * @public
469
+ */
470
+ type FetchType = 'BASE' | 'REALTIME';
471
+ declare module '@firebase/component' {
472
+ interface NameServiceMapping {
473
+ 'remote-config': RemoteConfig;
474
+ }
475
+ }
476
+
477
+ /**
478
+ * @license
479
+ * Copyright 2020 Google LLC
480
+ *
481
+ * Licensed under the Apache License, Version 2.0 (the "License");
482
+ * you may not use this file except in compliance with the License.
483
+ * You may obtain a copy of the License at
484
+ *
485
+ * http://www.apache.org/licenses/LICENSE-2.0
486
+ *
487
+ * Unless required by applicable law or agreed to in writing, software
488
+ * distributed under the License is distributed on an "AS IS" BASIS,
489
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
490
+ * See the License for the specific language governing permissions and
491
+ * limitations under the License.
492
+ */
493
+
494
+ /**
495
+ *
496
+ * @param app - The {@link @firebase/app#FirebaseApp} instance.
497
+ * @param options - Optional. The {@link RemoteConfigOptions} with which to instantiate the
498
+ * Remote Config instance.
499
+ * @returns A {@link RemoteConfig} instance.
500
+ *
501
+ * @public
502
+ */
503
+ declare function getRemoteConfig(app?: FirebaseApp, options?: RemoteConfigOptions): RemoteConfig;
504
+ /**
505
+ * Makes the last fetched config available to the getters.
506
+ * @param remoteConfig - The {@link RemoteConfig} instance.
507
+ * @returns A `Promise` which resolves to true if the current call activated the fetched configs.
508
+ * If the fetched configs were already activated, the `Promise` will resolve to false.
509
+ *
510
+ * @public
511
+ */
512
+ declare function activate(remoteConfig: RemoteConfig): Promise<boolean>;
513
+ /**
514
+ * Ensures the last activated config are available to the getters.
515
+ * @param remoteConfig - The {@link RemoteConfig} instance.
516
+ *
517
+ * @returns A `Promise` that resolves when the last activated config is available to the getters.
518
+ * @public
519
+ */
520
+ declare function ensureInitialized(remoteConfig: RemoteConfig): Promise<void>;
521
+ /**
522
+ * Fetches and caches configuration from the Remote Config service.
523
+ * @param remoteConfig - The {@link RemoteConfig} instance.
524
+ * @public
525
+ */
526
+ declare function fetchConfig(remoteConfig: RemoteConfig): Promise<void>;
527
+ /**
528
+ * Gets all config.
529
+ *
530
+ * @param remoteConfig - The {@link RemoteConfig} instance.
531
+ * @returns All config.
532
+ *
533
+ * @public
534
+ */
535
+ declare function getAll(remoteConfig: RemoteConfig): Record<string, Value>;
536
+ /**
537
+ * Gets the value for the given key as a boolean.
538
+ *
539
+ * Convenience method for calling <code>remoteConfig.getValue(key).asBoolean()</code>.
540
+ *
541
+ * @param remoteConfig - The {@link RemoteConfig} instance.
542
+ * @param key - The name of the parameter.
543
+ *
544
+ * @returns The value for the given key as a boolean.
545
+ * @public
546
+ */
547
+ declare function getBoolean(remoteConfig: RemoteConfig, key: string): boolean;
548
+ /**
549
+ * Gets the value for the given key as a number.
550
+ *
551
+ * Convenience method for calling <code>remoteConfig.getValue(key).asNumber()</code>.
552
+ *
553
+ * @param remoteConfig - The {@link RemoteConfig} instance.
554
+ * @param key - The name of the parameter.
555
+ *
556
+ * @returns The value for the given key as a number.
557
+ *
558
+ * @public
559
+ */
560
+ declare function getNumber(remoteConfig: RemoteConfig, key: string): number;
561
+ /**
562
+ * Gets the value for the given key as a string.
563
+ * Convenience method for calling <code>remoteConfig.getValue(key).asString()</code>.
564
+ *
565
+ * @param remoteConfig - The {@link RemoteConfig} instance.
566
+ * @param key - The name of the parameter.
567
+ *
568
+ * @returns The value for the given key as a string.
569
+ *
570
+ * @public
571
+ */
572
+ declare function getString(remoteConfig: RemoteConfig, key: string): string;
573
+ /**
574
+ * Gets the {@link Value} for the given key.
575
+ *
576
+ * @param remoteConfig - The {@link RemoteConfig} instance.
577
+ * @param key - The name of the parameter.
578
+ *
579
+ * @returns The value for the given key.
580
+ *
581
+ * @public
582
+ */
583
+ declare function getValue(remoteConfig: RemoteConfig, key: string): Value;
584
+ /**
585
+ * Defines the log level to use.
586
+ *
587
+ * @param remoteConfig - The {@link RemoteConfig} instance.
588
+ * @param logLevel - The log level to set.
589
+ *
590
+ * @public
591
+ */
592
+ declare function setLogLevel(remoteConfig: RemoteConfig, logLevel: LogLevel): void;
593
+ /**
594
+ * Sets the custom signals for the app instance.
595
+ *
596
+ * @param remoteConfig - The {@link RemoteConfig} instance.
597
+ * @param customSignals - Map (key, value) of the custom signals to be set for the app instance. If
598
+ * a key already exists, the value is overwritten. Setting the value of a custom signal to null
599
+ * unsets the signal. The signals will be persisted locally on the client.
600
+ *
601
+ * @public
602
+ */
603
+ declare function setCustomSignals(remoteConfig: RemoteConfig, customSignals: CustomSignals): Promise<void>;
604
+ /**
605
+ * Starts listening for real-time config updates from the Remote Config backend and automatically
606
+ * fetches updates from the Remote Config backend when they are available.
607
+ *
608
+ * @remarks
609
+ * If a connection to the Remote Config backend is not already open, calling this method will
610
+ * open it. Multiple listeners can be added by calling this method again, but subsequent calls
611
+ * re-use the same connection to the backend.
612
+ *
613
+ * @param remoteConfig - The {@link RemoteConfig} instance.
614
+ * @param observer - The {@link ConfigUpdateObserver} to be notified of config updates.
615
+ * @returns An {@link Unsubscribe} function to remove the listener.
616
+ *
617
+ * @public
618
+ */
619
+ declare function onConfigUpdate(remoteConfig: RemoteConfig, observer: ConfigUpdateObserver): Unsubscribe;
620
+
621
+ /**
622
+ * @license
623
+ * Copyright 2020 Google LLC
624
+ *
625
+ * Licensed under the Apache License, Version 2.0 (the "License");
626
+ * you may not use this file except in compliance with the License.
627
+ * You may obtain a copy of the License at
628
+ *
629
+ * http://www.apache.org/licenses/LICENSE-2.0
630
+ *
631
+ * Unless required by applicable law or agreed to in writing, software
632
+ * distributed under the License is distributed on an "AS IS" BASIS,
633
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
634
+ * See the License for the specific language governing permissions and
635
+ * limitations under the License.
636
+ */
637
+
638
+ /**
639
+ *
640
+ * Performs fetch and activate operations, as a convenience.
641
+ *
642
+ * @param remoteConfig - The {@link RemoteConfig} instance.
643
+ *
644
+ * @returns A `Promise` which resolves to true if the current call activated the fetched configs.
645
+ * If the fetched configs were already activated, the `Promise` will resolve to false.
646
+ *
647
+ * @public
648
+ */
649
+ declare function fetchAndActivate(remoteConfig: RemoteConfig): Promise<boolean>;
650
+ /**
651
+ * This method provides two different checks:
652
+ *
653
+ * 1. Check if IndexedDB exists in the browser environment.
654
+ * 2. Check if the current browser context allows IndexedDB `open()` calls.
655
+ *
656
+ * @returns A `Promise` which resolves to true if a {@link RemoteConfig} instance
657
+ * can be initialized in this environment, or false if it cannot.
658
+ * @public
659
+ */
660
+ declare function isSupported(): Promise<boolean>;
661
+
662
+ /**
663
+ * The Firebase Remote Config Web SDK.
664
+ * This SDK does not work in a Node.js environment.
665
+ *
666
+ * @packageDocumentation
667
+ */
668
+ declare global {
669
+ interface Window {
670
+ FIREBASE_REMOTE_CONFIG_URL_BASE: string;
671
+ }
672
+ }
673
+
674
+ export { ConfigUpdate, ConfigUpdateObserver, CustomSignals, FetchResponse, FetchStatus, FetchType, FirebaseExperimentDescription, FirebaseRemoteConfigObject, LogLevel, RemoteConfig, RemoteConfigOptions, RemoteConfigSettings, Unsubscribe, Value, ValueSource, activate, ensureInitialized, fetchAndActivate, fetchConfig, getAll, getBoolean, getNumber, getRemoteConfig, getString, getValue, isSupported, onConfigUpdate, setCustomSignals, setLogLevel };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The Firebase Remote Config Web SDK.
3
+ * This SDK does not work in a Node.js environment.
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ declare global {
8
+ interface Window {
9
+ FIREBASE_REMOTE_CONFIG_URL_BASE: string;
10
+ }
11
+ }
12
+ export * from './api';
13
+ export * from './api2';
14
+ export * from './public_types';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Attempts to get the most accurate browser language setting.
19
+ *
20
+ * <p>Adapted from getUserLanguage in packages/auth/src/utils.js for TypeScript.
21
+ *
22
+ * <p>Defers default language specification to server logic for consistency.
23
+ *
24
+ * @param navigatorLanguage Enables tests to override read-only {@link NavigatorLanguage}.
25
+ */
26
+ export declare function getUserLanguage(navigatorLanguage?: NavigatorLanguage): string;