@coin-voyage/paykit 2.4.0-beta.8 → 2.4.1-beta.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.
@@ -28,6 +28,9 @@ export declare const AuthIcon: ({ ...props }: {
28
28
  export declare const ErrorIcon: ({ ...props }: {
29
29
  [x: string]: any;
30
30
  }) => import("react/jsx-runtime").JSX.Element;
31
+ export declare const WarningIcon: ({ ...props }: {
32
+ [x: string]: any;
33
+ }) => import("react/jsx-runtime").JSX.Element;
31
34
  export declare const CreditCardIcon: ({ ...props }: {
32
35
  [x: string]: any;
33
36
  }) => import("react/jsx-runtime").JSX.Element;
@@ -41,6 +41,9 @@ export const AuthIcon = ({ ...props }) => (_jsx("div", { ...props, style: {
41
41
  export const ErrorIcon = ({ ...props }) => {
42
42
  return (_jsx("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9 18C13.9706 18 18 13.9706 18 9C18 4.02944 13.9706 0 9 0C4.02944 0 0 4.02944 0 9C0 13.9706 4.02944 18 9 18ZM6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L7.58579 9L5.29289 11.2929C4.90237 11.6834 4.90237 12.3166 5.29289 12.7071C5.68342 13.0976 6.31658 13.0976 6.70711 12.7071L9 10.4142L11.2929 12.7071C11.6834 13.0976 12.3166 13.0976 12.7071 12.7071C13.0976 12.3166 13.0976 11.6834 12.7071 11.2929L10.4142 9L12.7071 6.70711C13.0976 6.31658 13.0976 5.68342 12.7071 5.29289C12.3166 4.90237 11.6834 4.90237 11.2929 5.29289L9 7.58579L6.70711 5.29289Z", fill: "currentColor" }) }));
43
43
  };
44
+ export const WarningIcon = ({ ...props }) => {
45
+ return (_jsxs("svg", { "aria-hidden": "true", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", ...props, children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("line", { x1: "12", x2: "12", y1: "8", y2: "12" }), _jsx("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })] }));
46
+ };
44
47
  export const CreditCardIcon = ({ ...props }) => {
45
48
  return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", ...props, children: [_jsx("rect", { width: "20", height: "14", x: "2", y: "5", rx: "2" }), _jsx("line", { x1: "2", x2: "22", y1: "10", y2: "10" })] }));
46
49
  };
@@ -7,7 +7,7 @@ import useLocales from "../../../hooks/useLocales";
7
7
  import usePayContext from "../../contexts/pay/index";
8
8
  import { ModalContent, ModalH1, PageContent } from "../../ui/Modal/styles";
9
9
  import PoweredByFooter from "../../ui/PoweredByFooter/index";
10
- import { AnimationContainer, ErrorIcon, InsetContainer, Link, Spinner, SuccessIcon } from "./styles";
10
+ import { AnimationContainer, ErrorIcon, InsetContainer, Link, Spinner, SuccessIcon, WarningIcon } from "./styles";
11
11
  export default function Confirmation() {
12
12
  const locales = useLocales();
13
13
  const { paymentState, onSuccess, options } = usePayContext();
@@ -19,7 +19,7 @@ export default function Confirmation() {
19
19
  onSuccess();
20
20
  }
21
21
  }, [uiState, onSuccess]);
22
- return (_jsx(PageContent, { "$center": true, children: _jsxs(ModalContent, { "$center": true, style: { paddingBottom: 0 }, children: [_jsx(AnimationContainer, { children: _jsxs(InsetContainer, { children: [_jsx(Spinner, { "$status": uiState === "loading" }), _jsx(SuccessIcon, { "$status": uiState === "success" }), _jsx(ErrorIcon, { "$status": uiState === "error" })] }) }), _jsx(ModalH1, { children: title }), txURL && (_jsxs(Link, { href: txURL, target: "_blank", rel: "noopener noreferrer", children: [_jsx(ExternalLinkIcon, { width: 14, height: 14, fillOpacity: 0.9 }), "view transaction"] })), _jsx(PoweredByFooter, {})] }) }));
22
+ return (_jsx(PageContent, { "$center": true, children: _jsxs(ModalContent, { "$center": true, style: { paddingBottom: 0 }, children: [_jsx(AnimationContainer, { children: _jsxs(InsetContainer, { children: [_jsx(Spinner, { "$status": uiState === "loading" }), _jsx(SuccessIcon, { "$status": uiState === "success" }), _jsx(ErrorIcon, { "$status": uiState === "error" }), _jsx(WarningIcon, { "$status": uiState === "warning" })] }) }), _jsx(ModalH1, { children: title }), txURL && (_jsxs(Link, { href: txURL, target: "_blank", rel: "noopener noreferrer", children: [_jsx(ExternalLinkIcon, { width: 14, height: 14, fillOpacity: 0.9 }), "view transaction"] })), _jsx(PoweredByFooter, {})] }) }));
23
23
  }
24
24
  function getConfirmationState(payOrder, isDeposit, locales, optimisticConfirmation) {
25
25
  if (!payOrder) {
@@ -39,6 +39,13 @@ function getConfirmationState(payOrder, isDeposit, locales, optimisticConfirmati
39
39
  uiState: "error",
40
40
  };
41
41
  }
42
+ if (payOrder.status === PayOrderStatus.PARTIAL_PAYMENT) {
43
+ return {
44
+ title: "Partial payment received",
45
+ uiState: "warning",
46
+ txURL: sourceTxURL,
47
+ };
48
+ }
42
49
  if (payOrder.status === PayOrderStatus.AWAITING_CONFIRMATION ||
43
50
  payOrder.status === PayOrderStatus.OPTIMISTIC_CONFIRMED) {
44
51
  return {
@@ -3,5 +3,6 @@ declare const InsetContainer: any;
3
3
  declare const Link: any;
4
4
  declare const SuccessIcon: any;
5
5
  declare const ErrorIcon: any;
6
+ declare const WarningIcon: any;
6
7
  declare const Spinner: any;
7
- export { AnimationContainer, ErrorIcon, InsetContainer, Link, Spinner, SuccessIcon };
8
+ export { AnimationContainer, ErrorIcon, InsetContainer, Link, Spinner, SuccessIcon, WarningIcon };
@@ -1,5 +1,5 @@
1
1
  import { motion } from "framer-motion";
2
- import { ErrorIcon as ErrorIconSVG, LoadingCircleIcon, TickIcon } from "../../../assets/icons";
2
+ import { ErrorIcon as ErrorIconSVG, LoadingCircleIcon, TickIcon, WarningIcon as WarningIconSVG, } from "../../../assets/icons";
3
3
  import styled from "../../../styles/styled/index";
4
4
  const AnimationContainer = styled(motion.div) `
5
5
  position: relative;
@@ -51,6 +51,14 @@ const ErrorIcon = styled(ErrorIconSVG) `
51
51
  opacity: ${(props) => (props.$status ? 1 : 0)};
52
52
  transform: scale(${(p) => (p.$status ? 1 : 0.5)});
53
53
  `;
54
+ const WarningIcon = styled(WarningIconSVG) `
55
+ color: var(--ck-body-color-warning);
56
+ transition: all 0.2s ease-in-out;
57
+ position: absolute;
58
+
59
+ opacity: ${(props) => (props.$status ? 1 : 0)};
60
+ transform: scale(${(p) => (p.$status ? 1 : 0.5)});
61
+ `;
54
62
  const Spinner = styled(LoadingCircleIcon) `
55
63
  position: absolute;
56
64
 
@@ -76,4 +84,4 @@ const Spinner = styled(LoadingCircleIcon) `
76
84
  }
77
85
  }
78
86
  `;
79
- export { AnimationContainer, ErrorIcon, InsetContainer, Link, Spinner, SuccessIcon };
87
+ export { AnimationContainer, ErrorIcon, InsetContainer, Link, Spinner, SuccessIcon, WarningIcon };
@@ -3,6 +3,8 @@ import type { PayOrderStatus } from "@coin-voyage/shared/types";
3
3
  *
4
4
  * Status values:
5
5
  * - `PENDING` - the user has not paid yet
6
+ * - `FAILED` - the payOrder is finalized and failed before completing execution.
7
+ * - `PARTIAL_PAYMENT` - the payOrder received an insufficient amount and is shown as a terminal partial-payment state.
6
8
  * - `AWAITING_PAYMENT` - the user has requested payment details but not yet executed the payment.
7
9
  * - `AWAITING_CONFIRMATION` - the user has paid & payment is in progress. This status
8
10
  * typically lasts a few seconds.
@@ -3,6 +3,8 @@ import usePayContext from "../components/contexts/pay";
3
3
  *
4
4
  * Status values:
5
5
  * - `PENDING` - the user has not paid yet
6
+ * - `FAILED` - the payOrder is finalized and failed before completing execution.
7
+ * - `PARTIAL_PAYMENT` - the payOrder received an insufficient amount and is shown as a terminal partial-payment state.
6
8
  * - `AWAITING_PAYMENT` - the user has requested payment details but not yet executed the payment.
7
9
  * - `AWAITING_CONFIRMATION` - the user has paid & payment is in progress. This status
8
10
  * typically lasts a few seconds.
@@ -18,6 +18,7 @@ export function usePaymentLifecycle(order, handlers) {
18
18
  return false;
19
19
  const startedStatus = [
20
20
  ...completedStates,
21
+ PayOrderStatus.PARTIAL_PAYMENT,
21
22
  PayOrderStatus.AWAITING_CONFIRMATION,
22
23
  PayOrderStatus.OPTIMISTIC_CONFIRMED,
23
24
  PayOrderStatus.EXECUTING_ORDER,
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.4.0-beta.8",
4
+ "version": "2.4.1-beta.0",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "author": "Lars <lars@coinvoyage.io>",
@@ -63,8 +63,8 @@
63
63
  "@stripe/crypto": "0.0.4",
64
64
  "styled-components": "^5.3.11",
65
65
  "uuid": "13.0.0",
66
- "@coin-voyage/shared": "2.4.0-beta.6",
67
- "@coin-voyage/crypto": "2.4.0-beta.0"
66
+ "@coin-voyage/crypto": "2.4.0",
67
+ "@coin-voyage/shared": "2.4.1-beta.0"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@types/qrcode": "1.5.5",