@dynamic-labs/sdk-react-core 4.0.0-alpha.46 → 4.0.0-alpha.47
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 +15 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/index.d.ts +1 -1
- package/src/lib/components/Divider/Divider.cjs +1 -0
- package/src/lib/components/Divider/Divider.js +1 -0
- package/src/lib/components/UserProfile/UserProfile.cjs +6 -1
- package/src/lib/components/UserProfile/UserProfile.js +7 -2
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.cjs +1 -1
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.js +2 -2
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -5
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -5
- package/src/lib/context/DynamicContext/types/DynamicContextProps.d.ts +2 -2
- package/src/lib/context/DynamicContext/types/IDynamicContext.d.ts +2 -5
- package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +1 -1
- package/src/lib/context/DynamicContext/types/index.d.ts +0 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +1 -3
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +1 -3
- package/src/lib/events/multiWallet.d.ts +2 -1
- package/src/lib/shared/types/wallets.d.ts +10 -0
- package/src/lib/store/state/walletConnectorOptions.cjs +21 -2
- package/src/lib/store/state/walletConnectorOptions.d.ts +7 -1
- package/src/lib/store/state/walletConnectorOptions.js +21 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs +5 -3
- package/src/lib/utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js +5 -3
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs +1 -1
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js +2 -2
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.cjs +12 -6
- package/src/lib/utils/hooks/useWalletItemActions/useWalletItemActions.js +12 -6
- package/src/lib/views/SubdomainField/SubdomainField.cjs +7 -1
- package/src/lib/views/SubdomainField/SubdomainField.js +7 -1
- package/src/lib/views/WalletList/WalletListGridTabs/WalletListGridTabs.d.ts +1 -1
- package/src/lib/views/WalletList/hooks/useTabState.d.ts +2 -2
- package/src/lib/views/WalletList/utils/getEffectiveRecommendedWallets.d.ts +1 -2
- package/src/lib/views/WalletList/utils/getEffectiveWalletFilter.d.ts +1 -1
- package/src/lib/context/DynamicContext/types/WalletListViewTabItem.d.ts +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.47](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.46...v4.0.0-alpha.47) (2024-12-17)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* stop exposing authToken and minAuthToken from dynamic context (#7629)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* allow re-linking unknown wallet when there's another account of the same wallet provider already linked ([#7628](https://github.com/dynamic-labs/dynamic-auth/issues/7628)) ([20c6dc3](https://github.com/dynamic-labs/dynamic-auth/commit/20c6dc3b1847d82bd46f0df5abaef4efe1e24e38))
|
|
12
|
+
* ensure wallet connector will not get removed ([#7625](https://github.com/dynamic-labs/dynamic-auth/issues/7625)) ([b764846](https://github.com/dynamic-labs/dynamic-auth/commit/b764846b56428e2997d33858e29a87f44359eb6c))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
* stop exposing authToken and minAuthToken from dynamic context ([#7629](https://github.com/dynamic-labs/dynamic-auth/issues/7629)) ([9648870](https://github.com/dynamic-labs/dynamic-auth/commit/9648870478cdcecde279117ada2a1095dab54e2c))
|
|
16
|
+
|
|
2
17
|
## [4.0.0-alpha.46](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.45...v4.0.0-alpha.46) (2024-12-17)
|
|
3
18
|
|
|
4
19
|
|
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": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.47",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.576",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"react-i18next": "13.5.0",
|
|
14
14
|
"yup": "0.32.11",
|
|
15
15
|
"react-international-phone": "4.2.5",
|
|
16
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
17
|
-
"@dynamic-labs/iconic": "4.0.0-alpha.
|
|
18
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
19
|
-
"@dynamic-labs/multi-wallet": "4.0.0-alpha.
|
|
20
|
-
"@dynamic-labs/rpc-providers": "4.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/store": "4.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
16
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.47",
|
|
17
|
+
"@dynamic-labs/iconic": "4.0.0-alpha.47",
|
|
18
|
+
"@dynamic-labs/logger": "4.0.0-alpha.47",
|
|
19
|
+
"@dynamic-labs/multi-wallet": "4.0.0-alpha.47",
|
|
20
|
+
"@dynamic-labs/rpc-providers": "4.0.0-alpha.47",
|
|
21
|
+
"@dynamic-labs/store": "4.0.0-alpha.47",
|
|
22
|
+
"@dynamic-labs/types": "4.0.0-alpha.47",
|
|
23
|
+
"@dynamic-labs/utils": "4.0.0-alpha.47",
|
|
24
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.47",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.47",
|
|
26
26
|
"bs58": "5.0.0",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
package/src/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ LogoutIcon,
|
|
|
57
57
|
/** @deprecated */
|
|
58
58
|
PencilIcon,
|
|
59
59
|
/** @deprecated */
|
|
60
|
-
SpinnerIcon, type AccessDeniedCustomButton, type AccountSwitchState, type AuthModeType, type AwaitingSignatureState, type ChainToWalletMap, type DynamicEventsCallbacks, type DynamicHandlers, type MultiWalletWidgetState, type OnAuthSuccess, type HandleConnectedWallet, type OnWalletAdded, type OnWalletRemoved, type OnOtpVerificationResult, type OnEmbeddedWalletCreated, type OnUserProfileUpdate, type RecommendedWallet, type Wallet, type WalletOption,
|
|
60
|
+
SpinnerIcon, type AccessDeniedCustomButton, type AccountSwitchState, type AuthModeType, type AwaitingSignatureState, type ChainToWalletMap, type DynamicEventsCallbacks, type DynamicHandlers, type MultiWalletWidgetState, type OnAuthSuccess, type HandleConnectedWallet, type OnWalletAdded, type OnWalletRemoved, type OnOtpVerificationResult, type OnEmbeddedWalletCreated, type OnUserProfileUpdate, type RecommendedWallet, type Wallet, type WalletOption, type WalletsFilter, type WalletListViewTabItem,
|
|
61
61
|
/** @deprecated */
|
|
62
62
|
useLocalStorage,
|
|
63
63
|
/** @deprecated */
|
|
@@ -88,6 +88,7 @@ require('qrcode');
|
|
|
88
88
|
|
|
89
89
|
const Divider = ({ text, className, style, fullWidth = false, children, }) => (jsxRuntime.jsxs("div", { className: classNames.classNames('divider', className, {
|
|
90
90
|
'divider__full-width': fullWidth,
|
|
91
|
+
'divider__no-gap': text === undefined && children === undefined,
|
|
91
92
|
}), style: style, children: [jsxRuntime.jsx("div", { className: 'divider__dash' }), Boolean(text) && (jsxRuntime.jsx(Typography.Typography, { className: 'divider__text', variant: 'body_small', color: 'secondary', children: text })), children && jsxRuntime.jsx("div", { children: children }), jsxRuntime.jsx("div", { className: 'divider__dash' })] }));
|
|
92
93
|
|
|
93
94
|
exports.Divider = Divider;
|
|
@@ -84,6 +84,7 @@ import 'qrcode';
|
|
|
84
84
|
|
|
85
85
|
const Divider = ({ text, className, style, fullWidth = false, children, }) => (jsxs("div", { className: classNames('divider', className, {
|
|
86
86
|
'divider__full-width': fullWidth,
|
|
87
|
+
'divider__no-gap': text === undefined && children === undefined,
|
|
87
88
|
}), style: style, children: [jsx("div", { className: 'divider__dash' }), Boolean(text) && (jsx(Typography, { className: 'divider__text', variant: 'body_small', color: 'secondary', children: text })), children && jsx("div", { children: children }), jsx("div", { className: 'divider__dash' })] }));
|
|
88
89
|
|
|
89
90
|
export { Divider };
|
|
@@ -122,6 +122,7 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
122
122
|
projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
|
|
123
123
|
user,
|
|
124
124
|
});
|
|
125
|
+
const ensDomain = React.useMemo(() => { var _a; return (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.nameService) === null || _a === void 0 ? void 0 : _a.evm.domain; }, [projectSettings]);
|
|
125
126
|
const providers = isSocialKycEnabled.isSocialKycEnabled(projectSettings)
|
|
126
127
|
? index.getEnabledOAuthProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers)
|
|
127
128
|
: [];
|
|
@@ -143,9 +144,13 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
143
144
|
let fieldValue = value;
|
|
144
145
|
if (validationType === sdkApiCore.CustomFieldType.Checkbox)
|
|
145
146
|
fieldValue = value.length > 0 ? 'Checked' : 'Unchecked';
|
|
146
|
-
|
|
147
|
+
// Use name instead of label here because the back-end doesn't set label
|
|
148
|
+
let fieldLabel = name;
|
|
147
149
|
if (name === fields.NAME_SERVICE_FIELD_NAME) {
|
|
148
150
|
fieldLabel = t('dyn_subdomain_field.label');
|
|
151
|
+
if (ensDomain) {
|
|
152
|
+
fieldValue = `${fieldValue}.${ensDomain}`;
|
|
153
|
+
}
|
|
149
154
|
}
|
|
150
155
|
return (jsxRuntime.jsx(UserProfileField.UserProfileField, { name: name, label: fieldLabel, value: fieldValue }, name));
|
|
151
156
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { useRef, useEffect, useMemo } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { KycFieldType, CustomFieldType } from '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
@@ -118,6 +118,7 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
118
118
|
projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
|
|
119
119
|
user,
|
|
120
120
|
});
|
|
121
|
+
const ensDomain = useMemo(() => { var _a; return (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.nameService) === null || _a === void 0 ? void 0 : _a.evm.domain; }, [projectSettings]);
|
|
121
122
|
const providers = isSocialKycEnabled(projectSettings)
|
|
122
123
|
? getEnabledOAuthProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers)
|
|
123
124
|
: [];
|
|
@@ -139,9 +140,13 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
139
140
|
let fieldValue = value;
|
|
140
141
|
if (validationType === CustomFieldType.Checkbox)
|
|
141
142
|
fieldValue = value.length > 0 ? 'Checked' : 'Unchecked';
|
|
142
|
-
|
|
143
|
+
// Use name instead of label here because the back-end doesn't set label
|
|
144
|
+
let fieldLabel = name;
|
|
143
145
|
if (name === NAME_SERVICE_FIELD_NAME) {
|
|
144
146
|
fieldLabel = t('dyn_subdomain_field.label');
|
|
147
|
+
if (ensDomain) {
|
|
148
|
+
fieldValue = `${fieldValue}.${ensDomain}`;
|
|
149
|
+
}
|
|
145
150
|
}
|
|
146
151
|
return (jsx(UserProfileField, { name: name, label: fieldLabel, value: fieldValue }, name));
|
|
147
152
|
}
|
|
@@ -138,7 +138,7 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
|
|
|
138
138
|
const newWalletOption = createWallet.createWallet(connectorProps.walletBook, connector);
|
|
139
139
|
updatedConnectors.push(newWalletOption);
|
|
140
140
|
}
|
|
141
|
-
walletConnectorOptions.
|
|
141
|
+
walletConnectorOptions.mergeWalletConnectorOptions(updatedConnectors);
|
|
142
142
|
};
|
|
143
143
|
if (!walletBook.isWalletBookPopulated(connectorProps.walletBook)) {
|
|
144
144
|
return;
|
|
@@ -44,7 +44,7 @@ import '../../context/MockContext/MockContext.js';
|
|
|
44
44
|
import '../../views/CollectUserDataView/useFields.js';
|
|
45
45
|
import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
46
46
|
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
47
|
-
import {
|
|
47
|
+
import { mergeWalletConnectorOptions } from '../../store/state/walletConnectorOptions.js';
|
|
48
48
|
import 'react-i18next';
|
|
49
49
|
import '../Accordion/components/AccordionItem/AccordionItem.js';
|
|
50
50
|
import '../Alert/Alert.js';
|
|
@@ -134,7 +134,7 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
|
|
|
134
134
|
const newWalletOption = createWallet(connectorProps.walletBook, connector);
|
|
135
135
|
updatedConnectors.push(newWalletOption);
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
mergeWalletConnectorOptions(updatedConnectors);
|
|
138
138
|
};
|
|
139
139
|
if (!isWalletBookPopulated(connectorProps.walletBook)) {
|
|
140
140
|
return;
|
|
@@ -30,8 +30,7 @@ require('../../shared/consts/index.cjs');
|
|
|
30
30
|
var CaptchaContext = require('../CaptchaContext/CaptchaContext.cjs');
|
|
31
31
|
var ErrorContext = require('../ErrorContext/ErrorContext.cjs');
|
|
32
32
|
require('@dynamic-labs/multi-wallet');
|
|
33
|
-
var
|
|
34
|
-
var getMinAuthToken = require('../../utils/functions/getMinAuthToken/getMinAuthToken.cjs');
|
|
33
|
+
var helpers = require('./helpers/helpers.cjs');
|
|
35
34
|
require('react-international-phone');
|
|
36
35
|
var ApiEndpoint = require('../../config/ApiEndpoint.cjs');
|
|
37
36
|
var user = require('../../store/state/user/user.cjs');
|
|
@@ -132,7 +131,6 @@ var SendBalanceContext = require('../SendBalanceContext/SendBalanceContext.cjs')
|
|
|
132
131
|
var UseNetworkValidation = require('../UseNetworkValidation/UseNetworkValidation.cjs');
|
|
133
132
|
var defaultDynamicSettings = require('../../store/state/dynamicContextProps/defaultDynamicSettings.cjs');
|
|
134
133
|
var onReinitialize = require('./functions/onReinitialize/onReinitialize.cjs');
|
|
135
|
-
var helpers = require('./helpers/helpers.cjs');
|
|
136
134
|
var useDisplayOrderState = require('./hooks/useDisplayOrderState/useDisplayOrderState.cjs');
|
|
137
135
|
var useEmailLoginState = require('./hooks/useEmailLoginState/useEmailLoginState.cjs');
|
|
138
136
|
var useHandleLogout = require('./hooks/useHandleLogout/useHandleLogout.cjs');
|
|
@@ -483,7 +481,6 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
483
481
|
appLogoUrl,
|
|
484
482
|
appName,
|
|
485
483
|
authMode,
|
|
486
|
-
authToken: getAuthToken.getAuthToken(),
|
|
487
484
|
authorizationViewDisplayOrder,
|
|
488
485
|
awaitingSignatureState,
|
|
489
486
|
bridgeChains,
|
|
@@ -521,7 +518,6 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
521
518
|
changeLanguage: locale.Locale.getInstance().changeLanguage,
|
|
522
519
|
},
|
|
523
520
|
loginWithEmail,
|
|
524
|
-
minAuthToken: getMinAuthToken.getMinAuthToken(),
|
|
525
521
|
multiAsset,
|
|
526
522
|
multiWallet,
|
|
527
523
|
multiWalletWidgetState,
|
|
@@ -26,8 +26,7 @@ import '../../shared/consts/index.js';
|
|
|
26
26
|
import { CaptchaContextProvider } from '../CaptchaContext/CaptchaContext.js';
|
|
27
27
|
import { ErrorContextProvider } from '../ErrorContext/ErrorContext.js';
|
|
28
28
|
import '@dynamic-labs/multi-wallet';
|
|
29
|
-
import {
|
|
30
|
-
import { getMinAuthToken } from '../../utils/functions/getMinAuthToken/getMinAuthToken.js';
|
|
29
|
+
import { resolveNetworkValidationMode, initExpirationTime, getInitialView, getDeepLinkPreference } from './helpers/helpers.js';
|
|
31
30
|
import 'react-international-phone';
|
|
32
31
|
import ApiEndpoint from '../../config/ApiEndpoint.js';
|
|
33
32
|
import { useUser } from '../../store/state/user/user.js';
|
|
@@ -128,7 +127,6 @@ import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceCon
|
|
|
128
127
|
import { UseNetworkValidation } from '../UseNetworkValidation/UseNetworkValidation.js';
|
|
129
128
|
import { defaultDynamicSettings } from '../../store/state/dynamicContextProps/defaultDynamicSettings.js';
|
|
130
129
|
import { onReinitialize } from './functions/onReinitialize/onReinitialize.js';
|
|
131
|
-
import { resolveNetworkValidationMode, initExpirationTime, getInitialView, getDeepLinkPreference } from './helpers/helpers.js';
|
|
132
130
|
import { useDisplayOrderState } from './hooks/useDisplayOrderState/useDisplayOrderState.js';
|
|
133
131
|
import { useEmailLoginState } from './hooks/useEmailLoginState/useEmailLoginState.js';
|
|
134
132
|
import { useHandleLogout } from './hooks/useHandleLogout/useHandleLogout.js';
|
|
@@ -479,7 +477,6 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
479
477
|
appLogoUrl,
|
|
480
478
|
appName,
|
|
481
479
|
authMode,
|
|
482
|
-
authToken: getAuthToken(),
|
|
483
480
|
authorizationViewDisplayOrder,
|
|
484
481
|
awaitingSignatureState,
|
|
485
482
|
bridgeChains,
|
|
@@ -517,7 +514,6 @@ const InnerDynamicContextProvider = (props) => {
|
|
|
517
514
|
changeLanguage: Locale.getInstance().changeLanguage,
|
|
518
515
|
},
|
|
519
516
|
loginWithEmail,
|
|
520
|
-
minAuthToken: getMinAuthToken(),
|
|
521
517
|
multiAsset,
|
|
522
518
|
multiWallet,
|
|
523
519
|
multiWalletWidgetState,
|
|
@@ -5,7 +5,7 @@ import { type MobileExperience, type CoinbaseWalletPreference, type SocialProvid
|
|
|
5
5
|
import { DeepLinkVariant, WalletConnectorExtension, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
6
6
|
import { TokenBalance } from '@dynamic-labs/sdk-api-core';
|
|
7
7
|
import { LocaleResource } from '../../../locale';
|
|
8
|
-
import { AccessDeniedCustomButton, AuthModeType, ChainToWalletMap, DynamicEventsCallbacks, RecommendedWallet,
|
|
8
|
+
import { AccessDeniedCustomButton, AuthModeType, ChainToWalletMap, DynamicEventsCallbacks, RecommendedWallet, WalletsFilter } from '../../../shared';
|
|
9
9
|
import { DynamicHandlers } from '../../../shared/types/dynamicHandlers';
|
|
10
10
|
import { SocialNetworkIconType } from '../../../utils/functions/getSocialNetworkIcon';
|
|
11
11
|
import { ThemeData, ThemeSetting } from '../../ThemeContext';
|
|
@@ -87,7 +87,7 @@ export interface DynamicContextProps {
|
|
|
87
87
|
walletConnectors?: WalletConnectorsMethod[];
|
|
88
88
|
walletConnectorExtensions?: WalletConnectorExtension[];
|
|
89
89
|
walletConnectPreferredChains?: `eip155:${number}`[];
|
|
90
|
-
walletsFilter?:
|
|
90
|
+
walletsFilter?: WalletsFilter;
|
|
91
91
|
/**
|
|
92
92
|
* Allows filtering which tokens show in the expanded tokens view.
|
|
93
93
|
* Hidden tokens will not count towards the user's total balance.
|
|
@@ -5,7 +5,7 @@ import { NameServiceData, ProjectSettings } from '@dynamic-labs/sdk-api-core';
|
|
|
5
5
|
import { MobileExperience, NetworkConfigurationMap, SocialProviderFilter, UserProfile, WalletUiUtils } from '@dynamic-labs/types';
|
|
6
6
|
import { Chain, GetAddressOpts, InternalWalletConnector, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
7
7
|
import { PasskeySuccessEnum } from '../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner';
|
|
8
|
-
import { AccessDeniedCustomButton, AccountSwitchState, AuthModeType, AwaitingSignatureState, ChainToWalletMap, DynamicEventsCallbacks, MultiWalletWidgetState, RecommendedWallet, Wallet, WalletOption, WalletWithAction } from '../../../shared';
|
|
8
|
+
import { AccessDeniedCustomButton, AccountSwitchState, AuthModeType, AwaitingSignatureState, ChainToWalletMap, DynamicEventsCallbacks, MultiWalletWidgetState, RecommendedWallet, Wallet, WalletListViewTabItem, WalletOption, WalletsFilter, WalletWithAction } from '../../../shared';
|
|
9
9
|
import { DynamicHandlers } from '../../../shared/types/dynamicHandlers';
|
|
10
10
|
import { SocialNetworkIconType } from '../../../utils/functions/getSocialNetworkIcon';
|
|
11
11
|
import { MultiWalletWidgetStateSetter } from '../../../utils/hooks/multiWallet';
|
|
@@ -14,7 +14,6 @@ import { ThemeData, ThemeSetting } from '../../ThemeContext';
|
|
|
14
14
|
import { DisplayOrder, SetDisplayOrderPriority, SetShowAuthFlow } from '../hooks';
|
|
15
15
|
import { SetCallbackType } from '../useCustomerCallbacks';
|
|
16
16
|
import { SettingsOverrides } from './SettingsOverrides';
|
|
17
|
-
import { WalletListViewTabItem } from './WalletListViewTabItem';
|
|
18
17
|
import { SocialSettings } from './SocialSettings';
|
|
19
18
|
export type ChainsToConnect = {
|
|
20
19
|
chain: Chain;
|
|
@@ -34,7 +33,6 @@ export interface IDynamicContext {
|
|
|
34
33
|
appName?: string;
|
|
35
34
|
defaultPhoneInputIso2?: CountryIso2;
|
|
36
35
|
authMode: AuthModeType;
|
|
37
|
-
authToken: string | undefined;
|
|
38
36
|
authorizationViewDisplayOrder: DisplayOrder;
|
|
39
37
|
awaitingSignatureState: AwaitingSignatureState;
|
|
40
38
|
socialSettings?: SocialSettings;
|
|
@@ -81,7 +79,6 @@ export interface IDynamicContext {
|
|
|
81
79
|
selectedTabSettings: WalletListViewTabItem | undefined;
|
|
82
80
|
tabsItems: WalletListViewTabItem[] | undefined;
|
|
83
81
|
setSelectedTabIndex: Dispatch<SetStateAction<number>>;
|
|
84
|
-
minAuthToken: string | undefined;
|
|
85
82
|
multiAsset: boolean;
|
|
86
83
|
multiWallet: boolean;
|
|
87
84
|
multiWalletWidgetState: MultiWalletWidgetState;
|
|
@@ -158,5 +155,5 @@ export interface IDynamicContext {
|
|
|
158
155
|
userWithMissingInfo: UserProfile | undefined;
|
|
159
156
|
walletConnectorOptions: WalletOption[];
|
|
160
157
|
walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
161
|
-
walletsFilter?:
|
|
158
|
+
walletsFilter?: WalletsFilter;
|
|
162
159
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SdkView } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import { GenericNetwork } from '@dynamic-labs/types';
|
|
3
3
|
import { ChainDisplayOverrides } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
-
import { WalletListViewTabItem } from '
|
|
4
|
+
import { WalletListViewTabItem } from '../../../shared';
|
|
5
5
|
export type WalletListViewSettings = {
|
|
6
6
|
type: 'wallet-list';
|
|
7
7
|
tabs?: {
|
|
@@ -13,12 +13,11 @@ const useDynamicContext = () => {
|
|
|
13
13
|
if (context === undefined) {
|
|
14
14
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
15
15
|
}
|
|
16
|
-
const { accountSwitchState, authMode,
|
|
16
|
+
const { accountSwitchState, authMode, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, userWithMissingInfo, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, selectedTabIndex, setSelectedTabIndex, } = context;
|
|
17
17
|
const { setAuthMode } = useOverrides.useOverrides(context);
|
|
18
18
|
return {
|
|
19
19
|
accountSwitchState,
|
|
20
20
|
authMode,
|
|
21
|
-
authToken,
|
|
22
21
|
awaitingSignatureState,
|
|
23
22
|
bridgeChains,
|
|
24
23
|
bridgeChainsToConnect,
|
|
@@ -28,7 +27,6 @@ const useDynamicContext = () => {
|
|
|
28
27
|
loadingNetwork,
|
|
29
28
|
locale,
|
|
30
29
|
loginWithEmail,
|
|
31
|
-
minAuthToken,
|
|
32
30
|
multiWalletWidgetState,
|
|
33
31
|
network,
|
|
34
32
|
networkConfigurations,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { IDynamicContext } from '../types';
|
|
3
|
-
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | '
|
|
3
|
+
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'userWithMissingInfo' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setAuthMode' | 'selectedTabIndex' | 'setSelectedTabIndex'> & {
|
|
4
4
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
5
5
|
};
|
|
6
6
|
export declare const useDynamicContext: () => UseDynamicContext;
|
|
@@ -9,12 +9,11 @@ const useDynamicContext = () => {
|
|
|
9
9
|
if (context === undefined) {
|
|
10
10
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
11
11
|
}
|
|
12
|
-
const { accountSwitchState, authMode,
|
|
12
|
+
const { accountSwitchState, authMode, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, userWithMissingInfo, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, selectedTabIndex, setSelectedTabIndex, } = context;
|
|
13
13
|
const { setAuthMode } = useOverrides(context);
|
|
14
14
|
return {
|
|
15
15
|
accountSwitchState,
|
|
16
16
|
authMode,
|
|
17
|
-
authToken,
|
|
18
17
|
awaitingSignatureState,
|
|
19
18
|
bridgeChains,
|
|
20
19
|
bridgeChainsToConnect,
|
|
@@ -24,7 +23,6 @@ const useDynamicContext = () => {
|
|
|
24
23
|
loadingNetwork,
|
|
25
24
|
locale,
|
|
26
25
|
loginWithEmail,
|
|
27
|
-
minAuthToken,
|
|
28
26
|
multiWalletWidgetState,
|
|
29
27
|
network,
|
|
30
28
|
networkConfigurations,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
1
2
|
export type MultiWalletInternalEvents = {
|
|
2
3
|
triggerComputePrimaryWalletMultiWalletStateFromAccounts: (props: {
|
|
3
4
|
accounts: string[];
|
|
4
5
|
}) => void;
|
|
5
|
-
triggerConnectAndSign: () => void;
|
|
6
|
+
triggerConnectAndSign: (walletConnector?: InternalWalletConnector) => void;
|
|
6
7
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import { OauthProviderRequest, PasswordSourceTypeEnum, WalletAdditionalAddress, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
2
3
|
import type { InternalWalletConnector, Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
3
4
|
export type { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
@@ -54,3 +55,12 @@ export type ChainToWalletMap = {
|
|
|
54
55
|
solana?: string;
|
|
55
56
|
};
|
|
56
57
|
};
|
|
58
|
+
export type WalletsFilter = (options: WalletOption[]) => WalletOption[];
|
|
59
|
+
export type WalletListViewTabItem = {
|
|
60
|
+
label: {
|
|
61
|
+
text?: string;
|
|
62
|
+
icon?: string | ReactElement;
|
|
63
|
+
};
|
|
64
|
+
walletsFilter?: WalletsFilter;
|
|
65
|
+
recommendedWallets?: RecommendedWallet[];
|
|
66
|
+
};
|
|
@@ -5,9 +5,28 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var createStoreState = require('../internalImplementation/utils/createStoreState/createStoreState.cjs');
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const walletConnectorOptionsState = createStoreState.createStoreState('walletConnectorOptions');
|
|
9
|
+
const { getWalletConnectorOptions, useWalletConnectorOptions, resetWalletConnectorOptions, } = walletConnectorOptionsState;
|
|
10
|
+
/**
|
|
11
|
+
* Merges the current wallet connector options with the new options.
|
|
12
|
+
* @param options - The new wallet connector options to merge.
|
|
13
|
+
*/
|
|
14
|
+
const mergeWalletConnectorOptions = (options) => {
|
|
15
|
+
const currentWalletOptions = getWalletConnectorOptions();
|
|
16
|
+
// Create a unique key for each wallet option based on its key and connected chain
|
|
17
|
+
const getKey = (walletOption) => `${walletOption.key}-${walletOption.walletConnector.connectedChain}`;
|
|
18
|
+
const currentWalletOptionsMap = new Map(currentWalletOptions.map((walletOption) => [
|
|
19
|
+
getKey(walletOption),
|
|
20
|
+
walletOption,
|
|
21
|
+
]));
|
|
22
|
+
options.forEach((walletOption) => {
|
|
23
|
+
currentWalletOptionsMap.set(getKey(walletOption), walletOption);
|
|
24
|
+
});
|
|
25
|
+
const updatedWalletOptions = Array.from(currentWalletOptionsMap.values());
|
|
26
|
+
walletConnectorOptionsState.setWalletConnectorOptions(updatedWalletOptions);
|
|
27
|
+
};
|
|
9
28
|
|
|
10
29
|
exports.getWalletConnectorOptions = getWalletConnectorOptions;
|
|
30
|
+
exports.mergeWalletConnectorOptions = mergeWalletConnectorOptions;
|
|
11
31
|
exports.resetWalletConnectorOptions = resetWalletConnectorOptions;
|
|
12
|
-
exports.setWalletConnectorOptions = setWalletConnectorOptions;
|
|
13
32
|
exports.useWalletConnectorOptions = useWalletConnectorOptions;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { WalletOption } from '../../shared';
|
|
2
|
+
export declare const getWalletConnectorOptions: () => WalletOption[], useWalletConnectorOptions: () => WalletOption[], resetWalletConnectorOptions: () => void;
|
|
3
|
+
/**
|
|
4
|
+
* Merges the current wallet connector options with the new options.
|
|
5
|
+
* @param options - The new wallet connector options to merge.
|
|
6
|
+
*/
|
|
7
|
+
export declare const mergeWalletConnectorOptions: (options: WalletOption[]) => void;
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { createStoreState } from '../internalImplementation/utils/createStoreState/createStoreState.js';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const walletConnectorOptionsState = createStoreState('walletConnectorOptions');
|
|
5
|
+
const { getWalletConnectorOptions, useWalletConnectorOptions, resetWalletConnectorOptions, } = walletConnectorOptionsState;
|
|
6
|
+
/**
|
|
7
|
+
* Merges the current wallet connector options with the new options.
|
|
8
|
+
* @param options - The new wallet connector options to merge.
|
|
9
|
+
*/
|
|
10
|
+
const mergeWalletConnectorOptions = (options) => {
|
|
11
|
+
const currentWalletOptions = getWalletConnectorOptions();
|
|
12
|
+
// Create a unique key for each wallet option based on its key and connected chain
|
|
13
|
+
const getKey = (walletOption) => `${walletOption.key}-${walletOption.walletConnector.connectedChain}`;
|
|
14
|
+
const currentWalletOptionsMap = new Map(currentWalletOptions.map((walletOption) => [
|
|
15
|
+
getKey(walletOption),
|
|
16
|
+
walletOption,
|
|
17
|
+
]));
|
|
18
|
+
options.forEach((walletOption) => {
|
|
19
|
+
currentWalletOptionsMap.set(getKey(walletOption), walletOption);
|
|
20
|
+
});
|
|
21
|
+
const updatedWalletOptions = Array.from(currentWalletOptionsMap.values());
|
|
22
|
+
walletConnectorOptionsState.setWalletConnectorOptions(updatedWalletOptions);
|
|
23
|
+
};
|
|
5
24
|
|
|
6
|
-
export { getWalletConnectorOptions,
|
|
25
|
+
export { getWalletConnectorOptions, mergeWalletConnectorOptions, resetWalletConnectorOptions, useWalletConnectorOptions };
|