@daimo/pay 0.3.21 → 1.0.1
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/build/index.d.ts +132 -301
- package/build/package.json.js +103 -0
- package/build/package.json.js.map +1 -0
- package/build/src/assets/ScanIconWithLogos.js +34 -0
- package/build/src/assets/ScanIconWithLogos.js.map +1 -0
- package/build/src/assets/browsers.js +13 -0
- package/build/src/assets/browsers.js.map +1 -0
- package/build/src/assets/chains.js +152 -0
- package/build/src/assets/chains.js.map +1 -0
- package/build/src/assets/coins.js +6 -0
- package/build/src/assets/coins.js.map +1 -0
- package/build/src/assets/crepe.js +8 -0
- package/build/src/assets/crepe.js.map +1 -0
- package/build/src/assets/icons.js +28 -0
- package/build/src/assets/icons.js.map +1 -0
- package/build/src/assets/logos.js +131 -0
- package/build/src/assets/logos.js.map +1 -0
- package/build/src/assets/wallet.js +8 -0
- package/build/src/assets/wallet.js.map +1 -0
- package/build/src/assets/wave.js +6 -0
- package/build/src/assets/wave.js.map +1 -0
- package/build/src/components/Common/Alert/index.js +10 -0
- package/build/src/components/Common/Alert/index.js.map +1 -0
- package/build/src/components/Common/Alert/styles.js +55 -0
- package/build/src/components/Common/Alert/styles.js.map +1 -0
- package/build/src/components/Common/Avatar/index.js +66 -0
- package/build/src/components/Common/Avatar/index.js.map +1 -0
- package/build/src/components/Common/Avatar/styles.js +59 -0
- package/build/src/components/Common/Avatar/styles.js.map +1 -0
- package/build/src/components/Common/BrowserIcon/index.js +28 -0
- package/build/src/components/Common/BrowserIcon/index.js.map +1 -0
- package/build/src/components/Common/BrowserIcon/styles.js +20 -0
- package/build/src/components/Common/BrowserIcon/styles.js.map +1 -0
- package/build/src/components/Common/Button/index.js +38 -0
- package/build/src/components/Common/Button/index.js.map +1 -0
- package/build/src/components/Common/Button/styles.js +291 -0
- package/build/src/components/Common/Button/styles.js.map +1 -0
- package/build/src/components/Common/Chain/index.js +25 -0
- package/build/src/components/Common/Chain/index.js.map +1 -0
- package/build/src/components/Common/Chain/styles.js +94 -0
- package/build/src/components/Common/Chain/styles.js.map +1 -0
- package/build/src/components/Common/ChainSelectList/index.js +107 -0
- package/build/src/components/Common/ChainSelectList/index.js.map +1 -0
- package/build/src/components/Common/ChainSelectList/styles.js +228 -0
- package/build/src/components/Common/ChainSelectList/styles.js.map +1 -0
- package/build/src/components/Common/ConnectorList/index.js +70 -0
- package/build/src/components/Common/ConnectorList/index.js.map +1 -0
- package/build/src/components/Common/ConnectorList/styles.js +314 -0
- package/build/src/components/Common/ConnectorList/styles.js.map +1 -0
- package/build/src/components/Common/CopyToClipboard/CopyToClipboardIcon.js +71 -0
- package/build/src/components/Common/CopyToClipboard/CopyToClipboardIcon.js.map +1 -0
- package/build/src/components/Common/CopyToClipboard/index.js +51 -0
- package/build/src/components/Common/CopyToClipboard/index.js.map +1 -0
- package/build/src/components/Common/CustomQRCode/QRCode.js +69 -0
- package/build/src/components/Common/CustomQRCode/QRCode.js.map +1 -0
- package/build/src/components/Common/CustomQRCode/index.js +22 -0
- package/build/src/components/Common/CustomQRCode/index.js.map +1 -0
- package/build/src/components/Common/CustomQRCode/styles.js +155 -0
- package/build/src/components/Common/CustomQRCode/styles.js.map +1 -0
- package/build/src/components/Common/FitText/index.js +27 -0
- package/build/src/components/Common/FitText/index.js.map +1 -0
- package/build/src/components/Common/Modal/index.js +297 -0
- package/build/src/components/Common/Modal/index.js.map +1 -0
- package/build/src/components/Common/Modal/styles.js +660 -0
- package/build/src/components/Common/Modal/styles.js.map +1 -0
- package/build/src/components/Common/OptionsList/index.js +106 -0
- package/build/src/components/Common/OptionsList/index.js.map +1 -0
- package/build/src/components/Common/OptionsList/styles.js +165 -0
- package/build/src/components/Common/OptionsList/styles.js.map +1 -0
- package/build/src/components/Common/OrderHeader/index.js +215 -0
- package/build/src/components/Common/OrderHeader/index.js.map +1 -0
- package/build/src/components/Common/Portal/index.js +31 -0
- package/build/src/components/Common/Portal/index.js.map +1 -0
- package/build/src/components/Common/PoweredByFooter/index.js +44 -0
- package/build/src/components/Common/PoweredByFooter/index.js.map +1 -0
- package/build/src/components/Common/ScrollArea/index.js +62 -0
- package/build/src/components/Common/ScrollArea/index.js.map +1 -0
- package/build/src/components/Common/ScrollArea/styles.js +168 -0
- package/build/src/components/Common/ScrollArea/styles.js.map +1 -0
- package/build/src/components/Common/Spinner/index.js +24 -0
- package/build/src/components/Common/Spinner/index.js.map +1 -0
- package/build/src/components/Common/Spinner/styles.js +22 -0
- package/build/src/components/Common/Spinner/styles.js.map +1 -0
- package/build/src/components/Common/ThemedButton/index.js +25 -0
- package/build/src/components/Common/ThemedButton/index.js.map +1 -0
- package/build/src/components/Common/ThemedButton/styles.js +152 -0
- package/build/src/components/Common/ThemedButton/styles.js.map +1 -0
- package/build/src/components/Common/Tooltip/index.js +97 -0
- package/build/src/components/Common/Tooltip/index.js.map +1 -0
- package/build/src/components/Common/Tooltip/styles.js +81 -0
- package/build/src/components/Common/Tooltip/styles.js.map +1 -0
- package/build/src/components/DaimoPay.js +232 -0
- package/build/src/components/DaimoPay.js.map +1 -0
- package/build/src/components/DaimoPayButton/index.js +129 -0
- package/build/src/components/DaimoPayButton/index.js.map +1 -0
- package/build/src/components/DaimoPayButton/styles.js +50 -0
- package/build/src/components/DaimoPayButton/styles.js.map +1 -0
- package/build/src/components/DaimoPayModal/ConnectUsing.js +45 -0
- package/build/src/components/DaimoPayModal/ConnectUsing.js.map +1 -0
- package/build/src/components/DaimoPayModal/ConnectWithInjector/index.js +202 -0
- package/build/src/components/DaimoPayModal/ConnectWithInjector/index.js.map +1 -0
- package/build/src/components/DaimoPayModal/ConnectWithInjector/styles.js +133 -0
- package/build/src/components/DaimoPayModal/ConnectWithInjector/styles.js.map +1 -0
- package/build/src/components/DaimoPayModal/ConnectWithQRCode.js +75 -0
- package/build/src/components/DaimoPayModal/ConnectWithQRCode.js.map +1 -0
- package/build/src/components/DaimoPayModal/index.js +140 -0
- package/build/src/components/DaimoPayModal/index.js.map +1 -0
- package/build/src/components/DaimoPayThemeProvider/DaimoPayThemeProvider.js +21 -0
- package/build/src/components/DaimoPayThemeProvider/DaimoPayThemeProvider.js.map +1 -0
- package/build/src/components/Pages/About/graphics.js +187 -0
- package/build/src/components/Pages/About/graphics.js.map +1 -0
- package/build/src/components/Pages/About/index.js +131 -0
- package/build/src/components/Pages/About/index.js.map +1 -0
- package/build/src/components/Pages/About/styles.js +144 -0
- package/build/src/components/Pages/About/styles.js.map +1 -0
- package/build/src/components/Pages/Confirmation/index.js +105 -0
- package/build/src/components/Pages/Confirmation/index.js.map +1 -0
- package/build/src/components/Pages/Connectors/index.js +20 -0
- package/build/src/components/Pages/Connectors/index.js.map +1 -0
- package/build/src/components/Pages/Connectors/styles.js +267 -0
- package/build/src/components/Pages/Connectors/styles.js.map +1 -0
- package/build/src/components/Pages/DownloadApp/index.js +30 -0
- package/build/src/components/Pages/DownloadApp/index.js.map +1 -0
- package/build/src/components/Pages/MobileConnectors/index.js +73 -0
- package/build/src/components/Pages/MobileConnectors/index.js.map +1 -0
- package/build/src/components/Pages/MobileConnectors/styles.js +65 -0
- package/build/src/components/Pages/MobileConnectors/styles.js.map +1 -0
- package/build/src/components/Pages/Onboarding/index.js +18 -0
- package/build/src/components/Pages/Onboarding/index.js.map +1 -0
- package/build/src/components/Pages/Onboarding/styles.js +229 -0
- package/build/src/components/Pages/Onboarding/styles.js.map +1 -0
- package/build/src/components/Pages/PayWithToken/index.js +204 -0
- package/build/src/components/Pages/PayWithToken/index.js.map +1 -0
- package/build/src/components/Pages/SelectDepositAddressChain/index.js +32 -0
- package/build/src/components/Pages/SelectDepositAddressChain/index.js.map +1 -0
- package/build/src/components/Pages/SelectMethod/index.js +113 -0
- package/build/src/components/Pages/SelectMethod/index.js.map +1 -0
- package/build/src/components/Pages/SelectToken/index.js +62 -0
- package/build/src/components/Pages/SelectToken/index.js.map +1 -0
- package/build/src/components/Pages/Solana/ConnectSolana/index.js +37 -0
- package/build/src/components/Pages/Solana/ConnectSolana/index.js.map +1 -0
- package/build/src/components/Pages/Solana/ConnectorSolana/index.js +45 -0
- package/build/src/components/Pages/Solana/ConnectorSolana/index.js.map +1 -0
- package/build/src/components/Pages/Solana/PayWithSolanaToken/index.js +85 -0
- package/build/src/components/Pages/Solana/PayWithSolanaToken/index.js.map +1 -0
- package/build/src/components/Pages/Solana/SelectSolanaToken/index.js +38 -0
- package/build/src/components/Pages/Solana/SelectSolanaToken/index.js.map +1 -0
- package/build/src/components/Pages/SwitchNetworks/index.js +26 -0
- package/build/src/components/Pages/SwitchNetworks/index.js.map +1 -0
- package/build/src/components/Pages/WaitingDepositAddress/index.js +51 -0
- package/build/src/components/Pages/WaitingDepositAddress/index.js.map +1 -0
- package/build/src/components/Pages/WaitingOther/index.js +91 -0
- package/build/src/components/Pages/WaitingOther/index.js.map +1 -0
- package/build/src/components/Spinners/CircleSpinner/index.js +15 -0
- package/build/src/components/Spinners/CircleSpinner/index.js.map +1 -0
- package/build/src/components/Spinners/CircleSpinner/styles.js +118 -0
- package/build/src/components/Spinners/CircleSpinner/styles.js.map +1 -0
- package/build/src/components/Spinners/SquircleSpinner/index.js +15 -0
- package/build/src/components/Spinners/SquircleSpinner/index.js.map +1 -0
- package/build/src/components/Spinners/SquircleSpinner/styles.js +66 -0
- package/build/src/components/Spinners/SquircleSpinner/styles.js.map +1 -0
- package/build/src/components/contexts/solana/index.js +11 -0
- package/build/src/components/contexts/solana/index.js.map +1 -0
- package/build/src/components/contexts/web3/index.js +46 -0
- package/build/src/components/contexts/web3/index.js.map +1 -0
- package/build/src/constants/chainConfigs.js +306 -0
- package/build/src/constants/chainConfigs.js.map +1 -0
- package/build/src/constants/defaultTheme.js +6 -0
- package/build/src/constants/defaultTheme.js.map +1 -0
- package/build/src/defaultConfig.js +59 -0
- package/build/src/defaultConfig.js.map +1 -0
- package/build/src/defaultConnectors.js +43 -0
- package/build/src/defaultConnectors.js.map +1 -0
- package/build/src/hooks/connectors/useWalletConnectUri.js +93 -0
- package/build/src/hooks/connectors/useWalletConnectUri.js.map +1 -0
- package/build/src/hooks/useChainIsSupported.js +12 -0
- package/build/src/hooks/useChainIsSupported.js.map +1 -0
- package/build/src/hooks/useChains.js +11 -0
- package/build/src/hooks/useChains.js.map +1 -0
- package/build/src/hooks/useConnect.js +45 -0
- package/build/src/hooks/useConnect.js.map +1 -0
- package/build/src/hooks/useConnectCallback.js +18 -0
- package/build/src/hooks/useConnectCallback.js.map +1 -0
- package/build/src/hooks/useConnectors.js +29 -0
- package/build/src/hooks/useConnectors.js.map +1 -0
- package/build/src/hooks/useDaimoPayStatus.js +37 -0
- package/build/src/hooks/useDaimoPayStatus.js.map +1 -0
- package/build/src/hooks/useDepositAddressOptions.js +28 -0
- package/build/src/hooks/useDepositAddressOptions.js.map +1 -0
- package/build/src/hooks/useEnsFallbackConfig.js +16 -0
- package/build/src/hooks/useEnsFallbackConfig.js.map +1 -0
- package/build/src/hooks/useExternalPaymentOptions.js +46 -0
- package/build/src/hooks/useExternalPaymentOptions.js.map +1 -0
- package/build/src/hooks/useFitText.js +148 -0
- package/build/src/hooks/useFitText.js.map +1 -0
- package/build/src/hooks/useFocusTrap.js +60 -0
- package/build/src/hooks/useFocusTrap.js.map +1 -0
- package/build/src/hooks/useGoogleFont.js +45 -0
- package/build/src/hooks/useGoogleFont.js.map +1 -0
- package/build/src/hooks/useIsMobile.js +17 -0
- package/build/src/hooks/useIsMobile.js.map +1 -0
- package/build/src/hooks/useIsMounted.js +12 -0
- package/build/src/hooks/useIsMounted.js.map +1 -0
- package/build/src/hooks/useLastConnector.js +24 -0
- package/build/src/hooks/useLastConnector.js.map +1 -0
- package/build/src/hooks/useLocales.js +67 -0
- package/build/src/hooks/useLocales.js.map +1 -0
- package/build/src/hooks/useLockBodyScroll.js +53 -0
- package/build/src/hooks/useLockBodyScroll.js.map +1 -0
- package/build/src/hooks/useModal.js +35 -0
- package/build/src/hooks/useModal.js.map +1 -0
- package/build/src/hooks/usePayWithSolanaToken.js +50 -0
- package/build/src/hooks/usePayWithSolanaToken.js.map +1 -0
- package/build/src/hooks/usePayWithToken.js +57 -0
- package/build/src/hooks/usePayWithToken.js.map +1 -0
- package/build/src/hooks/usePaymentState.js +243 -0
- package/build/src/hooks/usePaymentState.js.map +1 -0
- package/build/src/hooks/usePrevious.js +14 -0
- package/build/src/hooks/usePrevious.js.map +1 -0
- package/build/src/hooks/useSolanaPaymentOptions.js +37 -0
- package/build/src/hooks/useSolanaPaymentOptions.js.map +1 -0
- package/build/src/hooks/useWalletConnectModal.js +52 -0
- package/build/src/hooks/useWalletConnectModal.js.map +1 -0
- package/build/src/hooks/useWalletPaymentOptions.js +40 -0
- package/build/src/hooks/useWalletPaymentOptions.js.map +1 -0
- package/build/src/hooks/useWindowSize.js +23 -0
- package/build/src/hooks/useWindowSize.js.map +1 -0
- package/build/src/index.js +10 -0
- package/build/src/index.js.map +1 -0
- package/build/src/localizations/index.js +57 -0
- package/build/src/localizations/index.js.map +1 -0
- package/build/src/localizations/locales/ar-AE.js +97 -0
- package/build/src/localizations/locales/ar-AE.js.map +1 -0
- package/build/src/localizations/locales/ca-AD.js +95 -0
- package/build/src/localizations/locales/ca-AD.js.map +1 -0
- package/build/src/localizations/locales/ee-EE.js +95 -0
- package/build/src/localizations/locales/ee-EE.js.map +1 -0
- package/build/src/localizations/locales/en-US.js +95 -0
- package/build/src/localizations/locales/en-US.js.map +1 -0
- package/build/src/localizations/locales/es-ES.js +95 -0
- package/build/src/localizations/locales/es-ES.js.map +1 -0
- package/build/src/localizations/locales/fa-IR.js +95 -0
- package/build/src/localizations/locales/fa-IR.js.map +1 -0
- package/build/src/localizations/locales/fr-FR.js +95 -0
- package/build/src/localizations/locales/fr-FR.js.map +1 -0
- package/build/src/localizations/locales/ja-JP.js +95 -0
- package/build/src/localizations/locales/ja-JP.js.map +1 -0
- package/build/src/localizations/locales/pt-BR.js +95 -0
- package/build/src/localizations/locales/pt-BR.js.map +1 -0
- package/build/src/localizations/locales/ru-RU.js +95 -0
- package/build/src/localizations/locales/ru-RU.js.map +1 -0
- package/build/src/localizations/locales/tr-TR.js +95 -0
- package/build/src/localizations/locales/tr-TR.js.map +1 -0
- package/build/src/localizations/locales/vi-VN.js +95 -0
- package/build/src/localizations/locales/vi-VN.js.map +1 -0
- package/build/src/localizations/locales/zh-CN.js +95 -0
- package/build/src/localizations/locales/zh-CN.js.map +1 -0
- package/build/src/styles/defaultTheme.js +89 -0
- package/build/src/styles/defaultTheme.js.map +1 -0
- package/build/src/styles/index.js +329 -0
- package/build/src/styles/index.js.map +1 -0
- package/build/src/styles/styled/index.js +16 -0
- package/build/src/styles/styled/index.js.map +1 -0
- package/build/src/styles/themes/base.js +141 -0
- package/build/src/styles/themes/base.js.map +1 -0
- package/build/src/styles/themes/index.js +13 -0
- package/build/src/styles/themes/index.js.map +1 -0
- package/build/src/styles/themes/midnight.js +76 -0
- package/build/src/styles/themes/midnight.js.map +1 -0
- package/build/src/styles/themes/minimal.js +96 -0
- package/build/src/styles/themes/minimal.js.map +1 -0
- package/build/src/styles/themes/nouns.js +81 -0
- package/build/src/styles/themes/nouns.js.map +1 -0
- package/build/src/styles/themes/retro.js +106 -0
- package/build/src/styles/themes/retro.js.map +1 -0
- package/build/src/styles/themes/rounded.js +106 -0
- package/build/src/styles/themes/rounded.js.map +1 -0
- package/build/src/styles/themes/soft.js +71 -0
- package/build/src/styles/themes/soft.js.map +1 -0
- package/build/src/styles/themes/web95.js +132 -0
- package/build/src/styles/themes/web95.js.map +1 -0
- package/build/src/utils/exports.js +12 -0
- package/build/src/utils/exports.js.map +1 -0
- package/build/src/utils/index.js +39 -0
- package/build/src/utils/index.js.map +1 -0
- package/build/src/utils/p3.js +16 -0
- package/build/src/utils/p3.js.map +1 -0
- package/build/src/utils/platform.js +13 -0
- package/build/src/utils/platform.js.map +1 -0
- package/build/src/utils/trpc.js +14 -0
- package/build/src/utils/trpc.js.map +1 -0
- package/build/src/utils/wallets.js +14 -0
- package/build/src/utils/wallets.js.map +1 -0
- package/build/src/wallets/index.js +32 -0
- package/build/src/wallets/index.js.map +1 -0
- package/build/src/wallets/useWallets.js +86 -0
- package/build/src/wallets/useWallets.js.map +1 -0
- package/build/src/wallets/walletConfigs.js +362 -0
- package/build/src/wallets/walletConfigs.js.map +1 -0
- package/package.json +5 -5
- package/build/index.es.js +0 -11565
- package/build/index.es.js.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { css } from 'styled-components';
|
|
4
|
+
import styled from '../../../styles/styled/index.js';
|
|
5
|
+
import Button from '../Button/index.js';
|
|
6
|
+
import CopyToClipboardIcon from './CopyToClipboardIcon.js';
|
|
7
|
+
|
|
8
|
+
const Container = styled.div `
|
|
9
|
+
--color: var(--ck-copytoclipboard-stroke);
|
|
10
|
+
--bg: var(--ck-body-background);
|
|
11
|
+
transition: all 220ms cubic-bezier(0.175, 0.885, 0.32, 1.1);
|
|
12
|
+
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
margin-top: 4px;
|
|
18
|
+
gap: 8px;
|
|
19
|
+
|
|
20
|
+
${(props) => props.$disabled
|
|
21
|
+
? css `
|
|
22
|
+
cursor: not-allowed;
|
|
23
|
+
opacity: 0.4;
|
|
24
|
+
`
|
|
25
|
+
: css `
|
|
26
|
+
&:hover {
|
|
27
|
+
--color: var(--ck-body-color-muted);
|
|
28
|
+
}
|
|
29
|
+
`}
|
|
30
|
+
`;
|
|
31
|
+
const CopyToClipboard = ({ string, children, variant }) => {
|
|
32
|
+
const [clipboard, setClipboard] = useState(false);
|
|
33
|
+
let timeout;
|
|
34
|
+
const onCopy = () => {
|
|
35
|
+
if (!string)
|
|
36
|
+
return;
|
|
37
|
+
const str = string.trim();
|
|
38
|
+
if (navigator.clipboard) {
|
|
39
|
+
navigator.clipboard.writeText(str);
|
|
40
|
+
}
|
|
41
|
+
setClipboard(true);
|
|
42
|
+
clearTimeout(timeout);
|
|
43
|
+
timeout = setTimeout(() => setClipboard(false), 1000);
|
|
44
|
+
};
|
|
45
|
+
if (variant === "button")
|
|
46
|
+
return (jsx(Button, { disabled: !string, onClick: onCopy, icon: jsx(CopyToClipboardIcon, { copied: clipboard }), children: children }));
|
|
47
|
+
return (jsxs(Container, { onClick: onCopy, "$disabled": !string, children: [jsx(CopyToClipboardIcon, { copied: clipboard, dark: true }), children] }));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { CopyToClipboard as default };
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import QRCodeUtil from 'qrcode';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
const generateMatrix = (value, errorCorrectionLevel) => {
|
|
6
|
+
const arr = Array.prototype.slice.call(QRCodeUtil.create(value, { errorCorrectionLevel }).modules.data, 0);
|
|
7
|
+
const sqrt = Math.sqrt(arr.length);
|
|
8
|
+
return arr.reduce((rows, key, index) => (index % sqrt === 0
|
|
9
|
+
? rows.push([key])
|
|
10
|
+
: rows[rows.length - 1].push(key)) && rows, []);
|
|
11
|
+
};
|
|
12
|
+
function QRCode({ ecl = "M", size: sizeProp = 200, uri, clearArea = false, image, imageBackground = "transparent", }) {
|
|
13
|
+
const logoSize = clearArea ? 168 : 0;
|
|
14
|
+
const size = sizeProp - 10 * 2;
|
|
15
|
+
const dots = useMemo(() => {
|
|
16
|
+
const dots = [];
|
|
17
|
+
const matrix = generateMatrix(uri, ecl);
|
|
18
|
+
const cellSize = size / matrix.length;
|
|
19
|
+
let qrList = [
|
|
20
|
+
{ x: 0, y: 0 },
|
|
21
|
+
{ x: 1, y: 0 },
|
|
22
|
+
{ x: 0, y: 1 },
|
|
23
|
+
];
|
|
24
|
+
qrList.forEach(({ x, y }) => {
|
|
25
|
+
const x1 = (matrix.length - 7) * cellSize * x;
|
|
26
|
+
const y1 = (matrix.length - 7) * cellSize * y;
|
|
27
|
+
for (let i = 0; i < 3; i++) {
|
|
28
|
+
dots.push(jsx("rect", { fill: i % 2 !== 0
|
|
29
|
+
? "var(--ck-qr-background, var(--ck-body-background))"
|
|
30
|
+
: "var(--ck-qr-dot-color)", rx: (i - 2) * -5 + (i === 0 ? 2 : 3), ry: (i - 2) * -5 + (i === 0 ? 2 : 3), width: cellSize * (7 - i * 2), height: cellSize * (7 - i * 2), x: x1 + cellSize * i, y: y1 + cellSize * i }, `${i}-${x}-${y}`));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (image) {
|
|
34
|
+
const x1 = (matrix.length - 7) * cellSize * 1;
|
|
35
|
+
const y1 = (matrix.length - 7) * cellSize * 1;
|
|
36
|
+
dots.push(jsxs(Fragment, { children: [jsx("rect", { fill: imageBackground, rx: (0 - 2) * -5 + 2, ry: (0 - 2) * -5 + 2, width: cellSize * (7 - 0 * 2), height: cellSize * (7 - 0 * 2), x: x1 + cellSize * 0, y: y1 + cellSize * 0 }), jsx("foreignObject", { width: cellSize * (7 - 0 * 2), height: cellSize * (7 - 0 * 2), x: x1 + cellSize * 0, y: y1 + cellSize * 0, children: jsx("div", { style: { borderRadius: (0 - 2) * -5 + 2, overflow: "hidden" }, children: image }) })] }));
|
|
37
|
+
}
|
|
38
|
+
const clearArenaSize = Math.floor((logoSize + 25) / cellSize);
|
|
39
|
+
const matrixMiddleStart = matrix.length / 2 - clearArenaSize / 2;
|
|
40
|
+
const matrixMiddleEnd = matrix.length / 2 + clearArenaSize / 2 - 1;
|
|
41
|
+
matrix.forEach((row, i) => {
|
|
42
|
+
row.forEach((_, j) => {
|
|
43
|
+
if (matrix[i][j]) {
|
|
44
|
+
// Do not render dots under position squares
|
|
45
|
+
if (!((i < 7 && j < 7) ||
|
|
46
|
+
(i > matrix.length - 8 && j < 7) ||
|
|
47
|
+
(i < 7 && j > matrix.length - 8))) {
|
|
48
|
+
//if (image && i > matrix.length - 9 && j > matrix.length - 9) return;
|
|
49
|
+
if (image ||
|
|
50
|
+
!(i > matrixMiddleStart &&
|
|
51
|
+
i < matrixMiddleEnd &&
|
|
52
|
+
j > matrixMiddleStart &&
|
|
53
|
+
j < matrixMiddleEnd)) {
|
|
54
|
+
dots.push(jsx("circle", { cx: i * cellSize + cellSize / 2, cy: j * cellSize + cellSize / 2, fill: "var(--ck-qr-dot-color)", r: cellSize / 3 }, `circle-${i}-${j}`));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
return dots;
|
|
61
|
+
}, [ecl, size, uri]);
|
|
62
|
+
return (jsxs("svg", { height: size, width: size, viewBox: `0 0 ${size} ${size}`, style: {
|
|
63
|
+
width: size,
|
|
64
|
+
height: size,
|
|
65
|
+
}, children: [jsx("rect", { fill: "transparent", height: size, width: size }), dots] }));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { QRCode };
|
|
69
|
+
//# sourceMappingURL=QRCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QRCode.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { QRCodeContainer, QRCodeContent, LogoContainer, LogoIcon, QRPlaceholder } from './styles.js';
|
|
3
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
|
+
import Tooltip from '../Tooltip/index.js';
|
|
5
|
+
import useWindowSize from '../../../hooks/useWindowSize.js';
|
|
6
|
+
import { QRCode } from './QRCode.js';
|
|
7
|
+
|
|
8
|
+
function CustomQRCode({ value, image, imageBackground, imagePosition = "center", tooltipMessage, }) {
|
|
9
|
+
const windowSize = useWindowSize();
|
|
10
|
+
const Logo = windowSize.width > 920 && tooltipMessage ? (jsx(Tooltip, { xOffset: 139, yOffset: 5, delay: 0.1, message: tooltipMessage, children: image })) : (image);
|
|
11
|
+
return (jsx(QRCodeContainer, { children: jsxs(QRCodeContent, { children: [image && (jsx(LogoContainer, { children: jsx(LogoIcon, { "$wcLogo": imagePosition !== "center", style: {
|
|
12
|
+
background: imagePosition === "center" ? imageBackground : undefined,
|
|
13
|
+
}, children: Logo }) })), jsx(AnimatePresence, { initial: false, children: value ? (jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0, position: "absolute", inset: [0, 0] }, transition: {
|
|
14
|
+
duration: 0.2,
|
|
15
|
+
}, children: jsx(QRCode, { uri: value, size: 576, ecl: "H", clearArea: !!(imagePosition === "center" && image) }) }, value)) : (jsxs(QRPlaceholder, { initial: { opacity: 0.1 }, animate: { opacity: 0.1 }, exit: { opacity: 0, position: "absolute", inset: [0, 0] }, transition: {
|
|
16
|
+
duration: 0.2,
|
|
17
|
+
}, children: [jsx("span", {}), jsx("span", {}), jsx("span", {}), jsx("div", {})] })) })] }) }));
|
|
18
|
+
}
|
|
19
|
+
CustomQRCode.displayName = "CustomQRCode";
|
|
20
|
+
|
|
21
|
+
export { CustomQRCode as default };
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { motion } from 'framer-motion';
|
|
2
|
+
import { keyframes, css } from 'styled-components';
|
|
3
|
+
import styled from '../../../styles/styled/index.js';
|
|
4
|
+
|
|
5
|
+
const QRCodeContainer = styled(motion.div) `
|
|
6
|
+
z-index: 3;
|
|
7
|
+
position: relative;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
height: 0;
|
|
10
|
+
padding-bottom: 100% !important;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
margin: 1px 0 2px;
|
|
15
|
+
border-radius: var(--ck-qr-border-radius, 24px);
|
|
16
|
+
background: var(--ck-qr-background, transparent);
|
|
17
|
+
box-shadow: 0 0 0 1px var(--ck-qr-border-color);
|
|
18
|
+
backface-visibility: hidden;
|
|
19
|
+
svg {
|
|
20
|
+
display: block;
|
|
21
|
+
max-width: 100%;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: auto;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const QRCodeContent = styled(motion.div) `
|
|
27
|
+
position: absolute;
|
|
28
|
+
inset: 13px;
|
|
29
|
+
svg {
|
|
30
|
+
width: 100% !important;
|
|
31
|
+
height: auto !important;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
const PlaceholderKeyframes = keyframes `
|
|
35
|
+
0%{ background-position: 100% 0; }
|
|
36
|
+
100%{ background-position: -100% 0; }
|
|
37
|
+
`;
|
|
38
|
+
const QRPlaceholder = styled(motion.div) `
|
|
39
|
+
--color: var(--ck-qr-dot-color);
|
|
40
|
+
--bg: var(--ck-qr-background, var(--ck-body-background));
|
|
41
|
+
|
|
42
|
+
position: absolute;
|
|
43
|
+
inset: 0;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
> div {
|
|
48
|
+
z-index: 4;
|
|
49
|
+
position: relative;
|
|
50
|
+
width: 28%;
|
|
51
|
+
height: 28%;
|
|
52
|
+
border-radius: 20px;
|
|
53
|
+
background: var(--bg);
|
|
54
|
+
box-shadow: 0 0 0 7px var(--bg);
|
|
55
|
+
}
|
|
56
|
+
> span {
|
|
57
|
+
z-index: 4;
|
|
58
|
+
position: absolute;
|
|
59
|
+
background: var(--color);
|
|
60
|
+
border-radius: 12px;
|
|
61
|
+
width: 13.25%;
|
|
62
|
+
height: 13.25%;
|
|
63
|
+
box-shadow: 0 0 0 4px var(--bg);
|
|
64
|
+
&:before {
|
|
65
|
+
content: "";
|
|
66
|
+
position: absolute;
|
|
67
|
+
inset: 9px;
|
|
68
|
+
border-radius: 3px;
|
|
69
|
+
box-shadow: 0 0 0 4px var(--bg);
|
|
70
|
+
}
|
|
71
|
+
&:nth-child(1) {
|
|
72
|
+
top: 0;
|
|
73
|
+
left: 0;
|
|
74
|
+
}
|
|
75
|
+
&:nth-child(2) {
|
|
76
|
+
top: 0;
|
|
77
|
+
right: 0;
|
|
78
|
+
}
|
|
79
|
+
&:nth-child(3) {
|
|
80
|
+
bottom: 0;
|
|
81
|
+
left: 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
&:before {
|
|
85
|
+
z-index: 3;
|
|
86
|
+
content: "";
|
|
87
|
+
position: absolute;
|
|
88
|
+
inset: 0;
|
|
89
|
+
background: repeat;
|
|
90
|
+
background-size: 1.888% 1.888%;
|
|
91
|
+
background-image: radial-gradient(var(--color) 41%, transparent 41%);
|
|
92
|
+
}
|
|
93
|
+
&:after {
|
|
94
|
+
z-index: 5;
|
|
95
|
+
content: "";
|
|
96
|
+
position: absolute;
|
|
97
|
+
inset: 0;
|
|
98
|
+
transform: scale(1.5) rotate(45deg);
|
|
99
|
+
background-image: linear-gradient(
|
|
100
|
+
90deg,
|
|
101
|
+
rgba(255, 255, 255, 0) 50%,
|
|
102
|
+
rgba(255, 255, 255, 1),
|
|
103
|
+
rgba(255, 255, 255, 0)
|
|
104
|
+
);
|
|
105
|
+
background-size: 200% 100%;
|
|
106
|
+
animation: ${PlaceholderKeyframes} 1000ms linear infinite both;
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
const LogoContainer = styled(motion.div) `
|
|
110
|
+
z-index: 6;
|
|
111
|
+
position: absolute;
|
|
112
|
+
top: 0;
|
|
113
|
+
left: 0;
|
|
114
|
+
width: 100%;
|
|
115
|
+
height: 100%;
|
|
116
|
+
transform: translateY(50%) scale(0.9999); // Shifting fix
|
|
117
|
+
`;
|
|
118
|
+
const LogoIcon = styled(motion.div) `
|
|
119
|
+
z-index: 6;
|
|
120
|
+
position: absolute;
|
|
121
|
+
left: 50%;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
|
|
124
|
+
transform: translate(-50%, -50%) scale(0.9999); // Shifting fix
|
|
125
|
+
|
|
126
|
+
svg {
|
|
127
|
+
display: block;
|
|
128
|
+
position: relative;
|
|
129
|
+
width: 100%;
|
|
130
|
+
height: 100%;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
${(props) => props.$wcLogo
|
|
134
|
+
? css `
|
|
135
|
+
width: 29%;
|
|
136
|
+
height: 20.5%;
|
|
137
|
+
`
|
|
138
|
+
: css `
|
|
139
|
+
width: 28%;
|
|
140
|
+
height: 28%;
|
|
141
|
+
border-radius: 17px;
|
|
142
|
+
&:before {
|
|
143
|
+
pointer-events: none;
|
|
144
|
+
z-index: 2;
|
|
145
|
+
content: "";
|
|
146
|
+
position: absolute;
|
|
147
|
+
inset: 0;
|
|
148
|
+
border-radius: inherit;
|
|
149
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
|
|
150
|
+
}
|
|
151
|
+
`}
|
|
152
|
+
`;
|
|
153
|
+
|
|
154
|
+
export { LogoContainer, LogoIcon, PlaceholderKeyframes, QRCodeContainer, QRCodeContent, QRPlaceholder };
|
|
155
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import useFitText from '../../../hooks/useFitText.js';
|
|
4
|
+
|
|
5
|
+
const FitText = ({ children }) => {
|
|
6
|
+
const [ready, setReady] = React.useState(false);
|
|
7
|
+
const { fontSize, ref: textRef } = useFitText({
|
|
8
|
+
logLevel: "none",
|
|
9
|
+
maxFontSize: 100,
|
|
10
|
+
minFontSize: 70,
|
|
11
|
+
onStart: () => setReady(true),
|
|
12
|
+
onFinish: () => setReady(true),
|
|
13
|
+
});
|
|
14
|
+
return (jsx("div", { ref: textRef, style: {
|
|
15
|
+
visibility: ready ? "visible" : "hidden",
|
|
16
|
+
fontSize: `${fontSize}%`,
|
|
17
|
+
maxHeight: "100%",
|
|
18
|
+
maxWidth: "100%",
|
|
19
|
+
display: "flex",
|
|
20
|
+
justifyContent: "center",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
}, children: children }));
|
|
23
|
+
};
|
|
24
|
+
FitText.displayName = "FitText";
|
|
25
|
+
|
|
26
|
+
export { FitText as default };
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useEffect, useState, useCallback, useRef } from 'react';
|
|
3
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
|
+
import { ResetContainer } from '../../../styles/index.js';
|
|
5
|
+
import Portal from '../Portal/index.js';
|
|
6
|
+
import { isMobile, flattenChildren, isWalletConnectConnector } from '../../../utils/index.js';
|
|
7
|
+
import { ModalContainer, BackgroundOverlay, Container, BoxContainer, DisclaimerBackground, Disclaimer, ErrorMessage, ControllerContainer, CloseButton, BackButton, InfoButton, ModalHeading, InnerContainer, PageContents, PageContainer, TextWithHr } from './styles.js';
|
|
8
|
+
import useLockBodyScroll from '../../../hooks/useLockBodyScroll.js';
|
|
9
|
+
import { usePayContext, ROUTES } from '../../DaimoPay.js';
|
|
10
|
+
import { getChainName } from '@daimo/contract';
|
|
11
|
+
import { useTransition } from 'react-transition-state';
|
|
12
|
+
import { useAccount, useSwitchChain } from 'wagmi';
|
|
13
|
+
import FocusTrap from '../../../hooks/useFocusTrap.js';
|
|
14
|
+
import useLocales from '../../../hooks/useLocales.js';
|
|
15
|
+
import usePrevious from '../../../hooks/usePrevious.js';
|
|
16
|
+
import { useWallet } from '../../../wallets/useWallets.js';
|
|
17
|
+
import { useThemeContext } from '../../DaimoPayThemeProvider/DaimoPayThemeProvider.js';
|
|
18
|
+
import FitText from '../FitText/index.js';
|
|
19
|
+
|
|
20
|
+
const InfoIcon = ({ ...props }) => (jsx("svg", { "aria-hidden": "true", width: "22", height: "22", viewBox: "0 0 22 22", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M20 11C20 15.9706 15.9706 20 11 20C6.02944 20 2 15.9706 2 11C2 6.02944 6.02944 2 11 2C15.9706 2 20 6.02944 20 11ZM22 11C22 17.0751 17.0751 22 11 22C4.92487 22 0 17.0751 0 11C0 4.92487 4.92487 0 11 0C17.0751 0 22 4.92487 22 11ZM11.6445 12.7051C11.6445 13.1348 11.3223 13.4678 10.7744 13.4678C10.2266 13.4678 9.92578 13.1885 9.92578 12.6191V12.4795C9.92578 11.4268 10.4951 10.8574 11.2686 10.3203C12.2031 9.67578 12.665 9.32129 12.665 8.59082C12.665 7.76367 12.0205 7.21582 11.043 7.21582C10.3232 7.21582 9.80762 7.57031 9.45312 8.16113C9.38282 8.24242 9.32286 8.32101 9.2667 8.39461C9.04826 8.68087 8.88747 8.8916 8.40039 8.8916C8.0459 8.8916 7.66992 8.62305 7.66992 8.15039C7.66992 7.96777 7.70215 7.7959 7.75586 7.61328C8.05664 6.625 9.27051 5.75488 11.1182 5.75488C12.9336 5.75488 14.5234 6.71094 14.5234 8.50488C14.5234 9.7832 13.7822 10.417 12.7402 11.1045C11.999 11.5986 11.6445 11.9746 11.6445 12.5762V12.7051ZM11.9131 15.5625C11.9131 16.1855 11.376 16.6797 10.7529 16.6797C10.1299 16.6797 9.59277 16.1748 9.59277 15.5625C9.59277 14.9395 10.1191 14.4453 10.7529 14.4453C11.3867 14.4453 11.9131 14.9287 11.9131 15.5625Z", fill: "currentColor" }) }));
|
|
21
|
+
const CloseIcon = ({ ...props }) => (jsx(motion.svg, { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "M1 13L13 1M1 1L13 13", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
22
|
+
const BackIcon = ({ ...props }) => (jsx(motion.svg, { width: 9, height: 16, viewBox: "0 0 9 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "M8 1L1 8L8 15", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
23
|
+
const contentTransitionDuration = 0.22;
|
|
24
|
+
const contentVariants = {
|
|
25
|
+
initial: {
|
|
26
|
+
//willChange: 'transform,opacity',
|
|
27
|
+
zIndex: 2,
|
|
28
|
+
opacity: 0,
|
|
29
|
+
},
|
|
30
|
+
animate: {
|
|
31
|
+
opacity: 1,
|
|
32
|
+
scale: 1,
|
|
33
|
+
transition: {
|
|
34
|
+
duration: contentTransitionDuration * 0.75,
|
|
35
|
+
delay: contentTransitionDuration * 0.25,
|
|
36
|
+
ease: [0.26, 0.08, 0.25, 1],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
exit: {
|
|
40
|
+
zIndex: 1,
|
|
41
|
+
opacity: 0,
|
|
42
|
+
pointerEvents: "none",
|
|
43
|
+
position: "absolute",
|
|
44
|
+
left: ["50%", "50%"],
|
|
45
|
+
x: ["-50%", "-50%"],
|
|
46
|
+
transition: {
|
|
47
|
+
duration: contentTransitionDuration,
|
|
48
|
+
ease: [0.26, 0.08, 0.25, 1],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const Modal = ({ open, pages, pageId, positionInside, inline, demo, onClose, onBack, onInfo, }) => {
|
|
53
|
+
const context = usePayContext();
|
|
54
|
+
const themeContext = useThemeContext();
|
|
55
|
+
const mobile = isMobile();
|
|
56
|
+
const { daimoPayOrder, selectedExternalOption, selectedTokenOption, selectedSolanaTokenOption, selectedDepositAddressOption, } = context.paymentState;
|
|
57
|
+
const wallet = useWallet(context.connector?.id);
|
|
58
|
+
const walletInfo = {
|
|
59
|
+
name: wallet?.name,
|
|
60
|
+
shortName: wallet?.shortName ?? wallet?.name,
|
|
61
|
+
icon: wallet?.iconConnector ?? wallet?.icon,
|
|
62
|
+
iconShape: wallet?.iconShape ?? "circle",
|
|
63
|
+
iconShouldShrink: wallet?.iconShouldShrink,
|
|
64
|
+
};
|
|
65
|
+
const locales = useLocales({
|
|
66
|
+
CONNECTORNAME: walletInfo?.name,
|
|
67
|
+
});
|
|
68
|
+
const [state, setOpen] = useTransition({
|
|
69
|
+
timeout: mobile ? 160 : 160, // different animations, 10ms extra to avoid final-frame drops
|
|
70
|
+
preEnter: true,
|
|
71
|
+
mountOnEnter: true,
|
|
72
|
+
unmountOnExit: true,
|
|
73
|
+
});
|
|
74
|
+
const mounted = !(state === "exited" || state === "unmounted");
|
|
75
|
+
const rendered = state === "preEnter" || state !== "exiting";
|
|
76
|
+
const currentDepth = context.route === ROUTES.CONNECTORS
|
|
77
|
+
? 0
|
|
78
|
+
: context.route === ROUTES.DOWNLOAD
|
|
79
|
+
? 2
|
|
80
|
+
: 1;
|
|
81
|
+
const prevDepth = usePrevious(currentDepth, currentDepth);
|
|
82
|
+
if (!positionInside)
|
|
83
|
+
useLockBodyScroll(mounted);
|
|
84
|
+
usePrevious(pageId, pageId);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
setOpen(open);
|
|
87
|
+
if (open)
|
|
88
|
+
setInTransition(undefined);
|
|
89
|
+
}, [open]);
|
|
90
|
+
const [dimensions, setDimensions] = useState({
|
|
91
|
+
width: undefined,
|
|
92
|
+
height: undefined,
|
|
93
|
+
});
|
|
94
|
+
const [inTransition, setInTransition] = useState(undefined);
|
|
95
|
+
// Calculate new content bounds
|
|
96
|
+
const updateBounds = (node) => {
|
|
97
|
+
const bounds = {
|
|
98
|
+
width: node?.offsetWidth,
|
|
99
|
+
height: node?.offsetHeight,
|
|
100
|
+
};
|
|
101
|
+
setDimensions({
|
|
102
|
+
width: `${bounds?.width}px`,
|
|
103
|
+
height: `${bounds?.height}px`,
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
let blockTimeout;
|
|
107
|
+
const contentRef = useCallback((node) => {
|
|
108
|
+
if (!node)
|
|
109
|
+
return;
|
|
110
|
+
ref.current = node;
|
|
111
|
+
// Avoid transition mixups
|
|
112
|
+
setInTransition(inTransition === undefined ? false : true);
|
|
113
|
+
clearTimeout(blockTimeout);
|
|
114
|
+
blockTimeout = setTimeout(() => setInTransition(false), 360);
|
|
115
|
+
// Calculate new content bounds
|
|
116
|
+
updateBounds(node);
|
|
117
|
+
}, [open, inTransition]);
|
|
118
|
+
// Update layout on chain/network switch to avoid clipping
|
|
119
|
+
const { chain } = useAccount();
|
|
120
|
+
const { switchChain } = useSwitchChain();
|
|
121
|
+
const ref = useRef(null);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (ref.current)
|
|
124
|
+
updateBounds(ref.current);
|
|
125
|
+
}, [chain, switchChain, mobile, context.options, context.resize]);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (!mounted) {
|
|
128
|
+
setDimensions({
|
|
129
|
+
width: undefined,
|
|
130
|
+
height: undefined,
|
|
131
|
+
});
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const listener = (e) => {
|
|
135
|
+
if (e.key === "Escape" && onClose)
|
|
136
|
+
onClose();
|
|
137
|
+
};
|
|
138
|
+
document.addEventListener("keydown", listener);
|
|
139
|
+
return () => {
|
|
140
|
+
document.removeEventListener("keydown", listener);
|
|
141
|
+
};
|
|
142
|
+
}, [mounted, onClose]);
|
|
143
|
+
const dimensionsCSS = {
|
|
144
|
+
"--height": dimensions.height,
|
|
145
|
+
"--width": dimensions.width,
|
|
146
|
+
};
|
|
147
|
+
function shouldUseQrcode() {
|
|
148
|
+
if (!wallet)
|
|
149
|
+
return false; // Fail states are shown in the injector flow
|
|
150
|
+
const useInjector = !wallet.getWalletConnectDeeplink || wallet.isInstalled;
|
|
151
|
+
return !useInjector;
|
|
152
|
+
}
|
|
153
|
+
function getHeading() {
|
|
154
|
+
switch (context.route) {
|
|
155
|
+
case ROUTES.ABOUT:
|
|
156
|
+
return locales.aboutScreen_heading;
|
|
157
|
+
case ROUTES.CONNECT:
|
|
158
|
+
if (shouldUseQrcode()) {
|
|
159
|
+
return isWalletConnectConnector(wallet?.connector?.id)
|
|
160
|
+
? locales.scanScreen_heading
|
|
161
|
+
: locales.scanScreen_heading_withConnector;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return walletInfo?.name;
|
|
165
|
+
}
|
|
166
|
+
case ROUTES.SOLANA_CONNECT:
|
|
167
|
+
return "Connect Solana Wallet";
|
|
168
|
+
case ROUTES.SOLANA_CONNECTOR:
|
|
169
|
+
return context.solanaConnector ?? "Solana Wallet";
|
|
170
|
+
case ROUTES.CONNECTORS:
|
|
171
|
+
return locales.connectorsScreen_heading;
|
|
172
|
+
case ROUTES.MOBILECONNECTORS:
|
|
173
|
+
return locales.mobileConnectorsScreen_heading;
|
|
174
|
+
case ROUTES.DOWNLOAD:
|
|
175
|
+
return locales.downloadAppScreen_heading;
|
|
176
|
+
case ROUTES.ONBOARDING:
|
|
177
|
+
return locales.onboardingScreen_heading;
|
|
178
|
+
case ROUTES.SWITCHNETWORKS:
|
|
179
|
+
return locales.switchNetworkScreen_heading;
|
|
180
|
+
case ROUTES.SELECT_METHOD:
|
|
181
|
+
case ROUTES.SELECT_TOKEN:
|
|
182
|
+
case ROUTES.SOLANA_SELECT_TOKEN:
|
|
183
|
+
return daimoPayOrder?.metadata.intent;
|
|
184
|
+
case ROUTES.SOLANA_PAY_WITH_TOKEN:
|
|
185
|
+
if (!selectedSolanaTokenOption)
|
|
186
|
+
return undefined;
|
|
187
|
+
return `Pay with ${selectedSolanaTokenOption.required.token.symbol}`;
|
|
188
|
+
case ROUTES.WAITING_OTHER:
|
|
189
|
+
return selectedExternalOption?.cta;
|
|
190
|
+
case ROUTES.SELECT_DEPOSIT_ADDRESS_CHAIN:
|
|
191
|
+
return "Select Chain";
|
|
192
|
+
case ROUTES.WAITING_DEPOSIT_ADDRESS:
|
|
193
|
+
if (!selectedDepositAddressOption)
|
|
194
|
+
return undefined;
|
|
195
|
+
return `Pay with ${selectedDepositAddressOption.id}`;
|
|
196
|
+
case ROUTES.PAY_WITH_TOKEN:
|
|
197
|
+
if (!selectedTokenOption)
|
|
198
|
+
return undefined;
|
|
199
|
+
const chainName = getChainName(selectedTokenOption.required.token.chainId ?? 0);
|
|
200
|
+
const capitalizedChainName = chainName.charAt(0).toUpperCase() + chainName.slice(1);
|
|
201
|
+
return `Pay with ${capitalizedChainName} ${selectedTokenOption.required.token.symbol}`;
|
|
202
|
+
case ROUTES.CONFIRMATION:
|
|
203
|
+
return "Payment Successful";
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const Content = (jsx(ResetContainer, { "$useTheme": demo?.theme ?? themeContext.theme, "$useMode": demo?.mode ?? themeContext.mode, "$customTheme": demo?.customTheme ?? themeContext.customTheme, children: jsxs(ModalContainer, { role: "dialog", style: {
|
|
207
|
+
pointerEvents: rendered ? "auto" : "none",
|
|
208
|
+
position: positionInside ? "absolute" : undefined,
|
|
209
|
+
}, children: [!inline && (jsx(BackgroundOverlay, { "$active": rendered, onClick: onClose, "$blur": context.options?.overlayBlur })), jsxs(Container, { style: dimensionsCSS, initial: false, children: [jsx("div", { style: {
|
|
210
|
+
pointerEvents: inTransition ? "all" : "none", // Block interaction while transitioning
|
|
211
|
+
position: "absolute",
|
|
212
|
+
top: 0,
|
|
213
|
+
bottom: 0,
|
|
214
|
+
left: "50%",
|
|
215
|
+
transform: "translateX(-50%)",
|
|
216
|
+
width: "var(--width)",
|
|
217
|
+
zIndex: 9,
|
|
218
|
+
transition: "width 200ms ease",
|
|
219
|
+
} }), jsxs(BoxContainer, { className: `${rendered && "active"}`, children: [jsx(AnimatePresence, { initial: false, children: context.options?.disclaimer &&
|
|
220
|
+
context.route === ROUTES.CONNECTORS && (jsx(DisclaimerBackground, { initial: {
|
|
221
|
+
opacity: 0,
|
|
222
|
+
}, animate: {
|
|
223
|
+
opacity: 1,
|
|
224
|
+
}, exit: { opacity: 0 }, transition: {
|
|
225
|
+
delay: 0,
|
|
226
|
+
duration: 0.2,
|
|
227
|
+
ease: [0.25, 0.1, 0.25, 1.0],
|
|
228
|
+
}, children: jsx(Disclaimer, { children: jsx("div", { children: context.options?.disclaimer }) }) })) }), jsx(AnimatePresence, { initial: false, children: context.errorMessage && (jsxs(ErrorMessage, { initial: { y: "10%", x: "-50%" }, animate: { y: "-100%" }, exit: { y: "100%" }, transition: { duration: 0.2, ease: "easeInOut" }, children: [jsx("span", { children: context.errorMessage }), jsx("div", { onClick: () => context.displayError(null), style: {
|
|
229
|
+
position: "absolute",
|
|
230
|
+
right: 24,
|
|
231
|
+
top: 24,
|
|
232
|
+
cursor: "pointer",
|
|
233
|
+
}, children: jsx(CloseIcon, {}) })] })) }), jsxs(ControllerContainer, { children: [onClose && (jsx(CloseButton, { "aria-label": flattenChildren(locales.close).toString(), onClick: onClose, children: jsx(CloseIcon, {}) })), jsx("div", { style: {
|
|
234
|
+
position: "absolute",
|
|
235
|
+
top: 23,
|
|
236
|
+
left: 20,
|
|
237
|
+
width: 32,
|
|
238
|
+
height: 32,
|
|
239
|
+
}, children: jsx(AnimatePresence, { children: onBack ? (jsx(BackButton, { disabled: inTransition, "aria-label": flattenChildren(locales.back).toString(), onClick: onBack, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: {
|
|
240
|
+
duration: mobile ? 0 : 0.1,
|
|
241
|
+
delay: mobile ? 0.01 : 0,
|
|
242
|
+
}, children: jsx(BackIcon, {}) }, "backButton")) : (onInfo &&
|
|
243
|
+
!context.options?.hideQuestionMarkCTA && (jsx(InfoButton, { disabled: inTransition, "aria-label": flattenChildren(locales.moreInformation).toString(), onClick: onInfo, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: {
|
|
244
|
+
duration: mobile ? 0 : 0.1,
|
|
245
|
+
delay: mobile ? 0.01 : 0,
|
|
246
|
+
}, children: jsx(InfoIcon, {}) }, "infoButton"))) }) })] }), jsx(ModalHeading, { children: jsx(AnimatePresence, { children: jsx(motion.div, { style: {
|
|
247
|
+
position: "absolute",
|
|
248
|
+
top: 0,
|
|
249
|
+
bottom: 0,
|
|
250
|
+
left: 52,
|
|
251
|
+
right: 52,
|
|
252
|
+
display: "flex",
|
|
253
|
+
//alignItems: 'center',
|
|
254
|
+
justifyContent: "center",
|
|
255
|
+
}, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: {
|
|
256
|
+
duration: mobile ? 0 : 0.17,
|
|
257
|
+
delay: mobile ? 0.01 : 0,
|
|
258
|
+
}, children: jsx(FitText, { children: getHeading() }) }, `${context.route}`) }) }), jsx(InnerContainer, { children: Object.keys(pages).map((key) => (jsx(Page, { open: key === pageId, initial: !positionInside && state !== "entered", enterAnim: key === pageId
|
|
259
|
+
? currentDepth > prevDepth
|
|
260
|
+
? "active-scale-up"
|
|
261
|
+
: "active"
|
|
262
|
+
: "", exitAnim: key !== pageId
|
|
263
|
+
? currentDepth < prevDepth
|
|
264
|
+
? "exit-scale-down"
|
|
265
|
+
: "exit"
|
|
266
|
+
: "", children: jsx(PageContents, { ref: contentRef, style: {
|
|
267
|
+
pointerEvents: key === pageId && rendered ? "auto" : "none",
|
|
268
|
+
}, children: pages[key] }, `inner-${key}`) }, key))) })] })] })] }) }));
|
|
269
|
+
return (jsx(Fragment, { children: mounted && (jsx(Fragment, { children: positionInside ? (Content) : (jsx(Fragment, { children: jsx(Portal, { children: jsx(FocusTrap, { children: Content }) }) })) })) }));
|
|
270
|
+
};
|
|
271
|
+
const Page = ({ children, open, initial, prevDepth, currentDepth, enterAnim, exitAnim, }) => {
|
|
272
|
+
const [state, setOpen] = useTransition({
|
|
273
|
+
timeout: 400,
|
|
274
|
+
preEnter: true,
|
|
275
|
+
initialEntered: open,
|
|
276
|
+
mountOnEnter: true,
|
|
277
|
+
unmountOnExit: true,
|
|
278
|
+
});
|
|
279
|
+
const mounted = !(state === "exited" || state === "unmounted");
|
|
280
|
+
const rendered = state === "preEnter" || state !== "exiting";
|
|
281
|
+
useEffect(() => {
|
|
282
|
+
setOpen(open);
|
|
283
|
+
}, [open]);
|
|
284
|
+
if (!mounted)
|
|
285
|
+
return null;
|
|
286
|
+
return (jsx(PageContainer, { className: `${rendered ? enterAnim : exitAnim}`, style: {
|
|
287
|
+
animationDuration: initial ? "0ms" : undefined,
|
|
288
|
+
animationDelay: initial ? "0ms" : undefined,
|
|
289
|
+
}, children: children }));
|
|
290
|
+
};
|
|
291
|
+
const OrDivider = ({ children }) => {
|
|
292
|
+
const locales = useLocales();
|
|
293
|
+
return (jsx(TextWithHr, { children: jsx("span", { children: children ?? locales.or }) }));
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export { OrDivider, contentVariants, Modal as default };
|
|
297
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|