@onekeyfe/inpage-providers-hub 2.2.0 → 2.2.2
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/floatingButton/index.js +130 -103
- package/dist/floatingButton/index.d.ts +1 -1
- package/dist/floatingButton/index.js +131 -104
- package/package.json +22 -22
|
@@ -18,24 +18,24 @@ const images_1 = require("./images");
|
|
|
18
18
|
let isInjected = false;
|
|
19
19
|
let i18n = {};
|
|
20
20
|
const logoStyle = {
|
|
21
|
-
width: '
|
|
22
|
-
height: '
|
|
21
|
+
width: '24px',
|
|
22
|
+
height: '24px',
|
|
23
23
|
};
|
|
24
24
|
const textStyle = {
|
|
25
25
|
color: 'rgba(0, 0, 0, 0.61)',
|
|
26
|
-
fontSize: '
|
|
26
|
+
fontSize: '14px',
|
|
27
27
|
marginLeft: '8px',
|
|
28
28
|
};
|
|
29
29
|
const containerId = 'onekey-floating-widget';
|
|
30
|
-
const
|
|
30
|
+
const removeIcon = () => {
|
|
31
31
|
var _a;
|
|
32
32
|
(_a = document.getElementById(containerId)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
33
|
+
isInjected = false;
|
|
33
34
|
};
|
|
34
35
|
const useOutsideClick = (ref, callback) => {
|
|
35
36
|
(0, hooks_1.useEffect)(() => {
|
|
36
37
|
const handleClickOutside = (event) => {
|
|
37
|
-
if (ref.current &&
|
|
38
|
-
!ref.current.contains(event.target)) {
|
|
38
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
39
39
|
callback();
|
|
40
40
|
}
|
|
41
41
|
};
|
|
@@ -52,40 +52,46 @@ function CloseDialog({ onClose }) {
|
|
|
52
52
|
void globalThis.$onekey.$private.request({
|
|
53
53
|
method: 'wallet_disableFloatingButton',
|
|
54
54
|
});
|
|
55
|
-
|
|
55
|
+
removeIcon();
|
|
56
56
|
}, []);
|
|
57
57
|
const handleHideOnSite = (0, hooks_1.useCallback)(() => {
|
|
58
58
|
void globalThis.$onekey.$private.request({
|
|
59
59
|
method: 'wallet_hideFloatingButtonOnSite',
|
|
60
60
|
params: { url: window.location.origin },
|
|
61
61
|
});
|
|
62
|
-
|
|
62
|
+
removeIcon();
|
|
63
63
|
}, []);
|
|
64
64
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
display: 'flex',
|
|
66
|
+
flexDirection: 'column',
|
|
67
|
+
gap: '8px',
|
|
68
|
+
padding: '12px',
|
|
67
69
|
position: 'absolute',
|
|
68
|
-
right: '
|
|
69
|
-
|
|
70
|
-
top: '
|
|
71
|
-
width: '
|
|
72
|
-
borderRadius: '
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
right: '100%',
|
|
71
|
+
background: '#fff',
|
|
72
|
+
top: '40px',
|
|
73
|
+
width: '196px',
|
|
74
|
+
borderRadius: '12px',
|
|
75
|
+
boxShadow: '0px 0px 0px 1px rgba(0, 0, 0, 0.05),0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',
|
|
76
|
+
color: 'rgba(0, 0, 0, 1)',
|
|
77
|
+
fontSize: '12px',
|
|
78
|
+
lineHeight: '16px',
|
|
79
|
+
}, ref: dialogRef, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
80
|
+
display: 'flex',
|
|
81
|
+
alignItems: 'center',
|
|
77
82
|
cursor: 'pointer',
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
fontSize: '12px',
|
|
83
|
-
fontWeight: '400',
|
|
83
|
+
gap: '8px',
|
|
84
|
+
}, onClick: handleHideOnSite, children: [(0, jsx_runtime_1.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M2.29312 2.2929C2.68364 1.90237 3.31681 1.90237 3.70734 2.29289L7.35069 5.9362L21.7073 20.2929C22.0979 20.6834 22.0979 21.3166 21.7073 21.7071C21.3168 22.0976 20.6836 22.0976 20.2931 21.7071L17.2031 18.617C14.684 20.0216 11.8704 20.363 9.19337 19.6107C6.27083 18.7893 3.59188 16.6894 1.6441 13.4178C1.12514 12.5461 1.12292 11.4579 1.64298 10.5841C2.63083 8.92441 3.8063 7.56606 5.10844 6.52239L2.29313 3.70711C1.9026 3.31659 1.9026 2.68342 2.29312 2.2929ZM6.53283 7.94678L7.41812 8.8321L8.5542 9.96818C8.20253 10.5636 8.00023 11.2586 8.00023 12C8.00023 14.2091 9.79109 16 12.0002 16C12.7416 16 13.4366 15.7977 14.0321 15.446L15.7203 17.1343C13.7862 18.0642 11.7083 18.24 9.73447 17.6852C7.37839 17.0231 5.08952 15.2953 3.36259 12.3947C3.21773 12.1514 3.21796 11.8483 3.36159 11.607C4.28389 10.0575 5.36713 8.84257 6.53283 7.94678ZM12.5184 13.9324L10.0678 11.4818C10.0237 11.647 10.0002 11.8207 10.0002 12C10.0002 13.1046 10.8957 14 12.0002 14C12.1796 14 12.3532 13.9765 12.5184 13.9324ZM20.6388 11.6068C18.1001 7.34166 14.3527 5.6013 10.8782 6.07652C10.331 6.15137 9.82679 5.76845 9.75195 5.22126C9.67711 4.67407 10.06 4.16981 10.6072 4.09497C15.0162 3.49193 19.4849 5.75792 22.3574 10.5838C22.8767 11.4564 22.8771 12.5429 22.3576 13.4157C21.9613 14.0815 21.535 14.6987 21.0823 15.2666C20.738 15.6985 20.1088 15.7695 19.677 15.4253C19.2451 15.081 19.1741 14.4519 19.5183 14.02C19.9123 13.5257 20.2873 12.9836 20.6389 12.3928C20.7831 12.1507 20.7831 11.8493 20.6388 11.6068Z", fill: "rgba(0, 0, 0, 0.61)" }) }), (0, jsx_runtime_1.jsx)("div", { children: i18n.hideOnThisSite })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
85
|
+
display: 'flex',
|
|
86
|
+
alignItems: 'center',
|
|
84
87
|
cursor: 'pointer',
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
gap: '8px',
|
|
89
|
+
}, onClick: handleDisable, children: [(0, jsx_runtime_1.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M12 4C7.58172 4 4 7.58172 4 12C4 13.8491 4.62644 15.5506 5.68009 16.9057L16.9057 5.68009C15.5506 4.62644 13.8491 4 12 4ZM18.3199 7.0943L7.0943 18.3199C8.44939 19.3736 10.1509 20 12 20C16.4183 20 20 16.4183 20 12C20 10.1509 19.3736 8.44939 18.3199 7.0943ZM2 12C2 6.47715 6.47715 2 12 2C14.7611 2 17.2625 3.12038 19.0711 4.92893C20.8796 6.73748 22 9.23885 22 12C22 17.5228 17.5228 22 12 22C9.23885 22 6.73748 20.8796 4.92893 19.0711C3.12038 17.2625 2 14.7611 2 12Z", fill: "rgba(0, 0, 0, 0.61)" }) }), (0, jsx_runtime_1.jsx)("div", { children: i18n.disable })] }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
90
|
+
color: 'rgba(0, 0, 0, 0.61)',
|
|
91
|
+
fontSize: '12px',
|
|
92
|
+
lineHeight: '16px',
|
|
93
|
+
paddingTop: '8px',
|
|
94
|
+
borderTop: '1px solid rgba(0, 0, 0, 0.05)',
|
|
89
95
|
}, children: i18n.canBeReEnabledInSettings })] }));
|
|
90
96
|
}
|
|
91
97
|
function IconButton({ isExpanded, onClick, dataLoaded, isShowCloseDialog, showCloseDialog, }) {
|
|
@@ -93,10 +99,8 @@ function IconButton({ isExpanded, onClick, dataLoaded, isShowCloseDialog, showCl
|
|
|
93
99
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
94
100
|
display: 'flex',
|
|
95
101
|
alignItems: 'center',
|
|
96
|
-
width: '184px',
|
|
97
102
|
position: 'relative',
|
|
98
103
|
cursor: 'pointer',
|
|
99
|
-
padding: '8px',
|
|
100
104
|
}, onMouseEnter: () => {
|
|
101
105
|
if (isExpanded || isShowCloseDialog) {
|
|
102
106
|
return;
|
|
@@ -108,32 +112,36 @@ function IconButton({ isExpanded, onClick, dataLoaded, isShowCloseDialog, showCl
|
|
|
108
112
|
}
|
|
109
113
|
setIsShowCloseButton(false);
|
|
110
114
|
onClick();
|
|
111
|
-
}, children: [(0, jsx_runtime_1.jsx)(images_1.Logo, { style: logoStyle }), !dataLoaded && (
|
|
115
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', padding: '8px' }, children: [(0, jsx_runtime_1.jsx)(images_1.Logo, { style: logoStyle }), !dataLoaded && (0, jsx_runtime_1.jsx)("span", { style: textStyle, children: isExpanded ? i18n.fetchingDAppInfo : '' })] }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
116
|
+
display: 'flex',
|
|
117
|
+
padding: '$4',
|
|
112
118
|
position: 'absolute',
|
|
113
|
-
left: '
|
|
119
|
+
left: '-6px',
|
|
114
120
|
bottom: '-10px',
|
|
121
|
+
transition: 'all 150ms cubic-bezier(0.4, 0, 0.2, 1)',
|
|
115
122
|
opacity: showCloseButton ? 1 : 0,
|
|
123
|
+
borderRadius: '9999px',
|
|
124
|
+
backgroundColor: '#fff',
|
|
125
|
+
border: '1px solid rgba(0, 0, 0, 0.1)',
|
|
116
126
|
}, onClick: (event) => {
|
|
117
127
|
event.stopPropagation();
|
|
118
128
|
setIsShowCloseButton(false);
|
|
119
129
|
showCloseDialog();
|
|
120
|
-
}, children: (0, jsx_runtime_1.jsx)("svg", { width: "
|
|
130
|
+
}, children: (0, jsx_runtime_1.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M7.29289 7.29289C7.68342 6.90237 8.31658 6.90237 8.70711 7.29289L12 10.5858L15.2929 7.29289C15.6834 6.90237 16.3166 6.90237 16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711L13.4142 12L16.7071 15.2929C17.0976 15.6834 17.0976 16.3166 16.7071 16.7071C16.3166 17.0976 15.6834 17.0976 15.2929 16.7071L12 13.4142L8.70711 16.7071C8.31658 17.0976 7.68342 17.0976 7.29289 16.7071C6.90237 16.3166 6.90237 15.6834 7.29289 15.2929L10.5858 12L7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289Z", fill: "rgba(0, 0, 0, 0.61)" }) }) })] }));
|
|
121
131
|
}
|
|
122
|
-
function SecurityInfoRow({ title, children
|
|
132
|
+
function SecurityInfoRow({ title, children }) {
|
|
123
133
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
124
134
|
display: 'flex',
|
|
125
|
-
height: '16px',
|
|
126
135
|
flexDirection: 'row',
|
|
127
136
|
justifyContent: 'space-between',
|
|
128
137
|
alignItems: 'center',
|
|
129
|
-
padding: '0 8px',
|
|
130
138
|
}, children: [(0, jsx_runtime_1.jsx)("span", { style: {
|
|
131
139
|
color: 'rgba(0, 0, 0, 0.61)',
|
|
132
|
-
|
|
133
|
-
|
|
140
|
+
fontSize: '12px',
|
|
141
|
+
lineHeight: '16px',
|
|
134
142
|
}, children: title }), children] }));
|
|
135
143
|
}
|
|
136
|
-
function SecurityRiskDetectionRow({ securityInfo
|
|
144
|
+
function SecurityRiskDetectionRow({ securityInfo }) {
|
|
137
145
|
const { securityElement, securityStatus } = (0, hooks_1.useMemo)(() => {
|
|
138
146
|
const security = (securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.checkSources.filter((item) => item.riskLevel === type_1.EHostSecurityLevel.Security).map((item) => item.name).join(' & ')) || '';
|
|
139
147
|
if (security) {
|
|
@@ -142,8 +150,9 @@ function SecurityRiskDetectionRow({ securityInfo, }) {
|
|
|
142
150
|
securityElement: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { style: {
|
|
143
151
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
144
152
|
fontWeight: '500',
|
|
145
|
-
fontSize: '
|
|
146
|
-
|
|
153
|
+
fontSize: '12px',
|
|
154
|
+
lineHeight: '16px',
|
|
155
|
+
}, children: i18n.verifiedSite }), (0, jsx_runtime_1.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { width: "16", height: "16", viewBox: "0 0 24 24", d: "M10.4673 2.69869C11.2767 1.76711 12.7232 1.7671 13.5326 2.69868L14.8908 4.26193C14.8977 4.26983 14.9082 4.27364 14.9185 4.272L16.9638 3.94755C18.1827 3.7542 19.2907 4.68395 19.3119 5.91786L19.3476 7.98845C19.3478 7.99891 19.3533 8.00854 19.3623 8.01393L21.1377 9.08009C22.1956 9.71544 22.4468 11.1399 21.6699 12.0988L20.3663 13.7079C20.3597 13.716 20.3578 13.7269 20.3612 13.7368L21.0359 15.6947C21.4379 16.8615 20.7147 18.1142 19.5032 18.3493L17.4703 18.744C17.46 18.746 17.4515 18.7531 17.4478 18.7629L16.7061 20.6964C16.2641 21.8487 14.9049 22.3434 13.8257 21.7448L12.0147 20.7404C12.0055 20.7353 11.9944 20.7353 11.9852 20.7404L10.1742 21.7448C9.09503 22.3434 7.73582 21.8487 7.29383 20.6964L6.55216 18.7629C6.54841 18.7531 6.53989 18.746 6.52962 18.744L4.49668 18.3493C3.2852 18.1142 2.56198 16.8615 2.96404 15.6947L3.63873 13.7368C3.64214 13.7269 3.64021 13.716 3.63362 13.7079L2.32998 12.0988C1.55311 11.1399 1.80428 9.71544 2.86226 9.08009L4.63762 8.01393C4.64659 8.00854 4.65215 7.99891 4.65233 7.98845L4.68797 5.91786C4.70921 4.68395 5.81725 3.7542 7.0361 3.94755L9.08142 4.272C9.09176 4.27364 9.10221 4.26983 9.10907 4.26193L10.4673 2.69869ZM15.2071 11.2071C15.5976 10.8166 15.5976 10.1834 15.2071 9.79289C14.8166 9.40237 14.1834 9.40237 13.7929 9.79289L11 12.5858L10.2071 11.7929C9.81655 11.4024 9.18339 11.4024 8.79286 11.7929C8.40234 12.1834 8.40234 12.8166 8.79286 13.2071L9.93931 14.3536C10.5251 14.9393 11.4748 14.9393 12.0606 14.3536L15.2071 11.2071Z", fill: "#006B3B", fillOpacity: "0.906" }) })] })),
|
|
147
156
|
};
|
|
148
157
|
}
|
|
149
158
|
const highSecurity = (securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.checkSources.filter((item) => item.riskLevel === type_1.EHostSecurityLevel.High).map((item) => item.name).join(' & ')) || '';
|
|
@@ -153,7 +162,8 @@ function SecurityRiskDetectionRow({ securityInfo, }) {
|
|
|
153
162
|
securityElement: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { style: {
|
|
154
163
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
155
164
|
fontWeight: '500',
|
|
156
|
-
fontSize: '
|
|
165
|
+
fontSize: '12px',
|
|
166
|
+
lineHeight: '16px',
|
|
157
167
|
}, children: i18n.maliciousSiteWarning }), (0, jsx_runtime_1.jsx)("svg", { width: "18", height: "16", viewBox: "0 0 18 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M6.83981 2.21151C7.8045 0.557753 10.194 0.557748 11.1587 2.21151L17.007 12.2371C17.9792 13.9038 16.777 15.9968 14.8475 15.9968H3.15098C1.22151 15.9968 0.0193263 13.9038 0.991535 12.2371L6.83981 2.21151ZM9.00008 5.99683C9.46032 5.99683 9.83342 6.36992 9.83342 6.83016V9.33016C9.83342 9.7904 9.46032 10.1635 9.00008 10.1635C8.53984 10.1635 8.16675 9.7904 8.16675 9.33016V6.83016C8.16675 6.36992 8.53984 5.99683 9.00008 5.99683ZM7.95842 11.8302C7.95842 11.2549 8.42478 10.7885 9.00008 10.7885C9.57538 10.7885 10.0417 11.2549 10.0417 11.8302C10.0417 12.4055 9.57538 12.8718 9.00008 12.8718C8.42478 12.8718 7.95842 12.4055 7.95842 11.8302Z", fill: "#BB0007", fillOpacity: "0.836" }) })] })),
|
|
158
168
|
};
|
|
159
169
|
}
|
|
@@ -164,7 +174,8 @@ function SecurityRiskDetectionRow({ securityInfo, }) {
|
|
|
164
174
|
securityElement: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { style: {
|
|
165
175
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
166
176
|
fontWeight: '500',
|
|
167
|
-
fontSize: '
|
|
177
|
+
fontSize: '12px',
|
|
178
|
+
lineHeight: '16px',
|
|
168
179
|
}, children: i18n.suspectedMaliciousBehavior }), (0, jsx_runtime_1.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.96786 0.159913C3.52858 0.159899 3.14962 0.159886 2.83748 0.185389C2.50802 0.212306 2.18034 0.271736 1.86503 0.432398C1.39462 0.672081 1.01217 1.05453 0.772486 1.52494C0.611824 1.84025 0.552394 2.16794 0.525477 2.49739C0.499974 2.80953 0.499986 3.18849 0.500001 3.62776V11.692C0.499986 12.1313 0.499974 12.5103 0.525477 12.8224C0.552394 13.1519 0.611824 13.4796 0.772486 13.7949C1.01217 14.2653 1.39462 14.6477 1.86503 14.8874C2.18034 15.0481 2.50802 15.1075 2.83748 15.1344C3.14962 15.1599 3.52858 15.1599 3.96786 15.1599H12.0321C12.4714 15.1599 12.8504 15.1599 13.1625 15.1344C13.492 15.1075 13.8197 15.0481 14.135 14.8874C14.6054 14.6477 14.9878 14.2653 15.2275 13.7949C15.3882 13.4796 15.4476 13.1519 15.4745 12.8224C15.5 12.5103 15.5 12.1313 15.5 11.6921V3.62778C15.5 3.18849 15.5 2.80953 15.4745 2.49739C15.4476 2.16794 15.3882 1.84025 15.2275 1.52494C14.9878 1.05453 14.6054 0.672081 14.135 0.432398C13.8197 0.271736 13.492 0.212306 13.1625 0.185389C12.8504 0.159886 12.4714 0.159899 12.0322 0.159913H3.96786ZM6.33333 6.82658C6.33333 6.36634 6.70643 5.99325 7.16667 5.99325H8C8.46024 5.99325 8.83333 6.36634 8.83333 6.82658V10.9932C8.83333 11.4535 8.46024 11.8266 8 11.8266C7.53976 11.8266 7.16667 11.4535 7.16667 10.9932V7.65991C6.70643 7.65991 6.33333 7.28682 6.33333 6.82658ZM8 3.49325C7.53976 3.49325 7.16667 3.86634 7.16667 4.32658C7.16667 4.78682 7.53976 5.15991 8 5.15991C8.46024 5.15991 8.83333 4.78682 8.83333 4.32658C8.83333 3.86634 8.46024 3.49325 8 3.49325Z", fill: "#5E4200", fillOpacity: "0.844" }) })] })),
|
|
169
180
|
};
|
|
170
181
|
}
|
|
@@ -173,7 +184,8 @@ function SecurityRiskDetectionRow({ securityInfo, }) {
|
|
|
173
184
|
securityElement: ((0, jsx_runtime_1.jsx)("span", { style: {
|
|
174
185
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
175
186
|
fontWeight: '500',
|
|
176
|
-
fontSize: '
|
|
187
|
+
fontSize: '12px',
|
|
188
|
+
lineHeight: '16px',
|
|
177
189
|
}, children: i18n.unknown })),
|
|
178
190
|
};
|
|
179
191
|
}, [securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.checkSources]);
|
|
@@ -190,82 +202,84 @@ function SecurityInfo({ securityInfo, onClose, showCloseDialog, }) {
|
|
|
190
202
|
return ((0, jsx_runtime_1.jsxs)("div", { ref: viewRef, style: {
|
|
191
203
|
display: 'flex',
|
|
192
204
|
flexDirection: 'column',
|
|
193
|
-
width: '234px',
|
|
194
|
-
borderTopLeftRadius: '12px',
|
|
195
|
-
borderBottomLeftRadius: '12px',
|
|
196
|
-
paddingTop: '8px',
|
|
197
205
|
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
198
206
|
display: 'flex',
|
|
199
207
|
flexDirection: 'column',
|
|
200
|
-
gap: '8px',
|
|
201
208
|
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
202
|
-
padding: '
|
|
209
|
+
padding: '8px',
|
|
203
210
|
display: 'flex',
|
|
204
211
|
alignItems: 'center',
|
|
205
212
|
flexDirection: 'row',
|
|
206
213
|
justifyContent: 'space-between',
|
|
214
|
+
borderBottom: '1px solid rgba(0, 0, 0, 0.05)',
|
|
207
215
|
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
208
216
|
display: 'flex',
|
|
209
217
|
flexDirection: 'row',
|
|
210
218
|
alignItems: 'center',
|
|
211
219
|
gap: '8px',
|
|
212
220
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
213
|
-
fontSize: '
|
|
221
|
+
fontSize: '14px',
|
|
214
222
|
fontWeight: '500',
|
|
223
|
+
overflow: 'hidden',
|
|
215
224
|
}, children: [((_a = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _a === void 0 ? void 0 : _a.logo) ? ((0, jsx_runtime_1.jsx)("img", { src: (_b = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _b === void 0 ? void 0 : _b.logo, style: {
|
|
216
225
|
height: '24px',
|
|
217
226
|
width: '24px',
|
|
218
|
-
borderRadius: '
|
|
219
|
-
} })) : ((0, jsx_runtime_1.jsxs)("svg", {
|
|
227
|
+
borderRadius: '8px',
|
|
228
|
+
} })) : ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
220
229
|
width: '24px',
|
|
221
230
|
height: '24px',
|
|
222
|
-
}, children: [(0, jsx_runtime_1.jsx)("path", { d: "M6.6234 6.17768C6.6234 4.79769 7.73338 3.66333 9.1234 3.66333C10.5134 3.66333 11.6234 4.79769 11.6234 6.17768C11.6234 7.30559 10.8798 7.89399 10.4435 8.19056C10.3054 8.28442 10.2138 8.36716 10.1499 8.45311C10.092 8.53086 10.0368 8.63774 10.0107 8.81185C9.92866 9.35801 9.41941 9.73426 8.87325 9.65224C8.3271 9.57021 7.95084 9.06096 8.03287 8.5148C8.19122 7.4605 8.81104 6.8819 9.31912 6.53656C9.47624 6.42975 9.54878 6.36136 9.58594 6.31084C9.60107 6.29027 9.60813 6.27529 9.61242 6.26261C9.61657 6.25036 9.6234 6.22488 9.6234 6.17768C9.6234 5.88426 9.39093 5.66333 9.1234 5.66333C8.85586 5.66333 8.6234 5.88426 8.6234 6.17768C8.6234 6.72996 8.17568 7.17768 7.6234 7.17768C7.07111 7.17768 6.6234 6.72996 6.6234 6.17768Z", fill: "#3C3C3C" }), (0, jsx_runtime_1.jsx)("path", { d: "M7.74976 11.5C7.74976 12.1904 8.3094 12.75 8.99976 12.75C9.69011 12.75 10.2498 12.1904 10.2498 11.5C10.2498 10.8096 9.69011 10.25 8.99976 10.25C8.3094 10.25 7.74976 10.8096 7.74976 11.5Z", fill: "#3C3C3C" }), (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.00195 2.00272e-05L15.0019 0C16.6588 -2.7418e-06 18.002 1.34314 18.002 3V13.0358C18.002 14.6926 16.6588 16.0357 15.002 16.0358L12.3757 16.0358L8.99393 18.8375L5.65157 16.0358H3.00195C1.3451 16.0358 0.00195312 14.6926 0.00195312 13.0358V3.00002C0.00195312 1.34317 1.34509 2.2769e-05 3.00195 2.00272e-05ZM15.002 2L3.00195 2.00002C2.44967 2.00002 2.00195 2.44774 2.00195 3.00002V13.0358C2.00195 13.5881 2.44967 14.0358 3.00195 14.0358H5.65157C6.12143 14.0358 6.57629 14.2012 6.93638 14.503L9.00143 16.2341L11.0997 14.4957C11.4585 14.1984 11.9098 14.0358 12.3757 14.0358L15.002 14.0358C15.5542 14.0358 16.002 13.588 16.002 13.0358V3C16.002 2.44772 15.5542 2 15.002 2Z", fill: "#3C3C3C" })] })), (
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
231
|
+
}, children: [(0, jsx_runtime_1.jsx)("path", { d: "M6.6234 6.17768C6.6234 4.79769 7.73338 3.66333 9.1234 3.66333C10.5134 3.66333 11.6234 4.79769 11.6234 6.17768C11.6234 7.30559 10.8798 7.89399 10.4435 8.19056C10.3054 8.28442 10.2138 8.36716 10.1499 8.45311C10.092 8.53086 10.0368 8.63774 10.0107 8.81185C9.92866 9.35801 9.41941 9.73426 8.87325 9.65224C8.3271 9.57021 7.95084 9.06096 8.03287 8.5148C8.19122 7.4605 8.81104 6.8819 9.31912 6.53656C9.47624 6.42975 9.54878 6.36136 9.58594 6.31084C9.60107 6.29027 9.60813 6.27529 9.61242 6.26261C9.61657 6.25036 9.6234 6.22488 9.6234 6.17768C9.6234 5.88426 9.39093 5.66333 9.1234 5.66333C8.85586 5.66333 8.6234 5.88426 8.6234 6.17768C8.6234 6.72996 8.17568 7.17768 7.6234 7.17768C7.07111 7.17768 6.6234 6.72996 6.6234 6.17768Z", fill: "#3C3C3C" }), (0, jsx_runtime_1.jsx)("path", { d: "M7.74976 11.5C7.74976 12.1904 8.3094 12.75 8.99976 12.75C9.69011 12.75 10.2498 12.1904 10.2498 11.5C10.2498 10.8096 9.69011 10.25 8.99976 10.25C8.3094 10.25 7.74976 10.8096 7.74976 11.5Z", fill: "#3C3C3C" }), (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.00195 2.00272e-05L15.0019 0C16.6588 -2.7418e-06 18.002 1.34314 18.002 3V13.0358C18.002 14.6926 16.6588 16.0357 15.002 16.0358L12.3757 16.0358L8.99393 18.8375L5.65157 16.0358H3.00195C1.3451 16.0358 0.00195312 14.6926 0.00195312 13.0358V3.00002C0.00195312 1.34317 1.34509 2.2769e-05 3.00195 2.00272e-05ZM15.002 2L3.00195 2.00002C2.44967 2.00002 2.00195 2.44774 2.00195 3.00002V13.0358C2.00195 13.5881 2.44967 14.0358 3.00195 14.0358H5.65157C6.12143 14.0358 6.57629 14.2012 6.93638 14.503L9.00143 16.2341L11.0997 14.4957C11.4585 14.1984 11.9098 14.0358 12.3757 14.0358L15.002 14.0358C15.5542 14.0358 16.002 13.588 16.002 13.0358V3C16.002 2.44772 15.5542 2 15.002 2Z", fill: "#3C3C3C" })] })), (0, jsx_runtime_1.jsx)("span", { style: {
|
|
232
|
+
width: '100%',
|
|
233
|
+
overflow: 'hidden',
|
|
234
|
+
textOverflow: 'ellipsis'
|
|
235
|
+
}, children: ((_c = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _c === void 0 ? void 0 : _c.name) || (securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.host) })] }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
236
|
+
display: 'flex',
|
|
237
|
+
width: '24',
|
|
238
|
+
height: '24',
|
|
239
|
+
cursor: 'pointer',
|
|
226
240
|
}, onClick: () => {
|
|
227
241
|
onClose();
|
|
228
242
|
setTimeout(() => {
|
|
229
243
|
showCloseDialog();
|
|
230
244
|
}, 200);
|
|
231
|
-
}, children: (0, jsx_runtime_1.jsx)("svg", { width: "24", height: "24", viewBox: "0 0 24 24",
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
245
|
+
}, children: (0, jsx_runtime_1.jsx)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.29289 7.29289C7.68342 6.90237 8.31658 6.90237 8.70711 7.29289L12 10.5858L15.2929 7.29289C15.6834 6.90237 16.3166 6.90237 16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711L13.4142 12L16.7071 15.2929C17.0976 15.6834 17.0976 16.3166 16.7071 16.7071C16.3166 17.0976 15.6834 17.0976 15.2929 16.7071L12 13.4142L8.70711 16.7071C8.31658 17.0976 7.68342 17.0976 7.29289 16.7071C6.90237 16.3166 6.90237 15.6834 7.29289 15.2929L10.5858 12L7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289Z", fill: "rgba(0, 0, 0, 0.61)" }) }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', padding: '12px 8px', gap: '12px' }, children: [((_d = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _d === void 0 ? void 0 : _d.origins.length) ? ((0, jsx_runtime_1.jsx)(SecurityInfoRow, { title: i18n.dappListedBy, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
246
|
+
display: 'flex',
|
|
247
|
+
alignItems: 'center',
|
|
248
|
+
gap: '2px',
|
|
249
|
+
}, children: (_e = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _e === void 0 ? void 0 : _e.origins.map((item) => ((0, jsx_runtime_1.jsx)("img", { src: item.logo, style: {
|
|
250
|
+
border: '1px solid rgba(0, 0, 0, 0.1)',
|
|
251
|
+
borderRadius: '9999px',
|
|
252
|
+
width: '16px',
|
|
253
|
+
height: '16px',
|
|
254
|
+
} }))) }) })) : null, (0, jsx_runtime_1.jsx)(SecurityRiskDetectionRow, { securityInfo: securityInfo }), ((_f = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _f === void 0 ? void 0 : _f.origins.length) ? ((0, jsx_runtime_1.jsx)(SecurityInfoRow, { title: i18n.lastVerifiedAt, children: (0, jsx_runtime_1.jsx)("span", { style: {
|
|
255
|
+
fontWeight: '500',
|
|
256
|
+
fontSize: '12px',
|
|
257
|
+
lineHeight: '16px',
|
|
258
|
+
color: 'rgba(0, 0, 0, 0.88)',
|
|
259
|
+
}, children: securityInfo.updatedAt }) })) : null] })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
260
|
+
display: 'flex',
|
|
261
|
+
gap: '8px',
|
|
262
|
+
padding: '12px 8px',
|
|
263
|
+
alignItems: 'center',
|
|
264
|
+
justifyContent: 'center',
|
|
265
|
+
backgroundColor: '#F9F9F9',
|
|
251
266
|
borderBottomLeftRadius: '12px',
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
justifyContent: "center",
|
|
267
|
+
borderBottomRightRadius: '12px',
|
|
268
|
+
borderTop: '1px solid rgba(0, 0, 0, 0.05)',
|
|
255
269
|
}, children: [(0, jsx_runtime_1.jsx)("span", { style: {
|
|
270
|
+
flex: 1,
|
|
256
271
|
color: 'rgba(0, 0, 0, 0.61)',
|
|
257
272
|
fontWeight: '400',
|
|
258
|
-
fontSize: '
|
|
273
|
+
fontSize: '12px',
|
|
274
|
+
lineHeight: '16px',
|
|
259
275
|
}, children: "Powered by" }), (0, jsx_runtime_1.jsx)(images_1.Logo, { style: {
|
|
260
|
-
width: '
|
|
261
|
-
height: '
|
|
262
|
-
marginLeft: '5.6px',
|
|
263
|
-
marginRight: '4.2px',
|
|
264
|
-
verticalAlign: 'middle',
|
|
276
|
+
width: '14px',
|
|
277
|
+
height: '14px',
|
|
265
278
|
} }), (0, jsx_runtime_1.jsx)("span", { style: {
|
|
266
279
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
267
|
-
fontWeight: '
|
|
268
|
-
fontSize: '
|
|
280
|
+
fontWeight: '500',
|
|
281
|
+
fontSize: '12px',
|
|
282
|
+
lineHeight: '16px',
|
|
269
283
|
}, children: "OneKey" })] })] }));
|
|
270
284
|
}
|
|
271
285
|
function App() {
|
|
@@ -287,26 +301,28 @@ function App() {
|
|
|
287
301
|
setSecurityInfo(result.securityInfo);
|
|
288
302
|
}
|
|
289
303
|
}), [isExpanded, securityInfo]);
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
304
|
+
return ((0, jsx_runtime_1.jsxs)("div", { id: containerId, style: {
|
|
305
|
+
position: 'fixed',
|
|
306
|
+
zIndex: 999999,
|
|
307
|
+
top: '75%',
|
|
308
|
+
right: '0px',
|
|
309
|
+
width: '256px',
|
|
310
|
+
background: '#fff',
|
|
311
|
+
borderRadius: '12px',
|
|
312
|
+
transition: 'all 150ms cubic-bezier(0.4, 0, 0.2, 1)',
|
|
313
|
+
boxShadow: '0px 0px 0px 1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)',
|
|
314
|
+
transform: isExpanded ? 'translateX(-20px)' : 'translateX(216px)',
|
|
315
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
|
316
|
+
WebkitTextSizeAdjust: '100%',
|
|
317
|
+
fontSmooth: 'antialiased',
|
|
318
|
+
}, children: [showSecurityInfo && securityInfo ? ((0, jsx_runtime_1.jsx)(SecurityInfo, { securityInfo: securityInfo, showCloseDialog: handleShowCloseDialog, onClose: () => {
|
|
303
319
|
setIsExpanded(false);
|
|
304
320
|
setIsShowSecurityInfo(false);
|
|
305
321
|
} })) : ((0, jsx_runtime_1.jsx)(IconButton, { onClick: handleClick, isExpanded: isExpanded, isShowCloseDialog: showCloseDialog, showCloseDialog: handleShowCloseDialog, dataLoaded: !!securityInfo })), !isExpanded && showCloseDialog && ((0, jsx_runtime_1.jsx)(CloseDialog, { onClose: () => {
|
|
306
322
|
setIsShowCloseDialog(false);
|
|
307
323
|
} }))] }));
|
|
308
324
|
}
|
|
309
|
-
function
|
|
325
|
+
function injectIcon() {
|
|
310
326
|
return __awaiter(this, void 0, void 0, function* () {
|
|
311
327
|
const { isShow, i18n: i18nResponse } = yield globalThis.$onekey.$private.request({
|
|
312
328
|
method: 'wallet_isShowFloatingButton',
|
|
@@ -328,3 +344,14 @@ function injectFloatingButton() {
|
|
|
328
344
|
(0, preact_1.render)((0, jsx_runtime_1.jsx)(App, {}), document.body, div);
|
|
329
345
|
});
|
|
330
346
|
}
|
|
347
|
+
function injectFloatingButton() {
|
|
348
|
+
globalThis.$onekey.$private.onNotifyFloatingIconChanged(({ showFloatingIcon }) => {
|
|
349
|
+
if (showFloatingIcon) {
|
|
350
|
+
void injectIcon();
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
removeIcon();
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
void injectIcon();
|
|
357
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function injectFloatingButton():
|
|
1
|
+
export declare function injectFloatingButton(): void;
|
|
@@ -10,29 +10,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
11
11
|
import { render } from 'preact';
|
|
12
12
|
import { useEffect, useMemo, useCallback, useRef, useState } from 'preact/hooks';
|
|
13
|
-
import { EHostSecurityLevel
|
|
13
|
+
import { EHostSecurityLevel } from './type';
|
|
14
14
|
import { Logo } from './images';
|
|
15
15
|
let isInjected = false;
|
|
16
16
|
let i18n = {};
|
|
17
17
|
const logoStyle = {
|
|
18
|
-
width: '
|
|
19
|
-
height: '
|
|
18
|
+
width: '24px',
|
|
19
|
+
height: '24px',
|
|
20
20
|
};
|
|
21
21
|
const textStyle = {
|
|
22
22
|
color: 'rgba(0, 0, 0, 0.61)',
|
|
23
|
-
fontSize: '
|
|
23
|
+
fontSize: '14px',
|
|
24
24
|
marginLeft: '8px',
|
|
25
25
|
};
|
|
26
26
|
const containerId = 'onekey-floating-widget';
|
|
27
|
-
const
|
|
27
|
+
const removeIcon = () => {
|
|
28
28
|
var _a;
|
|
29
29
|
(_a = document.getElementById(containerId)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
30
|
+
isInjected = false;
|
|
30
31
|
};
|
|
31
32
|
const useOutsideClick = (ref, callback) => {
|
|
32
33
|
useEffect(() => {
|
|
33
34
|
const handleClickOutside = (event) => {
|
|
34
|
-
if (ref.current &&
|
|
35
|
-
!ref.current.contains(event.target)) {
|
|
35
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
36
36
|
callback();
|
|
37
37
|
}
|
|
38
38
|
};
|
|
@@ -49,40 +49,46 @@ function CloseDialog({ onClose }) {
|
|
|
49
49
|
void globalThis.$onekey.$private.request({
|
|
50
50
|
method: 'wallet_disableFloatingButton',
|
|
51
51
|
});
|
|
52
|
-
|
|
52
|
+
removeIcon();
|
|
53
53
|
}, []);
|
|
54
54
|
const handleHideOnSite = useCallback(() => {
|
|
55
55
|
void globalThis.$onekey.$private.request({
|
|
56
56
|
method: 'wallet_hideFloatingButtonOnSite',
|
|
57
57
|
params: { url: window.location.origin },
|
|
58
58
|
});
|
|
59
|
-
|
|
59
|
+
removeIcon();
|
|
60
60
|
}, []);
|
|
61
61
|
return (_jsxs("div", { style: {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
display: 'flex',
|
|
63
|
+
flexDirection: 'column',
|
|
64
|
+
gap: '8px',
|
|
65
|
+
padding: '12px',
|
|
64
66
|
position: 'absolute',
|
|
65
|
-
right: '
|
|
66
|
-
|
|
67
|
-
top: '
|
|
68
|
-
width: '
|
|
69
|
-
borderRadius: '
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
right: '100%',
|
|
68
|
+
background: '#fff',
|
|
69
|
+
top: '40px',
|
|
70
|
+
width: '196px',
|
|
71
|
+
borderRadius: '12px',
|
|
72
|
+
boxShadow: '0px 0px 0px 1px rgba(0, 0, 0, 0.05),0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',
|
|
73
|
+
color: 'rgba(0, 0, 0, 1)',
|
|
74
|
+
fontSize: '12px',
|
|
75
|
+
lineHeight: '16px',
|
|
76
|
+
}, ref: dialogRef, children: [_jsxs("div", { style: {
|
|
77
|
+
display: 'flex',
|
|
78
|
+
alignItems: 'center',
|
|
74
79
|
cursor: 'pointer',
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
fontSize: '12px',
|
|
80
|
-
fontWeight: '400',
|
|
80
|
+
gap: '8px',
|
|
81
|
+
}, onClick: handleHideOnSite, children: [_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M2.29312 2.2929C2.68364 1.90237 3.31681 1.90237 3.70734 2.29289L7.35069 5.9362L21.7073 20.2929C22.0979 20.6834 22.0979 21.3166 21.7073 21.7071C21.3168 22.0976 20.6836 22.0976 20.2931 21.7071L17.2031 18.617C14.684 20.0216 11.8704 20.363 9.19337 19.6107C6.27083 18.7893 3.59188 16.6894 1.6441 13.4178C1.12514 12.5461 1.12292 11.4579 1.64298 10.5841C2.63083 8.92441 3.8063 7.56606 5.10844 6.52239L2.29313 3.70711C1.9026 3.31659 1.9026 2.68342 2.29312 2.2929ZM6.53283 7.94678L7.41812 8.8321L8.5542 9.96818C8.20253 10.5636 8.00023 11.2586 8.00023 12C8.00023 14.2091 9.79109 16 12.0002 16C12.7416 16 13.4366 15.7977 14.0321 15.446L15.7203 17.1343C13.7862 18.0642 11.7083 18.24 9.73447 17.6852C7.37839 17.0231 5.08952 15.2953 3.36259 12.3947C3.21773 12.1514 3.21796 11.8483 3.36159 11.607C4.28389 10.0575 5.36713 8.84257 6.53283 7.94678ZM12.5184 13.9324L10.0678 11.4818C10.0237 11.647 10.0002 11.8207 10.0002 12C10.0002 13.1046 10.8957 14 12.0002 14C12.1796 14 12.3532 13.9765 12.5184 13.9324ZM20.6388 11.6068C18.1001 7.34166 14.3527 5.6013 10.8782 6.07652C10.331 6.15137 9.82679 5.76845 9.75195 5.22126C9.67711 4.67407 10.06 4.16981 10.6072 4.09497C15.0162 3.49193 19.4849 5.75792 22.3574 10.5838C22.8767 11.4564 22.8771 12.5429 22.3576 13.4157C21.9613 14.0815 21.535 14.6987 21.0823 15.2666C20.738 15.6985 20.1088 15.7695 19.677 15.4253C19.2451 15.081 19.1741 14.4519 19.5183 14.02C19.9123 13.5257 20.2873 12.9836 20.6389 12.3928C20.7831 12.1507 20.7831 11.8493 20.6388 11.6068Z", fill: "rgba(0, 0, 0, 0.61)" }) }), _jsx("div", { children: i18n.hideOnThisSite })] }), _jsxs("div", { style: {
|
|
82
|
+
display: 'flex',
|
|
83
|
+
alignItems: 'center',
|
|
81
84
|
cursor: 'pointer',
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
gap: '8px',
|
|
86
|
+
}, onClick: handleDisable, children: [_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M12 4C7.58172 4 4 7.58172 4 12C4 13.8491 4.62644 15.5506 5.68009 16.9057L16.9057 5.68009C15.5506 4.62644 13.8491 4 12 4ZM18.3199 7.0943L7.0943 18.3199C8.44939 19.3736 10.1509 20 12 20C16.4183 20 20 16.4183 20 12C20 10.1509 19.3736 8.44939 18.3199 7.0943ZM2 12C2 6.47715 6.47715 2 12 2C14.7611 2 17.2625 3.12038 19.0711 4.92893C20.8796 6.73748 22 9.23885 22 12C22 17.5228 17.5228 22 12 22C9.23885 22 6.73748 20.8796 4.92893 19.0711C3.12038 17.2625 2 14.7611 2 12Z", fill: "rgba(0, 0, 0, 0.61)" }) }), _jsx("div", { children: i18n.disable })] }), _jsx("div", { style: {
|
|
87
|
+
color: 'rgba(0, 0, 0, 0.61)',
|
|
88
|
+
fontSize: '12px',
|
|
89
|
+
lineHeight: '16px',
|
|
90
|
+
paddingTop: '8px',
|
|
91
|
+
borderTop: '1px solid rgba(0, 0, 0, 0.05)',
|
|
86
92
|
}, children: i18n.canBeReEnabledInSettings })] }));
|
|
87
93
|
}
|
|
88
94
|
function IconButton({ isExpanded, onClick, dataLoaded, isShowCloseDialog, showCloseDialog, }) {
|
|
@@ -90,10 +96,8 @@ function IconButton({ isExpanded, onClick, dataLoaded, isShowCloseDialog, showCl
|
|
|
90
96
|
return (_jsxs("div", { style: {
|
|
91
97
|
display: 'flex',
|
|
92
98
|
alignItems: 'center',
|
|
93
|
-
width: '184px',
|
|
94
99
|
position: 'relative',
|
|
95
100
|
cursor: 'pointer',
|
|
96
|
-
padding: '8px',
|
|
97
101
|
}, onMouseEnter: () => {
|
|
98
102
|
if (isExpanded || isShowCloseDialog) {
|
|
99
103
|
return;
|
|
@@ -105,32 +109,36 @@ function IconButton({ isExpanded, onClick, dataLoaded, isShowCloseDialog, showCl
|
|
|
105
109
|
}
|
|
106
110
|
setIsShowCloseButton(false);
|
|
107
111
|
onClick();
|
|
108
|
-
}, children: [_jsx(Logo, { style: logoStyle }), !dataLoaded &&
|
|
112
|
+
}, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', padding: '8px' }, children: [_jsx(Logo, { style: logoStyle }), !dataLoaded && _jsx("span", { style: textStyle, children: isExpanded ? i18n.fetchingDAppInfo : '' })] }), _jsx("div", { style: {
|
|
113
|
+
display: 'flex',
|
|
114
|
+
padding: '$4',
|
|
109
115
|
position: 'absolute',
|
|
110
|
-
left: '
|
|
116
|
+
left: '-6px',
|
|
111
117
|
bottom: '-10px',
|
|
118
|
+
transition: 'all 150ms cubic-bezier(0.4, 0, 0.2, 1)',
|
|
112
119
|
opacity: showCloseButton ? 1 : 0,
|
|
120
|
+
borderRadius: '9999px',
|
|
121
|
+
backgroundColor: '#fff',
|
|
122
|
+
border: '1px solid rgba(0, 0, 0, 0.1)',
|
|
113
123
|
}, onClick: (event) => {
|
|
114
124
|
event.stopPropagation();
|
|
115
125
|
setIsShowCloseButton(false);
|
|
116
126
|
showCloseDialog();
|
|
117
|
-
}, children: _jsx("svg", { width: "
|
|
127
|
+
}, children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M7.29289 7.29289C7.68342 6.90237 8.31658 6.90237 8.70711 7.29289L12 10.5858L15.2929 7.29289C15.6834 6.90237 16.3166 6.90237 16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711L13.4142 12L16.7071 15.2929C17.0976 15.6834 17.0976 16.3166 16.7071 16.7071C16.3166 17.0976 15.6834 17.0976 15.2929 16.7071L12 13.4142L8.70711 16.7071C8.31658 17.0976 7.68342 17.0976 7.29289 16.7071C6.90237 16.3166 6.90237 15.6834 7.29289 15.2929L10.5858 12L7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289Z", fill: "rgba(0, 0, 0, 0.61)" }) }) })] }));
|
|
118
128
|
}
|
|
119
|
-
function SecurityInfoRow({ title, children
|
|
129
|
+
function SecurityInfoRow({ title, children }) {
|
|
120
130
|
return (_jsxs("div", { style: {
|
|
121
131
|
display: 'flex',
|
|
122
|
-
height: '16px',
|
|
123
132
|
flexDirection: 'row',
|
|
124
133
|
justifyContent: 'space-between',
|
|
125
134
|
alignItems: 'center',
|
|
126
|
-
padding: '0 8px',
|
|
127
135
|
}, children: [_jsx("span", { style: {
|
|
128
136
|
color: 'rgba(0, 0, 0, 0.61)',
|
|
129
|
-
|
|
130
|
-
|
|
137
|
+
fontSize: '12px',
|
|
138
|
+
lineHeight: '16px',
|
|
131
139
|
}, children: title }), children] }));
|
|
132
140
|
}
|
|
133
|
-
function SecurityRiskDetectionRow({ securityInfo
|
|
141
|
+
function SecurityRiskDetectionRow({ securityInfo }) {
|
|
134
142
|
const { securityElement, securityStatus } = useMemo(() => {
|
|
135
143
|
const security = (securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.checkSources.filter((item) => item.riskLevel === EHostSecurityLevel.Security).map((item) => item.name).join(' & ')) || '';
|
|
136
144
|
if (security) {
|
|
@@ -139,8 +147,9 @@ function SecurityRiskDetectionRow({ securityInfo, }) {
|
|
|
139
147
|
securityElement: (_jsxs(_Fragment, { children: [_jsx("span", { style: {
|
|
140
148
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
141
149
|
fontWeight: '500',
|
|
142
|
-
fontSize: '
|
|
143
|
-
|
|
150
|
+
fontSize: '12px',
|
|
151
|
+
lineHeight: '16px',
|
|
152
|
+
}, children: i18n.verifiedSite }), _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { width: "16", height: "16", viewBox: "0 0 24 24", d: "M10.4673 2.69869C11.2767 1.76711 12.7232 1.7671 13.5326 2.69868L14.8908 4.26193C14.8977 4.26983 14.9082 4.27364 14.9185 4.272L16.9638 3.94755C18.1827 3.7542 19.2907 4.68395 19.3119 5.91786L19.3476 7.98845C19.3478 7.99891 19.3533 8.00854 19.3623 8.01393L21.1377 9.08009C22.1956 9.71544 22.4468 11.1399 21.6699 12.0988L20.3663 13.7079C20.3597 13.716 20.3578 13.7269 20.3612 13.7368L21.0359 15.6947C21.4379 16.8615 20.7147 18.1142 19.5032 18.3493L17.4703 18.744C17.46 18.746 17.4515 18.7531 17.4478 18.7629L16.7061 20.6964C16.2641 21.8487 14.9049 22.3434 13.8257 21.7448L12.0147 20.7404C12.0055 20.7353 11.9944 20.7353 11.9852 20.7404L10.1742 21.7448C9.09503 22.3434 7.73582 21.8487 7.29383 20.6964L6.55216 18.7629C6.54841 18.7531 6.53989 18.746 6.52962 18.744L4.49668 18.3493C3.2852 18.1142 2.56198 16.8615 2.96404 15.6947L3.63873 13.7368C3.64214 13.7269 3.64021 13.716 3.63362 13.7079L2.32998 12.0988C1.55311 11.1399 1.80428 9.71544 2.86226 9.08009L4.63762 8.01393C4.64659 8.00854 4.65215 7.99891 4.65233 7.98845L4.68797 5.91786C4.70921 4.68395 5.81725 3.7542 7.0361 3.94755L9.08142 4.272C9.09176 4.27364 9.10221 4.26983 9.10907 4.26193L10.4673 2.69869ZM15.2071 11.2071C15.5976 10.8166 15.5976 10.1834 15.2071 9.79289C14.8166 9.40237 14.1834 9.40237 13.7929 9.79289L11 12.5858L10.2071 11.7929C9.81655 11.4024 9.18339 11.4024 8.79286 11.7929C8.40234 12.1834 8.40234 12.8166 8.79286 13.2071L9.93931 14.3536C10.5251 14.9393 11.4748 14.9393 12.0606 14.3536L15.2071 11.2071Z", fill: "#006B3B", fillOpacity: "0.906" }) })] })),
|
|
144
153
|
};
|
|
145
154
|
}
|
|
146
155
|
const highSecurity = (securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.checkSources.filter((item) => item.riskLevel === EHostSecurityLevel.High).map((item) => item.name).join(' & ')) || '';
|
|
@@ -150,7 +159,8 @@ function SecurityRiskDetectionRow({ securityInfo, }) {
|
|
|
150
159
|
securityElement: (_jsxs(_Fragment, { children: [_jsx("span", { style: {
|
|
151
160
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
152
161
|
fontWeight: '500',
|
|
153
|
-
fontSize: '
|
|
162
|
+
fontSize: '12px',
|
|
163
|
+
lineHeight: '16px',
|
|
154
164
|
}, children: i18n.maliciousSiteWarning }), _jsx("svg", { width: "18", height: "16", viewBox: "0 0 18 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M6.83981 2.21151C7.8045 0.557753 10.194 0.557748 11.1587 2.21151L17.007 12.2371C17.9792 13.9038 16.777 15.9968 14.8475 15.9968H3.15098C1.22151 15.9968 0.0193263 13.9038 0.991535 12.2371L6.83981 2.21151ZM9.00008 5.99683C9.46032 5.99683 9.83342 6.36992 9.83342 6.83016V9.33016C9.83342 9.7904 9.46032 10.1635 9.00008 10.1635C8.53984 10.1635 8.16675 9.7904 8.16675 9.33016V6.83016C8.16675 6.36992 8.53984 5.99683 9.00008 5.99683ZM7.95842 11.8302C7.95842 11.2549 8.42478 10.7885 9.00008 10.7885C9.57538 10.7885 10.0417 11.2549 10.0417 11.8302C10.0417 12.4055 9.57538 12.8718 9.00008 12.8718C8.42478 12.8718 7.95842 12.4055 7.95842 11.8302Z", fill: "#BB0007", fillOpacity: "0.836" }) })] })),
|
|
155
165
|
};
|
|
156
166
|
}
|
|
@@ -161,7 +171,8 @@ function SecurityRiskDetectionRow({ securityInfo, }) {
|
|
|
161
171
|
securityElement: (_jsxs(_Fragment, { children: [_jsx("span", { style: {
|
|
162
172
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
163
173
|
fontWeight: '500',
|
|
164
|
-
fontSize: '
|
|
174
|
+
fontSize: '12px',
|
|
175
|
+
lineHeight: '16px',
|
|
165
176
|
}, children: i18n.suspectedMaliciousBehavior }), _jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.96786 0.159913C3.52858 0.159899 3.14962 0.159886 2.83748 0.185389C2.50802 0.212306 2.18034 0.271736 1.86503 0.432398C1.39462 0.672081 1.01217 1.05453 0.772486 1.52494C0.611824 1.84025 0.552394 2.16794 0.525477 2.49739C0.499974 2.80953 0.499986 3.18849 0.500001 3.62776V11.692C0.499986 12.1313 0.499974 12.5103 0.525477 12.8224C0.552394 13.1519 0.611824 13.4796 0.772486 13.7949C1.01217 14.2653 1.39462 14.6477 1.86503 14.8874C2.18034 15.0481 2.50802 15.1075 2.83748 15.1344C3.14962 15.1599 3.52858 15.1599 3.96786 15.1599H12.0321C12.4714 15.1599 12.8504 15.1599 13.1625 15.1344C13.492 15.1075 13.8197 15.0481 14.135 14.8874C14.6054 14.6477 14.9878 14.2653 15.2275 13.7949C15.3882 13.4796 15.4476 13.1519 15.4745 12.8224C15.5 12.5103 15.5 12.1313 15.5 11.6921V3.62778C15.5 3.18849 15.5 2.80953 15.4745 2.49739C15.4476 2.16794 15.3882 1.84025 15.2275 1.52494C14.9878 1.05453 14.6054 0.672081 14.135 0.432398C13.8197 0.271736 13.492 0.212306 13.1625 0.185389C12.8504 0.159886 12.4714 0.159899 12.0322 0.159913H3.96786ZM6.33333 6.82658C6.33333 6.36634 6.70643 5.99325 7.16667 5.99325H8C8.46024 5.99325 8.83333 6.36634 8.83333 6.82658V10.9932C8.83333 11.4535 8.46024 11.8266 8 11.8266C7.53976 11.8266 7.16667 11.4535 7.16667 10.9932V7.65991C6.70643 7.65991 6.33333 7.28682 6.33333 6.82658ZM8 3.49325C7.53976 3.49325 7.16667 3.86634 7.16667 4.32658C7.16667 4.78682 7.53976 5.15991 8 5.15991C8.46024 5.15991 8.83333 4.78682 8.83333 4.32658C8.83333 3.86634 8.46024 3.49325 8 3.49325Z", fill: "#5E4200", fillOpacity: "0.844" }) })] })),
|
|
166
177
|
};
|
|
167
178
|
}
|
|
@@ -170,7 +181,8 @@ function SecurityRiskDetectionRow({ securityInfo, }) {
|
|
|
170
181
|
securityElement: (_jsx("span", { style: {
|
|
171
182
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
172
183
|
fontWeight: '500',
|
|
173
|
-
fontSize: '
|
|
184
|
+
fontSize: '12px',
|
|
185
|
+
lineHeight: '16px',
|
|
174
186
|
}, children: i18n.unknown })),
|
|
175
187
|
};
|
|
176
188
|
}, [securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.checkSources]);
|
|
@@ -187,82 +199,84 @@ function SecurityInfo({ securityInfo, onClose, showCloseDialog, }) {
|
|
|
187
199
|
return (_jsxs("div", { ref: viewRef, style: {
|
|
188
200
|
display: 'flex',
|
|
189
201
|
flexDirection: 'column',
|
|
190
|
-
width: '234px',
|
|
191
|
-
borderTopLeftRadius: '12px',
|
|
192
|
-
borderBottomLeftRadius: '12px',
|
|
193
|
-
paddingTop: '8px',
|
|
194
202
|
}, children: [_jsxs("div", { style: {
|
|
195
203
|
display: 'flex',
|
|
196
204
|
flexDirection: 'column',
|
|
197
|
-
gap: '8px',
|
|
198
205
|
}, children: [_jsxs("div", { style: {
|
|
199
|
-
padding: '
|
|
206
|
+
padding: '8px',
|
|
200
207
|
display: 'flex',
|
|
201
208
|
alignItems: 'center',
|
|
202
209
|
flexDirection: 'row',
|
|
203
210
|
justifyContent: 'space-between',
|
|
211
|
+
borderBottom: '1px solid rgba(0, 0, 0, 0.05)',
|
|
204
212
|
}, children: [_jsxs("div", { style: {
|
|
205
213
|
display: 'flex',
|
|
206
214
|
flexDirection: 'row',
|
|
207
215
|
alignItems: 'center',
|
|
208
216
|
gap: '8px',
|
|
209
217
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
210
|
-
fontSize: '
|
|
218
|
+
fontSize: '14px',
|
|
211
219
|
fontWeight: '500',
|
|
220
|
+
overflow: 'hidden',
|
|
212
221
|
}, children: [((_a = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _a === void 0 ? void 0 : _a.logo) ? (_jsx("img", { src: (_b = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _b === void 0 ? void 0 : _b.logo, style: {
|
|
213
222
|
height: '24px',
|
|
214
223
|
width: '24px',
|
|
215
|
-
borderRadius: '
|
|
216
|
-
} })) : (_jsxs("svg", {
|
|
224
|
+
borderRadius: '8px',
|
|
225
|
+
} })) : (_jsxs("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
217
226
|
width: '24px',
|
|
218
227
|
height: '24px',
|
|
219
|
-
}, children: [_jsx("path", { d: "M6.6234 6.17768C6.6234 4.79769 7.73338 3.66333 9.1234 3.66333C10.5134 3.66333 11.6234 4.79769 11.6234 6.17768C11.6234 7.30559 10.8798 7.89399 10.4435 8.19056C10.3054 8.28442 10.2138 8.36716 10.1499 8.45311C10.092 8.53086 10.0368 8.63774 10.0107 8.81185C9.92866 9.35801 9.41941 9.73426 8.87325 9.65224C8.3271 9.57021 7.95084 9.06096 8.03287 8.5148C8.19122 7.4605 8.81104 6.8819 9.31912 6.53656C9.47624 6.42975 9.54878 6.36136 9.58594 6.31084C9.60107 6.29027 9.60813 6.27529 9.61242 6.26261C9.61657 6.25036 9.6234 6.22488 9.6234 6.17768C9.6234 5.88426 9.39093 5.66333 9.1234 5.66333C8.85586 5.66333 8.6234 5.88426 8.6234 6.17768C8.6234 6.72996 8.17568 7.17768 7.6234 7.17768C7.07111 7.17768 6.6234 6.72996 6.6234 6.17768Z", fill: "#3C3C3C" }), _jsx("path", { d: "M7.74976 11.5C7.74976 12.1904 8.3094 12.75 8.99976 12.75C9.69011 12.75 10.2498 12.1904 10.2498 11.5C10.2498 10.8096 9.69011 10.25 8.99976 10.25C8.3094 10.25 7.74976 10.8096 7.74976 11.5Z", fill: "#3C3C3C" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.00195 2.00272e-05L15.0019 0C16.6588 -2.7418e-06 18.002 1.34314 18.002 3V13.0358C18.002 14.6926 16.6588 16.0357 15.002 16.0358L12.3757 16.0358L8.99393 18.8375L5.65157 16.0358H3.00195C1.3451 16.0358 0.00195312 14.6926 0.00195312 13.0358V3.00002C0.00195312 1.34317 1.34509 2.2769e-05 3.00195 2.00272e-05ZM15.002 2L3.00195 2.00002C2.44967 2.00002 2.00195 2.44774 2.00195 3.00002V13.0358C2.00195 13.5881 2.44967 14.0358 3.00195 14.0358H5.65157C6.12143 14.0358 6.57629 14.2012 6.93638 14.503L9.00143 16.2341L11.0997 14.4957C11.4585 14.1984 11.9098 14.0358 12.3757 14.0358L15.002 14.0358C15.5542 14.0358 16.002 13.588 16.002 13.0358V3C16.002 2.44772 15.5542 2 15.002 2Z", fill: "#3C3C3C" })] })),
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
228
|
+
}, children: [_jsx("path", { d: "M6.6234 6.17768C6.6234 4.79769 7.73338 3.66333 9.1234 3.66333C10.5134 3.66333 11.6234 4.79769 11.6234 6.17768C11.6234 7.30559 10.8798 7.89399 10.4435 8.19056C10.3054 8.28442 10.2138 8.36716 10.1499 8.45311C10.092 8.53086 10.0368 8.63774 10.0107 8.81185C9.92866 9.35801 9.41941 9.73426 8.87325 9.65224C8.3271 9.57021 7.95084 9.06096 8.03287 8.5148C8.19122 7.4605 8.81104 6.8819 9.31912 6.53656C9.47624 6.42975 9.54878 6.36136 9.58594 6.31084C9.60107 6.29027 9.60813 6.27529 9.61242 6.26261C9.61657 6.25036 9.6234 6.22488 9.6234 6.17768C9.6234 5.88426 9.39093 5.66333 9.1234 5.66333C8.85586 5.66333 8.6234 5.88426 8.6234 6.17768C8.6234 6.72996 8.17568 7.17768 7.6234 7.17768C7.07111 7.17768 6.6234 6.72996 6.6234 6.17768Z", fill: "#3C3C3C" }), _jsx("path", { d: "M7.74976 11.5C7.74976 12.1904 8.3094 12.75 8.99976 12.75C9.69011 12.75 10.2498 12.1904 10.2498 11.5C10.2498 10.8096 9.69011 10.25 8.99976 10.25C8.3094 10.25 7.74976 10.8096 7.74976 11.5Z", fill: "#3C3C3C" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.00195 2.00272e-05L15.0019 0C16.6588 -2.7418e-06 18.002 1.34314 18.002 3V13.0358C18.002 14.6926 16.6588 16.0357 15.002 16.0358L12.3757 16.0358L8.99393 18.8375L5.65157 16.0358H3.00195C1.3451 16.0358 0.00195312 14.6926 0.00195312 13.0358V3.00002C0.00195312 1.34317 1.34509 2.2769e-05 3.00195 2.00272e-05ZM15.002 2L3.00195 2.00002C2.44967 2.00002 2.00195 2.44774 2.00195 3.00002V13.0358C2.00195 13.5881 2.44967 14.0358 3.00195 14.0358H5.65157C6.12143 14.0358 6.57629 14.2012 6.93638 14.503L9.00143 16.2341L11.0997 14.4957C11.4585 14.1984 11.9098 14.0358 12.3757 14.0358L15.002 14.0358C15.5542 14.0358 16.002 13.588 16.002 13.0358V3C16.002 2.44772 15.5542 2 15.002 2Z", fill: "#3C3C3C" })] })), _jsx("span", { style: {
|
|
229
|
+
width: '100%',
|
|
230
|
+
overflow: 'hidden',
|
|
231
|
+
textOverflow: 'ellipsis'
|
|
232
|
+
}, children: ((_c = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _c === void 0 ? void 0 : _c.name) || (securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.host) })] }), _jsx("div", { style: {
|
|
233
|
+
display: 'flex',
|
|
234
|
+
width: '24',
|
|
235
|
+
height: '24',
|
|
236
|
+
cursor: 'pointer',
|
|
223
237
|
}, onClick: () => {
|
|
224
238
|
onClose();
|
|
225
239
|
setTimeout(() => {
|
|
226
240
|
showCloseDialog();
|
|
227
241
|
}, 200);
|
|
228
|
-
}, children: _jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24",
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
}, children: _jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.29289 7.29289C7.68342 6.90237 8.31658 6.90237 8.70711 7.29289L12 10.5858L15.2929 7.29289C15.6834 6.90237 16.3166 6.90237 16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711L13.4142 12L16.7071 15.2929C17.0976 15.6834 17.0976 16.3166 16.7071 16.7071C16.3166 17.0976 15.6834 17.0976 15.2929 16.7071L12 13.4142L8.70711 16.7071C8.31658 17.0976 7.68342 17.0976 7.29289 16.7071C6.90237 16.3166 6.90237 15.6834 7.29289 15.2929L10.5858 12L7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289Z", fill: "rgba(0, 0, 0, 0.61)" }) }) })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', padding: '12px 8px', gap: '12px' }, children: [((_d = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _d === void 0 ? void 0 : _d.origins.length) ? (_jsx(SecurityInfoRow, { title: i18n.dappListedBy, children: _jsx("div", { style: {
|
|
243
|
+
display: 'flex',
|
|
244
|
+
alignItems: 'center',
|
|
245
|
+
gap: '2px',
|
|
246
|
+
}, children: (_e = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _e === void 0 ? void 0 : _e.origins.map((item) => (_jsx("img", { src: item.logo, style: {
|
|
247
|
+
border: '1px solid rgba(0, 0, 0, 0.1)',
|
|
248
|
+
borderRadius: '9999px',
|
|
249
|
+
width: '16px',
|
|
250
|
+
height: '16px',
|
|
251
|
+
} }))) }) })) : null, _jsx(SecurityRiskDetectionRow, { securityInfo: securityInfo }), ((_f = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _f === void 0 ? void 0 : _f.origins.length) ? (_jsx(SecurityInfoRow, { title: i18n.lastVerifiedAt, children: _jsx("span", { style: {
|
|
252
|
+
fontWeight: '500',
|
|
253
|
+
fontSize: '12px',
|
|
254
|
+
lineHeight: '16px',
|
|
255
|
+
color: 'rgba(0, 0, 0, 0.88)',
|
|
256
|
+
}, children: securityInfo.updatedAt }) })) : null] })] }), _jsxs("div", { style: {
|
|
257
|
+
display: 'flex',
|
|
258
|
+
gap: '8px',
|
|
259
|
+
padding: '12px 8px',
|
|
260
|
+
alignItems: 'center',
|
|
261
|
+
justifyContent: 'center',
|
|
262
|
+
backgroundColor: '#F9F9F9',
|
|
248
263
|
borderBottomLeftRadius: '12px',
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
justifyContent: "center",
|
|
264
|
+
borderBottomRightRadius: '12px',
|
|
265
|
+
borderTop: '1px solid rgba(0, 0, 0, 0.05)',
|
|
252
266
|
}, children: [_jsx("span", { style: {
|
|
267
|
+
flex: 1,
|
|
253
268
|
color: 'rgba(0, 0, 0, 0.61)',
|
|
254
269
|
fontWeight: '400',
|
|
255
|
-
fontSize: '
|
|
270
|
+
fontSize: '12px',
|
|
271
|
+
lineHeight: '16px',
|
|
256
272
|
}, children: "Powered by" }), _jsx(Logo, { style: {
|
|
257
|
-
width: '
|
|
258
|
-
height: '
|
|
259
|
-
marginLeft: '5.6px',
|
|
260
|
-
marginRight: '4.2px',
|
|
261
|
-
verticalAlign: 'middle',
|
|
273
|
+
width: '14px',
|
|
274
|
+
height: '14px',
|
|
262
275
|
} }), _jsx("span", { style: {
|
|
263
276
|
color: 'rgba(0, 0, 0, 0.88)',
|
|
264
|
-
fontWeight: '
|
|
265
|
-
fontSize: '
|
|
277
|
+
fontWeight: '500',
|
|
278
|
+
fontSize: '12px',
|
|
279
|
+
lineHeight: '16px',
|
|
266
280
|
}, children: "OneKey" })] })] }));
|
|
267
281
|
}
|
|
268
282
|
function App() {
|
|
@@ -284,26 +298,28 @@ function App() {
|
|
|
284
298
|
setSecurityInfo(result.securityInfo);
|
|
285
299
|
}
|
|
286
300
|
}), [isExpanded, securityInfo]);
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
301
|
+
return (_jsxs("div", { id: containerId, style: {
|
|
302
|
+
position: 'fixed',
|
|
303
|
+
zIndex: 999999,
|
|
304
|
+
top: '75%',
|
|
305
|
+
right: '0px',
|
|
306
|
+
width: '256px',
|
|
307
|
+
background: '#fff',
|
|
308
|
+
borderRadius: '12px',
|
|
309
|
+
transition: 'all 150ms cubic-bezier(0.4, 0, 0.2, 1)',
|
|
310
|
+
boxShadow: '0px 0px 0px 1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)',
|
|
311
|
+
transform: isExpanded ? 'translateX(-20px)' : 'translateX(216px)',
|
|
312
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
|
313
|
+
WebkitTextSizeAdjust: '100%',
|
|
314
|
+
fontSmooth: 'antialiased',
|
|
315
|
+
}, children: [showSecurityInfo && securityInfo ? (_jsx(SecurityInfo, { securityInfo: securityInfo, showCloseDialog: handleShowCloseDialog, onClose: () => {
|
|
300
316
|
setIsExpanded(false);
|
|
301
317
|
setIsShowSecurityInfo(false);
|
|
302
318
|
} })) : (_jsx(IconButton, { onClick: handleClick, isExpanded: isExpanded, isShowCloseDialog: showCloseDialog, showCloseDialog: handleShowCloseDialog, dataLoaded: !!securityInfo })), !isExpanded && showCloseDialog && (_jsx(CloseDialog, { onClose: () => {
|
|
303
319
|
setIsShowCloseDialog(false);
|
|
304
320
|
} }))] }));
|
|
305
321
|
}
|
|
306
|
-
|
|
322
|
+
function injectIcon() {
|
|
307
323
|
return __awaiter(this, void 0, void 0, function* () {
|
|
308
324
|
const { isShow, i18n: i18nResponse } = yield globalThis.$onekey.$private.request({
|
|
309
325
|
method: 'wallet_isShowFloatingButton',
|
|
@@ -325,3 +341,14 @@ export function injectFloatingButton() {
|
|
|
325
341
|
render(_jsx(App, {}), document.body, div);
|
|
326
342
|
});
|
|
327
343
|
}
|
|
344
|
+
export function injectFloatingButton() {
|
|
345
|
+
globalThis.$onekey.$private.onNotifyFloatingIconChanged(({ showFloatingIcon }) => {
|
|
346
|
+
if (showFloatingIcon) {
|
|
347
|
+
void injectIcon();
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
removeIcon();
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
void injectIcon();
|
|
354
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/inpage-providers-hub",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -30,26 +30,26 @@
|
|
|
30
30
|
"start": "tsc --watch"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-core": "2.2.
|
|
34
|
-
"@onekeyfe/cross-inpage-provider-types": "2.2.
|
|
35
|
-
"@onekeyfe/onekey-algo-provider": "2.2.
|
|
36
|
-
"@onekeyfe/onekey-alph-provider": "2.2.
|
|
37
|
-
"@onekeyfe/onekey-aptos-provider": "2.2.
|
|
38
|
-
"@onekeyfe/onekey-bfc-provider": "2.2.
|
|
39
|
-
"@onekeyfe/onekey-btc-provider": "2.2.
|
|
40
|
-
"@onekeyfe/onekey-cardano-provider": "2.2.
|
|
41
|
-
"@onekeyfe/onekey-conflux-provider": "2.2.
|
|
42
|
-
"@onekeyfe/onekey-cosmos-provider": "2.2.
|
|
43
|
-
"@onekeyfe/onekey-eth-provider": "2.2.
|
|
44
|
-
"@onekeyfe/onekey-nostr-provider": "2.2.
|
|
45
|
-
"@onekeyfe/onekey-polkadot-provider": "2.2.
|
|
46
|
-
"@onekeyfe/onekey-private-provider": "2.2.
|
|
47
|
-
"@onekeyfe/onekey-scdo-provider": "2.2.
|
|
48
|
-
"@onekeyfe/onekey-solana-provider": "2.2.
|
|
49
|
-
"@onekeyfe/onekey-sui-provider": "2.2.
|
|
50
|
-
"@onekeyfe/onekey-ton-provider": "2.2.
|
|
51
|
-
"@onekeyfe/onekey-tron-provider": "2.2.
|
|
52
|
-
"@onekeyfe/onekey-webln-provider": "2.2.
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-core": "2.2.2",
|
|
34
|
+
"@onekeyfe/cross-inpage-provider-types": "2.2.2",
|
|
35
|
+
"@onekeyfe/onekey-algo-provider": "2.2.2",
|
|
36
|
+
"@onekeyfe/onekey-alph-provider": "2.2.2",
|
|
37
|
+
"@onekeyfe/onekey-aptos-provider": "2.2.2",
|
|
38
|
+
"@onekeyfe/onekey-bfc-provider": "2.2.2",
|
|
39
|
+
"@onekeyfe/onekey-btc-provider": "2.2.2",
|
|
40
|
+
"@onekeyfe/onekey-cardano-provider": "2.2.2",
|
|
41
|
+
"@onekeyfe/onekey-conflux-provider": "2.2.2",
|
|
42
|
+
"@onekeyfe/onekey-cosmos-provider": "2.2.2",
|
|
43
|
+
"@onekeyfe/onekey-eth-provider": "2.2.2",
|
|
44
|
+
"@onekeyfe/onekey-nostr-provider": "2.2.2",
|
|
45
|
+
"@onekeyfe/onekey-polkadot-provider": "2.2.2",
|
|
46
|
+
"@onekeyfe/onekey-private-provider": "2.2.2",
|
|
47
|
+
"@onekeyfe/onekey-scdo-provider": "2.2.2",
|
|
48
|
+
"@onekeyfe/onekey-solana-provider": "2.2.2",
|
|
49
|
+
"@onekeyfe/onekey-sui-provider": "2.2.2",
|
|
50
|
+
"@onekeyfe/onekey-ton-provider": "2.2.2",
|
|
51
|
+
"@onekeyfe/onekey-tron-provider": "2.2.2",
|
|
52
|
+
"@onekeyfe/onekey-webln-provider": "2.2.2",
|
|
53
53
|
"preact": "^10.25.1",
|
|
54
54
|
"web3": "^1.7.3"
|
|
55
55
|
},
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"@types/node": "^20.12.7",
|
|
59
59
|
"playwright": "^1.43.1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "c8e8c48be31f7ab33e4f38edd2cb5230a085563b"
|
|
62
62
|
}
|