@huma-finance/widgets 0.0.8 → 0.0.10

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 (115) hide show
  1. package/.env.example +2 -2
  2. package/.eslintignore +2 -2
  3. package/.eslintrc.js +64 -64
  4. package/.prettierignore +4 -4
  5. package/.prettierrc.js +16 -16
  6. package/API.md +331 -331
  7. package/LICENSE +660 -660
  8. package/README.md +48 -48
  9. package/babel.config.js +15 -15
  10. package/config-overrides.js +9 -9
  11. package/cosmos.config.json +7 -7
  12. package/cypress/e2e/01-invoice-factoring-borrow.test.ts +62 -62
  13. package/cypress/support/e2e.ts +76 -76
  14. package/cypress/support/ethereum.ts +142 -142
  15. package/cypress/tsconfig.json +9 -9
  16. package/cypress/utils/index.ts +54 -54
  17. package/cypress.config.ts +20 -20
  18. package/jsdoc2md.json +20 -20
  19. package/package.json +4 -4
  20. package/public/index.html +40 -40
  21. package/public/manifest.json +25 -25
  22. package/public/robots.txt +3 -3
  23. package/rollup.config.js +81 -81
  24. package/src/components/ApolloWrapper.tsx +15 -15
  25. package/src/components/BottomButton.tsx +31 -31
  26. package/src/components/Factoring/index.ts +2 -2
  27. package/src/components/HumaLoading.tsx +68 -68
  28. package/src/components/HumaTable.tsx +158 -158
  29. package/src/components/InvoiceFactoring/borrow/3-ChooseAmount.tsx +13 -19
  30. package/src/components/InvoiceFactoring/borrow/4-ConfirmTransfer.tsx +3 -3
  31. package/src/components/InvoiceFactoring/borrow/7-Success.tsx +20 -20
  32. package/src/components/Lend/supply/4-ConfirmTransfer.tsx +3 -3
  33. package/src/components/LoadingModal.tsx +49 -49
  34. package/src/components/StreamFactoring/borrow/2-ChooseAmount.tsx +11 -11
  35. package/src/components/StreamFactoring/borrow/3-ConfirmTransfer.tsx +3 -3
  36. package/src/components/StreamFactoring/borrow/4-ApproveAllowance.tsx +2 -2
  37. package/src/components/StreamFactoring/borrow/7-Success.tsx +20 -20
  38. package/src/components/SuperfluidFactoring/SuperfluidUpcomingList.tsx +1 -1
  39. package/src/components/SuperfluidFactoring/index.tsx +1 -1
  40. package/src/components/WrapperModal.tsx +54 -54
  41. package/src/components/buttons/TableActionButton.tsx +36 -36
  42. package/src/components/buttons/index.ts +1 -1
  43. package/src/components/humaModal/HumaModalHeader.tsx +70 -70
  44. package/src/components/humaModal/index.tsx +2 -2
  45. package/src/components/icons/approve-lender.svg +30 -30
  46. package/src/components/icons/auto-payback.svg +40 -40
  47. package/src/components/icons/check-circle.svg +3 -3
  48. package/src/components/icons/check-green.svg +3 -3
  49. package/src/components/icons/check.svg +10 -10
  50. package/src/components/icons/donut.svg +904 -904
  51. package/src/components/icons/ellipse.svg +3 -3
  52. package/src/components/icons/huma-full.svg +22 -22
  53. package/src/components/icons/huma.svg +15 -15
  54. package/src/components/icons/index.tsx +93 -93
  55. package/src/components/icons/loader.svg +229 -229
  56. package/src/components/icons/metamask.svg +31 -31
  57. package/src/components/icons/polygon.svg +16 -16
  58. package/src/components/icons/receipt.svg +3 -3
  59. package/src/components/icons/separator.svg +3 -3
  60. package/src/components/icons/sorry.svg +31 -31
  61. package/src/components/icons/usdc.svg +5 -5
  62. package/src/components/icons/wallet-connect.svg +11 -11
  63. package/src/cosmos/CreditLineBorrow.fixture.tsx +85 -85
  64. package/src/cosmos/CreditLinePayment.fixture.tsx +49 -49
  65. package/src/cosmos/InvoiceFactoringBorrow.fixture.tsx +111 -111
  66. package/src/cosmos/InvoiceFactoringPayment.fixture.tsx +67 -67
  67. package/src/cosmos/LendSupply.fixture.tsx +75 -75
  68. package/src/cosmos/LendWithdraw.fixture.tsx +43 -43
  69. package/src/cosmos/SDKTesting.fixture.tsx +1 -0
  70. package/src/cosmos/SuperfluidFactoringBorrow.fixture.tsx +12 -12
  71. package/src/cosmos/WalletWrapper.tsx +52 -52
  72. package/src/cosmos/abis/InvoiceNFT.json +644 -644
  73. package/src/cosmos/abis/ReceivableFactoringPool.json +1529 -1529
  74. package/src/cosmos/utils/index.ts +169 -169
  75. package/src/fonts/Recoleta/Recoleta-Black.otf +0 -0
  76. package/src/fonts/Recoleta/Recoleta-Bold.otf +0 -0
  77. package/src/fonts/Recoleta/Recoleta-Light.otf +0 -0
  78. package/src/fonts/Recoleta/Recoleta-Medium.otf +0 -0
  79. package/src/fonts/Recoleta/Recoleta-Regular.otf +0 -0
  80. package/src/fonts/Recoleta/Recoleta-RegularDEMO.otf +0 -0
  81. package/src/fonts/Recoleta/Recoleta-SemiBold.otf +0 -0
  82. package/src/fonts/Recoleta/Recoleta-Thin.otf +0 -0
  83. package/src/hooks/useEA.ts +11 -9
  84. package/src/hooks/useRedux.ts +6 -6
  85. package/src/index.css +61 -61
  86. package/src/index.tsx +1 -7
  87. package/src/react-app-env.d.ts +1 -1
  88. package/src/reportWebVitals.ts +15 -15
  89. package/src/setupTests.ts +6 -6
  90. package/src/store/index.ts +27 -27
  91. package/src/store/widgets.reducers.ts +7 -7
  92. package/src/store/widgets.selectors.ts +3 -3
  93. package/src/store/widgets.store.ts +2 -2
  94. package/src/theme/breakpoints.ts +10 -10
  95. package/src/theme/components.ts +70 -70
  96. package/src/theme/coreThemeConstants.ts +29 -29
  97. package/src/theme/cssMixins.ts +92 -92
  98. package/src/theme/hooks/useGetSizes.ts +31 -34
  99. package/src/theme/index.ts +24 -24
  100. package/src/theme/palette.ts +150 -150
  101. package/src/theme/shape.ts +7 -7
  102. package/src/theme/theme.types.ts +80 -80
  103. package/src/theme/typography.ts +117 -117
  104. package/src/utilTypes.d.ts +29 -29
  105. package/src/utils/env.ts +9 -9
  106. package/tsconfig.build.json +7 -7
  107. package/tsconfig.json +32 -32
  108. package/webpack.cosmos.js +54 -54
  109. package/dist/assets/output-15e10f9f.css +0 -44
  110. package/dist/cjs/assets/output-15e10f9f.css +0 -44
  111. package/dist/cjs/index.cjs +0 -7723
  112. package/dist/cjs/index.cjs.map +0 -1
  113. package/dist/index.d.ts +0 -211
  114. package/dist/index.js +0 -7679
  115. package/dist/index.js.map +0 -1
