@paybutton/react 2.1.1 → 3.0.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 (66) hide show
  1. package/README.md +12 -1
  2. package/dist/index.d.ts +5 -13
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.modern.js +1 -1
  6. package/dist/index.modern.js.map +1 -1
  7. package/dist/{react/src → src}/components/BarChart/BarChart.stories.d.ts +1 -1
  8. package/dist/{components → src/components}/Button/Button.d.ts +2 -7
  9. package/dist/{components → src/components}/Button/Button.stories.d.ts +2 -7
  10. package/dist/{react/src → src}/components/PayButton/PayButton.d.ts +9 -16
  11. package/dist/{react/src → src}/components/PayButton/PayButton.stories.d.ts +2 -10
  12. package/dist/{react/src → src}/components/PaymentDialog/PaymentDialog.d.ts +9 -5
  13. package/dist/{components → src/components}/PaymentDialog/PaymentDialog.stories.d.ts +1 -1
  14. package/dist/{react/src → src}/components/Widget/Widget.d.ts +5 -2
  15. package/dist/{react/src → src}/components/Widget/Widget.stories.d.ts +1 -1
  16. package/dist/{react/src → src}/components/Widget/WidgetContainer.d.ts +9 -5
  17. package/dist/src/tests/opReturn.test.d.ts +1 -0
  18. package/dist/{react/src → src}/util/api-client.d.ts +7 -31
  19. package/dist/src/util/opReturn.d.ts +23 -0
  20. package/dist/{react/src → src}/util/satoshis.d.ts +2 -2
  21. package/package.json +25 -16
  22. package/dist/components/BarChart/BarChart.stories.d.ts +0 -25
  23. package/dist/components/PayButton/PayButton.d.ts +0 -39
  24. package/dist/components/PayButton/PayButton.stories.d.ts +0 -58
  25. package/dist/components/PaymentDialog/PaymentDialog.d.ts +0 -44
  26. package/dist/components/Widget/Widget.d.ts +0 -31
  27. package/dist/components/Widget/Widget.stories.d.ts +0 -34
  28. package/dist/components/Widget/WidgetContainer.d.ts +0 -33
  29. package/dist/react/src/assets/edit-pencil.d.ts +0 -3
  30. package/dist/react/src/components/BarChart/BarChart.d.ts +0 -13
  31. package/dist/react/src/components/BarChart/index.d.ts +0 -1
  32. package/dist/react/src/components/Button/Button.d.ts +0 -21
  33. package/dist/react/src/components/Button/Button.stories.d.ts +0 -28
  34. package/dist/react/src/components/Button/index.d.ts +0 -1
  35. package/dist/react/src/components/PayButton/index.d.ts +0 -1
  36. package/dist/react/src/components/PaymentDialog/PaymentDialog.stories.d.ts +0 -49
  37. package/dist/react/src/components/PaymentDialog/index.d.ts +0 -1
  38. package/dist/react/src/components/Widget/index.d.ts +0 -1
  39. package/dist/react/src/components/index.d.ts +0 -8
  40. package/dist/react/src/index.d.ts +0 -31
  41. package/dist/themes/Theme.d.ts +0 -9
  42. package/dist/themes/index.d.ts +0 -13
  43. package/dist/themes/themes/orange.d.ts +0 -3
  44. package/dist/themes/themes/paybutton.d.ts +0 -3
  45. package/dist/themes/themes/xec.d.ts +0 -3
  46. package/dist/util/address.d.ts +0 -10
  47. package/dist/util/api-client.d.ts +0 -173
  48. package/dist/util/format.d.ts +0 -19
  49. package/dist/util/randomizeSats.d.ts +0 -4
  50. package/dist/util/satoshis.d.ts +0 -11
  51. /package/dist/{assets → src/assets}/edit-pencil.d.ts +0 -0
  52. /package/dist/{components → src/components}/BarChart/BarChart.d.ts +0 -0
  53. /package/dist/{components → src/components}/BarChart/index.d.ts +0 -0
  54. /package/dist/{components → src/components}/Button/index.d.ts +0 -0
  55. /package/dist/{components → src/components}/PayButton/index.d.ts +0 -0
  56. /package/dist/{components → src/components}/PaymentDialog/index.d.ts +0 -0
  57. /package/dist/{components → src/components}/Widget/index.d.ts +0 -0
  58. /package/dist/{components → src/components}/index.d.ts +0 -0
  59. /package/dist/{react/src → src}/themes/Theme.d.ts +0 -0
  60. /package/dist/{react/src → src}/themes/index.d.ts +0 -0
  61. /package/dist/{react/src → src}/themes/themes/orange.d.ts +0 -0
  62. /package/dist/{react/src → src}/themes/themes/paybutton.d.ts +0 -0
  63. /package/dist/{react/src → src}/themes/themes/xec.d.ts +0 -0
  64. /package/dist/{react/src → src}/util/address.d.ts +0 -0
  65. /package/dist/{react/src → src}/util/format.d.ts +0 -0
  66. /package/dist/{react/src → src}/util/randomizeSats.d.ts +0 -0
