@dynamic-labs/sdk-react-core 0.19.0-alpha.3 → 0.19.0-alpha.5

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +9 -9
  5. package/src/lib/components/DynamicConnectButton/DynamicConnectButton.cjs +2 -14
  6. package/src/lib/components/DynamicConnectButton/DynamicConnectButton.js +2 -14
  7. package/src/lib/components/MenuList/Dropdown/Dropdown.cjs +1 -1
  8. package/src/lib/components/MenuList/Dropdown/Dropdown.js +1 -1
  9. package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.cjs +2 -0
  10. package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.d.ts +1 -1
  11. package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.js +2 -0
  12. package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +1 -1
  13. package/src/lib/components/OTPVerificationView/OTPVerificationView.js +1 -1
  14. package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -1
  15. package/src/lib/context/DynamicContext/DynamicContext.js +1 -1
  16. package/src/lib/context/DynamicContext/helpers.cjs +5 -6
  17. package/src/lib/context/DynamicContext/helpers.d.ts +2 -2
  18. package/src/lib/context/DynamicContext/helpers.js +5 -6
  19. package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
  20. package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.cjs +2 -1
  21. package/src/lib/layout/DynamicAuthLayout/HelpContent/HelpContent.js +2 -1
  22. package/src/lib/main.global.cjs +1 -1
  23. package/src/lib/main.global.js +1 -1
  24. package/src/lib/shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.cjs +28 -2
  25. package/src/lib/shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.js +28 -2
  26. package/src/lib/styles/index.shadow.cjs +1 -1
  27. package/src/lib/styles/index.shadow.js +1 -1
  28. package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.cjs +6 -0
  29. package/src/lib/utils/functions/getDynamicLayoutData/getDynamicLayoutData.js +6 -0
  30. package/src/lib/utils/functions/isEmailProviderEnabled/isEmailProviderEnabled.cjs +7 -1
  31. package/src/lib/utils/functions/isEmailProviderEnabled/isEmailProviderEnabled.js +7 -1
  32. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +8 -2
  33. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +9 -3
  34. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +4 -0
  35. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +4 -0
  36. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +7 -5
  37. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +7 -5
  38. package/src/lib/views/AccountExistsView/AccountExistsView.cjs +2 -2
  39. package/src/lib/views/AccountExistsView/AccountExistsView.js +2 -2
  40. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +1 -1
  41. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +1 -1
  42. package/src/lib/views/LoginView/LoginView.cjs +70 -0
  43. package/src/lib/views/LoginView/LoginView.d.ts +2 -0
  44. package/src/lib/views/LoginView/LoginView.js +66 -0
  45. package/src/lib/views/{LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs → LoginView/components/EmailSignIn/LoginEmailForm.cjs} +11 -12
  46. package/src/lib/views/LoginView/components/EmailSignIn/LoginEmailForm.d.ts +8 -0
  47. package/src/lib/views/{LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js → LoginView/components/EmailSignIn/LoginEmailForm.js} +11 -12
  48. package/src/lib/views/LoginView/components/EmailSignIn/index.d.ts +1 -0
  49. package/src/lib/views/LoginView/components/LoginWidget.d.ts +5 -0
  50. package/src/lib/views/LoginView/components/WalletSignIn/ListItemButton/ListItemButton.cjs +65 -0
  51. package/src/lib/views/{LoginWithEmailView/components → LoginView/components/WalletSignIn}/ListItemButton/ListItemButton.d.ts +2 -1
  52. package/src/lib/views/LoginView/components/WalletSignIn/ListItemButton/ListItemButton.js +61 -0
  53. package/src/lib/views/{LoginWithEmailView/components/ListItemButton/ListItemButton.cjs → LoginView/components/WalletSignIn/WalletSignIn.cjs} +7 -19
  54. package/src/lib/views/LoginView/components/WalletSignIn/WalletSignIn.d.ts +7 -0
  55. package/src/lib/views/{LoginWithEmailView/components/ListItemButton/ListItemButton.js → LoginView/components/WalletSignIn/WalletSignIn.js} +8 -20
  56. package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.cjs +47 -0
  57. package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.d.ts +8 -0
  58. package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/WalletSimpleSignIn.js +43 -0
  59. package/src/lib/views/LoginView/components/WalletSignIn/WalletSimpleSignIn/index.d.ts +1 -0
  60. package/src/lib/views/LoginView/components/WalletSignIn/index.d.ts +1 -0
  61. package/src/lib/views/LoginView/components/index.d.ts +3 -0
  62. package/src/lib/views/LoginView/index.d.ts +1 -0
  63. package/src/lib/views/LoginView/useLoginView.cjs +137 -0
  64. package/src/lib/views/LoginView/useLoginView.d.ts +6 -0
  65. package/src/lib/views/LoginView/useLoginView.js +132 -0
  66. package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +1 -0
  67. package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +1 -0
  68. package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +3 -3
  69. package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +3 -3
  70. package/src/lib/views/WalletList/WalletListItem/WalletListItem.types.d.ts +1 -0
  71. package/src/lib/views/viewToComponentMap.cjs +4 -3
  72. package/src/lib/views/viewToComponentMap.js +4 -3
  73. package/src/lib/views/LoginWithEmailView/LoginWithEmailView.cjs +0 -63
  74. package/src/lib/views/LoginWithEmailView/LoginWithEmailView.d.ts +0 -2
  75. package/src/lib/views/LoginWithEmailView/LoginWithEmailView.js +0 -59
  76. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.d.ts +0 -7
  77. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/index.d.ts +0 -1
  78. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.cjs +0 -36
  79. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.d.ts +0 -9
  80. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.js +0 -31
  81. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/index.d.ts +0 -1
  82. package/src/lib/views/LoginWithEmailView/index.d.ts +0 -1
  83. /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/SocialSignIn.cjs +0 -0
  84. /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/SocialSignIn.d.ts +0 -0
  85. /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/SocialSignIn.js +0 -0
  86. /package/src/lib/views/{LoginWithEmailView → LoginView}/components/SocialSignIn/index.d.ts +0 -0
  87. /package/src/lib/views/{LoginWithEmailView/components → LoginView/components/WalletSignIn}/ListItemButton/index.d.ts +0 -0
