@dynamic-labs/sdk-react-core 1.1.0-alpha.8 → 1.1.0-alpha.9

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 (111) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +11 -11
  5. package/src/index.cjs +2 -2
  6. package/src/index.js +1 -1
  7. package/src/lib/Main.cjs +4 -5
  8. package/src/lib/Main.js +4 -5
  9. package/src/lib/components/Toggle/Toggle.cjs +14 -0
  10. package/src/lib/components/Toggle/Toggle.d.ts +7 -0
  11. package/src/lib/components/Toggle/Toggle.js +10 -0
  12. package/src/lib/components/Toggle/index.d.ts +1 -0
  13. package/src/lib/context/DynamicContext/DynamicContext.cjs +35 -42
  14. package/src/lib/context/DynamicContext/DynamicContext.js +36 -43
  15. package/src/lib/context/DynamicContext/hooks/index.d.ts +1 -1
  16. package/src/lib/context/DynamicContext/hooks/useSetShowLinkNewWalletModal/index.d.ts +1 -0
  17. package/src/lib/context/DynamicContext/hooks/{useSetShowLinkNewWalletModalWithInit/useSetShowLinkNewWalletModalWithInit.cjs → useSetShowLinkNewWalletModal/useSetShowLinkNewWalletModal.cjs} +11 -17
  18. package/src/lib/context/DynamicContext/hooks/{useSetShowLinkNewWalletModalWithInit/useSetShowLinkNewWalletModalWithInit.d.ts → useSetShowLinkNewWalletModal/useSetShowLinkNewWalletModal.d.ts} +3 -6
  19. package/src/lib/context/DynamicContext/hooks/{useSetShowLinkNewWalletModalWithInit/useSetShowLinkNewWalletModalWithInit.js → useSetShowLinkNewWalletModal/useSetShowLinkNewWalletModal.js} +11 -17
  20. package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/index.d.ts +1 -0
  21. package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.cjs +59 -0
  22. package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.d.ts +37 -0
  23. package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.js +55 -0
  24. package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +1 -0
  25. package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +1 -0
  26. package/src/lib/context/DynamicContext/types/index.d.ts +10 -7
  27. package/src/lib/context/DynamicContext/useDynamicContext.cjs +6 -1
  28. package/src/lib/context/DynamicContext/useDynamicContext.d.ts +4 -1
  29. package/src/lib/context/DynamicContext/useDynamicContext.js +6 -1
  30. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +1 -1
  31. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +1 -1
  32. package/src/lib/events/dynamicEvents.d.ts +3 -0
  33. package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +2 -2
  34. package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +2 -2
  35. package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +5 -5
  36. package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +5 -5
  37. package/src/lib/locale/en/translation.cjs +0 -2
  38. package/src/lib/locale/en/translation.d.ts +0 -2
  39. package/src/lib/locale/en/translation.js +0 -2
  40. package/src/lib/shared/types/index.d.ts +3 -0
  41. package/src/lib/styles/index.shadow.cjs +1 -1
  42. package/src/lib/styles/index.shadow.js +1 -1
  43. package/src/lib/utils/functions/isSelectedWalletAlreadyConnected/isSelectedWalletAlreadyConnected.cjs +2 -4
  44. package/src/lib/utils/functions/isSelectedWalletAlreadyConnected/isSelectedWalletAlreadyConnected.js +2 -4
  45. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +3 -3
  46. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +4 -4
  47. package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +1 -1
  48. package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +1 -1
  49. package/src/lib/utils/hooks/useClearWalletConnectSessions/useClearWalletConnectSessions.cjs +3 -3
  50. package/src/lib/utils/hooks/useClearWalletConnectSessions/useClearWalletConnectSessions.js +3 -3
  51. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +1 -1
  52. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +2 -2
  53. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +1 -1
  54. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +2 -2
  55. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +2 -2
  56. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +6 -3
  57. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +6 -3
  58. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +9 -6
  59. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +9 -6
  60. package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.cjs +5 -3
  61. package/src/lib/utils/hooks/useHandleUnlinkWallet/useHandleUnlinkWallet.js +5 -3
  62. package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +6 -8
  63. package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +6 -8
  64. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +1 -1
  65. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +1 -1
  66. package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs +8 -5
  67. package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js +8 -5
  68. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
  69. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
  70. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +2 -2
  71. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +2 -2
  72. package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +5 -2
  73. package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +5 -2
  74. package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.cjs +1 -1
  75. package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.js +1 -1
  76. package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +1 -1
  77. package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +1 -1
  78. package/src/lib/views/BridgeWelcomeView/BridgeWelcomeView.cjs +1 -1
  79. package/src/lib/views/BridgeWelcomeView/BridgeWelcomeView.js +1 -1
  80. package/src/lib/views/EmailVerification/EmailVerification.cjs +1 -1
  81. package/src/lib/views/EmailVerification/EmailVerification.js +1 -1
  82. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +1 -1
  83. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +1 -1
  84. package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +1 -1
  85. package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +1 -1
  86. package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +1 -1
  87. package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +1 -1
  88. package/src/lib/views/QrCodeView/QRCode.cjs +2 -3
  89. package/src/lib/views/QrCodeView/QRCode.js +2 -3
  90. package/src/lib/views/WalletGroupView/WalletGroupView.cjs +3 -1
  91. package/src/lib/views/WalletGroupView/WalletGroupView.js +3 -1
  92. package/src/lib/views/WalletGroupView/components/HardwareWalletToggle/HardwareWalletToggle.cjs +8 -6
  93. package/src/lib/views/WalletGroupView/components/HardwareWalletToggle/HardwareWalletToggle.js +9 -7
  94. package/src/lib/views/WalletUsedView/WalletUsedView.cjs +5 -5
  95. package/src/lib/views/WalletUsedView/WalletUsedView.js +5 -5
  96. package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.cjs +6 -3
  97. package/src/lib/widgets/DynamicBridgeWidget/views/EditProfileView/EditProfileView.js +6 -3
  98. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +2 -3
  99. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +2 -3
  100. package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.cjs +66 -21
  101. package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.d.ts +1 -1
  102. package/src/lib/widgets/DynamicWidget/hooks/useFetchBalance/useFetchBalance.js +67 -22
  103. package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +2 -2
  104. package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +2 -2
  105. package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +7 -3
  106. package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +7 -3
  107. package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/index.d.ts +0 -1
  108. package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.cjs +0 -55
  109. package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.d.ts +0 -18
  110. package/src/lib/context/DynamicContext/hooks/useSetShowAuthFlowWithInit/useSetShowAuthFlowWithInit.js +0 -51
  111. package/src/lib/context/DynamicContext/hooks/useSetShowLinkNewWalletModalWithInit/index.d.ts +0 -1
