@firebase/auth 0.18.3 → 0.19.0-canary.477bdef13

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 (89) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/auth-public.d.ts +28 -19
  3. package/dist/auth.d.ts +29 -20
  4. package/dist/cordova/index.js +2 -2
  5. package/dist/cordova/index.rn.d.ts +3 -0
  6. package/dist/cordova/internal.js +7 -3
  7. package/dist/cordova/internal.js.map +1 -1
  8. package/dist/cordova/{popup_redirect-f608cd47.js → popup_redirect-d7b9a2c0.js} +54 -33
  9. package/dist/cordova/popup_redirect-d7b9a2c0.js.map +1 -0
  10. package/dist/cordova/src/core/errors.d.ts +2 -2
  11. package/dist/cordova/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  12. package/dist/cordova/src/mfa/mfa_error.d.ts +4 -5
  13. package/dist/cordova/src/model/public_types.d.ts +25 -19
  14. package/dist/cordova/src/platform_browser/persistence/browser.d.ts +4 -3
  15. package/dist/cordova/src/platform_browser/persistence/browser.test.d.ts +17 -0
  16. package/dist/cordova/src/platform_browser/strategies/phone.d.ts +3 -0
  17. package/dist/cordova/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  18. package/dist/esm2017/{index-f41a0691.js → index-030cefd0.js} +43 -25
  19. package/dist/esm2017/index-030cefd0.js.map +1 -0
  20. package/dist/esm2017/index.js +1 -1
  21. package/dist/esm2017/index.rn.d.ts +3 -0
  22. package/dist/esm2017/internal.js +2 -2
  23. package/dist/esm2017/src/core/errors.d.ts +2 -2
  24. package/dist/esm2017/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  25. package/dist/esm2017/src/mfa/mfa_error.d.ts +4 -5
  26. package/dist/esm2017/src/model/public_types.d.ts +25 -19
  27. package/dist/esm2017/src/platform_browser/persistence/browser.d.ts +4 -3
  28. package/dist/esm2017/src/platform_browser/persistence/browser.test.d.ts +17 -0
  29. package/dist/esm2017/src/platform_browser/strategies/phone.d.ts +3 -0
  30. package/dist/esm2017/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  31. package/dist/esm5/{index-fd8b7af5.js → index-5050030d.js} +59 -34
  32. package/dist/esm5/index-5050030d.js.map +1 -0
  33. package/dist/esm5/index.js +1 -1
  34. package/dist/esm5/index.rn.d.ts +3 -0
  35. package/dist/esm5/internal.js +2 -2
  36. package/dist/esm5/src/core/errors.d.ts +2 -2
  37. package/dist/esm5/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  38. package/dist/esm5/src/mfa/mfa_error.d.ts +4 -5
  39. package/dist/esm5/src/model/public_types.d.ts +25 -19
  40. package/dist/esm5/src/platform_browser/persistence/browser.d.ts +4 -3
  41. package/dist/esm5/src/platform_browser/persistence/browser.test.d.ts +17 -0
  42. package/dist/esm5/src/platform_browser/strategies/phone.d.ts +3 -0
  43. package/dist/esm5/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  44. package/dist/index.rn.d.ts +3 -0
  45. package/dist/index.webworker.esm5.js +25 -23
  46. package/dist/index.webworker.esm5.js.map +1 -1
  47. package/dist/node/{index-358613ec.js → index-99e8c13b.js} +26 -24
  48. package/dist/node/index-99e8c13b.js.map +1 -0
  49. package/dist/node/index.js +1 -1
  50. package/dist/node/index.rn.d.ts +3 -0
  51. package/dist/node/internal.js +29 -10
  52. package/dist/node/internal.js.map +1 -1
  53. package/dist/node/src/core/errors.d.ts +2 -2
  54. package/dist/node/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  55. package/dist/node/src/mfa/mfa_error.d.ts +4 -5
  56. package/dist/node/src/model/public_types.d.ts +25 -19
  57. package/dist/node/src/platform_browser/persistence/browser.d.ts +4 -3
  58. package/dist/node/src/platform_browser/persistence/browser.test.d.ts +17 -0
  59. package/dist/node/src/platform_browser/strategies/phone.d.ts +3 -0
  60. package/dist/node/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  61. package/dist/rn/index.js +70 -64
  62. package/dist/rn/index.js.map +1 -1
  63. package/dist/rn/index.rn.d.ts +3 -0
  64. package/dist/rn/internal.js +338 -1465
  65. package/dist/rn/internal.js.map +1 -1
  66. package/dist/rn/{enum_maps-81db3ff6.js → phone-c7fcf861.js} +1195 -34
  67. package/dist/rn/phone-c7fcf861.js.map +1 -0
  68. package/dist/rn/src/core/errors.d.ts +2 -2
  69. package/dist/rn/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  70. package/dist/rn/src/mfa/mfa_error.d.ts +4 -5
  71. package/dist/rn/src/model/public_types.d.ts +25 -19
  72. package/dist/rn/src/platform_browser/persistence/browser.d.ts +4 -3
  73. package/dist/rn/src/platform_browser/persistence/browser.test.d.ts +17 -0
  74. package/dist/rn/src/platform_browser/strategies/phone.d.ts +3 -0
  75. package/dist/rn/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  76. package/dist/src/core/errors.d.ts +2 -2
  77. package/dist/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  78. package/dist/src/mfa/mfa_error.d.ts +4 -5
  79. package/dist/src/model/public_types.d.ts +25 -19
  80. package/dist/src/platform_browser/persistence/browser.d.ts +4 -3
  81. package/dist/src/platform_browser/persistence/browser.test.d.ts +17 -0
  82. package/dist/src/platform_browser/strategies/phone.d.ts +3 -0
  83. package/dist/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  84. package/package.json +6 -6
  85. package/dist/cordova/popup_redirect-f608cd47.js.map +0 -1
  86. package/dist/esm2017/index-f41a0691.js.map +0 -1
  87. package/dist/esm5/index-fd8b7af5.js.map +0 -1
  88. package/dist/node/index-358613ec.js.map +0 -1
  89. package/dist/rn/enum_maps-81db3ff6.js.map +0 -1
@@ -946,7 +946,7 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
946
946
  serverResponse = (_a.sent());
947
947
  if ('mfaPendingCredential' in serverResponse) {
948
948
  _fail(auth, "multi-factor-auth-required" /* MFA_REQUIRED */, {
949
- serverResponse: serverResponse
949
+ _serverResponse: serverResponse
950
950
  });
951
951
  }
952
952
  return [2 /*return*/, serverResponse];
@@ -2409,9 +2409,9 @@ var AuthImpl = /** @class */ (function () {
2409
2409
  // promise resolution)
2410
2410
  this._initializationPromise = this.queue(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
2411
2411
  var _a;
2412
- var _b;
2413
- return tslib.__generator(this, function (_c) {
2414
- switch (_c.label) {
2412
+ var _b, _c;
2413
+ return tslib.__generator(this, function (_d) {
2414
+ switch (_d.label) {
2415
2415
  case 0:
2416
2416
  if (this._deleted) {
2417
2417
  return [2 /*return*/];
@@ -2419,18 +2419,19 @@ var AuthImpl = /** @class */ (function () {
2419
2419
  _a = this;
2420
2420
  return [4 /*yield*/, PersistenceUserManager.create(this, persistenceHierarchy)];
2421
2421
  case 1:
2422
- _a.persistenceManager = _c.sent();
2422
+ _a.persistenceManager = _d.sent();
2423
2423
  if (this._deleted) {
2424
2424
  return [2 /*return*/];
2425
2425
  }
2426
2426
  if (!((_b = this._popupRedirectResolver) === null || _b === void 0 ? void 0 : _b._shouldInitProactively)) return [3 /*break*/, 3];
2427
2427
  return [4 /*yield*/, this._popupRedirectResolver._initialize(this)];
2428
2428
  case 2:
2429
- _c.sent();
2430
- _c.label = 3;
2429
+ _d.sent();
2430
+ _d.label = 3;
2431
2431
  case 3: return [4 /*yield*/, this.initializeCurrentUser(popupRedirectResolver)];
2432
2432
  case 4:
2433
- _c.sent();
2433
+ _d.sent();
2434
+ this.lastNotifiedUid = ((_c = this.currentUser) === null || _c === void 0 ? void 0 : _c.uid) || null;
2434
2435
  if (this._deleted) {
2435
2436
  return [2 /*return*/];
2436
2437
  }
@@ -3555,14 +3556,14 @@ function sendPhoneVerificationCode(auth, request) {
3555
3556
  });
3556
3557
  });
3557
3558
  }
3558
- function signInWithPhoneNumber(auth, request) {
3559
+ function signInWithPhoneNumber$1(auth, request) {
3559
3560
  return tslib.__awaiter(this, void 0, void 0, function () {
3560
3561
  return tslib.__generator(this, function (_a) {
3561
3562
  return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
3562
3563
  });
3563
3564
  });
3564
3565
  }
3565
- function linkWithPhoneNumber(auth, request) {
3566
+ function linkWithPhoneNumber$1(auth, request) {
3566
3567
  return tslib.__awaiter(this, void 0, void 0, function () {
3567
3568
  var response;
3568
3569
  return tslib.__generator(this, function (_a) {
@@ -3629,11 +3630,11 @@ var PhoneAuthCredential = /** @class */ (function (_super) {
3629
3630
  };
3630
3631
  /** @internal */
3631
3632
  PhoneAuthCredential.prototype._getIdTokenResponse = function (auth) {
3632
- return signInWithPhoneNumber(auth, this._makeVerificationRequest());
3633
+ return signInWithPhoneNumber$1(auth, this._makeVerificationRequest());
3633
3634
  };
3634
3635
  /** @internal */
3635
3636
  PhoneAuthCredential.prototype._linkToIdToken = function (auth, idToken) {
3636
- return linkWithPhoneNumber(auth, tslib.__assign({ idToken: idToken }, this._makeVerificationRequest()));
3637
+ return linkWithPhoneNumber$1(auth, tslib.__assign({ idToken: idToken }, this._makeVerificationRequest()));
3637
3638
  };
3638
3639
  /** @internal */
3639
3640
  PhoneAuthCredential.prototype._getReauthenticationResolver = function (auth) {
@@ -4983,14 +4984,14 @@ var MultiFactorError = /** @class */ (function (_super) {
4983
4984
  var _this = _super.call(this, error.code, error.message) || this;
4984
4985
  _this.operationType = operationType;
4985
4986
  _this.user = user;
4986
- _this.name = 'FirebaseError';
4987
4987
  // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
4988
4988
  Object.setPrototypeOf(_this, MultiFactorError.prototype);
4989
- _this.appName = auth.name;
4990
- _this.code = error.code;
4991
- _this.tenantId = (_a = auth.tenantId) !== null && _a !== void 0 ? _a : undefined;
4992
- _this.serverResponse = error.customData
4993
- .serverResponse;
4989
+ _this.customData = {
4990
+ appName: auth.name,
4991
+ tenantId: (_a = auth.tenantId) !== null && _a !== void 0 ? _a : undefined,
4992
+ _serverResponse: error.customData._serverResponse,
4993
+ operationType: operationType,
4994
+ };
4994
4995
  return _this;
4995
4996
  }
4996
4997
  MultiFactorError._fromErrorAndOperation = function (auth, error, operationType, user) {
@@ -6528,11 +6529,12 @@ var MultiFactorResolverImpl = /** @class */ (function () {
6528
6529
  MultiFactorResolverImpl._fromError = function (authExtern, error) {
6529
6530
  var _this = this;
6530
6531
  var auth = _castAuth(authExtern);
6531
- var hints = (error.serverResponse.mfaInfo || []).map(function (enrollment) {
6532
+ var serverResponse = error.customData._serverResponse;
6533
+ var hints = (serverResponse.mfaInfo || []).map(function (enrollment) {
6532
6534
  return MultiFactorInfoImpl._fromServerResponse(auth, enrollment);
6533
6535
  });
6534
- _assert(error.serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
6535
- var session = MultiFactorSessionImpl._fromMfaPendingCredential(error.serverResponse.mfaPendingCredential);
6536
+ _assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
6537
+ var session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);
6536
6538
  return new MultiFactorResolverImpl(session, hints, function (assertion) { return tslib.__awaiter(_this, void 0, void 0, function () {
6537
6539
  var mfaResponse, idTokenResponse, _a, userCredential;
6538
6540
  return tslib.__generator(this, function (_b) {
@@ -6541,9 +6543,9 @@ var MultiFactorResolverImpl = /** @class */ (function () {
6541
6543
  case 1:
6542
6544
  mfaResponse = _b.sent();
6543
6545
  // Clear out the unneeded fields from the old login response
6544
- delete error.serverResponse.mfaInfo;
6545
- delete error.serverResponse.mfaPendingCredential;
6546
- idTokenResponse = tslib.__assign(tslib.__assign({}, error.serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
6546
+ delete serverResponse.mfaInfo;
6547
+ delete serverResponse.mfaPendingCredential;
6548
+ idTokenResponse = tslib.__assign(tslib.__assign({}, serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
6547
6549
  _a = error.operationType;
6548
6550
  switch (_a) {
6549
6551
  case "signIn" /* SIGN_IN */: return [3 /*break*/, 2];
@@ -6593,8 +6595,8 @@ function getMultiFactorResolver(auth, error) {
6593
6595
  var _a;
6594
6596
  var authModular = util.getModularInstance(auth);
6595
6597
  var errorInternal = error;
6596
- _assert(error.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
6597
- _assert((_a = errorInternal.serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
6598
+ _assert(error.customData.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
6599
+ _assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
6598
6600
  return MultiFactorResolverImpl._fromError(authModular, errorInternal);
6599
6601
  }
6600
6602
 
@@ -6753,7 +6755,7 @@ function multiFactor(user) {
6753
6755
  }
6754
6756
 
6755
6757
  var name = "@firebase/auth";
6756
- var version = "0.18.3";
6758
+ var version = "0.19.0-canary.477bdef13";
6757
6759
 
6758
6760
  /**
6759
6761
  * @license
@@ -7016,6 +7018,1156 @@ var ActionCodeOperation = {
7016
7018
  VERIFY_EMAIL: 'VERIFY_EMAIL'
7017
7019
  };
7018
7020
 
7021
+ /**
7022
+ * @license
7023
+ * Copyright 2020 Google LLC
7024
+ *
7025
+ * Licensed under the Apache License, Version 2.0 (the "License");
7026
+ * you may not use this file except in compliance with the License.
7027
+ * You may obtain a copy of the License at
7028
+ *
7029
+ * http://www.apache.org/licenses/LICENSE-2.0
7030
+ *
7031
+ * Unless required by applicable law or agreed to in writing, software
7032
+ * distributed under the License is distributed on an "AS IS" BASIS,
7033
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7034
+ * See the License for the specific language governing permissions and
7035
+ * limitations under the License.
7036
+ */
7037
+ function startSignInPhoneMfa(auth, request) {
7038
+ return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaSignIn:start" /* START_PHONE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
7039
+ }
7040
+ function finalizeSignInPhoneMfa(auth, request) {
7041
+ return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaSignIn:finalize" /* FINALIZE_PHONE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
7042
+ }
7043
+
7044
+ /**
7045
+ * @license
7046
+ * Copyright 2020 Google LLC
7047
+ *
7048
+ * Licensed under the Apache License, Version 2.0 (the "License");
7049
+ * you may not use this file except in compliance with the License.
7050
+ * You may obtain a copy of the License at
7051
+ *
7052
+ * http://www.apache.org/licenses/LICENSE-2.0
7053
+ *
7054
+ * Unless required by applicable law or agreed to in writing, software
7055
+ * distributed under the License is distributed on an "AS IS" BASIS,
7056
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7057
+ * See the License for the specific language governing permissions and
7058
+ * limitations under the License.
7059
+ */
7060
+ function getRecaptchaParams(auth) {
7061
+ return tslib.__awaiter(this, void 0, void 0, function () {
7062
+ return tslib.__generator(this, function (_a) {
7063
+ switch (_a.label) {
7064
+ case 0: return [4 /*yield*/, _performApiRequest(auth, "GET" /* GET */, "/v1/recaptchaParams" /* GET_RECAPTCHA_PARAM */)];
7065
+ case 1: return [2 /*return*/, ((_a.sent()).recaptchaSiteKey || '')];
7066
+ }
7067
+ });
7068
+ });
7069
+ }
7070
+
7071
+ /**
7072
+ * @license
7073
+ * Copyright 2020 Google LLC
7074
+ *
7075
+ * Licensed under the Apache License, Version 2.0 (the "License");
7076
+ * you may not use this file except in compliance with the License.
7077
+ * You may obtain a copy of the License at
7078
+ *
7079
+ * http://www.apache.org/licenses/LICENSE-2.0
7080
+ *
7081
+ * Unless required by applicable law or agreed to in writing, software
7082
+ * distributed under the License is distributed on an "AS IS" BASIS,
7083
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7084
+ * See the License for the specific language governing permissions and
7085
+ * limitations under the License.
7086
+ */
7087
+ /**
7088
+ * Lazy accessor for window, since the compat layer won't tree shake this out,
7089
+ * we need to make sure not to mess with window unless we have to
7090
+ */
7091
+ function _window() {
7092
+ return window;
7093
+ }
7094
+ function _setWindowLocation(url) {
7095
+ _window().location.href = url;
7096
+ }
7097
+
7098
+ /**
7099
+ * @license
7100
+ * Copyright 2020 Google LLC.
7101
+ *
7102
+ * Licensed under the Apache License, Version 2.0 (the "License");
7103
+ * you may not use this file except in compliance with the License.
7104
+ * You may obtain a copy of the License at
7105
+ *
7106
+ * http://www.apache.org/licenses/LICENSE-2.0
7107
+ *
7108
+ * Unless required by applicable law or agreed to in writing, software
7109
+ * distributed under the License is distributed on an "AS IS" BASIS,
7110
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7111
+ * See the License for the specific language governing permissions and
7112
+ * limitations under the License.
7113
+ */
7114
+ function _isWorker() {
7115
+ return (typeof _window()['WorkerGlobalScope'] !== 'undefined' &&
7116
+ typeof _window()['importScripts'] === 'function');
7117
+ }
7118
+ function _getActiveServiceWorker() {
7119
+ return tslib.__awaiter(this, void 0, void 0, function () {
7120
+ var registration;
7121
+ return tslib.__generator(this, function (_b) {
7122
+ switch (_b.label) {
7123
+ case 0:
7124
+ if (!(navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker)) {
7125
+ return [2 /*return*/, null];
7126
+ }
7127
+ _b.label = 1;
7128
+ case 1:
7129
+ _b.trys.push([1, 3, , 4]);
7130
+ return [4 /*yield*/, navigator.serviceWorker.ready];
7131
+ case 2:
7132
+ registration = _b.sent();
7133
+ return [2 /*return*/, registration.active];
7134
+ case 3:
7135
+ _b.sent();
7136
+ return [2 /*return*/, null];
7137
+ case 4: return [2 /*return*/];
7138
+ }
7139
+ });
7140
+ });
7141
+ }
7142
+ function _getServiceWorkerController() {
7143
+ var _a;
7144
+ return ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker) === null || _a === void 0 ? void 0 : _a.controller) || null;
7145
+ }
7146
+ function _getWorkerGlobalScope() {
7147
+ return _isWorker() ? self : null;
7148
+ }
7149
+
7150
+ /**
7151
+ * @license
7152
+ * Copyright 2020 Google LLC
7153
+ *
7154
+ * Licensed under the Apache License, Version 2.0 (the "License");
7155
+ * you may not use this file except in compliance with the License.
7156
+ * You may obtain a copy of the License at
7157
+ *
7158
+ * http://www.apache.org/licenses/LICENSE-2.0
7159
+ *
7160
+ * Unless required by applicable law or agreed to in writing, software
7161
+ * distributed under the License is distributed on an "AS IS" BASIS,
7162
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7163
+ * See the License for the specific language governing permissions and
7164
+ * limitations under the License.
7165
+ */
7166
+ function getScriptParentElement() {
7167
+ var _a, _b;
7168
+ return (_b = (_a = document.getElementsByTagName('head')) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : document;
7169
+ }
7170
+ function _loadJS(url) {
7171
+ // TODO: consider adding timeout support & cancellation
7172
+ return new Promise(function (resolve, reject) {
7173
+ var el = document.createElement('script');
7174
+ el.setAttribute('src', url);
7175
+ el.onload = resolve;
7176
+ el.onerror = function (e) {
7177
+ var error = _createError("internal-error" /* INTERNAL_ERROR */);
7178
+ error.customData = e;
7179
+ reject(error);
7180
+ };
7181
+ el.type = 'text/javascript';
7182
+ el.charset = 'UTF-8';
7183
+ getScriptParentElement().appendChild(el);
7184
+ });
7185
+ }
7186
+ function _generateCallbackName(prefix) {
7187
+ return "__" + prefix + Math.floor(Math.random() * 1000000);
7188
+ }
7189
+
7190
+ /**
7191
+ * @license
7192
+ * Copyright 2020 Google LLC
7193
+ *
7194
+ * Licensed under the Apache License, Version 2.0 (the "License");
7195
+ * you may not use this file except in compliance with the License.
7196
+ * You may obtain a copy of the License at
7197
+ *
7198
+ * http://www.apache.org/licenses/LICENSE-2.0
7199
+ *
7200
+ * Unless required by applicable law or agreed to in writing, software
7201
+ * distributed under the License is distributed on an "AS IS" BASIS,
7202
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7203
+ * See the License for the specific language governing permissions and
7204
+ * limitations under the License.
7205
+ */
7206
+ var _SOLVE_TIME_MS = 500;
7207
+ var _EXPIRATION_TIME_MS = 60000;
7208
+ var _WIDGET_ID_START = 1000000000000;
7209
+ var MockReCaptcha = /** @class */ (function () {
7210
+ function MockReCaptcha(auth) {
7211
+ this.auth = auth;
7212
+ this.counter = _WIDGET_ID_START;
7213
+ this._widgets = new Map();
7214
+ }
7215
+ MockReCaptcha.prototype.render = function (container, parameters) {
7216
+ var id = this.counter;
7217
+ this._widgets.set(id, new MockWidget(container, this.auth.name, parameters || {}));
7218
+ this.counter++;
7219
+ return id;
7220
+ };
7221
+ MockReCaptcha.prototype.reset = function (optWidgetId) {
7222
+ var _a;
7223
+ var id = optWidgetId || _WIDGET_ID_START;
7224
+ void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.delete());
7225
+ this._widgets.delete(id);
7226
+ };
7227
+ MockReCaptcha.prototype.getResponse = function (optWidgetId) {
7228
+ var _a;
7229
+ var id = optWidgetId || _WIDGET_ID_START;
7230
+ return ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.getResponse()) || '';
7231
+ };
7232
+ MockReCaptcha.prototype.execute = function (optWidgetId) {
7233
+ var _a;
7234
+ return tslib.__awaiter(this, void 0, void 0, function () {
7235
+ var id;
7236
+ return tslib.__generator(this, function (_b) {
7237
+ id = optWidgetId || _WIDGET_ID_START;
7238
+ void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.execute());
7239
+ return [2 /*return*/, ''];
7240
+ });
7241
+ });
7242
+ };
7243
+ return MockReCaptcha;
7244
+ }());
7245
+ var MockWidget = /** @class */ (function () {
7246
+ function MockWidget(containerOrId, appName, params) {
7247
+ var _this = this;
7248
+ this.params = params;
7249
+ this.timerId = null;
7250
+ this.deleted = false;
7251
+ this.responseToken = null;
7252
+ this.clickHandler = function () {
7253
+ _this.execute();
7254
+ };
7255
+ var container = typeof containerOrId === 'string'
7256
+ ? document.getElementById(containerOrId)
7257
+ : containerOrId;
7258
+ _assert(container, "argument-error" /* ARGUMENT_ERROR */, { appName: appName });
7259
+ this.container = container;
7260
+ this.isVisible = this.params.size !== 'invisible';
7261
+ if (this.isVisible) {
7262
+ this.execute();
7263
+ }
7264
+ else {
7265
+ this.container.addEventListener('click', this.clickHandler);
7266
+ }
7267
+ }
7268
+ MockWidget.prototype.getResponse = function () {
7269
+ this.checkIfDeleted();
7270
+ return this.responseToken;
7271
+ };
7272
+ MockWidget.prototype.delete = function () {
7273
+ this.checkIfDeleted();
7274
+ this.deleted = true;
7275
+ if (this.timerId) {
7276
+ clearTimeout(this.timerId);
7277
+ this.timerId = null;
7278
+ }
7279
+ this.container.removeEventListener('click', this.clickHandler);
7280
+ };
7281
+ MockWidget.prototype.execute = function () {
7282
+ var _this = this;
7283
+ this.checkIfDeleted();
7284
+ if (this.timerId) {
7285
+ return;
7286
+ }
7287
+ this.timerId = window.setTimeout(function () {
7288
+ _this.responseToken = generateRandomAlphaNumericString(50);
7289
+ var _a = _this.params, callback = _a.callback, expiredCallback = _a["expired-callback"];
7290
+ if (callback) {
7291
+ try {
7292
+ callback(_this.responseToken);
7293
+ }
7294
+ catch (e) { }
7295
+ }
7296
+ _this.timerId = window.setTimeout(function () {
7297
+ _this.timerId = null;
7298
+ _this.responseToken = null;
7299
+ if (expiredCallback) {
7300
+ try {
7301
+ expiredCallback();
7302
+ }
7303
+ catch (e) { }
7304
+ }
7305
+ if (_this.isVisible) {
7306
+ _this.execute();
7307
+ }
7308
+ }, _EXPIRATION_TIME_MS);
7309
+ }, _SOLVE_TIME_MS);
7310
+ };
7311
+ MockWidget.prototype.checkIfDeleted = function () {
7312
+ if (this.deleted) {
7313
+ throw new Error('reCAPTCHA mock was already deleted!');
7314
+ }
7315
+ };
7316
+ return MockWidget;
7317
+ }());
7318
+ function generateRandomAlphaNumericString(len) {
7319
+ var chars = [];
7320
+ var allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
7321
+ for (var i = 0; i < len; i++) {
7322
+ chars.push(allowedChars.charAt(Math.floor(Math.random() * allowedChars.length)));
7323
+ }
7324
+ return chars.join('');
7325
+ }
7326
+
7327
+ /**
7328
+ * @license
7329
+ * Copyright 2020 Google LLC
7330
+ *
7331
+ * Licensed under the Apache License, Version 2.0 (the "License");
7332
+ * you may not use this file except in compliance with the License.
7333
+ * You may obtain a copy of the License at
7334
+ *
7335
+ * http://www.apache.org/licenses/LICENSE-2.0
7336
+ *
7337
+ * Unless required by applicable law or agreed to in writing, software
7338
+ * distributed under the License is distributed on an "AS IS" BASIS,
7339
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7340
+ * See the License for the specific language governing permissions and
7341
+ * limitations under the License.
7342
+ */
7343
+ // ReCaptcha will load using the same callback, so the callback function needs
7344
+ // to be kept around
7345
+ var _JSLOAD_CALLBACK = _generateCallbackName('rcb');
7346
+ var NETWORK_TIMEOUT_DELAY = new Delay(30000, 60000);
7347
+ var RECAPTCHA_BASE = 'https://www.google.com/recaptcha/api.js?';
7348
+ /**
7349
+ * Loader for the GReCaptcha library. There should only ever be one of this.
7350
+ */
7351
+ var ReCaptchaLoaderImpl = /** @class */ (function () {
7352
+ function ReCaptchaLoaderImpl() {
7353
+ this.hostLanguage = '';
7354
+ this.counter = 0;
7355
+ this.librarySeparatelyLoaded = !!_window().grecaptcha;
7356
+ }
7357
+ ReCaptchaLoaderImpl.prototype.load = function (auth, hl) {
7358
+ var _this = this;
7359
+ if (hl === void 0) { hl = ''; }
7360
+ _assert(isHostLanguageValid(hl), auth, "argument-error" /* ARGUMENT_ERROR */);
7361
+ if (this.shouldResolveImmediately(hl)) {
7362
+ return Promise.resolve(_window().grecaptcha);
7363
+ }
7364
+ return new Promise(function (resolve, reject) {
7365
+ var networkTimeout = _window().setTimeout(function () {
7366
+ reject(_createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
7367
+ }, NETWORK_TIMEOUT_DELAY.get());
7368
+ _window()[_JSLOAD_CALLBACK] = function () {
7369
+ _window().clearTimeout(networkTimeout);
7370
+ delete _window()[_JSLOAD_CALLBACK];
7371
+ var recaptcha = _window().grecaptcha;
7372
+ if (!recaptcha) {
7373
+ reject(_createError(auth, "internal-error" /* INTERNAL_ERROR */));
7374
+ return;
7375
+ }
7376
+ // Wrap the greptcha render function so that we know if the developer has
7377
+ // called it separately
7378
+ var render = recaptcha.render;
7379
+ recaptcha.render = function (container, params) {
7380
+ var widgetId = render(container, params);
7381
+ _this.counter++;
7382
+ return widgetId;
7383
+ };
7384
+ _this.hostLanguage = hl;
7385
+ resolve(recaptcha);
7386
+ };
7387
+ var url = RECAPTCHA_BASE + "?" + util.querystring({
7388
+ onload: _JSLOAD_CALLBACK,
7389
+ render: 'explicit',
7390
+ hl: hl
7391
+ });
7392
+ _loadJS(url).catch(function () {
7393
+ clearTimeout(networkTimeout);
7394
+ reject(_createError(auth, "internal-error" /* INTERNAL_ERROR */));
7395
+ });
7396
+ });
7397
+ };
7398
+ ReCaptchaLoaderImpl.prototype.clearedOneInstance = function () {
7399
+ this.counter--;
7400
+ };
7401
+ ReCaptchaLoaderImpl.prototype.shouldResolveImmediately = function (hl) {
7402
+ // We can resolve immediately if:
7403
+ // • grecaptcha is already defined AND (
7404
+ // 1. the requested language codes are the same OR
7405
+ // 2. there exists already a ReCaptcha on the page
7406
+ // 3. the library was already loaded by the app
7407
+ // In cases (2) and (3), we _can't_ reload as it would break the recaptchas
7408
+ // that are already in the page
7409
+ return (!!_window().grecaptcha &&
7410
+ (hl === this.hostLanguage ||
7411
+ this.counter > 0 ||
7412
+ this.librarySeparatelyLoaded));
7413
+ };
7414
+ return ReCaptchaLoaderImpl;
7415
+ }());
7416
+ function isHostLanguageValid(hl) {
7417
+ return hl.length <= 6 && /^\s*[a-zA-Z0-9\-]*\s*$/.test(hl);
7418
+ }
7419
+ var MockReCaptchaLoaderImpl = /** @class */ (function () {
7420
+ function MockReCaptchaLoaderImpl() {
7421
+ }
7422
+ MockReCaptchaLoaderImpl.prototype.load = function (auth) {
7423
+ return tslib.__awaiter(this, void 0, void 0, function () {
7424
+ return tslib.__generator(this, function (_a) {
7425
+ return [2 /*return*/, new MockReCaptcha(auth)];
7426
+ });
7427
+ });
7428
+ };
7429
+ MockReCaptchaLoaderImpl.prototype.clearedOneInstance = function () { };
7430
+ return MockReCaptchaLoaderImpl;
7431
+ }());
7432
+
7433
+ /**
7434
+ * @license
7435
+ * Copyright 2020 Google LLC
7436
+ *
7437
+ * Licensed under the Apache License, Version 2.0 (the "License");
7438
+ * you may not use this file except in compliance with the License.
7439
+ * You may obtain a copy of the License at
7440
+ *
7441
+ * http://www.apache.org/licenses/LICENSE-2.0
7442
+ *
7443
+ * Unless required by applicable law or agreed to in writing, software
7444
+ * distributed under the License is distributed on an "AS IS" BASIS,
7445
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7446
+ * See the License for the specific language governing permissions and
7447
+ * limitations under the License.
7448
+ */
7449
+ var RECAPTCHA_VERIFIER_TYPE = 'recaptcha';
7450
+ var DEFAULT_PARAMS = {
7451
+ theme: 'light',
7452
+ type: 'image'
7453
+ };
7454
+ /**
7455
+ * An {@link https://www.google.com/recaptcha/ | reCAPTCHA}-based application verifier.
7456
+ *
7457
+ * @public
7458
+ */
7459
+ var RecaptchaVerifier = /** @class */ (function () {
7460
+ /**
7461
+ *
7462
+ * @param containerOrId - The reCAPTCHA container parameter.
7463
+ *
7464
+ * @remarks
7465
+ * This has different meaning depending on whether the reCAPTCHA is hidden or visible. For a
7466
+ * visible reCAPTCHA the container must be empty. If a string is used, it has to correspond to
7467
+ * an element ID. The corresponding element must also must be in the DOM at the time of
7468
+ * initialization.
7469
+ *
7470
+ * @param parameters - The optional reCAPTCHA parameters.
7471
+ *
7472
+ * @remarks
7473
+ * Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for
7474
+ * the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will
7475
+ * configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value
7476
+ * 'invisible'.
7477
+ *
7478
+ * @param authExtern - The corresponding Firebase {@link Auth} instance.
7479
+ *
7480
+ * @remarks
7481
+ * If none is provided, the default Firebase {@link Auth} instance is used. A Firebase {@link Auth} instance
7482
+ * must be initialized with an API key, otherwise an error will be thrown.
7483
+ */
7484
+ function RecaptchaVerifier(containerOrId, parameters, authExtern) {
7485
+ if (parameters === void 0) { parameters = tslib.__assign({}, DEFAULT_PARAMS); }
7486
+ this.parameters = parameters;
7487
+ /**
7488
+ * The application verifier type.
7489
+ *
7490
+ * @remarks
7491
+ * For a reCAPTCHA verifier, this is 'recaptcha'.
7492
+ */
7493
+ this.type = RECAPTCHA_VERIFIER_TYPE;
7494
+ this.destroyed = false;
7495
+ this.widgetId = null;
7496
+ this.tokenChangeListeners = new Set();
7497
+ this.renderPromise = null;
7498
+ this.recaptcha = null;
7499
+ this.auth = _castAuth(authExtern);
7500
+ this.isInvisible = this.parameters.size === 'invisible';
7501
+ _assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
7502
+ var container = typeof containerOrId === 'string'
7503
+ ? document.getElementById(containerOrId)
7504
+ : containerOrId;
7505
+ _assert(container, this.auth, "argument-error" /* ARGUMENT_ERROR */);
7506
+ this.container = container;
7507
+ this.parameters.callback = this.makeTokenCallback(this.parameters.callback);
7508
+ this._recaptchaLoader = this.auth.settings.appVerificationDisabledForTesting
7509
+ ? new MockReCaptchaLoaderImpl()
7510
+ : new ReCaptchaLoaderImpl();
7511
+ this.validateStartingState();
7512
+ // TODO: Figure out if sdk version is needed
7513
+ }
7514
+ /**
7515
+ * Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token.
7516
+ *
7517
+ * @returns A Promise for the reCAPTCHA token.
7518
+ */
7519
+ RecaptchaVerifier.prototype.verify = function () {
7520
+ return tslib.__awaiter(this, void 0, void 0, function () {
7521
+ var id, recaptcha, response;
7522
+ var _this = this;
7523
+ return tslib.__generator(this, function (_a) {
7524
+ switch (_a.label) {
7525
+ case 0:
7526
+ this.assertNotDestroyed();
7527
+ return [4 /*yield*/, this.render()];
7528
+ case 1:
7529
+ id = _a.sent();
7530
+ recaptcha = this.getAssertedRecaptcha();
7531
+ response = recaptcha.getResponse(id);
7532
+ if (response) {
7533
+ return [2 /*return*/, response];
7534
+ }
7535
+ return [2 /*return*/, new Promise(function (resolve) {
7536
+ var tokenChange = function (token) {
7537
+ if (!token) {
7538
+ return; // Ignore token expirations.
7539
+ }
7540
+ _this.tokenChangeListeners.delete(tokenChange);
7541
+ resolve(token);
7542
+ };
7543
+ _this.tokenChangeListeners.add(tokenChange);
7544
+ if (_this.isInvisible) {
7545
+ recaptcha.execute(id);
7546
+ }
7547
+ })];
7548
+ }
7549
+ });
7550
+ });
7551
+ };
7552
+ /**
7553
+ * Renders the reCAPTCHA widget on the page.
7554
+ *
7555
+ * @returns A Promise that resolves with the reCAPTCHA widget ID.
7556
+ */
7557
+ RecaptchaVerifier.prototype.render = function () {
7558
+ var _this = this;
7559
+ try {
7560
+ this.assertNotDestroyed();
7561
+ }
7562
+ catch (e) {
7563
+ // This method returns a promise. Since it's not async (we want to return the
7564
+ // _same_ promise if rendering is still occurring), the API surface should
7565
+ // reject with the error rather than just throw
7566
+ return Promise.reject(e);
7567
+ }
7568
+ if (this.renderPromise) {
7569
+ return this.renderPromise;
7570
+ }
7571
+ this.renderPromise = this.makeRenderPromise().catch(function (e) {
7572
+ _this.renderPromise = null;
7573
+ throw e;
7574
+ });
7575
+ return this.renderPromise;
7576
+ };
7577
+ /** @internal */
7578
+ RecaptchaVerifier.prototype._reset = function () {
7579
+ this.assertNotDestroyed();
7580
+ if (this.widgetId !== null) {
7581
+ this.getAssertedRecaptcha().reset(this.widgetId);
7582
+ }
7583
+ };
7584
+ /**
7585
+ * Clears the reCAPTCHA widget from the page and destroys the instance.
7586
+ */
7587
+ RecaptchaVerifier.prototype.clear = function () {
7588
+ var _this = this;
7589
+ this.assertNotDestroyed();
7590
+ this.destroyed = true;
7591
+ this._recaptchaLoader.clearedOneInstance();
7592
+ if (!this.isInvisible) {
7593
+ this.container.childNodes.forEach(function (node) {
7594
+ _this.container.removeChild(node);
7595
+ });
7596
+ }
7597
+ };
7598
+ RecaptchaVerifier.prototype.validateStartingState = function () {
7599
+ _assert(!this.parameters.sitekey, this.auth, "argument-error" /* ARGUMENT_ERROR */);
7600
+ _assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, "argument-error" /* ARGUMENT_ERROR */);
7601
+ _assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
7602
+ };
7603
+ RecaptchaVerifier.prototype.makeTokenCallback = function (existing) {
7604
+ var _this = this;
7605
+ return function (token) {
7606
+ _this.tokenChangeListeners.forEach(function (listener) { return listener(token); });
7607
+ if (typeof existing === 'function') {
7608
+ existing(token);
7609
+ }
7610
+ else if (typeof existing === 'string') {
7611
+ var globalFunc = _window()[existing];
7612
+ if (typeof globalFunc === 'function') {
7613
+ globalFunc(token);
7614
+ }
7615
+ }
7616
+ };
7617
+ };
7618
+ RecaptchaVerifier.prototype.assertNotDestroyed = function () {
7619
+ _assert(!this.destroyed, this.auth, "internal-error" /* INTERNAL_ERROR */);
7620
+ };
7621
+ RecaptchaVerifier.prototype.makeRenderPromise = function () {
7622
+ return tslib.__awaiter(this, void 0, void 0, function () {
7623
+ var container, guaranteedEmpty;
7624
+ return tslib.__generator(this, function (_a) {
7625
+ switch (_a.label) {
7626
+ case 0: return [4 /*yield*/, this.init()];
7627
+ case 1:
7628
+ _a.sent();
7629
+ if (!this.widgetId) {
7630
+ container = this.container;
7631
+ if (!this.isInvisible) {
7632
+ guaranteedEmpty = document.createElement('div');
7633
+ container.appendChild(guaranteedEmpty);
7634
+ container = guaranteedEmpty;
7635
+ }
7636
+ this.widgetId = this.getAssertedRecaptcha().render(container, this.parameters);
7637
+ }
7638
+ return [2 /*return*/, this.widgetId];
7639
+ }
7640
+ });
7641
+ });
7642
+ };
7643
+ RecaptchaVerifier.prototype.init = function () {
7644
+ return tslib.__awaiter(this, void 0, void 0, function () {
7645
+ var _a, siteKey;
7646
+ return tslib.__generator(this, function (_b) {
7647
+ switch (_b.label) {
7648
+ case 0:
7649
+ _assert(_isHttpOrHttps() && !_isWorker(), this.auth, "internal-error" /* INTERNAL_ERROR */);
7650
+ return [4 /*yield*/, domReady()];
7651
+ case 1:
7652
+ _b.sent();
7653
+ _a = this;
7654
+ return [4 /*yield*/, this._recaptchaLoader.load(this.auth, this.auth.languageCode || undefined)];
7655
+ case 2:
7656
+ _a.recaptcha = _b.sent();
7657
+ return [4 /*yield*/, getRecaptchaParams(this.auth)];
7658
+ case 3:
7659
+ siteKey = _b.sent();
7660
+ _assert(siteKey, this.auth, "internal-error" /* INTERNAL_ERROR */);
7661
+ this.parameters.sitekey = siteKey;
7662
+ return [2 /*return*/];
7663
+ }
7664
+ });
7665
+ });
7666
+ };
7667
+ RecaptchaVerifier.prototype.getAssertedRecaptcha = function () {
7668
+ _assert(this.recaptcha, this.auth, "internal-error" /* INTERNAL_ERROR */);
7669
+ return this.recaptcha;
7670
+ };
7671
+ return RecaptchaVerifier;
7672
+ }());
7673
+ function domReady() {
7674
+ var resolver = null;
7675
+ return new Promise(function (resolve) {
7676
+ if (document.readyState === 'complete') {
7677
+ resolve();
7678
+ return;
7679
+ }
7680
+ // Document not ready, wait for load before resolving.
7681
+ // Save resolver, so we can remove listener in case it was externally
7682
+ // cancelled.
7683
+ resolver = function () { return resolve(); };
7684
+ window.addEventListener('load', resolver);
7685
+ }).catch(function (e) {
7686
+ if (resolver) {
7687
+ window.removeEventListener('load', resolver);
7688
+ }
7689
+ throw e;
7690
+ });
7691
+ }
7692
+
7693
+ /**
7694
+ * @license
7695
+ * Copyright 2020 Google LLC
7696
+ *
7697
+ * Licensed under the Apache License, Version 2.0 (the "License");
7698
+ * you may not use this file except in compliance with the License.
7699
+ * You may obtain a copy of the License at
7700
+ *
7701
+ * http://www.apache.org/licenses/LICENSE-2.0
7702
+ *
7703
+ * Unless required by applicable law or agreed to in writing, software
7704
+ * distributed under the License is distributed on an "AS IS" BASIS,
7705
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7706
+ * See the License for the specific language governing permissions and
7707
+ * limitations under the License.
7708
+ */
7709
+ var ConfirmationResultImpl = /** @class */ (function () {
7710
+ function ConfirmationResultImpl(verificationId, onConfirmation) {
7711
+ this.verificationId = verificationId;
7712
+ this.onConfirmation = onConfirmation;
7713
+ }
7714
+ ConfirmationResultImpl.prototype.confirm = function (verificationCode) {
7715
+ var authCredential = PhoneAuthCredential._fromVerification(this.verificationId, verificationCode);
7716
+ return this.onConfirmation(authCredential);
7717
+ };
7718
+ return ConfirmationResultImpl;
7719
+ }());
7720
+ /**
7721
+ * Asynchronously signs in using a phone number.
7722
+ *
7723
+ * @remarks
7724
+ * This method sends a code via SMS to the given
7725
+ * phone number, and returns a {@link ConfirmationResult}. After the user
7726
+ * provides the code sent to their phone, call {@link ConfirmationResult.confirm}
7727
+ * with the code to sign the user in.
7728
+ *
7729
+ * For abuse prevention, this method also requires a {@link ApplicationVerifier}.
7730
+ * This SDK includes a reCAPTCHA-based implementation, {@link RecaptchaVerifier}.
7731
+ * This function can work on other platforms that do not support the
7732
+ * {@link RecaptchaVerifier} (like React Native), but you need to use a
7733
+ * third-party {@link ApplicationVerifier} implementation.
7734
+ *
7735
+ * @example
7736
+ * ```javascript
7737
+ * // 'recaptcha-container' is the ID of an element in the DOM.
7738
+ * const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');
7739
+ * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
7740
+ * // Obtain a verificationCode from the user.
7741
+ * const credential = await confirmationResult.confirm(verificationCode);
7742
+ * ```
7743
+ *
7744
+ * @param auth - The {@link Auth} instance.
7745
+ * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
7746
+ * @param appVerifier - The {@link ApplicationVerifier}.
7747
+ *
7748
+ * @public
7749
+ */
7750
+ function signInWithPhoneNumber(auth, phoneNumber, appVerifier) {
7751
+ return tslib.__awaiter(this, void 0, void 0, function () {
7752
+ var authInternal, verificationId;
7753
+ return tslib.__generator(this, function (_a) {
7754
+ switch (_a.label) {
7755
+ case 0:
7756
+ authInternal = _castAuth(auth);
7757
+ return [4 /*yield*/, _verifyPhoneNumber(authInternal, phoneNumber, util.getModularInstance(appVerifier))];
7758
+ case 1:
7759
+ verificationId = _a.sent();
7760
+ return [2 /*return*/, new ConfirmationResultImpl(verificationId, function (cred) {
7761
+ return signInWithCredential(authInternal, cred);
7762
+ })];
7763
+ }
7764
+ });
7765
+ });
7766
+ }
7767
+ /**
7768
+ * Links the user account with the given phone number.
7769
+ *
7770
+ * @param user - The user.
7771
+ * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
7772
+ * @param appVerifier - The {@link ApplicationVerifier}.
7773
+ *
7774
+ * @public
7775
+ */
7776
+ function linkWithPhoneNumber(user, phoneNumber, appVerifier) {
7777
+ return tslib.__awaiter(this, void 0, void 0, function () {
7778
+ var userInternal, verificationId;
7779
+ return tslib.__generator(this, function (_a) {
7780
+ switch (_a.label) {
7781
+ case 0:
7782
+ userInternal = util.getModularInstance(user);
7783
+ return [4 /*yield*/, _assertLinkedStatus(false, userInternal, "phone" /* PHONE */)];
7784
+ case 1:
7785
+ _a.sent();
7786
+ return [4 /*yield*/, _verifyPhoneNumber(userInternal.auth, phoneNumber, util.getModularInstance(appVerifier))];
7787
+ case 2:
7788
+ verificationId = _a.sent();
7789
+ return [2 /*return*/, new ConfirmationResultImpl(verificationId, function (cred) {
7790
+ return linkWithCredential(userInternal, cred);
7791
+ })];
7792
+ }
7793
+ });
7794
+ });
7795
+ }
7796
+ /**
7797
+ * Re-authenticates a user using a fresh phone credential.
7798
+ *
7799
+ * @remarks Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.
7800
+ *
7801
+ * @param user - The user.
7802
+ * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
7803
+ * @param appVerifier - The {@link ApplicationVerifier}.
7804
+ *
7805
+ * @public
7806
+ */
7807
+ function reauthenticateWithPhoneNumber(user, phoneNumber, appVerifier) {
7808
+ return tslib.__awaiter(this, void 0, void 0, function () {
7809
+ var userInternal, verificationId;
7810
+ return tslib.__generator(this, function (_a) {
7811
+ switch (_a.label) {
7812
+ case 0:
7813
+ userInternal = util.getModularInstance(user);
7814
+ return [4 /*yield*/, _verifyPhoneNumber(userInternal.auth, phoneNumber, util.getModularInstance(appVerifier))];
7815
+ case 1:
7816
+ verificationId = _a.sent();
7817
+ return [2 /*return*/, new ConfirmationResultImpl(verificationId, function (cred) {
7818
+ return reauthenticateWithCredential(userInternal, cred);
7819
+ })];
7820
+ }
7821
+ });
7822
+ });
7823
+ }
7824
+ /**
7825
+ * Returns a verification ID to be used in conjunction with the SMS code that is sent.
7826
+ *
7827
+ */
7828
+ function _verifyPhoneNumber(auth, options, verifier) {
7829
+ var _a;
7830
+ return tslib.__awaiter(this, void 0, void 0, function () {
7831
+ var recaptchaToken, phoneInfoOptions, session, response, mfaEnrollmentId, response, sessionInfo;
7832
+ return tslib.__generator(this, function (_b) {
7833
+ switch (_b.label) {
7834
+ case 0: return [4 /*yield*/, verifier.verify()];
7835
+ case 1:
7836
+ recaptchaToken = _b.sent();
7837
+ _b.label = 2;
7838
+ case 2:
7839
+ _b.trys.push([2, , 10, 11]);
7840
+ _assert(typeof recaptchaToken === 'string', auth, "argument-error" /* ARGUMENT_ERROR */);
7841
+ _assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* ARGUMENT_ERROR */);
7842
+ phoneInfoOptions = void 0;
7843
+ if (typeof options === 'string') {
7844
+ phoneInfoOptions = {
7845
+ phoneNumber: options
7846
+ };
7847
+ }
7848
+ else {
7849
+ phoneInfoOptions = options;
7850
+ }
7851
+ if (!('session' in phoneInfoOptions)) return [3 /*break*/, 7];
7852
+ session = phoneInfoOptions.session;
7853
+ if (!('phoneNumber' in phoneInfoOptions)) return [3 /*break*/, 4];
7854
+ _assert(session.type === "enroll" /* ENROLL */, auth, "internal-error" /* INTERNAL_ERROR */);
7855
+ return [4 /*yield*/, startEnrollPhoneMfa(auth, {
7856
+ idToken: session.credential,
7857
+ phoneEnrollmentInfo: {
7858
+ phoneNumber: phoneInfoOptions.phoneNumber,
7859
+ recaptchaToken: recaptchaToken
7860
+ }
7861
+ })];
7862
+ case 3:
7863
+ response = _b.sent();
7864
+ return [2 /*return*/, response.phoneSessionInfo.sessionInfo];
7865
+ case 4:
7866
+ _assert(session.type === "signin" /* SIGN_IN */, auth, "internal-error" /* INTERNAL_ERROR */);
7867
+ mfaEnrollmentId = ((_a = phoneInfoOptions.multiFactorHint) === null || _a === void 0 ? void 0 : _a.uid) ||
7868
+ phoneInfoOptions.multiFactorUid;
7869
+ _assert(mfaEnrollmentId, auth, "missing-multi-factor-info" /* MISSING_MFA_INFO */);
7870
+ return [4 /*yield*/, startSignInPhoneMfa(auth, {
7871
+ mfaPendingCredential: session.credential,
7872
+ mfaEnrollmentId: mfaEnrollmentId,
7873
+ phoneSignInInfo: {
7874
+ recaptchaToken: recaptchaToken
7875
+ }
7876
+ })];
7877
+ case 5:
7878
+ response = _b.sent();
7879
+ return [2 /*return*/, response.phoneResponseInfo.sessionInfo];
7880
+ case 6: return [3 /*break*/, 9];
7881
+ case 7: return [4 /*yield*/, sendPhoneVerificationCode(auth, {
7882
+ phoneNumber: phoneInfoOptions.phoneNumber,
7883
+ recaptchaToken: recaptchaToken
7884
+ })];
7885
+ case 8:
7886
+ sessionInfo = (_b.sent()).sessionInfo;
7887
+ return [2 /*return*/, sessionInfo];
7888
+ case 9: return [3 /*break*/, 11];
7889
+ case 10:
7890
+ verifier._reset();
7891
+ return [7 /*endfinally*/];
7892
+ case 11: return [2 /*return*/];
7893
+ }
7894
+ });
7895
+ });
7896
+ }
7897
+ /**
7898
+ * Updates the user's phone number.
7899
+ *
7900
+ * @example
7901
+ * ```
7902
+ * // 'recaptcha-container' is the ID of an element in the DOM.
7903
+ * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');
7904
+ * const provider = new PhoneAuthProvider(auth);
7905
+ * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);
7906
+ * // Obtain the verificationCode from the user.
7907
+ * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
7908
+ * await updatePhoneNumber(user, phoneCredential);
7909
+ * ```
7910
+ *
7911
+ * @param user - The user.
7912
+ * @param credential - A credential authenticating the new phone number.
7913
+ *
7914
+ * @public
7915
+ */
7916
+ function updatePhoneNumber(user, credential) {
7917
+ return tslib.__awaiter(this, void 0, void 0, function () {
7918
+ return tslib.__generator(this, function (_a) {
7919
+ switch (_a.label) {
7920
+ case 0: return [4 /*yield*/, _link(util.getModularInstance(user), credential)];
7921
+ case 1:
7922
+ _a.sent();
7923
+ return [2 /*return*/];
7924
+ }
7925
+ });
7926
+ });
7927
+ }
7928
+
7929
+ /**
7930
+ * @license
7931
+ * Copyright 2020 Google LLC
7932
+ *
7933
+ * Licensed under the Apache License, Version 2.0 (the "License");
7934
+ * you may not use this file except in compliance with the License.
7935
+ * You may obtain a copy of the License at
7936
+ *
7937
+ * http://www.apache.org/licenses/LICENSE-2.0
7938
+ *
7939
+ * Unless required by applicable law or agreed to in writing, software
7940
+ * distributed under the License is distributed on an "AS IS" BASIS,
7941
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7942
+ * See the License for the specific language governing permissions and
7943
+ * limitations under the License.
7944
+ */
7945
+ /**
7946
+ * Provider for generating an {@link PhoneAuthCredential}.
7947
+ *
7948
+ * @example
7949
+ * ```javascript
7950
+ * // 'recaptcha-container' is the ID of an element in the DOM.
7951
+ * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');
7952
+ * const provider = new PhoneAuthProvider(auth);
7953
+ * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);
7954
+ * // Obtain the verificationCode from the user.
7955
+ * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
7956
+ * const userCredential = await signInWithCredential(auth, phoneCredential);
7957
+ * ```
7958
+ *
7959
+ * @public
7960
+ */
7961
+ var PhoneAuthProvider = /** @class */ (function () {
7962
+ /**
7963
+ * @param auth - The Firebase {@link Auth} instance in which sign-ins should occur.
7964
+ *
7965
+ */
7966
+ function PhoneAuthProvider(auth) {
7967
+ /** Always set to {@link ProviderId}.PHONE. */
7968
+ this.providerId = PhoneAuthProvider.PROVIDER_ID;
7969
+ this.auth = _castAuth(auth);
7970
+ }
7971
+ /**
7972
+ *
7973
+ * Starts a phone number authentication flow by sending a verification code to the given phone
7974
+ * number.
7975
+ *
7976
+ * @example
7977
+ * ```javascript
7978
+ * const provider = new PhoneAuthProvider(auth);
7979
+ * const verificationId = await provider.verifyPhoneNumber(phoneNumber, applicationVerifier);
7980
+ * // Obtain verificationCode from the user.
7981
+ * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
7982
+ * const userCredential = await signInWithCredential(auth, authCredential);
7983
+ * ```
7984
+ *
7985
+ * @example
7986
+ * An alternative flow is provided using the `signInWithPhoneNumber` method.
7987
+ * ```javascript
7988
+ * const confirmationResult = signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
7989
+ * // Obtain verificationCode from the user.
7990
+ * const userCredential = confirmationResult.confirm(verificationCode);
7991
+ * ```
7992
+ *
7993
+ * @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in
7994
+ * E.164 format (e.g. +16505550101).
7995
+ * @param applicationVerifier - For abuse prevention, this method also requires a
7996
+ * {@link ApplicationVerifier}. This SDK includes a reCAPTCHA-based implementation,
7997
+ * {@link RecaptchaVerifier}.
7998
+ *
7999
+ * @returns A Promise for a verification ID that can be passed to
8000
+ * {@link PhoneAuthProvider.credential} to identify this flow..
8001
+ */
8002
+ PhoneAuthProvider.prototype.verifyPhoneNumber = function (phoneOptions, applicationVerifier) {
8003
+ return _verifyPhoneNumber(this.auth, phoneOptions, util.getModularInstance(applicationVerifier));
8004
+ };
8005
+ /**
8006
+ * Creates a phone auth credential, given the verification ID from
8007
+ * {@link PhoneAuthProvider.verifyPhoneNumber} and the code that was sent to the user's
8008
+ * mobile device.
8009
+ *
8010
+ * @example
8011
+ * ```javascript
8012
+ * const provider = new PhoneAuthProvider(auth);
8013
+ * const verificationId = provider.verifyPhoneNumber(phoneNumber, applicationVerifier);
8014
+ * // Obtain verificationCode from the user.
8015
+ * const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
8016
+ * const userCredential = signInWithCredential(auth, authCredential);
8017
+ * ```
8018
+ *
8019
+ * @example
8020
+ * An alternative flow is provided using the `signInWithPhoneNumber` method.
8021
+ * ```javascript
8022
+ * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
8023
+ * // Obtain verificationCode from the user.
8024
+ * const userCredential = await confirmationResult.confirm(verificationCode);
8025
+ * ```
8026
+ *
8027
+ * @param verificationId - The verification ID returned from {@link PhoneAuthProvider.verifyPhoneNumber}.
8028
+ * @param verificationCode - The verification code sent to the user's mobile device.
8029
+ *
8030
+ * @returns The auth provider credential.
8031
+ */
8032
+ PhoneAuthProvider.credential = function (verificationId, verificationCode) {
8033
+ return PhoneAuthCredential._fromVerification(verificationId, verificationCode);
8034
+ };
8035
+ /**
8036
+ * Generates an {@link AuthCredential} from a {@link UserCredential}.
8037
+ * @param userCredential - The user credential.
8038
+ */
8039
+ PhoneAuthProvider.credentialFromResult = function (userCredential) {
8040
+ var credential = userCredential;
8041
+ return PhoneAuthProvider.credentialFromTaggedObject(credential);
8042
+ };
8043
+ /**
8044
+ * Returns an {@link AuthCredential} when passed an error.
8045
+ *
8046
+ * @remarks
8047
+ *
8048
+ * This method works for errors like
8049
+ * `auth/account-exists-with-different-credentials`. This is useful for
8050
+ * recovering when attempting to set a user's phone number but the number
8051
+ * in question is already tied to another account. For example, the following
8052
+ * code tries to update the current user's phone number, and if that
8053
+ * fails, links the user with the account associated with that number:
8054
+ *
8055
+ * ```js
8056
+ * const provider = new PhoneAuthProvider(auth);
8057
+ * const verificationId = await provider.verifyPhoneNumber(number, verifier);
8058
+ * try {
8059
+ * const code = ''; // Prompt the user for the verification code
8060
+ * await updatePhoneNumber(
8061
+ * auth.currentUser,
8062
+ * PhoneAuthProvider.credential(verificationId, code));
8063
+ * } catch (e) {
8064
+ * if (e.code === 'auth/account-exists-with-different-credential') {
8065
+ * const cred = PhoneAuthProvider.credentialFromError(e);
8066
+ * await linkWithCredential(auth.currentUser, cred);
8067
+ * }
8068
+ * }
8069
+ *
8070
+ * // At this point, auth.currentUser.phoneNumber === number.
8071
+ * ```
8072
+ *
8073
+ * @param error - The error to generate a credential from.
8074
+ */
8075
+ PhoneAuthProvider.credentialFromError = function (error) {
8076
+ return PhoneAuthProvider.credentialFromTaggedObject((error.customData || {}));
8077
+ };
8078
+ PhoneAuthProvider.credentialFromTaggedObject = function (_a) {
8079
+ var tokenResponse = _a._tokenResponse;
8080
+ if (!tokenResponse) {
8081
+ return null;
8082
+ }
8083
+ var _b = tokenResponse, phoneNumber = _b.phoneNumber, temporaryProof = _b.temporaryProof;
8084
+ if (phoneNumber && temporaryProof) {
8085
+ return PhoneAuthCredential._fromTokenResponse(phoneNumber, temporaryProof);
8086
+ }
8087
+ return null;
8088
+ };
8089
+ /** Always set to {@link ProviderId}.PHONE. */
8090
+ PhoneAuthProvider.PROVIDER_ID = "phone" /* PHONE */;
8091
+ /** Always set to {@link SignInMethod}.PHONE. */
8092
+ PhoneAuthProvider.PHONE_SIGN_IN_METHOD = "phone" /* PHONE */;
8093
+ return PhoneAuthProvider;
8094
+ }());
8095
+
8096
+ var MultiFactorAssertionImpl = /** @class */ (function () {
8097
+ function MultiFactorAssertionImpl(factorId) {
8098
+ this.factorId = factorId;
8099
+ }
8100
+ MultiFactorAssertionImpl.prototype._process = function (auth, session, displayName) {
8101
+ switch (session.type) {
8102
+ case "enroll" /* ENROLL */:
8103
+ return this._finalizeEnroll(auth, session.credential, displayName);
8104
+ case "signin" /* SIGN_IN */:
8105
+ return this._finalizeSignIn(auth, session.credential);
8106
+ default:
8107
+ return debugFail('unexpected MultiFactorSessionType');
8108
+ }
8109
+ };
8110
+ return MultiFactorAssertionImpl;
8111
+ }());
8112
+
8113
+ /**
8114
+ * {@inheritdoc PhoneMultiFactorAssertion}
8115
+ *
8116
+ * @public
8117
+ */
8118
+ var PhoneMultiFactorAssertionImpl = /** @class */ (function (_super) {
8119
+ tslib.__extends(PhoneMultiFactorAssertionImpl, _super);
8120
+ function PhoneMultiFactorAssertionImpl(credential) {
8121
+ var _this = _super.call(this, "phone" /* PHONE */) || this;
8122
+ _this.credential = credential;
8123
+ return _this;
8124
+ }
8125
+ /** @internal */
8126
+ PhoneMultiFactorAssertionImpl._fromCredential = function (credential) {
8127
+ return new PhoneMultiFactorAssertionImpl(credential);
8128
+ };
8129
+ /** @internal */
8130
+ PhoneMultiFactorAssertionImpl.prototype._finalizeEnroll = function (auth, idToken, displayName) {
8131
+ return finalizeEnrollPhoneMfa(auth, {
8132
+ idToken: idToken,
8133
+ displayName: displayName,
8134
+ phoneVerificationInfo: this.credential._makeVerificationRequest()
8135
+ });
8136
+ };
8137
+ /** @internal */
8138
+ PhoneMultiFactorAssertionImpl.prototype._finalizeSignIn = function (auth, mfaPendingCredential) {
8139
+ return finalizeSignInPhoneMfa(auth, {
8140
+ mfaPendingCredential: mfaPendingCredential,
8141
+ phoneVerificationInfo: this.credential._makeVerificationRequest()
8142
+ });
8143
+ };
8144
+ return PhoneMultiFactorAssertionImpl;
8145
+ }(MultiFactorAssertionImpl));
8146
+ /**
8147
+ * Provider for generating a {@link PhoneMultiFactorAssertion}.
8148
+ *
8149
+ * @public
8150
+ */
8151
+ var PhoneMultiFactorGenerator = /** @class */ (function () {
8152
+ function PhoneMultiFactorGenerator() {
8153
+ }
8154
+ /**
8155
+ * Provides a {@link PhoneMultiFactorAssertion} to confirm ownership of the phone second factor.
8156
+ *
8157
+ * @param phoneAuthCredential - A credential provided by {@link PhoneAuthProvider.credential}.
8158
+ * @returns A {@link PhoneMultiFactorAssertion} which can be used with
8159
+ * {@link MultiFactorResolver.resolveSignIn}
8160
+ */
8161
+ PhoneMultiFactorGenerator.assertion = function (credential) {
8162
+ return PhoneMultiFactorAssertionImpl._fromCredential(credential);
8163
+ };
8164
+ /**
8165
+ * The identifier of the phone second factor: `phone`.
8166
+ */
8167
+ PhoneMultiFactorGenerator.FACTOR_ID = 'phone';
8168
+ return PhoneMultiFactorGenerator;
8169
+ }());
8170
+
7019
8171
  exports.AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY;
7020
8172
  exports.ActionCodeOperation = ActionCodeOperation;
7021
8173
  exports.ActionCodeURL = ActionCodeURL;
@@ -7035,14 +8187,16 @@ exports.OAuthCredential = OAuthCredential;
7035
8187
  exports.OAuthProvider = OAuthProvider;
7036
8188
  exports.OperationType = OperationType;
7037
8189
  exports.PhoneAuthCredential = PhoneAuthCredential;
8190
+ exports.PhoneAuthProvider = PhoneAuthProvider;
8191
+ exports.PhoneMultiFactorGenerator = PhoneMultiFactorGenerator;
7038
8192
  exports.ProviderId = ProviderId;
8193
+ exports.RecaptchaVerifier = RecaptchaVerifier;
7039
8194
  exports.SAMLAuthCredential = SAMLAuthCredential;
7040
8195
  exports.SAMLAuthProvider = SAMLAuthProvider;
7041
8196
  exports.STORAGE_AVAILABLE_KEY = STORAGE_AVAILABLE_KEY;
7042
8197
  exports.SignInMethod = SignInMethod;
7043
8198
  exports.TwitterAuthProvider = TwitterAuthProvider;
7044
8199
  exports.UserImpl = UserImpl;
7045
- exports._addTidIfNecessary = _addTidIfNecessary;
7046
8200
  exports._assert = _assert;
7047
8201
  exports._assertInstanceOf = _assertInstanceOf;
7048
8202
  exports._assertLinkedStatus = _assertLinkedStatus;
@@ -7050,13 +8204,16 @@ exports._castAuth = _castAuth;
7050
8204
  exports._createError = _createError;
7051
8205
  exports._emulatorUrl = _emulatorUrl;
7052
8206
  exports._fail = _fail;
8207
+ exports._generateCallbackName = _generateCallbackName;
8208
+ exports._getActiveServiceWorker = _getActiveServiceWorker;
7053
8209
  exports._getClientVersion = _getClientVersion;
7054
8210
  exports._getCurrentUrl = _getCurrentUrl;
7055
8211
  exports._getInstance = _getInstance;
8212
+ exports._getServiceWorkerController = _getServiceWorkerController;
8213
+ exports._getWorkerGlobalScope = _getWorkerGlobalScope;
7056
8214
  exports._isAndroid = _isAndroid;
7057
8215
  exports._isChromeIOS = _isChromeIOS;
7058
8216
  exports._isFirefox = _isFirefox;
7059
- exports._isHttpOrHttps = _isHttpOrHttps;
7060
8217
  exports._isIE10 = _isIE10;
7061
8218
  exports._isIOS = _isIOS;
7062
8219
  exports._isIOS7Or8 = _isIOS7Or8;
@@ -7064,11 +8221,15 @@ exports._isIOSStandalone = _isIOSStandalone;
7064
8221
  exports._isIframe = _isIframe;
7065
8222
  exports._isMobileBrowser = _isMobileBrowser;
7066
8223
  exports._isSafari = _isSafari;
8224
+ exports._isWorker = _isWorker;
7067
8225
  exports._link = _link;
8226
+ exports._loadJS = _loadJS;
7068
8227
  exports._performApiRequest = _performApiRequest;
7069
8228
  exports._persistenceKeyName = _persistenceKeyName;
7070
8229
  exports._reauthenticate = _reauthenticate;
8230
+ exports._setWindowLocation = _setWindowLocation;
7071
8231
  exports._signInWithCredential = _signInWithCredential;
8232
+ exports._window = _window;
7072
8233
  exports.applyActionCode = applyActionCode;
7073
8234
  exports.checkActionCode = checkActionCode;
7074
8235
  exports.confirmPasswordReset = confirmPasswordReset;
@@ -7076,10 +8237,8 @@ exports.connectAuthEmulator = connectAuthEmulator;
7076
8237
  exports.createUserWithEmailAndPassword = createUserWithEmailAndPassword;
7077
8238
  exports.debugAssert = debugAssert;
7078
8239
  exports.debugErrorMap = debugErrorMap;
7079
- exports.debugFail = debugFail;
7080
8240
  exports.deleteUser = deleteUser;
7081
8241
  exports.fetchSignInMethodsForEmail = fetchSignInMethodsForEmail;
7082
- exports.finalizeEnrollPhoneMfa = finalizeEnrollPhoneMfa;
7083
8242
  exports.getAdditionalUserInfo = getAdditionalUserInfo;
7084
8243
  exports.getIdToken = getIdToken;
7085
8244
  exports.getIdTokenResult = getIdTokenResult;
@@ -7088,17 +8247,18 @@ exports.inMemoryPersistence = inMemoryPersistence;
7088
8247
  exports.initializeAuth = initializeAuth;
7089
8248
  exports.isSignInWithEmailLink = isSignInWithEmailLink;
7090
8249
  exports.linkWithCredential = linkWithCredential;
8250
+ exports.linkWithPhoneNumber = linkWithPhoneNumber;
7091
8251
  exports.multiFactor = multiFactor;
7092
8252
  exports.onAuthStateChanged = onAuthStateChanged;
7093
8253
  exports.onIdTokenChanged = onIdTokenChanged;
7094
8254
  exports.parseActionCodeURL = parseActionCodeURL;
7095
8255
  exports.prodErrorMap = prodErrorMap;
7096
8256
  exports.reauthenticateWithCredential = reauthenticateWithCredential;
8257
+ exports.reauthenticateWithPhoneNumber = reauthenticateWithPhoneNumber;
7097
8258
  exports.registerAuth = registerAuth;
7098
8259
  exports.reload = reload;
7099
8260
  exports.sendEmailVerification = sendEmailVerification;
7100
8261
  exports.sendPasswordResetEmail = sendPasswordResetEmail;
7101
- exports.sendPhoneVerificationCode = sendPhoneVerificationCode;
7102
8262
  exports.sendSignInLinkToEmail = sendSignInLinkToEmail;
7103
8263
  exports.setPersistence = setPersistence;
7104
8264
  exports.signInAnonymously = signInAnonymously;
@@ -7107,14 +8267,15 @@ exports.signInWithCustomToken = signInWithCustomToken;
7107
8267
  exports.signInWithEmailAndPassword = signInWithEmailAndPassword;
7108
8268
  exports.signInWithEmailLink = signInWithEmailLink;
7109
8269
  exports.signInWithIdp = signInWithIdp;
8270
+ exports.signInWithPhoneNumber = signInWithPhoneNumber;
7110
8271
  exports.signOut = signOut;
7111
- exports.startEnrollPhoneMfa = startEnrollPhoneMfa;
7112
8272
  exports.unlink = unlink;
7113
8273
  exports.updateCurrentUser = updateCurrentUser;
7114
8274
  exports.updateEmail = updateEmail;
7115
8275
  exports.updatePassword = updatePassword;
8276
+ exports.updatePhoneNumber = updatePhoneNumber;
7116
8277
  exports.updateProfile = updateProfile;
7117
8278
  exports.useDeviceLanguage = useDeviceLanguage;
7118
8279
  exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
7119
8280
  exports.verifyPasswordResetCode = verifyPasswordResetCode;
7120
- //# sourceMappingURL=enum_maps-81db3ff6.js.map
8281
+ //# sourceMappingURL=phone-c7fcf861.js.map