@dynamic-labs/sdk-react-core 0.19.0-alpha.4 → 0.19.0-alpha.6
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 +23 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +9 -9
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.cjs +2 -14
- package/src/lib/components/DynamicConnectButton/DynamicConnectButton.js +2 -14
- package/src/lib/components/UserProfile/UserProfile.cjs +1 -1
- package/src/lib/components/UserProfile/UserProfile.js +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -1
- package/src/lib/context/DynamicContext/helpers.cjs +5 -6
- package/src/lib/context/DynamicContext/helpers.d.ts +2 -2
- package/src/lib/context/DynamicContext/helpers.js +5 -6
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.cjs +2 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.js +2 -1
- package/src/lib/utils/functions/createUserProfile/createUserProfile.cjs +1 -1
- package/src/lib/utils/functions/createUserProfile/createUserProfile.js +1 -1
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.cjs +6 -0
- package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.js +6 -0
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +4 -4
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +4 -4
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +7 -5
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +7 -5
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +14 -16
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +15 -17
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +1 -6
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +1 -6
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +15 -10
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +15 -10
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +2 -2
- package/src/lib/views/AccountExistsView/AccountExistsView.js +2 -2
- package/src/lib/views/LoginView/LoginView.cjs +70 -0
- package/src/lib/views/LoginView/LoginView.d.ts +2 -0
- package/src/lib/views/LoginView/LoginView.js +66 -0
- package/src/lib/views/{LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs → LoginView/components/EmailSignIn/LoginEmailForm.cjs} +6 -11
- package/src/lib/views/LoginView/components/EmailSignIn/LoginEmailForm.d.ts +8 -0
- package/src/lib/views/{LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js → LoginView/components/EmailSignIn/LoginEmailForm.js} +6 -11
- package/src/lib/views/LoginView/components/EmailSignIn/index.d.ts +1 -0
- package/src/lib/views/LoginView/components/LoginWidget.d.ts +5 -0
- package/src/lib/views/LoginView/components/WalletSignIn/ListItemButton/ListItemButton.cjs +65 -0
- package/src/lib/views/{LoginWithEmailView/components → LoginView/components/WalletSignIn}/ListItemButton/ListItemButton.d.ts +2 -1
- package/src/lib/views/LoginView/components/WalletSignIn/ListItemButton/ListItemButton.js +61 -0
- package/src/lib/views/{LoginWithEmailView/components/ListItemButton/ListItemButton.cjs → LoginView/components/WalletSignIn/WalletSignIn.cjs} +7 -19
- package/src/lib/views/LoginView/components/WalletSignIn/WalletSignIn.d.ts +7 -0
- package/src/lib/views/{LoginWithEmailView/components/ListItemButton/ListItemButton.js → LoginView/components/WalletSignIn/WalletSignIn.js} +8 -20
- package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.cjs +47 -0
- package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.d.ts +8 -0
- package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.js +43 -0
- package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/index.d.ts +1 -0
- package/src/lib/views/LoginView/components/WalletSignIn/index.d.ts +1 -0
- package/src/lib/views/LoginView/components/index.d.ts +3 -0
- package/src/lib/views/LoginView/index.d.ts +1 -0
- package/src/lib/views/LoginView/useLoginView.cjs +146 -0
- package/src/lib/views/LoginView/useLoginView.d.ts +6 -0
- package/src/lib/views/LoginView/useLoginView.js +141 -0
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +2 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +2 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.types.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +4 -3
- package/src/lib/views/viewToComponentMap.js +4 -3
- package/src/lib/views/LoginWithEmailView/LoginWithEmailView.cjs +0 -63
- package/src/lib/views/LoginWithEmailView/LoginWithEmailView.d.ts +0 -2
- package/src/lib/views/LoginWithEmailView/LoginWithEmailView.js +0 -59
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.d.ts +0 -7
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/index.d.ts +0 -1
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.cjs +0 -36
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.d.ts +0 -9
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.js +0 -31
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/index.d.ts +0 -1
- package/src/lib/views/LoginWithEmailView/index.d.ts +0 -1
- /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/SocialSignIn.cjs +0 -0
- /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/SocialSignIn.d.ts +0 -0
- /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/SocialSignIn.js +0 -0
- /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/index.d.ts +0 -0
- /package/src/lib/views/{LoginWithEmailView/components → LoginView/components/WalletSignIn}/ListItemButton/index.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.19.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.5...v0.19.0-alpha.6) (2023-08-25)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* optionally split up email and social and change their display order in login view ([#3125](https://github.com/dynamic-labs/DynamicAuth/issues/3125)) ([ee82d26](https://github.com/dynamic-labs/DynamicAuth/commit/ee82d264eb3cb7f4ca7eb33369ef5409fe6860e4))
|
|
8
|
+
* post a connection request for second wallet ([#3113](https://github.com/dynamic-labs/DynamicAuth/issues/3113)) ([630aefa](https://github.com/dynamic-labs/DynamicAuth/commit/630aefa5ce83278082db1e3cd419c03e4fd081c7))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fix bug where user was not able to confirm last wallet transfer ([#3102](https://github.com/dynamic-labs/DynamicAuth/issues/3102)) ([453b4c2](https://github.com/dynamic-labs/DynamicAuth/commit/453b4c20ea8f09d92dda11cdf92ddab562096d6f))
|
|
14
|
+
* fix github social linking icon on dark mode ([#3126](https://github.com/dynamic-labs/DynamicAuth/issues/3126)) ([6a8f3e3](https://github.com/dynamic-labs/DynamicAuth/commit/6a8f3e3d6e43d76b428e169fd5ead9ee0e2ec43d))
|
|
15
|
+
* fix issue with detecting oauth window closed before finishing linking ([#3124](https://github.com/dynamic-labs/DynamicAuth/issues/3124)) ([6a80ee9](https://github.com/dynamic-labs/DynamicAuth/commit/6a80ee97deb54e5b62bf2285d71b03c36802c5d2))
|
|
16
|
+
* stop calling handleLogOut prematurely ([#3135](https://github.com/dynamic-labs/DynamicAuth/issues/3135)) ([e7c81ad](https://github.com/dynamic-labs/DynamicAuth/commit/e7c81ad7e9e9cff03e5d2ca1e0fb7cfea083d06e))
|
|
17
|
+
|
|
18
|
+
## [0.19.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.4...v0.19.0-alpha.5) (2023-08-24)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* send wagmi settings only once when DynamicWagmiConnector loads ([#3103](https://github.com/dynamic-labs/DynamicAuth/issues/3103)) ([8bba505](https://github.com/dynamic-labs/DynamicAuth/commit/8bba505f84f6f3567743397a3f1274a3840a7700))
|
|
24
|
+
|
|
2
25
|
## [0.19.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.3...v0.19.0-alpha.4) (2023-08-23)
|
|
3
26
|
|
|
4
27
|
|
package/package.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = "0.19.0-alpha.
|
|
5
|
+
var version = "0.19.0-alpha.6";
|
|
6
6
|
var dependencies = {
|
|
7
7
|
"react-focus-lock": "2.9.2",
|
|
8
8
|
"@dynamic-labs/iconic": "0.1.27",
|
|
9
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
9
|
+
"@dynamic-labs/sdk-api": "0.0.270",
|
|
10
10
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
11
11
|
"country-list": "2.3.0",
|
|
12
12
|
yup: "0.32.11",
|
package/package.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var version = "0.19.0-alpha.
|
|
1
|
+
var version = "0.19.0-alpha.6";
|
|
2
2
|
var dependencies = {
|
|
3
3
|
"react-focus-lock": "2.9.2",
|
|
4
4
|
"@dynamic-labs/iconic": "0.1.27",
|
|
5
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
5
|
+
"@dynamic-labs/sdk-api": "0.0.270",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
7
7
|
"country-list": "2.3.0",
|
|
8
8
|
yup: "0.32.11",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.19.0-alpha.
|
|
3
|
+
"version": "0.19.0-alpha.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"react-focus-lock": "2.9.2",
|
|
11
11
|
"@dynamic-labs/iconic": "0.1.27",
|
|
12
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
12
|
+
"@dynamic-labs/sdk-api": "0.0.270",
|
|
13
13
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
14
14
|
"country-list": "2.3.0",
|
|
15
15
|
"yup": "0.32.11",
|
|
16
16
|
"formik": "2.2.9",
|
|
17
17
|
"qrcode": "1.5.1",
|
|
18
18
|
"ethers": "5.7.2",
|
|
19
|
-
"@dynamic-labs/logger": "0.19.0-alpha.
|
|
20
|
-
"@dynamic-labs/multi-wallet": "0.19.0-alpha.
|
|
21
|
-
"@dynamic-labs/rpc-providers": "0.19.0-alpha.
|
|
22
|
-
"@dynamic-labs/types": "0.19.0-alpha.
|
|
23
|
-
"@dynamic-labs/utils": "0.19.0-alpha.
|
|
24
|
-
"@dynamic-labs/wallet-book": "0.19.0-alpha.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.
|
|
19
|
+
"@dynamic-labs/logger": "0.19.0-alpha.6",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "0.19.0-alpha.6",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "0.19.0-alpha.6",
|
|
22
|
+
"@dynamic-labs/types": "0.19.0-alpha.6",
|
|
23
|
+
"@dynamic-labs/utils": "0.19.0-alpha.6",
|
|
24
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.6",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.6",
|
|
26
26
|
"eventemitter3": "5.0.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -10,28 +10,16 @@ var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
|
|
|
10
10
|
var ConnectButton = require('./components/ConnectButton.cjs');
|
|
11
11
|
|
|
12
12
|
const DynamicConnectButton = ({ buttonContainerClassName = '', buttonClassName = '', children, }) => {
|
|
13
|
-
const { isProjectSettingsLoading, setShowAuthFlow, setSelectedWalletConnector,
|
|
13
|
+
const { isProjectSettingsLoading, setShowAuthFlow, setSelectedWalletConnector, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
14
14
|
const { setView } = ViewContext.useViewContext();
|
|
15
15
|
const [didUserClick, setUserClicked] = React.useState(false);
|
|
16
16
|
const handleOnClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
if (!didUserClick) {
|
|
18
18
|
setUserClicked(true);
|
|
19
19
|
}
|
|
20
|
-
if (loginWithEmail) {
|
|
21
|
-
setView('login-with-email-or-wallet');
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
setView('wallet-list');
|
|
25
|
-
}
|
|
26
20
|
setSelectedWalletConnector(null);
|
|
27
21
|
setShowAuthFlow(true);
|
|
28
|
-
}), [
|
|
29
|
-
didUserClick,
|
|
30
|
-
loginWithEmail,
|
|
31
|
-
setSelectedWalletConnector,
|
|
32
|
-
setShowAuthFlow,
|
|
33
|
-
setView,
|
|
34
|
-
]);
|
|
22
|
+
}), [didUserClick, setSelectedWalletConnector, setShowAuthFlow, setView]);
|
|
35
23
|
return (jsxRuntime.jsx(ConnectButton.ConnectButton, Object.assign({ isLoading: isProjectSettingsLoading, isActive: didUserClick, onClick: handleOnClick, buttonContainerClassName: buttonContainerClassName, buttonClassName: buttonClassName }, { children: children })));
|
|
36
24
|
};
|
|
37
25
|
|
|
@@ -6,28 +6,16 @@ import { useViewContext } from '../../context/ViewContext/ViewContext.js';
|
|
|
6
6
|
import { ConnectButton } from './components/ConnectButton.js';
|
|
7
7
|
|
|
8
8
|
const DynamicConnectButton = ({ buttonContainerClassName = '', buttonClassName = '', children, }) => {
|
|
9
|
-
const { isProjectSettingsLoading, setShowAuthFlow, setSelectedWalletConnector,
|
|
9
|
+
const { isProjectSettingsLoading, setShowAuthFlow, setSelectedWalletConnector, } = useInternalDynamicContext();
|
|
10
10
|
const { setView } = useViewContext();
|
|
11
11
|
const [didUserClick, setUserClicked] = useState(false);
|
|
12
12
|
const handleOnClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
13
|
if (!didUserClick) {
|
|
14
14
|
setUserClicked(true);
|
|
15
15
|
}
|
|
16
|
-
if (loginWithEmail) {
|
|
17
|
-
setView('login-with-email-or-wallet');
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
setView('wallet-list');
|
|
21
|
-
}
|
|
22
16
|
setSelectedWalletConnector(null);
|
|
23
17
|
setShowAuthFlow(true);
|
|
24
|
-
}), [
|
|
25
|
-
didUserClick,
|
|
26
|
-
loginWithEmail,
|
|
27
|
-
setSelectedWalletConnector,
|
|
28
|
-
setShowAuthFlow,
|
|
29
|
-
setView,
|
|
30
|
-
]);
|
|
18
|
+
}), [didUserClick, setSelectedWalletConnector, setShowAuthFlow, setView]);
|
|
31
19
|
return (jsx(ConnectButton, Object.assign({ isLoading: isProjectSettingsLoading, isActive: didUserClick, onClick: handleOnClick, buttonContainerClassName: buttonContainerClassName, buttonClassName: buttonClassName }, { children: children })));
|
|
32
20
|
};
|
|
33
21
|
|
|
@@ -43,7 +43,7 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
43
43
|
const { label } = index$1.getValueByKey(fieldsConfig.fieldsConfig, name);
|
|
44
44
|
const value = mapFieldKeyToValue(name);
|
|
45
45
|
return (jsxRuntime.jsx(UserProfileField.UserProfileField, { name: name, label: label, value: value }, name));
|
|
46
|
-
}) })) }))), (providers === null || providers === void 0 ? void 0 : providers.length) > 0 && (jsxRuntime.jsx(UserProfileSection.UserProfileSection, Object.assign({ title: 'Social accounts' }, { children: jsxRuntime.jsx("div", Object.assign({ className: 'user-profile__social-accounts' }, { children: providers.map(({
|
|
46
|
+
}) })) }))), (providers === null || providers === void 0 ? void 0 : providers.length) > 0 && (jsxRuntime.jsx(UserProfileSection.UserProfileSection, Object.assign({ title: 'Social accounts' }, { children: jsxRuntime.jsx("div", Object.assign({ className: 'user-profile__social-accounts' }, { children: providers.map(({ provider }) => (jsxRuntime.jsx(UserProfileSocialAccount.UserProfileSocialAccount, { provider: provider }, provider))) })) })))] })));
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
exports.UserProfile = UserProfile;
|
|
@@ -39,7 +39,7 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
39
39
|
const { label } = getValueByKey(fieldsConfig, name);
|
|
40
40
|
const value = mapFieldKeyToValue(name);
|
|
41
41
|
return (jsx(UserProfileField, { name: name, label: label, value: value }, name));
|
|
42
|
-
}) })) }))), (providers === null || providers === void 0 ? void 0 : providers.length) > 0 && (jsx(UserProfileSection, Object.assign({ title: 'Social accounts' }, { children: jsx("div", Object.assign({ className: 'user-profile__social-accounts' }, { children: providers.map(({
|
|
42
|
+
}) })) }))), (providers === null || providers === void 0 ? void 0 : providers.length) > 0 && (jsx(UserProfileSection, Object.assign({ title: 'Social accounts' }, { children: jsx("div", Object.assign({ className: 'user-profile__social-accounts' }, { children: providers.map(({ provider }) => (jsx(UserProfileSocialAccount, { provider: provider }, provider))) })) })))] })));
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export { UserProfile };
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs
CHANGED
|
@@ -60,7 +60,7 @@ const UserProfileSocialAccount = ({ provider, }) => {
|
|
|
60
60
|
const isProviderLinked = isLinked(provider);
|
|
61
61
|
const connectedAccountInfo = getLinkedAccountInformation(provider);
|
|
62
62
|
const iconThemeVariant = useIconThemeVariant.useIconThemeVariant();
|
|
63
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: 'user-profile-social-account', "data-testid": `social-account-${provider}` }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'user-profile-social-account__icon' }, { children: isProviderLinked ? (jsxRuntime.jsx(ConnectedAccountAvatar.ConnectedAccountAvatar, { provider: provider, avatarUrl: connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.avatar
|
|
63
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: 'user-profile-social-account', "data-testid": `social-account-${provider}` }, { children: [jsxRuntime.jsx("div", Object.assign({ 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", Object.assign({ className: 'user-profile-social-account__label' }, { children: jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary' }, { children: (_a = connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.publicIdentifier) !== null && _a !== void 0 ? _a : helpers.capitalize(provider) })) })), isProviderLinked ? (jsxRuntime.jsx(Button.Button, { buttonClassName: 'user-profile-social-account__button', buttonVariant: 'secondary', buttonRounded: 'small', buttonPadding: 'none', onClick: () => unlinkSocialAccount(provider), loading: isProcessing, dataTestId: 'social-account-disconnect-button', typographyProps: {
|
|
64
64
|
color: 'secondary',
|
|
65
65
|
variant: 'button_tertiary',
|
|
66
66
|
}, startSlot:
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js
CHANGED
|
@@ -56,7 +56,7 @@ const UserProfileSocialAccount = ({ provider, }) => {
|
|
|
56
56
|
const isProviderLinked = isLinked(provider);
|
|
57
57
|
const connectedAccountInfo = getLinkedAccountInformation(provider);
|
|
58
58
|
const iconThemeVariant = useIconThemeVariant();
|
|
59
|
-
return (jsxs("div", Object.assign({ className: 'user-profile-social-account', "data-testid": `social-account-${provider}` }, { children: [jsx("div", Object.assign({ className: 'user-profile-social-account__icon' }, { children: isProviderLinked ? (jsx(ConnectedAccountAvatar, { provider: provider, avatarUrl: connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.avatar
|
|
59
|
+
return (jsxs("div", Object.assign({ className: 'user-profile-social-account', "data-testid": `social-account-${provider}` }, { children: [jsx("div", Object.assign({ 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", Object.assign({ className: 'user-profile-social-account__label' }, { children: jsx(Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary' }, { children: (_a = connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.publicIdentifier) !== null && _a !== void 0 ? _a : capitalize(provider) })) })), isProviderLinked ? (jsx(Button, { buttonClassName: 'user-profile-social-account__button', buttonVariant: 'secondary', buttonRounded: 'small', buttonPadding: 'none', onClick: () => unlinkSocialAccount(provider), loading: isProcessing, dataTestId: 'social-account-disconnect-button', typographyProps: {
|
|
60
60
|
color: 'secondary',
|
|
61
61
|
variant: 'button_tertiary',
|
|
62
62
|
}, startSlot:
|
|
@@ -691,9 +691,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
691
691
|
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile, user]);
|
|
692
692
|
return (jsxRuntime.jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsxRuntime.jsx(walletBook.WalletBookContextProvider, Object.assign({ walletBook: walletBook$1 }, { children: jsxRuntime.jsx(ThemeContext.ThemeContextProvider, Object.assign({ customerTheme: parseTheme.parseTheme(theme, ((_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _h === void 0 ? void 0 : _h.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design }, { children: jsxRuntime.jsx(LoadingContext.LoadingContextProvider, { children: jsxRuntime.jsx(ViewContext.ViewContextProvider, Object.assign({ initialView: helpers.getInitialView({
|
|
693
693
|
connectedWallets,
|
|
694
|
+
isAuthenticated,
|
|
694
695
|
isBridgeFlow,
|
|
695
696
|
isFullyConnected,
|
|
696
|
-
loginWithEmail,
|
|
697
697
|
}) }, { children: jsxRuntime.jsx(AccountExistsContext.AccountExistsContextProvider, { children: jsxRuntime.jsx(WalletContext.WalletContextProvider, Object.assign({ canSync: didConnectedStateLoad }, { children: jsxRuntime.jsx(QrCodeContext.QrCodeContextProvider, { children: jsxRuntime.jsx(EmailVerificationContext.EmailVerificationContextProvider, { children: jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(DynamicBridgeWidgetContext.DynamicBridgeWidgetContextProvider, { children: jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsx(FundingContext.FundingContextProvider, { children: jsxRuntime.jsx(AccessDeniedContext.AccessDeniedContextProvider, { children: jsxRuntime.jsx(SendBalanceContext.SendBalanceContextProvider, { children: jsxRuntime.jsx(WalletGroupContext.WalletGroupContextProvider, { children: jsxRuntime.jsxs(UserFieldEditorContext.UserFieldEditorContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), jsxRuntime.jsx(OAuthIFrameContainer.OAuthIFrameContainer, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) })) }) })) }) })) })) })));
|
|
698
698
|
};
|
|
699
699
|
|
|
@@ -687,9 +687,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
687
687
|
}, [multiWallet, multiWalletWidgetState, showDynamicUserProfile, user]);
|
|
688
688
|
return (jsx(DynamicContext.Provider, Object.assign({ value: value }, { children: jsx(WalletBookContextProvider, Object.assign({ walletBook: walletBook }, { children: jsx(ThemeContextProvider, Object.assign({ customerTheme: parseTheme(theme, ((_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _h === void 0 ? void 0 : _h.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design }, { children: jsx(LoadingContextProvider, { children: jsx(ViewContextProvider, Object.assign({ initialView: getInitialView({
|
|
689
689
|
connectedWallets,
|
|
690
|
+
isAuthenticated,
|
|
690
691
|
isBridgeFlow,
|
|
691
692
|
isFullyConnected,
|
|
692
|
-
loginWithEmail,
|
|
693
693
|
}) }, { children: jsx(AccountExistsContextProvider, { children: jsx(WalletContextProvider, Object.assign({ canSync: didConnectedStateLoad }, { children: jsx(QrCodeContextProvider, { children: jsx(EmailVerificationContextProvider, { children: jsx(ErrorContextProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(CaptchaContextProvider, { children: jsx(FundingContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsx(WalletGroupContextProvider, { children: jsxs(UserFieldEditorContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), jsx(OAuthIFrameContainer, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) })) }) })) }) })) })) })));
|
|
694
694
|
};
|
|
695
695
|
|
|
@@ -54,17 +54,16 @@ const initExpirationTime = (logout) => {
|
|
|
54
54
|
const expiryTimeout = Math.min(expirationTimeInMs, 2147483647);
|
|
55
55
|
logoutTimer = setTimeout(logout, expiryTimeout);
|
|
56
56
|
};
|
|
57
|
-
const getInitialView = ({ connectedWallets,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (isFullyConnected) {
|
|
57
|
+
const getInitialView = ({ connectedWallets, isBridgeFlow, isFullyConnected, isAuthenticated, }) => {
|
|
58
|
+
// when multiwallet enabled, and user wants to link wallet
|
|
59
|
+
// show wallet-list view
|
|
60
|
+
if (isFullyConnected || isAuthenticated) {
|
|
62
61
|
return 'wallet-list';
|
|
63
62
|
}
|
|
64
63
|
if (isBridgeFlow && !connectedWallets.length) {
|
|
65
64
|
return 'bridge-welcome';
|
|
66
65
|
}
|
|
67
|
-
return 'wallet
|
|
66
|
+
return 'login-with-email-or-wallet';
|
|
68
67
|
};
|
|
69
68
|
|
|
70
69
|
exports.getInitialView = getInitialView;
|
|
@@ -2,9 +2,9 @@ import { Wallet } from '../../shared';
|
|
|
2
2
|
import { ViewType } from '../ViewContext';
|
|
3
3
|
export declare const isAuthTokenExpired: (token: string) => boolean;
|
|
4
4
|
export declare const initExpirationTime: (logout: VoidFunction) => void;
|
|
5
|
-
export declare const getInitialView: ({ connectedWallets,
|
|
5
|
+
export declare const getInitialView: ({ connectedWallets, isBridgeFlow, isFullyConnected, isAuthenticated, }: {
|
|
6
6
|
connectedWallets: Wallet[];
|
|
7
|
-
loginWithEmail: boolean;
|
|
8
7
|
isBridgeFlow: boolean;
|
|
8
|
+
isAuthenticated: boolean;
|
|
9
9
|
isFullyConnected: boolean;
|
|
10
10
|
}) => ViewType;
|
|
@@ -50,17 +50,16 @@ const initExpirationTime = (logout) => {
|
|
|
50
50
|
const expiryTimeout = Math.min(expirationTimeInMs, 2147483647);
|
|
51
51
|
logoutTimer = setTimeout(logout, expiryTimeout);
|
|
52
52
|
};
|
|
53
|
-
const getInitialView = ({ connectedWallets,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (isFullyConnected) {
|
|
53
|
+
const getInitialView = ({ connectedWallets, isBridgeFlow, isFullyConnected, isAuthenticated, }) => {
|
|
54
|
+
// when multiwallet enabled, and user wants to link wallet
|
|
55
|
+
// show wallet-list view
|
|
56
|
+
if (isFullyConnected || isAuthenticated) {
|
|
58
57
|
return 'wallet-list';
|
|
59
58
|
}
|
|
60
59
|
if (isBridgeFlow && !connectedWallets.length) {
|
|
61
60
|
return 'bridge-welcome';
|
|
62
61
|
}
|
|
63
|
-
return 'wallet
|
|
62
|
+
return 'login-with-email-or-wallet';
|
|
64
63
|
};
|
|
65
64
|
|
|
66
65
|
export { getInitialView, initExpirationTime, isAuthTokenExpired };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SetStateAction, Dispatch, PropsWithChildren, FC } from 'react';
|
|
2
|
-
export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'wallet-cannot-be-transferred';
|
|
2
|
+
export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'wallet-cannot-be-transferred';
|
|
3
3
|
export type ViewContextProps = {
|
|
4
4
|
setView: Dispatch<SetStateAction<ViewType>>;
|
|
5
5
|
view: ViewType;
|
|
@@ -17,7 +17,8 @@ const HelpContentSwitch = () => {
|
|
|
17
17
|
const { projectSettings, newToWeb3WalletChainMap, selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
|
|
18
18
|
const isWalletListTypeView = React.useMemo(() => view === 'wallet-connect-mobile-wallets-list' ||
|
|
19
19
|
view === 'wallet-list' ||
|
|
20
|
-
view === 'login-with-email-or-wallet-full-wallet-list'
|
|
20
|
+
view === 'login-with-email-or-wallet-full-wallet-list' ||
|
|
21
|
+
view === 'login-with-wallet-only', [view]);
|
|
21
22
|
const isPendingSignatureTypeView = React.useMemo(() => view === 'pending-signature-without-back-button' ||
|
|
22
23
|
view === 'pending-signature', [view]);
|
|
23
24
|
const isPendingConnectTypeView = React.useMemo(() => view === 'pending-connect' || view === 'qr-code', [view]);
|
|
@@ -13,7 +13,8 @@ const HelpContentSwitch = () => {
|
|
|
13
13
|
const { projectSettings, newToWeb3WalletChainMap, selectedWalletConnector } = useInternalDynamicContext();
|
|
14
14
|
const isWalletListTypeView = useMemo(() => view === 'wallet-connect-mobile-wallets-list' ||
|
|
15
15
|
view === 'wallet-list' ||
|
|
16
|
-
view === 'login-with-email-or-wallet-full-wallet-list'
|
|
16
|
+
view === 'login-with-email-or-wallet-full-wallet-list' ||
|
|
17
|
+
view === 'login-with-wallet-only', [view]);
|
|
17
18
|
const isPendingSignatureTypeView = useMemo(() => view === 'pending-signature-without-back-button' ||
|
|
18
19
|
view === 'pending-signature', [view]);
|
|
19
20
|
const isPendingConnectTypeView = useMemo(() => view === 'pending-connect' || view === 'qr-code', [view]);
|
|
@@ -29,7 +29,7 @@ const createUserProfile = (decodedJwt) => {
|
|
|
29
29
|
team: decodedJwt.team,
|
|
30
30
|
username: decodedJwt.username,
|
|
31
31
|
};
|
|
32
|
-
const userProfile = Object.assign({ chain: wallet === null || wallet === void 0 ? void 0 : wallet.chain, ens: wallet === null || wallet === void 0 ? void 0 : wallet.nameService, environmentId: decodedJwt.environmentId, isAuthenticatedWithAWallet: ((_a = index.lastAuthenticatedAccount(decodedJwt)) === null || _a === void 0 ? void 0 : _a.format) === 'blockchain', lastVerifiedCredentialId: decodedJwt.lastVerifiedCredentialId, lists: decodedJwt.lists, newUser: decodedJwt.newUser, scope: decodedJwt.scope, sessionId: decodedJwt.sid, userId: decodedJwt.sub, verifiedCredentials: decodedJwt.verifiedCredentials || [], wallet: wallet === null || wallet === void 0 ? void 0 : wallet.walletName }, kyc);
|
|
32
|
+
const userProfile = Object.assign({ chain: wallet === null || wallet === void 0 ? void 0 : wallet.chain, ens: wallet === null || wallet === void 0 ? void 0 : wallet.nameService, environmentId: decodedJwt.environmentId, isAuthenticatedWithAWallet: ((_a = index.lastAuthenticatedAccount(decodedJwt)) === null || _a === void 0 ? void 0 : _a.format) === 'blockchain', lastVerifiedCredentialId: decodedJwt.lastVerifiedCredentialId, lists: decodedJwt.lists, metadata: decodedJwt.metadata, newUser: decodedJwt.newUser, scope: decodedJwt.scope, sessionId: decodedJwt.sid, userId: decodedJwt.sub, verifiedCredentials: decodedJwt.verifiedCredentials || [], wallet: wallet === null || wallet === void 0 ? void 0 : wallet.walletName }, kyc);
|
|
33
33
|
return userProfile;
|
|
34
34
|
};
|
|
35
35
|
|
|
@@ -25,7 +25,7 @@ const createUserProfile = (decodedJwt) => {
|
|
|
25
25
|
team: decodedJwt.team,
|
|
26
26
|
username: decodedJwt.username,
|
|
27
27
|
};
|
|
28
|
-
const userProfile = Object.assign({ chain: wallet === null || wallet === void 0 ? void 0 : wallet.chain, ens: wallet === null || wallet === void 0 ? void 0 : wallet.nameService, environmentId: decodedJwt.environmentId, isAuthenticatedWithAWallet: ((_a = lastAuthenticatedAccount(decodedJwt)) === null || _a === void 0 ? void 0 : _a.format) === 'blockchain', lastVerifiedCredentialId: decodedJwt.lastVerifiedCredentialId, lists: decodedJwt.lists, newUser: decodedJwt.newUser, scope: decodedJwt.scope, sessionId: decodedJwt.sid, userId: decodedJwt.sub, verifiedCredentials: decodedJwt.verifiedCredentials || [], wallet: wallet === null || wallet === void 0 ? void 0 : wallet.walletName }, kyc);
|
|
28
|
+
const userProfile = Object.assign({ chain: wallet === null || wallet === void 0 ? void 0 : wallet.chain, ens: wallet === null || wallet === void 0 ? void 0 : wallet.nameService, environmentId: decodedJwt.environmentId, isAuthenticatedWithAWallet: ((_a = lastAuthenticatedAccount(decodedJwt)) === null || _a === void 0 ? void 0 : _a.format) === 'blockchain', lastVerifiedCredentialId: decodedJwt.lastVerifiedCredentialId, lists: decodedJwt.lists, metadata: decodedJwt.metadata, newUser: decodedJwt.newUser, scope: decodedJwt.scope, sessionId: decodedJwt.sid, userId: decodedJwt.sub, verifiedCredentials: decodedJwt.verifiedCredentials || [], wallet: wallet === null || wallet === void 0 ? void 0 : wallet.walletName }, kyc);
|
|
29
29
|
return userProfile;
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -16,6 +16,9 @@ const getDynamicLayoutData = ({ view }) => {
|
|
|
16
16
|
'login-with-email-or-wallet-full-wallet-list': {
|
|
17
17
|
heading: 'Get your first wallet',
|
|
18
18
|
},
|
|
19
|
+
'login-with-wallet-only': {
|
|
20
|
+
heading: 'Get your first wallet',
|
|
21
|
+
},
|
|
19
22
|
'pending-connect': {
|
|
20
23
|
heading: 'Connecting a wallet',
|
|
21
24
|
},
|
|
@@ -44,6 +47,9 @@ const getDynamicLayoutData = ({ view }) => {
|
|
|
44
47
|
'login-with-email-or-wallet-full-wallet-list': {
|
|
45
48
|
heading: 'Select your wallet',
|
|
46
49
|
},
|
|
50
|
+
'login-with-wallet-only': {
|
|
51
|
+
heading: 'Select your wallet',
|
|
52
|
+
},
|
|
47
53
|
'wallet-connect-mobile-wallets-list': {
|
|
48
54
|
heading: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(iconic.WalletConnectIcon, { style: { height: '1.5rem', width: '1.5rem' } }), ' ', "WalletConnect wallets"] })),
|
|
49
55
|
},
|
|
@@ -12,6 +12,9 @@ const getDynamicLayoutData = ({ view }) => {
|
|
|
12
12
|
'login-with-email-or-wallet-full-wallet-list': {
|
|
13
13
|
heading: 'Get your first wallet',
|
|
14
14
|
},
|
|
15
|
+
'login-with-wallet-only': {
|
|
16
|
+
heading: 'Get your first wallet',
|
|
17
|
+
},
|
|
15
18
|
'pending-connect': {
|
|
16
19
|
heading: 'Connecting a wallet',
|
|
17
20
|
},
|
|
@@ -40,6 +43,9 @@ const getDynamicLayoutData = ({ view }) => {
|
|
|
40
43
|
'login-with-email-or-wallet-full-wallet-list': {
|
|
41
44
|
heading: 'Select your wallet',
|
|
42
45
|
},
|
|
46
|
+
'login-with-wallet-only': {
|
|
47
|
+
heading: 'Select your wallet',
|
|
48
|
+
},
|
|
43
49
|
'wallet-connect-mobile-wallets-list': {
|
|
44
50
|
heading: (jsxs(Fragment, { children: [jsx(WalletConnectIcon, { style: { height: '1.5rem', width: '1.5rem' } }), ' ', "WalletConnect wallets"] })),
|
|
45
51
|
},
|
|
@@ -91,12 +91,12 @@ const useSyncPrimaryWallet = ({ connectWallet, computeConnectedStateForWallets,
|
|
|
91
91
|
computeConnectedStateForWallets();
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
if (!primaryWallet.connector.isInstalledOnBrowser()) {
|
|
95
|
-
handleLogOut();
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
94
|
// user is logged in (has valid jwt), but no wallet is connected
|
|
99
95
|
if (isAuthenticated && e.code === errors.MISSING_ADDRESS_ERROR) {
|
|
96
|
+
if (!primaryWallet.connector.isInstalledOnBrowser()) {
|
|
97
|
+
handleLogOut();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
100
|
setShowAuthFlow(true);
|
|
101
101
|
setView('wallet-locked-view');
|
|
102
102
|
}
|
|
@@ -87,12 +87,12 @@ const useSyncPrimaryWallet = ({ connectWallet, computeConnectedStateForWallets,
|
|
|
87
87
|
computeConnectedStateForWallets();
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
|
-
if (!primaryWallet.connector.isInstalledOnBrowser()) {
|
|
91
|
-
handleLogOut();
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
90
|
// user is logged in (has valid jwt), but no wallet is connected
|
|
95
91
|
if (isAuthenticated && e.code === MISSING_ADDRESS_ERROR) {
|
|
92
|
+
if (!primaryWallet.connector.isInstalledOnBrowser()) {
|
|
93
|
+
handleLogOut();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
96
|
setShowAuthFlow(true);
|
|
97
97
|
setView('wallet-locked-view');
|
|
98
98
|
}
|
|
@@ -17,7 +17,8 @@ const useAuthLayoutChecks = (walletConnector) => {
|
|
|
17
17
|
const { helpHeaderData } = getDynamicLayoutData.getDynamicLayoutData({ view });
|
|
18
18
|
const isWalletListTypeView = view === 'wallet-connect-mobile-wallets-list' ||
|
|
19
19
|
view === 'wallet-list' ||
|
|
20
|
-
view === 'login-with-email-or-wallet-full-wallet-list'
|
|
20
|
+
view === 'login-with-email-or-wallet-full-wallet-list' ||
|
|
21
|
+
view === 'login-with-wallet-only';
|
|
21
22
|
const showHelpContent = Boolean(helpHeaderData &&
|
|
22
23
|
// Notice the negation here
|
|
23
24
|
!((view === 'qr-code' && !(walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.canConnectViaQrCode)) ||
|
|
@@ -51,13 +52,14 @@ const useAuthLayoutChecks = (walletConnector) => {
|
|
|
51
52
|
const showToSFooter = Boolean(!isUserLinkingWallet.isUserLinkingWallet(user, view, mockedSDK) &&
|
|
52
53
|
(view === 'wallet-list' ||
|
|
53
54
|
view === 'wallet-connect-mobile-wallets-list' ||
|
|
54
|
-
// Don't show empty footer
|
|
55
|
-
(view === 'login-with-email-or-wallet'
|
|
55
|
+
// Don't show empty footer during the login
|
|
56
|
+
((view === 'login-with-email-or-wallet' ||
|
|
57
|
+
view === 'login-with-email-or-wallet-full-wallet-list' ||
|
|
58
|
+
view === 'login-with-wallet-only') &&
|
|
56
59
|
(termsOfServiceUrl ||
|
|
57
60
|
privacyPolicyUrl ||
|
|
58
61
|
customPrivacyPolicy ||
|
|
59
|
-
customTermsOfServices))
|
|
60
|
-
view === 'login-with-email-or-wallet-full-wallet-list'));
|
|
62
|
+
customTermsOfServices))));
|
|
61
63
|
const showCloseButton = view !== 'login-with-email-or-wallet-full-wallet-list' &&
|
|
62
64
|
view !== 'login-with-email-verification';
|
|
63
65
|
const showBackButton = view === 'qr-code' ||
|
|
@@ -13,7 +13,8 @@ const useAuthLayoutChecks = (walletConnector) => {
|
|
|
13
13
|
const { helpHeaderData } = getDynamicLayoutData({ view });
|
|
14
14
|
const isWalletListTypeView = view === 'wallet-connect-mobile-wallets-list' ||
|
|
15
15
|
view === 'wallet-list' ||
|
|
16
|
-
view === 'login-with-email-or-wallet-full-wallet-list'
|
|
16
|
+
view === 'login-with-email-or-wallet-full-wallet-list' ||
|
|
17
|
+
view === 'login-with-wallet-only';
|
|
17
18
|
const showHelpContent = Boolean(helpHeaderData &&
|
|
18
19
|
// Notice the negation here
|
|
19
20
|
!((view === 'qr-code' && !(walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.canConnectViaQrCode)) ||
|
|
@@ -47,13 +48,14 @@ const useAuthLayoutChecks = (walletConnector) => {
|
|
|
47
48
|
const showToSFooter = Boolean(!isUserLinkingWallet(user, view, mockedSDK) &&
|
|
48
49
|
(view === 'wallet-list' ||
|
|
49
50
|
view === 'wallet-connect-mobile-wallets-list' ||
|
|
50
|
-
// Don't show empty footer
|
|
51
|
-
(view === 'login-with-email-or-wallet'
|
|
51
|
+
// Don't show empty footer during the login
|
|
52
|
+
((view === 'login-with-email-or-wallet' ||
|
|
53
|
+
view === 'login-with-email-or-wallet-full-wallet-list' ||
|
|
54
|
+
view === 'login-with-wallet-only') &&
|
|
52
55
|
(termsOfServiceUrl ||
|
|
53
56
|
privacyPolicyUrl ||
|
|
54
57
|
customPrivacyPolicy ||
|
|
55
|
-
customTermsOfServices))
|
|
56
|
-
view === 'login-with-email-or-wallet-full-wallet-list'));
|
|
58
|
+
customTermsOfServices))));
|
|
57
59
|
const showCloseButton = view !== 'login-with-email-or-wallet-full-wallet-list' &&
|
|
58
60
|
view !== 'login-with-email-verification';
|
|
59
61
|
const showBackButton = view === 'qr-code' ||
|
|
@@ -130,8 +130,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
130
130
|
network: currentWalletConnectoNetwork,
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
|
-
const shouldSkipCreatingVisit =
|
|
134
|
-
connectedWallet, [authMode, connectedWallet, enableVisitTrackingOnConnectOnly]);
|
|
133
|
+
const shouldSkipCreatingVisit = authMode === 'connect-only' && !enableVisitTrackingOnConnectOnly;
|
|
135
134
|
const connectWallet = (walletConnector, fetchPublicAddressOpts, shouldCallCallback = true) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
136
135
|
const publicWalletAddress = yield walletConnector.fetchPublicAddress(fetchPublicAddressOpts);
|
|
137
136
|
if (!publicWalletAddress) {
|
|
@@ -168,21 +167,20 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
168
167
|
walletConnectorKey: walletConnector.name,
|
|
169
168
|
walletId,
|
|
170
169
|
});
|
|
170
|
+
if (!shouldSkipCreatingVisit) {
|
|
171
|
+
// send information to backend to kick off background jobs
|
|
172
|
+
// so verify/sign on the next step could go by more quickly
|
|
173
|
+
// this is async work, but DO NOT AWAIT
|
|
174
|
+
api.createVisit({
|
|
175
|
+
authMode,
|
|
176
|
+
chain: walletChain || '',
|
|
177
|
+
environmentId,
|
|
178
|
+
publicWalletAddress,
|
|
179
|
+
walletName: walletConnector.name,
|
|
180
|
+
walletProvider: getWalletProvider.getWalletProvider(walletConnector),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
171
183
|
}
|
|
172
|
-
if (shouldSkipCreatingVisit) {
|
|
173
|
-
return Promise.resolve(publicWalletAddress);
|
|
174
|
-
}
|
|
175
|
-
// send information to backend to kick off background jobs
|
|
176
|
-
// so verify/sign on the next step could go by more quickly
|
|
177
|
-
// this is async work, but DO NOT AWAIT
|
|
178
|
-
api.createVisit({
|
|
179
|
-
authMode,
|
|
180
|
-
chain: walletChain || '',
|
|
181
|
-
environmentId,
|
|
182
|
-
publicWalletAddress,
|
|
183
|
-
walletName: walletConnector.name,
|
|
184
|
-
walletProvider: getWalletProvider.getWalletProvider(walletConnector),
|
|
185
|
-
});
|
|
186
184
|
return Promise.resolve(publicWalletAddress);
|
|
187
185
|
});
|
|
188
186
|
const unlinkConnectedWallet = (walletId) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
2
|
-
import { useState, useCallback, useEffect
|
|
2
|
+
import { useState, useCallback, useEffect } from 'react';
|
|
3
3
|
import { getWalletConnectorByName, logger } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import '@dynamic-labs/sdk-api';
|
|
5
5
|
import '../../../shared/logger.js';
|
|
@@ -126,8 +126,7 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
126
126
|
network: currentWalletConnectoNetwork,
|
|
127
127
|
});
|
|
128
128
|
});
|
|
129
|
-
const shouldSkipCreatingVisit =
|
|
130
|
-
connectedWallet, [authMode, connectedWallet, enableVisitTrackingOnConnectOnly]);
|
|
129
|
+
const shouldSkipCreatingVisit = authMode === 'connect-only' && !enableVisitTrackingOnConnectOnly;
|
|
131
130
|
const connectWallet = (walletConnector, fetchPublicAddressOpts, shouldCallCallback = true) => __awaiter(void 0, void 0, void 0, function* () {
|
|
132
131
|
const publicWalletAddress = yield walletConnector.fetchPublicAddress(fetchPublicAddressOpts);
|
|
133
132
|
if (!publicWalletAddress) {
|
|
@@ -164,21 +163,20 @@ const useConnectWallet = ({ authMode, clearPrimaryWalletId, enableVisitTrackingO
|
|
|
164
163
|
walletConnectorKey: walletConnector.name,
|
|
165
164
|
walletId,
|
|
166
165
|
});
|
|
166
|
+
if (!shouldSkipCreatingVisit) {
|
|
167
|
+
// send information to backend to kick off background jobs
|
|
168
|
+
// so verify/sign on the next step could go by more quickly
|
|
169
|
+
// this is async work, but DO NOT AWAIT
|
|
170
|
+
createVisit({
|
|
171
|
+
authMode,
|
|
172
|
+
chain: walletChain || '',
|
|
173
|
+
environmentId,
|
|
174
|
+
publicWalletAddress,
|
|
175
|
+
walletName: walletConnector.name,
|
|
176
|
+
walletProvider: getWalletProvider(walletConnector),
|
|
177
|
+
});
|
|
178
|
+
}
|
|
167
179
|
}
|
|
168
|
-
if (shouldSkipCreatingVisit) {
|
|
169
|
-
return Promise.resolve(publicWalletAddress);
|
|
170
|
-
}
|
|
171
|
-
// send information to backend to kick off background jobs
|
|
172
|
-
// so verify/sign on the next step could go by more quickly
|
|
173
|
-
// this is async work, but DO NOT AWAIT
|
|
174
|
-
createVisit({
|
|
175
|
-
authMode,
|
|
176
|
-
chain: walletChain || '',
|
|
177
|
-
environmentId,
|
|
178
|
-
publicWalletAddress,
|
|
179
|
-
walletName: walletConnector.name,
|
|
180
|
-
walletProvider: getWalletProvider(walletConnector),
|
|
181
|
-
});
|
|
182
180
|
return Promise.resolve(publicWalletAddress);
|
|
183
181
|
});
|
|
184
182
|
const unlinkConnectedWallet = (walletId) => {
|
|
@@ -147,6 +147,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
|
|
|
147
147
|
if (!isValidMessage) {
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
+
setIsProcessing(true);
|
|
150
151
|
if (!((_c = providersWaitingOauthMessages.current) === null || _c === void 0 ? void 0 : _c[provider])) {
|
|
151
152
|
handleError(types.SocialOAuthErrorCode.SESSION_TIMEOUT, `Linking ${provider} account session timeout.`);
|
|
152
153
|
return;
|
|
@@ -201,15 +202,9 @@ const useSocialAccounts = ({ sessionTimeout } = {
|
|
|
201
202
|
if (!providersWithoutWindowOpenerRefence.includes(provider)) {
|
|
202
203
|
// For provider that support window.opener, we need to clear all states/listeners when the window is closed
|
|
203
204
|
authWindowInterval.current = setInterval(() => {
|
|
204
|
-
var _a;
|
|
205
205
|
if (!(authWindow === null || authWindow === void 0 ? void 0 : authWindow.closed)) {
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
|
-
// window was closed by user, before completing oauth
|
|
209
|
-
if ((_a = providersWaitingOauthMessages.current) === null || _a === void 0 ? void 0 : _a[provider]) {
|
|
210
|
-
clearListeners();
|
|
211
|
-
handleError(types.SocialOAuthErrorCode.OAUTH_WINDOW_CLOSED, `Linking ${provider} account window closed.`);
|
|
212
|
-
}
|
|
213
208
|
clearInterval(authWindowInterval.current);
|
|
214
209
|
setIsProcessing(false);
|
|
215
210
|
});
|