@paybutton/react 1.0.5 → 1.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 (52) hide show
  1. package/README.md +25 -25
  2. package/dist/assets/edit-pencil.d.ts +3 -0
  3. package/dist/components/BarChart/BarChart.d.ts +13 -0
  4. package/dist/components/BarChart/BarChart.stories.d.ts +26 -0
  5. package/dist/components/BarChart/index.d.ts +1 -0
  6. package/dist/components/Button/Button.d.ts +2 -0
  7. package/dist/components/Button/Button.stories.d.ts +2 -1
  8. package/dist/components/PayButton/PayButton.d.ts +9 -3
  9. package/dist/components/PayButton/PayButton.stories.d.ts +7 -1
  10. package/dist/components/PaymentDialog/PaymentDialog.d.ts +37 -0
  11. package/dist/components/PaymentDialog/PaymentDialog.stories.d.ts +50 -0
  12. package/dist/components/PaymentDialog/index.d.ts +1 -0
  13. package/dist/components/Widget/Widget.d.ts +13 -1
  14. package/dist/components/Widget/Widget.stories.d.ts +1 -0
  15. package/dist/components/Widget/WidgetContainer.d.ts +12 -1
  16. package/dist/components/index.d.ts +2 -0
  17. package/dist/index.d.ts +18 -1
  18. package/dist/index.js +1 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.modern.js +1 -1
  21. package/dist/index.modern.js.map +1 -1
  22. package/dist/util/address.d.ts +5 -0
  23. package/dist/util/api-client.d.ts +198 -49
  24. package/dist/util/format.d.ts +9 -0
  25. package/dist/util/satoshis.d.ts +12 -0
  26. package/package.json +99 -93
  27. package/dist/BCH~bmNlrEgs.svg +0 -7
  28. package/dist/components/PayButton/PayButton.test.d.ts +0 -1
  29. package/dist/components/UI/Button/Button.d.ts +0 -14
  30. package/dist/components/UI/Button/Button.stories.d.ts +0 -20
  31. package/dist/components/UI/Button/Button.test.d.ts +0 -1
  32. package/dist/components/UI/Button/index.d.ts +0 -1
  33. package/dist/components/UI/Widget/Widget.d.ts +0 -16
  34. package/dist/components/UI/Widget/Widget.stories.d.ts +0 -33
  35. package/dist/components/UI/Widget/Widget.test.d.ts +0 -1
  36. package/dist/components/UI/Widget/index.d.ts +0 -1
  37. package/dist/components/WidgetContainer/WidgetContainer.d.ts +0 -18
  38. package/dist/components/WidgetContainer/WidgetContainer.test.d.ts +0 -1
  39. package/dist/components/WidgetContainer/index.d.ts +0 -1
  40. package/dist/components/index.spec.d.ts +0 -0
  41. package/dist/components/index.test.d.ts +0 -1
  42. package/dist/hooks/useBalancePolling.d.ts +0 -20
  43. package/dist/hooks/useTheme.d.ts +0 -4
  44. package/dist/index.test.d.ts +0 -1
  45. package/dist/stories/Button.d.ts +0 -28
  46. package/dist/stories/Button.stories.d.ts +0 -8
  47. package/dist/stories/Header.d.ts +0 -9
  48. package/dist/stories/Header.stories.d.ts +0 -6
  49. package/dist/stories/Page.d.ts +0 -9
  50. package/dist/stories/Page.stories.d.ts +0 -6
  51. package/dist/util/copyToClipboard.d.ts +0 -2
  52. package/dist/util/satoshisToBCH.d.ts +0 -2
