herald-exchange-onramp_offramp-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.
Files changed (37) hide show
  1. package/.babelrc +3 -0
  2. package/Readme.md +166 -0
  3. package/dist/index.css +1 -0
  4. package/dist/index.d.ts +24 -0
  5. package/dist/index.js +47 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +47 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +59 -0
  10. package/rollup.config.js +90 -0
  11. package/src/assets/css/style.module.css +1435 -0
  12. package/src/assets/icons-one.png +0 -0
  13. package/src/assets/react.svg +1 -0
  14. package/src/components/ButtonStepper.tsx +144 -0
  15. package/src/components/BuyField.tsx +632 -0
  16. package/src/components/CommonCenterLoader.tsx +119 -0
  17. package/src/components/CustomeSelect.tsx +180 -0
  18. package/src/components/DotLoader.tsx +8 -0
  19. package/src/components/NewBuyField.tsx +687 -0
  20. package/src/components/SellAdminCryptoAccount.tsx +601 -0
  21. package/src/components/SellField.tsx +712 -0
  22. package/src/components/WidgetBankDetails.tsx +612 -0
  23. package/src/components/WidgetComponent.tsx +49 -0
  24. package/src/components/WidgetContent.tsx +71 -0
  25. package/src/components/WidgetSuccesDetails.tsx +113 -0
  26. package/src/components/api.ts +59 -0
  27. package/src/components/chains.ts +319 -0
  28. package/src/components/images.d.ts +5 -0
  29. package/src/components/loader.tsx +14 -0
  30. package/src/components/style.module.css.d.ts +4 -0
  31. package/src/components/toast.tsx +51 -0
  32. package/src/components/types.ts +237 -0
  33. package/src/components/utils.ts +17 -0
  34. package/src/hooks/toastProvider.tsx +64 -0
  35. package/src/hooks/useSocketExchange.tsx +48 -0
  36. package/src/index.ts +3 -0
  37. package/tsconfig.json +118 -0
