@dynamic-labs/sdk-react-core 3.0.0-alpha.42 → 3.0.0-alpha.44
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.
- package/CHANGELOG.md +30 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +2 -1
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +2 -1
- package/src/lib/components/SecureEmbeddedWalletCard/SecureEmbeddedWalletCard.cjs +2 -1
- package/src/lib/components/SecureEmbeddedWalletCard/SecureEmbeddedWalletCard.js +2 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +0 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +0 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -2
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -2
- package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +0 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +2 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +1 -2
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +1 -2
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +5 -4
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +5 -4
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/createUserProfile/createUserProfile.cjs +1 -4
- package/src/lib/utils/functions/createUserProfile/createUserProfile.js +1 -4
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/isAuthenticatedWithAWallet/index.d.ts +1 -0
- package/src/lib/utils/functions/isAuthenticatedWithAWallet/isAuthenticatedWithAWallet.cjs +14 -0
- package/src/lib/utils/functions/isAuthenticatedWithAWallet/isAuthenticatedWithAWallet.d.ts +2 -0
- package/src/lib/utils/functions/isAuthenticatedWithAWallet/isAuthenticatedWithAWallet.js +10 -0
- package/src/lib/utils/functions/isMultiAssetSupportedNetwork/isMultiAssetSupportedNetwork.d.ts +1 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +2 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +2 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +2 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +2 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +5 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +5 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +9 -3
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +9 -3
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.cjs +2 -1
- package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.js +2 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +1 -0
- package/src/lib/views/EmailVerification/EmailVerification.cjs +3 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +3 -1
- package/src/lib/views/LoginView/LoginViewSection/LoginViewSection.cjs +20 -16
- package/src/lib/views/LoginView/LoginViewSection/LoginViewSection.js +20 -16
- package/src/lib/views/LoginView/sections/ToggleableSection/ToggleableSection.d.ts +1 -2
- package/src/lib/views/viewToComponentMap.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +3 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.44](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.43...v3.0.0-alpha.44) (2024-08-15)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* populate wallet new isPrimary flag ([#6597](https://github.com/dynamic-labs/DynamicAuth/issues/6597)) ([7809f81](https://github.com/dynamic-labs/DynamicAuth/commit/7809f81c9743b8bf7bc27dc34cf45923cf9baf99))
|
|
8
|
+
* twitter should no longer rely polling for oauth flow ([#6603](https://github.com/dynamic-labs/DynamicAuth/issues/6603)) ([09aea8b](https://github.com/dynamic-labs/DynamicAuth/commit/09aea8b3f197c25dcfb5bc72049b90859df246f3))
|
|
9
|
+
|
|
10
|
+
## [3.0.0-alpha.43](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.42...v3.0.0-alpha.43) (2024-08-15)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### ⚠ BREAKING CHANGES
|
|
14
|
+
|
|
15
|
+
* removes walletConnector from dynamic context (#6579)
|
|
16
|
+
* removed deprecated props from user profile (#6589)
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* optimize solana embedded transactions ([#6582](https://github.com/dynamic-labs/DynamicAuth/issues/6582)) ([419aff9](https://github.com/dynamic-labs/DynamicAuth/commit/419aff96d312892d7db520e94ecc6956b8de771d))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* check if wallet is connected using normalized addresses ([#6594](https://github.com/dynamic-labs/DynamicAuth/issues/6594)) ([44aabae](https://github.com/dynamic-labs/DynamicAuth/commit/44aabae8ee72261bf0f7e308ed4adf0f42760ed2))
|
|
26
|
+
* minor sdk ui updates ([#6590](https://github.com/dynamic-labs/DynamicAuth/issues/6590)) ([8619e40](https://github.com/dynamic-labs/DynamicAuth/commit/8619e40e1afff8d68357138f3b5b9b89989140fd))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
* removed deprecated props from user profile ([#6589](https://github.com/dynamic-labs/DynamicAuth/issues/6589)) ([b621da8](https://github.com/dynamic-labs/DynamicAuth/commit/b621da8a0703eb8228a5b10131af2717f314fd2e))
|
|
30
|
+
* removes walletConnector from dynamic context ([#6579](https://github.com/dynamic-labs/DynamicAuth/issues/6579)) ([51d69fe](https://github.com/dynamic-labs/DynamicAuth/commit/51d69feebab71158ad2aa69f11001623a0aaa80a))
|
|
31
|
+
|
|
2
32
|
## [3.0.0-alpha.42](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.41...v3.0.0-alpha.42) (2024-08-14)
|
|
3
33
|
|
|
4
34
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.44",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "3.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/message-transport": "3.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "3.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "3.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/store": "3.0.0-alpha.
|
|
26
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/viem-utils": "3.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
30
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
20
|
+
"@dynamic-labs/iconic": "3.0.0-alpha.44",
|
|
21
|
+
"@dynamic-labs/logger": "3.0.0-alpha.44",
|
|
22
|
+
"@dynamic-labs/message-transport": "3.0.0-alpha.44",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "3.0.0-alpha.44",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "3.0.0-alpha.44",
|
|
25
|
+
"@dynamic-labs/store": "3.0.0-alpha.44",
|
|
26
|
+
"@dynamic-labs/types": "3.0.0-alpha.44",
|
|
27
|
+
"@dynamic-labs/utils": "3.0.0-alpha.44",
|
|
28
|
+
"@dynamic-labs/viem-utils": "3.0.0-alpha.44",
|
|
29
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.44",
|
|
30
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.44",
|
|
31
31
|
"eventemitter3": "5.0.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
package/src/index.cjs
CHANGED
|
@@ -65,6 +65,7 @@ require('@dynamic-labs/multi-wallet');
|
|
|
65
65
|
require('react-international-phone');
|
|
66
66
|
var mergeNetworks = require('./lib/utils/functions/mergeNetworks/mergeNetworks.cjs');
|
|
67
67
|
require('@dynamic-labs/store');
|
|
68
|
+
var isAuthenticatedWithAWallet = require('./lib/utils/functions/isAuthenticatedWithAWallet/isAuthenticatedWithAWallet.cjs');
|
|
68
69
|
require('./lib/locale/locale.cjs');
|
|
69
70
|
var useEmbeddedWallet = require('./lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs');
|
|
70
71
|
require('./lib/context/WalletContext/WalletContext.cjs');
|
|
@@ -206,6 +207,7 @@ exports.SpinnerIcon = spinner.ReactComponent;
|
|
|
206
207
|
exports.ArrowIcon = stroke.ReactComponent;
|
|
207
208
|
exports.apiClient = api.sdkApi;
|
|
208
209
|
exports.mergeNetworks = mergeNetworks.mergeNetworks;
|
|
210
|
+
exports.isAuthenticatedWithAWallet = isAuthenticatedWithAWallet.isAuthenticatedWithAWallet;
|
|
209
211
|
exports.useEmbeddedWallet = useEmbeddedWallet.useEmbeddedWallet;
|
|
210
212
|
exports.usePasskeyRecovery = usePasskeyRecovery.usePasskeyRecovery;
|
|
211
213
|
Object.defineProperty(exports, 'EmbeddedWalletVersion', {
|
package/src/index.d.ts
CHANGED
|
@@ -122,3 +122,4 @@ export { useSwitchNetwork } from './lib/utils/hooks/useSwitchNetwork';
|
|
|
122
122
|
export { useReinitialize } from './lib/context/ReinitializeContext';
|
|
123
123
|
export { useExternalAuth } from './lib/utils/hooks/useExternalAuth';
|
|
124
124
|
export { sdkApi as apiClient } from './lib/data/api/api';
|
|
125
|
+
export { isAuthenticatedWithAWallet } from './lib/utils/functions/isAuthenticatedWithAWallet';
|
package/src/index.js
CHANGED
|
@@ -61,6 +61,7 @@ import '@dynamic-labs/multi-wallet';
|
|
|
61
61
|
import 'react-international-phone';
|
|
62
62
|
export { mergeNetworks } from './lib/utils/functions/mergeNetworks/mergeNetworks.js';
|
|
63
63
|
import '@dynamic-labs/store';
|
|
64
|
+
export { isAuthenticatedWithAWallet } from './lib/utils/functions/isAuthenticatedWithAWallet/isAuthenticatedWithAWallet.js';
|
|
64
65
|
import './lib/locale/locale.js';
|
|
65
66
|
export { useEmbeddedWallet } from './lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js';
|
|
66
67
|
import './lib/context/WalletContext/WalletContext.js';
|
|
@@ -95,7 +95,7 @@ var useInternalDynamicContext = require('../../context/DynamicContext/useDynamic
|
|
|
95
95
|
|
|
96
96
|
const NeedHelpSection = ({ isRecoveryFlow = false }) => {
|
|
97
97
|
var _a, _b, _c, _d, _e, _f;
|
|
98
|
-
const { projectSettings,
|
|
98
|
+
const { projectSettings, primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
99
99
|
const { t } = reactI18next.useTranslation();
|
|
100
100
|
const { initPasskeyRecoveryProcess } = usePasskeyRecovery.usePasskeyRecovery();
|
|
101
101
|
const supportEmail = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _a === void 0 ? void 0 : _a.supportEmail;
|
|
@@ -105,6 +105,7 @@ const NeedHelpSection = ({ isRecoveryFlow = false }) => {
|
|
|
105
105
|
const isRecoveryEnabled = !isRecoveryFlow &&
|
|
106
106
|
((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _d === void 0 ? void 0 : _d.find((p) => p.provider === sdkApiCore.ProviderEnum.Turnkey && p.enabledAt)) &&
|
|
107
107
|
Boolean((_f = (_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _e === void 0 ? void 0 : _e.embeddedWallets) === null || _f === void 0 ? void 0 : _f.emailRecoveryEnabled);
|
|
108
|
+
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
108
109
|
const isSessionKeyCompatible = walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector) ||
|
|
109
110
|
((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev' &&
|
|
110
111
|
walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector.getEOAConnector()));
|
|
@@ -91,7 +91,7 @@ import { useInternalDynamicContext } from '../../context/DynamicContext/useDynam
|
|
|
91
91
|
|
|
92
92
|
const NeedHelpSection = ({ isRecoveryFlow = false }) => {
|
|
93
93
|
var _a, _b, _c, _d, _e, _f;
|
|
94
|
-
const { projectSettings,
|
|
94
|
+
const { projectSettings, primaryWallet } = useInternalDynamicContext();
|
|
95
95
|
const { t } = useTranslation();
|
|
96
96
|
const { initPasskeyRecoveryProcess } = usePasskeyRecovery();
|
|
97
97
|
const supportEmail = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) === null || _a === void 0 ? void 0 : _a.supportEmail;
|
|
@@ -101,6 +101,7 @@ const NeedHelpSection = ({ isRecoveryFlow = false }) => {
|
|
|
101
101
|
const isRecoveryEnabled = !isRecoveryFlow &&
|
|
102
102
|
((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _d === void 0 ? void 0 : _d.find((p) => p.provider === ProviderEnum.Turnkey && p.enabledAt)) &&
|
|
103
103
|
Boolean((_f = (_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _e === void 0 ? void 0 : _e.embeddedWallets) === null || _f === void 0 ? void 0 : _f.emailRecoveryEnabled);
|
|
104
|
+
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
104
105
|
const isSessionKeyCompatible = isSessionKeyCompatibleWalletConnector(walletConnector) ||
|
|
105
106
|
((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev' &&
|
|
106
107
|
isSessionKeyCompatibleWalletConnector(walletConnector.getEOAConnector()));
|
|
@@ -95,7 +95,8 @@ require('../../context/ReinitializeContext/ReinitializeContextProvider.cjs');
|
|
|
95
95
|
|
|
96
96
|
const SecureEmbeddedWalletCard = ({ className }) => {
|
|
97
97
|
const { t } = reactI18next.useTranslation();
|
|
98
|
-
const {
|
|
98
|
+
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
99
|
+
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
99
100
|
const { initPasskeyRecoveryProcess } = usePasskeyRecovery.usePasskeyRecovery();
|
|
100
101
|
const { showSecureAccountBanner, setShowSecureAccountBanner } = PasskeyContext.usePasskeyContext();
|
|
101
102
|
const isSessionKeyCompatible = walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector) ||
|
|
@@ -91,7 +91,8 @@ import '../../context/ReinitializeContext/ReinitializeContextProvider.js';
|
|
|
91
91
|
|
|
92
92
|
const SecureEmbeddedWalletCard = ({ className }) => {
|
|
93
93
|
const { t } = useTranslation();
|
|
94
|
-
const {
|
|
94
|
+
const { primaryWallet } = useInternalDynamicContext();
|
|
95
|
+
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
95
96
|
const { initPasskeyRecoveryProcess } = usePasskeyRecovery();
|
|
96
97
|
const { showSecureAccountBanner, setShowSecureAccountBanner } = usePasskeyContext();
|
|
97
98
|
const isSessionKeyCompatible = isSessionKeyCompatibleWalletConnector(walletConnector) ||
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs
CHANGED
|
@@ -114,7 +114,6 @@ const UserProfileSocialAccount = ({ provider, }) => {
|
|
|
114
114
|
: linkSocialAccount(provider), loading: isProcessing, dataTestId: `social-account-${isProviderLinked ? 'disconnect' : 'connect'}-button`, typographyProps: {
|
|
115
115
|
color: 'secondary',
|
|
116
116
|
variant: 'button_tertiary',
|
|
117
|
-
// weight: 'medium',
|
|
118
117
|
}, startSlot:
|
|
119
118
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
120
119
|
jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'small', children: isProviderLinked ? jsxRuntime.jsx(unlink.ReactComponent, {}) : jsxRuntime.jsx(add.ReactComponent, {}) }), children: isProviderLinked ? null : 'Connect' }));
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js
CHANGED
|
@@ -110,7 +110,6 @@ const UserProfileSocialAccount = ({ provider, }) => {
|
|
|
110
110
|
: linkSocialAccount(provider), loading: isProcessing, dataTestId: `social-account-${isProviderLinked ? 'disconnect' : 'connect'}-button`, typographyProps: {
|
|
111
111
|
color: 'secondary',
|
|
112
112
|
variant: 'button_tertiary',
|
|
113
|
-
// weight: 'medium',
|
|
114
113
|
}, startSlot:
|
|
115
114
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
116
115
|
jsx(Icon, { color: 'text-tertiary', size: 'small', children: isProviderLinked ? jsx(SvgUnlink, {}) : jsx(SvgAdd, {}) }), children: isProviderLinked ? null : 'Connect' }));
|
|
@@ -451,7 +451,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
451
451
|
]);
|
|
452
452
|
const { passkeySuccessPopup, setPasskeySuccessPopup } = usePasskeySuccessPopup.usePasskeySuccessPopup();
|
|
453
453
|
const value = React.useMemo(() => {
|
|
454
|
-
var _a
|
|
454
|
+
var _a;
|
|
455
455
|
return ({
|
|
456
456
|
accessDeniedButton,
|
|
457
457
|
accessDeniedMessagePrimary,
|
|
@@ -571,7 +571,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
571
571
|
toolkitEnabled,
|
|
572
572
|
user,
|
|
573
573
|
userWithMissingInfo,
|
|
574
|
-
walletConnector: (_b = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _b !== void 0 ? _b : null,
|
|
575
574
|
walletConnectorOptions,
|
|
576
575
|
walletUiUtils,
|
|
577
576
|
walletsFilter,
|
|
@@ -447,7 +447,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
447
447
|
]);
|
|
448
448
|
const { passkeySuccessPopup, setPasskeySuccessPopup } = usePasskeySuccessPopup();
|
|
449
449
|
const value = useMemo(() => {
|
|
450
|
-
var _a
|
|
450
|
+
var _a;
|
|
451
451
|
return ({
|
|
452
452
|
accessDeniedButton,
|
|
453
453
|
accessDeniedMessagePrimary,
|
|
@@ -567,7 +567,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
567
567
|
toolkitEnabled,
|
|
568
568
|
user,
|
|
569
569
|
userWithMissingInfo,
|
|
570
|
-
walletConnector: (_b = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) !== null && _b !== void 0 ? _b : null,
|
|
571
570
|
walletConnectorOptions,
|
|
572
571
|
walletUiUtils,
|
|
573
572
|
walletsFilter,
|
|
@@ -162,7 +162,6 @@ export interface IDynamicContext {
|
|
|
162
162
|
toolkitEnabled?: boolean;
|
|
163
163
|
user: UserProfile | undefined;
|
|
164
164
|
userWithMissingInfo: UserProfile | undefined;
|
|
165
|
-
walletConnector: WalletConnector | null;
|
|
166
165
|
walletConnectorOptions: WalletOption[];
|
|
167
166
|
walletUiUtils: WalletUiUtils<WalletConnector>;
|
|
168
167
|
walletsFilter?: (options: WalletOption[]) => WalletOption[];
|
|
@@ -17,6 +17,7 @@ require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
|
17
17
|
require('../../../shared/utils/classes/storage/sessionStorage.cjs');
|
|
18
18
|
require('@dynamic-labs/utils');
|
|
19
19
|
require('../../../shared/consts/index.cjs');
|
|
20
|
+
var isAuthenticatedWithAWallet = require('../../../utils/functions/isAuthenticatedWithAWallet/isAuthenticatedWithAWallet.cjs');
|
|
20
21
|
|
|
21
22
|
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate }, handleLogOut, primaryWallet, user, isAuthenticated, setHasLoggedOut, }) => {
|
|
22
23
|
const [callbackQueue, setCallbackQueue] = React.useState([]);
|
|
@@ -62,7 +63,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
|
|
|
62
63
|
// for the primary wallet state to be set
|
|
63
64
|
// if user logged in with email without embedded wallet, then
|
|
64
65
|
// there is no wallet so we can go ahead and run the callback
|
|
65
|
-
if (
|
|
66
|
+
if (isAuthenticatedWithAWallet.isAuthenticatedWithAWallet(user) && !primaryWallet) {
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
69
|
handleNextCallback(callbackQueue[0], user);
|
|
@@ -13,6 +13,7 @@ import '../../../shared/utils/classes/storage/localStorage.js';
|
|
|
13
13
|
import '../../../shared/utils/classes/storage/sessionStorage.js';
|
|
14
14
|
import '@dynamic-labs/utils';
|
|
15
15
|
import '../../../shared/consts/index.js';
|
|
16
|
+
import { isAuthenticatedWithAWallet } from '../../../utils/functions/isAuthenticatedWithAWallet/isAuthenticatedWithAWallet.js';
|
|
16
17
|
|
|
17
18
|
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate }, handleLogOut, primaryWallet, user, isAuthenticated, setHasLoggedOut, }) => {
|
|
18
19
|
const [callbackQueue, setCallbackQueue] = useState([]);
|
|
@@ -58,7 +59,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
|
|
|
58
59
|
// for the primary wallet state to be set
|
|
59
60
|
// if user logged in with email without embedded wallet, then
|
|
60
61
|
// there is no wallet so we can go ahead and run the callback
|
|
61
|
-
if (user
|
|
62
|
+
if (isAuthenticatedWithAWallet(user) && !primaryWallet) {
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
65
|
handleNextCallback(callbackQueue[0], user);
|
|
@@ -13,7 +13,7 @@ const useDynamicContext = () => {
|
|
|
13
13
|
if (context === undefined) {
|
|
14
14
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
15
15
|
}
|
|
16
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, userWithMissingInfo,
|
|
16
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, userWithMissingInfo, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, selectedTabIndex, setSelectedTabIndex, } = context;
|
|
17
17
|
const { setAuthMode } = useOverrides.useOverrides(context);
|
|
18
18
|
return {
|
|
19
19
|
accountSwitchState,
|
|
@@ -57,7 +57,6 @@ const useDynamicContext = () => {
|
|
|
57
57
|
showQrcodeModal,
|
|
58
58
|
user,
|
|
59
59
|
userWithMissingInfo,
|
|
60
|
-
walletConnector,
|
|
61
60
|
walletConnectorOptions,
|
|
62
61
|
};
|
|
63
62
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { IDynamicContext } from '../types';
|
|
3
|
-
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'userWithMissingInfo' | '
|
|
3
|
+
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'userWithMissingInfo' | 'walletConnectorOptions' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setAuthMode' | 'minAuthToken' | 'selectedTabIndex' | 'setSelectedTabIndex'> & {
|
|
4
4
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
5
5
|
};
|
|
6
6
|
export declare const useDynamicContext: () => UseDynamicContext;
|
|
@@ -9,7 +9,7 @@ const useDynamicContext = () => {
|
|
|
9
9
|
if (context === undefined) {
|
|
10
10
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
11
11
|
}
|
|
12
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, userWithMissingInfo,
|
|
12
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, userWithMissingInfo, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, selectedTabIndex, setSelectedTabIndex, } = context;
|
|
13
13
|
const { setAuthMode } = useOverrides(context);
|
|
14
14
|
return {
|
|
15
15
|
accountSwitchState,
|
|
@@ -53,7 +53,6 @@ const useDynamicContext = () => {
|
|
|
53
53
|
showQrcodeModal,
|
|
54
54
|
user,
|
|
55
55
|
userWithMissingInfo,
|
|
56
|
-
walletConnector,
|
|
57
56
|
walletConnectorOptions,
|
|
58
57
|
};
|
|
59
58
|
};
|
|
@@ -118,10 +118,11 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
118
118
|
const [show, setShow] = React.useState(true);
|
|
119
119
|
const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery.usePasskeyRecovery();
|
|
120
120
|
const { isTurnkeyWallet } = useIsTurnkeyWallet.useIsTurnkeyWallet();
|
|
121
|
-
const { setShowAuthFlow,
|
|
121
|
+
const { setShowAuthFlow, primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
122
122
|
const { setView } = ViewContext.useViewContext();
|
|
123
123
|
const { userNeedsCrossDomainPasskey } = PasskeyContext.usePasskeyContext();
|
|
124
124
|
const { t } = reactI18next.useTranslation();
|
|
125
|
+
const primaryConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
125
126
|
const handleOnReject = React.useCallback(() => {
|
|
126
127
|
didConfirmRef.current = false;
|
|
127
128
|
setShow(false);
|
|
@@ -157,15 +158,15 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
157
158
|
}, [signedMessage, onSignMessage, onReject, signMessageError]);
|
|
158
159
|
const handleMessageSign = (signWithoutModal) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
159
160
|
if ((yield shouldInitRecovery()) &&
|
|
160
|
-
|
|
161
|
-
!usingSessionKeys.usingSessionKey(
|
|
161
|
+
primaryConnector &&
|
|
162
|
+
!usingSessionKeys.usingSessionKey(primaryConnector)) {
|
|
162
163
|
yield initPasskeyRecoveryProcess('email', 'signMessage');
|
|
163
164
|
}
|
|
164
165
|
if (signWithoutModal === true) {
|
|
165
166
|
onSignMessage('callHandlerOutsideModal');
|
|
166
167
|
return;
|
|
167
168
|
}
|
|
168
|
-
if (
|
|
169
|
+
if (primaryConnector && usingSessionKeys.usingSessionKey(primaryConnector)) {
|
|
169
170
|
confirm();
|
|
170
171
|
return;
|
|
171
172
|
}
|
|
@@ -114,10 +114,11 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
114
114
|
const [show, setShow] = useState(true);
|
|
115
115
|
const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery();
|
|
116
116
|
const { isTurnkeyWallet } = useIsTurnkeyWallet();
|
|
117
|
-
const { setShowAuthFlow,
|
|
117
|
+
const { setShowAuthFlow, primaryWallet } = useInternalDynamicContext();
|
|
118
118
|
const { setView } = useViewContext();
|
|
119
119
|
const { userNeedsCrossDomainPasskey } = usePasskeyContext();
|
|
120
120
|
const { t } = useTranslation();
|
|
121
|
+
const primaryConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
121
122
|
const handleOnReject = useCallback(() => {
|
|
122
123
|
didConfirmRef.current = false;
|
|
123
124
|
setShow(false);
|
|
@@ -153,15 +154,15 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
153
154
|
}, [signedMessage, onSignMessage, onReject, signMessageError]);
|
|
154
155
|
const handleMessageSign = (signWithoutModal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
155
156
|
if ((yield shouldInitRecovery()) &&
|
|
156
|
-
|
|
157
|
-
!usingSessionKey(
|
|
157
|
+
primaryConnector &&
|
|
158
|
+
!usingSessionKey(primaryConnector)) {
|
|
158
159
|
yield initPasskeyRecoveryProcess('email', 'signMessage');
|
|
159
160
|
}
|
|
160
161
|
if (signWithoutModal === true) {
|
|
161
162
|
onSignMessage('callHandlerOutsideModal');
|
|
162
163
|
return;
|
|
163
164
|
}
|
|
164
|
-
if (
|
|
165
|
+
if (primaryConnector && usingSessionKey(primaryConnector)) {
|
|
165
166
|
confirm();
|
|
166
167
|
return;
|
|
167
168
|
}
|