@paybutton/react 2.0.4 → 2.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/components/PayButton/PayButton.d.ts +3 -1
- package/dist/components/PayButton/PayButton.stories.d.ts +10 -0
- package/dist/components/PaymentDialog/PaymentDialog.d.ts +6 -2
- package/dist/components/Widget/Widget.d.ts +3 -2
- package/dist/components/Widget/WidgetContainer.d.ts +7 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/react/src/components/PayButton/PayButton.d.ts +2 -0
- package/dist/react/src/components/PayButton/PayButton.stories.d.ts +10 -0
- package/dist/react/src/components/PaymentDialog/PaymentDialog.d.ts +5 -1
- package/dist/react/src/components/Widget/Widget.d.ts +2 -3
- package/dist/react/src/components/Widget/WidgetContainer.d.ts +5 -3
- package/dist/util/address.d.ts +3 -3
- package/dist/util/api-client.d.ts +0 -2
- package/dist/util/randomizeSats.d.ts +3 -1
- package/dist/util/satoshis.d.ts +2 -2
- package/package.json +2 -1
- package/dist/hooks/useAddressDetails.d.ts +0 -3
- package/dist/react/src/hooks/useAddressDetails.d.ts +0 -3
|
@@ -19,6 +19,8 @@ export interface PayButtonProps extends ButtonProps {
|
|
|
19
19
|
editable?: boolean;
|
|
20
20
|
onSuccess?: (txid: string, amount: BigNumber) => void;
|
|
21
21
|
onTransaction?: (txid: string, amount: BigNumber) => void;
|
|
22
|
+
onOpen?: (expectedAmount?: number | string, address?: string) => void;
|
|
23
|
+
onClose?: (success?: boolean) => void;
|
|
22
24
|
wsBaseUrl?: string;
|
|
23
25
|
apiBaseUrl?: string;
|
|
24
26
|
}
|
|
@@ -3,10 +3,14 @@ import { Theme, ThemeName } from '../../themes';
|
|
|
3
3
|
import { ButtonProps } from '../Button/Button';
|
|
4
4
|
import { currency } from '../../util/api-client';
|
|
5
5
|
import BigNumber from 'bignumber.js';
|
|
6
|
+
import { currencyObject } from '../../util/satoshis';
|
|
6
7
|
export interface PaymentDialogProps extends ButtonProps {
|
|
7
8
|
to: string;
|
|
8
9
|
amount?: number | string;
|
|
10
|
+
setAmount: Function;
|
|
9
11
|
currency?: currency;
|
|
12
|
+
currencyObj?: currencyObject;
|
|
13
|
+
setCurrencyObj: Function;
|
|
10
14
|
theme?: ThemeName | Theme;
|
|
11
15
|
successText?: string;
|
|
12
16
|
randomSatoshis?: boolean | number;
|
|
@@ -18,7 +22,7 @@ export interface PaymentDialogProps extends ButtonProps {
|
|
|
18
22
|
disableScrollLock?: boolean;
|
|
19
23
|
active?: boolean;
|
|
20
24
|
container?: HTMLElement;
|
|
21
|
-
onClose?: () => void;
|
|
25
|
+
onClose?: (success?: boolean) => void;
|
|
22
26
|
onSuccess?: (txid: string, amount: BigNumber) => void;
|
|
23
27
|
onTransaction?: (txid: string, amount: BigNumber) => void;
|
|
24
28
|
wsBaseUrl?: string;
|
|
@@ -6,10 +6,9 @@ import { currency, Transaction } from '../../util/api-client';
|
|
|
6
6
|
export interface WidgetProps {
|
|
7
7
|
to: string;
|
|
8
8
|
amount?: number | null | string;
|
|
9
|
-
setAmount
|
|
9
|
+
setAmount?: Function;
|
|
10
10
|
text?: string;
|
|
11
11
|
ButtonComponent?: React.ComponentType;
|
|
12
|
-
loading: boolean;
|
|
13
12
|
success: boolean;
|
|
14
13
|
successText?: string;
|
|
15
14
|
theme?: ThemeName | Theme;
|
|
@@ -19,7 +18,7 @@ export interface WidgetProps {
|
|
|
19
18
|
currency?: currency;
|
|
20
19
|
animation?: animation;
|
|
21
20
|
currencyObject?: currencyObject | undefined;
|
|
22
|
-
setCurrencyObject
|
|
21
|
+
setCurrencyObject?: Function;
|
|
23
22
|
randomSatoshis?: boolean | number;
|
|
24
23
|
price?: number;
|
|
25
24
|
editable?: boolean;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { currency } from '../../util/api-client';
|
|
3
|
+
import { currencyObject } from '../../util/satoshis';
|
|
3
4
|
import { WidgetProps } from './Widget';
|
|
4
5
|
import BigNumber from 'bignumber.js';
|
|
5
|
-
export interface WidgetContainerProps extends Omit<WidgetProps, '
|
|
6
|
+
export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'setNewTxs' | 'setCurrencyObject'> {
|
|
6
7
|
active?: boolean;
|
|
7
8
|
amount?: number;
|
|
8
9
|
currency?: currency;
|
|
10
|
+
currencyObj?: currencyObject;
|
|
11
|
+
setCurrencyObj: Function;
|
|
9
12
|
randomSatoshis?: boolean | number;
|
|
10
|
-
displayCurrency?: cryptoCurrency;
|
|
11
13
|
hideToasts?: boolean;
|
|
12
14
|
onSuccess?: (txid: string, amount: BigNumber) => void;
|
|
13
15
|
onTransaction?: (txid: string, amount: BigNumber) => void;
|
package/dist/util/address.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cryptoCurrency } from '../util/api-client';
|
|
2
2
|
export declare const isValidCashAddress: (address: string) => boolean;
|
|
3
3
|
export declare const isValidXecAddress: (address: string) => boolean;
|
|
4
|
-
export declare const getCurrencyTypeFromAddress: (address: string) =>
|
|
4
|
+
export declare const getCurrencyTypeFromAddress: (address: string) => cryptoCurrency;
|
|
5
5
|
declare const _default: {
|
|
6
6
|
isValidCashAddress: (address: string) => boolean;
|
|
7
7
|
isValidXecAddress: (address: string) => boolean;
|
|
8
|
-
getCurrencyTypeFromAddress: (address: string) =>
|
|
8
|
+
getCurrencyTypeFromAddress: (address: string) => "BCH" | "XEC";
|
|
9
9
|
};
|
|
10
10
|
export default _default;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Socket } from 'socket.io-client';
|
|
2
|
-
export declare const DEFAULT_WS_URL = "https://socket.paybutton.org";
|
|
3
|
-
export declare const DEFAULT_API_URL = "https://api.paybutton.org";
|
|
4
2
|
export declare const getAddressDetails: (address: string, rootUrl?: string) => Promise<Transaction[]>;
|
|
5
3
|
declare type TxBroadcast = 'NewTx' | 'OldTx';
|
|
6
4
|
export interface BroadcastTxData {
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { cryptoCurrency } from './api-client';
|
|
2
|
+
export declare const getNSatoshis: (amount: number, randomSatoshis: boolean | number, satsPrecision: number) => number;
|
|
3
|
+
export declare const randomizeSatoshis: (amount: number, addressType: cryptoCurrency, randomSatoshis: boolean | number) => number;
|
|
2
4
|
export default randomizeSatoshis;
|
package/dist/util/satoshis.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export declare type currencyObject = {
|
|
|
4
4
|
string: string;
|
|
5
5
|
currency: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const getCurrencyObject: (amount: number, currencyType: currency) => currencyObject;
|
|
7
|
+
export declare const getCurrencyObject: (amount: number, currencyType: currency, randomSatoshis: boolean | number) => currencyObject;
|
|
8
8
|
declare const _default: {
|
|
9
|
-
getCurrencyObject: (amount: number, currencyType: currency) => currencyObject;
|
|
9
|
+
getCurrencyObject: (amount: number, currencyType: currency, randomSatoshis: number | boolean) => currencyObject;
|
|
10
10
|
};
|
|
11
11
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paybutton/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "The easiest way to accept eCash online",
|
|
5
5
|
"author": "poldridge",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "microbundle --jsx React.createElement --format modern,cjs",
|
|
19
|
+
"postbuild": "cp -rf dist/react/src/* dist/ || true",
|
|
19
20
|
"lint": "eslint 'src/**/*.{ts,tsx}' --fix",
|
|
20
21
|
"prettier": "prettier --write 'src/**/*.ts'",
|
|
21
22
|
"dev": "concurrently npm:watch npm:storybook",
|