@@ -4,42 +4,87 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _tslib = require('../../../../../../_virtual/_tslib.cjs');
6
6
  var React = require('react');
7
+ require('../../../../events/dynamicEvents.cjs');
8
+ var useWalletConnectorEvent = require('../../../../utils/hooks/events/useWalletConnectorEvent/useWalletConnectorEvent.cjs');
9
+ require('@dynamic-labs/utils');
10
+ require('../../../../context/DynamicContext/DynamicContext.cjs');
11
+ require('@dynamic-labs/wallet-connector-core');
12
+ require('../../../../context/CaptchaContext/CaptchaContext.cjs');
13
+ require('../../../../context/ErrorContext/ErrorContext.cjs');
14
+ require('../../../../context/ViewContext/ViewContext.cjs');
7
15
  require('@dynamic-labs/sdk-api');
8
16
  require('../../../../shared/logger.cjs');
9
17
  require('@dynamic-labs/iconic');
10
- require('@dynamic-labs/wallet-connector-core');
11
18
  require('react/jsx-runtime');
12
- require('../../../../context/ViewContext/ViewContext.cjs');
13
19
  require('@dynamic-labs/wallet-book');
14
20
  require('../../../../utils/constants/colors.cjs');
15
21
  require('../../../../shared/utils/classes/storage/localStorage.cjs');
16
22
  require('viem');
17
- require('@dynamic-labs/utils');
18
23
  require('../../../../shared/consts/index.cjs');
19
24
  require('@dynamic-labs/multi-wallet');
