@dynamic-labs/sdk-react-core 3.4.4 → 3.4.5
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 +12 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.cjs +4 -2
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.js +4 -2
- 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/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +6 -11
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +6 -11
- package/src/lib/utils/hooks/useDebounce/index.d.ts +1 -0
- package/src/lib/utils/hooks/useDebounce/useDebounce.cjs +22 -0
- package/src/lib/utils/hooks/useDebounce/useDebounce.d.ts +1 -0
- package/src/lib/utils/hooks/useDebounce/useDebounce.js +18 -0
- package/src/lib/utils/hooks/usePromise/usePromise.cjs +1 -1
- package/src/lib/utils/hooks/usePromise/usePromise.js +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +2 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +2 -0
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +5 -1
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +5 -1
- package/src/lib/views/MobileWalletRedirectView/MobileWalletRedirectView.cjs +6 -7
- package/src/lib/views/MobileWalletRedirectView/MobileWalletRedirectView.js +6 -7
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +1 -11
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +1 -11
|
@@ -66,3 +66,4 @@ export { useSyncMfaFlow } from './useSyncMfaFlow';
|
|
|
66
66
|
export * from './useSmartWallets';
|
|
67
67
|
export { useEmbeddedWalletSessionKeys } from './useEmbeddedWalletSessionKeys';
|
|
68
68
|
export { useTelegramLogin } from './useTelegramLogin';
|
|
69
|
+
export { useDebounce } from './useDebounce';
|
|
@@ -31,6 +31,7 @@ require('../../../locale/locale.cjs');
|
|
|
31
31
|
var getWalletProvider = require('../../functions/getWalletProvider/getWalletProvider.cjs');
|
|
32
32
|
var isConnectOnly = require('../authenticationHooks/helpers/isConnectOnly.cjs');
|
|
33
33
|
var getWalletConnectorForWallet = require('../../functions/getWalletConnectorForWallet/getWalletConnectorForWallet.cjs');
|
|
34
|
+
var useDebounce = require('../useDebounce/useDebounce.cjs');
|
|
34
35
|
var updateUserWalletsFromConnectedWallets = require('./updateUserWalletsFromConnectedWallets/updateUserWalletsFromConnectedWallets.cjs');
|
|
35
36
|
|
|
36
37
|
const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingOnConnectOnly, environmentId, primaryWalletId, setPrimaryWalletId, walletConnectorOptions, handleConnectedWallet, setShowAuthFlow, isBridgeFlow, user, }) => {
|
|
@@ -69,11 +70,10 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
69
70
|
setPrimaryWalletId,
|
|
70
71
|
]);
|
|
71
72
|
// The function to update and define the connectedWallets list.
|
|
72
|
-
// It
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
const updateConnectedWalletsList = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
// It should be called on the first render, when connectedWalletsInfo updates and when walletConnectorOptions updates.
|
|
74
|
+
// To avoid unnecessary updates that are causing issues with connectors added asynchronously,
|
|
75
|
+
// we're debouncing this function
|
|
76
|
+
const updateConnectedWalletsList = useDebounce.useDebounce(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
77
77
|
const walletConnectors = walletConnectorOptions.map((wallet) => wallet.walletConnector);
|
|
78
78
|
if (!walletConnectors.length) {
|
|
79
79
|
return;
|
|
@@ -110,12 +110,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
110
110
|
return walletObject;
|
|
111
111
|
})))).filter((wallet) => Boolean(wallet));
|
|
112
112
|
setConnectedWallets(updatedConnectedWallets);
|
|
113
|
-
}),
|
|
114
|
-
connectedWalletsInfo,
|
|
115
|
-
disconnectWallet,
|
|
116
|
-
setConnectedWallets,
|
|
117
|
-
walletConnectorOptions,
|
|
118
|
-
]);
|
|
113
|
+
}), 300);
|
|
119
114
|
// Generate the connectedWallets list when connectedWalletsInfo (localStorage) or memoized wallet connector updates
|
|
120
115
|
React.useEffect(() => {
|
|
121
116
|
updateConnectedWalletsList();
|
|
@@ -27,6 +27,7 @@ import '../../../locale/locale.js';
|
|
|
27
27
|
import { getWalletProvider } from '../../functions/getWalletProvider/getWalletProvider.js';
|
|
28
28
|
import { isConnectOnly } from '../authenticationHooks/helpers/isConnectOnly.js';
|
|
29
29
|
import { getWalletConnectorForWallet } from '../../functions/getWalletConnectorForWallet/getWalletConnectorForWallet.js';
|
|
30
|
+
import { useDebounce } from '../useDebounce/useDebounce.js';
|
|
30
31
|
import { updateUserWalletsFromConnectedWallets } from './updateUserWalletsFromConnectedWallets/updateUserWalletsFromConnectedWallets.js';
|
|
31
32
|
|
|
32
33
|
const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingOnConnectOnly, environmentId, primaryWalletId, setPrimaryWalletId, walletConnectorOptions, handleConnectedWallet, setShowAuthFlow, isBridgeFlow, user, }) => {
|
|
@@ -65,11 +66,10 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
65
66
|
setPrimaryWalletId,
|
|
66
67
|
]);
|
|
67
68
|
// The function to update and define the connectedWallets list.
|
|
68
|
-
// It
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
const updateConnectedWalletsList = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
+
// It should be called on the first render, when connectedWalletsInfo updates and when walletConnectorOptions updates.
|
|
70
|
+
// To avoid unnecessary updates that are causing issues with connectors added asynchronously,
|
|
71
|
+
// we're debouncing this function
|
|
72
|
+
const updateConnectedWalletsList = useDebounce(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
73
|
const walletConnectors = walletConnectorOptions.map((wallet) => wallet.walletConnector);
|
|
74
74
|
if (!walletConnectors.length) {
|
|
75
75
|
return;
|
|
@@ -106,12 +106,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
106
106
|
return walletObject;
|
|
107
107
|
})))).filter((wallet) => Boolean(wallet));
|
|
108
108
|
setConnectedWallets(updatedConnectedWallets);
|
|
109
|
-
}),
|
|
110
|
-
connectedWalletsInfo,
|
|
111
|
-
disconnectWallet,
|
|
112
|
-
setConnectedWallets,
|
|
113
|
-
walletConnectorOptions,
|
|
114
|
-
]);
|
|
109
|
+
}), 300);
|
|
115
110
|
// Generate the connectedWallets list when connectedWalletsInfo (localStorage) or memoized wallet connector updates
|
|
116
111
|
useEffect(() => {
|
|
117
112
|
updateConnectedWalletsList();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDebounce } from './useDebounce';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var React = require('react');
|
|
7
|
+
|
|
8
|
+
const useDebounce = (callback, timeout) => {
|
|
9
|
+
const timeoutId = React.useRef(null);
|
|
10
|
+
const callbackRef = React.useRef(callback);
|
|
11
|
+
callbackRef.current = callback;
|
|
12
|
+
return React.useCallback(((...params) => {
|
|
13
|
+
if (timeoutId.current) {
|
|
14
|
+
clearTimeout(timeoutId.current);
|
|
15
|
+
}
|
|
16
|
+
timeoutId.current = window.setTimeout(() => {
|
|
17
|
+
callbackRef.current(...params);
|
|
18
|
+
}, timeout);
|
|
19
|
+
}), [timeout]);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.useDebounce = useDebounce;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useDebounce: <C extends (...params: any[]) => void>(callback: C, timeout: number) => C;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { useRef, useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
const useDebounce = (callback, timeout) => {
|
|
5
|
+
const timeoutId = useRef(null);
|
|
6
|
+
const callbackRef = useRef(callback);
|
|
7
|
+
callbackRef.current = callback;
|
|
8
|
+
return useCallback(((...params) => {
|
|
9
|
+
if (timeoutId.current) {
|
|
10
|
+
clearTimeout(timeoutId.current);
|
|
11
|
+
}
|
|
12
|
+
timeoutId.current = window.setTimeout(() => {
|
|
13
|
+
callbackRef.current(...params);
|
|
14
|
+
}, timeout);
|
|
15
|
+
}), [timeout]);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useDebounce };
|
|
@@ -46,7 +46,7 @@ options) => {
|
|
|
46
46
|
const callTimestamp = new Date().getTime();
|
|
47
47
|
const diffFromLastCall = callTimestamp - lastCallTimestamp.current;
|
|
48
48
|
if (diffFromLastCall < 5) {
|
|
49
|
-
logger.logger.
|
|
49
|
+
logger.logger.logVerboseTroubleshootingMessage('usePromise: Fetcher function was called in very quick succession. Please make sure the fetcher function is not synchronous and that you are not calling it inside a loop.', deps);
|
|
50
50
|
}
|
|
51
51
|
lastCallTimestamp.current = callTimestamp;
|
|
52
52
|
setIsLoading(true);
|
|
@@ -42,7 +42,7 @@ options) => {
|
|
|
42
42
|
const callTimestamp = new Date().getTime();
|
|
43
43
|
const diffFromLastCall = callTimestamp - lastCallTimestamp.current;
|
|
44
44
|
if (diffFromLastCall < 5) {
|
|
45
|
-
logger.
|
|
45
|
+
logger.logVerboseTroubleshootingMessage('usePromise: Fetcher function was called in very quick succession. Please make sure the fetcher function is not synchronous and that you are not calling it inside a loop.', deps);
|
|
46
46
|
}
|
|
47
47
|
lastCallTimestamp.current = callTimestamp;
|
|
48
48
|
setIsLoading(true);
|
|
@@ -218,9 +218,13 @@ const useWalletItemActions = () => {
|
|
|
218
218
|
yield walletConnector.endSession();
|
|
219
219
|
}
|
|
220
220
|
setLegacyIsVerifying(false);
|
|
221
|
+
const isMetamask = walletConnector.key === 'metamask';
|
|
221
222
|
// in connect only we only allow one account to be connected in the same wallet
|
|
222
|
-
|
|
223
|
+
// also this is only a feature in MM
|
|
224
|
+
if (authMode !== 'connect-only' && isMetamask) {
|
|
223
225
|
try {
|
|
226
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
227
|
+
setView('pending-connect');
|
|
224
228
|
yield walletConnector.chooseAccountsToConnect();
|
|
225
229
|
}
|
|
226
230
|
catch (error) {
|
|
@@ -214,9 +214,13 @@ const useWalletItemActions = () => {
|
|
|
214
214
|
yield walletConnector.endSession();
|
|
215
215
|
}
|
|
216
216
|
setLegacyIsVerifying(false);
|
|
217
|
+
const isMetamask = walletConnector.key === 'metamask';
|
|
217
218
|
// in connect only we only allow one account to be connected in the same wallet
|
|
218
|
-
|
|
219
|
+
// also this is only a feature in MM
|
|
220
|
+
if (authMode !== 'connect-only' && isMetamask) {
|
|
219
221
|
try {
|
|
222
|
+
setSelectedWalletConnectorKey(walletConnector.key);
|
|
223
|
+
setView('pending-connect');
|
|
220
224
|
yield walletConnector.chooseAccountsToConnect();
|
|
221
225
|
}
|
|
222
226
|
catch (error) {
|
|
@@ -6,9 +6,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
|
-
var walletBook = require('@dynamic-labs/wallet-book');
|
|
10
9
|
var utils = require('@dynamic-labs/utils');
|
|
10
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
11
|
+
var Icon = require('../../components/Icon/Icon.cjs');
|
|
11
12
|
var IconWithSpinner = require('../../components/IconWithSpinner/IconWithSpinner.cjs');
|
|
13
|
+
var Typography = require('../../components/Typography/Typography.cjs');
|
|
14
|
+
var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
|
|
12
15
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
13
16
|
require('@dynamic-labs/sdk-api-core');
|
|
14
17
|
require('../../shared/logger.cjs');
|
|
@@ -16,7 +19,6 @@ require('@dynamic-labs/iconic');
|
|
|
16
19
|
require('@dynamic-labs/wallet-connector-core');
|
|
17
20
|
require('../../context/ViewContext/ViewContext.cjs');
|
|
18
21
|
var externalLink = require('../../shared/assets/externalLink.cjs');
|
|
19
|
-
var footerInfoIcon = require('../../shared/assets/footer-info-icon.cjs');
|
|
20
22
|
require('../../utils/constants/colors.cjs');
|
|
21
23
|
require('../../utils/constants/values.cjs');
|
|
22
24
|
require('../../store/state/loadingAndLifecycle.cjs');
|
|
@@ -52,10 +54,7 @@ require('@dynamic-labs/rpc-providers');
|
|
|
52
54
|
require('../../store/state/environmentId.cjs');
|
|
53
55
|
require('../../store/state/walletConnectorOptions.cjs');
|
|
54
56
|
require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
55
|
-
|
|
56
|
-
var Typography = require('../../components/Typography/Typography.cjs');
|
|
57
|
-
var Icon = require('../../components/Icon/Icon.cjs');
|
|
58
|
-
var TypographyButton = require('../../components/TypographyButton/TypographyButton.cjs');
|
|
57
|
+
require('../../components/Alert/Alert.cjs');
|
|
59
58
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
60
59
|
require('../../components/IconButton/IconButton.cjs');
|
|
61
60
|
require('../../components/InlineWidget/InlineWidget.cjs');
|
|
@@ -115,7 +114,7 @@ const MobileWalletRedirectView = ({ onRetry, }) => {
|
|
|
115
114
|
height: pixelToRem.pixelToRem(size),
|
|
116
115
|
width: pixelToRem.pixelToRem(size),
|
|
117
116
|
} }));
|
|
118
|
-
return (jsxRuntime.jsxs("div", { className: 'mobile-wallet-redirect', children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: makeIcon(94 * IconWithSpinner.iconRatio), iconSize: 94, isSpinning: true, className: 'mobile-wallet-redirect__icon-with-spinner' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', className: 'mobile-wallet-redirect__copy-text', copykey: 'dyn_login.mobile_wallet_redirect.prompt', children: t('dyn_login.mobile_wallet_redirect.prompt') }), jsxRuntime.jsxs(TypographyButton.TypographyButton, { buttonVariant: 'brand-primary', typographyProps: { color: 'white', variant: 'button_secondary' }, onClick: onRetry, buttonPadding: 'small', children: [t('dyn_login.mobile_wallet_redirect.open_prompt'), ' ', selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name] }), jsxRuntime.jsx(
|
|
117
|
+
return (jsxRuntime.jsxs("div", { className: 'mobile-wallet-redirect', children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: makeIcon(94 * IconWithSpinner.iconRatio), iconSize: 94, isSpinning: true, className: 'mobile-wallet-redirect__icon-with-spinner' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', className: 'mobile-wallet-redirect__copy-text', copykey: 'dyn_login.mobile_wallet_redirect.prompt', children: t('dyn_login.mobile_wallet_redirect.prompt') }), jsxRuntime.jsxs(TypographyButton.TypographyButton, { buttonVariant: 'brand-primary', typographyProps: { color: 'white', variant: 'button_secondary' }, onClick: onRetry, buttonPadding: 'small', children: [t('dyn_login.mobile_wallet_redirect.open_prompt'), ' ', selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', className: 'mobile-wallet-redirect__alert', children: t('dyn_login.mobile_wallet_redirect.redirect_fail_message', {
|
|
119
118
|
walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
120
119
|
}) }), storeName && (jsxRuntime.jsxs("div", { className: 'mobile-wallet-redirect__wallet-app', onClick: openWalletApp, children: [jsxRuntime.jsxs("div", { className: 'mobile-wallet-redirect__wallet-app__group', children: [makeIcon(26), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', weight: 'bold', children: [t('dyn_login.mobile_wallet_redirect.get_app_prompt'), ' ', selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name] })] }), jsxRuntime.jsxs("div", { className: 'mobile-wallet-redirect__wallet-app__group', children: [jsxRuntime.jsx(Typography.Typography, { className: 'mobile-wallet-redirect__wallet-app__group__app-store', variant: 'body_small', weight: 'bold', color: 'secondary', children: storeName }), jsxRuntime.jsx(Icon.Icon, { color: 'text-secondary', size: 'small', children: jsxRuntime.jsx(externalLink.ReactComponent, {}) })] })] }))] }));
|
|
121
120
|
};
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { useWalletBookContext, getWalletLinks, WalletIcon } from '@dynamic-labs/wallet-book';
|
|
6
5
|
import { isIOS, isAndroid, isSamsungBrowser } from '@dynamic-labs/utils';
|
|
6
|
+
import { useWalletBookContext, getWalletLinks, WalletIcon } from '@dynamic-labs/wallet-book';
|
|
7
|
+
import { Icon } from '../../components/Icon/Icon.js';
|
|
7
8
|
import { IconWithSpinner, iconRatio } from '../../components/IconWithSpinner/IconWithSpinner.js';
|
|
9
|
+
import { Typography } from '../../components/Typography/Typography.js';
|
|
10
|
+
import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
|
|
8
11
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
9
12
|
import '@dynamic-labs/sdk-api-core';
|
|
10
13
|
import '../../shared/logger.js';
|
|
@@ -12,7 +15,6 @@ import '@dynamic-labs/iconic';
|
|
|
12
15
|
import '@dynamic-labs/wallet-connector-core';
|
|
13
16
|
import '../../context/ViewContext/ViewContext.js';
|
|
14
17
|
import { ReactComponent as SvgExternalLink } from '../../shared/assets/externalLink.js';
|
|
15
|
-
import { ReactComponent as SvgFooterInfoIcon } from '../../shared/assets/footer-info-icon.js';
|
|
16
18
|
import '../../utils/constants/colors.js';
|
|
17
19
|
import '../../utils/constants/values.js';
|
|
18
20
|
import '../../store/state/loadingAndLifecycle.js';
|
|
@@ -48,10 +50,7 @@ import '@dynamic-labs/rpc-providers';
|
|
|
48
50
|
import '../../store/state/environmentId.js';
|
|
49
51
|
import '../../store/state/walletConnectorOptions.js';
|
|
50
52
|
import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
51
|
-
import
|
|
52
|
-
import { Typography } from '../../components/Typography/Typography.js';
|
|
53
|
-
import { Icon } from '../../components/Icon/Icon.js';
|
|
54
|
-
import { TypographyButton } from '../../components/TypographyButton/TypographyButton.js';
|
|
53
|
+
import '../../components/Alert/Alert.js';
|
|
55
54
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
56
55
|
import '../../components/IconButton/IconButton.js';
|
|
57
56
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
@@ -111,7 +110,7 @@ const MobileWalletRedirectView = ({ onRetry, }) => {
|
|
|
111
110
|
height: pixelToRem(size),
|
|
112
111
|
width: pixelToRem(size),
|
|
113
112
|
} }));
|
|
114
|
-
return (jsxs("div", { className: 'mobile-wallet-redirect', children: [jsx(IconWithSpinner, { Icon: makeIcon(94 * iconRatio), iconSize: 94, isSpinning: true, className: 'mobile-wallet-redirect__icon-with-spinner' }), jsx(Typography, { variant: 'body_normal', weight: 'regular', className: 'mobile-wallet-redirect__copy-text', copykey: 'dyn_login.mobile_wallet_redirect.prompt', children: t('dyn_login.mobile_wallet_redirect.prompt') }), jsxs(TypographyButton, { buttonVariant: 'brand-primary', typographyProps: { color: 'white', variant: 'button_secondary' }, onClick: onRetry, buttonPadding: 'small', children: [t('dyn_login.mobile_wallet_redirect.open_prompt'), ' ', selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name] }), jsx(
|
|
113
|
+
return (jsxs("div", { className: 'mobile-wallet-redirect', children: [jsx(IconWithSpinner, { Icon: makeIcon(94 * iconRatio), iconSize: 94, isSpinning: true, className: 'mobile-wallet-redirect__icon-with-spinner' }), jsx(Typography, { variant: 'body_normal', weight: 'regular', className: 'mobile-wallet-redirect__copy-text', copykey: 'dyn_login.mobile_wallet_redirect.prompt', children: t('dyn_login.mobile_wallet_redirect.prompt') }), jsxs(TypographyButton, { buttonVariant: 'brand-primary', typographyProps: { color: 'white', variant: 'button_secondary' }, onClick: onRetry, buttonPadding: 'small', children: [t('dyn_login.mobile_wallet_redirect.open_prompt'), ' ', selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name] }), jsx(Typography, { variant: 'body_small', color: 'secondary', className: 'mobile-wallet-redirect__alert', children: t('dyn_login.mobile_wallet_redirect.redirect_fail_message', {
|
|
115
114
|
walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
116
115
|
}) }), storeName && (jsxs("div", { className: 'mobile-wallet-redirect__wallet-app', onClick: openWalletApp, children: [jsxs("div", { className: 'mobile-wallet-redirect__wallet-app__group', children: [makeIcon(26), jsxs(Typography, { variant: 'body_small', weight: 'bold', children: [t('dyn_login.mobile_wallet_redirect.get_app_prompt'), ' ', selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name] })] }), jsxs("div", { className: 'mobile-wallet-redirect__wallet-app__group', children: [jsx(Typography, { className: 'mobile-wallet-redirect__wallet-app__group__app-store', variant: 'body_small', weight: 'bold', color: 'secondary', children: storeName }), jsx(Icon, { color: 'text-secondary', size: 'small', children: jsx(SvgExternalLink, {}) })] })] }))] }));
|
|
117
116
|
};
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs
CHANGED
|
@@ -84,17 +84,7 @@ var SandboxIndicatorWrapper = require('../../../components/SandboxIndicatorWrapp
|
|
|
84
84
|
|
|
85
85
|
const DynamicEmbeddedAuthFlow = ({ background = 'none', className, style, }) => {
|
|
86
86
|
const hide = useIsLoggedIn.useIsLoggedIn();
|
|
87
|
-
const { projectSettings, isRenderingEmbeddedAuthFlow
|
|
88
|
-
// This is needed to make sure WalletConnect is initialized for users who are using
|
|
89
|
-
// universal links on mobile. This also happens in useShowAuthFlow, but since this
|
|
90
|
-
// is the embedded auth flow, that hook does not get called.
|
|
91
|
-
// Without initializing WalletConnect here, users end up hitting the iOS app store bug
|
|
92
|
-
// and are redirected to the app store, instead of the wallet
|
|
93
|
-
React.useEffect(() => {
|
|
94
|
-
var _a;
|
|
95
|
-
(_a = walletConnectorOptions
|
|
96
|
-
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
97
|
-
}, [walletConnectorOptions]);
|
|
87
|
+
const { projectSettings, isRenderingEmbeddedAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
98
88
|
const { goToInitialView: resetAuthView } = ViewContext.useViewContext();
|
|
99
89
|
// Reset view when user logs out
|
|
100
90
|
React.useEffect(() => {
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js
CHANGED
|
@@ -80,17 +80,7 @@ import { SandboxIndicatorWrapper } from '../../../components/SandboxIndicatorWra
|
|
|
80
80
|
|
|
81
81
|
const DynamicEmbeddedAuthFlow = ({ background = 'none', className, style, }) => {
|
|
82
82
|
const hide = useIsLoggedIn();
|
|
83
|
-
const { projectSettings, isRenderingEmbeddedAuthFlow
|
|
84
|
-
// This is needed to make sure WalletConnect is initialized for users who are using
|
|
85
|
-
// universal links on mobile. This also happens in useShowAuthFlow, but since this
|
|
86
|
-
// is the embedded auth flow, that hook does not get called.
|
|
87
|
-
// Without initializing WalletConnect here, users end up hitting the iOS app store bug
|
|
88
|
-
// and are redirected to the app store, instead of the wallet
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
var _a;
|
|
91
|
-
(_a = walletConnectorOptions
|
|
92
|
-
.find((wallet) => wallet.walletConnector.key === 'walletconnect')) === null || _a === void 0 ? void 0 : _a.walletConnector.init();
|
|
93
|
-
}, [walletConnectorOptions]);
|
|
83
|
+
const { projectSettings, isRenderingEmbeddedAuthFlow } = useInternalDynamicContext();
|
|
94
84
|
const { goToInitialView: resetAuthView } = useViewContext();
|
|
95
85
|
// Reset view when user logs out
|
|
96
86
|
useEffect(() => {
|