@web3auth/modal 10.0.0-beta.0 → 10.0.0-beta.1

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