@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
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import "./css/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare class LoginModal extends SafeEventEmitter {
|
|
1
|
+
import "./css/index.css";
|
|
2
|
+
import { type BaseConnectorConfig, type LoginMethodConfig, type WALLET_CONNECTOR_TYPE } from "@web3auth/no-modal";
|
|
3
|
+
import { LoginModalCallbacks, LoginModalProps, UIConfig } from "./interfaces";
|
|
4
|
+
export declare class LoginModal {
|
|
6
5
|
private uiConfig;
|
|
7
6
|
private stateEmitter;
|
|
8
7
|
private chainNamespaces;
|
|
9
8
|
private walletRegistry;
|
|
10
|
-
|
|
9
|
+
private callbacks;
|
|
10
|
+
constructor(uiConfig: LoginModalProps, callbacks: LoginModalCallbacks);
|
|
11
11
|
get isDark(): boolean;
|
|
12
12
|
initModal: () => Promise<void>;
|
|
13
13
|
addSocialLogins: (connector: WALLET_CONNECTOR_TYPE, loginMethods: LoginMethodConfig, loginMethodsOrder: string[], uiConfig: Omit<UIConfig, "connectorListener">) => void;
|
|
14
|
-
addWalletLogins: (externalWalletsConfig: Record<string, BaseConnectorConfig>, options
|
|
14
|
+
addWalletLogins: (externalWalletsConfig: Record<string, BaseConnectorConfig>, options?: {
|
|
15
|
+
externalWalletsInitialized: boolean;
|
|
16
|
+
externalWalletsVisibility: boolean;
|
|
15
17
|
showExternalWalletsOnly: boolean;
|
|
16
18
|
}) => void;
|
|
17
19
|
open: () => void;
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LANGUAGE_TYPE } from "@web3auth/auth";
|
|
2
|
+
import { ClassValue } from "clsx";
|
|
3
|
+
import { browser, mobileOs, platform } from "./interfaces";
|
|
4
|
+
/** Merge classes with tailwind-merge with clsx full feature and memoization */
|
|
5
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
6
|
+
export declare const getBrowserExtensionUrl: (browserType: browser, walletId: string) => string;
|
|
7
|
+
export declare const getMobileInstallLink: (os: mobileOs, appId: string) => string;
|
|
8
|
+
export declare const getOsName: (os: mobileOs) => "iOS" | "Android" | "";
|
|
9
|
+
export declare const getBrowserName: (browserType: browser) => string;
|
|
10
|
+
export declare const getIcons: (icon: string) => string;
|
|
2
11
|
export declare function validateImageUrl(url: string): Promise<boolean>;
|
|
3
12
|
export declare function getNetworkIconId(ticker: string): Promise<string>;
|
|
4
|
-
export declare const passwordlessBackendUrl = "https://api
|
|
13
|
+
export declare const passwordlessBackendUrl = "https://api.web3auth.io/passwordless-service";
|
|
5
14
|
export declare const getUserCountry: () => Promise<{
|
|
6
15
|
country: string;
|
|
7
16
|
dialCode: string;
|
|
8
17
|
} | null>;
|
|
9
18
|
export declare const validatePhoneNumber: (phoneNumber: string) => Promise<string | boolean>;
|
|
10
19
|
export declare const getUserLanguage: (defaultLanguage: string | undefined) => LANGUAGE_TYPE;
|
|
20
|
+
export declare const getPlatform: () => platform;
|
|
21
|
+
export declare function formatIOSMobile(params: {
|
|
22
|
+
uri: string;
|
|
23
|
+
link?: string;
|
|
24
|
+
}): string;
|
|
25
|
+
export declare const getErrorMessages: (errorCode: string) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function styleInject(css, ref) {
|
|
2
2
|
if (ref === void 0) ref = {};
|
|
3
3
|
var insertAt = ref.insertAt;
|
|
4
|
-
if (
|
|
4
|
+
if (typeof document === 'undefined') {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
7
|
var head = document.head || document.getElementsByTagName('head')[0];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
-
import { Web3AuthNoModal, cloneDeep, log, CONNECTOR_EVENTS, WalletInitializationError,
|
|
3
|
+
import { Web3AuthNoModal, cloneDeep, WALLET_CONNECTORS, log, CONNECTOR_STATUS, CONNECTOR_EVENTS, WalletInitializationError, fetchProjectConfig, fetchWalletRegistry, CONNECTOR_CATEGORY, CONNECTOR_NAMES } from '@web3auth/no-modal';
|
|
4
4
|
import deepmerge from 'deepmerge';
|
|
5
5
|
import { defaultConnectorsModalConfig, walletRegistryUrl } from './config.js';
|
|
6
|
-
import { AUTH_PROVIDERS, capitalizeFirstLetter } from './ui/config.js';
|
|
6
|
+
import { AUTH_PROVIDERS_NAMES, AUTH_PROVIDERS, capitalizeFirstLetter } from './ui/config.js';
|
|
7
7
|
import { LOGIN_MODAL_EVENTS } from './ui/interfaces.js';
|
|
8
8
|
import { LoginModal } from './ui/loginModal.js';
|
|
9
9
|
import { getUserLanguage } from './ui/utils.js';
|
|
@@ -14,6 +14,54 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
14
14
|
_defineProperty(this, "loginModal", void 0);
|
|
15
15
|
_defineProperty(this, "options", void 0);
|
|
16
16
|
_defineProperty(this, "modalConfig", cloneDeep(defaultConnectorsModalConfig));
|
|
17
|
+
_defineProperty(this, "onInitExternalWallets", async params => {
|
|
18
|
+
if (params.externalWalletsInitialized) return;
|
|
19
|
+
// initialize WC connector only as other external wallets are initialized in initModal
|
|
20
|
+
await this.initExternalConnectors(this.connectors.filter(x => x.name === WALLET_CONNECTORS.WALLET_CONNECT_V2), {
|
|
21
|
+
externalWalletsInitialized: true,
|
|
22
|
+
externalWalletsVisibility: true
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
_defineProperty(this, "onSocialLogin", async params => {
|
|
26
|
+
try {
|
|
27
|
+
await this.connectTo(params.connector, params.loginParams);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
_defineProperty(this, "onExternalWalletLogin", async params => {
|
|
33
|
+
try {
|
|
34
|
+
await this.connectTo(params.connector, params.loginParams);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
_defineProperty(this, "onModalVisibility", async visibility => {
|
|
40
|
+
log.debug("is login modal visible", visibility);
|
|
41
|
+
this.emit(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, visibility);
|
|
42
|
+
const wcConnector = this.getConnector(WALLET_CONNECTORS.WALLET_CONNECT_V2);
|
|
43
|
+
if (wcConnector) {
|
|
44
|
+
const walletConnectStatus = wcConnector === null || wcConnector === void 0 ? void 0 : wcConnector.status;
|
|
45
|
+
log.debug("trying refreshing wc session", visibility, walletConnectStatus);
|
|
46
|
+
if (visibility && (walletConnectStatus === CONNECTOR_STATUS.READY || walletConnectStatus === CONNECTOR_STATUS.CONNECTING)) {
|
|
47
|
+
log.debug("refreshing wc session");
|
|
48
|
+
|
|
49
|
+
// refreshing session for wallet connect whenever modal is opened.
|
|
50
|
+
try {
|
|
51
|
+
const initialChain = this.getInitialChainIdForConnector(wcConnector);
|
|
52
|
+
wcConnector.connect({
|
|
53
|
+
chainId: initialChain.chainId
|
|
54
|
+
});
|
|
55
|
+
} catch (error) {
|
|
56
|
+
log.error(`Error while disconnecting to wallet connect in core`, error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!visibility && this.status === CONNECTOR_STATUS.CONNECTED && (walletConnectStatus === CONNECTOR_STATUS.READY || walletConnectStatus === CONNECTOR_STATUS.CONNECTING)) {
|
|
60
|
+
log.debug("this stops wc connector from trying to reconnect once proposal expires");
|
|
61
|
+
wcConnector.status = CONNECTOR_STATUS.READY;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
17
65
|
this.options = _objectSpread({}, options);
|
|
18
66
|
if (!this.options.uiConfig) this.options.uiConfig = {};
|
|
19
67
|
if (this.options.modalConfig) this.modalConfig = this.options.modalConfig;
|
|
@@ -30,6 +78,7 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
30
78
|
this.options.uiConfig = deepmerge(cloneDeep(projectConfig.whitelabel || {}), this.options.uiConfig || {});
|
|
31
79
|
if (!this.options.uiConfig.defaultLanguage) this.options.uiConfig.defaultLanguage = getUserLanguage(this.options.uiConfig.defaultLanguage);
|
|
32
80
|
if (!this.options.uiConfig.mode) this.options.uiConfig.mode = "light";
|
|
81
|
+
this.options.uiConfig = deepmerge(projectConfig.loginModal || {}, this.options.uiConfig || {});
|
|
33
82
|
|
|
34
83
|
// init config
|
|
35
84
|
super.initAccountAbstractionConfig(projectConfig);
|
|
@@ -43,10 +92,16 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
43
92
|
} = this.filterWalletRegistry(walletRegistry, projectConfig);
|
|
44
93
|
this.loginModal = new LoginModal(_objectSpread(_objectSpread({}, this.options.uiConfig), {}, {
|
|
45
94
|
connectorListener: this,
|
|
95
|
+
web3authClientId: this.options.clientId,
|
|
96
|
+
web3authNetwork: this.options.web3AuthNetwork,
|
|
46
97
|
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
98
|
walletRegistry: filteredWalletRegistry
|
|
48
|
-
})
|
|
49
|
-
|
|
99
|
+
}), {
|
|
100
|
+
onInitExternalWallets: this.onInitExternalWallets,
|
|
101
|
+
onSocialLogin: this.onSocialLogin,
|
|
102
|
+
onExternalWalletLogin: this.onExternalWalletLogin,
|
|
103
|
+
onModalVisibility: this.onModalVisibility
|
|
104
|
+
});
|
|
50
105
|
await this.loginModal.initModal();
|
|
51
106
|
|
|
52
107
|
// setup common JRPC provider
|
|
@@ -73,18 +128,29 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
73
128
|
if (this.connectedConnectorName && this.status === CONNECTOR_STATUS.CONNECTED && this.provider) return this.provider;
|
|
74
129
|
this.loginModal.open();
|
|
75
130
|
return new Promise((resolve, reject) => {
|
|
76
|
-
|
|
131
|
+
// remove all listeners when promise is resolved or rejected.
|
|
132
|
+
// this is to prevent memory leaks if user clicks connect button multiple times.
|
|
133
|
+
const handleConnected = () => {
|
|
134
|
+
this.removeListener(CONNECTOR_EVENTS.ERRORED, handleError);
|
|
135
|
+
this.removeListener(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
|
|
77
136
|
return resolve(this.provider);
|
|
78
|
-
}
|
|
79
|
-
|
|
137
|
+
};
|
|
138
|
+
const handleError = err => {
|
|
139
|
+
this.removeListener(CONNECTOR_EVENTS.CONNECTED, handleConnected);
|
|
140
|
+
this.removeListener(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
|
|
80
141
|
return reject(err);
|
|
81
|
-
}
|
|
82
|
-
|
|
142
|
+
};
|
|
143
|
+
const handleVisibility = visibility => {
|
|
83
144
|
// modal is closed but user is not connected to any wallet.
|
|
84
145
|
if (!visibility && this.status !== CONNECTOR_STATUS.CONNECTED) {
|
|
146
|
+
this.removeListener(CONNECTOR_EVENTS.CONNECTED, handleConnected);
|
|
147
|
+
this.removeListener(CONNECTOR_EVENTS.ERRORED, handleError);
|
|
85
148
|
return reject(new Error("User closed the modal"));
|
|
86
149
|
}
|
|
87
|
-
}
|
|
150
|
+
};
|
|
151
|
+
this.once(CONNECTOR_EVENTS.CONNECTED, handleConnected);
|
|
152
|
+
this.once(CONNECTOR_EVENTS.ERRORED, handleError);
|
|
153
|
+
this.once(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
|
|
88
154
|
});
|
|
89
155
|
}
|
|
90
156
|
filterWalletRegistry(walletRegistry, projectConfig) {
|
|
@@ -102,6 +168,8 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
102
168
|
if (disableAllOtherWallets) {
|
|
103
169
|
Object.keys(walletRegistry.others).forEach(wallet => disabledExternalWallets.add(wallet));
|
|
104
170
|
}
|
|
171
|
+
// always show MetaMask, force enable it
|
|
172
|
+
disabledExternalWallets.delete(WALLET_CONNECTORS.METAMASK);
|
|
105
173
|
|
|
106
174
|
// remove wallets that are disabled in project config from wallet registry
|
|
107
175
|
const filteredWalletRegistry = cloneDeep(walletRegistry);
|
|
@@ -120,12 +188,16 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
120
188
|
let projectConfig;
|
|
121
189
|
try {
|
|
122
190
|
var _this$options$account;
|
|
123
|
-
projectConfig = await fetchProjectConfig(
|
|
191
|
+
projectConfig = await fetchProjectConfig({
|
|
192
|
+
clientId: this.options.clientId,
|
|
193
|
+
web3AuthNetwork: this.options.web3AuthNetwork,
|
|
194
|
+
aaProvider: (_this$options$account = this.options.accountAbstractionConfig) === null || _this$options$account === void 0 ? void 0 : _this$options$account.smartAccountType,
|
|
195
|
+
authBuildEnv: this.options.authBuildEnv
|
|
196
|
+
});
|
|
124
197
|
} catch (e) {
|
|
125
198
|
log.error("Failed to fetch project configurations", e);
|
|
126
199
|
throw WalletInitializationError.notReady("failed to fetch project configurations", e);
|
|
127
200
|
}
|
|
128
|
-
|
|
129
201
|
// get wallet registry
|
|
130
202
|
let walletRegistry = {
|
|
131
203
|
others: {},
|
|
@@ -160,15 +232,28 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
160
232
|
hasInAppConnectors,
|
|
161
233
|
hasExternalConnectors
|
|
162
234
|
} = await this.checkConnectorAvailability(filteredConnectorNames);
|
|
235
|
+
const filteredConnectors = connectors.filter(x => filteredConnectorNames.includes(x.name));
|
|
163
236
|
if (hasInAppConnectors) {
|
|
164
|
-
await this.initInAppAndCachedConnectors(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
237
|
+
await this.initInAppAndCachedConnectors(filteredConnectors);
|
|
238
|
+
}
|
|
239
|
+
if (hasExternalConnectors) {
|
|
240
|
+
if (hasInAppConnectors) {
|
|
241
|
+
// show connect button if both in-app and external wallets are available
|
|
242
|
+
this.loginModal.initExternalWalletContainer();
|
|
243
|
+
// initialize installed external wallets (except WC), don't mark external wallets as fully initialized
|
|
244
|
+
this.initExternalConnectors(filteredConnectors.filter(x => x.type === CONNECTOR_CATEGORY.EXTERNAL && x.name !== WALLET_CONNECTORS.WALLET_CONNECT_V2), {
|
|
245
|
+
externalWalletsInitialized: false,
|
|
246
|
+
showExternalWalletsOnly: false,
|
|
247
|
+
externalWalletsVisibility: false
|
|
248
|
+
});
|
|
249
|
+
} else {
|
|
250
|
+
// if no in app wallet is available then initialize all external wallets in modal
|
|
251
|
+
await this.initExternalConnectors(filteredConnectors.filter(x => x.type === CONNECTOR_CATEGORY.EXTERNAL), {
|
|
252
|
+
externalWalletsInitialized: true,
|
|
253
|
+
showExternalWalletsOnly: true,
|
|
254
|
+
externalWalletsVisibility: true
|
|
255
|
+
});
|
|
256
|
+
}
|
|
172
257
|
}
|
|
173
258
|
|
|
174
259
|
// emit ready event if connector is ready
|
|
@@ -181,25 +266,31 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
181
266
|
projectConfig,
|
|
182
267
|
disabledExternalWallets
|
|
183
268
|
}) {
|
|
184
|
-
var _this$modalConfig2
|
|
185
|
-
// Auth connector config:
|
|
269
|
+
var _this$modalConfig2;
|
|
270
|
+
// Auth connector config: populate this with the default config for auth connectors.
|
|
186
271
|
const loginMethods = {};
|
|
272
|
+
const embedWalletConfigMap = new Map();
|
|
187
273
|
for (const authConnectionConfig of projectConfig.embeddedWalletAuth || []) {
|
|
188
274
|
const {
|
|
189
275
|
isDefault,
|
|
190
|
-
|
|
276
|
+
authConnection,
|
|
191
277
|
groupedAuthConnectionId,
|
|
192
|
-
|
|
278
|
+
authConnectionId
|
|
193
279
|
} = authConnectionConfig;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
280
|
+
if (isDefault) {
|
|
281
|
+
loginMethods[authConnection] = {
|
|
282
|
+
name: AUTH_PROVIDERS_NAMES[authConnection],
|
|
283
|
+
authConnection: authConnection,
|
|
284
|
+
authConnectionId: authConnectionId,
|
|
285
|
+
groupedAuthConnectionId: groupedAuthConnectionId,
|
|
286
|
+
extraLoginOptions: authConnectionConfig.jwtParameters,
|
|
287
|
+
isDefault: true,
|
|
288
|
+
showOnModal: true,
|
|
289
|
+
showOnDesktop: true,
|
|
290
|
+
showOnMobile: true
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
embedWalletConfigMap.set(groupedAuthConnectionId || authConnectionId, authConnectionConfig);
|
|
203
294
|
}
|
|
204
295
|
const dashboardConnectorConfig = {
|
|
205
296
|
[WALLET_CONNECTORS.AUTH]: {
|
|
@@ -207,29 +298,41 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
207
298
|
loginMethods
|
|
208
299
|
}
|
|
209
300
|
};
|
|
301
|
+
|
|
302
|
+
// populate the user config data with the dashboard config.
|
|
210
303
|
if ((_this$modalConfig2 = this.modalConfig) !== null && _this$modalConfig2 !== void 0 && (_this$modalConfig2 = _this$modalConfig2.connectors) !== null && _this$modalConfig2 !== void 0 && _this$modalConfig2[WALLET_CONNECTORS.AUTH]) {
|
|
211
304
|
if (!this.modalConfig.connectors[WALLET_CONNECTORS.AUTH].loginMethods) this.modalConfig.connectors[WALLET_CONNECTORS.AUTH].loginMethods = {};
|
|
212
305
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
306
|
+
const authProviders = new Set(AUTH_PROVIDERS);
|
|
307
|
+
Object.keys(this.modalConfig.connectors[WALLET_CONNECTORS.AUTH].loginMethods).forEach(key => {
|
|
308
|
+
const userConfig = this.modalConfig.connectors[WALLET_CONNECTORS.AUTH].loginMethods[key];
|
|
309
|
+
const {
|
|
310
|
+
authConnectionId,
|
|
311
|
+
groupedAuthConnectionId
|
|
312
|
+
} = userConfig;
|
|
313
|
+
if (!authProviders.has(key)) {
|
|
314
|
+
throw WalletInitializationError.invalidParams(`Invalid auth connection: ${key}`);
|
|
315
|
+
}
|
|
224
316
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
317
|
+
// only throw error if one of them is defined in the config.
|
|
318
|
+
if (groupedAuthConnectionId || authConnectionId) {
|
|
319
|
+
if (!embedWalletConfigMap.has(groupedAuthConnectionId || authConnectionId)) throw WalletInitializationError.invalidParams(`Invalid auth connection config, authConnection: ${key}. Missing AuthConnectionConfig from the dashboard.`);
|
|
320
|
+
const configFromDashboard = embedWalletConfigMap.get(groupedAuthConnectionId || authConnectionId);
|
|
321
|
+
this.modalConfig.connectors[WALLET_CONNECTORS.AUTH].loginMethods[key] = {
|
|
322
|
+
authConnection: configFromDashboard.authConnection,
|
|
323
|
+
authConnectionId: configFromDashboard.authConnectionId,
|
|
324
|
+
groupedAuthConnectionId: configFromDashboard.groupedAuthConnectionId,
|
|
325
|
+
isDefault: configFromDashboard.isDefault || false,
|
|
326
|
+
extraLoginOptions: _objectSpread(_objectSpread({}, configFromDashboard.jwtParameters), userConfig.extraLoginOptions)
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
this.modalConfig.connectors = deepmerge(dashboardConnectorConfig, cloneDeep(this.modalConfig.connectors || {}));
|
|
228
331
|
|
|
229
332
|
// merge default connectors with the custom configured connectors.
|
|
230
333
|
const allConnectorNames = [...new Set([...Object.keys(this.modalConfig.connectors || {}), ...this.connectors.map(connector => connector.name)])];
|
|
231
334
|
const connectorNames = allConnectorNames.map(connectorName => {
|
|
232
|
-
var _this$
|
|
335
|
+
var _this$modalConfig3, _this$modalConfig$con, _this$modalConfig$con2;
|
|
233
336
|
// start with the default config of connector.
|
|
234
337
|
const defaultConnectorConfig = {
|
|
235
338
|
label: CONNECTOR_NAMES[connectorName] || connectorName.split("-").map(capitalizeFirstLetter).join(" "),
|
|
@@ -237,7 +340,7 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
237
340
|
showOnMobile: true,
|
|
238
341
|
showOnDesktop: true
|
|
239
342
|
};
|
|
240
|
-
this.modalConfig.connectors[connectorName] = _objectSpread(_objectSpread({}, defaultConnectorConfig), ((_this$
|
|
343
|
+
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]) || {});
|
|
241
344
|
|
|
242
345
|
// check if connector is configured/added by user and exist in connectors map.
|
|
243
346
|
const connector = this.getConnector(connectorName);
|
|
@@ -253,18 +356,18 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
253
356
|
// skip connector if it is hidden by user
|
|
254
357
|
if (!connectorConfig.showOnModal) return;
|
|
255
358
|
|
|
256
|
-
// skip external connector if external wallets are disabled
|
|
257
|
-
|
|
359
|
+
// skip external connector if external wallets are disabled except for MetaMask
|
|
360
|
+
const isExternalWalletEnabled = Boolean(projectConfig.externalWalletAuth);
|
|
361
|
+
if (connector.type === CONNECTOR_CATEGORY.EXTERNAL && connector.name !== WALLET_CONNECTORS.METAMASK) {
|
|
258
362
|
if (!isExternalWalletEnabled) return;
|
|
259
363
|
if (disabledExternalWallets.has(connectorName)) return;
|
|
260
|
-
if (!isInstalledWalletWalletDisplayed) return;
|
|
261
364
|
}
|
|
262
365
|
|
|
263
366
|
// skip WC connector if external wallets are disabled or hideWalletDiscovery is true
|
|
264
367
|
if (connectorName === WALLET_CONNECTORS.WALLET_CONNECT_V2) {
|
|
265
|
-
var _this$
|
|
368
|
+
var _this$modalConfig4;
|
|
266
369
|
if (!isExternalWalletEnabled) return;
|
|
267
|
-
if ((_this$
|
|
370
|
+
if ((_this$modalConfig4 = this.modalConfig) !== null && _this$modalConfig4 !== void 0 && _this$modalConfig4.hideWalletDiscovery) return;
|
|
268
371
|
}
|
|
269
372
|
this.modalConfig.connectors[connectorName] = connectorConfig;
|
|
270
373
|
return connectorName;
|
|
@@ -296,10 +399,9 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
296
399
|
hasExternalConnectors
|
|
297
400
|
};
|
|
298
401
|
}
|
|
299
|
-
async initInAppAndCachedConnectors(connectors
|
|
300
|
-
await Promise.all(
|
|
301
|
-
const
|
|
302
|
-
if (!connector) return;
|
|
402
|
+
async initInAppAndCachedConnectors(connectors) {
|
|
403
|
+
await Promise.all(connectors.map(async connector => {
|
|
404
|
+
const connectorName = connector.name;
|
|
303
405
|
try {
|
|
304
406
|
// skip if connector is already initialized
|
|
305
407
|
if (connector.status !== CONNECTOR_STATUS.NOT_READY) return;
|
|
@@ -333,101 +435,52 @@ class Web3Auth extends Web3AuthNoModal {
|
|
|
333
435
|
}
|
|
334
436
|
}));
|
|
335
437
|
}
|
|
336
|
-
async initExternalConnectors(
|
|
337
|
-
if (externalWalletsInitialized) return;
|
|
438
|
+
async initExternalConnectors(externalConnectors, options) {
|
|
338
439
|
const connectorsConfig = {};
|
|
339
440
|
// we do it like this because we don't want one slow connector to delay the load of the entire external wallet section.
|
|
340
|
-
|
|
441
|
+
externalConnectors.forEach(async connector => {
|
|
341
442
|
const connectorName = connector.name;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
this.subscribeToConnectorEvents(connector);
|
|
443
|
+
log.debug("init external wallet", this.cachedConnector, connectorName, connector.status);
|
|
444
|
+
if (connector.status === CONNECTOR_STATUS.NOT_READY) {
|
|
345
445
|
// we are not initializing cached connector here as it is already being initialized in initModal before.
|
|
346
|
-
if (this.cachedConnector === connectorName)
|
|
347
|
-
|
|
446
|
+
if (this.cachedConnector === connectorName) return;
|
|
447
|
+
try {
|
|
448
|
+
this.subscribeToConnectorEvents(connector);
|
|
449
|
+
const initialChain = this.getInitialChainIdForConnector(connector);
|
|
450
|
+
await connector.init({
|
|
451
|
+
autoConnect: this.cachedConnector === connectorName,
|
|
452
|
+
chainId: initialChain.chainId
|
|
453
|
+
});
|
|
454
|
+
const connectorModalConfig = this.modalConfig.connectors[connectorName];
|
|
455
|
+
connectorsConfig[connectorName] = _objectSpread(_objectSpread({}, connectorModalConfig), {}, {
|
|
456
|
+
isInjected: connector.isInjected,
|
|
457
|
+
icon: connector.icon
|
|
458
|
+
});
|
|
459
|
+
this.loginModal.addWalletLogins(connectorsConfig, {
|
|
460
|
+
showExternalWalletsOnly: !!options.showExternalWalletsOnly,
|
|
461
|
+
externalWalletsVisibility: !!options.externalWalletsVisibility,
|
|
462
|
+
externalWalletsInitialized: !!options.externalWalletsInitialized
|
|
463
|
+
});
|
|
464
|
+
} catch (error) {
|
|
465
|
+
log.error(error, "error while initializing connector", connectorName);
|
|
348
466
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
const initialChain = this.getInitialChainIdForConnector(connector);
|
|
352
|
-
await connector.init({
|
|
353
|
-
autoConnect: this.cachedConnector === connectorName,
|
|
354
|
-
chainId: initialChain.chainId
|
|
355
|
-
});
|
|
356
|
-
const connectorModalConfig = this.modalConfig.connectors[connectorName];
|
|
357
|
-
connectorsConfig[connectorName] = _objectSpread(_objectSpread({}, connectorModalConfig), {}, {
|
|
358
|
-
isInjected: connector.isInjected
|
|
359
|
-
});
|
|
360
|
-
this.loginModal.addWalletLogins(connectorsConfig, {
|
|
361
|
-
showExternalWalletsOnly: !!(options !== null && options !== void 0 && options.showExternalWalletsOnly)
|
|
362
|
-
});
|
|
363
|
-
} catch (error) {
|
|
364
|
-
log.error(error, "error while initializing connector", connectorName);
|
|
365
|
-
}
|
|
366
|
-
} else if (connector.status === CONNECTOR_STATUS.READY || connector.status === CONNECTOR_STATUS.CONNECTING) {
|
|
467
|
+
} else {
|
|
468
|
+
if (connector.status === CONNECTOR_STATUS.READY || connector.status === CONNECTOR_STATUS.CONNECTING) {
|
|
367
469
|
// we use connecting status for wallet connect
|
|
368
470
|
const connectorModalConfig = this.modalConfig.connectors[connectorName];
|
|
369
471
|
connectorsConfig[connectorName] = _objectSpread(_objectSpread({}, connectorModalConfig), {}, {
|
|
370
|
-
isInjected: connector.isInjected
|
|
472
|
+
isInjected: connector.isInjected,
|
|
473
|
+
icon: connector.icon
|
|
371
474
|
});
|
|
372
475
|
this.loginModal.addWalletLogins(connectorsConfig, {
|
|
373
|
-
showExternalWalletsOnly: !!
|
|
476
|
+
showExternalWalletsOnly: !!options.showExternalWalletsOnly,
|
|
477
|
+
externalWalletsVisibility: !!options.externalWalletsVisibility,
|
|
478
|
+
externalWalletsInitialized: !!options.externalWalletsInitialized
|
|
374
479
|
});
|
|
375
480
|
}
|
|
376
481
|
}
|
|
377
482
|
});
|
|
378
483
|
}
|
|
379
|
-
subscribeToLoginModalEvents() {
|
|
380
|
-
this.loginModal.on(LOGIN_MODAL_EVENTS.EXTERNAL_WALLET_LOGIN, async params => {
|
|
381
|
-
try {
|
|
382
|
-
await this.connectTo(params.connector);
|
|
383
|
-
} catch (error) {
|
|
384
|
-
log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
this.loginModal.on(LOGIN_MODAL_EVENTS.SOCIAL_LOGIN, async params => {
|
|
388
|
-
try {
|
|
389
|
-
await this.connectTo(params.connector, params.loginParams);
|
|
390
|
-
} catch (error) {
|
|
391
|
-
log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
this.loginModal.on(LOGIN_MODAL_EVENTS.INIT_EXTERNAL_WALLETS, async params => {
|
|
395
|
-
await this.initExternalConnectors(this.connectors, params.externalWalletsInitialized);
|
|
396
|
-
});
|
|
397
|
-
this.loginModal.on(LOGIN_MODAL_EVENTS.DISCONNECT, async () => {
|
|
398
|
-
try {
|
|
399
|
-
await this.logout();
|
|
400
|
-
} catch (error) {
|
|
401
|
-
log.error(`Error while disconnecting`, error);
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
this.loginModal.on(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, async visibility => {
|
|
405
|
-
log.debug("is login modal visible", visibility);
|
|
406
|
-
this.emit(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, visibility);
|
|
407
|
-
const wcConnector = this.getConnector(WALLET_CONNECTORS.WALLET_CONNECT_V2);
|
|
408
|
-
if (wcConnector) {
|
|
409
|
-
const walletConnectStatus = wcConnector === null || wcConnector === void 0 ? void 0 : wcConnector.status;
|
|
410
|
-
log.debug("trying refreshing wc session", visibility, walletConnectStatus);
|
|
411
|
-
if (visibility && (walletConnectStatus === CONNECTOR_STATUS.READY || walletConnectStatus === CONNECTOR_STATUS.CONNECTING)) {
|
|
412
|
-
log.debug("refreshing wc session");
|
|
413
|
-
|
|
414
|
-
// refreshing session for wallet connect whenever modal is opened.
|
|
415
|
-
try {
|
|
416
|
-
const initialChain = this.getInitialChainIdForConnector(wcConnector);
|
|
417
|
-
wcConnector.connect({
|
|
418
|
-
chainId: initialChain.chainId
|
|
419
|
-
});
|
|
420
|
-
} catch (error) {
|
|
421
|
-
log.error(`Error while disconnecting to wallet connect in core`, error);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
if (!visibility && this.status === CONNECTOR_STATUS.CONNECTED && (walletConnectStatus === CONNECTOR_STATUS.READY || walletConnectStatus === CONNECTOR_STATUS.CONNECTING)) {
|
|
425
|
-
log.debug("this stops wc connector from trying to reconnect once proposal expires");
|
|
426
|
-
wcConnector.status = CONNECTOR_STATUS.READY;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
484
|
}
|
|
432
485
|
|
|
433
486
|
export { Web3Auth };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { cn } from '../../utils.js';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* BottomSheet component
|
|
6
|
+
* @returns BottomSheet component
|
|
7
|
+
*/
|
|
8
|
+
function BottomSheet({
|
|
9
|
+
isShown,
|
|
10
|
+
onClose,
|
|
11
|
+
children,
|
|
12
|
+
uiConfig
|
|
13
|
+
}) {
|
|
14
|
+
const {
|
|
15
|
+
borderRadiusType
|
|
16
|
+
} = uiConfig;
|
|
17
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
18
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
19
|
+
className: cn("w3a--bottom-sheet-bg w3a--fixed w3a--left-0 w3a--top-0 w3a--size-full w3a--transition-opacity w3a--duration-300", {
|
|
20
|
+
"w3a--rounded-[30px]": borderRadiusType === "large",
|
|
21
|
+
"w3a--rounded-2xl": borderRadiusType === "medium",
|
|
22
|
+
"w3a--rounded-none": borderRadiusType === "small"
|
|
23
|
+
}),
|
|
24
|
+
onClick: onClose,
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
role: "button"
|
|
27
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
28
|
+
className: cn(`w3a--fixed w3a--bottom-2 w3a--left-2 w3a--mx-auto w3a--flex w3a--w-[96%] w3a--flex-col
|
|
29
|
+
w3a--gap-y-2 w3a--rounded-3xl w3a--border w3a--border-app-gray-100 w3a--bg-app-white w3a--p-4 w3a--shadow-lg w3a--transition-transform w3a--duration-500
|
|
30
|
+
w3a--ease-out dark:w3a--border-app-gray-600 dark:w3a--bg-app-dark-surface-main
|
|
31
|
+
${isShown ? "w3a--translate-y-0 w3a--delay-700" : "w3a--translate-y-full"}`, {
|
|
32
|
+
"w3a--rounded-[30px]": borderRadiusType === "large",
|
|
33
|
+
"w3a--rounded-2xl": borderRadiusType === "medium",
|
|
34
|
+
"w3a--rounded-none": borderRadiusType === "small"
|
|
35
|
+
}),
|
|
36
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
37
|
+
className: "w3a--absolute w3a--right-4 w3a--top-[16px] w3a--z-10 w3a--cursor-pointer",
|
|
38
|
+
children: /*#__PURE__*/jsx("svg", {
|
|
39
|
+
width: "13",
|
|
40
|
+
height: "13",
|
|
41
|
+
viewBox: "0 0 13 13",
|
|
42
|
+
fill: "none",
|
|
43
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44
|
+
onClick: onClose,
|
|
45
|
+
className: "w3a--text-app-gray-500 dark:w3a--text-app-gray-200",
|
|
46
|
+
children: /*#__PURE__*/jsx("path", {
|
|
47
|
+
fillRule: "evenodd",
|
|
48
|
+
clipRule: "evenodd",
|
|
49
|
+
d: "M0.292787 1.29299C0.480314 1.10552 0.734622 1.0002 0.999786 1.0002C1.26495 1.0002 1.51926 1.10552 1.70679 1.29299L5.99979 5.58599L10.2928 1.29299C10.385 1.19748 10.4954 1.1213 10.6174 1.06889C10.7394 1.01648 10.8706 0.988893 11.0034 0.987739C11.1362 0.986585 11.2678 1.01189 11.3907 1.06217C11.5136 1.11245 11.6253 1.1867 11.7192 1.28059C11.8131 1.37449 11.8873 1.48614 11.9376 1.60904C11.9879 1.73193 12.0132 1.86361 12.012 1.99639C12.0109 2.12917 11.9833 2.26039 11.9309 2.38239C11.8785 2.5044 11.8023 2.61474 11.7068 2.70699L7.41379 6.99999L11.7068 11.293C11.8889 11.4816 11.9897 11.7342 11.9875 11.9964C11.9852 12.2586 11.88 12.5094 11.6946 12.6948C11.5092 12.8802 11.2584 12.9854 10.9962 12.9877C10.734 12.9899 10.4814 12.8891 10.2928 12.707L5.99979 8.41399L1.70679 12.707C1.51818 12.8891 1.26558 12.9899 1.00339 12.9877C0.741188 12.9854 0.490376 12.8802 0.304968 12.6948C0.11956 12.5094 0.0143906 12.2586 0.0121121 11.9964C0.00983372 11.7342 0.110629 11.4816 0.292787 11.293L4.58579 6.99999L0.292787 2.70699C0.105316 2.51946 0 2.26515 0 1.99999C0 1.73483 0.105316 1.48052 0.292787 1.29299V1.29299Z",
|
|
50
|
+
fill: "currentColor"
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
}), children]
|
|
54
|
+
})]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { BottomSheet as default };
|