@dynamic-labs/sdk-react-core 2.0.0-alpha.27 → 2.0.0-alpha.28
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 +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/context/DynamicContext/DynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -2
- package/src/lib/context/DynamicContext/helpers/helpers.cjs +7 -0
- package/src/lib/context/DynamicContext/helpers/helpers.d.ts +2 -0
- package/src/lib/context/DynamicContext/helpers/helpers.js +7 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.types.d.ts +0 -15
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.cjs +1 -0
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.js +1 -0
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs +1 -0
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.js +1 -0
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.28](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.27...v2.0.0-alpha.28) (2024-04-10)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* improve bridge connect experience on mobile ([#5283](https://github.com/dynamic-labs/DynamicAuth/issues/5283)) ([155e4a9](https://github.com/dynamic-labs/DynamicAuth/commit/155e4a99e2cf5f78a1a5e91e774acbf170d6b083))
|
|
8
|
+
|
|
2
9
|
## [2.0.0-alpha.27](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.26...v2.0.0-alpha.27) (2024-04-09)
|
|
3
10
|
|
|
4
11
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.28",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/ethereum": "2.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/iconic": "2.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/logger": "2.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "2.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/rpc-provider-solana": "2.0.0-alpha.
|
|
26
|
-
"@dynamic-labs/rpc-providers": "2.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/types": "2.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/utils": "2.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/viem-utils": "2.0.0-alpha.
|
|
30
|
-
"@dynamic-labs/wallet-book": "2.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.
|
|
20
|
+
"@dynamic-labs/ethereum": "2.0.0-alpha.28",
|
|
21
|
+
"@dynamic-labs/iconic": "2.0.0-alpha.28",
|
|
22
|
+
"@dynamic-labs/logger": "2.0.0-alpha.28",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "2.0.0-alpha.28",
|
|
24
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.28",
|
|
25
|
+
"@dynamic-labs/rpc-provider-solana": "2.0.0-alpha.28",
|
|
26
|
+
"@dynamic-labs/rpc-providers": "2.0.0-alpha.28",
|
|
27
|
+
"@dynamic-labs/types": "2.0.0-alpha.28",
|
|
28
|
+
"@dynamic-labs/utils": "2.0.0-alpha.28",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.0.0-alpha.28",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.0.0-alpha.28",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.28",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -130,7 +130,7 @@ const DynamicContext = React.createContext(undefined);
|
|
|
130
130
|
/** The context provider itself we only use internally */
|
|
131
131
|
const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale$1, }) => {
|
|
132
132
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
133
|
-
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, enableConnectOnlyFallback = false, deepLinkPreference = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, localStorageSuffix, walletsFilter, logLevel = 'WARN', mobileExperience = 'in-app-browser', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, hideEmbeddedWalletTransactionUIs, handlers, } = settings;
|
|
133
|
+
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = values.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, localStorageSuffix, walletsFilter, logLevel = 'WARN', mobileExperience = 'in-app-browser', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, hideEmbeddedWalletTransactionUIs, handlers, } = settings;
|
|
134
134
|
/**
|
|
135
135
|
* For backwards compatibility, we allow the client to pass in
|
|
136
136
|
* `eventsCallbacks` instead of `events`. It should remove this
|
|
@@ -156,6 +156,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale
|
|
|
156
156
|
const i18nSDKInstance = locale.Locale.setup(locale$1);
|
|
157
157
|
const isAuthenticated = Boolean(getAuthToken.getAuthToken());
|
|
158
158
|
const isBridgeFlow = Boolean(bridgeChains);
|
|
159
|
+
const deepLinkPreference = helpers.getDeepLinkPreference(deepLinkPreferenceProp, isBridgeFlow);
|
|
159
160
|
const [onboardingOnlyJwt, setOnboardingOnlyJwt] = React.useState(undefined);
|
|
160
161
|
// state to track the full connectivity status of the individual's wallets.
|
|
161
162
|
// Set to true once the predetermined number of wallets is connected.
|
|
@@ -106,7 +106,7 @@ import { FundingContextProvider } from '../FundingContext/FundingContext.js';
|
|
|
106
106
|
import { PhantomRedirectContextProvider } from '../PhantomRedirectContext/PhantomRedirectContext.js';
|
|
107
107
|
import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceContext.js';
|
|
108
108
|
import { UseNetworkValidation } from '../UseNetworkValidation/UseNetworkValidation.js';
|
|
109
|
-
import { resolveNetworkValidationMode, initExpirationTime, getInitialView } from './helpers/helpers.js';
|
|
109
|
+
import { resolveNetworkValidationMode, initExpirationTime, getInitialView, getDeepLinkPreference } from './helpers/helpers.js';
|
|
110
110
|
import { useDisplayOrderState } from './hooks/useDisplayOrderState/useDisplayOrderState.js';
|
|
111
111
|
import { useEmailLoginState } from './hooks/useEmailLoginState/useEmailLoginState.js';
|
|
112
112
|
import { useHandleLogout } from './hooks/useHandleLogout/useHandleLogout.js';
|
|
@@ -126,7 +126,7 @@ const DynamicContext = createContext(undefined);
|
|
|
126
126
|
/** The context provider itself we only use internally */
|
|
127
127
|
const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
128
128
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
129
|
-
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, enableConnectOnlyFallback = false, deepLinkPreference = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, localStorageSuffix, walletsFilter, logLevel = 'WARN', mobileExperience = 'in-app-browser', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, hideEmbeddedWalletTransactionUIs, handlers, } = settings;
|
|
129
|
+
const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, localStorageSuffix, walletsFilter, logLevel = 'WARN', mobileExperience = 'in-app-browser', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, hideEmbeddedWalletTransactionUIs, handlers, } = settings;
|
|
130
130
|
/**
|
|
131
131
|
* For backwards compatibility, we allow the client to pass in
|
|
132
132
|
* `eventsCallbacks` instead of `events`. It should remove this
|
|
@@ -152,6 +152,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
152
152
|
const i18nSDKInstance = Locale.setup(locale);
|
|
153
153
|
const isAuthenticated = Boolean(getAuthToken());
|
|
154
154
|
const isBridgeFlow = Boolean(bridgeChains);
|
|
155
|
+
const deepLinkPreference = getDeepLinkPreference(deepLinkPreferenceProp, isBridgeFlow);
|
|
155
156
|
const [onboardingOnlyJwt, setOnboardingOnlyJwt] = useState(undefined);
|
|
156
157
|
// state to track the full connectivity status of the individual's wallets.
|
|
157
158
|
// Set to true once the predetermined number of wallets is connected.
|
|
@@ -119,7 +119,14 @@ const resolveNetworkValidationMode = ({ networkValidationMode, bridgeChains, })
|
|
|
119
119
|
}
|
|
120
120
|
return 'sign-in';
|
|
121
121
|
};
|
|
122
|
+
const getDeepLinkPreference = (deepLinkPreferenceProp, isBridgeFlow) => {
|
|
123
|
+
if (isBridgeFlow) {
|
|
124
|
+
return 'universal';
|
|
125
|
+
}
|
|
126
|
+
return deepLinkPreferenceProp;
|
|
127
|
+
};
|
|
122
128
|
|
|
129
|
+
exports.getDeepLinkPreference = getDeepLinkPreference;
|
|
123
130
|
exports.getInitialView = getInitialView;
|
|
124
131
|
exports.initExpirationTime = initExpirationTime;
|
|
125
132
|
exports.isAuthTokenExpired = isAuthTokenExpired;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeepLinkVariant } from '@dynamic-labs/wallet-connector-core';
|
|
1
2
|
import { Wallet } from '../../../shared';
|
|
2
3
|
import { ViewState, ViewType } from '../../ViewContext';
|
|
3
4
|
import { ChainsToConnect, NetworkValidationMode } from '../types';
|
|
@@ -20,3 +21,4 @@ export declare const resolveNetworkValidationMode: ({ networkValidationMode, bri
|
|
|
20
21
|
networkValidationMode: NetworkValidationMode | undefined;
|
|
21
22
|
bridgeChains: ChainsToConnect[] | undefined;
|
|
22
23
|
}) => NetworkValidationMode;
|
|
24
|
+
export declare const getDeepLinkPreference: (deepLinkPreferenceProp: DeepLinkVariant, isBridgeFlow: boolean) => DeepLinkVariant;
|
|
@@ -115,5 +115,11 @@ const resolveNetworkValidationMode = ({ networkValidationMode, bridgeChains, })
|
|
|
115
115
|
}
|
|
116
116
|
return 'sign-in';
|
|
117
117
|
};
|
|
118
|
+
const getDeepLinkPreference = (deepLinkPreferenceProp, isBridgeFlow) => {
|
|
119
|
+
if (isBridgeFlow) {
|
|
120
|
+
return 'universal';
|
|
121
|
+
}
|
|
122
|
+
return deepLinkPreferenceProp;
|
|
123
|
+
};
|
|
118
124
|
|
|
119
|
-
export { getInitialView, initExpirationTime, isAuthTokenExpired, isDynamicContextSessionSettingExpired, isMinAuthTokenExpired, isWagmiSessionSettingExpired, resolveNetworkValidationMode, sdkSettingsTimeout, setDynamicContextSessionSettings, setWagmiSessionSettings };
|
|
125
|
+
export { getDeepLinkPreference, getInitialView, initExpirationTime, isAuthTokenExpired, isDynamicContextSessionSettingExpired, isMinAuthTokenExpired, isWagmiSessionSettingExpired, resolveNetworkValidationMode, sdkSettingsTimeout, setDynamicContextSessionSettings, setWagmiSessionSettings };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { PasskeyError } from '@dynamic-labs/utils';
|
|
3
|
-
export type SignMessageConfirmationModalProps = {
|
|
4
|
-
appLogoUrl?: string;
|
|
5
|
-
appName?: string;
|
|
6
|
-
appOrigin: string;
|
|
7
|
-
handler: (message: string | ArrayLike<number>) => Promise<string>;
|
|
8
|
-
message: string | ArrayLike<number>;
|
|
9
|
-
onReject: (error: unknown) => void;
|
|
10
|
-
onSignMessage: (signedMessage: string) => void;
|
|
11
|
-
};
|
|
12
|
-
export type SignMessageConfirmationModalComponent = FC<SignMessageConfirmationModalProps>;
|
|
13
|
-
export type SignMessageError = Error & PasskeyError & {
|
|
14
|
-
reason?: string;
|
|
15
|
-
};
|
|
@@ -6,6 +6,7 @@ const TurnkeyErrorMap = {
|
|
|
6
6
|
0: 'Operation was canceled.',
|
|
7
7
|
16: 'Invalid Passkey signature. Select the passkey for this account and device.',
|
|
8
8
|
3: 'You reached the limit of passkeys for this account.',
|
|
9
|
+
5: 'Invalid Passkey signature. Select the passkey for this account and device.',
|
|
9
10
|
7: 'The code is invalid or expired.',
|
|
10
11
|
};
|
|
11
12
|
const DOMExceptionErrorMap = {
|
|
@@ -2,6 +2,7 @@ const TurnkeyErrorMap = {
|
|
|
2
2
|
0: 'Operation was canceled.',
|
|
3
3
|
16: 'Invalid Passkey signature. Select the passkey for this account and device.',
|
|
4
4
|
3: 'You reached the limit of passkeys for this account.',
|
|
5
|
+
5: 'Invalid Passkey signature. Select the passkey for this account and device.',
|
|
5
6
|
7: 'The code is invalid or expired.',
|
|
6
7
|
};
|
|
7
8
|
const DOMExceptionErrorMap = {
|
|
@@ -23,6 +23,7 @@ const errorCodesMapping = {
|
|
|
23
23
|
0: 'The operation either timed out or was not allowed.',
|
|
24
24
|
16: 'Invalid Passkey signature. Select the passkey for this account and device.',
|
|
25
25
|
3: 'You reached the limit of passkeys for this account.',
|
|
26
|
+
5: 'Invalid Passkey signature.',
|
|
26
27
|
INSUFFICIENT_FUNDS: 'Insufficient funds for this transaction.',
|
|
27
28
|
[magicRpcError.toString()]: 'A network error has occurred. Please try again later',
|
|
28
29
|
};
|
|
@@ -19,6 +19,7 @@ const errorCodesMapping = {
|
|
|
19
19
|
0: 'The operation either timed out or was not allowed.',
|
|
20
20
|
16: 'Invalid Passkey signature. Select the passkey for this account and device.',
|
|
21
21
|
3: 'You reached the limit of passkeys for this account.',
|
|
22
|
+
5: 'Invalid Passkey signature.',
|
|
22
23
|
INSUFFICIENT_FUNDS: 'Insufficient funds for this transaction.',
|
|
23
24
|
[magicRpcError.toString()]: 'A network error has occurred. Please try again later',
|
|
24
25
|
};
|
|
@@ -84,7 +84,7 @@ const NoQrNotInstalledModalView = () => {
|
|
|
84
84
|
if (!selectedWalletConnector) {
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
87
|
-
const walletName = walletBook.getWalletBookWallet(walletBook$1, selectedWalletConnector.key).name;
|
|
87
|
+
const walletName = walletBook.getWalletBookWallet(walletBook$1, selectedWalletConnector.key, selectedWalletConnector.walletFallback).name;
|
|
88
88
|
const walletLinks = walletBook.getWalletLinks(walletBook$1, selectedWalletConnector.key);
|
|
89
89
|
const { currentDesktopUrl, userBrowser } = parseWalletLinks.parseWalletLinks(walletLinks);
|
|
90
90
|
const downloadLinks = userBrowser && currentDesktopUrl ? (jsxRuntime.jsx(WalletHelpLink.WalletHelpLink, { name: userBrowser, link: currentDesktopUrl, Icon: getBrowserIcon.getBrowserIcon(userBrowser) }, userBrowser)) : (Object.entries(walletLinks)
|
package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js
CHANGED
|
@@ -80,7 +80,7 @@ const NoQrNotInstalledModalView = () => {
|
|
|
80
80
|
if (!selectedWalletConnector) {
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
83
|
-
const walletName = getWalletBookWallet(walletBook, selectedWalletConnector.key).name;
|
|
83
|
+
const walletName = getWalletBookWallet(walletBook, selectedWalletConnector.key, selectedWalletConnector.walletFallback).name;
|
|
84
84
|
const walletLinks = getWalletLinks(walletBook, selectedWalletConnector.key);
|
|
85
85
|
const { currentDesktopUrl, userBrowser } = parseWalletLinks(walletLinks);
|
|
86
86
|
const downloadLinks = userBrowser && currentDesktopUrl ? (jsx(WalletHelpLink, { name: userBrowser, link: currentDesktopUrl, Icon: getBrowserIcon(userBrowser) }, userBrowser)) : (Object.entries(walletLinks)
|