@@ -13,7 +13,8 @@ const useAuthLayoutChecks = (walletConnector) => {
13
13
  const { helpHeaderData } = getDynamicLayoutData({ view });
14
14
  const isWalletListTypeView = view === 'wallet-connect-mobile-wallets-list' ||
15
15
  view === 'wallet-list' ||
16
- view === 'login-with-email-or-wallet-full-wallet-list';
16
+ view === 'login-with-email-or-wallet-full-wallet-list' ||
17
+ view === 'login-with-wallet-only';
17
18
  const showHelpContent = Boolean(helpHeaderData &&
18
19
  // Notice the negation here
19
20
  !((view === 'qr-code' && !(walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.canConnectViaQrCode)) ||
@@ -47,13 +48,14 @@ const useAuthLayoutChecks = (walletConnector) => {
47
48
  const showToSFooter = Boolean(!isUserLinkingWallet(user, view, mockedSDK) &&
48
49
  (view === 'wallet-list' ||
49
50
  view === 'wallet-connect-mobile-wallets-list' ||
50
- // Don't show empty footer on login-with-email-or-wallet-full-wallet-list
51
- (view === 'login-with-email-or-wallet' &&
51
+ // Don't show empty footer during the login
52
+ ((view === 'login-with-email-or-wallet' ||
53
+ view === 'login-with-email-or-wallet-full-wallet-list' ||
54
+ view === 'login-with-wallet-only') &&
52
55
  (termsOfServiceUrl ||
53
56
  privacyPolicyUrl ||
54
57
  customPrivacyPolicy ||
55
- customTermsOfServices)) ||
56
- view === 'login-with-email-or-wallet-full-wallet-list'));
58
+ customTermsOfServices))));
57
59
  const showCloseButton = view !== 'login-with-email-or-wallet-full-wallet-list' &&
58
60
  view !== 'login-with-email-verification';
59
61
  const showBackButton = view === 'qr-code' ||
@@ -53,7 +53,7 @@ require('../../components/InlineWidget/InlineWidget.cjs');
53
53
  require('../../components/MenuList/Dropdown/Dropdown.cjs');
54
54
  var capitalize = require('../../shared/utils/functions/capitalize/capitalize.cjs');
55
55
  var SocialRedirectContext = require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
56
- var LoginWithEmailForm = require('../LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs');
56
+ var LoginEmailForm = require('../LoginView/components/EmailSignIn/LoginEmailForm.cjs');
57
57
 
58
58
  const AccountExistsView = () => {
59
59
  const { existentAccountData } = AccountExistsContext.useAccountExistsContext();
@@ -71,7 +71,7 @@ const AccountExistsView = () => {
71
71
  : '. Please log in with your email.';
72
72
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: ["It looks like an account already exists using ", jsxRuntime.jsx("strong", { children: email }), '', messageTrail] }));
73
73
  };
74
- 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 === embeddedSocialSigninProvider, 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(LoginWithEmailForm.LoginWithEmailForm, { currentEmail: email }))] }))] })));
74
+ 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 === embeddedSocialSigninProvider, 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 }))] }))] })));
75
75
  };
76
76
 
77
77
  exports.AccountExistsView = AccountExistsView;
@@ -49,7 +49,7 @@ import '../../components/InlineWidget/InlineWidget.js';
49
49
  import '../../components/MenuList/Dropdown/Dropdown.js';
50
50
  import { capitalize } from '../../shared/utils/functions/capitalize/capitalize.js';
51
51
  import { useSocialRedirectContext } from '../../context/SocialRedirectContext/SocialRedirectContext.js';
52
- import { LoginWithEmailForm } from '../LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js';
52
+ import { LoginEmailForm } from '../LoginView/components/EmailSignIn/LoginEmailForm.js';
53
53
 
54
54
  const AccountExistsView = () => {
55
55
  const { existentAccountData } = useAccountExistsContext();
@@ -67,7 +67,7 @@ const AccountExistsView = () => {
67
67
  : '. Please log in with your email.';
68
68
  return (jsxs(Fragment, { children: ["It looks like an account already exists using ", jsx("strong", { children: email }), '', messageTrail] }));
69
69
  };
70
- 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 === embeddedSocialSigninProvider, iconSize: 32 }), jsxs(Typography, Object.assign({ variant: 'button_primary' }, { children: ["Connect with", ' ', capitalize(embeddedSocialSigninProvider === null || embeddedSocialSigninProvider === void 0 ? void 0 : embeddedSocialSigninProvider.toString())] }))] }), embeddedSocialSigninProvider)) : (jsx(LoginWithEmailForm, { currentEmail: email }))] }))] })));
70
+ 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 === embeddedSocialSigninProvider, 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 }))] }))] })));
71
71
  };
72
72
 
73
73
  export { AccountExistsView };
