@dynamic-labs/sdk-react-core 0.18.0-RC.7 → 0.18.0-RC.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/index.cjs +2 -0
- package/src/index.js +1 -0
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +26 -1
- package/src/lib/components/NetworkPicker/NetworkPicker.js +26 -1
- package/src/lib/components/NetworkPicker/components/Network/Network.cjs +3 -1
- package/src/lib/components/NetworkPicker/components/Network/Network.d.ts +2 -1
- package/src/lib/components/NetworkPicker/components/Network/Network.js +3 -1
- package/src/lib/components/NetworkPicker/components/NetworkAction/NetworkAction.cjs +6 -1
- package/src/lib/components/NetworkPicker/components/NetworkAction/NetworkAction.d.ts +2 -1
- package/src/lib/components/NetworkPicker/components/NetworkAction/NetworkAction.js +6 -1
- package/src/lib/components/TosAndPp/TosAndPp.cjs +1 -1
- package/src/lib/components/TosAndPp/TosAndPp.js +1 -1
- package/src/lib/components/Transition/transition.type.d.ts +3 -3
- package/src/lib/context/DynamicContext/DynamicContext.cjs +20 -4
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +4 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +21 -5
- package/src/lib/context/ErrorContext/ErrorContext.cjs +6 -0
- package/src/lib/context/ErrorContext/ErrorContext.js +6 -0
- package/src/lib/shared/utils/hooks/index.d.ts +1 -0
- package/src/lib/shared/utils/hooks/useMediaQuery/index.d.ts +1 -0
- package/src/lib/shared/utils/hooks/useMediaQuery/useMediaQuery.cjs +31 -0
- package/src/lib/shared/utils/hooks/useMediaQuery/useMediaQuery.d.ts +1 -0
- package/src/lib/shared/utils/hooks/useMediaQuery/useMediaQuery.js +27 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +1 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +3 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +3 -1
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +13 -0
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +13 -0
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useColorSchemePreference/useColorSchemePreference.cjs +16 -18
- package/src/lib/utils/hooks/useColorSchemePreference/useColorSchemePreference.js +16 -18
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +20 -6
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +14 -2
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +20 -6
- package/src/lib/utils/hooks/useCountdown/useCountdown.cjs +39 -0
- package/src/lib/utils/hooks/useCountdown/useCountdown.d.ts +11 -0
- package/src/lib/utils/hooks/useCountdown/useCountdown.js +35 -0
- package/src/lib/utils/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs +10 -0
- package/src/lib/utils/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +6 -0
- package/src/lib/utils/hooks/useKeyboardEventListener/useKeyboardEventListener.cjs +6 -8
- package/src/lib/utils/hooks/useKeyboardEventListener/useKeyboardEventListener.js +7 -9
- package/src/lib/utils/hooks/useRpcProviders/useRpcProviders.cjs +6 -28
- package/src/lib/utils/hooks/useRpcProviders/useRpcProviders.d.ts +0 -1
- package/src/lib/utils/hooks/useRpcProviders/useRpcProviders.js +7 -29
- package/src/lib/utils/hooks/useTimeout/useTimeout.cjs +27 -0
- package/src/lib/utils/hooks/useTimeout/useTimeout.js +23 -0
- package/src/lib/utils/hooks/useTransition/useTransition.cjs +16 -24
- package/src/lib/utils/hooks/useTransition/useTransition.d.ts +3 -3
- package/src/lib/utils/hooks/useTransition/useTransition.js +17 -25
- package/src/lib/utils/hooks/useTransitionEvents/useTransitionEvents.cjs +11 -9
- package/src/lib/utils/hooks/useTransitionEvents/useTransitionEvents.js +11 -9
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +3 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +3 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +1 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +1 -0
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +4 -1
- package/src/lib/utils/hooks/useWallets/useWallets.d.ts +2 -1
- package/src/lib/utils/hooks/useWallets/useWallets.js +4 -1
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +2 -1
- package/src/lib/views/EmailUpdate/EmailUpdate.js +2 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +12 -21
- package/src/lib/views/EmailVerification/EmailVerification.js +13 -22
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +2 -1
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +2 -1
- package/src/lib/views/QrCodeView/QRCode.cjs +36 -4
- package/src/lib/views/QrCodeView/QRCode.js +37 -5
- package/src/lib/views/QrCodeView/QrCodeView.cjs +3 -6
- package/src/lib/views/QrCodeView/QrCodeView.js +3 -6
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs +15 -0
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.js +15 -0
- package/src/lib/views/WalletList/data.cjs +2 -1
- package/src/lib/views/WalletList/data.js +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __rest
|
|
1
|
+
import { __rest } from '../../../../../_virtual/_tslib.js';
|
|
2
2
|
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
3
3
|
import { animationFrameTimeout, clearAnimationFrameTimeout } from '../../functions/animationFrameTimeout/animationFrameTimeout.js';
|
|
4
4
|
import { useTransitionEvents } from '../useTransitionEvents/useTransitionEvents.js';
|
|
@@ -6,22 +6,22 @@ import { useTransitionEvents } from '../useTransitionEvents/useTransitionEvents.
|
|
|
6
6
|
const DEFAULT_DURATION = 100;
|
|
7
7
|
// The hook inspired by https://github.com/reactjs/react-transition-group/blob/master/src/Transition.js
|
|
8
8
|
const useTransition = (_a) => {
|
|
9
|
-
var { isShown, inDuration, outDuration, duration = DEFAULT_DURATION,
|
|
10
|
-
const
|
|
9
|
+
var { isShown, inDuration, outDuration, duration = DEFAULT_DURATION, delay, inDelay, outDelay, animateOnMount = true } = _a, events = __rest(_a, ["isShown", "inDuration", "outDuration", "duration", "delay", "inDelay", "outDelay", "animateOnMount"]);
|
|
10
|
+
const initialStage = animateOnMount ? 'UNMOUNT' : 'ENTERED';
|
|
11
11
|
const animationFrameTimeoutIdRef = useRef({ id: -1 });
|
|
12
12
|
const timeoutIdRef = useRef({ id: -1 });
|
|
13
|
-
const [stage, setStage] = useState(
|
|
13
|
+
const [stage, setStage] = useState(initialStage);
|
|
14
14
|
const [mount, setMount] = useState(!animateOnMount);
|
|
15
15
|
const [currentDuration, setCurrentDuration] = useState(duration);
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
timeoutIdRef.current = animationFrameTimeout(
|
|
16
|
+
const performTransition = (runTransition, transitionDelay) => {
|
|
17
|
+
if (transitionDelay) {
|
|
18
|
+
timeoutIdRef.current = animationFrameTimeout(runTransition, transitionDelay);
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
|
|
21
|
+
runTransition();
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
const performEnter = useCallback(() =>
|
|
24
|
+
const performEnter = useCallback(() => {
|
|
25
25
|
const animationDuration = inDuration || duration;
|
|
26
26
|
setCurrentDuration(animationDuration);
|
|
27
27
|
setMount(true);
|
|
@@ -29,8 +29,8 @@ const useTransition = (_a) => {
|
|
|
29
29
|
animationFrameTimeoutIdRef.current = animationFrameTimeout(() => {
|
|
30
30
|
setStage('ENTERED');
|
|
31
31
|
}, animationDuration);
|
|
32
|
-
}
|
|
33
|
-
const performExit = useCallback(() =>
|
|
32
|
+
}, [duration, inDuration]);
|
|
33
|
+
const performExit = useCallback(() => {
|
|
34
34
|
const animationDuration = outDuration || duration;
|
|
35
35
|
setCurrentDuration(animationDuration);
|
|
36
36
|
setStage('EXITING');
|
|
@@ -38,29 +38,21 @@ const useTransition = (_a) => {
|
|
|
38
38
|
setMount(false);
|
|
39
39
|
setStage('UNMOUNT');
|
|
40
40
|
}, animationDuration);
|
|
41
|
-
}
|
|
41
|
+
}, [duration, outDuration]);
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
if (isShown && stage !== 'ENTERED') {
|
|
44
|
-
const
|
|
45
|
-
|
|
44
|
+
const enterDelay = inDelay || delay;
|
|
45
|
+
performTransition(performEnter, enterDelay);
|
|
46
46
|
}
|
|
47
47
|
else if (!isShown && stage !== 'UNMOUNT') {
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const exitDelay = outDelay || delay;
|
|
49
|
+
performTransition(performExit, exitDelay);
|
|
50
50
|
}
|
|
51
51
|
return () => {
|
|
52
52
|
clearAnimationFrameTimeout(animationFrameTimeoutIdRef.current);
|
|
53
53
|
clearAnimationFrameTimeout(timeoutIdRef.current);
|
|
54
54
|
};
|
|
55
|
-
}, [
|
|
56
|
-
inTimeout,
|
|
57
|
-
outTimeout,
|
|
58
|
-
performEnter,
|
|
59
|
-
performExit,
|
|
60
|
-
isShown,
|
|
61
|
-
timeout,
|
|
62
|
-
stage,
|
|
63
|
-
]);
|
|
55
|
+
}, [inDelay, outDelay, performEnter, performExit, isShown, delay, stage]);
|
|
64
56
|
useTransitionEvents(stage, events);
|
|
65
57
|
return { currentDuration, mount, stage };
|
|
66
58
|
};
|
|
@@ -4,21 +4,23 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var useUpdateEffect = require('../useUpdateEffect/useUpdateEffect.cjs');
|
|
6
6
|
|
|
7
|
-
const useTransitionEvents = (stage, events) =>
|
|
8
|
-
var _a;
|
|
7
|
+
const useTransitionEvents = (stage, events) => {
|
|
9
8
|
const mapCallbackToStage = {
|
|
10
9
|
ENTERED: events === null || events === void 0 ? void 0 : events.onEntered,
|
|
11
10
|
ENTERING: events === null || events === void 0 ? void 0 : events.onEntering,
|
|
12
11
|
EXITING: events === null || events === void 0 ? void 0 : events.onExiting,
|
|
13
12
|
UNMOUNT: events === null || events === void 0 ? void 0 : events.onUnmount,
|
|
14
13
|
};
|
|
15
|
-
(
|
|
16
|
-
return () => {
|
|
14
|
+
return useUpdateEffect.useUpdateEffect(() => {
|
|
17
15
|
var _a;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
(_a = mapCallbackToStage[stage]) === null || _a === void 0 ? void 0 : _a.call(mapCallbackToStage);
|
|
17
|
+
return () => {
|
|
18
|
+
var _a;
|
|
19
|
+
if (stage === 'EXITING') {
|
|
20
|
+
(_a = mapCallbackToStage.UNMOUNT) === null || _a === void 0 ? void 0 : _a.call(mapCallbackToStage);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}, [stage]);
|
|
24
|
+
};
|
|
23
25
|
|
|
24
26
|
exports.useTransitionEvents = useTransitionEvents;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { useUpdateEffect } from '../useUpdateEffect/useUpdateEffect.js';
|
|
2
2
|
|
|
3
|
-
const useTransitionEvents = (stage, events) =>
|
|
4
|
-
var _a;
|
|
3
|
+
const useTransitionEvents = (stage, events) => {
|
|
5
4
|
const mapCallbackToStage = {
|
|
6
5
|
ENTERED: events === null || events === void 0 ? void 0 : events.onEntered,
|
|
7
6
|
ENTERING: events === null || events === void 0 ? void 0 : events.onEntering,
|
|
8
7
|
EXITING: events === null || events === void 0 ? void 0 : events.onExiting,
|
|
9
8
|
UNMOUNT: events === null || events === void 0 ? void 0 : events.onUnmount,
|
|
10
9
|
};
|
|
11
|
-
(
|
|
12
|
-
return () => {
|
|
10
|
+
return useUpdateEffect(() => {
|
|
13
11
|
var _a;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
(_a = mapCallbackToStage[stage]) === null || _a === void 0 ? void 0 : _a.call(mapCallbackToStage);
|
|
13
|
+
return () => {
|
|
14
|
+
var _a;
|
|
15
|
+
if (stage === 'EXITING') {
|
|
16
|
+
(_a = mapCallbackToStage.UNMOUNT) === null || _a === void 0 ? void 0 : _a.call(mapCallbackToStage);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}, [stage]);
|
|
20
|
+
};
|
|
19
21
|
|
|
20
22
|
export { useTransitionEvents };
|
|
@@ -38,7 +38,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
38
38
|
const { setDeniedAddress, setDeniedOauthProvider } = AccessDeniedContext.useAccessDeniedContext();
|
|
39
39
|
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
40
40
|
const { setErrorMessage, setError } = ErrorContext.useErrorContext();
|
|
41
|
-
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
41
|
+
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, removeConnectedWalletsInfo, setConnectedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
42
42
|
// If the user is not already logged it means that we only need to verify
|
|
43
43
|
// We need this boolean for the part of the logic where we already persisted a new authToken,
|
|
44
44
|
// and need to distinguish between logic for verify or linking.
|
|
@@ -91,6 +91,8 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
const handleError = (e, walletConnector, address, oauth) => {
|
|
94
|
+
removeConnectedWalletsInfo();
|
|
95
|
+
setConnectedWallets([]);
|
|
94
96
|
// This is a special case where the user is trying to link a wallet
|
|
95
97
|
// and the wallet is already linked and we don't want to kill the session.
|
|
96
98
|
if (e instanceof utils.WalletUsedError) {
|
|
@@ -34,7 +34,7 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
34
34
|
const { setDeniedAddress, setDeniedOauthProvider } = useAccessDeniedContext();
|
|
35
35
|
const { setView, goToInitialView } = useViewContext();
|
|
36
36
|
const { setErrorMessage, setError } = useErrorContext();
|
|
37
|
-
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, } = useInternalDynamicContext();
|
|
37
|
+
const { setUser, multiWalletWidgetState, debugError, multiWallet: multiWalletEnabled, appName, primaryWalletId, setCallback, setShowAuthFlow, setPrimaryWalletId, siweStatement, connectedWallet, authMode, setOnboardingOnlyJwt, authToken, setAuthMode, removeConnectedWalletsInfo, setConnectedWallets, } = useInternalDynamicContext();
|
|
38
38
|
// If the user is not already logged it means that we only need to verify
|
|
39
39
|
// We need this boolean for the part of the logic where we already persisted a new authToken,
|
|
40
40
|
// and need to distinguish between logic for verify or linking.
|
|
@@ -87,6 +87,8 @@ const useVerifyWallet = ({ consumeNonce, displayTermsOfService, environmentId, p
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
const handleError = (e, walletConnector, address, oauth) => {
|
|
90
|
+
removeConnectedWalletsInfo();
|
|
91
|
+
setConnectedWallets([]);
|
|
90
92
|
// This is a special case where the user is trying to link a wallet
|
|
91
93
|
// and the wallet is already linked and we don't want to kill the session.
|
|
92
94
|
if (e instanceof WalletUsedError) {
|
|
@@ -62,6 +62,7 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
62
62
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
63
|
orderedSecondaryWalletAddresses(secondaryWallets).join(),
|
|
64
64
|
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
65
|
+
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.isInitialized,
|
|
65
66
|
]);
|
|
66
67
|
const handleAccountChangeWhenAwaitingAccountSwitch = React.useCallback((isPrimaryWallet, newAddress) => {
|
|
67
68
|
const linkedSecondaryWallet = secondaryWallets.find((wallet) => walletConnectorCore.isSameAddress(wallet.address, newAddress, wallet.chain));
|
|
@@ -58,6 +58,7 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
58
58
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
59
|
orderedSecondaryWalletAddresses(secondaryWallets).join(),
|
|
60
60
|
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
61
|
+
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.isInitialized,
|
|
61
62
|
]);
|
|
62
63
|
const handleAccountChangeWhenAwaitingAccountSwitch = useCallback((isPrimaryWallet, newAddress) => {
|
|
63
64
|
const linkedSecondaryWallet = secondaryWallets.find((wallet) => isSameAddress(wallet.address, newAddress, wallet.chain));
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var data = require('../../../views/WalletList/data.cjs');
|
|
7
7
|
|
|
8
|
-
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, }) => {
|
|
8
|
+
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }) => {
|
|
9
9
|
const wallets = React.useMemo(() => {
|
|
10
10
|
if (!projectSettings || !Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length)
|
|
11
11
|
return [];
|
|
@@ -17,6 +17,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
17
17
|
networkConfigurations,
|
|
18
18
|
skipMemo: true,
|
|
19
19
|
walletBook,
|
|
20
|
+
walletConnectV1Bridge,
|
|
20
21
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
21
22
|
walletUiUtils,
|
|
22
23
|
});
|
|
@@ -28,6 +29,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
28
29
|
networkConfigurations,
|
|
29
30
|
skipMemo: true,
|
|
30
31
|
walletBook,
|
|
32
|
+
walletConnectV1Bridge,
|
|
31
33
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
32
34
|
walletUiUtils,
|
|
33
35
|
});
|
|
@@ -39,6 +41,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
39
41
|
networkConfigurations,
|
|
40
42
|
projectSettings,
|
|
41
43
|
walletConnectorsProp,
|
|
44
|
+
walletConnectV1Bridge,
|
|
42
45
|
flowNetwork,
|
|
43
46
|
Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length,
|
|
44
47
|
]);
|
|
@@ -9,10 +9,11 @@ type Props = {
|
|
|
9
9
|
networkConfigurations: NetworkConfigurationMap | undefined;
|
|
10
10
|
projectSettings: ProjectSettings | undefined;
|
|
11
11
|
walletBook: WalletBookSchema;
|
|
12
|
+
walletConnectV1Bridge?: string;
|
|
12
13
|
walletConnectorsProp?: WalletConnectorsMethod[];
|
|
13
14
|
walletUiUtils: WalletUiUtils;
|
|
14
15
|
};
|
|
15
|
-
export declare const useWallets: ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, }: Props) => {
|
|
16
|
+
export declare const useWallets: ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }: Props) => {
|
|
16
17
|
wallets: import("../../../shared").WalletOption[];
|
|
17
18
|
};
|
|
18
19
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { getInstalledWallets, getNotInstalledWallets } from '../../../views/WalletList/data.js';
|
|
3
3
|
|
|
4
|
-
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletUiUtils, walletConnectorsProp, }) => {
|
|
4
|
+
const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, networkConfigurations, walletBook, walletConnectV1Bridge, walletUiUtils, walletConnectorsProp, }) => {
|
|
5
5
|
const wallets = useMemo(() => {
|
|
6
6
|
if (!projectSettings || !Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length)
|
|
7
7
|
return [];
|
|
@@ -13,6 +13,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
13
13
|
networkConfigurations,
|
|
14
14
|
skipMemo: true,
|
|
15
15
|
walletBook,
|
|
16
|
+
walletConnectV1Bridge,
|
|
16
17
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
17
18
|
walletUiUtils,
|
|
18
19
|
});
|
|
@@ -24,6 +25,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
24
25
|
networkConfigurations,
|
|
25
26
|
skipMemo: true,
|
|
26
27
|
walletBook,
|
|
28
|
+
walletConnectV1Bridge,
|
|
27
29
|
walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [],
|
|
28
30
|
walletUiUtils,
|
|
29
31
|
});
|
|
@@ -35,6 +37,7 @@ const useWallets = ({ projectSettings, appLogoUrl, appName, flowNetwork, network
|
|
|
35
37
|
networkConfigurations,
|
|
36
38
|
projectSettings,
|
|
37
39
|
walletConnectorsProp,
|
|
40
|
+
walletConnectV1Bridge,
|
|
38
41
|
flowNetwork,
|
|
39
42
|
Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length,
|
|
40
43
|
]);
|
|
@@ -8,7 +8,7 @@ var React = require('react');
|
|
|
8
8
|
var iconic = require('@dynamic-labs/iconic');
|
|
9
9
|
var Typography = require('../../components/Typography/Typography.cjs');
|
|
10
10
|
require('@dynamic-labs/sdk-api');
|
|
11
|
-
require('../../shared/logger.cjs');
|
|
11
|
+
var logger = require('../../shared/logger.cjs');
|
|
12
12
|
require('@dynamic-labs/wallet-connector-core');
|
|
13
13
|
var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
var chevronLeft = require('../../shared/assets/chevron-left.cjs');
|
|
@@ -76,6 +76,7 @@ const EmailUpdate = () => {
|
|
|
76
76
|
setVerificationUUID(emailVerification.verificationUUID);
|
|
77
77
|
}
|
|
78
78
|
catch (error) {
|
|
79
|
+
logger.logger.debug(error);
|
|
79
80
|
setErrorMessage(error.code);
|
|
80
81
|
}
|
|
81
82
|
finally {
|
|
@@ -4,7 +4,7 @@ import { useState } from 'react';
|
|
|
4
4
|
import { SignInWithEmailIcon } from '@dynamic-labs/iconic';
|
|
5
5
|
import { Typography } from '../../components/Typography/Typography.js';
|
|
6
6
|
import '@dynamic-labs/sdk-api';
|
|
7
|
-
import '../../shared/logger.js';
|
|
7
|
+
import { logger } from '../../shared/logger.js';
|
|
8
8
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
9
|
import { useViewContext } from '../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import { ReactComponent as SvgChevronLeft } from '../../shared/assets/chevron-left.js';
|
|
@@ -72,6 +72,7 @@ const EmailUpdate = () => {
|
|
|
72
72
|
setVerificationUUID(emailVerification.verificationUUID);
|
|
73
73
|
}
|
|
74
74
|
catch (error) {
|
|
75
|
+
logger.debug(error);
|
|
75
76
|
setErrorMessage(error.code);
|
|
76
77
|
}
|
|
77
78
|
finally {
|
|
@@ -13,7 +13,7 @@ require('@dynamic-labs/wallet-connector-core');
|
|
|
13
13
|
var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
var check = require('../../shared/assets/check.cjs');
|
|
15
15
|
var checkCircle = require('../../shared/assets/check-circle.cjs');
|
|
16
|
-
require('../../shared/logger.cjs');
|
|
16
|
+
var logger = require('../../shared/logger.cjs');
|
|
17
17
|
require('@dynamic-labs/wallet-book');
|
|
18
18
|
require('../../utils/constants/colors.cjs');
|
|
19
19
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
@@ -44,6 +44,7 @@ require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/Secondar
|
|
|
44
44
|
require('../../context/MockContext/MockContext.cjs');
|
|
45
45
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
46
46
|
require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
47
|
+
var useCountdown = require('../../utils/hooks/useCountdown/useCountdown.cjs');
|
|
47
48
|
var TextButton = require('../../components/TextButton/TextButton.cjs');
|
|
48
49
|
var ErrorContainer = require('../../components/ErrorContainer/ErrorContainer.cjs');
|
|
49
50
|
var PinField = require('../../components/PinField/PinField.cjs');
|
|
@@ -57,10 +58,9 @@ var LoadingContext = require('../../context/LoadingContext/LoadingContext.cjs');
|
|
|
57
58
|
var useEmailVerificationRequest = require('../../utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs');
|
|
58
59
|
var useCreateUserProfileByJWTCallback = require('../../utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.cjs');
|
|
59
60
|
|
|
60
|
-
const
|
|
61
|
+
const SECONDS_TO_RETRY = 15;
|
|
61
62
|
const EmailVerification = () => {
|
|
62
63
|
const [hideRetryButton, setHideRetryButton] = React.useState(false);
|
|
63
|
-
const [count, setCount] = React.useState(secondsToRetry);
|
|
64
64
|
const [retried, setRetried] = React.useState(false);
|
|
65
65
|
const [isValidated, setIsValidated] = React.useState(false);
|
|
66
66
|
const [showTransferMessage, setShowTransferMessage] = React.useState(false);
|
|
@@ -69,6 +69,10 @@ const EmailVerification = () => {
|
|
|
69
69
|
const { environmentId, onboardingOnlyJwt, handleLogOut, authToken, setOnboardingOnlyJwt, setShowAuthFlow, setCallback, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
70
70
|
const { email, verificationUUID, setVerificationUUID } = EmailVerificationContext.useEmailVerificationContext();
|
|
71
71
|
const { loading, setLoading } = LoadingContext.useLoadingContext();
|
|
72
|
+
const { remainingSeconds, startCountdown } = useCountdown.useCountdown({
|
|
73
|
+
callback: () => setRetried(false),
|
|
74
|
+
seconds: SECONDS_TO_RETRY,
|
|
75
|
+
});
|
|
72
76
|
const isLoginView = view === 'login-with-email-verification';
|
|
73
77
|
const { verifyEmail } = useEmailVerificationRequest.useEmailVerificationRequest();
|
|
74
78
|
const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback.useCreateUserProfileByJWTCallback();
|
|
@@ -93,6 +97,7 @@ const EmailVerification = () => {
|
|
|
93
97
|
setShowAuthFlow(false);
|
|
94
98
|
}
|
|
95
99
|
catch (error) {
|
|
100
|
+
logger.logger.debug(error);
|
|
96
101
|
setErrorMessage(error.code);
|
|
97
102
|
}
|
|
98
103
|
finally {
|
|
@@ -151,6 +156,7 @@ const EmailVerification = () => {
|
|
|
151
156
|
if (error instanceof utils.NoAccessError) {
|
|
152
157
|
setView('no-access');
|
|
153
158
|
}
|
|
159
|
+
logger.logger.debug(error);
|
|
154
160
|
setErrorMessage(error.code);
|
|
155
161
|
}
|
|
156
162
|
finally {
|
|
@@ -183,9 +189,11 @@ const EmailVerification = () => {
|
|
|
183
189
|
});
|
|
184
190
|
setVerificationUUID(newVerificationUUID);
|
|
185
191
|
setRetried(true);
|
|
192
|
+
startCountdown();
|
|
186
193
|
setError(undefined);
|
|
187
194
|
}
|
|
188
195
|
catch (error) {
|
|
196
|
+
logger.logger.debug(error);
|
|
189
197
|
setErrorMessage(error.code);
|
|
190
198
|
if (error.code === 'too_many_email_verification_attempts') {
|
|
191
199
|
setHideRetryButton(true);
|
|
@@ -198,26 +206,9 @@ const EmailVerification = () => {
|
|
|
198
206
|
setLoading(false);
|
|
199
207
|
}
|
|
200
208
|
});
|
|
201
|
-
React.useEffect(() => {
|
|
202
|
-
/* istanbul ignore next */
|
|
203
|
-
setCount(secondsToRetry);
|
|
204
|
-
const timeout = setTimeout(() => {
|
|
205
|
-
if (retried)
|
|
206
|
-
setRetried(false);
|
|
207
|
-
}, secondsToRetry * 1000);
|
|
208
|
-
return () => clearTimeout(timeout);
|
|
209
|
-
}, [retried]);
|
|
210
|
-
React.useEffect(() => {
|
|
211
|
-
/* istanbul ignore next */
|
|
212
|
-
const timeout = setTimeout(() => {
|
|
213
|
-
if (count)
|
|
214
|
-
setCount((prev) => prev - 1);
|
|
215
|
-
}, 1000);
|
|
216
|
-
return () => clearTimeout(timeout);
|
|
217
|
-
}, [count]);
|
|
218
209
|
return (jsxRuntime.jsxs("div", Object.assign({ className: 'email-verification__container' }, { children: [error && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, Object.assign({ withIcon: false, className: 'email-verification__error-message' }, { children: error }))), showTransferMessage && (jsxRuntime.jsx("div", Object.assign({ className: 'email-verification__transfer-message' }, { children: "Verification complete, the email is now verified to this account." }))), isValidated ? (jsxRuntime.jsx("div", Object.assign({ className: 'email-verification__icon-container' }, { children: jsxRuntime.jsx(IconWithStatus.IconWithStatus, { containerClassName: 'email-verification__icon--verified', Icon: iconic.SignInWithEmailIcon, iconSize: 50, InnerIcon: check.ReactComponent }) }))) : (jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { className: classNames.classNames({
|
|
219
210
|
'email-verification__icon-with-spinner': Boolean(!error),
|
|
220
|
-
}), Icon: iconic.SignInWithEmailIcon, iconSize: 80, isSpinning: true })), jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'title', className: 'email-verification__title', color: 'primary' }, { children: "Confirm verification code" })), jsxRuntime.jsxs("div", Object.assign({ className: 'email-verification__copy-text-container' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary' }, { children: "We\u2019ve sent a verification code to" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'bold', color: 'secondary' }, { children: shortenEmail.shortenEmail(email) }))] })), !isLoginView && (jsxRuntime.jsx(TextButton.TextButton, Object.assign({ onClick: () => setView('update-email'), className: 'email-verification__text-button', disabled: loading }, { children: "Edit email" }))), jsxRuntime.jsx(PinField.PinField, { initialValue: Array(6).join('.').split('.'), isLoading: loading, handleComplete: isLoginView ? handleEmailLogin : handleComplete, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), retried ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'body_small', color: 'secondary' }, { children: ["Re-send code in ",
|
|
211
|
+
}), Icon: iconic.SignInWithEmailIcon, iconSize: 80, isSpinning: true })), jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'title', className: 'email-verification__title', color: 'primary' }, { children: "Confirm verification code" })), jsxRuntime.jsxs("div", Object.assign({ className: 'email-verification__copy-text-container' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary' }, { children: "We\u2019ve sent a verification code to" })), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'bold', color: 'secondary' }, { children: shortenEmail.shortenEmail(email) }))] })), !isLoginView && (jsxRuntime.jsx(TextButton.TextButton, Object.assign({ onClick: () => setView('update-email'), className: 'email-verification__text-button', disabled: loading }, { children: "Edit email" }))), jsxRuntime.jsx(PinField.PinField, { initialValue: Array(6).join('.').split('.'), isLoading: loading, handleComplete: isLoginView ? handleEmailLogin : handleComplete, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), retried ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'body_small', color: 'secondary' }, { children: ["Re-send code in ", remainingSeconds] })), jsxRuntime.jsxs("span", Object.assign({ className: 'email-verification__retry-container' }, { children: [jsxRuntime.jsx(checkCircle.ReactComponent, {}), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_small', weight: 'medium', color: 'primary', className: 'email-verification__retry-container-text' }, { children: "Code sent" }))] }))] })) : (!hideRetryButton && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_small', weight: 'medium', color: 'secondary' }, { children: "Did not receive your code yet?" })), jsxRuntime.jsx(TextButton.TextButton, Object.assign({ className: 'email-verification__text-button', disabled: loading || isValidated, onClick: () => handleRetry() }, { children: "Re-send code" }))] }))), !isLoginView && (jsxRuntime.jsx(TextButton.TextButton, Object.assign({ className: 'email-verification__log-out', onClick: () => handleLogOut() }, { children: "Log out" }))), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, {})] })));
|
|
221
212
|
};
|
|
222
213
|
|
|
223
214
|
exports.EmailVerification = EmailVerification;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { useState, useCallback
|
|
3
|
+
import { useState, useCallback } from 'react';
|
|
4
4
|
import { SignInWithEmailIcon } from '@dynamic-labs/iconic';
|
|
5
5
|
import { NoAccessError } from '@dynamic-labs/utils';
|
|
6
6
|
import { Typography } from '../../components/Typography/Typography.js';
|
|
@@ -9,7 +9,7 @@ import '@dynamic-labs/wallet-connector-core';
|
|
|
9
9
|
import { useViewContext } from '../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import { ReactComponent as SvgCheck } from '../../shared/assets/check.js';
|
|
11
11
|
import { ReactComponent as SvgCheckCircle } from '../../shared/assets/check-circle.js';
|
|
12
|
-
import '../../shared/logger.js';
|
|
12
|
+
import { logger } from '../../shared/logger.js';
|
|
13
13
|
import '@dynamic-labs/wallet-book';
|
|
14
14
|
import '../../utils/constants/colors.js';
|
|
15
15
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
@@ -40,6 +40,7 @@ import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/Secondary
|
|
|
40
40
|
import '../../context/MockContext/MockContext.js';
|
|
41
41
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
42
42
|
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
43
|
+
import { useCountdown } from '../../utils/hooks/useCountdown/useCountdown.js';
|
|
43
44
|
import { TextButton } from '../../components/TextButton/TextButton.js';
|
|
44
45
|
import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
|
|
45
46
|
import { PinField } from '../../components/PinField/PinField.js';
|
|
@@ -53,10 +54,9 @@ import { useLoadingContext } from '../../context/LoadingContext/LoadingContext.j
|
|
|
53
54
|
import { useEmailVerificationRequest } from '../../utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js';
|
|
54
55
|
import { useCreateUserProfileByJWTCallback } from '../../utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.js';
|
|
55
56
|
|
|
56
|
-
const
|
|
57
|
+
const SECONDS_TO_RETRY = 15;
|
|
57
58
|
const EmailVerification = () => {
|
|
58
59
|
const [hideRetryButton, setHideRetryButton] = useState(false);
|
|
59
|
-
const [count, setCount] = useState(secondsToRetry);
|
|
60
60
|
const [retried, setRetried] = useState(false);
|
|
61
61
|
const [isValidated, setIsValidated] = useState(false);
|
|
62
62
|
const [showTransferMessage, setShowTransferMessage] = useState(false);
|
|
@@ -65,6 +65,10 @@ const EmailVerification = () => {
|
|
|
65
65
|
const { environmentId, onboardingOnlyJwt, handleLogOut, authToken, setOnboardingOnlyJwt, setShowAuthFlow, setCallback, } = useInternalDynamicContext();
|
|
66
66
|
const { email, verificationUUID, setVerificationUUID } = useEmailVerificationContext();
|
|
67
67
|
const { loading, setLoading } = useLoadingContext();
|
|
68
|
+
const { remainingSeconds, startCountdown } = useCountdown({
|
|
69
|
+
callback: () => setRetried(false),
|
|
70
|
+
seconds: SECONDS_TO_RETRY,
|
|
71
|
+
});
|
|
68
72
|
const isLoginView = view === 'login-with-email-verification';
|
|
69
73
|
const { verifyEmail } = useEmailVerificationRequest();
|
|
70
74
|
const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback();
|
|
@@ -89,6 +93,7 @@ const EmailVerification = () => {
|
|
|
89
93
|
setShowAuthFlow(false);
|
|
90
94
|
}
|
|
91
95
|
catch (error) {
|
|
96
|
+
logger.debug(error);
|
|
92
97
|
setErrorMessage(error.code);
|
|
93
98
|
}
|
|
94
99
|
finally {
|
|
@@ -147,6 +152,7 @@ const EmailVerification = () => {
|
|
|
147
152
|
if (error instanceof NoAccessError) {
|
|
148
153
|
setView('no-access');
|
|
149
154
|
}
|
|
155
|
+
logger.debug(error);
|
|
150
156
|
setErrorMessage(error.code);
|
|
151
157
|
}
|
|
152
158
|
finally {
|
|
@@ -179,9 +185,11 @@ const EmailVerification = () => {
|
|
|
179
185
|
});
|
|
180
186
|
setVerificationUUID(newVerificationUUID);
|
|
181
187
|
setRetried(true);
|
|
188
|
+
startCountdown();
|
|
182
189
|
setError(undefined);
|
|
183
190
|
}
|
|
184
191
|
catch (error) {
|
|
192
|
+
logger.debug(error);
|
|
185
193
|
setErrorMessage(error.code);
|
|
186
194
|
if (error.code === 'too_many_email_verification_attempts') {
|
|
187
195
|
setHideRetryButton(true);
|
|
@@ -194,26 +202,9 @@ const EmailVerification = () => {
|
|
|
194
202
|
setLoading(false);
|
|
195
203
|
}
|
|
196
204
|
});
|
|
197
|
-
useEffect(() => {
|
|
198
|
-
/* istanbul ignore next */
|
|
199
|
-
setCount(secondsToRetry);
|
|
200
|
-
const timeout = setTimeout(() => {
|
|
201
|
-
if (retried)
|
|
202
|
-
setRetried(false);
|
|
203
|
-
}, secondsToRetry * 1000);
|
|
204
|
-
return () => clearTimeout(timeout);
|
|
205
|
-
}, [retried]);
|
|
206
|
-
useEffect(() => {
|
|
207
|
-
/* istanbul ignore next */
|
|
208
|
-
const timeout = setTimeout(() => {
|
|
209
|
-
if (count)
|
|
210
|
-
setCount((prev) => prev - 1);
|
|
211
|
-
}, 1000);
|
|
212
|
-
return () => clearTimeout(timeout);
|
|
213
|
-
}, [count]);
|
|
214
205
|
return (jsxs("div", Object.assign({ className: 'email-verification__container' }, { children: [error && (jsx(ErrorContainer, Object.assign({ withIcon: false, className: 'email-verification__error-message' }, { children: error }))), showTransferMessage && (jsx("div", Object.assign({ className: 'email-verification__transfer-message' }, { children: "Verification complete, the email is now verified to this account." }))), isValidated ? (jsx("div", Object.assign({ className: 'email-verification__icon-container' }, { children: jsx(IconWithStatus, { containerClassName: 'email-verification__icon--verified', Icon: SignInWithEmailIcon, iconSize: 50, InnerIcon: SvgCheck }) }))) : (jsx(IconWithSpinner, { className: classNames({
|
|
215
206
|
'email-verification__icon-with-spinner': Boolean(!error),
|
|
216
|
-
}), Icon: SignInWithEmailIcon, iconSize: 80, isSpinning: true })), jsx(Typography, Object.assign({ weight: 'medium', variant: 'title', className: 'email-verification__title', color: 'primary' }, { children: "Confirm verification code" })), jsxs("div", Object.assign({ className: 'email-verification__copy-text-container' }, { children: [jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary' }, { children: "We\u2019ve sent a verification code to" })), jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'bold', color: 'secondary' }, { children: shortenEmail(email) }))] })), !isLoginView && (jsx(TextButton, Object.assign({ onClick: () => setView('update-email'), className: 'email-verification__text-button', disabled: loading }, { children: "Edit email" }))), jsx(PinField, { initialValue: Array(6).join('.').split('.'), isLoading: loading, handleComplete: isLoginView ? handleEmailLogin : handleComplete, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), retried ? (jsxs(Fragment, { children: [jsxs(Typography, Object.assign({ variant: 'body_small', color: 'secondary' }, { children: ["Re-send code in ",
|
|
207
|
+
}), Icon: SignInWithEmailIcon, iconSize: 80, isSpinning: true })), jsx(Typography, Object.assign({ weight: 'medium', variant: 'title', className: 'email-verification__title', color: 'primary' }, { children: "Confirm verification code" })), jsxs("div", Object.assign({ className: 'email-verification__copy-text-container' }, { children: [jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary' }, { children: "We\u2019ve sent a verification code to" })), jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'bold', color: 'secondary' }, { children: shortenEmail(email) }))] })), !isLoginView && (jsx(TextButton, Object.assign({ onClick: () => setView('update-email'), className: 'email-verification__text-button', disabled: loading }, { children: "Edit email" }))), jsx(PinField, { initialValue: Array(6).join('.').split('.'), isLoading: loading, handleComplete: isLoginView ? handleEmailLogin : handleComplete, isValidated: isValidated, inputMode: 'numeric', pattern: '[0-9]*', hasError: Boolean(error), onChange: () => setError(undefined) }), retried ? (jsxs(Fragment, { children: [jsxs(Typography, Object.assign({ variant: 'body_small', color: 'secondary' }, { children: ["Re-send code in ", remainingSeconds] })), jsxs("span", Object.assign({ className: 'email-verification__retry-container' }, { children: [jsx(SvgCheckCircle, {}), jsx(Typography, Object.assign({ variant: 'body_small', weight: 'medium', color: 'primary', className: 'email-verification__retry-container-text' }, { children: "Code sent" }))] }))] })) : (!hideRetryButton && (jsxs(Fragment, { children: [jsx(Typography, Object.assign({ variant: 'body_small', weight: 'medium', color: 'secondary' }, { children: "Did not receive your code yet?" })), jsx(TextButton, Object.assign({ className: 'email-verification__text-button', disabled: loading || isValidated, onClick: () => handleRetry() }, { children: "Re-send code" }))] }))), !isLoginView && (jsx(TextButton, Object.assign({ className: 'email-verification__log-out', onClick: () => handleLogOut() }, { children: "Log out" }))), jsx(PoweredByDynamic, {})] })));
|
|
217
208
|
};
|
|
218
209
|
|
|
219
210
|
export { EmailVerification };
|
package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs
CHANGED
|
@@ -9,7 +9,7 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
|
9
9
|
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
10
10
|
require('@dynamic-labs/utils');
|
|
11
11
|
var api = require('../../../../data/api.cjs');
|
|
12
|
-
require('../../../../shared/logger.cjs');
|
|
12
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
13
13
|
require('@dynamic-labs/iconic');
|
|
14
14
|
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
15
15
|
require('@dynamic-labs/wallet-book');
|
|
@@ -116,6 +116,7 @@ const LoginWithEmailForm = () => {
|
|
|
116
116
|
yield submitHandler();
|
|
117
117
|
}
|
|
118
118
|
catch (error) {
|
|
119
|
+
logger.logger.debug(error);
|
|
119
120
|
setErrorMessage(error.code);
|
|
120
121
|
}
|
|
121
122
|
finally {
|
package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js
CHANGED
|
@@ -5,7 +5,7 @@ import { isEmailWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
|
5
5
|
import { ProviderEnum } from '@dynamic-labs/sdk-api';
|
|
6
6
|
import '@dynamic-labs/utils';
|
|
7
7
|
import { getEmailProvider, createEmailVerification } from '../../../../data/api.js';
|
|
8
|
-
import '../../../../shared/logger.js';
|
|
8
|
+
import { logger } from '../../../../shared/logger.js';
|
|
9
9
|
import '@dynamic-labs/iconic';
|
|
10
10
|
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
11
11
|
import '@dynamic-labs/wallet-book';
|
|
@@ -112,6 +112,7 @@ const LoginWithEmailForm = () => {
|
|
|
112
112
|
yield submitHandler();
|
|
113
113
|
}
|
|
114
114
|
catch (error) {
|
|
115
|
+
logger.debug(error);
|
|
115
116
|
setErrorMessage(error.code);
|
|
116
117
|
}
|
|
117
118
|
finally {
|