@dynamic-labs/sdk-react-core 4.5.0 → 4.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +12 -12
  5. package/src/index.cjs +7 -7
  6. package/src/index.js +2 -2
  7. package/src/lib/components/Alert/Alert.cjs +6 -3
  8. package/src/lib/components/Alert/Alert.d.ts +1 -0
  9. package/src/lib/components/Alert/Alert.js +6 -4
  10. package/src/lib/components/Alert/AlertText/AlertText.cjs +16 -0
  11. package/src/lib/components/Alert/AlertText/AlertText.d.ts +7 -0
  12. package/src/lib/components/Alert/AlertText/AlertText.js +12 -0
  13. package/src/lib/components/Alert/AlertText/index.d.ts +1 -0
  14. package/src/lib/components/NetworkPicker/NetworkPicker.cjs +11 -40
  15. package/src/lib/components/NetworkPicker/NetworkPicker.d.ts +2 -6
  16. package/src/lib/components/NetworkPicker/NetworkPicker.js +12 -41
  17. package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.cjs +6 -8
  18. package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.d.ts +2 -4
  19. package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.js +6 -8
  20. package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.cjs +67 -0
  21. package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.d.ts +14 -0
  22. package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.js +63 -0
  23. package/src/lib/components/NetworkPicker/components/NetworkDropdown/index.d.ts +1 -0
  24. package/src/lib/components/NetworkPicker/components/{EvmNetworkControl/EvmNetworkControl.cjs → NetworkSwitchControl/NetworkSwitchControl.cjs} +27 -36
  25. package/src/lib/components/NetworkPicker/components/NetworkSwitchControl/NetworkSwitchControl.d.ts +16 -0
  26. package/src/lib/components/NetworkPicker/components/{EvmNetworkControl/EvmNetworkControl.js → NetworkSwitchControl/NetworkSwitchControl.js} +27 -35
  27. package/src/lib/components/NetworkPicker/components/NetworkSwitchControl/index.d.ts +1 -0
  28. package/src/lib/components/Portal/Portal.cjs +3 -2
  29. package/src/lib/components/Portal/Portal.js +3 -2
  30. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +1 -1
  31. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +1 -1
  32. package/src/lib/components/ShadowDOM/ShadowDOM.cjs +0 -2
  33. package/src/lib/components/ShadowDOM/ShadowDOM.js +1 -2
  34. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +1 -1
  35. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +1 -1
  36. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -1
  37. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -1
  38. package/src/lib/components/UserProfile/UserProfile.cjs +1 -1
  39. package/src/lib/components/UserProfile/UserProfile.js +1 -1
  40. package/src/lib/context/DynamicContext/DynamicContext.cjs +15 -12
  41. package/src/lib/context/DynamicContext/DynamicContext.js +15 -12
  42. package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.cjs +2 -2
  43. package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.js +3 -3
  44. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +0 -4
  45. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +0 -4
  46. package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.cjs +7 -2
  47. package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.js +7 -2
  48. package/src/lib/context/DynamicContext/hooks/usePasskeySuccessPopup/usePasskeySuccessPopup.cjs +2 -2
  49. package/src/lib/context/DynamicContext/hooks/usePasskeySuccessPopup/usePasskeySuccessPopup.js +3 -3
  50. package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +5 -2
  51. package/src/lib/context/ErrorContext/ErrorContext.cjs +7 -6
  52. package/src/lib/context/ErrorContext/ErrorContext.js +8 -7
  53. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +3 -3
  54. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +3 -3
  55. package/src/lib/context/ViewContext/ViewContext.cjs +7 -2
  56. package/src/lib/context/ViewContext/ViewContext.js +7 -2
  57. package/src/lib/context/ViewContext/types/index.d.ts +1 -1
  58. package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +5 -64
  59. package/src/lib/data/api/embeddedWallets/embeddedWallets.d.ts +2 -18
  60. package/src/lib/data/api/embeddedWallets/embeddedWallets.js +6 -61
  61. package/src/lib/data/api/wallets/wallets.cjs +1 -3
  62. package/src/lib/data/api/wallets/wallets.d.ts +1 -1
  63. package/src/lib/data/api/wallets/wallets.js +2 -4
  64. package/src/lib/events/embeddedWallet.d.ts +0 -4
  65. package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +2 -6
  66. package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +2 -6
  67. package/src/lib/locale/en/translation.cjs +13 -32
  68. package/src/lib/locale/en/translation.d.ts +12 -31
  69. package/src/lib/locale/en/translation.js +13 -32
  70. package/src/lib/main.global.cjs +1 -1
  71. package/src/lib/main.global.js +1 -1
  72. package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.cjs +8 -8
  73. package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.js +8 -8
  74. package/src/lib/modals/index.d.ts +0 -2
  75. package/src/lib/shared/assets/index.d.ts +1 -0
  76. package/src/lib/shared/assets/{currency.cjs → wallet-with-sunglasses.cjs} +14 -26
  77. package/src/lib/shared/assets/wallet-with-sunglasses.js +34 -0
  78. package/src/lib/shared/utils/functions/index.d.ts +0 -2
  79. package/src/lib/shared/utils/hooks/useLocalStorage/useLocalStorage.cjs +7 -5
  80. package/src/lib/shared/utils/hooks/useLocalStorage/useLocalStorage.js +8 -6
  81. package/src/lib/styles/index.shadow.cjs +1 -1
  82. package/src/lib/styles/index.shadow.js +1 -1
  83. package/src/lib/utils/functions/index.d.ts +0 -5
  84. package/src/lib/utils/functions/isAllowedToLinkWallet/isAllowedToLinkWallet.cjs +1 -1
  85. package/src/lib/utils/functions/isAllowedToLinkWallet/isAllowedToLinkWallet.js +1 -1
  86. package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.cjs +2 -4
  87. package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.d.ts +2 -2
  88. package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.js +2 -4
  89. package/src/lib/utils/functions/onrampConfigurationToOnrampOption/onrampConfigurationToOnrampOption.cjs +1 -1
  90. package/src/lib/utils/functions/onrampConfigurationToOnrampOption/onrampConfigurationToOnrampOption.js +1 -1
  91. package/src/lib/utils/hooks/index.d.ts +0 -1
  92. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +0 -2
  93. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +0 -2
  94. package/src/lib/utils/hooks/useClearWalletConnectSessions/useClearWalletConnectSessions.cjs +2 -2
  95. package/src/lib/utils/hooks/useClearWalletConnectSessions/useClearWalletConnectSessions.js +3 -3
  96. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +16 -4
  97. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +16 -4
  98. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +3 -3
  99. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +3 -3
  100. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs +1 -1
  101. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js +1 -1
  102. package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +1 -6
  103. package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +1 -6
  104. package/src/lib/utils/hooks/useDynamicModals/useDynamicModals.cjs +1 -1
  105. package/src/lib/utils/hooks/useDynamicModals/useDynamicModals.js +1 -1
  106. package/src/lib/utils/hooks/useElementById/useElementById.cjs +2 -2
  107. package/src/lib/utils/hooks/useElementById/useElementById.js +3 -3
  108. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +1 -13
  109. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +1 -13
  110. package/src/lib/utils/hooks/useEmbeddedWallet/index.d.ts +0 -1
  111. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +7 -23
  112. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.d.ts +0 -2
  113. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +7 -23
  114. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +4 -4
  115. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +4 -4
  116. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +3 -3
  117. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +3 -3
  118. package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +1 -0
  119. package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +1 -0
  120. package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs +1 -1
  121. package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js +1 -1
  122. package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +2 -2
  123. package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +2 -2
  124. package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.cjs +1 -1
  125. package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.js +1 -1
  126. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +11 -18
  127. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +12 -19
  128. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.cjs +4 -4
  129. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.js +4 -4
  130. package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.cjs +4 -4
  131. package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.js +4 -4
  132. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +4 -4
  133. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +4 -4
  134. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +0 -3
  135. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +0 -3
  136. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +0 -3
  137. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +0 -3
  138. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.cjs +0 -1
  139. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.js +0 -1
  140. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +2 -24
  141. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +2 -24
  142. package/src/lib/utils/validations/index.d.ts +0 -1
  143. package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +2 -4
  144. package/src/lib/views/CollectUserDataView/CollectUserDataView.js +2 -4
  145. package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.cjs +2 -2
  146. package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.js +2 -2
  147. package/src/lib/views/EmailVerification/EmailVerification.cjs +4 -4
  148. package/src/lib/views/EmailVerification/EmailVerification.js +4 -4
  149. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +12 -34
  150. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +13 -35
  151. package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.cjs +2 -2
  152. package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.js +2 -2
  153. package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.cjs +1 -1
  154. package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.js +1 -1
  155. package/src/lib/views/MfaRecoveryView/MfaRecoveryView.cjs +1 -1
  156. package/src/lib/views/MfaRecoveryView/MfaRecoveryView.js +1 -1
  157. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +3 -4
  158. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +3 -4
  159. package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +1 -1
  160. package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +1 -1
  161. package/src/lib/views/SendBalanceView/SendBalanceView.cjs +1 -1
  162. package/src/lib/views/SendBalanceView/SendBalanceView.js +1 -1
  163. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +11 -11
  164. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +11 -11
  165. package/src/lib/views/viewToComponentMap.cjs +0 -4
  166. package/src/lib/views/viewToComponentMap.d.ts +0 -2
  167. package/src/lib/views/viewToComponentMap.js +0 -4
  168. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +10 -15
  169. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +11 -16
  170. package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +1 -1
  171. package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +1 -1
  172. package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.cjs +2 -6
  173. package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.js +2 -6
  174. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +3 -3
  175. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +3 -3
  176. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +1 -1
  177. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +1 -1
  178. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +1 -1
  179. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +1 -1
  180. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
  181. package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +1 -1
  182. package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +1 -1
  183. package/src/lib/widgets/DynamicWidget/views/ChooseOnrampProviderView/ChooseOnrampProviderView.cjs +4 -1
  184. package/src/lib/widgets/DynamicWidget/views/ChooseOnrampProviderView/ChooseOnrampProviderView.js +4 -1
  185. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.cjs +1 -1
  186. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.js +1 -1
  187. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useFundingMethods.cjs +19 -11
  188. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useFundingMethods.js +19 -11
  189. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs +2 -2
  190. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js +2 -2
  191. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.cjs +103 -50
  192. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.js +99 -46
  193. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenOption/TokenOption.cjs +21 -10
  194. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenOption/TokenOption.d.ts +2 -0
  195. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenOption/TokenOption.js +21 -10
  196. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenSelectScreen.cjs +3 -3
  197. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenSelectScreen.d.ts +2 -0
  198. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenSelectScreen.js +3 -3
  199. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/types.d.ts +2 -0
  200. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/calculateFiatBalance.cjs +27 -0
  201. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/calculateFiatBalance.d.ts +2 -0
  202. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/calculateFiatBalance.js +23 -0
  203. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/index.d.ts +1 -0
  204. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/convert/convert.cjs +4 -0
  205. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/convert/convert.js +4 -0
  206. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/convertScientificToDecimal.cjs +33 -0
  207. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/convertScientificToDecimal.d.ts +8 -0
  208. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/convertScientificToDecimal.js +29 -0
  209. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/index.d.ts +1 -0
  210. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/formatValue.cjs +27 -22
  211. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/formatValue.d.ts +6 -0
  212. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/formatValue.js +27 -22
  213. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/isFiatToken/isFiatToken.cjs +2 -0
  214. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/isFiatToken/isFiatToken.d.ts +1 -0
  215. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/isFiatToken/isFiatToken.js +2 -1
  216. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/index.d.ts +1 -0
  217. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/useExchangeRatesForFunding.cjs +32 -0
  218. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/useExchangeRatesForFunding.d.ts +9 -0
  219. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/useExchangeRatesForFunding.js +28 -0
  220. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useSubmitExternalWalletFunding/useSubmitExternalWalletFunding.cjs +14 -2
  221. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useSubmitExternalWalletFunding/useSubmitExternalWalletFunding.js +14 -2
  222. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useTokensForFunding/useTokensForFunding.cjs +27 -15
  223. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useTokensForFunding/useTokensForFunding.js +27 -15
  224. package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/EmptyScreen.cjs +20 -0
  225. package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/EmptyScreen.d.ts +2 -0
  226. package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/EmptyScreen.js +16 -0
  227. package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/index.d.ts +1 -0
  228. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +10 -23
  229. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +11 -24
  230. package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.d.ts +0 -23
  231. package/src/lib/components/NetworkPicker/components/EvmNetworkControl/index.d.ts +0 -1
  232. package/src/lib/components/ToggleVisibilityButton/ToggleVisibilityButton.cjs +0 -113
  233. package/src/lib/components/ToggleVisibilityButton/ToggleVisibilityButton.js +0 -109
  234. package/src/lib/modals/CreatePasswordModal/CreatePasswordModal.cjs +0 -106
  235. package/src/lib/modals/CreatePasswordModal/CreatePasswordModal.d.ts +0 -3
  236. package/src/lib/modals/CreatePasswordModal/CreatePasswordModal.js +0 -102
  237. package/src/lib/modals/CreatePasswordModal/CreatePasswordModal.types.d.ts +0 -5
  238. package/src/lib/modals/CreatePasswordModal/index.d.ts +0 -1
  239. package/src/lib/modals/EnterPasswordModal/EnterPasswordModal.cjs +0 -106
  240. package/src/lib/modals/EnterPasswordModal/EnterPasswordModal.d.ts +0 -3
  241. package/src/lib/modals/EnterPasswordModal/EnterPasswordModal.js +0 -102
  242. package/src/lib/modals/EnterPasswordModal/EnterPasswordModal.types.d.ts +0 -6
  243. package/src/lib/modals/EnterPasswordModal/index.d.ts +0 -1
  244. package/src/lib/shared/assets/alt-key.cjs +0 -55
  245. package/src/lib/shared/assets/alt-key.js +0 -31
  246. package/src/lib/shared/assets/currency.js +0 -46
  247. package/src/lib/shared/assets/lock.cjs +0 -55
  248. package/src/lib/shared/assets/lock.js +0 -31
  249. package/src/lib/shared/assets/save-password-hero.cjs +0 -128
  250. package/src/lib/shared/assets/save-password-hero.js +0 -104
  251. package/src/lib/shared/assets/wallet-claim-hero.cjs +0 -128
  252. package/src/lib/shared/assets/wallet-claim-hero.js +0 -104
  253. package/src/lib/shared/utils/functions/generateRandomPassword/generateRandomPassword.cjs +0 -15
  254. package/src/lib/shared/utils/functions/generateRandomPassword/generateRandomPassword.d.ts +0 -1
  255. package/src/lib/shared/utils/functions/generateRandomPassword/generateRandomPassword.js +0 -11
  256. package/src/lib/shared/utils/functions/generateRandomPassword/index.d.ts +0 -1
  257. package/src/lib/shared/utils/functions/validatePassword/index.d.ts +0 -1
  258. package/src/lib/shared/utils/functions/validatePassword/validatePassword.cjs +0 -60
  259. package/src/lib/shared/utils/functions/validatePassword/validatePassword.d.ts +0 -13
  260. package/src/lib/shared/utils/functions/validatePassword/validatePassword.js +0 -56
  261. package/src/lib/utils/functions/findCoinbaseMPCWallet/findCoinbaseMPCWallet.cjs +0 -8
  262. package/src/lib/utils/functions/findCoinbaseMPCWallet/findCoinbaseMPCWallet.d.ts +0 -2
  263. package/src/lib/utils/functions/findCoinbaseMPCWallet/findCoinbaseMPCWallet.js +0 -4
  264. package/src/lib/utils/functions/findCoinbaseMPCWallet/index.d.ts +0 -1
  265. package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.cjs +0 -53
  266. package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.d.ts +0 -9
  267. package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.js +0 -49
  268. package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/index.d.ts +0 -1
  269. package/src/lib/utils/functions/isCoinbaseWaasEnabled/isCoinbaseWaasEnabled.cjs +0 -14
  270. package/src/lib/utils/functions/isCoinbaseWaasEnabled/isCoinbaseWaasEnabled.js +0 -10
  271. package/src/lib/utils/functions/requiresPasswordForEmbeddedWallet/index.d.ts +0 -1
  272. package/src/lib/utils/functions/requiresPasswordForEmbeddedWallet/requiresPasswordForEmbeddedWallet.cjs +0 -16
  273. package/src/lib/utils/functions/requiresPasswordForEmbeddedWallet/requiresPasswordForEmbeddedWallet.d.ts +0 -2
  274. package/src/lib/utils/functions/requiresPasswordForEmbeddedWallet/requiresPasswordForEmbeddedWallet.js +0 -12
  275. package/src/lib/utils/functions/requiresPasswordForEmbeddedWalletOnSignup/index.d.ts +0 -1
  276. package/src/lib/utils/functions/requiresPasswordForEmbeddedWalletOnSignup/requiresPasswordForEmbeddedWalletOnSignup.cjs +0 -39
  277. package/src/lib/utils/functions/requiresPasswordForEmbeddedWalletOnSignup/requiresPasswordForEmbeddedWalletOnSignup.d.ts +0 -2
  278. package/src/lib/utils/functions/requiresPasswordForEmbeddedWalletOnSignup/requiresPasswordForEmbeddedWalletOnSignup.js +0 -35
  279. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/index.d.ts +0 -2
  280. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/index.d.ts +0 -1
  281. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +0 -229
  282. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.d.ts +0 -5
  283. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +0 -225
  284. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.cjs +0 -191
  285. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.d.ts +0 -18
  286. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.js +0 -187
  287. package/src/lib/utils/hooks/useEmbeddedWalletPassword/index.d.ts +0 -1
  288. package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +0 -141
  289. package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.d.ts +0 -4
  290. package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +0 -137
  291. package/src/lib/utils/validations/validateMPCProviderEnabled/index.d.ts +0 -1
  292. package/src/lib/utils/validations/validateMPCProviderEnabled/validateMPCProviderEnabled.cjs +0 -18
  293. package/src/lib/utils/validations/validateMPCProviderEnabled/validateMPCProviderEnabled.d.ts +0 -2
  294. package/src/lib/utils/validations/validateMPCProviderEnabled/validateMPCProviderEnabled.js +0 -14
  295. package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.cjs +0 -116
  296. package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.d.ts +0 -2
  297. package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.js +0 -112
  298. package/src/lib/views/CoinbaseMPCClaimIntro/index.d.ts +0 -1
  299. package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.cjs +0 -197
  300. package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.d.ts +0 -12
  301. package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.js +0 -193
  302. package/src/lib/views/CreatePasswordView/CreatePasswordStep/index.d.ts +0 -1
  303. package/src/lib/views/CreatePasswordView/CreatePasswordView.cjs +0 -169
  304. package/src/lib/views/CreatePasswordView/CreatePasswordView.d.ts +0 -9
  305. package/src/lib/views/CreatePasswordView/CreatePasswordView.js +0 -165
  306. package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.cjs +0 -141
  307. package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.d.ts +0 -12
  308. package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.js +0 -137
  309. package/src/lib/views/CreatePasswordView/SavePasswordStep/index.d.ts +0 -1
  310. package/src/lib/views/CreatePasswordView/index.d.ts +0 -1
  311. package/src/lib/views/EnterPasswordView/EnterPasswordView.cjs +0 -141
  312. package/src/lib/views/EnterPasswordView/EnterPasswordView.d.ts +0 -8
  313. package/src/lib/views/EnterPasswordView/EnterPasswordView.js +0 -137
  314. package/src/lib/views/EnterPasswordView/index.d.ts +0 -1
