@dynamic-labs/sdk-react-core 4.29.6 → 4.30.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 +25 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/SignMessagePreview/components/SignTypedDataPreview/SignTypedDataPreview.cjs +1 -14
- package/src/lib/components/SignMessagePreview/components/SignTypedDataPreview/SignTypedDataPreview.js +1 -14
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.cjs +6 -6
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.js +6 -6
- package/src/lib/components/TransactionCard/TransactionCard.cjs +3 -3
- package/src/lib/components/TransactionCard/TransactionCard.js +3 -3
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +2 -2
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +2 -2
- package/src/lib/components/UserAddress/UserAddress.cjs +11 -11
- package/src/lib/components/UserAddress/UserAddress.js +11 -11
- package/src/lib/components/WalletInformationCard/WalletInformationCard.cjs +1 -11
- package/src/lib/components/WalletInformationCard/WalletInformationCard.js +1 -11
- package/src/lib/data/api/externalAuth/externalAuth.cjs +6 -27
- package/src/lib/data/api/externalAuth/externalAuth.d.ts +1 -6
- package/src/lib/data/api/externalAuth/externalAuth.js +8 -28
- package/src/lib/data/api/oauth/oauth.cjs +3 -1
- package/src/lib/data/api/oauth/oauth.js +3 -1
- package/src/lib/events/dynamicEvents.cjs +1 -0
- package/src/lib/events/dynamicEvents.d.ts +1 -1
- package/src/lib/events/dynamicEvents.js +1 -0
- package/src/lib/events/wallets.d.ts +2 -0
- package/src/lib/shared/utils/functions/chain/getChainIcon.cjs +1 -0
- package/src/lib/shared/utils/functions/chain/getChainIcon.js +2 -1
- package/src/lib/shared/utils/functions/index.d.ts +0 -1
- package/src/lib/shared/utils/functions/shortenWalletAddress/index.d.ts +1 -1
- package/src/lib/shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs +9 -3
- package/src/lib/shared/utils/functions/shortenWalletAddress/shortenWalletAddress.d.ts +1 -1
- package/src/lib/shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js +9 -3
- package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.d.ts +1 -1
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.cjs +5 -5
- package/src/lib/utils/hooks/useExternalAuth/useExternalAuth.js +8 -8
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +2 -1
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +3 -2
- package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.cjs +2 -0
- package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.js +2 -0
- package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.d.ts +2 -2
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +2 -2
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +2 -2
- package/src/lib/views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs +1 -1
- package/src/lib/views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js +1 -1
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.cjs +2 -2
- package/src/lib/views/MergeUserAccountsWithSameEmailView/MergeUserAccountsWithSameEmailView.js +2 -2
- package/src/lib/views/NoAccess/NoAccess.cjs +2 -2
- package/src/lib/views/NoAccess/NoAccess.js +2 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +2 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.js +2 -2
- package/src/lib/views/SyncWalletView/AutoReconnectingView/AutoReconnectingView.cjs +8 -8
- package/src/lib/views/SyncWalletView/AutoReconnectingView/AutoReconnectingView.js +8 -8
- package/src/lib/views/SyncWalletView/ReconnectWithQrCodeView/ReconnectWithQrCodeView.cjs +3 -1
- package/src/lib/views/SyncWalletView/ReconnectWithQrCodeView/ReconnectWithQrCodeView.js +3 -1
- package/src/lib/views/SyncWalletView/SwitchWalletView/SwitchWalletView.cjs +2 -2
- package/src/lib/views/SyncWalletView/SwitchWalletView/SwitchWalletView.js +2 -2
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.cjs +1 -1
- package/src/lib/views/WalletAlreadyExistsView/WalletAlreadyExistsView.js +1 -1
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +1 -1
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +1 -1
- package/src/lib/views/WalletList/data.d.ts +1 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/DynamicBridgeWidget.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveBitcoinWalletAddresses/ActiveBitcoinWalletAddresses.js +3 -3
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletAddress/ActiveWalletAddress.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchAccountView/SwitchAccountView.js +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ConfirmExchangeTransferView/ConfirmExchangeTransferView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/DepositView/DepositView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/DepositView/DepositView.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/DepositedExchangeView/DepositedExchangeView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/DepositedExchangeView/DepositedExchangeView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js +1 -1
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
7
8
|
var utils$1 = require('@dynamic-labs/utils');
|
|
8
9
|
require('@dynamic-labs-sdk/client/core');
|
|
9
10
|
require('@dynamic-labs/sdk-api-core');
|
|
10
11
|
require('../../../client/client.cjs');
|
|
11
12
|
require('react');
|
|
12
|
-
require('@dynamic-labs-sdk/client');
|
|
13
13
|
require('../../../config/ApiEndpoint.cjs');
|
|
14
14
|
require('../../../utils/constants/values.cjs');
|
|
15
15
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -33,33 +33,11 @@ require('../../../events/dynamicEvents.cjs');
|
|
|
33
33
|
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
34
34
|
var storeTokenAndUser = require('../../../client/extension/storeTokenAndUser/storeTokenAndUser.cjs');
|
|
35
35
|
|
|
36
|
-
const externalAuthSignin = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ environmentId, externalJwt, sessionPublicKey, }) {
|
|
37
|
-
try {
|
|
38
|
-
const response = yield api.sdkApi().externalAuthSignin({
|
|
39
|
-
environmentId,
|
|
40
|
-
externalAuthSigninRequest: {
|
|
41
|
-
jwt: externalJwt,
|
|
42
|
-
sessionPublicKey,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
return storeTokenAndUser.storeTokenAndUser(response);
|
|
46
|
-
}
|
|
47
|
-
catch (e) {
|
|
48
|
-
const data = yield utils.logResponseError(e, 'Error signing in with external JWT');
|
|
49
|
-
if (data.code === 'invalid_external_auth') {
|
|
50
|
-
throw new utils$1.ExternalAuthError(data.code);
|
|
51
|
-
}
|
|
52
|
-
if (data.error.code === 'sandbox_maximum_threshold_reached') {
|
|
53
|
-
throw new utils$1.SandboxMaximumThresholdReachedError(data.error.message);
|
|
54
|
-
}
|
|
55
|
-
throw new utils$1.DynamicError(data.error);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
36
|
/**
|
|
59
|
-
* @deprecated Use `
|
|
37
|
+
* @deprecated Use `signInWithExternalJwt` instead.
|
|
60
38
|
* This currently does not work.
|
|
61
39
|
*/
|
|
62
|
-
const externalAuthVerify = (
|
|
40
|
+
const externalAuthVerify = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ environmentId, externalJwt, }) {
|
|
63
41
|
try {
|
|
64
42
|
/* istanbul ignore next */
|
|
65
43
|
const response = (yield api.sdkApi().externalAuthVerify({
|
|
@@ -74,7 +52,9 @@ const externalAuthVerify = (_b) => _tslib.__awaiter(void 0, [_b], void 0, functi
|
|
|
74
52
|
catch (e) {
|
|
75
53
|
const data = yield utils.logResponseError(e, 'Error verifying external JWT');
|
|
76
54
|
if (data.code === 'invalid_external_auth') {
|
|
77
|
-
throw new
|
|
55
|
+
throw new client.InvalidExternalAuthError({
|
|
56
|
+
cause: data,
|
|
57
|
+
});
|
|
78
58
|
}
|
|
79
59
|
if (data.error.code === 'sandbox_maximum_threshold_reached') {
|
|
80
60
|
throw new utils$1.SandboxMaximumThresholdReachedError(data.error.message);
|
|
@@ -83,5 +63,4 @@ const externalAuthVerify = (_b) => _tslib.__awaiter(void 0, [_b], void 0, functi
|
|
|
83
63
|
}
|
|
84
64
|
});
|
|
85
65
|
|
|
86
|
-
exports.externalAuthSignin = externalAuthSignin;
|
|
87
66
|
exports.externalAuthVerify = externalAuthVerify;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { UserProfile } from '../../../..';
|
|
2
|
-
export declare const externalAuthSignin: ({ environmentId, externalJwt, sessionPublicKey, }: {
|
|
3
|
-
environmentId: string;
|
|
4
|
-
externalJwt?: string;
|
|
5
|
-
sessionPublicKey?: string;
|
|
6
|
-
}) => Promise<UserProfile | undefined>;
|
|
7
2
|
/**
|
|
8
|
-
* @deprecated Use `
|
|
3
|
+
* @deprecated Use `signInWithExternalJwt` instead.
|
|
9
4
|
* This currently does not work.
|
|
10
5
|
*/
|
|
11
6
|
export declare const externalAuthVerify: ({ environmentId, externalJwt, }: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import {
|
|
3
|
+
import { InvalidExternalAuthError } from '@dynamic-labs-sdk/client';
|
|
4
|
+
import { SandboxMaximumThresholdReachedError, DynamicError } from '@dynamic-labs/utils';
|
|
4
5
|
import '@dynamic-labs-sdk/client/core';
|
|
5
6
|
import '@dynamic-labs/sdk-api-core';
|
|
6
7
|
import '../../../client/client.js';
|
|
7
8
|
import 'react';
|
|
8
|
-
import '@dynamic-labs-sdk/client';
|
|
9
9
|
import '../../../config/ApiEndpoint.js';
|
|
10
10
|
import '../../../utils/constants/values.js';
|
|
11
11
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -29,33 +29,11 @@ import '../../../events/dynamicEvents.js';
|
|
|
29
29
|
import '../../../store/state/projectSettings/projectSettings.js';
|
|
30
30
|
import { storeTokenAndUser } from '../../../client/extension/storeTokenAndUser/storeTokenAndUser.js';
|
|
31
31
|
|
|
32
|
-
const externalAuthSignin = (_a) => __awaiter(void 0, [_a], void 0, function* ({ environmentId, externalJwt, sessionPublicKey, }) {
|
|
33
|
-
try {
|
|
34
|
-
const response = yield sdkApi().externalAuthSignin({
|
|
35
|
-
environmentId,
|
|
36
|
-
externalAuthSigninRequest: {
|
|
37
|
-
jwt: externalJwt,
|
|
38
|
-
sessionPublicKey,
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
return storeTokenAndUser(response);
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
const data = yield logResponseError(e, 'Error signing in with external JWT');
|
|
45
|
-
if (data.code === 'invalid_external_auth') {
|
|
46
|
-
throw new ExternalAuthError(data.code);
|
|
47
|
-
}
|
|
48
|
-
if (data.error.code === 'sandbox_maximum_threshold_reached') {
|
|
49
|
-
throw new SandboxMaximumThresholdReachedError(data.error.message);
|
|
50
|
-
}
|
|
51
|
-
throw new DynamicError(data.error);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
32
|
/**
|
|
55
|
-
* @deprecated Use `
|
|
33
|
+
* @deprecated Use `signInWithExternalJwt` instead.
|
|
56
34
|
* This currently does not work.
|
|
57
35
|
*/
|
|
58
|
-
const externalAuthVerify = (
|
|
36
|
+
const externalAuthVerify = (_a) => __awaiter(void 0, [_a], void 0, function* ({ environmentId, externalJwt, }) {
|
|
59
37
|
try {
|
|
60
38
|
/* istanbul ignore next */
|
|
61
39
|
const response = (yield sdkApi().externalAuthVerify({
|
|
@@ -70,7 +48,9 @@ const externalAuthVerify = (_b) => __awaiter(void 0, [_b], void 0, function* ({
|
|
|
70
48
|
catch (e) {
|
|
71
49
|
const data = yield logResponseError(e, 'Error verifying external JWT');
|
|
72
50
|
if (data.code === 'invalid_external_auth') {
|
|
73
|
-
throw new
|
|
51
|
+
throw new InvalidExternalAuthError({
|
|
52
|
+
cause: data,
|
|
53
|
+
});
|
|
74
54
|
}
|
|
75
55
|
if (data.error.code === 'sandbox_maximum_threshold_reached') {
|
|
76
56
|
throw new SandboxMaximumThresholdReachedError(data.error.message);
|
|
@@ -79,4 +59,4 @@ const externalAuthVerify = (_b) => __awaiter(void 0, [_b], void 0, function* ({
|
|
|
79
59
|
}
|
|
80
60
|
});
|
|
81
61
|
|
|
82
|
-
export {
|
|
62
|
+
export { externalAuthVerify };
|
|
@@ -74,11 +74,13 @@ const verifyOAuth = (environmentId_1, providerType_1, _b) => _tslib.__awaiter(vo
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
const unlinkOAuth = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ environmentId, primaryWalletId, verifiedCrentialId, }) {
|
|
77
|
+
// 7702 wallets have a -zerodev suffix because it's a credential created on the fly
|
|
78
|
+
const normalizedPrimaryWalletId = primaryWalletId === null || primaryWalletId === void 0 ? void 0 : primaryWalletId.replace('-zerodev', '');
|
|
77
79
|
try {
|
|
78
80
|
const response = yield api.sdkApi().verifyUnlink({
|
|
79
81
|
environmentId,
|
|
80
82
|
verifyUnlinkRequest: {
|
|
81
|
-
primaryWalletId,
|
|
83
|
+
primaryWalletId: normalizedPrimaryWalletId,
|
|
82
84
|
verifiedCrentialId,
|
|
83
85
|
},
|
|
84
86
|
});
|
|
@@ -70,11 +70,13 @@ const verifyOAuth = (environmentId_1, providerType_1, _b) => __awaiter(void 0, [
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
const unlinkOAuth = (_c) => __awaiter(void 0, [_c], void 0, function* ({ environmentId, primaryWalletId, verifiedCrentialId, }) {
|
|
73
|
+
// 7702 wallets have a -zerodev suffix because it's a credential created on the fly
|
|
74
|
+
const normalizedPrimaryWalletId = primaryWalletId === null || primaryWalletId === void 0 ? void 0 : primaryWalletId.replace('-zerodev', '');
|
|
73
75
|
try {
|
|
74
76
|
const response = yield sdkApi().verifyUnlink({
|
|
75
77
|
environmentId,
|
|
76
78
|
verifyUnlinkRequest: {
|
|
77
|
-
primaryWalletId,
|
|
79
|
+
primaryWalletId: normalizedPrimaryWalletId,
|
|
78
80
|
verifiedCrentialId,
|
|
79
81
|
},
|
|
80
82
|
});
|
|
@@ -14,7 +14,7 @@ import { WalletEvents } from './wallets';
|
|
|
14
14
|
export type DynamicEvents = AuthEvents & UIEvents & OTPEvents & WalletEvents & PasskeyEvents & SocialEvents & EmbeddedWalletEvents & MultiWalletInternalEvents & TokenBalancesEvents & UserEvents & FundingEvents;
|
|
15
15
|
type PublicDynamicEvents = Pick<DynamicEvents, typeof externalEvents[number]>;
|
|
16
16
|
/** Which events are accessible by our clients */
|
|
17
|
-
export declare const externalEvents: ("authFailure" | "authInit" | "logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "authFlowOpen" | "authFlowClose" | "authFlowCancelled" | "walletTabSelected" | "emailVerificationResult" | "smsVerificationResult" | "walletAdded" | "walletRemoved" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "userWalletsChanged" | "walletConnectionFailed" | "embeddedWalletCreated" | "walletConnectedForFunding")[];
|
|
17
|
+
export declare const externalEvents: ("authFailure" | "authInit" | "logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "authFlowOpen" | "authFlowClose" | "authFlowCancelled" | "walletTabSelected" | "emailVerificationResult" | "smsVerificationResult" | "walletAdded" | "walletRemoved" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "userWalletsChanged" | "walletConnectionFailed" | "walletConnectionQrCodeReady" | "embeddedWalletCreated" | "walletConnectedForFunding")[];
|
|
18
18
|
export declare const dynamicEvents: EventEmitter<DynamicEvents, any>;
|
|
19
19
|
export declare const publicDynamicEvents: EventEmitter<PublicDynamicEvents, any>;
|
|
20
20
|
export type DynamicEventEmitter = typeof dynamicEvents;
|
|
@@ -37,4 +37,6 @@ export type WalletEvents = {
|
|
|
37
37
|
userWalletsPopulated: (userWallets: Wallet[]) => void;
|
|
38
38
|
/** Triggered when Dynamic fails to connect to a wallet */
|
|
39
39
|
walletConnectionFailed: (walletConnector: WalletConnector, error: unknown) => void;
|
|
40
|
+
/** Triggered when a wallet connection QR code is ready */
|
|
41
|
+
walletConnectionQrCodeReady: (qrCodeUri: string) => void;
|
|
40
42
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { AlgorandIcon, BitcoinIcon, CosmosIcon, EclipseIcon, EthereumIcon, FlowIcon, SolanaIcon, StarknetIcon, SuiIcon } from '@dynamic-labs/iconic';
|
|
2
|
+
import { AlgorandIcon, BitcoinIcon, CosmosIcon, EclipseIcon, EthereumIcon, FlowIcon, SolanaIcon, SparkIcon, StarknetIcon, SuiIcon } from '@dynamic-labs/iconic';
|
|
3
3
|
import { getChainInfo } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import 'react';
|
|
5
5
|
import { ReactComponent as SvgError } from '../../../assets/error.js';
|
|
@@ -14,6 +14,7 @@ const chainIconMap = {
|
|
|
14
14
|
evm: EthereumIcon,
|
|
15
15
|
flow: FlowIcon,
|
|
16
16
|
solana: SolanaIcon,
|
|
17
|
+
spark: SparkIcon,
|
|
17
18
|
starknet: StarknetIcon,
|
|
18
19
|
sui: SuiIcon,
|
|
19
20
|
};
|
|
@@ -4,7 +4,6 @@ export * from './chain';
|
|
|
4
4
|
export * from './wallet';
|
|
5
5
|
export * from './getValueByKey';
|
|
6
6
|
export * from './detectBrowser';
|
|
7
|
-
export * from './shortenWalletAddress';
|
|
8
7
|
export * from './debounce';
|
|
9
8
|
export * from './isSSR';
|
|
10
9
|
export * from './isDisplayOrderPriorityForWeb3';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './shortenWalletAddress';
|
|
@@ -3,12 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// These are constant to ensure we keep a consistent length for cropped
|
|
7
|
+
// wallet addresses throughout the app.
|
|
8
|
+
const before = 4;
|
|
9
|
+
const after = 4;
|
|
10
|
+
// While it would be useful to export this function, we need to ensure the wallet lengths
|
|
11
|
+
// follow a standard. Therefore, we export the functions with the specific lengths.
|
|
12
|
+
const shortenWalletAddress = (walletAddress) => {
|
|
7
13
|
if (!walletAddress)
|
|
8
14
|
return '';
|
|
9
|
-
if (walletAddress.length <=
|
|
15
|
+
if (walletAddress.length <= before + after)
|
|
10
16
|
return walletAddress;
|
|
11
|
-
return walletAddress.replace(walletAddress.substring(
|
|
17
|
+
return walletAddress.replace(walletAddress.substring(before, Number(walletAddress.length) - after), '...');
|
|
12
18
|
};
|
|
13
19
|
|
|
14
20
|
exports.shortenWalletAddress = shortenWalletAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const shortenWalletAddress: (walletAddress: string | undefined
|
|
1
|
+
export declare const shortenWalletAddress: (walletAddress: string | undefined) => string;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
2
|
+
// These are constant to ensure we keep a consistent length for cropped
|
|
3
|
+
// wallet addresses throughout the app.
|
|
4
|
+
const before = 4;
|
|
5
|
+
const after = 4;
|
|
6
|
+
// While it would be useful to export this function, we need to ensure the wallet lengths
|
|
7
|
+
// follow a standard. Therefore, we export the functions with the specific lengths.
|
|
8
|
+
const shortenWalletAddress = (walletAddress) => {
|
|
3
9
|
if (!walletAddress)
|
|
4
10
|
return '';
|
|
5
|
-
if (walletAddress.length <=
|
|
11
|
+
if (walletAddress.length <= before + after)
|
|
6
12
|
return walletAddress;
|
|
7
|
-
return walletAddress.replace(walletAddress.substring(
|
|
13
|
+
return walletAddress.replace(walletAddress.substring(before, Number(walletAddress.length) - after), '...');
|
|
8
14
|
};
|
|
9
15
|
|
|
10
16
|
export { shortenWalletAddress };
|
|
@@ -4,5 +4,5 @@ type DynamicEventListener<E extends keyof DynamicEvents> = (...args: EventArgs<D
|
|
|
4
4
|
/** Allows us to subscribe to all dynamicEvents with a hook, even the internal ones */
|
|
5
5
|
export declare const useInternalDynamicEvents: <E extends keyof import("../../../../events/auth").AuthEvents | keyof import("../../../../events/ui").UIEvents | keyof import("../../../../events/otp").OTPEvents | keyof import("../../../../events/wallets").WalletEvents | keyof import("../../../../events/passkey").PasskeyEvents | "farcasterConnectCancelled" | keyof import("../../../../events/embeddedWallet").EmbeddedWalletEvents | keyof import("../../../../events/multiWallet").MultiWalletInternalEvents | "tokenBalancesChanged" | "userProfileUpdated" | "walletConnectedForFunding">(event: E, listener: DynamicEventListener<E>) => void;
|
|
6
6
|
/** Allows subscribing to dynamic events directly inside components with a hook */
|
|
7
|
-
export declare const useDynamicEvents: <E extends "authFailure" | "authInit" | "logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "authFlowOpen" | "authFlowClose" | "authFlowCancelled" | "walletTabSelected" | "emailVerificationResult" | "smsVerificationResult" | "walletAdded" | "walletRemoved" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "userWalletsChanged" | "walletConnectionFailed" | "embeddedWalletCreated" | "walletConnectedForFunding">(event: E, listener: DynamicEventListener<E>) => void;
|
|
7
|
+
export declare const useDynamicEvents: <E extends "authFailure" | "authInit" | "logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "authFlowOpen" | "authFlowClose" | "authFlowCancelled" | "walletTabSelected" | "emailVerificationResult" | "smsVerificationResult" | "walletAdded" | "walletRemoved" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "userWalletsChanged" | "walletConnectionFailed" | "walletConnectionQrCodeReady" | "embeddedWalletCreated" | "walletConnectedForFunding">(event: E, listener: DynamicEventListener<E>) => void;
|
|
8
8
|
export {};
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
8
9
|
require('@dynamic-labs/utils');
|
|
9
10
|
require('@dynamic-labs/sdk-api-core');
|
|
10
11
|
require('@dynamic-labs-sdk/client/core');
|
|
11
12
|
require('../../../client/client.cjs');
|
|
12
|
-
require('@dynamic-labs-sdk/client');
|
|
13
13
|
require('../../../config/ApiEndpoint.cjs');
|
|
14
14
|
require('../../constants/values.cjs');
|
|
15
15
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -29,6 +29,7 @@ require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
|
29
29
|
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
30
30
|
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
31
31
|
require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
32
|
+
var convertSdkUserToUserProfile = require('../../../client/extension/user/convertSdkUserToUserProfile/convertSdkUserToUserProfile.cjs');
|
|
32
33
|
var externalAuth = require('../../../data/api/externalAuth/externalAuth.cjs');
|
|
33
34
|
require('../../../locale/locale.cjs');
|
|
34
35
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
@@ -126,11 +127,11 @@ const useExternalAuth = () => {
|
|
|
126
127
|
const sessionPublicKey = shouldRegisterSessionKeysOnSignin()
|
|
127
128
|
? (yield generateSessionKey()).publicKey
|
|
128
129
|
: undefined;
|
|
129
|
-
const
|
|
130
|
-
environmentId,
|
|
130
|
+
const response = yield client.signInWithExternalJwt({
|
|
131
131
|
externalJwt,
|
|
132
132
|
sessionPublicKey,
|
|
133
133
|
});
|
|
134
|
+
const userProfile = convertSdkUserToUserProfile.convertSdkUserToUserProfile(response.user);
|
|
134
135
|
setCallback('authSuccess');
|
|
135
136
|
if (userProfile && !hasPendingRequirements.hasPendingRequirements(userProfile)) {
|
|
136
137
|
setShowAuthFlow(false);
|
|
@@ -146,14 +147,13 @@ const useExternalAuth = () => {
|
|
|
146
147
|
throw e;
|
|
147
148
|
}
|
|
148
149
|
}), [
|
|
149
|
-
environmentId,
|
|
150
150
|
setCallback,
|
|
151
151
|
setShowAuthFlow,
|
|
152
152
|
generateSessionKey,
|
|
153
153
|
shouldRegisterSessionKeysOnSignin,
|
|
154
154
|
]);
|
|
155
155
|
/**
|
|
156
|
-
* @deprecated Use `
|
|
156
|
+
* @deprecated Use `signInWithExternalJwt` instead.
|
|
157
157
|
*/
|
|
158
158
|
const verifyWithExternalJwt = React.useCallback((_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ externalUserId, externalJwt, }) {
|
|
159
159
|
try {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useCallback, useMemo } from 'react';
|
|
4
|
+
import { signInWithExternalJwt } from '@dynamic-labs-sdk/client';
|
|
4
5
|
import '@dynamic-labs/utils';
|
|
5
6
|
import '@dynamic-labs/sdk-api-core';
|
|
6
7
|
import '@dynamic-labs-sdk/client/core';
|
|
7
8
|
import '../../../client/client.js';
|
|
8
|
-
import '@dynamic-labs-sdk/client';
|
|
9
9
|
import '../../../config/ApiEndpoint.js';
|
|
10
10
|
import '../../constants/values.js';
|
|
11
11
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -25,7 +25,8 @@ import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
|
25
25
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
26
26
|
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
27
27
|
import '../../../store/state/projectSettings/projectSettings.js';
|
|
28
|
-
import {
|
|
28
|
+
import { convertSdkUserToUserProfile } from '../../../client/extension/user/convertSdkUserToUserProfile/convertSdkUserToUserProfile.js';
|
|
29
|
+
import { externalAuthVerify } from '../../../data/api/externalAuth/externalAuth.js';
|
|
29
30
|
import '../../../locale/locale.js';
|
|
30
31
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
31
32
|
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
@@ -117,16 +118,16 @@ const useExternalAuth = () => {
|
|
|
117
118
|
*
|
|
118
119
|
* @returns {UserProfile} - User profile for successfully signed in user
|
|
119
120
|
*/
|
|
120
|
-
const signInWithExternalJwt = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ externalUserId, externalJwt, }) {
|
|
121
|
+
const signInWithExternalJwt$1 = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ externalUserId, externalJwt, }) {
|
|
121
122
|
try {
|
|
122
123
|
const sessionPublicKey = shouldRegisterSessionKeysOnSignin()
|
|
123
124
|
? (yield generateSessionKey()).publicKey
|
|
124
125
|
: undefined;
|
|
125
|
-
const
|
|
126
|
-
environmentId,
|
|
126
|
+
const response = yield signInWithExternalJwt({
|
|
127
127
|
externalJwt,
|
|
128
128
|
sessionPublicKey,
|
|
129
129
|
});
|
|
130
|
+
const userProfile = convertSdkUserToUserProfile(response.user);
|
|
130
131
|
setCallback('authSuccess');
|
|
131
132
|
if (userProfile && !hasPendingRequirements(userProfile)) {
|
|
132
133
|
setShowAuthFlow(false);
|
|
@@ -142,14 +143,13 @@ const useExternalAuth = () => {
|
|
|
142
143
|
throw e;
|
|
143
144
|
}
|
|
144
145
|
}), [
|
|
145
|
-
environmentId,
|
|
146
146
|
setCallback,
|
|
147
147
|
setShowAuthFlow,
|
|
148
148
|
generateSessionKey,
|
|
149
149
|
shouldRegisterSessionKeysOnSignin,
|
|
150
150
|
]);
|
|
151
151
|
/**
|
|
152
|
-
* @deprecated Use `
|
|
152
|
+
* @deprecated Use `signInWithExternalJwt` instead.
|
|
153
153
|
*/
|
|
154
154
|
const verifyWithExternalJwt = useCallback((_b) => __awaiter(void 0, [_b], void 0, function* ({ externalUserId, externalJwt, }) {
|
|
155
155
|
try {
|
|
@@ -170,7 +170,7 @@ const useExternalAuth = () => {
|
|
|
170
170
|
throw e;
|
|
171
171
|
}
|
|
172
172
|
}), [environmentId, setCallback, setShowAuthFlow]);
|
|
173
|
-
return useMemo(() => ({ signInWithExternalJwt, verifyWithExternalJwt }), [signInWithExternalJwt, verifyWithExternalJwt]);
|
|
173
|
+
return useMemo(() => ({ signInWithExternalJwt: signInWithExternalJwt$1, verifyWithExternalJwt }), [signInWithExternalJwt$1, verifyWithExternalJwt]);
|
|
174
174
|
};
|
|
175
175
|
|
|
176
176
|
export { useExternalAuth };
|
|
@@ -208,7 +208,8 @@ const useUserAuth = ({ authMethod, }) => {
|
|
|
208
208
|
pushView('account-exists');
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
|
-
if (error instanceof utils.SandboxMaximumThresholdReachedError
|
|
211
|
+
if (error instanceof utils.SandboxMaximumThresholdReachedError ||
|
|
212
|
+
error instanceof client.SandboxMaximumThresholdReachedError) {
|
|
212
213
|
pushView('sandbox-maximum-threshold-reached');
|
|
213
214
|
return;
|
|
214
215
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { MfaInvalidOtpError, MfaRateLimitedError } from '@dynamic-labs-sdk/client';
|
|
3
|
+
import { MfaInvalidOtpError, MfaRateLimitedError, SandboxMaximumThresholdReachedError as SandboxMaximumThresholdReachedError$1 } from '@dynamic-labs-sdk/client';
|
|
4
4
|
import { EmbeddedWalletVersionEnum, MfaBackupCodeAcknowledgement } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { DynamicError, EmailAlreadyExistsError, CustomFieldNotUniqueError, UsernameAlreadyExistsError, TooManyEmailVerificationsError, InvalidPhoneNumberError, NoAccessError, AccountExistsError, SandboxMaximumThresholdReachedError, UserHasAccountWithEmailError, sleep } from '@dynamic-labs/utils';
|
|
6
6
|
import '@dynamic-labs-sdk/client/core';
|
|
@@ -204,7 +204,8 @@ const useUserAuth = ({ authMethod, }) => {
|
|
|
204
204
|
pushView('account-exists');
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
if (error instanceof SandboxMaximumThresholdReachedError
|
|
207
|
+
if (error instanceof SandboxMaximumThresholdReachedError ||
|
|
208
|
+
error instanceof SandboxMaximumThresholdReachedError$1) {
|
|
208
209
|
pushView('sandbox-maximum-threshold-reached');
|
|
209
210
|
return;
|
|
210
211
|
}
|
package/src/lib/utils/hooks/useWalletItemActions/useHandleWalletItem/useHandleWalletItem.cjs
CHANGED
|
@@ -166,9 +166,11 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
|
|
|
166
166
|
onQrCodeConnect({
|
|
167
167
|
getAddressOpts: {
|
|
168
168
|
onDesktopUri: (uri) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
169
|
+
dynamicEvents.dynamicEvents.emit('walletConnectionQrCodeReady', uri);
|
|
169
170
|
setDesktopUri(uri);
|
|
170
171
|
}),
|
|
171
172
|
onDisplayUri: (uri) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
173
|
+
dynamicEvents.dynamicEvents.emit('walletConnectionQrCodeReady', uri);
|
|
172
174
|
setQrcodeUri(uri);
|
|
173
175
|
}),
|
|
174
176
|
},
|
|
@@ -162,9 +162,11 @@ const useHandleWalletItem = ({ allowAlreadyConnectedWallet, onQrCodeConnect, onC
|
|
|
162
162
|
onQrCodeConnect({
|
|
163
163
|
getAddressOpts: {
|
|
164
164
|
onDesktopUri: (uri) => __awaiter(void 0, void 0, void 0, function* () {
|
|
165
|
+
dynamicEvents.emit('walletConnectionQrCodeReady', uri);
|
|
165
166
|
setDesktopUri(uri);
|
|
166
167
|
}),
|
|
167
168
|
onDisplayUri: (uri) => __awaiter(void 0, void 0, void 0, function* () {
|
|
169
|
+
dynamicEvents.emit('walletConnectionQrCodeReady', uri);
|
|
168
170
|
setQrcodeUri(uri);
|
|
169
171
|
}),
|
|
170
172
|
},
|
|
@@ -2,7 +2,7 @@ import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
|
2
2
|
import { WalletOption } from '../../../shared';
|
|
3
3
|
export declare const useWalletOptions: () => {
|
|
4
4
|
getFilteredWalletOptions: (filter: (options: WalletOption[]) => WalletOption[]) => {
|
|
5
|
-
chain: "ETH" | "FLOW" | "SOL" | "EVM" | "ALGO" | "STARK" | "ATOM" | "COSMOS" | "BTC" | "ECLIPSE" | "SUI";
|
|
5
|
+
chain: "ETH" | "FLOW" | "SOL" | "EVM" | "ALGO" | "STARK" | "ATOM" | "COSMOS" | "BTC" | "ECLIPSE" | "SUI" | "SPARK";
|
|
6
6
|
group: string | undefined;
|
|
7
7
|
groupName: string | undefined;
|
|
8
8
|
isInstalledOnBrowser: boolean;
|
|
@@ -13,7 +13,7 @@ export declare const useWalletOptions: () => {
|
|
|
13
13
|
}[];
|
|
14
14
|
selectWalletOption: (walletKey: string, selectGroupIfAvailable?: boolean, skipAllSelectionUi?: boolean) => Promise<Wallet<import("@dynamic-labs/wallet-connector-core").WalletConnectorCore.WalletConnector>>;
|
|
15
15
|
walletOptions: {
|
|
16
|
-
chain: "ETH" | "FLOW" | "SOL" | "EVM" | "ALGO" | "STARK" | "ATOM" | "COSMOS" | "BTC" | "ECLIPSE" | "SUI";
|
|
16
|
+
chain: "ETH" | "FLOW" | "SOL" | "EVM" | "ALGO" | "STARK" | "ATOM" | "COSMOS" | "BTC" | "ECLIPSE" | "SUI" | "SPARK";
|
|
17
17
|
group: string | undefined;
|
|
18
18
|
groupName: string | undefined;
|
|
19
19
|
isInstalledOnBrowser: boolean;
|
|
@@ -16,7 +16,6 @@ require('@dynamic-labs/sdk-api-core');
|
|
|
16
16
|
require('../../shared/logger.cjs');
|
|
17
17
|
require('@dynamic-labs/wallet-connector-core');
|
|
18
18
|
require('@dynamic-labs/wallet-book');
|
|
19
|
-
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
20
19
|
require('@dynamic-labs/utils');
|
|
21
20
|
require('../../utils/constants/colors.cjs');
|
|
22
21
|
require('../../utils/constants/values.cjs');
|
|
@@ -75,6 +74,7 @@ require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
|
75
74
|
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
76
75
|
require('react-focus-lock');
|
|
77
76
|
var Icon = require('../../components/Icon/Icon.cjs');
|
|
77
|
+
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
78
78
|
var AuthProviderIcon = require('../../components/AuthProviderIcon/AuthProviderIcon.cjs');
|
|
79
79
|
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
80
80
|
require('../../components/IconButton/IconButton.cjs');
|
|
@@ -127,7 +127,7 @@ const CollectUserDataView = () => {
|
|
|
127
127
|
isSupportedNetwork.isSupportedNetwork({ network, walletConnector });
|
|
128
128
|
const shouldDisplayWrongNetworkState = !_isSupportedNetwork && Boolean(walletConnector);
|
|
129
129
|
const walletAddress = (_a = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.verifiedCredentials.find((verifiedCredential) => verifiedCredential.id === userWithMissingInfo.lastVerifiedCredentialId)) === null || _a === void 0 ? void 0 : _a.address;
|
|
130
|
-
return (jsxRuntime.jsxs("div", { className: 'collect-user-data', "data-testid": 'collect-user-data-view', children: [jsxRuntime.jsxs("div", { className: 'collect-user-data__network-container', children: [jsxRuntime.jsxs("div", { className: 'collect-user-data__img-container', children: [(nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsxRuntime.jsx("img", { src: nameService.avatar, alt: '', className: 'collect-user-data__img collect-user-data__img--rounded' })) : (jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, { iconSize: 28 })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data__wallet-address', children: (nameService === null || nameService === void 0 ? void 0 : nameService.name) || shortenWalletAddress.shortenWalletAddress(walletAddress
|
|
130
|
+
return (jsxRuntime.jsxs("div", { className: 'collect-user-data', "data-testid": 'collect-user-data-view', children: [jsxRuntime.jsxs("div", { className: 'collect-user-data__network-container', children: [jsxRuntime.jsxs("div", { className: 'collect-user-data__img-container', children: [(nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsxRuntime.jsx("img", { src: nameService.avatar, alt: '', className: 'collect-user-data__img collect-user-data__img--rounded' })) : (jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, { iconSize: 28 })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data__wallet-address', children: (nameService === null || nameService === void 0 ? void 0 : nameService.name) || shortenWalletAddress.shortenWalletAddress(walletAddress) })] }), walletConnector && (jsxRuntime.jsx(NetworkPicker.NetworkPicker, { currentNetwork: network, connector: walletConnector, showNetworkName: true, buttonClassName: 'collect-user-data__network-picker-button', mainClassName: 'collect-user-data__network-picker' }))] }), onboardingImageUrl && (jsxRuntime.jsx("img", { className: 'collect-user-data__main-img', src: onboardingImageUrl, alt: 'onboarding' })), shouldDisplayWrongNetworkState && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { withIcon: false, className: 'collect-user-data__error--not-supported', copykey: 'dyn_collect_user_data.not_supported_network.error_message', children: t('dyn_collect_user_data.not_supported_network.error_message') })), jsxRuntime.jsxs("div", { className: classNames.classNames('collect-user-data__form', {
|
|
131
131
|
'collect-user-data__form--error': shouldDisplayWrongNetworkState,
|
|
132
132
|
}), children: [jsxRuntime.jsx("div", { className: 'collect-user-data__success-icon', children: jsxRuntime.jsx(Icon.Icon, { color: 'text-primary', size: 'large', children: jsxRuntime.jsx(checkConnection.ReactComponent, {}) }) }), jsxRuntime.jsx(OnboardingUserDataForm.OnboardingUserDataForm, { disableSubmit: shouldDisplayWrongNetworkState, userProfile: userWithMissingInfo, children: shouldDisplayWrongNetworkState ? (jsxRuntime.jsxs("div", { className: 'collect-user-data__welcome-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'collect-user-data__welcome-title', copykey: 'dyn_collect_user_data.not_supported_network.title', children: t('dyn_collect_user_data.not_supported_network.title') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_collect_user_data.not_supported_network.description', children: t('dyn_collect_user_data.not_supported_network.description') })] })) : (jsxRuntime.jsxs("div", { className: 'collect-user-data__welcome-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'collect-user-data__welcome-title', copykey: 'dyn_collect_user_data.greeting', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeHeader) ||
|
|
133
133
|
t('dyn_collect_user_data.greeting', { appName }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_collect_user_data.description', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeMessage) ||
|
|
@@ -12,7 +12,6 @@ import '@dynamic-labs/sdk-api-core';
|
|
|
12
12
|
import '../../shared/logger.js';
|
|
13
13
|
import '@dynamic-labs/wallet-connector-core';
|
|
14
14
|
import '@dynamic-labs/wallet-book';
|
|
15
|
-
import { shortenWalletAddress } from '../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
16
15
|
import '@dynamic-labs/utils';
|
|
17
16
|
import '../../utils/constants/colors.js';
|
|
18
17
|
import '../../utils/constants/values.js';
|
|
@@ -71,6 +70,7 @@ import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
|
71
70
|
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
72
71
|
import 'react-focus-lock';
|
|
73
72
|
import { Icon } from '../../components/Icon/Icon.js';
|
|
73
|
+
import { shortenWalletAddress } from '../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
74
74
|
import { AuthProviderIcon } from '../../components/AuthProviderIcon/AuthProviderIcon.js';
|
|
75
75
|
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
76
76
|
import '../../components/IconButton/IconButton.js';
|
|
@@ -123,7 +123,7 @@ const CollectUserDataView = () => {
|
|
|
123
123
|
isSupportedNetwork({ network, walletConnector });
|
|
124
124
|
const shouldDisplayWrongNetworkState = !_isSupportedNetwork && Boolean(walletConnector);
|
|
125
125
|
const walletAddress = (_a = userWithMissingInfo === null || userWithMissingInfo === void 0 ? void 0 : userWithMissingInfo.verifiedCredentials.find((verifiedCredential) => verifiedCredential.id === userWithMissingInfo.lastVerifiedCredentialId)) === null || _a === void 0 ? void 0 : _a.address;
|
|
126
|
-
return (jsxs("div", { className: 'collect-user-data', "data-testid": 'collect-user-data-view', children: [jsxs("div", { className: 'collect-user-data__network-container', children: [jsxs("div", { className: 'collect-user-data__img-container', children: [(nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("img", { src: nameService.avatar, alt: '', className: 'collect-user-data__img collect-user-data__img--rounded' })) : (jsx(AuthProviderIcon, { iconSize: 28 })), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data__wallet-address', children: (nameService === null || nameService === void 0 ? void 0 : nameService.name) || shortenWalletAddress(walletAddress
|
|
126
|
+
return (jsxs("div", { className: 'collect-user-data', "data-testid": 'collect-user-data-view', children: [jsxs("div", { className: 'collect-user-data__network-container', children: [jsxs("div", { className: 'collect-user-data__img-container', children: [(nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("img", { src: nameService.avatar, alt: '', className: 'collect-user-data__img collect-user-data__img--rounded' })) : (jsx(AuthProviderIcon, { iconSize: 28 })), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data__wallet-address', children: (nameService === null || nameService === void 0 ? void 0 : nameService.name) || shortenWalletAddress(walletAddress) })] }), walletConnector && (jsx(NetworkPicker, { currentNetwork: network, connector: walletConnector, showNetworkName: true, buttonClassName: 'collect-user-data__network-picker-button', mainClassName: 'collect-user-data__network-picker' }))] }), onboardingImageUrl && (jsx("img", { className: 'collect-user-data__main-img', src: onboardingImageUrl, alt: 'onboarding' })), shouldDisplayWrongNetworkState && (jsx(ErrorContainer, { withIcon: false, className: 'collect-user-data__error--not-supported', copykey: 'dyn_collect_user_data.not_supported_network.error_message', children: t('dyn_collect_user_data.not_supported_network.error_message') })), jsxs("div", { className: classNames('collect-user-data__form', {
|
|
127
127
|
'collect-user-data__form--error': shouldDisplayWrongNetworkState,
|
|
128
128
|
}), children: [jsx("div", { className: 'collect-user-data__success-icon', children: jsx(Icon, { color: 'text-primary', size: 'large', children: jsx(SvgCheckConnection, {}) }) }), jsx(OnboardingUserDataForm, { disableSubmit: shouldDisplayWrongNetworkState, userProfile: userWithMissingInfo, children: shouldDisplayWrongNetworkState ? (jsxs("div", { className: 'collect-user-data__welcome-container', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'collect-user-data__welcome-title', copykey: 'dyn_collect_user_data.not_supported_network.title', children: t('dyn_collect_user_data.not_supported_network.title') }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_collect_user_data.not_supported_network.description', children: t('dyn_collect_user_data.not_supported_network.description') })] })) : (jsxs("div", { className: 'collect-user-data__welcome-container', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'collect-user-data__welcome-title', copykey: 'dyn_collect_user_data.greeting', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeHeader) ||
|
|
129
129
|
t('dyn_collect_user_data.greeting', { appName }) }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_collect_user_data.description', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeMessage) ||
|
|
@@ -23,7 +23,6 @@ require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
|
23
23
|
require('../../shared/logger.cjs');
|
|
24
24
|
require('@dynamic-labs/wallet-connector-core');
|
|
25
25
|
require('@dynamic-labs/wallet-book');
|
|
26
|
-
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
27
26
|
require('../../utils/constants/colors.cjs');
|
|
28
27
|
require('../../utils/constants/values.cjs');
|
|
29
28
|
require('../../shared/consts/index.cjs');
|
|
@@ -77,6 +76,7 @@ require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
|
77
76
|
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
78
77
|
require('react-focus-lock');
|
|
79
78
|
var IconWithSpinner = require('../../components/IconWithSpinner/IconWithSpinner.cjs');
|
|
79
|
+
var shortenWalletAddress = require('../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
80
80
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
81
81
|
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
82
82
|
var IconButton = require('../../components/IconButton/IconButton.cjs');
|
|
@@ -19,7 +19,6 @@ import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
|
19
19
|
import '../../shared/logger.js';
|
|
20
20
|
import '@dynamic-labs/wallet-connector-core';
|
|
21
21
|
import '@dynamic-labs/wallet-book';
|
|
22
|
-
import { shortenWalletAddress } from '../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
23
22
|
import '../../utils/constants/colors.js';
|
|
24
23
|
import '../../utils/constants/values.js';
|
|
25
24
|
import '../../shared/consts/index.js';
|
|
@@ -73,6 +72,7 @@ import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
|
73
72
|
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
74
73
|
import 'react-focus-lock';
|
|
75
74
|
import { iconRatio } from '../../components/IconWithSpinner/IconWithSpinner.js';
|
|
75
|
+
import { shortenWalletAddress } from '../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
76
76
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
77
77
|
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
78
78
|
import { IconButton } from '../../components/IconButton/IconButton.js';
|