@dynamic-labs/sdk-react-core 0.17.0-RC.17 → 0.17.0-RC.19

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 (284) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/package.cjs +10 -10
  3. package/package.js +10 -10
  4. package/package.json +17 -17
  5. package/src/index.cjs +8 -0
  6. package/src/index.js +5 -0
  7. package/src/lib/Main.cjs +2 -0
  8. package/src/lib/Main.js +2 -0
  9. package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +2 -0
  10. package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +2 -0
  11. package/src/lib/components/AnimatePresence/AnimatePresence.cjs +2 -0
  12. package/src/lib/components/AnimatePresence/AnimatePresence.js +2 -0
  13. package/src/lib/components/AppOriginTile/AppOriginTile.types.d.ts +1 -1
  14. package/src/lib/components/Divider/Divider.cjs +2 -0
  15. package/src/lib/components/Divider/Divider.js +2 -0
  16. package/src/lib/components/ErrorContainer/ErrorContainer.cjs +2 -2
  17. package/src/lib/components/ErrorContainer/ErrorContainer.d.ts +3 -1
  18. package/src/lib/components/ErrorContainer/ErrorContainer.js +2 -2
  19. package/src/lib/components/IconWithSpinner/IconWithSpinner.cjs +1 -0
  20. package/src/lib/components/IconWithSpinner/IconWithSpinner.js +1 -0
  21. package/src/lib/components/IconWithSpinner/Spinner/Spinner.cjs +1 -0
  22. package/src/lib/components/IconWithSpinner/Spinner/Spinner.js +1 -0
  23. package/src/lib/components/IconWithStatus/IconWithStatus.cjs +1 -0
  24. package/src/lib/components/IconWithStatus/IconWithStatus.js +1 -0
  25. package/src/lib/components/Input/Input.cjs +13 -6
  26. package/src/lib/components/Input/Input.js +14 -7
  27. package/src/lib/components/Input/Input.types.d.ts +4 -0
  28. package/src/lib/components/NetworkPicker/components/ActionList/ActionList.cjs +2 -0
  29. package/src/lib/components/NetworkPicker/components/ActionList/ActionList.js +2 -0
  30. package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +2 -0
  31. package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +2 -0
  32. package/src/lib/components/NetworkPicker/components/Network/Network.cjs +2 -0
  33. package/src/lib/components/NetworkPicker/components/Network/Network.js +2 -0
  34. package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +2 -0
  35. package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +2 -0
  36. package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +2 -0
  37. package/src/lib/components/OTPVerificationView/OTPVerificationView.js +2 -0
  38. package/src/lib/components/OverlayCard/OverlayCard.cjs +2 -0
  39. package/src/lib/components/OverlayCard/OverlayCard.js +2 -0
  40. package/src/lib/components/Portal/Portal.cjs +2 -0
  41. package/src/lib/components/Portal/Portal.js +2 -0
  42. package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +24 -0
  43. package/src/lib/components/SendBalanceForm/SendBalanceForm.d.ts +10 -0
  44. package/src/lib/components/SendBalanceForm/SendBalanceForm.js +22 -0
  45. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.d.ts +16 -0
  46. package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.d.ts +8 -0
  47. package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/index.d.ts +1 -0
  48. package/src/lib/components/SendBalancePageLayout/components/index.d.ts +1 -0
  49. package/src/lib/components/SendBalancePageLayout/index.d.ts +2 -0
  50. package/src/lib/components/Tooltip/Tooltip.cjs +2 -0
  51. package/src/lib/components/Tooltip/Tooltip.js +2 -0
  52. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.d.ts +1 -1
  53. package/src/lib/components/TransactionOriginDestination/TransactionOriginDestination.d.ts +11 -0
  54. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.d.ts +11 -0
  55. package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.cjs +2 -0
  56. package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.js +2 -0
  57. package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +2 -0
  58. package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +2 -0
  59. package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.cjs +2 -0
  60. package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.js +2 -0
  61. package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +2 -0
  62. package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +2 -0
  63. package/src/lib/components/index.d.ts +1 -0
  64. package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -2
  65. package/src/lib/context/DynamicContext/DynamicContext.js +3 -2
  66. package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.cjs +1 -0
  67. package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.js +1 -0
  68. package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs +2 -0
  69. package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.js +2 -0
  70. package/src/lib/context/QrCodeContext/QrCodeContext.cjs +2 -0
  71. package/src/lib/context/QrCodeContext/QrCodeContext.js +2 -0
  72. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +59 -20
  73. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.d.ts +3 -1
  74. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +60 -21
  75. package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
  76. package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +2 -0
  77. package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +2 -0
  78. package/src/lib/layout/DynamicAuthLayout/Footer/Footer.cjs +2 -0
  79. package/src/lib/layout/DynamicAuthLayout/Footer/Footer.js +2 -0
  80. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/Item/Item.cjs +2 -0
  81. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/Item/Item.js +2 -0
  82. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +2 -0
  83. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +2 -0
  84. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletListFooterContent.cjs +1 -0
  85. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletListFooterContent.js +1 -0
  86. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs +2 -0
  87. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.js +2 -0
  88. package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +13 -3
  89. package/src/lib/layout/DynamicAuthLayout/Header/header.js +13 -3
  90. package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +2 -0
  91. package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +2 -0
  92. package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +22 -70
  93. package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +24 -72
  94. package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +0 -3
  95. package/src/lib/shared/utils/functions/formatBigNumber/formatBigNumber.cjs +2 -1
  96. package/src/lib/shared/utils/functions/formatBigNumber/formatBigNumber.js +2 -1
  97. package/src/lib/shared/utils/functions/index.d.ts +1 -0
  98. package/src/lib/shared/utils/functions/trimEnd/index.d.ts +1 -0
  99. package/src/lib/shared/utils/functions/trimEnd/trimEnd.cjs +13 -0
  100. package/src/lib/shared/utils/functions/trimEnd/trimEnd.d.ts +1 -0
  101. package/src/lib/shared/utils/functions/trimEnd/trimEnd.js +9 -0
  102. package/src/lib/shared/utils/hooks/index.d.ts +2 -0
  103. package/src/lib/shared/utils/hooks/useIsMounted/index.d.ts +1 -0
  104. package/src/lib/shared/utils/hooks/useIsMounted/useIsMounted.cjs +18 -0
  105. package/src/lib/shared/utils/hooks/useIsMounted/useIsMounted.d.ts +1 -0
  106. package/src/lib/shared/utils/hooks/useIsMounted/useIsMounted.js +14 -0
  107. package/src/lib/styles/index.shadow.cjs +1 -1
  108. package/src/lib/styles/index.shadow.js +1 -1
  109. package/src/lib/utils/functions/getAppOrigin/getAppOrigin.cjs +12 -0
  110. package/src/lib/utils/functions/getAppOrigin/getAppOrigin.d.ts +1 -0
  111. package/src/lib/utils/functions/getAppOrigin/getAppOrigin.js +8 -0
  112. package/src/lib/utils/functions/getAppOrigin/index.d.ts +1 -0
  113. package/src/lib/utils/functions/getReferencedAccount/getReferencedAccount.cjs +29 -0
  114. package/src/lib/utils/functions/getReferencedAccount/getReferencedAccount.d.ts +7 -0
  115. package/src/lib/utils/functions/getReferencedAccount/getReferencedAccount.js +25 -0
  116. package/src/lib/utils/functions/getReferencedAccount/index.d.ts +1 -0
  117. package/src/lib/utils/functions/index.d.ts +2 -0
  118. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -1
  119. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +1 -1
  120. package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs +1 -0
  121. package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js +1 -0
  122. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +12 -3
  123. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +12 -3
  124. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -1
  125. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -1
  126. package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.cjs +37 -0
  127. package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.d.ts +8 -0
  128. package/src/lib/utils/hooks/useWalletConnectors/reconnectSocialWallet.js +33 -0
  129. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +7 -0
  130. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +8 -1
  131. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +4 -3
  132. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +4 -3
  133. package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +1 -1
  134. package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +1 -1
  135. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +19 -17
  136. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +19 -17
  137. package/src/lib/utils/hooks/useWallets/useWallets.cjs +26 -36
  138. package/src/lib/utils/hooks/useWallets/useWallets.d.ts +1 -2
  139. package/src/lib/utils/hooks/useWallets/useWallets.js +27 -37
  140. package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +2 -0
  141. package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +2 -0
  142. package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +1 -0
  143. package/src/lib/views/CollectUserDataView/CollectUserDataView.js +1 -0
  144. package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +2 -0
  145. package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +2 -0
  146. package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +2 -0
  147. package/src/lib/views/CollectUserDataView/UserDataFields/index.js +2 -0
  148. package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +2 -0
  149. package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +2 -0
  150. package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +2 -0
  151. package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +2 -0
  152. package/src/lib/views/EmailUpdate/EmailUpdate.cjs +2 -0
  153. package/src/lib/views/EmailUpdate/EmailUpdate.js +2 -0
  154. package/src/lib/views/EmailVerification/EmailVerification.cjs +2 -0
  155. package/src/lib/views/EmailVerification/EmailVerification.js +2 -0
  156. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +2 -0
  157. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +2 -0
  158. package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.cjs +2 -0
  159. package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.js +2 -0
  160. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +2 -0
  161. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +2 -0
  162. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +2 -0
  163. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +2 -0
  164. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +2 -1
  165. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +2 -1
  166. package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +1 -0
  167. package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +1 -0
  168. package/src/lib/views/NoAccess/NoAccess.cjs +1 -0
  169. package/src/lib/views/NoAccess/NoAccess.js +1 -0
  170. package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +1 -0
  171. package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +1 -0
  172. package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +2 -0
  173. package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +2 -0
  174. package/src/lib/views/PendingConnectView/PendingConnectView.cjs +1 -0
  175. package/src/lib/views/PendingConnectView/PendingConnectView.js +1 -0
  176. package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +1 -0
  177. package/src/lib/views/PendingSignatureView/PendingSignatureView.js +1 -0
  178. package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +2 -0
  179. package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +2 -0
  180. package/src/lib/views/QrCodeView/QrCodeView.cjs +1 -0
  181. package/src/lib/views/QrCodeView/QrCodeView.js +1 -0
  182. package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +5 -8
  183. package/src/lib/views/SocialRedirectView/SocialRedirectView.js +5 -8
  184. package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.cjs +58 -0
  185. package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.d.ts +2 -0
  186. package/src/lib/views/SocialWrongAccountView/SocialWrongAccountView.js +54 -0
  187. package/src/lib/views/SocialWrongAccountView/index.d.ts +1 -0
  188. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +92 -0
  189. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.d.ts +13 -0
  190. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +88 -0
  191. package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/helpers/transactionErrorMessage.cjs +6 -1
  192. package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/helpers/transactionErrorMessage.d.ts +1 -0
  193. package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/helpers/transactionErrorMessage.js +6 -1
  194. package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/hooks/useTransactionData/useTransactionData.cjs +2 -0
  195. package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/hooks/useTransactionData/useTransactionData.js +2 -0
  196. package/src/lib/views/TransactionConfirmationView/index.d.ts +2 -0
  197. package/src/lib/views/WalletList/SearchInstead/SearchInstead.cjs +2 -0
  198. package/src/lib/views/WalletList/SearchInstead/SearchInstead.js +2 -0
  199. package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +1 -0
  200. package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +1 -0
  201. package/src/lib/views/WalletList/data.cjs +4 -5
  202. package/src/lib/views/WalletList/data.d.ts +2 -2
  203. package/src/lib/views/WalletList/data.js +4 -5
  204. package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +1 -0
  205. package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +1 -0
  206. package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -0
  207. package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -0
  208. package/src/lib/views/viewToComponentMap.cjs +2 -0
  209. package/src/lib/views/viewToComponentMap.js +2 -0
  210. package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +2 -0
  211. package/src/lib/widgets/DynamicWidget/DynamicWidget.js +2 -0
  212. package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +1 -0
  213. package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +1 -0
  214. package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +2 -0
  215. package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +2 -0
  216. package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +2 -0
  217. package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +2 -0
  218. package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +2 -0
  219. package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +2 -0
  220. package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +2 -0
  221. package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +2 -0
  222. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +2 -0
  223. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +2 -0
  224. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +1 -0
  225. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +1 -0
  226. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetSwitcher/DynamicWidgetSwitcher.cjs +2 -0
  227. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetSwitcher/DynamicWidgetSwitcher.js +2 -0
  228. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.cjs +2 -0
  229. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.js +2 -0
  230. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.cjs +2 -0
  231. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.js +2 -0
  232. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +2 -0
  233. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +2 -0
  234. package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.cjs +2 -0
  235. package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.js +2 -0
  236. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +2 -0
  237. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +2 -0
  238. package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +2 -0
  239. package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +2 -0
  240. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +2 -0
  241. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +2 -0
  242. package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +11 -5
  243. package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +11 -5
  244. package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.cjs +1 -0
  245. package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.js +1 -0
  246. package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.cjs +2 -0
  247. package/src/lib/widgets/DynamicWidget/components/WidgetPortal/WidgetPortal.js +2 -0
  248. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +2 -0
  249. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +2 -0
  250. package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.cjs +1 -0
  251. package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.js +1 -0
  252. package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.cjs +2 -0
  253. package/src/lib/widgets/DynamicWidget/prompts/DefaultPromptModal/DefaultPromptModal.js +2 -0
  254. package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +2 -0
  255. package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +2 -0
  256. package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +1 -0
  257. package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +1 -0
  258. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +2 -0
  259. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +2 -0
  260. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +1 -0
  261. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +1 -0
  262. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +1 -0
  263. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +1 -0
  264. package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +1 -0
  265. package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +1 -0
  266. package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +1 -0
  267. package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +1 -0
  268. package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +1 -0
  269. package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +1 -0
  270. package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +1 -0
  271. package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +1 -0
  272. package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +2 -0
  273. package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +2 -0
  274. package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +2 -0
  275. package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +2 -0
  276. package/src/lib/widgets/DynamicWidget/views/IndexView/IndexView.cjs +2 -0
  277. package/src/lib/widgets/DynamicWidget/views/IndexView/IndexView.js +2 -0
  278. package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +2 -0
  279. package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +2 -0
  280. package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.cjs +2 -0
  281. package/src/lib/widgets/FundingWidget/views/FundWalletView/FundWalletView.js +2 -0
  282. /package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/hooks/index.d.ts +0 -0
  283. /package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/hooks/useTransactionData/index.d.ts +0 -0
  284. /package/src/lib/{modals/TransactionConfirmationModal → views/TransactionConfirmationView}/hooks/useTransactionData/useTransactionData.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from '../../../../_virtual/_tslib.js';
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { createContext, useContext, useState, useEffect } from 'react';
3
+ import { createContext, useContext, useState, useMemo, useEffect } from 'react';
4
4
  import { isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
5
5
  import { useInternalDynamicContext } from '../DynamicContext/useInternalDynamicContext.js';
6
6
  import { useViewContext } from '../ViewContext/ViewContext.js';
@@ -13,6 +13,7 @@ import '../../utils/constants/colors.js';
13
13
  import 'ethers';
14
14
  import '../../shared/consts/index.js';
15
15
  import '@dynamic-labs/multi-wallet';
16
+ import { getReferencedAccount } from '../../utils/functions/getReferencedAccount/getReferencedAccount.js';
16
17
  import '@dynamic-labs/rpc-providers';
17
18
  import { useVerifyWallet } from '../../utils/hooks/useVerifyWallet/useVerifyWallet.js';
18
19
  import 'react-dom';
@@ -26,6 +27,8 @@ import '../../components/IconButton/IconButton.js';
26
27
  import '../../components/Alert/Alert.js';
27
28
  import '../../components/Popper/Popper/Popper.js';
28
29
  import '../../components/Popper/PopperContext/PopperContext.js';
30
+ import '@dynamic-labs/wallet-book';
31
+ import '../../components/SendBalanceForm/SendBalanceForm.js';
29
32
  import '../MockContext/MockContext.js';
30
33
  import '../ErrorContext/ErrorContext.js';
31
34
  import '../CaptchaContext/CaptchaContext.js';
@@ -34,7 +37,7 @@ import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
34
37
  const SocialRedirectContext = createContext(undefined);
35
38
  const SocialRedirectContextProvider = ({ children, }) => {
36
39
  var _a, _b;
37
- const { setShowAuthFlow, wallets, setSelectedWalletConnector, walletUiUtils, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, } = useInternalDynamicContext();
40
+ const { setShowAuthFlow, wallets, setSelectedWalletConnector, walletUiUtils, consumeNonce, displayTermsOfService, environmentId, projectSettings, setIsSingleWalletAccount, setShowDynamicUserProfile, isAuthenticated, setPrimaryWalletId, secondaryWallets, sdkHasLoaded, authToken, } = useInternalDynamicContext();
38
41
  const { setView } = useViewContext();
39
42
  const verifyWallet = useVerifyWallet({
40
43
  consumeNonce,
@@ -52,12 +55,11 @@ const SocialRedirectContextProvider = ({ children, }) => {
52
55
  .find(isSocialWalletConnector);
53
56
  const [redirectStatus, setRedirectStatus] = useState('idle');
54
57
  const [socialProvider, setSocialProvider] = useState();
58
+ const wallet = secondaryWallets.find((wallet) => wallet.connector.key === (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.key));
59
+ const socialAccount = useMemo(() => (wallet ? getReferencedAccount(authToken, wallet.id) : undefined), [authToken, wallet]);
55
60
  useEffect(() => {
56
61
  var _a;
57
- if (!projectSettings) {
58
- return;
59
- }
60
- if (!socialWalletConnector) {
62
+ if (!projectSettings || !socialWalletConnector || !sdkHasLoaded) {
61
63
  return;
62
64
  }
63
65
  const params = new URLSearchParams(window.location.search);
@@ -67,42 +69,79 @@ const SocialRedirectContextProvider = ({ children, }) => {
67
69
  setRedirectStatus('loading');
68
70
  setView('social-redirect-view');
69
71
  setShowAuthFlow(true);
70
- setSelectedWalletConnector(socialWalletConnector);
72
+ if (!isAuthenticated) {
73
+ setSelectedWalletConnector(socialWalletConnector);
74
+ }
71
75
  (_a = socialWalletConnector
72
76
  .getSession) === null || _a === void 0 ? void 0 : _a.call(socialWalletConnector).then((session) => __awaiter(void 0, void 0, void 0, function* () {
73
- const address = yield socialWalletConnector.fetchPublicAddress();
74
- if (!address) {
75
- return;
77
+ /**
78
+ * If the user is already authenticated, that means that they are in the process
79
+ * of setting their social wallet as their primary wallet. At this point, they
80
+ * have successfully re-authenticated with the social provider. We can now finish
81
+ * the setPrimaryWallet flow
82
+ */
83
+ if (isAuthenticated) {
84
+ if (!socialAccount) {
85
+ throw new Error('Social account not found');
86
+ }
87
+ if (socialAccount.oauthAccountId === session.oauthId) {
88
+ // justification: socialAccount is defined if and only if wallet is also defined
89
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
90
+ setPrimaryWalletId(wallet.id);
91
+ setShowAuthFlow(false);
92
+ setShowDynamicUserProfile(true);
93
+ }
94
+ else {
95
+ yield socialWalletConnector.endSession();
96
+ setView('social-wrong-account');
97
+ }
98
+ }
99
+ else {
100
+ const address = yield socialWalletConnector.fetchPublicAddress();
101
+ walletUiUtils.disabledConfirmationOnce();
102
+ yield verifyWallet({
103
+ oauth: {
104
+ accessToken: session.accessToken,
105
+ didToken: session.didToken,
106
+ provider: providerFromParams,
107
+ },
108
+ /**
109
+ * justification: if the user just successfully authenticated their social,
110
+ * then the social connector must return an address
111
+ */
112
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
113
+ publicWalletAddress: address,
114
+ walletConnector: socialWalletConnector,
115
+ });
76
116
  }
77
- walletUiUtils.enableInternalSign();
78
- yield verifyWallet({
79
- oauth: {
80
- accessToken: session.accessToken,
81
- didToken: session.didToken,
82
- provider: providerFromParams,
83
- },
84
- publicWalletAddress: address,
85
- walletConnector: socialWalletConnector,
86
- });
87
117
  setSocialProvider(undefined);
88
118
  setRedirectStatus('success');
89
- })).catch(() => {
119
+ })).catch((error) => {
90
120
  setRedirectStatus('error');
91
121
  });
92
122
  }
93
123
  }, [
124
+ socialAccount,
125
+ authToken,
126
+ isAuthenticated,
94
127
  projectSettings,
128
+ sdkHasLoaded,
129
+ secondaryWallets,
130
+ setPrimaryWalletId,
95
131
  setSelectedWalletConnector,
96
132
  setShowAuthFlow,
133
+ setShowDynamicUserProfile,
97
134
  setView,
98
135
  socialWalletConnector,
99
136
  verifyWallet,
100
137
  walletUiUtils,
138
+ wallet,
101
139
  ]);
102
140
  return (jsx(SocialRedirectContext.Provider, Object.assign({ value: {
103
141
  enabledSocialProviders,
104
142
  redirectStatus,
105
143
  setSocialProvider,
144
+ socialAccount,
106
145
  socialProvider,
107
146
  socialWalletConnector,
108
147
  } }, { children: children })));
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, SetStateAction, Dispatch } from 'react';
2
- export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view';
2
+ export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'social-wrong-account';
3
3
  export interface ViewContextProps {
4
4
  setView: Dispatch<SetStateAction<ViewType>>;
5
5
  view: ViewType;
@@ -39,6 +39,8 @@ require('../../components/Alert/Alert.cjs');
39
39
  var AnimatePresence = require('../../components/AnimatePresence/AnimatePresence.cjs');
40
40
  require('../../components/Popper/Popper/Popper.cjs');
41
41
  require('../../components/Popper/PopperContext/PopperContext.cjs');
42
+ require('@dynamic-labs/wallet-book');
43
+ require('../../components/SendBalanceForm/SendBalanceForm.cjs');
42
44
  var isUserLinkingWallet = require('../../shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.cjs');
43
45
  require('../../components/OverlayCard/OverlayCard.context.cjs');
44
46
  var OverlayCardTarget = require('../../components/OverlayCard/OverlayCardTarget.cjs');
@@ -35,6 +35,8 @@ import '../../components/Alert/Alert.js';
35
35
  import { AnimatePresence } from '../../components/AnimatePresence/AnimatePresence.js';
36
36
  import '../../components/Popper/Popper/Popper.js';
37
37
  import '../../components/Popper/PopperContext/PopperContext.js';
38
+ import '@dynamic-labs/wallet-book';
39
+ import '../../components/SendBalanceForm/SendBalanceForm.js';
38
40
  import { isUserLinkingWallet } from '../../shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.js';
39
41
  import '../../components/OverlayCard/OverlayCard.context.js';
40
42
  import { OverlayCardTarget } from '../../components/OverlayCard/OverlayCardTarget.js';
@@ -37,6 +37,8 @@ require('../../../components/IconButton/IconButton.cjs');
37
37
  require('../../../components/Alert/Alert.cjs');
38
38
  require('../../../components/Popper/Popper/Popper.cjs');
39
39
  require('../../../components/Popper/PopperContext/PopperContext.cjs');
40
+ require('@dynamic-labs/wallet-book');
41
+ require('../../../components/SendBalanceForm/SendBalanceForm.cjs');
40
42
 
41
43
  const Footer = ({ heading, icon, projectSettings }) => {
42
44
  const { theme } = ThemeContext.useThemeContext();
@@ -33,6 +33,8 @@ import '../../../components/IconButton/IconButton.js';
33
33
  import '../../../components/Alert/Alert.js';
34
34
  import '../../../components/Popper/Popper/Popper.js';
35
35
  import '../../../components/Popper/PopperContext/PopperContext.js';
36
+ import '@dynamic-labs/wallet-book';
37
+ import '../../../components/SendBalanceForm/SendBalanceForm.js';
36
38
 
37
39
  const Footer = ({ heading, icon, projectSettings }) => {
38
40
  const { theme } = useThemeContext();
@@ -33,6 +33,8 @@ require('../../../../../components/IconButton/IconButton.cjs');
33
33
  require('../../../../../components/Alert/Alert.cjs');
34
34
  require('../../../../../components/Popper/Popper/Popper.cjs');
35
35
  require('../../../../../components/Popper/PopperContext/PopperContext.cjs');
36
+ require('@dynamic-labs/wallet-book');
37
+ require('../../../../../components/SendBalanceForm/SendBalanceForm.cjs');
36
38
 
37
39
  const Item = ({ heading, StartIcon, EndIcon, message, url, }) => (jsxRuntime.jsxs("a", Object.assign({ className: 'footer-buttons-item', href: url, rel: 'noopener noreferrer', target: '_blank' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'footer-buttons-item__icon--left' }, { children: jsxRuntime.jsx(StartIcon, {}) })), jsxRuntime.jsxs("div", Object.assign({ className: 'footer-buttons-item__typography' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ as: 'h2', weight: 'regular', color: 'primary', variant: 'body_normal' }, { children: heading })), message && (jsxRuntime.jsx(Typography.Typography, Object.assign({ as: 'p', weight: 'regular', color: 'secondary' }, { children: message })))] })), EndIcon && jsxRuntime.jsx(EndIcon, { style: { height: '1.5rem', width: '1.5rem' } })] })));