@@ -1,197 +0,0 @@
1
- 'use client'
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
- var jsxRuntime = require('react/jsx-runtime');
8
- var React = require('react');
9
- var reactI18next = require('react-i18next');
10
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
11
- require('@dynamic-labs/utils');
12
- require('../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
13
- require('../../../components/Alert/Alert.cjs');
14
- require('../../../events/dynamicEvents.cjs');
15
- require('../../../context/DynamicContext/DynamicContext.cjs');
16
- require('@dynamic-labs/sdk-api-core');
17
- require('../../../shared/logger.cjs');
18
- require('@dynamic-labs/iconic');
19
- var check = require('../../../shared/assets/check.cjs');
20
- var close = require('../../../shared/assets/close.cjs');
21
- var copy = require('../../../shared/assets/copy.cjs');
22
- var passwordHero = require('../../../shared/assets/password-hero.cjs');
23
- require('../../../context/ViewContext/ViewContext.cjs');
24
- require('@dynamic-labs/wallet-book');
25
- require('../../../utils/constants/colors.cjs');
26
- require('../../../utils/constants/values.cjs');
27
- var validatePassword = require('../../../shared/utils/functions/validatePassword/validatePassword.cjs');
28
- require('../../../shared/consts/index.cjs');
29
- var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
30
- require('../../../context/CaptchaContext/CaptchaContext.cjs');
31
- require('../../../context/ErrorContext/ErrorContext.cjs');
32
- require('@dynamic-labs/multi-wallet');
33
- require('react-international-phone');
34
- require('../../../store/state/nonce/nonce.cjs');
35
- require('../../../store/state/projectSettings/projectSettings.cjs');
36
- require('../../../config/ApiEndpoint.cjs');
37
- require('../../../store/state/user/user.cjs');
38
- require('../../../locale/locale.cjs');
39
- require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
40
- require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
41
- require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
42
- require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
43
- require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
44
- require('../../../context/VerificationContext/VerificationContext.cjs');
45
- require('react-dom');
46
- require('../../../utils/functions/compareChains/compareChains.cjs');
47
- require('../../../context/ThemeContext/ThemeContext.cjs');
48
- require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
49
- require('bs58');
50
- require('@dynamic-labs/types');
51
- require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
52
- require('../../../context/LoadingContext/LoadingContext.cjs');
53
- require('../../../context/WalletContext/WalletContext.cjs');
54
- require('../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
55
- require('yup');
56
- require('../../../context/MockContext/MockContext.cjs');
57
- require('../../CollectUserDataView/useFields.cjs');
58
- require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
59
- require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
60
- require('@dynamic-labs/rpc-providers');
61
- require('../../../store/state/loadingAndLifecycle.cjs');
62
- require('../../../store/state/walletOptions/walletOptions.cjs');
63
- var Typography = require('../../../components/Typography/Typography.cjs');
64
- require('../../../context/FooterAnimationContext/index.cjs');
65
- require('../../../components/ShadowDOM/ShadowDOM.cjs');
66
- require('../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
67
- require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
68
- require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
69
- require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
70
- require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
71
- require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
72
- require('react-focus-lock');
73
- require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
74
- var IconButton = require('../../../components/IconButton/IconButton.cjs');
75
- require('../../../components/MenuList/Dropdown/Dropdown.cjs');
76
- var ErrorContainer = require('../../../components/ErrorContainer/ErrorContainer.cjs');
77
- var TypographyButton = require('../../../components/TypographyButton/TypographyButton.cjs');
78
- require('formik');
79
- require('../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
80
- var ModalHeader = require('../../../components/ModalHeader/ModalHeader.cjs');
81
- require('../../../store/state/sendBalances.cjs');
82
- var Input = require('../../../components/Input/Input.cjs');
83
- require('../../../components/OverlayCard/OverlayCard.cjs');
84
- require('../../TransactionConfirmationView/TransactionConfirmationView.cjs');
85
- require('../../../context/PasskeyContext/PasskeyContext.cjs');
86
- require('../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
87
- require('../../../context/OnrampContext/OnrampContext.cjs');
88
- var CopyButton = require('../../../components/CopyButton/CopyButton.cjs');
89
- require('qrcode');
90
- require('../../../widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.cjs');
91
- require('../../../../index.cjs');
92
- require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
93
- require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
94
- require('../../../context/ConnectWithOtpContext/constants.cjs');
95
- require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
96
- require('@hcaptcha/react-hcaptcha');
97
- var TextButton = require('../../../components/TextButton/TextButton.cjs');
98
- require('../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
99
- require('../../../store/state/tokenBalances.cjs');
100
- require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
101
- require('../../../components/InlineWidget/InlineWidget.cjs');
102
- require('../../../components/IsBrowser/IsBrowser.cjs');
103
- require('../../../components/Popper/Popper/Popper.cjs');
104
- require('../../../components/Popper/PopperContext/PopperContext.cjs');
105
- var ToggleVisibilityButton = require('../../../components/ToggleVisibilityButton/ToggleVisibilityButton.cjs');
106
-
107
- const CreatePasswordStep = ({ password, setPassword, currentPassword, setCurrentPassword, onContinue, isChangingPassword, onClose, onLogout, }) => {
108
- const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
109
- const [currentPasswordInputType, setCurrentPasswordInputType] = React.useState('password');
110
- const [passwordInputType, setPasswordInputType] = React.useState('password');
111
- const intialPasswordStrength = validatePassword.validatePassword(password).strength;
112
- const [passwordStrength, setPasswordStrength] = React.useState(intialPasswordStrength);
113
- const [confirmPassword, setConfirmPassword] = React.useState('');
114
- const [confirmPasswordInputType, setConfirmPasswordInputType] = React.useState('password');
115
- const [isLoading, setIsLoading] = React.useState(false);
116
- const [error, setError] = React.useState('');
117
- const { t } = reactI18next.useTranslation();
118
- const canContinue = Boolean((password === null || password === void 0 ? void 0 : password.length) >= 6 &&
119
- passwordStrength >= 5 &&
120
- confirmPassword === password &&
121
- (!isChangingPassword ||
122
- (currentPassword && currentPassword !== password)));
123
- const closeButton = onClose && (jsxRuntime.jsx(IconButton.IconButton, { onClick: () => onClose(), type: 'button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
124
- const inputSuffix = (inputType, setInputType, includeCopy = true) => (jsxRuntime.jsxs("div", { className: 'create-password__password-input__suffix', children: [includeCopy && (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(CopyButton.CopyButton, { textToCopy: password, copykey: 'dyn_qr_code.copy_button', className: 'create-password__password-input__suffix__icon', children: jsxRuntime.jsx(copy.ReactComponent, { className: 'create-password__password-input__suffix__icon', onClick: (e) => {
125
- e.preventDefault();
126
- } }) }) })), jsxRuntime.jsx(ToggleVisibilityButton.ToggleVisibilityButton, { initialState: inputType === 'password', onClick: (hidden) => setInputType(hidden ? 'password' : 'text'), className: 'create-password__password-input__suffix__icon' })] }));
127
- const handleChangePassword = (e) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
128
- e.preventDefault();
129
- const connector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
130
- if (isChangingPassword && walletConnectorCore.isCoinbaseMpcWalletConnector(connector)) {
131
- setIsLoading(true);
132
- try {
133
- const isValid = yield connector.validatePasscode(currentPassword);
134
- if (!isValid) {
135
- setError(t('dyn_create_password.errors.invalid_current_password'));
136
- return;
137
- }
138
- }
139
- catch (error) {
140
- setError(t('dyn_create_password.errors.error_changing_password'));
141
- return;
142
- }
143
- finally {
144
- setIsLoading(false);
145
- }
146
- }
147
- if (canContinue) {
148
- onContinue();
149
- }
150
- });
151
- const onCreatePasswordInputChange = (e) => {
152
- const newPassword = e.target.value;
153
- const { strength } = validatePassword.validatePassword(newPassword);
154
- setPasswordStrength(strength);
155
- setPassword(newPassword);
156
- if (isChangingPassword) {
157
- if (currentPassword === newPassword) {
158
- setError(t('dyn_create_password.errors.new_password_same_as_old'));
159
- }
160
- else if (newPassword &&
161
- confirmPassword &&
162
- newPassword !== confirmPassword) {
163
- setError(t('dyn_create_password.errors.password_mismatch'));
164
- }
165
- else {
166
- setError('');
167
- }
168
- return;
169
- }
170
- if (!(newPassword === null || newPassword === void 0 ? void 0 : newPassword.length)) {
171
- setError('');
172
- }
173
- };
174
- const onConfirmPasswordInputChange = (e) => {
175
- const newPassword = e.target.value;
176
- if (newPassword !== password) {
177
- setError(t('dyn_create_password.errors.password_mismatch'));
178
- }
179
- else {
180
- setError('');
181
- }
182
- setConfirmPassword(newPassword);
183
- };
184
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: 'dyn_create_password.title', children: isChangingPassword
185
- ? t('dyn_create_password.title.update')
186
- : t('dyn_create_password.title.create') }) }), jsxRuntime.jsx("div", { className: 'create-password', children: jsxRuntime.jsxs("form", { className: 'create-password__body', "data-testid": 'create-password-form', onSubmit: handleChangePassword, children: [jsxRuntime.jsxs("div", { className: 'create-password__body__header', children: [jsxRuntime.jsx(passwordHero.ReactComponent, {}), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', children: t('dyn_create_password.description') })] }), error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), isChangingPassword && (jsxRuntime.jsx(Input.Input, { id: 'current-password', placeholder: t('dyn_create_password.current_password_input.placeholder'), type: currentPasswordInputType, suffix: inputSuffix(currentPasswordInputType, setCurrentPasswordInputType, false), label: t('dyn_create_password.current_password_input.label'), value: currentPassword, onChange: (e) => setCurrentPassword(e.target.value), autoFocus: true, copykey: 'dyn_create_password.current_password_input' })), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Input.Input, { id: 'password', placeholder: isChangingPassword
187
- ? t('dyn_create_password.update_input.placeholder')
188
- : t('dyn_create_password.create_input.placeholder'), type: passwordInputType, suffix: inputSuffix(passwordInputType, setPasswordInputType), label: isChangingPassword
189
- ? t('dyn_create_password.update_input.label')
190
- : t('dyn_create_password.create_input.label'), value: password, onChange: onCreatePasswordInputChange, autoFocus: Boolean(!isChangingPassword), copykey: 'dyn_create_password.create_input' }) }), password.length >= 1 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'create-password__body__card', children: validatePassword.validatePassword(password).securityCriteria.map((criteria) => (jsxRuntime.jsxs("div", { className: `create-password__password-criteria-list ${criteria.value
191
- ? 'create-password__password-criteria-list__success'
192
- : 'create-password__password-criteria-list__error'}`, children: [jsxRuntime.jsx("div", { children: criteria.value ? (jsxRuntime.jsx(check.ReactComponent, { className: 'create-password__password-criteria-icon' })) : (jsxRuntime.jsx(close.ReactComponent, { className: 'create-password__password-criteria-icon' })) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_mini', children: criteria.description })] }, criteria.key))) }), jsxRuntime.jsx(Input.Input, { id: 'confirm-password', placeholder: t('dyn_create_password.confirm_input.placeholder'), type: confirmPasswordInputType, suffix: inputSuffix(confirmPasswordInputType, setConfirmPasswordInputType, false), label: t('dyn_create_password.confirm_input.label'), value: confirmPassword, onChange: onConfirmPasswordInputChange, copykey: 'dyn_create_password.confirm_input' })] })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'large', buttonVariant: 'brand-primary', typographyProps: {
193
- color: 'inherit',
194
- }, disabled: !canContinue, copykey: 'dyn_create_password.continue', type: 'submit', loading: isLoading, children: t('dyn_create_password.continue') }), onLogout && (jsxRuntime.jsx(TextButton.TextButton, { className: 'create-password__log-out', onClick: onLogout, copykey: 'dyn_create_password.logout', children: t('dyn_create_password.logout') }))] }) })] }));
195
- };
196
-
197
- exports.CreatePasswordStep = CreatePasswordStep;
@@ -1,12 +0,0 @@
1
- import { Dispatch, FC, SetStateAction } from 'react';
2
- export type CreatePasswordStepProps = {
3
- password: string;
4
- setPassword: Dispatch<SetStateAction<string>>;
5
- currentPassword: string;
6
- setCurrentPassword: Dispatch<SetStateAction<string>>;
7
- onContinue: () => void;
8
- isChangingPassword?: boolean;
9
- onClose?: () => void;
10
- onLogout?: (e?: React.MouseEvent<HTMLButtonElement>) => void;
11
- };
12
- export declare const CreatePasswordStep: FC<CreatePasswordStepProps>;
@@ -1,193 +0,0 @@
1
- 'use client'
2
- import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { useState } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
- import { isCoinbaseMpcWalletConnector } from '@dynamic-labs/wallet-connector-core';
7
- import '@dynamic-labs/utils';
8
- import '../../../components/Accordion/components/AccordionItem/AccordionItem.js';
9
- import '../../../components/Alert/Alert.js';
10
- import '../../../events/dynamicEvents.js';
11
- import '../../../context/DynamicContext/DynamicContext.js';
12
- import '@dynamic-labs/sdk-api-core';
13
- import '../../../shared/logger.js';
14
- import '@dynamic-labs/iconic';
15
- import { ReactComponent as SvgCheck } from '../../../shared/assets/check.js';
16
- import { ReactComponent as SvgClose } from '../../../shared/assets/close.js';
17
- import { ReactComponent as SvgCopy } from '../../../shared/assets/copy.js';
18
- import { ReactComponent as SvgPasswordHero } from '../../../shared/assets/password-hero.js';
19
- import '../../../context/ViewContext/ViewContext.js';
20
- import '@dynamic-labs/wallet-book';
21
- import '../../../utils/constants/colors.js';
22
- import '../../../utils/constants/values.js';
23
- import { validatePassword } from '../../../shared/utils/functions/validatePassword/validatePassword.js';
24
- import '../../../shared/consts/index.js';
25
- import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
26
- import '../../../context/CaptchaContext/CaptchaContext.js';
27
- import '../../../context/ErrorContext/ErrorContext.js';
28
- import '@dynamic-labs/multi-wallet';
29
- import 'react-international-phone';
30
- import '../../../store/state/nonce/nonce.js';
31
- import '../../../store/state/projectSettings/projectSettings.js';
32
- import '../../../config/ApiEndpoint.js';
33
- import '../../../store/state/user/user.js';
34
- import '../../../locale/locale.js';
35
- import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
36
- import '../../../store/state/primaryWalletId/primaryWalletId.js';
37
- import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
38
- import '../../../context/AccountExistsContext/AccountExistsContext.js';
39
- import '../../../context/UserWalletsContext/UserWalletsContext.js';
40
- import '../../../context/VerificationContext/VerificationContext.js';
41
- import 'react-dom';
42
- import '../../../utils/functions/compareChains/compareChains.js';
43
- import '../../../context/ThemeContext/ThemeContext.js';
44
- import '../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
45
- import 'bs58';
46
- import '@dynamic-labs/types';
47
- import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
48
- import '../../../context/LoadingContext/LoadingContext.js';
49
- import '../../../context/WalletContext/WalletContext.js';
50
- import '../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
51
- import 'yup';
52
- import '../../../context/MockContext/MockContext.js';
53
- import '../../CollectUserDataView/useFields.js';
54
- import '../../../context/FieldsStateContext/FieldsStateContext.js';
55
- import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
56
- import '@dynamic-labs/rpc-providers';
57
- import '../../../store/state/loadingAndLifecycle.js';
58
- import '../../../store/state/walletOptions/walletOptions.js';
59
- import { Typography } from '../../../components/Typography/Typography.js';
60
- import '../../../context/FooterAnimationContext/index.js';
61
- import '../../../components/ShadowDOM/ShadowDOM.js';
62
- import '../../../components/Transition/ZoomTransition/ZoomTransition.js';
63
- import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
64
- import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
65
- import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
66
- import '../../../context/WalletGroupContext/WalletGroupContext.js';
67
- import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
68
- import 'react-focus-lock';
69
- import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
70
- import { IconButton } from '../../../components/IconButton/IconButton.js';
71
- import '../../../components/MenuList/Dropdown/Dropdown.js';
72
- import { ErrorContainer } from '../../../components/ErrorContainer/ErrorContainer.js';
73
- import { TypographyButton } from '../../../components/TypographyButton/TypographyButton.js';
74
- import 'formik';
75
- import '../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
76
- import { ModalHeader } from '../../../components/ModalHeader/ModalHeader.js';
77
- import '../../../store/state/sendBalances.js';
78
- import { Input } from '../../../components/Input/Input.js';
79
- import '../../../components/OverlayCard/OverlayCard.js';
80
- import '../../TransactionConfirmationView/TransactionConfirmationView.js';
81
- import '../../../context/PasskeyContext/PasskeyContext.js';
82
- import '../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
83
- import '../../../context/OnrampContext/OnrampContext.js';
84
- import { CopyButton } from '../../../components/CopyButton/CopyButton.js';
85
- import 'qrcode';
86
- import '../../../widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.js';
87
- import '../../../../index.js';
88
- import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
89
- import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
90
- import '../../../context/ConnectWithOtpContext/constants.js';
91
- import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
92
- import '@hcaptcha/react-hcaptcha';
93
- import { TextButton } from '../../../components/TextButton/TextButton.js';
94
- import '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
95
- import '../../../store/state/tokenBalances.js';
96
- import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
97
- import '../../../components/InlineWidget/InlineWidget.js';
98
- import '../../../components/IsBrowser/IsBrowser.js';
99
- import '../../../components/Popper/Popper/Popper.js';
100
- import '../../../components/Popper/PopperContext/PopperContext.js';
101
- import { ToggleVisibilityButton } from '../../../components/ToggleVisibilityButton/ToggleVisibilityButton.js';
102
-
103
- const CreatePasswordStep = ({ password, setPassword, currentPassword, setCurrentPassword, onContinue, isChangingPassword, onClose, onLogout, }) => {
104
- const { primaryWallet } = useInternalDynamicContext();
105
- const [currentPasswordInputType, setCurrentPasswordInputType] = useState('password');
106
- const [passwordInputType, setPasswordInputType] = useState('password');
107
- const intialPasswordStrength = validatePassword(password).strength;
108
- const [passwordStrength, setPasswordStrength] = useState(intialPasswordStrength);
109
- const [confirmPassword, setConfirmPassword] = useState('');
110
- const [confirmPasswordInputType, setConfirmPasswordInputType] = useState('password');
111
- const [isLoading, setIsLoading] = useState(false);
112
- const [error, setError] = useState('');
113
- const { t } = useTranslation();
114
- const canContinue = Boolean((password === null || password === void 0 ? void 0 : password.length) >= 6 &&
115
- passwordStrength >= 5 &&
116
- confirmPassword === password &&
117
- (!isChangingPassword ||
118
- (currentPassword && currentPassword !== password)));
119
- const closeButton = onClose && (jsx(IconButton, { onClick: () => onClose(), type: 'button', children: jsx(SvgClose, {}) }));
120
- const inputSuffix = (inputType, setInputType, includeCopy = true) => (jsxs("div", { className: 'create-password__password-input__suffix', children: [includeCopy && (jsx("div", { children: jsx(CopyButton, { textToCopy: password, copykey: 'dyn_qr_code.copy_button', className: 'create-password__password-input__suffix__icon', children: jsx(SvgCopy, { className: 'create-password__password-input__suffix__icon', onClick: (e) => {
121
- e.preventDefault();
122
- } }) }) })), jsx(ToggleVisibilityButton, { initialState: inputType === 'password', onClick: (hidden) => setInputType(hidden ? 'password' : 'text'), className: 'create-password__password-input__suffix__icon' })] }));
123
- const handleChangePassword = (e) => __awaiter(void 0, void 0, void 0, function* () {
124
- e.preventDefault();
125
- const connector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
126
- if (isChangingPassword && isCoinbaseMpcWalletConnector(connector)) {
127
- setIsLoading(true);
128
- try {
129
- const isValid = yield connector.validatePasscode(currentPassword);
130
- if (!isValid) {
131
- setError(t('dyn_create_password.errors.invalid_current_password'));
132
- return;
133
- }
134
- }
135
- catch (error) {
136
- setError(t('dyn_create_password.errors.error_changing_password'));
137
- return;
138
- }
139
- finally {
140
- setIsLoading(false);
141
- }
142
- }
143
- if (canContinue) {
144
- onContinue();
145
- }
146
- });
147
- const onCreatePasswordInputChange = (e) => {
148
- const newPassword = e.target.value;
149
- const { strength } = validatePassword(newPassword);
150
- setPasswordStrength(strength);
151
- setPassword(newPassword);
152
- if (isChangingPassword) {
153
- if (currentPassword === newPassword) {
154
- setError(t('dyn_create_password.errors.new_password_same_as_old'));
155
- }
156
- else if (newPassword &&
157
- confirmPassword &&
158
- newPassword !== confirmPassword) {
159
- setError(t('dyn_create_password.errors.password_mismatch'));
160
- }
161
- else {
162
- setError('');
163
- }
164
- return;
165
- }
166
- if (!(newPassword === null || newPassword === void 0 ? void 0 : newPassword.length)) {
167
- setError('');
168
- }
169
- };
170
- const onConfirmPasswordInputChange = (e) => {
171
- const newPassword = e.target.value;
172
- if (newPassword !== password) {
173
- setError(t('dyn_create_password.errors.password_mismatch'));
174
- }
175
- else {
176
- setError('');
177
- }
178
- setConfirmPassword(newPassword);
179
- };
180
- return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: 'dyn_create_password.title', children: isChangingPassword
181
- ? t('dyn_create_password.title.update')
182
- : t('dyn_create_password.title.create') }) }), jsx("div", { className: 'create-password', children: jsxs("form", { className: 'create-password__body', "data-testid": 'create-password-form', onSubmit: handleChangePassword, children: [jsxs("div", { className: 'create-password__body__header', children: [jsx(SvgPasswordHero, {}), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', children: t('dyn_create_password.description') })] }), error && jsx(ErrorContainer, { children: error }), isChangingPassword && (jsx(Input, { id: 'current-password', placeholder: t('dyn_create_password.current_password_input.placeholder'), type: currentPasswordInputType, suffix: inputSuffix(currentPasswordInputType, setCurrentPasswordInputType, false), label: t('dyn_create_password.current_password_input.label'), value: currentPassword, onChange: (e) => setCurrentPassword(e.target.value), autoFocus: true, copykey: 'dyn_create_password.current_password_input' })), jsx("div", { children: jsx(Input, { id: 'password', placeholder: isChangingPassword
183
- ? t('dyn_create_password.update_input.placeholder')
184
- : t('dyn_create_password.create_input.placeholder'), type: passwordInputType, suffix: inputSuffix(passwordInputType, setPasswordInputType), label: isChangingPassword
185
- ? t('dyn_create_password.update_input.label')
186
- : t('dyn_create_password.create_input.label'), value: password, onChange: onCreatePasswordInputChange, autoFocus: Boolean(!isChangingPassword), copykey: 'dyn_create_password.create_input' }) }), password.length >= 1 && (jsxs(Fragment, { children: [jsx("div", { className: 'create-password__body__card', children: validatePassword(password).securityCriteria.map((criteria) => (jsxs("div", { className: `create-password__password-criteria-list ${criteria.value
187
- ? 'create-password__password-criteria-list__success'
188
- : 'create-password__password-criteria-list__error'}`, children: [jsx("div", { children: criteria.value ? (jsx(SvgCheck, { className: 'create-password__password-criteria-icon' })) : (jsx(SvgClose, { className: 'create-password__password-criteria-icon' })) }), jsx(Typography, { variant: 'body_mini', children: criteria.description })] }, criteria.key))) }), jsx(Input, { id: 'confirm-password', placeholder: t('dyn_create_password.confirm_input.placeholder'), type: confirmPasswordInputType, suffix: inputSuffix(confirmPasswordInputType, setConfirmPasswordInputType, false), label: t('dyn_create_password.confirm_input.label'), value: confirmPassword, onChange: onConfirmPasswordInputChange, copykey: 'dyn_create_password.confirm_input' })] })), jsx(TypographyButton, { buttonPadding: 'large', buttonVariant: 'brand-primary', typographyProps: {
189
- color: 'inherit',
190
- }, disabled: !canContinue, copykey: 'dyn_create_password.continue', type: 'submit', loading: isLoading, children: t('dyn_create_password.continue') }), onLogout && (jsx(TextButton, { className: 'create-password__log-out', onClick: onLogout, copykey: 'dyn_create_password.logout', children: t('dyn_create_password.logout') }))] }) })] }));
191
- };
192
-
193
- export { CreatePasswordStep };
@@ -1 +0,0 @@
1
- export { CreatePasswordStep } from './CreatePasswordStep';
@@ -1,169 +0,0 @@
1
- 'use client'
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var _tslib = require('../../../../_virtual/_tslib.cjs');
7
- var jsxRuntime = require('react/jsx-runtime');
8
- var React = require('react');
9
- var reactI18next = require('react-i18next');
10
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
11
- require('../../context/DynamicContext/DynamicContext.cjs');
12
- require('@dynamic-labs/sdk-api-core');
13
- var logger = require('../../shared/logger.cjs');
14
- require('@dynamic-labs/iconic');
15
- require('../../context/ViewContext/ViewContext.cjs');
16
- require('@dynamic-labs/wallet-book');
17
- require('@dynamic-labs/utils');
18
- require('../../utils/constants/colors.cjs');
19
- require('../../utils/constants/values.cjs');
20
- require('../../shared/consts/index.cjs');
21
- var dynamicEvents = require('../../events/dynamicEvents.cjs');
22
- require('../../context/CaptchaContext/CaptchaContext.cjs');
23
- require('../../context/ErrorContext/ErrorContext.cjs');
24
- require('@dynamic-labs/multi-wallet');
25
- require('react-international-phone');
26
- require('../../store/state/nonce/nonce.cjs');
27
- require('../../store/state/projectSettings/projectSettings.cjs');
28
- var findCoinbaseMPCWallet = require('../../utils/functions/findCoinbaseMPCWallet/findCoinbaseMPCWallet.cjs');
29
- var requiresPasswordForEmbeddedWallet = require('../../utils/functions/requiresPasswordForEmbeddedWallet/requiresPasswordForEmbeddedWallet.cjs');
30
- require('../../config/ApiEndpoint.cjs');
31
- require('../../store/state/user/user.cjs');
32
- require('../../locale/locale.cjs');
33
- require('../../store/state/dynamicContextProps/dynamicContextProps.cjs');
34
- require('../../store/state/primaryWalletId/primaryWalletId.cjs');
35
- require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
36
- require('../../context/AccountExistsContext/AccountExistsContext.cjs');
37
- require('../../context/UserWalletsContext/UserWalletsContext.cjs');
38
- require('../../context/VerificationContext/VerificationContext.cjs');
39
- require('react-dom');
40
- require('../../utils/functions/compareChains/compareChains.cjs');
41
- require('../../context/ThemeContext/ThemeContext.cjs');
42
- require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
43
- require('bs58');
44
- require('@dynamic-labs/types');
45
- require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
46
- require('../../context/LoadingContext/LoadingContext.cjs');
47
- require('../../context/WalletContext/WalletContext.cjs');
48
- require('../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
49
- var useEmbeddedWalletPassword = require('../../utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs');
50
- require('yup');
51
- require('../../context/MockContext/MockContext.cjs');
52
- require('../CollectUserDataView/useFields.cjs');
53
- require('../../context/FieldsStateContext/FieldsStateContext.cjs');
54
- require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
55
- require('@dynamic-labs/rpc-providers');
56
- require('../../store/state/loadingAndLifecycle.cjs');
57
- require('../../store/state/walletOptions/walletOptions.cjs');
58
- require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
59
- require('../../components/Alert/Alert.cjs');
60
- require('../../components/ShadowDOM/ShadowDOM.cjs');
61
- require('../../components/IconButton/IconButton.cjs');
62
- require('../../components/InlineWidget/InlineWidget.cjs');
63
- require('../../components/Input/Input.cjs');
64
- require('../../components/IsBrowser/IsBrowser.cjs');
65
- require('../../components/MenuList/Dropdown/Dropdown.cjs');
66
- require('../../components/OverlayCard/OverlayCard.cjs');
67
- require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
68
- require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
69
- require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
70
- require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
71
- require('../../components/Popper/Popper/Popper.cjs');
72
- require('../../components/Popper/PopperContext/PopperContext.cjs');
73
- require('react-focus-lock');
74
- require('qrcode');
75
- require('formik');
76
- require('../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
77
- require('../../context/WalletGroupContext/WalletGroupContext.cjs');
78
- require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
79
- require('../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
80
- require('../../context/ConnectWithOtpContext/constants.cjs');
81
- require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
82
- require('@hcaptcha/react-hcaptcha');
83
- var CreatePasswordStep = require('./CreatePasswordStep/CreatePasswordStep.cjs');
84
- var SavePasswordStep = require('./SavePasswordStep/SavePasswordStep.cjs');
85
- require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
86
- require('../../context/FooterAnimationContext/index.cjs');
87
- require('../../context/PasskeyContext/PasskeyContext.cjs');
88
- require('../../store/state/sendBalances.cjs');
89
- require('../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
90
- require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
91
- require('../TransactionConfirmationView/TransactionConfirmationView.cjs');
92
- require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
93
- require('../../context/OnrampContext/OnrampContext.cjs');
94
- require('../../widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.cjs');
95
- require('../../../index.cjs');
96
- require('../../store/state/tokenBalances.cjs');
97
- require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
98
- var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
99
-
100
- const CreatePasswordView = ({ onSuccess, onError, closeView, notCalledFromWalletUtils, isSignUp, }) => {
101
- var _a;
102
- const { setShowAuthFlow, user, projectSettings, primaryWallet, handleLogOut: onLogout, walletConnectorOptions, } = useInternalDynamicContext.useInternalDynamicContext();
103
- const { t } = reactI18next.useTranslation();
104
- const { claimWallet } = useEmbeddedWalletPassword.useEmbeddedWalletPassword();
105
- const [curStep, setCurStep] = React.useState('create-password');
106
- const cbVcWalletProperties = (_a = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((vc) => vc.walletName === 'coinbasempc')) === null || _a === void 0 ? void 0 : _a.walletProperties;
107
- const isChangingPassword = Boolean(cbVcWalletProperties === null || cbVcWalletProperties === void 0 ? void 0 : cbVcWalletProperties.claimed);
108
- const closeViewOnCreate = closeView !== null && closeView !== void 0 ? closeView : true;
109
- const [currentPassword, setCurrentPassword] = React.useState('');
110
- const [password, setPassword] = React.useState('');
111
- const [isLoading, setIsLoading] = React.useState(false);
112
- const [error, setError] = React.useState('');
113
- const requiresPassword = requiresPasswordForEmbeddedWallet.requiresPasswordForEmbeddedWallet(projectSettings);
114
- const canClose = isChangingPassword || !requiresPassword;
115
- const handleCreatePassword = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
116
- setCurStep('save-password');
117
- });
118
- const handleSavePassword = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
119
- var _b, _c, _d;
120
- setIsLoading(true);
121
- try {
122
- if (!isSignUp) {
123
- const connector = (_d = (_b = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _b !== void 0 ? _b : (_c = findCoinbaseMPCWallet.findCoinbaseMPCWallet(walletConnectorOptions)) === null || _c === void 0 ? void 0 : _c.walletConnector) !== null && _d !== void 0 ? _d : undefined;
124
- // notCalledFromWalletUtils = true means the user triggered password flow, not the connector
125
- if (notCalledFromWalletUtils &&
126
- walletConnectorCore.isCoinbaseMpcWalletConnector(connector)) {
127
- yield connector.changePasscode(password, currentPassword);
128
- }
129
- if (!isChangingPassword) {
130
- // if creating password for the first time, set wallet as claimed
131
- yield claimWallet();
132
- }
133
- }
134
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(password);
135
- if (closeViewOnCreate) {
136
- setShowAuthFlow(false, { ignoreIfIsEmbeddedWidget: false });
137
- }
138
- dynamicEvents.dynamicEvents.emit('embeddedWalletCreatePasswordCompleted', password);
139
- }
140
- catch (e) {
141
- logger.logger.debug(`Error ${isChangingPassword ? 'updating' : 'creating'} password`, e);
142
- dynamicEvents.dynamicEvents.emit('embeddedWalletCreatePasswordFailed', e);
143
- if (e instanceof Error) {
144
- setError(e.message);
145
- }
146
- onError === null || onError === void 0 ? void 0 : onError(e);
147
- }
148
- finally {
149
- setIsLoading(false);
150
- }
151
- });
152
- const handleClose = () => {
153
- if (requiresPassword) {
154
- const error = new Error(t('dyn_create_password.errors.user_closed_view'));
155
- onError === null || onError === void 0 ? void 0 : onError(error, true);
156
- dynamicEvents.dynamicEvents.emit('embeddedWalletCreatePasswordFailed', error);
157
- }
158
- setShowAuthFlow(false);
159
- };
160
- const handleLogout = (e) => {
161
- e === null || e === void 0 ? void 0 : e.preventDefault();
162
- const error = new Error(t('dyn_create_password.errors.user_closed_view'));
163
- onError === null || onError === void 0 ? void 0 : onError(error, true);
164
- onLogout();
165
- };
166
- return curStep === 'save-password' ? (jsxRuntime.jsx(SavePasswordStep.SavePasswordStep, { password: password, onBack: () => setCurStep('create-password'), error: error, isLoading: isLoading, onSave: () => handleSavePassword(), onClose: canClose ? () => handleClose() : undefined, onLogout: !canClose ? handleLogout : undefined })) : (jsxRuntime.jsx(CreatePasswordStep.CreatePasswordStep, { password: password, setPassword: setPassword, currentPassword: currentPassword, setCurrentPassword: setCurrentPassword, onContinue: () => handleCreatePassword(), isChangingPassword: isChangingPassword, onClose: canClose ? () => handleClose() : undefined, onLogout: !canClose ? handleLogout : undefined }));
167
- };
168
-
169
- exports.CreatePasswordView = CreatePasswordView;
@@ -1,9 +0,0 @@
1
- import { FC } from 'react';
2
- export type CreatePasswordViewProps = {
3
- onSuccess?: (password: string) => void;
4
- onError?: (error: unknown, closePortal?: boolean) => void;
5
- closeView?: boolean;
6
- notCalledFromWalletUtils?: boolean;
7
- isSignUp?: boolean;
8
- };
9
- export declare const CreatePasswordView: FC<CreatePasswordViewProps>;