@daimo/pay 1.3.4 → 1.5.0
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 +6 -1
- package/build/package.json.js +3 -3
- package/build/src/components/Common/PoweredByFooter/index.js +4 -1
- package/build/src/components/Common/PoweredByFooter/index.js.map +1 -1
- package/build/src/components/DaimoPay.js +4 -0
- package/build/src/components/DaimoPay.js.map +1 -1
- package/build/src/components/DaimoPayButton/index.js +6 -0
- package/build/src/components/DaimoPayButton/index.js.map +1 -1
- package/build/src/components/DaimoPayModal/ConnectWithInjector/index.js +2 -2
- package/build/src/hooks/useExternalPaymentOptions.js +1 -0
- package/build/src/hooks/useExternalPaymentOptions.js.map +1 -1
- package/build/src/hooks/usePaymentState.js +3 -1
- package/build/src/hooks/usePaymentState.js.map +1 -1
- package/build/src/utils/supportUrl.js +10 -11
- package/build/src/utils/supportUrl.js.map +1 -1
- package/package.json +3 -3
package/build/index.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ type DaimoPayModalOptions = {
|
|
|
70
70
|
closeOnSuccess?: boolean;
|
|
71
71
|
};
|
|
72
72
|
/** Additional payment options. Onchain payments are always enabled. */
|
|
73
|
-
type PaymentOption = "Daimo" | "Coinbase" | "Binance" | "RampNetwork" | "Solana" | "ExternalChains";
|
|
73
|
+
type PaymentOption = "Daimo" | "Coinbase" | "Binance" | "RampNetwork" | "Solana" | "ExternalChains" | "Lemon";
|
|
74
74
|
|
|
75
75
|
type types_d_All = All;
|
|
76
76
|
type types_d_CustomAvatarProps = CustomAvatarProps;
|
|
@@ -287,6 +287,9 @@ type ContextValue = {
|
|
|
287
287
|
/** Custom message to display on confirmation page. */
|
|
288
288
|
confirmationMessage?: string;
|
|
289
289
|
setConfirmationMessage: React$1.Dispatch<React$1.SetStateAction<string | undefined>>;
|
|
290
|
+
/** Redirect URL to return to the app. E.g. after Coinbase, Binance, RampNetwork. */
|
|
291
|
+
redirectReturnUrl?: string;
|
|
292
|
+
setRedirectReturnUrl: React$1.Dispatch<React$1.SetStateAction<string | undefined>>;
|
|
290
293
|
} & useConnectCallbackProps;
|
|
291
294
|
/** Meant for internal use. This will be non-exported in a future SDK version. */
|
|
292
295
|
declare const Context: React$1.Context<ContextValue | null>;
|
|
@@ -404,6 +407,8 @@ type PayButtonCommonProps = PayButtonPaymentProps & {
|
|
|
404
407
|
defaultOpen?: boolean;
|
|
405
408
|
/** Custom message to display on confirmation page. */
|
|
406
409
|
confirmationMessage?: string;
|
|
410
|
+
/** Redirect URL to return to the app. E.g. after Coinbase, Binance, RampNetwork. */
|
|
411
|
+
redirectReturnUrl?: string;
|
|
407
412
|
};
|
|
408
413
|
type DaimoPayButtonProps = PayButtonCommonProps & {
|
|
409
414
|
/** Light mode, dark mode, or auto. */
|
package/build/package.json.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var name = "@daimo/pay";
|
|
2
|
-
var version = "1.
|
|
2
|
+
var version = "1.5.0";
|
|
3
3
|
var author = "Daimo";
|
|
4
4
|
var homepage = "https://pay.daimo.com";
|
|
5
5
|
var license = "BSD-2-Clause license";
|
|
@@ -38,8 +38,8 @@ var keywords = [
|
|
|
38
38
|
"crypto"
|
|
39
39
|
];
|
|
40
40
|
var dependencies = {
|
|
41
|
-
"@daimo/common": "1.
|
|
42
|
-
"@daimo/contract": "1.
|
|
41
|
+
"@daimo/common": "1.5.0",
|
|
42
|
+
"@daimo/contract": "1.5.0",
|
|
43
43
|
"@solana/wallet-adapter-base": "^0.9.23",
|
|
44
44
|
"@solana/wallet-adapter-react": "^0.15.35",
|
|
45
45
|
"@solana/web3.js": "^1.95.4",
|
|
@@ -4,6 +4,7 @@ import { useState, useEffect } from 'react';
|
|
|
4
4
|
import { keyframes } from 'styled-components';
|
|
5
5
|
import CrepeIcon from '../../../assets/crepe.js';
|
|
6
6
|
import styled from '../../../styles/styled/index.js';
|
|
7
|
+
import { daimoPayVersion } from '../../../utils/exports.js';
|
|
7
8
|
|
|
8
9
|
const PoweredByFooter = ({ supportUrl } = {}) => {
|
|
9
10
|
const [supportVisible, setSupportVisible] = useState(false);
|
|
@@ -17,7 +18,9 @@ const PoweredByFooter = ({ supportUrl } = {}) => {
|
|
|
17
18
|
return () => clearTimeout(timer);
|
|
18
19
|
}, []);
|
|
19
20
|
return (jsx(Container, { children: jsxs(TextButton, { onClick: () => {
|
|
20
|
-
window.open(supportVisible
|
|
21
|
+
window.open(supportVisible
|
|
22
|
+
? supportUrl
|
|
23
|
+
: `https://pay.daimo.com?ref=paykit-v${daimoPayVersion}`, "_blank");
|
|
21
24
|
}, className: supportVisible ? "support" : "", children: [!supportVisible && jsx(CrepeIcon, {}), jsx("span", { children: supportVisible ? (jsxs(Fragment, { children: ["Need help? ", jsx(Underline, { children: "Contact support" })] })) : (jsx(Fragment, { children: "Powered by Daimo Pay" })) })] }) }));
|
|
22
25
|
};
|
|
23
26
|
const Container = styled(motion.div) `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -129,6 +129,7 @@ const DaimoPayProviderWithoutSolana = ({ children, theme = "auto", mode = "auto"
|
|
|
129
129
|
};
|
|
130
130
|
const [errorMessage, setErrorMessage] = useState("");
|
|
131
131
|
const [confirmationMessage, setConfirmationMessage] = useState(undefined);
|
|
132
|
+
const [redirectReturnUrl, setRedirectReturnUrl] = useState(undefined);
|
|
132
133
|
const [resize, onResize] = useState(0);
|
|
133
134
|
// Include Google Font that is needed for a themes
|
|
134
135
|
if (opts.embedGoogleFonts)
|
|
@@ -170,6 +171,7 @@ const DaimoPayProviderWithoutSolana = ({ children, theme = "auto", mode = "auto"
|
|
|
170
171
|
setDaimoPayOrder,
|
|
171
172
|
setOpen,
|
|
172
173
|
log,
|
|
174
|
+
redirectReturnUrl,
|
|
173
175
|
});
|
|
174
176
|
// When a payment is in progress, poll for status updates. Do this regardless
|
|
175
177
|
// of whether the modal is still being displayed for useDaimoPayStatus().
|
|
@@ -235,6 +237,8 @@ const DaimoPayProviderWithoutSolana = ({ children, theme = "auto", mode = "auto"
|
|
|
235
237
|
errorMessage,
|
|
236
238
|
confirmationMessage,
|
|
237
239
|
setConfirmationMessage,
|
|
240
|
+
redirectReturnUrl,
|
|
241
|
+
setRedirectReturnUrl,
|
|
238
242
|
debugMode,
|
|
239
243
|
log,
|
|
240
244
|
displayError: (message, code) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DaimoPay.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DaimoPay.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -55,6 +55,12 @@ function DaimoPayButtonCustom(props) {
|
|
|
55
55
|
setConfirmationMessage(props.confirmationMessage);
|
|
56
56
|
}
|
|
57
57
|
}, [props.confirmationMessage, setConfirmationMessage]);
|
|
58
|
+
const { setRedirectReturnUrl } = context;
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (props.redirectReturnUrl) {
|
|
61
|
+
setRedirectReturnUrl(props.redirectReturnUrl);
|
|
62
|
+
}
|
|
63
|
+
}, [props.redirectReturnUrl, setRedirectReturnUrl]);
|
|
58
64
|
// Payment events: call these three event handlers.
|
|
59
65
|
const { onPaymentStarted, onPaymentCompleted, onPaymentBounced } = props;
|
|
60
66
|
const order = paymentState.daimoPayOrder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -7,7 +7,7 @@ import Button from '../../Common/Button/index.js';
|
|
|
7
7
|
import { PageContent, ModalHeading, ModalContent, ModalContentContainer, ModalH1, ModalBody } from '../../Common/Modal/styles.js';
|
|
8
8
|
import Tooltip from '../../Common/Tooltip/index.js';
|
|
9
9
|
import SquircleSpinner from '../../Spinners/SquircleSpinner/index.js';
|
|
10
|
-
import { RetryIconCircle, AlertIcon, TickIcon } from '../../../assets/icons.js';
|
|
10
|
+
import { RetryIconCircle, AlertIcon, ExternalLinkIcon, TickIcon } from '../../../assets/icons.js';
|
|
11
11
|
import { useConnect } from '../../../hooks/useConnect.js';
|
|
12
12
|
import useLocales from '../../../hooks/useLocales.js';
|
|
13
13
|
import { detectBrowser, isWalletConnectConnector } from '../../../utils/index.js';
|
|
@@ -195,7 +195,7 @@ const ConnectWithInjector = ({ switchConnectMethod, forceState }) => {
|
|
|
195
195
|
? locales.injectionScreen_connecting_injected_h1
|
|
196
196
|
: locales.injectionScreen_connecting_h1 }), jsx(ModalBody, { children: wallet.connector.id === "injected"
|
|
197
197
|
? locales.injectionScreen_connecting_injected_p
|
|
198
|
-
: locales.injectionScreen_connecting_p })] }) }, states.CONNECTING)), status === states.CONNECTED && (jsx(Content, { initial: "initial", animate: "animate", exit: "exit", variants: contentVariants, children: jsxs(ModalContent, { children: [jsxs(ModalH1, { "$valid": true, children: [jsx(TickIcon, {}), " ", locales.injectionScreen_connected_h1] }), jsx(ModalBody, { children: locales.injectionScreen_connected_p })] }) }, states.CONNECTED)), status === states.NOTCONNECTED && (jsx(Content, { initial: "initial", animate: "animate", exit: "exit", variants: contentVariants, children: jsxs(ModalContent, { children: [jsx(ModalH1, { children: locales.injectionScreen_notconnected_h1 }), jsx(ModalBody, { children: locales.injectionScreen_notconnected_p })] }) }, states.NOTCONNECTED)), status === states.UNAVAILABLE && (jsx(Content, { initial: "initial", animate: "animate", exit: "exit", variants: contentVariants, children: !extensionUrl ? (jsxs(Fragment, { children: [jsxs(ModalContent, { style: { paddingBottom: 12 }, children: [jsx(ModalH1, { children: locales.injectionScreen_unavailable_h1 }), jsx(ModalBody, { children: locales.injectionScreen_unavailable_p })] }), !wallet.isInstalled && suggestedExtension && (jsxs(Button, { href: suggestedExtension?.url, icon: jsx(BrowserIcon, { browser: suggestedExtension?.name }), children: ["Install on ", suggestedExtension?.label] }))] })) : (jsxs(Fragment, { children: [jsxs(ModalContent, { style: { paddingBottom: 18 }, children: [jsx(ModalH1, { children: locales.injectionScreen_install_h1 }), jsx(ModalBody, { children: locales.injectionScreen_install_p })] }), !wallet.isInstalled && extensionUrl && (jsx(Button, { href: extensionUrl, icon: jsx(BrowserIcon, {}), children: locales.installTheExtension }))] })) }, states.UNAVAILABLE))] }) })] }) }));
|
|
198
|
+
: locales.injectionScreen_connecting_p }), jsxs(Button, { icon: jsx(ExternalLinkIcon, {}), onClick: runConnect, children: ["Connect ", walletInfo.name] })] }) }, states.CONNECTING)), status === states.CONNECTED && (jsx(Content, { initial: "initial", animate: "animate", exit: "exit", variants: contentVariants, children: jsxs(ModalContent, { children: [jsxs(ModalH1, { "$valid": true, children: [jsx(TickIcon, {}), " ", locales.injectionScreen_connected_h1] }), jsx(ModalBody, { children: locales.injectionScreen_connected_p })] }) }, states.CONNECTED)), status === states.NOTCONNECTED && (jsx(Content, { initial: "initial", animate: "animate", exit: "exit", variants: contentVariants, children: jsxs(ModalContent, { children: [jsx(ModalH1, { children: locales.injectionScreen_notconnected_h1 }), jsx(ModalBody, { children: locales.injectionScreen_notconnected_p })] }) }, states.NOTCONNECTED)), status === states.UNAVAILABLE && (jsx(Content, { initial: "initial", animate: "animate", exit: "exit", variants: contentVariants, children: !extensionUrl ? (jsxs(Fragment, { children: [jsxs(ModalContent, { style: { paddingBottom: 12 }, children: [jsx(ModalH1, { children: locales.injectionScreen_unavailable_h1 }), jsx(ModalBody, { children: locales.injectionScreen_unavailable_p })] }), !wallet.isInstalled && suggestedExtension && (jsxs(Button, { href: suggestedExtension?.url, icon: jsx(BrowserIcon, { browser: suggestedExtension?.name }), children: ["Install on ", suggestedExtension?.label] }))] })) : (jsxs(Fragment, { children: [jsxs(ModalContent, { style: { paddingBottom: 18 }, children: [jsx(ModalH1, { children: locales.injectionScreen_install_h1 }), jsx(ModalBody, { children: locales.injectionScreen_install_p })] }), !wallet.isInstalled && extensionUrl && (jsx(Button, { href: extensionUrl, icon: jsx(BrowserIcon, {}), children: locales.installTheExtension }))] })) }, states.UNAVAILABLE))] }) })] }) }));
|
|
199
199
|
};
|
|
200
200
|
|
|
201
201
|
export { ConnectWithInjector as default, states };
|
|
@@ -6,6 +6,7 @@ const DEFAULT_EXTERNAL_PAYMENT_OPTIONS = [
|
|
|
6
6
|
ExternalPaymentOptions.Binance,
|
|
7
7
|
ExternalPaymentOptions.Daimo,
|
|
8
8
|
ExternalPaymentOptions.RampNetwork,
|
|
9
|
+
ExternalPaymentOptions.Lemon,
|
|
9
10
|
// Solana and ExternalChains are handled in the SelectMethod component.
|
|
10
11
|
];
|
|
11
12
|
function useExternalPaymentOptions({ trpc, filterIds, platform, usdRequired, mode, }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExternalPaymentOptions.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useExternalPaymentOptions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -13,7 +13,7 @@ import { usePayWithToken } from './usePayWithToken.js';
|
|
|
13
13
|
import { useSolanaPaymentOptions } from './useSolanaPaymentOptions.js';
|
|
14
14
|
import { useWalletPaymentOptions } from './useWalletPaymentOptions.js';
|
|
15
15
|
|
|
16
|
-
function usePaymentState({ trpc, daimoPayOrder, setDaimoPayOrder, setOpen, log, }) {
|
|
16
|
+
function usePaymentState({ trpc, daimoPayOrder, setDaimoPayOrder, setOpen, log, redirectReturnUrl, }) {
|
|
17
17
|
// Browser state.
|
|
18
18
|
const [platform, setPlatform] = useState();
|
|
19
19
|
useEffect(() => {
|
|
@@ -76,6 +76,7 @@ function usePaymentState({ trpc, daimoPayOrder, setDaimoPayOrder, setOpen, log,
|
|
|
76
76
|
platform,
|
|
77
77
|
refundAddress,
|
|
78
78
|
externalPaymentOption,
|
|
79
|
+
redirectReturnUrl,
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
log(`[CREATE/HYDRATE] creating+hydrating new order ${order.id}`);
|
|
@@ -94,6 +95,7 @@ function usePaymentState({ trpc, daimoPayOrder, setDaimoPayOrder, setOpen, log,
|
|
|
94
95
|
platform,
|
|
95
96
|
refundAddress,
|
|
96
97
|
externalPaymentOption,
|
|
98
|
+
redirectReturnUrl,
|
|
97
99
|
});
|
|
98
100
|
};
|
|
99
101
|
const { payWithToken } = usePayWithToken({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaymentState.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePaymentState.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { writeDaimoPayOrderID } from '@daimo/common';
|
|
2
|
+
import { daimoPayVersion } from './exports.js';
|
|
2
3
|
|
|
3
4
|
function getSupportUrl(daimoPayOrder, screen) {
|
|
4
|
-
const
|
|
5
|
+
const payId = daimoPayOrder == null ? null : writeDaimoPayOrderID(daimoPayOrder.id);
|
|
5
6
|
const email = "support@daimo.com";
|
|
6
|
-
const subject = `Support
|
|
7
|
-
let body =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
body
|
|
14
|
-
const mailtoUrl = `mailto:${email}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
|
|
15
|
-
return mailtoUrl;
|
|
7
|
+
const subject = `Support${payId ? ` #${payId}` : ""}`;
|
|
8
|
+
let body = [
|
|
9
|
+
`Transaction: ${screen}`,
|
|
10
|
+
`Version: ${daimoPayVersion}`,
|
|
11
|
+
``,
|
|
12
|
+
`Tell us how we can help`,
|
|
13
|
+
].join("\n");
|
|
14
|
+
return `mailto:${email}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
export { getSupportUrl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supportUrl.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"supportUrl.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daimo/pay",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"author": "Daimo",
|
|
6
6
|
"homepage": "https://pay.daimo.com",
|
|
7
7
|
"license": "BSD-2-Clause license",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"crypto"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@daimo/common": "1.
|
|
44
|
-
"@daimo/contract": "1.
|
|
43
|
+
"@daimo/common": "1.5.0",
|
|
44
|
+
"@daimo/contract": "1.5.0",
|
|
45
45
|
"@solana/wallet-adapter-base": "^0.9.23",
|
|
46
46
|
"@solana/wallet-adapter-react": "^0.15.35",
|
|
47
47
|
"@solana/web3.js": "^1.95.4",
|