@paybutton/react 5.0.3 → 5.1.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/dist/index.d.ts +5 -22
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +2 -0
- package/dist/index.modern.mjs.map +1 -0
- package/dist/lib/altpayment/index.d.ts +6 -6
- package/dist/lib/altpayment/sideshift.d.ts +1 -1
- package/dist/lib/components/BarChart/BarChart.d.ts +4 -10
- package/dist/lib/components/BarChart/BarChart.stories.d.ts +1 -7
- package/dist/lib/components/Button/Button.d.ts +2 -5
- package/dist/lib/components/Button/Button.stories.d.ts +1 -1
- package/dist/lib/components/PayButton/PayButton.d.ts +6 -7
- package/dist/lib/components/PayButton/PayButton.stories.d.ts +1 -4
- package/dist/lib/components/PaymentDialog/PaymentDialog.d.ts +6 -15
- package/dist/lib/components/PaymentDialog/PaymentDialog.stories.d.ts +1 -14
- package/dist/lib/components/Widget/Widget.d.ts +6 -1
- package/dist/lib/components/Widget/WidgetContainer.d.ts +4 -1
- package/dist/lib/themes/index.d.ts +1 -1
- package/dist/lib/util/address.d.ts +1 -1
- package/dist/lib/util/api-client.d.ts +2 -1
- package/dist/lib/util/autoClose.d.ts +10 -0
- package/dist/lib/util/cashtab.d.ts +2 -2
- package/dist/lib/util/constants.d.ts +12 -1
- package/dist/lib/util/format.d.ts +2 -2
- package/dist/lib/util/index.d.ts +1 -0
- package/dist/lib/util/socket.d.ts +1 -1
- package/dist/lib/util/types.d.ts +8 -7
- package/dist/lib/util/validate.d.ts +1 -1
- package/dist/src/App.d.ts +2 -2
- package/package.json +28 -19
- package/dist/index.modern.js +0 -2
- package/dist/index.modern.js.map +0 -1
- package/dist/lib/tests/util/currency.test.d.ts +0 -1
- package/dist/lib/tests/util/format.test.d.ts +0 -1
- package/dist/lib/tests/util/number.test.d.ts +0 -1
- package/dist/lib/tests/util/opReturn.test.d.ts +0 -1
- package/dist/lib/tests/util/validate.test.d.ts +0 -1
|
@@ -10,12 +10,12 @@ export declare const SOCKET_MESSAGES: {
|
|
|
10
10
|
ERROR_WHEN_CREATING_QUOTE: string;
|
|
11
11
|
ERROR_WHEN_CREATING_SHIFT: string;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
13
|
+
export type AltpaymentClientOptions = 'sideshift' | 'mocked';
|
|
14
|
+
export type AltpaymentCoin = SideshiftCoin;
|
|
15
|
+
export type AltpaymentQuote = SideshiftQuote;
|
|
16
|
+
export type AltpaymentPair = SideshiftPair;
|
|
17
|
+
export type AltpaymentShift = SideshiftShift;
|
|
18
|
+
export type AltpaymentError = SideshiftError;
|
|
19
19
|
export interface AltpaymentClient {
|
|
20
20
|
getPaymentStatus: (id: string) => Promise<AltpaymentShift>;
|
|
21
21
|
}
|
|
@@ -59,7 +59,7 @@ export interface SideshiftShift {
|
|
|
59
59
|
status: string;
|
|
60
60
|
type: string;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
type ErrorType = 'quote-error' | 'shift-error';
|
|
63
63
|
export interface SideshiftError {
|
|
64
64
|
errorType: ErrorType;
|
|
65
65
|
errorMessage: string;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface BarChartProps {
|
|
3
|
-
value
|
|
4
|
-
color
|
|
5
|
-
disabled
|
|
3
|
+
value?: number;
|
|
4
|
+
color?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare const BarChart: {
|
|
8
|
-
(props: BarChartProps): React.ReactElement;
|
|
9
|
-
defaultProps: {
|
|
10
|
-
value: number;
|
|
11
|
-
color: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
7
|
+
export declare const BarChart: ({ value, color, disabled, }: BarChartProps) => React.ReactElement;
|
|
14
8
|
export default BarChart;
|
|
@@ -2,13 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { BarChartProps } from './BarChart';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: {
|
|
6
|
-
(props: BarChartProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
7
|
-
defaultProps: {
|
|
8
|
-
value: number;
|
|
9
|
-
color: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
5
|
+
component: ({ value, color, disabled, }: BarChartProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
12
6
|
decorators: ((Story: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("@storybook/types").Args>) => React.ReactNode)[];
|
|
13
7
|
argTypes: {
|
|
14
8
|
onClick: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Theme, ThemeName } from '../../themes';
|
|
3
3
|
import { ButtonSize } from '../../util';
|
|
4
|
-
export
|
|
4
|
+
export type animation = 'slide' | 'invert' | 'none' | undefined;
|
|
5
5
|
export interface ButtonProps {
|
|
6
6
|
animation?: animation;
|
|
7
7
|
text?: string;
|
|
@@ -12,8 +12,5 @@ export interface ButtonProps {
|
|
|
12
12
|
size?: ButtonSize;
|
|
13
13
|
sizeScaleAlreadyApplied?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export declare const Button: {
|
|
16
|
-
(props: ButtonProps): React.ReactElement;
|
|
17
|
-
defaultProps: ButtonProps;
|
|
18
|
-
};
|
|
15
|
+
export declare const Button: ({ animation, text, hoverText, disabled, size, sizeScaleAlreadyApplied, onClick, theme: themeProp, }: ButtonProps) => React.ReactElement;
|
|
19
16
|
export default Button;
|
|
@@ -2,6 +2,6 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
2
2
|
import Button from './Button';
|
|
3
3
|
declare const meta: Meta<typeof Button>;
|
|
4
4
|
export default meta;
|
|
5
|
-
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
7
|
export declare const OrangeTheme: Story;
|
|
@@ -26,14 +26,13 @@ export interface PayButtonProps extends ButtonProps {
|
|
|
26
26
|
apiBaseUrl?: string;
|
|
27
27
|
transactionText?: string;
|
|
28
28
|
disableSound?: boolean;
|
|
29
|
-
autoClose?: boolean;
|
|
29
|
+
autoClose?: boolean | number | string;
|
|
30
30
|
disableAltpayment?: boolean;
|
|
31
31
|
contributionOffset?: number;
|
|
32
|
-
size
|
|
33
|
-
sizeScaleAlreadyApplied
|
|
32
|
+
size?: ButtonSize;
|
|
33
|
+
sizeScaleAlreadyApplied?: boolean;
|
|
34
|
+
donationAddress?: string;
|
|
35
|
+
donationRate?: number;
|
|
34
36
|
}
|
|
35
|
-
export declare const PayButton: {
|
|
36
|
-
(props: PayButtonProps): React.ReactElement;
|
|
37
|
-
defaultProps: PayButtonProps;
|
|
38
|
-
};
|
|
37
|
+
export declare const PayButton: ({ to, amount: initialAmount, opReturn, disablePaymentId, currency, theme: themeProp, text, hoverText, successText, animation, randomSatoshis, hideToasts, disabled: disabledProp, goalAmount, disableEnforceFocus, editable, onSuccess, onTransaction, onOpen, onClose, wsBaseUrl, apiBaseUrl, transactionText, disableSound, autoClose, disableAltpayment, contributionOffset, size, sizeScaleAlreadyApplied, donationRate, donationAddress }: PayButtonProps) => React.ReactElement;
|
|
39
38
|
export default PayButton;
|
|
@@ -2,10 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { PayButtonProps } from './PayButton';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: {
|
|
6
|
-
(props: PayButtonProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
7
|
-
defaultProps: PayButtonProps;
|
|
8
|
-
};
|
|
5
|
+
component: ({ to, amount: initialAmount, opReturn, disablePaymentId, currency, theme: themeProp, text, hoverText, successText, animation, randomSatoshis, hideToasts, disabled: disabledProp, goalAmount, disableEnforceFocus, editable, onSuccess, onTransaction, onOpen, onClose, wsBaseUrl, apiBaseUrl, transactionText, disableSound, autoClose, disableAltpayment, contributionOffset, size, sizeScaleAlreadyApplied, donationRate, donationAddress }: PayButtonProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
9
6
|
decorators: ((Story: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("@storybook/types").Args>) => JSX.Element)[];
|
|
10
7
|
argTypes: {
|
|
11
8
|
onClick: {
|
|
@@ -58,22 +58,13 @@ export interface PaymentDialogProps extends ButtonProps {
|
|
|
58
58
|
setAddressType: Function;
|
|
59
59
|
setNewTxs: Function;
|
|
60
60
|
newTxs?: Transaction[];
|
|
61
|
-
autoClose?: boolean;
|
|
61
|
+
autoClose?: boolean | number | string;
|
|
62
62
|
disableSound?: boolean;
|
|
63
|
+
donationAddress?: string;
|
|
64
|
+
donationRate?: number;
|
|
63
65
|
transactionText?: string;
|
|
66
|
+
convertedCurrencyObj?: CurrencyObject;
|
|
67
|
+
setConvertedCurrencyObj?: Function;
|
|
64
68
|
}
|
|
65
|
-
export declare const PaymentDialog: {
|
|
66
|
-
(props: PaymentDialogProps): React.ReactElement;
|
|
67
|
-
defaultProps: {
|
|
68
|
-
animation: string;
|
|
69
|
-
hideToasts: boolean;
|
|
70
|
-
randomSatoshis: boolean;
|
|
71
|
-
successText: string;
|
|
72
|
-
disableEnforceFocus: boolean;
|
|
73
|
-
disabled: boolean;
|
|
74
|
-
editable: boolean;
|
|
75
|
-
dialogOpen: boolean;
|
|
76
|
-
autoClose: boolean;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
69
|
+
export declare const PaymentDialog: ({ to, amount, setAmount, opReturn, paymentId, disablePaymentId, currency, currencyObj, setCurrencyObj, cryptoAmount, price, successText, animation, randomSatoshis, hideToasts, onClose, onSuccess, onTransaction, goalAmount, disableEnforceFocus, editable, dialogOpen, setDialogOpen, container, wsBaseUrl, apiBaseUrl, hoverText, disableAltpayment, contributionOffset, autoClose, useAltpayment, setUseAltpayment, setTxsSocket, txsSocket, setAltpaymentSocket, altpaymentSocket, setCoins, coins, setCoinPair, coinPair, setLoadingPair, loadingPair, setAltpaymentShift, altpaymentShift, setLoadingShift, loadingShift, setAltpaymentError, altpaymentError, addressType, newTxs, setNewTxs, setAddressType, disableSound, transactionText, disabled, convertedCurrencyObj, setConvertedCurrencyObj, theme: themeProp, donationAddress, donationRate }: PaymentDialogProps) => React.ReactElement;
|
|
79
70
|
export default PaymentDialog;
|
|
@@ -2,20 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { PaymentDialogProps } from './PaymentDialog';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: {
|
|
6
|
-
(props: PaymentDialogProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
7
|
-
defaultProps: {
|
|
8
|
-
animation: string;
|
|
9
|
-
hideToasts: boolean;
|
|
10
|
-
randomSatoshis: boolean;
|
|
11
|
-
successText: string;
|
|
12
|
-
disableEnforceFocus: boolean;
|
|
13
|
-
disabled: boolean;
|
|
14
|
-
editable: boolean;
|
|
15
|
-
dialogOpen: boolean;
|
|
16
|
-
autoClose: boolean;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
5
|
+
component: ({ to, amount, setAmount, opReturn, paymentId, disablePaymentId, currency, currencyObj, setCurrencyObj, cryptoAmount, price, successText, animation, randomSatoshis, hideToasts, onClose, onSuccess, onTransaction, goalAmount, disableEnforceFocus, editable, dialogOpen, setDialogOpen, container, wsBaseUrl, apiBaseUrl, hoverText, disableAltpayment, contributionOffset, autoClose, useAltpayment, setUseAltpayment, setTxsSocket, txsSocket, setAltpaymentSocket, altpaymentSocket, setCoins, coins, setCoinPair, coinPair, setLoadingPair, loadingPair, setAltpaymentShift, altpaymentShift, setLoadingShift, loadingShift, setAltpaymentError, altpaymentError, addressType, newTxs, setNewTxs, setAddressType, disableSound, transactionText, disabled, convertedCurrencyObj, setConvertedCurrencyObj, theme: themeProp, donationAddress, donationRate }: PaymentDialogProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
19
6
|
decorators: ((Story: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("@storybook/types").Args>) => JSX.Element)[];
|
|
20
7
|
argTypes: {
|
|
21
8
|
onClick: {
|
|
@@ -28,7 +28,7 @@ export interface WidgetProps {
|
|
|
28
28
|
price?: number | undefined;
|
|
29
29
|
usdPrice?: number | undefined;
|
|
30
30
|
editable?: boolean;
|
|
31
|
-
setNewTxs
|
|
31
|
+
setNewTxs?: Function;
|
|
32
32
|
newTxs?: Transaction[];
|
|
33
33
|
wsBaseUrl?: string;
|
|
34
34
|
apiBaseUrl?: string;
|
|
@@ -45,6 +45,8 @@ export interface WidgetProps {
|
|
|
45
45
|
altpaymentSocket?: Socket;
|
|
46
46
|
setAltpaymentSocket?: Function;
|
|
47
47
|
shiftCompleted?: boolean;
|
|
48
|
+
donationAddress?: string;
|
|
49
|
+
donationRate?: number;
|
|
48
50
|
setShiftCompleted?: Function;
|
|
49
51
|
setCoins?: Function;
|
|
50
52
|
coins?: AltpaymentCoin[];
|
|
@@ -60,6 +62,9 @@ export interface WidgetProps {
|
|
|
60
62
|
setAddressType?: Function;
|
|
61
63
|
newTxText?: string;
|
|
62
64
|
transactionText?: string;
|
|
65
|
+
convertedCurrencyObj?: CurrencyObject;
|
|
66
|
+
setConvertedCurrencyObj?: Function;
|
|
67
|
+
setPaymentId?: Function;
|
|
63
68
|
}
|
|
64
69
|
export declare const Widget: React.FunctionComponent<WidgetProps>;
|
|
65
70
|
export default Widget;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Currency, CurrencyObject, Transaction } from '../../util';
|
|
3
3
|
import { WidgetProps } from './Widget';
|
|
4
|
-
export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'setCurrencyObject' | 'shiftCompleted' | 'setShiftCompleted'> {
|
|
4
|
+
export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'setCurrencyObject' | 'shiftCompleted' | 'setShiftCompleted' | 'setPaymentId'> {
|
|
5
5
|
active?: boolean;
|
|
6
6
|
amount?: number;
|
|
7
7
|
opReturn?: string;
|
|
@@ -28,6 +28,9 @@ export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'set
|
|
|
28
28
|
setNewTxs: Function;
|
|
29
29
|
disableSound?: boolean;
|
|
30
30
|
transactionText?: string;
|
|
31
|
+
donationAddress?: string;
|
|
32
|
+
donationRate?: number;
|
|
33
|
+
convertedCurrencyObj?: CurrencyObject;
|
|
31
34
|
}
|
|
32
35
|
export interface Output {
|
|
33
36
|
index: number;
|
|
@@ -10,4 +10,4 @@ export declare enum ThemeName {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const getTheme: (name?: ThemeName) => Theme;
|
|
12
12
|
export declare const ThemeProvider: React.Provider<Theme | undefined>;
|
|
13
|
-
export declare const useTheme: (defaultTheme?: ThemeName | Theme
|
|
13
|
+
export declare const useTheme: (defaultTheme?: ThemeName | Theme, isXec?: boolean) => Theme;
|
|
@@ -8,6 +8,6 @@ declare const _default: {
|
|
|
8
8
|
getCurrencyTypeFromAddress: (address: string) => string;
|
|
9
9
|
};
|
|
10
10
|
export default _default;
|
|
11
|
-
|
|
11
|
+
type NetworkSlugsType = 'ecash' | 'bitcoincash';
|
|
12
12
|
export declare const getAddressPrefix: (addressString: string) => NetworkSlugsType;
|
|
13
13
|
export declare const getAddressPrefixed: (addressString: string) => string;
|
|
@@ -4,8 +4,9 @@ export declare const getAddressBalance: (address: string, rootUrl?: string) => P
|
|
|
4
4
|
export declare const getUTXOs: (address: string, rootUrl?: string) => Promise<UtxoDetails>;
|
|
5
5
|
export declare const getBchFiatPrice: (currency: Currency, rootUrl?: string) => Promise<PriceData>;
|
|
6
6
|
export declare const getXecFiatPrice: (currency: Currency, rootUrl?: string) => Promise<PriceData>;
|
|
7
|
-
export declare const getFiatPrice: (currency: string, to: string, apiBaseUrl?: string
|
|
7
|
+
export declare const getFiatPrice: (currency: string, to: string, apiBaseUrl?: string) => Promise<number | null>;
|
|
8
8
|
export declare const getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
|
|
9
|
+
export declare const createPayment: (amount: string | number | undefined, address: string, rootUrl?: string) => Promise<string | undefined>;
|
|
9
10
|
declare const _default: {
|
|
10
11
|
getAddressDetails: (address: string, rootUrl?: string) => Promise<Transaction[]>;
|
|
11
12
|
getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type AutoCloseValue = boolean | number | string | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* Determine auto-close delay (ms) from a variety of allowed input types.
|
|
4
|
+
* Rules:
|
|
5
|
+
* - undefined -> default enabled delay
|
|
6
|
+
* - boolean -> true: default delay; false: disabled (undefined)
|
|
7
|
+
* - number -> >0 seconds: round to nearest ms; <=0: disabled
|
|
8
|
+
* - string -> 'true': default; 'false': disabled; numeric string parsed like number; other strings: default
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAutoCloseDelay(value: AutoCloseValue): number | undefined;
|
|
@@ -10,7 +10,7 @@ export declare const getCashtabProviderStatus: () => Promise<boolean>;
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const clearCashtabStatusCache: () => void;
|
|
12
12
|
export declare const initializeCashtabStatus: () => Promise<boolean>;
|
|
13
|
-
export declare const waitForCashtabExtension: (timeout?: number
|
|
13
|
+
export declare const waitForCashtabExtension: (timeout?: number) => Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Request the user's eCash address from their Cashtab wallet
|
|
16
16
|
* @returns Promise<string> - The user's address
|
|
@@ -25,5 +25,5 @@ export declare const sendXecWithCashtab: (address: string, amount: string | numb
|
|
|
25
25
|
* @param bip21Url - The BIP21 formatted payment URL
|
|
26
26
|
* @param fallbackUrl - Optional fallback URL if extension is not available
|
|
27
27
|
*/
|
|
28
|
-
export declare const openCashtabPayment: (bip21Url: string, fallbackUrl?: string
|
|
28
|
+
export declare const openCashtabPayment: (bip21Url: string, fallbackUrl?: string) => Promise<void>;
|
|
29
29
|
export { CashtabExtensionUnavailableError, CashtabAddressDeniedError, CashtabTimeoutError };
|
|
@@ -3,5 +3,16 @@ export declare const CRYPTO_CURRENCIES: string[];
|
|
|
3
3
|
export declare const DECIMALS: {
|
|
4
4
|
[key: string]: number;
|
|
5
5
|
};
|
|
6
|
+
export declare const MAX_AMOUNT: {
|
|
7
|
+
[key: string]: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const AUTO_CLOSE_DEFAULT_MS = 2000;
|
|
6
10
|
export declare const CURRENCY_PREFIXES_MAP: Record<typeof CRYPTO_CURRENCIES[number], string>;
|
|
7
|
-
export declare
|
|
11
|
+
export declare const CURRENCY_TYPES_MAP: Record<typeof CRYPTO_CURRENCIES[number], string>;
|
|
12
|
+
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | "extrasmall" | "small" | "medium" | "large" | "extralarge" | undefined;
|
|
13
|
+
export declare const DEFAULT_DONATION_RATE = 2;
|
|
14
|
+
export declare const DONATION_RATE_STORAGE_KEY = "paybutton_donation_rate";
|
|
15
|
+
export declare const DONATION_RATE_FIAT_THRESHOLD = 5;
|
|
16
|
+
export declare const DEFAULT_MINIMUM_DONATION_AMOUNT: {
|
|
17
|
+
[key: string]: number;
|
|
18
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Currency } from './types';
|
|
2
|
-
export declare const amount: (x?: number | null
|
|
2
|
+
export declare const amount: (x?: number | null) => string | undefined;
|
|
3
3
|
export declare const formatPrice: (price: number, currencyType: Currency, precision?: number) => string;
|
|
4
4
|
export declare const formatComma: (number: number) => string;
|
|
5
5
|
export declare const formatBCH: (bch: string) => string;
|
|
6
6
|
export declare const formatXEC: (xec: string) => string;
|
|
7
|
-
export declare const isPropsTrue: (value?: string | boolean
|
|
7
|
+
export declare const isPropsTrue: (value?: string | boolean) => boolean;
|
|
8
8
|
declare const _default: {
|
|
9
9
|
amount: (x?: number | null | undefined) => string | undefined;
|
|
10
10
|
formatPrice: (price: number, currencyType: string, precision?: number) => string;
|
package/dist/lib/util/index.d.ts
CHANGED
|
@@ -36,5 +36,5 @@ interface SetupTxsSocketParams {
|
|
|
36
36
|
}
|
|
37
37
|
export declare const setupTxsSocket: (params: SetupTxsSocketParams) => Promise<void>;
|
|
38
38
|
export declare const setupChronikWebSocket: (params: SetupTxsSocketParams) => Promise<void>;
|
|
39
|
-
export declare const onMessage: (transactions: Transaction[], setNewTxs: Function, setDialogOpen?: Function
|
|
39
|
+
export declare const onMessage: (transactions: Transaction[], setNewTxs: Function, setDialogOpen?: Function, checkSuccessInfo?: CheckSuccessInfo) => void;
|
|
40
40
|
export {};
|
package/dist/lib/util/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
2
|
import { CRYPTO_CURRENCIES, FIAT_CURRENCIES } from "./constants";
|
|
3
|
-
export
|
|
3
|
+
export type CurrencyObject = {
|
|
4
4
|
float: number;
|
|
5
5
|
string: string;
|
|
6
6
|
currency: string;
|
|
@@ -123,12 +123,12 @@ export interface TransactionDetails {
|
|
|
123
123
|
};
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
export
|
|
130
|
-
export
|
|
131
|
-
export
|
|
126
|
+
type FiatCurrenciesTuple = typeof FIAT_CURRENCIES;
|
|
127
|
+
type CyptoCurrenciesTuple = typeof CRYPTO_CURRENCIES;
|
|
128
|
+
type TxBroadcast = 'NewTx' | 'OldTx';
|
|
129
|
+
export type CryptoCurrency = FiatCurrenciesTuple[number];
|
|
130
|
+
export type FiatCurrency = CyptoCurrenciesTuple[number];
|
|
131
|
+
export type Currency = CryptoCurrency | FiatCurrency;
|
|
132
132
|
export interface BroadcastTxData {
|
|
133
133
|
address: string;
|
|
134
134
|
txs: Transaction[];
|
|
@@ -143,5 +143,6 @@ export interface CheckSuccessInfo {
|
|
|
143
143
|
expectedAmount?: BigNumber | number;
|
|
144
144
|
expectedOpReturn?: string;
|
|
145
145
|
currencyObj?: CurrencyObject;
|
|
146
|
+
donationRate?: number;
|
|
146
147
|
}
|
|
147
148
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
2
|
import { CurrencyObject, Transaction } from "./types";
|
|
3
|
-
export declare const shouldTriggerOnSuccess: (transaction: Transaction, currency: string, price: number, randomSatoshis: number | boolean, disablePaymentId?: boolean
|
|
3
|
+
export declare const shouldTriggerOnSuccess: (transaction: Transaction, currency: string, price: number, randomSatoshis: number | boolean, disablePaymentId?: boolean, expectedPaymentId?: string, expectedAmount?: BigNumber | number, expectedOpReturn?: string, currencyObject?: CurrencyObject) => boolean;
|
package/dist/src/App.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare function App(): JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare function App(): React.JSX.Element;
|
|
3
3
|
export default App;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paybutton/react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "The easiest way to accept eCash online",
|
|
5
5
|
"author": "Blockchain Ventures Corp.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"test:coverage": "jest --coverage"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"react": "^
|
|
32
|
-
"react-dom": "^
|
|
31
|
+
"react": "^18.0.0",
|
|
32
|
+
"react-dom": "^18.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@babel/core": "7.18.9",
|
|
@@ -41,14 +41,16 @@
|
|
|
41
41
|
"@storybook/cli": "^7.6.17",
|
|
42
42
|
"@storybook/react": "^7.6.17",
|
|
43
43
|
"@storybook/react-vite": "^7.6.17",
|
|
44
|
+
"@testing-library/dom": "^10.4.1",
|
|
45
|
+
"@testing-library/react": "^16.3.0",
|
|
46
|
+
"@testing-library/user-event": "^14.6.1",
|
|
44
47
|
"@types/currency-formatter": "1.5.1",
|
|
45
48
|
"@types/decimal.js": "^7.4.3",
|
|
46
49
|
"@types/lodash": "4.14.182",
|
|
47
50
|
"@types/minimatch": "^6.0.0",
|
|
48
51
|
"@types/node": "17.0.41",
|
|
49
|
-
"@types/
|
|
50
|
-
"@types/react": "
|
|
51
|
-
"@types/react-dom": "17.0.0",
|
|
52
|
+
"@types/react": "18.3.26",
|
|
53
|
+
"@types/react-dom": "18.0.0",
|
|
52
54
|
"@typescript-eslint/eslint-plugin": "8.39.1",
|
|
53
55
|
"@typescript-eslint/parser": "8.39.1",
|
|
54
56
|
"@vitejs/plugin-react": "^4.6.0",
|
|
@@ -70,11 +72,12 @@
|
|
|
70
72
|
"eslint-plugin-standard": "4.1.0",
|
|
71
73
|
"html-webpack-plugin": "^5.5.0",
|
|
72
74
|
"husky": "4.3.8",
|
|
75
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
73
76
|
"lint-staged": "10.5.4",
|
|
74
|
-
"microbundle": "0.
|
|
77
|
+
"microbundle": "^0.15.1",
|
|
75
78
|
"prettier": "2.7.1",
|
|
76
|
-
"react": "
|
|
77
|
-
"react-dom": "
|
|
79
|
+
"react": "18",
|
|
80
|
+
"react-dom": "18",
|
|
78
81
|
"react-is": "16.13.1",
|
|
79
82
|
"react-scripts": "5.0.1",
|
|
80
83
|
"storybook": "^7.6.17",
|
|
@@ -83,12 +86,13 @@
|
|
|
83
86
|
"yarn-run-all": "^3.1.1"
|
|
84
87
|
},
|
|
85
88
|
"dependencies": {
|
|
86
|
-
"@
|
|
87
|
-
"@
|
|
88
|
-
"@
|
|
89
|
+
"@emotion/react": "^11.14.0",
|
|
90
|
+
"@emotion/styled": "^11.14.1",
|
|
91
|
+
"@mui/lab": "^7.0.1-beta.18",
|
|
92
|
+
"@mui/material": "^7.3.4",
|
|
89
93
|
"@types/crypto-js": "^4.2.1",
|
|
90
94
|
"@types/jest": "^29.5.11",
|
|
91
|
-
"axios": "1.
|
|
95
|
+
"axios": "1.12.0",
|
|
92
96
|
"bignumber.js": "9.0.2",
|
|
93
97
|
"cashtab-connect": "^1.1.0",
|
|
94
98
|
"chronik-client-cashtokens": "^3.4.0",
|
|
@@ -98,11 +102,12 @@
|
|
|
98
102
|
"ecashaddrjs": "^2.0.0",
|
|
99
103
|
"jest": "^29.7.0",
|
|
100
104
|
"lodash": "4.17.21",
|
|
101
|
-
"notistack": "
|
|
102
|
-
"qrcode.react": "
|
|
105
|
+
"notistack": "3.0.0",
|
|
106
|
+
"qrcode.react": "3",
|
|
103
107
|
"react-jss": "10.10.0",
|
|
108
|
+
"react-number-format": "^5.4.4",
|
|
104
109
|
"socket.io-client": "4.7.4",
|
|
105
|
-
"ts-jest": "^29.
|
|
110
|
+
"ts-jest": "^29.4.5",
|
|
106
111
|
"xecaddrjs": "^0.0.1"
|
|
107
112
|
},
|
|
108
113
|
"lint-staged": {
|
|
@@ -112,8 +117,12 @@
|
|
|
112
117
|
]
|
|
113
118
|
},
|
|
114
119
|
"resolutions": {
|
|
115
|
-
"@types/react": "
|
|
116
|
-
"@types/react-dom": "
|
|
117
|
-
"chronik-client-cashtokens/ecashaddrjs": "^2.0.0"
|
|
120
|
+
"@types/react": "18.3.26",
|
|
121
|
+
"@types/react-dom": "18.3.0",
|
|
122
|
+
"chronik-client-cashtokens/ecashaddrjs": "^2.0.0",
|
|
123
|
+
"webpack": "^5.0.0",
|
|
124
|
+
"@babel/plugin-syntax-flow": "^7.14.5",
|
|
125
|
+
"@babel/plugin-transform-react-jsx": "^7.14.9",
|
|
126
|
+
"jsdom": "20.0.3"
|
|
118
127
|
}
|
|
119
128
|
}
|