@dynamic-labs/sdk-react-core 2.1.0-alpha.11 → 2.1.0-alpha.12

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 (25) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +12 -12
  5. package/src/lib/components/CopyButton/CopyButton.cjs +3 -3
  6. package/src/lib/components/CopyButton/CopyButton.d.ts +1 -1
  7. package/src/lib/components/CopyButton/CopyButton.js +3 -3
  8. package/src/lib/components/LoadingQrCode/LoadingQrCode.cjs +11 -0
  9. package/src/lib/components/LoadingQrCode/LoadingQrCode.d.ts +8 -0
  10. package/src/lib/components/LoadingQrCode/LoadingQrCode.js +7 -0
  11. package/src/lib/components/LoadingQrCode/index.d.ts +1 -0
  12. package/src/lib/components/QrCodeWrapper/QrCodeContainer/QrCodeContainer.cjs +2 -1
  13. package/src/lib/components/QrCodeWrapper/QrCodeContainer/QrCodeContainer.js +2 -1
  14. package/src/lib/components/QrCodeWrapper/QrCodeWrapper.cjs +5 -1
  15. package/src/lib/components/QrCodeWrapper/QrCodeWrapper.js +5 -1
  16. package/src/lib/views/FarcasterQrCodeView/FarcasterQrCodeView.cjs +103 -0
  17. package/src/lib/views/FarcasterQrCodeView/FarcasterQrCodeView.d.ts +6 -0
  18. package/src/lib/views/FarcasterQrCodeView/FarcasterQrCodeView.js +99 -0
  19. package/src/lib/views/FarcasterQrCodeView/index.d.ts +1 -0
  20. package/src/lib/views/LoginView/LoginView.cjs +9 -1
  21. package/src/lib/views/LoginView/LoginView.js +9 -1
  22. package/src/lib/views/LoginView/utils/showFarcasterQrCodeView/index.d.ts +1 -0
  23. package/src/lib/views/LoginView/utils/showFarcasterQrCodeView/showFarcasterQrCodeView.cjs +14 -0
  24. package/src/lib/views/LoginView/utils/showFarcasterQrCodeView/showFarcasterQrCodeView.d.ts +2 -0
  25. package/src/lib/views/LoginView/utils/showFarcasterQrCodeView/showFarcasterQrCodeView.js +10 -0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ ## [2.1.0-alpha.12](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.11...v2.1.0-alpha.12) (2024-05-02)
