@daimo/pay 1.1.2 → 1.1.4

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 CHANGED
@@ -9,8 +9,8 @@ import { CreateTRPCClient } from '@trpc/client';
9
9
  import * as abitype from 'abitype';
10
10
  import { WalletName } from '@solana/wallet-adapter-base';
11
11
  import { CreateConfigParameters } from '@wagmi/core';
12
- import { CoinbaseWalletParameters } from 'wagmi/connectors';
13
12
  import { CreateConnectorFn } from 'wagmi';
13
+ import { CoinbaseWalletParameters } from 'wagmi/connectors';
14
14
 
15
15
  type Hash = `0x${string}`;
16
16
  type CustomAvatarProps = {
@@ -385,9 +385,10 @@ type DefaultConfigProps = {
385
385
  * WalletConnect project ID by default. */
386
386
  walletConnectProjectId?: string;
387
387
  coinbaseWalletPreference?: CoinbaseWalletParameters<"4">["preference"];
388
+ additionalConnectors?: CreateConnectorFn[];
388
389
  } & Partial<CreateConfigParameters>;
389
390
  /** Daimo Pay recommended config, for use with wagmi's createConfig(). */
390
- declare const defaultConfig: ({ appName, appIcon, appDescription, appUrl, walletConnectProjectId, coinbaseWalletPreference, chains, client, ...props }: DefaultConfigProps) => CreateConfigParameters;
391
+ declare const defaultConfig: ({ appName, appIcon, appDescription, appUrl, walletConnectProjectId, coinbaseWalletPreference, additionalConnectors, chains, client, ...props }: DefaultConfigProps) => CreateConfigParameters;
391
392
 
392
393
  type PayButtonPaymentProps = {
393
394
  /**
@@ -1,5 +1,5 @@
1
1
  var name = "@daimo/pay";
2
- var version = "1.1.2";
2
+ var version = "1.1.4";
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": "0.3.17",
42
- "@daimo/contract": "0.3.17",
41
+ "@daimo/common": "0.3.18",
42
+ "@daimo/contract": "0.3.18",
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",
@@ -60,7 +60,7 @@ var peerDependencies = {
60
60
  "@tanstack/react-query": ">=5.0.0",
61
61
  react: "17.x || 18.x || 19.x",
62
62
  "react-dom": "17.x || 18.x || 19.x",
63
- viem: "2.x",
63
+ viem: ">=2.22.0",
64
64
  wagmi: "2.x"
65
65
  };
66
66
  var devDependencies = {
@@ -69,7 +69,7 @@ const OptionItem = ({ option }) => {
69
69
  return (jsx(IconStackContainer, { children: hydratedIcons.map((icon, index) => (jsx(IconStackItem, { "$marginRight": index !== hydratedIcons.length - 1 ? -12 : 0, "$zIndex": hydratedIcons.length - index, children: icon }, index))) }));
70
70
  }
71
71
  })();
72
- return (jsxs(OptionButton, { type: "button", onClick: option.onClick, children: [iconContent, jsxs(OptionLabel, { children: [jsx(OptionTitle, { children: option.title }), option.subtitle && jsx(OptionSubtitle, { children: option.subtitle })] })] }));
72
+ return (jsxs(OptionButton, { type: "button", onClick: option.onClick, disabled: option.disabled, children: [iconContent, jsxs(OptionLabel, { children: [jsx(OptionTitle, { children: option.title }), option.subtitle && jsx(OptionSubtitle, { children: option.subtitle })] })] }));
73
73
  };
74
74
  const IconStackContainer = styled(motion.div) `
75
75
  position: absolute;
@@ -1,18 +1,34 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { motion } from 'framer-motion';
3
+ import { useState, useEffect } from 'react';
4
+ import { keyframes } from 'styled-components';
3
5
  import CrepeIcon from '../../../assets/crepe.js';
4
6
  import styled from '../../../styles/styled/index.js';
5
7
 
6
- const PoweredByFooter = () => {
8
+ const PoweredByFooter = ({ supportUrl } = {}) => {
9
+ const [supportVisible, setSupportVisible] = useState(false);
10
+ useEffect(() => {
11
+ if (supportUrl == null)
12
+ return;
13
+ // Show the support link after delay
14
+ const timer = setTimeout(() => {
15
+ setSupportVisible(true);
16
+ }, 2500);
17
+ return () => clearTimeout(timer);
18
+ }, []);
7
19
  return (jsx(Container, { children: jsxs(TextButton, { onClick: () => {
8
- window.open("https://pay.daimo.com?ref=paykit", "_blank");
9
- }, children: [jsx(CrepeIcon, {}), "Powered by Daimo Pay"] }) }));
20
+ window.open(supportVisible ? supportUrl : "https://pay.daimo.com?ref=paykit", "_blank");
21
+ }, 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" })) })] }) }));
10
22
  };
11
23
  const Container = styled(motion.div) `
12
24
  text-align: center;
13
25
  margin-top: 16px;
14
26
  margin-bottom: -4px;
15
27
  `;
28
+ const fadeIn = keyframes `
29
+ 0%{ opacity:0; }
30
+ 100%{ opacity:1; }
31
+ `;
16
32
  const TextButton = styled(motion.button) `
17
33
  appearance: none;
18
34
  user-select: none;
@@ -26,18 +42,34 @@ const TextButton = styled(motion.button) `
26
42
  border-radius: 6px;
27
43
  background: none;
28
44
  color: var(--ck-body-color-muted);
45
+ text-decoration-color: var(--ck-body-color-muted);
29
46
  font-size: 15px;
30
47
  line-height: 18px;
31
48
  font-weight: 500;
49
+
32
50
  transition:
33
51
  color 200ms ease,
34
52
  transform 100ms ease;
35
53
  &:hover {
36
54
  color: var(--ck-body-color-muted-hover);
55
+ text-decoration-color: var(--ck-body-color-muted-hover);
37
56
  }
38
57
  &:active {
39
58
  transform: scale(0.96);
40
59
  }
60
+
61
+ span {
62
+ opacity: 1;
63
+ transition: opacity 300ms ease;
64
+ }
65
+
66
+ &.support span {
67
+ animation: ${fadeIn} 300ms ease both;
68
+ }
69
+ `;
70
+ const Underline = styled(motion.span) `
71
+ text-underline-offset: 2px;
72
+ text-decoration: underline;
41
73
  `;
42
74
 
43
75
  export { PoweredByFooter as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -160,9 +160,9 @@ const DaimoPayProviderWithoutSolana = ({ children, theme = "auto", mode = "auto"
160
160
  setTimeout(() => retryBackoff("refreshOrder", () => paymentState.refreshOrder()), intervalMs);
161
161
  }, [daimoPayOrder]);
162
162
  const showPayment = async (modalOptions) => {
163
- const { daimoPayOrder, payParams } = paymentState;
163
+ const { daimoPayOrder } = paymentState;
164
164
  const id = daimoPayOrder?.id;
165
- log(`[PAY] showing payment ${debugJson({ id, payParams, modalOptions })}`);
165
+ log(`[PAY] showing payment ${debugJson({ id, modalOptions })}`);
166
166
  paymentState.setModalOptions(modalOptions);
167
167
  if (daimoPayOrder &&
168
168
  daimoPayOrder.mode === DaimoPayOrderMode.HYDRATED &&
@@ -6,6 +6,7 @@ import { getChainExplorerTxUrl } from '@daimo/contract';
6
6
  import { motion } from 'framer-motion';
7
7
  import { TickIcon, LoadingCircleIcon } from '../../../assets/icons.js';
8
8
  import styled from '../../../styles/styled/index.js';
9
+ import { getSupportUrl } from '../../../utils/supportUrl.js';
9
10
  import PoweredByFooter from '../../Common/PoweredByFooter/index.js';
10
11
 
11
12
  const Confirmation = () => {
@@ -43,7 +44,7 @@ const Confirmation = () => {
43
44
  justifyContent: "center",
44
45
  alignItems: "center",
45
46
  paddingBottom: 0,
46
- }, children: [jsx(AnimationContainer, { children: jsxs(InsetContainer, { children: [jsx(Spinner, { "$status": done }), jsx(SuccessIcon, { "$status": done })] }) }), !done ? (jsx(ModalH1, { children: "Confirming..." })) : (jsxs(Fragment, { children: [jsx(ModalH1, { children: jsx(Link, { href: txURL, target: "_blank", rel: "noopener noreferrer", children: "Payment completed" }) }), confirmationMessage && (jsx(ModalBody, { children: confirmationMessage }))] })), jsx(PoweredByFooter, {})] }) }));
47
+ }, children: [jsx(AnimationContainer, { children: jsxs(InsetContainer, { children: [jsx(Spinner, { "$status": done }), jsx(SuccessIcon, { "$status": done })] }) }), !done ? (jsx(ModalH1, { children: "Confirming..." })) : (jsxs(Fragment, { children: [jsx(ModalH1, { children: jsx(Link, { href: txURL, target: "_blank", rel: "noopener noreferrer", children: "Payment completed" }) }), confirmationMessage && (jsx(ModalBody, { children: confirmationMessage }))] })), jsx(PoweredByFooter, { supportUrl: getSupportUrl(daimoPayOrder, done ? "Confirmed" : "Confirming") })] }) }));
47
48
  };
48
49
  const AnimationContainer = styled(motion.div) `
49
50
  position: relative;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -103,6 +103,8 @@ const SelectMethod = () => {
103
103
  setSelectedExternalOption(option);
104
104
  setRoute(ROUTES.WAITING_OTHER);
105
105
  },
106
+ disabled: option.disabled,
107
+ subtitle: option.message,
106
108
  })),
107
109
  ...(depositAddressOption ? [depositAddressOption] : []),
108
110
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -19,7 +19,7 @@ const REQUIRED_CHAINS = [
19
19
  blast,
20
20
  ];
21
21
  /** Daimo Pay recommended config, for use with wagmi's createConfig(). */
22
- const defaultConfig = ({ appName = "Daimo Pay", appIcon, appDescription, appUrl, walletConnectProjectId, coinbaseWalletPreference, chains = REQUIRED_CHAINS, client, ...props }) => {
22
+ const defaultConfig = ({ appName = "Daimo Pay", appIcon, appDescription, appUrl, walletConnectProjectId, coinbaseWalletPreference, additionalConnectors, chains = REQUIRED_CHAINS, client, ...props }) => {
23
23
  globalAppName = appName;
24
24
  const paddedChains = [...chains];
25
25
  for (const chain of REQUIRED_CHAINS) {
@@ -47,6 +47,7 @@ const defaultConfig = ({ appName = "Daimo Pay", appIcon, appDescription, appUrl,
47
47
  },
48
48
  walletConnectProjectId: walletConnectProjectId ?? "ea6c5b36001c18b96e06128f14c06f40",
49
49
  coinbaseWalletPreference,
50
+ additionalConnectors,
50
51
  });
51
52
  const config = {
52
53
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"defaultConfig.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"defaultConfig.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,9 +1,9 @@
1
1
  import { safe, injected, coinbaseWallet, walletConnect } from '@wagmi/connectors';
2
2
 
3
- const defaultConnectors = ({ app, walletConnectProjectId, coinbaseWalletPreference, }) => {
3
+ const defaultConnectors = ({ app, walletConnectProjectId, coinbaseWalletPreference, additionalConnectors, }) => {
4
4
  const hasAllAppData = app.name && app.icon && app.description && app.url;
5
5
  const shouldUseSafeConnector = !(typeof window === "undefined") && window?.parent !== window;
6
- const connectors = [];
6
+ const connectors = additionalConnectors ?? [];
7
7
  // If we're in an iframe, include the SafeConnector
8
8
  if (shouldUseSafeConnector) {
9
9
  connectors.push(safe({
@@ -1,4 +1,4 @@
1
- import { readDaimoPayOrderID, assert, assertNotNull, debugJson } from '@daimo/common';
1
+ import { readDaimoPayOrderID, assert, assertNotNull } from '@daimo/common';
2
2
  import { ethereum } from '@daimo/contract';
3
3
  import { useWallet } from '@solana/wallet-adapter-react';
4
4
  import { useState, useEffect, useCallback } from 'react';
@@ -178,7 +178,6 @@ function usePaymentState({ trpc, daimoPayOrder, setDaimoPayOrder, setOpen, log,
178
178
  }, [daimoPayOrder]);
179
179
  /** Called whenever params change. */
180
180
  const setPayParams = async (payParams) => {
181
- console.log(`[CHECKOUT] setting payParams: ${debugJson(payParams)}`);
182
181
  assert(payParams != null);
183
182
  setPayParamsState(payParams);
184
183
  const newPayId = generatePayId();
@@ -1 +1 @@
1
- {"version":3,"file":"usePaymentState.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"usePaymentState.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,19 @@
1
+ import { writeDaimoPayOrderID } from '@daimo/common';
2
+
3
+ function getSupportUrl(daimoPayOrder, screen) {
4
+ const encodedOrderId = daimoPayOrder == null ? null : writeDaimoPayOrderID(daimoPayOrder.id);
5
+ const email = "support@daimo.com";
6
+ const subject = `Support with Daimo Pay Id ${encodedOrderId}`;
7
+ let body = "";
8
+ if (daimoPayOrder != null) {
9
+ body += `Id: ${encodedOrderId}\n`;
10
+ body += `Org Id: ${daimoPayOrder.orgId}\n`;
11
+ }
12
+ body += `Support requested on ${screen} screen at ${new Date().toISOString()}\n\n`;
13
+ body += "Please explain the issue you are experiencing:\n\n";
14
+ const mailtoUrl = `mailto:${email}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
15
+ return mailtoUrl;
16
+ }
17
+
18
+ export { getSupportUrl };
19
+ //# sourceMappingURL=supportUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supportUrl.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
@@ -30,6 +30,7 @@ const useWallets = () => {
30
30
  iconShape: "squircle",
31
31
  isInstalled: connector.type === "mock" ||
32
32
  (connector.type === "injected" && connector.id !== "metaMask") ||
33
+ connector.type === "farcasterFrame" ||
33
34
  isCoinbaseWalletConnector(connector.id), // always run coinbase wallet SDK
34
35
  };
35
36
  if (walletId) {
@@ -62,6 +63,9 @@ const useWallets = () => {
62
63
  // remove wallet with id io.metamask if wallet with id 'metaMask' exists
63
64
  .filter((wallet, index, self) => !((wallet.id === "metaMaskSDK" || wallet.id === "metaMask") &&
64
65
  self.find((w) => w.id === "io.metamask" || w.id === "io.metamask.mobile")))
66
+ // remove wallet with id 'com.warpcast.mobile' if wallet with id 'farcaster' exists
67
+ .filter((wallet, index, self) => !(wallet.id === "com.warpcast.mobile" &&
68
+ self.find((w) => w.id === "farcaster")))
65
69
  // order by isInstalled injected connectors first
66
70
  .sort((a, b) => {
67
71
  const AisInstalled = a.isInstalled && isInjectedConnector(a.connector.type);
@@ -1 +1 @@
1
- {"version":3,"file":"useWallets.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"useWallets.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.1.2",
4
+ "version": "1.1.4",
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": "0.3.17",
44
- "@daimo/contract": "0.3.17",
43
+ "@daimo/common": "0.3.18",
44
+ "@daimo/contract": "0.3.18",
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",
@@ -62,7 +62,7 @@
62
62
  "@tanstack/react-query": ">=5.0.0",
63
63
  "react": "17.x || 18.x || 19.x",
64
64
  "react-dom": "17.x || 18.x || 19.x",
65
- "viem": "2.x",
65
+ "viem": ">=2.22.0",
66
66
  "wagmi": "2.x"
67
67
  },
68
68
  "devDependencies": {
@@ -80,4 +80,4 @@
80
80
  "rollup-plugin-visualizer": "^5.5.4",
81
81
  "typescript-plugin-styled-components": "^3.0.0"
82
82
  }
83
- }
83
+ }