herald-exchange-glide-widget 1.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.
- package/.babelrc +3 -0
- package/Readme.md +116 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +24 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +58 -0
- package/rollup.config.js +90 -0
- package/src/assets/css/style.module.css +1352 -0
- package/src/assets/icons-one.png +0 -0
- package/src/assets/swap.svg +8 -0
- package/src/components/ButtonStepper.tsx +143 -0
- package/src/components/CommonCenterLoader.tsx +118 -0
- package/src/components/CustomeSelect.tsx +179 -0
- package/src/components/DotLoader.tsx +8 -0
- package/src/components/SellAdminCryptoAccount.tsx +604 -0
- package/src/components/SellField.tsx +705 -0
- package/src/components/WidgetBankDetails.tsx +592 -0
- package/src/components/WidgetComponent.tsx +42 -0
- package/src/components/WidgetContent.tsx +36 -0
- package/src/components/WidgetSuccesDetails.tsx +122 -0
- package/src/components/api.ts +59 -0
- package/src/components/api.tsx +61 -0
- package/src/components/chains.ts +319 -0
- package/src/components/images.d.ts +5 -0
- package/src/components/loader.tsx +12 -0
- package/src/components/style.module.css.d.ts +4 -0
- package/src/components/toast.tsx +43 -0
- package/src/components/types.ts +237 -0
- package/src/components/utils.ts +17 -0
- package/src/components/utils.tsx +10 -0
- package/src/hooks/toastProvider.tsx +63 -0
- package/src/hooks/useSocketExchange.tsx +48 -0
- package/src/index.ts +3 -0
- package/tsconfig.json +118 -0
Binary file
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<svg width="70" height="70" viewBox="0 0 70 70" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<rect x="9" y="61" width="52" height="52" rx="26" transform="rotate(-90 9 61)" fill="white"/>
|
3
|
+
<rect x="4.715" y="65.285" width="60.57" height="60.57" rx="30.285" transform="rotate(-90 4.715 65.285)" stroke="black" stroke-opacity="0.05" stroke-width="8.57"/>
|
4
|
+
<path d="M33.5609 30.097L30.1066 26.6428L26.6523 30.097" stroke="black" stroke-width="1.85714" stroke-linecap="round" stroke-linejoin="round"/>
|
5
|
+
<path d="M30.1074 43.3571V26.6428" stroke="black" stroke-width="1.85714" stroke-linecap="round" stroke-linejoin="round"/>
|
6
|
+
<path d="M36.4375 39.9028L39.8918 43.3571L43.3461 39.9028" stroke="black" stroke-width="1.85714" stroke-linecap="round" stroke-linejoin="round"/>
|
7
|
+
<path d="M39.8926 26.6428V43.3571" stroke="black" stroke-width="1.85714" stroke-linecap="round" stroke-linejoin="round"/>
|
8
|
+
</svg>
|
@@ -0,0 +1,143 @@
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
|
+
|
3
|
+
const ButtonStepper = ({ props, monitoring,css }: { props: any; monitoring: boolean; css: any }) => {
|
4
|
+
const [completed, setCompleted] = useState(false);
|
5
|
+
const [processing, setProcessing] = useState(false);
|
6
|
+
|
7
|
+
useEffect(() => {
|
8
|
+
if (props?.data && Object.keys(props?.data)?.length > 0) {
|
9
|
+
setCompleted(true);
|
10
|
+
}
|
11
|
+
}, [props]);
|
12
|
+
|
13
|
+
useEffect(() => {
|
14
|
+
setProcessing(monitoring);
|
15
|
+
}, [monitoring]);
|
16
|
+
|
17
|
+
useEffect(() => {
|
18
|
+
return () => {
|
19
|
+
setCompleted(false);
|
20
|
+
};
|
21
|
+
}, []);
|
22
|
+
|
23
|
+
return (
|
24
|
+
<>
|
25
|
+
<div className={css.flow_stepper_wrap}>
|
26
|
+
<div className={css.flow_stepper_frame}>
|
27
|
+
<ul className="list-unstyled">
|
28
|
+
<li className={`${!processing ? css.completed : ""}`}>
|
29
|
+
<div className={css.flow_stepper_card}>
|
30
|
+
<div className={css.flow_stepper_process}>
|
31
|
+
{!processing ? (
|
32
|
+
<svg
|
33
|
+
xmlns="http://www.w3.org/2000/svg"
|
34
|
+
width="24"
|
35
|
+
height="24"
|
36
|
+
enableBackground="new 0 0 512 512"
|
37
|
+
viewBox="0 0 20 20"
|
38
|
+
fill="#fff"
|
39
|
+
>
|
40
|
+
<path
|
41
|
+
fillRule="evenodd"
|
42
|
+
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
|
43
|
+
clipRule="evenodd"
|
44
|
+
data-original="#000000"
|
45
|
+
></path>
|
46
|
+
</svg>
|
47
|
+
) : (
|
48
|
+
<div className={css.flow_loader}></div>
|
49
|
+
)}
|
50
|
+
</div>
|
51
|
+
<span>Awaiting Transaction</span>
|
52
|
+
</div>
|
53
|
+
</li>
|
54
|
+
<li className={completed && !processing ? css.completed : ""}>
|
55
|
+
<div className={css.flow_stepper_card}>
|
56
|
+
<div className={css.flow_stepper_process}>
|
57
|
+
{completed && !processing ? (
|
58
|
+
<svg
|
59
|
+
xmlns="http://www.w3.org/2000/svg"
|
60
|
+
width="24"
|
61
|
+
height="24"
|
62
|
+
enableBackground="new 0 0 512 512"
|
63
|
+
viewBox="0 0 20 20"
|
64
|
+
fill="#fff"
|
65
|
+
>
|
66
|
+
<path
|
67
|
+
fillRule="evenodd"
|
68
|
+
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
|
69
|
+
clipRule="evenodd"
|
70
|
+
data-original="#000000"
|
71
|
+
></path>
|
72
|
+
</svg>
|
73
|
+
) : !processing && !completed ? (
|
74
|
+
<div className={css.flow_loader}></div>
|
75
|
+
) : (
|
76
|
+
<svg
|
77
|
+
xmlns="http://www.w3.org/2000/svg"
|
78
|
+
width="24"
|
79
|
+
height="24"
|
80
|
+
enableBackground="new 0 0 512 512"
|
81
|
+
viewBox="0 0 20 20"
|
82
|
+
fill="#fff"
|
83
|
+
>
|
84
|
+
<path
|
85
|
+
fillRule="evenodd"
|
86
|
+
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
|
87
|
+
clipRule="evenodd"
|
88
|
+
data-original="#000000"
|
89
|
+
></path>
|
90
|
+
</svg>
|
91
|
+
)}
|
92
|
+
</div>
|
93
|
+
<span>Processing Transaction</span>
|
94
|
+
</div>
|
95
|
+
</li>
|
96
|
+
<li className={`${completed ? css.completed : ""}`}>
|
97
|
+
<div className={css.flow_stepper_card}>
|
98
|
+
<div className={css.flow_stepper_process}>
|
99
|
+
{completed ? (
|
100
|
+
<svg
|
101
|
+
xmlns="http://www.w3.org/2000/svg"
|
102
|
+
width="24"
|
103
|
+
height="24"
|
104
|
+
enableBackground="new 0 0 512 512"
|
105
|
+
viewBox="0 0 20 20"
|
106
|
+
fill="#fff"
|
107
|
+
>
|
108
|
+
<path
|
109
|
+
fillRule="evenodd"
|
110
|
+
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
|
111
|
+
clipRule="evenodd"
|
112
|
+
data-original="#000000"
|
113
|
+
></path>
|
114
|
+
</svg>
|
115
|
+
) : (
|
116
|
+
<svg
|
117
|
+
xmlns="http://www.w3.org/2000/svg"
|
118
|
+
width="24"
|
119
|
+
height="24"
|
120
|
+
enableBackground="new 0 0 512 512"
|
121
|
+
viewBox="0 0 20 20"
|
122
|
+
fill="#e4e0e0"
|
123
|
+
>
|
124
|
+
<path
|
125
|
+
fillRule="evenodd"
|
126
|
+
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
|
127
|
+
clipRule="evenodd"
|
128
|
+
data-original="#000000"
|
129
|
+
></path>
|
130
|
+
</svg>
|
131
|
+
)}
|
132
|
+
</div>
|
133
|
+
<span>Transaction Successful</span>
|
134
|
+
</div>
|
135
|
+
</li>
|
136
|
+
</ul>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
</>
|
140
|
+
);
|
141
|
+
};
|
142
|
+
|
143
|
+
export default ButtonStepper;
|
@@ -0,0 +1,118 @@
|
|
1
|
+
import React from "react";
|
2
|
+
|
3
|
+
const CommonCenterLoader = (css: any) => (
|
4
|
+
<div className={css.text_center}>
|
5
|
+
{/* <img style={{ width: "5em", height: "5em" }} src={window.location.origin + "/images/small-loader.svg"} /> */}
|
6
|
+
<svg
|
7
|
+
style={{
|
8
|
+
margin: "auto",
|
9
|
+
background: "none",
|
10
|
+
display: "block",
|
11
|
+
shapeRendering: "auto",
|
12
|
+
width: "5em",
|
13
|
+
height: "5em",
|
14
|
+
}}
|
15
|
+
viewBox="0 0 100 100"
|
16
|
+
preserveAspectRatio="xMidYMid"
|
17
|
+
>
|
18
|
+
<circle
|
19
|
+
cx="50"
|
20
|
+
cy="50"
|
21
|
+
r="29"
|
22
|
+
stroke-width="5"
|
23
|
+
stroke="#333333"
|
24
|
+
stroke-dasharray="45.553093477052 45.553093477052"
|
25
|
+
fill="none"
|
26
|
+
stroke-linecap="round"
|
27
|
+
>
|
28
|
+
<animateTransform
|
29
|
+
attributeName="transform"
|
30
|
+
type="rotate"
|
31
|
+
dur="1.25s"
|
32
|
+
repeatCount="indefinite"
|
33
|
+
keyTimes="0;1"
|
34
|
+
values="0 50 50;360 50 50"
|
35
|
+
></animateTransform>
|
36
|
+
</circle>
|
37
|
+
<circle
|
38
|
+
cx="50"
|
39
|
+
cy="50"
|
40
|
+
r="23"
|
41
|
+
stroke-width="5"
|
42
|
+
stroke="#555555"
|
43
|
+
stroke-dasharray="36.12831551628262 36.12831551628262"
|
44
|
+
stroke-dashoffset="36.12831551628262"
|
45
|
+
fill="none"
|
46
|
+
stroke-linecap="round"
|
47
|
+
>
|
48
|
+
<animateTransform
|
49
|
+
attributeName="transform"
|
50
|
+
type="rotate"
|
51
|
+
dur="1.25s"
|
52
|
+
repeatCount="indefinite"
|
53
|
+
keyTimes="0;1"
|
54
|
+
values="0 50 50;-360 50 50"
|
55
|
+
></animateTransform>
|
56
|
+
</circle>
|
57
|
+
</svg>
|
58
|
+
</div>
|
59
|
+
);
|
60
|
+
|
61
|
+
export const ButtonLoader = (css: any) => (
|
62
|
+
<div className={css.text_cenetr}>
|
63
|
+
<svg
|
64
|
+
style={{
|
65
|
+
margin: "auto",
|
66
|
+
background: "none",
|
67
|
+
display: "block",
|
68
|
+
shapeRendering: "auto",
|
69
|
+
width: "2.3em",
|
70
|
+
height: "2.3em",
|
71
|
+
}}
|
72
|
+
viewBox="0 0 100 100"
|
73
|
+
preserveAspectRatio="xMidYMid"
|
74
|
+
>
|
75
|
+
<circle
|
76
|
+
cx="50"
|
77
|
+
cy="50"
|
78
|
+
r="29"
|
79
|
+
stroke-width="5"
|
80
|
+
stroke="#333333"
|
81
|
+
stroke-dasharray="45.553093477052 45.553093477052"
|
82
|
+
fill="none"
|
83
|
+
stroke-linecap="round"
|
84
|
+
>
|
85
|
+
<animateTransform
|
86
|
+
attributeName="transform"
|
87
|
+
type="rotate"
|
88
|
+
dur="1.25s"
|
89
|
+
repeatCount="indefinite"
|
90
|
+
keyTimes="0;1"
|
91
|
+
values="0 50 50;360 50 50"
|
92
|
+
></animateTransform>
|
93
|
+
</circle>
|
94
|
+
<circle
|
95
|
+
cx="50"
|
96
|
+
cy="50"
|
97
|
+
r="23"
|
98
|
+
stroke-width="5"
|
99
|
+
stroke="#555555"
|
100
|
+
stroke-dasharray="36.12831551628262 36.12831551628262"
|
101
|
+
stroke-dashoffset="36.12831551628262"
|
102
|
+
fill="none"
|
103
|
+
stroke-linecap="round"
|
104
|
+
>
|
105
|
+
<animateTransform
|
106
|
+
attributeName="transform"
|
107
|
+
type="rotate"
|
108
|
+
dur="1.25s"
|
109
|
+
repeatCount="indefinite"
|
110
|
+
keyTimes="0;1"
|
111
|
+
values="0 50 50;-360 50 50"
|
112
|
+
></animateTransform>
|
113
|
+
</circle>
|
114
|
+
</svg>
|
115
|
+
</div>
|
116
|
+
);
|
117
|
+
|
118
|
+
export default CommonCenterLoader;
|
@@ -0,0 +1,179 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import Select, { components } from "react-select";
|
3
|
+
import MgIcon from "../assets/icons-one.png";
|
4
|
+
import type { CustomOption } from "./types";
|
5
|
+
import css from "../assets/css/style.module.css";
|
6
|
+
|
7
|
+
|
8
|
+
// 👇 Define props for the component
|
9
|
+
interface CustomSelectProps {
|
10
|
+
placeholder?: string;
|
11
|
+
value?: CustomOption | null;
|
12
|
+
backgroundColor?: string;
|
13
|
+
borderColor?: string;
|
14
|
+
color?: string;
|
15
|
+
svgFill?: string;
|
16
|
+
image?: boolean;
|
17
|
+
singleicons?: boolean;
|
18
|
+
options: CustomOption[];
|
19
|
+
onChange?: (selected: CustomOption | null) => void;
|
20
|
+
isClearable?: boolean;
|
21
|
+
isDisabled?: boolean;
|
22
|
+
isSearchable?: boolean;
|
23
|
+
onBlur?: () => void;
|
24
|
+
onKeyDown?: React.KeyboardEventHandler;
|
25
|
+
onInputChange?: (inputValue: string, meta: { action: string }) => void;
|
26
|
+
}
|
27
|
+
|
28
|
+
// 👇 Main Component
|
29
|
+
const CustomSelect: React.FC<CustomSelectProps> = ({
|
30
|
+
placeholder,
|
31
|
+
value,
|
32
|
+
backgroundColor = "#fff",
|
33
|
+
borderColor = "var(--no-color)",
|
34
|
+
color = "#000",
|
35
|
+
svgFill = "#333",
|
36
|
+
image,
|
37
|
+
singleicons,
|
38
|
+
options,
|
39
|
+
onChange,
|
40
|
+
isClearable,
|
41
|
+
isDisabled,
|
42
|
+
isSearchable,
|
43
|
+
onBlur,
|
44
|
+
onKeyDown,
|
45
|
+
onInputChange,
|
46
|
+
}) => {
|
47
|
+
const customStyles = {
|
48
|
+
menuPortal: (provided: any) => ({ ...provided, zIndex: 9999 }),
|
49
|
+
menu: (provided: any) => ({
|
50
|
+
...provided,
|
51
|
+
zIndex: 9999,
|
52
|
+
left: "0px",
|
53
|
+
borderRadius: "4px",
|
54
|
+
overflow: "hidden",
|
55
|
+
}),
|
56
|
+
menuList: (provided: any) => ({
|
57
|
+
...provided,
|
58
|
+
padding: 0,
|
59
|
+
minWidth: 250,
|
60
|
+
fontSize: "0.95em",
|
61
|
+
"&::-webkit-scrollbar-track": {
|
62
|
+
boxShadow: "inset 0 0 6px rgba(0,0,0,0.3)",
|
63
|
+
borderRadius: "3px",
|
64
|
+
backgroundColor: "#fff",
|
65
|
+
},
|
66
|
+
"&::-webkit-scrollbar": {
|
67
|
+
width: "4px",
|
68
|
+
backgroundColor: "#fff",
|
69
|
+
},
|
70
|
+
"&::-webkit-scrollbar-thumb": {
|
71
|
+
borderRadius: "3px",
|
72
|
+
boxShadow: "inset 0 0 6px rgba(0, 0, 0, .3)",
|
73
|
+
backgroundColor: "#555",
|
74
|
+
},
|
75
|
+
}),
|
76
|
+
container: (provided: any) => ({ ...provided, width: "auto" }),
|
77
|
+
control: (provided: any) => ({
|
78
|
+
...provided,
|
79
|
+
padding: 0,
|
80
|
+
backgroundColor: backgroundColor,
|
81
|
+
border: `1px solid ${borderColor}!important`,
|
82
|
+
borderRadius: "8px!important",
|
83
|
+
boxShadow: "none!important",
|
84
|
+
height: "42px",
|
85
|
+
display: "flex",
|
86
|
+
alignItems: "center",
|
87
|
+
alignItemsContent: "center",
|
88
|
+
cursor: "pointer",
|
89
|
+
fontSize: "0.85em",
|
90
|
+
}),
|
91
|
+
placeholder: (provided: any) => ({
|
92
|
+
...provided,
|
93
|
+
color: color,
|
94
|
+
fontSize: "1.2em",
|
95
|
+
fontWeight: "600",
|
96
|
+
}),
|
97
|
+
singleValue: (provided: any) => ({
|
98
|
+
...provided,
|
99
|
+
color: "#000",
|
100
|
+
display: "flex",
|
101
|
+
alignItems: "center",
|
102
|
+
gap: "1em",
|
103
|
+
fontSize: "1.2em",
|
104
|
+
fontWeight: "600",
|
105
|
+
}),
|
106
|
+
indicatorContainer: (provided: any) => ({
|
107
|
+
...provided,
|
108
|
+
color: "#000!important",
|
109
|
+
}),
|
110
|
+
indicatorSeparator: (base: any) => ({
|
111
|
+
...base,
|
112
|
+
display: "none",
|
113
|
+
}),
|
114
|
+
dropdownIndicator: (provided: any) => ({
|
115
|
+
...provided,
|
116
|
+
svg: {
|
117
|
+
fill: svgFill,
|
118
|
+
stroke: "#333",
|
119
|
+
},
|
120
|
+
}),
|
121
|
+
option: (provided: any, state: any) => ({
|
122
|
+
...provided,
|
123
|
+
display: "flex",
|
124
|
+
alignItems: "center",
|
125
|
+
gap: "1em",
|
126
|
+
backgroundColor: state.isSelected ? "#8B5CF6" : state.isFocused ? "#f0f0f0" : "transparent",
|
127
|
+
color: state.isSelected || state.isFocused ? "#000" : "#000",
|
128
|
+
":hover": {
|
129
|
+
backgroundColor: "#f0f0f0",
|
130
|
+
color: "#000",
|
131
|
+
},
|
132
|
+
}),
|
133
|
+
};
|
134
|
+
|
135
|
+
const Option = (props: any) => {
|
136
|
+
return (
|
137
|
+
<components.Option {...props} className={css.ramp_option}>
|
138
|
+
{image && <img src={props.data.icon || MgIcon} alt="logo" className={css.ramp_modal_img}/>}
|
139
|
+
{props.data.label}
|
140
|
+
</components.Option>
|
141
|
+
);
|
142
|
+
};
|
143
|
+
|
144
|
+
// 👇 Custom SingleValue Component
|
145
|
+
const SingleValue = (props: any) => {
|
146
|
+
return (
|
147
|
+
<components.SingleValue {...props}>
|
148
|
+
{singleicons && (
|
149
|
+
<img
|
150
|
+
src={props.data.icon || window.location.origin + "/img/icons-one.png"}
|
151
|
+
alt="s-logo"
|
152
|
+
className={css.ramp_modal_img}
|
153
|
+
/>
|
154
|
+
)}
|
155
|
+
{props.children}
|
156
|
+
</components.SingleValue>
|
157
|
+
);
|
158
|
+
};
|
159
|
+
|
160
|
+
return (
|
161
|
+
<Select
|
162
|
+
value={value}
|
163
|
+
options={options}
|
164
|
+
styles={customStyles}
|
165
|
+
placeholder={placeholder || "Select an option"}
|
166
|
+
isClearable={isClearable}
|
167
|
+
isSearchable={isSearchable}
|
168
|
+
onChange={onChange}
|
169
|
+
components={{ Option, SingleValue }}
|
170
|
+
onBlur={onBlur}
|
171
|
+
isDisabled={isDisabled}
|
172
|
+
onKeyDown={onKeyDown}
|
173
|
+
onInputChange={onInputChange}
|
174
|
+
// menuPortalTarget={document.body}
|
175
|
+
/>
|
176
|
+
);
|
177
|
+
};
|
178
|
+
|
179
|
+
export default CustomSelect;
|