@paybutton/react 4.1.0 → 4.2.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.
Files changed (56) hide show
  1. package/dist/{react/index.d.ts → index.d.ts} +1 -0
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.modern.js +1 -1
  5. package/dist/index.modern.js.map +1 -1
  6. package/dist/{react/lib → lib}/altpayment/index.d.ts +1 -0
  7. package/dist/{react/lib → lib}/components/Button/Button.d.ts +3 -0
  8. package/dist/{react/lib → lib}/components/PayButton/PayButton.d.ts +6 -1
  9. package/dist/{react/lib → lib}/components/PaymentDialog/PaymentDialog.d.ts +29 -0
  10. package/dist/{react/lib → lib}/components/PaymentDialog/PaymentDialog.stories.d.ts +1 -0
  11. package/dist/{react/lib → lib}/components/Widget/Widget.d.ts +27 -7
  12. package/dist/{react/lib → lib}/components/Widget/WidgetContainer.d.ts +4 -1
  13. package/dist/{react/lib → lib}/util/address.d.ts +3 -0
  14. package/dist/{react/lib → lib}/util/constants.d.ts +1 -0
  15. package/dist/lib/util/socket.d.ts +38 -0
  16. package/dist/{react/lib → lib}/util/types.d.ts +11 -0
  17. package/dist/lib/util/validate.d.ts +3 -0
  18. package/package.json +3 -3
  19. package/dist/react/lib/util/socket.d.ts +0 -14
  20. package/dist/react/lib/util/validate.d.ts +0 -3
  21. /package/dist/{react/lib → lib}/altpayment/mocked.d.ts +0 -0
  22. /package/dist/{react/lib → lib}/altpayment/sideshift.d.ts +0 -0
  23. /package/dist/{react/lib → lib}/assets/edit-pencil.d.ts +0 -0
  24. /package/dist/{react/lib → lib}/components/BarChart/BarChart.d.ts +0 -0
  25. /package/dist/{react/lib → lib}/components/BarChart/BarChart.stories.d.ts +0 -0
  26. /package/dist/{react/lib → lib}/components/BarChart/index.d.ts +0 -0
  27. /package/dist/{react/lib → lib}/components/Button/Button.stories.d.ts +0 -0
  28. /package/dist/{react/lib → lib}/components/Button/index.d.ts +0 -0
  29. /package/dist/{react/lib → lib}/components/PayButton/PayButton.stories.d.ts +0 -0
  30. /package/dist/{react/lib → lib}/components/PayButton/index.d.ts +0 -0
  31. /package/dist/{react/lib → lib}/components/PaymentDialog/index.d.ts +0 -0
  32. /package/dist/{react/lib → lib}/components/Widget/AltpaymentWidget.d.ts +0 -0
  33. /package/dist/{react/lib → lib}/components/Widget/SideShiftLogo.d.ts +0 -0
  34. /package/dist/{react/lib → lib}/components/Widget/Widget.stories.d.ts +0 -0
  35. /package/dist/{react/lib → lib}/components/Widget/index.d.ts +0 -0
  36. /package/dist/{react/lib → lib}/components/index.d.ts +0 -0
  37. /package/dist/{react/lib → lib}/tests/util/currency.test.d.ts +0 -0
  38. /package/dist/{react/lib → lib}/tests/util/format.test.d.ts +0 -0
  39. /package/dist/{react/lib → lib}/tests/util/number.test.d.ts +0 -0
  40. /package/dist/{react/lib → lib}/tests/util/opReturn.test.d.ts +0 -0
  41. /package/dist/{react/lib → lib}/tests/util/validate.test.d.ts +0 -0
  42. /package/dist/{react/lib → lib}/themes/Theme.d.ts +0 -0
  43. /package/dist/{react/lib → lib}/themes/index.d.ts +0 -0
  44. /package/dist/{react/lib → lib}/themes/themes/orange.d.ts +0 -0
  45. /package/dist/{react/lib → lib}/themes/themes/paybutton.d.ts +0 -0
  46. /package/dist/{react/lib → lib}/themes/themes/xec.d.ts +0 -0
  47. /package/dist/{react/lib → lib}/util/api-client.d.ts +0 -0
  48. /package/dist/{react/lib → lib}/util/currency.d.ts +0 -0
  49. /package/dist/{react/lib → lib}/util/format.d.ts +0 -0
  50. /package/dist/{react/lib → lib}/util/index.d.ts +0 -0
  51. /package/dist/{react/lib → lib}/util/number.d.ts +0 -0
  52. /package/dist/{react/lib → lib}/util/opReturn.d.ts +0 -0
  53. /package/dist/{react/lib → lib}/util/randomizeSats.d.ts +0 -0
  54. /package/dist/{react/lib → lib}/util/satoshis.d.ts +0 -0
  55. /package/dist/{react/src → src}/App.d.ts +0 -0
  56. /package/dist/{react/src → src}/main.d.ts +0 -0
