@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.
Files changed (86) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/android/src/reactnative/java/io/invertase/firebase/config/ReactNativeFirebaseConfigModule.java +11 -5
  3. package/dist/module/RemoteConfigValue.js +53 -0
  4. package/dist/module/RemoteConfigValue.js.map +1 -0
  5. package/dist/module/index.js +27 -0
  6. package/dist/module/index.js.map +1 -0
  7. package/dist/module/modular.js +155 -0
  8. package/dist/module/modular.js.map +1 -0
  9. package/dist/module/namespaced.js +400 -0
  10. package/dist/module/namespaced.js.map +1 -0
  11. package/dist/module/package.json +1 -0
  12. package/{lib → dist/module}/polyfills.js +26 -11
  13. package/dist/module/polyfills.js.map +1 -0
  14. package/dist/module/polyfills.web.js +3 -0
  15. package/dist/module/polyfills.web.js.map +1 -0
  16. package/{lib → dist/module}/statics.js +5 -3
  17. package/dist/module/statics.js.map +1 -0
  18. package/dist/module/types/internal.js +4 -0
  19. package/dist/module/types/internal.js.map +1 -0
  20. package/dist/module/types/namespaced.js +24 -0
  21. package/dist/module/types/namespaced.js.map +1 -0
  22. package/dist/module/types/remote-config.js +4 -0
  23. package/dist/module/types/remote-config.js.map +1 -0
  24. package/dist/module/version.js +5 -0
  25. package/dist/module/version.js.map +1 -0
  26. package/dist/module/web/RNFBConfigModule.android.js +6 -0
  27. package/dist/module/web/RNFBConfigModule.android.js.map +1 -0
  28. package/dist/module/web/RNFBConfigModule.ios.js +6 -0
  29. package/dist/module/web/RNFBConfigModule.ios.js.map +1 -0
  30. package/{lib → dist/module}/web/RNFBConfigModule.js +69 -77
  31. package/dist/module/web/RNFBConfigModule.js.map +1 -0
  32. package/dist/typescript/lib/RemoteConfigValue.d.ts +16 -0
  33. package/dist/typescript/lib/RemoteConfigValue.d.ts.map +1 -0
  34. package/dist/typescript/lib/index.d.ts +6 -0
  35. package/dist/typescript/lib/index.d.ts.map +1 -0
  36. package/dist/typescript/lib/modular.d.ts +76 -0
  37. package/dist/typescript/lib/modular.d.ts.map +1 -0
  38. package/dist/typescript/lib/namespaced.d.ts +11 -0
  39. package/dist/typescript/lib/namespaced.d.ts.map +1 -0
  40. package/dist/typescript/lib/polyfills.d.ts +2 -0
  41. package/dist/typescript/lib/polyfills.d.ts.map +1 -0
  42. package/dist/typescript/lib/polyfills.web.d.ts +1 -0
  43. package/dist/typescript/lib/polyfills.web.d.ts.map +1 -0
  44. package/dist/typescript/lib/statics.d.ts +12 -0
  45. package/dist/typescript/lib/statics.d.ts.map +1 -0
  46. package/dist/typescript/lib/types/internal.d.ts +94 -0
  47. package/dist/typescript/lib/types/internal.d.ts.map +1 -0
  48. package/dist/typescript/lib/types/namespaced.d.ts +124 -0
  49. package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
  50. package/dist/typescript/lib/types/remote-config.d.ts +37 -0
  51. package/dist/typescript/lib/types/remote-config.d.ts.map +1 -0
  52. package/dist/typescript/lib/version.d.ts +2 -0
  53. package/dist/typescript/lib/version.d.ts.map +1 -0
  54. package/dist/typescript/lib/web/RNFBConfigModule.android.d.ts +3 -0
  55. package/dist/typescript/lib/web/RNFBConfigModule.android.d.ts.map +1 -0
  56. package/dist/typescript/lib/web/RNFBConfigModule.d.ts +17 -0
  57. package/dist/typescript/lib/web/RNFBConfigModule.d.ts.map +1 -0
  58. package/dist/typescript/lib/web/RNFBConfigModule.ios.d.ts +3 -0
  59. package/dist/typescript/lib/web/RNFBConfigModule.ios.d.ts.map +1 -0
  60. package/dist/typescript/package.json +1 -0
  61. package/ios/RNFBConfig/RNFBConfigModule.m +10 -4
  62. package/lib/RemoteConfigValue.ts +66 -0
  63. package/lib/index.ts +25 -0
  64. package/lib/modular.ts +197 -0
  65. package/lib/namespaced.ts +552 -0
  66. package/lib/polyfills.ts +54 -0
  67. package/lib/statics.ts +27 -0
  68. package/lib/types/internal.ts +165 -0
  69. package/lib/types/namespaced.ts +163 -0
  70. package/lib/types/remote-config.ts +63 -0
  71. package/lib/version.ts +2 -0
  72. package/lib/web/RNFBConfigModule.android.ts +4 -0
  73. package/lib/web/RNFBConfigModule.ios.ts +4 -0
  74. package/lib/web/RNFBConfigModule.ts +254 -0
  75. package/package.json +42 -9
  76. package/tsconfig.json +21 -0
  77. package/typedoc.json +2 -3
  78. package/lib/RemoteConfigValue.js +0 -51
  79. package/lib/index.d.ts +0 -659
  80. package/lib/index.js +0 -400
  81. package/lib/modular/index.d.ts +0 -265
  82. package/lib/modular/index.js +0 -289
  83. package/lib/version.js +0 -2
  84. package/lib/web/RNFBConfigModule.android.js +0 -2
  85. package/lib/web/RNFBConfigModule.ios.js +0 -2
  86. /package/lib/{polyfills.web.js → polyfills.web.ts} +0 -0