38
40
 
@@ -29,6 +29,8 @@ import '../../../../../components/IconButton/IconButton.js';
29
29
  import '../../../../../components/Alert/Alert.js';
30
30
  import '../../../../../components/Popper/Popper/Popper.js';
31
31
  import '../../../../../components/Popper/PopperContext/PopperContext.js';
32
+ import '@dynamic-labs/wallet-book';
33
+ import '../../../../../components/SendBalanceForm/SendBalanceForm.js';
32
34
 
33
35
  const Item = ({ heading, StartIcon, EndIcon, message, url, }) => (jsxs("a", Object.assign({ className: 'footer-buttons-item', href: url, rel: 'noopener noreferrer', target: '_blank' }, { children: [jsx("div", Object.assign({ className: 'footer-buttons-item__icon--left' }, { children: jsx(StartIcon, {}) })), jsxs("div", Object.assign({ className: 'footer-buttons-item__typography' }, { children: [jsx(Typography, Object.assign({ as: 'h2', weight: 'regular', color: 'primary', variant: 'body_normal' }, { children: heading })), message && (jsx(Typography, Object.assign({ as: 'p', weight: 'regular', color: 'secondary' }, { children: message })))] })), EndIcon && jsx(EndIcon, { style: { height: '1.5rem', width: '1.5rem' } })] })));
