@dynamic-labs/sdk-react-core 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +4 -2
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +4 -2
- package/src/lib/shared/utils/functions/providerLabel/providerLabel.cjs +3 -0
- package/src/lib/shared/utils/functions/providerLabel/providerLabel.d.ts +1 -1
- package/src/lib/shared/utils/functions/providerLabel/providerLabel.js +3 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +1 -8
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +1 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
### [1.1.2](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.1...v1.1.2) (2024-02-13)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* coinbasesocial should display coinbase in profile linking section ([#4681](https://github.com/dynamic-labs/DynamicAuth/issues/4681)) ([dea7dc6](https://github.com/dynamic-labs/DynamicAuth/commit/dea7dc63fcc84ac2b99eb561ca26fe5c8f1d3edf))
|
|
8
|
+
* prompt to change network on signin when using wallet-connect ([#4675](https://github.com/dynamic-labs/DynamicAuth/issues/4675)) ([2f5f2a0](https://github.com/dynamic-labs/DynamicAuth/commit/2f5f2a0cad538f2bb706296d8a664488d2dc35ac)), closes [#4672](https://github.com/dynamic-labs/DynamicAuth/issues/4672)
|
|
9
|
+
|
|
2
10
|
### [1.1.1](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0...v1.1.1) (2024-02-13)
|
|
3
11
|
|
|
4
12
|
|
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": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"react-focus-lock": "2.9.2",
|
|
17
17
|
"react-i18next": "^13.2.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
|
-
"@dynamic-labs/ethereum": "1.1.
|
|
20
|
-
"@dynamic-labs/iconic": "1.1.
|
|
21
|
-
"@dynamic-labs/logger": "1.1.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "1.1.
|
|
23
|
-
"@dynamic-labs/rpc-providers": "1.1.
|
|
24
|
-
"@dynamic-labs/types": "1.1.
|
|
25
|
-
"@dynamic-labs/utils": "1.1.
|
|
26
|
-
"@dynamic-labs/viem-utils": "1.1.
|
|
27
|
-
"@dynamic-labs/wallet-book": "1.1.
|
|
28
|
-
"@dynamic-labs/wallet-connector-core": "1.1.
|
|
19
|
+
"@dynamic-labs/ethereum": "1.1.2",
|
|
20
|
+
"@dynamic-labs/iconic": "1.1.2",
|
|
21
|
+
"@dynamic-labs/logger": "1.1.2",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "1.1.2",
|
|
23
|
+
"@dynamic-labs/rpc-providers": "1.1.2",
|
|
24
|
+
"@dynamic-labs/types": "1.1.2",
|
|
25
|
+
"@dynamic-labs/utils": "1.1.2",
|
|
26
|
+
"@dynamic-labs/viem-utils": "1.1.2",
|
|
27
|
+
"@dynamic-labs/wallet-book": "1.1.2",
|
|
28
|
+
"@dynamic-labs/wallet-connector-core": "1.1.2",
|
|
29
29
|
"eventemitter3": "5.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs
CHANGED
|
@@ -20,11 +20,13 @@ require('../../../../utils/constants/colors.cjs');
|
|
|
20
20
|
require('../../../../utils/constants/values.cjs');
|
|
21
21
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
22
22
|
require('viem');
|
|
23
|
+
var providerLabel = require('../../../../shared/utils/functions/providerLabel/providerLabel.cjs');
|
|
23
24
|
require('../../../../shared/consts/index.cjs');
|
|
24
25
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
25
26
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
26
27
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
27
28
|
require('@dynamic-labs/multi-wallet');
|
|
29
|
+
var getSocialSignInProviderForProviderEnum = require('../../../../utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.cjs');
|
|
28
30
|
require('viem/chains');
|
|
29
31
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
30
32
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
@@ -53,7 +55,7 @@ require('react-focus-lock');
|
|
|
53
55
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
54
56
|
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
55
57
|
var Icon = require('../../../Icon/Icon.cjs');
|
|
56
|
-
|
|
58
|
+
require('i18next');
|
|
57
59
|
require('qrcode');
|
|
58
60
|
require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
59
61
|
require('../UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
@@ -95,7 +97,7 @@ const UserProfileSocialAccount = ({ provider, }) => {
|
|
|
95
97
|
}, startSlot:
|
|
96
98
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
97
99
|
jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'small', children: isProviderLinked ? jsxRuntime.jsx(unlink.ReactComponent, {}) : jsxRuntime.jsx(add.ReactComponent, {}) }), children: isProviderLinked ? null : 'Connect' }));
|
|
98
|
-
return (jsxRuntime.jsxs("div", { className: 'user-profile-social-account', "data-testid": `social-account-${provider}`, children: [jsxRuntime.jsx("div", { className: 'user-profile-social-account__icon', children: isProviderLinked ? (jsxRuntime.jsx(ConnectedAccountAvatar.ConnectedAccountAvatar, { provider: provider, avatarUrl: connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.avatar })) : (jsxRuntime.jsx(iconic.SocialIcon, { name: provider, variant: iconThemeVariant })) }), jsxRuntime.jsx("div", { className: 'user-profile-social-account__label', children: jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_normal', color: 'primary', children: (_a = connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.publicIdentifier) !== null && _a !== void 0 ? _a :
|
|
100
|
+
return (jsxRuntime.jsxs("div", { className: 'user-profile-social-account', "data-testid": `social-account-${provider}`, children: [jsxRuntime.jsx("div", { className: 'user-profile-social-account__icon', children: isProviderLinked ? (jsxRuntime.jsx(ConnectedAccountAvatar.ConnectedAccountAvatar, { provider: provider, avatarUrl: connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.avatar })) : (jsxRuntime.jsx(iconic.SocialIcon, { name: provider, variant: iconThemeVariant })) }), jsxRuntime.jsx("div", { className: 'user-profile-social-account__label', children: jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_normal', color: 'primary', children: (_a = connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.publicIdentifier) !== null && _a !== void 0 ? _a : providerLabel.providerLabel(getSocialSignInProviderForProviderEnum.getSocialSignInProviderForProviderEnum(provider)) }) }), !isActiveCredential ? renderButton() : null] }));
|
|
99
101
|
};
|
|
100
102
|
|
|
101
103
|
exports.UserProfileSocialAccount = UserProfileSocialAccount;
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js
CHANGED
|
@@ -16,11 +16,13 @@ import '../../../../utils/constants/colors.js';
|
|
|
16
16
|
import '../../../../utils/constants/values.js';
|
|
17
17
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
18
18
|
import 'viem';
|
|
19
|
+
import { providerLabel } from '../../../../shared/utils/functions/providerLabel/providerLabel.js';
|
|
19
20
|
import '../../../../shared/consts/index.js';
|
|
20
21
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
21
22
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
22
23
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
23
24
|
import '@dynamic-labs/multi-wallet';
|
|
25
|
+
import { getSocialSignInProviderForProviderEnum } from '../../../../utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.js';
|
|
24
26
|
import 'viem/chains';
|
|
25
27
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
26
28
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
@@ -49,7 +51,7 @@ import 'react-focus-lock';
|
|
|
49
51
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
50
52
|
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
51
53
|
import { Icon } from '../../../Icon/Icon.js';
|
|
52
|
-
import
|
|
54
|
+
import 'i18next';
|
|
53
55
|
import 'qrcode';
|
|
54
56
|
import '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
55
57
|
import '../UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
@@ -91,7 +93,7 @@ const UserProfileSocialAccount = ({ provider, }) => {
|
|
|
91
93
|
}, startSlot:
|
|
92
94
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
93
95
|
jsx(Icon, { color: 'text-tertiary', size: 'small', children: isProviderLinked ? jsx(SvgUnlink, {}) : jsx(SvgAdd, {}) }), children: isProviderLinked ? null : 'Connect' }));
|
|
94
|
-
return (jsxs("div", { className: 'user-profile-social-account', "data-testid": `social-account-${provider}`, children: [jsx("div", { className: 'user-profile-social-account__icon', children: isProviderLinked ? (jsx(ConnectedAccountAvatar, { provider: provider, avatarUrl: connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.avatar })) : (jsx(SocialIcon, { name: provider, variant: iconThemeVariant })) }), jsx("div", { className: 'user-profile-social-account__label', children: jsx(Typography, { weight: 'medium', variant: 'body_normal', color: 'primary', children: (_a = connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.publicIdentifier) !== null && _a !== void 0 ? _a :
|
|
96
|
+
return (jsxs("div", { className: 'user-profile-social-account', "data-testid": `social-account-${provider}`, children: [jsx("div", { className: 'user-profile-social-account__icon', children: isProviderLinked ? (jsx(ConnectedAccountAvatar, { provider: provider, avatarUrl: connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.avatar })) : (jsx(SocialIcon, { name: provider, variant: iconThemeVariant })) }), jsx("div", { className: 'user-profile-social-account__label', children: jsx(Typography, { weight: 'medium', variant: 'body_normal', color: 'primary', children: (_a = connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.publicIdentifier) !== null && _a !== void 0 ? _a : providerLabel(getSocialSignInProviderForProviderEnum(provider)) }) }), !isActiveCredential ? renderButton() : null] }));
|
|
95
97
|
};
|
|
96
98
|
|
|
97
99
|
export { UserProfileSocialAccount };
|
|
@@ -6,6 +6,9 @@ var sdkApi = require('@dynamic-labs/sdk-api');
|
|
|
6
6
|
var capitalize = require('../capitalize/capitalize.cjs');
|
|
7
7
|
|
|
8
8
|
const providerLabel = (provider) => {
|
|
9
|
+
if (!provider) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
9
12
|
if (provider === sdkApi.SocialSignInProviderEnum.Coinbasesocial) {
|
|
10
13
|
return 'Coinbase';
|
|
11
14
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SocialSignInProviderEnum } from '@dynamic-labs/sdk-api';
|
|
2
|
-
export declare const providerLabel: (provider
|
|
2
|
+
export declare const providerLabel: (provider?: SocialSignInProviderEnum) => string | undefined;
|
|
@@ -2,6 +2,9 @@ import { SocialSignInProviderEnum } from '@dynamic-labs/sdk-api';
|
|
|
2
2
|
import { capitalize } from '../capitalize/capitalize.js';
|
|
3
3
|
|
|
4
4
|
const providerLabel = (provider) => {
|
|
5
|
+
if (!provider) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
5
8
|
if (provider === SocialSignInProviderEnum.Coinbasesocial) {
|
|
6
9
|
return 'Coinbase';
|
|
7
10
|
}
|
|
@@ -138,11 +138,6 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
138
138
|
}
|
|
139
139
|
const { address } = connectionResult;
|
|
140
140
|
const walletNetwork = yield walletConnector.getNetwork();
|
|
141
|
-
// When we switch networks on MM/walletconnect, it breaks the flow and doesn't always display the sign message
|
|
142
|
-
// Since it the network doesn't matter for the sign, we don't need to force the user to switch to the supported
|
|
143
|
-
// network at this stage and they can switch when doing a transaction
|
|
144
|
-
// Note: not checking specifically for MM since user can choose walletconnect connector to use with MM
|
|
145
|
-
const shouldForceSupportedNetwork = !walletConnector.isWalletConnect;
|
|
146
141
|
const usesSupportedNetwork = isSupportedNetwork.isSupportedNetwork({
|
|
147
142
|
network: walletNetwork,
|
|
148
143
|
walletConnector,
|
|
@@ -151,9 +146,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
151
146
|
if (!isProgrammableNetworkSwitchSupported.isProgrammableNetworkSwitchSupported(walletConnector)) {
|
|
152
147
|
return setView('network-not-supported-manual');
|
|
153
148
|
}
|
|
154
|
-
|
|
155
|
-
return setView('network-not-supported');
|
|
156
|
-
}
|
|
149
|
+
return setView('network-not-supported');
|
|
157
150
|
}
|
|
158
151
|
if (isConnectOnly.isConnectOnly(user, authMode)) {
|
|
159
152
|
localStorage.LocalStorage.setToLS(localStorage$1.LAST_USED_WALLET, walletConnector.key);
|
|
@@ -134,11 +134,6 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
134
134
|
}
|
|
135
135
|
const { address } = connectionResult;
|
|
136
136
|
const walletNetwork = yield walletConnector.getNetwork();
|
|
137
|
-
// When we switch networks on MM/walletconnect, it breaks the flow and doesn't always display the sign message
|
|
138
|
-
// Since it the network doesn't matter for the sign, we don't need to force the user to switch to the supported
|
|
139
|
-
// network at this stage and they can switch when doing a transaction
|
|
140
|
-
// Note: not checking specifically for MM since user can choose walletconnect connector to use with MM
|
|
141
|
-
const shouldForceSupportedNetwork = !walletConnector.isWalletConnect;
|
|
142
137
|
const usesSupportedNetwork = isSupportedNetwork({
|
|
143
138
|
network: walletNetwork,
|
|
144
139
|
walletConnector,
|
|
@@ -147,9 +142,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
147
142
|
if (!isProgrammableNetworkSwitchSupported(walletConnector)) {
|
|
148
143
|
return setView('network-not-supported-manual');
|
|
149
144
|
}
|
|
150
|
-
|
|
151
|
-
return setView('network-not-supported');
|
|
152
|
-
}
|
|
145
|
+
return setView('network-not-supported');
|
|
153
146
|
}
|
|
154
147
|
if (isConnectOnly(user, authMode)) {
|
|
155
148
|
LocalStorage.setToLS(LAST_USED_WALLET, walletConnector.key);
|