@dynamic-labs/sdk-react-core 0.19.3 → 1.0.0-alpha.1
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 +41 -24
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +10 -10
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +2 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +3 -2
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.cjs +3 -3
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.js +3 -3
- package/src/lib/context/CaptchaContext/CaptchaContext.cjs +27 -1
- package/src/lib/context/CaptchaContext/CaptchaContext.d.ts +14 -0
- package/src/lib/context/CaptchaContext/CaptchaContext.js +28 -3
- package/src/lib/context/DynamicContext/DynamicContext.cjs +11 -11
- package/src/lib/context/DynamicContext/DynamicContext.js +11 -11
- package/src/lib/context/DynamicContext/hooks/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.cjs +20 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.d.ts +10 -0
- package/src/lib/context/DynamicContext/hooks/useSelectedWalletConnector/useSelectedWalletConnector.js +16 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/types.d.ts +2 -3
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.d.ts +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +1 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +6 -4
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +6 -4
- package/src/lib/data/api.cjs +6 -3
- package/src/lib/data/api.d.ts +5 -3
- package/src/lib/data/api.js +6 -3
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.js +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +42 -26
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +42 -26
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.cjs +9 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSignSplitSteps/useConnectAndSignSplitSteps.js +9 -3
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.cjs +5 -2
- package/src/lib/utils/hooks/authenticationHooks/useSignConnectOnlyUser/useSignConnectOnlyUser.js +5 -2
- package/src/lib/utils/hooks/index.d.ts +0 -1
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +4 -4
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +4 -4
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.cjs +39 -5
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.d.ts +1 -2
- package/src/lib/utils/hooks/useEmailProvider/useEmailProvider.js +40 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +13 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +13 -1
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +10 -1
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +10 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +8 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +9 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +4 -3
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +5 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +4 -3
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.cjs +3 -1
- package/src/lib/utils/hooks/useValidateSession/useValidateSession.js +3 -1
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.cjs +0 -1
- package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.js +0 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +15 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +15 -4
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +9 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.d.ts +3 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +5 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +36 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.d.ts +10 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +29 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +4 -4
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +3 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +4 -4
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +8 -7
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +8 -7
- package/src/lib/utils/hooks/useWallets/useWallets.cjs +0 -1
- package/src/lib/utils/hooks/useWallets/useWallets.js +0 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +9 -41
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.d.ts +1 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +9 -41
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +1 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +1 -1
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +38 -34
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +38 -34
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +20 -3
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +20 -3
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +17 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +17 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs +1 -1
- package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js +1 -1
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.cjs +15 -3
- package/src/lib/views/PasskeyIntroView/PasskeyIntroView.js +15 -3
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.cjs +1 -2
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.d.ts +1 -1
- package/src/lib/views/PasskeyIntroView/utils/createEmbeddedWalletWithPasskey/createEmbeddedWalletWithPasskey.js +1 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +16 -8
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +16 -8
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs +5 -2
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.d.ts +2 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js +5 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +2 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.d.ts +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +2 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.d.ts +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +2 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +6 -7
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +6 -7
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +4 -3
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +4 -3
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +3 -5
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +3 -5
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/PendingSignModal.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +2 -4
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +2 -4
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.cjs +3 -5
- package/src/lib/widgets/DynamicWidget/views/WalletsView/WalletsView.js +3 -5
- package/src/lib/utils/hooks/useMultiWalletFlag/index.d.ts +0 -1
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.cjs +0 -36
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.d.ts +0 -2
- package/src/lib/utils/hooks/useMultiWalletFlag/useMultiWalletFlag.js +0 -31
package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs
CHANGED
|
@@ -16,7 +16,7 @@ require('../../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
|
16
16
|
require('viem');
|
|
17
17
|
require('@dynamic-labs/utils');
|
|
18
18
|
require('../../../../../shared/consts/index.cjs');
|
|
19
|
-
require('../../../../../context/DynamicContext/
|
|
19
|
+
var useInternalDynamicContext = require('../../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
20
20
|
require('@dynamic-labs/multi-wallet');
|
|
21
21
|
require('../../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
22
22
|
require('../../../../../context/ThemeContext/ThemeContext.cjs');
|
|
@@ -38,7 +38,7 @@ require('../../../../../context/MockContext/MockContext.cjs');
|
|
|
38
38
|
require('../../../../../context/QrCodeContext/QrCodeContext.cjs');
|
|
39
39
|
require('../../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
40
40
|
require('../../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
41
|
-
require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
41
|
+
var CaptchaContext = require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
42
42
|
require('../../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
43
43
|
require('qrcode');
|
|
44
44
|
require('../../../../../context/LoadingContext/LoadingContext.cjs');
|
|
@@ -60,8 +60,23 @@ var SocialSignIn = require('../../../../../components/SocialSignIn/SocialSignIn.
|
|
|
60
60
|
var SocialRedirectContext = require('../../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
61
61
|
|
|
62
62
|
const MagicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLayout, }) => {
|
|
63
|
+
const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
63
64
|
const { socialProvider, setSocialProvider, socialWalletConnector, enabledSocialProviders, } = SocialRedirectContext.useSocialRedirectContext();
|
|
65
|
+
const { engageCaptcha, setCaptchaTokenInLS } = CaptchaContext.useCaptchaContext();
|
|
64
66
|
const { mutate: onClickProvider, isLoading } = useMutation.useMutation((provider) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
var _a;
|
|
68
|
+
if ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security.hCaptcha) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
69
|
+
engageCaptcha({
|
|
70
|
+
authMethod: 'social',
|
|
71
|
+
onCaptchaSuccess: (captchaToken) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
+
setCaptchaTokenInLS(captchaToken);
|
|
73
|
+
setSocialProvider(provider);
|
|
74
|
+
yield (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.endSession());
|
|
75
|
+
return socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.connect(provider);
|
|
76
|
+
}),
|
|
77
|
+
});
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
65
80
|
setSocialProvider(provider);
|
|
66
81
|
yield (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.endSession());
|
|
67
82
|
return socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.connect(provider);
|
package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js
CHANGED
|
@@ -12,7 +12,7 @@ import '../../../../../shared/utils/classes/storage/localStorage.js';
|
|
|
12
12
|
import 'viem';
|
|
13
13
|
import '@dynamic-labs/utils';
|
|
14
14
|
import '../../../../../shared/consts/index.js';
|
|
15
|
-
import '../../../../../context/DynamicContext/
|
|
15
|
+
import { useInternalDynamicContext } from '../../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
16
16
|
import '@dynamic-labs/multi-wallet';
|
|
17
17
|
import '../../../../../components/ShadowDOM/ShadowDOM.js';
|
|
18
18
|
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
@@ -34,7 +34,7 @@ import '../../../../../context/MockContext/MockContext.js';
|
|
|
34
34
|
import '../../../../../context/QrCodeContext/QrCodeContext.js';
|
|
35
35
|
import '../../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
36
36
|
import '../../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
37
|
-
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
37
|
+
import { useCaptchaContext } from '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
38
38
|
import '../../../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
39
39
|
import 'qrcode';
|
|
40
40
|
import '../../../../../context/LoadingContext/LoadingContext.js';
|
|
@@ -56,8 +56,23 @@ import { SocialSignIn } from '../../../../../components/SocialSignIn/SocialSignI
|
|
|
56
56
|
import { useSocialRedirectContext } from '../../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
57
57
|
|
|
58
58
|
const MagicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, collapsedLayout, }) => {
|
|
59
|
+
const { projectSettings } = useInternalDynamicContext();
|
|
59
60
|
const { socialProvider, setSocialProvider, socialWalletConnector, enabledSocialProviders, } = useSocialRedirectContext();
|
|
61
|
+
const { engageCaptcha, setCaptchaTokenInLS } = useCaptchaContext();
|
|
60
62
|
const { mutate: onClickProvider, isLoading } = useMutation((provider) => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
var _a;
|
|
64
|
+
if ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security.hCaptcha) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
65
|
+
engageCaptcha({
|
|
66
|
+
authMethod: 'social',
|
|
67
|
+
onCaptchaSuccess: (captchaToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
setCaptchaTokenInLS(captchaToken);
|
|
69
|
+
setSocialProvider(provider);
|
|
70
|
+
yield (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.endSession());
|
|
71
|
+
return socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.connect(provider);
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
61
76
|
setSocialProvider(provider);
|
|
62
77
|
yield (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.endSession());
|
|
63
78
|
return socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.connect(provider);
|
package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.cjs
CHANGED
|
@@ -65,7 +65,7 @@ const ListItemButton = ({ text, onClick, numberOfWallets, disabled = false, }) =
|
|
|
65
65
|
if (numberOfWallets <= 10) {
|
|
66
66
|
return numberOfWallets;
|
|
67
67
|
}
|
|
68
|
-
return
|
|
68
|
+
return `${Math.floor(numberOfWallets / 10) * 10}+`;
|
|
69
69
|
}, [numberOfWallets]);
|
|
70
70
|
const trailing = (jsxRuntime.jsxs("div", { className: 'list-item-button__trailing', children: [jsxRuntime.jsx("div", { className: classNames.classNames('list-item-button__trailing-child', 'list-item-button__trailing-label'), children: jsxRuntime.jsx(Badge.Badge, { text: `${numberOfWalletsText} available` }) }), jsxRuntime.jsx("div", { className: classNames.classNames('list-item-button__trailing-child', 'list-item-button__trailing-icon'), children: jsxRuntime.jsx(Icon.Icon, { color: 'text-primary', size: 'small', children: jsxRuntime.jsx(stroke.ReactComponent, {}) }) })] }));
|
|
71
71
|
return (jsxRuntime.jsx(ListTile.ListTile, { trailing: trailing, onClick: onClick, className: 'list-item-button', disabled: disabled, children: text }));
|
package/src/lib/views/LoginView/sections/WalletSignInSection/ListItemButton/ListItemButton.js
CHANGED
|
@@ -61,7 +61,7 @@ const ListItemButton = ({ text, onClick, numberOfWallets, disabled = false, }) =
|
|
|
61
61
|
if (numberOfWallets <= 10) {
|
|
62
62
|
return numberOfWallets;
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return `${Math.floor(numberOfWallets / 10) * 10}+`;
|
|
65
65
|
}, [numberOfWallets]);
|
|
66
66
|
const trailing = (jsxs("div", { className: 'list-item-button__trailing', children: [jsx("div", { className: classNames('list-item-button__trailing-child', 'list-item-button__trailing-label'), children: jsx(Badge, { text: `${numberOfWalletsText} available` }) }), jsx("div", { className: classNames('list-item-button__trailing-child', 'list-item-button__trailing-icon'), children: jsx(Icon, { color: 'text-primary', size: 'small', children: jsx(SvgStroke, {}) }) })] }));
|
|
67
67
|
return (jsx(ListTile, { trailing: trailing, onClick: onClick, className: 'list-item-button', disabled: disabled, children: text }));
|
|
@@ -40,6 +40,7 @@ require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
|
40
40
|
require('../../config/ApiEndpoint.cjs');
|
|
41
41
|
require('@dynamic-labs/rpc-providers');
|
|
42
42
|
require('../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
43
|
+
var smartWallet = require('../../utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs');
|
|
43
44
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
44
45
|
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
45
46
|
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
@@ -87,7 +88,7 @@ const PasskeyIntroView = ({ createEmbeddedWalletMutation = createEmbeddedWalletW
|
|
|
87
88
|
React.useEffect(() => localStorage.LocalStorage.removeFromLS(localStorage$1.LAST_USED_WALLET), []);
|
|
88
89
|
const { mutate: createEmbeddedWalletWithPasskeyMutation, isLoading, error, } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
89
90
|
var _a;
|
|
90
|
-
const {
|
|
91
|
+
const { embeddedWalletVerifiedCredential, jwt, decodedJwt, walletConnector, } = yield createEmbeddedWalletMutation({
|
|
91
92
|
authToken,
|
|
92
93
|
environmentId,
|
|
93
94
|
user,
|
|
@@ -98,10 +99,21 @@ const PasskeyIntroView = ({ createEmbeddedWalletMutation = createEmbeddedWalletW
|
|
|
98
99
|
chain: walletConnector.connectedChain || '',
|
|
99
100
|
connected: true,
|
|
100
101
|
connector: walletConnector,
|
|
101
|
-
id:
|
|
102
|
+
id: embeddedWalletVerifiedCredential.id,
|
|
102
103
|
};
|
|
103
104
|
internalEvents.current.emit('embeddedWalletCreated', passkeyWallet);
|
|
104
|
-
|
|
105
|
+
const smartWallet$1 = smartWallet.findSmartWallet(embeddedWalletVerifiedCredential, decodedJwt.verifiedCredentials);
|
|
106
|
+
if (smartWallet$1) {
|
|
107
|
+
setPrimaryWalletId(smartWallet$1.id);
|
|
108
|
+
smartWallet.initializeSmartWallet({
|
|
109
|
+
account: smartWallet$1,
|
|
110
|
+
verifiedCredentials: decodedJwt.verifiedCredentials,
|
|
111
|
+
walletOptions: wallets,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
116
|
+
}
|
|
105
117
|
index$1.storeAuthToken(jwt);
|
|
106
118
|
setUser(createUserProfile.createUserProfile(decodedJwt));
|
|
107
119
|
setShowAuthFlow(false);
|
|
@@ -36,6 +36,7 @@ import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
|
36
36
|
import '../../config/ApiEndpoint.js';
|
|
37
37
|
import '@dynamic-labs/rpc-providers';
|
|
38
38
|
import '../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
39
|
+
import { findSmartWallet, initializeSmartWallet } from '../../utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js';
|
|
39
40
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
40
41
|
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
41
42
|
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
@@ -83,7 +84,7 @@ const PasskeyIntroView = ({ createEmbeddedWalletMutation = createEmbeddedWalletW
|
|
|
83
84
|
useEffect(() => LocalStorage.removeFromLS(LAST_USED_WALLET), []);
|
|
84
85
|
const { mutate: createEmbeddedWalletWithPasskeyMutation, isLoading, error, } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
86
|
var _a;
|
|
86
|
-
const {
|
|
87
|
+
const { embeddedWalletVerifiedCredential, jwt, decodedJwt, walletConnector, } = yield createEmbeddedWalletMutation({
|
|
87
88
|
authToken,
|
|
88
89
|
environmentId,
|
|
89
90
|
user,
|
|
@@ -94,10 +95,21 @@ const PasskeyIntroView = ({ createEmbeddedWalletMutation = createEmbeddedWalletW
|
|
|
94
95
|
chain: walletConnector.connectedChain || '',
|
|
95
96
|
connected: true,
|
|
96
97
|
connector: walletConnector,
|
|
97
|
-
id:
|
|
98
|
+
id: embeddedWalletVerifiedCredential.id,
|
|
98
99
|
};
|
|
99
100
|
internalEvents.current.emit('embeddedWalletCreated', passkeyWallet);
|
|
100
|
-
|
|
101
|
+
const smartWallet = findSmartWallet(embeddedWalletVerifiedCredential, decodedJwt.verifiedCredentials);
|
|
102
|
+
if (smartWallet) {
|
|
103
|
+
setPrimaryWalletId(smartWallet.id);
|
|
104
|
+
initializeSmartWallet({
|
|
105
|
+
account: smartWallet,
|
|
106
|
+
verifiedCredentials: decodedJwt.verifiedCredentials,
|
|
107
|
+
walletOptions: wallets,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
setPrimaryWalletId(embeddedWalletVerifiedCredential.id);
|
|
112
|
+
}
|
|
101
113
|
storeAuthToken(jwt);
|
|
102
114
|
setUser(createUserProfile(decodedJwt));
|
|
103
115
|
setShowAuthFlow(false);
|
|
@@ -47,11 +47,10 @@ const createEmbeddedWalletWithPasskey = ({ user, walletConnector, environmentId,
|
|
|
47
47
|
if (!embeddedWalletVerifiedCredential) {
|
|
48
48
|
throw new utils.DynamicError('EmbeddedWalletVerifiedCredential not found');
|
|
49
49
|
}
|
|
50
|
-
const embeddedWalletVerifiedCredentialId = embeddedWalletVerifiedCredential.id;
|
|
51
50
|
walletConnector.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
52
51
|
return {
|
|
53
52
|
decodedJwt,
|
|
54
|
-
|
|
53
|
+
embeddedWalletVerifiedCredential,
|
|
55
54
|
jwt,
|
|
56
55
|
walletConnector,
|
|
57
56
|
};
|
|
@@ -7,7 +7,7 @@ export declare const createEmbeddedWalletWithPasskey: ({ user, walletConnector,
|
|
|
7
7
|
walletConnector: (IPasskeyWalletConnector & IEmailWalletConnector) | undefined;
|
|
8
8
|
}) => Promise<{
|
|
9
9
|
decodedJwt: Omit<import("@dynamic-labs/sdk-api").DynamicJwt, "jwt">;
|
|
10
|
-
|
|
10
|
+
embeddedWalletVerifiedCredential: import("@dynamic-labs/sdk-api").JwtVerifiedCredential;
|
|
11
11
|
jwt: string;
|
|
12
12
|
walletConnector: IPasskeyWalletConnector & IEmailWalletConnector;
|
|
13
13
|
}>;
|
|
@@ -43,11 +43,10 @@ const createEmbeddedWalletWithPasskey = ({ user, walletConnector, environmentId,
|
|
|
43
43
|
if (!embeddedWalletVerifiedCredential) {
|
|
44
44
|
throw new DynamicError('EmbeddedWalletVerifiedCredential not found');
|
|
45
45
|
}
|
|
46
|
-
const embeddedWalletVerifiedCredentialId = embeddedWalletVerifiedCredential.id;
|
|
47
46
|
walletConnector.setVerifiedCredentials(decodedJwt.verifiedCredentials);
|
|
48
47
|
return {
|
|
49
48
|
decodedJwt,
|
|
50
|
-
|
|
49
|
+
embeddedWalletVerifiedCredential,
|
|
51
50
|
jwt,
|
|
52
51
|
walletConnector,
|
|
53
52
|
};
|
|
@@ -8,12 +8,12 @@ var React = require('react');
|
|
|
8
8
|
var reactI18next = require('react-i18next');
|
|
9
9
|
var viem = require('viem');
|
|
10
10
|
var utils = require('@dynamic-labs/utils');
|
|
11
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
11
12
|
var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
12
13
|
require('@dynamic-labs/sdk-api');
|
|
13
14
|
require('../../config/ApiEndpoint.cjs');
|
|
14
15
|
require('../../shared/logger.cjs');
|
|
15
16
|
var getChainIcon = require('../../shared/utils/functions/chain/getChainIcon.cjs');
|
|
16
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
17
17
|
require('@dynamic-labs/wallet-book');
|
|
18
18
|
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
19
19
|
require('../../utils/constants/colors.cjs');
|
|
@@ -81,8 +81,16 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
81
81
|
const balanceText = yield primaryWallet.connector.getBalance();
|
|
82
82
|
return balanceText ? viem.parseEther(balanceText) : undefined;
|
|
83
83
|
}));
|
|
84
|
+
const { data: isGasSponsored, isLoading: isGasSponsoredLoading } = usePromise.usePromise(() => {
|
|
85
|
+
if (!walletConnectorCore.canCheckGasSponsorship(primaryWallet.connector)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
return primaryWallet.connector.isGasSponsored(transaction);
|
|
89
|
+
});
|
|
84
90
|
const { mutate: send, isLoading, error: transactionError, } = useMutation.useMutation(mutation, {
|
|
85
|
-
onFailure: (error) =>
|
|
91
|
+
onFailure: (error) => {
|
|
92
|
+
onError === null || onError === void 0 ? void 0 : onError(error);
|
|
93
|
+
},
|
|
86
94
|
onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx),
|
|
87
95
|
});
|
|
88
96
|
const { isLoading: isGasPriceLoading, gasTotalPrice, isGasEstimated, } = useTransactionGas.useTransactionGas({
|
|
@@ -100,12 +108,14 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
100
108
|
}));
|
|
101
109
|
const total = useTransactionTotal.useTransactionTotal({
|
|
102
110
|
gasTotalPrice,
|
|
111
|
+
isGasSponsored,
|
|
103
112
|
transactionValue,
|
|
104
113
|
});
|
|
105
114
|
const isTransactionLoading = isTransactionValueLoading ||
|
|
106
115
|
isGasPriceLoading ||
|
|
107
116
|
isTransactionToAddressLoading ||
|
|
108
|
-
isTransactionFromAddressLoading
|
|
117
|
+
isTransactionFromAddressLoading ||
|
|
118
|
+
isGasSponsoredLoading;
|
|
109
119
|
const ChainIconComponent = getChainIcon.getChainIcon(primaryWallet.chain);
|
|
110
120
|
const chainIcon = (jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(ChainIconComponent, {}) }));
|
|
111
121
|
const errorMessage = transactionError && transactionErrorMessage.transactionErrorMessage(transactionError);
|
|
@@ -130,13 +140,11 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
130
140
|
});
|
|
131
141
|
}, [currencySymbol, hasInsufficientFunds, missingFunds]);
|
|
132
142
|
return (jsxRuntime.jsxs(TransactionConfirmationPageLayout.TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isTransactionLoading || hasInsufficientFunds, error: errorMessage, warningMessage: warningMessage, children: [jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.from'), isLoading: isTransactionFromAddressLoading, title: transactionFromAddress, children: shortenWalletAddress.shortenWalletAddress(transactionFromAddress, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.to'), isLoading: isTransactionToAddressLoading, title: transactionToAddress, children: transactionToAddress &&
|
|
133
|
-
shortenWalletAddress.shortenWalletAddress(transactionToAddress, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber.formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber.formatBigNumber(transactionValue, 10) : 0 }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: isGasEstimated
|
|
143
|
+
shortenWalletAddress.shortenWalletAddress(transactionToAddress, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber.formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber.formatBigNumber(transactionValue, 10) : 0 }), !isGasSponsored && (jsxRuntime.jsx(TransactionRow.TransactionRow, { label: isGasEstimated
|
|
134
144
|
? t('dyn_send_transaction.confirmation.data.gas_estimate')
|
|
135
|
-
: t('dyn_send_transaction.confirmation.data.gas'), isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading, title: gasTotalPrice ? formatBigNumber.formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
|
|
145
|
+
: t('dyn_send_transaction.confirmation.data.gas'), isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading || isGasSponsoredLoading, title: gasTotalPrice ? formatBigNumber.formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
|
|
136
146
|
? 'transaction-estimated-gas-fee'
|
|
137
|
-
: 'transaction-gas-fee', children: gasTotalPrice
|
|
138
|
-
? formatBigNumber.formatBigNumber(gasTotalPrice, 10)
|
|
139
|
-
: t('dyn_send_transaction.confirmation.data.gas_estimate') }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.total'), isEmpty: !total, title: total ? formatBigNumber.formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total
|
|
147
|
+
: 'transaction-gas-fee', children: gasTotalPrice ? formatBigNumber.formatBigNumber(gasTotalPrice, 10) : '--' })), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.total'), isEmpty: !total, title: total ? formatBigNumber.formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total
|
|
140
148
|
? formatBigNumber.formatBigNumber(total, 10)
|
|
141
149
|
: t('dyn_send_transaction.confirmation.not_applied') })] }));
|
|
142
150
|
};
|
|
@@ -4,12 +4,12 @@ import { useMemo } from 'react';
|
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { parseEther, isHex, hexToBigInt } from 'viem';
|
|
6
6
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
7
|
+
import { canCheckGasSponsorship } from '@dynamic-labs/wallet-connector-core';
|
|
7
8
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
|
|
8
9
|
import '@dynamic-labs/sdk-api';
|
|
9
10
|
import '../../config/ApiEndpoint.js';
|
|
10
11
|
import '../../shared/logger.js';
|
|
11
12
|
import { getChainIcon } from '../../shared/utils/functions/chain/getChainIcon.js';
|
|
12
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
13
13
|
import '@dynamic-labs/wallet-book';
|
|
14
14
|
import { shortenWalletAddress } from '../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
15
15
|
import '../../utils/constants/colors.js';
|
|
@@ -77,8 +77,16 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
77
77
|
const balanceText = yield primaryWallet.connector.getBalance();
|
|
78
78
|
return balanceText ? parseEther(balanceText) : undefined;
|
|
79
79
|
}));
|
|
80
|
+
const { data: isGasSponsored, isLoading: isGasSponsoredLoading } = usePromise(() => {
|
|
81
|
+
if (!canCheckGasSponsorship(primaryWallet.connector)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
return primaryWallet.connector.isGasSponsored(transaction);
|
|
85
|
+
});
|
|
80
86
|
const { mutate: send, isLoading, error: transactionError, } = useMutation(mutation, {
|
|
81
|
-
onFailure: (error) =>
|
|
87
|
+
onFailure: (error) => {
|
|
88
|
+
onError === null || onError === void 0 ? void 0 : onError(error);
|
|
89
|
+
},
|
|
82
90
|
onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx),
|
|
83
91
|
});
|
|
84
92
|
const { isLoading: isGasPriceLoading, gasTotalPrice, isGasEstimated, } = useTransactionGas({
|
|
@@ -96,12 +104,14 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
96
104
|
}));
|
|
97
105
|
const total = useTransactionTotal({
|
|
98
106
|
gasTotalPrice,
|
|
107
|
+
isGasSponsored,
|
|
99
108
|
transactionValue,
|
|
100
109
|
});
|
|
101
110
|
const isTransactionLoading = isTransactionValueLoading ||
|
|
102
111
|
isGasPriceLoading ||
|
|
103
112
|
isTransactionToAddressLoading ||
|
|
104
|
-
isTransactionFromAddressLoading
|
|
113
|
+
isTransactionFromAddressLoading ||
|
|
114
|
+
isGasSponsoredLoading;
|
|
105
115
|
const ChainIconComponent = getChainIcon(primaryWallet.chain);
|
|
106
116
|
const chainIcon = (jsx(Icon, { size: 'small', children: jsx(ChainIconComponent, {}) }));
|
|
107
117
|
const errorMessage = transactionError && transactionErrorMessage(transactionError);
|
|
@@ -126,13 +136,11 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
126
136
|
});
|
|
127
137
|
}, [currencySymbol, hasInsufficientFunds, missingFunds]);
|
|
128
138
|
return (jsxs(TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isTransactionLoading || hasInsufficientFunds, error: errorMessage, warningMessage: warningMessage, children: [jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.from'), isLoading: isTransactionFromAddressLoading, title: transactionFromAddress, children: shortenWalletAddress(transactionFromAddress, 4, 4) }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.to'), isLoading: isTransactionToAddressLoading, title: transactionToAddress, children: transactionToAddress &&
|
|
129
|
-
shortenWalletAddress(transactionToAddress, 4, 4) }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber(transactionValue, 10) : 0 }), jsx(TransactionRow, { label: isGasEstimated
|
|
139
|
+
shortenWalletAddress(transactionToAddress, 4, 4) }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber(transactionValue, 10) : 0 }), !isGasSponsored && (jsx(TransactionRow, { label: isGasEstimated
|
|
130
140
|
? t('dyn_send_transaction.confirmation.data.gas_estimate')
|
|
131
|
-
: t('dyn_send_transaction.confirmation.data.gas'), isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading, title: gasTotalPrice ? formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
|
|
141
|
+
: t('dyn_send_transaction.confirmation.data.gas'), isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading || isGasSponsoredLoading, title: gasTotalPrice ? formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
|
|
132
142
|
? 'transaction-estimated-gas-fee'
|
|
133
|
-
: 'transaction-gas-fee', children: gasTotalPrice
|
|
134
|
-
? formatBigNumber(gasTotalPrice, 10)
|
|
135
|
-
: t('dyn_send_transaction.confirmation.data.gas_estimate') }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.total'), isEmpty: !total, title: total ? formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total
|
|
143
|
+
: 'transaction-gas-fee', children: gasTotalPrice ? formatBigNumber(gasTotalPrice, 10) : '--' })), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.total'), isEmpty: !total, title: total ? formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total
|
|
136
144
|
? formatBigNumber(total, 10)
|
|
137
145
|
: t('dyn_send_transaction.confirmation.not_applied') })] }));
|
|
138
146
|
};
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs
CHANGED
|
@@ -4,11 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
|
|
7
|
-
const useTransactionTotal = ({ transactionValue, gasTotalPrice, }) => React.useMemo(() => {
|
|
7
|
+
const useTransactionTotal = ({ transactionValue, gasTotalPrice, isGasSponsored = false, }) => React.useMemo(() => {
|
|
8
|
+
if (isGasSponsored && transactionValue !== undefined) {
|
|
9
|
+
return transactionValue;
|
|
10
|
+
}
|
|
8
11
|
if (gasTotalPrice !== undefined && transactionValue !== undefined) {
|
|
9
12
|
return gasTotalPrice + transactionValue;
|
|
10
13
|
}
|
|
11
14
|
return transactionValue || gasTotalPrice;
|
|
12
|
-
}, [gasTotalPrice, transactionValue]);
|
|
15
|
+
}, [gasTotalPrice, transactionValue, isGasSponsored]);
|
|
13
16
|
|
|
14
17
|
exports.useTransactionTotal = useTransactionTotal;
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
type UseTransactionTotalProps = {
|
|
2
2
|
transactionValue?: bigint;
|
|
3
3
|
gasTotalPrice?: bigint;
|
|
4
|
+
isGasSponsored?: boolean;
|
|
4
5
|
};
|
|
5
|
-
export declare const useTransactionTotal: ({ transactionValue, gasTotalPrice, }: UseTransactionTotalProps) => bigint | undefined;
|
|
6
|
+
export declare const useTransactionTotal: ({ transactionValue, gasTotalPrice, isGasSponsored, }: UseTransactionTotalProps) => bigint | undefined;
|
|
6
7
|
export {};
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
const useTransactionTotal = ({ transactionValue, gasTotalPrice, }) => useMemo(() => {
|
|
3
|
+
const useTransactionTotal = ({ transactionValue, gasTotalPrice, isGasSponsored = false, }) => useMemo(() => {
|
|
4
|
+
if (isGasSponsored && transactionValue !== undefined) {
|
|
5
|
+
return transactionValue;
|
|
6
|
+
}
|
|
4
7
|
if (gasTotalPrice !== undefined && transactionValue !== undefined) {
|
|
5
8
|
return gasTotalPrice + transactionValue;
|
|
6
9
|
}
|
|
7
10
|
return transactionValue || gasTotalPrice;
|
|
8
|
-
}, [gasTotalPrice, transactionValue]);
|
|
11
|
+
}, [gasTotalPrice, transactionValue, isGasSponsored]);
|
|
9
12
|
|
|
10
13
|
export { useTransactionTotal };
|
|
@@ -63,7 +63,7 @@ require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
|
63
63
|
|
|
64
64
|
const WalletSignSpinnerView = () => {
|
|
65
65
|
const { goToInitialView } = ViewContext.useViewContext();
|
|
66
|
-
const { setMultiWalletWidgetState,
|
|
66
|
+
const { setMultiWalletWidgetState, setSelectedWalletConnectorKey, selectedWalletConnector: walletConnector, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
67
67
|
if (!walletConnector) {
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
@@ -72,7 +72,7 @@ const WalletSignSpinnerView = () => {
|
|
|
72
72
|
const handleClose = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
73
73
|
goToInitialView();
|
|
74
74
|
setMultiWalletWidgetState('idle');
|
|
75
|
-
|
|
75
|
+
setSelectedWalletConnectorKey(null);
|
|
76
76
|
yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.endSession());
|
|
77
77
|
});
|
|
78
78
|
const icon = (jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: key, style: {
|
|
@@ -59,7 +59,7 @@ import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
|
59
59
|
|
|
60
60
|
const WalletSignSpinnerView = () => {
|
|
61
61
|
const { goToInitialView } = useViewContext();
|
|
62
|
-
const { setMultiWalletWidgetState,
|
|
62
|
+
const { setMultiWalletWidgetState, setSelectedWalletConnectorKey, selectedWalletConnector: walletConnector, } = useInternalDynamicContext();
|
|
63
63
|
if (!walletConnector) {
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
@@ -68,7 +68,7 @@ const WalletSignSpinnerView = () => {
|
|
|
68
68
|
const handleClose = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
69
|
goToInitialView();
|
|
70
70
|
setMultiWalletWidgetState('idle');
|
|
71
|
-
|
|
71
|
+
setSelectedWalletConnectorKey(null);
|
|
72
72
|
yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.endSession());
|
|
73
73
|
});
|
|
74
74
|
const icon = (jsx(WalletIcon, { walletKey: key, style: {
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs
CHANGED
|
@@ -56,6 +56,7 @@ var PopperContext = require('../../../components/Popper/PopperContext/PopperCont
|
|
|
56
56
|
var ModalCard = require('../../../components/ModalCard/ModalCard.cjs');
|
|
57
57
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
58
58
|
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
59
|
+
var IsBrowser = require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
59
60
|
var SocialRedirectContext = require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
60
61
|
require('../../../views/WalletList/WalletList.cjs');
|
|
61
62
|
var viewToComponentMap = require('../../../views/viewToComponentMap.cjs');
|
|
@@ -82,7 +83,7 @@ const DynamicEmbeddedAuthFlow = ({ background = 'none', className, style, }) =>
|
|
|
82
83
|
if (hide)
|
|
83
84
|
return null;
|
|
84
85
|
const content = (jsxRuntime.jsx(DynamicAuthLayout.DynamicAuthLayout, { className: className, style: style, projectSettings: projectSettings, children: viewToComponentMap.viewToComponentMap[authView] }));
|
|
85
|
-
return (jsxRuntime.jsx(ShadowDOM.ShadowDOM, { className: 'embedded-widget', children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: jsxRuntime.jsx(SocialRedirectContext.SocialRedirectContextProvider, { children: jsxRuntime.jsx(index.FooterAnimationContextProvider, { children: background === 'none' ? (content) : (jsxRuntime.jsx(ModalCard.ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }) }) }));
|
|
86
|
+
return (jsxRuntime.jsx(IsBrowser.IsBrowser, { children: jsxRuntime.jsx(ShadowDOM.ShadowDOM, { className: 'embedded-widget', children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: jsxRuntime.jsx(SocialRedirectContext.SocialRedirectContextProvider, { children: jsxRuntime.jsx(index.FooterAnimationContextProvider, { children: background === 'none' ? (content) : (jsxRuntime.jsx(ModalCard.ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }) }) }) }));
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
exports.DynamicEmbeddedAuthFlow = DynamicEmbeddedAuthFlow;
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { EmbedProps } from '../EmbedProps.type';
|
|
3
2
|
import { ClassStyleProps } from '../../../utils/types';
|
|
3
|
+
import { EmbedProps } from '../EmbedProps.type';
|
|
4
4
|
type DynamicEmbeddedAuthFlowProps = EmbedProps & ClassStyleProps;
|
|
5
5
|
export declare const DynamicEmbeddedAuthFlow: FC<DynamicEmbeddedAuthFlowProps>;
|
|
6
6
|
export {};
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js
CHANGED
|
@@ -52,6 +52,7 @@ import { PopperProvider } from '../../../components/Popper/PopperContext/PopperC
|
|
|
52
52
|
import { ModalCard } from '../../../components/ModalCard/ModalCard.js';
|
|
53
53
|
import '../../../components/InlineWidget/InlineWidget.js';
|
|
54
54
|
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
55
|
+
import { IsBrowser } from '../../../components/IsBrowser/IsBrowser.js';
|
|
55
56
|
import { SocialRedirectContextProvider } from '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
56
57
|
import '../../../views/WalletList/WalletList.js';
|
|
57
58
|
import { viewToComponentMap } from '../../../views/viewToComponentMap.js';
|
|
@@ -78,7 +79,7 @@ const DynamicEmbeddedAuthFlow = ({ background = 'none', className, style, }) =>
|
|
|
78
79
|
if (hide)
|
|
79
80
|
return null;
|
|
80
81
|
const content = (jsx(DynamicAuthLayout, { className: className, style: style, projectSettings: projectSettings, children: viewToComponentMap[authView] }));
|
|
81
|
-
return (jsx(ShadowDOM, { className: 'embedded-widget', children: jsx(PopperProvider, { children: jsx(SocialRedirectContextProvider, { children: jsx(FooterAnimationContextProvider, { children: background === 'none' ? (content) : (jsx(ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }) }) }));
|
|
82
|
+
return (jsx(IsBrowser, { children: jsx(ShadowDOM, { className: 'embedded-widget', children: jsx(PopperProvider, { children: jsx(SocialRedirectContextProvider, { children: jsx(FooterAnimationContextProvider, { children: background === 'none' ? (content) : (jsx(ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }) }) }) }));
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
export { DynamicEmbeddedAuthFlow };
|
|
@@ -52,13 +52,14 @@ var PopperContext = require('../../../components/Popper/PopperContext/PopperCont
|
|
|
52
52
|
var ModalCard = require('../../../components/ModalCard/ModalCard.cjs');
|
|
53
53
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
54
54
|
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
55
|
+
var IsBrowser = require('../../../components/IsBrowser/IsBrowser.cjs');
|
|
55
56
|
|
|
56
57
|
const DynamicEmbeddedUserProfile = ({ background = 'none', className, style }) => {
|
|
57
58
|
const show = useIsLoggedIn.useIsLoggedIn();
|
|
58
59
|
if (!show)
|
|
59
60
|
return null;
|
|
60
61
|
const content = (jsxRuntime.jsx(DynamicUserProfileLayout.DynamicUserProfileLayout, { className: className, style: style, variant: 'modal' }));
|
|
61
|
-
return (jsxRuntime.jsx(ShadowDOM.ShadowDOM, { className: 'embedded-widget', children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: background === 'none' ? (content) : (jsxRuntime.jsx(ModalCard.ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }));
|
|
62
|
+
return (jsxRuntime.jsx(IsBrowser.IsBrowser, { children: jsxRuntime.jsx(ShadowDOM.ShadowDOM, { className: 'embedded-widget', children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: background === 'none' ? (content) : (jsxRuntime.jsx(ModalCard.ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }) }));
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
exports.DynamicEmbeddedUserProfile = DynamicEmbeddedUserProfile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { EmbedProps } from '../EmbedProps.type';
|
|
3
2
|
import { ClassStyleProps } from '../../../utils/types';
|
|
3
|
+
import { EmbedProps } from '../EmbedProps.type';
|
|
4
4
|
type DynamicEmbeddedUserProfileProps = EmbedProps & ClassStyleProps;
|
|
5
5
|
export declare const DynamicEmbeddedUserProfile: FC<DynamicEmbeddedUserProfileProps>;
|
|
6
6
|
export {};
|
|
@@ -48,13 +48,14 @@ import { PopperProvider } from '../../../components/Popper/PopperContext/PopperC
|
|
|
48
48
|
import { ModalCard } from '../../../components/ModalCard/ModalCard.js';
|
|
49
49
|
import '../../../components/InlineWidget/InlineWidget.js';
|
|
50
50
|
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
51
|
+
import { IsBrowser } from '../../../components/IsBrowser/IsBrowser.js';
|
|
51
52
|
|
|
52
53
|
const DynamicEmbeddedUserProfile = ({ background = 'none', className, style }) => {
|
|
53
54
|
const show = useIsLoggedIn();
|
|
54
55
|
if (!show)
|
|
55
56
|
return null;
|
|
56
57
|
const content = (jsx(DynamicUserProfileLayout, { className: className, style: style, variant: 'modal' }));
|
|
57
|
-
return (jsx(ShadowDOM, { className: 'embedded-widget', children: jsx(PopperProvider, { children: background === 'none' ? (content) : (jsx(ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }));
|
|
58
|
+
return (jsx(IsBrowser, { children: jsx(ShadowDOM, { className: 'embedded-widget', children: jsx(PopperProvider, { children: background === 'none' ? (content) : (jsx(ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }) }));
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
export { DynamicEmbeddedUserProfile };
|
package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs
CHANGED
|
@@ -19,7 +19,7 @@ require('../../../../shared/consts/index.cjs');
|
|
|
19
19
|
require('@dynamic-labs/multi-wallet');
|
|
20
20
|
require('@dynamic-labs/rpc-providers');
|
|
21
21
|
require('../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
22
|
-
require('../../../../context/DynamicContext/
|
|
22
|
+
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
23
23
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
24
24
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
25
25
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
@@ -55,7 +55,6 @@ require('@dynamic-labs/types');
|
|
|
55
55
|
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
56
56
|
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
57
57
|
var useKYCFlag = require('../../../../utils/hooks/useKYCFlag/useKYCFlag.cjs');
|
|
58
|
-
var useMultiWalletFlag = require('../../../../utils/hooks/useMultiWalletFlag/useMultiWalletFlag.cjs');
|
|
59
58
|
var DynamicWidgetWalletHeader = require('./DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs');
|
|
60
59
|
|
|
61
60
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -74,19 +73,19 @@ const options = [
|
|
|
74
73
|
];
|
|
75
74
|
const DynamicWidgetHeader = ({ variant, }) => {
|
|
76
75
|
const { dynamicWidgetView, setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
76
|
+
const { multiWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
77
77
|
const isKYCEnabled = useKYCFlag.useKYCFlag();
|
|
78
|
-
const isMultiWalletEnabled = useMultiWalletFlag.useMultiWalletFlag();
|
|
79
78
|
// Marks 'Profile' view as active when client goes to 'Edit Profile' view
|
|
80
79
|
const dynamicWidgetSwitcherOverwriteValue = React.useMemo(() => {
|
|
81
|
-
if (!isKYCEnabled && !
|
|
80
|
+
if (!isKYCEnabled && !multiWallet)
|
|
82
81
|
return 'wallets';
|
|
83
82
|
if (dynamicWidgetView === 'edit-profile')
|
|
84
83
|
return 'profile';
|
|
85
84
|
return dynamicWidgetView;
|
|
86
|
-
}, [dynamicWidgetView, isKYCEnabled,
|
|
87
|
-
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-header', children: [isKYCEnabled &&
|
|
85
|
+
}, [dynamicWidgetView, isKYCEnabled, multiWallet]);
|
|
86
|
+
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-header', children: [isKYCEnabled && multiWallet && (jsxRuntime.jsx(OptionsSwitcher.OptionsSwitcher, { rootClassName: 'dynamic-widget-header__switcher', value: dynamicWidgetSwitcherOverwriteValue, options: options, onChange: (view) => setDynamicWidgetView(view) })), (dynamicWidgetSwitcherOverwriteValue === 'wallets' ||
|
|
88
87
|
(dynamicWidgetSwitcherOverwriteValue === 'profile' &&
|
|
89
|
-
!
|
|
88
|
+
!multiWallet)) && jsxRuntime.jsx(DynamicWidgetWalletHeader.DynamicWidgetWalletHeader, { variant: variant })] }));
|
|
90
89
|
};
|
|
91
90
|
const MemoizedDynamicWidgetHeader = React__default["default"].memo(DynamicWidgetHeader);
|
|
92
91
|
|