@dynamic-labs/sdk-react-core 2.0.0-alpha.6 → 2.0.0-alpha.8

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 (166) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.cjs +4 -4
  3. package/package.js +4 -4
  4. package/package.json +16 -16
  5. package/src/index.cjs +3 -7
  6. package/src/index.d.ts +1 -2
  7. package/src/index.js +2 -2
  8. package/src/lib/components/Alert/Alert.cjs +1 -0
  9. package/src/lib/components/Alert/Alert.js +1 -0
  10. package/src/lib/components/Alert/Alert.types.d.ts +1 -1
  11. package/src/lib/components/ErrorContainer/ErrorContainer.cjs +1 -1
  12. package/src/lib/components/ErrorContainer/ErrorContainer.js +1 -1
  13. package/src/lib/components/NetworkPicker/NetworkPicker.cjs +4 -2
  14. package/src/lib/components/NetworkPicker/NetworkPicker.js +4 -2
  15. package/src/lib/components/ShadowDOM/ShadowDOM.cjs +2 -0
  16. package/src/lib/components/ShadowDOM/ShadowDOM.js +2 -1
  17. package/src/lib/components/SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.cjs +26 -10
  18. package/src/lib/components/SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.js +27 -11
  19. package/src/lib/components/index.d.ts +1 -0
  20. package/src/lib/context/DynamicContext/DynamicContext.cjs +16 -17
  21. package/src/lib/context/DynamicContext/DynamicContext.d.ts +3 -4
  22. package/src/lib/context/DynamicContext/DynamicContext.js +17 -18
  23. package/src/lib/context/DynamicContext/helpers/helpers.cjs +10 -0
  24. package/src/lib/context/DynamicContext/helpers/helpers.d.ts +5 -0
  25. package/src/lib/context/DynamicContext/helpers/helpers.js +10 -1
  26. package/src/lib/context/DynamicContext/hooks/useHandleLogout/types.d.ts +0 -1
  27. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +1 -1
  28. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +1 -1
  29. package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.cjs +1 -0
  30. package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.d.ts +8 -7
  31. package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.js +1 -0
  32. package/src/lib/context/DynamicContext/types/index.d.ts +14 -2
  33. package/src/lib/context/ErrorContext/ErrorContext.cjs +4 -0
  34. package/src/lib/context/ErrorContext/ErrorContext.d.ts +1 -0
  35. package/src/lib/context/ErrorContext/ErrorContext.js +4 -0
  36. package/src/lib/context/FundingContext/FundingContext.cjs +3 -1
  37. package/src/lib/context/FundingContext/FundingContext.js +3 -1
  38. package/src/lib/context/PasskeyContext/PasskeyContext.cjs +1 -0
  39. package/src/lib/context/PasskeyContext/PasskeyContext.js +1 -0
  40. package/src/lib/context/ViewContext/ViewContext.cjs +7 -0
  41. package/src/lib/context/ViewContext/ViewContext.js +7 -0
  42. package/src/lib/context/ViewContext/types/index.d.ts +5 -3
  43. package/src/lib/locale/en/translation.cjs +30 -16
  44. package/src/lib/locale/en/translation.d.ts +22 -8
  45. package/src/lib/locale/en/translation.js +30 -16
  46. package/src/lib/shared/types/localStorage.d.ts +1 -1
  47. package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +10 -28
  48. package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.d.ts +1 -5
  49. package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.js +10 -28
  50. package/src/lib/styles/index.shadow.cjs +1 -1
  51. package/src/lib/styles/index.shadow.js +1 -1
  52. package/src/lib/utils/functions/index.d.ts +1 -0
  53. package/src/lib/utils/functions/mergeNetworks/index.d.ts +1 -0
  54. package/src/lib/utils/functions/mergeNetworks/mergeNetworks.cjs +26 -0
  55. package/src/lib/utils/functions/mergeNetworks/mergeNetworks.d.ts +13 -0
  56. package/src/lib/utils/functions/mergeNetworks/mergeNetworks.js +22 -0
  57. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +4 -2
  58. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +4 -2
  59. package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs +1 -0
  60. package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js +1 -0
  61. package/src/lib/utils/hooks/index.d.ts +1 -0
  62. package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.cjs +3 -13
  63. package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.d.ts +1 -2
  64. package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js +3 -13
  65. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +1 -1
  66. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +1 -1
  67. package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +1 -0
  68. package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +1 -0
  69. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +33 -8
  70. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +33 -8
  71. package/src/lib/utils/hooks/useEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +1 -0
  72. package/src/lib/utils/hooks/useEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +1 -0
  73. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +27 -5
  74. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +27 -5
  75. package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +7 -6
  76. package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.d.ts +1 -1
  77. package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +7 -6
  78. package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +2 -6
  79. package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +2 -6
  80. package/src/lib/utils/hooks/useProcessNetworkConfigurations/useProcessNetworkConfigurations.cjs +20 -54
  81. package/src/lib/utils/hooks/useProcessNetworkConfigurations/useProcessNetworkConfigurations.d.ts +5 -3
  82. package/src/lib/utils/hooks/useProcessNetworkConfigurations/useProcessNetworkConfigurations.js +20 -54
  83. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/index.d.ts +1 -0
  84. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +38 -0
  85. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.d.ts +2 -0
  86. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +34 -0
  87. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -0
  88. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -0
  89. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +8 -11
  90. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +8 -11
  91. package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs +1 -0
  92. package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js +1 -0
  93. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -0
  94. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -0
  95. package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +4 -7
  96. package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +4 -7
  97. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +1 -1
  98. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +1 -1
  99. package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +1 -1
  100. package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +1 -1
  101. package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.cjs +1 -1
  102. package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.js +1 -1
  103. package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +3 -8
  104. package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +3 -8
  105. package/src/lib/views/{CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs → CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.cjs} +5 -4
  106. package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.d.ts +13 -0
  107. package/src/lib/views/{CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js → CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.js} +5 -4
  108. package/src/lib/views/CollectUserDataViewNoWallet/index.d.ts +1 -0
  109. package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.cjs +17 -2
  110. package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.js +17 -2
  111. package/src/lib/views/CreatePasswordView/CreatePasswordView.cjs +12 -13
  112. package/src/lib/views/CreatePasswordView/CreatePasswordView.d.ts +2 -0
  113. package/src/lib/views/CreatePasswordView/CreatePasswordView.js +12 -13
  114. package/src/lib/views/EmailUpdate/EmailUpdate.cjs +1 -0
  115. package/src/lib/views/EmailUpdate/EmailUpdate.js +1 -0
  116. package/src/lib/views/EmailVerification/EmailVerification.cjs +10 -17
  117. package/src/lib/views/EmailVerification/EmailVerification.js +10 -17
  118. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +40 -13
  119. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.d.ts +2 -3
  120. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +40 -13
  121. package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.d.ts +1 -1
  122. package/src/lib/views/EnterPasswordView/EnterPasswordView.cjs +8 -1
  123. package/src/lib/views/EnterPasswordView/EnterPasswordView.js +8 -1
  124. package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.cjs +1 -0
  125. package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.js +1 -0
  126. package/src/lib/views/LoginView/useLoginView/useLoginView.cjs +11 -5
  127. package/src/lib/views/LoginView/useLoginView/useLoginView.js +11 -5
  128. package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +1 -0
  129. package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +1 -0
  130. package/src/lib/views/Passkey/EmbeddedAuthChoice/EmbeddedAuthChoice.d.ts +2 -3
  131. package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.d.ts +2 -3
  132. package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.d.ts +2 -3
  133. package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.cjs +1 -0
  134. package/src/lib/views/Passkey/RenamePasskeyView/RenamePasskeyView.js +1 -0
  135. package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.cjs +31 -7
  136. package/src/lib/views/SmsVerification/useSmsVerification/useSmsVerification.js +31 -7
  137. package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -0
  138. package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -0
  139. package/src/lib/views/viewToComponentMap.cjs +4 -4
  140. package/src/lib/views/viewToComponentMap.d.ts +60 -2
  141. package/src/lib/views/viewToComponentMap.js +4 -4
  142. package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs +1 -1
  143. package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js +1 -1
  144. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +6 -4
  145. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +6 -4
  146. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +5 -2
  147. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +5 -2
  148. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.cjs +2 -14
  149. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js +2 -14
  150. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +3 -1
  151. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +4 -2
  152. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +2 -14
  153. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +2 -14
  154. package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.cjs +18 -9
  155. package/src/lib/widgets/DynamicWidget/views/WalletSettingsView/WalletSettingsView.js +18 -9
  156. package/src/lib/utils/functions/isSameWalletName/index.d.ts +0 -1
  157. package/src/lib/utils/functions/isSameWalletName/isSameWalletName.cjs +0 -9
  158. package/src/lib/utils/functions/isSameWalletName/isSameWalletName.d.ts +0 -1
  159. package/src/lib/utils/functions/isSameWalletName/isSameWalletName.js +0 -5
  160. package/src/lib/utils/hooks/useProcessNetworkConfigurations/utils/index.d.ts +0 -1
  161. package/src/lib/utils/hooks/useProcessNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/index.d.ts +0 -1
  162. package/src/lib/utils/hooks/useProcessNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.cjs +0 -16
  163. package/src/lib/utils/hooks/useProcessNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.d.ts +0 -2
  164. package/src/lib/utils/hooks/useProcessNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.js +0 -12
  165. package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.d.ts +0 -2
  166. package/src/lib/views/CollectUserDataViewLoginWithEmail/index.d.ts +0 -1
