@fileverse-dev/fortune-react 1.0.88-patch-1 → 1.0.88-patch-3
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.
|
@@ -27,11 +27,8 @@ export function timeFromNowMessage(expiryStr) {
|
|
|
27
27
|
if (!expiryStr) {
|
|
28
28
|
return "0 minute";
|
|
29
29
|
}
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
ss = _a[1];
|
|
33
|
-
var minutes = ss > 0 ? mm + 1 : mm;
|
|
34
|
-
return "".concat(minutes, " minute").concat(minutes !== 1 ? "s" : "");
|
|
30
|
+
var mm = expiryStr.split(":").map(Number)[0];
|
|
31
|
+
return "".concat(mm, " minute").concat(mm !== 1 ? "s" : "");
|
|
35
32
|
}
|
|
36
33
|
var FormulaHint = function FormulaHint(props) {
|
|
37
34
|
var _a;
|
|
@@ -57,11 +54,11 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
57
54
|
var _g = useState(""),
|
|
58
55
|
expiryTime = _g[0],
|
|
59
56
|
setExpiryTime = _g[1];
|
|
60
|
-
var isWrongGnosisPayConnector = localStorage.getItem("LOGIN_METHOD") !== "
|
|
57
|
+
var isWrongGnosisPayConnector = localStorage.getItem("LOGIN_METHOD") !== "walletAddress";
|
|
61
58
|
var handleGnosisPayToken = function handleGnosisPayToken(onDone) {
|
|
62
59
|
if (localStorage.getItem("GNOSIS_PAY_ACCESS")) {
|
|
63
60
|
var access = JSON.parse(localStorage.getItem("GNOSIS_PAY_ACCESS") || "");
|
|
64
|
-
if (!access || isExpired(access === null || access === void 0 ? void 0 : access.createdAt)) {
|
|
61
|
+
if (!(access === null || access === void 0 ? void 0 : access.token) || isExpired(access === null || access === void 0 ? void 0 : access.createdAt)) {
|
|
65
62
|
if (hasGnosisPayToken) {
|
|
66
63
|
setHasGnosisPayToken(false);
|
|
67
64
|
}
|
|
@@ -71,8 +68,17 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
71
68
|
return;
|
|
72
69
|
}
|
|
73
70
|
setHasGnosisPayToken(!!access.token);
|
|
74
|
-
setExpiryTime(formatExpiryTime(access.
|
|
71
|
+
setExpiryTime(formatExpiryTime(access.createdAt));
|
|
75
72
|
onDone === null || onDone === void 0 ? void 0 : onDone();
|
|
73
|
+
} else {
|
|
74
|
+
var urlParams = new URLSearchParams(window.location.search);
|
|
75
|
+
var isRejected = urlParams.has("reject");
|
|
76
|
+
if (isRejected) {
|
|
77
|
+
var url = new URL(window.location.href);
|
|
78
|
+
url.searchParams.delete("reject");
|
|
79
|
+
window.history.replaceState({}, "", url.toString());
|
|
80
|
+
onDone === null || onDone === void 0 ? void 0 : onDone();
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
};
|
|
78
84
|
useEffect(function () {
|
|
@@ -139,6 +145,9 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
139
145
|
};
|
|
140
146
|
}, []);
|
|
141
147
|
var gnosisTokenTokenIntervalRef = useRef(null);
|
|
148
|
+
var _j = useState(false),
|
|
149
|
+
isLoading = _j[0],
|
|
150
|
+
setIsLoading = _j[1];
|
|
142
151
|
useEffect(function () {
|
|
143
152
|
return function () {
|
|
144
153
|
if (gnosisTokenTokenIntervalRef.current) clearInterval(gnosisTokenTokenIntervalRef.current);
|
|
@@ -335,16 +344,22 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
335
344
|
var button = document.getElementById("grant-gnosispay-access");
|
|
336
345
|
if (!button) return;
|
|
337
346
|
button.click();
|
|
347
|
+
setIsLoading(true);
|
|
338
348
|
var interval = setInterval(function () {
|
|
339
349
|
handleGnosisPayToken(function () {
|
|
340
|
-
|
|
350
|
+
clearInterval(interval);
|
|
351
|
+
setIsLoading(false);
|
|
341
352
|
});
|
|
342
353
|
}, 5000);
|
|
343
354
|
gnosisTokenTokenIntervalRef.current = interval;
|
|
344
355
|
},
|
|
345
|
-
disabled: hasGnosisPayToken || isWrongGnosisPayConnector,
|
|
346
|
-
className: "w-full flex gap-1"
|
|
347
|
-
},
|
|
356
|
+
disabled: hasGnosisPayToken || isWrongGnosisPayConnector || isLoading,
|
|
357
|
+
className: "w-full items-center flex gap-1"
|
|
358
|
+
}, isLoading && (/*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
359
|
+
name: "LoaderCircle",
|
|
360
|
+
className: "animate-spin",
|
|
361
|
+
size: "sm"
|
|
362
|
+
}))), /*#__PURE__*/React.createElement("p", null, "Grant access "), " ", expiryTime && /*#__PURE__*/React.createElement("div", null, expiryTime))))), /*#__PURE__*/React.createElement("div", {
|
|
348
363
|
style: {
|
|
349
364
|
backgroundColor: "white",
|
|
350
365
|
padding: "6px",
|
|
@@ -19,7 +19,7 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
19
19
|
var _b = useContext(WorkbookContext),
|
|
20
20
|
context = _b.context,
|
|
21
21
|
isAuthorized = _b.settings.isAuthorized;
|
|
22
|
-
var isWrongGnosisPayConnector = localStorage.getItem("LOGIN_METHOD") !== "
|
|
22
|
+
var isWrongGnosisPayConnector = localStorage.getItem("LOGIN_METHOD") !== "walletAddress";
|
|
23
23
|
var authedFunction = ["COINGECKO", "ETHERSCAN", "DEFILLAMA", "GNOSIS", "BASE", "EOA", "PNL", "SAFE", "BLOCKSCOUT", "GNOSIS", "LENS", "FARCASTER", "Ethereum", "SMARTCONTRACT"];
|
|
24
24
|
var filteredDefaultCandidates = context.defaultCandidates.filter(function (item) {
|
|
25
25
|
return !authedFunction.includes(item.n);
|
|
@@ -39,11 +39,8 @@ function timeFromNowMessage(expiryStr) {
|
|
|
39
39
|
if (!expiryStr) {
|
|
40
40
|
return "0 minute";
|
|
41
41
|
}
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
ss = _a[1];
|
|
45
|
-
var minutes = ss > 0 ? mm + 1 : mm;
|
|
46
|
-
return "".concat(minutes, " minute").concat(minutes !== 1 ? "s" : "");
|
|
42
|
+
var mm = expiryStr.split(":").map(Number)[0];
|
|
43
|
+
return "".concat(mm, " minute").concat(mm !== 1 ? "s" : "");
|
|
47
44
|
}
|
|
48
45
|
var FormulaHint = function FormulaHint(props) {
|
|
49
46
|
var _a;
|
|
@@ -69,11 +66,11 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
69
66
|
var _g = (0, _react.useState)(""),
|
|
70
67
|
expiryTime = _g[0],
|
|
71
68
|
setExpiryTime = _g[1];
|
|
72
|
-
var isWrongGnosisPayConnector = localStorage.getItem("LOGIN_METHOD") !== "
|
|
69
|
+
var isWrongGnosisPayConnector = localStorage.getItem("LOGIN_METHOD") !== "walletAddress";
|
|
73
70
|
var handleGnosisPayToken = function handleGnosisPayToken(onDone) {
|
|
74
71
|
if (localStorage.getItem("GNOSIS_PAY_ACCESS")) {
|
|
75
72
|
var access = JSON.parse(localStorage.getItem("GNOSIS_PAY_ACCESS") || "");
|
|
76
|
-
if (!access || isExpired(access === null || access === void 0 ? void 0 : access.createdAt)) {
|
|
73
|
+
if (!(access === null || access === void 0 ? void 0 : access.token) || isExpired(access === null || access === void 0 ? void 0 : access.createdAt)) {
|
|
77
74
|
if (hasGnosisPayToken) {
|
|
78
75
|
setHasGnosisPayToken(false);
|
|
79
76
|
}
|
|
@@ -83,8 +80,17 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
83
80
|
return;
|
|
84
81
|
}
|
|
85
82
|
setHasGnosisPayToken(!!access.token);
|
|
86
|
-
setExpiryTime(formatExpiryTime(access.
|
|
83
|
+
setExpiryTime(formatExpiryTime(access.createdAt));
|
|
87
84
|
onDone === null || onDone === void 0 ? void 0 : onDone();
|
|
85
|
+
} else {
|
|
86
|
+
var urlParams = new URLSearchParams(window.location.search);
|
|
87
|
+
var isRejected = urlParams.has("reject");
|
|
88
|
+
if (isRejected) {
|
|
89
|
+
var url = new URL(window.location.href);
|
|
90
|
+
url.searchParams.delete("reject");
|
|
91
|
+
window.history.replaceState({}, "", url.toString());
|
|
92
|
+
onDone === null || onDone === void 0 ? void 0 : onDone();
|
|
93
|
+
}
|
|
88
94
|
}
|
|
89
95
|
};
|
|
90
96
|
(0, _react.useEffect)(function () {
|
|
@@ -151,6 +157,9 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
151
157
|
};
|
|
152
158
|
}, []);
|
|
153
159
|
var gnosisTokenTokenIntervalRef = (0, _react.useRef)(null);
|
|
160
|
+
var _j = (0, _react.useState)(false),
|
|
161
|
+
isLoading = _j[0],
|
|
162
|
+
setIsLoading = _j[1];
|
|
154
163
|
(0, _react.useEffect)(function () {
|
|
155
164
|
return function () {
|
|
156
165
|
if (gnosisTokenTokenIntervalRef.current) clearInterval(gnosisTokenTokenIntervalRef.current);
|
|
@@ -347,16 +356,22 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
347
356
|
var button = document.getElementById("grant-gnosispay-access");
|
|
348
357
|
if (!button) return;
|
|
349
358
|
button.click();
|
|
359
|
+
setIsLoading(true);
|
|
350
360
|
var interval = setInterval(function () {
|
|
351
361
|
handleGnosisPayToken(function () {
|
|
352
|
-
|
|
362
|
+
clearInterval(interval);
|
|
363
|
+
setIsLoading(false);
|
|
353
364
|
});
|
|
354
365
|
}, 5000);
|
|
355
366
|
gnosisTokenTokenIntervalRef.current = interval;
|
|
356
367
|
},
|
|
357
|
-
disabled: hasGnosisPayToken || isWrongGnosisPayConnector,
|
|
358
|
-
className: "w-full flex gap-1"
|
|
359
|
-
},
|
|
368
|
+
disabled: hasGnosisPayToken || isWrongGnosisPayConnector || isLoading,
|
|
369
|
+
className: "w-full items-center flex gap-1"
|
|
370
|
+
}, isLoading && (/*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
|
|
371
|
+
name: "LoaderCircle",
|
|
372
|
+
className: "animate-spin",
|
|
373
|
+
size: "sm"
|
|
374
|
+
}))), /*#__PURE__*/_react.default.createElement("p", null, "Grant access "), " ", expiryTime && /*#__PURE__*/_react.default.createElement("div", null, expiryTime))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
360
375
|
style: {
|
|
361
376
|
backgroundColor: "white",
|
|
362
377
|
padding: "6px",
|
|
@@ -28,7 +28,7 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
28
28
|
var _b = (0, _react.useContext)(_context.default),
|
|
29
29
|
context = _b.context,
|
|
30
30
|
isAuthorized = _b.settings.isAuthorized;
|
|
31
|
-
var isWrongGnosisPayConnector = localStorage.getItem("LOGIN_METHOD") !== "
|
|
31
|
+
var isWrongGnosisPayConnector = localStorage.getItem("LOGIN_METHOD") !== "walletAddress";
|
|
32
32
|
var authedFunction = ["COINGECKO", "ETHERSCAN", "DEFILLAMA", "GNOSIS", "BASE", "EOA", "PNL", "SAFE", "BLOCKSCOUT", "GNOSIS", "LENS", "FARCASTER", "Ethereum", "SMARTCONTRACT"];
|
|
33
33
|
var filteredDefaultCandidates = context.defaultCandidates.filter(function (item) {
|
|
34
34
|
return !authedFunction.includes(item.n);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.0.88-patch-
|
|
3
|
+
"version": "1.0.88-patch-3",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"tsc": "tsc"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@fileverse-dev/fortune-core": "1.0.88-patch-
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.0.88-patch-3",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-21",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|