@firebase/auth 0.19.0-2021920175447 → 0.19.0-canary.2322b6023
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 +5 -1
- package/dist/auth-public.d.ts +3 -0
- package/dist/auth.d.ts +3 -0
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/index.rn.d.ts +3 -0
- package/dist/cordova/internal.js +5 -2
- package/dist/cordova/internal.js.map +1 -1
- package/dist/cordova/{popup_redirect-afe2ef4a.js → popup_redirect-822a24b7.js} +31 -17
- package/dist/cordova/popup_redirect-822a24b7.js.map +1 -0
- package/dist/cordova/src/platform_browser/persistence/browser.d.ts +4 -3
- package/dist/cordova/src/platform_browser/persistence/browser.test.d.ts +17 -0
- package/dist/cordova/src/platform_browser/strategies/phone.d.ts +3 -0
- package/dist/cordova/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
- package/dist/esm2017/{index-a559a600.js → index-f7563dee.js} +20 -9
- package/dist/esm2017/index-f7563dee.js.map +1 -0
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/index.rn.d.ts +3 -0
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm2017/src/platform_browser/persistence/browser.d.ts +4 -3
- package/dist/esm2017/src/platform_browser/persistence/browser.test.d.ts +17 -0
- package/dist/esm2017/src/platform_browser/strategies/phone.d.ts +3 -0
- package/dist/esm2017/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
- package/dist/esm5/{index-67d14a54.js → index-85a0dd9d.js} +34 -17
- package/dist/esm5/index-85a0dd9d.js.map +1 -0
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/index.rn.d.ts +3 -0
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/platform_browser/persistence/browser.d.ts +4 -3
- package/dist/esm5/src/platform_browser/persistence/browser.test.d.ts +17 -0
- package/dist/esm5/src/platform_browser/strategies/phone.d.ts +3 -0
- package/dist/esm5/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
- package/dist/index.rn.d.ts +3 -0
- package/dist/index.webworker.esm5.js +9 -8
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/{index-f07b3fe1.js → index-31e9496a.js} +10 -9
- package/dist/node/index-31e9496a.js.map +1 -0
- package/dist/node/index.js +1 -1
- package/dist/node/index.rn.d.ts +3 -0
- package/dist/node/internal.js +22 -9
- package/dist/node/internal.js.map +1 -1
- package/dist/node/src/platform_browser/persistence/browser.d.ts +4 -3
- package/dist/node/src/platform_browser/persistence/browser.test.d.ts +17 -0
- package/dist/node/src/platform_browser/strategies/phone.d.ts +3 -0
- package/dist/node/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
- package/dist/node-esm/index-a6d276f5.js +6031 -0
- package/dist/node-esm/index-a6d276f5.js.map +1 -0
- package/dist/node-esm/index.cordova.d.ts +32 -0
- package/dist/node-esm/index.d.ts +36 -0
- package/dist/node-esm/index.doc.d.ts +24 -0
- package/dist/node-esm/index.js +8 -0
- package/dist/node-esm/index.js.map +1 -0
- package/dist/node-esm/index.node.d.ts +17 -0
- package/dist/node-esm/index.rn.d.ts +30 -0
- package/dist/node-esm/index.shared.d.ts +19 -0
- package/dist/node-esm/index.webworker.d.ts +21 -0
- package/dist/node-esm/internal/index.d.ts +41 -0
- package/dist/node-esm/internal.js +1455 -0
- package/dist/node-esm/internal.js.map +1 -0
- package/dist/node-esm/package.json +1 -0
- package/dist/node-esm/scripts/run_node_tests.d.ts +17 -0
- package/dist/node-esm/src/api/account_management/account.d.ts +59 -0
- package/dist/node-esm/src/api/account_management/account.test.d.ts +17 -0
- package/dist/node-esm/src/api/account_management/email_and_password.d.ts +47 -0
- package/dist/node-esm/src/api/account_management/email_and_password.test.d.ts +17 -0
- package/dist/node-esm/src/api/account_management/mfa.d.ts +69 -0
- package/dist/node-esm/src/api/account_management/mfa.test.d.ts +17 -0
- package/dist/node-esm/src/api/account_management/profile.d.ts +29 -0
- package/dist/node-esm/src/api/account_management/profile.test.d.ts +17 -0
- package/dist/node-esm/src/api/authentication/create_auth_uri.d.ts +26 -0
- package/dist/node-esm/src/api/authentication/create_auth_uri.test.d.ts +17 -0
- package/dist/node-esm/src/api/authentication/custom_token.d.ts +26 -0
- package/dist/node-esm/src/api/authentication/custom_token.test.d.ts +17 -0
- package/dist/node-esm/src/api/authentication/email_and_password.d.ts +76 -0
- package/dist/node-esm/src/api/authentication/email_and_password.test.d.ts +17 -0
- package/dist/node-esm/src/api/authentication/email_link.d.ts +32 -0
- package/dist/node-esm/src/api/authentication/email_link.test.d.ts +17 -0
- package/dist/node-esm/src/api/authentication/idp.d.ts +40 -0
- package/dist/node-esm/src/api/authentication/idp.test.d.ts +17 -0
- package/dist/node-esm/src/api/authentication/mfa.d.ts +58 -0
- package/dist/node-esm/src/api/authentication/mfa.test.d.ts +17 -0
- package/dist/node-esm/src/api/authentication/recaptcha.d.ts +18 -0
- package/dist/node-esm/src/api/authentication/recaptcha.test.d.ts +17 -0
- package/dist/node-esm/src/api/authentication/sign_up.d.ts +29 -0
- package/dist/node-esm/src/api/authentication/sign_up.test.d.ts +17 -0
- package/dist/node-esm/src/api/authentication/sms.d.ts +50 -0
- package/dist/node-esm/src/api/authentication/sms.test.d.ts +17 -0
- package/dist/node-esm/src/api/authentication/token.d.ts +26 -0
- package/dist/node-esm/src/api/authentication/token.test.d.ts +17 -0
- package/dist/node-esm/src/api/errors.d.ts +118 -0
- package/dist/node-esm/src/api/index.d.ts +67 -0
- package/dist/node-esm/src/api/index.test.d.ts +17 -0
- package/dist/node-esm/src/api/project_config/get_project_config.d.ts +25 -0
- package/dist/node-esm/src/api/project_config/get_project_config.test.d.ts +17 -0
- package/dist/node-esm/src/core/action_code_url.d.ts +73 -0
- package/dist/node-esm/src/core/action_code_url.test.d.ts +17 -0
- package/dist/node-esm/src/core/auth/auth_event_manager.d.ts +34 -0
- package/dist/node-esm/src/core/auth/auth_event_manager.test.d.ts +17 -0
- package/dist/node-esm/src/core/auth/auth_impl.d.ts +106 -0
- package/dist/node-esm/src/core/auth/auth_impl.test.d.ts +17 -0
- package/dist/node-esm/src/core/auth/emulator.d.ts +42 -0
- package/dist/node-esm/src/core/auth/emulator.test.d.ts +17 -0
- package/dist/node-esm/src/core/auth/firebase_internal.d.ts +35 -0
- package/dist/node-esm/src/core/auth/firebase_internal.test.d.ts +17 -0
- package/dist/node-esm/src/core/auth/initialize.d.ts +46 -0
- package/dist/node-esm/src/core/auth/initialize.test.d.ts +17 -0
- package/dist/node-esm/src/core/auth/register.d.ts +23 -0
- package/dist/node-esm/src/core/credentials/auth_credential.d.ts +75 -0
- package/dist/node-esm/src/core/credentials/email.d.ts +60 -0
- package/dist/node-esm/src/core/credentials/email.test.d.ts +17 -0
- package/dist/node-esm/src/core/credentials/index.d.ts +23 -0
- package/dist/node-esm/src/core/credentials/oauth.d.ts +81 -0
- package/dist/node-esm/src/core/credentials/oauth.test.d.ts +17 -0
- package/dist/node-esm/src/core/credentials/phone.d.ts +52 -0
- package/dist/node-esm/src/core/credentials/phone.test.d.ts +17 -0
- package/dist/node-esm/src/core/credentials/saml.d.ts +52 -0
- package/dist/node-esm/src/core/credentials/saml.test.d.ts +17 -0
- package/dist/node-esm/src/core/errors.d.ts +299 -0
- package/dist/node-esm/src/core/errors.test.d.ts +17 -0
- package/dist/node-esm/src/core/index.d.ts +141 -0
- package/dist/node-esm/src/core/persistence/in_memory.d.ts +35 -0
- package/dist/node-esm/src/core/persistence/in_memory.test.d.ts +17 -0
- package/dist/node-esm/src/core/persistence/index.d.ts +41 -0
- package/dist/node-esm/src/core/persistence/persistence_user_manager.d.ts +45 -0
- package/dist/node-esm/src/core/persistence/persistence_user_manager.test.d.ts +17 -0
- package/dist/node-esm/src/core/providers/email.d.ts +83 -0
- package/dist/node-esm/src/core/providers/email.test.d.ts +17 -0
- package/dist/node-esm/src/core/providers/facebook.d.ts +93 -0
- package/dist/node-esm/src/core/providers/facebook.test.d.ts +17 -0
- package/dist/node-esm/src/core/providers/federated.d.ts +64 -0
- package/dist/node-esm/src/core/providers/federated.test.d.ts +17 -0
- package/dist/node-esm/src/core/providers/github.d.ts +89 -0
- package/dist/node-esm/src/core/providers/github.test.d.ts +17 -0
- package/dist/node-esm/src/core/providers/google.d.ts +96 -0
- package/dist/node-esm/src/core/providers/google.test.d.ts +17 -0
- package/dist/node-esm/src/core/providers/oauth.d.ts +151 -0
- package/dist/node-esm/src/core/providers/oauth.test.d.ts +17 -0
- package/dist/node-esm/src/core/providers/saml.d.ts +62 -0
- package/dist/node-esm/src/core/providers/saml.test.d.ts +17 -0
- package/dist/node-esm/src/core/providers/twitter.d.ts +103 -0
- package/dist/node-esm/src/core/providers/twitter.test.d.ts +17 -0
- package/dist/node-esm/src/core/strategies/abstract_popup_redirect_operation.d.ts +44 -0
- package/dist/node-esm/src/core/strategies/abstract_popup_redirect_operation.test.d.ts +17 -0
- package/dist/node-esm/src/core/strategies/action_code_settings.d.ts +19 -0
- package/dist/node-esm/src/core/strategies/action_code_settings.test.d.ts +17 -0
- package/dist/node-esm/src/core/strategies/anonymous.d.ts +29 -0
- package/dist/node-esm/src/core/strategies/anonymous.test.d.ts +17 -0
- package/dist/node-esm/src/core/strategies/credential.d.ts +57 -0
- package/dist/node-esm/src/core/strategies/credential.test.d.ts +17 -0
- package/dist/node-esm/src/core/strategies/custom_token.d.ts +34 -0
- package/dist/node-esm/src/core/strategies/custom_token.test.d.ts +17 -0
- package/dist/node-esm/src/core/strategies/email.d.ts +98 -0
- package/dist/node-esm/src/core/strategies/email.test.d.ts +17 -0
- package/dist/node-esm/src/core/strategies/email_and_password.d.ts +126 -0
- package/dist/node-esm/src/core/strategies/email_and_password.test.d.ts +17 -0
- package/dist/node-esm/src/core/strategies/email_link.d.ts +103 -0
- package/dist/node-esm/src/core/strategies/email_link.test.d.ts +17 -0
- package/dist/node-esm/src/core/strategies/idp.d.ts +32 -0
- package/dist/node-esm/src/core/strategies/idp.test.d.ts +17 -0
- package/dist/node-esm/src/core/strategies/redirect.d.ts +35 -0
- package/dist/node-esm/src/core/strategies/redirect.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/account_info.d.ts +60 -0
- package/dist/node-esm/src/core/user/account_info.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/additional_user_info.d.ts +31 -0
- package/dist/node-esm/src/core/user/additional_user_info.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/id_token_result.d.ts +48 -0
- package/dist/node-esm/src/core/user/id_token_result.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/invalidation.d.ts +18 -0
- package/dist/node-esm/src/core/user/invalidation.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/link_unlink.d.ts +30 -0
- package/dist/node-esm/src/core/user/link_unlink.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/proactive_refresh.d.ts +34 -0
- package/dist/node-esm/src/core/user/proactive_refresh.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/reauthenticate.d.ts +20 -0
- package/dist/node-esm/src/core/user/reauthenticate.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/reload.d.ts +27 -0
- package/dist/node-esm/src/core/user/reload.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/token_manager.d.ts +49 -0
- package/dist/node-esm/src/core/user/token_manager.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/user_credential_impl.d.ts +37 -0
- package/dist/node-esm/src/core/user/user_credential_impl.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/user_impl.d.ts +68 -0
- package/dist/node-esm/src/core/user/user_impl.test.d.ts +17 -0
- package/dist/node-esm/src/core/user/user_metadata.d.ts +27 -0
- package/dist/node-esm/src/core/util/assert.d.ts +93 -0
- package/dist/node-esm/src/core/util/assert.test.d.ts +17 -0
- package/dist/node-esm/src/core/util/browser.d.ts +50 -0
- package/dist/node-esm/src/core/util/browser.test.d.ts +17 -0
- package/dist/node-esm/src/core/util/delay.d.ts +31 -0
- package/dist/node-esm/src/core/util/delay.test.d.ts +17 -0
- package/dist/node-esm/src/core/util/emulator.d.ts +18 -0
- package/dist/node-esm/src/core/util/emulator.test.d.ts +17 -0
- package/dist/node-esm/src/core/util/event_id.d.ts +17 -0
- package/dist/node-esm/src/core/util/event_id.test.d.ts +17 -0
- package/dist/node-esm/src/core/util/fetch_provider.d.ts +25 -0
- package/dist/node-esm/src/core/util/handler.d.ts +20 -0
- package/dist/node-esm/src/core/util/instantiator.d.ts +28 -0
- package/dist/node-esm/src/core/util/instantiator.test.d.ts +17 -0
- package/dist/node-esm/src/core/util/location.d.ts +19 -0
- package/dist/node-esm/src/core/util/log.d.ts +22 -0
- package/dist/node-esm/src/core/util/navigator.d.ts +21 -0
- package/dist/node-esm/src/core/util/providers.d.ts +23 -0
- package/dist/node-esm/src/core/util/resolver.d.ts +25 -0
- package/dist/node-esm/src/core/util/time.d.ts +17 -0
- package/dist/node-esm/src/core/util/validate_origin.d.ts +18 -0
- package/dist/node-esm/src/core/util/validate_origin.test.d.ts +17 -0
- package/dist/node-esm/src/core/util/version.d.ts +30 -0
- package/dist/node-esm/src/core/util/version.test.d.ts +17 -0
- package/dist/node-esm/src/index.d.ts +18 -0
- package/dist/node-esm/src/mfa/index.d.ts +18 -0
- package/dist/node-esm/src/mfa/mfa_assertion.d.ts +27 -0
- package/dist/node-esm/src/mfa/mfa_error.d.ts +35 -0
- package/dist/node-esm/src/mfa/mfa_info.d.ts +32 -0
- package/dist/node-esm/src/mfa/mfa_info.test.d.ts +17 -0
- package/dist/node-esm/src/mfa/mfa_resolver.d.ts +41 -0
- package/dist/node-esm/src/mfa/mfa_resolver.test.d.ts +17 -0
- package/dist/node-esm/src/mfa/mfa_session.d.ts +37 -0
- package/dist/node-esm/src/mfa/mfa_session.test.d.ts +17 -0
- package/dist/node-esm/src/mfa/mfa_user.d.ts +38 -0
- package/dist/node-esm/src/mfa/mfa_user.test.d.ts +17 -0
- package/dist/node-esm/src/model/application_verifier.d.ts +23 -0
- package/dist/node-esm/src/model/auth.d.ts +75 -0
- package/dist/node-esm/src/model/enum_maps.d.ts +97 -0
- package/dist/node-esm/src/model/enums.d.ts +74 -0
- package/dist/node-esm/src/model/id_token.d.ts +84 -0
- package/dist/node-esm/src/model/popup_redirect.d.ts +92 -0
- package/dist/node-esm/src/model/public_types.d.ts +1139 -0
- package/dist/node-esm/src/model/user.d.ts +79 -0
- package/dist/node-esm/src/platform_browser/auth.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/auth_window.d.ts +37 -0
- package/dist/node-esm/src/platform_browser/iframe/gapi.d.ts +19 -0
- package/dist/node-esm/src/platform_browser/iframe/gapi.iframes.d.ts +47 -0
- package/dist/node-esm/src/platform_browser/iframe/gapi.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/iframe/iframe.d.ts +18 -0
- package/dist/node-esm/src/platform_browser/iframe/iframe.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/index.d.ts +27 -0
- package/dist/node-esm/src/platform_browser/load_js.d.ts +18 -0
- package/dist/node-esm/src/platform_browser/load_js.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/messagechannel/index.d.ts +87 -0
- package/dist/node-esm/src/platform_browser/messagechannel/promise.d.ts +33 -0
- package/dist/node-esm/src/platform_browser/messagechannel/promise.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/messagechannel/receiver.d.ts +63 -0
- package/dist/node-esm/src/platform_browser/messagechannel/receiver.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/messagechannel/sender.d.ts +46 -0
- package/dist/node-esm/src/platform_browser/messagechannel/sender.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/mfa/assertions/phone.d.ts +56 -0
- package/dist/node-esm/src/platform_browser/mfa/assertions/phone.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/persistence/browser.d.ts +27 -0
- package/dist/node-esm/src/platform_browser/persistence/browser.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/persistence/indexed_db.d.ts +33 -0
- package/dist/node-esm/src/platform_browser/persistence/indexed_db.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/persistence/local_storage.d.ts +25 -0
- package/dist/node-esm/src/platform_browser/persistence/local_storage.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/persistence/session_storage.d.ts +24 -0
- package/dist/node-esm/src/platform_browser/persistence/session_storage.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/popup_redirect.d.ts +24 -0
- package/dist/node-esm/src/platform_browser/popup_redirect.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/providers/phone.d.ts +149 -0
- package/dist/node-esm/src/platform_browser/providers/phone.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha.d.ts +23 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_loader.d.ts +44 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_loader.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_mock.d.ts +51 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_mock.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +94 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_verifier.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/strategies/phone.d.ts +98 -0
- package/dist/node-esm/src/platform_browser/strategies/phone.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/strategies/popup.d.ts +103 -0
- package/dist/node-esm/src/platform_browser/strategies/popup.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/strategies/redirect.d.ts +156 -0
- package/dist/node-esm/src/platform_browser/strategies/redirect.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/util/popup.d.ts +24 -0
- package/dist/node-esm/src/platform_browser/util/popup.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/util/worker.d.ts +20 -0
- package/dist/node-esm/src/platform_cordova/plugins.d.ts +42 -0
- package/dist/node-esm/src/platform_cordova/popup_redirect/events.d.ts +39 -0
- package/dist/node-esm/src/platform_cordova/popup_redirect/events.test.d.ts +17 -0
- package/dist/node-esm/src/platform_cordova/popup_redirect/popup_redirect.d.ts +24 -0
- package/dist/node-esm/src/platform_cordova/popup_redirect/popup_redirect.test.d.ts +17 -0
- package/dist/node-esm/src/platform_cordova/popup_redirect/utils.d.ts +47 -0
- package/dist/node-esm/src/platform_cordova/popup_redirect/utils.test.d.ts +17 -0
- package/dist/node-esm/src/platform_cordova/strategies/redirect.d.ts +20 -0
- package/dist/node-esm/src/platform_node/index.d.ts +49 -0
- package/dist/node-esm/src/platform_react_native/persistence/react_native.d.ts +31 -0
- package/dist/node-esm/src/platform_react_native/persistence/react_native.test.d.ts +17 -0
- package/dist/node-esm/test/helpers/api/helper.d.ts +20 -0
- package/dist/node-esm/test/helpers/delay.d.ts +20 -0
- package/dist/node-esm/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
- package/dist/node-esm/test/helpers/fake_service_worker.d.ts +22 -0
- package/dist/node-esm/test/helpers/id_token_response.d.ts +18 -0
- package/dist/node-esm/test/helpers/iframe_event.d.ts +19 -0
- package/dist/node-esm/test/helpers/integration/emulator_rest_helpers.d.ts +35 -0
- package/dist/node-esm/test/helpers/integration/helpers.d.ts +20 -0
- package/dist/node-esm/test/helpers/integration/settings.d.ts +23 -0
- package/dist/node-esm/test/helpers/jwt.d.ts +17 -0
- package/dist/node-esm/test/helpers/mock_auth.d.ts +37 -0
- package/dist/node-esm/test/helpers/mock_auth_credential.d.ts +31 -0
- package/dist/node-esm/test/helpers/mock_fetch.d.ts +30 -0
- package/dist/node-esm/test/helpers/mock_fetch.test.d.ts +17 -0
- package/dist/node-esm/test/helpers/mock_popup_redirect_resolver.d.ts +24 -0
- package/dist/node-esm/test/helpers/redirect_persistence.d.ts +24 -0
- package/dist/node-esm/test/helpers/timeout_stub.d.ts +34 -0
- package/dist/node-esm/test/integration/flows/anonymous.test.d.ts +17 -0
- package/dist/node-esm/test/integration/flows/custom.local.test.d.ts +17 -0
- package/dist/node-esm/test/integration/flows/email.test.d.ts +17 -0
- package/dist/node-esm/test/integration/flows/idp.local.test.d.ts +17 -0
- package/dist/node-esm/test/integration/flows/oob.local.test.d.ts +17 -0
- package/dist/node-esm/test/integration/flows/phone.test.d.ts +17 -0
- package/dist/node-esm/test/integration/webdriver/anonymous.test.d.ts +17 -0
- package/dist/node-esm/test/integration/webdriver/compat/firebaseui.test.d.ts +17 -0
- package/dist/node-esm/test/integration/webdriver/persistence.test.d.ts +17 -0
- package/dist/node-esm/test/integration/webdriver/popup.test.d.ts +17 -0
- package/dist/node-esm/test/integration/webdriver/redirect.test.d.ts +17 -0
- package/dist/node-esm/test/integration/webdriver/util/auth_driver.d.ts +46 -0
- package/dist/node-esm/test/integration/webdriver/util/functions.d.ts +77 -0
- package/dist/node-esm/test/integration/webdriver/util/idp_page.d.ts +31 -0
- package/dist/node-esm/test/integration/webdriver/util/js_load_condition.d.ts +25 -0
- package/dist/node-esm/test/integration/webdriver/util/test_runner.d.ts +19 -0
- package/dist/node-esm/test/integration/webdriver/util/test_server.d.ts +27 -0
- package/dist/node-esm/test/integration/webdriver/util/ui_page.d.ts +33 -0
- package/dist/rn/index.js +70 -64
- package/dist/rn/index.js.map +1 -1
- package/dist/rn/index.rn.d.ts +3 -0
- package/dist/rn/internal.js +331 -1465
- package/dist/rn/internal.js.map +1 -1
- package/dist/rn/{enum_maps-f94b9714.js → phone-259c608c.js} +1179 -19
- package/dist/rn/phone-259c608c.js.map +1 -0
- package/dist/rn/src/platform_browser/persistence/browser.d.ts +4 -3
- package/dist/rn/src/platform_browser/persistence/browser.test.d.ts +17 -0
- package/dist/rn/src/platform_browser/strategies/phone.d.ts +3 -0
- package/dist/rn/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
- package/dist/src/platform_browser/persistence/browser.d.ts +4 -3
- package/dist/src/platform_browser/persistence/browser.test.d.ts +17 -0
- package/dist/src/platform_browser/strategies/phone.d.ts +3 -0
- package/dist/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
- package/package.json +31 -9
- package/dist/cordova/popup_redirect-afe2ef4a.js.map +0 -1
- package/dist/esm2017/index-a559a600.js.map +0 -1
- package/dist/esm5/index-67d14a54.js.map +0 -1
- package/dist/node/index-f07b3fe1.js.map +0 -1
- package/dist/rn/enum_maps-f94b9714.js.map +0 -1
package/dist/rn/internal.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var phone = require('./phone-259c608c.js');
|
|
6
6
|
var tslib = require('tslib');
|
|
7
7
|
var util = require('@firebase/util');
|
|
8
8
|
var app = require('@firebase/app');
|
|
@@ -29,8 +29,8 @@ require('@firebase/logger');
|
|
|
29
29
|
// Both have the same implementation but use a different underlying storage
|
|
30
30
|
// object.
|
|
31
31
|
var BrowserPersistenceClass = /** @class */ (function () {
|
|
32
|
-
function BrowserPersistenceClass(
|
|
33
|
-
this.
|
|
32
|
+
function BrowserPersistenceClass(storageRetriever, type) {
|
|
33
|
+
this.storageRetriever = storageRetriever;
|
|
34
34
|
this.type = type;
|
|
35
35
|
}
|
|
36
36
|
BrowserPersistenceClass.prototype._isAvailable = function () {
|
|
@@ -38,8 +38,8 @@ var BrowserPersistenceClass = /** @class */ (function () {
|
|
|
38
38
|
if (!this.storage) {
|
|
39
39
|
return Promise.resolve(false);
|
|
40
40
|
}
|
|
41
|
-
this.storage.setItem(
|
|
42
|
-
this.storage.removeItem(
|
|
41
|
+
this.storage.setItem(phone.STORAGE_AVAILABLE_KEY, '1');
|
|
42
|
+
this.storage.removeItem(phone.STORAGE_AVAILABLE_KEY);
|
|
43
43
|
return Promise.resolve(true);
|
|
44
44
|
}
|
|
45
45
|
catch (_a) {
|
|
@@ -58,6 +58,13 @@ var BrowserPersistenceClass = /** @class */ (function () {
|
|
|
58
58
|
this.storage.removeItem(key);
|
|
59
59
|
return Promise.resolve();
|
|
60
60
|
};
|
|
61
|
+
Object.defineProperty(BrowserPersistenceClass.prototype, "storage", {
|
|
62
|
+
get: function () {
|
|
63
|
+
return this.storageRetriever();
|
|
64
|
+
},
|
|
65
|
+
enumerable: false,
|
|
66
|
+
configurable: true
|
|
67
|
+
});
|
|
61
68
|
return BrowserPersistenceClass;
|
|
62
69
|
}());
|
|
63
70
|
|
|
@@ -79,7 +86,7 @@ var BrowserPersistenceClass = /** @class */ (function () {
|
|
|
79
86
|
*/
|
|
80
87
|
function _iframeCannotSyncWebStorage() {
|
|
81
88
|
var ua = util.getUA();
|
|
82
|
-
return
|
|
89
|
+
return phone._isSafari(ua) || phone._isIOS(ua);
|
|
83
90
|
}
|
|
84
91
|
// The polling period in case events are not supported
|
|
85
92
|
var _POLLING_INTERVAL_MS$1 = 1000;
|
|
@@ -88,7 +95,7 @@ var IE10_LOCAL_STORAGE_SYNC_DELAY = 10;
|
|
|
88
95
|
var BrowserLocalPersistence = /** @class */ (function (_super) {
|
|
89
96
|
tslib.__extends(BrowserLocalPersistence, _super);
|
|
90
97
|
function BrowserLocalPersistence() {
|
|
91
|
-
var _this = _super.call(this, window.localStorage, "LOCAL" /* LOCAL */) || this;
|
|
98
|
+
var _this = _super.call(this, function () { return window.localStorage; }, "LOCAL" /* LOCAL */) || this;
|
|
92
99
|
_this.boundEventHandler = function (event, poll) { return _this.onStorageEvent(event, poll); };
|
|
93
100
|
_this.listeners = {};
|
|
94
101
|
_this.localCache = {};
|
|
@@ -96,9 +103,9 @@ var BrowserLocalPersistence = /** @class */ (function (_super) {
|
|
|
96
103
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
104
|
_this.pollTimer = null;
|
|
98
105
|
// Safari or iOS browser and embedded in an iframe.
|
|
99
|
-
_this.safariLocalStorageNotSynced = _iframeCannotSyncWebStorage() &&
|
|
106
|
+
_this.safariLocalStorageNotSynced = _iframeCannotSyncWebStorage() && phone._isIframe();
|
|
100
107
|
// Whether to use polling instead of depending on window events
|
|
101
|
-
_this.fallbackToPolling =
|
|
108
|
+
_this.fallbackToPolling = phone._isMobileBrowser();
|
|
102
109
|
_this._shouldAllowMigration = true;
|
|
103
110
|
return _this;
|
|
104
111
|
}
|
|
@@ -172,7 +179,7 @@ var BrowserLocalPersistence = /** @class */ (function (_super) {
|
|
|
172
179
|
_this.notifyListeners(key, storedValue);
|
|
173
180
|
};
|
|
174
181
|
var storedValue = this.storage.getItem(key);
|
|
175
|
-
if (
|
|
182
|
+
if (phone._isIE10() &&
|
|
176
183
|
storedValue !== event.newValue &&
|
|
177
184
|
event.newValue !== event.oldValue) {
|
|
178
185
|
// IE 10 has this weird bug where a storage event would trigger with the
|
|
@@ -324,7 +331,7 @@ var browserLocalPersistence = BrowserLocalPersistence;
|
|
|
324
331
|
var BrowserSessionPersistence = /** @class */ (function (_super) {
|
|
325
332
|
tslib.__extends(BrowserSessionPersistence, _super);
|
|
326
333
|
function BrowserSessionPersistence() {
|
|
327
|
-
return _super.call(this, window.sessionStorage, "SESSION" /* SESSION */) || this;
|
|
334
|
+
return _super.call(this, function () { return window.sessionStorage; }, "SESSION" /* SESSION */) || this;
|
|
328
335
|
}
|
|
329
336
|
BrowserSessionPersistence.prototype._addListener = function (_key, _listener) {
|
|
330
337
|
// Listeners are not supported for session storage since it cannot be shared across windows
|
|
@@ -663,85 +670,6 @@ var Sender = /** @class */ (function () {
|
|
|
663
670
|
return Sender;
|
|
664
671
|
}());
|
|
665
672
|
|
|
666
|
-
/**
|
|
667
|
-
* @license
|
|
668
|
-
* Copyright 2020 Google LLC
|
|
669
|
-
*
|
|
670
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
671
|
-
* you may not use this file except in compliance with the License.
|
|
672
|
-
* You may obtain a copy of the License at
|
|
673
|
-
*
|
|
674
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
675
|
-
*
|
|
676
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
677
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
678
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
679
|
-
* See the License for the specific language governing permissions and
|
|
680
|
-
* limitations under the License.
|
|
681
|
-
*/
|
|
682
|
-
/**
|
|
683
|
-
* Lazy accessor for window, since the compat layer won't tree shake this out,
|
|
684
|
-
* we need to make sure not to mess with window unless we have to
|
|
685
|
-
*/
|
|
686
|
-
function _window() {
|
|
687
|
-
return window;
|
|
688
|
-
}
|
|
689
|
-
function _setWindowLocation(url) {
|
|
690
|
-
_window().location.href = url;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
/**
|
|
694
|
-
* @license
|
|
695
|
-
* Copyright 2020 Google LLC.
|
|
696
|
-
*
|
|
697
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
698
|
-
* you may not use this file except in compliance with the License.
|
|
699
|
-
* You may obtain a copy of the License at
|
|
700
|
-
*
|
|
701
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
702
|
-
*
|
|
703
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
704
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
705
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
706
|
-
* See the License for the specific language governing permissions and
|
|
707
|
-
* limitations under the License.
|
|
708
|
-
*/
|
|
709
|
-
function _isWorker() {
|
|
710
|
-
return (typeof _window()['WorkerGlobalScope'] !== 'undefined' &&
|
|
711
|
-
typeof _window()['importScripts'] === 'function');
|
|
712
|
-
}
|
|
713
|
-
function _getActiveServiceWorker() {
|
|
714
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
715
|
-
var registration;
|
|
716
|
-
return tslib.__generator(this, function (_b) {
|
|
717
|
-
switch (_b.label) {
|
|
718
|
-
case 0:
|
|
719
|
-
if (!(navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker)) {
|
|
720
|
-
return [2 /*return*/, null];
|
|
721
|
-
}
|
|
722
|
-
_b.label = 1;
|
|
723
|
-
case 1:
|
|
724
|
-
_b.trys.push([1, 3, , 4]);
|
|
725
|
-
return [4 /*yield*/, navigator.serviceWorker.ready];
|
|
726
|
-
case 2:
|
|
727
|
-
registration = _b.sent();
|
|
728
|
-
return [2 /*return*/, registration.active];
|
|
729
|
-
case 3:
|
|
730
|
-
_b.sent();
|
|
731
|
-
return [2 /*return*/, null];
|
|
732
|
-
case 4: return [2 /*return*/];
|
|
733
|
-
}
|
|
734
|
-
});
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
function _getServiceWorkerController() {
|
|
738
|
-
var _a;
|
|
739
|
-
return ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.serviceWorker) === null || _a === void 0 ? void 0 : _a.controller) || null;
|
|
740
|
-
}
|
|
741
|
-
function _getWorkerGlobalScope() {
|
|
742
|
-
return _isWorker() ? self : null;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
673
|
/**
|
|
746
674
|
* @license
|
|
747
675
|
* Copyright 2019 Google LLC
|
|
@@ -946,7 +874,7 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
946
874
|
IndexedDBLocalPersistence.prototype.initializeServiceWorkerMessaging = function () {
|
|
947
875
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
948
876
|
return tslib.__generator(this, function (_a) {
|
|
949
|
-
return [2 /*return*/, _isWorker() ? this.initializeReceiver() : this.initializeSender()];
|
|
877
|
+
return [2 /*return*/, phone._isWorker() ? this.initializeReceiver() : this.initializeSender()];
|
|
950
878
|
});
|
|
951
879
|
});
|
|
952
880
|
};
|
|
@@ -957,7 +885,7 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
957
885
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
958
886
|
var _this = this;
|
|
959
887
|
return tslib.__generator(this, function (_a) {
|
|
960
|
-
this.receiver = Receiver._getInstance(_getWorkerGlobalScope());
|
|
888
|
+
this.receiver = Receiver._getInstance(phone._getWorkerGlobalScope());
|
|
961
889
|
// Refresh from persistence if we receive a KeyChanged message.
|
|
962
890
|
this.receiver._subscribe("keyChanged" /* KEY_CHANGED */, function (_origin, data) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
963
891
|
var keys;
|
|
@@ -998,7 +926,7 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
998
926
|
case 0:
|
|
999
927
|
// Check to see if there's an active service worker.
|
|
1000
928
|
_c = this;
|
|
1001
|
-
return [4 /*yield*/, _getActiveServiceWorker()];
|
|
929
|
+
return [4 /*yield*/, phone._getActiveServiceWorker()];
|
|
1002
930
|
case 1:
|
|
1003
931
|
// Check to see if there's an active service worker.
|
|
1004
932
|
_c.activeServiceWorker = _d.sent();
|
|
@@ -1037,7 +965,7 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
1037
965
|
case 0:
|
|
1038
966
|
if (!this.sender ||
|
|
1039
967
|
!this.activeServiceWorker ||
|
|
1040
|
-
_getServiceWorkerController() !== this.activeServiceWorker) {
|
|
968
|
+
phone._getServiceWorkerController() !== this.activeServiceWorker) {
|
|
1041
969
|
return [2 /*return*/];
|
|
1042
970
|
}
|
|
1043
971
|
_b.label = 1;
|
|
@@ -1072,10 +1000,10 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
1072
1000
|
return [4 /*yield*/, _openDatabase()];
|
|
1073
1001
|
case 1:
|
|
1074
1002
|
db = _b.sent();
|
|
1075
|
-
return [4 /*yield*/, _putObject(db,
|
|
1003
|
+
return [4 /*yield*/, _putObject(db, phone.STORAGE_AVAILABLE_KEY, '1')];
|
|
1076
1004
|
case 2:
|
|
1077
1005
|
_b.sent();
|
|
1078
|
-
return [4 /*yield*/, _deleteObject(db,
|
|
1006
|
+
return [4 /*yield*/, _deleteObject(db, phone.STORAGE_AVAILABLE_KEY)];
|
|
1079
1007
|
case 3:
|
|
1080
1008
|
_b.sent();
|
|
1081
1009
|
return [2 /*return*/, true];
|
|
@@ -1116,1139 +1044,146 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
1116
1044
|
return tslib.__generator(this, function (_a) {
|
|
1117
1045
|
switch (_a.label) {
|
|
1118
1046
|
case 0: return [4 /*yield*/, this._withRetries(function (db) { return _putObject(db, key, value); })];
|
|
1119
|
-
case 1:
|
|
1120
|
-
_a.sent();
|
|
1121
|
-
this.localCache[key] = value;
|
|
1122
|
-
return [2 /*return*/, this.notifyServiceWorker(key)];
|
|
1123
|
-
}
|
|
1124
|
-
});
|
|
1125
|
-
}); })];
|
|
1126
|
-
});
|
|
1127
|
-
});
|
|
1128
|
-
};
|
|
1129
|
-
IndexedDBLocalPersistence.prototype._get = function (key) {
|
|
1130
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1131
|
-
var obj;
|
|
1132
|
-
return tslib.__generator(this, function (_a) {
|
|
1133
|
-
switch (_a.label) {
|
|
1134
|
-
case 0: return [4 /*yield*/, this._withRetries(function (db) {
|
|
1135
|
-
return getObject(db, key);
|
|
1136
|
-
})];
|
|
1137
|
-
case 1:
|
|
1138
|
-
obj = (_a.sent());
|
|
1139
|
-
this.localCache[key] = obj;
|
|
1140
|
-
return [2 /*return*/, obj];
|
|
1141
|
-
}
|
|
1142
|
-
});
|
|
1143
|
-
});
|
|
1144
|
-
};
|
|
1145
|
-
IndexedDBLocalPersistence.prototype._remove = function (key) {
|
|
1146
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1147
|
-
var _this = this;
|
|
1148
|
-
return tslib.__generator(this, function (_a) {
|
|
1149
|
-
return [2 /*return*/, this._withPendingWrite(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
1150
|
-
return tslib.__generator(this, function (_a) {
|
|
1151
|
-
switch (_a.label) {
|
|
1152
|
-
case 0: return [4 /*yield*/, this._withRetries(function (db) { return _deleteObject(db, key); })];
|
|
1153
|
-
case 1:
|
|
1154
|
-
_a.sent();
|
|
1155
|
-
delete this.localCache[key];
|
|
1156
|
-
return [2 /*return*/, this.notifyServiceWorker(key)];
|
|
1157
|
-
}
|
|
1158
|
-
});
|
|
1159
|
-
}); })];
|
|
1160
|
-
});
|
|
1161
|
-
});
|
|
1162
|
-
};
|
|
1163
|
-
IndexedDBLocalPersistence.prototype._poll = function () {
|
|
1164
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1165
|
-
var result, keys, keysInResult, _i, result_1, _a, key, value, _b, _c, localKey;
|
|
1166
|
-
return tslib.__generator(this, function (_d) {
|
|
1167
|
-
switch (_d.label) {
|
|
1168
|
-
case 0: return [4 /*yield*/, this._withRetries(function (db) {
|
|
1169
|
-
var getAllRequest = getObjectStore(db, false).getAll();
|
|
1170
|
-
return new DBPromise(getAllRequest).toPromise();
|
|
1171
|
-
})];
|
|
1172
|
-
case 1:
|
|
1173
|
-
result = _d.sent();
|
|
1174
|
-
if (!result) {
|
|
1175
|
-
return [2 /*return*/, []];
|
|
1176
|
-
}
|
|
1177
|
-
// If we have pending writes in progress abort, we'll get picked up on the next poll
|
|
1178
|
-
if (this.pendingWrites !== 0) {
|
|
1179
|
-
return [2 /*return*/, []];
|
|
1180
|
-
}
|
|
1181
|
-
keys = [];
|
|
1182
|
-
keysInResult = new Set();
|
|
1183
|
-
for (_i = 0, result_1 = result; _i < result_1.length; _i++) {
|
|
1184
|
-
_a = result_1[_i], key = _a.fbase_key, value = _a.value;
|
|
1185
|
-
keysInResult.add(key);
|
|
1186
|
-
if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) {
|
|
1187
|
-
this.notifyListeners(key, value);
|
|
1188
|
-
keys.push(key);
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
for (_b = 0, _c = Object.keys(this.localCache); _b < _c.length; _b++) {
|
|
1192
|
-
localKey = _c[_b];
|
|
1193
|
-
if (this.localCache[localKey] && !keysInResult.has(localKey)) {
|
|
1194
|
-
// Deleted
|
|
1195
|
-
this.notifyListeners(localKey, null);
|
|
1196
|
-
keys.push(localKey);
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
return [2 /*return*/, keys];
|
|
1200
|
-
}
|
|
1201
|
-
});
|
|
1202
|
-
});
|
|
1203
|
-
};
|
|
1204
|
-
IndexedDBLocalPersistence.prototype.notifyListeners = function (key, newValue) {
|
|
1205
|
-
this.localCache[key] = newValue;
|
|
1206
|
-
var listeners = this.listeners[key];
|
|
1207
|
-
if (listeners) {
|
|
1208
|
-
for (var _i = 0, _a = Array.from(listeners); _i < _a.length; _i++) {
|
|
1209
|
-
var listener = _a[_i];
|
|
1210
|
-
listener(newValue);
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
};
|
|
1214
|
-
IndexedDBLocalPersistence.prototype.startPolling = function () {
|
|
1215
|
-
var _this = this;
|
|
1216
|
-
this.stopPolling();
|
|
1217
|
-
this.pollTimer = setInterval(function () { return tslib.__awaiter(_this, void 0, void 0, function () { return tslib.__generator(this, function (_a) {
|
|
1218
|
-
return [2 /*return*/, this._poll()];
|
|
1219
|
-
}); }); }, _POLLING_INTERVAL_MS);
|
|
1220
|
-
};
|
|
1221
|
-
IndexedDBLocalPersistence.prototype.stopPolling = function () {
|
|
1222
|
-
if (this.pollTimer) {
|
|
1223
|
-
clearInterval(this.pollTimer);
|
|
1224
|
-
this.pollTimer = null;
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
|
-
IndexedDBLocalPersistence.prototype._addListener = function (key, listener) {
|
|
1228
|
-
if (Object.keys(this.listeners).length === 0) {
|
|
1229
|
-
this.startPolling();
|
|
1230
|
-
}
|
|
1231
|
-
if (!this.listeners[key]) {
|
|
1232
|
-
this.listeners[key] = new Set();
|
|
1233
|
-
// Populate the cache to avoid spuriously triggering on first poll.
|
|
1234
|
-
void this._get(key); // This can happen in the background async and we can return immediately.
|
|
1235
|
-
}
|
|
1236
|
-
this.listeners[key].add(listener);
|
|
1237
|
-
};
|
|
1238
|
-
IndexedDBLocalPersistence.prototype._removeListener = function (key, listener) {
|
|
1239
|
-
if (this.listeners[key]) {
|
|
1240
|
-
this.listeners[key].delete(listener);
|
|
1241
|
-
if (this.listeners[key].size === 0) {
|
|
1242
|
-
delete this.listeners[key];
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
if (Object.keys(this.listeners).length === 0) {
|
|
1246
|
-
this.stopPolling();
|
|
1247
|
-
}
|
|
1248
|
-
};
|
|
1249
|
-
IndexedDBLocalPersistence.type = 'LOCAL';
|
|
1250
|
-
return IndexedDBLocalPersistence;
|
|
1251
|
-
}());
|
|
1252
|
-
/**
|
|
1253
|
-
* An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`
|
|
1254
|
-
* for the underlying storage.
|
|
1255
|
-
*
|
|
1256
|
-
* @public
|
|
1257
|
-
*/
|
|
1258
|
-
var indexedDBLocalPersistence = IndexedDBLocalPersistence;
|
|
1259
|
-
|
|
1260
|
-
/**
|
|
1261
|
-
* @license
|
|
1262
|
-
* Copyright 2020 Google LLC
|
|
1263
|
-
*
|
|
1264
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1265
|
-
* you may not use this file except in compliance with the License.
|
|
1266
|
-
* You may obtain a copy of the License at
|
|
1267
|
-
*
|
|
1268
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1269
|
-
*
|
|
1270
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1271
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1272
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1273
|
-
* See the License for the specific language governing permissions and
|
|
1274
|
-
* limitations under the License.
|
|
1275
|
-
*/
|
|
1276
|
-
function startSignInPhoneMfa(auth, request) {
|
|
1277
|
-
return enum_maps._performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaSignIn:start" /* START_PHONE_MFA_SIGN_IN */, enum_maps._addTidIfNecessary(auth, request));
|
|
1278
|
-
}
|
|
1279
|
-
function finalizeSignInPhoneMfa(auth, request) {
|
|
1280
|
-
return enum_maps._performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaSignIn:finalize" /* FINALIZE_PHONE_MFA_SIGN_IN */, enum_maps._addTidIfNecessary(auth, request));
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
/**
|
|
1284
|
-
* @license
|
|
1285
|
-
* Copyright 2020 Google LLC
|
|
1286
|
-
*
|
|
1287
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1288
|
-
* you may not use this file except in compliance with the License.
|
|
1289
|
-
* You may obtain a copy of the License at
|
|
1290
|
-
*
|
|
1291
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1292
|
-
*
|
|
1293
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1294
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1295
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1296
|
-
* See the License for the specific language governing permissions and
|
|
1297
|
-
* limitations under the License.
|
|
1298
|
-
*/
|
|
1299
|
-
function getRecaptchaParams(auth) {
|
|
1300
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1301
|
-
return tslib.__generator(this, function (_a) {
|
|
1302
|
-
switch (_a.label) {
|
|
1303
|
-
case 0: return [4 /*yield*/, enum_maps._performApiRequest(auth, "GET" /* GET */, "/v1/recaptchaParams" /* GET_RECAPTCHA_PARAM */)];
|
|
1304
|
-
case 1: return [2 /*return*/, ((_a.sent()).recaptchaSiteKey || '')];
|
|
1305
|
-
}
|
|
1306
|
-
});
|
|
1307
|
-
});
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
/**
|
|
1311
|
-
* @license
|
|
1312
|
-
* Copyright 2020 Google LLC
|
|
1313
|
-
*
|
|
1314
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1315
|
-
* you may not use this file except in compliance with the License.
|
|
1316
|
-
* You may obtain a copy of the License at
|
|
1317
|
-
*
|
|
1318
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1319
|
-
*
|
|
1320
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1321
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1322
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1323
|
-
* See the License for the specific language governing permissions and
|
|
1324
|
-
* limitations under the License.
|
|
1325
|
-
*/
|
|
1326
|
-
function getScriptParentElement() {
|
|
1327
|
-
var _a, _b;
|
|
1328
|
-
return (_b = (_a = document.getElementsByTagName('head')) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : document;
|
|
1329
|
-
}
|
|
1330
|
-
function _loadJS(url) {
|
|
1331
|
-
// TODO: consider adding timeout support & cancellation
|
|
1332
|
-
return new Promise(function (resolve, reject) {
|
|
1333
|
-
var el = document.createElement('script');
|
|
1334
|
-
el.setAttribute('src', url);
|
|
1335
|
-
el.onload = resolve;
|
|
1336
|
-
el.onerror = function (e) {
|
|
1337
|
-
var error = enum_maps._createError("internal-error" /* INTERNAL_ERROR */);
|
|
1338
|
-
error.customData = e;
|
|
1339
|
-
reject(error);
|
|
1340
|
-
};
|
|
1341
|
-
el.type = 'text/javascript';
|
|
1342
|
-
el.charset = 'UTF-8';
|
|
1343
|
-
getScriptParentElement().appendChild(el);
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
|
-
function _generateCallbackName(prefix) {
|
|
1347
|
-
return "__" + prefix + Math.floor(Math.random() * 1000000);
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
/**
|
|
1351
|
-
* @license
|
|
1352
|
-
* Copyright 2020 Google LLC
|
|
1353
|
-
*
|
|
1354
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1355
|
-
* you may not use this file except in compliance with the License.
|
|
1356
|
-
* You may obtain a copy of the License at
|
|
1357
|
-
*
|
|
1358
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1359
|
-
*
|
|
1360
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1361
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1362
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1363
|
-
* See the License for the specific language governing permissions and
|
|
1364
|
-
* limitations under the License.
|
|
1365
|
-
*/
|
|
1366
|
-
var _SOLVE_TIME_MS = 500;
|
|
1367
|
-
var _EXPIRATION_TIME_MS = 60000;
|
|
1368
|
-
var _WIDGET_ID_START = 1000000000000;
|
|
1369
|
-
var MockReCaptcha = /** @class */ (function () {
|
|
1370
|
-
function MockReCaptcha(auth) {
|
|
1371
|
-
this.auth = auth;
|
|
1372
|
-
this.counter = _WIDGET_ID_START;
|
|
1373
|
-
this._widgets = new Map();
|
|
1374
|
-
}
|
|
1375
|
-
MockReCaptcha.prototype.render = function (container, parameters) {
|
|
1376
|
-
var id = this.counter;
|
|
1377
|
-
this._widgets.set(id, new MockWidget(container, this.auth.name, parameters || {}));
|
|
1378
|
-
this.counter++;
|
|
1379
|
-
return id;
|
|
1380
|
-
};
|
|
1381
|
-
MockReCaptcha.prototype.reset = function (optWidgetId) {
|
|
1382
|
-
var _a;
|
|
1383
|
-
var id = optWidgetId || _WIDGET_ID_START;
|
|
1384
|
-
void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.delete());
|
|
1385
|
-
this._widgets.delete(id);
|
|
1386
|
-
};
|
|
1387
|
-
MockReCaptcha.prototype.getResponse = function (optWidgetId) {
|
|
1388
|
-
var _a;
|
|
1389
|
-
var id = optWidgetId || _WIDGET_ID_START;
|
|
1390
|
-
return ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.getResponse()) || '';
|
|
1391
|
-
};
|
|
1392
|
-
MockReCaptcha.prototype.execute = function (optWidgetId) {
|
|
1393
|
-
var _a;
|
|
1394
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1395
|
-
var id;
|
|
1396
|
-
return tslib.__generator(this, function (_b) {
|
|
1397
|
-
id = optWidgetId || _WIDGET_ID_START;
|
|
1398
|
-
void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.execute());
|
|
1399
|
-
return [2 /*return*/, ''];
|
|
1400
|
-
});
|
|
1401
|
-
});
|
|
1402
|
-
};
|
|
1403
|
-
return MockReCaptcha;
|
|
1404
|
-
}());
|
|
1405
|
-
var MockWidget = /** @class */ (function () {
|
|
1406
|
-
function MockWidget(containerOrId, appName, params) {
|
|
1407
|
-
var _this = this;
|
|
1408
|
-
this.params = params;
|
|
1409
|
-
this.timerId = null;
|
|
1410
|
-
this.deleted = false;
|
|
1411
|
-
this.responseToken = null;
|
|
1412
|
-
this.clickHandler = function () {
|
|
1413
|
-
_this.execute();
|
|
1414
|
-
};
|
|
1415
|
-
var container = typeof containerOrId === 'string'
|
|
1416
|
-
? document.getElementById(containerOrId)
|
|
1417
|
-
: containerOrId;
|
|
1418
|
-
enum_maps._assert(container, "argument-error" /* ARGUMENT_ERROR */, { appName: appName });
|
|
1419
|
-
this.container = container;
|
|
1420
|
-
this.isVisible = this.params.size !== 'invisible';
|
|
1421
|
-
if (this.isVisible) {
|
|
1422
|
-
this.execute();
|
|
1423
|
-
}
|
|
1424
|
-
else {
|
|
1425
|
-
this.container.addEventListener('click', this.clickHandler);
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
MockWidget.prototype.getResponse = function () {
|
|
1429
|
-
this.checkIfDeleted();
|
|
1430
|
-
return this.responseToken;
|
|
1431
|
-
};
|
|
1432
|
-
MockWidget.prototype.delete = function () {
|
|
1433
|
-
this.checkIfDeleted();
|
|
1434
|
-
this.deleted = true;
|
|
1435
|
-
if (this.timerId) {
|
|
1436
|
-
clearTimeout(this.timerId);
|
|
1437
|
-
this.timerId = null;
|
|
1438
|
-
}
|
|
1439
|
-
this.container.removeEventListener('click', this.clickHandler);
|
|
1440
|
-
};
|
|
1441
|
-
MockWidget.prototype.execute = function () {
|
|
1442
|
-
var _this = this;
|
|
1443
|
-
this.checkIfDeleted();
|
|
1444
|
-
if (this.timerId) {
|
|
1445
|
-
return;
|
|
1446
|
-
}
|
|
1447
|
-
this.timerId = window.setTimeout(function () {
|
|
1448
|
-
_this.responseToken = generateRandomAlphaNumericString(50);
|
|
1449
|
-
var _a = _this.params, callback = _a.callback, expiredCallback = _a["expired-callback"];
|
|
1450
|
-
if (callback) {
|
|
1451
|
-
try {
|
|
1452
|
-
callback(_this.responseToken);
|
|
1453
|
-
}
|
|
1454
|
-
catch (e) { }
|
|
1455
|
-
}
|
|
1456
|
-
_this.timerId = window.setTimeout(function () {
|
|
1457
|
-
_this.timerId = null;
|
|
1458
|
-
_this.responseToken = null;
|
|
1459
|
-
if (expiredCallback) {
|
|
1460
|
-
try {
|
|
1461
|
-
expiredCallback();
|
|
1462
|
-
}
|
|
1463
|
-
catch (e) { }
|
|
1464
|
-
}
|
|
1465
|
-
if (_this.isVisible) {
|
|
1466
|
-
_this.execute();
|
|
1467
|
-
}
|
|
1468
|
-
}, _EXPIRATION_TIME_MS);
|
|
1469
|
-
}, _SOLVE_TIME_MS);
|
|
1470
|
-
};
|
|
1471
|
-
MockWidget.prototype.checkIfDeleted = function () {
|
|
1472
|
-
if (this.deleted) {
|
|
1473
|
-
throw new Error('reCAPTCHA mock was already deleted!');
|
|
1474
|
-
}
|
|
1475
|
-
};
|
|
1476
|
-
return MockWidget;
|
|
1477
|
-
}());
|
|
1478
|
-
function generateRandomAlphaNumericString(len) {
|
|
1479
|
-
var chars = [];
|
|
1480
|
-
var allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
1481
|
-
for (var i = 0; i < len; i++) {
|
|
1482
|
-
chars.push(allowedChars.charAt(Math.floor(Math.random() * allowedChars.length)));
|
|
1483
|
-
}
|
|
1484
|
-
return chars.join('');
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
/**
|
|
1488
|
-
* @license
|
|
1489
|
-
* Copyright 2020 Google LLC
|
|
1490
|
-
*
|
|
1491
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1492
|
-
* you may not use this file except in compliance with the License.
|
|
1493
|
-
* You may obtain a copy of the License at
|
|
1494
|
-
*
|
|
1495
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1496
|
-
*
|
|
1497
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1498
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1499
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1500
|
-
* See the License for the specific language governing permissions and
|
|
1501
|
-
* limitations under the License.
|
|
1502
|
-
*/
|
|
1503
|
-
// ReCaptcha will load using the same callback, so the callback function needs
|
|
1504
|
-
// to be kept around
|
|
1505
|
-
var _JSLOAD_CALLBACK = _generateCallbackName('rcb');
|
|
1506
|
-
var NETWORK_TIMEOUT_DELAY = new enum_maps.Delay(30000, 60000);
|
|
1507
|
-
var RECAPTCHA_BASE = 'https://www.google.com/recaptcha/api.js?';
|
|
1508
|
-
/**
|
|
1509
|
-
* Loader for the GReCaptcha library. There should only ever be one of this.
|
|
1510
|
-
*/
|
|
1511
|
-
var ReCaptchaLoaderImpl = /** @class */ (function () {
|
|
1512
|
-
function ReCaptchaLoaderImpl() {
|
|
1513
|
-
this.hostLanguage = '';
|
|
1514
|
-
this.counter = 0;
|
|
1515
|
-
this.librarySeparatelyLoaded = !!_window().grecaptcha;
|
|
1516
|
-
}
|
|
1517
|
-
ReCaptchaLoaderImpl.prototype.load = function (auth, hl) {
|
|
1518
|
-
var _this = this;
|
|
1519
|
-
if (hl === void 0) { hl = ''; }
|
|
1520
|
-
enum_maps._assert(isHostLanguageValid(hl), auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
1521
|
-
if (this.shouldResolveImmediately(hl)) {
|
|
1522
|
-
return Promise.resolve(_window().grecaptcha);
|
|
1523
|
-
}
|
|
1524
|
-
return new Promise(function (resolve, reject) {
|
|
1525
|
-
var networkTimeout = _window().setTimeout(function () {
|
|
1526
|
-
reject(enum_maps._createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
1527
|
-
}, NETWORK_TIMEOUT_DELAY.get());
|
|
1528
|
-
_window()[_JSLOAD_CALLBACK] = function () {
|
|
1529
|
-
_window().clearTimeout(networkTimeout);
|
|
1530
|
-
delete _window()[_JSLOAD_CALLBACK];
|
|
1531
|
-
var recaptcha = _window().grecaptcha;
|
|
1532
|
-
if (!recaptcha) {
|
|
1533
|
-
reject(enum_maps._createError(auth, "internal-error" /* INTERNAL_ERROR */));
|
|
1534
|
-
return;
|
|
1535
|
-
}
|
|
1536
|
-
// Wrap the greptcha render function so that we know if the developer has
|
|
1537
|
-
// called it separately
|
|
1538
|
-
var render = recaptcha.render;
|
|
1539
|
-
recaptcha.render = function (container, params) {
|
|
1540
|
-
var widgetId = render(container, params);
|
|
1541
|
-
_this.counter++;
|
|
1542
|
-
return widgetId;
|
|
1543
|
-
};
|
|
1544
|
-
_this.hostLanguage = hl;
|
|
1545
|
-
resolve(recaptcha);
|
|
1546
|
-
};
|
|
1547
|
-
var url = RECAPTCHA_BASE + "?" + util.querystring({
|
|
1548
|
-
onload: _JSLOAD_CALLBACK,
|
|
1549
|
-
render: 'explicit',
|
|
1550
|
-
hl: hl
|
|
1551
|
-
});
|
|
1552
|
-
_loadJS(url).catch(function () {
|
|
1553
|
-
clearTimeout(networkTimeout);
|
|
1554
|
-
reject(enum_maps._createError(auth, "internal-error" /* INTERNAL_ERROR */));
|
|
1555
|
-
});
|
|
1556
|
-
});
|
|
1557
|
-
};
|
|
1558
|
-
ReCaptchaLoaderImpl.prototype.clearedOneInstance = function () {
|
|
1559
|
-
this.counter--;
|
|
1560
|
-
};
|
|
1561
|
-
ReCaptchaLoaderImpl.prototype.shouldResolveImmediately = function (hl) {
|
|
1562
|
-
// We can resolve immediately if:
|
|
1563
|
-
// • grecaptcha is already defined AND (
|
|
1564
|
-
// 1. the requested language codes are the same OR
|
|
1565
|
-
// 2. there exists already a ReCaptcha on the page
|
|
1566
|
-
// 3. the library was already loaded by the app
|
|
1567
|
-
// In cases (2) and (3), we _can't_ reload as it would break the recaptchas
|
|
1568
|
-
// that are already in the page
|
|
1569
|
-
return (!!_window().grecaptcha &&
|
|
1570
|
-
(hl === this.hostLanguage ||
|
|
1571
|
-
this.counter > 0 ||
|
|
1572
|
-
this.librarySeparatelyLoaded));
|
|
1573
|
-
};
|
|
1574
|
-
return ReCaptchaLoaderImpl;
|
|
1575
|
-
}());
|
|
1576
|
-
function isHostLanguageValid(hl) {
|
|
1577
|
-
return hl.length <= 6 && /^\s*[a-zA-Z0-9\-]*\s*$/.test(hl);
|
|
1578
|
-
}
|
|
1579
|
-
var MockReCaptchaLoaderImpl = /** @class */ (function () {
|
|
1580
|
-
function MockReCaptchaLoaderImpl() {
|
|
1581
|
-
}
|
|
1582
|
-
MockReCaptchaLoaderImpl.prototype.load = function (auth) {
|
|
1583
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1584
|
-
return tslib.__generator(this, function (_a) {
|
|
1585
|
-
return [2 /*return*/, new MockReCaptcha(auth)];
|
|
1586
|
-
});
|
|
1587
|
-
});
|
|
1588
|
-
};
|
|
1589
|
-
MockReCaptchaLoaderImpl.prototype.clearedOneInstance = function () { };
|
|
1590
|
-
return MockReCaptchaLoaderImpl;
|
|
1591
|
-
}());
|
|
1592
|
-
|
|
1593
|
-
/**
|
|
1594
|
-
* @license
|
|
1595
|
-
* Copyright 2020 Google LLC
|
|
1596
|
-
*
|
|
1597
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1598
|
-
* you may not use this file except in compliance with the License.
|
|
1599
|
-
* You may obtain a copy of the License at
|
|
1600
|
-
*
|
|
1601
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1602
|
-
*
|
|
1603
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1604
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1605
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1606
|
-
* See the License for the specific language governing permissions and
|
|
1607
|
-
* limitations under the License.
|
|
1608
|
-
*/
|
|
1609
|
-
var RECAPTCHA_VERIFIER_TYPE = 'recaptcha';
|
|
1610
|
-
var DEFAULT_PARAMS = {
|
|
1611
|
-
theme: 'light',
|
|
1612
|
-
type: 'image'
|
|
1613
|
-
};
|
|
1614
|
-
/**
|
|
1615
|
-
* An {@link https://www.google.com/recaptcha/ | reCAPTCHA}-based application verifier.
|
|
1616
|
-
*
|
|
1617
|
-
* @public
|
|
1618
|
-
*/
|
|
1619
|
-
var RecaptchaVerifier = /** @class */ (function () {
|
|
1620
|
-
/**
|
|
1621
|
-
*
|
|
1622
|
-
* @param containerOrId - The reCAPTCHA container parameter.
|
|
1623
|
-
*
|
|
1624
|
-
* @remarks
|
|
1625
|
-
* This has different meaning depending on whether the reCAPTCHA is hidden or visible. For a
|
|
1626
|
-
* visible reCAPTCHA the container must be empty. If a string is used, it has to correspond to
|
|
1627
|
-
* an element ID. The corresponding element must also must be in the DOM at the time of
|
|
1628
|
-
* initialization.
|
|
1629
|
-
*
|
|
1630
|
-
* @param parameters - The optional reCAPTCHA parameters.
|
|
1631
|
-
*
|
|
1632
|
-
* @remarks
|
|
1633
|
-
* Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for
|
|
1634
|
-
* the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will
|
|
1635
|
-
* configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value
|
|
1636
|
-
* 'invisible'.
|
|
1637
|
-
*
|
|
1638
|
-
* @param authExtern - The corresponding Firebase {@link Auth} instance.
|
|
1639
|
-
*
|
|
1640
|
-
* @remarks
|
|
1641
|
-
* If none is provided, the default Firebase {@link Auth} instance is used. A Firebase {@link Auth} instance
|
|
1642
|
-
* must be initialized with an API key, otherwise an error will be thrown.
|
|
1643
|
-
*/
|
|
1644
|
-
function RecaptchaVerifier(containerOrId, parameters, authExtern) {
|
|
1645
|
-
if (parameters === void 0) { parameters = tslib.__assign({}, DEFAULT_PARAMS); }
|
|
1646
|
-
this.parameters = parameters;
|
|
1647
|
-
/**
|
|
1648
|
-
* The application verifier type.
|
|
1649
|
-
*
|
|
1650
|
-
* @remarks
|
|
1651
|
-
* For a reCAPTCHA verifier, this is 'recaptcha'.
|
|
1652
|
-
*/
|
|
1653
|
-
this.type = RECAPTCHA_VERIFIER_TYPE;
|
|
1654
|
-
this.destroyed = false;
|
|
1655
|
-
this.widgetId = null;
|
|
1656
|
-
this.tokenChangeListeners = new Set();
|
|
1657
|
-
this.renderPromise = null;
|
|
1658
|
-
this.recaptcha = null;
|
|
1659
|
-
this.auth = enum_maps._castAuth(authExtern);
|
|
1660
|
-
this.isInvisible = this.parameters.size === 'invisible';
|
|
1661
|
-
enum_maps._assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
1662
|
-
var container = typeof containerOrId === 'string'
|
|
1663
|
-
? document.getElementById(containerOrId)
|
|
1664
|
-
: containerOrId;
|
|
1665
|
-
enum_maps._assert(container, this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
1666
|
-
this.container = container;
|
|
1667
|
-
this.parameters.callback = this.makeTokenCallback(this.parameters.callback);
|
|
1668
|
-
this._recaptchaLoader = this.auth.settings.appVerificationDisabledForTesting
|
|
1669
|
-
? new MockReCaptchaLoaderImpl()
|
|
1670
|
-
: new ReCaptchaLoaderImpl();
|
|
1671
|
-
this.validateStartingState();
|
|
1672
|
-
// TODO: Figure out if sdk version is needed
|
|
1673
|
-
}
|
|
1674
|
-
/**
|
|
1675
|
-
* Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token.
|
|
1676
|
-
*
|
|
1677
|
-
* @returns A Promise for the reCAPTCHA token.
|
|
1678
|
-
*/
|
|
1679
|
-
RecaptchaVerifier.prototype.verify = function () {
|
|
1680
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1681
|
-
var id, recaptcha, response;
|
|
1682
|
-
var _this = this;
|
|
1683
|
-
return tslib.__generator(this, function (_a) {
|
|
1684
|
-
switch (_a.label) {
|
|
1685
|
-
case 0:
|
|
1686
|
-
this.assertNotDestroyed();
|
|
1687
|
-
return [4 /*yield*/, this.render()];
|
|
1688
|
-
case 1:
|
|
1689
|
-
id = _a.sent();
|
|
1690
|
-
recaptcha = this.getAssertedRecaptcha();
|
|
1691
|
-
response = recaptcha.getResponse(id);
|
|
1692
|
-
if (response) {
|
|
1693
|
-
return [2 /*return*/, response];
|
|
1694
|
-
}
|
|
1695
|
-
return [2 /*return*/, new Promise(function (resolve) {
|
|
1696
|
-
var tokenChange = function (token) {
|
|
1697
|
-
if (!token) {
|
|
1698
|
-
return; // Ignore token expirations.
|
|
1699
|
-
}
|
|
1700
|
-
_this.tokenChangeListeners.delete(tokenChange);
|
|
1701
|
-
resolve(token);
|
|
1702
|
-
};
|
|
1703
|
-
_this.tokenChangeListeners.add(tokenChange);
|
|
1704
|
-
if (_this.isInvisible) {
|
|
1705
|
-
recaptcha.execute(id);
|
|
1706
|
-
}
|
|
1707
|
-
})];
|
|
1708
|
-
}
|
|
1709
|
-
});
|
|
1710
|
-
});
|
|
1711
|
-
};
|
|
1712
|
-
/**
|
|
1713
|
-
* Renders the reCAPTCHA widget on the page.
|
|
1714
|
-
*
|
|
1715
|
-
* @returns A Promise that resolves with the reCAPTCHA widget ID.
|
|
1716
|
-
*/
|
|
1717
|
-
RecaptchaVerifier.prototype.render = function () {
|
|
1718
|
-
var _this = this;
|
|
1719
|
-
try {
|
|
1720
|
-
this.assertNotDestroyed();
|
|
1721
|
-
}
|
|
1722
|
-
catch (e) {
|
|
1723
|
-
// This method returns a promise. Since it's not async (we want to return the
|
|
1724
|
-
// _same_ promise if rendering is still occurring), the API surface should
|
|
1725
|
-
// reject with the error rather than just throw
|
|
1726
|
-
return Promise.reject(e);
|
|
1727
|
-
}
|
|
1728
|
-
if (this.renderPromise) {
|
|
1729
|
-
return this.renderPromise;
|
|
1730
|
-
}
|
|
1731
|
-
this.renderPromise = this.makeRenderPromise().catch(function (e) {
|
|
1732
|
-
_this.renderPromise = null;
|
|
1733
|
-
throw e;
|
|
1734
|
-
});
|
|
1735
|
-
return this.renderPromise;
|
|
1736
|
-
};
|
|
1737
|
-
/** @internal */
|
|
1738
|
-
RecaptchaVerifier.prototype._reset = function () {
|
|
1739
|
-
this.assertNotDestroyed();
|
|
1740
|
-
if (this.widgetId !== null) {
|
|
1741
|
-
this.getAssertedRecaptcha().reset(this.widgetId);
|
|
1742
|
-
}
|
|
1743
|
-
};
|
|
1744
|
-
/**
|
|
1745
|
-
* Clears the reCAPTCHA widget from the page and destroys the instance.
|
|
1746
|
-
*/
|
|
1747
|
-
RecaptchaVerifier.prototype.clear = function () {
|
|
1748
|
-
var _this = this;
|
|
1749
|
-
this.assertNotDestroyed();
|
|
1750
|
-
this.destroyed = true;
|
|
1751
|
-
this._recaptchaLoader.clearedOneInstance();
|
|
1752
|
-
if (!this.isInvisible) {
|
|
1753
|
-
this.container.childNodes.forEach(function (node) {
|
|
1754
|
-
_this.container.removeChild(node);
|
|
1755
|
-
});
|
|
1756
|
-
}
|
|
1757
|
-
};
|
|
1758
|
-
RecaptchaVerifier.prototype.validateStartingState = function () {
|
|
1759
|
-
enum_maps._assert(!this.parameters.sitekey, this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
1760
|
-
enum_maps._assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
1761
|
-
enum_maps._assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
1762
|
-
};
|
|
1763
|
-
RecaptchaVerifier.prototype.makeTokenCallback = function (existing) {
|
|
1764
|
-
var _this = this;
|
|
1765
|
-
return function (token) {
|
|
1766
|
-
_this.tokenChangeListeners.forEach(function (listener) { return listener(token); });
|
|
1767
|
-
if (typeof existing === 'function') {
|
|
1768
|
-
existing(token);
|
|
1769
|
-
}
|
|
1770
|
-
else if (typeof existing === 'string') {
|
|
1771
|
-
var globalFunc = _window()[existing];
|
|
1772
|
-
if (typeof globalFunc === 'function') {
|
|
1773
|
-
globalFunc(token);
|
|
1774
|
-
}
|
|
1775
|
-
}
|
|
1776
|
-
};
|
|
1777
|
-
};
|
|
1778
|
-
RecaptchaVerifier.prototype.assertNotDestroyed = function () {
|
|
1779
|
-
enum_maps._assert(!this.destroyed, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1780
|
-
};
|
|
1781
|
-
RecaptchaVerifier.prototype.makeRenderPromise = function () {
|
|
1782
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1783
|
-
var container, guaranteedEmpty;
|
|
1784
|
-
return tslib.__generator(this, function (_a) {
|
|
1785
|
-
switch (_a.label) {
|
|
1786
|
-
case 0: return [4 /*yield*/, this.init()];
|
|
1787
|
-
case 1:
|
|
1788
|
-
_a.sent();
|
|
1789
|
-
if (!this.widgetId) {
|
|
1790
|
-
container = this.container;
|
|
1791
|
-
if (!this.isInvisible) {
|
|
1792
|
-
guaranteedEmpty = document.createElement('div');
|
|
1793
|
-
container.appendChild(guaranteedEmpty);
|
|
1794
|
-
container = guaranteedEmpty;
|
|
1795
|
-
}
|
|
1796
|
-
this.widgetId = this.getAssertedRecaptcha().render(container, this.parameters);
|
|
1797
|
-
}
|
|
1798
|
-
return [2 /*return*/, this.widgetId];
|
|
1799
|
-
}
|
|
1800
|
-
});
|
|
1801
|
-
});
|
|
1802
|
-
};
|
|
1803
|
-
RecaptchaVerifier.prototype.init = function () {
|
|
1804
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1805
|
-
var _a, siteKey;
|
|
1806
|
-
return tslib.__generator(this, function (_b) {
|
|
1807
|
-
switch (_b.label) {
|
|
1808
|
-
case 0:
|
|
1809
|
-
enum_maps._assert(enum_maps._isHttpOrHttps() && !_isWorker(), this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1810
|
-
return [4 /*yield*/, domReady()];
|
|
1811
|
-
case 1:
|
|
1812
|
-
_b.sent();
|
|
1813
|
-
_a = this;
|
|
1814
|
-
return [4 /*yield*/, this._recaptchaLoader.load(this.auth, this.auth.languageCode || undefined)];
|
|
1815
|
-
case 2:
|
|
1816
|
-
_a.recaptcha = _b.sent();
|
|
1817
|
-
return [4 /*yield*/, getRecaptchaParams(this.auth)];
|
|
1818
|
-
case 3:
|
|
1819
|
-
siteKey = _b.sent();
|
|
1820
|
-
enum_maps._assert(siteKey, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1821
|
-
this.parameters.sitekey = siteKey;
|
|
1822
|
-
return [2 /*return*/];
|
|
1823
|
-
}
|
|
1824
|
-
});
|
|
1825
|
-
});
|
|
1826
|
-
};
|
|
1827
|
-
RecaptchaVerifier.prototype.getAssertedRecaptcha = function () {
|
|
1828
|
-
enum_maps._assert(this.recaptcha, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1829
|
-
return this.recaptcha;
|
|
1830
|
-
};
|
|
1831
|
-
return RecaptchaVerifier;
|
|
1832
|
-
}());
|
|
1833
|
-
function domReady() {
|
|
1834
|
-
var resolver = null;
|
|
1835
|
-
return new Promise(function (resolve) {
|
|
1836
|
-
if (document.readyState === 'complete') {
|
|
1837
|
-
resolve();
|
|
1838
|
-
return;
|
|
1839
|
-
}
|
|
1840
|
-
// Document not ready, wait for load before resolving.
|
|
1841
|
-
// Save resolver, so we can remove listener in case it was externally
|
|
1842
|
-
// cancelled.
|
|
1843
|
-
resolver = function () { return resolve(); };
|
|
1844
|
-
window.addEventListener('load', resolver);
|
|
1845
|
-
}).catch(function (e) {
|
|
1846
|
-
if (resolver) {
|
|
1847
|
-
window.removeEventListener('load', resolver);
|
|
1848
|
-
}
|
|
1849
|
-
throw e;
|
|
1850
|
-
});
|
|
1851
|
-
}
|
|
1852
|
-
|
|
1853
|
-
/**
|
|
1854
|
-
* @license
|
|
1855
|
-
* Copyright 2020 Google LLC
|
|
1856
|
-
*
|
|
1857
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1858
|
-
* you may not use this file except in compliance with the License.
|
|
1859
|
-
* You may obtain a copy of the License at
|
|
1860
|
-
*
|
|
1861
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1862
|
-
*
|
|
1863
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1864
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1865
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1866
|
-
* See the License for the specific language governing permissions and
|
|
1867
|
-
* limitations under the License.
|
|
1868
|
-
*/
|
|
1869
|
-
var ConfirmationResultImpl = /** @class */ (function () {
|
|
1870
|
-
function ConfirmationResultImpl(verificationId, onConfirmation) {
|
|
1871
|
-
this.verificationId = verificationId;
|
|
1872
|
-
this.onConfirmation = onConfirmation;
|
|
1873
|
-
}
|
|
1874
|
-
ConfirmationResultImpl.prototype.confirm = function (verificationCode) {
|
|
1875
|
-
var authCredential = enum_maps.PhoneAuthCredential._fromVerification(this.verificationId, verificationCode);
|
|
1876
|
-
return this.onConfirmation(authCredential);
|
|
1877
|
-
};
|
|
1878
|
-
return ConfirmationResultImpl;
|
|
1879
|
-
}());
|
|
1880
|
-
/**
|
|
1881
|
-
* Asynchronously signs in using a phone number.
|
|
1882
|
-
*
|
|
1883
|
-
* @remarks
|
|
1884
|
-
* This method sends a code via SMS to the given
|
|
1885
|
-
* phone number, and returns a {@link ConfirmationResult}. After the user
|
|
1886
|
-
* provides the code sent to their phone, call {@link ConfirmationResult.confirm}
|
|
1887
|
-
* with the code to sign the user in.
|
|
1888
|
-
*
|
|
1889
|
-
* For abuse prevention, this method also requires a {@link ApplicationVerifier}.
|
|
1890
|
-
* This SDK includes a reCAPTCHA-based implementation, {@link RecaptchaVerifier}.
|
|
1891
|
-
*
|
|
1892
|
-
* @example
|
|
1893
|
-
* ```javascript
|
|
1894
|
-
* // 'recaptcha-container' is the ID of an element in the DOM.
|
|
1895
|
-
* const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');
|
|
1896
|
-
* const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
|
|
1897
|
-
* // Obtain a verificationCode from the user.
|
|
1898
|
-
* const credential = await confirmationResult.confirm(verificationCode);
|
|
1899
|
-
* ```
|
|
1900
|
-
*
|
|
1901
|
-
* @param auth - The {@link Auth} instance.
|
|
1902
|
-
* @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
|
|
1903
|
-
* @param appVerifier - The {@link ApplicationVerifier}.
|
|
1904
|
-
*
|
|
1905
|
-
* @public
|
|
1906
|
-
*/
|
|
1907
|
-
function signInWithPhoneNumber(auth, phoneNumber, appVerifier) {
|
|
1908
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1909
|
-
var authInternal, verificationId;
|
|
1910
|
-
return tslib.__generator(this, function (_a) {
|
|
1911
|
-
switch (_a.label) {
|
|
1912
|
-
case 0:
|
|
1913
|
-
authInternal = enum_maps._castAuth(auth);
|
|
1914
|
-
return [4 /*yield*/, _verifyPhoneNumber(authInternal, phoneNumber, util.getModularInstance(appVerifier))];
|
|
1915
|
-
case 1:
|
|
1916
|
-
verificationId = _a.sent();
|
|
1917
|
-
return [2 /*return*/, new ConfirmationResultImpl(verificationId, function (cred) {
|
|
1918
|
-
return enum_maps.signInWithCredential(authInternal, cred);
|
|
1919
|
-
})];
|
|
1920
|
-
}
|
|
1921
|
-
});
|
|
1922
|
-
});
|
|
1923
|
-
}
|
|
1924
|
-
/**
|
|
1925
|
-
* Links the user account with the given phone number.
|
|
1926
|
-
*
|
|
1927
|
-
* @param user - The user.
|
|
1928
|
-
* @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
|
|
1929
|
-
* @param appVerifier - The {@link ApplicationVerifier}.
|
|
1930
|
-
*
|
|
1931
|
-
* @public
|
|
1932
|
-
*/
|
|
1933
|
-
function linkWithPhoneNumber(user, phoneNumber, appVerifier) {
|
|
1934
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1935
|
-
var userInternal, verificationId;
|
|
1936
|
-
return tslib.__generator(this, function (_a) {
|
|
1937
|
-
switch (_a.label) {
|
|
1938
|
-
case 0:
|
|
1939
|
-
userInternal = util.getModularInstance(user);
|
|
1940
|
-
return [4 /*yield*/, enum_maps._assertLinkedStatus(false, userInternal, "phone" /* PHONE */)];
|
|
1941
|
-
case 1:
|
|
1942
|
-
_a.sent();
|
|
1943
|
-
return [4 /*yield*/, _verifyPhoneNumber(userInternal.auth, phoneNumber, util.getModularInstance(appVerifier))];
|
|
1944
|
-
case 2:
|
|
1945
|
-
verificationId = _a.sent();
|
|
1946
|
-
return [2 /*return*/, new ConfirmationResultImpl(verificationId, function (cred) {
|
|
1947
|
-
return enum_maps.linkWithCredential(userInternal, cred);
|
|
1948
|
-
})];
|
|
1949
|
-
}
|
|
1950
|
-
});
|
|
1951
|
-
});
|
|
1952
|
-
}
|
|
1953
|
-
/**
|
|
1954
|
-
* Re-authenticates a user using a fresh phone credential.
|
|
1955
|
-
*
|
|
1956
|
-
* @remarks Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.
|
|
1957
|
-
*
|
|
1958
|
-
* @param user - The user.
|
|
1959
|
-
* @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
|
|
1960
|
-
* @param appVerifier - The {@link ApplicationVerifier}.
|
|
1961
|
-
*
|
|
1962
|
-
* @public
|
|
1963
|
-
*/
|
|
1964
|
-
function reauthenticateWithPhoneNumber(user, phoneNumber, appVerifier) {
|
|
1965
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1966
|
-
var userInternal, verificationId;
|
|
1967
|
-
return tslib.__generator(this, function (_a) {
|
|
1968
|
-
switch (_a.label) {
|
|
1969
|
-
case 0:
|
|
1970
|
-
userInternal = util.getModularInstance(user);
|
|
1971
|
-
return [4 /*yield*/, _verifyPhoneNumber(userInternal.auth, phoneNumber, util.getModularInstance(appVerifier))];
|
|
1972
|
-
case 1:
|
|
1973
|
-
verificationId = _a.sent();
|
|
1974
|
-
return [2 /*return*/, new ConfirmationResultImpl(verificationId, function (cred) {
|
|
1975
|
-
return enum_maps.reauthenticateWithCredential(userInternal, cred);
|
|
1047
|
+
case 1:
|
|
1048
|
+
_a.sent();
|
|
1049
|
+
this.localCache[key] = value;
|
|
1050
|
+
return [2 /*return*/, this.notifyServiceWorker(key)];
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
}); })];
|
|
1054
|
+
});
|
|
1055
|
+
});
|
|
1056
|
+
};
|
|
1057
|
+
IndexedDBLocalPersistence.prototype._get = function (key) {
|
|
1058
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1059
|
+
var obj;
|
|
1060
|
+
return tslib.__generator(this, function (_a) {
|
|
1061
|
+
switch (_a.label) {
|
|
1062
|
+
case 0: return [4 /*yield*/, this._withRetries(function (db) {
|
|
1063
|
+
return getObject(db, key);
|
|
1976
1064
|
})];
|
|
1977
|
-
|
|
1065
|
+
case 1:
|
|
1066
|
+
obj = (_a.sent());
|
|
1067
|
+
this.localCache[key] = obj;
|
|
1068
|
+
return [2 /*return*/, obj];
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1978
1071
|
});
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
case 1:
|
|
1993
|
-
recaptchaToken = _b.sent();
|
|
1994
|
-
_b.label = 2;
|
|
1995
|
-
case 2:
|
|
1996
|
-
_b.trys.push([2, , 10, 11]);
|
|
1997
|
-
enum_maps._assert(typeof recaptchaToken === 'string', auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
1998
|
-
enum_maps._assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
1999
|
-
phoneInfoOptions = void 0;
|
|
2000
|
-
if (typeof options === 'string') {
|
|
2001
|
-
phoneInfoOptions = {
|
|
2002
|
-
phoneNumber: options
|
|
2003
|
-
};
|
|
2004
|
-
}
|
|
2005
|
-
else {
|
|
2006
|
-
phoneInfoOptions = options;
|
|
2007
|
-
}
|
|
2008
|
-
if (!('session' in phoneInfoOptions)) return [3 /*break*/, 7];
|
|
2009
|
-
session = phoneInfoOptions.session;
|
|
2010
|
-
if (!('phoneNumber' in phoneInfoOptions)) return [3 /*break*/, 4];
|
|
2011
|
-
enum_maps._assert(session.type === "enroll" /* ENROLL */, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2012
|
-
return [4 /*yield*/, enum_maps.startEnrollPhoneMfa(auth, {
|
|
2013
|
-
idToken: session.credential,
|
|
2014
|
-
phoneEnrollmentInfo: {
|
|
2015
|
-
phoneNumber: phoneInfoOptions.phoneNumber,
|
|
2016
|
-
recaptchaToken: recaptchaToken
|
|
1072
|
+
};
|
|
1073
|
+
IndexedDBLocalPersistence.prototype._remove = function (key) {
|
|
1074
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1075
|
+
var _this = this;
|
|
1076
|
+
return tslib.__generator(this, function (_a) {
|
|
1077
|
+
return [2 /*return*/, this._withPendingWrite(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
1078
|
+
return tslib.__generator(this, function (_a) {
|
|
1079
|
+
switch (_a.label) {
|
|
1080
|
+
case 0: return [4 /*yield*/, this._withRetries(function (db) { return _deleteObject(db, key); })];
|
|
1081
|
+
case 1:
|
|
1082
|
+
_a.sent();
|
|
1083
|
+
delete this.localCache[key];
|
|
1084
|
+
return [2 /*return*/, this.notifyServiceWorker(key)];
|
|
2017
1085
|
}
|
|
1086
|
+
});
|
|
1087
|
+
}); })];
|
|
1088
|
+
});
|
|
1089
|
+
});
|
|
1090
|
+
};
|
|
1091
|
+
IndexedDBLocalPersistence.prototype._poll = function () {
|
|
1092
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1093
|
+
var result, keys, keysInResult, _i, result_1, _a, key, value, _b, _c, localKey;
|
|
1094
|
+
return tslib.__generator(this, function (_d) {
|
|
1095
|
+
switch (_d.label) {
|
|
1096
|
+
case 0: return [4 /*yield*/, this._withRetries(function (db) {
|
|
1097
|
+
var getAllRequest = getObjectStore(db, false).getAll();
|
|
1098
|
+
return new DBPromise(getAllRequest).toPromise();
|
|
2018
1099
|
})];
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
1100
|
+
case 1:
|
|
1101
|
+
result = _d.sent();
|
|
1102
|
+
if (!result) {
|
|
1103
|
+
return [2 /*return*/, []];
|
|
1104
|
+
}
|
|
1105
|
+
// If we have pending writes in progress abort, we'll get picked up on the next poll
|
|
1106
|
+
if (this.pendingWrites !== 0) {
|
|
1107
|
+
return [2 /*return*/, []];
|
|
1108
|
+
}
|
|
1109
|
+
keys = [];
|
|
1110
|
+
keysInResult = new Set();
|
|
1111
|
+
for (_i = 0, result_1 = result; _i < result_1.length; _i++) {
|
|
1112
|
+
_a = result_1[_i], key = _a.fbase_key, value = _a.value;
|
|
1113
|
+
keysInResult.add(key);
|
|
1114
|
+
if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) {
|
|
1115
|
+
this.notifyListeners(key, value);
|
|
1116
|
+
keys.push(key);
|
|
2032
1117
|
}
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
case 9: return [3 /*break*/, 11];
|
|
2046
|
-
case 10:
|
|
2047
|
-
verifier._reset();
|
|
2048
|
-
return [7 /*endfinally*/];
|
|
2049
|
-
case 11: return [2 /*return*/];
|
|
2050
|
-
}
|
|
1118
|
+
}
|
|
1119
|
+
for (_b = 0, _c = Object.keys(this.localCache); _b < _c.length; _b++) {
|
|
1120
|
+
localKey = _c[_b];
|
|
1121
|
+
if (this.localCache[localKey] && !keysInResult.has(localKey)) {
|
|
1122
|
+
// Deleted
|
|
1123
|
+
this.notifyListeners(localKey, null);
|
|
1124
|
+
keys.push(localKey);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
return [2 /*return*/, keys];
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
2051
1130
|
});
|
|
2052
|
-
}
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
* const applicationVerifier = new RecaptchaVerifier('recaptcha-container');
|
|
2061
|
-
* const provider = new PhoneAuthProvider(auth);
|
|
2062
|
-
* const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);
|
|
2063
|
-
* // Obtain the verificationCode from the user.
|
|
2064
|
-
* const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
|
|
2065
|
-
* await updatePhoneNumber(user, phoneCredential);
|
|
2066
|
-
* ```
|
|
2067
|
-
*
|
|
2068
|
-
* @param user - The user.
|
|
2069
|
-
* @param credential - A credential authenticating the new phone number.
|
|
2070
|
-
*
|
|
2071
|
-
* @public
|
|
2072
|
-
*/
|
|
2073
|
-
function updatePhoneNumber(user, credential) {
|
|
2074
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2075
|
-
return tslib.__generator(this, function (_a) {
|
|
2076
|
-
switch (_a.label) {
|
|
2077
|
-
case 0: return [4 /*yield*/, enum_maps._link(util.getModularInstance(user), credential)];
|
|
2078
|
-
case 1:
|
|
2079
|
-
_a.sent();
|
|
2080
|
-
return [2 /*return*/];
|
|
1131
|
+
};
|
|
1132
|
+
IndexedDBLocalPersistence.prototype.notifyListeners = function (key, newValue) {
|
|
1133
|
+
this.localCache[key] = newValue;
|
|
1134
|
+
var listeners = this.listeners[key];
|
|
1135
|
+
if (listeners) {
|
|
1136
|
+
for (var _i = 0, _a = Array.from(listeners); _i < _a.length; _i++) {
|
|
1137
|
+
var listener = _a[_i];
|
|
1138
|
+
listener(newValue);
|
|
2081
1139
|
}
|
|
2082
|
-
}
|
|
2083
|
-
});
|
|
2084
|
-
}
|
|
2085
|
-
|
|
2086
|
-
/**
|
|
2087
|
-
* @license
|
|
2088
|
-
* Copyright 2020 Google LLC
|
|
2089
|
-
*
|
|
2090
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2091
|
-
* you may not use this file except in compliance with the License.
|
|
2092
|
-
* You may obtain a copy of the License at
|
|
2093
|
-
*
|
|
2094
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2095
|
-
*
|
|
2096
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2097
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2098
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2099
|
-
* See the License for the specific language governing permissions and
|
|
2100
|
-
* limitations under the License.
|
|
2101
|
-
*/
|
|
2102
|
-
/**
|
|
2103
|
-
* Provider for generating an {@link PhoneAuthCredential}.
|
|
2104
|
-
*
|
|
2105
|
-
* @example
|
|
2106
|
-
* ```javascript
|
|
2107
|
-
* // 'recaptcha-container' is the ID of an element in the DOM.
|
|
2108
|
-
* const applicationVerifier = new RecaptchaVerifier('recaptcha-container');
|
|
2109
|
-
* const provider = new PhoneAuthProvider(auth);
|
|
2110
|
-
* const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);
|
|
2111
|
-
* // Obtain the verificationCode from the user.
|
|
2112
|
-
* const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
|
|
2113
|
-
* const userCredential = await signInWithCredential(auth, phoneCredential);
|
|
2114
|
-
* ```
|
|
2115
|
-
*
|
|
2116
|
-
* @public
|
|
2117
|
-
*/
|
|
2118
|
-
var PhoneAuthProvider = /** @class */ (function () {
|
|
2119
|
-
/**
|
|
2120
|
-
* @param auth - The Firebase {@link Auth} instance in which sign-ins should occur.
|
|
2121
|
-
*
|
|
2122
|
-
*/
|
|
2123
|
-
function PhoneAuthProvider(auth) {
|
|
2124
|
-
/** Always set to {@link ProviderId}.PHONE. */
|
|
2125
|
-
this.providerId = PhoneAuthProvider.PROVIDER_ID;
|
|
2126
|
-
this.auth = enum_maps._castAuth(auth);
|
|
2127
|
-
}
|
|
2128
|
-
/**
|
|
2129
|
-
*
|
|
2130
|
-
* Starts a phone number authentication flow by sending a verification code to the given phone
|
|
2131
|
-
* number.
|
|
2132
|
-
*
|
|
2133
|
-
* @example
|
|
2134
|
-
* ```javascript
|
|
2135
|
-
* const provider = new PhoneAuthProvider(auth);
|
|
2136
|
-
* const verificationId = await provider.verifyPhoneNumber(phoneNumber, applicationVerifier);
|
|
2137
|
-
* // Obtain verificationCode from the user.
|
|
2138
|
-
* const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
|
|
2139
|
-
* const userCredential = await signInWithCredential(auth, authCredential);
|
|
2140
|
-
* ```
|
|
2141
|
-
*
|
|
2142
|
-
* @example
|
|
2143
|
-
* An alternative flow is provided using the `signInWithPhoneNumber` method.
|
|
2144
|
-
* ```javascript
|
|
2145
|
-
* const confirmationResult = signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
|
|
2146
|
-
* // Obtain verificationCode from the user.
|
|
2147
|
-
* const userCredential = confirmationResult.confirm(verificationCode);
|
|
2148
|
-
* ```
|
|
2149
|
-
*
|
|
2150
|
-
* @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in
|
|
2151
|
-
* E.164 format (e.g. +16505550101).
|
|
2152
|
-
* @param applicationVerifier - For abuse prevention, this method also requires a
|
|
2153
|
-
* {@link ApplicationVerifier}. This SDK includes a reCAPTCHA-based implementation,
|
|
2154
|
-
* {@link RecaptchaVerifier}.
|
|
2155
|
-
*
|
|
2156
|
-
* @returns A Promise for a verification ID that can be passed to
|
|
2157
|
-
* {@link PhoneAuthProvider.credential} to identify this flow..
|
|
2158
|
-
*/
|
|
2159
|
-
PhoneAuthProvider.prototype.verifyPhoneNumber = function (phoneOptions, applicationVerifier) {
|
|
2160
|
-
return _verifyPhoneNumber(this.auth, phoneOptions, util.getModularInstance(applicationVerifier));
|
|
1140
|
+
}
|
|
2161
1141
|
};
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
* ```javascript
|
|
2169
|
-
* const provider = new PhoneAuthProvider(auth);
|
|
2170
|
-
* const verificationId = provider.verifyPhoneNumber(phoneNumber, applicationVerifier);
|
|
2171
|
-
* // Obtain verificationCode from the user.
|
|
2172
|
-
* const authCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
|
|
2173
|
-
* const userCredential = signInWithCredential(auth, authCredential);
|
|
2174
|
-
* ```
|
|
2175
|
-
*
|
|
2176
|
-
* @example
|
|
2177
|
-
* An alternative flow is provided using the `signInWithPhoneNumber` method.
|
|
2178
|
-
* ```javascript
|
|
2179
|
-
* const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
|
|
2180
|
-
* // Obtain verificationCode from the user.
|
|
2181
|
-
* const userCredential = await confirmationResult.confirm(verificationCode);
|
|
2182
|
-
* ```
|
|
2183
|
-
*
|
|
2184
|
-
* @param verificationId - The verification ID returned from {@link PhoneAuthProvider.verifyPhoneNumber}.
|
|
2185
|
-
* @param verificationCode - The verification code sent to the user's mobile device.
|
|
2186
|
-
*
|
|
2187
|
-
* @returns The auth provider credential.
|
|
2188
|
-
*/
|
|
2189
|
-
PhoneAuthProvider.credential = function (verificationId, verificationCode) {
|
|
2190
|
-
return enum_maps.PhoneAuthCredential._fromVerification(verificationId, verificationCode);
|
|
1142
|
+
IndexedDBLocalPersistence.prototype.startPolling = function () {
|
|
1143
|
+
var _this = this;
|
|
1144
|
+
this.stopPolling();
|
|
1145
|
+
this.pollTimer = setInterval(function () { return tslib.__awaiter(_this, void 0, void 0, function () { return tslib.__generator(this, function (_a) {
|
|
1146
|
+
return [2 /*return*/, this._poll()];
|
|
1147
|
+
}); }); }, _POLLING_INTERVAL_MS);
|
|
2191
1148
|
};
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
var credential = userCredential;
|
|
2198
|
-
return PhoneAuthProvider.credentialFromTaggedObject(credential);
|
|
1149
|
+
IndexedDBLocalPersistence.prototype.stopPolling = function () {
|
|
1150
|
+
if (this.pollTimer) {
|
|
1151
|
+
clearInterval(this.pollTimer);
|
|
1152
|
+
this.pollTimer = null;
|
|
1153
|
+
}
|
|
2199
1154
|
};
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
* fails, links the user with the account associated with that number:
|
|
2211
|
-
*
|
|
2212
|
-
* ```js
|
|
2213
|
-
* const provider = new PhoneAuthProvider(auth);
|
|
2214
|
-
* const verificationId = await provider.verifyPhoneNumber(number, verifier);
|
|
2215
|
-
* try {
|
|
2216
|
-
* const code = ''; // Prompt the user for the verification code
|
|
2217
|
-
* await updatePhoneNumber(
|
|
2218
|
-
* auth.currentUser,
|
|
2219
|
-
* PhoneAuthProvider.credential(verificationId, code));
|
|
2220
|
-
* } catch (e) {
|
|
2221
|
-
* if (e.code === 'auth/account-exists-with-different-credential') {
|
|
2222
|
-
* const cred = PhoneAuthProvider.credentialFromError(e);
|
|
2223
|
-
* await linkWithCredential(auth.currentUser, cred);
|
|
2224
|
-
* }
|
|
2225
|
-
* }
|
|
2226
|
-
*
|
|
2227
|
-
* // At this point, auth.currentUser.phoneNumber === number.
|
|
2228
|
-
* ```
|
|
2229
|
-
*
|
|
2230
|
-
* @param error - The error to generate a credential from.
|
|
2231
|
-
*/
|
|
2232
|
-
PhoneAuthProvider.credentialFromError = function (error) {
|
|
2233
|
-
return PhoneAuthProvider.credentialFromTaggedObject((error.customData || {}));
|
|
1155
|
+
IndexedDBLocalPersistence.prototype._addListener = function (key, listener) {
|
|
1156
|
+
if (Object.keys(this.listeners).length === 0) {
|
|
1157
|
+
this.startPolling();
|
|
1158
|
+
}
|
|
1159
|
+
if (!this.listeners[key]) {
|
|
1160
|
+
this.listeners[key] = new Set();
|
|
1161
|
+
// Populate the cache to avoid spuriously triggering on first poll.
|
|
1162
|
+
void this._get(key); // This can happen in the background async and we can return immediately.
|
|
1163
|
+
}
|
|
1164
|
+
this.listeners[key].add(listener);
|
|
2234
1165
|
};
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
1166
|
+
IndexedDBLocalPersistence.prototype._removeListener = function (key, listener) {
|
|
1167
|
+
if (this.listeners[key]) {
|
|
1168
|
+
this.listeners[key].delete(listener);
|
|
1169
|
+
if (this.listeners[key].size === 0) {
|
|
1170
|
+
delete this.listeners[key];
|
|
1171
|
+
}
|
|
2239
1172
|
}
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
return enum_maps.PhoneAuthCredential._fromTokenResponse(phoneNumber, temporaryProof);
|
|
1173
|
+
if (Object.keys(this.listeners).length === 0) {
|
|
1174
|
+
this.stopPolling();
|
|
2243
1175
|
}
|
|
2244
|
-
return null;
|
|
2245
1176
|
};
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
1177
|
+
IndexedDBLocalPersistence.type = 'LOCAL';
|
|
1178
|
+
return IndexedDBLocalPersistence;
|
|
1179
|
+
}());
|
|
1180
|
+
/**
|
|
1181
|
+
* An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`
|
|
1182
|
+
* for the underlying storage.
|
|
1183
|
+
*
|
|
1184
|
+
* @public
|
|
1185
|
+
*/
|
|
1186
|
+
var indexedDBLocalPersistence = IndexedDBLocalPersistence;
|
|
2252
1187
|
|
|
2253
1188
|
/**
|
|
2254
1189
|
* @license
|
|
@@ -2273,9 +1208,9 @@ var PhoneAuthProvider = /** @class */ (function () {
|
|
|
2273
1208
|
*/
|
|
2274
1209
|
function _withDefaultResolver(auth, resolverOverride) {
|
|
2275
1210
|
if (resolverOverride) {
|
|
2276
|
-
return
|
|
1211
|
+
return phone._getInstance(resolverOverride);
|
|
2277
1212
|
}
|
|
2278
|
-
|
|
1213
|
+
phone._assert(auth._popupRedirectResolver, auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
2279
1214
|
return auth._popupRedirectResolver;
|
|
2280
1215
|
}
|
|
2281
1216
|
|
|
@@ -2303,13 +1238,13 @@ var IdpCredential = /** @class */ (function (_super) {
|
|
|
2303
1238
|
return _this;
|
|
2304
1239
|
}
|
|
2305
1240
|
IdpCredential.prototype._getIdTokenResponse = function (auth) {
|
|
2306
|
-
return
|
|
1241
|
+
return phone.signInWithIdp(auth, this._buildIdpRequest());
|
|
2307
1242
|
};
|
|
2308
1243
|
IdpCredential.prototype._linkToIdToken = function (auth, idToken) {
|
|
2309
|
-
return
|
|
1244
|
+
return phone.signInWithIdp(auth, this._buildIdpRequest(idToken));
|
|
2310
1245
|
};
|
|
2311
1246
|
IdpCredential.prototype._getReauthenticationResolver = function (auth) {
|
|
2312
|
-
return
|
|
1247
|
+
return phone.signInWithIdp(auth, this._buildIdpRequest());
|
|
2313
1248
|
};
|
|
2314
1249
|
IdpCredential.prototype._buildIdpRequest = function (idToken) {
|
|
2315
1250
|
var request = {
|
|
@@ -2327,22 +1262,22 @@ var IdpCredential = /** @class */ (function (_super) {
|
|
|
2327
1262
|
return request;
|
|
2328
1263
|
};
|
|
2329
1264
|
return IdpCredential;
|
|
2330
|
-
}(
|
|
1265
|
+
}(phone.AuthCredential));
|
|
2331
1266
|
function _signIn(params) {
|
|
2332
|
-
return
|
|
1267
|
+
return phone._signInWithCredential(params.auth, new IdpCredential(params), params.bypassAuthState);
|
|
2333
1268
|
}
|
|
2334
1269
|
function _reauth(params) {
|
|
2335
1270
|
var auth = params.auth, user = params.user;
|
|
2336
|
-
|
|
2337
|
-
return
|
|
1271
|
+
phone._assert(user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1272
|
+
return phone._reauthenticate(user, new IdpCredential(params), params.bypassAuthState);
|
|
2338
1273
|
}
|
|
2339
1274
|
function _link(params) {
|
|
2340
1275
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2341
1276
|
var auth, user;
|
|
2342
1277
|
return tslib.__generator(this, function (_a) {
|
|
2343
1278
|
auth = params.auth, user = params.user;
|
|
2344
|
-
|
|
2345
|
-
return [2 /*return*/,
|
|
1279
|
+
phone._assert(user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1280
|
+
return [2 /*return*/, phone._link(user, new IdpCredential(params), params.bypassAuthState)];
|
|
2346
1281
|
});
|
|
2347
1282
|
});
|
|
2348
1283
|
}
|
|
@@ -2459,16 +1394,16 @@ var AbstractPopupRedirectOperation = /** @class */ (function () {
|
|
|
2459
1394
|
case "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */:
|
|
2460
1395
|
return _reauth;
|
|
2461
1396
|
default:
|
|
2462
|
-
|
|
1397
|
+
phone._fail(this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2463
1398
|
}
|
|
2464
1399
|
};
|
|
2465
1400
|
AbstractPopupRedirectOperation.prototype.resolve = function (cred) {
|
|
2466
|
-
|
|
1401
|
+
phone.debugAssert(this.pendingPromise, 'Pending promise was never set');
|
|
2467
1402
|
this.pendingPromise.resolve(cred);
|
|
2468
1403
|
this.unregisterAndCleanUp();
|
|
2469
1404
|
};
|
|
2470
1405
|
AbstractPopupRedirectOperation.prototype.reject = function (error) {
|
|
2471
|
-
|
|
1406
|
+
phone.debugAssert(this.pendingPromise, 'Pending promise was never set');
|
|
2472
1407
|
this.pendingPromise.reject(error);
|
|
2473
1408
|
this.unregisterAndCleanUp();
|
|
2474
1409
|
};
|
|
@@ -2498,7 +1433,7 @@ var AbstractPopupRedirectOperation = /** @class */ (function () {
|
|
|
2498
1433
|
* See the License for the specific language governing permissions and
|
|
2499
1434
|
* limitations under the License.
|
|
2500
1435
|
*/
|
|
2501
|
-
var _POLL_WINDOW_CLOSE_TIMEOUT = new
|
|
1436
|
+
var _POLL_WINDOW_CLOSE_TIMEOUT = new phone.Delay(2000, 10000);
|
|
2502
1437
|
/**
|
|
2503
1438
|
* Authenticates a Firebase client using a popup-based OAuth authentication flow.
|
|
2504
1439
|
*
|
|
@@ -2532,8 +1467,8 @@ function signInWithPopup(auth, provider, resolver) {
|
|
|
2532
1467
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2533
1468
|
var authInternal, resolverInternal, action;
|
|
2534
1469
|
return tslib.__generator(this, function (_a) {
|
|
2535
|
-
authInternal =
|
|
2536
|
-
|
|
1470
|
+
authInternal = phone._castAuth(auth);
|
|
1471
|
+
phone._assertInstanceOf(auth, provider, phone.FederatedAuthProvider);
|
|
2537
1472
|
resolverInternal = _withDefaultResolver(authInternal, resolver);
|
|
2538
1473
|
action = new PopupOperation(authInternal, "signInViaPopup" /* SIGN_IN_VIA_POPUP */, provider, resolverInternal);
|
|
2539
1474
|
return [2 /*return*/, action.executeNotNull()];
|
|
@@ -2570,7 +1505,7 @@ function reauthenticateWithPopup(user, provider, resolver) {
|
|
|
2570
1505
|
var userInternal, resolverInternal, action;
|
|
2571
1506
|
return tslib.__generator(this, function (_a) {
|
|
2572
1507
|
userInternal = util.getModularInstance(user);
|
|
2573
|
-
|
|
1508
|
+
phone._assertInstanceOf(userInternal.auth, provider, phone.FederatedAuthProvider);
|
|
2574
1509
|
resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
|
|
2575
1510
|
action = new PopupOperation(userInternal.auth, "reauthViaPopup" /* REAUTH_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
2576
1511
|
return [2 /*return*/, action.executeNotNull()];
|
|
@@ -2606,7 +1541,7 @@ function linkWithPopup(user, provider, resolver) {
|
|
|
2606
1541
|
var userInternal, resolverInternal, action;
|
|
2607
1542
|
return tslib.__generator(this, function (_a) {
|
|
2608
1543
|
userInternal = util.getModularInstance(user);
|
|
2609
|
-
|
|
1544
|
+
phone._assertInstanceOf(userInternal.auth, provider, phone.FederatedAuthProvider);
|
|
2610
1545
|
resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
|
|
2611
1546
|
action = new PopupOperation(userInternal.auth, "linkViaPopup" /* LINK_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
2612
1547
|
return [2 /*return*/, action.executeNotNull()];
|
|
@@ -2639,7 +1574,7 @@ var PopupOperation = /** @class */ (function (_super) {
|
|
|
2639
1574
|
case 0: return [4 /*yield*/, this.execute()];
|
|
2640
1575
|
case 1:
|
|
2641
1576
|
result = _a.sent();
|
|
2642
|
-
|
|
1577
|
+
phone._assert(result, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2643
1578
|
return [2 /*return*/, result];
|
|
2644
1579
|
}
|
|
2645
1580
|
});
|
|
@@ -2652,7 +1587,7 @@ var PopupOperation = /** @class */ (function (_super) {
|
|
|
2652
1587
|
return tslib.__generator(this, function (_b) {
|
|
2653
1588
|
switch (_b.label) {
|
|
2654
1589
|
case 0:
|
|
2655
|
-
|
|
1590
|
+
phone.debugAssert(this.filter.length === 1, 'Popup operations only handle one event');
|
|
2656
1591
|
eventId = _generateEventId();
|
|
2657
1592
|
_a = this;
|
|
2658
1593
|
return [4 /*yield*/, this.resolver._openPopup(this.auth, this.provider, this.filter[0], // There's always one, see constructor
|
|
@@ -2672,7 +1607,7 @@ var PopupOperation = /** @class */ (function (_super) {
|
|
|
2672
1607
|
});
|
|
2673
1608
|
this.resolver._isIframeWebStorageSupported(this.auth, function (isSupported) {
|
|
2674
1609
|
if (!isSupported) {
|
|
2675
|
-
_this.reject(
|
|
1610
|
+
_this.reject(phone._createError(_this.auth, "web-storage-unsupported" /* WEB_STORAGE_UNSUPPORTED */));
|
|
2676
1611
|
}
|
|
2677
1612
|
});
|
|
2678
1613
|
// Handle user closure. Notice this does *not* use await
|
|
@@ -2691,7 +1626,7 @@ var PopupOperation = /** @class */ (function (_super) {
|
|
|
2691
1626
|
configurable: true
|
|
2692
1627
|
});
|
|
2693
1628
|
PopupOperation.prototype.cancel = function () {
|
|
2694
|
-
this.reject(
|
|
1629
|
+
this.reject(phone._createError(this.auth, "cancelled-popup-request" /* EXPIRED_POPUP_REQUEST */));
|
|
2695
1630
|
};
|
|
2696
1631
|
PopupOperation.prototype.cleanUp = function () {
|
|
2697
1632
|
if (this.authWindow) {
|
|
@@ -2714,7 +1649,7 @@ var PopupOperation = /** @class */ (function (_super) {
|
|
|
2714
1649
|
// call could still be in flight.
|
|
2715
1650
|
_this.pollId = window.setTimeout(function () {
|
|
2716
1651
|
_this.pollId = null;
|
|
2717
|
-
_this.reject(
|
|
1652
|
+
_this.reject(phone._createError(_this.auth, "popup-closed-by-user" /* POPUP_CLOSED_BY_USER */));
|
|
2718
1653
|
}, 2000 /* AUTH_EVENT */);
|
|
2719
1654
|
return;
|
|
2720
1655
|
}
|
|
@@ -2850,16 +1785,22 @@ var RedirectAction = /** @class */ (function (_super) {
|
|
|
2850
1785
|
}(AbstractPopupRedirectOperation));
|
|
2851
1786
|
function _getAndClearPendingRedirectStatus(resolver, auth) {
|
|
2852
1787
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2853
|
-
var key, hasPendingRedirect;
|
|
1788
|
+
var key, persistence, hasPendingRedirect;
|
|
2854
1789
|
return tslib.__generator(this, function (_a) {
|
|
2855
1790
|
switch (_a.label) {
|
|
2856
1791
|
case 0:
|
|
2857
1792
|
key = pendingRedirectKey(auth);
|
|
2858
|
-
|
|
1793
|
+
persistence = resolverPersistence(resolver);
|
|
1794
|
+
return [4 /*yield*/, persistence._isAvailable()];
|
|
2859
1795
|
case 1:
|
|
2860
|
-
|
|
2861
|
-
|
|
1796
|
+
if (!(_a.sent())) {
|
|
1797
|
+
return [2 /*return*/, false];
|
|
1798
|
+
}
|
|
1799
|
+
return [4 /*yield*/, persistence._get(key)];
|
|
2862
1800
|
case 2:
|
|
1801
|
+
hasPendingRedirect = (_a.sent()) === 'true';
|
|
1802
|
+
return [4 /*yield*/, persistence._remove(key)];
|
|
1803
|
+
case 3:
|
|
2863
1804
|
_a.sent();
|
|
2864
1805
|
return [2 /*return*/, hasPendingRedirect];
|
|
2865
1806
|
}
|
|
@@ -2877,10 +1818,10 @@ function _clearRedirectOutcomes() {
|
|
|
2877
1818
|
redirectOutcomeMap.clear();
|
|
2878
1819
|
}
|
|
2879
1820
|
function resolverPersistence(resolver) {
|
|
2880
|
-
return
|
|
1821
|
+
return phone._getInstance(resolver._redirectPersistence);
|
|
2881
1822
|
}
|
|
2882
1823
|
function pendingRedirectKey(auth) {
|
|
2883
|
-
return
|
|
1824
|
+
return phone._persistenceKeyName(PENDING_REDIRECT_KEY, auth.config.apiKey, auth.name);
|
|
2884
1825
|
}
|
|
2885
1826
|
|
|
2886
1827
|
/**
|
|
@@ -2947,8 +1888,8 @@ function _signInWithRedirect(auth, provider, resolver) {
|
|
|
2947
1888
|
return tslib.__generator(this, function (_a) {
|
|
2948
1889
|
switch (_a.label) {
|
|
2949
1890
|
case 0:
|
|
2950
|
-
authInternal =
|
|
2951
|
-
|
|
1891
|
+
authInternal = phone._castAuth(auth);
|
|
1892
|
+
phone._assertInstanceOf(auth, provider, phone.FederatedAuthProvider);
|
|
2952
1893
|
resolverInternal = _withDefaultResolver(authInternal, resolver);
|
|
2953
1894
|
return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, authInternal)];
|
|
2954
1895
|
case 1:
|
|
@@ -2996,7 +1937,7 @@ function _reauthenticateWithRedirect(user, provider, resolver) {
|
|
|
2996
1937
|
switch (_a.label) {
|
|
2997
1938
|
case 0:
|
|
2998
1939
|
userInternal = util.getModularInstance(user);
|
|
2999
|
-
|
|
1940
|
+
phone._assertInstanceOf(userInternal.auth, provider, phone.FederatedAuthProvider);
|
|
3000
1941
|
resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
|
|
3001
1942
|
return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, userInternal.auth)];
|
|
3002
1943
|
case 1:
|
|
@@ -3044,9 +1985,9 @@ function _linkWithRedirect(user, provider, resolver) {
|
|
|
3044
1985
|
switch (_a.label) {
|
|
3045
1986
|
case 0:
|
|
3046
1987
|
userInternal = util.getModularInstance(user);
|
|
3047
|
-
|
|
1988
|
+
phone._assertInstanceOf(userInternal.auth, provider, phone.FederatedAuthProvider);
|
|
3048
1989
|
resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
|
|
3049
|
-
return [4 /*yield*/,
|
|
1990
|
+
return [4 /*yield*/, phone._assertLinkedStatus(false, userInternal, provider.providerId)];
|
|
3050
1991
|
case 1:
|
|
3051
1992
|
_a.sent();
|
|
3052
1993
|
return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, userInternal.auth)];
|
|
@@ -3103,7 +2044,7 @@ function getRedirectResult(auth, resolver) {
|
|
|
3103
2044
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3104
2045
|
return tslib.__generator(this, function (_a) {
|
|
3105
2046
|
switch (_a.label) {
|
|
3106
|
-
case 0: return [4 /*yield*/,
|
|
2047
|
+
case 0: return [4 /*yield*/, phone._castAuth(auth)._initializationPromise];
|
|
3107
2048
|
case 1:
|
|
3108
2049
|
_a.sent();
|
|
3109
2050
|
return [2 /*return*/, _getRedirectResult(auth, resolver, false)];
|
|
@@ -3118,7 +2059,7 @@ function _getRedirectResult(auth, resolverExtern, bypassAuthState) {
|
|
|
3118
2059
|
return tslib.__generator(this, function (_a) {
|
|
3119
2060
|
switch (_a.label) {
|
|
3120
2061
|
case 0:
|
|
3121
|
-
authInternal =
|
|
2062
|
+
authInternal = phone._castAuth(auth);
|
|
3122
2063
|
resolver = _withDefaultResolver(authInternal, resolverExtern);
|
|
3123
2064
|
action = new RedirectAction(authInternal, resolver, bypassAuthState);
|
|
3124
2065
|
return [4 /*yield*/, action.execute()];
|
|
@@ -3230,7 +2171,7 @@ var AuthEventManager = /** @class */ (function () {
|
|
|
3230
2171
|
if (event.error && !isNullRedirectEvent(event)) {
|
|
3231
2172
|
var code = ((_a = event.error.code) === null || _a === void 0 ? void 0 : _a.split('auth/')[1]) ||
|
|
3232
2173
|
"internal-error" /* INTERNAL_ERROR */;
|
|
3233
|
-
consumer.onError(
|
|
2174
|
+
consumer.onError(phone._createError(this.auth, code));
|
|
3234
2175
|
}
|
|
3235
2176
|
else {
|
|
3236
2177
|
consumer.onAuthEvent(event);
|
|
@@ -3295,7 +2236,7 @@ function _getProjectConfig(auth, request) {
|
|
|
3295
2236
|
if (request === void 0) { request = {}; }
|
|
3296
2237
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3297
2238
|
return tslib.__generator(this, function (_a) {
|
|
3298
|
-
return [2 /*return*/,
|
|
2239
|
+
return [2 /*return*/, phone._performApiRequest(auth, "GET" /* GET */, "/v1/projects" /* GET_PROJECT_CONFIG */, request)];
|
|
3299
2240
|
});
|
|
3300
2241
|
});
|
|
3301
2242
|
}
|
|
@@ -3343,14 +2284,14 @@ function _validateOrigin$1(auth) {
|
|
|
3343
2284
|
}
|
|
3344
2285
|
}
|
|
3345
2286
|
// In the old SDK, this error also provides helpful messages.
|
|
3346
|
-
|
|
2287
|
+
phone._fail(auth, "unauthorized-domain" /* INVALID_ORIGIN */);
|
|
3347
2288
|
return [2 /*return*/];
|
|
3348
2289
|
}
|
|
3349
2290
|
});
|
|
3350
2291
|
});
|
|
3351
2292
|
}
|
|
3352
2293
|
function matchDomain(expected) {
|
|
3353
|
-
var currentUrl =
|
|
2294
|
+
var currentUrl = phone._getCurrentUrl();
|
|
3354
2295
|
var _a = new URL(currentUrl), protocol = _a.protocol, hostname = _a.hostname;
|
|
3355
2296
|
if (expected.startsWith('chrome-extension://')) {
|
|
3356
2297
|
var ceUrl = new URL(expected);
|
|
@@ -3394,7 +2335,7 @@ function matchDomain(expected) {
|
|
|
3394
2335
|
* See the License for the specific language governing permissions and
|
|
3395
2336
|
* limitations under the License.
|
|
3396
2337
|
*/
|
|
3397
|
-
var NETWORK_TIMEOUT = new
|
|
2338
|
+
var NETWORK_TIMEOUT = new phone.Delay(30000, 60000);
|
|
3398
2339
|
/**
|
|
3399
2340
|
* Reset unlaoded GApi modules. If gapi.load fails due to a network error,
|
|
3400
2341
|
* it will stop working after a retrial. This is a hack to fix this issue.
|
|
@@ -3403,7 +2344,7 @@ function resetUnloadedGapiModules() {
|
|
|
3403
2344
|
// Clear last failed gapi.load state to force next gapi.load to first
|
|
3404
2345
|
// load the failed gapi.iframes module.
|
|
3405
2346
|
// Get gapix.beacon context.
|
|
3406
|
-
var beacon = _window().___jsl;
|
|
2347
|
+
var beacon = phone._window().___jsl;
|
|
3407
2348
|
// Get current hint.
|
|
3408
2349
|
if (beacon === null || beacon === void 0 ? void 0 : beacon.H) {
|
|
3409
2350
|
// Get gapi hint.
|
|
@@ -3445,16 +2386,16 @@ function loadGapi(auth) {
|
|
|
3445
2386
|
// failed attempt.
|
|
3446
2387
|
// Timeout when gapi.iframes.Iframe not loaded.
|
|
3447
2388
|
resetUnloadedGapiModules();
|
|
3448
|
-
reject(
|
|
2389
|
+
reject(phone._createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
3449
2390
|
},
|
|
3450
2391
|
timeout: NETWORK_TIMEOUT.get()
|
|
3451
2392
|
});
|
|
3452
2393
|
}
|
|
3453
|
-
if ((_b = (_a = _window().gapi) === null || _a === void 0 ? void 0 : _a.iframes) === null || _b === void 0 ? void 0 : _b.Iframe) {
|
|
2394
|
+
if ((_b = (_a = phone._window().gapi) === null || _a === void 0 ? void 0 : _a.iframes) === null || _b === void 0 ? void 0 : _b.Iframe) {
|
|
3454
2395
|
// If gapi.iframes.Iframe available, resolve.
|
|
3455
2396
|
resolve(gapi.iframes.getContext());
|
|
3456
2397
|
}
|
|
3457
|
-
else if (!!((_c = _window().gapi) === null || _c === void 0 ? void 0 : _c.load)) {
|
|
2398
|
+
else if (!!((_c = phone._window().gapi) === null || _c === void 0 ? void 0 : _c.load)) {
|
|
3458
2399
|
// Gapi loader ready, load gapi.iframes.
|
|
3459
2400
|
loadGapiIframe();
|
|
3460
2401
|
}
|
|
@@ -3464,20 +2405,20 @@ function loadGapi(auth) {
|
|
|
3464
2405
|
// multiple times in parallel and could result in the later callback
|
|
3465
2406
|
// overwriting the previous one. This would end up with a iframe
|
|
3466
2407
|
// timeout.
|
|
3467
|
-
var cbName = _generateCallbackName('iframefcb');
|
|
2408
|
+
var cbName = phone._generateCallbackName('iframefcb');
|
|
3468
2409
|
// GApi loader not available, dynamically load platform.js.
|
|
3469
|
-
_window()[cbName] = function () {
|
|
2410
|
+
phone._window()[cbName] = function () {
|
|
3470
2411
|
// GApi loader should be ready.
|
|
3471
2412
|
if (!!gapi.load) {
|
|
3472
2413
|
loadGapiIframe();
|
|
3473
2414
|
}
|
|
3474
2415
|
else {
|
|
3475
2416
|
// Gapi loader failed, throw error.
|
|
3476
|
-
reject(
|
|
2417
|
+
reject(phone._createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
3477
2418
|
}
|
|
3478
2419
|
};
|
|
3479
2420
|
// Load GApi loader.
|
|
3480
|
-
return _loadJS("https://apis.google.com/js/api.js?onload=" + cbName);
|
|
2421
|
+
return phone._loadJS("https://apis.google.com/js/api.js?onload=" + cbName);
|
|
3481
2422
|
}
|
|
3482
2423
|
}).catch(function (error) {
|
|
3483
2424
|
// Reset cached promise to allow for retrial.
|
|
@@ -3507,7 +2448,7 @@ function _loadGapi(auth) {
|
|
|
3507
2448
|
* See the License for the specific language governing permissions and
|
|
3508
2449
|
* limitations under the License.
|
|
3509
2450
|
*/
|
|
3510
|
-
var PING_TIMEOUT = new
|
|
2451
|
+
var PING_TIMEOUT = new phone.Delay(5000, 15000);
|
|
3511
2452
|
var IFRAME_PATH = '__/auth/iframe';
|
|
3512
2453
|
var EMULATED_IFRAME_PATH = 'emulator/auth/iframe';
|
|
3513
2454
|
var IFRAME_ATTRIBUTES = {
|
|
@@ -3528,9 +2469,9 @@ var EID_FROM_APIHOST = new Map([
|
|
|
3528
2469
|
]);
|
|
3529
2470
|
function getIframeUrl(auth) {
|
|
3530
2471
|
var config = auth.config;
|
|
3531
|
-
|
|
2472
|
+
phone._assert(config.authDomain, auth, "auth-domain-config-required" /* MISSING_AUTH_DOMAIN */);
|
|
3532
2473
|
var url = config.emulator
|
|
3533
|
-
?
|
|
2474
|
+
? phone._emulatorUrl(config, EMULATED_IFRAME_PATH)
|
|
3534
2475
|
: "https://" + auth.config.authDomain + "/" + IFRAME_PATH;
|
|
3535
2476
|
var params = {
|
|
3536
2477
|
apiKey: config.apiKey,
|
|
@@ -3556,8 +2497,8 @@ function _openIframe(auth) {
|
|
|
3556
2497
|
case 0: return [4 /*yield*/, _loadGapi(auth)];
|
|
3557
2498
|
case 1:
|
|
3558
2499
|
context = _a.sent();
|
|
3559
|
-
gapi = _window().gapi;
|
|
3560
|
-
|
|
2500
|
+
gapi = phone._window().gapi;
|
|
2501
|
+
phone._assert(gapi, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3561
2502
|
return [2 /*return*/, context.open({
|
|
3562
2503
|
where: document.body,
|
|
3563
2504
|
url: getIframeUrl(auth),
|
|
@@ -3568,7 +2509,7 @@ function _openIframe(auth) {
|
|
|
3568
2509
|
return new Promise(function (resolve, reject) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
3569
2510
|
// Clear timer and resolve pending iframe ready promise.
|
|
3570
2511
|
function clearTimerAndResolve() {
|
|
3571
|
-
_window().clearTimeout(networkErrorTimer);
|
|
2512
|
+
phone._window().clearTimeout(networkErrorTimer);
|
|
3572
2513
|
resolve(iframe);
|
|
3573
2514
|
}
|
|
3574
2515
|
var networkError, networkErrorTimer;
|
|
@@ -3580,8 +2521,8 @@ function _openIframe(auth) {
|
|
|
3580
2521
|
})];
|
|
3581
2522
|
case 1:
|
|
3582
2523
|
_a.sent();
|
|
3583
|
-
networkError =
|
|
3584
|
-
networkErrorTimer = _window().setTimeout(function () {
|
|
2524
|
+
networkError = phone._createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */);
|
|
2525
|
+
networkErrorTimer = phone._window().setTimeout(function () {
|
|
3585
2526
|
reject(networkError);
|
|
3586
2527
|
}, PING_TIMEOUT.get());
|
|
3587
2528
|
// This returns an IThenable. However the reject part does not call
|
|
@@ -3652,9 +2593,9 @@ function _open(auth, url, name, width, height) {
|
|
|
3652
2593
|
// specified, even though the popup is not necessarily blocked.
|
|
3653
2594
|
var ua = util.getUA().toLowerCase();
|
|
3654
2595
|
if (name) {
|
|
3655
|
-
target =
|
|
2596
|
+
target = phone._isChromeIOS(ua) ? TARGET_BLANK : name;
|
|
3656
2597
|
}
|
|
3657
|
-
if (
|
|
2598
|
+
if (phone._isFirefox(ua)) {
|
|
3658
2599
|
// Firefox complains when invalid URLs are popped out. Hacky way to bypass.
|
|
3659
2600
|
url = url || FIREFOX_EMPTY_URL;
|
|
3660
2601
|
// Firefox disables by default scrolling on popup windows, which can create
|
|
@@ -3665,14 +2606,14 @@ function _open(auth, url, name, width, height) {
|
|
|
3665
2606
|
var key = _a[0], value = _a[1];
|
|
3666
2607
|
return "" + accum + key + "=" + value + ",";
|
|
3667
2608
|
}, '');
|
|
3668
|
-
if (
|
|
2609
|
+
if (phone._isIOSStandalone(ua) && target !== '_self') {
|
|
3669
2610
|
openAsNewWindowIOS(url || '', target);
|
|
3670
2611
|
return new AuthPopup(null);
|
|
3671
2612
|
}
|
|
3672
2613
|
// about:blank getting sanitized causing browsers like IE/Edge to display
|
|
3673
2614
|
// brief error message before redirecting to handler.
|
|
3674
2615
|
var newWin = window.open(url || '', target, optionsString);
|
|
3675
|
-
|
|
2616
|
+
phone._assert(newWin, auth, "popup-blocked" /* POPUP_BLOCKED */);
|
|
3676
2617
|
// Flaky on IE edge, encapsulate with a try and catch.
|
|
3677
2618
|
try {
|
|
3678
2619
|
newWin.focus();
|
|
@@ -3718,8 +2659,8 @@ var WIDGET_PATH = '__/auth/handler';
|
|
|
3718
2659
|
*/
|
|
3719
2660
|
var EMULATOR_WIDGET_PATH = 'emulator/auth/handler';
|
|
3720
2661
|
function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {
|
|
3721
|
-
|
|
3722
|
-
|
|
2662
|
+
phone._assert(auth.config.authDomain, auth, "auth-domain-config-required" /* MISSING_AUTH_DOMAIN */);
|
|
2663
|
+
phone._assert(auth.config.apiKey, auth, "invalid-api-key" /* INVALID_API_KEY */);
|
|
3723
2664
|
var params = {
|
|
3724
2665
|
apiKey: auth.config.apiKey,
|
|
3725
2666
|
appName: auth.name,
|
|
@@ -3728,7 +2669,7 @@ function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additio
|
|
|
3728
2669
|
v: app.SDK_VERSION,
|
|
3729
2670
|
eventId: eventId
|
|
3730
2671
|
};
|
|
3731
|
-
if (provider instanceof
|
|
2672
|
+
if (provider instanceof phone.FederatedAuthProvider) {
|
|
3732
2673
|
provider.setDefaultLanguage(auth.languageCode);
|
|
3733
2674
|
params.providerId = provider.providerId || '';
|
|
3734
2675
|
if (!util.isEmpty(provider.getCustomParameters())) {
|
|
@@ -3740,7 +2681,7 @@ function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additio
|
|
|
3740
2681
|
params[key] = value;
|
|
3741
2682
|
}
|
|
3742
2683
|
}
|
|
3743
|
-
if (provider instanceof
|
|
2684
|
+
if (provider instanceof phone.BaseOAuthProvider) {
|
|
3744
2685
|
var scopes = provider.getScopes().filter(function (scope) { return scope !== ''; });
|
|
3745
2686
|
if (scopes.length > 0) {
|
|
3746
2687
|
params.scopes = scopes.join(',');
|
|
@@ -3765,7 +2706,7 @@ function getHandlerBase(_a) {
|
|
|
3765
2706
|
if (!config.emulator) {
|
|
3766
2707
|
return "https://" + config.authDomain + "/" + WIDGET_PATH;
|
|
3767
2708
|
}
|
|
3768
|
-
return
|
|
2709
|
+
return phone._emulatorUrl(config, EMULATOR_WIDGET_PATH);
|
|
3769
2710
|
}
|
|
3770
2711
|
|
|
3771
2712
|
/**
|
|
@@ -3804,8 +2745,8 @@ var BrowserPopupRedirectResolver = /** @class */ (function () {
|
|
|
3804
2745
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3805
2746
|
var url;
|
|
3806
2747
|
return tslib.__generator(this, function (_b) {
|
|
3807
|
-
|
|
3808
|
-
url = _getRedirectUrl(auth, provider, authType,
|
|
2748
|
+
phone.debugAssert((_a = this.eventManagers[auth._key()]) === null || _a === void 0 ? void 0 : _a.manager, '_initialize() not called before _openPopup()');
|
|
2749
|
+
url = _getRedirectUrl(auth, provider, authType, phone._getCurrentUrl(), eventId);
|
|
3809
2750
|
return [2 /*return*/, _open(auth, url, _generateEventId())];
|
|
3810
2751
|
});
|
|
3811
2752
|
});
|
|
@@ -3817,7 +2758,7 @@ var BrowserPopupRedirectResolver = /** @class */ (function () {
|
|
|
3817
2758
|
case 0: return [4 /*yield*/, this._originValidation(auth)];
|
|
3818
2759
|
case 1:
|
|
3819
2760
|
_a.sent();
|
|
3820
|
-
_setWindowLocation(_getRedirectUrl(auth, provider, authType,
|
|
2761
|
+
phone._setWindowLocation(_getRedirectUrl(auth, provider, authType, phone._getCurrentUrl(), eventId));
|
|
3821
2762
|
return [2 /*return*/, new Promise(function () { })];
|
|
3822
2763
|
}
|
|
3823
2764
|
});
|
|
@@ -3831,7 +2772,7 @@ var BrowserPopupRedirectResolver = /** @class */ (function () {
|
|
|
3831
2772
|
return Promise.resolve(manager);
|
|
3832
2773
|
}
|
|
3833
2774
|
else {
|
|
3834
|
-
|
|
2775
|
+
phone.debugAssert(promise_1, 'If manager is not set, promise should be');
|
|
3835
2776
|
return promise_1;
|
|
3836
2777
|
}
|
|
3837
2778
|
}
|
|
@@ -3849,7 +2790,7 @@ var BrowserPopupRedirectResolver = /** @class */ (function () {
|
|
|
3849
2790
|
iframe = _a.sent();
|
|
3850
2791
|
manager = new AuthEventManager(auth);
|
|
3851
2792
|
iframe.register('authEvent', function (iframeEvent) {
|
|
3852
|
-
|
|
2793
|
+
phone._assert(iframeEvent === null || iframeEvent === void 0 ? void 0 : iframeEvent.authEvent, auth, "invalid-auth-event" /* INVALID_AUTH_EVENT */);
|
|
3853
2794
|
// TODO: Consider splitting redirect and popup events earlier on
|
|
3854
2795
|
var handled = manager.onEvent(iframeEvent.authEvent);
|
|
3855
2796
|
return { status: handled ? "ACK" /* ACK */ : "ERROR" /* ERROR */ };
|
|
@@ -3869,7 +2810,7 @@ var BrowserPopupRedirectResolver = /** @class */ (function () {
|
|
|
3869
2810
|
if (isSupported !== undefined) {
|
|
3870
2811
|
cb(!!isSupported);
|
|
3871
2812
|
}
|
|
3872
|
-
|
|
2813
|
+
phone._fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3873
2814
|
}, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);
|
|
3874
2815
|
};
|
|
3875
2816
|
BrowserPopupRedirectResolver.prototype._originValidation = function (auth) {
|
|
@@ -3882,7 +2823,7 @@ var BrowserPopupRedirectResolver = /** @class */ (function () {
|
|
|
3882
2823
|
Object.defineProperty(BrowserPopupRedirectResolver.prototype, "_shouldInitProactively", {
|
|
3883
2824
|
get: function () {
|
|
3884
2825
|
// Mobile browsers and Safari need to optimistically initialize
|
|
3885
|
-
return
|
|
2826
|
+
return phone._isMobileBrowser() || phone._isSafari() || phone._isIOS();
|
|
3886
2827
|
},
|
|
3887
2828
|
enumerable: false,
|
|
3888
2829
|
configurable: true
|
|
@@ -3897,81 +2838,6 @@ var BrowserPopupRedirectResolver = /** @class */ (function () {
|
|
|
3897
2838
|
*/
|
|
3898
2839
|
var browserPopupRedirectResolver = BrowserPopupRedirectResolver;
|
|
3899
2840
|
|
|
3900
|
-
var MultiFactorAssertionImpl = /** @class */ (function () {
|
|
3901
|
-
function MultiFactorAssertionImpl(factorId) {
|
|
3902
|
-
this.factorId = factorId;
|
|
3903
|
-
}
|
|
3904
|
-
MultiFactorAssertionImpl.prototype._process = function (auth, session, displayName) {
|
|
3905
|
-
switch (session.type) {
|
|
3906
|
-
case "enroll" /* ENROLL */:
|
|
3907
|
-
return this._finalizeEnroll(auth, session.credential, displayName);
|
|
3908
|
-
case "signin" /* SIGN_IN */:
|
|
3909
|
-
return this._finalizeSignIn(auth, session.credential);
|
|
3910
|
-
default:
|
|
3911
|
-
return enum_maps.debugFail('unexpected MultiFactorSessionType');
|
|
3912
|
-
}
|
|
3913
|
-
};
|
|
3914
|
-
return MultiFactorAssertionImpl;
|
|
3915
|
-
}());
|
|
3916
|
-
|
|
3917
|
-
/**
|
|
3918
|
-
* {@inheritdoc PhoneMultiFactorAssertion}
|
|
3919
|
-
*
|
|
3920
|
-
* @public
|
|
3921
|
-
*/
|
|
3922
|
-
var PhoneMultiFactorAssertionImpl = /** @class */ (function (_super) {
|
|
3923
|
-
tslib.__extends(PhoneMultiFactorAssertionImpl, _super);
|
|
3924
|
-
function PhoneMultiFactorAssertionImpl(credential) {
|
|
3925
|
-
var _this = _super.call(this, "phone" /* PHONE */) || this;
|
|
3926
|
-
_this.credential = credential;
|
|
3927
|
-
return _this;
|
|
3928
|
-
}
|
|
3929
|
-
/** @internal */
|
|
3930
|
-
PhoneMultiFactorAssertionImpl._fromCredential = function (credential) {
|
|
3931
|
-
return new PhoneMultiFactorAssertionImpl(credential);
|
|
3932
|
-
};
|
|
3933
|
-
/** @internal */
|
|
3934
|
-
PhoneMultiFactorAssertionImpl.prototype._finalizeEnroll = function (auth, idToken, displayName) {
|
|
3935
|
-
return enum_maps.finalizeEnrollPhoneMfa(auth, {
|
|
3936
|
-
idToken: idToken,
|
|
3937
|
-
displayName: displayName,
|
|
3938
|
-
phoneVerificationInfo: this.credential._makeVerificationRequest()
|
|
3939
|
-
});
|
|
3940
|
-
};
|
|
3941
|
-
/** @internal */
|
|
3942
|
-
PhoneMultiFactorAssertionImpl.prototype._finalizeSignIn = function (auth, mfaPendingCredential) {
|
|
3943
|
-
return finalizeSignInPhoneMfa(auth, {
|
|
3944
|
-
mfaPendingCredential: mfaPendingCredential,
|
|
3945
|
-
phoneVerificationInfo: this.credential._makeVerificationRequest()
|
|
3946
|
-
});
|
|
3947
|
-
};
|
|
3948
|
-
return PhoneMultiFactorAssertionImpl;
|
|
3949
|
-
}(MultiFactorAssertionImpl));
|
|
3950
|
-
/**
|
|
3951
|
-
* Provider for generating a {@link PhoneMultiFactorAssertion}.
|
|
3952
|
-
*
|
|
3953
|
-
* @public
|
|
3954
|
-
*/
|
|
3955
|
-
var PhoneMultiFactorGenerator = /** @class */ (function () {
|
|
3956
|
-
function PhoneMultiFactorGenerator() {
|
|
3957
|
-
}
|
|
3958
|
-
/**
|
|
3959
|
-
* Provides a {@link PhoneMultiFactorAssertion} to confirm ownership of the phone second factor.
|
|
3960
|
-
*
|
|
3961
|
-
* @param phoneAuthCredential - A credential provided by {@link PhoneAuthProvider.credential}.
|
|
3962
|
-
* @returns A {@link PhoneMultiFactorAssertion} which can be used with
|
|
3963
|
-
* {@link MultiFactorResolver.resolveSignIn}
|
|
3964
|
-
*/
|
|
3965
|
-
PhoneMultiFactorGenerator.assertion = function (credential) {
|
|
3966
|
-
return PhoneMultiFactorAssertionImpl._fromCredential(credential);
|
|
3967
|
-
};
|
|
3968
|
-
/**
|
|
3969
|
-
* The identifier of the phone second factor: `phone`.
|
|
3970
|
-
*/
|
|
3971
|
-
PhoneMultiFactorGenerator.FACTOR_ID = 'phone';
|
|
3972
|
-
return PhoneMultiFactorGenerator;
|
|
3973
|
-
}());
|
|
3974
|
-
|
|
3975
2841
|
/**
|
|
3976
2842
|
* @license
|
|
3977
2843
|
* Copyright 2021 Google LLC
|
|
@@ -4002,7 +2868,7 @@ function getAuth(app$1) {
|
|
|
4002
2868
|
if (provider.isInitialized()) {
|
|
4003
2869
|
return provider.getImmediate();
|
|
4004
2870
|
}
|
|
4005
|
-
return
|
|
2871
|
+
return phone.initializeAuth(app$1, {
|
|
4006
2872
|
popupRedirectResolver: browserPopupRedirectResolver,
|
|
4007
2873
|
persistence: [
|
|
4008
2874
|
indexedDBLocalPersistence,
|
|
@@ -4011,7 +2877,7 @@ function getAuth(app$1) {
|
|
|
4011
2877
|
]
|
|
4012
2878
|
});
|
|
4013
2879
|
}
|
|
4014
|
-
|
|
2880
|
+
phone.registerAuth("Browser" /* BROWSER */);
|
|
4015
2881
|
|
|
4016
2882
|
/**
|
|
4017
2883
|
* @license
|
|
@@ -4065,21 +2931,21 @@ function _generateHandlerUrl(auth, event, provider) {
|
|
|
4065
2931
|
switch (_b.label) {
|
|
4066
2932
|
case 0:
|
|
4067
2933
|
BuildInfo = _cordovaWindow().BuildInfo;
|
|
4068
|
-
|
|
2934
|
+
phone.debugAssert(event.sessionId, 'AuthEvent did not contain a session ID');
|
|
4069
2935
|
return [4 /*yield*/, computeSha256(event.sessionId)];
|
|
4070
2936
|
case 1:
|
|
4071
2937
|
sessionDigest = _b.sent();
|
|
4072
2938
|
additionalParams = {};
|
|
4073
|
-
if (
|
|
2939
|
+
if (phone._isIOS()) {
|
|
4074
2940
|
// iOS app identifier
|
|
4075
2941
|
additionalParams['ibi'] = BuildInfo.packageName;
|
|
4076
2942
|
}
|
|
4077
|
-
else if (
|
|
2943
|
+
else if (phone._isAndroid()) {
|
|
4078
2944
|
// Android app identifier
|
|
4079
2945
|
additionalParams['apn'] = BuildInfo.packageName;
|
|
4080
2946
|
}
|
|
4081
2947
|
else {
|
|
4082
|
-
|
|
2948
|
+
phone._fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
4083
2949
|
}
|
|
4084
2950
|
// Add the display name if available
|
|
4085
2951
|
if (BuildInfo.displayName) {
|
|
@@ -4103,14 +2969,14 @@ function _validateOrigin(auth) {
|
|
|
4103
2969
|
case 0:
|
|
4104
2970
|
BuildInfo = _cordovaWindow().BuildInfo;
|
|
4105
2971
|
request = {};
|
|
4106
|
-
if (
|
|
2972
|
+
if (phone._isIOS()) {
|
|
4107
2973
|
request.iosBundleId = BuildInfo.packageName;
|
|
4108
2974
|
}
|
|
4109
|
-
else if (
|
|
2975
|
+
else if (phone._isAndroid()) {
|
|
4110
2976
|
request.androidPackageName = BuildInfo.packageName;
|
|
4111
2977
|
}
|
|
4112
2978
|
else {
|
|
4113
|
-
|
|
2979
|
+
phone._fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
4114
2980
|
}
|
|
4115
2981
|
// Will fail automatically if package name is not authorized
|
|
4116
2982
|
return [4 /*yield*/, _getProjectConfig(auth, request)];
|
|
@@ -4133,7 +2999,7 @@ function _performRedirect(handlerUrl) {
|
|
|
4133
2999
|
}
|
|
4134
3000
|
else {
|
|
4135
3001
|
// TODO: Return the inappbrowser ref that's returned from the open call
|
|
4136
|
-
iabRef = cordova.InAppBrowser.open(handlerUrl,
|
|
3002
|
+
iabRef = cordova.InAppBrowser.open(handlerUrl, phone._isIOS7Or8() ? '_blank' : '_system', 'location=yes');
|
|
4137
3003
|
}
|
|
4138
3004
|
resolve(iabRef);
|
|
4139
3005
|
});
|
|
@@ -4181,7 +3047,7 @@ function _waitForAppResume(auth, eventListener, iabRef) {
|
|
|
4181
3047
|
}
|
|
4182
3048
|
onCloseTimer = window.setTimeout(function () {
|
|
4183
3049
|
// Wait two seeconds after resume then reject.
|
|
4184
|
-
reject(
|
|
3050
|
+
reject(phone._createError(auth, "redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */));
|
|
4185
3051
|
}, REDIRECT_TIMEOUT_MS);
|
|
4186
3052
|
}
|
|
4187
3053
|
function visibilityChanged() {
|
|
@@ -4194,7 +3060,7 @@ function _waitForAppResume(auth, eventListener, iabRef) {
|
|
|
4194
3060
|
eventListener.addPassiveListener(authEventSeen);
|
|
4195
3061
|
// Listen for resume and visibility events
|
|
4196
3062
|
document.addEventListener('resume', resumed, false);
|
|
4197
|
-
if (
|
|
3063
|
+
if (phone._isAndroid()) {
|
|
4198
3064
|
document.addEventListener('visibilitychange', visibilityChanged, false);
|
|
4199
3065
|
}
|
|
4200
3066
|
// SETUP THE CLEANUP FUNCTION =====
|
|
@@ -4231,22 +3097,22 @@ function _checkCordovaConfiguration(auth) {
|
|
|
4231
3097
|
// Note that cordova-universal-links-plugin has been abandoned.
|
|
4232
3098
|
// A fork with latest fixes is available at:
|
|
4233
3099
|
// https://www.npmjs.com/package/cordova-universal-links-plugin-fix
|
|
4234
|
-
|
|
3100
|
+
phone._assert(typeof ((_a = win === null || win === void 0 ? void 0 : win.universalLinks) === null || _a === void 0 ? void 0 : _a.subscribe) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
|
|
4235
3101
|
missingPlugin: 'cordova-universal-links-plugin-fix'
|
|
4236
3102
|
});
|
|
4237
3103
|
// https://www.npmjs.com/package/cordova-plugin-buildinfo
|
|
4238
|
-
|
|
3104
|
+
phone._assert(typeof ((_b = win === null || win === void 0 ? void 0 : win.BuildInfo) === null || _b === void 0 ? void 0 : _b.packageName) !== 'undefined', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
|
|
4239
3105
|
missingPlugin: 'cordova-plugin-buildInfo'
|
|
4240
3106
|
});
|
|
4241
3107
|
// https://github.com/google/cordova-plugin-browsertab
|
|
4242
|
-
|
|
3108
|
+
phone._assert(typeof ((_e = (_d = (_c = win === null || win === void 0 ? void 0 : win.cordova) === null || _c === void 0 ? void 0 : _c.plugins) === null || _d === void 0 ? void 0 : _d.browsertab) === null || _e === void 0 ? void 0 : _e.openUrl) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
|
|
4243
3109
|
missingPlugin: 'cordova-plugin-browsertab'
|
|
4244
3110
|
});
|
|
4245
|
-
|
|
3111
|
+
phone._assert(typeof ((_h = (_g = (_f = win === null || win === void 0 ? void 0 : win.cordova) === null || _f === void 0 ? void 0 : _f.plugins) === null || _g === void 0 ? void 0 : _g.browsertab) === null || _h === void 0 ? void 0 : _h.isAvailable) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
|
|
4246
3112
|
missingPlugin: 'cordova-plugin-browsertab'
|
|
4247
3113
|
});
|
|
4248
3114
|
// https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
|
|
4249
|
-
|
|
3115
|
+
phone._assert(typeof ((_k = (_j = win === null || win === void 0 ? void 0 : win.cordova) === null || _j === void 0 ? void 0 : _j.InAppBrowser) === null || _k === void 0 ? void 0 : _k.open) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
|
|
4250
3116
|
missingPlugin: 'cordova-plugin-inappbrowser'
|
|
4251
3117
|
});
|
|
4252
3118
|
}
|
|
@@ -4274,7 +3140,7 @@ function computeSha256(sessionId) {
|
|
|
4274
3140
|
function stringToArrayBuffer(str) {
|
|
4275
3141
|
// This function is only meant to deal with an ASCII charset and makes
|
|
4276
3142
|
// certain simplifying assumptions.
|
|
4277
|
-
|
|
3143
|
+
phone.debugAssert(/[0-9a-zA-Z]+/.test(str), 'Can only convert alpha-numeric strings');
|
|
4278
3144
|
if (typeof TextEncoder !== 'undefined') {
|
|
4279
3145
|
return new TextEncoder().encode(str);
|
|
4280
3146
|
}
|
|
@@ -4358,7 +3224,7 @@ function _generateNewEvent(auth, type, eventId) {
|
|
|
4358
3224
|
sessionId: generateSessionId(),
|
|
4359
3225
|
postBody: null,
|
|
4360
3226
|
tenantId: auth.tenantId,
|
|
4361
|
-
error:
|
|
3227
|
+
error: phone._createError(auth, "no-auth-event" /* NO_AUTH_EVENT */)
|
|
4362
3228
|
};
|
|
4363
3229
|
}
|
|
4364
3230
|
function _savePartialEvent(auth, event) {
|
|
@@ -4401,7 +3267,7 @@ function _eventFromPartialAndUrl(partialEvent, url) {
|
|
|
4401
3267
|
? parseJsonOrNull(decodeURIComponent(params['firebaseError']))
|
|
4402
3268
|
: null;
|
|
4403
3269
|
var code = (_b = (_a = errorObject === null || errorObject === void 0 ? void 0 : errorObject['code']) === null || _a === void 0 ? void 0 : _a.split('auth/')) === null || _b === void 0 ? void 0 : _b[1];
|
|
4404
|
-
var error = code ?
|
|
3270
|
+
var error = code ? phone._createError(code) : null;
|
|
4405
3271
|
if (error) {
|
|
4406
3272
|
return {
|
|
4407
3273
|
type: partialEvent.type,
|
|
@@ -4436,10 +3302,10 @@ function generateSessionId() {
|
|
|
4436
3302
|
return chars.join('');
|
|
4437
3303
|
}
|
|
4438
3304
|
function storage() {
|
|
4439
|
-
return
|
|
3305
|
+
return phone._getInstance(browserLocalPersistence);
|
|
4440
3306
|
}
|
|
4441
3307
|
function persistenceKey(auth) {
|
|
4442
|
-
return
|
|
3308
|
+
return phone._persistenceKeyName("authEvent" /* AUTH_EVENT */, auth.config.apiKey, auth.name);
|
|
4443
3309
|
}
|
|
4444
3310
|
function parseJsonOrNull(json) {
|
|
4445
3311
|
try {
|
|
@@ -4519,7 +3385,7 @@ var CordovaPopupRedirectResolver = /** @class */ (function () {
|
|
|
4519
3385
|
});
|
|
4520
3386
|
};
|
|
4521
3387
|
CordovaPopupRedirectResolver.prototype._openPopup = function (auth) {
|
|
4522
|
-
|
|
3388
|
+
phone._fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
4523
3389
|
};
|
|
4524
3390
|
CordovaPopupRedirectResolver.prototype._openRedirect = function (auth, provider, authType, eventId) {
|
|
4525
3391
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
@@ -4657,7 +3523,7 @@ function generateNoEvent() {
|
|
|
4657
3523
|
urlResponse: null,
|
|
4658
3524
|
postBody: null,
|
|
4659
3525
|
tenantId: null,
|
|
4660
|
-
error:
|
|
3526
|
+
error: phone._createError("no-auth-event" /* NO_AUTH_EVENT */)
|
|
4661
3527
|
};
|
|
4662
3528
|
}
|
|
4663
3529
|
|
|
@@ -4681,82 +3547,86 @@ function generateNoEvent() {
|
|
|
4681
3547
|
// It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it out
|
|
4682
3548
|
// of autogenerated documentation pages to reduce accidental misuse.
|
|
4683
3549
|
function addFrameworkForLogging(auth, framework) {
|
|
4684
|
-
|
|
3550
|
+
phone._castAuth(auth)._logFramework(framework);
|
|
4685
3551
|
}
|
|
4686
3552
|
|
|
4687
|
-
exports.ActionCodeOperation =
|
|
4688
|
-
exports.ActionCodeURL =
|
|
4689
|
-
exports.AuthCredential =
|
|
4690
|
-
exports.AuthErrorCodes =
|
|
4691
|
-
exports.AuthImpl =
|
|
4692
|
-
exports.EmailAuthCredential =
|
|
4693
|
-
exports.EmailAuthProvider =
|
|
4694
|
-
exports.FacebookAuthProvider =
|
|
4695
|
-
exports.FactorId =
|
|
4696
|
-
exports.FetchProvider =
|
|
4697
|
-
exports.GithubAuthProvider =
|
|
4698
|
-
exports.GoogleAuthProvider =
|
|
4699
|
-
exports.OAuthCredential =
|
|
4700
|
-
exports.OAuthProvider =
|
|
4701
|
-
exports.OperationType =
|
|
4702
|
-
exports.PhoneAuthCredential =
|
|
4703
|
-
exports.
|
|
4704
|
-
exports.
|
|
4705
|
-
exports.
|
|
4706
|
-
exports.
|
|
4707
|
-
exports.
|
|
4708
|
-
exports.
|
|
4709
|
-
exports.
|
|
4710
|
-
exports.
|
|
4711
|
-
exports.
|
|
4712
|
-
exports.
|
|
4713
|
-
exports.
|
|
4714
|
-
exports.
|
|
4715
|
-
exports.
|
|
4716
|
-
exports.
|
|
4717
|
-
exports.
|
|
4718
|
-
exports.
|
|
4719
|
-
exports.
|
|
4720
|
-
exports.
|
|
4721
|
-
exports.
|
|
4722
|
-
exports.
|
|
4723
|
-
exports.
|
|
4724
|
-
exports.
|
|
4725
|
-
exports.
|
|
4726
|
-
exports.
|
|
4727
|
-
exports.
|
|
4728
|
-
exports.
|
|
4729
|
-
exports.
|
|
4730
|
-
exports.
|
|
4731
|
-
exports.
|
|
4732
|
-
exports.
|
|
4733
|
-
exports.
|
|
4734
|
-
exports.
|
|
4735
|
-
exports.
|
|
4736
|
-
exports.
|
|
4737
|
-
exports.
|
|
4738
|
-
exports.
|
|
4739
|
-
exports.
|
|
4740
|
-
exports.
|
|
4741
|
-
exports.
|
|
4742
|
-
exports.
|
|
4743
|
-
exports.
|
|
4744
|
-
exports.
|
|
4745
|
-
exports.
|
|
4746
|
-
exports.
|
|
4747
|
-
exports.
|
|
4748
|
-
exports.
|
|
4749
|
-
exports.
|
|
4750
|
-
exports.
|
|
4751
|
-
exports.
|
|
4752
|
-
exports.
|
|
4753
|
-
exports.
|
|
4754
|
-
exports.
|
|
4755
|
-
exports.
|
|
3553
|
+
exports.ActionCodeOperation = phone.ActionCodeOperation;
|
|
3554
|
+
exports.ActionCodeURL = phone.ActionCodeURL;
|
|
3555
|
+
exports.AuthCredential = phone.AuthCredential;
|
|
3556
|
+
exports.AuthErrorCodes = phone.AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY;
|
|
3557
|
+
exports.AuthImpl = phone.AuthImpl;
|
|
3558
|
+
exports.EmailAuthCredential = phone.EmailAuthCredential;
|
|
3559
|
+
exports.EmailAuthProvider = phone.EmailAuthProvider;
|
|
3560
|
+
exports.FacebookAuthProvider = phone.FacebookAuthProvider;
|
|
3561
|
+
exports.FactorId = phone.FactorId;
|
|
3562
|
+
exports.FetchProvider = phone.FetchProvider;
|
|
3563
|
+
exports.GithubAuthProvider = phone.GithubAuthProvider;
|
|
3564
|
+
exports.GoogleAuthProvider = phone.GoogleAuthProvider;
|
|
3565
|
+
exports.OAuthCredential = phone.OAuthCredential;
|
|
3566
|
+
exports.OAuthProvider = phone.OAuthProvider;
|
|
3567
|
+
exports.OperationType = phone.OperationType;
|
|
3568
|
+
exports.PhoneAuthCredential = phone.PhoneAuthCredential;
|
|
3569
|
+
exports.PhoneAuthProvider = phone.PhoneAuthProvider;
|
|
3570
|
+
exports.PhoneMultiFactorGenerator = phone.PhoneMultiFactorGenerator;
|
|
3571
|
+
exports.ProviderId = phone.ProviderId;
|
|
3572
|
+
exports.RecaptchaVerifier = phone.RecaptchaVerifier;
|
|
3573
|
+
exports.SAMLAuthCredential = phone.SAMLAuthCredential;
|
|
3574
|
+
exports.SAMLAuthProvider = phone.SAMLAuthProvider;
|
|
3575
|
+
exports.SignInMethod = phone.SignInMethod;
|
|
3576
|
+
exports.TwitterAuthProvider = phone.TwitterAuthProvider;
|
|
3577
|
+
exports.UserImpl = phone.UserImpl;
|
|
3578
|
+
exports._assert = phone._assert;
|
|
3579
|
+
exports._castAuth = phone._castAuth;
|
|
3580
|
+
exports._fail = phone._fail;
|
|
3581
|
+
exports._getClientVersion = phone._getClientVersion;
|
|
3582
|
+
exports._getInstance = phone._getInstance;
|
|
3583
|
+
exports._persistenceKeyName = phone._persistenceKeyName;
|
|
3584
|
+
exports.applyActionCode = phone.applyActionCode;
|
|
3585
|
+
exports.checkActionCode = phone.checkActionCode;
|
|
3586
|
+
exports.confirmPasswordReset = phone.confirmPasswordReset;
|
|
3587
|
+
exports.connectAuthEmulator = phone.connectAuthEmulator;
|
|
3588
|
+
exports.createUserWithEmailAndPassword = phone.createUserWithEmailAndPassword;
|
|
3589
|
+
exports.debugErrorMap = phone.debugErrorMap;
|
|
3590
|
+
exports.deleteUser = phone.deleteUser;
|
|
3591
|
+
exports.fetchSignInMethodsForEmail = phone.fetchSignInMethodsForEmail;
|
|
3592
|
+
exports.getAdditionalUserInfo = phone.getAdditionalUserInfo;
|
|
3593
|
+
exports.getIdToken = phone.getIdToken;
|
|
3594
|
+
exports.getIdTokenResult = phone.getIdTokenResult;
|
|
3595
|
+
exports.getMultiFactorResolver = phone.getMultiFactorResolver;
|
|
3596
|
+
exports.inMemoryPersistence = phone.inMemoryPersistence;
|
|
3597
|
+
exports.initializeAuth = phone.initializeAuth;
|
|
3598
|
+
exports.isSignInWithEmailLink = phone.isSignInWithEmailLink;
|
|
3599
|
+
exports.linkWithCredential = phone.linkWithCredential;
|
|
3600
|
+
exports.linkWithPhoneNumber = phone.linkWithPhoneNumber;
|
|
3601
|
+
exports.multiFactor = phone.multiFactor;
|
|
3602
|
+
exports.onAuthStateChanged = phone.onAuthStateChanged;
|
|
3603
|
+
exports.onIdTokenChanged = phone.onIdTokenChanged;
|
|
3604
|
+
exports.parseActionCodeURL = phone.parseActionCodeURL;
|
|
3605
|
+
exports.prodErrorMap = phone.prodErrorMap;
|
|
3606
|
+
exports.reauthenticateWithCredential = phone.reauthenticateWithCredential;
|
|
3607
|
+
exports.reauthenticateWithPhoneNumber = phone.reauthenticateWithPhoneNumber;
|
|
3608
|
+
exports.reload = phone.reload;
|
|
3609
|
+
exports.sendEmailVerification = phone.sendEmailVerification;
|
|
3610
|
+
exports.sendPasswordResetEmail = phone.sendPasswordResetEmail;
|
|
3611
|
+
exports.sendSignInLinkToEmail = phone.sendSignInLinkToEmail;
|
|
3612
|
+
exports.setPersistence = phone.setPersistence;
|
|
3613
|
+
exports.signInAnonymously = phone.signInAnonymously;
|
|
3614
|
+
exports.signInWithCredential = phone.signInWithCredential;
|
|
3615
|
+
exports.signInWithCustomToken = phone.signInWithCustomToken;
|
|
3616
|
+
exports.signInWithEmailAndPassword = phone.signInWithEmailAndPassword;
|
|
3617
|
+
exports.signInWithEmailLink = phone.signInWithEmailLink;
|
|
3618
|
+
exports.signInWithPhoneNumber = phone.signInWithPhoneNumber;
|
|
3619
|
+
exports.signOut = phone.signOut;
|
|
3620
|
+
exports.unlink = phone.unlink;
|
|
3621
|
+
exports.updateCurrentUser = phone.updateCurrentUser;
|
|
3622
|
+
exports.updateEmail = phone.updateEmail;
|
|
3623
|
+
exports.updatePassword = phone.updatePassword;
|
|
3624
|
+
exports.updatePhoneNumber = phone.updatePhoneNumber;
|
|
3625
|
+
exports.updateProfile = phone.updateProfile;
|
|
3626
|
+
exports.useDeviceLanguage = phone.useDeviceLanguage;
|
|
3627
|
+
exports.verifyBeforeUpdateEmail = phone.verifyBeforeUpdateEmail;
|
|
3628
|
+
exports.verifyPasswordResetCode = phone.verifyPasswordResetCode;
|
|
4756
3629
|
exports.AuthPopup = AuthPopup;
|
|
4757
|
-
exports.PhoneAuthProvider = PhoneAuthProvider;
|
|
4758
|
-
exports.PhoneMultiFactorGenerator = PhoneMultiFactorGenerator;
|
|
4759
|
-
exports.RecaptchaVerifier = RecaptchaVerifier;
|
|
4760
3630
|
exports._generateEventId = _generateEventId;
|
|
4761
3631
|
exports._getRedirectResult = _getRedirectResult;
|
|
4762
3632
|
exports.addFrameworkForLogging = addFrameworkForLogging;
|
|
@@ -4767,14 +3637,10 @@ exports.cordovaPopupRedirectResolver = cordovaPopupRedirectResolver;
|
|
|
4767
3637
|
exports.getAuth = getAuth;
|
|
4768
3638
|
exports.getRedirectResult = getRedirectResult;
|
|
4769
3639
|
exports.indexedDBLocalPersistence = indexedDBLocalPersistence;
|
|
4770
|
-
exports.linkWithPhoneNumber = linkWithPhoneNumber;
|
|
4771
3640
|
exports.linkWithPopup = linkWithPopup;
|
|
4772
3641
|
exports.linkWithRedirect = linkWithRedirect;
|
|
4773
|
-
exports.reauthenticateWithPhoneNumber = reauthenticateWithPhoneNumber;
|
|
4774
3642
|
exports.reauthenticateWithPopup = reauthenticateWithPopup;
|
|
4775
3643
|
exports.reauthenticateWithRedirect = reauthenticateWithRedirect;
|
|
4776
|
-
exports.signInWithPhoneNumber = signInWithPhoneNumber;
|
|
4777
3644
|
exports.signInWithPopup = signInWithPopup;
|
|
4778
3645
|
exports.signInWithRedirect = signInWithRedirect;
|
|
4779
|
-
exports.updatePhoneNumber = updatePhoneNumber;
|
|
4780
3646
|
//# sourceMappingURL=internal.js.map
|