@web3auth/modal 10.0.0-beta.0 → 10.0.0-beta.1
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/dist/lib.cjs/node_modules/style-inject/dist/style-inject.es.js +1 -1
- package/dist/lib.cjs/packages/modal/src/modalManager.js +186 -132
- package/dist/lib.cjs/packages/modal/src/react/Web3AuthProvider.js +2 -2
- package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +26 -26
- package/dist/lib.cjs/packages/modal/src/react/hooks/useWeb3Auth.js +2 -2
- package/dist/lib.cjs/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +60 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/Button.js +47 -22
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/Button.type.js +8 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/ButtonSocial/ButtonSocial.js +53 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/ButtonWallet/ButtonWallet.js +68 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +202 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +62 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/{ExternalWallet/ExternalWalletChainNamespace.js → ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js} +28 -30
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.js +49 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.js +140 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.js +93 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletSearch/ConnectWalletSearch.js +55 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Embed/Embed.js +70 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Footer/Footer.js +53 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Image/Image.js +89 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Loader/Loader.js +151 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/Login.js +489 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/LoginOtp/LoginOtp.js +116 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/LoginPasswordLess/LoginPasswordLess.js +117 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/LoginHint/LoginHint.js +52 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Modal/Modal.js +87 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Otp/Otp.js +190 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/PulseLoader/PulseLoader.js +18 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Root/Root.js +452 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLoginList/SocialLoginList.js +156 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Toast/Toast.js +70 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/Widget/Widget.js +229 -0
- package/dist/lib.cjs/packages/modal/src/ui/config.js +12 -1
- package/dist/lib.cjs/packages/modal/src/ui/constants.js +18 -0
- package/dist/lib.cjs/packages/modal/src/ui/context/RootContext.js +20 -0
- package/dist/lib.cjs/packages/modal/src/ui/context/ThemeContext.js +2 -2
- package/dist/lib.cjs/packages/modal/src/ui/css/index.css.js +8 -0
- package/dist/lib.cjs/packages/modal/src/ui/handlers/AbstractHandler.js +117 -0
- package/dist/lib.cjs/packages/modal/src/ui/handlers/EmailPasswordlessHandler.js +54 -0
- package/dist/lib.cjs/packages/modal/src/ui/handlers/SmsPasswordlessHandler.js +57 -0
- package/dist/lib.cjs/packages/modal/src/ui/handlers/factory.js +19 -0
- package/dist/lib.cjs/packages/modal/src/ui/i18n/dutch.json.js +37 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/english.json.js +37 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/french.json.js +37 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/german.json.js +37 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/japanese.json.js +37 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/korean.json.js +37 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/mandarin.json.js +37 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/portuguese.json.js +37 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/spanish.json.js +37 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/turkish.json.js +37 -2
- package/dist/lib.cjs/packages/modal/src/ui/interfaces.js +7 -10
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +69 -44
- package/dist/lib.cjs/packages/modal/src/ui/utils.js +107 -1
- package/dist/lib.cjs/types/modalManager.d.ts +4 -1
- package/dist/lib.cjs/types/ui/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/dist/lib.cjs/types/ui/components/BottomSheet/BottomSheet.type.d.ts +7 -0
- package/dist/lib.cjs/types/ui/components/BottomSheet/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Button/Button.d.ts +2 -15
- package/dist/lib.cjs/types/ui/components/Button/Button.type.d.ts +12 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonSocial/ButtonSocial.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonSocial/ButtonSocial.type.d.ts +14 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonSocial/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonWallet/ButtonWallet.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonWallet/ButtonWallet.type.d.ts +13 -0
- package/dist/lib.cjs/types/ui/components/Button/ButtonWallet/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Button/index.d.ts +1 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWallet.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWallet.type.d.ts +24 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.type.d.ts +13 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainFilter/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.type.d.ts +10 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletChainNamespaceSelect/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.type.d.ts +6 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletHeader/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.type.d.ts +19 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletList/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.type.d.ts +9 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletQrCode/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletSearch/ConnectWalletSearch.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletSearch/ConnectWalletSearch.type.d.ts +9 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/ConnectWalletSearch/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/ConnectWallet/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Embed/Embed.d.ts +8 -0
- package/dist/lib.cjs/types/ui/components/Embed/Embed.type.d.ts +12 -0
- package/dist/lib.cjs/types/ui/components/Embed/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Footer/Footer.d.ts +7 -0
- package/dist/lib.cjs/types/ui/components/Footer/Footer.type.d.ts +4 -0
- package/dist/lib.cjs/types/ui/components/Footer/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Image/Image.d.ts +7 -0
- package/dist/lib.cjs/types/ui/components/{Image.d.ts → Image/Image.type.d.ts} +2 -1
- package/dist/lib.cjs/types/ui/components/Image/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Loader/Loader.d.ts +8 -0
- package/dist/lib.cjs/types/ui/components/Loader/Loader.type.d.ts +12 -0
- package/dist/lib.cjs/types/ui/components/Loader/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Login/Login.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Login/Login.type.d.ts +29 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginOtp/LoginOtp.d.ts +8 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginOtp/LoginOtp.type.d.ts +10 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginOtp/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginPasswordLess/LoginPasswordLess.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginPasswordLess/LoginPasswordLess.type.d.ts +13 -0
- package/dist/lib.cjs/types/ui/components/Login/LoginPasswordLess/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Login/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/LoginHint/LoginHint.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/LoginHint/LoginHint.type.d.ts +6 -0
- package/dist/lib.cjs/types/ui/components/LoginHint/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Modal/Modal.d.ts +8 -0
- package/dist/lib.cjs/types/ui/components/Modal/Modal.type.d.ts +14 -0
- package/dist/lib.cjs/types/ui/components/Modal/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Otp/Otp.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Otp/Otp.type.d.ts +22 -0
- package/dist/lib.cjs/types/ui/components/Otp/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/PulseLoader/PulseLoader.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/PulseLoader/index.d.ts +1 -0
- package/dist/lib.cjs/types/ui/components/Root/Root.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/Root/Root.type.d.ts +27 -0
- package/dist/lib.cjs/types/ui/components/Root/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/SocialLoginList/SocialLoginList.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/SocialLoginList/SocialLoginList.type.d.ts +11 -0
- package/dist/lib.cjs/types/ui/components/SocialLoginList/index.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Toast/Toast.d.ts +2 -0
- package/dist/lib.cjs/types/ui/components/Toast/index.d.ts +1 -0
- package/dist/lib.cjs/types/ui/components/Widget/Widget.d.ts +3 -0
- package/dist/lib.cjs/types/ui/components/{Modal.d.ts → Widget/Widget.type.d.ts} +4 -5
- package/dist/lib.cjs/types/ui/components/Widget/index.d.ts +1 -0
- package/dist/lib.cjs/types/ui/config.d.ts +4 -1
- package/dist/lib.cjs/types/ui/constants.d.ts +13 -0
- package/dist/lib.cjs/types/ui/context/RootContext.d.ts +18 -0
- package/dist/lib.cjs/types/ui/handlers/AbstractHandler.d.ts +20 -0
- package/dist/lib.cjs/types/ui/handlers/EmailPasswordlessHandler.d.ts +8 -0
- package/dist/lib.cjs/types/ui/handlers/SmsPasswordlessHandler.d.ts +9 -0
- package/dist/lib.cjs/types/ui/handlers/factory.d.ts +5 -0
- package/dist/lib.cjs/types/ui/interfaces.d.ts +115 -14
- package/dist/lib.cjs/types/ui/loginModal.d.ts +9 -7
- package/dist/lib.cjs/types/ui/utils.d.ts +17 -2
- package/dist/lib.esm/node_modules/style-inject/dist/style-inject.es.js +1 -1
- package/dist/lib.esm/packages/modal/src/modalManager.js +191 -138
- package/dist/lib.esm/packages/modal/src/ui/components/BottomSheet/BottomSheet.js +58 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Button/Button.js +48 -24
- package/dist/lib.esm/packages/modal/src/ui/components/Button/Button.type.js +6 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Button/ButtonSocial/ButtonSocial.js +51 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Button/ButtonWallet/ButtonWallet.js +66 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +200 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +60 -0
- package/dist/lib.esm/packages/modal/src/ui/components/{ExternalWallet/ExternalWalletChainNamespace.js → ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js} +28 -31
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletHeader/ConnectWalletHeader.js +47 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletList/ConnectWalletList.js +138 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletQrCode/ConnectWalletQrCode.js +91 -0
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletSearch/ConnectWalletSearch.js +56 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Embed/Embed.js +68 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Footer/Footer.js +51 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Image/Image.js +87 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Loader/Loader.js +152 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Login/Login.js +489 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Login/LoginOtp/LoginOtp.js +115 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Login/LoginPasswordLess/LoginPasswordLess.js +115 -0
- package/dist/lib.esm/packages/modal/src/ui/components/LoginHint/LoginHint.js +50 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Modal/Modal.js +85 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Otp/Otp.js +188 -0
- package/dist/lib.esm/packages/modal/src/ui/components/PulseLoader/PulseLoader.js +16 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Root/Root.js +462 -0
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLoginList/SocialLoginList.js +154 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Toast/Toast.js +68 -0
- package/dist/lib.esm/packages/modal/src/ui/components/Widget/Widget.js +231 -0
- package/dist/lib.esm/packages/modal/src/ui/config.js +10 -3
- package/dist/lib.esm/packages/modal/src/ui/constants.js +13 -0
- package/dist/lib.esm/packages/modal/src/ui/context/RootContext.js +18 -0
- package/dist/lib.esm/packages/modal/src/ui/css/index.css.js +6 -0
- package/dist/lib.esm/packages/modal/src/ui/handlers/AbstractHandler.js +115 -0
- package/dist/lib.esm/packages/modal/src/ui/handlers/EmailPasswordlessHandler.js +52 -0
- package/dist/lib.esm/packages/modal/src/ui/handlers/SmsPasswordlessHandler.js +55 -0
- package/dist/lib.esm/packages/modal/src/ui/handlers/factory.js +17 -0
- package/dist/lib.esm/packages/modal/src/ui/i18n/dutch.json.js +37 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/english.json.js +37 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/french.json.js +37 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/german.json.js +37 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/japanese.json.js +37 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/korean.json.js +37 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/mandarin.json.js +37 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/portuguese.json.js +37 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/spanish.json.js +37 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/turkish.json.js +37 -3
- package/dist/lib.esm/packages/modal/src/ui/interfaces.js +8 -9
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +70 -45
- package/dist/lib.esm/packages/modal/src/ui/utils.js +105 -3
- package/dist/modal.umd.min.js +1 -1
- package/dist/modal.umd.min.js.LICENSE.txt +8 -8
- package/package.json +14 -11
- package/dist/lib.cjs/packages/modal/src/ui/assets/arrow-left-dark.svg.js +0 -7
- package/dist/lib.cjs/packages/modal/src/ui/assets/arrow-left-light.svg.js +0 -7
- package/dist/lib.cjs/packages/modal/src/ui/assets/x-dark.svg.js +0 -7
- package/dist/lib.cjs/packages/modal/src/ui/assets/x-light.svg.js +0 -7
- package/dist/lib.cjs/packages/modal/src/ui/components/AdapterLoader.js +0 -108
- package/dist/lib.cjs/packages/modal/src/ui/components/Button/styles.css.js +0 -8
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletButton.js +0 -44
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletConnect.js +0 -67
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletDetails.js +0 -43
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletHeader.js +0 -46
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallet/ExternalWalletInstall.js +0 -167
- package/dist/lib.cjs/packages/modal/src/ui/components/ExternalWallets.js +0 -279
- package/dist/lib.cjs/packages/modal/src/ui/components/Footer.js +0 -20
- package/dist/lib.cjs/packages/modal/src/ui/components/Header.js +0 -81
- package/dist/lib.cjs/packages/modal/src/ui/components/Icon.js +0 -73
- package/dist/lib.cjs/packages/modal/src/ui/components/Image.js +0 -51
- package/dist/lib.cjs/packages/modal/src/ui/components/Loader.js +0 -59
- package/dist/lib.cjs/packages/modal/src/ui/components/Modal.js +0 -278
- package/dist/lib.cjs/packages/modal/src/ui/components/SelfCustodyViaWeb3Auth.js +0 -30
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLoginPasswordless.js +0 -150
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLogins.js +0 -153
- package/dist/lib.cjs/packages/modal/src/ui/components/WalletConnect.js +0 -84
- package/dist/lib.cjs/packages/modal/src/ui/css/web3auth.css.js +0 -8
- package/dist/lib.cjs/types/ui/components/AdapterLoader.d.ts +0 -11
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletButton.d.ts +0 -7
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletChainNamespace.d.ts +0 -9
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletConnect.d.ts +0 -9
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletDetails.d.ts +0 -10
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletHeader.d.ts +0 -8
- package/dist/lib.cjs/types/ui/components/ExternalWallet/ExternalWalletInstall.d.ts +0 -8
- package/dist/lib.cjs/types/ui/components/ExternalWallets.d.ts +0 -15
- package/dist/lib.cjs/types/ui/components/Footer.d.ts +0 -1
- package/dist/lib.cjs/types/ui/components/Header.d.ts +0 -8
- package/dist/lib.cjs/types/ui/components/Icon.d.ts +0 -9
- package/dist/lib.cjs/types/ui/components/Loader.d.ts +0 -10
- package/dist/lib.cjs/types/ui/components/SelfCustodyViaWeb3Auth.d.ts +0 -1
- package/dist/lib.cjs/types/ui/components/SocialLoginPasswordless.d.ts +0 -14
- package/dist/lib.cjs/types/ui/components/SocialLogins.d.ts +0 -10
- package/dist/lib.cjs/types/ui/components/WalletConnect.d.ts +0 -8
- package/dist/lib.esm/packages/modal/src/ui/assets/arrow-left-dark.svg.js +0 -5
- package/dist/lib.esm/packages/modal/src/ui/assets/arrow-left-light.svg.js +0 -5
- package/dist/lib.esm/packages/modal/src/ui/assets/x-dark.svg.js +0 -5
- package/dist/lib.esm/packages/modal/src/ui/assets/x-light.svg.js +0 -5
- package/dist/lib.esm/packages/modal/src/ui/components/AdapterLoader.js +0 -106
- package/dist/lib.esm/packages/modal/src/ui/components/Button/styles.css.js +0 -6
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletButton.js +0 -42
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletConnect.js +0 -65
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletDetails.js +0 -44
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletHeader.js +0 -44
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallet/ExternalWalletInstall.js +0 -165
- package/dist/lib.esm/packages/modal/src/ui/components/ExternalWallets.js +0 -281
- package/dist/lib.esm/packages/modal/src/ui/components/Footer.js +0 -18
- package/dist/lib.esm/packages/modal/src/ui/components/Header.js +0 -79
- package/dist/lib.esm/packages/modal/src/ui/components/Icon.js +0 -71
- package/dist/lib.esm/packages/modal/src/ui/components/Image.js +0 -49
- package/dist/lib.esm/packages/modal/src/ui/components/Loader.js +0 -57
- package/dist/lib.esm/packages/modal/src/ui/components/Modal.js +0 -277
- package/dist/lib.esm/packages/modal/src/ui/components/SelfCustodyViaWeb3Auth.js +0 -28
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLoginPasswordless.js +0 -148
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLogins.js +0 -152
- package/dist/lib.esm/packages/modal/src/ui/components/WalletConnect.js +0 -82
- package/dist/lib.esm/packages/modal/src/ui/css/web3auth.css.js +0 -6
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
function styleInject(css, ref) {
|
|
4
4
|
if (ref === void 0) ref = {};
|
|
5
5
|
var insertAt = ref.insertAt;
|
|
6
|
-
if (
|
|
6
|
+
if (typeof document === 'undefined') {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
var head = document.head || document.getElementsByTagName('head')[0];
|
|
@@ -16,6 +16,53 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
16
16
|
_defineProperty(this, "loginModal", void 0);
|
|
17
17
|
_defineProperty(this, "options", void 0);
|
|
18
18
|
_defineProperty(this, "modalConfig", noModal.cloneDeep(config.defaultConnectorsModalConfig));
|
|
19
|
+
_defineProperty(this, "onInitExternalWallets", async params => {
|
|
20
|
+
if (params.externalWalletsInitialized) return;
|
|
21
|
+
// initialize WC connector only as other external wallets are initialized in initModal
|
|
22
|
+
await this.initExternalConnectors(this.connectors.filter(x => x.name === noModal.WALLET_CONNECTORS.WALLET_CONNECT_V2), {
|
|
23
|
+
externalWalletsInitialized: true,
|
|
24
|
+
externalWalletsVisibility: true
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
_defineProperty(this, "onSocialLogin", async params => {
|
|
28
|
+
try {
|
|
29
|
+
await this.connectTo(params.connector, params.loginParams);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
noModal.log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
_defineProperty(this, "onExternalWalletLogin", async params => {
|
|
35
|
+
try {
|
|
36
|
+
await this.connectTo(params.connector, params.loginParams);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
noModal.log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
_defineProperty(this, "onModalVisibility", async visibility => {
|
|
42
|
+
noModal.log.debug("is login modal visible", visibility);
|
|
43
|
+
this.emit(interfaces.LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, visibility);
|
|
44
|
+
const wcConnector = this.getConnector(noModal.WALLET_CONNECTORS.WALLET_CONNECT_V2);
|
|
45
|
+
if (wcConnector) {
|
|
46
|
+
const walletConnectStatus = wcConnector === null || wcConnector === void 0 ? void 0 : wcConnector.status;
|
|
47
|
+
noModal.log.debug("trying refreshing wc session", visibility, walletConnectStatus);
|
|
48
|
+
if (visibility && (walletConnectStatus === noModal.CONNECTOR_STATUS.READY || walletConnectStatus === noModal.CONNECTOR_STATUS.CONNECTING)) {
|
|
49
|
+
noModal.log.debug("refreshing wc session");
|
|
50
|
+
// refreshing session for wallet connect whenever modal is opened.
|
|
51
|
+
try {
|
|
52
|
+
const initialChain = this.getInitialChainIdForConnector(wcConnector);
|
|
53
|
+
wcConnector.connect({
|
|
54
|
+
chainId: initialChain.chainId
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
noModal.log.error(`Error while disconnecting to wallet connect in core`, error);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (!visibility && this.status === noModal.CONNECTOR_STATUS.CONNECTED && (walletConnectStatus === noModal.CONNECTOR_STATUS.READY || walletConnectStatus === noModal.CONNECTOR_STATUS.CONNECTING)) {
|
|
61
|
+
noModal.log.debug("this stops wc connector from trying to reconnect once proposal expires");
|
|
62
|
+
wcConnector.status = noModal.CONNECTOR_STATUS.READY;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
19
66
|
this.options = _objectSpread({}, options);
|
|
20
67
|
if (!this.options.uiConfig) this.options.uiConfig = {};
|
|
21
68
|
if (this.options.modalConfig) this.modalConfig = this.options.modalConfig;
|
|
@@ -32,6 +79,7 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
32
79
|
this.options.uiConfig = deepmerge(noModal.cloneDeep(projectConfig.whitelabel || {}), this.options.uiConfig || {});
|
|
33
80
|
if (!this.options.uiConfig.defaultLanguage) this.options.uiConfig.defaultLanguage = utils.getUserLanguage(this.options.uiConfig.defaultLanguage);
|
|
34
81
|
if (!this.options.uiConfig.mode) this.options.uiConfig.mode = "light";
|
|
82
|
+
this.options.uiConfig = deepmerge(projectConfig.loginModal || {}, this.options.uiConfig || {});
|
|
35
83
|
// init config
|
|
36
84
|
super.initAccountAbstractionConfig(projectConfig);
|
|
37
85
|
super.initChainsConfig(projectConfig);
|
|
@@ -43,10 +91,16 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
43
91
|
} = this.filterWalletRegistry(walletRegistry, projectConfig);
|
|
44
92
|
this.loginModal = new loginModal.LoginModal(_objectSpread(_objectSpread({}, this.options.uiConfig), {}, {
|
|
45
93
|
connectorListener: this,
|
|
94
|
+
web3authClientId: this.options.clientId,
|
|
95
|
+
web3authNetwork: this.options.web3AuthNetwork,
|
|
46
96
|
chainNamespaces: [...new Set(((_this$coreOptions$cha = this.coreOptions.chains) === null || _this$coreOptions$cha === void 0 ? void 0 : _this$coreOptions$cha.map(x => x.chainNamespace)) || [])],
|
|
47
97
|
walletRegistry: filteredWalletRegistry
|
|
48
|
-
})
|
|
49
|
-
|
|
98
|
+
}), {
|
|
99
|
+
onInitExternalWallets: this.onInitExternalWallets,
|
|
100
|
+
onSocialLogin: this.onSocialLogin,
|
|
101
|
+
onExternalWalletLogin: this.onExternalWalletLogin,
|
|
102
|
+
onModalVisibility: this.onModalVisibility
|
|
103
|
+
});
|
|
50
104
|
await this.loginModal.initModal();
|
|
51
105
|
// setup common JRPC provider
|
|
52
106
|
await this.setupCommonJRPCProvider();
|
|
@@ -70,18 +124,29 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
70
124
|
if (this.connectedConnectorName && this.status === noModal.CONNECTOR_STATUS.CONNECTED && this.provider) return this.provider;
|
|
71
125
|
this.loginModal.open();
|
|
72
126
|
return new Promise((resolve, reject) => {
|
|
73
|
-
|
|
127
|
+
// remove all listeners when promise is resolved or rejected.
|
|
128
|
+
// this is to prevent memory leaks if user clicks connect button multiple times.
|
|
129
|
+
const handleConnected = () => {
|
|
130
|
+
this.removeListener(noModal.CONNECTOR_EVENTS.ERRORED, handleError);
|
|
131
|
+
this.removeListener(interfaces.LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
|
|
74
132
|
return resolve(this.provider);
|
|
75
|
-
}
|
|
76
|
-
|
|
133
|
+
};
|
|
134
|
+
const handleError = err => {
|
|
135
|
+
this.removeListener(noModal.CONNECTOR_EVENTS.CONNECTED, handleConnected);
|
|
136
|
+
this.removeListener(interfaces.LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
|
|
77
137
|
return reject(err);
|
|
78
|
-
}
|
|
79
|
-
|
|
138
|
+
};
|
|
139
|
+
const handleVisibility = visibility => {
|
|
80
140
|
// modal is closed but user is not connected to any wallet.
|
|
81
141
|
if (!visibility && this.status !== noModal.CONNECTOR_STATUS.CONNECTED) {
|
|
142
|
+
this.removeListener(noModal.CONNECTOR_EVENTS.CONNECTED, handleConnected);
|
|
143
|
+
this.removeListener(noModal.CONNECTOR_EVENTS.ERRORED, handleError);
|
|
82
144
|
return reject(new Error("User closed the modal"));
|
|
83
145
|
}
|
|
84
|
-
}
|
|
146
|
+
};
|
|
147
|
+
this.once(noModal.CONNECTOR_EVENTS.CONNECTED, handleConnected);
|
|
148
|
+
this.once(noModal.CONNECTOR_EVENTS.ERRORED, handleError);
|
|
149
|
+
this.once(interfaces.LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
|
|
85
150
|
});
|
|
86
151
|
}
|
|
87
152
|
filterWalletRegistry(walletRegistry, projectConfig) {
|
|
@@ -98,6 +163,8 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
98
163
|
if (disableAllOtherWallets) {
|
|
99
164
|
Object.keys(walletRegistry.others).forEach(wallet => disabledExternalWallets.add(wallet));
|
|
100
165
|
}
|
|
166
|
+
// always show MetaMask, force enable it
|
|
167
|
+
disabledExternalWallets.delete(noModal.WALLET_CONNECTORS.METAMASK);
|
|
101
168
|
// remove wallets that are disabled in project config from wallet registry
|
|
102
169
|
const filteredWalletRegistry = noModal.cloneDeep(walletRegistry);
|
|
103
170
|
disabledExternalWallets.forEach(wallet => {
|
|
@@ -115,7 +182,12 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
115
182
|
let projectConfig;
|
|
116
183
|
try {
|
|
117
184
|
var _this$options$account;
|
|
118
|
-
projectConfig = await noModal.fetchProjectConfig(
|
|
185
|
+
projectConfig = await noModal.fetchProjectConfig({
|
|
186
|
+
clientId: this.options.clientId,
|
|
187
|
+
web3AuthNetwork: this.options.web3AuthNetwork,
|
|
188
|
+
aaProvider: (_this$options$account = this.options.accountAbstractionConfig) === null || _this$options$account === void 0 ? void 0 : _this$options$account.smartAccountType,
|
|
189
|
+
authBuildEnv: this.options.authBuildEnv
|
|
190
|
+
});
|
|
119
191
|
} catch (e) {
|
|
120
192
|
noModal.log.error("Failed to fetch project configurations", e);
|
|
121
193
|
throw noModal.WalletInitializationError.notReady("failed to fetch project configurations", e);
|
|
@@ -153,15 +225,28 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
153
225
|
hasInAppConnectors,
|
|
154
226
|
hasExternalConnectors
|
|
155
227
|
} = await this.checkConnectorAvailability(filteredConnectorNames);
|
|
228
|
+
const filteredConnectors = connectors.filter(x => filteredConnectorNames.includes(x.name));
|
|
156
229
|
if (hasInAppConnectors) {
|
|
157
|
-
await this.initInAppAndCachedConnectors(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
230
|
+
await this.initInAppAndCachedConnectors(filteredConnectors);
|
|
231
|
+
}
|
|
232
|
+
if (hasExternalConnectors) {
|
|
233
|
+
if (hasInAppConnectors) {
|
|
234
|
+
// show connect button if both in-app and external wallets are available
|
|
235
|
+
this.loginModal.initExternalWalletContainer();
|
|
236
|
+
// initialize installed external wallets (except WC), don't mark external wallets as fully initialized
|
|
237
|
+
this.initExternalConnectors(filteredConnectors.filter(x => x.type === noModal.CONNECTOR_CATEGORY.EXTERNAL && x.name !== noModal.WALLET_CONNECTORS.WALLET_CONNECT_V2), {
|
|
238
|
+
externalWalletsInitialized: false,
|
|
239
|
+
showExternalWalletsOnly: false,
|
|
240
|
+
externalWalletsVisibility: false
|
|
241
|
+
});
|
|
242
|
+
} else {
|
|
243
|
+
// if no in app wallet is available then initialize all external wallets in modal
|
|
244
|
+
await this.initExternalConnectors(filteredConnectors.filter(x => x.type === noModal.CONNECTOR_CATEGORY.EXTERNAL), {
|
|
245
|
+
externalWalletsInitialized: true,
|
|
246
|
+
showExternalWalletsOnly: true,
|
|
247
|
+
externalWalletsVisibility: true
|
|
248
|
+
});
|
|
249
|
+
}
|
|
165
250
|
}
|
|
166
251
|
// emit ready event if connector is ready
|
|
167
252
|
if (this.status === noModal.CONNECTOR_STATUS.NOT_READY) {
|
|
@@ -173,25 +258,31 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
173
258
|
projectConfig,
|
|
174
259
|
disabledExternalWallets
|
|
175
260
|
}) {
|
|
176
|
-
var _this$modalConfig2
|
|
177
|
-
// Auth connector config:
|
|
261
|
+
var _this$modalConfig2;
|
|
262
|
+
// Auth connector config: populate this with the default config for auth connectors.
|
|
178
263
|
const loginMethods = {};
|
|
264
|
+
const embedWalletConfigMap = new Map();
|
|
179
265
|
for (const authConnectionConfig of projectConfig.embeddedWalletAuth || []) {
|
|
180
266
|
const {
|
|
181
267
|
isDefault,
|
|
182
|
-
|
|
268
|
+
authConnection,
|
|
183
269
|
groupedAuthConnectionId,
|
|
184
|
-
|
|
270
|
+
authConnectionId
|
|
185
271
|
} = authConnectionConfig;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
272
|
+
if (isDefault) {
|
|
273
|
+
loginMethods[authConnection] = {
|
|
274
|
+
name: config$1.AUTH_PROVIDERS_NAMES[authConnection],
|
|
275
|
+
authConnection: authConnection,
|
|
276
|
+
authConnectionId: authConnectionId,
|
|
277
|
+
groupedAuthConnectionId: groupedAuthConnectionId,
|
|
278
|
+
extraLoginOptions: authConnectionConfig.jwtParameters,
|
|
279
|
+
isDefault: true,
|
|
280
|
+
showOnModal: true,
|
|
281
|
+
showOnDesktop: true,
|
|
282
|
+
showOnMobile: true
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
embedWalletConfigMap.set(groupedAuthConnectionId || authConnectionId, authConnectionConfig);
|
|
195
286
|
}
|
|
196
287
|
const dashboardConnectorConfig = {
|
|
197
288
|
[noModal.WALLET_CONNECTORS.AUTH]: {
|
|
@@ -199,26 +290,38 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
199
290
|
loginMethods
|
|
200
291
|
}
|
|
201
292
|
};
|
|
293
|
+
// populate the user config data with the dashboard config.
|
|
202
294
|
if ((_this$modalConfig2 = this.modalConfig) !== null && _this$modalConfig2 !== void 0 && (_this$modalConfig2 = _this$modalConfig2.connectors) !== null && _this$modalConfig2 !== void 0 && _this$modalConfig2[noModal.WALLET_CONNECTORS.AUTH]) {
|
|
203
295
|
if (!this.modalConfig.connectors[noModal.WALLET_CONNECTORS.AUTH].loginMethods) this.modalConfig.connectors[noModal.WALLET_CONNECTORS.AUTH].loginMethods = {};
|
|
204
296
|
}
|
|
297
|
+
const authProviders = new Set(config$1.AUTH_PROVIDERS);
|
|
298
|
+
Object.keys(this.modalConfig.connectors[noModal.WALLET_CONNECTORS.AUTH].loginMethods).forEach(key => {
|
|
299
|
+
const userConfig = this.modalConfig.connectors[noModal.WALLET_CONNECTORS.AUTH].loginMethods[key];
|
|
300
|
+
const {
|
|
301
|
+
authConnectionId,
|
|
302
|
+
groupedAuthConnectionId
|
|
303
|
+
} = userConfig;
|
|
304
|
+
if (!authProviders.has(key)) {
|
|
305
|
+
throw noModal.WalletInitializationError.invalidParams(`Invalid auth connection: ${key}`);
|
|
306
|
+
}
|
|
307
|
+
// only throw error if one of them is defined in the config.
|
|
308
|
+
if (groupedAuthConnectionId || authConnectionId) {
|
|
309
|
+
if (!embedWalletConfigMap.has(groupedAuthConnectionId || authConnectionId)) throw noModal.WalletInitializationError.invalidParams(`Invalid auth connection config, authConnection: ${key}. Missing AuthConnectionConfig from the dashboard.`);
|
|
310
|
+
const configFromDashboard = embedWalletConfigMap.get(groupedAuthConnectionId || authConnectionId);
|
|
311
|
+
this.modalConfig.connectors[noModal.WALLET_CONNECTORS.AUTH].loginMethods[key] = {
|
|
312
|
+
authConnection: configFromDashboard.authConnection,
|
|
313
|
+
authConnectionId: configFromDashboard.authConnectionId,
|
|
314
|
+
groupedAuthConnectionId: configFromDashboard.groupedAuthConnectionId,
|
|
315
|
+
isDefault: configFromDashboard.isDefault || false,
|
|
316
|
+
extraLoginOptions: _objectSpread(_objectSpread({}, configFromDashboard.jwtParameters), userConfig.extraLoginOptions)
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
});
|
|
205
320
|
this.modalConfig.connectors = deepmerge(dashboardConnectorConfig, noModal.cloneDeep(this.modalConfig.connectors || {}));
|
|
206
|
-
// TODO: validate modal connector config here.!!
|
|
207
|
-
if ((_this$modalConfig3 = this.modalConfig) !== null && _this$modalConfig3 !== void 0 && (_this$modalConfig3 = _this$modalConfig3.connectors) !== null && _this$modalConfig3 !== void 0 && (_this$modalConfig3 = _this$modalConfig3[noModal.WALLET_CONNECTORS.AUTH]) !== null && _this$modalConfig3 !== void 0 && _this$modalConfig3.loginMethods) {
|
|
208
|
-
const authProviders = new Set(config$1.AUTH_PROVIDERS);
|
|
209
|
-
Object.keys(this.modalConfig.connectors[noModal.WALLET_CONNECTORS.AUTH].loginMethods).forEach(key => {
|
|
210
|
-
if (!authProviders.has(key)) {
|
|
211
|
-
throw noModal.WalletInitializationError.invalidParams(`Invalid auth connection: ${key}`);
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
// external wallets config
|
|
216
|
-
const isExternalWalletEnabled = Boolean(projectConfig.externalWalletAuth);
|
|
217
|
-
const isInstalledWalletWalletDisplayed = Boolean((_projectConfig$loginM = (_projectConfig$loginM2 = projectConfig.loginModal) === null || _projectConfig$loginM2 === void 0 ? void 0 : _projectConfig$loginM2.displayInstalledExternalWallets) !== null && _projectConfig$loginM !== void 0 ? _projectConfig$loginM : true);
|
|
218
321
|
// merge default connectors with the custom configured connectors.
|
|
219
322
|
const allConnectorNames = [...new Set([...Object.keys(this.modalConfig.connectors || {}), ...this.connectors.map(connector => connector.name)])];
|
|
220
323
|
const connectorNames = allConnectorNames.map(connectorName => {
|
|
221
|
-
var _this$
|
|
324
|
+
var _this$modalConfig3, _this$modalConfig$con, _this$modalConfig$con2;
|
|
222
325
|
// start with the default config of connector.
|
|
223
326
|
const defaultConnectorConfig = {
|
|
224
327
|
label: noModal.CONNECTOR_NAMES[connectorName] || connectorName.split("-").map(config$1.capitalizeFirstLetter).join(" "),
|
|
@@ -226,7 +329,7 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
226
329
|
showOnMobile: true,
|
|
227
330
|
showOnDesktop: true
|
|
228
331
|
};
|
|
229
|
-
this.modalConfig.connectors[connectorName] = _objectSpread(_objectSpread({}, defaultConnectorConfig), ((_this$
|
|
332
|
+
this.modalConfig.connectors[connectorName] = _objectSpread(_objectSpread({}, defaultConnectorConfig), ((_this$modalConfig3 = this.modalConfig) === null || _this$modalConfig3 === void 0 || (_this$modalConfig3 = _this$modalConfig3.connectors) === null || _this$modalConfig3 === void 0 ? void 0 : _this$modalConfig3[connectorName]) || {});
|
|
230
333
|
// check if connector is configured/added by user and exist in connectors map.
|
|
231
334
|
const connector = this.getConnector(connectorName);
|
|
232
335
|
noModal.log.debug("connector config", connectorName, (_this$modalConfig$con = this.modalConfig.connectors) === null || _this$modalConfig$con === void 0 || (_this$modalConfig$con = _this$modalConfig$con[connectorName]) === null || _this$modalConfig$con === void 0 ? void 0 : _this$modalConfig$con.showOnModal, connector);
|
|
@@ -238,17 +341,17 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
238
341
|
}
|
|
239
342
|
// skip connector if it is hidden by user
|
|
240
343
|
if (!connectorConfig.showOnModal) return;
|
|
241
|
-
// skip external connector if external wallets are disabled
|
|
242
|
-
|
|
344
|
+
// skip external connector if external wallets are disabled except for MetaMask
|
|
345
|
+
const isExternalWalletEnabled = Boolean(projectConfig.externalWalletAuth);
|
|
346
|
+
if (connector.type === noModal.CONNECTOR_CATEGORY.EXTERNAL && connector.name !== noModal.WALLET_CONNECTORS.METAMASK) {
|
|
243
347
|
if (!isExternalWalletEnabled) return;
|
|
244
348
|
if (disabledExternalWallets.has(connectorName)) return;
|
|
245
|
-
if (!isInstalledWalletWalletDisplayed) return;
|
|
246
349
|
}
|
|
247
350
|
// skip WC connector if external wallets are disabled or hideWalletDiscovery is true
|
|
248
351
|
if (connectorName === noModal.WALLET_CONNECTORS.WALLET_CONNECT_V2) {
|
|
249
|
-
var _this$
|
|
352
|
+
var _this$modalConfig4;
|
|
250
353
|
if (!isExternalWalletEnabled) return;
|
|
251
|
-
if ((_this$
|
|
354
|
+
if ((_this$modalConfig4 = this.modalConfig) !== null && _this$modalConfig4 !== void 0 && _this$modalConfig4.hideWalletDiscovery) return;
|
|
252
355
|
}
|
|
253
356
|
this.modalConfig.connectors[connectorName] = connectorConfig;
|
|
254
357
|
return connectorName;
|
|
@@ -279,10 +382,9 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
279
382
|
hasExternalConnectors
|
|
280
383
|
};
|
|
281
384
|
}
|
|
282
|
-
async initInAppAndCachedConnectors(connectors
|
|
283
|
-
await Promise.all(
|
|
284
|
-
const
|
|
285
|
-
if (!connector) return;
|
|
385
|
+
async initInAppAndCachedConnectors(connectors) {
|
|
386
|
+
await Promise.all(connectors.map(async connector => {
|
|
387
|
+
const connectorName = connector.name;
|
|
286
388
|
try {
|
|
287
389
|
// skip if connector is already initialized
|
|
288
390
|
if (connector.status !== noModal.CONNECTOR_STATUS.NOT_READY) return;
|
|
@@ -313,100 +415,52 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
313
415
|
}
|
|
314
416
|
}));
|
|
315
417
|
}
|
|
316
|
-
async initExternalConnectors(
|
|
317
|
-
if (externalWalletsInitialized) return;
|
|
418
|
+
async initExternalConnectors(externalConnectors, options) {
|
|
318
419
|
const connectorsConfig = {};
|
|
319
420
|
// we do it like this because we don't want one slow connector to delay the load of the entire external wallet section.
|
|
320
|
-
|
|
421
|
+
externalConnectors.forEach(async connector => {
|
|
321
422
|
const connectorName = connector.name;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
this.subscribeToConnectorEvents(connector);
|
|
423
|
+
noModal.log.debug("init external wallet", this.cachedConnector, connectorName, connector.status);
|
|
424
|
+
if (connector.status === noModal.CONNECTOR_STATUS.NOT_READY) {
|
|
325
425
|
// we are not initializing cached connector here as it is already being initialized in initModal before.
|
|
326
|
-
if (this.cachedConnector === connectorName)
|
|
327
|
-
|
|
426
|
+
if (this.cachedConnector === connectorName) return;
|
|
427
|
+
try {
|
|
428
|
+
this.subscribeToConnectorEvents(connector);
|
|
429
|
+
const initialChain = this.getInitialChainIdForConnector(connector);
|
|
430
|
+
await connector.init({
|
|
431
|
+
autoConnect: this.cachedConnector === connectorName,
|
|
432
|
+
chainId: initialChain.chainId
|
|
433
|
+
});
|
|
434
|
+
const connectorModalConfig = this.modalConfig.connectors[connectorName];
|
|
435
|
+
connectorsConfig[connectorName] = _objectSpread(_objectSpread({}, connectorModalConfig), {}, {
|
|
436
|
+
isInjected: connector.isInjected,
|
|
437
|
+
icon: connector.icon
|
|
438
|
+
});
|
|
439
|
+
this.loginModal.addWalletLogins(connectorsConfig, {
|
|
440
|
+
showExternalWalletsOnly: !!options.showExternalWalletsOnly,
|
|
441
|
+
externalWalletsVisibility: !!options.externalWalletsVisibility,
|
|
442
|
+
externalWalletsInitialized: !!options.externalWalletsInitialized
|
|
443
|
+
});
|
|
444
|
+
} catch (error) {
|
|
445
|
+
noModal.log.error(error, "error while initializing connector", connectorName);
|
|
328
446
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
const initialChain = this.getInitialChainIdForConnector(connector);
|
|
332
|
-
await connector.init({
|
|
333
|
-
autoConnect: this.cachedConnector === connectorName,
|
|
334
|
-
chainId: initialChain.chainId
|
|
335
|
-
});
|
|
336
|
-
const connectorModalConfig = this.modalConfig.connectors[connectorName];
|
|
337
|
-
connectorsConfig[connectorName] = _objectSpread(_objectSpread({}, connectorModalConfig), {}, {
|
|
338
|
-
isInjected: connector.isInjected
|
|
339
|
-
});
|
|
340
|
-
this.loginModal.addWalletLogins(connectorsConfig, {
|
|
341
|
-
showExternalWalletsOnly: !!(options !== null && options !== void 0 && options.showExternalWalletsOnly)
|
|
342
|
-
});
|
|
343
|
-
} catch (error) {
|
|
344
|
-
noModal.log.error(error, "error while initializing connector", connectorName);
|
|
345
|
-
}
|
|
346
|
-
} else if (connector.status === noModal.CONNECTOR_STATUS.READY || connector.status === noModal.CONNECTOR_STATUS.CONNECTING) {
|
|
447
|
+
} else {
|
|
448
|
+
if (connector.status === noModal.CONNECTOR_STATUS.READY || connector.status === noModal.CONNECTOR_STATUS.CONNECTING) {
|
|
347
449
|
// we use connecting status for wallet connect
|
|
348
450
|
const connectorModalConfig = this.modalConfig.connectors[connectorName];
|
|
349
451
|
connectorsConfig[connectorName] = _objectSpread(_objectSpread({}, connectorModalConfig), {}, {
|
|
350
|
-
isInjected: connector.isInjected
|
|
452
|
+
isInjected: connector.isInjected,
|
|
453
|
+
icon: connector.icon
|
|
351
454
|
});
|
|
352
455
|
this.loginModal.addWalletLogins(connectorsConfig, {
|
|
353
|
-
showExternalWalletsOnly: !!
|
|
456
|
+
showExternalWalletsOnly: !!options.showExternalWalletsOnly,
|
|
457
|
+
externalWalletsVisibility: !!options.externalWalletsVisibility,
|
|
458
|
+
externalWalletsInitialized: !!options.externalWalletsInitialized
|
|
354
459
|
});
|
|
355
460
|
}
|
|
356
461
|
}
|
|
357
462
|
});
|
|
358
463
|
}
|
|
359
|
-
subscribeToLoginModalEvents() {
|
|
360
|
-
this.loginModal.on(interfaces.LOGIN_MODAL_EVENTS.EXTERNAL_WALLET_LOGIN, async params => {
|
|
361
|
-
try {
|
|
362
|
-
await this.connectTo(params.connector);
|
|
363
|
-
} catch (error) {
|
|
364
|
-
noModal.log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
this.loginModal.on(interfaces.LOGIN_MODAL_EVENTS.SOCIAL_LOGIN, async params => {
|
|
368
|
-
try {
|
|
369
|
-
await this.connectTo(params.connector, params.loginParams);
|
|
370
|
-
} catch (error) {
|
|
371
|
-
noModal.log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
this.loginModal.on(interfaces.LOGIN_MODAL_EVENTS.INIT_EXTERNAL_WALLETS, async params => {
|
|
375
|
-
await this.initExternalConnectors(this.connectors, params.externalWalletsInitialized);
|
|
376
|
-
});
|
|
377
|
-
this.loginModal.on(interfaces.LOGIN_MODAL_EVENTS.DISCONNECT, async () => {
|
|
378
|
-
try {
|
|
379
|
-
await this.logout();
|
|
380
|
-
} catch (error) {
|
|
381
|
-
noModal.log.error(`Error while disconnecting`, error);
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
this.loginModal.on(interfaces.LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, async visibility => {
|
|
385
|
-
noModal.log.debug("is login modal visible", visibility);
|
|
386
|
-
this.emit(interfaces.LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, visibility);
|
|
387
|
-
const wcConnector = this.getConnector(noModal.WALLET_CONNECTORS.WALLET_CONNECT_V2);
|
|
388
|
-
if (wcConnector) {
|
|
389
|
-
const walletConnectStatus = wcConnector === null || wcConnector === void 0 ? void 0 : wcConnector.status;
|
|
390
|
-
noModal.log.debug("trying refreshing wc session", visibility, walletConnectStatus);
|
|
391
|
-
if (visibility && (walletConnectStatus === noModal.CONNECTOR_STATUS.READY || walletConnectStatus === noModal.CONNECTOR_STATUS.CONNECTING)) {
|
|
392
|
-
noModal.log.debug("refreshing wc session");
|
|
393
|
-
// refreshing session for wallet connect whenever modal is opened.
|
|
394
|
-
try {
|
|
395
|
-
const initialChain = this.getInitialChainIdForConnector(wcConnector);
|
|
396
|
-
wcConnector.connect({
|
|
397
|
-
chainId: initialChain.chainId
|
|
398
|
-
});
|
|
399
|
-
} catch (error) {
|
|
400
|
-
noModal.log.error(`Error while disconnecting to wallet connect in core`, error);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
if (!visibility && this.status === noModal.CONNECTOR_STATUS.CONNECTED && (walletConnectStatus === noModal.CONNECTOR_STATUS.READY || walletConnectStatus === noModal.CONNECTOR_STATUS.CONNECTING)) {
|
|
404
|
-
noModal.log.debug("this stops wc connector from trying to reconnect once proposal expires");
|
|
405
|
-
wcConnector.status = noModal.CONNECTOR_STATUS.READY;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
464
|
}
|
|
411
465
|
|
|
412
466
|
exports.Web3Auth = Web3Auth;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var react = require('react');
|
|
4
4
|
var Web3AuthInnerContext = require('./context/Web3AuthInnerContext.js');
|
|
5
5
|
|
|
6
6
|
function Web3AuthProvider({
|
|
7
7
|
config,
|
|
8
8
|
children
|
|
9
9
|
}) {
|
|
10
|
-
return /*#__PURE__*/
|
|
10
|
+
return /*#__PURE__*/react.createElement(Web3AuthInnerContext.Web3AuthInnerProvider, {
|
|
11
11
|
config
|
|
12
12
|
}, children);
|
|
13
13
|
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var noModal = require('@web3auth/no-modal');
|
|
4
|
-
var
|
|
4
|
+
var react = require('react');
|
|
5
5
|
var modalManager = require('../../modalManager.js');
|
|
6
6
|
|
|
7
|
-
const Web3AuthInnerContext = /*#__PURE__*/
|
|
7
|
+
const Web3AuthInnerContext = /*#__PURE__*/react.createContext(null);
|
|
8
8
|
function Web3AuthInnerProvider(params) {
|
|
9
9
|
const {
|
|
10
10
|
children,
|
|
11
11
|
config
|
|
12
12
|
} = params;
|
|
13
|
-
const [web3Auth, setWeb3Auth] =
|
|
14
|
-
const [isConnecting, setIsConnecting] =
|
|
15
|
-
const [isInitializing, setIsInitializing] =
|
|
16
|
-
const [initError, setInitError] =
|
|
17
|
-
const [connectError, setConnectError] =
|
|
18
|
-
const [isConnected, setIsConnected] =
|
|
19
|
-
const [provider, setProvider] =
|
|
20
|
-
const [userInfo, setUserInfo] =
|
|
21
|
-
const [isMFAEnabled, setIsMFAEnabled] =
|
|
22
|
-
const [isInitialized, setIsInitialized] =
|
|
23
|
-
const [status, setStatus] =
|
|
24
|
-
const getPlugin =
|
|
13
|
+
const [web3Auth, setWeb3Auth] = react.useState(null);
|
|
14
|
+
const [isConnecting, setIsConnecting] = react.useState(false);
|
|
15
|
+
const [isInitializing, setIsInitializing] = react.useState(false);
|
|
16
|
+
const [initError, setInitError] = react.useState(null);
|
|
17
|
+
const [connectError, setConnectError] = react.useState(null);
|
|
18
|
+
const [isConnected, setIsConnected] = react.useState(false);
|
|
19
|
+
const [provider, setProvider] = react.useState(null);
|
|
20
|
+
const [userInfo, setUserInfo] = react.useState(null);
|
|
21
|
+
const [isMFAEnabled, setIsMFAEnabled] = react.useState(false);
|
|
22
|
+
const [isInitialized, setIsInitialized] = react.useState(false);
|
|
23
|
+
const [status, setStatus] = react.useState(null);
|
|
24
|
+
const getPlugin = react.useCallback(name => {
|
|
25
25
|
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
26
26
|
return web3Auth.getPlugin(name);
|
|
27
27
|
}, [web3Auth]);
|
|
28
|
-
const enableMFA =
|
|
28
|
+
const enableMFA = react.useCallback(async loginParams => {
|
|
29
29
|
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
30
30
|
if (!isConnected) throw noModal.WalletLoginError.notConnectedError();
|
|
31
31
|
await web3Auth.enableMFA(loginParams);
|
|
@@ -33,19 +33,19 @@ function Web3AuthInnerProvider(params) {
|
|
|
33
33
|
setUserInfo(localUserInfo);
|
|
34
34
|
setIsMFAEnabled(localUserInfo.isMfaEnabled || false);
|
|
35
35
|
}, [web3Auth, isConnected]);
|
|
36
|
-
const manageMFA =
|
|
36
|
+
const manageMFA = react.useCallback(async loginParams => {
|
|
37
37
|
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
38
38
|
if (!isConnected) throw noModal.WalletLoginError.notConnectedError();
|
|
39
39
|
await web3Auth.manageMFA(loginParams);
|
|
40
40
|
}, [web3Auth, isConnected]);
|
|
41
|
-
const logout =
|
|
41
|
+
const logout = react.useCallback(async (logoutParams = {
|
|
42
42
|
cleanup: false
|
|
43
43
|
}) => {
|
|
44
44
|
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
45
45
|
if (!isConnected) throw noModal.WalletLoginError.notConnectedError();
|
|
46
46
|
await web3Auth.logout(logoutParams);
|
|
47
47
|
}, [web3Auth, isConnected]);
|
|
48
|
-
const connect =
|
|
48
|
+
const connect = react.useCallback(async () => {
|
|
49
49
|
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
50
50
|
try {
|
|
51
51
|
setConnectError(null);
|
|
@@ -59,15 +59,15 @@ function Web3AuthInnerProvider(params) {
|
|
|
59
59
|
setIsConnecting(false);
|
|
60
60
|
}
|
|
61
61
|
}, [web3Auth]);
|
|
62
|
-
const authenticateUser =
|
|
62
|
+
const authenticateUser = react.useCallback(async () => {
|
|
63
63
|
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
64
64
|
return web3Auth.authenticateUser();
|
|
65
65
|
}, [web3Auth]);
|
|
66
|
-
const switchChain =
|
|
66
|
+
const switchChain = react.useCallback(chainParams => {
|
|
67
67
|
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
68
68
|
return web3Auth.switchChain(chainParams);
|
|
69
69
|
}, [web3Auth]);
|
|
70
|
-
|
|
70
|
+
react.useEffect(() => {
|
|
71
71
|
const resetHookState = () => {
|
|
72
72
|
setProvider(null);
|
|
73
73
|
setUserInfo(null);
|
|
@@ -82,7 +82,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
82
82
|
const web3AuthInstance = new modalManager.Web3Auth(web3AuthOptions);
|
|
83
83
|
setWeb3Auth(web3AuthInstance);
|
|
84
84
|
}, [config]);
|
|
85
|
-
|
|
85
|
+
react.useEffect(() => {
|
|
86
86
|
async function init() {
|
|
87
87
|
try {
|
|
88
88
|
setInitError(null);
|
|
@@ -96,7 +96,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
96
96
|
}
|
|
97
97
|
if (web3Auth) init();
|
|
98
98
|
}, [web3Auth, config]);
|
|
99
|
-
|
|
99
|
+
react.useEffect(() => {
|
|
100
100
|
const addState = async () => {
|
|
101
101
|
setProvider(web3Auth.provider);
|
|
102
102
|
const userState = await web3Auth.getUserInfo();
|
|
@@ -112,7 +112,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
112
112
|
if (isConnected) addState();else resetState();
|
|
113
113
|
}
|
|
114
114
|
}, [web3Auth, isConnected]);
|
|
115
|
-
|
|
115
|
+
react.useEffect(() => {
|
|
116
116
|
const notReadyListener = () => setStatus(web3Auth.status);
|
|
117
117
|
const readyListener = () => {
|
|
118
118
|
setStatus(web3Auth.status);
|
|
@@ -157,7 +157,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
}, [web3Auth]);
|
|
160
|
-
const value =
|
|
160
|
+
const value = react.useMemo(() => {
|
|
161
161
|
return {
|
|
162
162
|
web3Auth,
|
|
163
163
|
isConnected,
|
|
@@ -179,7 +179,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
179
179
|
connectError
|
|
180
180
|
};
|
|
181
181
|
}, [web3Auth, isConnected, isInitialized, provider, userInfo, isMFAEnabled, status, getPlugin, connect, enableMFA, manageMFA, logout, authenticateUser, switchChain, isInitializing, isConnecting, initError, connectError]);
|
|
182
|
-
return /*#__PURE__*/
|
|
182
|
+
return /*#__PURE__*/react.createElement(Web3AuthInnerContext.Provider, {
|
|
183
183
|
value
|
|
184
184
|
}, children);
|
|
185
185
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var noModal = require('@web3auth/no-modal');
|
|
4
|
-
var
|
|
4
|
+
var react = require('react');
|
|
5
5
|
var Web3AuthInnerContext = require('../context/Web3AuthInnerContext.js');
|
|
6
6
|
|
|
7
7
|
const useWeb3Auth = () => {
|
|
8
|
-
const context =
|
|
8
|
+
const context = react.useContext(Web3AuthInnerContext.Web3AuthInnerContext);
|
|
9
9
|
if (!context) {
|
|
10
10
|
throw noModal.WalletInitializationError.fromCode(1000, "usage of useWeb3Auth not wrapped in `Web3AuthContextProvider`.");
|
|
11
11
|
}
|