package/README.md CHANGED
@@ -1,25 +1,25 @@
1
- # @paybutton/react
2
-
3
- > The easiest way to accept Bitcoin Cash online
4
-
5
- [![NPM](https://img.shields.io/npm/v/@paybutton/react.svg)](https://www.npmjs.com/package/@paybutton/react)
6
-
7
- ## Install
8
-
9
- ```bash
10
- npm install --save @paybutton/react
11
- ```
12
-
13
- ## Usage
14
-
15
- ```tsx
16
- import React from 'react'
17
-
18
- import { PayButton } from '@paybutton/react'
19
-
20
- <PayButton to={address} />
21
- ```
22
-
23
- ## License
24
-
25
- MIT
1
+ # @paybutton/react
2
+
3
+ > The easiest way to accept Bitcoin Cash online
4
+
5
+ [![NPM](https://img.shields.io/npm/v/@paybutton/react.svg)](https://www.npmjs.com/package/@paybutton/react)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install --save @paybutton/react
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```tsx
16
+ import React from 'react'
17
+
18
+ import { PayButton } from '@paybutton/react'
19
+
20
+ <PayButton to={address} />
21
+ ```
22
+
23
+ ## License
24
+
25
+ MIT
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const PencilIcon: (props: any) => React.ReactElement;
3
+ export default PencilIcon;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export interface BarChartProps {
3
+ value: number;
4
+ color: string;
5
+ }
6
+ export declare const BarChart: {
7
+ (props: BarChartProps): React.ReactElement;
8
+ defaultProps: {
9
+ value: number;
10
+ color: string;
11
+ };
12
+ };
13
+ export default BarChart;
@@ -0,0 +1,26 @@
1
+ import { Story } from '@storybook/react';
2
+ import React from 'react';
3
+ import { BarChartProps } from './BarChart';
4
+ declare const _default: {
5
+ title: string;
6
+ component: {
7
+ (props: BarChartProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
8
+ defaultProps: {
9
+ value: number;
10
+ color: string;
11
+ };
12
+ };
13
+ decorators: ((Story: Story<import("@storybook/react").Args>) => React.ReactNode)[];
14
+ argTypes: {
15
+ onClick: {
16
+ table: {
17
+ disable: boolean;
18
+ };
19
+ };
20
+ };
21
+ parameters: {
22
+ jest: string[];
23
+ };
24
+ };
25
+ export default _default;
26
+ export declare const Default: Story<BarChartProps>;
@@ -0,0 +1 @@
1
+ export * from './BarChart';
@@ -6,6 +6,7 @@ export interface ButtonProps {
6
6
  text?: string;
7
7
  hoverText?: string;
8
8
  theme?: ThemeName | Theme;
9
+ disabled?: boolean;
9
10
  onClick?: () => void;
10
11
  }
11
12
  export declare const Button: {
@@ -14,6 +15,7 @@ export declare const Button: {
14
15
  animation: string;
15
16
  text: string;
16
17
  hoverText: string;
18
+ disabled: boolean;
17
19
  };
18
20
  };
19
21
  export default Button;
@@ -4,11 +4,12 @@ import { ButtonProps } from './Button';
4
4
  declare const _default: {
5
5
  title: string;
6
6
  component: {
7
- (props: ButtonProps): 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
+ (props: ButtonProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
8
8
  defaultProps: {
9
9
  animation: string;
10
10
  text: string;
11
11
  hoverText: string;
12
+ disabled: boolean;
12
13
  };
13
14
  };
14
15
  decorators: ((Story: Story<import("@storybook/react").Args>) => React.ReactNode)[];
@@ -1,18 +1,21 @@
1
1
  import React from 'react';
2
2
  import { Theme, ThemeName } from '../../themes';
3
3
  import { ButtonProps } from '../Button/Button';
4
- import { cryptoCurrency, currency } from '../Widget/WidgetContainer';
4
+ import { currency } from '../Widget/WidgetContainer';
5
5
  export interface PayButtonProps extends ButtonProps {
6
6
  to: string;
7
- amount?: number;
7
+ amount?: number | string;
8
8
  currency?: currency;
9
9
  theme?: ThemeName | Theme;
10
10
  text?: string;
11
11
  hoverText?: string;
12
12
  successText?: string;
13
- displayCurrency?: cryptoCurrency;
14
13
  randomSatoshis?: boolean;
15
14
  hideToasts?: boolean;
15
+ disabled?: boolean;
16
+ goalAmount?: number | string;
17
+ disableEnforceFocus?: boolean;
18
+ editable?: boolean;
16
19
  onSuccess?: (txid: string, amount: number) => void;
17
20
  onTransaction?: (txid: string, amount: number) => void;
18
21
  }
@@ -23,6 +26,9 @@ export declare const PayButton: {
23
26
  hideToasts: boolean;
24
27
  randomSatoshis: boolean;
25
28
  successText: string;
29
+ disableEnforceFocus: boolean;
30
+ disabled: boolean;
31
+ editable: boolean;
26
32
  };
27
33
  };
28
34
  export default PayButton;
@@ -4,12 +4,15 @@ import { PayButtonProps } from './PayButton';
4
4
  declare const _default: {
5
5
  title: string;
6
6
  component: {
7
- (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
+ (props: PayButtonProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
8
8
  defaultProps: {
9
9
  animation: string;
10
10
  hideToasts: boolean;
11
11
  randomSatoshis: boolean;
12
12
  successText: string;
13
+ disableEnforceFocus: boolean;
14
+ disabled: boolean;
15
+ editable: boolean;
13
16
  };
14
17
  };
15
18
  decorators: ((Story: Story<import("@storybook/react").Args>) => JSX.Element)[];
@@ -41,3 +44,6 @@ export default _default;
41
44
  export declare const Default: Story<PayButtonProps>;
42
45
  export declare const OrangeTheme: Story<PayButtonProps>;
43
46
  export declare const UsdAmount: Story<PayButtonProps>;
47
+ export declare const withGoal: Story<PayButtonProps>;
48
+ export declare const withUSDGoalCurrency: Story<PayButtonProps>;
49
+ export declare const withEURGoalCurrency: Story<PayButtonProps>;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { Theme, ThemeName } from '../../themes';
3
+ import { ButtonProps } from '../Button/Button';
4
+ import { currency } from '../Widget/WidgetContainer';
5
+ export interface PaymentDialogProps extends ButtonProps {
6
+ to: string;
7
+ amount?: number | string;
8
+ currency?: currency;
9
+ theme?: ThemeName | Theme;
10
+ successText?: string;
11
+ randomSatoshis?: boolean;
12
+ hideToasts?: boolean;
13
+ goalAmount?: number | string;
14
+ disableEnforceFocus?: boolean;
15
+ editable?: boolean;
16
+ dialogOpen: boolean;
17
+ disableScrollLock?: boolean;
18
+ active?: boolean;
19
+ container?: HTMLElement;
20
+ onClose?: () => void;
21
+ onSuccess?: (txid: string, amount: number) => void;
22
+ onTransaction?: (txid: string, amount: number) => void;
23
+ }
24
+ export declare const PaymentDialog: {
25
+ (props: PaymentDialogProps): React.ReactElement;
26
+ defaultProps: {
27
+ animation: string;
28
+ hideToasts: boolean;
29
+ randomSatoshis: boolean;
30
+ successText: string;
31
+ disableEnforceFocus: boolean;
32
+ disabled: boolean;
33
+ editable: boolean;
34
+ dialogOpen: boolean;
35
+ };
36
+ };
37
+ export default PaymentDialog;
@@ -0,0 +1,50 @@
1
+ import { Story } from '@storybook/react';
2
+ import React from 'react';
3
+ import { PaymentDialogProps } from './PaymentDialog';
4
+ declare const _default: {
5
+ title: string;
6
+ component: {
7
+ (props: PaymentDialogProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
8
+ defaultProps: {
9
+ animation: string;
10
+ hideToasts: boolean;
11
+ randomSatoshis: boolean;
12
+ successText: string;
13
+ disableEnforceFocus: boolean;
14
+ disabled: boolean;
15
+ editable: boolean;
16
+ dialogOpen: boolean;
17
+ };
18
+ };
19
+ decorators: ((Story: Story<import("@storybook/react").Args>) => JSX.Element)[];
20
+ argTypes: {
21
+ onClick: {
22
+ table: {
23
+ disable: boolean;
24
+ };
25
+ };
26
+ onSuccess: {
27
+ table: {
28
+ disable: boolean;
29
+ };
30
+ };
31
+ onTransaction: {
32
+ table: {
33
+ disable: boolean;
34
+ };
35
+ };
36
+ };
37
+ args: {
38
+ to: string;
39
+ };
40
+ parameters: {
41
+ jest: string[];
42
+ };
43
+ };
44
+ export default _default;
45
+ export declare const Default: Story<PaymentDialogProps>;
46
+ export declare const OrangeTheme: Story<PaymentDialogProps>;
47
+ export declare const UsdAmount: Story<PaymentDialogProps>;
48
+ export declare const withGoal: Story<PaymentDialogProps>;
49
+ export declare const withUSDGoalCurrency: Story<PaymentDialogProps>;
50
+ export declare const withEURGoalCurrency: Story<PaymentDialogProps>;
@@ -0,0 +1 @@
1
+ export * from './PaymentDialog';
@@ -1,8 +1,12 @@
1
1
  import React from 'react';
2
2
  import { Theme, ThemeName } from '../../themes';
3
+ import { currencyObject } from '../../util/satoshis';
4
+ import { fiatCurrency } from '../../util/api-client';
5
+ export declare type cryptoCurrency = 'BCH' | 'SAT' | 'bits';
6
+ export declare type currency = cryptoCurrency | fiatCurrency;
3
7
  export interface WidgetProps {
4
8
  to: string;
5
- amount?: number | null;
9
+ amount?: number | null | string;
6
10
  text?: string;
7
11
  ButtonComponent?: React.ComponentType;
8
12
  loading: boolean;
@@ -10,6 +14,14 @@ export interface WidgetProps {
10
14
  successText?: string;
11
15
  theme?: ThemeName | Theme;
12
16
  foot?: React.ReactNode;
17
+ disabled: boolean;
18
+ totalReceived?: number | null;
19
+ goalAmount?: number | string | null;
20
+ currency?: currency;
21
+ currencyObject?: currencyObject | undefined;
22
+ randomSatoshis?: boolean;
23
+ price?: number;
24
+ editable?: boolean;
13
25
  }
14
26
  export declare const Widget: React.FC<WidgetProps>;
15
27
  export default Widget;
@@ -32,3 +32,4 @@ export declare const Success: Story<WidgetProps>;
32
32
  export declare const Loading: Story<WidgetProps>;
33
33
  export declare const OrangeTheme: Story<WidgetProps>;
34
34
  export declare const CustomTheme: Story<WidgetProps>;
35
+ export declare const WithGoal: Story<WidgetProps>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { fiatCurrency } from '../../util/api-client';
3
3
  import { WidgetProps } from './Widget';
4
- export declare type cryptoCurrency = 'BCH' | 'SAT';
4
+ export declare type cryptoCurrency = 'BCH' | 'SAT' | 'bits';
5
5
  export declare type currency = cryptoCurrency | fiatCurrency;
6
6
  export interface WidgetContainerProps extends Omit<Omit<WidgetProps, 'loading'>, 'success'> {
7
7
  active?: boolean;
@@ -13,6 +13,17 @@ export interface WidgetContainerProps extends Omit<Omit<WidgetProps, 'loading'>,
13
13
  onSuccess?: (txid: string, amount: number) => void;
14
14
  onTransaction?: (txid: string, amount: number) => void;
15
15
  sound?: boolean;
16
+ goalAmount?: number | string;
17
+ disabled: boolean;
18
+ editable: boolean;
19
+ }
20
+ export interface Output {
21
+ index: number;
22
+ value: number;
23
+ pubkeyScript: string;
24
+ address: string;
25
+ scriptClass: string;
26
+ disassembledScript: string;
16
27
  }
17
28
  export declare const WidgetContainer: React.FC<WidgetContainerProps>;
18
29
  export default WidgetContainer;
@@ -2,5 +2,7 @@ export { Button } from './Button/Button';
2
2
  export type { ButtonProps } from './Button/Button';
3
3
  export { PayButton } from './PayButton/PayButton';
4
4
  export type { PayButtonProps } from './PayButton/PayButton';
5
+ export { PaymentDialog } from './PaymentDialog/PaymentDialog';
6
+ export type { PaymentDialogProps } from './PaymentDialog/PaymentDialog';
5
7
  export { WidgetContainer as Widget } from './Widget/WidgetContainer';
6
8
  export type { WidgetContainerProps as WidgetProps } from './Widget/WidgetContainer';
package/dist/index.d.ts CHANGED
@@ -1,14 +1,31 @@
1
1
  /// <reference types="react" />
2
2
  import * as Components from './components';
3
3
  export declare const PayButton: {
4
- (props: Components.PayButtonProps): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
4
+ (props: Components.PayButtonProps): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
5
5
  defaultProps: {
6
6
  animation: string;
7
7
  hideToasts: boolean;
8
8
  randomSatoshis: boolean;
9
9
  successText: string;
10
+ disableEnforceFocus: boolean;
11
+ disabled: boolean;
12
+ editable: boolean;
10
13
  };
11
14
  };
12
15
  export declare type PayButtonProps = Components.PayButtonProps;
16
+ export declare const PaymentDialog: {
17
+ (props: Components.PaymentDialogProps): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
18
+ defaultProps: {
19
+ animation: string;
20
+ hideToasts: boolean;
21
+ randomSatoshis: boolean;
22
+ successText: string;
23
+ disableEnforceFocus: boolean;
24
+ disabled: boolean;
25
+ editable: boolean;
26
+ dialogOpen: boolean;
27
+ };
28
+ };
29
+ export declare type PaymentDialogProps = Components.PaymentDialogProps;
13
30
  export declare const Widget: import("react").FC<Components.WidgetProps>;
14
31
  export declare type WidgetProps = Components.WidgetProps;