@@ -69,7 +69,7 @@ const EmailWalletOTPVerificationView = () => {
69
69
  const { data: isValid, isLoading, mutate: onSubmit, } = useMutation.useMutation((otp) => emailWalletConnector.verifyOneTimePassword(otp), {
70
70
  onFailure: (error) => setError(error),
71
71
  });
72
- return (jsxRuntime.jsx(OTPVerificationView.OTPVerificationView, { email: email, error: error, onClickBack: handleBackClick, isLoading: isLoading, onPinComplete: onSubmit, isValid: isValid === true, onPinChange: () => setError(undefined), onClickClose: handleOnClickClose, onClickEditEmail: handleBackClick, displayPoweredByDynamic: true, successBannerText: 'By signing in, you will access a wallet that is only associated to this email.' }));
72
+ return (jsxRuntime.jsx(OTPVerificationView.OTPVerificationView, { email: email, error: error, onClickBack: handleBackClick, isLoading: isLoading, onPinComplete: onSubmit, isValid: isValid === true, onPinChange: () => setError(undefined), onClickClose: handleOnClickClose, onClickEditEmail: handleBackClick, displayPoweredByDynamic: true, successBannerText: 'Sign in to access your email based wallet' }));
73
73
  };
74
74
 
75
75
  exports.EmailWalletOTPVerificationView = EmailWalletOTPVerificationView;
@@ -65,7 +65,7 @@ const EmailWalletOTPVerificationView = () => {
65
65
  const { data: isValid, isLoading, mutate: onSubmit, } = useMutation((otp) => emailWalletConnector.verifyOneTimePassword(otp), {
66
66
  onFailure: (error) => setError(error),
67
67
  });
68
- return (jsx(OTPVerificationView, { email: email, error: error, onClickBack: handleBackClick, isLoading: isLoading, onPinComplete: onSubmit, isValid: isValid === true, onPinChange: () => setError(undefined), onClickClose: handleOnClickClose, onClickEditEmail: handleBackClick, displayPoweredByDynamic: true, successBannerText: 'By signing in, you will access a wallet that is only associated to this email.' }));
68
+ return (jsx(OTPVerificationView, { email: email, error: error, onClickBack: handleBackClick, isLoading: isLoading, onPinComplete: onSubmit, isValid: isValid === true, onPinChange: () => setError(undefined), onClickClose: handleOnClickClose, onClickEditEmail: handleBackClick, displayPoweredByDynamic: true, successBannerText: 'Sign in to access your email based wallet' }));
69
69
  };
70
70
 