package/rollup.config.js CHANGED
@@ -1,81 +1,81 @@
1
- const { babel } = require('@rollup/plugin-babel')
2
- const commonjs = require('@rollup/plugin-commonjs')
3
- const inject = require('@rollup/plugin-inject')
4
- const json = require('@rollup/plugin-json')
5
- const { nodeResolve: resolve } = require('@rollup/plugin-node-resolve')
6
- const { default: dts } = require('rollup-plugin-dts')
7
- const url = require('@rollup/plugin-url')
8
- const svgr = require('@svgr/rollup')
9
- const externals = require('rollup-plugin-node-externals')
10
- const sass = require('rollup-plugin-scss')
11
-
12
- const EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx']
13
-
14
- const transpile = {
15
- input: 'src/index.tsx',
16
- external: (source) => {
17
- return source.startsWith('@ethersproject/')
18
- },
19
- plugins: [
20
- externals({
21
- exclude: [/\.json$/, /\.css$/],
22
- deps: true,
23
- peerDeps: true,
24
- }),
25
- resolve({ extensions: EXTENSIONS }),
26
- json(),
27
- url({ include: ['**/*.png', '**/*.svg', '**/*.gif'], limit: Infinity }),
28
- svgr({ jsxRuntime: 'automatic' }),
29
- sass(),
30
- commonjs(),
31
-
32
- babel({
33
- babelHelpers: 'runtime',
34
- extensions: EXTENSIONS,
35
- }),
36
- inject({ React: 'react' }),
37
- ],
38
- onwarn: (warning, warn) => {
39
- if (warning.code === 'UNUSED_EXTERNAL_IMPORT') return
40
- if (warning.code === 'THIS_IS_UNDEFINED') return
41
- if (warning.code === 'CIRCULAR_DEPENDENCY') return
42
-
43
- warn(warning)
44
- console.log(warning.loc, '\n')
45
- },
46
- }
47
-
48
- const esm = {
49
- ...transpile,
50
- output: {
51
- file: 'dist/index.js',
52
- format: 'esm',
53
- sourcemap: true,
54
- },
55
- }
56
-
57
- const cjs = {
58
- ...transpile,
59
- output: {
60
- dir: 'dist/cjs',
61
- entryFileNames: '[name].cjs',
62
- chunkFileNames: '[name]-[hash].cjs',
63
- format: 'cjs',
64
- sourcemap: true,
65
- },
66
- watch: false,
67
- }
68
-
69
- const types = {
70
- input: 'dts/index.d.ts',
71
- output: { file: 'dist/index.d.ts' },
72
- external: (source) =>
73
- source.endsWith('.css') || source.endsWith('/external.d.ts'),
74
- plugins: [dts({ compilerOptions: { baseUrl: 'dts' } })],
75
- watch: false,
76
- }
77
-
78
- const config = [esm, cjs, types]
79
- config.config = { ...esm, output: { ...esm.output, sourcemap: true } }
80
-
81
- module.exports = config
1
+ const { babel } = require('@rollup/plugin-babel')
2
+ const commonjs = require('@rollup/plugin-commonjs')
3
+ const inject = require('@rollup/plugin-inject')
4
+ const json = require('@rollup/plugin-json')
5
+ const { nodeResolve: resolve } = require('@rollup/plugin-node-resolve')
6
+ const { default: dts } = require('rollup-plugin-dts')
7
+ const url = require('@rollup/plugin-url')
8
+ const svgr = require('@svgr/rollup')
9
+ const externals = require('rollup-plugin-node-externals')
10
+ const sass = require('rollup-plugin-scss')
11
+
12
+ const EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx']
13
+
14
+ const transpile = {
15
+ input: 'src/index.tsx',
16
+ external: (source) => {
17
+ return source.startsWith('@ethersproject/')
18
+ },
19
+ plugins: [
20
+ externals({
21
+ exclude: [/\.json$/, /\.css$/],
22
+ deps: true,
23
+ peerDeps: true,
24
+ }),
25
+ resolve({ extensions: EXTENSIONS }),
26
+ json(),
27
+ url({ include: ['**/*.png', '**/*.svg', '**/*.gif'], limit: Infinity }),
28
+ svgr({ jsxRuntime: 'automatic' }),
29
+ sass(),
30
+ commonjs(),
31
+
32
+ babel({
33
+ babelHelpers: 'runtime',
34
+ extensions: EXTENSIONS,
35
+ }),
36
+ inject({ React: 'react' }),
37
+ ],
38
+ onwarn: (warning, warn) => {
39
+ if (warning.code === 'UNUSED_EXTERNAL_IMPORT') return
40
+ if (warning.code === 'THIS_IS_UNDEFINED') return
41
+ if (warning.code === 'CIRCULAR_DEPENDENCY') return
42
+
43
+ warn(warning)
44
+ console.log(warning.loc, '\n')
45
+ },
46
+ }
47
+
48
+ const esm = {
49
+ ...transpile,
50
+ output: {
51
+ file: 'dist/index.js',
52
+ format: 'esm',
53
+ sourcemap: true,
54
+ },
55
+ }
56
+
57
+ const cjs = {
58
+ ...transpile,
59
+ output: {
60
+ dir: 'dist/cjs',
61
+ entryFileNames: '[name].cjs',
62
+ chunkFileNames: '[name]-[hash].cjs',
63
+ format: 'cjs',
64
+ sourcemap: true,
65
+ },
66
+ watch: false,
67
+ }
68
+
69
+ const types = {
70
+ input: 'dts/index.d.ts',
71
+ output: { file: 'dist/index.d.ts' },
72
+ external: (source) =>
73
+ source.endsWith('.css') || source.endsWith('/external.d.ts'),
74
+ plugins: [dts({ compilerOptions: { baseUrl: 'dts' } })],
75
+ watch: false,
76
+ }
77
+
78
+ const config = [esm, cjs, types]
79
+ config.config = { ...esm, output: { ...esm.output, sourcemap: true } }
80
+
81
+ module.exports = config
@@ -1,15 +1,15 @@
1
- import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client'
2
-
3
- import { WCProps } from '../utilTypes'
4
-
5
- export function ApolloWrapper({
6
- uri,
7
- children,
8
- }: WCProps<{ uri: string }>): React.ReactElement | null {
9
- const client = new ApolloClient({
10
- uri,
11
- cache: new InMemoryCache(),
12
- })
13
-
14
- return <ApolloProvider client={client}>{children}</ApolloProvider>
15
- }
1
+ import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client'
2
+
3
+ import { WCProps } from '../utilTypes'
4
+
5
+ export function ApolloWrapper({
6
+ uri,
7
+ children,
8
+ }: WCProps<{ uri: string }>): React.ReactElement | null {
9
+ const client = new ApolloClient({
10
+ uri,
11
+ cache: new InMemoryCache(),
12
+ })
13
+
14
+ return <ApolloProvider client={client}>{children}</ApolloProvider>
15
+ }
@@ -1,31 +1,31 @@
1
- import { Box, Button, css } from '@mui/material'
2
- import React from 'react'
3
-
4
- import { WCProps } from '../utilTypes'
5
-
6
- type Props = {
7
- variant: 'contained' | 'outlined'
8
- onClick?: () => void
9
- }
10
-
11
- export function BottomButton({
12
- variant,
13
- onClick,
14
- children,
15
- }: WCProps<Props>): React.ReactElement {
16
- const styles = css`
17
- & .MuiButtonBase-root {
18
- width: 100%;
19
- position: absolute;
20
- bottom: 0;
21
- }
22
- `
23
-
24
- return (
25
- <Box css={styles}>
26
- <Button variant={variant} onClick={onClick}>
27
- {children}
28
- </Button>
29
- </Box>
30
- )
31
- }
1
+ import { Box, Button, css } from '@mui/material'
2
+ import React from 'react'
3
+
4
+ import { WCProps } from '../utilTypes'
5
+
6
+ type Props = {
7
+ variant: 'contained' | 'outlined'
8
+ onClick?: () => void
9
+ }
10
+
11
+ export function BottomButton({
12
+ variant,
13
+ onClick,
14
+ children,
15
+ }: WCProps<Props>): React.ReactElement {
16
+ const styles = css`
17
+ & .MuiButtonBase-root {
18
+ width: 100%;
19
+ position: absolute;
20
+ bottom: 0;
21
+ }
22
+ `
23
+
24
+ return (
25
+ <Box css={styles}>
26
+ <Button variant={variant} onClick={onClick}>
27
+ {children}
28
+ </Button>
29
+ </Box>
30
+ )
31
+ }
@@ -1,2 +1,2 @@
1
- export * from './UpcomingList'
2
- export * from './FactoredList'
1
+ export * from './UpcomingList'
2
+ export * from './FactoredList'
@@ -1,68 +1,68 @@
1
- import { css } from '@emotion/react'
2
- import { useTheme } from '@mui/material'
3
- import React, { useEffect, useState } from 'react'
4
-
5
- import { LoaderIcon } from './icons'
6
-
7
- type Props = {
8
- fullScreen?: boolean
9
- minHeight?: string
10
- }
11
-
12
- export function HumaLoading({
13
- fullScreen = false,
14
- minHeight = '0px',
15
- }: Props): React.ReactElement {
16
- const theme = useTheme()
17
- const pathLength = 45
18
- const [count, setCount] = useState(1)
19
- const intervalTime = 30
20
-
21
- useEffect(() => {
22
- const interval = setInterval(() => {
23
- if (count <= pathLength) {
24
- const element = document.querySelector(
25
- `#huma-loader-wrapper > svg > path:nth-of-type(${count})`,
26
- )
27
- if (element) {
28
- // @ts-ignore
29
- element.style.visibility = 'visible'
30
- setCount((pre) => pre + 1)
31
- }
32
- } else {
33
- const elements = document.querySelectorAll(
34
- `#huma-loader-wrapper > svg > path`,
35
- )
36
- if (elements) {
37
- // @ts-ignore
38
- elements.forEach((element) => {
39
- // @ts-ignore
40
- element.style.visibility = 'hidden'
41
- })
42
- setCount(1)
43
- }
44
- }
45
- }, intervalTime)
46
- return () => clearInterval(interval)
47
- }, [count])
48
-
49
- const styles = {
50
- wrapper: css`
51
- ${theme.cssMixins.rowCentered};
52
- min-height: ${fullScreen ? '100vh' : minHeight};
53
- width: 50px;
54
- height: 50px;
55
- `,
56
- icon: css`
57
- & > path {
58
- visibility: hidden;
59
- }
60
- `,
61
- }
62
-
63
- return (
64
- <div css={styles.wrapper} id='huma-loader-wrapper'>
65
- <LoaderIcon css={styles.icon} />
66
- </div>
67
- )
68
- }
1
+ import { css } from '@emotion/react'
2
+ import { useTheme } from '@mui/material'
3
+ import React, { useEffect, useState } from 'react'
4
+
5
+ import { LoaderIcon } from './icons'
6
+
7
+ type Props = {
8
+ fullScreen?: boolean
9
+ minHeight?: string
10
+ }
11
+
12
+ export function HumaLoading({
13
+ fullScreen = false,
14
+ minHeight = '0px',
15
+ }: Props): React.ReactElement {
16
+ const theme = useTheme()
17
+ const pathLength = 45
18
+ const [count, setCount] = useState(1)
19
+ const intervalTime = 30
20
+
21
+ useEffect(() => {
22
+ const interval = setInterval(() => {
23
+ if (count <= pathLength) {
24
+ const element = document.querySelector(
25
+ `#huma-loader-wrapper > svg > path:nth-of-type(${count})`,
26
+ )
27
+ if (element) {
28
+ // @ts-ignore
29
+ element.style.visibility = 'visible'
30
+ setCount((pre) => pre + 1)
31
+ }
32
+ } else {
33
+ const elements = document.querySelectorAll(
34
+ `#huma-loader-wrapper > svg > path`,
35
+ )
36
+ if (elements) {
37
+ // @ts-ignore
38
+ elements.forEach((element) => {
39
+ // @ts-ignore
40
+ element.style.visibility = 'hidden'
41
+ })
42
+ setCount(1)
43
+ }
44
+ }
45
+ }, intervalTime)
46
+ return () => clearInterval(interval)
47
+ }, [count])
48
+
49
+ const styles = {
50
+ wrapper: css`
51
+ ${theme.cssMixins.rowCentered};
52
+ min-height: ${fullScreen ? '100vh' : minHeight};
53
+ width: 50px;
54
+ height: 50px;
55
+ `,
56
+ icon: css`
57
+ & > path {
58
+ visibility: hidden;
59
+ }
60
+ `,
61
+ }
62
+
63
+ return (
64
+ <div css={styles.wrapper} id='huma-loader-wrapper'>
65
+ <LoaderIcon css={styles.icon} />
66
+ </div>
67
+ )
68
+ }