@firebase/app-check 0.5.17 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @firebase/app-check
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`1625f7a95`](https://github.com/firebase/firebase-js-sdk/commit/1625f7a95cc3ffb666845db0a8044329be74b5be) [#6799](https://github.com/firebase/firebase-js-sdk/pull/6799) - Update TypeScript version to 4.7.4.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`c20633ed3`](https://github.com/firebase/firebase-js-sdk/commit/c20633ed35056cbadc9d65d9ceddf4e28d1ea666), [`1625f7a95`](https://github.com/firebase/firebase-js-sdk/commit/1625f7a95cc3ffb666845db0a8044329be74b5be)]:
12
+ - @firebase/util@1.8.0
13
+ - @firebase/component@0.6.0
14
+ - @firebase/logger@0.4.0
15
+
3
16
  ## 0.5.17
4
17
 
5
18
  ### Patch Changes
@@ -235,22 +235,22 @@ function sleep(ms) {
235
235
  */
236
236
  var _a;
237
237
  var ERRORS = (_a = {},
238
- _a["already-initialized" /* ALREADY_INITIALIZED */] = 'You have already called initializeAppCheck() for FirebaseApp {$appName} with ' +
238
+ _a["already-initialized" /* AppCheckError.ALREADY_INITIALIZED */] = 'You have already called initializeAppCheck() for FirebaseApp {$appName} with ' +
239
239
  'different options. To avoid this error, call initializeAppCheck() with the ' +
240
240
  'same options as when it was originally called. This will return the ' +
241
241
  'already initialized instance.',
242
- _a["use-before-activation" /* USE_BEFORE_ACTIVATION */] = 'App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. ' +
242
+ _a["use-before-activation" /* AppCheckError.USE_BEFORE_ACTIVATION */] = 'App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. ' +
243
243
  'Call initializeAppCheck() before instantiating other Firebase services.',
244
- _a["fetch-network-error" /* FETCH_NETWORK_ERROR */] = 'Fetch failed to connect to a network. Check Internet connection. ' +
244
+ _a["fetch-network-error" /* AppCheckError.FETCH_NETWORK_ERROR */] = 'Fetch failed to connect to a network. Check Internet connection. ' +
245
245
  'Original error: {$originalErrorMessage}.',
246
- _a["fetch-parse-error" /* FETCH_PARSE_ERROR */] = 'Fetch client could not parse response.' +
246
+ _a["fetch-parse-error" /* AppCheckError.FETCH_PARSE_ERROR */] = 'Fetch client could not parse response.' +
247
247
  ' Original error: {$originalErrorMessage}.',
248
- _a["fetch-status-error" /* FETCH_STATUS_ERROR */] = 'Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.',
249
- _a["storage-open" /* STORAGE_OPEN */] = 'Error thrown when opening storage. Original error: {$originalErrorMessage}.',
250
- _a["storage-get" /* STORAGE_GET */] = 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.',
251
- _a["storage-set" /* STORAGE_WRITE */] = 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.',
252
- _a["recaptcha-error" /* RECAPTCHA_ERROR */] = 'ReCAPTCHA error.',
253
- _a["throttled" /* THROTTLED */] = "Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}",
248
+ _a["fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */] = 'Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.',
249
+ _a["storage-open" /* AppCheckError.STORAGE_OPEN */] = 'Error thrown when opening storage. Original error: {$originalErrorMessage}.',
250
+ _a["storage-get" /* AppCheckError.STORAGE_GET */] = 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.',
251
+ _a["storage-set" /* AppCheckError.STORAGE_WRITE */] = 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.',
252
+ _a["recaptcha-error" /* AppCheckError.RECAPTCHA_ERROR */] = 'ReCAPTCHA error.',
253
+ _a["throttled" /* AppCheckError.THROTTLED */] = "Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}",
254
254
  _a);
255
255
  var ERROR_FACTORY = new ErrorFactory('appCheck', 'AppCheck', ERRORS);
256
256
 
@@ -280,7 +280,7 @@ function getRecaptcha(isEnterprise) {
280
280
  }
281
281
  function ensureActivated(app) {
282
282
  if (!getStateReference(app).activated) {
283
- throw ERROR_FACTORY.create("use-before-activation" /* USE_BEFORE_ACTIVATION */, {
283
+ throw ERROR_FACTORY.create("use-before-activation" /* AppCheckError.USE_BEFORE_ACTIVATION */, {
284
284
  appName: app.name
285
285
  });
286
286
  }
@@ -325,12 +325,11 @@ function pad(value) {
325
325
  * limitations under the License.
326
326
  */
327
327
  function exchangeToken(_a, heartbeatServiceProvider) {
328
- var _b, _c;
329
328
  var url = _a.url, body = _a.body;
330
329
  return __awaiter(this, void 0, void 0, function () {
331
330
  var headers, heartbeatService, heartbeatsHeader, options, response, originalError_1, responseBody, originalError_2, match, timeToLiveAsNumber, now;
332
- return __generator(this, function (_d) {
333
- switch (_d.label) {
331
+ return __generator(this, function (_b) {
332
+ switch (_b.label) {
334
333
  case 0:
335
334
  headers = {
336
335
  'Content-Type': 'application/json'
@@ -341,54 +340,54 @@ function exchangeToken(_a, heartbeatServiceProvider) {
341
340
  if (!heartbeatService) return [3 /*break*/, 2];
342
341
  return [4 /*yield*/, heartbeatService.getHeartbeatsHeader()];
343
342
  case 1:
344
- heartbeatsHeader = _d.sent();
343
+ heartbeatsHeader = _b.sent();
345
344
  if (heartbeatsHeader) {
346
345
  headers['X-Firebase-Client'] = heartbeatsHeader;
347
346
  }
348
- _d.label = 2;
347
+ _b.label = 2;
349
348
  case 2:
350
349
  options = {
351
350
  method: 'POST',
352
351
  body: JSON.stringify(body),
353
352
  headers: headers
354
353
  };
355
- _d.label = 3;
354
+ _b.label = 3;
356
355
  case 3:
357
- _d.trys.push([3, 5, , 6]);
356
+ _b.trys.push([3, 5, , 6]);
358
357
  return [4 /*yield*/, fetch(url, options)];
359
358
  case 4:
360
- response = _d.sent();
359
+ response = _b.sent();
361
360
  return [3 /*break*/, 6];
362
361
  case 5:
363
- originalError_1 = _d.sent();
364
- throw ERROR_FACTORY.create("fetch-network-error" /* FETCH_NETWORK_ERROR */, {
365
- originalErrorMessage: (_b = originalError_1) === null || _b === void 0 ? void 0 : _b.message
362
+ originalError_1 = _b.sent();
363
+ throw ERROR_FACTORY.create("fetch-network-error" /* AppCheckError.FETCH_NETWORK_ERROR */, {
364
+ originalErrorMessage: originalError_1 === null || originalError_1 === void 0 ? void 0 : originalError_1.message
366
365
  });
367
366
  case 6:
368
367
  if (response.status !== 200) {
369
- throw ERROR_FACTORY.create("fetch-status-error" /* FETCH_STATUS_ERROR */, {
368
+ throw ERROR_FACTORY.create("fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */, {
370
369
  httpStatus: response.status
371
370
  });
372
371
  }
373
- _d.label = 7;
372
+ _b.label = 7;
374
373
  case 7:
375
- _d.trys.push([7, 9, , 10]);
374
+ _b.trys.push([7, 9, , 10]);
376
375
  return [4 /*yield*/, response.json()];
377
376
  case 8:
378
377
  // JSON parsing throws SyntaxError if the response body isn't a JSON string.
379
- responseBody = _d.sent();
378
+ responseBody = _b.sent();
380
379
  return [3 /*break*/, 10];
381
380
  case 9:
382
- originalError_2 = _d.sent();
383
- throw ERROR_FACTORY.create("fetch-parse-error" /* FETCH_PARSE_ERROR */, {
384
- originalErrorMessage: (_c = originalError_2) === null || _c === void 0 ? void 0 : _c.message
381
+ originalError_2 = _b.sent();
382
+ throw ERROR_FACTORY.create("fetch-parse-error" /* AppCheckError.FETCH_PARSE_ERROR */, {
383
+ originalErrorMessage: originalError_2 === null || originalError_2 === void 0 ? void 0 : originalError_2.message
385
384
  });
386
385
  case 10:
387
386
  match = responseBody.ttl.match(/^([\d.]+)(s)$/);
388
387
  if (!match || !match[2] || isNaN(Number(match[1]))) {
389
- throw ERROR_FACTORY.create("fetch-parse-error" /* FETCH_PARSE_ERROR */, {
388
+ throw ERROR_FACTORY.create("fetch-parse-error" /* AppCheckError.FETCH_PARSE_ERROR */, {
390
389
  originalErrorMessage: "ttl field (timeToLive) is not in standard Protobuf Duration " +
391
- ("format: " + responseBody.ttl)
390
+ "format: ".concat(responseBody.ttl)
392
391
  });
393
392
  }
394
393
  timeToLiveAsNumber = Number(match[1]) * 1000;
@@ -405,7 +404,7 @@ function exchangeToken(_a, heartbeatServiceProvider) {
405
404
  function getExchangeRecaptchaV3TokenRequest(app, reCAPTCHAToken) {
406
405
  var _a = app.options, projectId = _a.projectId, appId = _a.appId, apiKey = _a.apiKey;
407
406
  return {
408
- url: BASE_ENDPOINT + "/projects/" + projectId + "/apps/" + appId + ":" + EXCHANGE_RECAPTCHA_TOKEN_METHOD + "?key=" + apiKey,
407
+ url: "".concat(BASE_ENDPOINT, "/projects/").concat(projectId, "/apps/").concat(appId, ":").concat(EXCHANGE_RECAPTCHA_TOKEN_METHOD, "?key=").concat(apiKey),
409
408
  body: {
410
409
  'recaptcha_v3_token': reCAPTCHAToken
411
410
  }
@@ -414,7 +413,7 @@ function getExchangeRecaptchaV3TokenRequest(app, reCAPTCHAToken) {
414
413
  function getExchangeRecaptchaEnterpriseTokenRequest(app, reCAPTCHAToken) {
415
414
  var _a = app.options, projectId = _a.projectId, appId = _a.appId, apiKey = _a.apiKey;
416
415
  return {
417
- url: BASE_ENDPOINT + "/projects/" + projectId + "/apps/" + appId + ":" + EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD + "?key=" + apiKey,
416
+ url: "".concat(BASE_ENDPOINT, "/projects/").concat(projectId, "/apps/").concat(appId, ":").concat(EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD, "?key=").concat(apiKey),
418
417
  body: {
419
418
  'recaptcha_enterprise_token': reCAPTCHAToken
420
419
  }
@@ -423,7 +422,7 @@ function getExchangeRecaptchaEnterpriseTokenRequest(app, reCAPTCHAToken) {
423
422
  function getExchangeDebugTokenRequest(app, debugToken) {
424
423
  var _a = app.options, projectId = _a.projectId, appId = _a.appId, apiKey = _a.apiKey;
425
424
  return {
426
- url: BASE_ENDPOINT + "/projects/" + projectId + "/apps/" + appId + ":" + EXCHANGE_DEBUG_TOKEN_METHOD + "?key=" + apiKey,
425
+ url: "".concat(BASE_ENDPOINT, "/projects/").concat(projectId, "/apps/").concat(appId, ":").concat(EXCHANGE_DEBUG_TOKEN_METHOD, "?key=").concat(apiKey),
427
426
  body: {
428
427
  // eslint-disable-next-line
429
428
  debug_token: debugToken
@@ -457,7 +456,6 @@ function getDBPromise() {
457
456
  return dbPromise;
458
457
  }
459
458
  dbPromise = new Promise(function (resolve, reject) {
460
- var _a;
461
459
  try {
462
460
  var request = indexedDB.open(DB_NAME, DB_VERSION);
463
461
  request.onsuccess = function (event) {
@@ -465,7 +463,7 @@ function getDBPromise() {
465
463
  };
466
464
  request.onerror = function (event) {
467
465
  var _a;
468
- reject(ERROR_FACTORY.create("storage-open" /* STORAGE_OPEN */, {
466
+ reject(ERROR_FACTORY.create("storage-open" /* AppCheckError.STORAGE_OPEN */, {
469
467
  originalErrorMessage: (_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message
470
468
  }));
471
469
  };
@@ -485,8 +483,8 @@ function getDBPromise() {
485
483
  };
486
484
  }
487
485
  catch (e) {
488
- reject(ERROR_FACTORY.create("storage-open" /* STORAGE_OPEN */, {
489
- originalErrorMessage: (_a = e) === null || _a === void 0 ? void 0 : _a.message
486
+ reject(ERROR_FACTORY.create("storage-open" /* AppCheckError.STORAGE_OPEN */, {
487
+ originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
490
488
  }));
491
489
  }
492
490
  });
@@ -524,7 +522,7 @@ function write(key, value) {
524
522
  };
525
523
  transaction.onerror = function (event) {
526
524
  var _a;
527
- reject(ERROR_FACTORY.create("storage-set" /* STORAGE_WRITE */, {
525
+ reject(ERROR_FACTORY.create("storage-set" /* AppCheckError.STORAGE_WRITE */, {
528
526
  originalErrorMessage: (_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message
529
527
  }));
530
528
  };
@@ -556,7 +554,7 @@ function read(key) {
556
554
  };
557
555
  transaction.onerror = function (event) {
558
556
  var _a;
559
- reject(ERROR_FACTORY.create("storage-get" /* STORAGE_GET */, {
557
+ reject(ERROR_FACTORY.create("storage-get" /* AppCheckError.STORAGE_GET */, {
560
558
  originalErrorMessage: (_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message
561
559
  }));
562
560
  };
@@ -566,7 +564,7 @@ function read(key) {
566
564
  });
567
565
  }
568
566
  function computeKey(app) {
569
- return app.options.appId + "-" + app.name;
567
+ return "".concat(app.options.appId, "-").concat(app.name);
570
568
  }
571
569
 
572
570
  /**
@@ -624,7 +622,7 @@ function readTokenFromStorage(app) {
624
622
  case 3:
625
623
  e_1 = _a.sent();
626
624
  // swallow the error and return undefined
627
- logger.warn("Failed to read token from IndexedDB. Error: " + e_1);
625
+ logger.warn("Failed to read token from IndexedDB. Error: ".concat(e_1));
628
626
  return [3 /*break*/, 4];
629
627
  case 4: return [2 /*return*/, token];
630
628
  case 5: return [2 /*return*/, undefined];
@@ -639,7 +637,7 @@ function writeTokenToStorage(app, token) {
639
637
  if (isIndexedDBAvailable()) {
640
638
  return writeTokenToIndexedDB(app, token).catch(function (e) {
641
639
  // swallow the error and resolve the promise
642
- logger.warn("Failed to write token to IndexedDB. Error: " + e);
640
+ logger.warn("Failed to write token to IndexedDB. Error: ".concat(e));
643
641
  });
644
642
  }
645
643
  return Promise.resolve();
@@ -670,7 +668,7 @@ function readOrCreateDebugTokenFromStorage() {
670
668
  // If you see this error trying to use debug token, it probably means you are using a browser that doesn't support indexeddb.
671
669
  // You should switch to a different browser that supports indexeddb
672
670
  writeDebugTokenToIndexedDB(newToken).catch(function (e) {
673
- return logger.warn("Failed to persist debug token to IndexedDB. Error: " + e);
671
+ return logger.warn("Failed to persist debug token to IndexedDB. Error: ".concat(e));
674
672
  });
675
673
  return [2 /*return*/, newToken];
676
674
  }
@@ -822,7 +820,8 @@ function getToken$2(appCheck, forceRefresh) {
822
820
  _d = [app];
823
821
  return [4 /*yield*/, getDebugToken()];
824
822
  case 5:
825
- _a.exchangeTokenPromise = _b.apply(void 0, [_c.apply(void 0, _d.concat([_e.sent()])), appCheck.heartbeatServiceProvider]).finally(function () {
823
+ _a.exchangeTokenPromise = _b.apply(void 0, [_c.apply(void 0, _d.concat([_e.sent()])),
824
+ appCheck.heartbeatServiceProvider]).finally(function () {
826
825
  // Clear promise when settled - either resolved or rejected.
827
826
  state.exchangeTokenPromise = undefined;
828
827
  });
@@ -858,7 +857,7 @@ function getToken$2(appCheck, forceRefresh) {
858
857
  return [3 /*break*/, 12];
859
858
  case 11:
860
859
  e_1 = _e.sent();
861
- if (e_1.code === "appCheck/" + "throttled" /* THROTTLED */) {
860
+ if (e_1.code === "appCheck/".concat("throttled" /* AppCheckError.THROTTLED */)) {
862
861
  // Warn if throttled, but do not treat it as an error.
863
862
  logger.warn(e_1.message);
864
863
  }
@@ -924,7 +923,7 @@ function addTokenListener(appCheck, type, listener, onError) {
924
923
  error: onError,
925
924
  type: type
926
925
  };
927
- state.tokenObservers = __spreadArray(__spreadArray([], state.tokenObservers), [tokenObserver]);
926
+ state.tokenObservers = __spreadArray(__spreadArray([], state.tokenObservers, true), [tokenObserver], false);
928
927
  // Invoke the listener async immediately if there is a valid token
929
928
  // in memory.
930
929
  if (state.token && isValid(state.token)) {
@@ -1045,7 +1044,7 @@ function notifyTokenListeners(app, token) {
1045
1044
  for (var _i = 0, observers_1 = observers; _i < observers_1.length; _i++) {
1046
1045
  var observer = observers_1[_i];
1047
1046
  try {
1048
- if (observer.type === "EXTERNAL" /* EXTERNAL */ && token.error != null) {
1047
+ if (observer.type === "EXTERNAL" /* ListenerType.EXTERNAL */ && token.error != null) {
1049
1048
  // If this listener was added by a 3P call, send any token error to
1050
1049
  // the supplied error handler. A 3P observer always has an error
1051
1050
  // handler.
@@ -1114,14 +1113,14 @@ function internalFactory(appCheck) {
1114
1113
  return {
1115
1114
  getToken: function (forceRefresh) { return getToken$2(appCheck, forceRefresh); },
1116
1115
  addTokenListener: function (listener) {
1117
- return addTokenListener(appCheck, "INTERNAL" /* INTERNAL */, listener);
1116
+ return addTokenListener(appCheck, "INTERNAL" /* ListenerType.INTERNAL */, listener);
1118
1117
  },
1119
1118
  removeTokenListener: function (listener) { return removeTokenListener(appCheck.app, listener); }
1120
1119
  };
1121
1120
  }
1122
1121
 
1123
1122
  var name = "@firebase/app-check";
1124
- var version = "0.5.17";
1123
+ var version = "0.6.0";
1125
1124
 
1126
1125
  /**
1127
1126
  * @license
@@ -1199,7 +1198,7 @@ function queueWidgetRender(app, siteKey, grecaptcha, container, initialized) {
1199
1198
  * Add invisible div to page.
1200
1199
  */
1201
1200
  function makeDiv(app) {
1202
- var divId = "fire_app_check_" + app.name;
1201
+ var divId = "fire_app_check_".concat(app.name);
1203
1202
  var invisibleDiv = document.createElement('div');
1204
1203
  invisibleDiv.id = divId;
1205
1204
  invisibleDiv.style.display = 'none';
@@ -1308,7 +1307,7 @@ var ReCaptchaV3Provider = /** @class */ (function () {
1308
1307
  throwIfThrottled(this._throttleData);
1309
1308
  return [4 /*yield*/, getToken$1(this._app).catch(function (_e) {
1310
1309
  // reCaptcha.execute() throws null which is not very descriptive.
1311
- throw ERROR_FACTORY.create("recaptcha-error" /* RECAPTCHA_ERROR */);
1310
+ throw ERROR_FACTORY.create("recaptcha-error" /* AppCheckError.RECAPTCHA_ERROR */);
1312
1311
  })];
1313
1312
  case 1:
1314
1313
  attestedClaimsToken = _c.sent();
@@ -1321,9 +1320,9 @@ var ReCaptchaV3Provider = /** @class */ (function () {
1321
1320
  return [3 /*break*/, 5];
1322
1321
  case 4:
1323
1322
  e_1 = _c.sent();
1324
- if ((_a = e_1.code) === null || _a === void 0 ? void 0 : _a.includes("fetch-status-error" /* FETCH_STATUS_ERROR */)) {
1323
+ if ((_a = e_1.code) === null || _a === void 0 ? void 0 : _a.includes("fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */)) {
1325
1324
  this._throttleData = setBackoff(Number((_b = e_1.customData) === null || _b === void 0 ? void 0 : _b.httpStatus), this._throttleData);
1326
- throw ERROR_FACTORY.create("throttled" /* THROTTLED */, {
1325
+ throw ERROR_FACTORY.create("throttled" /* AppCheckError.THROTTLED */, {
1327
1326
  time: getDurationString(this._throttleData.allowRequestsAfter - Date.now()),
1328
1327
  httpStatus: this._throttleData.httpStatus
1329
1328
  });
@@ -1395,7 +1394,7 @@ var ReCaptchaEnterpriseProvider = /** @class */ (function () {
1395
1394
  throwIfThrottled(this._throttleData);
1396
1395
  return [4 /*yield*/, getToken$1(this._app).catch(function (_e) {
1397
1396
  // reCaptcha.execute() throws null which is not very descriptive.
1398
- throw ERROR_FACTORY.create("recaptcha-error" /* RECAPTCHA_ERROR */);
1397
+ throw ERROR_FACTORY.create("recaptcha-error" /* AppCheckError.RECAPTCHA_ERROR */);
1399
1398
  })];
1400
1399
  case 1:
1401
1400
  attestedClaimsToken = _c.sent();
@@ -1408,9 +1407,9 @@ var ReCaptchaEnterpriseProvider = /** @class */ (function () {
1408
1407
  return [3 /*break*/, 5];
1409
1408
  case 4:
1410
1409
  e_2 = _c.sent();
1411
- if ((_a = e_2.code) === null || _a === void 0 ? void 0 : _a.includes("fetch-status-error" /* FETCH_STATUS_ERROR */)) {
1410
+ if ((_a = e_2.code) === null || _a === void 0 ? void 0 : _a.includes("fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */)) {
1412
1411
  this._throttleData = setBackoff(Number((_b = e_2.customData) === null || _b === void 0 ? void 0 : _b.httpStatus), this._throttleData);
1413
- throw ERROR_FACTORY.create("throttled" /* THROTTLED */, {
1412
+ throw ERROR_FACTORY.create("throttled" /* AppCheckError.THROTTLED */, {
1414
1413
  time: getDurationString(this._throttleData.allowRequestsAfter - Date.now()),
1415
1414
  httpStatus: this._throttleData.httpStatus
1416
1415
  });
@@ -1543,7 +1542,7 @@ function throwIfThrottled(throttleData) {
1543
1542
  if (throttleData) {
1544
1543
  if (Date.now() - throttleData.allowRequestsAfter <= 0) {
1545
1544
  // If before, throw.
1546
- throw ERROR_FACTORY.create("throttled" /* THROTTLED */, {
1545
+ throw ERROR_FACTORY.create("throttled" /* AppCheckError.THROTTLED */, {
1547
1546
  time: getDurationString(throttleData.allowRequestsAfter - Date.now()),
1548
1547
  httpStatus: throttleData.httpStatus
1549
1548
  });
@@ -1587,7 +1586,7 @@ function initializeAppCheck(app, options) {
1587
1586
  // Do not block initialization to get the token for the message.
1588
1587
  void getDebugToken().then(function (token) {
1589
1588
  // Not using logger because I don't think we ever want this accidentally hidden.
1590
- return console.log("App Check debug token: " + token + ". You will need to add it to your app's App Check settings in the Firebase console for it to work.");
1589
+ return console.log("App Check debug token: ".concat(token, ". You will need to add it to your app's App Check settings in the Firebase console for it to work."));
1591
1590
  });
1592
1591
  }
1593
1592
  if (provider.isInitialized()) {
@@ -1599,7 +1598,7 @@ function initializeAppCheck(app, options) {
1599
1598
  return existingInstance;
1600
1599
  }
1601
1600
  else {
1602
- throw ERROR_FACTORY.create("already-initialized" /* ALREADY_INITIALIZED */, {
1601
+ throw ERROR_FACTORY.create("already-initialized" /* AppCheckError.ALREADY_INITIALIZED */, {
1603
1602
  appName: app.name
1604
1603
  });
1605
1604
  }
@@ -1615,7 +1614,7 @@ function initializeAppCheck(app, options) {
1615
1614
  // requests the token.
1616
1615
  // Listener function does not need to do anything, its base functionality
1617
1616
  // of calling getToken() already fetches token and writes it to memory/storage.
1618
- addTokenListener(appCheck, "INTERNAL" /* INTERNAL */, function () { });
1617
+ addTokenListener(appCheck, "INTERNAL" /* ListenerType.INTERNAL */, function () { });
1619
1618
  }
1620
1619
  return appCheck;
1621
1620
  }
@@ -1729,7 +1728,7 @@ onCompletion) {
1729
1728
  else if (onError) {
1730
1729
  errorFn = onError;
1731
1730
  }
1732
- addTokenListener(appCheckInstance, "EXTERNAL" /* EXTERNAL */, nextFn, errorFn);
1731
+ addTokenListener(appCheckInstance, "EXTERNAL" /* ListenerType.EXTERNAL */, nextFn, errorFn);
1733
1732
  return function () { return removeTokenListener(appCheckInstance.app, nextFn); };
1734
1733
  }
1735
1734
 
@@ -1747,8 +1746,8 @@ function registerAppCheck() {
1747
1746
  var app = container.getProvider('app').getImmediate();
1748
1747
  var heartbeatServiceProvider = container.getProvider('heartbeat');
1749
1748
  return factory(app, heartbeatServiceProvider);
1750
- }, "PUBLIC" /* PUBLIC */)
1751
- .setInstantiationMode("EXPLICIT" /* EXPLICIT */)
1749
+ }, "PUBLIC" /* ComponentType.PUBLIC */)
1750
+ .setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */)
1752
1751
  /**
1753
1752
  * Initialize app-check-internal after app-check is initialized to make AppCheck available to
1754
1753
  * other Firebase SDKs
@@ -1760,7 +1759,7 @@ function registerAppCheck() {
1760
1759
  _registerComponent(new Component(APP_CHECK_NAME_INTERNAL, function (container) {
1761
1760
  var appCheck = container.getProvider('app-check').getImmediate();
1762
1761
  return internalFactory(appCheck);
1763
- }, "PUBLIC" /* PUBLIC */).setInstantiationMode("EXPLICIT" /* EXPLICIT */));
1762
+ }, "PUBLIC" /* ComponentType.PUBLIC */).setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */));
1764
1763
  registerVersion(name, version);
1765
1764
  }
1766
1765
  registerAppCheck();