@dynamic-labs/sdk-react-core 0.19.0-alpha.7 → 0.19.0-alpha.8
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 +24 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +10 -10
- package/src/index.d.ts +1 -1
- package/src/lib/Main.cjs +1 -0
- package/src/lib/Main.js +1 -0
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +2 -2
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +2 -2
- package/src/lib/components/IconWithStatus/IconWithStatus.cjs +3 -3
- package/src/lib/components/IconWithStatus/IconWithStatus.d.ts +2 -2
- package/src/lib/components/IconWithStatus/IconWithStatus.js +3 -3
- package/src/lib/components/MockedQrCode/MockedQrCode.cjs +1 -1
- package/src/lib/components/MockedQrCode/MockedQrCode.js +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +2 -2
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.d.ts +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +2 -2
- package/src/lib/components/SocialSignIn/SocialSignIn.cjs +26 -14
- package/src/lib/components/SocialSignIn/SocialSignIn.d.ts +8 -7
- package/src/lib/components/SocialSignIn/SocialSignIn.js +26 -14
- package/src/lib/components/TransactionOriginDestination/TransactionOriginDestination.d.ts +1 -1
- package/src/lib/components/UserProfile/UserProfile.cjs +4 -1
- package/src/lib/components/UserProfile/UserProfile.js +4 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +15 -13
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +15 -13
- package/src/lib/context/DynamicContext/helpers.cjs +22 -10
- package/src/lib/context/DynamicContext/helpers.d.ts +4 -2
- package/src/lib/context/DynamicContext/helpers.js +20 -10
- package/src/lib/context/ErrorContext/ErrorContext.cjs +4 -1
- package/src/lib/context/ErrorContext/ErrorContext.js +4 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +7 -4
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.d.ts +5 -5
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +7 -4
- package/src/lib/data/api.cjs +48 -16
- package/src/lib/data/api.d.ts +1 -0
- package/src/lib/data/api.js +50 -19
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +1 -1
- package/src/lib/locale/en/translation.cjs +2 -4
- package/src/lib/locale/en/translation.js +2 -4
- package/src/lib/shared/types/index.d.ts +4 -0
- package/src/lib/shared/utils/functions/wallet/createWallet.cjs +1 -1
- package/src/lib/shared/utils/functions/wallet/createWallet.js +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/localStorage.cjs +4 -2
- package/src/lib/utils/constants/localStorage.d.ts +2 -1
- package/src/lib/utils/constants/localStorage.js +3 -2
- package/src/lib/utils/functions/getActiveOauthCredential/getActiveOauthCredential.cjs +11 -0
- package/src/lib/utils/functions/getActiveOauthCredential/getActiveOauthCredential.d.ts +2 -0
- package/src/lib/utils/functions/getActiveOauthCredential/getActiveOauthCredential.js +7 -0
- package/src/lib/utils/functions/getActiveOauthCredential/index.d.ts +1 -0
- package/src/lib/utils/functions/getEnabledSocialSignInProvidersAsProviderEnum/getEnabledSocialSignInProvidersAsProviderEnum.d.ts +2 -0
- package/src/lib/utils/functions/getEnabledSocialSignInProvidersAsProviderEnum/index.d.ts +1 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.cjs +19 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.d.ts +2 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.js +15 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/index.d.ts +1 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.cjs +19 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.d.ts +2 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.js +15 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/index.d.ts +1 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.cjs +19 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.d.ts +2 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.js +15 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +5 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +2 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +2 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +3 -3
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +4 -4
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +10 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +10 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +10 -164
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.d.ts +2 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +12 -166
- package/src/lib/utils/hooks/useSocialAuth/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +278 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +20 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +274 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +13 -3
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +13 -3
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +4 -2
- package/src/lib/views/AccountExistsView/AccountExistsView.js +4 -2
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +1 -1
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +1 -1
- package/src/lib/views/LoginView/LoginView.cjs +1 -1
- package/src/lib/views/LoginView/LoginView.js +1 -1
- package/src/lib/views/LoginView/sections/LoginWidget.d.ts +5 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +77 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.d.ts +3 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +73 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/index.d.ts +1 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +3 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.d.ts +2 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +3 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +18 -4
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.d.ts +6 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +18 -4
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.cjs +3 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.js +3 -2
- package/src/lib/views/LoginView/useLoginView.cjs +9 -10
- package/src/lib/views/LoginView/useLoginView.js +9 -10
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +1 -1
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.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/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +1 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +1 -1
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +2 -2
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +2 -2
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +1 -1
- package/src/lib/views/PendingConnectView/PendingConnectView.js +1 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +1 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +1 -1
- package/src/lib/views/QrCodeView/QRCode.cjs +3 -3
- package/src/lib/views/QrCodeView/QRCode.d.ts +2 -2
- package/src/lib/views/QrCodeView/QRCode.js +3 -3
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +2 -2
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.d.ts +2 -1
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +2 -2
- package/src/lib/views/QrCodeView/QrCodeView.cjs +2 -2
- package/src/lib/views/QrCodeView/QrCodeView.js +2 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +1 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.js +1 -1
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +4 -6
- package/src/lib/views/SocialRedirectView/SocialRedirectView.d.ts +1 -1
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +4 -6
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +1 -1
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +1 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.cjs +1 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.js +1 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +2 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +2 -2
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +1 -1
- package/src/lib/views/WalletLockedView/WalletLockedView.js +1 -1
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +2 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +2 -2
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +2 -2
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.d.ts +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +2 -2
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +18 -3
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +18 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +9 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +9 -1
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.d.ts +2 -2
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.js +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +6 -5
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +6 -5
|
@@ -19,6 +19,7 @@ require('ethers');
|
|
|
19
19
|
require('../../shared/consts/index.cjs');
|
|
20
20
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
21
21
|
require('@dynamic-labs/multi-wallet');
|
|
22
|
+
var getSocialSignInProviderForProviderEnum = require('../../utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.cjs');
|
|
22
23
|
require('../../components/ShadowDOM/ShadowDOM.cjs');
|
|
23
24
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
24
25
|
require('react-dom');
|
|
@@ -59,10 +60,11 @@ var LoginEmailForm = require('../LoginView/sections/EmailSignInSection/LoginEmai
|
|
|
59
60
|
const AccountExistsView = () => {
|
|
60
61
|
const { existentAccountData } = AccountExistsContext.useAccountExistsContext();
|
|
61
62
|
const { email, embeddedSocialSigninProvider } = existentAccountData || {};
|
|
63
|
+
const existingSocialSignInProvider = getSocialSignInProviderForProviderEnum.getSocialSignInProviderForProviderEnum(embeddedSocialSigninProvider);
|
|
62
64
|
const { socialProvider, setSocialProvider, socialWalletConnector } = SocialRedirectContext.useSocialRedirectContext();
|
|
63
65
|
const findSocialIcon = useFindSocialIcon.useFindSocialIcon();
|
|
64
66
|
const { mutate: handleNewLoging } = useMutation.useMutation(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
setSocialProvider(
|
|
67
|
+
setSocialProvider(existingSocialSignInProvider);
|
|
66
68
|
yield (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.endSession());
|
|
67
69
|
return socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.connect(embeddedSocialSigninProvider);
|
|
68
70
|
}));
|
|
@@ -72,7 +74,7 @@ const AccountExistsView = () => {
|
|
|
72
74
|
: '. Please log in with your email.';
|
|
73
75
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: ["It looks like an account already exists using ", jsxRuntime.jsx("strong", { children: email }), '', messageTrail] }));
|
|
74
76
|
};
|
|
75
|
-
return (jsxRuntime.jsxs("div", Object.assign({ className: 'account-exists__container' }, { children: [jsxRuntime.jsx(iconic.UserProfileIcon, { className: 'account-exists__image' }), jsxRuntime.jsxs("div", Object.assign({ className: 'account-exists__main' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'account-exists__content' }, { children: jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'account-exists__content--secondary' }, { children: renderFullMessage() })) })), embeddedSocialSigninProvider ? (jsxRuntime.jsxs(IconListTile.IconListTile, Object.assign({ dataTestId: `inline-${embeddedSocialSigninProvider}`, onClick: () => handleNewLoging(), className: 'social-sign-in--tile' }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: findSocialIcon(embeddedSocialSigninProvider), isSpinning: socialProvider ===
|
|
77
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: 'account-exists__container' }, { children: [jsxRuntime.jsx(iconic.UserProfileIcon, { className: 'account-exists__image' }), jsxRuntime.jsxs("div", Object.assign({ className: 'account-exists__main' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'account-exists__content' }, { children: jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'account-exists__content--secondary' }, { children: renderFullMessage() })) })), embeddedSocialSigninProvider ? (jsxRuntime.jsxs(IconListTile.IconListTile, Object.assign({ dataTestId: `inline-${embeddedSocialSigninProvider}`, onClick: () => handleNewLoging(), className: 'social-sign-in--tile' }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: findSocialIcon(embeddedSocialSigninProvider), isSpinning: socialProvider === existingSocialSignInProvider, iconSize: 32 }), jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'button_primary' }, { children: ["Connect with", ' ', capitalize.capitalize(embeddedSocialSigninProvider === null || embeddedSocialSigninProvider === void 0 ? void 0 : embeddedSocialSigninProvider.toString())] }))] }), embeddedSocialSigninProvider)) : (jsxRuntime.jsx(LoginEmailForm.LoginEmailForm, { isLoading: false, currentEmail: email }))] }))] })));
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
exports.AccountExistsView = AccountExistsView;
|
|
@@ -15,6 +15,7 @@ import 'ethers';
|
|
|
15
15
|
import '../../shared/consts/index.js';
|
|
16
16
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
17
17
|
import '@dynamic-labs/multi-wallet';
|
|
18
|
+
import { getSocialSignInProviderForProviderEnum } from '../../utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.js';
|
|
18
19
|
import '../../components/ShadowDOM/ShadowDOM.js';
|
|
19
20
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
20
21
|
import 'react-dom';
|
|
@@ -55,10 +56,11 @@ import { LoginEmailForm } from '../LoginView/sections/EmailSignInSection/LoginEm
|
|
|
55
56
|
const AccountExistsView = () => {
|
|
56
57
|
const { existentAccountData } = useAccountExistsContext();
|
|
57
58
|
const { email, embeddedSocialSigninProvider } = existentAccountData || {};
|
|
59
|
+
const existingSocialSignInProvider = getSocialSignInProviderForProviderEnum(embeddedSocialSigninProvider);
|
|
58
60
|
const { socialProvider, setSocialProvider, socialWalletConnector } = useSocialRedirectContext();
|
|
59
61
|
const findSocialIcon = useFindSocialIcon();
|
|
60
62
|
const { mutate: handleNewLoging } = useMutation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
setSocialProvider(
|
|
63
|
+
setSocialProvider(existingSocialSignInProvider);
|
|
62
64
|
yield (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.endSession());
|
|
63
65
|
return socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.connect(embeddedSocialSigninProvider);
|
|
64
66
|
}));
|
|
@@ -68,7 +70,7 @@ const AccountExistsView = () => {
|
|
|
68
70
|
: '. Please log in with your email.';
|
|
69
71
|
return (jsxs(Fragment, { children: ["It looks like an account already exists using ", jsx("strong", { children: email }), '', messageTrail] }));
|
|
70
72
|
};
|
|
71
|
-
return (jsxs("div", Object.assign({ className: 'account-exists__container' }, { children: [jsx(UserProfileIcon, { className: 'account-exists__image' }), jsxs("div", Object.assign({ className: 'account-exists__main' }, { children: [jsx("div", Object.assign({ className: 'account-exists__content' }, { children: jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'account-exists__content--secondary' }, { children: renderFullMessage() })) })), embeddedSocialSigninProvider ? (jsxs(IconListTile, Object.assign({ dataTestId: `inline-${embeddedSocialSigninProvider}`, onClick: () => handleNewLoging(), className: 'social-sign-in--tile' }, { children: [jsx(IconWithSpinner, { Icon: findSocialIcon(embeddedSocialSigninProvider), isSpinning: socialProvider ===
|
|
73
|
+
return (jsxs("div", Object.assign({ className: 'account-exists__container' }, { children: [jsx(UserProfileIcon, { className: 'account-exists__image' }), jsxs("div", Object.assign({ className: 'account-exists__main' }, { children: [jsx("div", Object.assign({ className: 'account-exists__content' }, { children: jsx(Typography, Object.assign({ variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'account-exists__content--secondary' }, { children: renderFullMessage() })) })), embeddedSocialSigninProvider ? (jsxs(IconListTile, Object.assign({ dataTestId: `inline-${embeddedSocialSigninProvider}`, onClick: () => handleNewLoging(), className: 'social-sign-in--tile' }, { children: [jsx(IconWithSpinner, { Icon: findSocialIcon(embeddedSocialSigninProvider), isSpinning: socialProvider === existingSocialSignInProvider, iconSize: 32 }), jsxs(Typography, Object.assign({ variant: 'button_primary' }, { children: ["Connect with", ' ', capitalize(embeddedSocialSigninProvider === null || embeddedSocialSigninProvider === void 0 ? void 0 : embeddedSocialSigninProvider.toString())] }))] }), embeddedSocialSigninProvider)) : (jsx(LoginEmailForm, { isLoading: false, currentEmail: email }))] }))] })));
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
export { AccountExistsView };
|
|
@@ -34,7 +34,7 @@ const BridgeSummaryView = () => {
|
|
|
34
34
|
const createPrimaryWalletCard = (wallet) => {
|
|
35
35
|
const PrimaryWalletChainIcon = getChainIcon.getChainIcon(wallet.chain);
|
|
36
36
|
const primaryWalletChainInfo = walletConnectorCore.getChainInfo(wallet.chain);
|
|
37
|
-
return (jsxRuntime.jsx(DynamicBridgeWalletCard.DynamicBridgeWalletCard, Object.assign({ networkIcon: jsxRuntime.jsx(PrimaryWalletChainIcon, {}), networkName: primaryWalletChainInfo === null || primaryWalletChainInfo === void 0 ? void 0 : primaryWalletChainInfo.displayName }, { children: jsxRuntime.jsx(DynamicBridgeWalletCardBody.DynamicBridgeWalletCardBody, {
|
|
37
|
+
return (jsxRuntime.jsx(DynamicBridgeWalletCard.DynamicBridgeWalletCard, Object.assign({ networkIcon: jsxRuntime.jsx(PrimaryWalletChainIcon, {}), networkName: primaryWalletChainInfo === null || primaryWalletChainInfo === void 0 ? void 0 : primaryWalletChainInfo.displayName }, { children: jsxRuntime.jsx(DynamicBridgeWalletCardBody.DynamicBridgeWalletCardBody, { walletKey: wallet.connector.key, walletAddress: wallet.address, walletBalance:
|
|
38
38
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
39
39
|
jsxRuntime.jsx(Balance.Balance, { address: wallet.address, connector: wallet.connector, network: wallet.chain }) }) })));
|
|
40
40
|
};
|
|
@@ -30,7 +30,7 @@ const BridgeSummaryView = () => {
|
|
|
30
30
|
const createPrimaryWalletCard = (wallet) => {
|
|
31
31
|
const PrimaryWalletChainIcon = getChainIcon(wallet.chain);
|
|
32
32
|
const primaryWalletChainInfo = getChainInfo(wallet.chain);
|
|
33
|
-
return (jsx(DynamicBridgeWalletCard, Object.assign({ networkIcon: jsx(PrimaryWalletChainIcon, {}), networkName: primaryWalletChainInfo === null || primaryWalletChainInfo === void 0 ? void 0 : primaryWalletChainInfo.displayName }, { children: jsx(DynamicBridgeWalletCardBody, {
|
|
33
|
+
return (jsx(DynamicBridgeWalletCard, Object.assign({ networkIcon: jsx(PrimaryWalletChainIcon, {}), networkName: primaryWalletChainInfo === null || primaryWalletChainInfo === void 0 ? void 0 : primaryWalletChainInfo.displayName }, { children: jsx(DynamicBridgeWalletCardBody, { walletKey: wallet.connector.key, walletAddress: wallet.address, walletBalance:
|
|
34
34
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
35
35
|
jsx(Balance, { address: wallet.address, connector: wallet.connector, network: wallet.chain }) }) })));
|
|
36
36
|
};
|
|
@@ -54,7 +54,7 @@ const LoginView = () => {
|
|
|
54
54
|
setShowWalletList(true);
|
|
55
55
|
}, isLoading: isLoading }, `${viewSection.type}_${index}`));
|
|
56
56
|
case 'social':
|
|
57
|
-
return jsxRuntime.jsx(SocialSignInSection.SocialSignInSection, {}, `${viewSection.type}_${index}`);
|
|
57
|
+
return (jsxRuntime.jsx(SocialSignInSection.SocialSignInSection, { sectionData: viewSection }, `${viewSection.type}_${index}`));
|
|
58
58
|
default:
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
@@ -50,7 +50,7 @@ const LoginView = () => {
|
|
|
50
50
|
setShowWalletList(true);
|
|
51
51
|
}, isLoading: isLoading }, `${viewSection.type}_${index}`));
|
|
52
52
|
case 'social':
|
|
53
|
-
return jsx(SocialSignInSection, {}, `${viewSection.type}_${index}`);
|
|
53
|
+
return (jsx(SocialSignInSection, { sectionData: viewSection }, `${viewSection.type}_${index}`));
|
|
54
54
|
default:
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { SocialSignInProviderEnum } from '@dynamic-labs/sdk-api';
|
|
1
2
|
export interface LoginWidgetProps {
|
|
2
3
|
onSubmit?: () => void;
|
|
3
4
|
onSubmitError?: () => void;
|
|
4
5
|
isLoading: boolean;
|
|
5
6
|
}
|
|
7
|
+
export interface SocialSectionProps {
|
|
8
|
+
defaultProvider?: SocialSignInProviderEnum;
|
|
9
|
+
numOfItemsToDisplay?: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
require('react');
|
|
7
|
+
require('@dynamic-labs/sdk-api');
|
|
8
|
+
require('../../../../../shared/logger.cjs');
|
|
9
|
+
require('@dynamic-labs/iconic');
|
|
10
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
11
|
+
var ViewContext = require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
12
|
+
require('@dynamic-labs/wallet-book');
|
|
13
|
+
require('@dynamic-labs/utils');
|
|
14
|
+
require('../../../../../utils/constants/colors.cjs');
|
|
15
|
+
require('../../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
16
|
+
require('ethers');
|
|
17
|
+
require('../../../../../shared/consts/index.cjs');
|
|
18
|
+
var useInternalDynamicContext = require('../../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
19
|
+
require('@dynamic-labs/multi-wallet');
|
|
20
|
+
var getProviderEnumForSocialSignInProvider = require('../../../../../utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.cjs');
|
|
21
|
+
require('../../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
22
|
+
require('../../../../../context/ThemeContext/ThemeContext.cjs');
|
|
23
|
+
require('react-dom');
|
|
24
|
+
require('react-focus-lock');
|
|
25
|
+
require('../../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
26
|
+
require('../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
27
|
+
require('../../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
28
|
+
require('../../../../../config/ApiEndpoint.cjs');
|
|
29
|
+
require('@dynamic-labs/rpc-providers');
|
|
30
|
+
require('../../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
31
|
+
require('../../../../../context/ErrorContext/ErrorContext.cjs');
|
|
32
|
+
require('../../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
33
|
+
require('../../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
34
|
+
require('../../../../../components/IconButton/IconButton.cjs');
|
|
35
|
+
require('../../../../../components/Alert/Alert.cjs');
|
|
36
|
+
require('formik');
|
|
37
|
+
require('yup');
|
|
38
|
+
require('../../../../CollectUserDataView/fieldsConfig.cjs');
|
|
39
|
+
require('../../../../../context/MockContext/MockContext.cjs');
|
|
40
|
+
require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
41
|
+
require('../../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
42
|
+
require('@dynamic-labs/types');
|
|
43
|
+
var useSocialAuth = require('../../../../../utils/hooks/useSocialAuth/useSocialAuth.cjs');
|
|
44
|
+
require('../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
45
|
+
require('../../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
46
|
+
require('../../../../../components/Popper/Popper/Popper.cjs');
|
|
47
|
+
require('../../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
48
|
+
require('../../../../../components/InlineWidget/InlineWidget.cjs');
|
|
49
|
+
require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
50
|
+
var SocialSignIn = require('../../../../../components/SocialSignIn/SocialSignIn.cjs');
|
|
51
|
+
var SocialRedirectContext = require('../../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
52
|
+
|
|
53
|
+
const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
54
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
55
|
+
const { setSocialProvider, socialProvider, enabledSocialProviders } = SocialRedirectContext.useSocialRedirectContext();
|
|
56
|
+
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
57
|
+
const { isProcessing, connectSocialAccount } = useSocialAuth.useSocialAuth({
|
|
58
|
+
authMode: 'signin',
|
|
59
|
+
onError: () => {
|
|
60
|
+
goToInitialView();
|
|
61
|
+
},
|
|
62
|
+
onSettled: () => {
|
|
63
|
+
setSocialProvider(undefined);
|
|
64
|
+
},
|
|
65
|
+
sessionTimeout: 10000,
|
|
66
|
+
});
|
|
67
|
+
const onSelectProvider = (provider) => {
|
|
68
|
+
const providerEnum = getProviderEnumForSocialSignInProvider.getProviderEnumForSocialSignInProvider(provider);
|
|
69
|
+
setSocialProvider(provider);
|
|
70
|
+
setView('social-redirect-view');
|
|
71
|
+
setShowAuthFlow(true);
|
|
72
|
+
connectSocialAccount(providerEnum);
|
|
73
|
+
};
|
|
74
|
+
return (jsxRuntime.jsx(SocialSignIn.SocialSignIn, { onSelectProvider: onSelectProvider, providers: enabledSocialProviders, selectedProvider: socialProvider, isLoading: isProcessing, testId: 'dynamic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay }));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports.DynamicSocialSignIn = DynamicSocialSignIn;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '@dynamic-labs/sdk-api';
|
|
4
|
+
import '../../../../../shared/logger.js';
|
|
5
|
+
import '@dynamic-labs/iconic';
|
|
6
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import { useViewContext } from '../../../../../context/ViewContext/ViewContext.js';
|
|
8
|
+
import '@dynamic-labs/wallet-book';
|
|
9
|
+
import '@dynamic-labs/utils';
|
|
10
|
+
import '../../../../../utils/constants/colors.js';
|
|
11
|
+
import '../../../../../shared/utils/classes/storage/localStorage.js';
|
|
12
|
+
import 'ethers';
|
|
13
|
+
import '../../../../../shared/consts/index.js';
|
|
14
|
+
import { useInternalDynamicContext } from '../../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
15
|
+
import '@dynamic-labs/multi-wallet';
|
|
16
|
+
import { getProviderEnumForSocialSignInProvider } from '../../../../../utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.js';
|
|
17
|
+
import '../../../../../components/ShadowDOM/ShadowDOM.js';
|
|
18
|
+
import '../../../../../context/ThemeContext/ThemeContext.js';
|
|
19
|
+
import 'react-dom';
|
|
20
|
+
import 'react-focus-lock';
|
|
21
|
+
import '../../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
22
|
+
import '../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
23
|
+
import '../../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
24
|
+
import '../../../../../config/ApiEndpoint.js';
|
|
25
|
+
import '@dynamic-labs/rpc-providers';
|
|
26
|
+
import '../../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
27
|
+
import '../../../../../context/ErrorContext/ErrorContext.js';
|
|
28
|
+
import '../../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
29
|
+
import '../../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
30
|
+
import '../../../../../components/IconButton/IconButton.js';
|
|
31
|
+
import '../../../../../components/Alert/Alert.js';
|
|
32
|
+
import 'formik';
|
|
33
|
+
import 'yup';
|
|
34
|
+
import '../../../../CollectUserDataView/fieldsConfig.js';
|
|
35
|
+
import '../../../../../context/MockContext/MockContext.js';
|
|
36
|
+
import '../../../../../context/CaptchaContext/CaptchaContext.js';
|
|
37
|
+
import '../../../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
38
|
+
import '@dynamic-labs/types';
|
|
39
|
+
import { useSocialAuth } from '../../../../../utils/hooks/useSocialAuth/useSocialAuth.js';
|
|
40
|
+
import '../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
41
|
+
import '../../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
42
|
+
import '../../../../../components/Popper/Popper/Popper.js';
|
|
43
|
+
import '../../../../../components/Popper/PopperContext/PopperContext.js';
|
|
44
|
+
import '../../../../../components/InlineWidget/InlineWidget.js';
|
|
45
|
+
import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
46
|
+
import { SocialSignIn } from '../../../../../components/SocialSignIn/SocialSignIn.js';
|
|
47
|
+
import { useSocialRedirectContext } from '../../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
48
|
+
|
|
49
|
+
const DynamicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
50
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
51
|
+
const { setSocialProvider, socialProvider, enabledSocialProviders } = useSocialRedirectContext();
|
|
52
|
+
const { setView, goToInitialView } = useViewContext();
|
|
53
|
+
const { isProcessing, connectSocialAccount } = useSocialAuth({
|
|
54
|
+
authMode: 'signin',
|
|
55
|
+
onError: () => {
|
|
56
|
+
goToInitialView();
|
|
57
|
+
},
|
|
58
|
+
onSettled: () => {
|
|
59
|
+
setSocialProvider(undefined);
|
|
60
|
+
},
|
|
61
|
+
sessionTimeout: 10000,
|
|
62
|
+
});
|
|
63
|
+
const onSelectProvider = (provider) => {
|
|
64
|
+
const providerEnum = getProviderEnumForSocialSignInProvider(provider);
|
|
65
|
+
setSocialProvider(provider);
|
|
66
|
+
setView('social-redirect-view');
|
|
67
|
+
setShowAuthFlow(true);
|
|
68
|
+
connectSocialAccount(providerEnum);
|
|
69
|
+
};
|
|
70
|
+
return (jsx(SocialSignIn, { onSelectProvider: onSelectProvider, providers: enabledSocialProviders, selectedProvider: socialProvider, isLoading: isProcessing, testId: 'dynamic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay }));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { DynamicSocialSignIn };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DynamicSocialSignIn';
|
package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs
CHANGED
|
@@ -50,15 +50,16 @@ require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
|
50
50
|
var SocialSignIn = require('../../../../../components/SocialSignIn/SocialSignIn.cjs');
|
|
51
51
|
var SocialRedirectContext = require('../../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
52
52
|
|
|
53
|
-
const MagicSocialSignIn = () => {
|
|
53
|
+
const MagicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
54
54
|
const { socialProvidersFilter = (providers) => providers } = useInternalDynamicContext.useInternalDynamicContext();
|
|
55
55
|
const { socialProvider, setSocialProvider, socialWalletConnector, enabledSocialProviders, } = SocialRedirectContext.useSocialRedirectContext();
|
|
56
56
|
const socialProviders = socialProvidersFilter(enabledSocialProviders);
|
|
57
57
|
const { mutate: onClickProvider, isLoading } = useMutation.useMutation((provider) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
+
setSocialProvider(provider);
|
|
58
59
|
yield (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.endSession());
|
|
59
60
|
return socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.connect(provider);
|
|
60
61
|
}));
|
|
61
|
-
return (jsxRuntime.jsx(SocialSignIn.SocialSignIn, {
|
|
62
|
+
return (jsxRuntime.jsx(SocialSignIn.SocialSignIn, { onSelectProvider: onClickProvider, providers: socialProviders, selectedProvider: socialProvider, isLoading: isLoading, testId: 'magic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay }));
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
exports.MagicSocialSignIn = MagicSocialSignIn;
|
package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js
CHANGED
|
@@ -46,15 +46,16 @@ import '../../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
|
46
46
|
import { SocialSignIn } from '../../../../../components/SocialSignIn/SocialSignIn.js';
|
|
47
47
|
import { useSocialRedirectContext } from '../../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
48
48
|
|
|
49
|
-
const MagicSocialSignIn = () => {
|
|
49
|
+
const MagicSocialSignIn = ({ defaultProvider, numOfItemsToDisplay, }) => {
|
|
50
50
|
const { socialProvidersFilter = (providers) => providers } = useInternalDynamicContext();
|
|
51
51
|
const { socialProvider, setSocialProvider, socialWalletConnector, enabledSocialProviders, } = useSocialRedirectContext();
|
|
52
52
|
const socialProviders = socialProvidersFilter(enabledSocialProviders);
|
|
53
53
|
const { mutate: onClickProvider, isLoading } = useMutation((provider) => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
setSocialProvider(provider);
|
|
54
55
|
yield (socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.endSession());
|
|
55
56
|
return socialWalletConnector === null || socialWalletConnector === void 0 ? void 0 : socialWalletConnector.connect(provider);
|
|
56
57
|
}));
|
|
57
|
-
return (jsx(SocialSignIn, {
|
|
58
|
+
return (jsx(SocialSignIn, { onSelectProvider: onClickProvider, providers: socialProviders, selectedProvider: socialProvider, isLoading: isLoading, testId: 'magic-social-sign-in', defaultProvider: defaultProvider, numOfItemsToDisplay: numOfItemsToDisplay }));
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
export { MagicSocialSignIn };
|
|
@@ -18,16 +18,30 @@ require('ethers');
|
|
|
18
18
|
require('../../../../shared/consts/index.cjs');
|
|
19
19
|
require('@dynamic-labs/multi-wallet');
|
|
20
20
|
var isProviderEnabled = require('../../../../utils/functions/isProviderEnabled/isProviderEnabled.cjs');
|
|
21
|
+
var getSocialSignInProviderFromString = require('../../../../utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.cjs');
|
|
21
22
|
var MagicSocialSignIn = require('./MagicSocialSignIn/MagicSocialSignIn.cjs');
|
|
23
|
+
var DynamicSocialSignIn = require('./DynamicSocialSignIn/DynamicSocialSignIn.cjs');
|
|
22
24
|
|
|
23
|
-
const SocialSignInSection = () => {
|
|
24
|
-
var _a, _b;
|
|
25
|
+
const SocialSignInSection = ({ sectionData }) => {
|
|
26
|
+
var _a, _b, _c;
|
|
25
27
|
const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
|
|
26
|
-
const
|
|
28
|
+
const providers = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _a !== void 0 ? _a : [];
|
|
29
|
+
const componentProps = {
|
|
30
|
+
defaultProvider: getSocialSignInProviderFromString.getSocialSignInProviderFromString(sectionData.defaultItem),
|
|
31
|
+
numOfItemsToDisplay: sectionData.numOfItemsToDisplay,
|
|
32
|
+
};
|
|
33
|
+
const isMagicEnabled = isProviderEnabled.isProviderEnabled(providers, sdkApi.ProviderEnum.MagicLink);
|
|
34
|
+
const isDynamicEnabled = isProviderEnabled.isProviderEnabled(providers, sdkApi.ProviderEnum.Dynamic) ||
|
|
35
|
+
isProviderEnabled.isProviderEnabled(providers, sdkApi.ProviderEnum.EmailOnly);
|
|
27
36
|
if (isMagicEnabled &&
|
|
28
37
|
((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.signInProvider) ===
|
|
29
38
|
sdkApi.SignInProviderEnum.MagicLink) {
|
|
30
|
-
return jsxRuntime.jsx(MagicSocialSignIn.MagicSocialSignIn, {});
|
|
39
|
+
return jsxRuntime.jsx(MagicSocialSignIn.MagicSocialSignIn, Object.assign({}, componentProps));
|
|
40
|
+
}
|
|
41
|
+
if (isDynamicEnabled &&
|
|
42
|
+
((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
|
|
43
|
+
sdkApi.SignInProviderEnum.Dynamic) {
|
|
44
|
+
return jsxRuntime.jsx(DynamicSocialSignIn.DynamicSocialSignIn, Object.assign({}, componentProps));
|
|
31
45
|
}
|
|
32
46
|
return null;
|
|
33
47
|
};
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { SdkViewSection } from '@dynamic-labs/sdk-api';
|
|
3
|
+
type Props = {
|
|
4
|
+
sectionData: SdkViewSection;
|
|
5
|
+
};
|
|
6
|
+
export declare const SocialSignInSection: ({ sectionData }: Props) => JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -14,16 +14,30 @@ import 'ethers';
|
|
|
14
14
|
import '../../../../shared/consts/index.js';
|
|
15
15
|
import '@dynamic-labs/multi-wallet';
|
|
16
16
|
import { isProviderEnabled } from '../../../../utils/functions/isProviderEnabled/isProviderEnabled.js';
|
|
17
|
+
import { getSocialSignInProviderFromString } from '../../../../utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.js';
|
|
17
18
|
import { MagicSocialSignIn } from './MagicSocialSignIn/MagicSocialSignIn.js';
|
|
19
|
+
import { DynamicSocialSignIn } from './DynamicSocialSignIn/DynamicSocialSignIn.js';
|
|
18
20
|
|
|
19
|
-
const SocialSignInSection = () => {
|
|
20
|
-
var _a, _b;
|
|
21
|
+
const SocialSignInSection = ({ sectionData }) => {
|
|
22
|
+
var _a, _b, _c;
|
|
21
23
|
const { projectSettings } = useInternalDynamicContext();
|
|
22
|
-
const
|
|
24
|
+
const providers = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) !== null && _a !== void 0 ? _a : [];
|
|
25
|
+
const componentProps = {
|
|
26
|
+
defaultProvider: getSocialSignInProviderFromString(sectionData.defaultItem),
|
|
27
|
+
numOfItemsToDisplay: sectionData.numOfItemsToDisplay,
|
|
28
|
+
};
|
|
29
|
+
const isMagicEnabled = isProviderEnabled(providers, ProviderEnum.MagicLink);
|
|
30
|
+
const isDynamicEnabled = isProviderEnabled(providers, ProviderEnum.Dynamic) ||
|
|
31
|
+
isProviderEnabled(providers, ProviderEnum.EmailOnly);
|
|
23
32
|
if (isMagicEnabled &&
|
|
24
33
|
((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.signInProvider) ===
|
|
25
34
|
SignInProviderEnum.MagicLink) {
|
|
26
|
-
return jsx(MagicSocialSignIn, {});
|
|
35
|
+
return jsx(MagicSocialSignIn, Object.assign({}, componentProps));
|
|
36
|
+
}
|
|
37
|
+
if (isDynamicEnabled &&
|
|
38
|
+
((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
|
|
39
|
+
SignInProviderEnum.Dynamic) {
|
|
40
|
+
return jsx(DynamicSocialSignIn, Object.assign({}, componentProps));
|
|
27
41
|
}
|
|
28
42
|
return null;
|
|
29
43
|
};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var reactI18next = require('react-i18next');
|
|
7
7
|
require('react');
|
|
8
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
8
9
|
require('@dynamic-labs/sdk-api');
|
|
9
10
|
require('../../../../shared/logger.cjs');
|
|
10
11
|
require('@dynamic-labs/iconic');
|
|
@@ -32,7 +33,6 @@ require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
|
32
33
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
33
34
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
34
35
|
require('../../../../components/IconButton/IconButton.cjs');
|
|
35
|
-
var Button = require('../../../../components/Button/Button.cjs');
|
|
36
36
|
require('../../../../components/Alert/Alert.cjs');
|
|
37
37
|
require('formik');
|
|
38
38
|
require('yup');
|
|
@@ -43,6 +43,7 @@ require('../../../../context/EmailVerificationContext/EmailVerificationContext.c
|
|
|
43
43
|
require('@dynamic-labs/types');
|
|
44
44
|
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
45
45
|
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
46
|
+
var IconListTile = require('../../../../components/IconListTile/IconListTile.cjs');
|
|
46
47
|
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
47
48
|
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
48
49
|
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
@@ -52,7 +53,7 @@ var WalletSimpleSignIn = require('./WalletSimpleSignIn/WalletSimpleSignIn.cjs');
|
|
|
52
53
|
|
|
53
54
|
const WalletSignInSection = ({ numberOfItensToShow, isLoading, onSubmit, }) => {
|
|
54
55
|
const { t } = reactI18next.useTranslation();
|
|
55
|
-
return numberOfItensToShow > 0 ? (jsxRuntime.jsx(WalletSimpleSignIn.WalletSimpleSignIn, { previewWalletsNumber: numberOfItensToShow, onshowAllWallets: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), disabled: isLoading })) : (jsxRuntime.jsx(
|
|
56
|
+
return numberOfItensToShow > 0 ? (jsxRuntime.jsx(WalletSimpleSignIn.WalletSimpleSignIn, { previewWalletsNumber: numberOfItensToShow, onshowAllWallets: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), disabled: isLoading })) : (jsxRuntime.jsx(IconListTile.IconListTile, Object.assign({ onClick: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), disabled: isLoading, className: 'connect-with-wallet-button' }, { children: jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'button_primary' }, { children: t('dyn_login.wallet_list.button_only') })) })));
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
exports.WalletSignInSection = WalletSignInSection;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import 'react';
|
|
4
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
4
5
|
import '@dynamic-labs/sdk-api';
|
|
5
6
|
import '../../../../shared/logger.js';
|
|
6
7
|
import '@dynamic-labs/iconic';
|
|
@@ -28,7 +29,6 @@ import '../../../../context/ErrorContext/ErrorContext.js';
|
|
|
28
29
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
29
30
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
30
31
|
import '../../../../components/IconButton/IconButton.js';
|
|
31
|
-
import { Button } from '../../../../components/Button/Button.js';
|
|
32
32
|
import '../../../../components/Alert/Alert.js';
|
|
33
33
|
import 'formik';
|
|
34
34
|
import 'yup';
|
|
@@ -39,6 +39,7 @@ import '../../../../context/EmailVerificationContext/EmailVerificationContext.js
|
|
|
39
39
|
import '@dynamic-labs/types';
|
|
40
40
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
41
41
|
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
42
|
+
import { IconListTile } from '../../../../components/IconListTile/IconListTile.js';
|
|
42
43
|
import '../../../../components/Popper/Popper/Popper.js';
|
|
43
44
|
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
44
45
|
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
@@ -48,7 +49,7 @@ import { WalletSimpleSignIn } from './WalletSimpleSignIn/WalletSimpleSignIn.js';
|
|
|
48
49
|
|
|
49
50
|
const WalletSignInSection = ({ numberOfItensToShow, isLoading, onSubmit, }) => {
|
|
50
51
|
const { t } = useTranslation();
|
|
51
|
-
return numberOfItensToShow > 0 ? (jsx(WalletSimpleSignIn, { previewWalletsNumber: numberOfItensToShow, onshowAllWallets: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), disabled: isLoading })) : (jsx(
|
|
52
|
+
return numberOfItensToShow > 0 ? (jsx(WalletSimpleSignIn, { previewWalletsNumber: numberOfItensToShow, onshowAllWallets: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), disabled: isLoading })) : (jsx(IconListTile, Object.assign({ onClick: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), disabled: isLoading, className: 'connect-with-wallet-button' }, { children: jsx(Typography, Object.assign({ variant: 'button_primary' }, { children: t('dyn_login.wallet_list.button_only') })) })));
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
export { WalletSignInSection };
|
|
@@ -39,17 +39,19 @@ const useLoginView = () => {
|
|
|
39
39
|
type: sdkApi.SdkViewSectionType.Email,
|
|
40
40
|
},
|
|
41
41
|
];
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
42
|
+
const enabledProviders = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _a === void 0 ? void 0 : _a.providers) === null || _b === void 0 ? void 0 : _b.filter((provider) => provider.enabled);
|
|
43
|
+
if (enabledProviders === null || enabledProviders === void 0 ? void 0 : enabledProviders.length) {
|
|
44
44
|
loginViewSections.push({
|
|
45
|
-
numOfItemsToDisplay:
|
|
45
|
+
numOfItemsToDisplay: 5,
|
|
46
46
|
type: sdkApi.SdkViewSectionType.Social,
|
|
47
47
|
});
|
|
48
48
|
if ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _c === void 0 ? void 0 : _c.splitEmailAndSocial) {
|
|
49
49
|
loginViewSections.splice(1, 0, {
|
|
50
|
-
label: t('dyn_login.separators.
|
|
50
|
+
label: t('dyn_login.separators.default'),
|
|
51
51
|
type: sdkApi.SdkViewSectionType.Separator,
|
|
52
52
|
});
|
|
53
|
+
loginViewSections[loginViewSections.length - 1].defaultItem =
|
|
54
|
+
enabledProviders[0].provider;
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
if ((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _d === void 0 ? void 0 : _d.socialAboveEmail) {
|
|
@@ -79,12 +81,9 @@ const useLoginView = () => {
|
|
|
79
81
|
!((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
80
82
|
return [];
|
|
81
83
|
}
|
|
82
|
-
const label = loginItem === 'email'
|
|
83
|
-
? t('dyn_login.separators.email_or_wallets')
|
|
84
|
-
: t('dyn_login.separators.wallets_or_email');
|
|
85
84
|
return [
|
|
86
85
|
{
|
|
87
|
-
label,
|
|
86
|
+
label: t('dyn_login.separators.default'),
|
|
88
87
|
type: sdkApi.SdkViewSectionType.Separator,
|
|
89
88
|
},
|
|
90
89
|
];
|
|
@@ -100,7 +99,7 @@ const useLoginView = () => {
|
|
|
100
99
|
if (loginItem === 'email' && ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
101
100
|
loginViewSections = loginViewSections.concat(getEmailViewSectionDefinition(),
|
|
102
101
|
// add separator if wallets defined
|
|
103
|
-
addSeparator(index
|
|
102
|
+
addSeparator(index));
|
|
104
103
|
}
|
|
105
104
|
if (loginItem === 'wallet' && (wallets === null || wallets === void 0 ? void 0 : wallets.length)) {
|
|
106
105
|
// if showWalletsButton is true, it should show "Connec with Wallet" button
|
|
@@ -114,7 +113,7 @@ const useLoginView = () => {
|
|
|
114
113
|
},
|
|
115
114
|
],
|
|
116
115
|
// add separator if email providers defined
|
|
117
|
-
addSeparator(index
|
|
116
|
+
addSeparator(index));
|
|
118
117
|
}
|
|
119
118
|
});
|
|
120
119
|
return loginViewSections;
|
|
@@ -35,17 +35,19 @@ const useLoginView = () => {
|
|
|
35
35
|
type: SdkViewSectionType.Email,
|
|
36
36
|
},
|
|
37
37
|
];
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
38
|
+
const enabledProviders = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _a === void 0 ? void 0 : _a.providers) === null || _b === void 0 ? void 0 : _b.filter((provider) => provider.enabled);
|
|
39
|
+
if (enabledProviders === null || enabledProviders === void 0 ? void 0 : enabledProviders.length) {
|
|
40
40
|
loginViewSections.push({
|
|
41
|
-
numOfItemsToDisplay:
|
|
41
|
+
numOfItemsToDisplay: 5,
|
|
42
42
|
type: SdkViewSectionType.Social,
|
|
43
43
|
});
|
|
44
44
|
if ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _c === void 0 ? void 0 : _c.splitEmailAndSocial) {
|
|
45
45
|
loginViewSections.splice(1, 0, {
|
|
46
|
-
label: t('dyn_login.separators.
|
|
46
|
+
label: t('dyn_login.separators.default'),
|
|
47
47
|
type: SdkViewSectionType.Separator,
|
|
48
48
|
});
|
|
49
|
+
loginViewSections[loginViewSections.length - 1].defaultItem =
|
|
50
|
+
enabledProviders[0].provider;
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
if ((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _d === void 0 ? void 0 : _d.socialAboveEmail) {
|
|
@@ -75,12 +77,9 @@ const useLoginView = () => {
|
|
|
75
77
|
!((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
76
78
|
return [];
|
|
77
79
|
}
|
|
78
|
-
const label = loginItem === 'email'
|
|
79
|
-
? t('dyn_login.separators.email_or_wallets')
|
|
80
|
-
: t('dyn_login.separators.wallets_or_email');
|
|
81
80
|
return [
|
|
82
81
|
{
|
|
83
|
-
label,
|
|
82
|
+
label: t('dyn_login.separators.default'),
|
|
84
83
|
type: SdkViewSectionType.Separator,
|
|
85
84
|
},
|
|
86
85
|
];
|
|
@@ -96,7 +95,7 @@ const useLoginView = () => {
|
|
|
96
95
|
if (loginItem === 'email' && ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
97
96
|
loginViewSections = loginViewSections.concat(getEmailViewSectionDefinition(),
|
|
98
97
|
// add separator if wallets defined
|
|
99
|
-
addSeparator(index
|
|
98
|
+
addSeparator(index));
|
|
100
99
|
}
|
|
101
100
|
if (loginItem === 'wallet' && (wallets === null || wallets === void 0 ? void 0 : wallets.length)) {
|
|
102
101
|
// if showWalletsButton is true, it should show "Connec with Wallet" button
|
|
@@ -110,7 +109,7 @@ const useLoginView = () => {
|
|
|
110
109
|
},
|
|
111
110
|
],
|
|
112
111
|
// add separator if email providers defined
|
|
113
|
-
addSeparator(index
|
|
112
|
+
addSeparator(index));
|
|
114
113
|
}
|
|
115
114
|
});
|
|
116
115
|
return loginViewSections;
|