@dynamic-labs/sdk-react-core 4.0.0-alpha.19 → 4.0.0-alpha.20
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 +2 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/context/DynamicContext/DynamicContext.cjs +0 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +0 -1
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.cjs +1 -7
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.d.ts +1 -3
- package/src/lib/context/DynamicContext/hooks/useShowAuthFlow/useShowAuthFlow.js +1 -7
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +1 -11
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +1 -11
package/CHANGELOG.md
CHANGED
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": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.20",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.559",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
"react-i18next": "13.5.0",
|
|
13
13
|
"yup": "0.32.11",
|
|
14
14
|
"react-international-phone": "4.2.5",
|
|
15
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
16
|
-
"@dynamic-labs/iconic": "4.0.0-alpha.
|
|
17
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
18
|
-
"@dynamic-labs/multi-wallet": "4.0.0-alpha.
|
|
19
|
-
"@dynamic-labs/rpc-providers": "4.0.0-alpha.
|
|
20
|
-
"@dynamic-labs/store": "4.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
15
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.20",
|
|
16
|
+
"@dynamic-labs/iconic": "4.0.0-alpha.20",
|
|
17
|
+
"@dynamic-labs/logger": "4.0.0-alpha.20",
|
|
18
|
+
"@dynamic-labs/multi-wallet": "4.0.0-alpha.20",
|
|
19
|
+
"@dynamic-labs/rpc-providers": "4.0.0-alpha.20",
|
|
20
|
+
"@dynamic-labs/store": "4.0.0-alpha.20",
|
|
21
|
+
"@dynamic-labs/types": "4.0.0-alpha.20",
|
|
22
|
+
"@dynamic-labs/utils": "4.0.0-alpha.20",
|
|
23
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.20",
|
|
24
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.20",
|
|
25
25
|
"eventemitter3": "5.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -279,7 +279,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
279
279
|
isMultiWalletEnabled: multiWallet,
|
|
280
280
|
isRenderingEmbeddedAuthFlow,
|
|
281
281
|
setShowDynamicUserProfile,
|
|
282
|
-
walletConnectorOptions: walletConnectorOptions$1,
|
|
283
282
|
});
|
|
284
283
|
const { connectWallet, removeConnectedWalletsInfo, connectedWalletsInfo, getConnectedWalletById, connectedWallets, disconnectWallet, refreshConnectedWallet, } = useConnectWallet.useConnectWallet({
|
|
285
284
|
authMode,
|
|
@@ -275,7 +275,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
275
275
|
isMultiWalletEnabled: multiWallet,
|
|
276
276
|
isRenderingEmbeddedAuthFlow,
|
|
277
277
|
setShowDynamicUserProfile,
|
|
278
|
-
walletConnectorOptions,
|
|
279
278
|
});
|
|
280
279
|
const { connectWallet, removeConnectedWalletsInfo, connectedWalletsInfo, getConnectedWalletById, connectedWallets, disconnectWallet, refreshConnectedWallet, } = useConnectWallet({
|
|
281
280
|
authMode,
|
|
@@ -25,11 +25,10 @@ var ErrorContext = require('../../../ErrorContext/ErrorContext.cjs');
|
|
|
25
25
|
* different scenarios and makes it especially easy to customize exactly which version of this method
|
|
26
26
|
* is being passed to useDynamicContext.
|
|
27
27
|
*/
|
|
28
|
-
const useShowAuthFlow = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMultiWalletEnabled,
|
|
28
|
+
const useShowAuthFlow = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMultiWalletEnabled, setShowDynamicUserProfile, }) => {
|
|
29
29
|
const [showAuthFlow, _setShowAuthFlow] = React.useState(false);
|
|
30
30
|
const { setError } = ErrorContext.useErrorContext();
|
|
31
31
|
const setShowAuthFlow = React.useCallback((value, options = {}) => {
|
|
32
|
-
var _a;
|
|
33
32
|
const { emitCancelAuth, ignoreIfIsEmbeddedWidget, initializeWalletConnect, performMultiWalletChecks, clearErrors, } = Object.assign({ clearErrors: true, emitCancelAuth: false, ignoreIfIsEmbeddedWidget: true, initializeWalletConnect: true, performMultiWalletChecks: false }, options);
|
|
34
33
|
logger.logger.logVerboseTroubleshootingMessage('setShowAuthFlow', {
|
|
35
34
|
clearErrors,
|
|
@@ -54,10 +53,6 @@ const useShowAuthFlow = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMulti
|
|
|
54
53
|
logger.logger.warn('Use setShowLinkNewWalletModal to render the wallet list instead. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext');
|
|
55
54
|
return;
|
|
56
55
|
}
|
|
57
|
-
if (initializeWalletConnect) {
|
|
58
|
-
(_a = walletConnectorOptions
|
|
59
|
-
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
60
|
-
}
|
|
61
56
|
}
|
|
62
57
|
else if (emitCancelAuth && showAuthFlow)
|
|
63
58
|
dynamicEvents.dynamicEvents.emit('authFlowCancelled');
|
|
@@ -71,7 +66,6 @@ const useShowAuthFlow = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMulti
|
|
|
71
66
|
setError,
|
|
72
67
|
setShowDynamicUserProfile,
|
|
73
68
|
showAuthFlow,
|
|
74
|
-
walletConnectorOptions,
|
|
75
69
|
]);
|
|
76
70
|
return [showAuthFlow, setShowAuthFlow];
|
|
77
71
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SetStateAction } from 'react';
|
|
2
|
-
import { WalletOption } from '../../../../shared';
|
|
3
2
|
import { IDynamicContext } from '../../types';
|
|
4
3
|
export type SetShowAuthFlowOptions = {
|
|
5
4
|
/**
|
|
@@ -28,7 +27,6 @@ export type SetShowAuthFlow = (value: SetStateAction<boolean>, options?: SetShow
|
|
|
28
27
|
export type UseShowAuthFlowParams = {
|
|
29
28
|
isMultiWalletEnabled: boolean;
|
|
30
29
|
isRenderingEmbeddedAuthFlow: IDynamicContext['isRenderingEmbeddedAuthFlow'];
|
|
31
|
-
walletConnectorOptions: WalletOption[];
|
|
32
30
|
isAuthenticated: boolean;
|
|
33
31
|
setShowDynamicUserProfile: IDynamicContext['setShowDynamicUserProfile'];
|
|
34
32
|
};
|
|
@@ -38,4 +36,4 @@ export type UseShowAuthFlowParams = {
|
|
|
38
36
|
* different scenarios and makes it especially easy to customize exactly which version of this method
|
|
39
37
|
* is being passed to useDynamicContext.
|
|
40
38
|
*/
|
|
41
|
-
export declare const useShowAuthFlow: ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMultiWalletEnabled,
|
|
39
|
+
export declare const useShowAuthFlow: ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMultiWalletEnabled, setShowDynamicUserProfile, }: UseShowAuthFlowParams) => [boolean, SetShowAuthFlow];
|
|
@@ -21,11 +21,10 @@ import { useErrorContext } from '../../../ErrorContext/ErrorContext.js';
|
|
|
21
21
|
* different scenarios and makes it especially easy to customize exactly which version of this method
|
|
22
22
|
* is being passed to useDynamicContext.
|
|
23
23
|
*/
|
|
24
|
-
const useShowAuthFlow = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMultiWalletEnabled,
|
|
24
|
+
const useShowAuthFlow = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMultiWalletEnabled, setShowDynamicUserProfile, }) => {
|
|
25
25
|
const [showAuthFlow, _setShowAuthFlow] = useState(false);
|
|
26
26
|
const { setError } = useErrorContext();
|
|
27
27
|
const setShowAuthFlow = useCallback((value, options = {}) => {
|
|
28
|
-
var _a;
|
|
29
28
|
const { emitCancelAuth, ignoreIfIsEmbeddedWidget, initializeWalletConnect, performMultiWalletChecks, clearErrors, } = Object.assign({ clearErrors: true, emitCancelAuth: false, ignoreIfIsEmbeddedWidget: true, initializeWalletConnect: true, performMultiWalletChecks: false }, options);
|
|
30
29
|
logger.logVerboseTroubleshootingMessage('setShowAuthFlow', {
|
|
31
30
|
clearErrors,
|
|
@@ -50,10 +49,6 @@ const useShowAuthFlow = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMulti
|
|
|
50
49
|
logger.warn('Use setShowLinkNewWalletModal to render the wallet list instead. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext');
|
|
51
50
|
return;
|
|
52
51
|
}
|
|
53
|
-
if (initializeWalletConnect) {
|
|
54
|
-
(_a = walletConnectorOptions
|
|
55
|
-
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
56
|
-
}
|
|
57
52
|
}
|
|
58
53
|
else if (emitCancelAuth && showAuthFlow)
|
|
59
54
|
dynamicEvents.emit('authFlowCancelled');
|
|
@@ -67,7 +62,6 @@ const useShowAuthFlow = ({ isAuthenticated, isRenderingEmbeddedAuthFlow, isMulti
|
|
|
67
62
|
setError,
|
|
68
63
|
setShowDynamicUserProfile,
|
|
69
64
|
showAuthFlow,
|
|
70
|
-
walletConnectorOptions,
|
|
71
65
|
]);
|
|
72
66
|
return [showAuthFlow, setShowAuthFlow];
|
|
73
67
|
};
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs
CHANGED
|
@@ -89,17 +89,7 @@ var SandboxIndicatorWrapper = require('../../../components/SandboxIndicatorWrapp
|
|
|
89
89
|
|
|
90
90
|
const DynamicEmbeddedAuthFlow = ({ background = 'none', className, style, }) => {
|
|
91
91
|
const hide = useIsLoggedIn.useIsLoggedIn();
|
|
92
|
-
const { projectSettings, isRenderingEmbeddedAuthFlow
|
|
93
|
-
// This is needed to make sure WalletConnect is initialized for users who are using
|
|
94
|
-
// universal links on mobile. This also happens in useShowAuthFlow, but since this
|
|
95
|
-
// is the embedded auth flow, that hook does not get called.
|
|
96
|
-
// Without initializing WalletConnect here, users end up hitting the iOS app store bug
|
|
97
|
-
// and are redirected to the app store, instead of the wallet
|
|
98
|
-
React.useEffect(() => {
|
|
99
|
-
var _a;
|
|
100
|
-
(_a = walletConnectorOptions
|
|
101
|
-
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
102
|
-
}, [walletConnectorOptions]);
|
|
92
|
+
const { projectSettings, isRenderingEmbeddedAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
103
93
|
const { goToInitialView: resetAuthView } = ViewContext.useViewContext();
|
|
104
94
|
// Reset view when user logs out
|
|
105
95
|
React.useEffect(() => {
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js
CHANGED
|
@@ -85,17 +85,7 @@ import { SandboxIndicatorWrapper } from '../../../components/SandboxIndicatorWra
|
|
|
85
85
|
|
|
86
86
|
const DynamicEmbeddedAuthFlow = ({ background = 'none', className, style, }) => {
|
|
87
87
|
const hide = useIsLoggedIn();
|
|
88
|
-
const { projectSettings, isRenderingEmbeddedAuthFlow
|
|
89
|
-
// This is needed to make sure WalletConnect is initialized for users who are using
|
|
90
|
-
// universal links on mobile. This also happens in useShowAuthFlow, but since this
|
|
91
|
-
// is the embedded auth flow, that hook does not get called.
|
|
92
|
-
// Without initializing WalletConnect here, users end up hitting the iOS app store bug
|
|
93
|
-
// and are redirected to the app store, instead of the wallet
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
var _a;
|
|
96
|
-
(_a = walletConnectorOptions
|
|
97
|
-
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
98
|
-
}, [walletConnectorOptions]);
|
|
88
|
+
const { projectSettings, isRenderingEmbeddedAuthFlow } = useInternalDynamicContext();
|
|
99
89
|
const { goToInitialView: resetAuthView } = useViewContext();
|
|
100
90
|
// Reset view when user logs out
|
|
101
91
|
useEffect(() => {
|