@coin-voyage/paykit 2.2.4 → 2.2.6

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 (58) hide show
  1. package/dist/assets/chains.d.ts +1 -1
  2. package/dist/assets/chains.js +1 -1
  3. package/dist/components/Pages/Confirmation/index.js +2 -1
  4. package/dist/components/Pages/MobileConnectors/index.js +4 -4
  5. package/dist/components/Pages/PayWithToken/index.js +2 -1
  6. package/dist/components/Pages/SwitchNetworks/index.d.ts +1 -2
  7. package/dist/components/Pages/SwitchNetworks/index.js +4 -4
  8. package/dist/components/pay-button/index.d.ts +1 -1
  9. package/dist/components/pay-button/index.js +1 -1
  10. package/dist/components/pay-modal/ConnectWithInjector/index.js +1 -1
  11. package/dist/components/ui/BrowserIcon/index.js +1 -1
  12. package/dist/components/ui/Button/index.d.ts +1 -2
  13. package/dist/components/ui/Button/index.js +2 -2
  14. package/dist/components/ui/ChainSelectList/index.js +1 -1
  15. package/dist/components/ui/ConnectorList/index.js +2 -2
  16. package/dist/components/ui/CopyToClipboard/index.d.ts +2 -2
  17. package/dist/components/ui/CopyToClipboard/index.js +1 -1
  18. package/dist/components/ui/CustomQRCode/index.js +2 -2
  19. package/dist/components/ui/DynamicContainer/index.d.ts +1 -1
  20. package/dist/components/ui/Modal/index.js +2 -4
  21. package/dist/components/ui/OrderHeader/index.js +4 -5
  22. package/dist/components/ui/TokenChainLogo/index.d.ts +1 -1
  23. package/dist/hooks/useChainIsSupported.d.ts +1 -1
  24. package/dist/hooks/useChainIsSupported.js +2 -1
  25. package/dist/hooks/useFitText.d.ts +1 -1
  26. package/dist/hooks/useFitText.js +2 -2
  27. package/dist/hooks/useMethodOptions.d.ts +1 -1
  28. package/dist/hooks/useMethodOptions.js +7 -3
  29. package/dist/hooks/usePayOrderQuotes.d.ts +1 -1
  30. package/dist/hooks/usePayOrderQuotes.js +1 -1
  31. package/dist/hooks/usePayStatus.d.ts +1 -1
  32. package/dist/hooks/usePayWithToken.d.ts +1 -1
  33. package/dist/hooks/usePaymentLifecycle.d.ts +1 -1
  34. package/dist/hooks/usePaymentLifecycle.js +3 -5
  35. package/dist/hooks/usePaymentState.d.ts +1 -1
  36. package/dist/hooks/usePaymentState.js +2 -1
  37. package/dist/hooks/useWalletConnectModal.js +3 -3
  38. package/dist/hooks/useWalletConnectUri.js +1 -1
  39. package/dist/lib/config/wallet.js +2 -2
  40. package/dist/providers/paykit-provider.js +3 -3
  41. package/dist/server.d.ts +1 -1
  42. package/dist/server.js +1 -1
  43. package/dist/types/state.d.ts +1 -1
  44. package/dist/types.d.ts +2 -2
  45. package/dist/types.js +1 -1
  46. package/dist/utils/index.d.ts +2 -5
  47. package/dist/utils/index.js +1 -39
  48. package/package.json +2 -2
  49. package/dist/hooks/useFocusTrap.d.ts +0 -9
  50. package/dist/hooks/useFocusTrap.js +0 -53
  51. package/dist/hooks/useIsClient.d.ts +0 -1
  52. package/dist/hooks/useIsClient.js +0 -5
  53. package/dist/hooks/usePrevious.d.ts +0 -1
  54. package/dist/hooks/usePrevious.js +0 -8
  55. package/dist/hooks/useWindowSize.d.ts +0 -4
  56. package/dist/hooks/useWindowSize.js +0 -19
  57. package/dist/utils/platform.d.ts +0 -2
  58. package/dist/utils/platform.js +0 -10
@@ -1,4 +1,4 @@
1
- import { ChainId } from "@coin-voyage/shared/common";
1
+ import { ChainId } from "@coin-voyage/shared/types";
2
2
  import { JSX } from "react";
3
3
  type Logo = {
4
4
  testnet?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChainId } from "@coin-voyage/shared/common";
