@web3auth/modal 10.0.0-beta.0 → 10.0.0-beta.2
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 +195 -140
- 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 +65 -0
- package/dist/lib.cjs/packages/modal/src/ui/components/{ExternalWallet/ExternalWalletChainNamespace.js → ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js} +29 -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 +448 -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 +231 -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/interface.d.ts +1 -1
- package/dist/lib.cjs/types/modalManager.d.ts +5 -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 +203 -145
- 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 +63 -0
- package/dist/lib.esm/packages/modal/src/ui/components/{ExternalWallet/ExternalWalletChainNamespace.js → ConnectWallet/ConnectWalletChainNamespaceSelect/ConnectWalletChainNamespaceSelect.js} +29 -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 +458 -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 +233 -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 +16 -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
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var reactI18next = require('react-i18next');
|
|
6
|
+
var interfaces = require('../../interfaces.js');
|
|
7
|
+
var localeImport = require('../../localeImport.js');
|
|
8
|
+
var Image = require('../Image/Image.js');
|
|
9
|
+
var PulseLoader = require('../PulseLoader/PulseLoader.js');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* ConnectingStatus component
|
|
13
|
+
* @param props - ConnectingStatusType
|
|
14
|
+
* @returns ConnectingStatus component
|
|
15
|
+
*/
|
|
16
|
+
function ConnectingStatus(props) {
|
|
17
|
+
const [t] = reactI18next.useTranslation(undefined, {
|
|
18
|
+
i18n: localeImport
|
|
19
|
+
});
|
|
20
|
+
const {
|
|
21
|
+
connector,
|
|
22
|
+
appLogo,
|
|
23
|
+
connectorName
|
|
24
|
+
} = props;
|
|
25
|
+
const providerIcon = react.useMemo(() => connector === "twitter" ? jsxRuntime.jsx(Image, {
|
|
26
|
+
imageId: "login-x-dark"
|
|
27
|
+
}) : jsxRuntime.jsx(Image, {
|
|
28
|
+
imageId: `login-${connector}`,
|
|
29
|
+
height: "40",
|
|
30
|
+
width: "40"
|
|
31
|
+
}), [connector]);
|
|
32
|
+
return jsxRuntime.jsxs("div", {
|
|
33
|
+
className: "w3a--flex w3a--h-full w3a--flex-1 w3a--flex-col w3a--items-center w3a--justify-center w3a--gap-y-4",
|
|
34
|
+
children: [jsxRuntime.jsxs("div", {
|
|
35
|
+
className: "w3a--flex w3a--items-center w3a--justify-center w3a--gap-x-6",
|
|
36
|
+
children: [jsxRuntime.jsx("figure", {
|
|
37
|
+
className: "w3a--loader-logo-size w3a--flex w3a--items-center w3a--justify-center w3a--overflow-hidden",
|
|
38
|
+
children: jsxRuntime.jsx("img", {
|
|
39
|
+
src: appLogo,
|
|
40
|
+
alt: "",
|
|
41
|
+
className: "w3a--size-full w3a--object-contain"
|
|
42
|
+
})
|
|
43
|
+
}), jsxRuntime.jsx(PulseLoader, {}), providerIcon]
|
|
44
|
+
}), jsxRuntime.jsxs("div", {
|
|
45
|
+
className: "w3a--flex w3a--flex-col w3a--gap-y-1",
|
|
46
|
+
children: [jsxRuntime.jsx("div", {
|
|
47
|
+
className: "w3a--text-center w3a--text-sm w3a--text-app-gray-500 dark:w3a--text-app-gray-400",
|
|
48
|
+
children: t("modal.adapter-loader.message1", {
|
|
49
|
+
adapter: connectorName
|
|
50
|
+
})
|
|
51
|
+
}), jsxRuntime.jsx("div", {
|
|
52
|
+
className: "w3a--text-center w3a--text-sm w3a--text-app-gray-500 dark:w3a--text-app-gray-400",
|
|
53
|
+
children: t("modal.adapter-loader.message2", {
|
|
54
|
+
adapter: connectorName
|
|
55
|
+
})
|
|
56
|
+
})]
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* ConnectedStatus component
|
|
62
|
+
* @param props - ConnectedStatusType
|
|
63
|
+
* @returns ConnectedStatus component
|
|
64
|
+
*/
|
|
65
|
+
function ConnectedStatus(props) {
|
|
66
|
+
const {
|
|
67
|
+
message
|
|
68
|
+
} = props;
|
|
69
|
+
return jsxRuntime.jsxs("div", {
|
|
70
|
+
className: "w3a--flex w3a--flex-col w3a--items-center w3a--gap-y-2",
|
|
71
|
+
children: [jsxRuntime.jsx("svg", {
|
|
72
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
73
|
+
fill: "none",
|
|
74
|
+
viewBox: "0 0 20 20",
|
|
75
|
+
className: "w3a--connected-logo",
|
|
76
|
+
children: jsxRuntime.jsx("path", {
|
|
77
|
+
fill: "currentColor",
|
|
78
|
+
fillRule: "evenodd",
|
|
79
|
+
d: "M6.267 3.455a3.07 3.07 0 0 0 1.745-.723 3.066 3.066 0 0 1 3.976 0 3.07 3.07 0 0 0 1.745.723 3.066 3.066 0 0 1 2.812 2.812c.051.643.304 1.254.723 1.745a3.066 3.066 0 0 1 0 3.976 3.07 3.07 0 0 0-.723 1.745 3.066 3.066 0 0 1-2.812 2.812 3.07 3.07 0 0 0-1.745.723 3.066 3.066 0 0 1-3.976 0 3.07 3.07 0 0 0-1.745-.723 3.066 3.066 0 0 1-2.812-2.812 3.07 3.07 0 0 0-.723-1.745 3.066 3.066 0 0 1 0-3.976 3.07 3.07 0 0 0 .723-1.745 3.066 3.066 0 0 1 2.812-2.812m7.44 5.252a1 1 0 0 0-1.414-1.414L9 10.586 7.707 9.293a1 1 0 0 0-1.414 1.414l2 2a1 1 0 0 0 1.414 0z",
|
|
80
|
+
clipRule: "evenodd"
|
|
81
|
+
})
|
|
82
|
+
}), jsxRuntime.jsx("p", {
|
|
83
|
+
className: "w3a--text-center w3a--text-sm w3a--text-app-gray-500 dark:w3a--text-app-gray-400",
|
|
84
|
+
children: message
|
|
85
|
+
})]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* ErroredStatus component
|
|
90
|
+
* @param props - ErroredStatusType
|
|
91
|
+
* @returns ErroredStatus component
|
|
92
|
+
*/
|
|
93
|
+
function ErroredStatus(props) {
|
|
94
|
+
const {
|
|
95
|
+
message
|
|
96
|
+
} = props;
|
|
97
|
+
return jsxRuntime.jsxs("div", {
|
|
98
|
+
className: "w3a--flex w3a--flex-col w3a--items-center w3a--gap-y-2",
|
|
99
|
+
children: [jsxRuntime.jsx("svg", {
|
|
100
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
101
|
+
fill: "none",
|
|
102
|
+
viewBox: "0 0 20 20",
|
|
103
|
+
className: "w3a--error-logo",
|
|
104
|
+
children: jsxRuntime.jsx("path", {
|
|
105
|
+
fill: "currentColor",
|
|
106
|
+
fillRule: "evenodd",
|
|
107
|
+
d: "M18 10a8 8 0 1 1-16.001 0A8 8 0 0 1 18 10m-7 4a1 1 0 1 1-2 0 1 1 0 0 1 2 0m-1-9a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0V6a1 1 0 0 0-1-1",
|
|
108
|
+
clipRule: "evenodd"
|
|
109
|
+
})
|
|
110
|
+
}), jsxRuntime.jsx("p", {
|
|
111
|
+
className: "w3a--text-center w3a--text-sm w3a--text-app-gray-500 dark:w3a--text-app-gray-400",
|
|
112
|
+
children: message
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Loader component
|
|
118
|
+
* @param props - LoaderProps
|
|
119
|
+
* @returns Loader component
|
|
120
|
+
*/
|
|
121
|
+
function Loader(props) {
|
|
122
|
+
const {
|
|
123
|
+
connector,
|
|
124
|
+
connectorName,
|
|
125
|
+
modalStatus,
|
|
126
|
+
onClose,
|
|
127
|
+
appLogo,
|
|
128
|
+
message
|
|
129
|
+
} = props;
|
|
130
|
+
react.useEffect(() => {
|
|
131
|
+
if (modalStatus === interfaces.MODAL_STATUS.CONNECTED) {
|
|
132
|
+
setTimeout(() => {
|
|
133
|
+
onClose();
|
|
134
|
+
}, 1000);
|
|
135
|
+
}
|
|
136
|
+
}, [modalStatus, onClose]);
|
|
137
|
+
return jsxRuntime.jsxs("div", {
|
|
138
|
+
className: "w3a--flex w3a--h-full w3a--flex-1 w3a--flex-col w3a--items-center w3a--justify-center w3a--gap-y-4",
|
|
139
|
+
children: [modalStatus === interfaces.MODAL_STATUS.CONNECTING && jsxRuntime.jsx(ConnectingStatus, {
|
|
140
|
+
connector: connector,
|
|
141
|
+
connectorName: connectorName,
|
|
142
|
+
appLogo: appLogo
|
|
143
|
+
}), modalStatus === interfaces.MODAL_STATUS.CONNECTED && jsxRuntime.jsx(ConnectedStatus, {
|
|
144
|
+
message: message
|
|
145
|
+
}), modalStatus === interfaces.MODAL_STATUS.ERRORED && jsxRuntime.jsx(ErroredStatus, {
|
|
146
|
+
message: message
|
|
147
|
+
})]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
module.exports = Loader;
|
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var HCaptcha = require('@hcaptcha/react-hcaptcha');
|
|
6
|
+
var auth = require('@web3auth/auth');
|
|
7
|
+
var noModal = require('@web3auth/no-modal');
|
|
8
|
+
var react = require('react');
|
|
9
|
+
var reactI18next = require('react-i18next');
|
|
10
|
+
var config = require('../../config.js');
|
|
11
|
+
var constants = require('../../constants.js');
|
|
12
|
+
var RootContext = require('../../context/RootContext.js');
|
|
13
|
+
var factory = require('../../handlers/factory.js');
|
|
14
|
+
var localeImport = require('../../localeImport.js');
|
|
15
|
+
var utils = require('../../utils.js');
|
|
16
|
+
var Image = require('../Image/Image.js');
|
|
17
|
+
var SocialLoginList = require('../SocialLoginList/SocialLoginList.js');
|
|
18
|
+
var LoginOtp = require('./LoginOtp/LoginOtp.js');
|
|
19
|
+
var LoginPasswordLess = require('./LoginPasswordLess/LoginPasswordLess.js');
|
|
20
|
+
|
|
21
|
+
const restrictedLoginMethods = [auth.AUTH_CONNECTION.SMS_PASSWORDLESS, auth.AUTH_CONNECTION.EMAIL_PASSWORDLESS, auth.AUTH_CONNECTION.AUTHENTICATOR, auth.AUTH_CONNECTION.PASSKEYS, auth.AUTH_CONNECTION.TELEGRAM, auth.AUTH_CONNECTION.CUSTOM];
|
|
22
|
+
function Login(props) {
|
|
23
|
+
// TODO: add appName, isEmailPrimary, isExternalPrimary
|
|
24
|
+
const {
|
|
25
|
+
web3authClientId,
|
|
26
|
+
web3authNetwork,
|
|
27
|
+
appLogo,
|
|
28
|
+
isModalVisible,
|
|
29
|
+
handleSocialLoginHeight,
|
|
30
|
+
socialLoginsConfig,
|
|
31
|
+
installedExternalWalletConfig,
|
|
32
|
+
isDark,
|
|
33
|
+
handleSocialLoginClick,
|
|
34
|
+
totalExternalWallets,
|
|
35
|
+
isEmailPasswordLessLoginVisible,
|
|
36
|
+
isSmsPasswordLessLoginVisible,
|
|
37
|
+
handleExternalWalletBtnClick,
|
|
38
|
+
handleExternalWalletClick,
|
|
39
|
+
areSocialLoginsVisible,
|
|
40
|
+
showPasswordLessInput,
|
|
41
|
+
showExternalWalletButton,
|
|
42
|
+
showExternalWalletCount,
|
|
43
|
+
showInstalledExternalWallets,
|
|
44
|
+
logoAlignment = "center",
|
|
45
|
+
buttonRadius = "pill",
|
|
46
|
+
enableMainSocialLoginButton = false
|
|
47
|
+
} = props;
|
|
48
|
+
const [t] = reactI18next.useTranslation(undefined, {
|
|
49
|
+
i18n: localeImport
|
|
50
|
+
});
|
|
51
|
+
const {
|
|
52
|
+
bodyState,
|
|
53
|
+
setBodyState
|
|
54
|
+
} = react.useContext(RootContext.RootContext);
|
|
55
|
+
const [countryCode, setCountryCode] = react.useState("");
|
|
56
|
+
const [passwordlessErrorMessage, setPasswordlessErrorMessage] = react.useState("");
|
|
57
|
+
const [otpErrorMessage, setOtpErrorMessage] = react.useState("");
|
|
58
|
+
const [expand, setExpand] = react.useState(false);
|
|
59
|
+
const [canShowMore, setCanShowMore] = react.useState(false);
|
|
60
|
+
const [visibleRow, setVisibleRow] = react.useState([]);
|
|
61
|
+
const [otherRow, setOtherRow] = react.useState([]);
|
|
62
|
+
const [isPasswordLessCtaClicked, setIsPasswordLessCtaClicked] = react.useState(false);
|
|
63
|
+
const [showOtpFlow, setShowOtpFlow] = react.useState(false);
|
|
64
|
+
const [authConnection, setAuthConnection] = react.useState(undefined);
|
|
65
|
+
const [passwordlessHandler, setPasswordlessHandler] = react.useState(undefined);
|
|
66
|
+
const [isPasswordLessLoading, setIsPasswordLessLoading] = react.useState(false);
|
|
67
|
+
const [otpLoading, setOtpLoading] = react.useState(false);
|
|
68
|
+
const [showCaptcha, setShowCaptcha] = react.useState(false);
|
|
69
|
+
const [captchaError, setCaptchaError] = react.useState("");
|
|
70
|
+
const captchaRef = react.useRef(null);
|
|
71
|
+
const handleExpand = () => {
|
|
72
|
+
setExpand(prev => !prev);
|
|
73
|
+
setIsPasswordLessCtaClicked(false);
|
|
74
|
+
handleSocialLoginHeight();
|
|
75
|
+
};
|
|
76
|
+
react.useEffect(() => {
|
|
77
|
+
const maxOptions = Object.keys(socialLoginsConfig.loginMethods).filter(loginMethodKey => {
|
|
78
|
+
return socialLoginsConfig.loginMethods[loginMethodKey].showOnModal;
|
|
79
|
+
});
|
|
80
|
+
const visibleRows = [];
|
|
81
|
+
const otherRows = [];
|
|
82
|
+
const loginOptions = Object.keys(socialLoginsConfig.loginMethods).filter(method => {
|
|
83
|
+
return !socialLoginsConfig.loginMethods[method].showOnModal === false && !restrictedLoginMethods.includes(method);
|
|
84
|
+
});
|
|
85
|
+
loginOptions.forEach((method, index) => {
|
|
86
|
+
var _socialLoginsConfig$u;
|
|
87
|
+
const connectorConfig = socialLoginsConfig.loginMethods[method];
|
|
88
|
+
const name = config.capitalizeFirstLetter(connectorConfig.name || method);
|
|
89
|
+
// const orderIndex = socialLoginsConfig.loginMethodsOrder.indexOf(method) + 1;
|
|
90
|
+
const order = index + 1;
|
|
91
|
+
const isMainOption = order === 1 && enableMainSocialLoginButton;
|
|
92
|
+
const isPrimaryBtn = (socialLoginsConfig === null || socialLoginsConfig === void 0 || (_socialLoginsConfig$u = socialLoginsConfig.uiConfig) === null || _socialLoginsConfig$u === void 0 ? void 0 : _socialLoginsConfig$u.primaryButton) === "socialLogin" && order === 1;
|
|
93
|
+
const loginOptionLength = loginOptions.length;
|
|
94
|
+
const moreThanFour = loginOptionLength >= 4;
|
|
95
|
+
const lengthCheck = moreThanFour ? order > 0 && order <= loginOptionLength : order > 0 && order < 4;
|
|
96
|
+
if (lengthCheck) {
|
|
97
|
+
visibleRows.push({
|
|
98
|
+
method,
|
|
99
|
+
isDark,
|
|
100
|
+
isPrimaryBtn,
|
|
101
|
+
name,
|
|
102
|
+
connector: socialLoginsConfig.connector,
|
|
103
|
+
loginParams: {
|
|
104
|
+
authConnection: connectorConfig.authConnection || method,
|
|
105
|
+
authConnectionId: connectorConfig.authConnectionId,
|
|
106
|
+
groupedAuthConnectionId: connectorConfig.groupedAuthConnectionId,
|
|
107
|
+
extraLoginOptions: connectorConfig.extraLoginOptions,
|
|
108
|
+
name,
|
|
109
|
+
login_hint: ""
|
|
110
|
+
},
|
|
111
|
+
order,
|
|
112
|
+
isMainOption
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
otherRows.push({
|
|
116
|
+
method,
|
|
117
|
+
isDark,
|
|
118
|
+
isPrimaryBtn,
|
|
119
|
+
name: name === "Twitter" ? "X" : name,
|
|
120
|
+
connector: socialLoginsConfig.connector,
|
|
121
|
+
loginParams: {
|
|
122
|
+
authConnection: method,
|
|
123
|
+
authConnectionId: connectorConfig.authConnectionId,
|
|
124
|
+
groupedAuthConnectionId: connectorConfig.groupedAuthConnectionId,
|
|
125
|
+
extraLoginOptions: connectorConfig.extraLoginOptions,
|
|
126
|
+
name,
|
|
127
|
+
login_hint: ""
|
|
128
|
+
},
|
|
129
|
+
order,
|
|
130
|
+
isMainOption
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
setVisibleRow(visibleRows);
|
|
134
|
+
setOtherRow(otherRows);
|
|
135
|
+
setCanShowMore(maxOptions.length > 4); // Update the state based on the condition
|
|
136
|
+
}, [socialLoginsConfig, isDark, enableMainSocialLoginButton, buttonRadius]);
|
|
137
|
+
const handleCustomLogin = async (authConnection, loginHint) => {
|
|
138
|
+
try {
|
|
139
|
+
const handler = factory.createPasswordlessHandler(authConnection, {
|
|
140
|
+
loginHint,
|
|
141
|
+
web3authClientId,
|
|
142
|
+
network: web3authNetwork,
|
|
143
|
+
uiConfig: socialLoginsConfig.uiConfig,
|
|
144
|
+
authConnection
|
|
145
|
+
});
|
|
146
|
+
let token = "";
|
|
147
|
+
if (authConnection === auth.AUTH_CONNECTION.SMS_PASSWORDLESS) {
|
|
148
|
+
var _captchaRef$current;
|
|
149
|
+
const res = await ((_captchaRef$current = captchaRef.current) === null || _captchaRef$current === void 0 ? void 0 : _captchaRef$current.execute({
|
|
150
|
+
async: true
|
|
151
|
+
}));
|
|
152
|
+
if (!res) {
|
|
153
|
+
throw noModal.WalletLoginError.connectionError("Captcha token is required");
|
|
154
|
+
}
|
|
155
|
+
token = res.response;
|
|
156
|
+
}
|
|
157
|
+
const result = await handler.sendVerificationCode({
|
|
158
|
+
captchaToken: token
|
|
159
|
+
});
|
|
160
|
+
if (result !== null && result !== void 0 && result.error) {
|
|
161
|
+
setPasswordlessErrorMessage(t(result.error));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
setAuthConnection(authConnection);
|
|
165
|
+
setShowOtpFlow(true);
|
|
166
|
+
setPasswordlessHandler(handler);
|
|
167
|
+
} catch (error) {
|
|
168
|
+
noModal.log.error(error);
|
|
169
|
+
} finally {
|
|
170
|
+
setIsPasswordLessLoading(false);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const handleFormSubmit = async loginHint => {
|
|
174
|
+
setIsPasswordLessLoading(true);
|
|
175
|
+
if (isEmailPasswordLessLoginVisible) {
|
|
176
|
+
const isEmailValid = loginHint.match(/^([\w.%+-]+)@([\w-]+\.)+([\w]{2,})$/i);
|
|
177
|
+
if (isEmailValid) {
|
|
178
|
+
const connectorConfig = socialLoginsConfig.loginMethods[auth.AUTH_CONNECTION.EMAIL_PASSWORDLESS];
|
|
179
|
+
if (connectorConfig.isDefault) {
|
|
180
|
+
return handleSocialLoginClick({
|
|
181
|
+
connector: socialLoginsConfig.connector || "",
|
|
182
|
+
loginParams: {
|
|
183
|
+
authConnection: auth.AUTH_CONNECTION.EMAIL_PASSWORDLESS,
|
|
184
|
+
authConnectionId: connectorConfig.authConnectionId,
|
|
185
|
+
groupedAuthConnectionId: connectorConfig.groupedAuthConnectionId,
|
|
186
|
+
extraLoginOptions: connectorConfig.extraLoginOptions,
|
|
187
|
+
login_hint: loginHint,
|
|
188
|
+
name: "Email"
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
return handleCustomLogin(auth.AUTH_CONNECTION.EMAIL_PASSWORDLESS, loginHint);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (isSmsPasswordLessLoginVisible) {
|
|
197
|
+
const number = loginHint.startsWith("+") ? loginHint : `${countryCode}${loginHint}`;
|
|
198
|
+
const result = await utils.validatePhoneNumber(number);
|
|
199
|
+
if (result) {
|
|
200
|
+
const finalLoginHint = typeof result === "string" ? result : number;
|
|
201
|
+
const connectorConfig = socialLoginsConfig.loginMethods[auth.AUTH_CONNECTION.SMS_PASSWORDLESS];
|
|
202
|
+
if (connectorConfig.isDefault) {
|
|
203
|
+
return handleSocialLoginClick({
|
|
204
|
+
connector: socialLoginsConfig.connector || "",
|
|
205
|
+
loginParams: {
|
|
206
|
+
authConnection: auth.AUTH_CONNECTION.SMS_PASSWORDLESS,
|
|
207
|
+
authConnectionId: connectorConfig.authConnectionId,
|
|
208
|
+
groupedAuthConnectionId: connectorConfig.groupedAuthConnectionId,
|
|
209
|
+
extraLoginOptions: connectorConfig.extraLoginOptions,
|
|
210
|
+
login_hint: finalLoginHint,
|
|
211
|
+
name: "Mobile"
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
} else {
|
|
215
|
+
return handleCustomLogin(auth.AUTH_CONNECTION.SMS_PASSWORDLESS, finalLoginHint);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
setPasswordlessErrorMessage(invalidInputErrorMessage);
|
|
220
|
+
setIsPasswordLessLoading(false);
|
|
221
|
+
return undefined;
|
|
222
|
+
};
|
|
223
|
+
const title = react.useMemo(() => {
|
|
224
|
+
if (isEmailPasswordLessLoginVisible && isSmsPasswordLessLoginVisible) return t("modal.social.passwordless-title");
|
|
225
|
+
if (isEmailPasswordLessLoginVisible) return t("modal.social.email");
|
|
226
|
+
return t("modal.social.phone");
|
|
227
|
+
}, [isEmailPasswordLessLoginVisible, isSmsPasswordLessLoginVisible, t]);
|
|
228
|
+
const placeholder = react.useMemo(() => {
|
|
229
|
+
if (isEmailPasswordLessLoginVisible && isSmsPasswordLessLoginVisible) return "+(00)123456/name@example.com";
|
|
230
|
+
if (isEmailPasswordLessLoginVisible) return "name@example.com";
|
|
231
|
+
return "+(00)123456";
|
|
232
|
+
}, [isEmailPasswordLessLoginVisible, isSmsPasswordLessLoginVisible]);
|
|
233
|
+
const invalidInputErrorMessage = react.useMemo(() => {
|
|
234
|
+
if (isEmailPasswordLessLoginVisible && isSmsPasswordLessLoginVisible) return t("modal.errors-invalid-number-email");
|
|
235
|
+
if (isEmailPasswordLessLoginVisible) return t("modal.errors-invalid-email");
|
|
236
|
+
return t("modal.errors-invalid-number");
|
|
237
|
+
}, [isEmailPasswordLessLoginVisible, isSmsPasswordLessLoginVisible, t]);
|
|
238
|
+
react.useEffect(() => {
|
|
239
|
+
const getLocation = async () => {
|
|
240
|
+
const result = await utils.getUserCountry();
|
|
241
|
+
if (result && result.dialCode) {
|
|
242
|
+
setCountryCode(result.dialCode);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
if (isSmsPasswordLessLoginVisible) getLocation();
|
|
246
|
+
}, [isSmsPasswordLessLoginVisible]);
|
|
247
|
+
const handleConnectWallet = e => {
|
|
248
|
+
setIsPasswordLessCtaClicked(false);
|
|
249
|
+
e.preventDefault();
|
|
250
|
+
if (handleExternalWalletBtnClick) handleExternalWalletBtnClick(true);
|
|
251
|
+
};
|
|
252
|
+
const handleOtpComplete = async otp => {
|
|
253
|
+
setOtpLoading(true);
|
|
254
|
+
if (otpErrorMessage) setOtpErrorMessage("");
|
|
255
|
+
try {
|
|
256
|
+
var _result$data;
|
|
257
|
+
const connectorConfig = socialLoginsConfig.loginMethods[authConnection];
|
|
258
|
+
const result = await (passwordlessHandler === null || passwordlessHandler === void 0 ? void 0 : passwordlessHandler.verifyCode(otp));
|
|
259
|
+
if (result !== null && result !== void 0 && result.error) {
|
|
260
|
+
setOtpErrorMessage(t(result.error));
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (result !== null && result !== void 0 && (_result$data = result.data) !== null && _result$data !== void 0 && _result$data.id_token) {
|
|
264
|
+
var _result$data2;
|
|
265
|
+
return handleSocialLoginClick({
|
|
266
|
+
connector: socialLoginsConfig.connector || "",
|
|
267
|
+
loginParams: {
|
|
268
|
+
authConnection: authConnection,
|
|
269
|
+
authConnectionId: connectorConfig.authConnectionId,
|
|
270
|
+
groupedAuthConnectionId: connectorConfig.groupedAuthConnectionId,
|
|
271
|
+
extraLoginOptions: _objectSpread(_objectSpread({}, connectorConfig.extraLoginOptions), {}, {
|
|
272
|
+
id_token: (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.id_token
|
|
273
|
+
}),
|
|
274
|
+
login_hint: passwordlessHandler.passwordlessParams.loginHint,
|
|
275
|
+
name: passwordlessHandler.name
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
} catch (error) {
|
|
280
|
+
noModal.log.error(error);
|
|
281
|
+
} finally {
|
|
282
|
+
setOtpLoading(false);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
const handleInstalledWalletClick = wallet => {
|
|
286
|
+
var _wallet$chainNamespac;
|
|
287
|
+
// when having multiple namespaces, ask user to select one
|
|
288
|
+
if (((_wallet$chainNamespac = wallet.chainNamespaces) === null || _wallet$chainNamespac === void 0 ? void 0 : _wallet$chainNamespac.length) > 1) {
|
|
289
|
+
setBodyState(_objectSpread(_objectSpread({}, bodyState), {}, {
|
|
290
|
+
showMultiChainSelector: true,
|
|
291
|
+
walletDetails: wallet
|
|
292
|
+
}));
|
|
293
|
+
} else {
|
|
294
|
+
handleExternalWalletClick({
|
|
295
|
+
connector: wallet.name
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
const installedExternalWallets = react.useMemo(() => {
|
|
300
|
+
if (showInstalledExternalWallets) return installedExternalWalletConfig;
|
|
301
|
+
// always show MetaMask
|
|
302
|
+
return installedExternalWalletConfig.filter(wallet => wallet.name === noModal.WALLET_CONNECTORS.METAMASK);
|
|
303
|
+
}, [installedExternalWalletConfig, showInstalledExternalWallets]);
|
|
304
|
+
if (showOtpFlow) {
|
|
305
|
+
return jsxRuntime.jsx(LoginOtp, {
|
|
306
|
+
otpLoading: otpLoading,
|
|
307
|
+
loginHint: passwordlessHandler === null || passwordlessHandler === void 0 ? void 0 : passwordlessHandler.passwordlessParams.loginHint,
|
|
308
|
+
setShowOtpFlow: setShowOtpFlow,
|
|
309
|
+
authConnection: authConnection,
|
|
310
|
+
handleOtpComplete: handleOtpComplete,
|
|
311
|
+
errorMessage: otpErrorMessage
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
const socialLoginSection = (otherRow = []) => {
|
|
315
|
+
return jsxRuntime.jsx(SocialLoginList, {
|
|
316
|
+
otherRow: otherRow,
|
|
317
|
+
isDark: isDark,
|
|
318
|
+
visibleRow: visibleRow,
|
|
319
|
+
canShowMore: canShowMore,
|
|
320
|
+
handleSocialLoginClick: handleSocialLoginClick,
|
|
321
|
+
socialLoginsConfig: socialLoginsConfig,
|
|
322
|
+
handleExpandSocialLogins: handleExpand,
|
|
323
|
+
buttonRadius: buttonRadius
|
|
324
|
+
}, "social-login-section");
|
|
325
|
+
};
|
|
326
|
+
const passwordlessLoginSection = () => {
|
|
327
|
+
return jsxRuntime.jsx(LoginPasswordLess, {
|
|
328
|
+
isModalVisible: isModalVisible,
|
|
329
|
+
isPasswordLessCtaClicked: isPasswordLessCtaClicked,
|
|
330
|
+
setIsPasswordLessCtaClicked: setIsPasswordLessCtaClicked,
|
|
331
|
+
title: title,
|
|
332
|
+
placeholder: placeholder,
|
|
333
|
+
handleFormSubmit: handleFormSubmit,
|
|
334
|
+
errorMessage: passwordlessErrorMessage,
|
|
335
|
+
isDark: isDark,
|
|
336
|
+
buttonRadius: buttonRadius,
|
|
337
|
+
isPasswordLessLoading: isPasswordLessLoading
|
|
338
|
+
}, "passwordless-section");
|
|
339
|
+
};
|
|
340
|
+
const externalWalletSection = () => {
|
|
341
|
+
return jsxRuntime.jsxs("div", {
|
|
342
|
+
className: utils.cn("w3a--flex w3a--w-full w3a--flex-col w3a--items-start w3a--justify-start w3a--gap-y-2"),
|
|
343
|
+
children: [installedExternalWallets.length > 0 && installedExternalWallets.map(wallet => jsxRuntime.jsxs("button", {
|
|
344
|
+
type: "button",
|
|
345
|
+
className: utils.cn("w3a--btn !w3a--justify-between w3a-external-wallet-btn", {
|
|
346
|
+
"w3a--rounded-full": buttonRadius === "pill",
|
|
347
|
+
"w3a--rounded-lg": buttonRadius === "rounded",
|
|
348
|
+
"w3a--rounded-none": buttonRadius === "square"
|
|
349
|
+
}),
|
|
350
|
+
onClick: () => handleInstalledWalletClick(wallet),
|
|
351
|
+
children: [jsxRuntime.jsx("p", {
|
|
352
|
+
className: "w3a--text-base w3a--font-normal w3a--text-app-gray-700 dark:w3a--text-app-white",
|
|
353
|
+
children: wallet.displayName
|
|
354
|
+
}), jsxRuntime.jsxs("div", {
|
|
355
|
+
className: "w3a--flex w3a--items-center w3a--gap-x-2",
|
|
356
|
+
children: [wallet.hasInjectedWallet && jsxRuntime.jsx("span", {
|
|
357
|
+
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",
|
|
358
|
+
children: t("modal.external.installed")
|
|
359
|
+
}), jsxRuntime.jsx("figure", {
|
|
360
|
+
className: wallet.icon ? "w3a--size-5" : "w3a--size-5 w3a--rounded-full w3a--bg-app-gray-300",
|
|
361
|
+
children: jsxRuntime.jsx(Image, {
|
|
362
|
+
imageData: wallet.icon,
|
|
363
|
+
imageId: `login-${wallet.name}`,
|
|
364
|
+
hoverImageId: `login-${wallet.name}`,
|
|
365
|
+
fallbackImageId: "wallet",
|
|
366
|
+
height: "24",
|
|
367
|
+
width: "24",
|
|
368
|
+
isButton: true,
|
|
369
|
+
extension: wallet.imgExtension || "webp"
|
|
370
|
+
})
|
|
371
|
+
})]
|
|
372
|
+
})]
|
|
373
|
+
}, wallet.name)), totalExternalWallets > 3 && jsxRuntime.jsxs("button", {
|
|
374
|
+
type: "button",
|
|
375
|
+
className: utils.cn("w3a--btn !w3a--justify-between w3a-external-wallet-btn", {
|
|
376
|
+
"w3a--rounded-full": buttonRadius === "pill",
|
|
377
|
+
"w3a--rounded-lg": buttonRadius === "rounded",
|
|
378
|
+
"w3a--rounded-none": buttonRadius === "square"
|
|
379
|
+
}),
|
|
380
|
+
onClick: handleConnectWallet,
|
|
381
|
+
children: [jsxRuntime.jsx("p", {
|
|
382
|
+
className: "w3a--text-app-gray-900 dark:w3a--text-app-white",
|
|
383
|
+
children: t("modal.external.all-wallets")
|
|
384
|
+
}), showExternalWalletCount && totalExternalWallets > 0 && jsxRuntime.jsx("div", {
|
|
385
|
+
id: "external-wallet-count",
|
|
386
|
+
className: "w3a--w-auto w3a--rounded-full w3a--bg-app-primary-100 w3a--px-2.5 w3a--py-0.5 w3a--text-xs w3a--font-medium w3a--text-app-primary-800 dark:w3a--border dark:w3a--border-app-primary-500 dark:w3a--bg-transparent dark:w3a--text-app-primary-500",
|
|
387
|
+
children: totalExternalWallets - 1
|
|
388
|
+
}), jsxRuntime.jsx("img", {
|
|
389
|
+
id: "external-wallet-arrow",
|
|
390
|
+
className: "w3a--icon-animation",
|
|
391
|
+
src: utils.getIcons(isDark ? "chevron-right-dark" : "chevron-right-light"),
|
|
392
|
+
alt: "arrow"
|
|
393
|
+
})]
|
|
394
|
+
})]
|
|
395
|
+
}, "external-wallets-section");
|
|
396
|
+
};
|
|
397
|
+
const delimiter = index => {
|
|
398
|
+
return jsxRuntime.jsxs("div", {
|
|
399
|
+
className: "w3a--flex w3a--w-full w3a--items-center w3a--gap-x-2",
|
|
400
|
+
children: [jsxRuntime.jsx("div", {
|
|
401
|
+
className: "w3a--h-px w3a--w-full w3a--bg-app-gray-200 dark:w3a--bg-app-gray-500"
|
|
402
|
+
}), jsxRuntime.jsx("p", {
|
|
403
|
+
className: "w3a--text-xs w3a--font-normal w3a--uppercase w3a--text-app-gray-400 dark:w3a--text-app-gray-400",
|
|
404
|
+
children: "or"
|
|
405
|
+
}), jsxRuntime.jsx("div", {
|
|
406
|
+
className: "w3a--h-px w3a--w-full w3a--bg-app-gray-200 dark:w3a--bg-app-gray-500"
|
|
407
|
+
})]
|
|
408
|
+
}, `section-delimiter-${index}`);
|
|
409
|
+
};
|
|
410
|
+
const defaultView = () => {
|
|
411
|
+
var _socialLoginsConfig$u2;
|
|
412
|
+
const sectionMap = {
|
|
413
|
+
social: socialLoginSection,
|
|
414
|
+
passwordless: passwordlessLoginSection,
|
|
415
|
+
externalWallets: externalWalletSection
|
|
416
|
+
};
|
|
417
|
+
const sectionVisibility = {
|
|
418
|
+
social: areSocialLoginsVisible,
|
|
419
|
+
passwordless: showPasswordLessInput,
|
|
420
|
+
externalWallets: showExternalWalletButton
|
|
421
|
+
};
|
|
422
|
+
const signInMethods = ((_socialLoginsConfig$u2 = socialLoginsConfig.uiConfig) === null || _socialLoginsConfig$u2 === void 0 ? void 0 : _socialLoginsConfig$u2.signInMethods) || ["social", "passwordless", "externalWallets"];
|
|
423
|
+
// add missing signInMethods in case uiConfig.signInMethods is not set correctly
|
|
424
|
+
Object.entries(sectionVisibility).forEach(([method, visibility]) => {
|
|
425
|
+
if (visibility && !signInMethods.includes(method)) {
|
|
426
|
+
signInMethods.push(method);
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
const sections = signInMethods.map(method => sectionVisibility[method] && sectionMap[method]()).filter(Boolean);
|
|
430
|
+
// add delimiter between external wallets and other sections
|
|
431
|
+
if (sections.length === 3) {
|
|
432
|
+
const externalWalletIndex = signInMethods.findIndex(section => section === "externalWallets");
|
|
433
|
+
if (externalWalletIndex === 0) {
|
|
434
|
+
// add after it
|
|
435
|
+
sections.splice(1, 0, delimiter(1));
|
|
436
|
+
} else if (externalWalletIndex === 1) {
|
|
437
|
+
// add before it
|
|
438
|
+
sections.splice(1, 0, delimiter(1));
|
|
439
|
+
// add after it
|
|
440
|
+
sections.splice(3, 0, delimiter(2));
|
|
441
|
+
} else if (externalWalletIndex === 2) {
|
|
442
|
+
// add before it
|
|
443
|
+
sections.splice(2, 0, delimiter(1));
|
|
444
|
+
}
|
|
445
|
+
} else if (sections.length === 2) {
|
|
446
|
+
if (sectionVisibility["externalWallets"]) {
|
|
447
|
+
sections.splice(1, 0, delimiter(1));
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return sections;
|
|
451
|
+
};
|
|
452
|
+
const expandedView = () => socialLoginSection(otherRow);
|
|
453
|
+
const headerLogo = [constants.DEFAULT_LOGO_DARK, constants.DEFAULT_LOGO_LIGHT].includes(appLogo) ? "" : appLogo;
|
|
454
|
+
return jsxRuntime.jsxs("div", {
|
|
455
|
+
className: "w3a--flex w3a--flex-col w3a--items-center w3a--gap-y-4 w3a--p-2",
|
|
456
|
+
children: [jsxRuntime.jsxs("div", {
|
|
457
|
+
className: utils.cn("w3a--flex w3a--flex-col w3a--items-center w3a--justify-center w3a--gap-y-2 w3a--pt-6", logoAlignment === "center" ? "" : "w3a--w-full"),
|
|
458
|
+
children: [jsxRuntime.jsx("figure", {
|
|
459
|
+
className: utils.cn("w3a--mx-auto w3a--h-12 w3a--w-[200px]", logoAlignment === "center" ? "w3a--flex w3a--justify-center w3a--items-center" : "w3a--ml-0"),
|
|
460
|
+
children: jsxRuntime.jsx("img", {
|
|
461
|
+
src: headerLogo || utils.getIcons(isDark ? "logo-dark" : "logo-light"),
|
|
462
|
+
alt: "Logo",
|
|
463
|
+
className: "w3a--object-contain"
|
|
464
|
+
})
|
|
465
|
+
}), jsxRuntime.jsx("p", {
|
|
466
|
+
className: utils.cn("w3a--text-lg w3a--font-semibold w3a--text-app-gray-900 dark:w3a--text-app-white", logoAlignment === "center" ? "w3a--text-center" : "w3a--text-left w3a--w-full w3a--ml-4"),
|
|
467
|
+
children: t("modal.social.sign-in")
|
|
468
|
+
})]
|
|
469
|
+
}), jsxRuntime.jsx(HCaptcha, {
|
|
470
|
+
ref: captchaRef,
|
|
471
|
+
sitekey: config.CAPTCHA_SITE_KEY,
|
|
472
|
+
size: "invisible",
|
|
473
|
+
languageOverride: socialLoginsConfig.uiConfig.defaultLanguage,
|
|
474
|
+
theme: socialLoginsConfig.uiConfig.theme,
|
|
475
|
+
onOpen: () => setShowCaptcha(true),
|
|
476
|
+
onClose: () => setShowCaptcha(false),
|
|
477
|
+
onError: () => setCaptchaError("passwordless.captcha-default-error"),
|
|
478
|
+
onChalExpired: () => setCaptchaError("passwordless.captcha-default-error")
|
|
479
|
+
}), captchaError && showCaptcha && jsxRuntime.jsx("p", {
|
|
480
|
+
className: "-w3a--mt-2 w3a--w-full w3a--pl-6 w3a--text-start w3a--text-xs w3a--font-normal w3a--text-app-red-500 dark:w3a--text-app-red-400",
|
|
481
|
+
children: t(captchaError)
|
|
482
|
+
}), !showCaptcha && jsxRuntime.jsxs("div", {
|
|
483
|
+
className: "w3a--flex w3a--w-full w3a--flex-col w3a--items-center w3a--justify-center w3a--gap-y-2",
|
|
484
|
+
children: [!expand && defaultView(), expand && expandedView()]
|
|
485
|
+
})]
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
module.exports = Login;
|