34
36
 
@@ -35,6 +35,8 @@ require('../../../../../components/IconButton/IconButton.cjs');
35
35
  require('../../../../../components/Alert/Alert.cjs');
36
36
  require('../../../../../components/Popper/Popper/Popper.cjs');
37
37
  require('../../../../../components/Popper/PopperContext/PopperContext.cjs');
38
+ require('@dynamic-labs/wallet-book');
39
+ require('../../../../../components/SendBalanceForm/SendBalanceForm.cjs');
38
40
  var NewToWeb3WalletItem = require('../NewToWeb3WalletItem/NewToWeb3WalletItem.cjs');
39
41
 
40
42
  const WalletExtensionOrAppContinueButton = ({ wallet, selectedUrl, }) => {
@@ -31,6 +31,8 @@ import '../../../../../components/IconButton/IconButton.js';
31
31
  import '../../../../../components/Alert/Alert.js';
32
32
  import '../../../../../components/Popper/Popper/Popper.js';
33
33
  import '../../../../../components/Popper/PopperContext/PopperContext.js';
34
+ import '@dynamic-labs/wallet-book';
35
+ import '../../../../../components/SendBalanceForm/SendBalanceForm.js';
34
36
  import { NewToWeb3WalletItem } from '../NewToWeb3WalletItem/NewToWeb3WalletItem.js';
35
37
 
36
38
  const WalletExtensionOrAppContinueButton = ({ wallet, selectedUrl, }) => {
@@ -39,6 +39,7 @@ var EnterTileAnimation = require('../../../../components/EnterTileAnimation/Ente
39
39
  require('../../../../components/Alert/Alert.cjs');
40
40
  require('../../../../components/Popper/Popper/Popper.cjs');
41
41
  require('../../../../components/Popper/PopperContext/PopperContext.cjs');
42
+ require('../../../../components/SendBalanceForm/SendBalanceForm.cjs');
42
43
  var NewToWeb3WalletItem = require('./NewToWeb3WalletItem/NewToWeb3WalletItem.cjs');
43
44
  var Item = require('./Item/Item.cjs');
44
45
  var WalletExtensionOrAppContinueButton = require('./WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs');
@@ -35,6 +35,7 @@ import { EnterTileAnimation } from '../../../../components/EnterTileAnimation/En
35
35
  import '../../../../components/Alert/Alert.js';
36
36
  import '../../../../components/Popper/Popper/Popper.js';
37
37
  import '../../../../components/Popper/PopperContext/PopperContext.js';
38
+ import '../../../../components/SendBalanceForm/SendBalanceForm.js';
38
39
  import { NewToWeb3WalletItem } from './NewToWeb3WalletItem/NewToWeb3WalletItem.js';
39
40
  import { Item } from './Item/Item.js';
40
41
  import { WalletExtensionOrAppContinueButton } from './WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js';
@@ -39,6 +39,8 @@ require('../../../../components/Alert/Alert.cjs');
39
39
  var PoweredByDynamic = require('../../../../components/PoweredByDynamic/PoweredByDynamic.cjs');
40
40
  require('../../../../components/Popper/Popper/Popper.cjs');
41
41
  require('../../../../components/Popper/PopperContext/PopperContext.cjs');
42
+ require('@dynamic-labs/wallet-book');
43
+ require('../../../../components/SendBalanceForm/SendBalanceForm.cjs');
42
44
 
43
45
  const WalletMoreInfoContent = ({ appName, variant, walletName, }) => {
44
46
  const defaultSignContent = {
@@ -35,6 +35,8 @@ import '../../../../components/Alert/Alert.js';
35
35
  import { PoweredByDynamic } from '../../../../components/PoweredByDynamic/PoweredByDynamic.js';
36
36
  import '../../../../components/Popper/Popper/Popper.js';
37
37
  import '../../../../components/Popper/PopperContext/PopperContext.js';
38
+ import '@dynamic-labs/wallet-book';
39
+ import '../../../../components/SendBalanceForm/SendBalanceForm.js';
38
40
 
39
41
  const WalletMoreInfoContent = ({ appName, variant, walletName, }) => {
40
42
  const defaultSignContent = {
@@ -37,16 +37,26 @@ require('../../../components/Alert/Alert.cjs');
37
37
  require('../../../components/Popper/Popper/Popper.cjs');
38
38
  require('../../../components/Popper/PopperContext/PopperContext.cjs');
39
39
  var Skeleton = require('../../../components/Skeleton/Skeleton.cjs');
40
+ require('@dynamic-labs/wallet-book');
41
+ require('../../../components/SendBalanceForm/SendBalanceForm.cjs');
40
42
  var QrCodeContext = require('../../../context/QrCodeContext/QrCodeContext.cjs');
41
43
 
42
44
  const Header = ({ onClose: handleClose, heading, projectSettings, }) => {
43
- const { clearStatesOnBackClick, loginWithEmail } = useInternalDynamicContext.useInternalDynamicContext();
45
+ const { clearStatesOnBackClick, loginWithEmail, selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
44
46
  const { showQrCodeMessage, setShowQrCodeImage, showQrCodeImage } = QrCodeContext.useQrCodeContext();
45
47
  const { view, setView } = ViewContext.useViewContext();
46
48
  const handleBackClick = React.useCallback(() => {
47
- clearStatesOnBackClick();
48
49
  setView(loginWithEmail ? 'login-with-email-or-wallet' : 'wallet-list');
49
- }, [clearStatesOnBackClick, loginWithEmail, setView]);
50
+ // on back button click in Coinbase wallet clearing state would kill connection and refresh the page
51
+ if ((selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name) !== 'Coinbase') {
52
+ clearStatesOnBackClick();
53
+ }
54
+ }, [
55
+ clearStatesOnBackClick,
56
+ loginWithEmail,
57
+ selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
58
+ setView,
59
+ ]);
50
60
  const positionAbsolute = view === 'login-with-email-verification';
51
61
  const showCloseButton = view !== 'login-with-email-or-wallet-full-wallet-list' &&
52
62
  view !== 'login-with-email-verification';
@@ -33,16 +33,26 @@ import '../../../components/Alert/Alert.js';
33
33
  import '../../../components/Popper/Popper/Popper.js';
34
34
  import '../../../components/Popper/PopperContext/PopperContext.js';
35
35
  import { Skeleton } from '../../../components/Skeleton/Skeleton.js';
36
+ import '@dynamic-labs/wallet-book';
37
+ import '../../../components/SendBalanceForm/SendBalanceForm.js';
36
38
  import { useQrCodeContext } from '../../../context/QrCodeContext/QrCodeContext.js';
37
39
 
38
40
  const Header = ({ onClose: handleClose, heading, projectSettings, }) => {
39
- const { clearStatesOnBackClick, loginWithEmail } = useInternalDynamicContext();
41
+ const { clearStatesOnBackClick, loginWithEmail, selectedWalletConnector } = useInternalDynamicContext();
40
42
  const { showQrCodeMessage, setShowQrCodeImage, showQrCodeImage } = useQrCodeContext();
41
43
  const { view, setView } = useViewContext();
42
44
  const handleBackClick = useCallback(() => {
43
- clearStatesOnBackClick();
44
45
  setView(loginWithEmail ? 'login-with-email-or-wallet' : 'wallet-list');
45
- }, [clearStatesOnBackClick, loginWithEmail, setView]);
46
+ // on back button click in Coinbase wallet clearing state would kill connection and refresh the page
47
+ if ((selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name) !== 'Coinbase') {
48
+ clearStatesOnBackClick();
49
+ }
50
+ }, [
51
+ clearStatesOnBackClick,
52
+ loginWithEmail,
53
+ selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
54
+ setView,
55
+ ]);
46
56
  const positionAbsolute = view === 'login-with-email-verification';
47
57
  const showCloseButton = view !== 'login-with-email-or-wallet-full-wallet-list' &&
48
58
  view !== 'login-with-email-verification';
@@ -46,6 +46,8 @@ require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
46
46
  var VerticalDrawerTransition = require('../../components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.cjs');
47
47
  require('../../components/Popper/Popper/Popper.cjs');
48
48
  require('../../components/Popper/PopperContext/PopperContext.cjs');
49
+ require('@dynamic-labs/wallet-book');
50
+ require('../../components/SendBalanceForm/SendBalanceForm.cjs');
49
51
 
50
52
  const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message, handler, onReject, onSignMessage, }) => {
51
53
  usePreventPageScroll.usePreventPageScroll(true);
@@ -42,6 +42,8 @@ import '../../components/Transition/OpacityTransition/OpacityTransition.js';
42
42
  import { VerticalDrawerTransition } from '../../components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.js';
43
43
  import '../../components/Popper/Popper/Popper.js';
44
44
  import '../../components/Popper/PopperContext/PopperContext.js';
45
+ import '@dynamic-labs/wallet-book';
46
+ import '../../components/SendBalanceForm/SendBalanceForm.js';
45
47
 
46
48
  const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message, handler, onReject, onSignMessage, }) => {
47
49
  usePreventPageScroll(true);
@@ -4,36 +4,28 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
- var ethers = require('ethers');
8
- var utils = require('@dynamic-labs/utils');
9
7
  require('@dynamic-labs/sdk-api');
10
8
  require('../../shared/logger.cjs');
11
- var getChainIcon = require('../../shared/utils/functions/chain/getChainIcon.cjs');
9
+ require('@dynamic-labs/iconic');
12
10
  require('@dynamic-labs/wallet-connector-core');
13
- var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
11
+ require('../../context/ViewContext/ViewContext.cjs');
12
+ require('@dynamic-labs/utils');
14
13
  require('../../utils/constants/colors.cjs');
15
- var formatBigNumber = require('../../shared/utils/functions/formatBigNumber/formatBigNumber.cjs');
14
+ require('ethers');
16
15
  var usePreventPageScroll = require('../../shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.cjs');
17
- require('@dynamic-labs/iconic');
18
- require('../../context/ViewContext/ViewContext.cjs');
19
16
  var index = require('../../shared/consts/index.cjs');
20
- var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
17
+ require('../../context/DynamicContext/DynamicContext.cjs');
21
18
  require('@dynamic-labs/multi-wallet');
22
19
  require('../../components/ShadowDOM/ShadowDOM.cjs');
23
20
  require('../../context/ThemeContext/ThemeContext.cjs');
24
- var Icon = require('../../components/Icon/Icon.cjs');
25
21
  var Portal = require('../../components/Portal/Portal.cjs');
26
22
  require('react-dom');
27
23
  require('../../config/ApiEndpoint.cjs');
28
24
  require('@dynamic-labs/rpc-providers');
29
25
  require('../../context/ErrorContext/ErrorContext.cjs');
30
- var useFetchCurrency = require('../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.cjs');
31
- var transactionErrorMessage = require('./helpers/transactionErrorMessage.cjs');
32
- var useTransactionData = require('./hooks/useTransactionData/useTransactionData.cjs');
26
+ var TransactionConfirmationView = require('../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
33
27
  require('../../context/MockContext/MockContext.cjs');
34
28
  require('../../context/CaptchaContext/CaptchaContext.cjs');
35
- var usePromise = require('../../utils/hooks/usePromise/usePromise.cjs');
36
- var useMutation = require('../../utils/hooks/useMutation/useMutation.cjs');
37
29
  require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
38
30
  require('../../components/IconButton/IconButton.cjs');
39
31
  require('../../components/Alert/Alert.cjs');
@@ -42,70 +34,30 @@ require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs
42
34
  require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
43
35
  require('../../components/Popper/Popper/Popper.cjs');
44
36
  require('../../components/Popper/PopperContext/PopperContext.cjs');
45
- var TransactionConfirmationPageLayout = require('../../components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs');
46
- var TransactionRow = require('../../components/TransactionConfirmationPageLayout/components/TransactionRow/TransactionRow.cjs');
37
+ require('@dynamic-labs/wallet-book');
38
+ require('../../components/SendBalanceForm/SendBalanceForm.cjs');
47
39
 
48
- const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onTransactionResponseSuccess, appLogoUrl, appName, transaction, provider, }) => {
40
+ const TransactionConfirmationModal = ({ title, handler, onReject, onTransactionResponseSuccess, transaction, provider, }) => {
49
41
  usePreventPageScroll.usePreventPageScroll(true);
50
- const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
51
- const didConfirmRef = React.useRef(false);
52
42
  const [show, setShow] = React.useState(true);
53
- if (!primaryWallet) {
54
- throw new utils.DynamicError('Primary wallet is not available, transaction cannot be displayed');
55
- }
56
- const { data: balance } = usePromise.usePromise(() => primaryWallet.connector
57
- .getBalance()
58
- .then((balanceText) => balanceText ? ethers.ethers.utils.parseEther(balanceText) : undefined));
59
- const [currencySymbol] = useFetchCurrency.useFetchCurrency(primaryWallet.connector);
60
- const { isLoading, mutate: sendTransaction, data: transactionResponse, error: transactionError, } = useMutation.useMutation(() => handler(transaction), {
61
- onSuccess: () => {
62
- didConfirmRef.current = true;
63
- setShow(false);
64
- },
65
- });
66
- const { isLoading: isLoadingTransaction, isTransactionFromAddressLoading, isTransactionToAddressLoading, transactionFromAddress, transactionToAddress, isEffectiveValueLoading, transactionValue, gasEstimate, isGasPriceLoading, total, } = useTransactionData.useTransactionData({
67
- provider,
68
- transaction,
69
- });
70
- const hasInsufficientFunds = React.useMemo(() => {
71
- if (balance === undefined || total === undefined)
72
- return false;
73
- return total.gt(balance);
74
- }, [balance, total]);
75
- const missingFunds = React.useMemo(() => {
76
- if (balance === undefined || total === undefined)
77
- return undefined;
78
- return total.sub(balance);
79
- }, [balance, total]);
80
- const handleOnReject = React.useCallback(() => {
81
- didConfirmRef.current = false;
43
+ const errorRef = React.useRef(null);
44
+ const transactionResponseRef = React.useRef(null);
45
+ const closeModal = React.useCallback(() => {
82
46
  setShow(false);
83
47
  }, [setShow]);
84
48
  const handleOnModalUnmount = React.useCallback(() => {
85
- if (transactionResponse) {
86
- return onTransactionResponseSuccess(transactionResponse);
49
+ if (transactionResponseRef.current) {
50
+ return onTransactionResponseSuccess(transactionResponseRef.current);
87
51
  }
88
- onReject(transactionError || new Error('user rejected transaction'));
89
- }, [
90
- transactionResponse,
91
- transactionError,
92
- onTransactionResponseSuccess,
93
- onReject,
94
- ]);
95
- const ChainIconComponent = getChainIcon.getChainIcon('evm');
96
- const chainIcon = (jsxRuntime.jsx(Icon.Icon, Object.assign({ size: 'small' }, { children: jsxRuntime.jsx(ChainIconComponent, {}) })));
97
- const errorMessage = transactionError && transactionErrorMessage.transactionErrorMessage(transactionError);
98
- const warningMessage = React.useMemo(() => {
99
- const showInsufficientFundsWarningMessage = hasInsufficientFunds && missingFunds;
100
- if (!showInsufficientFundsWarningMessage)
101
- return;
102
- const amountLeft = formatBigNumber.formatBigNumber(missingFunds, 5);
103
- return `Insufficient funds due to gas price increase from estimate. Please add ${amountLeft} ${currencySymbol} to continue.`;
104
- }, [currencySymbol, hasInsufficientFunds, missingFunds]);
105
- return (jsxRuntime.jsx(Portal.Portal, Object.assign({ handleClose: handleOnReject, isShown: show, zIndex: index.authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
52
+ onReject(errorRef.current || new Error('user rejected transaction'));
53
+ }, [onTransactionResponseSuccess, onReject]);
54
+ return (jsxRuntime.jsx(Portal.Portal, Object.assign({ handleClose: closeModal, isShown: show, zIndex: index.authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
106
55
  onUnmount: handleOnModalUnmount,
107
- } }, { children: jsxRuntime.jsx("div", Object.assign({ className: 'transaction-confirmation' }, { children: jsxRuntime.jsxs(TransactionConfirmationPageLayout.TransactionConfirmationPageLayout, Object.assign({ appOrigin: appOrigin, appLogoUrl: appLogoUrl, appName: appName, isLoading: isLoading, disableSendButton: isLoadingTransaction || hasInsufficientFunds, onClickSend: () => sendTransaction(), onClickClose: handleOnReject, displayPoweredByDynamicFooter: true, error: errorMessage, warningMessage: warningMessage, title: title }, { children: [jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'From (You)', isLoading: isTransactionFromAddressLoading, title: transactionFromAddress }, { children: shortenWalletAddress.shortenWalletAddress(transactionFromAddress, 4, 4) })), jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'To', isLoading: isTransactionToAddressLoading, title: transactionToAddress }, { children: transactionToAddress &&
108
- shortenWalletAddress.shortenWalletAddress(transactionToAddress, 4, 4) })), jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Amount', isLoading: isEffectiveValueLoading, isEmpty: !transactionValue, title: transactionValue && formatBigNumber.formatBigNumber(transactionValue), suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount' }, { children: transactionValue ? formatBigNumber.formatBigNumber(transactionValue, 10) : 0 })), jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Gas (estimated)', isEmpty: !gasEstimate, isLoading: isGasPriceLoading, title: gasEstimate && formatBigNumber.formatBigNumber(gasEstimate), suffix: gasEstimate && currencySymbol, icon: gasEstimate && chainIcon, dataTestId: 'transaction-gas-free' }, { children: gasEstimate ? formatBigNumber.formatBigNumber(gasEstimate, 10) : 'N/A' })), jsxRuntime.jsx(TransactionRow.TransactionRow, Object.assign({ label: 'Total', isEmpty: !total, title: total && formatBigNumber.formatBigNumber(total), suffix: total && currencySymbol, icon: total && chainIcon, dataTestId: 'transaction-total' }, { children: total ? formatBigNumber.formatBigNumber(total, 10) : 'N/A' }))] })) })) })));
56
+ } }, { children: jsxRuntime.jsx("div", Object.assign({ className: 'transaction-confirmation' }, { children: jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { provider: provider, transaction: transaction, title: title, mutation: () => handler(transaction), onClickClose: closeModal, onError: (error) => (errorRef.current = error), onSuccess: (transactionResponse) => {
57
+ errorRef.current = null;
58
+ transactionResponseRef.current = transactionResponse;
59
+ closeModal();
60
+ } }) })) })));
109
61
  };
110
62
 
111
63
  exports.TransactionConfirmationModal = TransactionConfirmationModal;