20
25
  var isWalletConnected = require('../../../../utils/functions/isWalletConnected/isWalletConnected.cjs');
26
+ require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
27
+ require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
28
+ require('../../../../config/ApiEndpoint.cjs');
29
+ require('../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
30
+ require('react-dom');
31
+ require('../../../../context/ThemeContext/ThemeContext.cjs');
32
+ var usePromise = require('../../../../utils/hooks/usePromise/usePromise.cjs');
33
+ require('@dynamic-labs/types');
34
+ require('yup');
35
+ require('react-i18next');
36
+ require('../../../../context/MockContext/MockContext.cjs');
37
+ require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
38
+ require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
39
+ require('@dynamic-labs/rpc-providers');
40
+ require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
41
+ require('../../../../components/Alert/Alert.cjs');
42
+ require('../../../../components/ShadowDOM/ShadowDOM.cjs');
43
+ require('../../../../components/IconButton/IconButton.cjs');
44
+ require('../../../../components/InlineWidget/InlineWidget.cjs');
45
+ require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
46
+ require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
47
+ require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
48
+ require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
49
+ require('../../../../components/Popper/Popper/Popper.cjs');
50
+ require('../../../../components/Popper/PopperContext/PopperContext.cjs');
51
+ require('react-focus-lock');
52
+ require('formik');
53
+ require('i18next');
54
+ require('../../../../components/OverlayCard/OverlayCard.context.cjs');
55
+ require('../../../../context/FooterAnimationContext/index.cjs');
56
+ require('../../../../context/QrCodeContext/QrCodeContext.cjs');
57
+ require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
58
+ require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
59
+ require('../../../../context/LoadingContext/LoadingContext.cjs');
60
+ require('qrcode');
61
+ require('../../context/DynamicWidgetContext.cjs');
62
+ require('../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
63
+ require('@dynamic-labs/viem-utils');
64
+ require('../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
21
65
 
22
66
  const useFetchBalance = ({ connector, chain, address, network, }) => {
23
67
  const [balance, setBalance] = React.useState('0.0');
24
- React.useEffect(() => {
25
- const fetchBalance = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
26
- if (!chain ||
27
- !address ||
28
- (connector.supportsNetworkSwitching() && !network))
29
- return;
30
- const isConnected = yield isWalletConnected.isWalletConnected({
31
- address,
32
- chain,
33
- connector,
34
- });
35
- /* istanbul ignore else */
36
- if (isConnected) {
37
- const value = yield connector.getBalance();
38
- setBalance(value);
39
- }
68
+ const isFetchBalanceDisabled = !chain || !address || (connector.supportsNetworkSwitching() && !network);
69
+ const fetchBalance = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
70
+ if (isFetchBalanceDisabled)
71
+ return;
72
+ const isConnected = yield isWalletConnected.isWalletConnected({
73
+ address,
74
+ chain,
75
+ connector,
40
76
  });
41
- fetchBalance();
42
- }, [address, chain, connector, network]);
77
+ /* istanbul ignore else */
78
+ if (isConnected) {
79
+ const value = yield connector.getBalance();
80
+ setBalance(value);
81
+ }
82
+ });
83
+ usePromise.usePromise(fetchBalance, {
84
+ deps: [address, network === null || network === void 0 ? void 0 : network.toString(), chain],
85
+ enabled: !isFetchBalanceDisabled,
86
+ });
87
+ useWalletConnectorEvent.useWalletConnectorEvent(connector, 'accountChange', fetchBalance);
43
88
  return [balance];
44
89
  };
45
90
 
@@ -1,4 +1,4 @@
1
- import { WalletConnector } from '../../../../..';
1
+ import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
2
2
  type Props = {
3
3
  address: string | undefined;
4
4
  chain: string | undefined;
@@ -1,41 +1,86 @@
1
1
  import { __awaiter } from '../../../../../../_virtual/_tslib.js';
2
- import { useState, useEffect } from 'react';
2
+ import { useState } from 'react';
3
+ import '../../../../events/dynamicEvents.js';
4
+ import { useWalletConnectorEvent } from '../../../../utils/hooks/events/useWalletConnectorEvent/useWalletConnectorEvent.js';
5
+ import '@dynamic-labs/utils';
6
+ import '../../../../context/DynamicContext/DynamicContext.js';
7
+ import '@dynamic-labs/wallet-connector-core';
8
+ import '../../../../context/CaptchaContext/CaptchaContext.js';
9
+ import '../../../../context/ErrorContext/ErrorContext.js';
10
+ import '../../../../context/ViewContext/ViewContext.js';
3
11
  import '@dynamic-labs/sdk-api';
4
12
  import '../../../../shared/logger.js';
5
13
  import '@dynamic-labs/iconic';
6
- import '@dynamic-labs/wallet-connector-core';
7
14
  import 'react/jsx-runtime';
8
- import '../../../../context/ViewContext/ViewContext.js';
9
15
  import '@dynamic-labs/wallet-book';
10
16
  import '../../../../utils/constants/colors.js';
11
17
  import '../../../../shared/utils/classes/storage/localStorage.js';
12
18
  import 'viem';
13
- import '@dynamic-labs/utils';
14
19
  import '../../../../shared/consts/index.js';
15
20
  import '@dynamic-labs/multi-wallet';
16
21
  import { isWalletConnected } from '../../../../utils/functions/isWalletConnected/isWalletConnected.js';
22
+ import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
23
+ import '../../../../context/AccountExistsContext/AccountExistsContext.js';
24
+ import '../../../../config/ApiEndpoint.js';
25
+ import '../../../../context/EmailVerificationContext/EmailVerificationContext.js';
26
+ import 'react-dom';
27
+ import '../../../../context/ThemeContext/ThemeContext.js';
28
+ import { usePromise } from '../../../../utils/hooks/usePromise/usePromise.js';
29
+ import '@dynamic-labs/types';
30
+ import 'yup';
31
+ import 'react-i18next';
32
+ import '../../../../context/MockContext/MockContext.js';
33
+ import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
34
+ import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
35
+ import '@dynamic-labs/rpc-providers';
36
+ import '../../../../context/UserWalletsContext/UserWalletsContext.js';
37
+ import '../../../../components/Alert/Alert.js';
38
+ import '../../../../components/ShadowDOM/ShadowDOM.js';
39
+ import '../../../../components/IconButton/IconButton.js';
40
+ import '../../../../components/InlineWidget/InlineWidget.js';
41
+ import '../../../../components/MenuList/Dropdown/Dropdown.js';
42
+ import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
43
+ import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
44
+ import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
45
+ import '../../../../components/Popper/Popper/Popper.js';
46
+ import '../../../../components/Popper/PopperContext/PopperContext.js';
47
+ import 'react-focus-lock';
48
+ import 'formik';
49
+ import 'i18next';
50
+ import '../../../../components/OverlayCard/OverlayCard.context.js';
51
+ import '../../../../context/FooterAnimationContext/index.js';
52
+ import '../../../../context/QrCodeContext/QrCodeContext.js';
53
+ import '../../../../context/WalletGroupContext/WalletGroupContext.js';
54
+ import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
55
+ import '../../../../context/LoadingContext/LoadingContext.js';
56
+ import 'qrcode';
57
+ import '../../context/DynamicWidgetContext.js';
58
+ import '../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
59
+ import '@dynamic-labs/viem-utils';
60
+ import '../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
17
61
 
18
62
  const useFetchBalance = ({ connector, chain, address, network, }) => {
19
63
  const [balance, setBalance] = useState('0.0');
20
- useEffect(() => {
21
- const fetchBalance = () => __awaiter(void 0, void 0, void 0, function* () {
22
- if (!chain ||
23
- !address ||
24
- (connector.supportsNetworkSwitching() && !network))
25
- return;
26
- const isConnected = yield isWalletConnected({
27
- address,
28
- chain,
29
- connector,
30
- });
31
- /* istanbul ignore else */
32
- if (isConnected) {
33
- const value = yield connector.getBalance();
34
- setBalance(value);
35
- }
64
+ const isFetchBalanceDisabled = !chain || !address || (connector.supportsNetworkSwitching() && !network);
65
+ const fetchBalance = () => __awaiter(void 0, void 0, void 0, function* () {
66
+ if (isFetchBalanceDisabled)
67
+ return;
68
+ const isConnected = yield isWalletConnected({
69
+ address,
70
+ chain,
71
+ connector,
36
72
  });
37
- fetchBalance();
38
- }, [address, chain, connector, network]);
73
+ /* istanbul ignore else */
74
+ if (isConnected) {
75
+ const value = yield connector.getBalance();
76
+ setBalance(value);
77
+ }
78
+ });
79
+ usePromise(fetchBalance, {
80
+ deps: [address, network === null || network === void 0 ? void 0 : network.toString(), chain],
81
+ enabled: !isFetchBalanceDisabled,
82
+ });
83
+ useWalletConnectorEvent(connector, 'accountChange', fetchBalance);
39
84
  return [balance];
40
85
  };
41
86
 
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var walletBook = require('@dynamic-labs/wallet-book');
7
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
8
7
  var QRCode = require('../../../../views/QrCodeView/QRCode.cjs');
9
8
  require('react');
10
9
  require('../../../../events/dynamicEvents.cjs');
11
10
  require('@dynamic-labs/utils');
12
11
  var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
12
+ require('@dynamic-labs/wallet-connector-core');
13
13
  require('../../../../context/CaptchaContext/CaptchaContext.cjs');
14
14
  require('../../../../context/ErrorContext/ErrorContext.cjs');
15
15
  require('../../../../context/ViewContext/ViewContext.cjs');
@@ -87,7 +87,7 @@ const QrCodeModalView = ({ walletId }) => {
87
87
  // can't use theme because it's string instead of 'light' | 'dark'
88
88
  const typedTheme = theme.theme.name === 'light' ? 'light' : 'dark';
89
89
  const icon = (jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletKey, style: { height: pixelToRem.pixelToRem(24), width: pixelToRem.pixelToRem(24) } }));
90
- return (jsxRuntime.jsxs("div", { className: 'qr-code-modal-view', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'button_primary', color: 'primary', className: 'qr-code-modal-view__title', children: ["Connect with ", newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.connector.name] }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'secondary', className: 'qr-code-modal-view__title', children: ["Connect wallet", ' ', jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.address, 4, 4) }), ' ', "to switch active account."] }), jsxRuntime.jsx("div", { className: 'qr-code-modal-view__container', children: jsxRuntime.jsx("div", { className: 'qr-code-modal-view__wrapper', children: qrcodeUri ? (jsxRuntime.jsx(QRCode.QRCode, { Icon: icon, accentColor: qrCodeColorsByTheme[typedTheme].accentColor, value: qrcodeUri, size: 175, logoSize: 40, walletKey: walletConnectorCore.normalizeWalletName(walletKey) })) : (
90
+ return (jsxRuntime.jsxs("div", { className: 'qr-code-modal-view', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'button_primary', color: 'primary', className: 'qr-code-modal-view__title', children: ["Connect with ", newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.connector.name] }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'secondary', className: 'qr-code-modal-view__title', children: ["Connect wallet", ' ', jsxRuntime.jsx(Typography.Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.address, 4, 4) }), ' ', "to switch active account."] }), jsxRuntime.jsx("div", { className: 'qr-code-modal-view__container', children: jsxRuntime.jsx("div", { className: 'qr-code-modal-view__wrapper', children: qrcodeUri ? (jsxRuntime.jsx(QRCode.QRCode, { Icon: icon, accentColor: qrCodeColorsByTheme[typedTheme].accentColor, value: qrcodeUri, size: 175, logoSize: 40, walletKey: walletKey })) : (
91
91
  // this div exists to give the parent a child, so that the parent
92
92
  // takes on its given width and height. the result is stable
93
93
  // rendering of this component, without this there is a brief flash
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useWalletBookContext, getWalletPrimaryColor, WalletIcon } from '@dynamic-labs/wallet-book';
3
- import { normalizeWalletName } from '@dynamic-labs/wallet-connector-core';
4
3
  import { QRCode } from '../../../../views/QrCodeView/QRCode.js';
5
4
  import 'react';
6
5
  import '../../../../events/dynamicEvents.js';
7
6
  import '@dynamic-labs/utils';
8
7
  import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
8
+ import '@dynamic-labs/wallet-connector-core';
9
9
  import '../../../../context/CaptchaContext/CaptchaContext.js';
10
10
  import '../../../../context/ErrorContext/ErrorContext.js';
11
11
  import '../../../../context/ViewContext/ViewContext.js';
@@ -83,7 +83,7 @@ const QrCodeModalView = ({ walletId }) => {
83
83
  // can't use theme because it's string instead of 'light' | 'dark'
84
84
  const typedTheme = theme.theme.name === 'light' ? 'light' : 'dark';
85
85
  const icon = (jsx(WalletIcon, { walletKey: walletKey, style: { height: pixelToRem(24), width: pixelToRem(24) } }));
86
- return (jsxs("div", { className: 'qr-code-modal-view', children: [jsxs(Typography, { variant: 'button_primary', color: 'primary', className: 'qr-code-modal-view__title', children: ["Connect with ", newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.connector.name] }), jsxs(Typography, { variant: 'body_small', color: 'secondary', className: 'qr-code-modal-view__title', children: ["Connect wallet", ' ', jsx(Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress(newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.address, 4, 4) }), ' ', "to switch active account."] }), jsx("div", { className: 'qr-code-modal-view__container', children: jsx("div", { className: 'qr-code-modal-view__wrapper', children: qrcodeUri ? (jsx(QRCode, { Icon: icon, accentColor: qrCodeColorsByTheme[typedTheme].accentColor, value: qrcodeUri, size: 175, logoSize: 40, walletKey: normalizeWalletName(walletKey) })) : (
86
+ return (jsxs("div", { className: 'qr-code-modal-view', children: [jsxs(Typography, { variant: 'button_primary', color: 'primary', className: 'qr-code-modal-view__title', children: ["Connect with ", newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.connector.name] }), jsxs(Typography, { variant: 'body_small', color: 'secondary', className: 'qr-code-modal-view__title', children: ["Connect wallet", ' ', jsx(Typography, { as: 'span', weight: 'medium', color: 'primary', children: shortenWalletAddress(newPrimaryWallet === null || newPrimaryWallet === void 0 ? void 0 : newPrimaryWallet.address, 4, 4) }), ' ', "to switch active account."] }), jsx("div", { className: 'qr-code-modal-view__container', children: jsx("div", { className: 'qr-code-modal-view__wrapper', children: qrcodeUri ? (jsx(QRCode, { Icon: icon, accentColor: qrCodeColorsByTheme[typedTheme].accentColor, value: qrcodeUri, size: 175, logoSize: 40, walletKey: walletKey })) : (
87
87
  // this div exists to give the parent a child, so that the parent
88
88
  // takes on its given width and height. the result is stable
89
89
  // rendering of this component, without this there is a brief flash
@@ -66,7 +66,7 @@ require('formik');
66
66
 
67
67
  const EditProfileView = ({ rootClassName, }) => {
68
68
  const { setView } = ViewContext.useViewContext();
69
- const { internalSetShowAuthFlow, multiWallet } = useInternalDynamicContext.useInternalDynamicContext();
69
+ const { setShowAuthFlow, multiWallet } = useInternalDynamicContext.useInternalDynamicContext();
70
70
  const { goToProfileView } = DynamicWidgetContext.useWidgetContext();
71
71
  const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
72
72
  validationSchemaStripUnknown: true,
@@ -75,10 +75,14 @@ const EditProfileView = ({ rootClassName, }) => {
75
75
  const { isEmailVerificationRequired } = yield updateUser(formValues);
76
76
  goToProfileView();
77
77
  if (isEmailVerificationRequired) {
78
- internalSetShowAuthFlow(true);
78
+ setShowAuthFlow(true, {
79
+ ignoreIfIsEmbeddedWidget: false,
80
+ initializeWalletConnect: false,
81
+ performMultiWalletChecks: false,
82
+ });
79
83
  setView('verify-email');
80
84
  }
81
- }), [goToProfileView, internalSetShowAuthFlow, setView, updateUser]);
85
+ }), [goToProfileView, setShowAuthFlow, setView, updateUser]);
82
86
  const isKYCEnabled = useKYCFlag.useKYCFlag();
83
87
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!multiWallet && isKYCEnabled && (jsxRuntime.jsx(Typography.Typography, { weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title', children: "My information" })), jsxRuntime.jsx(UserProfileForm.UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
84
88
  };
@@ -62,7 +62,7 @@ import 'formik';
62
62
 
63
63
  const EditProfileView = ({ rootClassName, }) => {
64
64
  const { setView } = useViewContext();
65
- const { internalSetShowAuthFlow, multiWallet } = useInternalDynamicContext();
65
+ const { setShowAuthFlow, multiWallet } = useInternalDynamicContext();
66
66
  const { goToProfileView } = useWidgetContext();
67
67
  const { updateUser } = useUserUpdateRequestInternal({
68
68
  validationSchemaStripUnknown: true,
@@ -71,10 +71,14 @@ const EditProfileView = ({ rootClassName, }) => {
71
71
  const { isEmailVerificationRequired } = yield updateUser(formValues);
72
72
  goToProfileView();
73
73
  if (isEmailVerificationRequired) {
74
- internalSetShowAuthFlow(true);
74
+ setShowAuthFlow(true, {
75
+ ignoreIfIsEmbeddedWidget: false,
76
+ initializeWalletConnect: false,
77
+ performMultiWalletChecks: false,
78
+ });
75
79
  setView('verify-email');
76
80
  }
77
- }), [goToProfileView, internalSetShowAuthFlow, setView, updateUser]);
81
+ }), [goToProfileView, setShowAuthFlow, setView, updateUser]);
78
82
  const isKYCEnabled = useKYCFlag();
79
83
  return (jsxs(Fragment, { children: [!multiWallet && isKYCEnabled && (jsx(Typography, { weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title', children: "My information" })), jsx(UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
80
84
  };
@@ -1 +0,0 @@
1
- export * from './useSetShowAuthFlowWithInit';
@@ -1,55 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- require('@dynamic-labs/sdk-api');
7
- var logger = require('../../../../shared/logger.cjs');
8
- require('@dynamic-labs/iconic');
9
- require('@dynamic-labs/wallet-connector-core');
10
- require('react/jsx-runtime');
11
- require('../../../ViewContext/ViewContext.cjs');
12
- require('@dynamic-labs/wallet-book');
13
- require('../../../../utils/constants/colors.cjs');
14
- require('../../../../shared/utils/classes/storage/localStorage.cjs');
15
- require('viem');
16
- require('@dynamic-labs/utils');
17
- require('../../../../shared/consts/index.cjs');
18
-
19
- /**
20
- * this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
21
- * before we can connect a wallet. The goal here is that when a user clicks
22
- * on the "Connect your wallet" button, the SDK starts initializing WalletConnect
23
- * and will prime it for connection. This way, when the user clicks on the
24
- * "Connect" button in the WalletConnect modal, there is a uri ready to go
25
- * to immediately trigger the deep link on mobile
26
- */
27
- const useSetShowAuthFlowWithInit = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, setShowAuthFlow, isMultiWalletEnabled, walletConnectorOptions, }) => {
28
- const setShowAuthFlowWithInit = React.useCallback((value) => {
29
- var _a;
30
- if (value) {
31
- // Do not change state if an embedded auth flow is already being rendered
32
- if (isRenderingEmbeddedAuthFlow.current)
33
- return;
34
- // show the user profile and log a warning is multi-wallet is disabled
35
- // but the user is logged in this is done to prevent a broken looking state
36
- if (isAuthenticated && !isMultiWalletEnabled) {
37
- logger.logger.warn('setShowAuthFlow was called while the user is logged in, but Dynamic is not configured with multi-wallet enabled. This results in a no-op.');
38
- return;
39
- }
40
- (_a = walletConnectorOptions
41
- .find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
42
- logger.logger.warn('Using setShowAuthFlow to render the wallet list when the user is logged in is deprecated. Use setShowLinkNewWalletModal instead. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext');
43
- }
44
- setShowAuthFlow(value);
45
- }, [
46
- setShowAuthFlow,
47
- isAuthenticated,
48
- isMultiWalletEnabled,
49
- isRenderingEmbeddedAuthFlow,
50
- walletConnectorOptions,
51
- ]);
52
- return setShowAuthFlowWithInit;
53
- };
54
-
55
- exports.useSetShowAuthFlowWithInit = useSetShowAuthFlowWithInit;
@@ -1,18 +0,0 @@
1
- import { Dispatch, SetStateAction } from 'react';
2
- import { WalletOption } from '../../../../shared';
3
- import { IDynamicContext } from '../../types';
4
- /**
5
- * this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
6
- * before we can connect a wallet. The goal here is that when a user clicks
7
- * on the "Connect your wallet" button, the SDK starts initializing WalletConnect
8
- * and will prime it for connection. This way, when the user clicks on the
9
- * "Connect" button in the WalletConnect modal, there is a uri ready to go
10
- * to immediately trigger the deep link on mobile
11
- */
12
- export declare const useSetShowAuthFlowWithInit: ({ isAuthenticated, isRenderingEmbeddedAuthFlow, setShowAuthFlow, isMultiWalletEnabled, walletConnectorOptions, }: {
13
- setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
14
- isMultiWalletEnabled: boolean;
15
- isRenderingEmbeddedAuthFlow: IDynamicContext['isRenderingEmbeddedAuthFlow'];
16
- walletConnectorOptions: WalletOption[];
17
- isAuthenticated: boolean;
18
- }) => Dispatch<SetStateAction<boolean>>;
@@ -1,51 +0,0 @@
1
- import { useCallback } from 'react';
2
- import '@dynamic-labs/sdk-api';
3
- import { logger } from '../../../../shared/logger.js';
4
- import '@dynamic-labs/iconic';
5
- import '@dynamic-labs/wallet-connector-core';
6
- import 'react/jsx-runtime';
7
- import '../../../ViewContext/ViewContext.js';
8
- import '@dynamic-labs/wallet-book';
9
- import '../../../../utils/constants/colors.js';
10
- import '../../../../shared/utils/classes/storage/localStorage.js';
11
- import 'viem';
12
- import '@dynamic-labs/utils';
13
- import '../../../../shared/consts/index.js';
14
-
15
- /**
16
- * this hook wraps `setShowAuthFlow`. WalletConnect requires initialization
17
- * before we can connect a wallet. The goal here is that when a user clicks
18
- * on the "Connect your wallet" button, the SDK starts initializing WalletConnect
19
- * and will prime it for connection. This way, when the user clicks on the
20
- * "Connect" button in the WalletConnect modal, there is a uri ready to go
21
- * to immediately trigger the deep link on mobile
22
- */
23
- const useSetShowAuthFlowWithInit = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, setShowAuthFlow, isMultiWalletEnabled, walletConnectorOptions, }) => {
24
- const setShowAuthFlowWithInit = useCallback((value) => {
25
- var _a;
26
- if (value) {
27
- // Do not change state if an embedded auth flow is already being rendered
28
- if (isRenderingEmbeddedAuthFlow.current)
29
- return;
30
- // show the user profile and log a warning is multi-wallet is disabled
31
- // but the user is logged in this is done to prevent a broken looking state
32
- if (isAuthenticated && !isMultiWalletEnabled) {
33
- logger.warn('setShowAuthFlow was called while the user is logged in, but Dynamic is not configured with multi-wallet enabled. This results in a no-op.');
34
- return;
35
- }
36
- (_a = walletConnectorOptions
37
- .find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
38
- logger.warn('Using setShowAuthFlow to render the wallet list when the user is logged in is deprecated. Use setShowLinkNewWalletModal instead. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext');
39
- }
40
- setShowAuthFlow(value);
41
- }, [
42
- setShowAuthFlow,
43
- isAuthenticated,
44
- isMultiWalletEnabled,
45
- isRenderingEmbeddedAuthFlow,
46
- walletConnectorOptions,
47
- ]);
48
- return setShowAuthFlowWithInit;
49
- };
50
-
51
- export { useSetShowAuthFlowWithInit };
@@ -1 +0,0 @@
1
- export * from './useSetShowLinkNewWalletModalWithInit';