2
+ import { ChainId } from "@coin-voyage/shared/types";
3
3
  const KnownChain = ({ testnet, ...props }) => (_jsxs("svg", { ...props, "aria-hidden": "true", width: props?.width ?? "44", height: props?.height ?? "44", viewBox: "0 0 44 44", xmlns: "http://www.w3.org/2000/svg", style: {
4
4
  background: testnet ? "linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)" : "black",
5
5
  }, children: [_jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M20.5611 8.12948C21.0082 7.90729 21.5007 7.79167 22 7.79167C22.4993 7.79167 22.9919 7.90729 23.439 8.12948L23.4408 8.1304L33.0387 12.9293C33.577 13.197 34.031 13.61 34.3478 14.121C34.6649 14.6323 34.833 15.2218 34.8333 15.8234V27.2595C34.833 27.8611 34.6649 28.4511 34.3478 28.9624C34.031 29.4733 33.578 29.8858 33.0398 30.1535L23.4411 34.9528C22.9919 35.1775 22.4963 35.2947 21.994 35.2947C21.4918 35.2947 20.9964 35.1777 20.5472 34.9529L10.9475 30.1531L10.9452 30.1519C10.4071 29.8808 9.95535 29.4646 9.6411 28.9504C9.32739 28.437 9.16312 27.8464 9.16673 27.2448L9.16675 27.2417L10.0004 27.2475H9.16673V27.2448V15.8239C9.16705 15.2223 9.33518 14.6322 9.65222 14.121C9.96906 13.61 10.4221 13.1976 10.9604 12.9298L20.5592 8.1304L20.5611 8.12948ZM21.3031 9.62267L11.8706 14.3389L22 19.4036L32.1294 14.3389L22.697 9.62267C22.4806 9.51531 22.2416 9.45905 22 9.45905C21.7585 9.45905 21.5194 9.51534 21.3031 9.62267ZM10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241ZM22.8337 33.3923L32.2967 28.6608C32.5576 28.5312 32.7772 28.3313 32.9308 28.0836C33.0844 27.836 33.1658 27.5504 33.166 27.259V15.8243C33.1659 15.7786 33.1639 15.7331 33.1599 15.6878L22.8337 20.8509V33.3923Z", fill: "url(#paint0_linear_3546_7073)" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241Z", fill: "url(#paint1_linear_3546_7073)", fillOpacity: "0.3" }), _jsxs("defs", { children: [_jsxs("linearGradient", { id: "paint0_linear_3546_7073", x1: "22", y1: "7.79167", x2: "22", y2: "35.2947", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "white" }), _jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0.7" })] }), _jsxs("linearGradient", { id: "paint1_linear_3546_7073", x1: "22", y1: "7.79167", x2: "22", y2: "35.2947", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "white" }), _jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0.7" })] })] })] }));
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { getChainExplorerTxUrl, PayOrderMode, PayOrderStatus } from "@coin-voyage/shared/common";
2
+ import { getChainExplorerTxUrl } from "@coin-voyage/shared/common";
3
+ import { PayOrderMode, PayOrderStatus } from "@coin-voyage/shared/types";
3
4
  import { useEffect, useMemo } from "react";
4
5
  import { ExternalLinkIcon } from "../../../assets/icons";
5
6
  import useLocales from "../../../hooks/useLocales";
@@ -1,17 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Container, WalletIcon, WalletItem, WalletLabel, WalletList } from "./styles";
3
- import { ModalContent, PageContent } from "../../ui/Modal/styles";
4
- import { ChainType } from "@coin-voyage/shared/common";
2
+ import { ChainType } from "@coin-voyage/shared/types";
5
3
  import { useCallback } from "react";
6
4
  import useLocales from "../../../hooks/useLocales";
7
5
  import { useWalletConnectModal } from "../../../hooks/useWalletConnectModal";
8
6
  import { useWalletConnectUri } from "../../../hooks/useWalletConnectUri";
9
7
  import { useWallets } from "../../../hooks/useWallets";
10
8
  import { walletConfigs } from "../../../lib/config/wallet";
9
+ import { ROUTES } from "../../../types/routes";
11
10
  import usePayContext from "../../contexts/pay";
11
+ import { ModalContent, PageContent } from "../../ui/Modal/styles";
12
12
  import { ScrollArea } from "../../ui/ScrollArea";
13
13
  import { Spinner } from "../../ui/Spinner";
14
- import { ROUTES } from "../../../types/routes";
14
+ import { Container, WalletIcon, WalletItem, WalletLabel, WalletList } from "./styles";
15
15
  const MoreIcon = (_jsx("svg", { width: "60", height: "60", viewBox: "0 0 60 60", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M30 42V19M19 30.5H42", stroke: "var(--ck-body-color-muted)", strokeWidth: "3", strokeLinecap: "round" }) }));
16
16
  export default function MobileConnectors() {
17
17
  const { paymentState } = usePayContext();
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useAccount } from "@coin-voyage/crypto/hooks";
3
- import { assert, ChainType, getChainTypeByChainId, PayOrderMode, PayOrderStatus, } from "@coin-voyage/shared/common";
3
+ import { assert, getChainTypeByChainId } from "@coin-voyage/shared/common";
4
+ import { ChainType, PayOrderMode, PayOrderStatus } from "@coin-voyage/shared/types";
4
5
  import { AnimatePresence, motion } from "framer-motion";
5
6
  import { useEffect, useMemo, useState } from "react";
6
7
  import { useChainId, useSwitchChain } from "wagmi";
@@ -1,3 +1,2 @@
1
- import type React from "react";
2
- declare const SwitchNetworks: React.FC;
1
+ declare const SwitchNetworks: () => import("react/jsx-runtime").JSX.Element;
3
2
  export default SwitchNetworks;
@@ -1,14 +1,14 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { ChainType } from "@coin-voyage/shared/types";
2
3
  import { useAccount, useConnect, useDisconnect } from "wagmi";
3
- import ChainSelectList from "../../ui/ChainSelectList";
4
- import { ModalBody, ModalContent, PageContent } from "../../ui/Modal/styles";
5
- import useLocales from "../../../hooks/useLocales";
6
- import { ChainType } from "@coin-voyage/shared/common";
7
4
  import { DisconnectIcon } from "../../../assets/icons";
8
5
  import { useChainIsSupported } from "../../../hooks/useChainIsSupported";
6
+ import useLocales from "../../../hooks/useLocales";
9
7
  import { isSafeConnector } from "../../../utils";
10
8
  import Button from "../../ui/Button";
9
+ import ChainSelectList from "../../ui/ChainSelectList";
11
10
  import { OrDivider } from "../../ui/Divider/OrDivider";
11
+ import { ModalBody, ModalContent, PageContent } from "../../ui/Modal/styles";
12
12
  const SwitchNetworks = () => {
13
13
  const { reset } = useConnect();
14
14
  const { disconnect } = useDisconnect();
@@ -1,4 +1,4 @@
1
- import { ChainId, PayOrderConfirmingEvent, PayOrderMetadata, PayOrderRefundedEvent, type PayOrderCompletedEvent, type PayOrderCreationErrorEvent } from "@coin-voyage/shared/common";
1
+ import type { ChainId, PayOrderCompletedEvent, PayOrderConfirmingEvent, PayOrderCreationErrorEvent, PayOrderMetadata, PayOrderRefundedEvent } from "@coin-voyage/shared/types";
2
2
  import type { CustomTheme, Mode, PayModalOptions, Theme } from "../../types";
3
3
  type DepositPayButtonParams = {
4
4
  /**
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useIsClient } from "@coin-voyage/shared/hooks";
2
3
  import { useQuery } from "@tanstack/react-query";
3
4
  import { AnimatePresence } from "framer-motion";
4
5
  import { useCallback, useEffect, useRef } from "react";
5
- import useIsClient from "../../hooks/useIsClient";
6
6
  import { usePaymentLifecycle } from "../../hooks/usePaymentLifecycle";
7
7
  import { ResetContainer } from "../../styles";
8
8
  import usePayContext from "../contexts/pay";
@@ -9,7 +9,7 @@ import Tooltip from "../../ui/Tooltip";
9
9
  import SquircleSpinner from "../../spinners/SquircleSpinner";
10
10
  import { useUniversalConnect } from "@coin-voyage/crypto/hooks";
11
11
  import { getConnectorId } from "@coin-voyage/crypto/lib/utils/connector";
12
- import { detectBrowser } from "@coin-voyage/shared/utils";
12
+ import { detectBrowser } from "@coin-voyage/shared/common";
13
13
  import { AlertIcon, RetryIconCircle, TickIcon } from "../../../assets/icons";
14
14
  import useLocales from "../../../hooks/useLocales";
15
15
  import { ROUTES } from "../../../types/routes";
@@ -1,6 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from "react";
3
- import { detectBrowser } from "@coin-voyage/shared/utils";
3
+ import { detectBrowser } from "@coin-voyage/shared/common";
4
4
  import { BrowserIconContainer } from "./styles";
5
5
  import browsers from "../../../assets/browsers";
6
6
  const BrowserIcon = React.forwardRef(({ browser }, _ref) => {
@@ -1,4 +1,3 @@
1
- import type React from "react";
2
1
  import type { ButtonProps } from "./types";
3
- declare const Button: React.FC<ButtonProps>;
2
+ declare const Button: ({ children, variant, disabled, icon, iconPosition, roundedIcon, waiting, arrow, download, href, style, onClick, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
4
3
  export default Button;
@@ -11,12 +11,12 @@ const transition = {
11
11
  const Button = ({ children, variant = "secondary", // unique aspect to how we're handling buttons
12
12
  disabled, icon, iconPosition = "left", roundedIcon, waiting, arrow, download, href, style, onClick, }) => {
13
13
  const key = typeof children === "string" ? children : flattenChildren(children).join(""); // Need to generate a string for the key so we can automatically animate between content
14
- const hrefUrl = typeof href === "string" ? href : flattenChildren(href).join(""); // Need to have a flat string for the href
14
+ const hrefUrl = typeof href === "string" ? href : href && flattenChildren(href).join("");
15
15
  return (_jsx(ButtonContainer, { as: href ? "a" : undefined, onClick: (event) => {
16
16
  if (!disabled && onClick) {
17
17
  onClick(event);
18
18
  }
19
- }, href: hrefUrl, target: href && "_blank", rel: href && "noopener noreferrer", disabled: disabled, "$variant": variant, style: style, children: _jsxs(AnimatePresence, { initial: false, children: [_jsxs(ButtonContainerInner, { initial: { opacity: 0, y: -10 }, animate: {
19
+ }, href: hrefUrl, target: href ? "_blank" : undefined, rel: href ? "noopener noreferrer" : undefined, disabled: disabled, "$variant": variant, style: style, children: _jsxs(AnimatePresence, { initial: false, children: [_jsxs(ButtonContainerInner, { initial: { opacity: 0, y: -10 }, animate: {
20
20
  opacity: 1,
21
21
  y: -1,
22
22
  }, exit: {
@@ -5,7 +5,7 @@ import Alert from "../Alert";
5
5
  import { ChainButton, ChainButtonBg, ChainButtonContainer, ChainButtonStatus, ChainButtons, ChainIcon, ChainLogoContainer, ChainLogoSpinner, SwitchNetworksContainer, } from "./styles";
6
6
  import { AnimatePresence, motion } from "framer-motion";
7
7
  import { isCoinbaseWalletConnector } from "../../../utils";
8
- import { isMobile } from "@coin-voyage/shared/utils";
8
+ import { isMobile } from "@coin-voyage/shared/common";
9
9
  import ChainIcons from "../../../assets/chains";
10
10
  import useLocales from "../../../hooks/useLocales";
11
11
  import { chainConfigs } from "../../../lib/config/chain";
@@ -6,7 +6,7 @@ import { ScrollArea } from "../ScrollArea";
6
6
  import { useLastConnector, useUniversalConnect } from "@coin-voyage/crypto/hooks";
7
7
  import { isWalletInstalled } from "@coin-voyage/crypto/lib/utils/is-wallet-installed";
8
8
  import { useIsMobile } from "@coin-voyage/shared/hooks";
9
- import { detectBrowser } from "@coin-voyage/shared/utils";
9
+ import { detectBrowser } from "@coin-voyage/shared/common";
10
10
  import { useCallback, useMemo } from "react";
11
11
  import useLocales from "../../../hooks/useLocales";
12
12
  import { useWalletConnectUri } from "../../../hooks/useWalletConnectUri";
@@ -24,7 +24,7 @@ export default function ConnectorList() {
24
24
  const installedWallets = useWallets();
25
25
  const { lastConnectorId } = useLastConnector();
26
26
  const walletsToDisplay = useMemo(() => {
27
- let wallets = [...installedWallets];
27
+ const wallets = [...installedWallets];
28
28
  const mobileWallet = walletConfigs["mobileWallet"];
29
29
  if (isMobile && connectorChainType && mobileWallet.chainTypes?.includes(connectorChainType)) {
30
30
  wallets.push({
@@ -1,7 +1,7 @@
1
1
  import type React from "react";
2
- declare const CopyToClipboard: React.FC<{
2
+ declare const CopyToClipboard: ({ text, children, variant, }: {
3
3
  text?: string;
4
4
  children?: React.ReactNode;
5
5
  variant?: "button" | "left";
6
- }>;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
7
  export default CopyToClipboard;
@@ -27,7 +27,7 @@ const Container = styled.div `
27
27
  }
28
28
  `}
29
29
  `;
30
- const CopyToClipboard = ({ text, children, variant }) => {
30
+ const CopyToClipboard = ({ text, children, variant, }) => {
31
31
  const [clipboard, setClipboard] = useState(false);
32
32
  const onCopy = async () => {
33
33
  if (!text)
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { LogoContainer, LogoIcon, QRCodeContainer, QRCodeContent, QRPlaceholder } from "./styles";
2
+ import { useWindowSize } from "@coin-voyage/shared/hooks";
3
3
  import { AnimatePresence, motion } from "framer-motion";
4
4
  import Tooltip from "../Tooltip";
5
- import useWindowSize from "../../../hooks/useWindowSize";
6
5
  import { QRCode } from "./QRCode";
6
+ import { LogoContainer, LogoIcon, QRCodeContainer, QRCodeContent, QRPlaceholder } from "./styles";
7
7
  function CustomQRCode({ value, image, imageBackground, imagePosition = "center", tooltipMessage }) {
8
8
  const windowSize = useWindowSize();
9
9
  const Logo = windowSize.width > 920 && tooltipMessage ? (_jsx(Tooltip, { xOffset: 139, yOffset: 5, delay: 0.1, message: tooltipMessage, children: image })) : (image);
@@ -3,5 +3,5 @@ type DynamicContainerProps = {
3
3
  id: string;
4
4
  children?: React.ReactNode;
5
5
  };
6
- declare const DynamicContainer: React.FC<DynamicContainerProps>;
6
+ declare const DynamicContainer: ({ id, children }: DynamicContainerProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export default DynamicContainer;
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getChainTypeName } from "@coin-voyage/shared/common";
3
- import { isMobile } from "@coin-voyage/shared/utils";
4
- import FocusTrap from "../../../hooks/useFocusTrap";
2
+ import { getChainTypeName, isMobile } from "@coin-voyage/shared/common";
3
+ import { FocusTrap, usePrevious } from "@coin-voyage/shared/hooks";
5
4
  import useLocales from "../../../hooks/useLocales";
6
- import usePrevious from "../../../hooks/usePrevious";
7
5
  import { useThemeContext } from "../../../providers/theme/provider";
8
6
  import { ResetContainer } from "../../../styles";
9
7
  import { ROUTES } from "../../../types/routes";
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useAccount } from "@coin-voyage/crypto/hooks";
3
- import { shortenAddress } from "@coin-voyage/shared/utils";
3
+ import { truncateAddress } from "@coin-voyage/shared/common";
4
4
  import { motion } from "framer-motion";
5
5
  import { Arbitrum, Bitcoin, Ethereum, Optimism, Solana, Sui } from "../../../assets/chains";
6
6
  import { USDC } from "../../../assets/coins";
@@ -14,7 +14,6 @@ export const OrderHeader = ({ minified = false, showConnectedWallet = false }) =
14
14
  selectedWallet,
15
15
  chainType: connectorChainType,
16
16
  });
17
- const fulfillment = payOrder?.fulfillment;
18
17
  const renderIcon = (icon, name, size = 32) => {
19
18
  if (!icon) {
20
19
  return null;
@@ -22,9 +21,9 @@ export const OrderHeader = ({ minified = false, showConnectedWallet = false }) =
22
21
  return (_jsx(LogoContainer, { "$size": size, "$zIndex": 1, style: { borderRadius: "22.5%" }, children: typeof icon === "string" ? (_jsx("img", { src: icon, alt: name || "wallet", style: { maxWidth: "100%", maxHeight: "100%" } })) : (icon) }));
23
22
  };
24
23
  if (minified) {
25
- return (_jsxs(MinifiedContainer, { children: [_jsx(MinifiedTitleAmount, { children: _jsx(TitleAmountContent, { fulfillment: fulfillment }) }), showConnectedWallet ? (_jsx(ConnectedWallet, { account: account, senderEnsName: senderEnsName, renderIcon: renderIcon })) : (_jsx(CoinLogos, { "$size": 32 }))] }));
24
+ return (_jsxs(MinifiedContainer, { children: [_jsx(MinifiedTitleAmount, { children: _jsx(TitleAmountContent, { fulfillment: payOrder?.fulfillment }) }), showConnectedWallet ? (_jsx(ConnectedWallet, { account: account, senderEnsName: senderEnsName, renderIcon: renderIcon })) : (_jsx(CoinLogos, { "$size": 32 }))] }));
26
25
  }
27
- return (_jsxs(_Fragment, { children: [_jsx(TitleAmount, { children: _jsx(TitleAmountContent, { fulfillment: fulfillment }) }), _jsxs(AnyChainAnyCoinContainer, { children: [showConnectedWallet ? (_jsx(ConnectedWallet, { account: account, senderEnsName: senderEnsName, renderIcon: renderIcon })) : (_jsx(CoinLogos, {})), _jsx(Subtitle, { children: "1000+ tokens accepted" })] })] }));
26
+ return (_jsxs(_Fragment, { children: [_jsx(TitleAmount, { children: _jsx(TitleAmountContent, { fulfillment: payOrder?.fulfillment }) }), _jsxs(AnyChainAnyCoinContainer, { children: [showConnectedWallet ? (_jsx(ConnectedWallet, { account: account, senderEnsName: senderEnsName, renderIcon: renderIcon })) : (_jsx(CoinLogos, {})), _jsx(Subtitle, { children: "1000+ tokens accepted" })] })] }));
28
27
  };
29
28
  const TitleAmountContent = ({ fulfillment }) => {
30
29
  if (!fulfillment)
@@ -37,7 +36,7 @@ const TitleAmountContent = ({ fulfillment }) => {
37
36
  const ConnectedWallet = ({ account, senderEnsName, renderIcon }) => {
38
37
  if (!account?.address)
39
38
  return null;
40
- return (_jsxs(SubtitleContainer, { children: [_jsx(Subtitle, { children: senderEnsName ?? shortenAddress(account.address) }), renderIcon(account.connector?.icon, account.connector?.name)] }));
39
+ return (_jsxs(SubtitleContainer, { children: [_jsx(Subtitle, { children: senderEnsName ?? truncateAddress(account.address) }), renderIcon(account.connector?.icon, account.connector?.name)] }));
41
40
  };
42
41
  const TitleAmount = styled(motion.h1) `
43
42
  margin: 0;
@@ -1,4 +1,4 @@
1
- import type { ChainId } from "@coin-voyage/shared/common";
1
+ import type { ChainId } from "@coin-voyage/shared/types";
2
2
  interface TokenChainLogoProps extends React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> {
3
3
  chainId: ChainId;
4
4
  }
@@ -1,2 +1,2 @@
1
- import { ChainType } from "@coin-voyage/shared/common";
1
+ import { ChainType } from "@coin-voyage/shared/types";
2
2
  export declare function useChainIsSupported(chainType: ChainType, chainId?: number): boolean | null;
@@ -1,5 +1,6 @@
1
1
  import { useAccount, useConfig as useBigmiConfig } from "@bigmi/react";
2
- import { ChainType, isBitcoinAddress } from "@coin-voyage/shared/common";
2
+ import { isBitcoinAddress } from "@coin-voyage/shared/common";
3
+ import { ChainType } from "@coin-voyage/shared/types";
3
4
  import { useConfig } from "wagmi";
4
5
  export function useChainIsSupported(chainType, chainId) {
5
6
  const { chains } = useConfig();
@@ -7,6 +7,6 @@ export type TOptions = {
7
7
  };
8
8
  declare const useFitText: ({ maxFontSize, minFontSize, onFinish, onStart, resolution }?: TOptions) => {
9
9
  fontSize: number;
10
- ref: import("react").RefObject<HTMLDivElement>;
10
+ ref: import("react").RefObject<HTMLDivElement | null>;
11
11
  };
12
12
  export default useFitText;
@@ -4,8 +4,8 @@ const useIsoLayoutEffect = typeof window !== "undefined" && window.document && w
4
4
  ? useLayoutEffect
5
5
  : useEffect;
6
6
  const useFitText = ({ maxFontSize = 100, minFontSize = 20, onFinish, onStart, resolution = 5 } = {}) => {
7
- const onStartRef = useRef();
8
- const onFinishRef = useRef();
7
+ const onStartRef = useRef(null);
8
+ const onFinishRef = useRef(null);
9
9
  useEffect(() => {
10
10
  onStartRef.current = onStart;
11
11
  }, [onStart]);
@@ -1,5 +1,5 @@
1
1
  import { Account } from "@coin-voyage/crypto/hooks";
2
- import { ChainType, PayOrderMode } from "@coin-voyage/shared/common";
2
+ import { ChainType, PayOrderMode } from "@coin-voyage/shared/types";
3
3
  import { type Option } from "../components/ui/OptionsList/types";
4
4
  interface UseMethodOptionsProps {
5
5
  account: Account;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useConfig as useBigmiConfig } from "@bigmi/react";
3
- import { ChainType, PayOrderMode } from "@coin-voyage/shared/common";
4
- import { shortenAddress } from "@coin-voyage/shared/utils";
3
+ import { truncateAddress, truncateENSName } from "@coin-voyage/shared/common";
4
+ import { ChainType, PayOrderMode } from "@coin-voyage/shared/types";
5
5
  import { useWallets } from "@mysten/dapp-kit";
6
6
  import { useWallet } from "@solana/wallet-adapter-react";
7
7
  import { useCallback, useMemo } from "react";
@@ -22,7 +22,11 @@ export function useMethodOptions({ account, mode, onClick }) {
22
22
  const { wallets: solanaWallets } = useWallet();
23
23
  const isDeposit = mode === PayOrderMode.DEPOSIT;
24
24
  const isConnected = account.isConnected;
25
- const displayName = useMemo(() => paymentState.senderEnsName ?? (account.address ? shortenAddress(account.address) : "wallet"), [paymentState.senderEnsName, account.address]);
25
+ const displayName = useMemo(() => paymentState.senderEnsName
26
+ ? truncateENSName(paymentState.senderEnsName, 14)
27
+ : account.address
28
+ ? truncateAddress(account.address)
29
+ : "wallet", [paymentState.senderEnsName, account.address]);
26
30
  const handleConnectedWalletClick = useCallback(() => {
27
31
  paymentState.setConnectorChainType(account.chainType);
28
32
  setRoute(ROUTES.SELECT_TOKEN);
@@ -1,4 +1,4 @@
1
- import { type ChainType, type CurrencyWithBalance, type PayOrder } from "@coin-voyage/shared/common";
1
+ import { type ChainType, type CurrencyWithBalance, type PayOrder } from "@coin-voyage/shared/types";
2
2
  interface PayOrderQuotesProps {
3
3
  payOrder: PayOrder | undefined;
4
4
  address: string | undefined;
@@ -1,4 +1,4 @@
1
- import { PayOrderStatus } from "@coin-voyage/shared/common";
1
+ import { PayOrderStatus } from "@coin-voyage/shared/types";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  import { useBackendApi } from "../components/contexts/api";
4
4
  export function usePayOrderQuotes({ payOrder, address, chainType }) {
@@ -1,4 +1,4 @@
1
- import { PayOrderStatus } from "@coin-voyage/shared/common";
1
+ import type { PayOrderStatus } from "@coin-voyage/shared/types";
2
2
  /** Returns the current payment, or undefined if there is none.
3
3
  *
4
4
  * Status values:
@@ -1,4 +1,4 @@
1
- import { ChainType, CurrencyWithAmount, PayOrder } from "@coin-voyage/shared/common";
1
+ import type { ChainType, CurrencyWithAmount, PayOrder } from "@coin-voyage/shared/types";
2
2
  interface PayWithTokenParams {
3
3
  senderAddr: string | undefined;
4
4
  payOrder: PayOrder | undefined;
@@ -1,4 +1,4 @@
1
- import { PayOrder, PayOrderCompletedEvent, PayOrderConfirmingEvent, PayOrderRefundedEvent } from "@coin-voyage/shared/common";
1
+ import { PayOrder, PayOrderCompletedEvent, PayOrderConfirmingEvent, PayOrderRefundedEvent } from "@coin-voyage/shared/types";
2
2
  type PaymentLifecycleHandlers = {
3
3
  onPaymentStarted: ((event: PayOrderConfirmingEvent) => void) | undefined;
4
4
  onPaymentCompleted: ((event: PayOrderCompletedEvent) => void) | undefined;
@@ -1,4 +1,4 @@
1
- import { PayOrderMode, PayOrderStatus, } from "@coin-voyage/shared/common";
1
+ import { PayOrderMode, PayOrderStatus, } from "@coin-voyage/shared/types";
2
2
  import { useEffect, useMemo, useRef } from "react";
3
3
  /**
4
4
  * Handles payment lifecycle events of an order, such as started, completed, and bounced.
@@ -47,15 +47,13 @@ export function usePaymentLifecycle(order, handlers) {
47
47
  useEffect(() => {
48
48
  if (sentComplete.current || !order?.payment || !isFinalized)
49
49
  return;
50
- const payment = order.payment;
51
- const dstChainId = payment.dst.chain_id;
52
50
  sentComplete.current = true;
53
51
  if (order.status === PayOrderStatus.REFUNDED) {
54
52
  onPaymentBounced?.({
55
53
  type: "payorder_refunded",
56
54
  payorder_id: order.id,
57
55
  metadata: order.metadata,
58
- refund_address: payment.refund_address,
56
+ refund_address: order.payment.refund_address,
59
57
  refund_tx_hash: order.refund_tx_hash ?? "",
60
58
  });
61
59
  return;
@@ -64,7 +62,7 @@ export function usePaymentLifecycle(order, handlers) {
64
62
  type: "payorder_completed",
65
63
  payorder_id: order.id,
66
64
  metadata: order.metadata,
67
- payment_data: payment,
65
+ payment_data: order.payment,
68
66
  });
69
67
  }, [order, isFinalized, onPaymentCompleted, onPaymentBounced]);
70
68
  return { isStarted, isFinalized, order };
@@ -1,5 +1,5 @@
1
1
  import { WalletProps } from "@coin-voyage/crypto/types/wallet";
2
- import { ChainType, CurrencyWithAmount, PayOrder } from "@coin-voyage/shared/common";
2
+ import { ChainType, type CurrencyWithAmount, type PayOrder } from "@coin-voyage/shared/types";
3
3
  import { PayOrderParams } from "@coin-voyage/shared/types/api";
4
4
  import { ROUTES } from "../types/routes";
5
5
  import { usePayOrderQuotes } from "./usePayOrderQuotes";
@@ -1,5 +1,6 @@
1
1
  import { useAccount } from "@coin-voyage/crypto/hooks";
2
- import { ChainType, PayOrderMode, zPayOrder, } from "@coin-voyage/shared/common";
2
+ import { zPayOrder } from "@coin-voyage/shared/common";
3
+ import { ChainType, PayOrderMode, } from "@coin-voyage/shared/types";
3
4
  import { useResolveSuiNSName } from "@mysten/dapp-kit";
4
5
  import { useCallback, useState } from "react";
5
6
  import { mainnet } from "viem/chains";
@@ -1,10 +1,10 @@
1
- import { useState } from "react";
2
- import { useConnect as wagmiUseConnect } from "wagmi";
3
1
  import { useUniversalConnect } from "@coin-voyage/crypto/hooks";
4
2
  import { createWalletConnectConnector } from "@coin-voyage/crypto/lib/connectors/walletConnect";
5
3
  import { extendsWalletAdapter } from "@coin-voyage/crypto/solana/utils";
6
- import { ChainType } from "@coin-voyage/shared/common";
4
+ import { ChainType } from "@coin-voyage/shared/types";
7
5
  import { useWallet } from "@solana/wallet-adapter-react";
6
+ import { useState } from "react";
7
+ import { useConnect as wagmiUseConnect } from "wagmi";
8
8
  import usePayContext from "../components/contexts/pay";
9
9
  import { ROUTES } from "../types/routes";
10
10
  import { isWalletConnectConnector } from "../utils";
@@ -1,5 +1,5 @@
1
1
  import { useAccount, useUniversalConnect } from "@coin-voyage/crypto/hooks";
2
- import { ChainType } from "@coin-voyage/shared/common";
2
+ import { ChainType } from "@coin-voyage/shared/types";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import usePayContext from "../components/contexts/pay";
5
5
  import { ROUTES } from "../types/routes";
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ChainType } from "@coin-voyage/shared/common";
3
- import { isAndroid } from "@coin-voyage/shared/utils";
2
+ import { isAndroid } from "@coin-voyage/shared/common";
3
+ import { ChainType } from "@coin-voyage/shared/types";
4
4
  import Logos from "../../assets/logos";
5
5
  import MobileWithLogos from "../../assets/mobile-with-logos";
6
6
  // Organised in alphabetical order by key
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useInWagmiContext } from "@coin-voyage/crypto/evm/provider/provider";
3
3
  import { useAccount, useConnectCallback } from "@coin-voyage/crypto/hooks";
4
- import { PayOrderMode, PayOrderStatus } from "@coin-voyage/shared/common";
4
+ import { PayOrderMode, PayOrderStatus } from "@coin-voyage/shared/types";
5
5
  import { Buffer } from "buffer";
6
6
  import { useCallback, useEffect, useRef, useState } from "react";
7
7
  import { ThemeProvider as StyledThemeProvider } from "styled-components";
@@ -54,8 +54,8 @@ function PayKitProviderInternal({ theme = "auto", mode = "auto", customTheme, op
54
54
  const [modalOptions, setModalOptions] = useState();
55
55
  const [errorMessage, setErrorMessage] = useState("");
56
56
  const [resize, onResize] = useState(0);
57
- const onOpenRef = useRef();
58
- const onCloseRef = useRef();
57
+ const onOpenRef = useRef(undefined);
58
+ const onCloseRef = useRef(undefined);
59
59
  const setOnOpen = useCallback((fn) => {
60
60
  onOpenRef.current = fn;
61
61
  }, []);
package/dist/server.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { ChainId, ChainType } from "@coin-voyage/shared/common/chains";
1
+ export { ChainId, ChainType } from "@coin-voyage/shared/types";
2
2
  export { ApiClient } from "./lib/api";
3
3
  export type { APIError, APIResponse, APIEnvironment } from "@coin-voyage/shared/api";
package/dist/server.js CHANGED
@@ -1,2 +1,2 @@
1
- export { ChainId, ChainType } from "@coin-voyage/shared/common/chains";
1
+ export { ChainId, ChainType } from "@coin-voyage/shared/types";
2
2
  export { ApiClient } from "./lib/api";
@@ -1,4 +1,4 @@
1
- import { ChainType } from "@coin-voyage/shared/common";
1
+ import type { ChainType } from "@coin-voyage/shared/types";
2
2
  import { ROUTES } from "./routes";
3
3
  export type InitState = {
4
4
  payOrderId: string;
package/dist/types.d.ts CHANGED
@@ -5,8 +5,8 @@ import type { ReactNode } from "react";
5
5
  import type { Languages as Lang } from "./lib/localizations";
6
6
  export type APIEnvironment = APIEnvironmentShared;
7
7
  export type WalletConfiguration = WalletConfigurationImport;
8
- export type { PayOrder, PayOrderMetadata, PayOrderEvent } from "@coin-voyage/shared/common";
9
- export { PayOrderStatus, WebhookEventType } from "@coin-voyage/shared/common";
8
+ export type { PayOrder, PayOrderMetadata, ParsedPayOrderMetadata, PayOrderEvent } from "@coin-voyage/shared/types";
9
+ export { PayOrderStatus, WebhookEventType } from "@coin-voyage/shared/types";
10
10
  export type PayKitConfig = {
11
11
  children?: ReactNode;
12
12
  apiKey: string;
package/dist/types.js CHANGED
@@ -1 +1 @@
1
- export { PayOrderStatus, WebhookEventType } from "@coin-voyage/shared/common";
1
+ export { PayOrderStatus, WebhookEventType } from "@coin-voyage/shared/types";
@@ -1,9 +1,6 @@
1
1
  import React from "react";
2
- declare const truncateEthAddress: (address?: string, separator?: string) => string;
3
- declare const truncateENSAddress: (ensName: string, maxLength: number) => string;
4
- declare const nFormatter: (num: number, digits?: number) => string;
5
2
  type ReactChildArray = ReturnType<typeof React.Children.toArray>;
6
- declare function flattenChildren(children: React.ReactNode): ReactChildArray;
3
+ export declare function flattenChildren(children: React.ReactNode): ReactChildArray;
7
4
  export declare const isMobileWalletConnector: (connectorId?: string) => connectorId is "mobileWallet";
8
5
  export declare const isWalletConnectConnector: (connectorId?: string) => boolean;
9
6
  export declare const isMetaMaskConnector: (connectorId?: string) => connectorId is "metaMaskSDK";
@@ -11,4 +8,4 @@ export declare const isCoinbaseWalletConnector: (connectorId?: string) => connec
11
8
  export declare const isLedgerConnector: (connectorId?: string) => connectorId is "ledger";
12
9
  export declare const isSafeConnector: (connectorId?: string) => connectorId is "safe";
13
10
  export declare const isInjectedConnector: (connectorId?: string) => connectorId is "injected";
14
- export { flattenChildren, nFormatter, truncateENSAddress, truncateEthAddress };
11
+ export {};
@@ -1,42 +1,5 @@
1
1
  import React from "react";
2
- const truncateRegex = /^(0x[a-zA-Z0-9]{4})[a-zA-Z0-9]+([a-zA-Z0-9]{4})$/;
3
- const truncateEthAddress = (address, separator = "••••") => {
4
- if (!address) {
5
- return "";
6
- }
7
- const match = address.match(truncateRegex);
8
- if (!match) {
9
- return address;
10
- }
11
- return `${match[1]}${separator}${match[2]}`;
12
- };
13
- const truncateENSAddress = (ensName, maxLength) => {
14
- if (ensName.length > maxLength) {
15
- return `${ensName.replace(".eth", "").slice(0, maxLength)}...`;
16
- }
17
- return ensName;
18
- };
19
- const nFormatter = (num, digits = 2) => {
20
- if (num < 10000) {
21
- return num.toFixed(2);
22
- }
23
- const lookup = [
24
- { value: 1, symbol: "" },
25
- { value: 1e3, symbol: "k" },
26
- { value: 1e6, symbol: "m" },
27
- { value: 1e9, symbol: "g" },
28
- { value: 1e12, symbol: "t" },
29
- { value: 1e15, symbol: "p" },
30
- { value: 1e18, symbol: "e" },
31
- ];
32
- const rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
33
- const item = lookup
34
- .slice()
35
- .reverse()
36
- .find((item) => num >= item.value);
37
- return item ? (num / item.value).toFixed(digits).replace(rx, "$1") + item.symbol : "0";
38
- };
39
- function flattenChildren(children) {
2
+ export function flattenChildren(children) {
40
3
  const childrenArray = React.Children.toArray(children);
41
4
  return childrenArray.reduce((flatChildren, child) => {
42
5
  if (child.type === React.Fragment) {
@@ -57,4 +20,3 @@ export const isCoinbaseWalletConnector = (connectorId) => connectorId === "coinb
57
20
  export const isLedgerConnector = (connectorId) => connectorId === "ledger";
58
21
  export const isSafeConnector = (connectorId) => connectorId === "safe";
59
22
  export const isInjectedConnector = (connectorId) => connectorId === "injected";
60
- export { flattenChildren, nFormatter, truncateENSAddress, truncateEthAddress };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coin-voyage/paykit",
3
3
  "description": "Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.",
4
- "version": "2.2.4",
4
+ "version": "2.2.6",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "author": "Lars <lars@coinvoyage.io>",
@@ -62,7 +62,7 @@
62
62
  "styled-components": "^5.3.11",
63
63
  "uuid": "13.0.0",
64
64
  "@coin-voyage/crypto": "2.2.2",
65
- "@coin-voyage/shared": "2.2.2"
65
+ "@coin-voyage/shared": "2.2.4"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/qrcode": "1.5.5",
@@ -1,9 +0,0 @@
1
- /**
2
- * Component that traps focus within its children.
3
- */
4
- interface FocusTrapProps {
5
- children: React.ReactNode;
6
- className?: string;
7
- }
8
- export default function FocusTrap({ children, className }: FocusTrapProps): import("react/jsx-runtime").JSX.Element;
9
- export {};
@@ -1,53 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useRef, useCallback } from "react";
3
- const KEYCODE_TAB = 9;
4
- function useFocusTrap() {
5
- const elRef = useRef(null);
6
- const handleFocus = useCallback((e) => {
7
- if (!elRef.current)
8
- return;
9
- const focusableEls = elRef.current.querySelectorAll(`
10
- a[href]:not(:disabled),
11
- button:not(:disabled),
12
- textarea:not(:disabled),
13
- input[type="text"]:not(:disabled),
14
- input[type="radio"]:not(:disabled),
15
- input[type="checkbox"]:not(:disabled),
16
- select:not(:disabled)
17
- `);
18
- const firstFocusableEl = focusableEls[0];
19
- const lastFocusableEl = focusableEls[focusableEls.length - 1];
20
- const isTabPressed = e.key === "Tab" || e.keyCode === KEYCODE_TAB;
21
- if (!isTabPressed)
22
- return;
23
- if (e.shiftKey) {
24
- // shift + tab
25
- if (document.activeElement === firstFocusableEl) {
26
- lastFocusableEl?.focus();
27
- e.preventDefault();
28
- }
29
- }
30
- else {
31
- // tab
32
- if (document.activeElement === lastFocusableEl) {
33
- firstFocusableEl?.focus();
34
- e.preventDefault();
35
- }
36
- }
37
- }, []);
38
- useEffect(() => {
39
- const el = elRef.current;
40
- if (!el)
41
- return;
42
- el.focus({ preventScroll: true });
43
- el.addEventListener("keydown", handleFocus);
44
- return () => {
45
- el.removeEventListener("keydown", handleFocus);
46
- };
47
- }, [handleFocus]);
48
- return elRef;
49
- }
50
- export default function FocusTrap({ children, className }) {
51
- const elRef = useFocusTrap();
52
- return (_jsx("div", { ref: elRef, tabIndex: -1, className: className, children: children }));
53
- }
@@ -1 +0,0 @@
1
- export default function useIsClient(): boolean;
@@ -1,5 +0,0 @@
1
- import { useSyncExternalStore } from "react";
2
- const emptySubscribe = () => () => { };
3
- export default function useIsClient() {
4
- return useSyncExternalStore(emptySubscribe, () => true, () => false);
5
- }
@@ -1 +0,0 @@
1
- export default function usePrevious<T>(value: T, initial: T): T;
@@ -1,8 +0,0 @@
1
- import { useState } from "react";
2
- export default function usePrevious(value, initial) {
3
- const [[previous, current], setState] = useState([initial, value]);
4
- if (value !== current) {
5
- setState([current, value]);
6
- }
7
- return previous;
8
- }
@@ -1,4 +0,0 @@
1
- export default function useWindowSize(): {
2
- width: number;
3
- height: number;
4
- };
@@ -1,19 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- export default function useWindowSize() {
3
- const [windowSize, setWindowSize] = useState({
4
- width: 0,
5
- height: 0,
6
- });
7
- useEffect(() => {
8
- function handleResize() {
9
- setWindowSize({
10
- width: window.innerWidth,
11
- height: window.innerHeight,
12
- });
13
- }
14
- window.addEventListener("resize", handleResize);
15
- handleResize();
16
- return () => window.removeEventListener("resize", handleResize);
17
- }, []);
18
- return windowSize;
19
- }
@@ -1,2 +0,0 @@
1
- import type { PlatformType } from "@coin-voyage/shared/common";
2
- export declare function detectPlatform(ua: string): PlatformType;
@@ -1,10 +0,0 @@
1
- export function detectPlatform(ua) {
2
- // From https://dev.to/konyu/using-javascript-to-determine-whether-the-client-is-ios-or-android-4i1j
3
- if (/android/i.test(ua)) {
4
- return "android";
5
- }
6
- if (/iPhone|iPod|iPad/.test(ua)) {
7
- return "ios";
8
- }
9
- return "other";
10
- }