71
71
  export { EmailWalletOTPVerificationView };
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
+ var Divider = require('../../components/Divider/Divider.cjs');
8
+ var ErrorContext = require('../../context/ErrorContext/ErrorContext.cjs');
9
+ var ErrorContainer = require('../../components/ErrorContainer/ErrorContainer.cjs');
10
+ var LoadingContext = require('../../context/LoadingContext/LoadingContext.cjs');
11
+ var useAuthLayoutChecks = require('../../utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs');
12
+ var classNames = require('../../utils/functions/classNames/classNames.cjs');
13
+ var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
14
+ var WalletList = require('../WalletList/WalletList.cjs');
15
+ var SocialSignIn = require('./components/SocialSignIn/SocialSignIn.cjs');
16
+ var WalletSignIn = require('./components/WalletSignIn/WalletSignIn.cjs');
17
+ var LoginEmailForm = require('./components/EmailSignIn/LoginEmailForm.cjs');
18
+ var useLoginView = require('./useLoginView.cjs');
19
+
20
+ const LoginView = () => {
21
+ const { error } = ErrorContext.useErrorContext();
22
+ const { loading } = LoadingContext.useLoadingContext();
23
+ const { showToSFooter } = useAuthLayoutChecks.useAuthLayoutChecks();
24
+ const { view, setView } = ViewContext.useViewContext();
25
+ const { isWalletOnly, logingViewSections } = useLoginView.useLoginView();
26
+ const [showWalletList, setShowWalletList] = React.useState(isWalletOnly);
27
+ const [isLoading, setIsLoading] = React.useState(loading);
28
+ React.useEffect(() => {
29
+ // toolkit log in with email was set to false
30
+ if (isWalletOnly) {
31
+ setView('login-with-wallet-only');
32
+ setShowWalletList(true);
33
+ }
34
+ // returning from 'View all wallets' button
35
+ if (!isWalletOnly && view === 'login-with-email-or-wallet') {
36
+ setShowWalletList(false);
37
+ }
38
+ // toolkit log in with email was set back to true
39
+ if (!isWalletOnly &&
40
+ (!showWalletList || view === 'login-with-wallet-only')) {
41
+ setView('login-with-email-or-wallet');
42
+ setShowWalletList(false);
43
+ }
44
+ }, [isWalletOnly, view]);
45
+ const renderViewSections = React.useMemo(() => logingViewSections.map((viewSection, index) => {
46
+ switch (viewSection.type) {
47
+ case 'separator':
48
+ return (jsxRuntime.jsx(Divider.Divider, { text: viewSection.label }, `${viewSection.type}_${index}`));
49
+ case 'email':
50
+ return (jsxRuntime.jsx(LoginEmailForm.LoginEmailForm, { onSubmit: () => setIsLoading(true), onSubmitError: () => setIsLoading(false), isLoading: isLoading }, `${viewSection.type}_${index}`));
51
+ case 'wallet':
52
+ return (jsxRuntime.jsx(WalletSignIn.WalletSignIn, { numberOfItensToShow: viewSection.numOfItemsToDisplay || 0, onSubmit: () => {
53
+ setView('login-with-email-or-wallet-full-wallet-list'); // this view is just to show the back button
54
+ setShowWalletList(true);
55
+ }, isLoading: isLoading }, `${viewSection.type}_${index}`));
56
+ case 'social':
57
+ return jsxRuntime.jsx(SocialSignIn.SocialSignIn, {}, `${viewSection.type}_${index}`);
58
+ default:
59
+ return;
60
+ }
61
+ }), [logingViewSections, isLoading, setView]);
62
+ if (showWalletList) {
63
+ return jsxRuntime.jsx(WalletList.WalletList, {});
64
+ }
65
+ return (jsxRuntime.jsxs("div", Object.assign({ className: 'login-with-email__container' }, { children: [error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), jsxRuntime.jsx("div", Object.assign({ className: classNames.classNames('login-with-email__scroll', {
66
+ 'login-with-email__scroll--with-footer': showToSFooter,
67
+ }), "data-testid": 'login-with-email-scroll' }, { children: renderViewSections }))] })));
68
+ };
69
+
70
+ exports.LoginView = LoginView;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const LoginView: () => JSX.Element;
@@ -0,0 +1,66 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useState, useEffect, useMemo } from 'react';
3
+ import { Divider } from '../../components/Divider/Divider.js';
4
+ import { useErrorContext } from '../../context/ErrorContext/ErrorContext.js';
5
+ import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
6
+ import { useLoadingContext } from '../../context/LoadingContext/LoadingContext.js';
7
+ import { useAuthLayoutChecks } from '../../utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js';
8
+ import { classNames } from '../../utils/functions/classNames/classNames.js';
9
+ import { useViewContext } from '../../context/ViewContext/ViewContext.js';
10
+ import { WalletList } from '../WalletList/WalletList.js';
11
+ import { SocialSignIn } from './components/SocialSignIn/SocialSignIn.js';
12
+ import { WalletSignIn } from './components/WalletSignIn/WalletSignIn.js';
13
+ import { LoginEmailForm } from './components/EmailSignIn/LoginEmailForm.js';
14
+ import { useLoginView } from './useLoginView.js';
15
+
16
+ const LoginView = () => {
17
+ const { error } = useErrorContext();
18
+ const { loading } = useLoadingContext();
19
+ const { showToSFooter } = useAuthLayoutChecks();
20
+ const { view, setView } = useViewContext();
21
+ const { isWalletOnly, logingViewSections } = useLoginView();
22
+ const [showWalletList, setShowWalletList] = useState(isWalletOnly);
23
+ const [isLoading, setIsLoading] = useState(loading);
24
+ useEffect(() => {
25
+ // toolkit log in with email was set to false
26
+ if (isWalletOnly) {
27
+ setView('login-with-wallet-only');
28
+ setShowWalletList(true);
29
+ }
30
+ // returning from 'View all wallets' button
31
+ if (!isWalletOnly && view === 'login-with-email-or-wallet') {
32
+ setShowWalletList(false);
33
+ }
34
+ // toolkit log in with email was set back to true
35
+ if (!isWalletOnly &&
36
+ (!showWalletList || view === 'login-with-wallet-only')) {
37
+ setView('login-with-email-or-wallet');
38
+ setShowWalletList(false);
39
+ }
40
+ }, [isWalletOnly, view]);
41
+ const renderViewSections = useMemo(() => logingViewSections.map((viewSection, index) => {
42
+ switch (viewSection.type) {
43
+ case 'separator':
44
+ return (jsx(Divider, { text: viewSection.label }, `${viewSection.type}_${index}`));
45
+ case 'email':
46
+ return (jsx(LoginEmailForm, { onSubmit: () => setIsLoading(true), onSubmitError: () => setIsLoading(false), isLoading: isLoading }, `${viewSection.type}_${index}`));
47
+ case 'wallet':
48
+ return (jsx(WalletSignIn, { numberOfItensToShow: viewSection.numOfItemsToDisplay || 0, onSubmit: () => {
49
+ setView('login-with-email-or-wallet-full-wallet-list'); // this view is just to show the back button
50
+ setShowWalletList(true);
51
+ }, isLoading: isLoading }, `${viewSection.type}_${index}`));
52
+ case 'social':
53
+ return jsx(SocialSignIn, {}, `${viewSection.type}_${index}`);
54
+ default:
55
+ return;
56
+ }
57
+ }), [logingViewSections, isLoading, setView]);
58
+ if (showWalletList) {
59
+ return jsx(WalletList, {});
60
+ }
61
+ return (jsxs("div", Object.assign({ className: 'login-with-email__container' }, { children: [error && jsx(ErrorContainer, { children: error }), jsx("div", Object.assign({ className: classNames('login-with-email__scroll', {
62
+ 'login-with-email__scroll--with-footer': showToSFooter,
63
+ }), "data-testid": 'login-with-email-scroll' }, { children: renderViewSections }))] })));
64
+ };
65
+
66
+ export { LoginView };
@@ -48,14 +48,12 @@ require('../../../../components/Popper/Popper/Popper.cjs');
48
48
  require('../../../../components/Popper/PopperContext/PopperContext.cjs');
49
49
  require('../../../../components/InlineWidget/InlineWidget.cjs');
50
50
  require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
51
- var LoadingContext = require('../../../../context/LoadingContext/LoadingContext.cjs');
52
51
  var useEmailProvider = require('../../../../utils/hooks/useEmailProvider/useEmailProvider.cjs');
53
52
 
54
53
  const EMAIL_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
