@dynamic-labs/sdk-react-core 0.19.0-alpha.24 → 0.19.0-alpha.26
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 +31 -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 +16 -6
- package/src/lib/components/SocialSignIn/SocialSignIn.d.ts +1 -1
- package/src/lib/components/SocialSignIn/SocialSignIn.js +16 -6
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +8 -8
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +8 -8
- 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/shared/utils/hooks/useOnClickOutside/index.cjs +2 -2
- package/src/lib/shared/utils/hooks/useOnClickOutside/index.js +2 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getUserWalletsFromVerifiedCredentials/getUserWalletsFromVerifiedCredentials.cjs +26 -0
- package/src/lib/utils/functions/getUserWalletsFromVerifiedCredentials/getUserWalletsFromVerifiedCredentials.d.ts +1 -0
- package/src/lib/utils/functions/getUserWalletsFromVerifiedCredentials/getUserWalletsFromVerifiedCredentials.js +22 -0
- package/src/lib/utils/functions/getUserWalletsFromVerifiedCredentials/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +1 -0
- 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/useEmbeddedWallet/useEmbeddedWallet.cjs +12 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +12 -6
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +14 -8
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +14 -8
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +2 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +2 -2
- 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 +3 -5
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +3 -5
- 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 +33 -19
- package/src/lib/views/LoginView/useLoginView.js +34 -20
- 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,35 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.19.0-alpha.26](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.25...v0.19.0-alpha.26) (2023-10-25)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* allow filtering social providers for Dynamic Social with socialProvidersFilter ([#3707](https://github.com/dynamic-labs/DynamicAuth/issues/3707)) ([e4c16f3](https://github.com/dynamic-labs/DynamicAuth/commit/e4c16f359946e278a372cb8153242946d4887dcc))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* only create embedded wallet if user have no wallet ([#3715](https://github.com/dynamic-labs/DynamicAuth/issues/3715)) ([728e01a](https://github.com/dynamic-labs/DynamicAuth/commit/728e01ab8b5931eaa6fb7877c23847ac85947f52))
|
|
13
|
+
* Revert "fix(use-wallet-event-listener): handle switching wallet … ([#3699](https://github.com/dynamic-labs/DynamicAuth/issues/3699)) ([9b94737](https://github.com/dynamic-labs/DynamicAuth/commit/9b94737ecfa72cd047964254d806403b342433a1)), closes [#3626](https://github.com/dynamic-labs/DynamicAuth/issues/3626)
|
|
14
|
+
* undefined network edge case ([#3667](https://github.com/dynamic-labs/DynamicAuth/issues/3667)) ([12d4236](https://github.com/dynamic-labs/DynamicAuth/commit/12d42363f69b1dfd5babe05142bd03c501f62e5f))
|
|
15
|
+
* **useOnClickOutside:** prevent opening element on click while already open ([#3714](https://github.com/dynamic-labs/DynamicAuth/issues/3714)) ([1999dc5](https://github.com/dynamic-labs/DynamicAuth/commit/1999dc50b6e82eb5ee8d0919118e9dfbc39c2b67))
|
|
16
|
+
|
|
17
|
+
## [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)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* reduce screen flickering ([#3674](https://github.com/dynamic-labs/DynamicAuth/issues/3674)) ([bc3f89f](https://github.com/dynamic-labs/DynamicAuth/commit/bc3f89f5c1fe80294b60869be4a1e26daffb5553))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **demo:** updated sign-in methods section ([#3670](https://github.com/dynamic-labs/DynamicAuth/issues/3670)) ([8d10863](https://github.com/dynamic-labs/DynamicAuth/commit/8d10863872952587d889f5491da4c1df35cbef86))
|
|
28
|
+
* 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))
|
|
29
|
+
* 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))
|
|
30
|
+
* 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))
|
|
31
|
+
* **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))
|
|
32
|
+
|
|
2
33
|
## [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)
|
|
3
34
|
|
|
4
35
|
|
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.26",
|
|
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.26",
|
|
21
|
+
"@dynamic-labs/multi-wallet": "0.19.0-alpha.26",
|
|
22
|
+
"@dynamic-labs/rpc-providers": "0.19.0-alpha.26",
|
|
23
|
+
"@dynamic-labs/types": "0.19.0-alpha.26",
|
|
24
|
+
"@dynamic-labs/utils": "0.19.0-alpha.26",
|
|
25
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.26",
|
|
26
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.26",
|
|
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,18 +68,23 @@ 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);
|
|
75
75
|
const numberOfEnabledSocialProviders = providers.length;
|
|
76
|
-
|
|
76
|
+
// Set default provider as the first available provider if
|
|
77
|
+
if (
|
|
78
|
+
// Default provider isn't within the providers
|
|
79
|
+
(defaultProvider && !providers.includes(defaultProvider)) ||
|
|
80
|
+
// Or there's only one provider
|
|
81
|
+
numberOfEnabledSocialProviders === 1) {
|
|
77
82
|
// set first and only item in providers list as default provider
|
|
78
83
|
[defaultProvider] = providers;
|
|
79
84
|
}
|
|
80
85
|
else {
|
|
81
|
-
// put default provider at the
|
|
82
|
-
providers.sort((p1
|
|
86
|
+
// put default provider at the beginning of the list
|
|
87
|
+
providers.sort((p1) => (p1 === defaultProvider ? -1 : 0));
|
|
83
88
|
}
|
|
84
89
|
const defaultProviderOffset = defaultProvider ? 1 : 0;
|
|
85
90
|
// display number of items set in prop, with a max limit of MAX_INLINE_ITEMS
|
|
@@ -101,8 +106,13 @@ const SocialSignIn = ({ providers, onSelectProvider, isLoading, selectedProvider
|
|
|
101
106
|
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
107
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'social-sign-in', style: {
|
|
103
108
|
'--number-of-social-grid-items': numberOfSocialGridItems,
|
|
104
|
-
}, "data-testid": testId, children: [defaultProvider && renderProviderItem(defaultProvider, true), socialProvidersToDisplayInline.map((provider) =>
|
|
105
|
-
|
|
109
|
+
}, "data-testid": testId, children: [defaultProvider && renderProviderItem(defaultProvider, true), socialProvidersToDisplayInline.map((provider) => {
|
|
110
|
+
// if there's no wallet list and 3 social items or less, display all with full width
|
|
111
|
+
const displayFullWidth = !collapsedLayout &&
|
|
112
|
+
socialProvidersToDisplayInline.length <
|
|
113
|
+
4 - (defaultProvider ? 1 : 0);
|
|
114
|
+
return renderProviderItem(provider, displayFullWidth);
|
|
115
|
+
}), 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
116
|
};
|
|
107
117
|
|
|
108
118
|
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,18 +64,23 @@ 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);
|
|
71
71
|
const numberOfEnabledSocialProviders = providers.length;
|
|
72
|
-
|
|
72
|
+
// Set default provider as the first available provider if
|
|
73
|
+
if (
|
|
74
|
+
// Default provider isn't within the providers
|
|
75
|
+
(defaultProvider && !providers.includes(defaultProvider)) ||
|
|
76
|
+
// Or there's only one provider
|
|
77
|
+
numberOfEnabledSocialProviders === 1) {
|
|
73
78
|
// set first and only item in providers list as default provider
|
|
74
79
|
[defaultProvider] = providers;
|
|
75
80
|
}
|
|
76
81
|
else {
|
|
77
|
-
// put default provider at the
|
|
78
|
-
providers.sort((p1
|
|
82
|
+
// put default provider at the beginning of the list
|
|
83
|
+
providers.sort((p1) => (p1 === defaultProvider ? -1 : 0));
|
|
79
84
|
}
|
|
80
85
|
const defaultProviderOffset = defaultProvider ? 1 : 0;
|
|
81
86
|
// display number of items set in prop, with a max limit of MAX_INLINE_ITEMS
|
|
@@ -97,8 +102,13 @@ const SocialSignIn = ({ providers, onSelectProvider, isLoading, selectedProvider
|
|
|
97
102
|
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
103
|
return (jsxs(Fragment, { children: [jsxs("div", { className: 'social-sign-in', style: {
|
|
99
104
|
'--number-of-social-grid-items': numberOfSocialGridItems,
|
|
100
|
-
}, "data-testid": testId, children: [defaultProvider && renderProviderItem(defaultProvider, true), socialProvidersToDisplayInline.map((provider) =>
|
|
101
|
-
|
|
105
|
+
}, "data-testid": testId, children: [defaultProvider && renderProviderItem(defaultProvider, true), socialProvidersToDisplayInline.map((provider) => {
|
|
106
|
+
// if there's no wallet list and 3 social items or less, display all with full width
|
|
107
|
+
const displayFullWidth = !collapsedLayout &&
|
|
108
|
+
socialProvidersToDisplayInline.length <
|
|
109
|
+
4 - (defaultProvider ? 1 : 0);
|
|
110
|
+
return renderProviderItem(provider, displayFullWidth);
|
|
111
|
+
}), 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
112
|
};
|
|
103
113
|
|
|
104
114
|
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);
|
|
@@ -6,24 +6,24 @@ var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
-
var useInternalDynamicContext = require('../DynamicContext/useInternalDynamicContext.cjs');
|
|
10
|
-
var ViewContext = require('../ViewContext/ViewContext.cjs');
|
|
11
|
-
require('@dynamic-labs/utils');
|
|
12
9
|
require('@dynamic-labs/sdk-api');
|
|
13
|
-
require('../../config/ApiEndpoint.cjs');
|
|
14
10
|
var logger = require('../../shared/logger.cjs');
|
|
15
11
|
require('@dynamic-labs/iconic');
|
|
12
|
+
var ViewContext = require('../ViewContext/ViewContext.cjs');
|
|
16
13
|
require('@dynamic-labs/wallet-book');
|
|
14
|
+
require('@dynamic-labs/utils');
|
|
17
15
|
require('../../utils/constants/colors.cjs');
|
|
18
16
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
17
|
require('viem');
|
|
20
18
|
require('../../shared/consts/index.cjs');
|
|
21
19
|
require('@dynamic-labs/multi-wallet');
|
|
20
|
+
var getReferencedAccount = require('../../utils/functions/getReferencedAccount/getReferencedAccount.cjs');
|
|
21
|
+
require('../../config/ApiEndpoint.cjs');
|
|
22
22
|
require('@dynamic-labs/rpc-providers');
|
|
23
23
|
require('../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
24
|
-
var getReferencedAccount = require('../../utils/functions/getReferencedAccount/getReferencedAccount.cjs');
|
|
25
24
|
var useVerifyWallet = require('../../utils/hooks/useVerifyWallet/useVerifyWallet.cjs');
|
|
26
25
|
require('react-dom');
|
|
26
|
+
var useInternalDynamicContext = require('../DynamicContext/useInternalDynamicContext.cjs');
|
|
27
27
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
28
28
|
require('../ThemeContext/ThemeContext.cjs');
|
|
29
29
|
require('react-focus-lock');
|
|
@@ -62,7 +62,7 @@ require('../UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
|
62
62
|
const SocialRedirectContext = React.createContext(undefined);
|
|
63
63
|
const SocialRedirectContextProvider = ({ children, }) => {
|
|
64
64
|
var _a, _b, _c, _d;
|
|
65
|
-
const { setShowAuthFlow, wallets, setSelectedWalletConnector, walletUiUtils, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, setShowDynamicUserProfile, isAuthenticated, setPrimaryWalletId, secondaryWallets, sdkHasLoaded, authToken, connectWallet, primaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
65
|
+
const { setShowAuthFlow, wallets, setSelectedWalletConnector, walletUiUtils, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, setShowDynamicUserProfile, isAuthenticated, setPrimaryWalletId, secondaryWallets, sdkHasLoaded, authToken, connectWallet, primaryWallet, socialProvidersFilter = (providers) => providers, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
66
66
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
67
67
|
const { setView } = ViewContext.useViewContext();
|
|
68
68
|
const verifyWallet = useVerifyWallet.useVerifyWallet({
|
|
@@ -74,9 +74,9 @@ const SocialRedirectContextProvider = ({ children, }) => {
|
|
|
74
74
|
});
|
|
75
75
|
const signInProvider = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _a === void 0 ? void 0 : _a.signInProvider;
|
|
76
76
|
const enabledSocialProvidersInDb = (_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.providers) !== null && _c !== void 0 ? _c : [];
|
|
77
|
-
const enabledSocialProviders = (_d = enabledSocialProvidersInDb
|
|
77
|
+
const enabledSocialProviders = (_d = socialProvidersFilter(enabledSocialProvidersInDb
|
|
78
78
|
.filter((provider) => provider.enabled)
|
|
79
|
-
.map((provider) => provider.provider)) !== null && _d !== void 0 ? _d : [];
|
|
79
|
+
.map((provider) => provider.provider))) !== null && _d !== void 0 ? _d : [];
|
|
80
80
|
const socialWalletConnector = wallets
|
|
81
81
|
.map(({ walletConnector }) => walletConnector)
|
|
82
82
|
.find(walletConnectorCore.isSocialWalletConnector);
|
|
@@ -2,24 +2,24 @@ import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, useState, useMemo, useCallback, useEffect, useContext } from 'react';
|
|
4
4
|
import { isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
-
import { useInternalDynamicContext } from '../DynamicContext/useInternalDynamicContext.js';
|
|
6
|
-
import { useViewContext } from '../ViewContext/ViewContext.js';
|
|
7
|
-
import '@dynamic-labs/utils';
|
|
8
5
|
import '@dynamic-labs/sdk-api';
|
|
9
|
-
import '../../config/ApiEndpoint.js';
|
|
10
6
|
import { logger } from '../../shared/logger.js';
|
|
11
7
|
import '@dynamic-labs/iconic';
|
|
8
|
+
import { useViewContext } from '../ViewContext/ViewContext.js';
|
|
12
9
|
import '@dynamic-labs/wallet-book';
|
|
10
|
+
import '@dynamic-labs/utils';
|
|
13
11
|
import '../../utils/constants/colors.js';
|
|
14
12
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
15
13
|
import 'viem';
|
|
16
14
|
import '../../shared/consts/index.js';
|
|
17
15
|
import '@dynamic-labs/multi-wallet';
|
|
16
|
+
import { getReferencedAccount } from '../../utils/functions/getReferencedAccount/getReferencedAccount.js';
|
|
17
|
+
import '../../config/ApiEndpoint.js';
|
|
18
18
|
import '@dynamic-labs/rpc-providers';
|
|
19
19
|
import '../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
20
|
-
import { getReferencedAccount } from '../../utils/functions/getReferencedAccount/getReferencedAccount.js';
|
|
21
20
|
import { useVerifyWallet } from '../../utils/hooks/useVerifyWallet/useVerifyWallet.js';
|
|
22
21
|
import 'react-dom';
|
|
22
|
+
import { useInternalDynamicContext } from '../DynamicContext/useInternalDynamicContext.js';
|
|
23
23
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
24
24
|
import '../ThemeContext/ThemeContext.js';
|
|
25
25
|
import 'react-focus-lock';
|
|
@@ -58,7 +58,7 @@ import '../UserFieldEditorContext/UserFieldEditorContext.js';
|
|
|
58
58
|
const SocialRedirectContext = createContext(undefined);
|
|
59
59
|
const SocialRedirectContextProvider = ({ children, }) => {
|
|
60
60
|
var _a, _b, _c, _d;
|
|
61
|
-
const { setShowAuthFlow, wallets, setSelectedWalletConnector, walletUiUtils, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, setShowDynamicUserProfile, isAuthenticated, setPrimaryWalletId, secondaryWallets, sdkHasLoaded, authToken, connectWallet, primaryWallet, } = useInternalDynamicContext();
|
|
61
|
+
const { setShowAuthFlow, wallets, setSelectedWalletConnector, walletUiUtils, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, setShowDynamicUserProfile, isAuthenticated, setPrimaryWalletId, secondaryWallets, sdkHasLoaded, authToken, connectWallet, primaryWallet, socialProvidersFilter = (providers) => providers, } = useInternalDynamicContext();
|
|
62
62
|
const { setErrorMessage } = useErrorContext();
|
|
63
63
|
const { setView } = useViewContext();
|
|
64
64
|
const verifyWallet = useVerifyWallet({
|
|
@@ -70,9 +70,9 @@ const SocialRedirectContextProvider = ({ children, }) => {
|
|
|
70
70
|
});
|
|
71
71
|
const signInProvider = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _a === void 0 ? void 0 : _a.signInProvider;
|
|
72
72
|
const enabledSocialProvidersInDb = (_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.providers) !== null && _c !== void 0 ? _c : [];
|
|
73
|
-
const enabledSocialProviders = (_d = enabledSocialProvidersInDb
|
|
73
|
+
const enabledSocialProviders = (_d = socialProvidersFilter(enabledSocialProvidersInDb
|
|
74
74
|
.filter((provider) => provider.enabled)
|
|
75
|
-
.map((provider) => provider.provider)) !== null && _d !== void 0 ? _d : [];
|
|
75
|
+
.map((provider) => provider.provider))) !== null && _d !== void 0 ? _d : [];
|
|
76
76
|
const socialWalletConnector = wallets
|
|
77
77
|
.map(({ walletConnector }) => walletConnector)
|
|
78
78
|
.find(isSocialWalletConnector);
|
|
@@ -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;
|
|
@@ -16,11 +16,11 @@ const useOnClickOutside = (ref, handler) => {
|
|
|
16
16
|
}
|
|
17
17
|
handler(event);
|
|
18
18
|
};
|
|
19
|
-
document.addEventListener('mousedown', listener);
|
|
20
19
|
document.addEventListener('touchstart', listener);
|
|
20
|
+
document.addEventListener('click', listener);
|
|
21
21
|
return () => {
|
|
22
|
-
document.removeEventListener('mousedown', listener);
|
|
23
22
|
document.removeEventListener('touchstart', listener);
|
|
23
|
+
document.removeEventListener('click', listener);
|
|
24
24
|
};
|
|
25
25
|
}, [ref, handler]);
|
|
26
26
|
};
|
|
@@ -12,11 +12,11 @@ const useOnClickOutside = (ref, handler) => {
|
|
|
12
12
|
}
|
|
13
13
|
handler(event);
|
|
14
14
|
};
|
|
15
|
-
document.addEventListener('mousedown', listener);
|
|
16
15
|
document.addEventListener('touchstart', listener);
|
|
16
|
+
document.addEventListener('click', listener);
|
|
17
17
|
return () => {
|
|
18
|
-
document.removeEventListener('mousedown', listener);
|
|
19
18
|
document.removeEventListener('touchstart', listener);
|
|
19
|
+
document.removeEventListener('click', listener);
|
|
20
20
|
};
|
|
21
21
|
}, [ref, handler]);
|
|
22
22
|
};
|