@@ -1,289 +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 { getApp } from '@react-native-firebase/app';
19
-
20
- import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
21
-
22
- /**
23
- * @typedef {import('@firebase/app').FirebaseApp} FirebaseApp
24
- * @typedef {import('..').FirebaseRemoteConfigTypes.Module} RemoteConfig
25
- * @typedef {import('..').FirebaseRemoteConfigTypes.ConfigDefaults} ConfigDefaults
26
- * @typedef {import('..').FirebaseRemoteConfigTypes.ConfigSettings} ConfigSettings
27
- * @typedef {import('..').FirebaseRemoteConfigTypes.ConfigValue} ConfigValue
28
- * @typedef {import('..').FirebaseRemoteConfigTypes.ConfigValues} ConfigValues
29
- * @typedef {import('..').FirebaseRemoteConfigTypes.LastFetchStatusType} LastFetchStatusType
30
- * @typedef {import('..').FirebaseRemoteConfigTypes.RemoteConfigLogLevel} RemoteConfigLogLevel
31
- * @typedef {import('..').FirebaseRemoteConfigTypes.ConfigUpdateObserver} ConfigUpdateObserver
32
- * @typedef {import('..').FirebaseRemoteConfigTypes.Unsubscribe} Unsubscribe
33
- * @typedef {import('.').CustomSignals} CustomSignals
34
- */
35
-
36
- /**
37
- * Returns a RemoteConfig instance for the given app.
38
- * @param {FirebaseApp} [app] - FirebaseApp. Optional.
39
- * @returns {RemoteConfig}
40
- */
41
- export function getRemoteConfig(app) {
42
- if (app) {
43
- return getApp(app.name).remoteConfig();
44
- }
45
-
46
- return getApp().remoteConfig();
47
- }
48
-
49
- /**
50
- * Returns a Boolean which resolves to true if the current call
51
- * activated the fetched configs.
52
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
53
- * @returns {Promise<boolean>}
54
- */
55
- export function activate(remoteConfig) {
56
- return remoteConfig.activate.call(remoteConfig, MODULAR_DEPRECATION_ARG);
57
- }
58
-
59
- /**
60
- * Ensures the last activated config are available to the getters.
61
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
62
- * @returns {Promise<void>}
63
- */
64
- export function ensureInitialized(remoteConfig) {
65
- return remoteConfig.ensureInitialized.call(remoteConfig, MODULAR_DEPRECATION_ARG);
66
- }
67
-
68
- /**
69
- * Performs a fetch and returns a Boolean which resolves to true
70
- * if the current call activated the fetched configs.
71
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
72
- * @returns {Promise<boolean>}
73
- */
74
- export function fetchAndActivate(remoteConfig) {
75
- return remoteConfig.fetchAndActivate.call(remoteConfig, MODULAR_DEPRECATION_ARG);
76
- }
77
-
78
- /**
79
- * Fetches and caches configuration from the Remote Config service.
80
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
81
- * @returns {Promise<void>}
82
- */
83
- export function fetchConfig(remoteConfig) {
84
- return remoteConfig.fetchConfig.call(remoteConfig, MODULAR_DEPRECATION_ARG);
85
- }
86
-
87
- /**
88
- * Gets all config.
89
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
90
- * @returns {ConfigValues}
91
- */
92
- export function getAll(remoteConfig) {
93
- return remoteConfig.getAll.call(remoteConfig, MODULAR_DEPRECATION_ARG);
94
- }
95
-
96
- /**
97
- * Gets the value for the given key as a boolean.
98
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
99
- * @param {string} key - key for boolean value
100
- * @returns {boolean}
101
- */
102
- export function getBoolean(remoteConfig, key) {
103
- return remoteConfig.getBoolean.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
104
- }
105
-
106
- /**
107
- * Gets the value for the given key as a number.
108
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
109
- * @param {string} key - key for number value
110
- * @returns {number}
111
- */
112
- export function getNumber(remoteConfig, key) {
113
- return remoteConfig.getNumber.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
114
- }
115
-
116
- /**
117
- * Gets the value for the given key as a string.
118
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
119
- * @param {string} key - key for string value
120
- * @returns {string}
121
- */
122
- export function getString(remoteConfig, key) {
123
- return remoteConfig.getString.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
124
- }
125
-
126
- /**
127
- * Gets the value for the given key
128
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
129
- * @param {string} key - key for the given value
130
- * @returns {ConfigValue}
131
- */
132
- export function getValue(remoteConfig, key) {
133
- return remoteConfig.getValue.call(remoteConfig, key, MODULAR_DEPRECATION_ARG);
134
- }
135
-
136
- /**
137
- * Defines the log level to use.
138
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
139
- * @param {RemoteConfigLogLevel} logLevel - The log level to set
140
- * @returns {RemoteConfigLogLevel}
141
- */
142
- // eslint-disable-next-line
143
- export function setLogLevel(remoteConfig, logLevel) {
144
- // always return the "error" log level for now as the setter is ignored on native. Web only.
145
- return 'error';
146
- }
147
-
148
- /**
149
- * Checks two different things.
150
- * 1. Check if IndexedDB exists in the browser environment.
151
- * 2. Check if the current browser context allows IndexedDB open() calls.
152
- * @returns {Promise<boolean>}
153
- */
154
- export function isSupported() {
155
- // always return "true" for now. Web only.
156
- return Promise.resolve(true);
157
- }
158
-
159
- /**
160
- * Indicates the default value in milliseconds to abandon a pending fetch
161
- * request made to the Remote Config server. Defaults to 60000 (One minute).
162
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
163
- * @returns {number}
164
- */
165
- export function fetchTimeMillis(remoteConfig) {
166
- return remoteConfig.fetchTimeMillis.call(remoteConfig, MODULAR_DEPRECATION_ARG);
167
- }
168
-
169
- /**
170
- * Returns a ConfigSettings object which provides the properties `minimumFetchIntervalMillis` & `fetchTimeMillis` if they have been set
171
- * using setConfigSettings({ fetchTimeMillis: number, minimumFetchIntervalMillis: number }).
172
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
173
- * @returns {ConfigSettings}
174
- */
175
- export function settings(remoteConfig) {
176
- return remoteConfig.settings.call(remoteConfig, MODULAR_DEPRECATION_ARG);
177
- }
178
-
179
- /**
180
- * The status of the latest Remote RemoteConfig fetch action.
181
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
182
- * @returns {LastFetchStatusType}
183
- */
184
- export function lastFetchStatus(remoteConfig) {
185
- return remoteConfig.lastFetchStatus.call(remoteConfig, MODULAR_DEPRECATION_ARG);
186
- }
187
-
188
- /**
189
- * Deletes all activated, fetched and defaults configs and
190
- * resets all Firebase Remote Config settings.
191
- * Android only. iOS does not reset anything.
192
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
193
- * @returns {Promise<void>}
194
- */
195
- export function reset(remoteConfig) {
196
- return remoteConfig.reset.call(remoteConfig, MODULAR_DEPRECATION_ARG);
197
- }
198
-
199
- /**
200
- * Set the Remote RemoteConfig settings, currently able to set
201
- * `fetchTimeMillis` & `minimumFetchIntervalMillis`
202
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
203
- * @param {ConfigSettings} settings - ConfigSettings instance
204
- * @returns {Promise<void>}
205
- */
206
- export function setConfigSettings(remoteConfig, settings) {
207
- return remoteConfig.setConfigSettings.call(remoteConfig, settings, MODULAR_DEPRECATION_ARG);
208
- }
209
-
210
- /**
211
- * Fetches parameter values for your app.
212
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
213
- * @param {number} expirationDurationSeconds - number
214
- * @returns {Promise<void>}
215
- */
216
- export function fetch(remoteConfig, expirationDurationSeconds) {
217
- return remoteConfig.fetch.call(remoteConfig, expirationDurationSeconds, MODULAR_DEPRECATION_ARG);
218
- }
219
-
220
- /**
221
- * Fetches parameter values for your app.
222
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
223
- * @param {ConfigDefaults} defaults - ConfigDefaults
224
- * @returns {Promise<void>}
225
- */
226
- export function setDefaults(remoteConfig, defaults) {
227
- return remoteConfig.setDefaults.call(remoteConfig, defaults, MODULAR_DEPRECATION_ARG);
228
- }
229
-
230
- /**
231
- * Fetches parameter values for your app.
232
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
233
- * @param {string} resourceName - string
234
- * @returns {Promise<null>}
235
- */
236
- export function setDefaultsFromResource(remoteConfig, resourceName) {
237
- return remoteConfig.setDefaultsFromResource.call(
238
- remoteConfig,
239
- resourceName,
240
- MODULAR_DEPRECATION_ARG,
241
- );
242
- }
243
-
244
- /**
245
- * Registers a listener to changes in the configuration.
246
- *
247
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
248
- * @param {ConfigUpdateObserver} observer - to be notified of config updates.
249
- * @returns {Unsubscribe} function to remove the listener.
250
- * @deprecated use official firebase-js-sdk onConfigUpdate now that web supports realtime
251
- */
252
- export function onConfigUpdate(remoteConfig, observer) {
253
- return remoteConfig.onConfigUpdate.call(remoteConfig, observer, MODULAR_DEPRECATION_ARG);
254
- }
255
-
256
- /**
257
- * Registers a listener to changes in the configuration.
258
- *
259
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
260
- * @param {CallbackOrObserver<OnConfigUpdatedListenerCallback>} callback - function called on config change
261
- * @returns {function} unsubscribe listener
262
- * @deprecated use official firebase-js-sdk onConfigUpdate now that web supports realtime
263
- */
264
- export function onConfigUpdated(remoteConfig, callback) {
265
- return remoteConfig.onConfigUpdated.call(remoteConfig, callback, MODULAR_DEPRECATION_ARG);
266
- }
267
-
268
- /**
269
- * Sets the custom signals for the app instance.
270
- * @param {RemoteConfig} remoteConfig - RemoteConfig instance
271
- * @param {CustomSignals} customSignals - CustomSignals
272
- * @returns {Promise<void>}
273
- */
274
- export async function setCustomSignals(remoteConfig, customSignals) {
275
- for (const [key, value] of Object.entries(customSignals)) {
276
- if (typeof value !== 'string' && typeof value !== 'number' && value !== null) {
277
- throw new Error(
278
- `firebase.remoteConfig().setCustomSignals(): Invalid type for custom signal '${key}': ${typeof value}. Expected 'string', 'number', or 'null'.`,
279
- );
280
- }
281
- }
282
- return remoteConfig._promiseWithConstants.call(
283
- remoteConfig,
284
- remoteConfig.native.setCustomSignals(customSignals),
285
- MODULAR_DEPRECATION_ARG,
286
- );
287
- }
288
-
289
- export { LastFetchStatus, ValueSource } from '../statics';
package/lib/version.js DELETED
@@ -1,2 +0,0 @@
1
- // Generated by genversion.
2
- module.exports = '24.1.0';
@@ -1,2 +0,0 @@
1
- // No-op for android.
2
- export default {};
@@ -1,2 +0,0 @@
1
- // No-op for ios.
2
- export default {};
File without changes