@dynamic-labs/sdk-react-core 1.0.0-alpha.6 → 1.0.0-alpha.7
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 +20 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +10 -10
- package/src/index.cjs +4 -2
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -1
- package/src/lib/Main.cjs +18 -21
- package/src/lib/Main.js +18 -21
- package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +84 -5
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +85 -6
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +8 -6
- package/src/lib/components/NetworkPicker/NetworkPicker.d.ts +2 -1
- package/src/lib/components/NetworkPicker/NetworkPicker.js +8 -6
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -4
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -4
- package/src/lib/context/DynamicContext/types/index.d.ts +0 -1
- package/src/lib/data/api.cjs +2 -1
- package/src/lib/data/api.js +2 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +9 -11
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +10 -12
- package/src/lib/locale/en/translation.cjs +7 -3
- package/src/lib/locale/en/translation.d.ts +6 -2
- package/src/lib/locale/en/translation.js +7 -3
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.cjs +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.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/functions/findTurnkeyWallet/findTurnkeyWallet.cjs +1 -1
- package/src/lib/utils/functions/findTurnkeyWallet/findTurnkeyWallet.js +1 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +1 -6
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +1 -6
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +3 -0
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +3 -0
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +7 -8
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +7 -8
- package/src/lib/utils/hooks/useEventListener/useEventListener.cjs +2 -1
- package/src/lib/utils/hooks/useEventListener/useEventListener.js +2 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +9 -5
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.d.ts +0 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +10 -6
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +20 -21
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +1 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +20 -21
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.cjs +32 -9
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.d.ts +0 -1
- package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.js +33 -10
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +1 -1
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +1 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +6 -3
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +6 -3
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +1 -1
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.cjs +1 -1
- package/src/lib/views/Passkey/utils/passkeyRecovery/passkeyRecovery.js +1 -1
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +1 -1
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +11 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +11 -1
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs +3 -0
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.js +4 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +3 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +1 -2
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +1 -2
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +1 -2
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +1 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +1 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +1 -3
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs +16 -6
- package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js +16 -6
|
@@ -232,7 +232,7 @@ const DynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
|
232
232
|
// until user completes onboarding, jwt is only stored in onboardingOnlyJwt
|
|
233
233
|
const authToken = (_e = getAuthToken()) !== null && _e !== void 0 ? _e : onboardingOnlyJwt;
|
|
234
234
|
useSetWalletConnectorVerifiedCredentials(authToken, wallets);
|
|
235
|
-
const {
|
|
235
|
+
const { didConnectedStateLoad, walletConnectors, primaryWallet, showQrcodeModal, secondaryWallets, setPrimaryWallet, setShowQrcodeModal, wallets: linkedOrConnectedWallets, } = useWalletConnectors({
|
|
236
236
|
authMode,
|
|
237
237
|
authToken: getAuthToken() || onboardingOnlyJwt,
|
|
238
238
|
canHaveMultipleWalletsConnected: multiWallet || isBridgeFlow,
|
|
@@ -366,7 +366,6 @@ const DynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
|
366
366
|
});
|
|
367
367
|
const { loadingNetwork, network, setNetwork } = useWalletEventListeners({
|
|
368
368
|
authMode,
|
|
369
|
-
computeConnectedStateForWallets,
|
|
370
369
|
handleLogOut,
|
|
371
370
|
multiWallet,
|
|
372
371
|
multiWalletWidgetState,
|
|
@@ -476,7 +475,6 @@ const DynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
|
476
475
|
bridgeChains,
|
|
477
476
|
bridgeChainsToConnect,
|
|
478
477
|
clearStatesOnBackClick,
|
|
479
|
-
computeConnectedStateForWallets,
|
|
480
478
|
connectWallet,
|
|
481
479
|
connectedWallet,
|
|
482
480
|
connectedWallets,
|
|
@@ -596,7 +594,6 @@ const DynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
|
596
594
|
bridgeChains,
|
|
597
595
|
bridgeChainsToConnect,
|
|
598
596
|
clearStatesOnBackClick,
|
|
599
|
-
computeConnectedStateForWallets,
|
|
600
597
|
connectWallet,
|
|
601
598
|
connectedWallet,
|
|
602
599
|
connectedWallets,
|
|
@@ -33,7 +33,6 @@ export interface IDynamicContext {
|
|
|
33
33
|
authorizationViewDisplayOrder: DisplayOrder;
|
|
34
34
|
awaitingSignatureState: AwaitingSignatureState;
|
|
35
35
|
clearStatesOnBackClick: () => void;
|
|
36
|
-
computeConnectedStateForWallets: () => Promise<void>;
|
|
37
36
|
connectWallet: (walletConnector: WalletConnector, fetchPublicAddressOpts?: FetchPublicAddressOpts, shouldCallCallback?: boolean) => Promise<ConnectWalletResult | undefined>;
|
|
38
37
|
connectedWallet: Wallet | null;
|
|
39
38
|
connectedWallets: Wallet[];
|
package/src/lib/data/api.cjs
CHANGED
|
@@ -480,11 +480,12 @@ const createTurnkeyEvmEmbeddedWallet = ({ attestation, challenge, environmentId,
|
|
|
480
480
|
embeddedWallets: [
|
|
481
481
|
{
|
|
482
482
|
chain: sdkApi$1.ChainEnum.Evm,
|
|
483
|
-
embeddedWalletProvider: sdkApi$1.EmbeddedWalletProviderEnum.
|
|
483
|
+
embeddedWalletProvider: sdkApi$1.EmbeddedWalletProviderEnum.Turnkeyhd,
|
|
484
484
|
embeddedWalletSpecificOpts: {
|
|
485
485
|
attestation,
|
|
486
486
|
challenge,
|
|
487
487
|
},
|
|
488
|
+
isAuthenticatorAttached: true,
|
|
488
489
|
},
|
|
489
490
|
],
|
|
490
491
|
},
|
package/src/lib/data/api.js
CHANGED
|
@@ -476,11 +476,12 @@ const createTurnkeyEvmEmbeddedWallet = ({ attestation, challenge, environmentId,
|
|
|
476
476
|
embeddedWallets: [
|
|
477
477
|
{
|
|
478
478
|
chain: ChainEnum.Evm,
|
|
479
|
-
embeddedWalletProvider: EmbeddedWalletProviderEnum.
|
|
479
|
+
embeddedWalletProvider: EmbeddedWalletProviderEnum.Turnkeyhd,
|
|
480
480
|
embeddedWalletSpecificOpts: {
|
|
481
481
|
attestation,
|
|
482
482
|
challenge,
|
|
483
483
|
},
|
|
484
|
+
isAuthenticatorAttached: true,
|
|
484
485
|
},
|
|
485
486
|
],
|
|
486
487
|
},
|
|
@@ -89,20 +89,18 @@ const Header = ({ onClose: handleClose, heading, projectSettings, walletConnecto
|
|
|
89
89
|
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
90
90
|
clearStatesOnBackClick,
|
|
91
91
|
]);
|
|
92
|
-
const leadingButtons = React.useMemo(() => {
|
|
93
|
-
let buttons = [];
|
|
94
|
-
if (showBackButton) {
|
|
95
|
-
buttons = [
|
|
96
|
-
...buttons,
|
|
97
|
-
jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', className: 'header__icon', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }, 'back-button'),
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
return buttons;
|
|
101
|
-
}, [handleBackClick, showBackButton]);
|
|
102
92
|
const closeButton = showCloseButton && handleClose && (jsxRuntime.jsx(IconButton.IconButton, { onClick: handleClose, type: 'button', id: 'close-button', "data-testid": 'close-button', className: 'header__icon', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
103
93
|
const infoButton = showHelpContent && (jsxRuntime.jsx(Tooltip.Tooltip, { content: 'Need some help?', className: 'header__tooltip', children: jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: () => setIsFooterExpanded(!isFooterExpanded), "data-testid": 'info-button', className: 'header__icon', children: isWalletListTypeView ? jsxRuntime.jsx(questionMark.ReactComponent, {}) : jsxRuntime.jsx(footerInfoIcon.ReactComponent, {}) }) }, 'info-button'));
|
|
94
|
+
const leadingButtons = [];
|
|
95
|
+
if (showBackButton) {
|
|
96
|
+
leadingButtons.push(jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', className: 'header__icon', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }, 'back-button'));
|
|
97
|
+
}
|
|
98
|
+
// if has close button and info button, info button should be on the right
|
|
99
|
+
if (closeButton && infoButton) {
|
|
100
|
+
leadingButtons.push(infoButton);
|
|
101
|
+
}
|
|
104
102
|
const qrCodePreHeader = (jsxRuntime.jsxs("div", { className: 'qr-code-view__scan-issue-message', children: [jsxRuntime.jsx(Typography.Typography, { color: 'primary', variant: 'body_small', children: "If you're having issues scanning, click\u00A0" }), jsxRuntime.jsx("button", { className: 'qr-code-view__scan-issue-button', onClick: () => setShowQrCodeImage(true), children: "here" })] }));
|
|
105
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: leadingButtons, trailing:
|
|
103
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: leadingButtons, trailing: closeButton || infoButton, displayBorder: displayBorderBelowHeader, children: jsxRuntime.jsx(Typography.Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'header__skeleton' })) : (heading) }) }), showQrCodePreHeader && qrCodePreHeader] }));
|
|
106
104
|
};
|
|
107
105
|
|
|
108
106
|
exports.Header = Header;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useCallback
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
3
|
import '@dynamic-labs/utils';
|
|
4
4
|
import '@dynamic-labs/sdk-api';
|
|
5
5
|
import '../../../config/ApiEndpoint.js';
|
|
@@ -85,20 +85,18 @@ const Header = ({ onClose: handleClose, heading, projectSettings, walletConnecto
|
|
|
85
85
|
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
86
86
|
clearStatesOnBackClick,
|
|
87
87
|
]);
|
|
88
|
-
const leadingButtons = useMemo(() => {
|
|
89
|
-
let buttons = [];
|
|
90
|
-
if (showBackButton) {
|
|
91
|
-
buttons = [
|
|
92
|
-
...buttons,
|
|
93
|
-
jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', className: 'header__icon', children: jsx(SvgArrowLeft, {}) }, 'back-button'),
|
|
94
|
-
];
|
|
95
|
-
}
|
|
96
|
-
return buttons;
|
|
97
|
-
}, [handleBackClick, showBackButton]);
|
|
98
88
|
const closeButton = showCloseButton && handleClose && (jsx(IconButton, { onClick: handleClose, type: 'button', id: 'close-button', "data-testid": 'close-button', className: 'header__icon', children: jsx(SvgClose, {}) }));
|
|
99
89
|
const infoButton = showHelpContent && (jsx(Tooltip, { content: 'Need some help?', className: 'header__tooltip', children: jsx(IconButton, { type: 'button', onClick: () => setIsFooterExpanded(!isFooterExpanded), "data-testid": 'info-button', className: 'header__icon', children: isWalletListTypeView ? jsx(SvgQuestionMark, {}) : jsx(SvgFooterInfoIcon, {}) }) }, 'info-button'));
|
|
90
|
+
const leadingButtons = [];
|
|
91
|
+
if (showBackButton) {
|
|
92
|
+
leadingButtons.push(jsx(IconButton, { type: 'button', onClick: handleBackClick, "data-testid": 'back-button', className: 'header__icon', children: jsx(SvgArrowLeft, {}) }, 'back-button'));
|
|
93
|
+
}
|
|
94
|
+
// if has close button and info button, info button should be on the right
|
|
95
|
+
if (closeButton && infoButton) {
|
|
96
|
+
leadingButtons.push(infoButton);
|
|
97
|
+
}
|
|
100
98
|
const qrCodePreHeader = (jsxs("div", { className: 'qr-code-view__scan-issue-message', children: [jsx(Typography, { color: 'primary', variant: 'body_small', children: "If you're having issues scanning, click\u00A0" }), jsx("button", { className: 'qr-code-view__scan-issue-button', onClick: () => setShowQrCodeImage(true), children: "here" })] }));
|
|
101
|
-
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: leadingButtons, trailing:
|
|
99
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: leadingButtons, trailing: closeButton || infoButton, displayBorder: displayBorderBelowHeader, children: jsx(Typography, { as: 'h1', variant: 'title', color: 'primary', "data-testid": 'dynamic-auth-modal-heading', className: 'header__typography', children: !projectSettings ? (jsx(Skeleton, { className: 'header__skeleton' })) : (heading) }) }), showQrCodePreHeader && qrCodePreHeader] }));
|
|
102
100
|
};
|
|
103
101
|
|
|
104
102
|
export { Header };
|
|
@@ -372,13 +372,17 @@ const translation = {
|
|
|
372
372
|
* @description copy key for Dynamic need help footer section
|
|
373
373
|
* @default
|
|
374
374
|
* {
|
|
375
|
-
info: '
|
|
376
|
-
contact_support: 'Contact
|
|
375
|
+
info: 'Can’t find your passkey?',
|
|
376
|
+
contact_support: 'Contact support',
|
|
377
|
+
divider: 'or',
|
|
378
|
+
recovery_button: 'generate a new one.',
|
|
377
379
|
}
|
|
378
380
|
*/
|
|
379
381
|
dyn_need_help_section: {
|
|
380
|
-
info: '
|
|
382
|
+
info: 'Can’t find your passkey?',
|
|
381
383
|
contact_support: 'Contact support',
|
|
384
|
+
divider: 'or',
|
|
385
|
+
recovery_button: 'generate a new one.',
|
|
382
386
|
},
|
|
383
387
|
/**
|
|
384
388
|
* @description copy keys for network not supported view
|
|
@@ -367,13 +367,17 @@ export declare const translation: {
|
|
|
367
367
|
* @description copy key for Dynamic need help footer section
|
|
368
368
|
* @default
|
|
369
369
|
* {
|
|
370
|
-
info: '
|
|
371
|
-
contact_support: 'Contact
|
|
370
|
+
info: 'Can’t find your passkey?',
|
|
371
|
+
contact_support: 'Contact support',
|
|
372
|
+
divider: 'or',
|
|
373
|
+
recovery_button: 'generate a new one.',
|
|
372
374
|
}
|
|
373
375
|
*/
|
|
374
376
|
dyn_need_help_section: {
|
|
375
377
|
info: string;
|
|
376
378
|
contact_support: string;
|
|
379
|
+
divider: string;
|
|
380
|
+
recovery_button: string;
|
|
377
381
|
};
|
|
378
382
|
/**
|
|
379
383
|
* @description copy keys for network not supported view
|
|
@@ -368,13 +368,17 @@ const translation = {
|
|
|
368
368
|
* @description copy key for Dynamic need help footer section
|
|
369
369
|
* @default
|
|
370
370
|
* {
|
|
371
|
-
info: '
|
|
372
|
-
contact_support: 'Contact
|
|
371
|
+
info: 'Can’t find your passkey?',
|
|
372
|
+
contact_support: 'Contact support',
|
|
373
|
+
divider: 'or',
|
|
374
|
+
recovery_button: 'generate a new one.',
|
|
373
375
|
}
|
|
374
376
|
*/
|
|
375
377
|
dyn_need_help_section: {
|
|
376
|
-
info: '
|
|
378
|
+
info: 'Can’t find your passkey?',
|
|
377
379
|
contact_support: 'Contact support',
|
|
380
|
+
divider: 'or',
|
|
381
|
+
recovery_button: 'generate a new one.',
|
|
378
382
|
},
|
|
379
383
|
/**
|
|
380
384
|
* @description copy keys for network not supported view
|
|
@@ -8,7 +8,7 @@ const TurnkeyErrorMap = {
|
|
|
8
8
|
3: 'You reached the limit of passkeys for this account.',
|
|
9
9
|
};
|
|
10
10
|
const DOMExceptionErrorMap = {
|
|
11
|
-
NotAllowedError: '
|
|
11
|
+
NotAllowedError: 'Request Cancelled. Select a device or password manager to set up a passkey.',
|
|
12
12
|
};
|
|
13
13
|
const getProperErrorMessage = (originalError) => {
|
|
14
14
|
var _a, _b;
|
|
@@ -4,7 +4,7 @@ const TurnkeyErrorMap = {
|
|
|
4
4
|
3: 'You reached the limit of passkeys for this account.',
|
|
5
5
|
};
|
|
6
6
|
const DOMExceptionErrorMap = {
|
|
7
|
-
NotAllowedError: '
|
|
7
|
+
NotAllowedError: 'Request Cancelled. Select a device or password manager to set up a passkey.',
|
|
8
8
|
};
|
|
9
9
|
const getProperErrorMessage = (originalError) => {
|
|
10
10
|
var _a, _b;
|