@@ -1,5 +1,6 @@
1
1
  import { SideshiftCoin, SideshiftError, SideshiftPair, SideshiftQuote, SideshiftShift } from "./sideshift";
2
2
  export declare const MINIMUM_ALTPAYMENT_DOLLAR_AMOUNT = 10;
3
+ export declare const MINIMUM_ALTPAYMENT_CAD_AMOUNT = 15;
3
4
  export declare const SOCKET_MESSAGES: {
4
5
  GET_ALTPAYMENT_RATE: string;
5
6
  SEND_ALTPAYMENT_RATE: string;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Theme, ThemeName } from '../../themes';
3
+ import { ButtonSize } from '../../util';
3
4
  export declare type animation = 'slide' | 'invert' | 'none' | undefined;
4
5
  export interface ButtonProps {
5
6
  animation?: animation;
@@ -8,6 +9,8 @@ export interface ButtonProps {
8
9
  theme?: ThemeName | Theme;
9
10
  disabled?: boolean;
10
11
  onClick?: () => void;
12
+ size?: ButtonSize;
13
+ sizeScaleAlreadyApplied?: boolean;
11
14
  }
12
15
  export declare const Button: {
13
16
  (props: ButtonProps): React.ReactElement;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Theme, ThemeName } from '../../themes';
3
3
  import { ButtonProps } from '../Button/Button';
4
- import { Transaction, Currency } from '../../util';
4
+ import { Transaction, Currency, ButtonSize } from '../../util';
5
5
  export interface PayButtonProps extends ButtonProps {
6
6
  to: string;
7
7
  amount?: number | string;
@@ -24,8 +24,13 @@ export interface PayButtonProps extends ButtonProps {
24
24
  onClose?: (success?: boolean, paymentId?: string) => void;
25
25
  wsBaseUrl?: string;
26
26
  apiBaseUrl?: string;
27
+ transactionText?: string;
28
+ disableSound?: boolean;
29
+ autoClose?: boolean;
27
30
  disableAltpayment?: boolean;
28
31
  contributionOffset?: number;
32
+ size: ButtonSize;
33
+ sizeScaleAlreadyApplied: boolean;
29
34
  }
30
35
  export declare const PayButton: {
31
36
  (props: PayButtonProps): React.ReactElement;
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import { Theme, ThemeName } from '../../themes';
3
3
  import { ButtonProps } from '../Button/Button';
4
4
  import { Currency, CurrencyObject, Transaction } from '../../util';
5
+ import { Socket } from 'socket.io-client';
6
+ import { AltpaymentCoin, AltpaymentPair, AltpaymentShift, AltpaymentError } from '../../altpayment';
5
7
  export interface PaymentDialogProps extends ButtonProps {
6
8
  to: string;
7
9
  amount?: number | string;
@@ -23,6 +25,7 @@ export interface PaymentDialogProps extends ButtonProps {
23
25
  disableEnforceFocus?: boolean;
24
26
  editable?: boolean;
25
27
  dialogOpen: boolean;
28
+ setDialogOpen: Function;
26
29
  disableScrollLock?: boolean;
27
30
  active?: boolean;
28
31
  container?: HTMLElement;
@@ -33,6 +36,31 @@ export interface PaymentDialogProps extends ButtonProps {
33
36
  apiBaseUrl?: string;
34
37
  disableAltpayment?: boolean;
35
38
  contributionOffset?: number;
39
+ useAltpayment: boolean;
40
+ setUseAltpayment: Function;
41
+ txsSocket?: Socket;
42
+ setTxsSocket: Function;
43
+ altpaymentSocket?: Socket;
44
+ setAltpaymentSocket: Function;
45
+ setCoins: Function;
46
+ coins: AltpaymentCoin[];
47
+ setCoinPair: Function;
48
+ coinPair?: AltpaymentPair;
49
+ setLoadingPair: Function;
50
+ loadingPair: boolean;
51
+ setAltpaymentShift: Function;
52
+ altpaymentShift?: AltpaymentShift;
53
+ setLoadingShift: Function;
54
+ loadingShift: boolean;
55
+ setAltpaymentError: Function;
56
+ altpaymentError?: AltpaymentError;
57
+ addressType: Currency;
58
+ setAddressType: Function;
59
+ setNewTxs: Function;
60
+ newTxs?: Transaction[];
61
+ autoClose?: boolean;
62
+ disableSound?: boolean;
63
+ transactionText?: string;
36
64
  }
37
65
  export declare const PaymentDialog: {
38
66
  (props: PaymentDialogProps): React.ReactElement;
@@ -45,6 +73,7 @@ export declare const PaymentDialog: {
45
73
  disabled: boolean;
46
74
  editable: boolean;
47
75
  dialogOpen: boolean;
76
+ autoClose: boolean;
48
77
  };
49
78
  };
50
79
  export default PaymentDialog;
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  disabled: boolean;
14
14
  editable: boolean;
15
15
  dialogOpen: boolean;
16
+ autoClose: boolean;
16
17
  };
17
18
  };
18
19
  decorators: ((Story: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>) => JSX.Element)[];
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
+ import { Socket } from 'socket.io-client';
2
3
  import { Theme, ThemeName } from '../../themes';
3
4
  import { animation } from '../Button/Button';
4
5
  import { Currency, Transaction, CurrencyObject } from '../../util';
5
- import { AltpaymentShift } from '../../altpayment';
6
+ import { AltpaymentPair, AltpaymentShift, AltpaymentError, AltpaymentCoin } from '../../altpayment';
6
7
  export interface WidgetProps {
7
8
  to: string;
9
+ isChild?: boolean;
8
10
  amount?: number | null | string;
9
11
  setAmount?: Function;
10
12
  opReturn?: string;
@@ -32,14 +34,32 @@ export interface WidgetProps {
32
34
  apiBaseUrl?: string;
33
35
  loading?: boolean;
34
36
  hoverText?: string;
35
- setAltpaymentShift: Function;
36
- altpaymentShift?: AltpaymentShift | undefined;
37
- useAltpayment: boolean;
38
- setUseAltpayment: Function;
39
- shiftCompleted: boolean;
40
- setShiftCompleted: Function;
41
37
  disableAltpayment?: boolean;
42
38
  contributionOffset?: number;
39
+ setAltpaymentShift?: Function;
40
+ altpaymentShift?: AltpaymentShift | undefined;
41
+ useAltpayment?: boolean;
42
+ setUseAltpayment?: Function;
43
+ txsSocket?: Socket;
44
+ setTxsSocket?: Function;
45
+ altpaymentSocket?: Socket;
46
+ setAltpaymentSocket?: Function;
47
+ shiftCompleted?: boolean;
48
+ setShiftCompleted?: Function;
49
+ setCoins?: Function;
50
+ coins?: AltpaymentCoin[];
51
+ setCoinPair?: Function;
52
+ coinPair?: AltpaymentPair;
53
+ setLoadingPair?: Function;
54
+ loadingPair?: boolean;
55
+ setLoadingShift?: Function;
56
+ loadingShift?: boolean;
57
+ setAltpaymentError?: Function;
58
+ altpaymentError?: AltpaymentError;
59
+ addressType?: Currency;
60
+ setAddressType?: Function;
61
+ newTxText?: string;
62
+ transactionText?: string;
43
63
  }
44
64
  export declare const Widget: React.FunctionComponent<WidgetProps>;
45
65
  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' | 'setNewTxs' | 'setCurrencyObject' | 'setAltpaymentShift' | 'useAltpayment' | 'setUseAltpayment' | 'shiftCompleted' | 'setShiftCompleted'> {
4
+ export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'setCurrencyObject' | 'shiftCompleted' | 'setShiftCompleted'> {
5
5
  active?: boolean;
6
6
  amount?: number;
7
7
  opReturn?: string;
@@ -25,6 +25,9 @@ export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'set
25
25
  successText?: string;
26
26
  disableAltpayment?: boolean;
27
27
  contributionOffset?: number;
28
+ setNewTxs: Function;
29
+ disableSound?: boolean;
30
+ transactionText?: string;
28
31
  }
29
32
  export interface Output {
30
33
  index: number;
@@ -8,3 +8,6 @@ declare const _default: {
8
8
  getCurrencyTypeFromAddress: (address: string) => string;
9
9
  };
10
10
  export default _default;
11
+ declare type NetworkSlugsType = 'ecash' | 'bitcoincash';
12
+ export declare const getAddressPrefix: (addressString: string) => NetworkSlugsType;
13
+ export declare const getAddressPrefixed: (addressString: string) => string;
@@ -4,3 +4,4 @@ export declare const DECIMALS: {
4
4
  [key: string]: number;
5
5
  };
6
6
  export declare const CURRENCY_PREFIXES_MAP: Record<typeof CRYPTO_CURRENCIES[number], string>;
7
+ export declare type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | "extrasmall" | "small" | "medium" | "large" | "extralarge" | undefined;
@@ -0,0 +1,38 @@
1
+ import { Socket } from 'socket.io-client';
2
+ import { CheckSuccessInfo } from './types';
3
+ interface AltpaymentListenerParams {
4
+ addressType: string;
5
+ altpaymentSocket: Socket;
6
+ setCoins: Function;
7
+ setCoinPair: Function;
8
+ setLoadingPair: Function;
9
+ setAltpaymentShift: Function;
10
+ setLoadingShift: Function;
11
+ setAltpaymentError: Function;
12
+ }
13
+ export declare const altpaymentListener: (params: AltpaymentListenerParams) => void;
14
+ interface SetupAltpaymentSocketParams {
15
+ addressType: string;
16
+ altpaymentSocket?: Socket;
17
+ wsBaseUrl?: string;
18
+ setAltpaymentSocket: Function;
19
+ setCoins: Function;
20
+ setCoinPair: Function;
21
+ setLoadingPair: Function;
22
+ setAltpaymentShift: Function;
23
+ setLoadingShift: Function;
24
+ setAltpaymentError: Function;
25
+ }
26
+ export declare const setupAltpaymentSocket: (params: SetupAltpaymentSocketParams) => Promise<void>;
27
+ interface SetupTxsSocketParams {
28
+ address: string;
29
+ txsSocket?: Socket;
30
+ apiBaseUrl?: string;
31
+ wsBaseUrl?: string;
32
+ setTxsSocket: Function;
33
+ setNewTxs: Function;
34
+ setDialogOpen?: Function;
35
+ checkSuccessInfo?: CheckSuccessInfo;
36
+ }
37
+ export declare const setupTxsSocket: (params: SetupTxsSocketParams) => Promise<void>;
38
+ export {};
@@ -1,3 +1,4 @@
1
+ import BigNumber from "bignumber.js";
1
2
  import { CRYPTO_CURRENCIES, FIAT_CURRENCIES } from "./constants";
2
3
  export declare type CurrencyObject = {
3
4
  float: number;
@@ -132,4 +133,14 @@ export interface BroadcastTxData {
132
133
  txs: Transaction[];
133
134
  messageType: TxBroadcast;
134
135
  }
136
+ export interface CheckSuccessInfo {
137
+ currency: Currency;
138
+ price: number;
139
+ randomSatoshis: number | boolean;
140
+ disablePaymentId?: boolean;
141
+ expectedPaymentId?: string;
142
+ expectedAmount?: BigNumber | number;
143
+ expectedOpReturn?: string;
144
+ currencyObj?: CurrencyObject;
145
+ }
135
146
  export {};
@@ -0,0 +1,3 @@
1
+ import BigNumber from "bignumber.js";
2
+ import { CurrencyObject, Transaction } from "./types";
3
+ export declare const shouldTriggerOnSuccess: (transaction: Transaction, currency: string, price: number, randomSatoshis: number | boolean, disablePaymentId?: boolean | undefined, expectedPaymentId?: string | undefined, expectedAmount?: number | BigNumber | undefined, expectedOpReturn?: string | undefined, currencyObject?: CurrencyObject | undefined) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paybutton/react",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "The easiest way to accept eCash online",
5
5
  "author": "Blockchain Ventures Corp.",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "@storybook/addon-essentials": "6.5.9",
40
40
  "@storybook/addon-links": "6.5.9",
41
41
  "@storybook/node-logger": "6.5.9",
42
- "@storybook/preset-create-react-app": "3.2.0",
42
+ "@storybook/preset-create-react-app": "8.6.12",
43
43
  "@storybook/react": "6.5.9",
44
44
  "@types/currency-formatter": "1.5.1",
45
45
  "@types/lodash": "4.14.182",
@@ -71,7 +71,7 @@
71
71
  "microbundle": "0.12.4",
72
72
  "prettier": "2.7.1",
73
73
  "react-is": "16.13.1",
74
- "react-scripts": "3.4.4",
74
+ "react-scripts": "5.0.1",
75
75
  "typescript": "^4.8.2",
76
76
  "yarn-run-all": "^3.1.1"
77
77
  },
@@ -1,14 +0,0 @@
1
- import { Socket } from 'socket.io-client';
2
- export declare const txsListener: (socket: Socket, setNewTxs: Function) => void;
3
- interface AltpaymentListenerParams {
4
- addressType: string;
5
- socket: Socket;
6
- setCoins: Function;
7
- setCoinPair: Function;
8
- setLoadingPair: Function;
9
- setAltpaymentShift: Function;
10
- setLoadingShift: Function;
11
- setAltpaymentError: Function;
12
- }
13
- export declare const altpaymentListener: (params: AltpaymentListenerParams) => void;
14
- export {};
@@ -1,3 +0,0 @@
1
- import BigNumber from "bignumber.js";
2
- import { CurrencyObject, Transaction } from "./types";
3
- export declare const shouldTriggerOnSuccess: (transaction: Transaction, currency: string, price: number, disablePaymentId?: boolean | undefined, expectedPaymentId?: string | undefined, expectedAmount?: BigNumber | undefined, expectedOpReturn?: string | undefined, currencyObject?: CurrencyObject | undefined) => Promise<boolean>;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes