@dynamic-labs/sdk-react-core 0.17.0-RC.20 → 0.17.0-RC.21
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 +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +7 -7
- package/src/lib/Main.cjs +2 -1
- package/src/lib/Main.js +2 -1
- package/src/lib/components/WalletOrSocialMagicIcon/WalletOrSocialMagicIcon.cjs +32 -6
- package/src/lib/components/WalletOrSocialMagicIcon/WalletOrSocialMagicIcon.d.ts +3 -1
- package/src/lib/components/WalletOrSocialMagicIcon/WalletOrSocialMagicIcon.js +32 -6
- package/src/lib/context/AccessDeniedContext/AccessDeniedContext.cjs +7 -1
- package/src/lib/context/AccessDeniedContext/AccessDeniedContext.d.ts +3 -0
- package/src/lib/context/AccessDeniedContext/AccessDeniedContext.js +7 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +8 -4
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +8 -4
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +1 -1
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +1 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +1 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +1 -1
- package/src/lib/views/NoAccess/NoAccess.cjs +7 -5
- package/src/lib/views/NoAccess/NoAccess.js +7 -5
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +4 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +4 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +4 -4
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +4 -4
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +5 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.17.0-RC.21](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.20...v0.17.0-RC.21) (2023-06-02)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* social icon is missing on some views ([#2211](https://github.com/dynamic-labs/DynamicAuth/issues/2211)) ([bddd255](https://github.com/dynamic-labs/DynamicAuth/commit/bddd255f0aa61aed4b767145c51624ac1eb9b963))
|
|
8
|
+
|
|
2
9
|
## [0.17.0-RC.20](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.19...v0.17.0-RC.20) (2023-06-01)
|
|
3
10
|
|
|
4
11
|
|
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": "0.17.0-RC.
|
|
3
|
+
"version": "0.17.0-RC.21",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"formik": "2.2.9",
|
|
18
18
|
"qrcode": "1.5.1",
|
|
19
19
|
"ethers": "5.7.2",
|
|
20
|
-
"@dynamic-labs/logger": "0.17.0-RC.
|
|
21
|
-
"@dynamic-labs/multi-wallet": "0.17.0-RC.
|
|
22
|
-
"@dynamic-labs/rpc-providers": "0.17.0-RC.
|
|
23
|
-
"@dynamic-labs/types": "0.17.0-RC.
|
|
24
|
-
"@dynamic-labs/utils": "0.17.0-RC.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "0.17.0-RC.
|
|
20
|
+
"@dynamic-labs/logger": "0.17.0-RC.21",
|
|
21
|
+
"@dynamic-labs/multi-wallet": "0.17.0-RC.21",
|
|
22
|
+
"@dynamic-labs/rpc-providers": "0.17.0-RC.21",
|
|
23
|
+
"@dynamic-labs/types": "0.17.0-RC.21",
|
|
24
|
+
"@dynamic-labs/utils": "0.17.0-RC.21",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "0.17.0-RC.21"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"semver": "7.3.8"
|
package/src/lib/Main.cjs
CHANGED
|
@@ -50,11 +50,12 @@ require('./main.global.cjs');
|
|
|
50
50
|
const Main = () => {
|
|
51
51
|
const { selectedWalletConnector, appName, connectedWallets, isProjectSettingsLoading, projectSettings, privacyPolicyUrl, setShowAuthFlow, showAuthFlow, termsOfServiceUrl, newToWeb3WalletChainMap, wallets, clearStatesOnBackClick, user, loginWithEmail, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
52
52
|
const { view, setView } = ViewContext.useViewContext();
|
|
53
|
-
const { setDeniedAddress } = AccessDeniedContext.useAccessDeniedContext();
|
|
53
|
+
const { setDeniedAddress, setDeniedOauthProvider } = AccessDeniedContext.useAccessDeniedContext();
|
|
54
54
|
usePreventPageScroll.usePreventPageScroll(showAuthFlow);
|
|
55
55
|
const handleClose = () => {
|
|
56
56
|
setShowAuthFlow(false);
|
|
57
57
|
setDeniedAddress('');
|
|
58
|
+
setDeniedOauthProvider(undefined);
|
|
58
59
|
clearStatesOnBackClick();
|
|
59
60
|
};
|
|
60
61
|
const handleOnPortalUnmount = React.useCallback(
|
package/src/lib/Main.js
CHANGED
|
@@ -46,11 +46,12 @@ import './main.global.js';
|
|
|
46
46
|
const Main = () => {
|
|
47
47
|
const { selectedWalletConnector, appName, connectedWallets, isProjectSettingsLoading, projectSettings, privacyPolicyUrl, setShowAuthFlow, showAuthFlow, termsOfServiceUrl, newToWeb3WalletChainMap, wallets, clearStatesOnBackClick, user, loginWithEmail, } = useInternalDynamicContext();
|
|
48
48
|
const { view, setView } = useViewContext();
|
|
49
|
-
const { setDeniedAddress } = useAccessDeniedContext();
|
|
49
|
+
const { setDeniedAddress, setDeniedOauthProvider } = useAccessDeniedContext();
|
|
50
50
|
usePreventPageScroll(showAuthFlow);
|
|
51
51
|
const handleClose = () => {
|
|
52
52
|
setShowAuthFlow(false);
|
|
53
53
|
setDeniedAddress('');
|
|
54
|
+
setDeniedOauthProvider(undefined);
|
|
54
55
|
clearStatesOnBackClick();
|
|
55
56
|
};
|
|
56
57
|
const handleOnPortalUnmount = useCallback(
|
|
@@ -19,18 +19,44 @@ var getReferencedAccount = require('../../utils/functions/getReferencedAccount/g
|
|
|
19
19
|
var getSocialIcon = require('../../utils/functions/getSocialIcon/getSocialIcon.cjs');
|
|
20
20
|
var IconWithStatus = require('../IconWithStatus/IconWithStatus.cjs');
|
|
21
21
|
var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
22
|
+
var WalletIconWithStatus = require('../../widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.cjs');
|
|
23
|
+
var AccessDeniedContext = require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
22
24
|
|
|
23
|
-
const WalletOrSocialMagicIcon = ({ jwt, iconSize = 64,
|
|
24
|
-
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
25
|
+
const WalletOrSocialMagicIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
|
|
26
|
+
const { primaryWallet, selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
|
|
27
|
+
const { deniedOauthProvider, deniedAddress } = AccessDeniedContext.useAccessDeniedContext();
|
|
28
|
+
// when access is denied we don't have jwt set, so we're getting this value out of useAccessDeniedContext
|
|
29
|
+
if (deniedOauthProvider) {
|
|
30
|
+
const MagicSocialWalletIcon = getSocialIcon.getSocialIcon(deniedOauthProvider);
|
|
31
|
+
return (jsxRuntime.jsx(MagicSocialWalletIcon, { style: {
|
|
32
|
+
height: pixelToRem.pixelToRem(iconSize),
|
|
33
|
+
width: pixelToRem.pixelToRem(iconSize),
|
|
34
|
+
} }));
|
|
35
|
+
}
|
|
36
|
+
// it means that user tried to login with actual wallet and no magic social and failed to go through the access list
|
|
37
|
+
if (deniedAddress) {
|
|
38
|
+
return (jsxRuntime.jsx(walletBook.WalletIcon, { walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name, style: { height: pixelToRem.pixelToRem(iconSize), width: pixelToRem.pixelToRem(iconSize) } }));
|
|
39
|
+
}
|
|
25
40
|
if (!primaryWallet) {
|
|
26
41
|
return null;
|
|
27
42
|
}
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
const walletForIcon = wallet ? wallet : primaryWallet;
|
|
44
|
+
if (walletConnectorCore.isSocialWalletConnector(walletForIcon.connector)) {
|
|
45
|
+
const socialAccountDataForWallet = getReferencedAccount.getReferencedAccount(jwt, walletForIcon.id);
|
|
30
46
|
const MagicSocialWalletIcon = getSocialIcon.getSocialIcon(socialAccountDataForWallet === null || socialAccountDataForWallet === void 0 ? void 0 : socialAccountDataForWallet.oauthProvider);
|
|
31
|
-
|
|
47
|
+
// to show social icon with status dot
|
|
48
|
+
if (showStatus) {
|
|
49
|
+
return (jsxRuntime.jsx(IconWithStatus.IconWithStatus, { iconSize: iconSize, Icon: MagicSocialWalletIcon, variant: walletForIcon.connected ? 'green' : 'red' }));
|
|
50
|
+
}
|
|
51
|
+
// to show social icon
|
|
52
|
+
return (jsxRuntime.jsx(MagicSocialWalletIcon, { style: { height: pixelToRem.pixelToRem(iconSize), width: pixelToRem.pixelToRem(iconSize) } }));
|
|
53
|
+
}
|
|
54
|
+
// to show wallet icon with status dot
|
|
55
|
+
if (showStatus) {
|
|
56
|
+
return (jsxRuntime.jsx(WalletIconWithStatus.WalletIconWithStatus, { iconSize: iconSize, walletName: walletForIcon.connector.name, connected: walletForIcon.connected, variant: 'secondary' }));
|
|
32
57
|
}
|
|
33
|
-
|
|
58
|
+
// to show wallet icon without status dot
|
|
59
|
+
return (jsxRuntime.jsx(walletBook.WalletIcon, { walletName: walletForIcon.connector.name, style: { height: pixelToRem.pixelToRem(iconSize), width: pixelToRem.pixelToRem(iconSize) } }));
|
|
34
60
|
};
|
|
35
61
|
|
|
36
62
|
exports.WalletOrSocialMagicIcon = WalletOrSocialMagicIcon;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { Wallet } from '../../shared';
|
|
2
3
|
type Props = {
|
|
3
4
|
iconSize?: number;
|
|
4
5
|
jwt: string | undefined;
|
|
5
|
-
|
|
6
|
+
wallet?: Wallet | null;
|
|
7
|
+
showStatus?: boolean;
|
|
6
8
|
};
|
|
7
9
|
export declare const WalletOrSocialMagicIcon: FC<Props>;
|
|
8
10
|
export {};
|
|
@@ -15,18 +15,44 @@ import { getReferencedAccount } from '../../utils/functions/getReferencedAccount
|
|
|
15
15
|
import { getSocialIcon } from '../../utils/functions/getSocialIcon/getSocialIcon.js';
|
|
16
16
|
import { IconWithStatus } from '../IconWithStatus/IconWithStatus.js';
|
|
17
17
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
|
|
18
|
+
import { WalletIconWithStatus } from '../../widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.js';
|
|
19
|
+
import { useAccessDeniedContext } from '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
18
20
|
|
|
19
|
-
const WalletOrSocialMagicIcon = ({ jwt, iconSize = 64,
|
|
20
|
-
const { primaryWallet } = useInternalDynamicContext();
|
|
21
|
+
const WalletOrSocialMagicIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
|
|
22
|
+
const { primaryWallet, selectedWalletConnector } = useInternalDynamicContext();
|
|
23
|
+
const { deniedOauthProvider, deniedAddress } = useAccessDeniedContext();
|
|
24
|
+
// when access is denied we don't have jwt set, so we're getting this value out of useAccessDeniedContext
|
|
25
|
+
if (deniedOauthProvider) {
|
|
26
|
+
const MagicSocialWalletIcon = getSocialIcon(deniedOauthProvider);
|
|
27
|
+
return (jsx(MagicSocialWalletIcon, { style: {
|
|
28
|
+
height: pixelToRem(iconSize),
|
|
29
|
+
width: pixelToRem(iconSize),
|
|
30
|
+
} }));
|
|
31
|
+
}
|
|
32
|
+
// it means that user tried to login with actual wallet and no magic social and failed to go through the access list
|
|
33
|
+
if (deniedAddress) {
|
|
34
|
+
return (jsx(WalletIcon, { walletName: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name, style: { height: pixelToRem(iconSize), width: pixelToRem(iconSize) } }));
|
|
35
|
+
}
|
|
21
36
|
if (!primaryWallet) {
|
|
22
37
|
return null;
|
|
23
38
|
}
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
const walletForIcon = wallet ? wallet : primaryWallet;
|
|
40
|
+
if (isSocialWalletConnector(walletForIcon.connector)) {
|
|
41
|
+
const socialAccountDataForWallet = getReferencedAccount(jwt, walletForIcon.id);
|
|
26
42
|
const MagicSocialWalletIcon = getSocialIcon(socialAccountDataForWallet === null || socialAccountDataForWallet === void 0 ? void 0 : socialAccountDataForWallet.oauthProvider);
|
|
27
|
-
|
|
43
|
+
// to show social icon with status dot
|
|
44
|
+
if (showStatus) {
|
|
45
|
+
return (jsx(IconWithStatus, { iconSize: iconSize, Icon: MagicSocialWalletIcon, variant: walletForIcon.connected ? 'green' : 'red' }));
|
|
46
|
+
}
|
|
47
|
+
// to show social icon
|
|
48
|
+
return (jsx(MagicSocialWalletIcon, { style: { height: pixelToRem(iconSize), width: pixelToRem(iconSize) } }));
|
|
49
|
+
}
|
|
50
|
+
// to show wallet icon with status dot
|
|
51
|
+
if (showStatus) {
|
|
52
|
+
return (jsx(WalletIconWithStatus, { iconSize: iconSize, walletName: walletForIcon.connector.name, connected: walletForIcon.connected, variant: 'secondary' }));
|
|
28
53
|
}
|
|
29
|
-
|
|
54
|
+
// to show wallet icon without status dot
|
|
55
|
+
return (jsx(WalletIcon, { walletName: walletForIcon.connector.name, style: { height: pixelToRem(iconSize), width: pixelToRem(iconSize) } }));
|
|
30
56
|
};
|
|
31
57
|
|
|
32
58
|
export { WalletOrSocialMagicIcon };
|
|
@@ -8,7 +8,13 @@ var React = require('react');
|
|
|
8
8
|
const AccessDeniedContext = React.createContext(undefined);
|
|
9
9
|
const AccessDeniedContextProvider = ({ children, }) => {
|
|
10
10
|
const [deniedAddress, setDeniedAddress] = React.useState('');
|
|
11
|
-
const
|
|
11
|
+
const [deniedOauthProvider, setDeniedOauthProvider] = React.useState(undefined);
|
|
12
|
+
const value = React.useMemo(() => ({
|
|
13
|
+
deniedAddress,
|
|
14
|
+
deniedOauthProvider,
|
|
15
|
+
setDeniedAddress,
|
|
16
|
+
setDeniedOauthProvider,
|
|
17
|
+
}), [deniedAddress, deniedOauthProvider]);
|
|
12
18
|
return (jsxRuntime.jsx(AccessDeniedContext.Provider, Object.assign({ value: value }, { children: children })));
|
|
13
19
|
};
|
|
14
20
|
const useAccessDeniedContext = () => {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { ProviderEnum } from '@dynamic-labs/sdk-api';
|
|
2
3
|
export type AccessDeniedContextType = {
|
|
3
4
|
deniedAddress: string;
|
|
4
5
|
setDeniedAddress(address: string): void;
|
|
6
|
+
setDeniedOauthProvider(deniedOauthProvider: ProviderEnum | undefined): void;
|
|
7
|
+
deniedOauthProvider: ProviderEnum | undefined;
|
|
5
8
|
};
|
|
6
9
|
export declare const AccessDeniedContext: import("react").Context<AccessDeniedContextType | undefined>;
|
|
7
10
|
export declare const AccessDeniedContextProvider: ({ children, }: {
|
|
@@ -4,7 +4,13 @@ import { createContext, useState, useMemo, useContext } from 'react';
|
|
|
4
4
|
const AccessDeniedContext = createContext(undefined);
|
|
5
5
|
const AccessDeniedContextProvider = ({ children, }) => {
|
|
6
6
|
const [deniedAddress, setDeniedAddress] = useState('');
|
|
7
|
-
const
|
|
7
|
+
const [deniedOauthProvider, setDeniedOauthProvider] = useState(undefined);
|
|
8
|
+
const value = useMemo(() => ({
|
|
9
|
+
deniedAddress,
|
|
10
|
+
deniedOauthProvider,
|
|
11
|
+
setDeniedAddress,
|
|
12
|
+
setDeniedOauthProvider,
|
|
13
|
+
}), [deniedAddress, deniedOauthProvider]);
|
|
8
14
|
return (jsx(AccessDeniedContext.Provider, Object.assign({ value: value }, { children: children })));
|
|
9
15
|
};
|
|
10
16
|
const useAccessDeniedContext = () => {
|