@bosonprotocol/react-kit 0.31.1 → 0.32.0-alpha.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/cjs/components/buttons/BaseButton.d.ts +27 -0
- package/dist/cjs/components/buttons/BaseButton.d.ts.map +1 -0
- package/dist/cjs/components/buttons/BaseButton.js +154 -0
- package/dist/cjs/components/buttons/BaseButton.js.map +1 -0
- package/dist/cjs/components/form/BaseInput.d.ts +17 -0
- package/dist/cjs/components/form/BaseInput.d.ts.map +1 -0
- package/dist/cjs/components/form/BaseInput.js +88 -0
- package/dist/cjs/components/form/BaseInput.js.map +1 -0
- package/dist/cjs/components/form/BaseTagsInput.d.ts +8 -0
- package/dist/cjs/components/form/BaseTagsInput.d.ts.map +1 -0
- package/dist/cjs/components/form/{TagsInput.js → BaseTagsInput.js} +24 -16
- package/dist/cjs/components/form/BaseTagsInput.js.map +1 -0
- package/dist/cjs/components/form/ClearButton.d.ts +14 -0
- package/dist/cjs/components/form/ClearButton.d.ts.map +1 -0
- package/dist/cjs/components/form/ClearButton.js +28 -0
- package/dist/cjs/components/form/ClearButton.js.map +1 -0
- package/dist/cjs/components/form/Field.styles.d.ts +45 -7
- package/dist/cjs/components/form/Field.styles.d.ts.map +1 -1
- package/dist/cjs/components/form/Field.styles.js +44 -36
- package/dist/cjs/components/form/Field.styles.js.map +1 -1
- package/dist/cjs/components/form/Input.d.ts +3 -2
- package/dist/cjs/components/form/Input.d.ts.map +1 -1
- package/dist/cjs/components/form/Input.js +37 -24
- package/dist/cjs/components/form/Input.js.map +1 -1
- package/dist/cjs/components/form/Phone.js +1 -1
- package/dist/cjs/components/form/Phone.js.map +1 -1
- package/dist/cjs/components/form/index.d.ts +3 -2
- package/dist/cjs/components/form/index.d.ts.map +1 -1
- package/dist/cjs/components/form/index.js +17 -3
- package/dist/cjs/components/form/index.js.map +1 -1
- package/dist/cjs/components/form/styles/{TagsInput.styles.d.ts → BaseTagsInput.styles.d.ts} +6 -2
- package/dist/cjs/components/form/styles/BaseTagsInput.styles.d.ts.map +1 -0
- package/dist/cjs/components/form/styles/BaseTagsInput.styles.js +76 -0
- package/dist/cjs/components/form/styles/BaseTagsInput.styles.js.map +1 -0
- package/dist/cjs/components/modal/components/Redeem/RedeemNonModal.js +7 -3
- package/dist/cjs/components/modal/components/Redeem/RedeemNonModal.js.map +1 -1
- package/dist/cjs/components/styles/GlobalStyle.d.ts +1 -14
- package/dist/cjs/components/styles/GlobalStyle.d.ts.map +1 -1
- package/dist/cjs/components/styles/GlobalStyle.js +14 -41
- package/dist/cjs/components/styles/GlobalStyle.js.map +1 -1
- package/dist/cjs/components/ui/ThemedButton.d.ts.map +1 -1
- package/dist/cjs/components/ui/ThemedButton.js +3 -97
- package/dist/cjs/components/ui/ThemedButton.js.map +1 -1
- package/dist/cjs/components/ui/styles.d.ts.map +1 -1
- package/dist/cjs/components/ui/styles.js +5 -2
- package/dist/cjs/components/ui/styles.js.map +1 -1
- package/dist/cjs/components/widgets/finance/convertion-rate/ConvertionRateContext.d.ts.map +1 -1
- package/dist/cjs/components/widgets/finance/convertion-rate/ConvertionRateContext.js +5 -1
- package/dist/cjs/components/widgets/finance/convertion-rate/ConvertionRateContext.js.map +1 -1
- package/dist/cjs/components/widgets/finance/convertion-rate/useUniswapPools.d.ts.map +1 -1
- package/dist/cjs/components/widgets/finance/convertion-rate/useUniswapPools.js +7 -3
- package/dist/cjs/components/widgets/finance/convertion-rate/useUniswapPools.js.map +1 -1
- package/dist/cjs/hooks/tokenGated/useCheckTokenGatedOffer.d.ts.map +1 -1
- package/dist/cjs/hooks/tokenGated/useCheckTokenGatedOffer.js +3 -2
- package/dist/cjs/hooks/tokenGated/useCheckTokenGatedOffer.js.map +1 -1
- package/dist/cjs/hooks/useCurrentSellers.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/config/config.d.ts +2 -2
- package/dist/cjs/lib/config/config.d.ts.map +1 -1
- package/dist/cjs/lib/config/config.js +15 -2
- package/dist/cjs/lib/config/config.js.map +1 -1
- package/dist/cjs/lib/const/networks.d.ts.map +1 -1
- package/dist/cjs/lib/const/networks.js +1 -0
- package/dist/cjs/lib/const/networks.js.map +1 -1
- package/dist/cjs/lib/uniswap/validateTokenList.d.ts.map +1 -1
- package/dist/cjs/lib/uniswap/validateTokenList.js +10 -9
- package/dist/cjs/lib/uniswap/validateTokenList.js.map +1 -1
- package/dist/esm/components/buttons/BaseButton.d.ts +27 -0
- package/dist/esm/components/buttons/BaseButton.d.ts.map +1 -0
- package/dist/esm/components/buttons/BaseButton.js +107 -0
- package/dist/esm/components/buttons/BaseButton.js.map +1 -0
- package/dist/esm/components/form/BaseInput.d.ts +17 -0
- package/dist/esm/components/form/BaseInput.d.ts.map +1 -0
- package/dist/esm/components/form/BaseInput.js +47 -0
- package/dist/esm/components/form/BaseInput.js.map +1 -0
- package/dist/esm/components/form/BaseTagsInput.d.ts +8 -0
- package/dist/esm/components/form/BaseTagsInput.d.ts.map +1 -0
- package/dist/esm/components/form/{TagsInput.js → BaseTagsInput.js} +22 -17
- package/dist/esm/components/form/BaseTagsInput.js.map +1 -0
- package/dist/esm/components/form/ClearButton.d.ts +14 -0
- package/dist/esm/components/form/ClearButton.d.ts.map +1 -0
- package/dist/esm/components/form/ClearButton.js +22 -0
- package/dist/esm/components/form/ClearButton.js.map +1 -0
- package/dist/esm/components/form/Field.styles.d.ts +45 -7
- package/dist/esm/components/form/Field.styles.d.ts.map +1 -1
- package/dist/esm/components/form/Field.styles.js +44 -36
- package/dist/esm/components/form/Field.styles.js.map +1 -1
- package/dist/esm/components/form/Input.d.ts +3 -2
- package/dist/esm/components/form/Input.d.ts.map +1 -1
- package/dist/esm/components/form/Input.js +37 -12
- package/dist/esm/components/form/Input.js.map +1 -1
- package/dist/esm/components/form/Phone.js +1 -1
- package/dist/esm/components/form/Phone.js.map +1 -1
- package/dist/esm/components/form/index.d.ts +3 -2
- package/dist/esm/components/form/index.d.ts.map +1 -1
- package/dist/esm/components/form/index.js +2 -1
- package/dist/esm/components/form/index.js.map +1 -1
- package/dist/esm/components/form/styles/{TagsInput.styles.d.ts → BaseTagsInput.styles.d.ts} +6 -2
- package/dist/esm/components/form/styles/BaseTagsInput.styles.d.ts.map +1 -0
- package/dist/esm/components/form/styles/{TagsInput.styles.js → BaseTagsInput.styles.js} +14 -4
- package/dist/esm/components/form/styles/BaseTagsInput.styles.js.map +1 -0
- package/dist/esm/components/modal/components/Redeem/RedeemNonModal.js +5 -2
- package/dist/esm/components/modal/components/Redeem/RedeemNonModal.js.map +1 -1
- package/dist/esm/components/styles/GlobalStyle.d.ts +1 -14
- package/dist/esm/components/styles/GlobalStyle.d.ts.map +1 -1
- package/dist/esm/components/styles/GlobalStyle.js +14 -41
- package/dist/esm/components/styles/GlobalStyle.js.map +1 -1
- package/dist/esm/components/ui/ThemedButton.d.ts.map +1 -1
- package/dist/esm/components/ui/ThemedButton.js +4 -98
- package/dist/esm/components/ui/ThemedButton.js.map +1 -1
- package/dist/esm/components/ui/styles.d.ts.map +1 -1
- package/dist/esm/components/ui/styles.js +5 -2
- package/dist/esm/components/ui/styles.js.map +1 -1
- package/dist/esm/components/widgets/finance/convertion-rate/ConvertionRateContext.d.ts.map +1 -1
- package/dist/esm/components/widgets/finance/convertion-rate/ConvertionRateContext.js +3 -1
- package/dist/esm/components/widgets/finance/convertion-rate/ConvertionRateContext.js.map +1 -1
- package/dist/esm/components/widgets/finance/convertion-rate/useUniswapPools.d.ts.map +1 -1
- package/dist/esm/components/widgets/finance/convertion-rate/useUniswapPools.js +3 -1
- package/dist/esm/components/widgets/finance/convertion-rate/useUniswapPools.js.map +1 -1
- package/dist/esm/hooks/tokenGated/useCheckTokenGatedOffer.d.ts.map +1 -1
- package/dist/esm/hooks/tokenGated/useCheckTokenGatedOffer.js +3 -2
- package/dist/esm/hooks/tokenGated/useCheckTokenGatedOffer.js.map +1 -1
- package/dist/esm/hooks/useCurrentSellers.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/config/config.d.ts +2 -2
- package/dist/esm/lib/config/config.d.ts.map +1 -1
- package/dist/esm/lib/config/config.js +10 -2
- package/dist/esm/lib/config/config.js.map +1 -1
- package/dist/esm/lib/const/networks.d.ts.map +1 -1
- package/dist/esm/lib/const/networks.js +1 -0
- package/dist/esm/lib/const/networks.js.map +1 -1
- package/dist/esm/lib/uniswap/validateTokenList.d.ts.map +1 -1
- package/dist/esm/lib/uniswap/validateTokenList.js +10 -6
- package/dist/esm/lib/uniswap/validateTokenList.js.map +1 -1
- package/package.json +2 -2
- package/src/components/buttons/BaseButton.tsx +181 -0
- package/src/components/form/BaseInput.tsx +88 -0
- package/src/components/form/{TagsInput.tsx → BaseTagsInput.tsx} +46 -24
- package/src/components/form/ClearButton.tsx +39 -0
- package/src/components/form/Field.styles.ts +83 -40
- package/src/components/form/Input.tsx +42 -21
- package/src/components/form/Phone.tsx +1 -1
- package/src/components/form/index.ts +3 -2
- package/src/components/form/styles/{TagsInput.styles.ts → BaseTagsInput.styles.ts} +18 -4
- package/src/components/modal/components/Redeem/RedeemNonModal.tsx +6 -2
- package/src/components/styles/GlobalStyle.tsx +15 -71
- package/src/components/ui/ThemedButton.tsx +8 -145
- package/src/components/ui/styles.ts +5 -2
- package/src/components/widgets/finance/convertion-rate/ConvertionRateContext.tsx +3 -1
- package/src/components/widgets/finance/convertion-rate/useUniswapPools.ts +4 -1
- package/src/hooks/tokenGated/useCheckTokenGatedOffer.ts +5 -5
- package/src/hooks/useCurrentSellers.ts +8 -8
- package/src/index.tsx +2 -0
- package/src/lib/config/config.ts +10 -2
- package/src/lib/const/networks.ts +2 -1
- package/src/lib/uniswap/validateTokenList.ts +10 -6
- package/src/stories/buttons/button.stories.tsx +84 -62
- package/src/stories/form/Input.stories.tsx +67 -0
- package/src/stories/ui/ThemedButton.stories.tsx +79 -52
- package/dist/cjs/components/form/TagsInput.d.ts +0 -4
- package/dist/cjs/components/form/TagsInput.d.ts.map +0 -1
- package/dist/cjs/components/form/TagsInput.js.map +0 -1
- package/dist/cjs/components/form/styles/TagsInput.styles.d.ts.map +0 -1
- package/dist/cjs/components/form/styles/TagsInput.styles.js +0 -46
- package/dist/cjs/components/form/styles/TagsInput.styles.js.map +0 -1
- package/dist/cjs/global.d.ts +0 -5
- package/dist/cjs/global.d.ts.map +0 -1
- package/dist/cjs/global.js +0 -44
- package/dist/cjs/global.js.map +0 -1
- package/dist/esm/components/form/TagsInput.d.ts +0 -4
- package/dist/esm/components/form/TagsInput.d.ts.map +0 -1
- package/dist/esm/components/form/TagsInput.js.map +0 -1
- package/dist/esm/components/form/styles/TagsInput.styles.d.ts.map +0 -1
- package/dist/esm/components/form/styles/TagsInput.styles.js.map +0 -1
- package/dist/esm/global.d.ts +0 -5
- package/dist/esm/global.d.ts.map +0 -1
- package/dist/esm/global.js +0 -41
- package/dist/esm/global.js.map +0 -1
- package/src/global.ts +0 -42
|
@@ -1,104 +1,11 @@
|
|
|
1
|
-
import React, { ButtonHTMLAttributes, forwardRef
|
|
2
|
-
import styled, { css, ThemeProvider } from "styled-components";
|
|
1
|
+
import React, { ButtonHTMLAttributes, forwardRef } from "react";
|
|
3
2
|
|
|
4
|
-
import { zIndex } from "./zIndex";
|
|
5
|
-
import { Tooltip } from "../tooltip/Tooltip";
|
|
6
|
-
import * as Styles from "./styles";
|
|
7
|
-
import { Typography } from "./Typography";
|
|
8
3
|
import { theme } from "../../theme";
|
|
9
|
-
import {
|
|
4
|
+
import { BaseButton } from "../buttons/BaseButton";
|
|
10
5
|
import { ButtonSize } from "./buttonSize";
|
|
11
6
|
|
|
12
7
|
const colors = theme.colors.light;
|
|
13
8
|
|
|
14
|
-
const BaseButton = styled.button<{
|
|
15
|
-
size: IButton["size"];
|
|
16
|
-
fill: IButton["fill"];
|
|
17
|
-
}>`
|
|
18
|
-
${() => Styles.button};
|
|
19
|
-
${(props) => Styles[props.size as keyof typeof Styles]}
|
|
20
|
-
border-style: solid;
|
|
21
|
-
border-color: ${(props) => props.theme.borderColor || "transparent"};
|
|
22
|
-
border-width: ${(props) => props.theme.borderWidth || 0}px;
|
|
23
|
-
color: ${(props) => props.theme.color || "#000000"};
|
|
24
|
-
background-color: ${(props) => props.theme.background || "transparent"};
|
|
25
|
-
svg {
|
|
26
|
-
stroke: ${(props) => props.theme.color || "#000000"};
|
|
27
|
-
}
|
|
28
|
-
${(props) =>
|
|
29
|
-
props.fill
|
|
30
|
-
? css`
|
|
31
|
-
width: 100%;
|
|
32
|
-
`
|
|
33
|
-
: ""};
|
|
34
|
-
${(props) =>
|
|
35
|
-
props.theme.hover &&
|
|
36
|
-
css`
|
|
37
|
-
&:hover:not(:disabled) {
|
|
38
|
-
background-color: ${props.theme.hover.background};
|
|
39
|
-
${props.theme.hover.color &&
|
|
40
|
-
css`
|
|
41
|
-
color: ${props.theme.hover.color} !important;
|
|
42
|
-
svg {
|
|
43
|
-
fill: ${props.theme.hover.color} !important;
|
|
44
|
-
line {
|
|
45
|
-
stroke: ${props.theme.hover.color} !important;
|
|
46
|
-
}
|
|
47
|
-
polyline {
|
|
48
|
-
stroke: ${props.theme.hover.color} !important;
|
|
49
|
-
}
|
|
50
|
-
path {
|
|
51
|
-
stroke: ${props.theme.hover.color} !important;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
`};
|
|
55
|
-
${props.theme.hover.borderColor &&
|
|
56
|
-
css`
|
|
57
|
-
border-color: ${props.theme.hover.borderColor};
|
|
58
|
-
`};
|
|
59
|
-
}
|
|
60
|
-
`}
|
|
61
|
-
${(props) =>
|
|
62
|
-
props.theme.padding
|
|
63
|
-
? css`
|
|
64
|
-
padding: ${props.theme.padding} !important;
|
|
65
|
-
`
|
|
66
|
-
: ""}
|
|
67
|
-
|
|
68
|
-
${(props) =>
|
|
69
|
-
props.theme.disabled
|
|
70
|
-
? css`
|
|
71
|
-
&:disabled {
|
|
72
|
-
background-color: ${props.theme.disabled.background ||
|
|
73
|
-
"transparent"};
|
|
74
|
-
color: ${props.theme.disabled.color || colors.darkGrey};
|
|
75
|
-
border-color: transparent;
|
|
76
|
-
cursor: not-allowed;
|
|
77
|
-
opacity: 0.5;
|
|
78
|
-
}
|
|
79
|
-
`
|
|
80
|
-
: css`
|
|
81
|
-
&:disabled {
|
|
82
|
-
background-color: ${colors.lightGrey};
|
|
83
|
-
color: ${colors.darkGrey};
|
|
84
|
-
border-color: transparent;
|
|
85
|
-
cursor: not-allowed;
|
|
86
|
-
opacity: 0.5;
|
|
87
|
-
}
|
|
88
|
-
`};
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
const ChildWrapperButton = styled.div`
|
|
92
|
-
display: flex;
|
|
93
|
-
align-items: center;
|
|
94
|
-
justify-content: center;
|
|
95
|
-
gap: 12px;
|
|
96
|
-
position: relative;
|
|
97
|
-
z-index: ${zIndex.Button};
|
|
98
|
-
|
|
99
|
-
${() => Styles.buttonText};
|
|
100
|
-
`;
|
|
101
|
-
|
|
102
9
|
const allThemes = ({ withBosonStyle }: { withBosonStyle?: boolean }) => {
|
|
103
10
|
return {
|
|
104
11
|
primary: {
|
|
@@ -325,57 +232,13 @@ export type IButton = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
325
232
|
};
|
|
326
233
|
|
|
327
234
|
const ThemedButton = forwardRef<HTMLButtonElement, IButton>(
|
|
328
|
-
(
|
|
329
|
-
{
|
|
330
|
-
children,
|
|
331
|
-
onClick,
|
|
332
|
-
size = "regular",
|
|
333
|
-
themeVal = "primary",
|
|
334
|
-
type = "button",
|
|
335
|
-
step = 0,
|
|
336
|
-
fill = false,
|
|
337
|
-
isLoading = false,
|
|
338
|
-
tooltip = "",
|
|
339
|
-
withBosonStyle = false,
|
|
340
|
-
...rest
|
|
341
|
-
},
|
|
342
|
-
ref
|
|
343
|
-
) => {
|
|
344
|
-
const Wrapper = tooltip !== "" && rest?.disabled ? Tooltip : Fragment;
|
|
345
|
-
const wrapperParams =
|
|
346
|
-
tooltip !== "" && rest?.disabled ? { wrap: false, content: tooltip } : {};
|
|
235
|
+
({ themeVal = "primary", withBosonStyle = false, ...rest }, ref) => {
|
|
347
236
|
return (
|
|
348
|
-
|
|
349
|
-
{
|
|
350
|
-
{
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
{/* @ts-ignore */}
|
|
354
|
-
<Wrapper {...wrapperParams}>
|
|
355
|
-
<BaseButton
|
|
356
|
-
onClick={onClick}
|
|
357
|
-
type={type}
|
|
358
|
-
size={size}
|
|
359
|
-
fill={fill ? fill : undefined}
|
|
360
|
-
{...rest}
|
|
361
|
-
ref={ref}
|
|
362
|
-
>
|
|
363
|
-
{isLoading ? (
|
|
364
|
-
<Loading />
|
|
365
|
-
) : (
|
|
366
|
-
<ChildWrapperButton data-child-wrapper-button>
|
|
367
|
-
{children}
|
|
368
|
-
{step !== 0 && (
|
|
369
|
-
<Typography>
|
|
370
|
-
<small>Step {step}</small>
|
|
371
|
-
</Typography>
|
|
372
|
-
)}
|
|
373
|
-
</ChildWrapperButton>
|
|
374
|
-
)}
|
|
375
|
-
</BaseButton>
|
|
376
|
-
</Wrapper>
|
|
377
|
-
</ThemeProvider>
|
|
378
|
-
</>
|
|
237
|
+
<BaseButton
|
|
238
|
+
{...rest}
|
|
239
|
+
ref={ref}
|
|
240
|
+
theme={allThemes({ withBosonStyle })[themeVal]}
|
|
241
|
+
/>
|
|
379
242
|
);
|
|
380
243
|
}
|
|
381
244
|
);
|
|
@@ -33,8 +33,11 @@ export const clamp = css`
|
|
|
33
33
|
-webkit-box-orient: vertical;
|
|
34
34
|
`;
|
|
35
35
|
export const boxShadow = css`
|
|
36
|
-
box-shadow:
|
|
37
|
-
0px 0px
|
|
36
|
+
box-shadow:
|
|
37
|
+
0px 0px 4px rgba(0, 0, 0, 0.05),
|
|
38
|
+
0px 0px 8px rgba(0, 0, 0, 0.05),
|
|
39
|
+
0px 0px 16px rgba(0, 0, 0, 0.05),
|
|
40
|
+
0px 0px 32px rgba(0, 0, 0, 0.05);
|
|
38
41
|
`;
|
|
39
42
|
|
|
40
43
|
export const text = css`
|
|
@@ -36,7 +36,9 @@ export const initalState: ConvertionRateContextType = {
|
|
|
36
36
|
type: null,
|
|
37
37
|
tokens: null,
|
|
38
38
|
rates:
|
|
39
|
-
process.env.NODE_ENV === "development"
|
|
39
|
+
process.env.NODE_ENV === "development" ||
|
|
40
|
+
// @ts-expect-error import.meta.env only exists in vite environments
|
|
41
|
+
import.meta?.env?.DEV
|
|
40
42
|
? MOCK_RATES
|
|
41
43
|
: getItemFromStorage("convertionRates", null),
|
|
42
44
|
fixed: 20,
|
|
@@ -100,7 +100,10 @@ export interface IPool {
|
|
|
100
100
|
|
|
101
101
|
export function useUniswapPools({ tokens }: Props) {
|
|
102
102
|
const tokensWithoutBoson = tokens?.filter((t) => t.symbol !== "BOSON") || [];
|
|
103
|
-
const isDev =
|
|
103
|
+
const isDev =
|
|
104
|
+
process.env.NODE_ENV === "development" ||
|
|
105
|
+
// @ts-expect-error import.meta.env only exists in vite environments
|
|
106
|
+
import.meta?.env?.DEV;
|
|
104
107
|
const queries = generateQuery(tokensWithoutBoson, false);
|
|
105
108
|
const swapQueries = generateQuery(tokensWithoutBoson, true);
|
|
106
109
|
|
|
@@ -3,8 +3,9 @@ import { utils } from "ethers";
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { Offer } from "../../types/offer";
|
|
5
5
|
import { useCoreSDKWithContext } from "../core-sdk/useCoreSdkWithContext";
|
|
6
|
-
import { BosonSnapshotGate__factory } from "./BosonSnapshotGate/typechain";
|
|
6
|
+
// import { BosonSnapshotGate__factory } from "./BosonSnapshotGate/typechain";
|
|
7
7
|
import { useAccount, useSigner } from "../connection/connection";
|
|
8
|
+
const importedTypechain = import("./BosonSnapshotGate/typechain");
|
|
8
9
|
|
|
9
10
|
interface Props {
|
|
10
11
|
commitProxyAddress?: string | undefined;
|
|
@@ -32,10 +33,9 @@ export default function useCheckTokenGatedOffer({
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
try {
|
|
35
|
-
const proxyContract =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
36
|
+
const proxyContract = (
|
|
37
|
+
await importedTypechain
|
|
38
|
+
).BosonSnapshotGate__factory.connect(commitProxyAddress, signer);
|
|
39
39
|
const [owned, used] = await proxyContract.checkSnapshot(
|
|
40
40
|
condition.minTokenId,
|
|
41
41
|
utils.getAddress(address)
|
|
@@ -259,15 +259,15 @@ export function useCurrentSellers(
|
|
|
259
259
|
const sellerType: string[] | string[][] = resultById?.data
|
|
260
260
|
? resultById.data.map((d) => Object.keys(d))
|
|
261
261
|
: resultByLensId?.data
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
? Object.keys(resultByLensId.data)
|
|
263
|
+
: resultByAddress?.data?.sellerType || [];
|
|
264
264
|
|
|
265
265
|
const sellerIdsToQuery: string[] =
|
|
266
266
|
sellerAddressType === "SELLER_IDS"
|
|
267
267
|
? (sellerAddress as string[])
|
|
268
268
|
: sellerAddressType === "LENS_TOKEN_ID" && resultByLensId?.data?.sellerId
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
? [resultByLensId?.data.sellerId]
|
|
270
|
+
: [];
|
|
271
271
|
const enableSellerById = !!sellerIdsToQuery?.length;
|
|
272
272
|
const { data: sellers2, refetch: refetchFetchSellers } = fetchSellers(
|
|
273
273
|
sellerIdsToQuery,
|
|
@@ -360,10 +360,10 @@ export function useCurrentSellers(
|
|
|
360
360
|
resultByAddress.data
|
|
361
361
|
? resultByAddress.data.sellers.map((seller) => seller.id)
|
|
362
362
|
: sellerAddressType === "SELLER_IDS"
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
363
|
+
? Array.isArray(sellerAddress)
|
|
364
|
+
? sellerAddress
|
|
365
|
+
: [sellerAddress]
|
|
366
|
+
: []
|
|
367
367
|
).filter((sellerId) => !!sellerId) as string[];
|
|
368
368
|
}, [resultByAddress.data, sellerAddress, sellerAddressType]);
|
|
369
369
|
return {
|
package/src/index.tsx
CHANGED
|
@@ -6,6 +6,7 @@ export { default as ThemedButton, IButton } from "./components/ui/ThemedButton";
|
|
|
6
6
|
export * from "./components/ui/zIndex";
|
|
7
7
|
export * from "./components/ui/buttonSize";
|
|
8
8
|
export * from "./components/buttons/Button";
|
|
9
|
+
export * from "./components/buttons/BaseButton";
|
|
9
10
|
export * from "./components/buttons/CommitButtonView";
|
|
10
11
|
export * from "./components/cta/exchange/BatchCompleteButton";
|
|
11
12
|
export * from "./components/cta/exchange/CancelButton";
|
|
@@ -58,6 +59,7 @@ export * from "./components/ui/Grid";
|
|
|
58
59
|
export * from "./components/ui/GridContainer";
|
|
59
60
|
export * from "./components/ui/Typography";
|
|
60
61
|
export * from "./components/ui/MuteButton";
|
|
62
|
+
export * from "./components/form";
|
|
61
63
|
export * from "./lib/magicLink/logout";
|
|
62
64
|
export * from "./lib/magicLink/provider";
|
|
63
65
|
export * from "./lib/const/networks";
|
package/src/lib/config/config.ts
CHANGED
|
@@ -2,7 +2,11 @@ import { getRpcUrls } from "../const/networks";
|
|
|
2
2
|
|
|
3
3
|
const magicLinkKey =
|
|
4
4
|
process.env.STORYBOOK_REACT_APP_MAGIC_API_KEY ||
|
|
5
|
-
process.env.REACT_APP_MAGIC_API_KEY
|
|
5
|
+
process.env.REACT_APP_MAGIC_API_KEY ||
|
|
6
|
+
// @ts-expect-error import.meta.env only exists in vite environments
|
|
7
|
+
import.meta?.env.STORYBOOK_REACT_APP_MAGIC_API_KEY ||
|
|
8
|
+
// @ts-expect-error import.meta.env only exists in vite environments
|
|
9
|
+
import.meta?.env.REACT_APP_MAGIC_API_KEY;
|
|
6
10
|
if (!magicLinkKey) {
|
|
7
11
|
throw new Error(
|
|
8
12
|
"STORYBOOK_REACT_APP_MAGIC_API_KEY/REACT_APP_MAGIC_API_KEY is not defined"
|
|
@@ -10,7 +14,11 @@ if (!magicLinkKey) {
|
|
|
10
14
|
}
|
|
11
15
|
const infuraKey =
|
|
12
16
|
process.env.STORYBOOK_REACT_APP_INFURA_KEY ||
|
|
13
|
-
process.env.REACT_APP_INFURA_KEY
|
|
17
|
+
process.env.REACT_APP_INFURA_KEY ||
|
|
18
|
+
// @ts-expect-error import.meta.env only exists in vite environments
|
|
19
|
+
import.meta?.env.STORYBOOK_REACT_APP_INFURA_KEY ||
|
|
20
|
+
// @ts-expect-error import.meta.env only exists in vite environments
|
|
21
|
+
import.meta?.env.REACT_APP_INFURA_KEY;
|
|
14
22
|
if (!infuraKey) {
|
|
15
23
|
throw new Error(
|
|
16
24
|
"STORYBOOK_REACT_APP_INFURA_KEY/REACT_APP_INFURA_KEY is not defined"
|
|
@@ -179,7 +179,8 @@ export const getRpcUrls = (infuraKey: string) => ({
|
|
|
179
179
|
`https://polygon-mumbai.infura.io/v3/${infuraKey}`,
|
|
180
180
|
...FALLBACK_URLS[ChainId.POLYGON_MUMBAI]
|
|
181
181
|
],
|
|
182
|
-
80002: [
|
|
182
|
+
80002: [
|
|
183
|
+
// AMOY
|
|
183
184
|
`https://polygon-amoy.infura.io/v3/${infuraKey}`,
|
|
184
185
|
...FALLBACK_URLS[80002]
|
|
185
186
|
],
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { TokenList } from "@uniswap/token-lists";
|
|
2
2
|
import type { ValidateFunction } from "ajv";
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
// import validateTokens from "./__generated__/validateTokens";
|
|
4
|
+
const importValidateTokens = import("./__generated__/validateTokens");
|
|
5
|
+
// import validatorImportList from "./__generated__/validateTokenList";
|
|
6
|
+
const importValidatorImportList = import("./__generated__/validateTokenList");
|
|
5
7
|
|
|
6
8
|
enum ValidationSchema {
|
|
7
9
|
LIST = "list",
|
|
@@ -30,13 +32,15 @@ async function validate(
|
|
|
30
32
|
// validatorImport = await import(
|
|
31
33
|
// "lib/uniswap/__generated__/validateTokenList"
|
|
32
34
|
// );
|
|
33
|
-
validatorImport = validatorImportList;
|
|
35
|
+
// validatorImport = validatorImportList;
|
|
36
|
+
validatorImport = await importValidatorImportList;
|
|
34
37
|
break;
|
|
35
38
|
case ValidationSchema.TOKENS:
|
|
36
39
|
// validatorImport = await import(
|
|
37
40
|
// "lib/uniswap/__generated__/validateTokens"
|
|
38
41
|
// );
|
|
39
|
-
validatorImport = validateTokens;
|
|
42
|
+
// validatorImport = validateTokens;
|
|
43
|
+
validatorImport = await importValidateTokens;
|
|
40
44
|
break;
|
|
41
45
|
default:
|
|
42
46
|
throw new Error("No validation function specified for token list schema");
|
|
@@ -45,8 +49,8 @@ async function validate(
|
|
|
45
49
|
import("ajv")
|
|
46
50
|
// validatorImport
|
|
47
51
|
]);
|
|
48
|
-
|
|
49
|
-
const validator = validatorImport as ValidateFunction;
|
|
52
|
+
const validator = validatorImport.default as ValidateFunction;
|
|
53
|
+
// const validator = validatorImport as ValidateFunction;
|
|
50
54
|
if (validator?.(data)) {
|
|
51
55
|
return data;
|
|
52
56
|
}
|
|
@@ -1,88 +1,110 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
-
|
|
1
|
+
import { fn } from "@storybook/test";
|
|
4
2
|
import { Button } from "../../components/buttons/Button";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Meta } from "@storybook/react";
|
|
5
5
|
|
|
6
6
|
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
7
7
|
export default {
|
|
8
8
|
title: "Visual Components/Buttons/Button",
|
|
9
|
-
component: Button
|
|
10
|
-
|
|
9
|
+
component: Button,
|
|
10
|
+
parameters: {
|
|
11
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
12
|
+
layout: "centered"
|
|
13
|
+
},
|
|
14
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
15
|
+
tags: ["autodocs"],
|
|
16
|
+
args: { onClick: fn() },
|
|
17
|
+
argTypes: {
|
|
18
|
+
disabled: { control: "boolean" },
|
|
19
|
+
size: {
|
|
20
|
+
control: "select",
|
|
21
|
+
options: ["small", "regular", "large"]
|
|
22
|
+
},
|
|
23
|
+
children: { control: "text" },
|
|
24
|
+
tooltip: { control: "text" }
|
|
25
|
+
},
|
|
26
|
+
decorators: [
|
|
27
|
+
(Story) => {
|
|
28
|
+
return <Story />;
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
} satisfies Meta<typeof Button>;
|
|
11
32
|
|
|
12
33
|
const BASE_ARGS = {
|
|
13
34
|
children: "Button Text",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
size: "regular"
|
|
35
|
+
size: "regular",
|
|
36
|
+
tooltip: "tooltip shown when disabled only"
|
|
17
37
|
} as const;
|
|
18
|
-
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
19
|
-
const Template: ComponentStory<typeof Button> = (args) => (
|
|
20
|
-
<Button {...BASE_ARGS} {...args} />
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
export const PrimaryFill: ComponentStory<typeof Button> = Template.bind({});
|
|
24
|
-
|
|
25
|
-
export const PrimaryInverted: ComponentStory<typeof Button> = Template.bind({});
|
|
26
|
-
|
|
27
|
-
export const SecondaryFill: ComponentStory<typeof Button> = Template.bind({});
|
|
28
|
-
|
|
29
|
-
export const SecondaryInverted: ComponentStory<typeof Button> = Template.bind(
|
|
30
|
-
{}
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
export const AccentFill: ComponentStory<typeof Button> = Template.bind({});
|
|
34
|
-
|
|
35
|
-
export const AccentInverted: ComponentStory<typeof Button> = Template.bind({});
|
|
36
|
-
|
|
37
|
-
export const Disabled: ComponentStory<typeof Button> = Template.bind({});
|
|
38
|
-
|
|
39
|
-
export const Loading: ComponentStory<typeof Button> = Template.bind({});
|
|
40
38
|
|
|
41
39
|
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
42
|
-
PrimaryFill
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
export const PrimaryFill = {
|
|
41
|
+
args: {
|
|
42
|
+
...BASE_ARGS,
|
|
43
|
+
disabled: false,
|
|
44
|
+
loading: false,
|
|
45
|
+
variant: "primaryFill"
|
|
46
|
+
}
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
PrimaryInverted
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
export const PrimaryInverted = {
|
|
50
|
+
args: {
|
|
51
|
+
...BASE_ARGS,
|
|
52
|
+
disabled: false,
|
|
53
|
+
loading: false,
|
|
54
|
+
variant: "primaryInverted"
|
|
55
|
+
}
|
|
52
56
|
};
|
|
53
57
|
|
|
54
|
-
SecondaryFill
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
export const SecondaryFill = {
|
|
59
|
+
args: {
|
|
60
|
+
...BASE_ARGS,
|
|
61
|
+
disabled: false,
|
|
62
|
+
loading: false,
|
|
63
|
+
variant: "secondaryFill"
|
|
64
|
+
}
|
|
58
65
|
};
|
|
59
66
|
|
|
60
|
-
SecondaryInverted
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
export const SecondaryInverted = {
|
|
68
|
+
args: {
|
|
69
|
+
...BASE_ARGS,
|
|
70
|
+
disabled: false,
|
|
71
|
+
loading: false,
|
|
72
|
+
variant: "secondaryInverted"
|
|
73
|
+
}
|
|
64
74
|
};
|
|
65
75
|
|
|
66
|
-
AccentFill
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
export const AccentFill = {
|
|
77
|
+
args: {
|
|
78
|
+
...BASE_ARGS,
|
|
79
|
+
disabled: false,
|
|
80
|
+
loading: false,
|
|
81
|
+
variant: "accentFill"
|
|
82
|
+
}
|
|
70
83
|
};
|
|
71
84
|
|
|
72
|
-
AccentInverted
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
export const AccentInverted = {
|
|
86
|
+
args: {
|
|
87
|
+
...BASE_ARGS,
|
|
88
|
+
disabled: false,
|
|
89
|
+
loading: false,
|
|
90
|
+
variant: "accentInverted"
|
|
91
|
+
}
|
|
76
92
|
};
|
|
77
93
|
|
|
78
|
-
Disabled
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
export const Disabled = {
|
|
95
|
+
args: {
|
|
96
|
+
...BASE_ARGS,
|
|
97
|
+
disabled: true,
|
|
98
|
+
loading: false,
|
|
99
|
+
variant: "primaryFill"
|
|
100
|
+
}
|
|
82
101
|
};
|
|
83
102
|
|
|
84
|
-
Loading
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
103
|
+
export const Loading = {
|
|
104
|
+
args: {
|
|
105
|
+
...BASE_ARGS,
|
|
106
|
+
disabled: false,
|
|
107
|
+
loading: true,
|
|
108
|
+
variant: "primaryFill"
|
|
109
|
+
}
|
|
88
110
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Input } from "../../components/form";
|
|
3
|
+
import { Formik } from "formik";
|
|
4
|
+
import type { Meta } from "@storybook/react";
|
|
5
|
+
import { fn } from "@storybook/test";
|
|
6
|
+
const inputWithErrors = "With error";
|
|
7
|
+
const defaultHeightSize = "regular";
|
|
8
|
+
const inputName = "test";
|
|
9
|
+
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
10
|
+
export default {
|
|
11
|
+
title: "Visual Components/Inputs/Input",
|
|
12
|
+
component: Input,
|
|
13
|
+
parameters: {
|
|
14
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
15
|
+
layout: "centered"
|
|
16
|
+
},
|
|
17
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
18
|
+
tags: ["autodocs"],
|
|
19
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
20
|
+
argTypes: {
|
|
21
|
+
disabled: { control: "boolean" },
|
|
22
|
+
heightSize: {
|
|
23
|
+
control: "select",
|
|
24
|
+
options: ["small", "regular", "large"]
|
|
25
|
+
},
|
|
26
|
+
isClearable: { control: "boolean" }
|
|
27
|
+
},
|
|
28
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
29
|
+
args: { onClick: fn() },
|
|
30
|
+
decorators: [
|
|
31
|
+
(Story, { name }) => {
|
|
32
|
+
return (
|
|
33
|
+
<Formik<{ [inputName]: unknown }>
|
|
34
|
+
onSubmit={() => {
|
|
35
|
+
//
|
|
36
|
+
}}
|
|
37
|
+
initialErrors={
|
|
38
|
+
name === inputWithErrors
|
|
39
|
+
? { [inputName]: "Input error before typing!" }
|
|
40
|
+
: {}
|
|
41
|
+
}
|
|
42
|
+
initialValues={{ [inputName]: "" }}
|
|
43
|
+
initialTouched={{ [inputName]: true }}
|
|
44
|
+
>
|
|
45
|
+
<Story />
|
|
46
|
+
</Formik>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
] satisfies Meta<typeof Input>["decorators"]
|
|
50
|
+
} satisfies Meta<typeof Input>;
|
|
51
|
+
|
|
52
|
+
export const Simple = {
|
|
53
|
+
args: {
|
|
54
|
+
name: inputName,
|
|
55
|
+
placeholder: "this is a placeholder",
|
|
56
|
+
heightSize: defaultHeightSize
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const InputWithError = {
|
|
61
|
+
name: "With error",
|
|
62
|
+
args: {
|
|
63
|
+
name: inputName,
|
|
64
|
+
placeholder: "this is a placeholder",
|
|
65
|
+
heightSize: defaultHeightSize
|
|
66
|
+
}
|
|
67
|
+
};
|