@dynamic-labs/sdk-react-core 4.91.3 → 4.91.4
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 +8 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/client/client.cjs +1 -1
- package/src/lib/client/client.js +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +4 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +4 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +3 -0
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +3 -0
- package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.cjs +1 -1
- package/src/lib/context/DynamicContext/hooks/useRemoveWallet/useRemoveWallet.js +1 -1
- package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +13 -1
- package/src/lib/context/OnrampContext/OnrampContext.cjs +1 -1
- package/src/lib/context/OnrampContext/OnrampContext.js +1 -1
- package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.cjs +2 -2
- package/src/lib/context/SendBalanceContext/SendBalanceContext.errors.js +2 -2
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +3 -3
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +3 -3
- package/src/lib/data/api/email/email.cjs +6 -3
- package/src/lib/data/api/email/email.js +6 -3
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +5 -5
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +5 -5
- package/src/lib/data/api/exchangeAccounts/exchangeAccounts.cjs +3 -3
- package/src/lib/data/api/exchangeAccounts/exchangeAccounts.js +3 -3
- package/src/lib/data/api/oauth/oauth.cjs +3 -2
- package/src/lib/data/api/oauth/oauth.js +3 -2
- package/src/lib/data/api/session/session.cjs +3 -3
- package/src/lib/data/api/session/session.js +3 -3
- package/src/lib/data/api/sms/sms.cjs +4 -1
- package/src/lib/data/api/sms/sms.js +4 -1
- package/src/lib/data/api/user/user.cjs +4 -4
- package/src/lib/data/api/user/user.js +4 -4
- package/src/lib/data/api/wallets/wallets.cjs +15 -13
- package/src/lib/data/api/wallets/wallets.js +15 -13
- package/src/lib/store/state/nonce/nonce.cjs +1 -1
- package/src/lib/store/state/nonce/nonce.js +1 -1
- package/src/lib/utils/functions/generateMessages/index.cjs +3 -3
- package/src/lib/utils/functions/generateMessages/index.js +3 -3
- package/src/lib/utils/functions/getEmbeddedWalletAuthHandler/getEmbeddedWalletAuthHandler.cjs +1 -1
- package/src/lib/utils/functions/getEmbeddedWalletAuthHandler/getEmbeddedWalletAuthHandler.js +1 -1
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.cjs +30 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.d.ts +17 -0
- package/src/lib/utils/functions/getTransactionLink/blockExplorerPatterns.js +29 -1
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.cjs +13 -1
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.d.ts +2 -1
- package/src/lib/utils/functions/getTransactionLink/getTransactionLink.js +14 -2
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.cjs +2 -2
- package/src/lib/utils/hooks/authenticationHooks/useOtpVerificationRequest/useOtpVerificationRequest.js +2 -2
- package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.cjs +2 -2
- package/src/lib/utils/hooks/useAuthenticateConnectedUser/useAuthenticateConnectedUser.js +2 -2
- package/src/lib/utils/hooks/useConfirmationPortal/useConfirmationPortal.cjs +1 -1
- package/src/lib/utils/hooks/useConfirmationPortal/useConfirmationPortal.js +1 -1
- package/src/lib/utils/hooks/useConnectExchangeForFunding/useConnectExchangeForFunding.cjs +1 -1
- package/src/lib/utils/hooks/useConnectExchangeForFunding/useConnectExchangeForFunding.js +1 -1
- package/src/lib/utils/hooks/useConnectUnifiedForFunding/useConnectUnifiedForFunding.cjs +2 -2
- package/src/lib/utils/hooks/useConnectUnifiedForFunding/useConnectUnifiedForFunding.js +2 -2
- package/src/lib/utils/hooks/useConnectWallet/HandleConnectWalletRejectionError.cjs +1 -1
- package/src/lib/utils/hooks/useConnectWallet/HandleConnectWalletRejectionError.js +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/errors/ConnectorSetupError.cjs +1 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/utils/errors/ConnectorSetupError.js +1 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +8 -8
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +8 -8
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +4 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +4 -4
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +9 -9
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +9 -9
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +2 -2
- package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +2 -2
- package/src/lib/utils/hooks/useFundingHelpers/useFundingHelpers.cjs +2 -2
- package/src/lib/utils/hooks/useFundingHelpers/useFundingHelpers.js +2 -2
- package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.cjs +1 -1
- package/src/lib/utils/hooks/useGetMfaToken/useGetMfaToken.js +1 -1
- package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.cjs +2 -2
- package/src/lib/utils/hooks/useSignEip7702Authorization/useSignEip7702Authorization.js +2 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +2 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +2 -2
- package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.cjs +2 -2
- package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.js +2 -2
- package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.cjs +3 -3
- package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.js +3 -3
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +1 -1
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +1 -1
- package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.cjs +1 -1
- package/src/lib/utils/hooks/useUserDataForm/useUserDataForm.js +1 -1
- package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.cjs +3 -3
- package/src/lib/utils/hooks/useUserUpdateRequest/unlinkUserEmail/unlinkUserEmail.js +3 -3
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs +1 -1
- package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
- package/src/lib/utils/hooks/useViewSettings/useViewSettings.d.ts +5 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +1 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +1 -1
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.cjs +1 -1
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.js +1 -1
- package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.cjs +1 -1
- package/src/lib/views/BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.js +1 -1
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +2 -2
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +2 -2
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.cjs +2 -2
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.js +2 -2
- package/src/lib/views/ExportSharesView/ExportSharesView.cjs +2 -2
- package/src/lib/views/ExportSharesView/ExportSharesView.js +2 -2
- package/src/lib/views/LoginView/useLoginView/useLoginView.cjs +1 -1
- package/src/lib/views/LoginView/useLoginView/useLoginView.js +1 -1
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs +1 -1
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js +1 -1
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +2 -2
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +2 -2
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/BundleValidation/PasskeyBundleRecovery.js +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/CompleteRecovery/PasskeyCompleteRecovery.js +1 -1
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.cjs +3 -3
- package/src/lib/views/Passkey/utils/createEmbeddedWalletRequest/createEmbeddedWalletRequest.js +3 -3
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +14 -14
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +14 -14
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +2 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.js +2 -2
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.cjs +1 -1
- package/src/lib/views/WalletDelegation/WalletDelegationView/WalletDelegationView.js +1 -1
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +1 -1
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/getPromptAmountParams/getPromptAmountParams.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/getPromptAmountParams/getPromptAmountParams.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/utils/useSubmitWalletFunding/useSubmitWalletFunding.cjs +10 -1
- package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/utils/useSubmitWalletFunding/useSubmitWalletFunding.js +10 -1
|
@@ -50,10 +50,10 @@ const useSignEip7702Authorization = () => {
|
|
|
50
50
|
// Use provided wallet or fallback to primary wallet
|
|
51
51
|
const wallet = providedWallet !== null && providedWallet !== void 0 ? providedWallet : primaryWallet;
|
|
52
52
|
if (!wallet) {
|
|
53
|
-
throw new utils.DynamicError('No wallet available. Please connect a wallet first.');
|
|
53
|
+
throw new utils.DynamicError('No wallet available. Please connect a wallet first.', 'no_wallet_available');
|
|
54
54
|
}
|
|
55
55
|
if (((_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.key) !== 'zerodev') {
|
|
56
|
-
throw new utils.DynamicError('The wallet connector must be a ZeroDev connector to sign EIP-7702 authorizations.');
|
|
56
|
+
throw new utils.DynamicError('The wallet connector must be a ZeroDev connector to sign EIP-7702 authorizations.', 'invalid_connector_for_eip7702');
|
|
57
57
|
}
|
|
58
58
|
return wallet.connector.signEip7702PreAuth(providedChainId);
|
|
59
59
|
}), [primaryWallet]);
|
|
@@ -46,10 +46,10 @@ const useSignEip7702Authorization = () => {
|
|
|
46
46
|
// Use provided wallet or fallback to primary wallet
|
|
47
47
|
const wallet = providedWallet !== null && providedWallet !== void 0 ? providedWallet : primaryWallet;
|
|
48
48
|
if (!wallet) {
|
|
49
|
-
throw new DynamicError('No wallet available. Please connect a wallet first.');
|
|
49
|
+
throw new DynamicError('No wallet available. Please connect a wallet first.', 'no_wallet_available');
|
|
50
50
|
}
|
|
51
51
|
if (((_a = wallet.connector) === null || _a === void 0 ? void 0 : _a.key) !== 'zerodev') {
|
|
52
|
-
throw new DynamicError('The wallet connector must be a ZeroDev connector to sign EIP-7702 authorizations.');
|
|
52
|
+
throw new DynamicError('The wallet connector must be a ZeroDev connector to sign EIP-7702 authorizations.', 'invalid_connector_for_eip7702');
|
|
53
53
|
}
|
|
54
54
|
return wallet.connector.signEip7702PreAuth(providedChainId);
|
|
55
55
|
}), [primaryWallet]);
|
|
@@ -455,11 +455,11 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
455
455
|
const checkCaptchaAndConnect = React.useCallback((props) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
456
456
|
var _m;
|
|
457
457
|
if (props.authMode === 'signin' && client.getDynamicClient().user) {
|
|
458
|
-
throw new utils.DynamicError('User is already logged in');
|
|
458
|
+
throw new utils.DynamicError('User is already logged in', 'user_is_already_logged_in');
|
|
459
459
|
}
|
|
460
460
|
else if ((props.authMode === 'link' || props.authMode === 'stepup') &&
|
|
461
461
|
!client.getDynamicClient().user) {
|
|
462
|
-
throw new utils.DynamicError('User is not logged in');
|
|
462
|
+
throw new utils.DynamicError('User is not logged in', 'user_is_not_logged_in');
|
|
463
463
|
}
|
|
464
464
|
if (!((_m = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security.hCaptcha) === null || _m === void 0 ? void 0 : _m.enabled)) {
|
|
465
465
|
yield connectSocialAccount(props);
|
|
@@ -451,11 +451,11 @@ const useSocialAuth = ({ onSettled, onError, onFarcasterUrl, }) => {
|
|
|
451
451
|
const checkCaptchaAndConnect = useCallback((props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
452
452
|
var _m;
|
|
453
453
|
if (props.authMode === 'signin' && getDynamicClient().user) {
|
|
454
|
-
throw new DynamicError('User is already logged in');
|
|
454
|
+
throw new DynamicError('User is already logged in', 'user_is_already_logged_in');
|
|
455
455
|
}
|
|
456
456
|
else if ((props.authMode === 'link' || props.authMode === 'stepup') &&
|
|
457
457
|
!getDynamicClient().user) {
|
|
458
|
-
throw new DynamicError('User is not logged in');
|
|
458
|
+
throw new DynamicError('User is not logged in', 'user_is_not_logged_in');
|
|
459
459
|
}
|
|
460
460
|
if (!((_m = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security.hCaptcha) === null || _m === void 0 ? void 0 : _m.enabled)) {
|
|
461
461
|
yield connectSocialAccount(props);
|
|
@@ -58,7 +58,7 @@ const useTransferWallet = () => {
|
|
|
58
58
|
}, [primaryWallet]);
|
|
59
59
|
return React.useCallback((props) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
60
60
|
if (!user)
|
|
61
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
61
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
62
62
|
const { overrideSiweStatement, walletConnector } = props;
|
|
63
63
|
const args = Object.assign(Object.assign({}, props), { displaySiweStatement,
|
|
64
64
|
environmentId, siweStatement: overrideSiweStatement, walletProvider: walletConnectorCore.getWalletProvider(walletConnector) });
|
|
@@ -76,7 +76,7 @@ const useTransferWallet = () => {
|
|
|
76
76
|
}
|
|
77
77
|
const userProfile = yield wallets.transferWallet(environmentId, verifyArgs);
|
|
78
78
|
if (!userProfile) {
|
|
79
|
-
throw new utils.DynamicError('Error transferring wallet.');
|
|
79
|
+
throw new utils.DynamicError('Error transferring wallet.', 'transferring_wallet');
|
|
80
80
|
}
|
|
81
81
|
updatePrimaryWallet(walletConnector, userProfile);
|
|
82
82
|
const walletId = userProfile.lastVerifiedCredentialId;
|
|
@@ -54,7 +54,7 @@ const useTransferWallet = () => {
|
|
|
54
54
|
}, [primaryWallet]);
|
|
55
55
|
return useCallback((props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
56
|
if (!user)
|
|
57
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
57
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
58
58
|
const { overrideSiweStatement, walletConnector } = props;
|
|
59
59
|
const args = Object.assign(Object.assign({}, props), { displaySiweStatement,
|
|
60
60
|
environmentId, siweStatement: overrideSiweStatement, walletProvider: getWalletProvider(walletConnector) });
|
|
@@ -72,7 +72,7 @@ const useTransferWallet = () => {
|
|
|
72
72
|
}
|
|
73
73
|
const userProfile = yield transferWallet(environmentId, verifyArgs);
|
|
74
74
|
if (!userProfile) {
|
|
75
|
-
throw new DynamicError('Error transferring wallet.');
|
|
75
|
+
throw new DynamicError('Error transferring wallet.', 'transferring_wallet');
|
|
76
76
|
}
|
|
77
77
|
updatePrimaryWallet(walletConnector, userProfile);
|
|
78
78
|
const walletId = userProfile.lastVerifiedCredentialId;
|
|
@@ -63,14 +63,14 @@ const useUpgradeEmbeddedWallet = () => {
|
|
|
63
63
|
const upgradeEmbeddedWallet = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
64
64
|
var _a, _b, _c, _d;
|
|
65
65
|
if (!user)
|
|
66
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
66
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
67
67
|
const userHasV2EmbeddedWallet = user.verifiedCredentials.some((credential) => { var _a; return ((_a = credential.walletProperties) === null || _a === void 0 ? void 0 : _a.version) === sdkApiCore.EmbeddedWalletVersionEnum.V2; });
|
|
68
68
|
if (userHasV2EmbeddedWallet) {
|
|
69
|
-
throw new utils.DynamicError(errors.USER_HAS_V2_EMBEDDED_WALLET);
|
|
69
|
+
throw new utils.DynamicError(errors.USER_HAS_V2_EMBEDDED_WALLET, 'user_has_v2_embedded_wallet');
|
|
70
70
|
}
|
|
71
71
|
const requiredSessionKey = shouldRegisterSessionKeysOnSignin();
|
|
72
72
|
if (!requiredSessionKey) {
|
|
73
|
-
throw new utils.DynamicError(errors.INCOMPATIBLE_SDK_VERSION);
|
|
73
|
+
throw new utils.DynamicError(errors.INCOMPATIBLE_SDK_VERSION, 'incompatible_sdk_version');
|
|
74
74
|
}
|
|
75
75
|
const sessionPublicKey = getSessionPublicKey();
|
|
76
76
|
const verifyResponse = yield wallets.upgradeEmbeddedWalletToV2({
|
|
@@ -59,14 +59,14 @@ const useUpgradeEmbeddedWallet = () => {
|
|
|
59
59
|
const upgradeEmbeddedWallet = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
60
|
var _a, _b, _c, _d;
|
|
61
61
|
if (!user)
|
|
62
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
62
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
63
63
|
const userHasV2EmbeddedWallet = user.verifiedCredentials.some((credential) => { var _a; return ((_a = credential.walletProperties) === null || _a === void 0 ? void 0 : _a.version) === EmbeddedWalletVersionEnum.V2; });
|
|
64
64
|
if (userHasV2EmbeddedWallet) {
|
|
65
|
-
throw new DynamicError(USER_HAS_V2_EMBEDDED_WALLET);
|
|
65
|
+
throw new DynamicError(USER_HAS_V2_EMBEDDED_WALLET, 'user_has_v2_embedded_wallet');
|
|
66
66
|
}
|
|
67
67
|
const requiredSessionKey = shouldRegisterSessionKeysOnSignin();
|
|
68
68
|
if (!requiredSessionKey) {
|
|
69
|
-
throw new DynamicError(INCOMPATIBLE_SDK_VERSION);
|
|
69
|
+
throw new DynamicError(INCOMPATIBLE_SDK_VERSION, 'incompatible_sdk_version');
|
|
70
70
|
}
|
|
71
71
|
const sessionPublicKey = getSessionPublicKey();
|
|
72
72
|
const verifyResponse = yield upgradeEmbeddedWalletToV2({
|
|
@@ -157,7 +157,7 @@ const useUserAuth = ({ authMethod, }) => {
|
|
|
157
157
|
const verifyResponse = yield verifyFunction();
|
|
158
158
|
if (!verifyResponse) {
|
|
159
159
|
yield cancelAuth();
|
|
160
|
-
throw new utils.DynamicError('No user returned from verify function');
|
|
160
|
+
throw new utils.DynamicError('No user returned from verify function', 'no_user_returned_from_verify_function');
|
|
161
161
|
}
|
|
162
162
|
let verifiedUser;
|
|
163
163
|
if (isVerifyResponse(verifyResponse)) {
|
|
@@ -153,7 +153,7 @@ const useUserAuth = ({ authMethod, }) => {
|
|
|
153
153
|
const verifyResponse = yield verifyFunction();
|
|
154
154
|
if (!verifyResponse) {
|
|
155
155
|
yield cancelAuth();
|
|
156
|
-
throw new DynamicError('No user returned from verify function');
|
|
156
|
+
throw new DynamicError('No user returned from verify function', 'no_user_returned_from_verify_function');
|
|
157
157
|
}
|
|
158
158
|
let verifiedUser;
|
|
159
159
|
if (isVerifyResponse(verifyResponse)) {
|
|
@@ -89,7 +89,7 @@ const useUserDataForm = ({ onSubmit, onError, userProfile, shouldEnforcePolicies
|
|
|
89
89
|
return;
|
|
90
90
|
try {
|
|
91
91
|
if (!(userProfile === null || userProfile === void 0 ? void 0 : userProfile.environmentId))
|
|
92
|
-
throw new utils.DynamicError('Invalid environment ID');
|
|
92
|
+
throw new utils.DynamicError('Invalid environment ID', 'invalid_environment_id');
|
|
93
93
|
setFetch(true);
|
|
94
94
|
let updatedUserFields = values;
|
|
95
95
|
// all kyc fields including custom are in the object, move custom fields to the object.metadata
|
|
@@ -85,7 +85,7 @@ const useUserDataForm = ({ onSubmit, onError, userProfile, shouldEnforcePolicies
|
|
|
85
85
|
return;
|
|
86
86
|
try {
|
|
87
87
|
if (!(userProfile === null || userProfile === void 0 ? void 0 : userProfile.environmentId))
|
|
88
|
-
throw new DynamicError('Invalid environment ID');
|
|
88
|
+
throw new DynamicError('Invalid environment ID', 'invalid_environment_id');
|
|
89
89
|
setFetch(true);
|
|
90
90
|
let updatedUserFields = values;
|
|
91
91
|
// all kyc fields including custom are in the object, move custom fields to the object.metadata
|
|
@@ -20,14 +20,14 @@ const useUnlinkUserEmail = () => {
|
|
|
20
20
|
const user$1 = (_b = client.getDynamicClient()) === null || _b === void 0 ? void 0 : _b.user;
|
|
21
21
|
const primaryWalletId$1 = primaryWalletId.getPrimaryWalletId();
|
|
22
22
|
if (!primaryWalletId$1) {
|
|
23
|
-
throw new utils.DynamicError('Primary wallet not found');
|
|
23
|
+
throw new utils.DynamicError('Primary wallet not found', 'primary_wallet_not_found');
|
|
24
24
|
}
|
|
25
25
|
const verifiedCredential = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.find((credential) => credential.id === verifiedCredentialId);
|
|
26
26
|
if (!verifiedCredential) {
|
|
27
|
-
throw new utils.DynamicError('Verified credential not found');
|
|
27
|
+
throw new utils.DynamicError('Verified credential not found', 'verified_credential_not_found');
|
|
28
28
|
}
|
|
29
29
|
if (verifiedCredential.format !== sdkApiCore.JwtVerifiedCredentialFormatEnum.Email) {
|
|
30
|
-
throw new utils.DynamicError('Verified credential is not an email');
|
|
30
|
+
throw new utils.DynamicError('Verified credential is not an email', 'verified_credential_is_not_an_email');
|
|
31
31
|
}
|
|
32
32
|
return user.unlinkEmail({
|
|
33
33
|
environmentId,
|
|
@@ -16,14 +16,14 @@ const useUnlinkUserEmail = () => {
|
|
|
16
16
|
const user = (_b = getDynamicClient()) === null || _b === void 0 ? void 0 : _b.user;
|
|
17
17
|
const primaryWalletId = getPrimaryWalletId();
|
|
18
18
|
if (!primaryWalletId) {
|
|
19
|
-
throw new DynamicError('Primary wallet not found');
|
|
19
|
+
throw new DynamicError('Primary wallet not found', 'primary_wallet_not_found');
|
|
20
20
|
}
|
|
21
21
|
const verifiedCredential = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.id === verifiedCredentialId);
|
|
22
22
|
if (!verifiedCredential) {
|
|
23
|
-
throw new DynamicError('Verified credential not found');
|
|
23
|
+
throw new DynamicError('Verified credential not found', 'verified_credential_not_found');
|
|
24
24
|
}
|
|
25
25
|
if (verifiedCredential.format !== JwtVerifiedCredentialFormatEnum.Email) {
|
|
26
|
-
throw new DynamicError('Verified credential is not an email');
|
|
26
|
+
throw new DynamicError('Verified credential is not an email', 'verified_credential_is_not_an_email');
|
|
27
27
|
}
|
|
28
28
|
return unlinkEmail({
|
|
29
29
|
environmentId,
|
package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.cjs
CHANGED
|
@@ -56,7 +56,7 @@ const useUpdateUserWithModal = (updateUser) => {
|
|
|
56
56
|
const { pushView } = ViewContext.useViewContext();
|
|
57
57
|
const editorContext = React.useContext(UserFieldEditorContext.UserFieldEditorContext);
|
|
58
58
|
if (!editorContext)
|
|
59
|
-
throw new utils.DynamicError('useUserUpdateRequest can only be used inside the context of DynamicContextProvider');
|
|
59
|
+
throw new utils.DynamicError('useUserUpdateRequest can only be used inside the context of DynamicContextProvider', 'missing_dynamic_context');
|
|
60
60
|
const { open: promptUserForValues } = editorContext;
|
|
61
61
|
const updateUserWithModal = React.useCallback((fields, options) => new Promise((resolve, reject) => {
|
|
62
62
|
// Catch invalid requests
|
package/src/lib/utils/hooks/useUserUpdateRequest/useUpdateUserWithModal/useUpdateUserWithModal.js
CHANGED
|
@@ -52,7 +52,7 @@ const useUpdateUserWithModal = (updateUser) => {
|
|
|
52
52
|
const { pushView } = useViewContext();
|
|
53
53
|
const editorContext = useContext(UserFieldEditorContext);
|
|
54
54
|
if (!editorContext)
|
|
55
|
-
throw new DynamicError('useUserUpdateRequest can only be used inside the context of DynamicContextProvider');
|
|
55
|
+
throw new DynamicError('useUserUpdateRequest can only be used inside the context of DynamicContextProvider', 'missing_dynamic_context');
|
|
56
56
|
const { open: promptUserForValues } = editorContext;
|
|
57
57
|
const updateUserWithModal = useCallback((fields, options) => new Promise((resolve, reject) => {
|
|
58
58
|
// Catch invalid requests
|
|
@@ -279,7 +279,7 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
|
|
|
279
279
|
}
|
|
280
280
|
const authMode$1 = authMode.getAuthMode();
|
|
281
281
|
if (connectedWallets.length && authMode$1 === 'connect-only') {
|
|
282
|
-
throw new utils.DynamicError(e.message);
|
|
282
|
+
throw new utils.DynamicError(e.message, 'unknown');
|
|
283
283
|
}
|
|
284
284
|
const userRejectedRequestError = (_a = e === null || e === void 0 ? void 0 : e.message) === null || _a === void 0 ? void 0 : _a.includes('User rejected the request');
|
|
285
285
|
const fallbackToConnectOnly = shouldFallbackToConnectOnly && !userRejectedRequestError;
|
|
@@ -323,7 +323,7 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
|
|
|
323
323
|
onVerifySuccess: (user) => {
|
|
324
324
|
var _a;
|
|
325
325
|
if (!user) {
|
|
326
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
326
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
327
327
|
}
|
|
328
328
|
try {
|
|
329
329
|
(_a = events === null || events === void 0 ? void 0 : events.onSignedMessage) === null || _a === void 0 ? void 0 : _a.call(events, {
|
|
@@ -275,7 +275,7 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
|
|
|
275
275
|
}
|
|
276
276
|
const authMode = getAuthMode();
|
|
277
277
|
if (connectedWallets.length && authMode === 'connect-only') {
|
|
278
|
-
throw new DynamicError(e.message);
|
|
278
|
+
throw new DynamicError(e.message, 'unknown');
|
|
279
279
|
}
|
|
280
280
|
const userRejectedRequestError = (_a = e === null || e === void 0 ? void 0 : e.message) === null || _a === void 0 ? void 0 : _a.includes('User rejected the request');
|
|
281
281
|
const fallbackToConnectOnly = shouldFallbackToConnectOnly && !userRejectedRequestError;
|
|
@@ -319,7 +319,7 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
|
|
|
319
319
|
onVerifySuccess: (user) => {
|
|
320
320
|
var _a;
|
|
321
321
|
if (!user) {
|
|
322
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
322
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
323
323
|
}
|
|
324
324
|
try {
|
|
325
325
|
(_a = events === null || events === void 0 ? void 0 : events.onSignedMessage) === null || _a === void 0 ? void 0 : _a.call(events, {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
export declare const useViewSettings: <T extends import("@dynamic-labs/sdk-api-core").SdkViewType | "wallet-list", R extends Extract<import("@dynamic-labs/sdk-api-core").SdkView, {
|
|
1
|
+
export declare const useViewSettings: <T extends import("@dynamic-labs/sdk-api-core").SdkViewType | "wallet-list" | "transaction-confirmation", R extends Extract<import("@dynamic-labs/sdk-api-core").SdkView, {
|
|
2
2
|
type: T;
|
|
3
3
|
}> | Extract<import("../../../context/DynamicContext/types").WalletListViewSettings, {
|
|
4
4
|
type: T;
|
|
5
|
+
}> | Extract<import("../../../context/DynamicContext/types").TransactionConfirmationViewSettings, {
|
|
6
|
+
type: T;
|
|
5
7
|
}> | undefined = Extract<import("@dynamic-labs/sdk-api-core").SdkView, {
|
|
6
8
|
type: T;
|
|
7
9
|
}> | Extract<import("../../../context/DynamicContext/types").WalletListViewSettings, {
|
|
8
10
|
type: T;
|
|
11
|
+
}> | Extract<import("../../../context/DynamicContext/types").TransactionConfirmationViewSettings, {
|
|
12
|
+
type: T;
|
|
9
13
|
}> | undefined>(viewType: T) => R;
|
|
@@ -94,7 +94,7 @@ const useWalletConnectors = ({ connectedWallets, walletConnectorOptions, setMult
|
|
|
94
94
|
const getSelectedWallet = React.useCallback((walletId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
95
95
|
const newWallet = wallets.find(({ id }) => id === walletId);
|
|
96
96
|
if (!newWallet) {
|
|
97
|
-
throw new utils.DynamicError(`Wallet with id: ${walletId} not found
|
|
97
|
+
throw new utils.DynamicError(`Wallet with id: ${walletId} not found`, 'wallet_with_id_not_found');
|
|
98
98
|
}
|
|
99
99
|
return newWallet;
|
|
100
100
|
}), [wallets]);
|
|
@@ -90,7 +90,7 @@ const useWalletConnectors = ({ connectedWallets, walletConnectorOptions, setMult
|
|
|
90
90
|
const getSelectedWallet = useCallback((walletId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
91
91
|
const newWallet = wallets.find(({ id }) => id === walletId);
|
|
92
92
|
if (!newWallet) {
|
|
93
|
-
throw new DynamicError(`Wallet with id: ${walletId} not found
|
|
93
|
+
throw new DynamicError(`Wallet with id: ${walletId} not found`, 'wallet_with_id_not_found');
|
|
94
94
|
}
|
|
95
95
|
return newWallet;
|
|
96
96
|
}), [wallets]);
|
|
@@ -111,7 +111,7 @@ const useWalletOptions = () => {
|
|
|
111
111
|
const errorMessage = chain
|
|
112
112
|
? `No wallet found with key "${walletKey}" for chain "${chain}".`
|
|
113
113
|
: `No wallet found with key "${walletKey}".`;
|
|
114
|
-
reject(new utils.DynamicError(errorMessage));
|
|
114
|
+
reject(new utils.DynamicError(errorMessage, 'wallet_not_found'));
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
addListenersToHandleWalletSelectionPromise({
|
|
@@ -107,7 +107,7 @@ const useWalletOptions = () => {
|
|
|
107
107
|
const errorMessage = chain
|
|
108
108
|
? `No wallet found with key "${walletKey}" for chain "${chain}".`
|
|
109
109
|
: `No wallet found with key "${walletKey}".`;
|
|
110
|
-
reject(new DynamicError(errorMessage));
|
|
110
|
+
reject(new DynamicError(errorMessage, 'wallet_not_found'));
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
addListenersToHandleWalletSelectionPromise({
|
|
@@ -24,7 +24,7 @@ const BridgeNextWalletConnectionView = () => {
|
|
|
24
24
|
const { setShowAuthFlow, bridgeChainsToConnect } = useInternalDynamicContext.useInternalDynamicContext();
|
|
25
25
|
const { pushView } = ViewContext.useViewContext();
|
|
26
26
|
if (!(bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length)) {
|
|
27
|
-
throw new utils.DynamicError('No wallets to connect');
|
|
27
|
+
throw new utils.DynamicError('No wallets to connect', 'no_wallets_to_connect');
|
|
28
28
|
}
|
|
29
29
|
const [nextWalletToConnect] = bridgeChainsToConnect;
|
|
30
30
|
const { chain } = nextWalletToConnect;
|
|
@@ -20,7 +20,7 @@ const BridgeNextWalletConnectionView = () => {
|
|
|
20
20
|
const { setShowAuthFlow, bridgeChainsToConnect } = useInternalDynamicContext();
|
|
21
21
|
const { pushView } = useViewContext();
|
|
22
22
|
if (!(bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length)) {
|
|
23
|
-
throw new DynamicError('No wallets to connect');
|
|
23
|
+
throw new DynamicError('No wallets to connect', 'no_wallets_to_connect');
|
|
24
24
|
}
|
|
25
25
|
const [nextWalletToConnect] = bridgeChainsToConnect;
|
|
26
26
|
const { chain } = nextWalletToConnect;
|
|
@@ -59,7 +59,7 @@ const initExport = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ i
|
|
|
59
59
|
const handleExportInitCheck = ({ user, wallet, }) => {
|
|
60
60
|
var _a, _b, _c, _d, _e;
|
|
61
61
|
if (!user) {
|
|
62
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
62
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
63
63
|
}
|
|
64
64
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
65
65
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -74,7 +74,7 @@ const handleExportInitCheck = ({ user, wallet, }) => {
|
|
|
74
74
|
const organizationId = (_e = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeySubOrganizationId) !== null && _e !== void 0 ? _e : undefined;
|
|
75
75
|
if (!organizationId ||
|
|
76
76
|
(turnkeyHDWalletId === undefined && privateKeyId === undefined)) {
|
|
77
|
-
throw new utils.DynamicError('Invalid token!');
|
|
77
|
+
throw new utils.DynamicError('Invalid token!', 'invalid_token');
|
|
78
78
|
}
|
|
79
79
|
return {
|
|
80
80
|
connector,
|
|
@@ -55,7 +55,7 @@ const initExport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ iframeCo
|
|
|
55
55
|
const handleExportInitCheck = ({ user, wallet, }) => {
|
|
56
56
|
var _a, _b, _c, _d, _e;
|
|
57
57
|
if (!user) {
|
|
58
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
58
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
59
59
|
}
|
|
60
60
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
61
61
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
@@ -70,7 +70,7 @@ const handleExportInitCheck = ({ user, wallet, }) => {
|
|
|
70
70
|
const organizationId = (_e = walletProperties === null || walletProperties === void 0 ? void 0 : walletProperties.turnkeySubOrganizationId) !== null && _e !== void 0 ? _e : undefined;
|
|
71
71
|
if (!organizationId ||
|
|
72
72
|
(turnkeyHDWalletId === undefined && privateKeyId === undefined)) {
|
|
73
|
-
throw new DynamicError('Invalid token!');
|
|
73
|
+
throw new DynamicError('Invalid token!', 'invalid_token');
|
|
74
74
|
}
|
|
75
75
|
return {
|
|
76
76
|
connector,
|
|
@@ -11,7 +11,7 @@ var errors = require('../../../../utils/constants/errors.cjs');
|
|
|
11
11
|
const handleExportInitCheck = ({ user, wallet, }) => {
|
|
12
12
|
var _a, _b, _c;
|
|
13
13
|
if (!user) {
|
|
14
|
-
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
14
|
+
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
15
15
|
}
|
|
16
16
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) || !(wallet === null || wallet === void 0 ? void 0 : wallet.id)) {
|
|
17
17
|
logger.logger.error('Cannot initialize embedded wallet export', {
|
|
@@ -28,7 +28,7 @@ const handleExportInitCheck = ({ user, wallet, }) => {
|
|
|
28
28
|
walletProperties = Object.assign(Object.assign({}, walletProperties), { accountAddress: wallet.address });
|
|
29
29
|
}
|
|
30
30
|
if (!walletProperties) {
|
|
31
|
-
throw new utils.DynamicError('Invalid token!');
|
|
31
|
+
throw new utils.DynamicError('Invalid token!', 'invalid_token');
|
|
32
32
|
}
|
|
33
33
|
return {
|
|
34
34
|
connector,
|
|
@@ -7,7 +7,7 @@ import { USER_NOT_LOGGED_IN } from '../../../../utils/constants/errors.js';
|
|
|
7
7
|
const handleExportInitCheck = ({ user, wallet, }) => {
|
|
8
8
|
var _a, _b, _c;
|
|
9
9
|
if (!user) {
|
|
10
|
-
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
10
|
+
throw new DynamicError(USER_NOT_LOGGED_IN, 'user_not_logged_in');
|
|
11
11
|
}
|
|
12
12
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) || !(wallet === null || wallet === void 0 ? void 0 : wallet.id)) {
|
|
13
13
|
logger.error('Cannot initialize embedded wallet export', {
|
|
@@ -24,7 +24,7 @@ const handleExportInitCheck = ({ user, wallet, }) => {
|
|
|
24
24
|
walletProperties = Object.assign(Object.assign({}, walletProperties), { accountAddress: wallet.address });
|
|
25
25
|
}
|
|
26
26
|
if (!walletProperties) {
|
|
27
|
-
throw new DynamicError('Invalid token!');
|
|
27
|
+
throw new DynamicError('Invalid token!', 'invalid_token');
|
|
28
28
|
}
|
|
29
29
|
return {
|
|
30
30
|
connector,
|
|
@@ -86,7 +86,7 @@ const ExportSharesView = ({ passcode }) => {
|
|
|
86
86
|
setIsLoading(true);
|
|
87
87
|
try {
|
|
88
88
|
if (!wallet) {
|
|
89
|
-
throw new utils.DynamicError('No wallet found');
|
|
89
|
+
throw new utils.DynamicError('No wallet found', 'no_wallet_found');
|
|
90
90
|
}
|
|
91
91
|
if (walletConnectorCore.isDynamicWaasConnector(wallet.connector)) {
|
|
92
92
|
yield wallet.connector.exportClientKeyshares({
|
|
@@ -107,7 +107,7 @@ const ExportSharesView = ({ passcode }) => {
|
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
throw new utils.DynamicError('Not a supported connector type for export shares');
|
|
110
|
+
throw new utils.DynamicError('Not a supported connector type for export shares', 'unsupported_connector_for_export');
|
|
111
111
|
}
|
|
112
112
|
catch (err) {
|
|
113
113
|
logger.logger.error('Error exporting shares', { error: err });
|
|
@@ -82,7 +82,7 @@ const ExportSharesView = ({ passcode }) => {
|
|
|
82
82
|
setIsLoading(true);
|
|
83
83
|
try {
|
|
84
84
|
if (!wallet) {
|
|
85
|
-
throw new DynamicError('No wallet found');
|
|
85
|
+
throw new DynamicError('No wallet found', 'no_wallet_found');
|
|
86
86
|
}
|
|
87
87
|
if (isDynamicWaasConnector(wallet.connector)) {
|
|
88
88
|
yield wallet.connector.exportClientKeyshares({
|
|
@@ -103,7 +103,7 @@ const ExportSharesView = ({ passcode }) => {
|
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
throw new DynamicError('Not a supported connector type for export shares');
|
|
106
|
+
throw new DynamicError('Not a supported connector type for export shares', 'unsupported_connector_for_export');
|
|
107
107
|
}
|
|
108
108
|
catch (err) {
|
|
109
109
|
logger.error('Error exporting shares', { error: err });
|
|
@@ -104,6 +104,7 @@ require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
|
104
104
|
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
105
105
|
require('../../../utils/hooks/useWalletDelegation/DelegationError.cjs');
|
|
106
106
|
require('../../../store/state/sendBalances.cjs');
|
|
107
|
+
var useViewSettings = require('../../../utils/hooks/useViewSettings/useViewSettings.cjs');
|
|
107
108
|
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
108
109
|
require('../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
109
110
|
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
@@ -114,7 +115,6 @@ require('../../../../index.cjs');
|
|
|
114
115
|
require('../../../widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.cjs');
|
|
115
116
|
require('../../../widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.cjs');
|
|
116
117
|
require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
117
|
-
var useViewSettings = require('../../../utils/hooks/useViewSettings/useViewSettings.cjs');
|
|
118
118
|
require('../../../store/state/tokenBalances.cjs');
|
|
119
119
|
require('../../../store/state/multichainBalances.cjs');
|
|
120
120
|
require('@dynamic-labs/store');
|
|
@@ -100,6 +100,7 @@ import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
|
100
100
|
import '../../../context/OnrampContext/OnrampContext.js';
|
|
101
101
|
import '../../../utils/hooks/useWalletDelegation/DelegationError.js';
|
|
102
102
|
import '../../../store/state/sendBalances.js';
|
|
103
|
+
import { useViewSettings } from '../../../utils/hooks/useViewSettings/useViewSettings.js';
|
|
103
104
|
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
104
105
|
import '../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
105
106
|
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
@@ -110,7 +111,6 @@ import '../../../../index.js';
|
|
|
110
111
|
import '../../../widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.js';
|
|
111
112
|
import '../../../widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.js';
|
|
112
113
|
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
113
|
-
import { useViewSettings } from '../../../utils/hooks/useViewSettings/useViewSettings.js';
|
|
114
114
|
import '../../../store/state/tokenBalances.js';
|
|
115
115
|
import '../../../store/state/multichainBalances.js';
|
|
116
116
|
import '@dynamic-labs/store';
|
package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs
CHANGED
|
@@ -132,7 +132,7 @@ const MergeUserAccountsWithSameEmailView = ({ returnToView }) => {
|
|
|
132
132
|
try {
|
|
133
133
|
const userProfile = yield user.mergeUserAccounts(environmentId);
|
|
134
134
|
if (!userProfile) {
|
|
135
|
-
throw new utils.DynamicError('Something went wrong, please try again.');
|
|
135
|
+
throw new utils.DynamicError('Something went wrong, please try again.', 'merge_accounts_error');
|
|
136
136
|
}
|
|
137
137
|
yield handleAuthenticatedUser(userProfile);
|
|
138
138
|
setShowAuthFlow(false);
|
package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js
CHANGED
|
@@ -128,7 +128,7 @@ const MergeUserAccountsWithSameEmailView = ({ returnToView }) => {
|
|
|
128
128
|
try {
|
|
129
129
|
const userProfile = yield mergeUserAccounts(environmentId);
|
|
130
130
|
if (!userProfile) {
|
|
131
|
-
throw new DynamicError('Something went wrong, please try again.');
|
|
131
|
+
throw new DynamicError('Something went wrong, please try again.', 'merge_accounts_error');
|
|
132
132
|
}
|
|
133
133
|
yield handleAuthenticatedUser(userProfile);
|
|
134
134
|
setShowAuthFlow(false);
|
|
@@ -147,10 +147,10 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
|
|
|
147
147
|
onReject: (err) => {
|
|
148
148
|
if (err instanceof client.MfaRateLimitedError) {
|
|
149
149
|
setIsRateLimited(true);
|
|
150
|
-
setError(new utils.DynamicError(t('dyn_mfa.otp_verification_view.rate_limit_error')));
|
|
150
|
+
setError(new utils.DynamicError(t('dyn_mfa.otp_verification_view.rate_limit_error'), 'mfa_rate_limited'));
|
|
151
151
|
}
|
|
152
152
|
else {
|
|
153
|
-
setError(new utils.DynamicError(t('dyn_mfa.otp_verification_view.error')));
|
|
153
|
+
setError(new utils.DynamicError(t('dyn_mfa.otp_verification_view.error'), 'tdynmfaotpverificationviewerror'));
|
|
154
154
|
}
|
|
155
155
|
},
|
|
156
156
|
onResolve: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -143,10 +143,10 @@ const MfaVerificationView = ({ type, isInitialSetup = false, showBackButton = fa
|
|
|
143
143
|
onReject: (err) => {
|
|
144
144
|
if (err instanceof MfaRateLimitedError) {
|
|
145
145
|
setIsRateLimited(true);
|
|
146
|
-
setError(new DynamicError(t('dyn_mfa.otp_verification_view.rate_limit_error')));
|
|
146
|
+
setError(new DynamicError(t('dyn_mfa.otp_verification_view.rate_limit_error'), 'mfa_rate_limited'));
|
|
147
147
|
}
|
|
148
148
|
else {
|
|
149
|
-
setError(new DynamicError(t('dyn_mfa.otp_verification_view.error')));
|
|
149
|
+
setError(new DynamicError(t('dyn_mfa.otp_verification_view.error'), 'tdynmfaotpverificationviewerror'));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
onResolve: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -128,7 +128,7 @@ const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
|
|
|
128
128
|
: 'dyn_passkey_recovery';
|
|
129
129
|
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: () => {
|
|
130
130
|
setShowAuthFlow(false, { emitCancelAuth: true });
|
|
131
|
-
dynamicEvents.dynamicEvents.emit('passkeyRecoveryFailed', new utils.DynamicError('Validation request cancelled'));
|
|
131
|
+
dynamicEvents.dynamicEvents.emit('passkeyRecoveryFailed', new utils.DynamicError('Validation request cancelled', 'validation_request_cancelled'));
|
|
132
132
|
}, "data-testid": 'close-button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
133
133
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: `${translationKey}.code.title`, children: t(`${translationKey}.code.title`) }) }), jsxRuntime.jsxs("div", { className: 'passkey-recovery-view', children: [!error$1 && !isValid ? (jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: emailIcon, isSpinning: !error$1 && !isValid, iconSize: 96 })) : (jsxRuntime.jsx(IconWithStatus.IconWithStatus, { Icon: iconic.SignInWithEmailIcon, iconSize: 64, variant: error$1 ? 'red' : 'green', InnerIcon: error$1 ? error.ReactComponent : check.ReactComponent })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'passkey-recovery-view__subtitle', copykey: `${translationKey}.code.description`, children: t(`${translationKey}.code.description`, { email: user === null || user === void 0 ? void 0 : user.email }) }), jsxRuntime.jsx("div", { className: 'passkey-recovery-view__actions', children: jsxRuntime.jsx(Input.Input, { id: 'passkey-recovery-bundle', "data-testid": 'passkey-recovery-bundle-input', value: bundleInput, onChange: handleBundleChanged, label: t(`${translationKey}.code.input_label`), disabled: isLoading || resendingCode, error: Boolean(error$1), className: isValid ? 'passkey-recovery-view__input-valid' : '', autoFocus: true, message: errorText }) }), jsxRuntime.jsxs("div", { className: 'passkey-recovery-view__resend-code', children: [jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_small', copykey: `${translationKey}.code.resend.text`, children: t(`${translationKey}.code.resend.text`) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'link', copykey: `${translationKey}.code.resend.button`, children: jsxRuntime.jsx(TextButton.TextButton, { "data-testid": 'resend-email-button', onClick: handleResentEmail, disabled: resendingCode || isLoading || (bundleInput.length > 0 && !error$1), children: t(`${translationKey}.code.resend.button`) }) })] })] })] }));
|
|
134
134
|
};
|
|
@@ -124,7 +124,7 @@ const PasskeyBundleRecovery = ({ authenticatorType, currentAction, }) => {
|
|
|
124
124
|
: 'dyn_passkey_recovery';
|
|
125
125
|
const closeButton = (jsx(IconButton, { type: 'button', onClick: () => {
|
|
126
126
|
setShowAuthFlow(false, { emitCancelAuth: true });
|
|
127
|
-
dynamicEvents.emit('passkeyRecoveryFailed', new DynamicError('Validation request cancelled'));
|
|
127
|
+
dynamicEvents.emit('passkeyRecoveryFailed', new DynamicError('Validation request cancelled', 'validation_request_cancelled'));
|
|
128
128
|
}, "data-testid": 'close-button', children: jsx(SvgClose, {}) }));
|
|
129
129
|
return (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', copykey: `${translationKey}.code.title`, children: t(`${translationKey}.code.title`) }) }), jsxs("div", { className: 'passkey-recovery-view', children: [!error && !isValid ? (jsx(IconWithSpinner, { Icon: emailIcon, isSpinning: !error && !isValid, iconSize: 96 })) : (jsx(IconWithStatus, { Icon: SignInWithEmailIcon, iconSize: 64, variant: error ? 'red' : 'green', InnerIcon: error ? SvgError : SvgCheck })), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'passkey-recovery-view__subtitle', copykey: `${translationKey}.code.description`, children: t(`${translationKey}.code.description`, { email: user === null || user === void 0 ? void 0 : user.email }) }), jsx("div", { className: 'passkey-recovery-view__actions', children: jsx(Input, { id: 'passkey-recovery-bundle', "data-testid": 'passkey-recovery-bundle-input', value: bundleInput, onChange: handleBundleChanged, label: t(`${translationKey}.code.input_label`), disabled: isLoading || resendingCode, error: Boolean(error), className: isValid ? 'passkey-recovery-view__input-valid' : '', autoFocus: true, message: errorText }) }), jsxs("div", { className: 'passkey-recovery-view__resend-code', children: [jsx(Typography, { color: 'secondary', variant: 'body_small', copykey: `${translationKey}.code.resend.text`, children: t(`${translationKey}.code.resend.text`) }), jsx(Typography, { variant: 'body_small', color: 'link', copykey: `${translationKey}.code.resend.button`, children: jsx(TextButton, { "data-testid": 'resend-email-button', onClick: handleResentEmail, disabled: resendingCode || isLoading || (bundleInput.length > 0 && !error), children: t(`${translationKey}.code.resend.button`) }) })] })] })] }));
|
|
130
130
|
};
|
|
@@ -41,7 +41,7 @@ const PasskeyCompleteRecovery = ({ goBack, }) => {
|
|
|
41
41
|
wallet,
|
|
42
42
|
});
|
|
43
43
|
if (!updatedUser) {
|
|
44
|
-
throw new utils.DynamicError('Error completing passkey recovery');
|
|
44
|
+
throw new utils.DynamicError('Error completing passkey recovery', 'completing_passkey_recovery');
|
|
45
45
|
}
|
|
46
46
|
dynamicEvents.dynamicEvents.emit('passkeyRecoveryCompleted', primaryWallet);
|
|
47
47
|
goBack();
|
|
@@ -37,7 +37,7 @@ const PasskeyCompleteRecovery = ({ goBack, }) => {
|
|
|
37
37
|
wallet,
|
|
38
38
|
});
|
|
39
39
|
if (!updatedUser) {
|
|
40
|
-
throw new DynamicError('Error completing passkey recovery');
|
|
40
|
+
throw new DynamicError('Error completing passkey recovery', 'completing_passkey_recovery');
|
|
41
41
|
}
|
|
42
42
|
dynamicEvents.emit('passkeyRecoveryCompleted', primaryWallet);
|
|
43
43
|
goBack();
|