@web3auth/modal 10.0.0-alpha.2 → 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/config.js +3 -57
- package/dist/lib.cjs/packages/modal/src/index.js +1 -5
- package/dist/lib.cjs/packages/modal/src/modalManager.js +286 -189
- package/dist/lib.cjs/packages/modal/src/react/Web3AuthProvider.js +2 -2
- package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +27 -38
- 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 +10 -0
- 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 +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/english.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/french.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/german.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/japanese.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/korean.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/mandarin.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/portuguese.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/spanish.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/i18n/turkish.json.js +38 -2
- package/dist/lib.cjs/packages/modal/src/ui/interfaces.js +7 -10
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +69 -43
- package/dist/lib.cjs/packages/modal/src/ui/utils.js +105 -20
- package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +1 -12
- package/dist/lib.cjs/types/config.d.ts +1 -5
- package/dist/lib.cjs/types/interface.d.ts +2 -6
- package/dist/lib.cjs/types/modalManager.d.ts +11 -4
- package/dist/lib.cjs/types/react/interfaces.d.ts +1 -6
- 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 +116 -15
- package/dist/lib.cjs/types/ui/loginModal.d.ts +9 -7
- package/dist/lib.cjs/types/ui/utils.d.ts +16 -3
- package/dist/lib.cjs/types/vue/interfaces.d.ts +1 -6
- package/dist/lib.esm/node_modules/style-inject/dist/style-inject.es.js +1 -1
- package/dist/lib.esm/packages/modal/src/config.js +4 -54
- package/dist/lib.esm/packages/modal/src/index.js +1 -1
- package/dist/lib.esm/packages/modal/src/modalManager.js +299 -195
- package/dist/lib.esm/packages/modal/src/react/context/Web3AuthInnerContext.js +1 -12
- 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 +9 -2
- 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 +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/english.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/french.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/german.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/japanese.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/korean.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/mandarin.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/portuguese.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/spanish.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/i18n/turkish.json.js +38 -3
- package/dist/lib.esm/packages/modal/src/ui/interfaces.js +8 -9
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +70 -44
- package/dist/lib.esm/packages/modal/src/ui/utils.js +104 -22
- package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +1 -12
- 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 -274
- 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 -244
- 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 -148
- package/dist/lib.cjs/packages/modal/src/ui/components/SocialLogins.js +0 -152
- 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 -276
- 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 -243
- 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 -146
- package/dist/lib.esm/packages/modal/src/ui/components/SocialLogins.js +0 -151
- 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,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,23 +82,12 @@ 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);
|
|
89
89
|
setIsInitializing(true);
|
|
90
|
-
|
|
91
|
-
modalConfig,
|
|
92
|
-
hideWalletDiscovery
|
|
93
|
-
} = config;
|
|
94
|
-
if (modalConfig) {
|
|
95
|
-
await web3Auth.initModal({
|
|
96
|
-
modalConfig,
|
|
97
|
-
hideWalletDiscovery
|
|
98
|
-
});
|
|
99
|
-
} else {
|
|
100
|
-
await web3Auth.initModal();
|
|
101
|
-
}
|
|
90
|
+
await web3Auth.initModal();
|
|
102
91
|
} catch (error) {
|
|
103
92
|
setInitError(error);
|
|
104
93
|
} finally {
|
|
@@ -107,7 +96,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
107
96
|
}
|
|
108
97
|
if (web3Auth) init();
|
|
109
98
|
}, [web3Auth, config]);
|
|
110
|
-
|
|
99
|
+
react.useEffect(() => {
|
|
111
100
|
const addState = async () => {
|
|
112
101
|
setProvider(web3Auth.provider);
|
|
113
102
|
const userState = await web3Auth.getUserInfo();
|
|
@@ -123,7 +112,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
123
112
|
if (isConnected) addState();else resetState();
|
|
124
113
|
}
|
|
125
114
|
}, [web3Auth, isConnected]);
|
|
126
|
-
|
|
115
|
+
react.useEffect(() => {
|
|
127
116
|
const notReadyListener = () => setStatus(web3Auth.status);
|
|
128
117
|
const readyListener = () => {
|
|
129
118
|
setStatus(web3Auth.status);
|
|
@@ -168,7 +157,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
168
157
|
}
|
|
169
158
|
};
|
|
170
159
|
}, [web3Auth]);
|
|
171
|
-
const value =
|
|
160
|
+
const value = react.useMemo(() => {
|
|
172
161
|
return {
|
|
173
162
|
web3Auth,
|
|
174
163
|
isConnected,
|
|
@@ -190,7 +179,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
190
179
|
connectError
|
|
191
180
|
};
|
|
192
181
|
}, [web3Auth, isConnected, isInitialized, provider, userInfo, isMFAEnabled, status, getPlugin, connect, enableMFA, manageMFA, logout, authenticateUser, switchChain, isInitializing, isConnecting, initError, connectError]);
|
|
193
|
-
return /*#__PURE__*/
|
|
182
|
+
return /*#__PURE__*/react.createElement(Web3AuthInnerContext.Provider, {
|
|
194
183
|
value
|
|
195
184
|
}, children);
|
|
196
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
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var utils = require('../../utils.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* BottomSheet component
|
|
8
|
+
* @returns BottomSheet component
|
|
9
|
+
*/
|
|
10
|
+
function BottomSheet({
|
|
11
|
+
isShown,
|
|
12
|
+
onClose,
|
|
13
|
+
children,
|
|
14
|
+
uiConfig
|
|
15
|
+
}) {
|
|
16
|
+
const {
|
|
17
|
+
borderRadiusType
|
|
18
|
+
} = uiConfig;
|
|
19
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
20
|
+
children: [jsxRuntime.jsx("div", {
|
|
21
|
+
className: utils.cn("w3a--bottom-sheet-bg w3a--fixed w3a--left-0 w3a--top-0 w3a--size-full w3a--transition-opacity w3a--duration-300", {
|
|
22
|
+
"w3a--rounded-[30px]": borderRadiusType === "large",
|
|
23
|
+
"w3a--rounded-2xl": borderRadiusType === "medium",
|
|
24
|
+
"w3a--rounded-none": borderRadiusType === "small"
|
|
25
|
+
}),
|
|
26
|
+
onClick: onClose,
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
role: "button"
|
|
29
|
+
}), jsxRuntime.jsxs("div", {
|
|
30
|
+
className: utils.cn(`w3a--fixed w3a--bottom-2 w3a--left-2 w3a--mx-auto w3a--flex w3a--w-[96%] w3a--flex-col
|
|
31
|
+
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
|
|
32
|
+
w3a--ease-out dark:w3a--border-app-gray-600 dark:w3a--bg-app-dark-surface-main
|
|
33
|
+
${isShown ? "w3a--translate-y-0 w3a--delay-700" : "w3a--translate-y-full"}`, {
|
|
34
|
+
"w3a--rounded-[30px]": borderRadiusType === "large",
|
|
35
|
+
"w3a--rounded-2xl": borderRadiusType === "medium",
|
|
36
|
+
"w3a--rounded-none": borderRadiusType === "small"
|
|
37
|
+
}),
|
|
38
|
+
children: [jsxRuntime.jsx("div", {
|
|
39
|
+
className: "w3a--absolute w3a--right-4 w3a--top-[16px] w3a--z-10 w3a--cursor-pointer",
|
|
40
|
+
children: jsxRuntime.jsx("svg", {
|
|
41
|
+
width: "13",
|
|
42
|
+
height: "13",
|
|
43
|
+
viewBox: "0 0 13 13",
|
|
44
|
+
fill: "none",
|
|
45
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
46
|
+
onClick: onClose,
|
|
47
|
+
className: "w3a--text-app-gray-500 dark:w3a--text-app-gray-200",
|
|
48
|
+
children: jsxRuntime.jsx("path", {
|
|
49
|
+
fillRule: "evenodd",
|
|
50
|
+
clipRule: "evenodd",
|
|
51
|
+
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",
|
|
52
|
+
fill: "currentColor"
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
}), children]
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = BottomSheet;
|
|
@@ -1,33 +1,58 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
require('./
|
|
5
|
-
var
|
|
4
|
+
var Button_type = require('./Button.type.js');
|
|
5
|
+
var ButtonSocial = require('./ButtonSocial/ButtonSocial.js');
|
|
6
|
+
var ButtonWallet = require('./ButtonWallet/ButtonWallet.js');
|
|
6
7
|
|
|
7
8
|
function Button(props) {
|
|
8
9
|
const {
|
|
9
|
-
|
|
10
|
+
type,
|
|
11
|
+
props: buttonProps
|
|
12
|
+
} = props;
|
|
13
|
+
const SocialButtonProps = buttonProps;
|
|
14
|
+
const WalletButtonProps = buttonProps;
|
|
15
|
+
const {
|
|
16
|
+
text,
|
|
17
|
+
showIcon,
|
|
18
|
+
showText,
|
|
19
|
+
method,
|
|
20
|
+
isDark,
|
|
21
|
+
isPrimaryBtn,
|
|
10
22
|
onClick,
|
|
11
23
|
children,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
btnStyle,
|
|
25
|
+
buttonRadius
|
|
26
|
+
} = SocialButtonProps;
|
|
27
|
+
const {
|
|
28
|
+
label,
|
|
29
|
+
onClick: walletOnClick,
|
|
30
|
+
button,
|
|
31
|
+
deviceDetails,
|
|
32
|
+
walletConnectUri,
|
|
33
|
+
buttonRadius: walletButtonRadius
|
|
34
|
+
} = WalletButtonProps;
|
|
35
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
36
|
+
children: [type === Button_type.BUTTON_TYPE.SOCIAL && jsxRuntime.jsx(ButtonSocial, {
|
|
37
|
+
text: text,
|
|
38
|
+
showIcon: showIcon,
|
|
39
|
+
showText: showText,
|
|
40
|
+
method: method,
|
|
41
|
+
isDark: isDark,
|
|
42
|
+
isPrimaryBtn: isPrimaryBtn,
|
|
43
|
+
onClick: onClick,
|
|
44
|
+
btnStyle: btnStyle,
|
|
45
|
+
buttonRadius: buttonRadius,
|
|
46
|
+
children: children
|
|
47
|
+
}), type === Button_type.BUTTON_TYPE.WALLET && jsxRuntime.jsx(ButtonWallet, {
|
|
48
|
+
label: label,
|
|
49
|
+
walletConnectUri: walletConnectUri,
|
|
50
|
+
onClick: walletOnClick,
|
|
51
|
+
button: button,
|
|
52
|
+
deviceDetails: deviceDetails,
|
|
53
|
+
buttonRadius: walletButtonRadius
|
|
54
|
+
})]
|
|
29
55
|
});
|
|
30
56
|
}
|
|
31
|
-
var Button$1 = /*#__PURE__*/React.memo(Button);
|
|
32
57
|
|
|
33
|
-
module.exports = Button
|
|
58
|
+
module.exports = Button;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var auth = require('@web3auth/auth');
|
|
5
|
+
var utils = require('../../../utils.js');
|
|
6
|
+
var Image = require('../../Image/Image.js');
|
|
7
|
+
|
|
8
|
+
function getProviderIcon(method, isDark, isPrimaryBtn) {
|
|
9
|
+
const imageId = method === auth.AUTH_CONNECTION.TWITTER ? `login-twitter-x${isDark ? "-light" : "-dark"}` : `login-${method}${isDark ? "-light" : "-dark"}`;
|
|
10
|
+
const hoverId = method === auth.AUTH_CONNECTION.APPLE || method === auth.AUTH_CONNECTION.GITHUB || method === auth.AUTH_CONNECTION.TWITTER ? imageId : `login-${method}-active`;
|
|
11
|
+
if (isPrimaryBtn) {
|
|
12
|
+
return jsxRuntime.jsx(Image, {
|
|
13
|
+
width: "20",
|
|
14
|
+
imageId: hoverId,
|
|
15
|
+
hoverImageId: hoverId,
|
|
16
|
+
isButton: true
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return jsxRuntime.jsx(Image, {
|
|
20
|
+
width: "20",
|
|
21
|
+
imageId: imageId,
|
|
22
|
+
hoverImageId: hoverId
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function SocialLoginButton(props) {
|
|
26
|
+
const {
|
|
27
|
+
text,
|
|
28
|
+
showIcon,
|
|
29
|
+
showText,
|
|
30
|
+
method,
|
|
31
|
+
isDark,
|
|
32
|
+
isPrimaryBtn,
|
|
33
|
+
onClick,
|
|
34
|
+
children,
|
|
35
|
+
btnStyle,
|
|
36
|
+
buttonRadius = "pill"
|
|
37
|
+
} = props;
|
|
38
|
+
return jsxRuntime.jsxs("button", {
|
|
39
|
+
type: "button",
|
|
40
|
+
onClick: e => onClick && onClick(e),
|
|
41
|
+
className: utils.cn("w3a--btn", btnStyle, {
|
|
42
|
+
"w3a--rounded-full": buttonRadius === "pill",
|
|
43
|
+
"w3a--rounded-lg": buttonRadius === "rounded",
|
|
44
|
+
"w3a--rounded-none": buttonRadius === "square"
|
|
45
|
+
}),
|
|
46
|
+
children: [showIcon && getProviderIcon(method, isDark, isPrimaryBtn), showText && jsxRuntime.jsx("p", {
|
|
47
|
+
className: "w3a--text-sm w3a--font-normal w3a--text-app-gray-900 dark:w3a--text-app-white",
|
|
48
|
+
children: text
|
|
49
|
+
}), children]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = SocialLoginButton;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var cn = require('classnames');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var reactI18next = require('react-i18next');
|
|
7
|
+
var localeImport = require('../../../localeImport.js');
|
|
8
|
+
var utils = require('../../../utils.js');
|
|
9
|
+
var Image = require('../../Image/Image.js');
|
|
10
|
+
|
|
11
|
+
function ButtonWallet(props) {
|
|
12
|
+
const [t] = reactI18next.useTranslation(undefined, {
|
|
13
|
+
i18n: localeImport
|
|
14
|
+
});
|
|
15
|
+
const {
|
|
16
|
+
deviceDetails,
|
|
17
|
+
button,
|
|
18
|
+
walletConnectUri,
|
|
19
|
+
onClick,
|
|
20
|
+
label,
|
|
21
|
+
buttonRadius
|
|
22
|
+
} = props;
|
|
23
|
+
const isLink = react.useMemo(() => deviceDetails.platform !== "desktop" && button.href && button.hasWalletConnect && !button.hasInjectedWallet, [deviceDetails, button]);
|
|
24
|
+
const href = react.useMemo(() => button.href ? utils.formatIOSMobile({
|
|
25
|
+
uri: walletConnectUri,
|
|
26
|
+
link: button.href
|
|
27
|
+
}) : walletConnectUri, [button, walletConnectUri]);
|
|
28
|
+
const handleBtnClick = () => {
|
|
29
|
+
if (href && isLink) {
|
|
30
|
+
window.open(href, "_blank");
|
|
31
|
+
} else if (onClick) {
|
|
32
|
+
onClick();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return jsxRuntime.jsxs("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
className: cn(`w3a--flex w3a--w-full w3a--items-center w3a--justify-between w3a--bg-app-gray-50 w3a--p-3 hover:w3a--bg-app-gray-200 hover:w3a--text-app-gray-900 dark:w3a--bg-app-gray-800 dark:hover:w3a--bg-app-gray-600`, {
|
|
38
|
+
"w3a--rounded-full": buttonRadius === "pill",
|
|
39
|
+
"w3a--rounded-lg": buttonRadius === "rounded",
|
|
40
|
+
"w3a--rounded-none": buttonRadius === "square"
|
|
41
|
+
}),
|
|
42
|
+
onClick: handleBtnClick,
|
|
43
|
+
children: [jsxRuntime.jsxs("div", {
|
|
44
|
+
className: "w3a--flex w3a--items-center w3a--gap-x-2",
|
|
45
|
+
children: [jsxRuntime.jsx("figure", {
|
|
46
|
+
className: button.icon ? "w3a--size-5" : "w3a--size-5 w3a--rounded-full w3a--bg-app-gray-300",
|
|
47
|
+
children: jsxRuntime.jsx(Image, {
|
|
48
|
+
imageData: button.icon,
|
|
49
|
+
imageId: `login-${button.name}`,
|
|
50
|
+
hoverImageId: `login-${button.name}`,
|
|
51
|
+
fallbackImageId: "wallet",
|
|
52
|
+
height: "24",
|
|
53
|
+
width: "24",
|
|
54
|
+
isButton: true,
|
|
55
|
+
extension: button.imgExtension || "webp"
|
|
56
|
+
})
|
|
57
|
+
}), jsxRuntime.jsx("p", {
|
|
58
|
+
className: "w3a--text-base w3a--font-normal w3a--text-app-gray-700 dark:w3a--text-app-white",
|
|
59
|
+
children: label
|
|
60
|
+
})]
|
|
61
|
+
}), button.hasInjectedWallet && jsxRuntime.jsx("span", {
|
|
62
|
+
className: "w3a--inline-flex w3a--items-center w3a--rounded-md w3a--bg-app-primary-100 w3a--px-2 w3a--py-1 w3a--text-xs w3a--font-medium w3a--text-app-primary-800 \n dark:w3a--border dark:w3a--border-app-primary-400 dark:w3a--bg-transparent dark:w3a--text-app-primary-400",
|
|
63
|
+
children: t("modal.external.installed")
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = ButtonWallet;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var noModal = require('@web3auth/no-modal');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var constants = require('../../constants.js');
|
|
8
|
+
var RootContext = require('../../context/RootContext.js');
|
|
9
|
+
var ConnectWalletChainFilter = require('./ConnectWalletChainFilter/ConnectWalletChainFilter.js');
|
|
10
|
+
var ConnectWalletHeader = require('./ConnectWalletHeader/ConnectWalletHeader.js');
|
|
11
|
+
var ConnectWalletList = require('./ConnectWalletList/ConnectWalletList.js');
|
|
12
|
+
var ConnectWalletQrCode = require('./ConnectWalletQrCode/ConnectWalletQrCode.js');
|
|
13
|
+
var ConnectWalletSearch = require('./ConnectWalletSearch/ConnectWalletSearch.js');
|
|
14
|
+
|
|
15
|
+
function ConnectWallet(props) {
|
|
16
|
+
var _selectedButton$walle;
|
|
17
|
+
const {
|
|
18
|
+
isDark,
|
|
19
|
+
config,
|
|
20
|
+
walletConnectUri,
|
|
21
|
+
walletRegistry,
|
|
22
|
+
allExternalButtons,
|
|
23
|
+
customConnectorButtons,
|
|
24
|
+
connectorVisibilityMap,
|
|
25
|
+
deviceDetails,
|
|
26
|
+
buttonRadius = "pill",
|
|
27
|
+
chainNamespace,
|
|
28
|
+
onBackClick,
|
|
29
|
+
handleExternalWalletClick,
|
|
30
|
+
handleWalletDetailsHeight
|
|
31
|
+
} = props;
|
|
32
|
+
const {
|
|
33
|
+
bodyState,
|
|
34
|
+
setBodyState,
|
|
35
|
+
toast,
|
|
36
|
+
setToast
|
|
37
|
+
} = react.useContext(RootContext.RootContext);
|
|
38
|
+
const [currentPage, setCurrentPage] = react.useState(constants.CONNECT_WALLET_PAGES.CONNECT_WALLET);
|
|
39
|
+
const [selectedWallet, setSelectedWallet] = react.useState(false);
|
|
40
|
+
const [isLoading] = react.useState(false);
|
|
41
|
+
const [selectedButton, setSelectedButton] = react.useState(null);
|
|
42
|
+
const [walletSearch, setWalletSearch] = react.useState("");
|
|
43
|
+
const [selectedChain, setSelectedChain] = react.useState("all");
|
|
44
|
+
const [isShowAllWallets, setIsShowAllWallets] = react.useState(false);
|
|
45
|
+
const handleBack = () => {
|
|
46
|
+
if (!selectedWallet && currentPage === constants.CONNECT_WALLET_PAGES.CONNECT_WALLET && onBackClick) {
|
|
47
|
+
onBackClick(false);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (selectedWallet) {
|
|
51
|
+
setCurrentPage(constants.CONNECT_WALLET_PAGES.CONNECT_WALLET);
|
|
52
|
+
setSelectedWallet(false);
|
|
53
|
+
handleWalletDetailsHeight();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const walletDiscoverySupported = react.useMemo(() => {
|
|
57
|
+
const supported = walletRegistry && Object.keys(walletRegistry.default || {}).length > 0 && Object.keys(walletRegistry.others || {}).length > 0;
|
|
58
|
+
return supported;
|
|
59
|
+
}, [walletRegistry]);
|
|
60
|
+
const allUniqueButtons = react.useMemo(() => {
|
|
61
|
+
const uniqueButtonSet = new Set();
|
|
62
|
+
return allExternalButtons.concat(customConnectorButtons).filter(button => {
|
|
63
|
+
if (uniqueButtonSet.has(button.name)) return false;
|
|
64
|
+
uniqueButtonSet.add(button.name);
|
|
65
|
+
return true;
|
|
66
|
+
});
|
|
67
|
+
}, [allExternalButtons, customConnectorButtons]);
|
|
68
|
+
const defaultButtonKeys = react.useMemo(() => new Set(Object.keys(walletRegistry.default)), [walletRegistry]);
|
|
69
|
+
const defaultButtons = react.useMemo(() => {
|
|
70
|
+
// display order: default injected buttons > custom adapter buttons > default non-injected buttons
|
|
71
|
+
const buttons = [...allExternalButtons.filter(button => button.hasInjectedWallet && defaultButtonKeys.has(button.name)), ...customConnectorButtons, ...allExternalButtons.filter(button => !button.hasInjectedWallet && defaultButtonKeys.has(button.name))];
|
|
72
|
+
const buttonSet = new Set();
|
|
73
|
+
return buttons.filter(button => {
|
|
74
|
+
if (buttonSet.has(button.name)) return false;
|
|
75
|
+
buttonSet.add(button.name);
|
|
76
|
+
return true;
|
|
77
|
+
}).filter(button => {
|
|
78
|
+
var _button$chainNamespac;
|
|
79
|
+
return selectedChain === "all" || ((_button$chainNamespac = button.chainNamespaces) === null || _button$chainNamespac === void 0 ? void 0 : _button$chainNamespac.includes(selectedChain));
|
|
80
|
+
});
|
|
81
|
+
}, [allExternalButtons, customConnectorButtons, defaultButtonKeys, selectedChain]);
|
|
82
|
+
const installedWalletButtons = react.useMemo(() => {
|
|
83
|
+
const visibilityMap = connectorVisibilityMap;
|
|
84
|
+
return Object.keys(config).reduce((acc, adapter) => {
|
|
85
|
+
if (![noModal.WALLET_CONNECTORS.WALLET_CONNECT_V2].includes(adapter) && visibilityMap[adapter]) {
|
|
86
|
+
acc.push({
|
|
87
|
+
name: adapter,
|
|
88
|
+
displayName: config[adapter].label || adapter,
|
|
89
|
+
hasInjectedWallet: config[adapter].isInjected,
|
|
90
|
+
hasWalletConnect: false,
|
|
91
|
+
hasInstallLinks: false
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return acc;
|
|
95
|
+
}, []);
|
|
96
|
+
}, [connectorVisibilityMap, config]);
|
|
97
|
+
const handleWalletSearch = e => {
|
|
98
|
+
const searchValue = e.target.value;
|
|
99
|
+
setWalletSearch(searchValue);
|
|
100
|
+
};
|
|
101
|
+
const handleChainFilterChange = chain => {
|
|
102
|
+
setSelectedChain(chain);
|
|
103
|
+
setIsShowAllWallets(false);
|
|
104
|
+
};
|
|
105
|
+
const filteredButtons = react.useMemo(() => {
|
|
106
|
+
if (walletDiscoverySupported) {
|
|
107
|
+
return allUniqueButtons.filter(button => selectedChain === "all" || button.chainNamespaces.includes(selectedChain)).filter(button => button.name.toLowerCase().includes(walletSearch.toLowerCase()));
|
|
108
|
+
}
|
|
109
|
+
return installedWalletButtons;
|
|
110
|
+
}, [walletDiscoverySupported, installedWalletButtons, walletSearch, allUniqueButtons, selectedChain]);
|
|
111
|
+
const externalButtons = react.useMemo(() => {
|
|
112
|
+
if (walletDiscoverySupported && !walletSearch && !isShowAllWallets) {
|
|
113
|
+
return defaultButtons;
|
|
114
|
+
}
|
|
115
|
+
return filteredButtons;
|
|
116
|
+
}, [walletDiscoverySupported, walletSearch, filteredButtons, defaultButtons, isShowAllWallets]);
|
|
117
|
+
const totalExternalWalletsCount = react.useMemo(() => filteredButtons.length, [filteredButtons]);
|
|
118
|
+
const initialWalletCount = react.useMemo(() => {
|
|
119
|
+
if (isShowAllWallets) return totalExternalWalletsCount;
|
|
120
|
+
return walletDiscoverySupported ? defaultButtons.length : installedWalletButtons.length;
|
|
121
|
+
}, [walletDiscoverySupported, defaultButtons, installedWalletButtons, isShowAllWallets, totalExternalWalletsCount]);
|
|
122
|
+
const handleWalletClick = button => {
|
|
123
|
+
var _button$chainNamespac2, _button$chainNamespac3;
|
|
124
|
+
// show chain namespace selector if the button is an injected connector with multiple chain namespaces
|
|
125
|
+
const isChainNamespaceSelectorRequired = button.hasInjectedWallet && ((_button$chainNamespac2 = button.chainNamespaces) === null || _button$chainNamespac2 === void 0 ? void 0 : _button$chainNamespac2.length) > 1;
|
|
126
|
+
if (isChainNamespaceSelectorRequired) {
|
|
127
|
+
setBodyState(_objectSpread(_objectSpread({}, bodyState), {}, {
|
|
128
|
+
showMultiChainSelector: true,
|
|
129
|
+
walletDetails: button
|
|
130
|
+
}));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const isInjectedConnectorAndSingleChainNamespace = button.hasInjectedWallet && ((_button$chainNamespac3 = button.chainNamespaces) === null || _button$chainNamespac3 === void 0 ? void 0 : _button$chainNamespac3.length) === 1;
|
|
134
|
+
// if doesn't have wallet connect & doesn't have install links, must be a custom connector
|
|
135
|
+
const isCustomConnector = !button.hasInjectedWallet && !button.hasWalletConnect && !button.hasInstallLinks;
|
|
136
|
+
if (isInjectedConnectorAndSingleChainNamespace || isCustomConnector) {
|
|
137
|
+
return handleExternalWalletClick({
|
|
138
|
+
connector: button.name
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (button.hasWalletConnect || !isInjectedConnectorAndSingleChainNamespace) {
|
|
142
|
+
setSelectedButton(button);
|
|
143
|
+
setSelectedWallet(true);
|
|
144
|
+
setCurrentPage(constants.CONNECT_WALLET_PAGES.SELECTED_WALLET);
|
|
145
|
+
handleWalletDetailsHeight();
|
|
146
|
+
} else {
|
|
147
|
+
setBodyState(_objectSpread(_objectSpread({}, bodyState), {}, {
|
|
148
|
+
showWalletDetails: true,
|
|
149
|
+
walletDetails: button
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const handleMoreWallets = () => {
|
|
154
|
+
setIsShowAllWallets(true);
|
|
155
|
+
};
|
|
156
|
+
return jsxRuntime.jsxs("div", {
|
|
157
|
+
className: "w3a--relative w3a--flex w3a--flex-1 w3a--flex-col w3a--gap-y-4",
|
|
158
|
+
children: [jsxRuntime.jsx(ConnectWalletHeader, {
|
|
159
|
+
onBackClick: handleBack,
|
|
160
|
+
currentPage: currentPage,
|
|
161
|
+
selectedButton: selectedButton
|
|
162
|
+
}), selectedWallet ? jsxRuntime.jsx(ConnectWalletQrCode, {
|
|
163
|
+
toast: toast,
|
|
164
|
+
setToast: setToast,
|
|
165
|
+
walletConnectUri: walletConnectUri,
|
|
166
|
+
isDark: isDark,
|
|
167
|
+
selectedButton: selectedButton,
|
|
168
|
+
bodyState: bodyState,
|
|
169
|
+
primaryColor: (_selectedButton$walle = selectedButton.walletRegistryItem) === null || _selectedButton$walle === void 0 ? void 0 : _selectedButton$walle.primaryColor,
|
|
170
|
+
logoImage: `https://images.web3auth.io/login-${selectedButton.name}.${selectedButton.imgExtension}`,
|
|
171
|
+
setBodyState: setBodyState
|
|
172
|
+
}) : jsxRuntime.jsxs("div", {
|
|
173
|
+
className: "w3a--flex w3a--flex-col w3a--gap-y-2",
|
|
174
|
+
children: [jsxRuntime.jsx(ConnectWalletChainFilter, {
|
|
175
|
+
isDark: isDark,
|
|
176
|
+
isLoading: isLoading,
|
|
177
|
+
selectedChain: selectedChain,
|
|
178
|
+
setSelectedChain: handleChainFilterChange,
|
|
179
|
+
chainNamespace: chainNamespace
|
|
180
|
+
}), jsxRuntime.jsx(ConnectWalletSearch, {
|
|
181
|
+
totalExternalWalletCount: totalExternalWalletsCount,
|
|
182
|
+
isLoading: isLoading,
|
|
183
|
+
walletSearch: walletSearch,
|
|
184
|
+
handleWalletSearch: handleWalletSearch,
|
|
185
|
+
buttonRadius: buttonRadius
|
|
186
|
+
}), jsxRuntime.jsx(ConnectWalletList, {
|
|
187
|
+
externalButtons: externalButtons,
|
|
188
|
+
isLoading: isLoading,
|
|
189
|
+
totalExternalWalletsCount: totalExternalWalletsCount,
|
|
190
|
+
initialWalletCount: initialWalletCount,
|
|
191
|
+
handleWalletClick: handleWalletClick,
|
|
192
|
+
handleMoreWallets: handleMoreWallets,
|
|
193
|
+
isDark: isDark,
|
|
194
|
+
deviceDetails: deviceDetails,
|
|
195
|
+
walletConnectUri: walletConnectUri,
|
|
196
|
+
buttonRadius: buttonRadius
|
|
197
|
+
})]
|
|
198
|
+
})]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
module.exports = ConnectWallet;
|