@@ -3,7 +3,7 @@ import { BarChartProps } from './BarChart';
3
3
  declare const _default: {
4
4
  title: string;
5
5
  component: {
6
- (props: BarChartProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
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
7
  defaultProps: {
8
8
  value: number;
9
9
  color: string;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Theme, ThemeName } from '../../themes';
3
- export declare type animation = 'slide' | 'invert' | 'none';
3
+ export declare type animation = 'slide' | 'invert' | 'none' | undefined;
4
4
  export interface ButtonProps {
5
5
  animation?: animation;
6
6
  text?: string;
@@ -11,11 +11,6 @@ export interface ButtonProps {
11
11
  }
12
12
  export declare const Button: {
13
13
  (props: ButtonProps): React.ReactElement;
14
- defaultProps: {
15
- animation: string;
16
- text: string;
17
- hoverText: string;
18
- disabled: boolean;
19
- };
14
+ defaultProps: ButtonProps;
20
15
  };
21
16
  export default Button;
@@ -3,13 +3,8 @@ import { ButtonProps } from './Button';
3
3
  declare const _default: {
4
4
  title: string;
5
5
  component: {
6
- (props: ButtonProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
7
- defaultProps: {
8
- animation: string;
9
- text: string;
10
- hoverText: string;
11
- disabled: boolean;
12
- };
6
+ (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
+ defaultProps: ButtonProps;
13
8
  };
14
9
  decorators: ((Story: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>) => React.ReactNode)[];
15
10
  argTypes: {
@@ -1,39 +1,32 @@
1
1
  import React from 'react';
2
2
  import { Theme, ThemeName } from '../../themes';
3
3
  import { ButtonProps } from '../Button/Button';
4
- import { currency } from '../../util/api-client';
5
- import BigNumber from 'bignumber.js';
4
+ import { Transaction, currency } from '../../util/api-client';
6
5
  export interface PayButtonProps extends ButtonProps {
7
6
  to: string;
8
7
  amount?: number | string;
8
+ opReturn?: string;
9
+ disablePaymentId?: boolean;
9
10
  currency?: currency;
10
11
  theme?: ThemeName | Theme;
11
12
  text?: string;
12
13
  hoverText?: string;
13
14
  successText?: string;
14
- randomSatoshis?: boolean | number;
15
+ randomSatoshis?: boolean | number | undefined;
15
16
  hideToasts?: boolean;
16
17
  disabled?: boolean;
17
18
  goalAmount?: number | string;
18
19
  disableEnforceFocus?: boolean;
19
20
  editable?: boolean;
20
- onSuccess?: (txid: string, amount: BigNumber) => void;
21
- onTransaction?: (txid: string, amount: BigNumber) => void;
22
- onOpen?: (expectedAmount?: number | string, address?: string) => void;
23
- onClose?: (success?: boolean) => void;
21
+ onSuccess?: (transaction: Transaction) => void;
22
+ onTransaction?: (transaction: Transaction) => void;
23
+ onOpen?: (amount?: number | string, to?: string, paymentId?: string) => void;
24
+ onClose?: (success?: boolean, paymentId?: string) => void;
24
25
  wsBaseUrl?: string;
25
26
  apiBaseUrl?: string;
26
27
  }
27
28
  export declare const PayButton: {
28
29
  (props: PayButtonProps): React.ReactElement;
29
- defaultProps: {
30
- animation: string;
31
- hideToasts: boolean;
32
- randomSatoshis: boolean;
33
- successText: string;
34
- disableEnforceFocus: boolean;
35
- disabled: boolean;
36
- editable: boolean;
37
- };
30
+ defaultProps: PayButtonProps;
38
31
  };
39
32
  export default PayButton;
@@ -3,16 +3,8 @@ import { PayButtonProps } from './PayButton';
3
3
  declare const _default: {
4
4
  title: string;
5
5
  component: {
6
- (props: PayButtonProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<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
- };
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;
16
8
  };
17
9
  decorators: ((Story: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>) => JSX.Element)[];
18
10
  argTypes: {
@@ -1,15 +1,19 @@
1
1
  import React from 'react';
2
2
  import { Theme, ThemeName } from '../../themes';
3
3
  import { ButtonProps } from '../Button/Button';
4
- import { currency } from '../../util/api-client';
5
- import BigNumber from 'bignumber.js';
4
+ import { Transaction, currency } from '../../util/api-client';
6
5
  import { currencyObject } from '../../util/satoshis';
7
6
  export interface PaymentDialogProps extends ButtonProps {
8
7
  to: string;
9
8
  amount?: number | string;
10
9
  setAmount: Function;
10
+ opReturn?: string;
11
+ paymentId?: string;
12
+ disablePaymentId?: boolean;
11
13
  currency?: currency;
12
14
  currencyObj?: currencyObject;
15
+ cryptoAmount?: string;
16
+ price?: number;
13
17
  setCurrencyObj: Function;
14
18
  theme?: ThemeName | Theme;
15
19
  successText?: string;
@@ -22,9 +26,9 @@ export interface PaymentDialogProps extends ButtonProps {
22
26
  disableScrollLock?: boolean;
23
27
  active?: boolean;
24
28
  container?: HTMLElement;
25
- onClose?: (success?: boolean) => void;
26
- onSuccess?: (txid: string, amount: BigNumber) => void;
27
- onTransaction?: (txid: string, amount: BigNumber) => void;
29
+ onClose?: (success?: boolean, paymentId?: string) => void;
30
+ onSuccess?: (transaction: Transaction) => void;
31
+ onTransaction?: (transaction: Transaction) => void;
28
32
  wsBaseUrl?: string;
29
33
  apiBaseUrl?: string;
30
34
  }
@@ -3,7 +3,7 @@ import { PaymentDialogProps } from './PaymentDialog';
3
3
  declare const _default: {
4
4
  title: string;
5
5
  component: {
6
- (props: PaymentDialogProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
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
7
  defaultProps: {
8
8
  animation: string;
9
9
  hideToasts: boolean;
@@ -7,6 +7,9 @@ export interface WidgetProps {
7
7
  to: string;
8
8
  amount?: number | null | string;
9
9
  setAmount?: Function;
10
+ opReturn?: string;
11
+ paymentId?: string;
12
+ disablePaymentId?: boolean;
10
13
  text?: string;
11
14
  ButtonComponent?: React.ComponentType;
12
15
  success: boolean;
@@ -20,12 +23,12 @@ export interface WidgetProps {
20
23
  currencyObject?: currencyObject | undefined;
21
24
  setCurrencyObject?: Function;
22
25
  randomSatoshis?: boolean | number;
23
- price?: number;
26
+ price?: number | undefined;
24
27
  editable?: boolean;
25
28
  setNewTxs: Function;
26
29
  newTxs?: Transaction[];
27
30
  wsBaseUrl?: string;
28
31
  apiBaseUrl?: string;
29
32
  }
30
- export declare const Widget: React.FC<WidgetProps>;
33
+ export declare const Widget: React.FunctionComponent<WidgetProps>;
31
34
  export default Widget;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { WidgetProps } from './Widget';
3
3
  declare const _default: {
4
4
  title: string;
5
- component: React.FC<WidgetProps>;
5
+ component: React.FunctionComponent<WidgetProps>;
6
6
  decorators: ((Story: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>) => React.ReactNode)[];
7
7
  argTypes: {
8
8
  success: {
@@ -1,18 +1,22 @@
1
1
  import React from 'react';
2
- import { currency } from '../../util/api-client';
2
+ import { Transaction, currency } from '../../util/api-client';
3
3
  import { currencyObject } from '../../util/satoshis';
4
4
  import { WidgetProps } from './Widget';
5
- import BigNumber from 'bignumber.js';
6
5
  export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'setNewTxs' | 'setCurrencyObject'> {
7
6
  active?: boolean;
8
7
  amount?: number;
8
+ opReturn?: string;
9
+ paymentId?: string;
10
+ disablePaymentId?: boolean;
9
11
  currency?: currency;
10
12
  currencyObj?: currencyObject;
13
+ cryptoAmount?: string;
14
+ price?: number;
11
15
  setCurrencyObj: Function;
12
16
  randomSatoshis?: boolean | number;
13
17
  hideToasts?: boolean;
14
- onSuccess?: (txid: string, amount: BigNumber) => void;
15
- onTransaction?: (txid: string, amount: BigNumber) => void;
18
+ onSuccess?: (transaction: Transaction) => void;
19
+ onTransaction?: (transaction: Transaction) => void;
16
20
  sound?: boolean;
17
21
  goalAmount?: number | string;
18
22
  disabled: boolean;
@@ -29,5 +33,5 @@ export interface Output {
29
33
  scriptClass: string;
30
34
  disassembledScript: string;
31
35
  }
32
- export declare const WidgetContainer: React.FC<WidgetContainerProps>;
36
+ export declare const WidgetContainer: React.FunctionComponent<WidgetContainerProps>;
33
37
  export default WidgetContainer;
@@ -0,0 +1 @@
1
+ export {};
@@ -7,18 +7,18 @@ export interface BroadcastTxData {
7
7
  messageType: TxBroadcast;
8
8
  }
9
9
  export declare const setListener: (socket: Socket, setNewTxs: Function) => void;
10
- export declare const getAddressBalance: (address: string, rootUrl?: string) => Promise<number>;
10
+ export declare const getAddressBalance: (address: string, rootUrl?: string) => Promise<number | undefined>;
11
11
  export declare const getUTXOs: (address: string, rootUrl?: string) => Promise<UtxoDetails>;
12
12
  export declare const getBchFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
13
13
  export declare const getXecFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
14
- export declare const getFiatPrice: (fiat: fiatCurrency, crypto: cryptoCurrency, rootUrl?: string) => Promise<PriceData>;
14
+ export declare const getFiatPrice: (currency: string, to: string, apiBaseUrl?: string | undefined) => Promise<number | null>;
15
15
  export declare const getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
16
16
  declare const _default: {
17
17
  getAddressDetails: (address: string, rootUrl?: string) => Promise<Transaction[]>;
18
18
  getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
19
19
  getBchFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
20
20
  getXecFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
21
- getAddressBalance: (address: string, rootUrl?: string) => Promise<number>;
21
+ getAddressBalance: (address: string, rootUrl?: string) => Promise<number | undefined>;
22
22
  };
23
23
  export default _default;
24
24
  export declare const fiatCurrencies: readonly ["USD", "CAD", "EUR", "GBP", "AUD"];
@@ -33,37 +33,13 @@ export declare function isCrypto(unknownString: string): unknownString is crypto
33
33
  export declare function isValidCurrency(unknownString: string): unknownString is cryptoCurrency;
34
34
  export declare const getCashtabProviderStatus: () => boolean;
35
35
  export interface Transaction {
36
- id: string;
37
36
  hash: string;
38
37
  amount: string;
39
- confirmed: boolean;
38
+ paymentId: string;
39
+ confirmed?: boolean;
40
+ message: string;
40
41
  timestamp: number;
41
- addressId: string;
42
- createdAt: string;
43
- updatedAt: string;
44
- address: {
45
- id: string;
46
- address: string;
47
- createdAt: string;
48
- updatedAt: string;
49
- networkId: number;
50
- lastSynced: string;
51
- };
52
- prices: [{
53
- priceId: number;
54
- transactionId: string;
55
- createdAt: string;
56
- updatedAt: string;
57
- price: {
58
- id: number;
59
- value: string;
60
- createdAt: string;
61
- updatedAt: string;
62
- timestamp: number;
63
- networkId: 1;
64
- quoteId: 1;
65
- };
66
- }];
42
+ address: string;
67
43
  }
68
44
  export interface UtxoDetails {
69
45
  outputsList: [Output];
@@ -0,0 +1,23 @@
1
+ export declare const OP_RETURN_PREFIX_PUSHDATA = "04";
2
+ export declare const OP_RETURN_PREFIX = "50415900";
3
+ export declare const VERSION = "00";
4
+ export declare const USER_DATA_BYTES_LIMIT = 213;
5
+ declare function prependPaymentIdWithPushdata(hexString: string): string;
6
+ declare function stringToHex(str: string): string;
7
+ export declare function generatePaymentId(bytesAmount: number): string;
8
+ declare function generatePushdataPrefixedPaymentId(bytesAmount: number, disabled?: boolean): string;
9
+ declare function getDataPushdata(data: string, disablePaymentId?: boolean): string;
10
+ export interface EncodeOpReturnParams {
11
+ opReturn?: string;
12
+ disablePaymentId: boolean;
13
+ paymentId?: string;
14
+ }
15
+ export declare function encodeOpReturnProps({ opReturn, disablePaymentId, paymentId }: EncodeOpReturnParams): string;
16
+ export declare const exportedForTesting: {
17
+ prependPaymentIdWithPushdata: typeof prependPaymentIdWithPushdata;
18
+ generatePaymentId: typeof generatePaymentId;
19
+ generatePushdataPrefixedPaymentId: typeof generatePushdataPrefixedPaymentId;
20
+ stringToHex: typeof stringToHex;
21
+ getDataPushdata: typeof getDataPushdata;
22
+ };
23
+ export {};
@@ -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, randomSatoshis: boolean | number) => currencyObject;
7
+ export declare const getCurrencyObject: (amount: number, currencyType: currency, randomSatoshis: boolean | number | undefined) => currencyObject;
8
8
  declare const _default: {
9
- getCurrencyObject: (amount: number, currencyType: currency, randomSatoshis: number | boolean) => currencyObject;
9
+ getCurrencyObject: (amount: number, currencyType: currency, randomSatoshis: number | boolean | undefined) => 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.1.1",
3
+ "version": "3.0.0",
4
4
  "description": "The easiest way to accept eCash online",
5
5
  "author": "poldridge",
6
6
  "license": "MIT",
@@ -10,22 +10,22 @@
10
10
  },
11
11
  "main": "dist/index.js",
12
12
  "module": "dist/index.modern.js",
13
- "source": "src/index.tsx",
13
+ "source": "index.tsx",
14
14
  "engines": {
15
15
  "node": ">=10"
16
16
  },
17
17
  "scripts": {
18
18
  "build": "microbundle --jsx React.createElement --format modern,cjs",
19
- "postbuild": "cp -rf dist/react/src/* dist/ || true",
20
19
  "lint": "eslint 'src/**/*.{ts,tsx}' --fix",
21
20
  "prettier": "prettier --write 'src/**/*.ts'",
22
- "dev": "concurrently npm:watch npm:storybook",
21
+ "dev": "concurrently yarn:watch yarn:storybook",
23
22
  "storybook": "start-storybook -p 6006",
24
- "watch": "microbundle watch --jsx React.createElement --no-compress --format modern,cjs"
23
+ "watch": "microbundle watch --jsx React.createElement --no-compress --format modern,cjs",
24
+ "test": "jest"
25
25
  },
26
26
  "peerDependencies": {
27
- "react": "16.14.0",
28
- "react-dom": "16.14.0"
27
+ "react": "17.0.0",
28
+ "react-dom": "17.0.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@babel/core": "7.18.9",
@@ -39,10 +39,10 @@
39
39
  "@storybook/react": "6.5.9",
40
40
  "@types/currency-formatter": "1.5.1",
41
41
  "@types/lodash": "4.14.182",
42
- "@types/node": "12.20.55",
42
+ "@types/node": "17.0.41",
43
43
  "@types/qrcode.react": "1.0.2",
44
- "@types/react": "16.14.28",
45
- "@types/react-dom": "16.9.16",
44
+ "@types/react": "17.0.0",
45
+ "@types/react-dom": "17.0.0",
46
46
  "@typescript-eslint/eslint-plugin": "2.34.0",
47
47
  "@typescript-eslint/parser": "2.34.0",
48
48
  "babel-eslint": "10.1.0",
@@ -65,11 +65,11 @@
65
65
  "husky": "4.3.8",
66
66
  "lint-staged": "10.5.4",
67
67
  "microbundle": "0.12.4",
68
- "npm-run-all": "4.1.5",
69
68
  "prettier": "2.7.1",
70
69
  "react-is": "16.13.1",
71
70
  "react-scripts": "3.4.4",
72
- "typescript": "3.9.10"
71
+ "typescript": "^4.8.2",
72
+ "yarn-run-all": "^3.1.1"
73
73
  },
74
74
  "files": [
75
75
  "dist"
@@ -78,14 +78,19 @@
78
78
  "@material-ui/core": "4.12.4",
79
79
  "@material-ui/lab": "4.0.0-alpha.61",
80
80
  "@material-ui/styles": "4.11.5",
81
- "axios": "0.21.4",
81
+ "@types/crypto-js": "^4.2.1",
82
+ "@types/jest": "^29.5.11",
83
+ "axios": "1.6.5",
82
84
  "bignumber.js": "9.0.2",
83
- "copy-to-clipboard": "3.3.1",
85
+ "copy-to-clipboard": "3.3.3",
86
+ "crypto-js": "^4.2.0",
87
+ "jest": "^29.7.0",
84
88
  "lodash": "4.17.21",
85
89
  "notistack": "1.0.10",
86
90
  "qrcode.react": "1.0.1",
87
- "react-jss": "10.9.0",
88
- "socket.io-client": "^4.7.1",
91
+ "react-jss": "10.10.0",
92
+ "socket.io-client": "4.7.4",
93
+ "ts-jest": "^29.1.1",
89
94
  "xecaddrjs": "^0.0.1"
90
95
  },
91
96
  "husky": {
@@ -98,5 +103,9 @@
98
103
  "eslint --fix",
99
104
  "prettier --write"
100
105
  ]
106
+ },
107
+ "resolutions": {
108
+ "@types/react": "17.0.0",
109
+ "@types/react-dom": "17.0.0"
101
110
  }
102
111
  }
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { BarChartProps } from './BarChart';
3
- declare const _default: {
4
- title: string;
5
- component: {
6
- (props: BarChartProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
7
- defaultProps: {
8
- value: number;
9
- color: string;
10
- };
11
- };
12
- decorators: ((Story: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>) => React.ReactNode)[];
13
- argTypes: {
14
- onClick: {
15
- table: {
16
- disable: boolean;
17
- };
18
- };
19
- };
20
- parameters: {
21
- jest: string[];
22
- };
23
- };
24
- export default _default;
25
- export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, BarChartProps>;
@@ -1,39 +0,0 @@
1
- import React from 'react';
2
- import { Theme, ThemeName } from '../../themes';
3
- import { ButtonProps } from '../Button/Button';
4
- import { currency } from '../../util/api-client';
5
- import BigNumber from 'bignumber.js';
6
- export interface PayButtonProps extends ButtonProps {
7
- to: string;
8
- amount?: number | string;
9
- currency?: currency;
10
- theme?: ThemeName | Theme;
11
- text?: string;
12
- hoverText?: string;
13
- successText?: string;
14
- randomSatoshis?: boolean | number;
15
- hideToasts?: boolean;
16
- disabled?: boolean;
17
- goalAmount?: number | string;
18
- disableEnforceFocus?: boolean;
19
- editable?: boolean;
20
- onSuccess?: (txid: string, amount: BigNumber) => void;
21
- onTransaction?: (txid: string, amount: BigNumber) => void;
22
- onOpen?: (expectedAmount?: number | string, address?: string) => void;
23
- onClose?: (success?: boolean) => void;
24
- wsBaseUrl?: string;
25
- apiBaseUrl?: string;
26
- }
27
- export declare const PayButton: {
28
- (props: PayButtonProps): React.ReactElement;
29
- defaultProps: {
30
- animation: string;
31
- hideToasts: boolean;
32
- randomSatoshis: boolean;
33
- successText: string;
34
- disableEnforceFocus: boolean;
35
- disabled: boolean;
36
- editable: boolean;
37
- };
38
- };
39
- export default PayButton;
@@ -1,58 +0,0 @@
1
- import React from 'react';
2
- import { PayButtonProps } from './PayButton';
3
- declare const _default: {
4
- title: string;
5
- component: {
6
- (props: PayButtonProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<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
- };
16
- };
17
- decorators: ((Story: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>) => JSX.Element)[];
18
- argTypes: {
19
- onClick: {
20
- table: {
21
- disable: boolean;
22
- };
23
- };
24
- onSuccess: {
25
- table: {
26
- disable: boolean;
27
- };
28
- };
29
- onOpen: {
30
- table: {
31
- disable: boolean;
32
- };
33
- };
34
- onClose: {
35
- table: {
36
- disable: boolean;
37
- };
38
- };
39
- onTransaction: {
40
- table: {
41
- disable: boolean;
42
- };
43
- };
44
- };
45
- args: {
46
- to: string;
47
- };
48
- parameters: {
49
- jest: string[];
50
- };
51
- };
52
- export default _default;
53
- export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PayButtonProps>;
54
- export declare const OrangeTheme: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PayButtonProps>;
55
- export declare const UsdAmount: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PayButtonProps>;
56
- export declare const withGoal: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PayButtonProps>;
57
- export declare const withUSDGoalCurrency: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PayButtonProps>;
58
- export declare const withEURGoalCurrency: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PayButtonProps>;
@@ -1,44 +0,0 @@
1
- import React from 'react';
2
- import { Theme, ThemeName } from '../../themes';
3
- import { ButtonProps } from '../Button/Button';
4
- import { currency } from '../../util/api-client';
5
- import BigNumber from 'bignumber.js';
6
- import { currencyObject } from '../../util/satoshis';
7
- export interface PaymentDialogProps extends ButtonProps {
8
- to: string;
9
- amount?: number | string;
10
- setAmount: Function;
11
- currency?: currency;
12
- currencyObj?: currencyObject;
13
- setCurrencyObj: Function;
14
- theme?: ThemeName | Theme;
15
- successText?: string;
16
- randomSatoshis?: boolean | number;
17
- hideToasts?: boolean;
18
- goalAmount?: number | string;
19
- disableEnforceFocus?: boolean;
20
- editable?: boolean;
21
- dialogOpen: boolean;
22
- disableScrollLock?: boolean;
23
- active?: boolean;
24
- container?: HTMLElement;
25
- onClose?: (success?: boolean) => void;
26
- onSuccess?: (txid: string, amount: BigNumber) => void;
27
- onTransaction?: (txid: string, amount: BigNumber) => void;
28
- wsBaseUrl?: string;
29
- apiBaseUrl?: string;
30
- }
31
- export declare const PaymentDialog: {
32
- (props: PaymentDialogProps): React.ReactElement;
33
- defaultProps: {
34
- animation: string;
35
- hideToasts: boolean;
36
- randomSatoshis: boolean;
37
- successText: string;
38
- disableEnforceFocus: boolean;
39
- disabled: boolean;
40
- editable: boolean;
41
- dialogOpen: boolean;
42
- };
43
- };
44
- export default PaymentDialog;
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- import { Theme, ThemeName } from '../../themes';
3
- import { animation } from '../Button/Button';
4
- import { currencyObject } from '../../util/satoshis';
5
- import { currency, Transaction } from '../../util/api-client';
6
- export interface WidgetProps {
7
- to: string;
8
- amount?: number | null | string;
9
- setAmount?: Function;
10
- text?: string;
11
- ButtonComponent?: React.ComponentType;
12
- success: boolean;
13
- successText?: string;
14
- theme?: ThemeName | Theme;
15
- foot?: React.ReactNode;
16
- disabled: boolean;
17
- goalAmount?: number | string | null;
18
- currency?: currency;
19
- animation?: animation;
20
- currencyObject?: currencyObject | undefined;
21
- setCurrencyObject?: Function;
22
- randomSatoshis?: boolean | number;
23
- price?: number;
24
- editable?: boolean;
25
- setNewTxs: Function;
26
- newTxs?: Transaction[];
27
- wsBaseUrl?: string;
28
- apiBaseUrl?: string;
29
- }
30
- export declare const Widget: React.FC<WidgetProps>;
31
- export default Widget;