@@ -0,0 +1,119 @@
1
+ import React from "react";
2
+ import styles from "../assets/css/style.module.css";
3
+
4
+ const CommonCenterLoader = () => (
5
+ <div className={styles.text_center}>
6
+ {/* <img style={{ width: "5em", height: "5em" }} src={window.location.origin + "/images/small-loader.svg"} /> */}
7
+ <svg
8
+ style={{
9
+ margin: "auto",
10
+ background: "none",
11
+ display: "block",
12
+ shapeRendering: "auto",
13
+ width: "5em",
14
+ height: "5em",
15
+ }}
16
+ viewBox="0 0 100 100"
17
+ preserveAspectRatio="xMidYMid"
18
+ >
19
+ <circle
20
+ cx="50"
21
+ cy="50"
22
+ r="29"
23
+ stroke-width="5"
24
+ stroke="#333333"
25
+ stroke-dasharray="45.553093477052 45.553093477052"
26
+ fill="none"
27
+ stroke-linecap="round"
28
+ >
29
+ <animateTransform
30
+ attributeName="transform"
31
+ type="rotate"
32
+ dur="1.25s"
33
+ repeatCount="indefinite"
34
+ keyTimes="0;1"
35
+ values="0 50 50;360 50 50"
36
+ ></animateTransform>
37
+ </circle>
38
+ <circle
39
+ cx="50"
40
+ cy="50"
41
+ r="23"
42
+ stroke-width="5"
43
+ stroke="#555555"
44
+ stroke-dasharray="36.12831551628262 36.12831551628262"
45
+ stroke-dashoffset="36.12831551628262"
46
+ fill="none"
47
+ stroke-linecap="round"
48
+ >
49
+ <animateTransform
50
+ attributeName="transform"
51
+ type="rotate"
52
+ dur="1.25s"
53
+ repeatCount="indefinite"
54
+ keyTimes="0;1"
55
+ values="0 50 50;-360 50 50"
56
+ ></animateTransform>
57
+ </circle>
58
+ </svg>
59
+ </div>
60
+ );
61
+
62
+ export const ButtonLoader = () => (
63
+ <div className={styles.text_center}>
64
+ <svg
65
+ style={{
66
+ margin: "auto",
67
+ background: "none",
68
+ display: "block",
69
+ shapeRendering: "auto",
70
+ width: "2.3em",
71
+ height: "2.3em",
72
+ }}
73
+ viewBox="0 0 100 100"
74
+ preserveAspectRatio="xMidYMid"
75
+ >
76
+ <circle
77
+ cx="50"
78
+ cy="50"
79
+ r="29"
80
+ stroke-width="5"
81
+ stroke="#333333"
82
+ stroke-dasharray="45.553093477052 45.553093477052"
83
+ fill="none"
84
+ stroke-linecap="round"
85
+ >
86
+ <animateTransform
87
+ attributeName="transform"
88
+ type="rotate"
89
+ dur="1.25s"
90
+ repeatCount="indefinite"
91
+ keyTimes="0;1"
92
+ values="0 50 50;360 50 50"
93
+ ></animateTransform>
94
+ </circle>
95
+ <circle
96
+ cx="50"
97
+ cy="50"
98
+ r="23"
99
+ stroke-width="5"
100
+ stroke="#555555"
101
+ stroke-dasharray="36.12831551628262 36.12831551628262"
102
+ stroke-dashoffset="36.12831551628262"
103
+ fill="none"
104
+ stroke-linecap="round"
105
+ >
106
+ <animateTransform
107
+ attributeName="transform"
108
+ type="rotate"
109
+ dur="1.25s"
110
+ repeatCount="indefinite"
111
+ keyTimes="0;1"
112
+ values="0 50 50;-360 50 50"
113
+ ></animateTransform>
114
+ </circle>
115
+ </svg>
116
+ </div>
117
+ );
118
+
119
+ export default CommonCenterLoader;
@@ -0,0 +1,180 @@
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 styles from "../assets/css/style.module.css";
6
+
7
+ // 👇 Define props for the component
8
+ interface CustomSelectProps {
9
+ placeholder?: string;
10
+ value?: CustomOption | null;
11
+ backgroundColor?: string;
12
+ borderColor?: string;
13
+ color?: string;
14
+ svgFill?: string;
15
+ image?: boolean;
16
+ singleicons?: boolean;
17
+ options: CustomOption[];
18
+ onChange?: (selected: CustomOption | null) => void;
19
+ isClearable?: boolean;
20
+ isDisabled?: boolean;
21
+ isSearchable?: boolean;
22
+ onBlur?: () => void;
23
+ onKeyDown?: React.KeyboardEventHandler;
24
+ onInputChange?: (inputValue: string, meta: { action: string }) => void;
25
+ }
26
+
27
+ // 👇 Main Component
28
+ const CustomSelect: React.FC<CustomSelectProps> = ({
29
+ placeholder,
30
+ value,
31
+ backgroundColor = "#fff",
32
+ borderColor = "var(--no-color)",
33
+ color = "#000",
34
+ svgFill = "#333",
35
+ image,
36
+ singleicons,
37
+ options,
38
+ onChange,
39
+ isClearable,
40
+ isDisabled,
41
+ isSearchable,
42
+ onBlur,
43
+ onKeyDown,
44
+ onInputChange,
45
+ }) => {
46
+ const customStyles = {
47
+ menuPortal: (provided: any) => ({ ...provided, zIndex: 9999 }),
48
+ menu: (provided: any) => ({
49
+ ...provided,
50
+ zIndex: 9999,
51
+ left: "0px",
52
+ borderRadius: "4px",
53
+ overflow: "hidden",
54
+ }),
55
+ menuList: (provided: any) => ({
56
+ ...provided,
57
+ padding: 0,
58
+ minWidth: 250,
59
+ fontSize: "0.95em",
60
+ "&::-webkit-scrollbar-track": {
61
+ boxShadow: "inset 0 0 6px rgba(0,0,0,0.3)",
62
+ borderRadius: "3px",
63
+ backgroundColor: "#fff",
64
+ },
65
+ "&::-webkit-scrollbar": {
66
+ width: "4px",
67
+ backgroundColor: "#fff",
68
+ },
69
+ "&::-webkit-scrollbar-thumb": {
70
+ borderRadius: "3px",
71
+ boxShadow: "inset 0 0 6px rgba(0, 0, 0, .3)",
72
+ backgroundColor: "#555",
73
+ },
74
+ }),
75
+ container: (provided: any) => ({ ...provided, width: "auto" }),
76
+ control: (provided: any) => ({
77
+ ...provided,
78
+ padding: 0,
79
+ backgroundColor: backgroundColor,
80
+ border: `1px solid ${borderColor}!important`,
81
+ borderRadius: "8px!important",
82
+ boxShadow: "none!important",
83
+ height: "42px",
84
+ display: "flex",
85
+ alignItems: "center",
86
+ alignItemsContent: "center",
87
+ cursor: "pointer",
88
+ fontSize: "0.85em",
89
+ }),
90
+ placeholder: (provided: any) => ({
91
+ ...provided,
92
+ color: color,
93
+ fontSize: "1.2em",
94
+ fontWeight: "600",
95
+ }),
96
+ singleValue: (provided: any) => ({
97
+ ...provided,
98
+ color: "#000",
99
+ display: "flex",
100
+ alignItems: "center",
101
+ gap: "1em",
102
+ fontSize: "1.2em",
103
+ fontWeight: "600",
104
+ }),
105
+ indicatorContainer: (provided: any) => ({
106
+ ...provided,
107
+ color: "#000!important",
108
+ }),
109
+ indicatorSeparator: (base: any) => ({
110
+ ...base,
111
+ display: "none",
112
+ }),
113
+ dropdownIndicator: (provided: any) => ({
114
+ ...provided,
115
+ svg: {
116
+ fill: svgFill,
117
+ stroke: "#333",
118
+ },
119
+ }),
120
+ option: (provided: any, state: any) => ({
121
+ ...provided,
122
+ display: "flex",
123
+ alignItems: "center",
124
+ gap: "1em",
125
+ backgroundColor: state.isSelected ? "#F9C201" : state.isFocused ? "#f0f0f0" : "transparent",
126
+ color: state.isSelected || state.isFocused ? "#000" : "#000",
127
+ ":hover": {
128
+ backgroundColor: "#f0f0f0",
129
+ color: "#000",
130
+ },
131
+ }),
132
+ };
133
+
134
+ const Option = (props: any) => {
135
+ return (
136
+ <components.Option {...props} className={styles.ramp_option}>
137
+ {image && (
138
+ <img src={props.data.icon || MgIcon} alt="logo" className={styles.ramp_modal_img} />
139
+ )}
140
+ {props.data.label}
141
+ </components.Option>
142
+ );
143
+ };
144
+
145
+ // 👇 Custom SingleValue Component
146
+ const SingleValue = (props: any) => {
147
+ return (
148
+ <components.SingleValue {...props}>
149
+ {singleicons && (
150
+ <img
151
+ src={props.data.icon || window.location.origin + "/img/icons-one.png"}
152
+ alt="s-logo"
153
+ className={styles.ramp_modal_img}
154
+ />
155
+ )}
156
+ {props.children}
157
+ </components.SingleValue>
158
+ );
159
+ };
160
+
161
+ return (
162
+ <Select
163
+ value={value}
164
+ options={options}
165
+ styles={customStyles}
166
+ placeholder={placeholder || "Select an option"}
167
+ isClearable={isClearable}
168
+ isSearchable={isSearchable}
169
+ onChange={onChange}
170
+ components={{ Option, SingleValue }}
171
+ onBlur={onBlur}
172
+ isDisabled={isDisabled}
173
+ onKeyDown={onKeyDown}
174
+ onInputChange={onInputChange}
175
+ // menuPortalTarget={document.body}
176
+ />
177
+ );
178
+ };
179
+
180
+ export default CustomSelect;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import styles from "../assets/css/style.module.css";
3
+
4
+ const DotLoader = ({ size }: { size?: number }) => {
5
+ return <div style={{ width: size ? size : 20 }} className={styles.dot_loader}></div>;
6
+ };
7
+
8
+ export default DotLoader;