55
- const LoginWithEmailForm = ({ currentEmail }) => {
54
+ const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError, currentEmail, }) => {
56
55
  var _a;
57
56
  const { environmentId, wallets, projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
58
- const { loading, setLoading } = LoadingContext.useLoadingContext();
59
57
  const { setErrorMessage } = ErrorContext.useErrorContext();
60
58
  const [emailInput, setEmailInput] = React.useState(currentEmail !== null && currentEmail !== void 0 ? currentEmail : '');
61
59
  const [emailError, setEmailError] = React.useState(false);
@@ -65,13 +63,12 @@ const LoginWithEmailForm = ({ currentEmail }) => {
65
63
  const { handleEmailOnlyLoginSubmit, submitEmail, isEmailProviderLoading } = useEmailProvider.useEmailProvider({
66
64
  emailWalletConnector,
67
65
  });
68
- const isLoading = React.useMemo(() => isEmailProviderLoading || loading, [isEmailProviderLoading, loading]);
66
+ const isLoading = React.useMemo(() => isEmailProviderLoading || isExternalLoading, [isEmailProviderLoading, isExternalLoading]);
69
67
  const handleEmailOnChangeEvent = (event) => {
70
68
  const { value } = event.currentTarget;
71
69
  setEmailInput(value);
72
70
  };
73
71
  const isInjectedWalletProviderEnabled = emailWalletConnector !== undefined;
74
- const onChangeHandler = handleEmailOnChangeEvent;
75
72
  const emailInputSuffixIcon = (jsxRuntime.jsx(IconButton.IconButton, Object.assign({ "data-testid": 'email_submit_button', type: 'submit', className: `icon-button${((_a = emailInput === null || emailInput === void 0 ? void 0 : emailInput.trim()) === null || _a === void 0 ? void 0 : _a.length) ? '--visible' : ''}`, disabled: isLoading }, { children: jsxRuntime.jsx(arrowRight.ReactComponent, {}) })));
76
73
  const handleSubmit = (e) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
77
74
  e.preventDefault();
@@ -80,7 +77,7 @@ const LoginWithEmailForm = ({ currentEmail }) => {
80
77
  return;
81
78
  }
82
79
  try {
83
- setLoading(true);
80
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
84
81
  if (isInjectedWalletProviderEnabled &&
85
82
  (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.confirmEmailProviderForVerify)) {
86
83
  // see: https://linear.app/dynamic-labs/issue/DYN-2517
@@ -89,7 +86,11 @@ const LoginWithEmailForm = ({ currentEmail }) => {
89
86
  email: emailInput,
90
87
  environmentId,
91
88
  });
92
- if (emailProvider === sdkApi.ProviderEnum.EmailOnly) {
89
+ // For v0.19 we will support emailOnly and Dynamic as email providers
90
+ // For v0.20/v1 we need to remove emailOnly and leave Dynamic as the only one email provider
91
+ // Ticket: https://linear.app/dynamic-labs/issue/GVTY-213/remove-emailonly-as-a-provider-from-sdk
92
+ if (emailProvider === sdkApi.ProviderEnum.EmailOnly ||
93
+ emailProvider === sdkApi.ProviderEnum.Dynamic) {
93
94
  yield handleEmailOnlyLoginSubmit(emailInput);
94
95
  return;
95
96
  }
@@ -99,14 +100,12 @@ const LoginWithEmailForm = ({ currentEmail }) => {
99
100
  catch (error) {
100
101
  logger.logger.debug(error);
101
102
  setErrorMessage(error.code);
102
- }
103
- finally {
104
- setLoading(false);
103
+ onSubmitError === null || onSubmitError === void 0 ? void 0 : onSubmitError();
105
104
  }
106
105
  });
107
106
  // social sign in currently coupled to email... might be better to decouple
108
- return (jsxRuntime.jsx("form", Object.assign({ className: 'login-with-email-form', onSubmit: (e) => handleSubmit(e) }, { children: jsxRuntime.jsx(Input.Input, { id: 'email_field', value: emailInput, onChange: onChangeHandler, label: 'Enter your email', error: emailError, message: emailError && 'Please enter a valid email address', suffix: emailInputSuffixIcon }) })));
107
+ return (jsxRuntime.jsx("form", Object.assign({ className: 'login-with-email-form', onSubmit: (e) => handleSubmit(e) }, { children: jsxRuntime.jsx(Input.Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, label: 'Enter your email', error: emailError, message: emailError && 'Please enter a valid email address', suffix: emailInputSuffixIcon, disabled: isLoading }) })));
109
108
  };
110
109
 
111
110
  exports.EMAIL_REGEX = EMAIL_REGEX;
112
- exports.LoginWithEmailForm = LoginWithEmailForm;
111
+ exports.LoginEmailForm = LoginEmailForm;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { LoginWidgetProps } from '../LoginWidget';
3
+ export declare const EMAIL_REGEX: RegExp;
4
+ interface Props extends LoginWidgetProps {
5
+ currentEmail?: string;
6
+ }
7
+ export declare const LoginEmailForm: React.FC<Props>;
8
+ export {};
@@ -44,14 +44,12 @@ import '../../../../components/Popper/Popper/Popper.js';
44
44
  import '../../../../components/Popper/PopperContext/PopperContext.js';
45
45
  import '../../../../components/InlineWidget/InlineWidget.js';
46
46
  import '../../../../components/MenuList/Dropdown/Dropdown.js';
47
- import { useLoadingContext } from '../../../../context/LoadingContext/LoadingContext.js';
48
47
  import { useEmailProvider } from '../../../../utils/hooks/useEmailProvider/useEmailProvider.js';
49
48
 
50
49
  const EMAIL_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
51
- const LoginWithEmailForm = ({ currentEmail }) => {
50
+ const LoginEmailForm = ({ isLoading: isExternalLoading, onSubmit, onSubmitError, currentEmail, }) => {
52
51
  var _a;
53
52
  const { environmentId, wallets, projectSettings } = useInternalDynamicContext();
54
- const { loading, setLoading } = useLoadingContext();
55
53
  const { setErrorMessage } = useErrorContext();
56
54
  const [emailInput, setEmailInput] = useState(currentEmail !== null && currentEmail !== void 0 ? currentEmail : '');
57
55
  const [emailError, setEmailError] = useState(false);
@@ -61,13 +59,12 @@ const LoginWithEmailForm = ({ currentEmail }) => {
61
59
  const { handleEmailOnlyLoginSubmit, submitEmail, isEmailProviderLoading } = useEmailProvider({
62
60
  emailWalletConnector,
63
61
  });
64
- const isLoading = useMemo(() => isEmailProviderLoading || loading, [isEmailProviderLoading, loading]);
62
+ const isLoading = useMemo(() => isEmailProviderLoading || isExternalLoading, [isEmailProviderLoading, isExternalLoading]);
65
63
  const handleEmailOnChangeEvent = (event) => {
66
64
  const { value } = event.currentTarget;
67
65
  setEmailInput(value);
68
66
  };
69
67
  const isInjectedWalletProviderEnabled = emailWalletConnector !== undefined;
70
- const onChangeHandler = handleEmailOnChangeEvent;
71
68
  const emailInputSuffixIcon = (jsx(IconButton, Object.assign({ "data-testid": 'email_submit_button', type: 'submit', className: `icon-button${((_a = emailInput === null || emailInput === void 0 ? void 0 : emailInput.trim()) === null || _a === void 0 ? void 0 : _a.length) ? '--visible' : ''}`, disabled: isLoading }, { children: jsx(SvgArrowRight, {}) })));
72
69
  const handleSubmit = (e) => __awaiter(void 0, void 0, void 0, function* () {
73
70
  e.preventDefault();
@@ -76,7 +73,7 @@ const LoginWithEmailForm = ({ currentEmail }) => {
76
73
  return;
77
74
  }
78
75
  try {
79
- setLoading(true);
76
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
80
77
  if (isInjectedWalletProviderEnabled &&
81
78
  (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.confirmEmailProviderForVerify)) {
82
79
  // see: https://linear.app/dynamic-labs/issue/DYN-2517
@@ -85,7 +82,11 @@ const LoginWithEmailForm = ({ currentEmail }) => {
85
82
  email: emailInput,
86
83
  environmentId,
87
84
  });
88
- if (emailProvider === ProviderEnum.EmailOnly) {
85
+ // For v0.19 we will support emailOnly and Dynamic as email providers
86
+ // For v0.20/v1 we need to remove emailOnly and leave Dynamic as the only one email provider
87
+ // Ticket: https://linear.app/dynamic-labs/issue/GVTY-213/remove-emailonly-as-a-provider-from-sdk
88
+ if (emailProvider === ProviderEnum.EmailOnly ||
89
+ emailProvider === ProviderEnum.Dynamic) {
89
90
  yield handleEmailOnlyLoginSubmit(emailInput);
90
91
  return;
91
92
  }
@@ -95,13 +96,11 @@ const LoginWithEmailForm = ({ currentEmail }) => {
95
96
  catch (error) {
96
97
  logger.debug(error);
97
98
  setErrorMessage(error.code);
98
- }
99
- finally {
100
- setLoading(false);
99
+ onSubmitError === null || onSubmitError === void 0 ? void 0 : onSubmitError();
101
100
  }
102
101
  });
103
102
  // social sign in currently coupled to email... might be better to decouple
104
- return (jsx("form", Object.assign({ className: 'login-with-email-form', onSubmit: (e) => handleSubmit(e) }, { children: jsx(Input, { id: 'email_field', value: emailInput, onChange: onChangeHandler, label: 'Enter your email', error: emailError, message: emailError && 'Please enter a valid email address', suffix: emailInputSuffixIcon }) })));
103
+ return (jsx("form", Object.assign({ className: 'login-with-email-form', onSubmit: (e) => handleSubmit(e) }, { children: jsx(Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, label: 'Enter your email', error: emailError, message: emailError && 'Please enter a valid email address', suffix: emailInputSuffixIcon, disabled: isLoading }) })));
105
104
  };
106
105
 
107
- export { EMAIL_REGEX, LoginWithEmailForm };
106
+ export { EMAIL_REGEX, LoginEmailForm };
@@ -0,0 +1 @@
1
+ export { LoginEmailForm } from './LoginEmailForm';
@@ -0,0 +1,5 @@
1
+ export interface LoginWidgetProps {
2
+ onSubmit?: () => void;
3
+ onSubmitError?: () => void;
4
+ isLoading: boolean;
5
+ }
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
+ require('@dynamic-labs/iconic');
8
+ require('../../../../../context/ViewContext/ViewContext.cjs');
9
+ var stroke = require('../../../../../shared/assets/stroke.cjs');
10
+ var classNames = require('../../../../../utils/functions/classNames/classNames.cjs');
11
+ require('@dynamic-labs/sdk-api');
12
+ require('../../../../../shared/logger.cjs');
13
+ require('@dynamic-labs/wallet-connector-core');
14
+ require('@dynamic-labs/wallet-book');
15
+ require('@dynamic-labs/utils');
16
+ require('../../../../../utils/constants/colors.cjs');
17
+ require('../../../../../shared/utils/classes/storage/localStorage.cjs');
18
+ require('ethers');
19
+ require('../../../../../shared/consts/index.cjs');
20
+ require('../../../../../context/DynamicContext/DynamicContext.cjs');
21
+ require('@dynamic-labs/multi-wallet');
22
+ require('../../../../../components/ShadowDOM/ShadowDOM.cjs');
23
+ require('../../../../../context/ThemeContext/ThemeContext.cjs');
24
+ var Icon = require('../../../../../components/Icon/Icon.cjs');
25
+ require('react-dom');
26
+ require('react-focus-lock');
27
+ require('../../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
28
+ require('../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
29
+ require('../../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
30
+ require('../../../../../config/ApiEndpoint.cjs');
31
+ require('@dynamic-labs/rpc-providers');
32
+ require('../../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
33
+ require('../../../../../context/ErrorContext/ErrorContext.cjs');
34
+ require('../../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
35
+ require('../../../../../context/AccountExistsContext/AccountExistsContext.cjs');
36
+ require('../../../../../components/IconButton/IconButton.cjs');
37
+ require('../../../../../components/Alert/Alert.cjs');
38
+ require('formik');
39
+ require('yup');
40
+ require('../../../../CollectUserDataView/fieldsConfig.cjs');
41
+ require('../../../../../context/MockContext/MockContext.cjs');
42
+ require('../../../../../context/CaptchaContext/CaptchaContext.cjs');
43
+ require('../../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
44
+ require('@dynamic-labs/types');
45
+ require('../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
46
+ require('../../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
47
+ var ListTile = require('../../../../../components/ListTile/ListTile.cjs');
48
+ require('../../../../../components/Popper/Popper/Popper.cjs');
49
+ require('../../../../../components/Popper/PopperContext/PopperContext.cjs');
50
+ require('../../../../../components/InlineWidget/InlineWidget.cjs');
51
+ require('../../../../../components/MenuList/Dropdown/Dropdown.cjs');
52
+ var Badge = require('../../../../../components/Badge/Badge.cjs');
53
+
54
+ const ListItemButton = ({ text, onClick, numberOfWallets, disabled = false, }) => {
55
+ const numberOfWalletsText = React.useMemo(() => {
56
+ if (numberOfWallets <= 10) {
57
+ return numberOfWallets;
58
+ }
59
+ return `+${Math.floor(numberOfWallets / 10) * 10}`;
60
+ }, [numberOfWallets]);
61
+ const trailing = (jsxRuntime.jsxs("div", Object.assign({ className: 'list-item-button__trailing' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: classNames.classNames('list-item-button__trailing-child', 'list-item-button__trailing-label') }, { children: jsxRuntime.jsx(Badge.Badge, { text: `${numberOfWalletsText} available` }) })), jsxRuntime.jsx("div", Object.assign({ className: classNames.classNames('list-item-button__trailing-child', 'list-item-button__trailing-icon') }, { children: jsxRuntime.jsx(Icon.Icon, Object.assign({ color: 'text-primary', size: 'small' }, { children: jsxRuntime.jsx(stroke.ReactComponent, {}) })) }))] })));
62
+ return (jsxRuntime.jsx(ListTile.ListTile, Object.assign({ trailing: trailing, onClick: onClick, className: 'list-item-button', disabled: disabled }, { children: text })));
63
+ };
64
+
65
+ exports.ListItemButton = ListItemButton;
@@ -3,6 +3,7 @@ type Props = {
3
3
  numberOfWallets: number;
4
4
  onClick: VoidFunction;
5
5
  text: string;
6
+ disabled?: boolean;
6
7
  };
7
- export declare const ListItemButton: ({ text, onClick, numberOfWallets }: Props) => JSX.Element;
8
+ export declare const ListItemButton: ({ text, onClick, numberOfWallets, disabled, }: Props) => JSX.Element;
8
9
  export {};
@@ -0,0 +1,61 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import '@dynamic-labs/iconic';
4
+ import '../../../../../context/ViewContext/ViewContext.js';
5
+ import { ReactComponent as SvgStroke } from '../../../../../shared/assets/stroke.js';
6
+ import { classNames } from '../../../../../utils/functions/classNames/classNames.js';
7
+ import '@dynamic-labs/sdk-api';
8
+ import '../../../../../shared/logger.js';
9
+ import '@dynamic-labs/wallet-connector-core';
10
+ import '@dynamic-labs/wallet-book';
11
+ import '@dynamic-labs/utils';
12
+ import '../../../../../utils/constants/colors.js';
13
+ import '../../../../../shared/utils/classes/storage/localStorage.js';
14
+ import 'ethers';
15
+ import '../../../../../shared/consts/index.js';
16
+ import '../../../../../context/DynamicContext/DynamicContext.js';
17
+ import '@dynamic-labs/multi-wallet';
18
+ import '../../../../../components/ShadowDOM/ShadowDOM.js';
19
+ import '../../../../../context/ThemeContext/ThemeContext.js';
20
+ import { Icon } from '../../../../../components/Icon/Icon.js';
21
+ import 'react-dom';
22
+ import 'react-focus-lock';
23
+ import '../../../../../components/Transition/ZoomTransition/ZoomTransition.js';
24
+ import '../../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
25
+ import '../../../../../components/Transition/OpacityTransition/OpacityTransition.js';
26
+ import '../../../../../config/ApiEndpoint.js';
27
+ import '@dynamic-labs/rpc-providers';
28
+ import '../../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
29
+ import '../../../../../context/ErrorContext/ErrorContext.js';
30
+ import '../../../../../context/AccessDeniedContext/AccessDeniedContext.js';
31
+ import '../../../../../context/AccountExistsContext/AccountExistsContext.js';
32
+ import '../../../../../components/IconButton/IconButton.js';
33
+ import '../../../../../components/Alert/Alert.js';
34
+ import 'formik';
35
+ import 'yup';
36
+ import '../../../../CollectUserDataView/fieldsConfig.js';
37
+ import '../../../../../context/MockContext/MockContext.js';
38
+ import '../../../../../context/CaptchaContext/CaptchaContext.js';
39
+ import '../../../../../context/EmailVerificationContext/EmailVerificationContext.js';
40
+ import '@dynamic-labs/types';
41
+ import '../../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
42
+ import '../../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
43
+ import { ListTile } from '../../../../../components/ListTile/ListTile.js';
44
+ import '../../../../../components/Popper/Popper/Popper.js';
45
+ import '../../../../../components/Popper/PopperContext/PopperContext.js';
46
+ import '../../../../../components/InlineWidget/InlineWidget.js';
47
+ import '../../../../../components/MenuList/Dropdown/Dropdown.js';
48
+ import { Badge } from '../../../../../components/Badge/Badge.js';
49
+
50
+ const ListItemButton = ({ text, onClick, numberOfWallets, disabled = false, }) => {
51
+ const numberOfWalletsText = useMemo(() => {
52
+ if (numberOfWallets <= 10) {
53
+ return numberOfWallets;
54
+ }
55
+ return `+${Math.floor(numberOfWallets / 10) * 10}`;
56
+ }, [numberOfWallets]);
57
+ const trailing = (jsxs("div", Object.assign({ className: 'list-item-button__trailing' }, { children: [jsx("div", Object.assign({ className: classNames('list-item-button__trailing-child', 'list-item-button__trailing-label') }, { children: jsx(Badge, { text: `${numberOfWalletsText} available` }) })), jsx("div", Object.assign({ className: classNames('list-item-button__trailing-child', 'list-item-button__trailing-icon') }, { children: jsx(Icon, Object.assign({ color: 'text-primary', size: 'small' }, { children: jsx(SvgStroke, {}) })) }))] })));
58
+ return (jsx(ListTile, Object.assign({ trailing: trailing, onClick: onClick, className: 'list-item-button', disabled: disabled }, { children: text })));
59
+ };
60
+
61
+ export { ListItemButton };
@@ -3,14 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
- var React = require('react');
7
- require('@dynamic-labs/iconic');
8
- require('../../../../context/ViewContext/ViewContext.cjs');
9
- var stroke = require('../../../../shared/assets/stroke.cjs');
10
- var classNames = require('../../../../utils/functions/classNames/classNames.cjs');
6
+ require('react');
11
7
  require('@dynamic-labs/sdk-api');
12
8
  require('../../../../shared/logger.cjs');
9
+ require('@dynamic-labs/iconic');
13
10
  require('@dynamic-labs/wallet-connector-core');
11
+ require('../../../../context/ViewContext/ViewContext.cjs');
14
12
  require('@dynamic-labs/wallet-book');
15
13
  require('@dynamic-labs/utils');
16
14
  require('../../../../utils/constants/colors.cjs');
@@ -21,7 +19,6 @@ require('../../../../context/DynamicContext/DynamicContext.cjs');
21
19
  require('@dynamic-labs/multi-wallet');
22
20
  require('../../../../components/ShadowDOM/ShadowDOM.cjs');
23
21
  require('../../../../context/ThemeContext/ThemeContext.cjs');
24
- var Icon = require('../../../../components/Icon/Icon.cjs');
25
22
  require('react-dom');
26
23
  require('react-focus-lock');
27
24
  require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
@@ -34,6 +31,7 @@ require('../../../../context/ErrorContext/ErrorContext.cjs');
34
31
  require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
35
32
  require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
36
33
  require('../../../../components/IconButton/IconButton.cjs');
34
+ var Button = require('../../../../components/Button/Button.cjs');
37
35
  require('../../../../components/Alert/Alert.cjs');
38
36
  require('formik');
39
37
  require('yup');
@@ -44,22 +42,12 @@ require('../../../../context/EmailVerificationContext/EmailVerificationContext.c
44
42
  require('@dynamic-labs/types');
45
43
  require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
46
44
  require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
47
- var ListTile = require('../../../../components/ListTile/ListTile.cjs');
48
45
  require('../../../../components/Popper/Popper/Popper.cjs');
49
46
  require('../../../../components/Popper/PopperContext/PopperContext.cjs');
50
47
  require('../../../../components/InlineWidget/InlineWidget.cjs');
51
48
  require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
52
- var Badge = require('../../../../components/Badge/Badge.cjs');
49
+ var WalletSimpleSignIn = require('./WalletSimpleSignIn/WalletSimpleSignIn.cjs');
53
50
 
54
- const ListItemButton = ({ text, onClick, numberOfWallets }) => {
55
- const numberOfWalletsText = React.useMemo(() => {
56
- if (numberOfWallets <= 10) {
57
- return numberOfWallets;
58
- }
59
- return `+${Math.floor(numberOfWallets / 10) * 10}`;
60
- }, [numberOfWallets]);
61
- const trailing = (jsxRuntime.jsxs("div", Object.assign({ className: 'list-item-button__trailing' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: classNames.classNames('list-item-button__trailing-child', 'list-item-button__trailing-label') }, { children: jsxRuntime.jsx(Badge.Badge, { text: `${numberOfWalletsText} available` }) })), jsxRuntime.jsx("div", Object.assign({ className: classNames.classNames('list-item-button__trailing-child', 'list-item-button__trailing-icon') }, { children: jsxRuntime.jsx(Icon.Icon, Object.assign({ color: 'text-primary', size: 'small' }, { children: jsxRuntime.jsx(stroke.ReactComponent, {}) })) }))] })));
62
- return (jsxRuntime.jsx(ListTile.ListTile, Object.assign({ trailing: trailing, onClick: onClick, className: 'list-item-button' }, { children: text })));
63
- };
51
+ const WalletSignIn = ({ numberOfItensToShow, isLoading, onSubmit, }) => numberOfItensToShow > 0 ? (jsxRuntime.jsx(WalletSimpleSignIn.WalletSimpleSignIn, { previewWalletsNumber: numberOfItensToShow, onshowAllWallets: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), disabled: isLoading })) : (jsxRuntime.jsx(Button.Button, Object.assign({ disabled: isLoading, onClick: () => onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(), buttonVariant: 'primary', buttonPadding: 'large' }, { children: "Connect with Wallet" })));
64
52
 
65
- exports.ListItemButton = ListItemButton;
53
+ exports.WalletSignIn = WalletSignIn;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { LoginWidgetProps } from '../LoginWidget';
3
+ interface WalletLoginProps extends LoginWidgetProps {
4
+ numberOfItensToShow: number;
5
+ }
6
+ export declare const WalletSignIn: React.FC<WalletLoginProps>;
7
+ export {};