@dynamic-labs/sdk-react-core 0.19.0-alpha.23 → 0.19.0-alpha.25
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 +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/components/LogoutButton/LogoutButton.cjs +3 -1
- package/src/lib/components/LogoutButton/LogoutButton.js +3 -1
- package/src/lib/components/SocialSignIn/SocialSignIn.cjs +8 -3
- package/src/lib/components/SocialSignIn/SocialSignIn.d.ts +1 -1
- package/src/lib/components/SocialSignIn/SocialSignIn.js +8 -3
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -0
- package/src/lib/shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.cjs +2 -1
- package/src/lib/shared/utils/functions/isUserLinkingWallet/isUserLinkingWallet.js +2 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +5 -4
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.d.ts +2 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +5 -4
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +5 -2
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +5 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +21 -9
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +21 -9
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +6 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +6 -1
- package/src/lib/utils/hooks/useWalletEventListeners/utils/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/index.d.ts +1 -0
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.cjs +9 -0
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.d.ts +2 -0
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.js +5 -0
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.cjs +7 -1
- package/src/lib/views/CollectUserDataView/OnboardingUserDataForm/OnboardingUserDataForm.js +7 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +10 -6
- package/src/lib/views/EmailVerification/EmailVerification.js +10 -6
- package/src/lib/views/LoginView/LoginView.cjs +4 -1
- package/src/lib/views/LoginView/LoginView.js +4 -1
- package/src/lib/views/LoginView/sections/LoginWidget.d.ts +1 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +2 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +2 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +2 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +2 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +2 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.d.ts +2 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +2 -1
- package/src/lib/views/LoginView/useLoginView.cjs +2 -2
- package/src/lib/views/LoginView/useLoginView.js +2 -2
- package/src/lib/views/WalletList/WalletList.cjs +2 -1
- package/src/lib/views/WalletList/WalletList.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.19.0-alpha.25](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.24...v0.19.0-alpha.25) (2023-10-25)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* reduce screen flickering ([#3674](https://github.com/dynamic-labs/DynamicAuth/issues/3674)) ([bc3f89f](https://github.com/dynamic-labs/DynamicAuth/commit/bc3f89f5c1fe80294b60869be4a1e26daffb5553))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **demo:** updated sign-in methods section ([#3670](https://github.com/dynamic-labs/DynamicAuth/issues/3670)) ([8d10863](https://github.com/dynamic-labs/DynamicAuth/commit/8d10863872952587d889f5491da4c1df35cbef86))
|
|
13
|
+
* don't auto-create passkey on social sign-in and onboarding if disabled ([#3696](https://github.com/dynamic-labs/DynamicAuth/issues/3696)) ([866e305](https://github.com/dynamic-labs/DynamicAuth/commit/866e3051cdd710d7e702562a7db14fc08d9ff275))
|
|
14
|
+
* hide auth flow when completing email verification if passkey if disabled ([#3684](https://github.com/dynamic-labs/DynamicAuth/issues/3684)) ([b3f4b56](https://github.com/dynamic-labs/DynamicAuth/commit/b3f4b56feaeed33a8f34a1c7376eb889dbc85655))
|
|
15
|
+
* hide wallet view when filter returns empty ([#3688](https://github.com/dynamic-labs/DynamicAuth/issues/3688)) ([e98d957](https://github.com/dynamic-labs/DynamicAuth/commit/e98d957de123a481e31db04297a467a64de109af))
|
|
16
|
+
* **use-wallet-event-listener:** handle switching wallet when multi-wallet is disabled ([#3626](https://github.com/dynamic-labs/DynamicAuth/issues/3626)) ([e3c5899](https://github.com/dynamic-labs/DynamicAuth/commit/e3c58999b3dcfd3818778da458a34097e6b957d9))
|
|
17
|
+
|
|
18
|
+
## [0.19.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.23...v0.19.0-alpha.24) (2023-10-24)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* check state from message receiver is same as generated oauth state ([#3675](https://github.com/dynamic-labs/DynamicAuth/issues/3675)) ([2407b6c](https://github.com/dynamic-labs/DynamicAuth/commit/2407b6cff09985bbd5b044e44ab600540a4c69cb))
|
|
24
|
+
|
|
2
25
|
## [0.19.0-alpha.23](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.22...v0.19.0-alpha.23) (2023-10-24)
|
|
3
26
|
|
|
4
27
|
|
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.19.0-alpha.
|
|
3
|
+
"version": "0.19.0-alpha.25",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"react-focus-lock": "2.9.2",
|
|
18
18
|
"react-i18next": "^13.2.0",
|
|
19
19
|
"yup": "0.32.11",
|
|
20
|
-
"@dynamic-labs/logger": "0.19.0-alpha.
|
|
21
|
-
"@dynamic-labs/multi-wallet": "0.19.0-alpha.
|
|
22
|
-
"@dynamic-labs/rpc-providers": "0.19.0-alpha.
|
|
23
|
-
"@dynamic-labs/types": "0.19.0-alpha.
|
|
24
|
-
"@dynamic-labs/utils": "0.19.0-alpha.
|
|
25
|
-
"@dynamic-labs/wallet-book": "0.19.0-alpha.
|
|
26
|
-
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.
|
|
20
|
+
"@dynamic-labs/logger": "0.19.0-alpha.25",
|
|
21
|
+
"@dynamic-labs/multi-wallet": "0.19.0-alpha.25",
|
|
22
|
+
"@dynamic-labs/rpc-providers": "0.19.0-alpha.25",
|
|
23
|
+
"@dynamic-labs/types": "0.19.0-alpha.25",
|
|
24
|
+
"@dynamic-labs/utils": "0.19.0-alpha.25",
|
|
25
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.25",
|
|
26
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.25",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -10,7 +10,7 @@ require('@dynamic-labs/sdk-api');
|
|
|
10
10
|
var logger = require('../../shared/logger.cjs');
|
|
11
11
|
require('@dynamic-labs/iconic');
|
|
12
12
|
require('@dynamic-labs/wallet-connector-core');
|
|
13
|
-
require('../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
var logout = require('../../shared/assets/logout.cjs');
|
|
15
15
|
require('@dynamic-labs/wallet-book');
|
|
16
16
|
require('@dynamic-labs/utils');
|
|
@@ -23,10 +23,12 @@ var Button = require('../Button/Button.cjs');
|
|
|
23
23
|
const LogoutButton = ({ buttonClassName = '', isTextButton = false, }) => {
|
|
24
24
|
const [loading, setLoading] = React.useState(false);
|
|
25
25
|
const { handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
|
|
26
|
+
const { goToInitialView } = ViewContext.useViewContext();
|
|
26
27
|
const onLogOutClick = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
27
28
|
try {
|
|
28
29
|
setLoading(true);
|
|
29
30
|
yield handleLogOut();
|
|
31
|
+
goToInitialView();
|
|
30
32
|
}
|
|
31
33
|
catch (e) {
|
|
32
34
|
logger.logger.error(e);
|
|
@@ -6,7 +6,7 @@ import '@dynamic-labs/sdk-api';
|
|
|
6
6
|
import { logger } from '../../shared/logger.js';
|
|
7
7
|
import '@dynamic-labs/iconic';
|
|
8
8
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
|
-
import '../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import { useViewContext } from '../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import { ReactComponent as SvgLogout } from '../../shared/assets/logout.js';
|
|
11
11
|
import '@dynamic-labs/wallet-book';
|
|
12
12
|
import '@dynamic-labs/utils';
|
|
@@ -19,10 +19,12 @@ import { Button } from '../Button/Button.js';
|
|
|
19
19
|
const LogoutButton = ({ buttonClassName = '', isTextButton = false, }) => {
|
|
20
20
|
const [loading, setLoading] = useState(false);
|
|
21
21
|
const { handleLogOut } = useInternalDynamicContext();
|
|
22
|
+
const { goToInitialView } = useViewContext();
|
|
22
23
|
const onLogOutClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
24
|
try {
|
|
24
25
|
setLoading(true);
|
|
25
26
|
yield handleLogOut();
|
|
27
|
+
goToInitialView();
|
|
26
28
|
}
|
|
27
29
|
catch (e) {
|
|
28
30
|
logger.error(e);
|
|
@@ -68,7 +68,7 @@ require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
|
68
68
|
var useIconThemeVariant = require('../../utils/hooks/useIconThemeVariant/useIconThemeVariant.cjs');
|
|
69
69
|
|
|
70
70
|
const MAX_INLINE_ITEMS = 5;
|
|
71
|
-
const SocialSignIn = ({ providers, onSelectProvider, isLoading, selectedProvider, testId, defaultProvider, numOfItemsToDisplay = 5, }) => {
|
|
71
|
+
const SocialSignIn = ({ providers, onSelectProvider, isLoading, selectedProvider, testId, defaultProvider, numOfItemsToDisplay = 5, collapsedLayout, }) => {
|
|
72
72
|
const iconThemeVariant = useIconThemeVariant.useIconThemeVariant();
|
|
73
73
|
const [showCard, setShowCard] = React.useState(false);
|
|
74
74
|
const closeCard = () => !isLoading && setShowCard(false);
|
|
@@ -101,8 +101,13 @@ const SocialSignIn = ({ providers, onSelectProvider, isLoading, selectedProvider
|
|
|
101
101
|
jsxRuntime.jsx(iconic.SocialIcon, { name: getProviderAsString(provider), variant: iconThemeVariant }), isSpinning: selectedProvider === provider, iconSize: 32 }), !insideCard && fullWidth && (jsxRuntime.jsxs(Typography.Typography, { variant: 'button_primary', children: ["Connect with ", capitalize.capitalize(getProviderAsString(provider))] }))] }, getProviderAsString(provider)));
|
|
102
102
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'social-sign-in', style: {
|
|
103
103
|
'--number-of-social-grid-items': numberOfSocialGridItems,
|
|
104
|
-
}, "data-testid": testId, children: [defaultProvider && renderProviderItem(defaultProvider, true), socialProvidersToDisplayInline.map((provider) =>
|
|
105
|
-
|
|
104
|
+
}, "data-testid": testId, children: [defaultProvider && renderProviderItem(defaultProvider, true), socialProvidersToDisplayInline.map((provider) => {
|
|
105
|
+
// if there's no wallet list and 3 social items or less, display all with full width
|
|
106
|
+
const displayFullWidth = !collapsedLayout &&
|
|
107
|
+
socialProvidersToDisplayInline.length <
|
|
108
|
+
4 - (defaultProvider ? 1 : 0);
|
|
109
|
+
return renderProviderItem(provider, displayFullWidth);
|
|
110
|
+
}), showCardButton && (jsxRuntime.jsx(IconListTile.IconListTile, { dataTestId: 'show-more-options', onClick: () => setShowCard(true), className: 'social-sign-in--tile', children: jsxRuntime.jsx(Icon.Icon, { color: 'text-primary', children: jsxRuntime.jsx(dotsHorizontal.ReactComponent, {}) }) }, 'show-more-options'))] }), jsxRuntime.jsx(OverlayCard.OverlayCard, { isOpen: showCard, onClickOverlay: closeCard, children: jsxRuntime.jsxs("div", { className: 'social-sign-in--card', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, children: jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span', children: "Choose a social account" }) }), jsxRuntime.jsx("div", { className: 'social-sign-in--card--body', children: providers.map((provider) => renderProviderItem(provider, false, true)) })] }) })] }));
|
|
106
111
|
};
|
|
107
112
|
|
|
108
113
|
exports.SocialSignIn = SocialSignIn;
|
|
@@ -8,5 +8,5 @@ interface Props extends SocialSectionProps {
|
|
|
8
8
|
selectedProvider?: SocialSignInProviderEnum;
|
|
9
9
|
testId?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const SocialSignIn: ({ providers, onSelectProvider, isLoading, selectedProvider, testId, defaultProvider, numOfItemsToDisplay, }: Props) => JSX.Element;
|
|
11
|
+
export declare const SocialSignIn: ({ providers, onSelectProvider, isLoading, selectedProvider, testId, defaultProvider, numOfItemsToDisplay, collapsedLayout, }: Props) => JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -64,7 +64,7 @@ import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
|
64
64
|
import { useIconThemeVariant } from '../../utils/hooks/useIconThemeVariant/useIconThemeVariant.js';
|
|
65
65
|
|
|
66
66
|
const MAX_INLINE_ITEMS = 5;
|
|
67
|
-
const SocialSignIn = ({ providers, onSelectProvider, isLoading, selectedProvider, testId, defaultProvider, numOfItemsToDisplay = 5, }) => {
|
|
67
|
+
const SocialSignIn = ({ providers, onSelectProvider, isLoading, selectedProvider, testId, defaultProvider, numOfItemsToDisplay = 5, collapsedLayout, }) => {
|
|
68
68
|
const iconThemeVariant = useIconThemeVariant();
|
|
69
69
|
const [showCard, setShowCard] = useState(false);
|
|
70
70
|
const closeCard = () => !isLoading && setShowCard(false);
|
|
@@ -97,8 +97,13 @@ const SocialSignIn = ({ providers, onSelectProvider, isLoading, selectedProvider
|
|
|
97
97
|
jsx(SocialIcon, { name: getProviderAsString(provider), variant: iconThemeVariant }), isSpinning: selectedProvider === provider, iconSize: 32 }), !insideCard && fullWidth && (jsxs(Typography, { variant: 'button_primary', children: ["Connect with ", capitalize(getProviderAsString(provider))] }))] }, getProviderAsString(provider)));
|
|
98
98
|
return (jsxs(Fragment, { children: [jsxs("div", { className: 'social-sign-in', style: {
|
|
99
99
|
'--number-of-social-grid-items': numberOfSocialGridItems,
|
|
100
|
-
}, "data-testid": testId, children: [defaultProvider && renderProviderItem(defaultProvider, true), socialProvidersToDisplayInline.map((provider) =>
|
|
101
|
-
|
|
100
|
+
}, "data-testid": testId, children: [defaultProvider && renderProviderItem(defaultProvider, true), socialProvidersToDisplayInline.map((provider) => {
|
|
101
|
+
// if there's no wallet list and 3 social items or less, display all with full width
|
|
102
|
+
const displayFullWidth = !collapsedLayout &&
|
|
103
|
+
socialProvidersToDisplayInline.length <
|
|
104
|
+
4 - (defaultProvider ? 1 : 0);
|
|
105
|
+
return renderProviderItem(provider, displayFullWidth);
|
|
106
|
+
}), showCardButton && (jsx(IconListTile, { dataTestId: 'show-more-options', onClick: () => setShowCard(true), className: 'social-sign-in--tile', children: jsx(Icon, { color: 'text-primary', children: jsx(SvgDotsHorizontal, {}) }) }, 'show-more-options'))] }), jsx(OverlayCard, { isOpen: showCard, onClickOverlay: closeCard, children: jsxs("div", { className: 'social-sign-in--card', children: [jsx(ModalHeader, { trailing: closeButton, children: jsx(Typography, { weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span', children: "Choose a social account" }) }), jsx("div", { className: 'social-sign-in--card--body', children: providers.map((provider) => renderProviderItem(provider, false, true)) })] }) })] }));
|
|
102
107
|
};
|
|
103
108
|
|
|
104
109
|
export { SocialSignIn };
|
|
@@ -273,6 +273,7 @@ const DynamicContextProvider = ({ children, theme, settings, locale: locale$1, }
|
|
|
273
273
|
]);
|
|
274
274
|
const handleLogOut = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
275
275
|
var _j, _k, _l;
|
|
276
|
+
setSdkHasLoaded(false);
|
|
276
277
|
clearAllWalletConnectSessions();
|
|
277
278
|
setWalletsToConnectByChain(walletsByChain);
|
|
278
279
|
setShowDynamicUserProfile(false);
|
|
@@ -269,6 +269,7 @@ const DynamicContextProvider = ({ children, theme, settings, locale, }) => {
|
|
|
269
269
|
]);
|
|
270
270
|
const handleLogOut = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
271
271
|
var _j, _k, _l;
|
|
272
|
+
setSdkHasLoaded(false);
|
|
272
273
|
clearAllWalletConnectSessions();
|
|
273
274
|
setWalletsToConnectByChain(walletsByChain);
|
|
274
275
|
setShowDynamicUserProfile(false);
|
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const isUserLinkingWallet = (user, view, isMockedSDK) => (user === null || user === void 0 ? void 0 : user.verifiedCredentials) !== undefined &&
|
|
6
6
|
(view === 'wallet-list' ||
|
|
7
|
-
view === 'login-with-email-or-wallet-full-wallet-list'
|
|
7
|
+
view === 'login-with-email-or-wallet-full-wallet-list' ||
|
|
8
|
+
view === 'multi-wallet-wallet-list') &&
|
|
8
9
|
// Mocked SDK is used in the dashboard and the user is
|
|
9
10
|
// the actual user that the user logged in to the dashboard
|
|
10
11
|
!isMockedSDK;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const isUserLinkingWallet = (user, view, isMockedSDK) => (user === null || user === void 0 ? void 0 : user.verifiedCredentials) !== undefined &&
|
|
2
2
|
(view === 'wallet-list' ||
|
|
3
|
-
view === 'login-with-email-or-wallet-full-wallet-list'
|
|
3
|
+
view === 'login-with-email-or-wallet-full-wallet-list' ||
|
|
4
|
+
view === 'multi-wallet-wallet-list') &&
|
|
4
5
|
// Mocked SDK is used in the dashboard and the user is
|
|
5
6
|
// the actual user that the user logged in to the dashboard
|
|
6
7
|
!isMockedSDK;
|