@@ -65,6 +65,7 @@ import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/Secondary
65
65
  import 'i18next';
66
66
  import '@hcaptcha/react-hcaptcha';
67
67
  import '../LoadingContext/LoadingContext.js';
68
+ import '../../config/ApiEndpoint.js';
68
69
  import '../FooterAnimationContext/index.js';
69
70
  import '../../views/LoginView/sections/PhoneNumberSignInSection/usePhoneInputLogic/usePhoneInputLogic.js';
70
71
  import '../WalletGroupContext/WalletGroupContext.js';
@@ -5,15 +5,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
7
  var useDynamicEvents = require('../../utils/hooks/events/useDynamicEvents/useDynamicEvents.cjs');
8
+ var ErrorContext = require('../ErrorContext/ErrorContext.cjs');
8
9
 
9
10
  const ViewContext = React.createContext(undefined);
10
11
  const ViewContextProvider = ({ children, initialView = { props: { isWalletConnectList: true }, type: 'wallet-list' }, }) => {
11
12
  const [_view, _setView] = React.useState(null);
12
13
  const view = _view || initialView;
14
+ const { clearError } = ErrorContext.useErrorContext();
13
15
  const goToInitialView = React.useCallback(() => {
14
16
  _setView(null);
15
17
  }, []);
16
18
  const setView = React.useCallback((type, props) => {
19
+ // we need to clear errors before proceeding to the next view
20
+ // but only if the next view is different from the current view
21
+ // this is to prevent the error from being cleared when the same view is re-rendered
22
+ if (view.type !== type)
23
+ clearError();
17
24
  _setView({ props, type });
18
25
  }, []);
19
26
  useDynamicEvents.useInternalDynamicEvents('logout', () => goToInitialView());
@@ -1,15 +1,22 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { createContext, useContext, useState, useCallback, useMemo } from 'react';
3
3
  import { useInternalDynamicEvents } from '../../utils/hooks/events/useDynamicEvents/useDynamicEvents.js';
4
+ import { useErrorContext } from '../ErrorContext/ErrorContext.js';
4
5
 
5
6
  const ViewContext = createContext(undefined);
6
7
  const ViewContextProvider = ({ children, initialView = { props: { isWalletConnectList: true }, type: 'wallet-list' }, }) => {
7
8
  const [_view, _setView] = useState(null);
8
9
  const view = _view || initialView;
10
+ const { clearError } = useErrorContext();
9
11
  const goToInitialView = useCallback(() => {
10
12
  _setView(null);
11
13
  }, []);
12
14
  const setView = useCallback((type, props) => {
15
+ // we need to clear errors before proceeding to the next view
16
+ // but only if the next view is different from the current view
17
+ // this is to prevent the error from being cleared when the same view is re-rendered
18
+ if (view.type !== type)
19
+ clearError();
13
20
  _setView({ props, type });
14
21
  }, []);
15
22
  useInternalDynamicEvents('logout', () => goToInitialView());
@@ -1,7 +1,9 @@
1
1
  import { FC } from 'react';
2
- export type ViewType = 'select-hardware-wallet' | '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-wallet-only' | 'login-with-email-verification' | 'login-with-sms-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' | 'multi-wallet-wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'embedded-reveal-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'create-password-view' | 'wallet-claim-intro';
3
- export type ViewMap = Record<ViewType, FC<any>>;
4
- type ComponentProps<T extends FC<any>> = T extends FC<infer P> ? P : undefined;
2
+ import { viewToComponentMap } from '../../../views/viewToComponentMap';
3
+ export type ViewType = 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-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' | 'multi-wallet-wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'embedded-reveal-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'create-password-view' | 'wallet-claim-intro';
4
+ export type ViewMapConstraint = Record<ViewType, FC<any>>;
5
+ type ComponentProps<T extends FC<any>> = T extends FC<infer P> ? P : never;
6
+ export type ViewMap = typeof viewToComponentMap;
5
7
  export type ViewState<T extends ViewType> = {
6
8
  type: T;
7
9
  props?: ComponentProps<ViewMap[T]>;
@@ -234,6 +234,7 @@ const translation = {
234
234
  errors: {
235
235
  invalid_current_password: 'Invalid current passcode',
236
236
  error_changing_password: 'Error changing passcode',
237
+ new_password_same_as_old: 'New passcode cannot be the same as the old passcode',
237
238
  password_mismatch: 'Passcodes do not match',
238
239
  user_closed_view: 'User closed the view',
239
240
  },
@@ -242,9 +243,9 @@ const translation = {
242
243
  description: {
243
244
  title: 'Add a passcode to protect your account',
244
245
  additional_protection: {
245
- title: 'Additional Protection',
246
+ title: 'Passcode Security',
246
247
  description:
247
- 'Add a secure passcode to prevent un-authorized access to your account',
248
+ 'Add a secure passcode to further prevent un-authrized access to your account.',
248
249
  },
249
250
  restore_access: {
250
251
  title: 'Restore Access',
@@ -252,11 +253,11 @@ const translation = {
252
253
  'You will be asked to enter it when signing on to a new device.',
253
254
  },
254
255
  },
255
- title: 'Secure your account',
256
+ title: 'Add a Passcode',
256
257
  },
257
258
  logout: 'Log out',
258
259
  title: {
259
- create: 'Create backup passcode',
260
+ create: 'Create passcode',
260
261
  update: 'Create new passcode',
261
262
  },
262
263
  update_input: {
@@ -283,6 +284,7 @@ const translation = {
283
284
  errors: {
284
285
  invalid_current_password: 'Invalid current passcode',
285
286
  error_changing_password: 'Error changing passcode',
287
+ new_password_same_as_old: 'New passcode cannot be the same as the old passcode',
286
288
  password_mismatch: 'Passcodes do not match',
287
289
  user_closed_view: 'User closed the view',
288
290
  },
@@ -291,19 +293,19 @@ const translation = {
291
293
  description: {
292
294
  title: 'Add a passcode to protect your account',
293
295
  additional_protection: {
294
- title: 'Additional Protection',
295
- description: 'Add a secure passcode to prevent un-authorized access to your account',
296
+ title: 'Passcode Security',
297
+ description: 'Add a secure passcode to further prevent un-authrized access to your account.',
296
298
  },
297
299
  restore_access: {
298
300
  title: 'Restore Access',
299
301
  description: 'You will be asked to enter it when signing on to a new device.',
300
302
  },
301
303
  },
302
- title: 'Secure your account',
304
+ title: 'Add a Passcode',
303
305
  },
304
306
  logout: 'Log out',
305
307
  title: {
306
- create: 'Create backup passcode',
308
+ create: 'Create passcode',
307
309
  update: 'Create new passcode',
308
310
  },
309
311
  update_input: {
@@ -311,6 +313,16 @@ const translation = {
311
313
  placeholder: 'New passcode',
312
314
  },
313
315
  },
316
+ /**
317
+ * @description copy keys for creating wallet wallet message
318
+ * @default
319
+ * {
320
+ loading_message: 'Your wallet is being created...',
321
+ }
322
+ */
323
+ dyn_creating_wallet: {
324
+ loading_message: 'Your wallet is being created...',
325
+ },
314
326
  /**
315
327
  * @description copy keys for email verification view after email logging in with magiclink
316
328
  * @default
@@ -689,7 +701,8 @@ const translation = {
689
701
  signing_section: {
690
702
  email_auth_button: 'One time code',
691
703
  passkey_button: 'Passkeys',
692
- title: 'Security & Signing Methods',
704
+ password_button: 'Passcode',
705
+ title: 'Security Methods',
693
706
  },
694
707
  title: 'Wallet settings',
695
708
  }
@@ -703,7 +716,8 @@ const translation = {
703
716
  signing_section: {
704
717
  email_auth_button: 'One time code',
705
718
  passkey_button: 'Passkeys',
706
- title: 'Security & Signing Methods',
719
+ password_button: 'Passcode',
720
+ title: 'Security Methods',
707
721
  },
708
722
  title: 'Wallet settings',
709
723
  },
@@ -1131,10 +1145,10 @@ const translation = {
1131
1145
  download_button: 'Download',
1132
1146
  logout: 'Log out',
1133
1147
  password_input: {
1134
- label: 'Backup Passcode',
1135
- placeholder: 'Backup Passcode',
1148
+ label: 'Passcode',
1149
+ placeholder: 'Passcode',
1136
1150
  },
1137
- title: 'Save backup passcode',
1151
+ title: 'Save passcode',
1138
1152
  warning:
1139
1153
  'If you lose your passcode, you cannot recover access to your account.',
1140
1154
  }
@@ -1151,10 +1165,10 @@ const translation = {
1151
1165
  download_button: 'Download',
1152
1166
  logout: 'Log out',
1153
1167
  password_input: {
1154
- label: 'Backup Passcode',
1155
- placeholder: 'Backup Passcode',
1168
+ label: 'Passcode',
1169
+ placeholder: 'Passcode',
1156
1170
  },
1157
- title: 'Save backup passcode',
1171
+ title: 'Save passcode',
1158
1172
  warning: 'If you lose your passcode, you cannot recover access to your account.',
1159
1173
  },
1160
1174
  /**
@@ -229,6 +229,7 @@ export declare const translation: {
229
229
  errors: {
230
230
  invalid_current_password: 'Invalid current passcode',
231
231
  error_changing_password: 'Error changing passcode',
232
+ new_password_same_as_old: 'New passcode cannot be the same as the old passcode',
232
233
  password_mismatch: 'Passcodes do not match',
233
234
  user_closed_view: 'User closed the view',
234
235
  },
@@ -237,9 +238,9 @@ export declare const translation: {
237
238
  description: {
238
239
  title: 'Add a passcode to protect your account',
239
240
  additional_protection: {
240
- title: 'Additional Protection',
241
+ title: 'Passcode Security',
241
242
  description:
242
- 'Add a secure passcode to prevent un-authorized access to your account',
243
+ 'Add a secure passcode to further prevent un-authrized access to your account.',
243
244
  },
244
245
  restore_access: {
245
246
  title: 'Restore Access',
@@ -247,11 +248,11 @@ export declare const translation: {
247
248
  'You will be asked to enter it when signing on to a new device.',
248
249
  },
249
250
  },
250
- title: 'Secure your account',
251
+ title: 'Add a Passcode',
251
252
  },
252
253
  logout: 'Log out',
253
254
  title: {
254
- create: 'Create backup passcode',
255
+ create: 'Create passcode',
255
256
  update: 'Create new passcode',
256
257
  },
257
258
  update_input: {
@@ -278,6 +279,7 @@ export declare const translation: {
278
279
  errors: {
279
280
  invalid_current_password: string;
280
281
  error_changing_password: string;
282
+ new_password_same_as_old: string;
281
283
  password_mismatch: string;
282
284
  user_closed_view: string;
283
285
  };
@@ -306,6 +308,16 @@ export declare const translation: {
306
308
  placeholder: string;
307
309
  };
308
310
  };
311
+ /**
312
+ * @description copy keys for creating wallet wallet message
313
+ * @default
314
+ * {
315
+ loading_message: 'Your wallet is being created...',
316
+ }
317
+ */
318
+ dyn_creating_wallet: {
319
+ loading_message: string;
320
+ };
309
321
  /**
310
322
  * @description copy keys for email verification view after email logging in with magiclink
311
323
  * @default
@@ -684,7 +696,8 @@ export declare const translation: {
684
696
  signing_section: {
685
697
  email_auth_button: 'One time code',
686
698
  passkey_button: 'Passkeys',
687
- title: 'Security & Signing Methods',
699
+ password_button: 'Passcode',
700
+ title: 'Security Methods',
688
701
  },
689
702
  title: 'Wallet settings',
690
703
  }
@@ -698,6 +711,7 @@ export declare const translation: {
698
711
  signing_section: {
699
712
  email_auth_button: string;
700
713
  passkey_button: string;
714
+ password_button: string;
701
715
  title: string;
702
716
  };
703
717
  title: string;
@@ -1126,10 +1140,10 @@ export declare const translation: {
1126
1140
  download_button: 'Download',
1127
1141
  logout: 'Log out',
1128
1142
  password_input: {
1129
- label: 'Backup Passcode',
1130
- placeholder: 'Backup Passcode',
1143
+ label: 'Passcode',
1144
+ placeholder: 'Passcode',
1131
1145
  },
1132
- title: 'Save backup passcode',
1146
+ title: 'Save passcode',
1133
1147
  warning:
1134
1148
  'If you lose your passcode, you cannot recover access to your account.',
1135
1149
  }
@@ -230,6 +230,7 @@ const translation = {
230
230
  errors: {
231
231
  invalid_current_password: 'Invalid current passcode',
232
232
  error_changing_password: 'Error changing passcode',
233
+ new_password_same_as_old: 'New passcode cannot be the same as the old passcode',
233
234
  password_mismatch: 'Passcodes do not match',
234
235
  user_closed_view: 'User closed the view',
235
236
  },
@@ -238,9 +239,9 @@ const translation = {
238
239
  description: {
239
240
  title: 'Add a passcode to protect your account',
240
241
  additional_protection: {
241
- title: 'Additional Protection',
242
+ title: 'Passcode Security',
242
243
  description:
243
- 'Add a secure passcode to prevent un-authorized access to your account',
244
+ 'Add a secure passcode to further prevent un-authrized access to your account.',
244
245
  },
245
246
  restore_access: {
246
247
  title: 'Restore Access',
@@ -248,11 +249,11 @@ const translation = {
248
249
  'You will be asked to enter it when signing on to a new device.',
249
250
  },
250
251
  },
251
- title: 'Secure your account',
252
+ title: 'Add a Passcode',
252
253
  },
253
254
  logout: 'Log out',
254
255
  title: {
255
- create: 'Create backup passcode',
256
+ create: 'Create passcode',
256
257
  update: 'Create new passcode',
257
258
  },
258
259
  update_input: {
@@ -279,6 +280,7 @@ const translation = {
279
280
  errors: {
280
281
  invalid_current_password: 'Invalid current passcode',
281
282
  error_changing_password: 'Error changing passcode',
283
+ new_password_same_as_old: 'New passcode cannot be the same as the old passcode',
282
284
  password_mismatch: 'Passcodes do not match',
283
285
  user_closed_view: 'User closed the view',
284
286
  },
@@ -287,19 +289,19 @@ const translation = {
287
289
  description: {
288
290
  title: 'Add a passcode to protect your account',
289
291
  additional_protection: {
290
- title: 'Additional Protection',
291
- description: 'Add a secure passcode to prevent un-authorized access to your account',
292
+ title: 'Passcode Security',
293
+ description: 'Add a secure passcode to further prevent un-authrized access to your account.',
292
294
  },
293
295
  restore_access: {
294
296
  title: 'Restore Access',
295
297
  description: 'You will be asked to enter it when signing on to a new device.',
296
298
  },
297
299
  },
298
- title: 'Secure your account',
300
+ title: 'Add a Passcode',
299
301
  },
300
302
  logout: 'Log out',
301
303
  title: {
302
- create: 'Create backup passcode',
304
+ create: 'Create passcode',
303
305
  update: 'Create new passcode',
304
306
  },
305
307
  update_input: {
@@ -307,6 +309,16 @@ const translation = {
307
309
  placeholder: 'New passcode',
308
310
  },
309
311
  },
312
+ /**
313
+ * @description copy keys for creating wallet wallet message
314
+ * @default
315
+ * {
316
+ loading_message: 'Your wallet is being created...',
317
+ }
318
+ */
319
+ dyn_creating_wallet: {
320
+ loading_message: 'Your wallet is being created...',
321
+ },
310
322
  /**
311
323
  * @description copy keys for email verification view after email logging in with magiclink
312
324
  * @default
@@ -685,7 +697,8 @@ const translation = {
685
697
  signing_section: {
686
698
  email_auth_button: 'One time code',
687
699
  passkey_button: 'Passkeys',
688
- title: 'Security & Signing Methods',
700
+ password_button: 'Passcode',
701
+ title: 'Security Methods',
689
702
  },
690
703
  title: 'Wallet settings',
691
704
  }
@@ -699,7 +712,8 @@ const translation = {
699
712
  signing_section: {
700
713
  email_auth_button: 'One time code',
701
714
  passkey_button: 'Passkeys',
702
- title: 'Security & Signing Methods',
715
+ password_button: 'Passcode',
716
+ title: 'Security Methods',
703
717
  },
704
718
  title: 'Wallet settings',
705
719
  },
@@ -1127,10 +1141,10 @@ const translation = {
1127
1141
  download_button: 'Download',
1128
1142
  logout: 'Log out',
1129
1143
  password_input: {
1130
- label: 'Backup Passcode',
1131
- placeholder: 'Backup Passcode',
1144
+ label: 'Passcode',
1145
+ placeholder: 'Passcode',
1132
1146
  },
1133
- title: 'Save backup passcode',
1147
+ title: 'Save passcode',
1134
1148
  warning:
1135
1149
  'If you lose your passcode, you cannot recover access to your account.',
1136
1150
  }
@@ -1147,10 +1161,10 @@ const translation = {
1147
1161
  download_button: 'Download',
1148
1162
  logout: 'Log out',
1149
1163
  password_input: {
1150
- label: 'Backup Passcode',
1151
- placeholder: 'Backup Passcode',
1164
+ label: 'Passcode',
1165
+ placeholder: 'Passcode',
1152
1166
  },
1153
- title: 'Save backup passcode',
1167
+ title: 'Save passcode',
1154
1168
  warning: 'If you lose your passcode, you cannot recover access to your account.',
1155
1169
  },
1156
1170
  /**
@@ -6,7 +6,7 @@ export type LocalStorageNonce = {
6
6
  value: string | undefined;
7
7
  };
8
8
  export type LocalStorageNetworks = {
9
- configurations: NetworkConfigurationMap;
9
+ networkConfigurations: NetworkConfigurationMap;
10
10
  environmentId?: string;
11
11
  expiry: number;
12
12
  version: number;
@@ -2,41 +2,23 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var React = require('react');
6
5
  var index = require('../../functions/lastAuthenticatedAccount/index.cjs');
7
6
 
8
7
  const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, }) => {
9
- var _a;
10
- const [sdkHasLoaded, setSdkHasLoaded] = React.useState(false);
11
- const primaryWalletIsLoading = user &&
8
+ var _a, _b;
9
+ const isPrimaryWalletLoading = user &&
12
10
  ((_a = index.lastAuthenticatedAccount(user)) === null || _a === void 0 ? void 0 : _a.format) === 'blockchain' &&
13
11
  !primaryWallet;
14
- const connectOnlyUserIsLoading = authMode === 'connect-only' &&
12
+ const isConnectOnlyWalletsLoading = authMode === 'connect-only' &&
15
13
  connectedInfo &&
16
14
  connectedWallets.length === 0;
17
- React.useEffect(() => {
18
- var _a;
19
- if (!Object.keys((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {}).length) {
20
- return;
21
- }
22
- if (projectSettings) {
23
- if (primaryWalletIsLoading || connectOnlyUserIsLoading) {
24
- return;
25
- }
26
- setSdkHasLoaded(true);
27
- }
28
- }, [
29
- projectSettings,
30
- primaryWallet,
31
- user,
32
- primaryWalletIsLoading,
33
- connectOnlyUserIsLoading,
34
- walletBook,
35
- ]);
36
- return {
37
- sdkHasLoaded,
38
- setSdkHasLoaded,
39
- };
15
+ const hasWalletBookLoaded = Boolean(Object.keys((_b = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _b !== void 0 ? _b : {}).length);
16
+ if (!hasWalletBookLoaded ||
17
+ !projectSettings ||
18
+ isPrimaryWalletLoading ||
19
+ isConnectOnlyWalletsLoading)
20
+ return false;
21
+ return true;
40
22
  };
41
23
 
42
24
  exports.useGlobalLoading = useGlobalLoading;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ProjectSettings } from '@dynamic-labs/sdk-api';
3
2
  import { WalletBookSchema } from '@dynamic-labs/wallet-book';
4
3
  import { UserProfile, Wallet } from '../../../types';
@@ -12,8 +11,5 @@ type Props = {
12
11
  user: UserProfile | undefined;
13
12
  walletBook: WalletBookSchema;
14
13
  };
15
- export declare const useGlobalLoading: ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, }: Props) => {
16
- sdkHasLoaded: boolean;
17
- setSdkHasLoaded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
18
- };
14
+ export declare const useGlobalLoading: ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, }: Props) => boolean;
19
15
  export {};
@@ -1,38 +1,20 @@
1
- import { useState, useEffect } from 'react';
2
1
  import { lastAuthenticatedAccount } from '../../functions/lastAuthenticatedAccount/index.js';
3
2
 
4
3
  const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWallet, user, walletBook, }) => {
5
- var _a;
6
- const [sdkHasLoaded, setSdkHasLoaded] = useState(false);
7
- const primaryWalletIsLoading = user &&
4
+ var _a, _b;
5
+ const isPrimaryWalletLoading = user &&
8
6
  ((_a = lastAuthenticatedAccount(user)) === null || _a === void 0 ? void 0 : _a.format) === 'blockchain' &&
9
7
  !primaryWallet;
10
- const connectOnlyUserIsLoading = authMode === 'connect-only' &&
8
+ const isConnectOnlyWalletsLoading = authMode === 'connect-only' &&
11
9
  connectedInfo &&
12
10
  connectedWallets.length === 0;
13
- useEffect(() => {
14
- var _a;
15
- if (!Object.keys((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {}).length) {
16
- return;
17
- }
18
- if (projectSettings) {
19
- if (primaryWalletIsLoading || connectOnlyUserIsLoading) {
20
- return;
21
- }
22
- setSdkHasLoaded(true);
23
- }
24
- }, [
25
- projectSettings,
26
- primaryWallet,
27
- user,
28
- primaryWalletIsLoading,
29
- connectOnlyUserIsLoading,
30
- walletBook,
31
- ]);
32
- return {
33
- sdkHasLoaded,
34
- setSdkHasLoaded,
35
- };
11
+ const hasWalletBookLoaded = Boolean(Object.keys((_b = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _b !== void 0 ? _b : {}).length);
12
+ if (!hasWalletBookLoaded ||
13
+ !projectSettings ||
14
+ isPrimaryWalletLoading ||
15
+ isConnectOnlyWalletsLoading)
16
+ return false;
17
+ return true;
36
18
  };
37
19
 
38
20
  export { useGlobalLoading };