GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
4.0 KiB

2 months ago
  1. import firebase from '@firebase/app-compat';
  2. import { Component } from '@firebase/component';
  3. import { activate, ensureInitialized, fetchConfig, fetchAndActivate, getAll, getBoolean, getNumber, getString, getValue, setLogLevel, isSupported } from '@firebase/remote-config';
  4. /**
  5. * @license
  6. * Copyright 2020 Google LLC
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. class RemoteConfigCompatImpl {
  21. constructor(app, _delegate) {
  22. this.app = app;
  23. this._delegate = _delegate;
  24. }
  25. get defaultConfig() {
  26. return this._delegate.defaultConfig;
  27. }
  28. set defaultConfig(value) {
  29. this._delegate.defaultConfig = value;
  30. }
  31. get fetchTimeMillis() {
  32. return this._delegate.fetchTimeMillis;
  33. }
  34. get lastFetchStatus() {
  35. return this._delegate.lastFetchStatus;
  36. }
  37. get settings() {
  38. return this._delegate.settings;
  39. }
  40. set settings(value) {
  41. this._delegate.settings = value;
  42. }
  43. activate() {
  44. return activate(this._delegate);
  45. }
  46. ensureInitialized() {
  47. return ensureInitialized(this._delegate);
  48. }
  49. /**
  50. * @throws a {@link ErrorCode.FETCH_CLIENT_TIMEOUT} if the request takes longer than
  51. * {@link Settings.fetchTimeoutInSeconds} or
  52. * {@link DEFAULT_FETCH_TIMEOUT_SECONDS}.
  53. */
  54. fetch() {
  55. return fetchConfig(this._delegate);
  56. }
  57. fetchAndActivate() {
  58. return fetchAndActivate(this._delegate);
  59. }
  60. getAll() {
  61. return getAll(this._delegate);
  62. }
  63. getBoolean(key) {
  64. return getBoolean(this._delegate, key);
  65. }
  66. getNumber(key) {
  67. return getNumber(this._delegate, key);
  68. }
  69. getString(key) {
  70. return getString(this._delegate, key);
  71. }
  72. getValue(key) {
  73. return getValue(this._delegate, key);
  74. }
  75. // Based on packages/firestore/src/util/log.ts but not static because we need per-instance levels
  76. // to differentiate 2p and 3p use-cases.
  77. setLogLevel(logLevel) {
  78. setLogLevel(this._delegate, logLevel);
  79. }
  80. }
  81. const name = "@firebase/remote-config-compat";
  82. const version = "0.2.1";
  83. /**
  84. * @license
  85. * Copyright 2020 Google LLC
  86. *
  87. * Licensed under the Apache License, Version 2.0 (the "License");
  88. * you may not use this file except in compliance with the License.
  89. * You may obtain a copy of the License at
  90. *
  91. * http://www.apache.org/licenses/LICENSE-2.0
  92. *
  93. * Unless required by applicable law or agreed to in writing, software
  94. * distributed under the License is distributed on an "AS IS" BASIS,
  95. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  96. * See the License for the specific language governing permissions and
  97. * limitations under the License.
  98. */
  99. function registerRemoteConfigCompat(firebaseInstance) {
  100. firebaseInstance.INTERNAL.registerComponent(new Component('remoteConfig-compat', remoteConfigFactory, "PUBLIC" /* ComponentType.PUBLIC */)
  101. .setMultipleInstances(true)
  102. .setServiceProps({ isSupported }));
  103. firebaseInstance.registerVersion(name, version);
  104. }
  105. function remoteConfigFactory(container, { instanceIdentifier: namespace }) {
  106. const app = container.getProvider('app-compat').getImmediate();
  107. // The following call will always succeed because rc `import {...} from '@firebase/remote-config'`
  108. const remoteConfig = container.getProvider('remote-config').getImmediate({
  109. identifier: namespace
  110. });
  111. return new RemoteConfigCompatImpl(app, remoteConfig);
  112. }
  113. registerRemoteConfigCompat(firebase);
  114. //# sourceMappingURL=index.esm2017.js.map