3
+
4
+
5
+ ### Features
6
+
7
+ * display Farcaster QR code when it is the only login option ([#5514](https://github.com/dynamic-labs/DynamicAuth/issues/5514)) ([7b166d9](https://github.com/dynamic-labs/DynamicAuth/commit/7b166d9a30c581746f0e2edb71c44fc015dc128e))
8
+
2
9
  ## [2.1.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.10...v2.1.0-alpha.11) (2024-05-02)
3
10
 
4
11
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "2.1.0-alpha.11";
6
+ var version = "2.1.0-alpha.12";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.433",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "2.1.0-alpha.11";
2
+ var version = "2.1.0-alpha.12";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.433",
5
5
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "2.1.0-alpha.11",
3
+ "version": "2.1.0-alpha.12",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -17,17 +17,17 @@
17
17
  "react-i18next": "13.5.0",
18
18
  "yup": "0.32.11",
19
19
  "react-international-phone": "4.2.5",
20
- "@dynamic-labs/iconic": "2.1.0-alpha.11",
21
- "@dynamic-labs/logger": "2.1.0-alpha.11",
22
- "@dynamic-labs/multi-wallet": "2.1.0-alpha.11",
23
- "@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.11",
24
- "@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.11",
25
- "@dynamic-labs/rpc-providers": "2.1.0-alpha.11",
26
- "@dynamic-labs/types": "2.1.0-alpha.11",
27
- "@dynamic-labs/utils": "2.1.0-alpha.11",
28
- "@dynamic-labs/viem-utils": "2.1.0-alpha.11",
29
- "@dynamic-labs/wallet-book": "2.1.0-alpha.11",
30
- "@dynamic-labs/wallet-connector-core": "2.1.0-alpha.11",
20
+ "@dynamic-labs/iconic": "2.1.0-alpha.12",
21
+ "@dynamic-labs/logger": "2.1.0-alpha.12",
22
+ "@dynamic-labs/multi-wallet": "2.1.0-alpha.12",
23
+ "@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.12",
24
+ "@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.12",
25
+ "@dynamic-labs/rpc-providers": "2.1.0-alpha.12",
26
+ "@dynamic-labs/types": "2.1.0-alpha.12",
27
+ "@dynamic-labs/utils": "2.1.0-alpha.12",
28
+ "@dynamic-labs/viem-utils": "2.1.0-alpha.12",
29
+ "@dynamic-labs/wallet-book": "2.1.0-alpha.12",
30
+ "@dynamic-labs/wallet-connector-core": "2.1.0-alpha.12",
31
31
  "eventemitter3": "5.0.1"
32
32
  },
33
33
  "devDependencies": {
@@ -10,7 +10,7 @@ var TextButton = require('../TextButton/TextButton.cjs');
10
10
  var TypographyButton = require('../TypographyButton/TypographyButton.cjs');
11
11
  var Tooltip = require('../Tooltip/Tooltip.cjs');
12
12
 
13
- const CopyButton = ({ children, className = '', textToCopy, onClick, variant = 'text', copykey, buttonPadding = 'small', buttonVariant = 'primary', buttonClassName = '', startSlot, }) => {
13
+ const CopyButton = ({ children, className = '', textToCopy, onClick, variant = 'text', copykey, buttonPadding = 'small', buttonVariant = 'primary', buttonClassName = '', startSlot, disabled, }) => {
14
14
  const [copied, setCopied] = React.useState(false);
15
15
  const copyToClipboard = () => {
16
16
  navigator.clipboard.writeText(textToCopy);
@@ -19,9 +19,9 @@ const CopyButton = ({ children, className = '', textToCopy, onClick, variant = '
19
19
  };
20
20
  const CopyButtonTooltip = () => (jsxRuntime.jsx(Tooltip.Tooltip, { className: 'copy-button__tooltip', content: copied ? 'Copied' : 'Copy', children: children }));
21
21
  if (variant === 'text') {
22
- return (jsxRuntime.jsx(TextButton.TextButton, { className: classNames.classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, children: jsxRuntime.jsx(CopyButtonTooltip, {}) }));
22
+ return (jsxRuntime.jsx(TextButton.TextButton, { className: classNames.classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, disabled: disabled, children: jsxRuntime.jsx(CopyButtonTooltip, {}) }));
23
23
  }
24
- return (jsxRuntime.jsx(TypographyButton.TypographyButton, { expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, children: jsxRuntime.jsx(CopyButtonTooltip, {}) }));
24
+ return (jsxRuntime.jsx(TypographyButton.TypographyButton, { expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, disabled: disabled, children: jsxRuntime.jsx(CopyButtonTooltip, {}) }));
25
25
  };
26
26
 
27
27
  exports.CopyButton = CopyButton;
@@ -8,5 +8,5 @@ type Props = ComponentPropsWithoutRef<'button'> & {
8
8
  textToCopy: string;
9
9
  variant?: 'text' | 'button';
10
10
  } & CopyKey & Pick<ButtonProps, 'buttonPadding' | 'buttonVariant' | 'buttonClassName' | 'startSlot'>;
11
- export declare const CopyButton: ({ children, className, textToCopy, onClick, variant, copykey, buttonPadding, buttonVariant, buttonClassName, startSlot, }: Props) => JSX.Element;
11
+ export declare const CopyButton: ({ children, className, textToCopy, onClick, variant, copykey, buttonPadding, buttonVariant, buttonClassName, startSlot, disabled, }: Props) => JSX.Element;
12
12
  export {};
@@ -6,7 +6,7 @@ import { TextButton } from '../TextButton/TextButton.js';
6
6
  import { TypographyButton } from '../TypographyButton/TypographyButton.js';
7
7
  import { Tooltip } from '../Tooltip/Tooltip.js';
8
8
 
9
- const CopyButton = ({ children, className = '', textToCopy, onClick, variant = 'text', copykey, buttonPadding = 'small', buttonVariant = 'primary', buttonClassName = '', startSlot, }) => {
9
+ const CopyButton = ({ children, className = '', textToCopy, onClick, variant = 'text', copykey, buttonPadding = 'small', buttonVariant = 'primary', buttonClassName = '', startSlot, disabled, }) => {
10
10
  const [copied, setCopied] = useState(false);
11
11
  const copyToClipboard = () => {
12
12
  navigator.clipboard.writeText(textToCopy);
@@ -15,9 +15,9 @@ const CopyButton = ({ children, className = '', textToCopy, onClick, variant = '
15
15
  };
16
16
  const CopyButtonTooltip = () => (jsx(Tooltip, { className: 'copy-button__tooltip', content: copied ? 'Copied' : 'Copy', children: children }));
17
17
  if (variant === 'text') {
18
- return (jsx(TextButton, { className: classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, children: jsx(CopyButtonTooltip, {}) }));
18
+ return (jsx(TextButton, { className: classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, disabled: disabled, children: jsx(CopyButtonTooltip, {}) }));
19
19
  }
20
- return (jsx(TypographyButton, { expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, children: jsx(CopyButtonTooltip, {}) }));
20
+ return (jsx(TypographyButton, { expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, disabled: disabled, children: jsx(CopyButtonTooltip, {}) }));
21
21
  };
22
22
 
23
23
  export { CopyButton };
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var IconWithSpinner = require('../IconWithSpinner/IconWithSpinner.cjs');
8
+
9
+ const LoadingQrCode = ({ Icon, logoSize }) => (jsxRuntime.jsx("div", { className: 'qrcode__container qrcode', "data-testid": 'loading-qrcode', children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: Icon, iconSize: logoSize, isSpinning: true, className: 'qrcode__icon' }) }));
10
+
11
+ exports.LoadingQrCode = LoadingQrCode;
@@ -0,0 +1,8 @@
1
+ import { FC, ReactElement } from 'react';
2
+ type LoadingQrCodeProps = {
3
+ Icon: ReactElement;
4
+ accentColor?: string;
5
+ logoSize?: number;
6
+ };
7
+ export declare const LoadingQrCode: FC<LoadingQrCodeProps>;
8
+ export {};
@@ -0,0 +1,7 @@
1
+ 'use client'
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { IconWithSpinner } from '../IconWithSpinner/IconWithSpinner.js';
4
+
5
+ const LoadingQrCode = ({ Icon, logoSize }) => (jsx("div", { className: 'qrcode__container qrcode', "data-testid": 'loading-qrcode', children: jsx(IconWithSpinner, { Icon: Icon, iconSize: logoSize, isSpinning: true, className: 'qrcode__icon' }) }));
6
+
7
+ export { LoadingQrCode };
@@ -0,0 +1 @@
1
+ export { LoadingQrCode } from './LoadingQrCode';
@@ -77,6 +77,7 @@ require('../../IsBrowser/IsBrowser.cjs');
77
77
  require('../../Popper/Popper/Popper.cjs');
78
78
  require('../../Popper/PopperContext/PopperContext.cjs');
79
79
  var QRCode = require('../../QRCode/QRCode.cjs');
80
+ var LoadingQrCode = require('../../LoadingQrCode/LoadingQrCode.cjs');
80
81
  require('../../../views/WalletList/WalletList.cjs');
81
82
  require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
82
83
  require('@hcaptcha/react-hcaptcha');
@@ -101,7 +102,7 @@ const QrCodeContainer = ({ accentColor, walletConnector, qrcodeValue, Icon: Main
101
102
  };
102
103
  return (jsxRuntime.jsxs("div", { className: classNames.classNames('qrcode-container__container', {
103
104
  'qrcode-container__container--message': showQrCodeMessage,
104
- }), children: [jsxRuntime.jsxs("div", { className: 'qrcode-container__top', children: [qrcodeValue && (jsxRuntime.jsx(QRCode.QRCode, { Icon: MainIcon, accentColor: accentColor, value: qrcodeValue, logoSize: 50, walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, showQrCodeImage: showQrCodeImage })), jsxRuntime.jsx(MockedQrCode.MockedQrCode, {}), jsxRuntime.jsxs("div", { className: 'button-container', children: [showCopyToClipboardButton && qrcodeValue && (jsxRuntime.jsx(CopyButton.CopyButton, { variant: 'button', textToCopy: qrcodeValue, buttonClassName: 'qr-code-button', copykey: 'dyn_qr_code.copy_button', startSlot:
105
+ }), children: [jsxRuntime.jsxs("div", { className: 'qrcode-container__top', children: [qrcodeValue.length ? (jsxRuntime.jsx(QRCode.QRCode, { Icon: MainIcon, accentColor: accentColor, value: qrcodeValue, logoSize: 50, walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, showQrCodeImage: showQrCodeImage })) : (jsxRuntime.jsx(LoadingQrCode.LoadingQrCode, { Icon: MainIcon, logoSize: 50 })), jsxRuntime.jsx(MockedQrCode.MockedQrCode, {}), jsxRuntime.jsxs("div", { className: 'button-container', children: [showCopyToClipboardButton && (jsxRuntime.jsx(CopyButton.CopyButton, { variant: 'button', textToCopy: qrcodeValue, disabled: !qrcodeValue.length, buttonClassName: 'qr-code-button', copykey: 'dyn_qr_code.copy_button', startSlot:
105
106
  // eslint-disable-next-line react/jsx-wrap-multilines
106
107
  jsxRuntime.jsx(Icon.Icon, { size: 'mini', color: 'text-tertiary', children: jsxRuntime.jsx(link.ReactComponent, {}) }), children: t('dyn_qr_code.copy_button') })), renderAppOrExtensionButton()] })] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', className: 'qrcode-container__content', copykey: 'dyn_qr_code.scan_title', children: t('dyn_qr_code.scan_title', {
107
108
  app: walletConnector ? 'wallet' : 'app',
@@ -73,6 +73,7 @@ import '../../IsBrowser/IsBrowser.js';
73
73
  import '../../Popper/Popper/Popper.js';
74
74
  import '../../Popper/PopperContext/PopperContext.js';
75
75
  import { QRCode } from '../../QRCode/QRCode.js';
76
+ import { LoadingQrCode } from '../../LoadingQrCode/LoadingQrCode.js';
76
77
  import '../../../views/WalletList/WalletList.js';
77
78
  import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
78
79
  import '@hcaptcha/react-hcaptcha';
@@ -97,7 +98,7 @@ const QrCodeContainer = ({ accentColor, walletConnector, qrcodeValue, Icon: Main
97
98
  };
98
99
  return (jsxs("div", { className: classNames('qrcode-container__container', {
99
100
  'qrcode-container__container--message': showQrCodeMessage,
100
- }), children: [jsxs("div", { className: 'qrcode-container__top', children: [qrcodeValue && (jsx(QRCode, { Icon: MainIcon, accentColor: accentColor, value: qrcodeValue, logoSize: 50, walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, showQrCodeImage: showQrCodeImage })), jsx(MockedQrCode, {}), jsxs("div", { className: 'button-container', children: [showCopyToClipboardButton && qrcodeValue && (jsx(CopyButton, { variant: 'button', textToCopy: qrcodeValue, buttonClassName: 'qr-code-button', copykey: 'dyn_qr_code.copy_button', startSlot:
101
+ }), children: [jsxs("div", { className: 'qrcode-container__top', children: [qrcodeValue.length ? (jsx(QRCode, { Icon: MainIcon, accentColor: accentColor, value: qrcodeValue, logoSize: 50, walletKey: walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key, showQrCodeImage: showQrCodeImage })) : (jsx(LoadingQrCode, { Icon: MainIcon, logoSize: 50 })), jsx(MockedQrCode, {}), jsxs("div", { className: 'button-container', children: [showCopyToClipboardButton && (jsx(CopyButton, { variant: 'button', textToCopy: qrcodeValue, disabled: !qrcodeValue.length, buttonClassName: 'qr-code-button', copykey: 'dyn_qr_code.copy_button', startSlot:
101
102
  // eslint-disable-next-line react/jsx-wrap-multilines
102
103
  jsx(Icon, { size: 'mini', color: 'text-tertiary', children: jsx(SvgLink, {}) }), children: t('dyn_qr_code.copy_button') })), renderAppOrExtensionButton()] })] }), jsx(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', className: 'qrcode-container__content', copykey: 'dyn_qr_code.scan_title', children: t('dyn_qr_code.scan_title', {
103
104
  app: walletConnector ? 'wallet' : 'app',
@@ -81,7 +81,11 @@ require('../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSign
81
81
  const QrCodeWrapper = ({ uri, desktopUri, icon, accentColor, showCopyToClipboardButton, walletConnector, }) => {
82
82
  const [showQrCodeMessage, setShowQrCodeMessage] = React.useState(false);
83
83
  const [showQrCodeImage, setShowQrCodeImage] = React.useState(false);
84
- useTimeout.useTimeout(() => setShowQrCodeMessage(true), 5000);
84
+ /**
85
+ * Show the QR code message after 5 seconds
86
+ * disabled if url is empty
87
+ */
88
+ useTimeout.useTimeout(() => setShowQrCodeMessage(true), uri.length ? 5000 : null);
85
89
  return (jsxRuntime.jsxs("div", { "data-testid": 'qr-code-wrapper', children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, { style: { width: '100%' } }), children: showQrCodeMessage && !showQrCodeImage && (jsxRuntime.jsxs("div", { className: 'qr-code-wrapper__scan-issue-message', children: [jsxRuntime.jsx(Typography.Typography, { color: 'primary', variant: 'body_small', children: "If you're having issues scanning, click\u00A0" }), jsxRuntime.jsx("button", { "data-testid": 'qr-code-wrapper__scan-issue-button', className: 'qr-code-wrapper__scan-issue-button', onClick: () => setShowQrCodeImage(true), children: "here" })] })) }), jsxRuntime.jsx(QrCodeContainer.QrCodeContainer, { showQrCodeMessage: showQrCodeMessage, desktopUri: desktopUri, accentColor: accentColor, walletConnector: walletConnector, qrcodeValue: uri, Icon: icon, showCopyToClipboardButton: showCopyToClipboardButton, showQrCodeImage: showQrCodeImage })] }));
86
90
  };
87
91
 
@@ -77,7 +77,11 @@ import '../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignI
77
77
  const QrCodeWrapper = ({ uri, desktopUri, icon, accentColor, showCopyToClipboardButton, walletConnector, }) => {
78
78
  const [showQrCodeMessage, setShowQrCodeMessage] = useState(false);
79
79
  const [showQrCodeImage, setShowQrCodeImage] = useState(false);
80
- useTimeout(() => setShowQrCodeMessage(true), 5000);
80
+ /**
81
+ * Show the QR code message after 5 seconds
82
+ * disabled if url is empty
83
+ */
84
+ useTimeout(() => setShowQrCodeMessage(true), uri.length ? 5000 : null);
81
85
  return (jsxs("div", { "data-testid": 'qr-code-wrapper', children: [jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, { style: { width: '100%' } }), children: showQrCodeMessage && !showQrCodeImage && (jsxs("div", { className: 'qr-code-wrapper__scan-issue-message', children: [jsx(Typography, { color: 'primary', variant: 'body_small', children: "If you're having issues scanning, click\u00A0" }), jsx("button", { "data-testid": 'qr-code-wrapper__scan-issue-button', className: 'qr-code-wrapper__scan-issue-button', onClick: () => setShowQrCodeImage(true), children: "here" })] })) }), jsx(QrCodeContainer, { showQrCodeMessage: showQrCodeMessage, desktopUri: desktopUri, accentColor: accentColor, walletConnector: walletConnector, qrcodeValue: uri, Icon: icon, showCopyToClipboardButton: showCopyToClipboardButton, showQrCodeImage: showQrCodeImage })] }));
82
86
  };
83
87
 
@@ -0,0 +1,103 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../../_virtual/_tslib.cjs');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ require('react');
9
+ require('../../context/DynamicContext/DynamicContext.cjs');
10
+ require('@dynamic-labs/sdk-api-core');
11
+ require('../../shared/logger.cjs');
12
+ require('@dynamic-labs/iconic');
13
+ require('@dynamic-labs/wallet-connector-core');
14
+ require('../../context/ViewContext/ViewContext.cjs');
15
+ require('@dynamic-labs/wallet-book');
16
+ require('../../utils/constants/colors.cjs');
17
+ require('../../utils/constants/values.cjs');
18
+ require('../../shared/utils/classes/storage/localStorage.cjs');
19
+ require('@dynamic-labs/utils');
20
+ require('../../shared/consts/index.cjs');
21
+ require('../../events/dynamicEvents.cjs');
22
+ require('../../context/CaptchaContext/CaptchaContext.cjs');
23
+ var ErrorContext = require('../../context/ErrorContext/ErrorContext.cjs');
24
+ require('@dynamic-labs/multi-wallet');
25
+ require('react-international-phone');
26
+ require('viem');
27
+ require('viem/chains');
28
+ require('../../config/ApiEndpoint.cjs');
29
+ require('../../locale/locale.cjs');
30
+ require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
31
+ require('../../context/AccountExistsContext/AccountExistsContext.cjs');
32
+ require('../../context/UserWalletsContext/UserWalletsContext.cjs');
33
+ require('../../context/VerificationContext/VerificationContext.cjs');
34
+ require('react-dom');
35
+ require('../../context/WalletContext/WalletContext.cjs');
36
+ var usePromise = require('../../utils/hooks/usePromise/usePromise.cjs');
37
+ require('../../context/ThemeContext/ThemeContext.cjs');
38
+ require('@dynamic-labs/types');
39
+ var farcaster = require('../../utils/hooks/useSocialAuth/farcaster.cjs');
40
+ require('yup');
41
+ require('../../context/MockContext/MockContext.cjs');
42
+ require('react-i18next');
43
+ require('../../context/FieldsStateContext/FieldsStateContext.cjs');
44
+ require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
45
+ require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
46
+ require('@dynamic-labs/rpc-providers');
47
+ require('../../components/Alert/Alert.cjs');
48
+ require('../../components/ShadowDOM/ShadowDOM.cjs');
49
+ require('../../components/IconButton/IconButton.cjs');
50
+ require('../../components/InlineWidget/InlineWidget.cjs');
51
+ require('../../components/Input/Input.cjs');
52
+ require('../../components/IsBrowser/IsBrowser.cjs');
53
+ require('../../components/MenuList/Dropdown/Dropdown.cjs');
54
+ require('../../components/Transition/ZoomTransition/ZoomTransition.cjs');
55
+ require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
56
+ require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
57
+ require('../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
58
+ require('../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
59
+ require('../../components/Popper/Popper/Popper.cjs');
60
+ require('../../components/Popper/PopperContext/PopperContext.cjs');
61
+ require('react-focus-lock');
62
+ require('qrcode');
63
+ require('formik');
64
+ require('../WalletList/WalletList.cjs');
65
+ var FarcasterConnectView = require('../FarcasterConnectView/FarcasterConnectView.cjs');
66
+ require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
67
+ require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
68
+ require('@hcaptcha/react-hcaptcha');
69
+ require('../../context/LoadingContext/LoadingContext.cjs');
70
+ require('../../context/FooterAnimationContext/index.cjs');
71
+ require('../LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.cjs');
72
+ require('../../context/WalletGroupContext/WalletGroupContext.cjs');
73
+ require('../../context/PasskeyContext/PasskeyContext.cjs');
74
+ require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
75
+ require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
76
+ require('../TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
77
+ require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
78
+ var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
79
+
80
+ /**
81
+ * This view is used to display the QR code for the farcaster connection.
82
+ * It is only used in the login view when Farcaster is the only available login method.
83
+ */
84
+ const FarcasterQrCodeView = () => {
85
+ var _a;
86
+ const { consumeNonce, redirectUrl } = useInternalDynamicContext.useInternalDynamicContext();
87
+ const { setError } = ErrorContext.useErrorContext();
88
+ const { data } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
89
+ const dynamicNonce = consumeNonce();
90
+ const domain = window.location.host;
91
+ return farcaster.connect({
92
+ domain,
93
+ nonce: dynamicNonce,
94
+ redirectUrl,
95
+ siweUri: window.location.origin,
96
+ });
97
+ }), {
98
+ onReject: () => setError('Something went wrong'),
99
+ });
100
+ return jsxRuntime.jsx(FarcasterConnectView.FarcasterConnectView, { url: (_a = data === null || data === void 0 ? void 0 : data.url) !== null && _a !== void 0 ? _a : '' });
101
+ };
102
+
103
+ exports.FarcasterQrCodeView = FarcasterQrCodeView;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * This view is used to display the QR code for the farcaster connection.
4
+ * It is only used in the login view when Farcaster is the only available login method.
5
+ */
6
+ export declare const FarcasterQrCodeView: () => JSX.Element;
@@ -0,0 +1,99 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../_virtual/_tslib.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import 'react';
5
+ import '../../context/DynamicContext/DynamicContext.js';
6
+ import '@dynamic-labs/sdk-api-core';
7
+ import '../../shared/logger.js';
8
+ import '@dynamic-labs/iconic';
9
+ import '@dynamic-labs/wallet-connector-core';
10
+ import '../../context/ViewContext/ViewContext.js';
11
+ import '@dynamic-labs/wallet-book';
12
+ import '../../utils/constants/colors.js';
13
+ import '../../utils/constants/values.js';
14
+ import '../../shared/utils/classes/storage/localStorage.js';
15
+ import '@dynamic-labs/utils';
16
+ import '../../shared/consts/index.js';
17
+ import '../../events/dynamicEvents.js';
18
+ import '../../context/CaptchaContext/CaptchaContext.js';
19
+ import { useErrorContext } from '../../context/ErrorContext/ErrorContext.js';
20
+ import '@dynamic-labs/multi-wallet';
21
+ import 'react-international-phone';
22
+ import 'viem';
23
+ import 'viem/chains';
24
+ import '../../config/ApiEndpoint.js';
25
+ import '../../locale/locale.js';
26
+ import '../../context/AccessDeniedContext/AccessDeniedContext.js';
27
+ import '../../context/AccountExistsContext/AccountExistsContext.js';
28
+ import '../../context/UserWalletsContext/UserWalletsContext.js';
29
+ import '../../context/VerificationContext/VerificationContext.js';
30
+ import 'react-dom';
31
+ import '../../context/WalletContext/WalletContext.js';
32
+ import { usePromise } from '../../utils/hooks/usePromise/usePromise.js';
33
+ import '../../context/ThemeContext/ThemeContext.js';
34
+ import '@dynamic-labs/types';
35
+ import { connect } from '../../utils/hooks/useSocialAuth/farcaster.js';
36
+ import 'yup';
37
+ import '../../context/MockContext/MockContext.js';
38
+ import 'react-i18next';
39
+ import '../../context/FieldsStateContext/FieldsStateContext.js';
40
+ import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
41
+ import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
42
+ import '@dynamic-labs/rpc-providers';
43
+ import '../../components/Alert/Alert.js';
44
+ import '../../components/ShadowDOM/ShadowDOM.js';
45
+ import '../../components/IconButton/IconButton.js';
46
+ import '../../components/InlineWidget/InlineWidget.js';
47
+ import '../../components/Input/Input.js';
48
+ import '../../components/IsBrowser/IsBrowser.js';
49
+ import '../../components/MenuList/Dropdown/Dropdown.js';
50
+ import '../../components/Transition/ZoomTransition/ZoomTransition.js';
51
+ import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
52
+ import '../../components/Transition/OpacityTransition/OpacityTransition.js';
53
+ import '../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
54
+ import '../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
55
+ import '../../components/Popper/Popper/Popper.js';
56
+ import '../../components/Popper/PopperContext/PopperContext.js';
57
+ import 'react-focus-lock';
58
+ import 'qrcode';
59
+ import 'formik';
60
+ import '../WalletList/WalletList.js';
61
+ import { FarcasterConnectView } from '../FarcasterConnectView/FarcasterConnectView.js';
62
+ import '../../context/SocialRedirectContext/SocialRedirectContext.js';
63
+ import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
64
+ import '@hcaptcha/react-hcaptcha';
65
+ import '../../context/LoadingContext/LoadingContext.js';
66
+ import '../../context/FooterAnimationContext/index.js';
67
+ import '../LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.js';
68
+ import '../../context/WalletGroupContext/WalletGroupContext.js';
69
+ import '../../context/PasskeyContext/PasskeyContext.js';
70
+ import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
71
+ import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
72
+ import '../TransactionConfirmationView/helpers/transactionErrorMessage.js';
73
+ import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
74
+ import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
75
+
76
+ /**
77
+ * This view is used to display the QR code for the farcaster connection.
78
+ * It is only used in the login view when Farcaster is the only available login method.
79
+ */
80
+ const FarcasterQrCodeView = () => {
81
+ var _a;
82
+ const { consumeNonce, redirectUrl } = useInternalDynamicContext();
83
+ const { setError } = useErrorContext();
84
+ const { data } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
85
+ const dynamicNonce = consumeNonce();
86
+ const domain = window.location.host;
87
+ return connect({
88
+ domain,
89
+ nonce: dynamicNonce,
90
+ redirectUrl,
91
+ siweUri: window.location.origin,
92
+ });
93
+ }), {
94
+ onReject: () => setError('Something went wrong'),
95
+ });
96
+ return jsx(FarcasterConnectView, { url: (_a = data === null || data === void 0 ? void 0 : data.url) !== null && _a !== void 0 ? _a : '' });
97
+ };
98
+
99
+ export { FarcasterQrCodeView };
@@ -0,0 +1 @@
1
+ export { FarcasterQrCodeView } from './FarcasterQrCodeView';
@@ -14,14 +14,18 @@ var DefaultFooter = require('../../layout/DynamicAuthLayout/DefaultFooter/Defaul
14
14
  var classNames = require('../../utils/functions/classNames/classNames.cjs');
15
15
  var useAuthLayoutChecks = require('../../utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs');
16
16
  var WalletList = require('../WalletList/WalletList.cjs');
17
+ var SocialRedirectContext = require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
18
+ var FarcasterQrCodeView = require('../FarcasterQrCodeView/FarcasterQrCodeView.cjs');
17
19
  var LoginViewSection = require('./LoginViewSection/LoginViewSection.cjs');
18
20
  var useLoginView = require('./useLoginView/useLoginView.cjs');
21
+ var showFarcasterQrCodeView = require('./utils/showFarcasterQrCodeView/showFarcasterQrCodeView.cjs');
19
22
 
20
23
  const LoginView = () => {
21
24
  var _a;
22
25
  const { error } = ErrorContext.useErrorContext();
23
26
  const { view, setView } = ViewContext.useViewContext();
24
27
  const { isWalletOnly, loginViewSections } = useLoginView.useLoginView();
28
+ const { enabledSocialProviders } = SocialRedirectContext.useSocialRedirectContext();
25
29
  const [showWalletList, setShowWalletList] = React.useState(isWalletOnly);
26
30
  React.useEffect(() => {
27
31
  // toolkit log in with email was set to false
@@ -43,11 +47,15 @@ const LoginView = () => {
43
47
  const { showDefaultFooter } = useAuthLayoutChecks.useAuthLayoutChecks();
44
48
  const numOfWallets = ((_a = loginViewSections.find((section) => section.type === sdkApiCore.SdkViewSectionType.Wallet)) === null || _a === void 0 ? void 0 : _a.numOfItemsToDisplay) || 0;
45
49
  const renderViewSections = React.useMemo(() => loginViewSections.map((viewSection, index) => (jsxRuntime.jsx("div", { className: classNames.classNames('login-view__scroll__section', `login-view__scroll__section--${viewSection.type}`), children: jsxRuntime.jsx(LoginViewSection.LoginViewSection, { gotToWalletList: () => setShowWalletList(true), index: index, viewSection: viewSection, walletCount: numOfWallets }) }, `${viewSection.type}__${index}`))), [loginViewSections, numOfWallets]);
50
+ const errorElement = error && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { className: 'login-view__error-container', withIcon: false, children: error }));
51
+ if (showFarcasterQrCodeView.showFarcasterQrCodeView(loginViewSections, enabledSocialProviders)) {
52
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [errorElement, jsxRuntime.jsx(FarcasterQrCodeView.FarcasterQrCodeView, {})] }));
53
+ }
46
54
  if (showWalletList) {
47
55
  return jsxRuntime.jsx(WalletList.WalletList, {});
48
56
  }
49
57
  const shouldShowFooter = utils.isMobile() && showDefaultFooter;
50
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [error && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { className: 'login-view__error-container', withIcon: false, children: error })), jsxRuntime.jsx("div", { className: classNames.classNames('login-view__container', {
58
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [errorElement, jsxRuntime.jsx("div", { className: classNames.classNames('login-view__container', {
51
59
  'login-view__container--error': Boolean(error),
52
60
  }), children: jsxRuntime.jsx("div", { className: 'login-view__scroll', "data-testid": 'login-view-scroll', children: renderViewSections }) }), shouldShowFooter && jsxRuntime.jsx(DefaultFooter.DefaultFooter, { hideBorder: true })] }));
53
61
  };
@@ -10,14 +10,18 @@ import { DefaultFooter } from '../../layout/DynamicAuthLayout/DefaultFooter/Defa
10
10
  import { classNames } from '../../utils/functions/classNames/classNames.js';
11
11
  import { useAuthLayoutChecks } from '../../utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js';
12
12
  import { WalletList } from '../WalletList/WalletList.js';
13
+ import { useSocialRedirectContext } from '../../context/SocialRedirectContext/SocialRedirectContext.js';
14
+ import { FarcasterQrCodeView } from '../FarcasterQrCodeView/FarcasterQrCodeView.js';
13
15
  import { LoginViewSection } from './LoginViewSection/LoginViewSection.js';
14
16
  import { useLoginView } from './useLoginView/useLoginView.js';
17
+ import { showFarcasterQrCodeView } from './utils/showFarcasterQrCodeView/showFarcasterQrCodeView.js';
15
18
 
16
19
  const LoginView = () => {
17
20
  var _a;
18
21
  const { error } = useErrorContext();
19
22
  const { view, setView } = useViewContext();
20
23
  const { isWalletOnly, loginViewSections } = useLoginView();
24
+ const { enabledSocialProviders } = useSocialRedirectContext();
21
25
  const [showWalletList, setShowWalletList] = useState(isWalletOnly);
22
26
  useEffect(() => {
23
27
  // toolkit log in with email was set to false
@@ -39,11 +43,15 @@ const LoginView = () => {
39
43
  const { showDefaultFooter } = useAuthLayoutChecks();
40
44
  const numOfWallets = ((_a = loginViewSections.find((section) => section.type === SdkViewSectionType.Wallet)) === null || _a === void 0 ? void 0 : _a.numOfItemsToDisplay) || 0;
41
45
  const renderViewSections = useMemo(() => loginViewSections.map((viewSection, index) => (jsx("div", { className: classNames('login-view__scroll__section', `login-view__scroll__section--${viewSection.type}`), children: jsx(LoginViewSection, { gotToWalletList: () => setShowWalletList(true), index: index, viewSection: viewSection, walletCount: numOfWallets }) }, `${viewSection.type}__${index}`))), [loginViewSections, numOfWallets]);
46
+ const errorElement = error && (jsx(ErrorContainer, { className: 'login-view__error-container', withIcon: false, children: error }));
47
+ if (showFarcasterQrCodeView(loginViewSections, enabledSocialProviders)) {
48
+ return (jsxs(Fragment, { children: [errorElement, jsx(FarcasterQrCodeView, {})] }));
49
+ }
42
50
  if (showWalletList) {
43
51
  return jsx(WalletList, {});
44
52
  }
45
53
  const shouldShowFooter = isMobile() && showDefaultFooter;
46
- return (jsxs(Fragment, { children: [error && (jsx(ErrorContainer, { className: 'login-view__error-container', withIcon: false, children: error })), jsx("div", { className: classNames('login-view__container', {
54
+ return (jsxs(Fragment, { children: [errorElement, jsx("div", { className: classNames('login-view__container', {
47
55
  'login-view__container--error': Boolean(error),
48
56
  }), children: jsx("div", { className: 'login-view__scroll', "data-testid": 'login-view-scroll', children: renderViewSections }) }), shouldShowFooter && jsx(DefaultFooter, { hideBorder: true })] }));
49
57
  };
@@ -0,0 +1 @@
1
+ export { showFarcasterQrCodeView } from './showFarcasterQrCodeView';
@@ -0,0 +1,14 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
7
+ var utils = require('@dynamic-labs/utils');
8
+
9
+ const showFarcasterQrCodeView = (loginViewSections, enabledSocialProviders) => loginViewSections.length === 1 &&
10
+ enabledSocialProviders.length === 1 &&
11
+ enabledSocialProviders.includes(sdkApiCore.SocialSignInProviderEnum.Farcaster) &&
12
+ !utils.isMobile();
13
+
14
+ exports.showFarcasterQrCodeView = showFarcasterQrCodeView;
@@ -0,0 +1,2 @@
1
+ import { SdkViewSection, SocialSignInProviderEnum } from '@dynamic-labs/sdk-api-core';
2
+ export declare const showFarcasterQrCodeView: (loginViewSections: SdkViewSection[], enabledSocialProviders: SocialSignInProviderEnum[]) => boolean;
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ import { SocialSignInProviderEnum } from '@dynamic-labs/sdk-api-core';
3
+ import { isMobile } from '@dynamic-labs/utils';
4
+
5
+ const showFarcasterQrCodeView = (loginViewSections, enabledSocialProviders) => loginViewSections.length === 1 &&
6
+ enabledSocialProviders.length === 1 &&
7
+ enabledSocialProviders.includes(SocialSignInProviderEnum.Farcaster) &&
8
+ !isMobile();
9
+
10
+ export { showFarcasterQrCodeView };