@fileverse-dev/fortune-react 1.0.87 → 1.0.88-patch-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/SheetOverlay/FormulaHint/index.d.ts +3 -0
- package/es/components/SheetOverlay/FormulaHint/index.js +97 -7
- package/es/components/SheetOverlay/FormulaSearch/index.js +25 -3
- package/es/components/Toolbar/index.js +1 -2
- package/lib/components/SheetOverlay/FormulaHint/index.d.ts +3 -0
- package/lib/components/SheetOverlay/FormulaHint/index.js +100 -7
- package/lib/components/SheetOverlay/FormulaSearch/index.js +25 -3
- package/lib/components/Toolbar/index.js +1 -2
- package/package.json +2 -2
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./index.css";
|
|
3
|
+
export declare function formatExpiryTime(createdAt: number): string;
|
|
4
|
+
export declare function isExpired(createdAt: number): boolean;
|
|
5
|
+
export declare function timeFromNowMessage(expiryStr: string): string;
|
|
3
6
|
declare const FormulaHint: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
4
7
|
export default FormulaHint;
|
|
@@ -13,6 +13,26 @@ import { Button, TextField, LucideIcon } from "@fileverse/ui";
|
|
|
13
13
|
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
14
14
|
import WorkbookContext from "../../../context";
|
|
15
15
|
import "./index.css";
|
|
16
|
+
export function formatExpiryTime(createdAt) {
|
|
17
|
+
var expiry = new Date(createdAt + 60 * 60 * 1000);
|
|
18
|
+
var mm = String(expiry.getMinutes()).padStart(2, "0");
|
|
19
|
+
var ss = String(expiry.getSeconds()).padStart(2, "0");
|
|
20
|
+
return "".concat(mm, ":").concat(ss);
|
|
21
|
+
}
|
|
22
|
+
export function isExpired(createdAt) {
|
|
23
|
+
var expiryTs = createdAt + 60 * 60 * 1000;
|
|
24
|
+
return Date.now() > expiryTs;
|
|
25
|
+
}
|
|
26
|
+
export function timeFromNowMessage(expiryStr) {
|
|
27
|
+
if (!expiryStr) {
|
|
28
|
+
return "0 minute";
|
|
29
|
+
}
|
|
30
|
+
var _a = expiryStr.split(":").map(Number),
|
|
31
|
+
mm = _a[0],
|
|
32
|
+
ss = _a[1];
|
|
33
|
+
var minutes = ss > 0 ? mm + 1 : mm;
|
|
34
|
+
return "".concat(minutes, " minute").concat(minutes !== 1 ? "s" : "");
|
|
35
|
+
}
|
|
16
36
|
var FormulaHint = function FormulaHint(props) {
|
|
17
37
|
var _a;
|
|
18
38
|
var context = useContext(WorkbookContext).context;
|
|
@@ -28,23 +48,48 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
28
48
|
var _d = useState(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
|
|
29
49
|
isKeyAdded = _d[0],
|
|
30
50
|
setApiKeyAdded = _d[1];
|
|
31
|
-
var _e = useState(
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
var _e = useState(false),
|
|
52
|
+
hasGnosisPayToken = _e[0],
|
|
53
|
+
setHasGnosisPayToken = _e[1];
|
|
54
|
+
var _f = useState(true),
|
|
55
|
+
showFunctionBody = _f[0],
|
|
56
|
+
setShouldShowFunctionBody = _f[1];
|
|
57
|
+
var _g = useState(""),
|
|
58
|
+
expiryTime = _g[0],
|
|
59
|
+
setExpiryTime = _g[1];
|
|
60
|
+
var isWrongGnosisPayConnector = localStorage.getItem("LOGIN_METHOD") !== "wallet";
|
|
61
|
+
var handleGnosisPayToken = function handleGnosisPayToken(onDone) {
|
|
62
|
+
if (localStorage.getItem("GNOSIS_PAY_ACCESS")) {
|
|
63
|
+
var access = JSON.parse(localStorage.getItem("GNOSIS_PAY_ACCESS") || "");
|
|
64
|
+
if (!access || isExpired(access === null || access === void 0 ? void 0 : access.createdAt)) {
|
|
65
|
+
if (hasGnosisPayToken) {
|
|
66
|
+
setHasGnosisPayToken(false);
|
|
67
|
+
}
|
|
68
|
+
if (expiryTime) {
|
|
69
|
+
setExpiryTime("");
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
setHasGnosisPayToken(!!access.token);
|
|
74
|
+
setExpiryTime(formatExpiryTime(access.createAt));
|
|
75
|
+
onDone === null || onDone === void 0 ? void 0 : onDone();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
34
78
|
useEffect(function () {
|
|
35
79
|
if (fn) {
|
|
36
80
|
setApiKeyAdded(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY));
|
|
37
81
|
setAPI_KEY(localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY) || "");
|
|
38
82
|
setShowAPInput(!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY));
|
|
83
|
+
handleGnosisPayToken();
|
|
39
84
|
}
|
|
40
85
|
}, [fn]);
|
|
41
86
|
var apiKeyPlaceholder = {
|
|
42
87
|
ETHERSCAN_API_KEY: "Etherscan API key"
|
|
43
88
|
};
|
|
44
89
|
var hintRef = useRef(null);
|
|
45
|
-
var
|
|
46
|
-
top =
|
|
47
|
-
setTop =
|
|
90
|
+
var _h = useState(0),
|
|
91
|
+
top = _h[0],
|
|
92
|
+
setTop = _h[1];
|
|
48
93
|
var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
|
|
49
94
|
var _a, _b, _c;
|
|
50
95
|
if (!((_a = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) === null || _a === void 0 ? void 0 : _a.toString()) || !((_b = firstSelection.height_move) === null || _b === void 0 ? void 0 : _b.toString()) || !hintRef.current) return;
|
|
@@ -93,6 +138,12 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
93
138
|
if (el && handleWheel) el.removeEventListener("wheel", handleWheel);
|
|
94
139
|
};
|
|
95
140
|
}, []);
|
|
141
|
+
var gnosisTokenTokenIntervalRef = useRef(null);
|
|
142
|
+
useEffect(function () {
|
|
143
|
+
return function () {
|
|
144
|
+
if (gnosisTokenTokenIntervalRef.current) clearInterval(gnosisTokenTokenIntervalRef.current);
|
|
145
|
+
};
|
|
146
|
+
}, [gnosisTokenTokenIntervalRef]);
|
|
96
147
|
if (!fn) return null;
|
|
97
148
|
return /*#__PURE__*/React.createElement("div", __assign({}, props, {
|
|
98
149
|
ref: hintRef,
|
|
@@ -254,7 +305,46 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
254
305
|
},
|
|
255
306
|
disabled: !API_KEY,
|
|
256
307
|
className: "min-w-[80px]"
|
|
257
|
-
}, "Ok"))))))), /*#__PURE__*/React.createElement("div", {
|
|
308
|
+
}, "Ok"))))))), fn.n === "GNOSISPAY" && (/*#__PURE__*/React.createElement("div", {
|
|
309
|
+
style: {
|
|
310
|
+
borderLeft: "4px solid ".concat(hasGnosisPayToken ? "#177E23" : "#fb923c"),
|
|
311
|
+
backgroundColor: "white",
|
|
312
|
+
padding: "16px",
|
|
313
|
+
margin: "4px 4px 0px 4px",
|
|
314
|
+
borderRadius: "4px"
|
|
315
|
+
}
|
|
316
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
317
|
+
style: {
|
|
318
|
+
display: "flex",
|
|
319
|
+
justifyContent: "space-between",
|
|
320
|
+
cursor: "pointer"
|
|
321
|
+
},
|
|
322
|
+
onClick: function onClick() {}
|
|
323
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
324
|
+
style: {
|
|
325
|
+
margin: "0 0 8px 0"
|
|
326
|
+
},
|
|
327
|
+
className: "text-heading-xsm color-text-default"
|
|
328
|
+
}, hasGnosisPayToken ? "Access granted" : "Access required")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
|
|
329
|
+
style: {
|
|
330
|
+
margin: "0 0 16px 0"
|
|
331
|
+
},
|
|
332
|
+
className: "text-body-sm color-text-default"
|
|
333
|
+
}, !hasGnosisPayToken ? "To access your Gnosis Pay account, please grant permission. Your dSheet account should be created via the same wallet ss your Gnosis Pay. " : " You have ".concat(timeFromNowMessage(expiryTime), " to use your Gnosis Pay account. Then you need to grand access again.")), /*#__PURE__*/React.createElement(Button, {
|
|
334
|
+
onClick: function onClick() {
|
|
335
|
+
var button = document.getElementById("grant-gnosispay-access");
|
|
336
|
+
if (!button) return;
|
|
337
|
+
button.click();
|
|
338
|
+
var interval = setInterval(function () {
|
|
339
|
+
handleGnosisPayToken(function () {
|
|
340
|
+
return clearInterval(interval);
|
|
341
|
+
});
|
|
342
|
+
}, 5000);
|
|
343
|
+
gnosisTokenTokenIntervalRef.current = interval;
|
|
344
|
+
},
|
|
345
|
+
disabled: hasGnosisPayToken || isWrongGnosisPayConnector,
|
|
346
|
+
className: "w-full flex gap-1"
|
|
347
|
+
}, /*#__PURE__*/React.createElement("p", null, "Grant access "), " ", expiryTime && /*#__PURE__*/React.createElement("div", null, expiryTime))))), /*#__PURE__*/React.createElement("div", {
|
|
258
348
|
style: {
|
|
259
349
|
backgroundColor: "white",
|
|
260
350
|
padding: "6px",
|
|
@@ -19,6 +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") !== "wallet";
|
|
22
23
|
var authedFunction = ["COINGECKO", "ETHERSCAN", "DEFILLAMA", "GNOSIS", "BASE", "EOA", "PNL", "SAFE", "BLOCKSCOUT", "GNOSIS", "LENS", "FARCASTER", "Ethereum", "SMARTCONTRACT"];
|
|
23
24
|
var filteredDefaultCandidates = context.defaultCandidates.filter(function (item) {
|
|
24
25
|
return !authedFunction.includes(item.n);
|
|
@@ -166,8 +167,18 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
166
167
|
justifyContent: "space-between"
|
|
167
168
|
}
|
|
168
169
|
}, /*#__PURE__*/React.createElement("div", {
|
|
170
|
+
className: "flex items-center"
|
|
171
|
+
}, v.LOGO && isWrongGnosisPayConnector && v.n === "GNOSISPAY" && (/*#__PURE__*/React.createElement("div", {
|
|
172
|
+
className: "mr-2"
|
|
173
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
174
|
+
src: v.LOGO,
|
|
175
|
+
alt: "Service Logo",
|
|
176
|
+
style: {
|
|
177
|
+
width: "16px"
|
|
178
|
+
}
|
|
179
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
169
180
|
className: "luckysheet-formula-search-func color-text-default text-body-sm"
|
|
170
|
-
}, v.n), /*#__PURE__*/React.createElement("div", {
|
|
181
|
+
}, v.n)), /*#__PURE__*/React.createElement("div", {
|
|
171
182
|
style: {
|
|
172
183
|
display: "flex",
|
|
173
184
|
justifyContent: "end",
|
|
@@ -175,7 +186,18 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
175
186
|
alignItems: "center",
|
|
176
187
|
gap: "6px"
|
|
177
188
|
}
|
|
178
|
-
}, v.
|
|
189
|
+
}, isWrongGnosisPayConnector && v.n === "GNOSISPAY" ? (/*#__PURE__*/React.createElement(Tooltip, {
|
|
190
|
+
position: "right",
|
|
191
|
+
text: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, "Your dSheet account was created via email/social. Unfortunately you are not able to use Gnosis Pay onchain function."), /*#__PURE__*/React.createElement("p", {
|
|
192
|
+
className: "mt-4"
|
|
193
|
+
}, "To use Gnosis Pay onchain function you need to create a new dSheets account via the same wallet as your Gnosis Pay account."))
|
|
194
|
+
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
195
|
+
name: "Info",
|
|
196
|
+
size: "sm",
|
|
197
|
+
style: {
|
|
198
|
+
color: "#F16227"
|
|
199
|
+
}
|
|
200
|
+
}))) : (/*#__PURE__*/React.createElement(React.Fragment, null, v.LOGO && (/*#__PURE__*/React.createElement("img", {
|
|
179
201
|
src: v.LOGO,
|
|
180
202
|
alt: "Service Logo",
|
|
181
203
|
style: {
|
|
@@ -204,7 +226,7 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
204
226
|
width: "12px",
|
|
205
227
|
height: "12px"
|
|
206
228
|
}
|
|
207
|
-
})))))), /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
})))))))), /*#__PURE__*/React.createElement("div", {
|
|
208
230
|
className: "luckysheet-formula-search-detail mt-1 text-helper-text-sm color-text-secondary"
|
|
209
231
|
}, v.d));
|
|
210
232
|
}), finalFunctionCandidates.length === 0 && (/*#__PURE__*/React.createElement("span", null, !isAuthorized && (/*#__PURE__*/React.createElement("div", {
|
|
@@ -1476,7 +1476,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1476
1476
|
icon: "Minus",
|
|
1477
1477
|
variant: "ghost",
|
|
1478
1478
|
size: "sm",
|
|
1479
|
-
className: "
|
|
1479
|
+
className: "",
|
|
1480
1480
|
disabled: decimals === 1,
|
|
1481
1481
|
onClick: function onClick() {
|
|
1482
1482
|
return handleCurrencyDecimalsChange_1(Math.max(1, decimals - 1));
|
|
@@ -1493,7 +1493,6 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1493
1493
|
icon: "Plus",
|
|
1494
1494
|
variant: "ghost",
|
|
1495
1495
|
size: "sm",
|
|
1496
|
-
className: "!bg-transparent",
|
|
1497
1496
|
disabled: decimals === 18,
|
|
1498
1497
|
onClick: function onClick() {
|
|
1499
1498
|
return handleCurrencyDecimalsChange_1(Math.min(18, decimals + 1));
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./index.css";
|
|
3
|
+
export declare function formatExpiryTime(createdAt: number): string;
|
|
4
|
+
export declare function isExpired(createdAt: number): boolean;
|
|
5
|
+
export declare function timeFromNowMessage(expiryStr: string): string;
|
|
3
6
|
declare const FormulaHint: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
4
7
|
export default FormulaHint;
|
|
@@ -5,6 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
exports.formatExpiryTime = formatExpiryTime;
|
|
9
|
+
exports.isExpired = isExpired;
|
|
10
|
+
exports.timeFromNowMessage = timeFromNowMessage;
|
|
8
11
|
var _fortuneCore = require("@fileverse-dev/fortune-core");
|
|
9
12
|
var _ui = require("@fileverse/ui");
|
|
10
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -22,6 +25,26 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
22
25
|
};
|
|
23
26
|
return __assign.apply(this, arguments);
|
|
24
27
|
};
|
|
28
|
+
function formatExpiryTime(createdAt) {
|
|
29
|
+
var expiry = new Date(createdAt + 60 * 60 * 1000);
|
|
30
|
+
var mm = String(expiry.getMinutes()).padStart(2, "0");
|
|
31
|
+
var ss = String(expiry.getSeconds()).padStart(2, "0");
|
|
32
|
+
return "".concat(mm, ":").concat(ss);
|
|
33
|
+
}
|
|
34
|
+
function isExpired(createdAt) {
|
|
35
|
+
var expiryTs = createdAt + 60 * 60 * 1000;
|
|
36
|
+
return Date.now() > expiryTs;
|
|
37
|
+
}
|
|
38
|
+
function timeFromNowMessage(expiryStr) {
|
|
39
|
+
if (!expiryStr) {
|
|
40
|
+
return "0 minute";
|
|
41
|
+
}
|
|
42
|
+
var _a = expiryStr.split(":").map(Number),
|
|
43
|
+
mm = _a[0],
|
|
44
|
+
ss = _a[1];
|
|
45
|
+
var minutes = ss > 0 ? mm + 1 : mm;
|
|
46
|
+
return "".concat(minutes, " minute").concat(minutes !== 1 ? "s" : "");
|
|
47
|
+
}
|
|
25
48
|
var FormulaHint = function FormulaHint(props) {
|
|
26
49
|
var _a;
|
|
27
50
|
var context = (0, _react.useContext)(_context.default).context;
|
|
@@ -37,23 +60,48 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
37
60
|
var _d = (0, _react.useState)(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
|
|
38
61
|
isKeyAdded = _d[0],
|
|
39
62
|
setApiKeyAdded = _d[1];
|
|
40
|
-
var _e = (0, _react.useState)(
|
|
41
|
-
|
|
42
|
-
|
|
63
|
+
var _e = (0, _react.useState)(false),
|
|
64
|
+
hasGnosisPayToken = _e[0],
|
|
65
|
+
setHasGnosisPayToken = _e[1];
|
|
66
|
+
var _f = (0, _react.useState)(true),
|
|
67
|
+
showFunctionBody = _f[0],
|
|
68
|
+
setShouldShowFunctionBody = _f[1];
|
|
69
|
+
var _g = (0, _react.useState)(""),
|
|
70
|
+
expiryTime = _g[0],
|
|
71
|
+
setExpiryTime = _g[1];
|
|
72
|
+
var isWrongGnosisPayConnector = localStorage.getItem("LOGIN_METHOD") !== "wallet";
|
|
73
|
+
var handleGnosisPayToken = function handleGnosisPayToken(onDone) {
|
|
74
|
+
if (localStorage.getItem("GNOSIS_PAY_ACCESS")) {
|
|
75
|
+
var access = JSON.parse(localStorage.getItem("GNOSIS_PAY_ACCESS") || "");
|
|
76
|
+
if (!access || isExpired(access === null || access === void 0 ? void 0 : access.createdAt)) {
|
|
77
|
+
if (hasGnosisPayToken) {
|
|
78
|
+
setHasGnosisPayToken(false);
|
|
79
|
+
}
|
|
80
|
+
if (expiryTime) {
|
|
81
|
+
setExpiryTime("");
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
setHasGnosisPayToken(!!access.token);
|
|
86
|
+
setExpiryTime(formatExpiryTime(access.createAt));
|
|
87
|
+
onDone === null || onDone === void 0 ? void 0 : onDone();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
43
90
|
(0, _react.useEffect)(function () {
|
|
44
91
|
if (fn) {
|
|
45
92
|
setApiKeyAdded(!!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY));
|
|
46
93
|
setAPI_KEY(localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY) || "");
|
|
47
94
|
setShowAPInput(!localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY));
|
|
95
|
+
handleGnosisPayToken();
|
|
48
96
|
}
|
|
49
97
|
}, [fn]);
|
|
50
98
|
var apiKeyPlaceholder = {
|
|
51
99
|
ETHERSCAN_API_KEY: "Etherscan API key"
|
|
52
100
|
};
|
|
53
101
|
var hintRef = (0, _react.useRef)(null);
|
|
54
|
-
var
|
|
55
|
-
top =
|
|
56
|
-
setTop =
|
|
102
|
+
var _h = (0, _react.useState)(0),
|
|
103
|
+
top = _h[0],
|
|
104
|
+
setTop = _h[1];
|
|
57
105
|
var calcuatePopUpPlacement = function calcuatePopUpPlacement() {
|
|
58
106
|
var _a, _b, _c;
|
|
59
107
|
if (!((_a = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.top) === null || _a === void 0 ? void 0 : _a.toString()) || !((_b = firstSelection.height_move) === null || _b === void 0 ? void 0 : _b.toString()) || !hintRef.current) return;
|
|
@@ -102,6 +150,12 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
102
150
|
if (el && handleWheel) el.removeEventListener("wheel", handleWheel);
|
|
103
151
|
};
|
|
104
152
|
}, []);
|
|
153
|
+
var gnosisTokenTokenIntervalRef = (0, _react.useRef)(null);
|
|
154
|
+
(0, _react.useEffect)(function () {
|
|
155
|
+
return function () {
|
|
156
|
+
if (gnosisTokenTokenIntervalRef.current) clearInterval(gnosisTokenTokenIntervalRef.current);
|
|
157
|
+
};
|
|
158
|
+
}, [gnosisTokenTokenIntervalRef]);
|
|
105
159
|
if (!fn) return null;
|
|
106
160
|
return /*#__PURE__*/_react.default.createElement("div", __assign({}, props, {
|
|
107
161
|
ref: hintRef,
|
|
@@ -263,7 +317,46 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
263
317
|
},
|
|
264
318
|
disabled: !API_KEY,
|
|
265
319
|
className: "min-w-[80px]"
|
|
266
|
-
}, "Ok"))))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
320
|
+
}, "Ok"))))))), fn.n === "GNOSISPAY" && (/*#__PURE__*/_react.default.createElement("div", {
|
|
321
|
+
style: {
|
|
322
|
+
borderLeft: "4px solid ".concat(hasGnosisPayToken ? "#177E23" : "#fb923c"),
|
|
323
|
+
backgroundColor: "white",
|
|
324
|
+
padding: "16px",
|
|
325
|
+
margin: "4px 4px 0px 4px",
|
|
326
|
+
borderRadius: "4px"
|
|
327
|
+
}
|
|
328
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
329
|
+
style: {
|
|
330
|
+
display: "flex",
|
|
331
|
+
justifyContent: "space-between",
|
|
332
|
+
cursor: "pointer"
|
|
333
|
+
},
|
|
334
|
+
onClick: function onClick() {}
|
|
335
|
+
}, /*#__PURE__*/_react.default.createElement("h3", {
|
|
336
|
+
style: {
|
|
337
|
+
margin: "0 0 8px 0"
|
|
338
|
+
},
|
|
339
|
+
className: "text-heading-xsm color-text-default"
|
|
340
|
+
}, hasGnosisPayToken ? "Access granted" : "Access required")), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", {
|
|
341
|
+
style: {
|
|
342
|
+
margin: "0 0 16px 0"
|
|
343
|
+
},
|
|
344
|
+
className: "text-body-sm color-text-default"
|
|
345
|
+
}, !hasGnosisPayToken ? "To access your Gnosis Pay account, please grant permission. Your dSheet account should be created via the same wallet ss your Gnosis Pay. " : " You have ".concat(timeFromNowMessage(expiryTime), " to use your Gnosis Pay account. Then you need to grand access again.")), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
346
|
+
onClick: function onClick() {
|
|
347
|
+
var button = document.getElementById("grant-gnosispay-access");
|
|
348
|
+
if (!button) return;
|
|
349
|
+
button.click();
|
|
350
|
+
var interval = setInterval(function () {
|
|
351
|
+
handleGnosisPayToken(function () {
|
|
352
|
+
return clearInterval(interval);
|
|
353
|
+
});
|
|
354
|
+
}, 5000);
|
|
355
|
+
gnosisTokenTokenIntervalRef.current = interval;
|
|
356
|
+
},
|
|
357
|
+
disabled: hasGnosisPayToken || isWrongGnosisPayConnector,
|
|
358
|
+
className: "w-full flex gap-1"
|
|
359
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, "Grant access "), " ", expiryTime && /*#__PURE__*/_react.default.createElement("div", null, expiryTime))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
267
360
|
style: {
|
|
268
361
|
backgroundColor: "white",
|
|
269
362
|
padding: "6px",
|
|
@@ -28,6 +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") !== "wallet";
|
|
31
32
|
var authedFunction = ["COINGECKO", "ETHERSCAN", "DEFILLAMA", "GNOSIS", "BASE", "EOA", "PNL", "SAFE", "BLOCKSCOUT", "GNOSIS", "LENS", "FARCASTER", "Ethereum", "SMARTCONTRACT"];
|
|
32
33
|
var filteredDefaultCandidates = context.defaultCandidates.filter(function (item) {
|
|
33
34
|
return !authedFunction.includes(item.n);
|
|
@@ -175,8 +176,18 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
175
176
|
justifyContent: "space-between"
|
|
176
177
|
}
|
|
177
178
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
179
|
+
className: "flex items-center"
|
|
180
|
+
}, v.LOGO && isWrongGnosisPayConnector && v.n === "GNOSISPAY" && (/*#__PURE__*/_react.default.createElement("div", {
|
|
181
|
+
className: "mr-2"
|
|
182
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
183
|
+
src: v.LOGO,
|
|
184
|
+
alt: "Service Logo",
|
|
185
|
+
style: {
|
|
186
|
+
width: "16px"
|
|
187
|
+
}
|
|
188
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
178
189
|
className: "luckysheet-formula-search-func color-text-default text-body-sm"
|
|
179
|
-
}, v.n), /*#__PURE__*/_react.default.createElement("div", {
|
|
190
|
+
}, v.n)), /*#__PURE__*/_react.default.createElement("div", {
|
|
180
191
|
style: {
|
|
181
192
|
display: "flex",
|
|
182
193
|
justifyContent: "end",
|
|
@@ -184,7 +195,18 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
184
195
|
alignItems: "center",
|
|
185
196
|
gap: "6px"
|
|
186
197
|
}
|
|
187
|
-
}, v.
|
|
198
|
+
}, isWrongGnosisPayConnector && v.n === "GNOSISPAY" ? (/*#__PURE__*/_react.default.createElement(_ui.Tooltip, {
|
|
199
|
+
position: "right",
|
|
200
|
+
text: /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", null, "Your dSheet account was created via email/social. Unfortunately you are not able to use Gnosis Pay onchain function."), /*#__PURE__*/_react.default.createElement("p", {
|
|
201
|
+
className: "mt-4"
|
|
202
|
+
}, "To use Gnosis Pay onchain function you need to create a new dSheets account via the same wallet as your Gnosis Pay account."))
|
|
203
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
|
|
204
|
+
name: "Info",
|
|
205
|
+
size: "sm",
|
|
206
|
+
style: {
|
|
207
|
+
color: "#F16227"
|
|
208
|
+
}
|
|
209
|
+
}))) : (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, v.LOGO && (/*#__PURE__*/_react.default.createElement("img", {
|
|
188
210
|
src: v.LOGO,
|
|
189
211
|
alt: "Service Logo",
|
|
190
212
|
style: {
|
|
@@ -213,7 +235,7 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
213
235
|
width: "12px",
|
|
214
236
|
height: "12px"
|
|
215
237
|
}
|
|
216
|
-
})))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
238
|
+
})))))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
217
239
|
className: "luckysheet-formula-search-detail mt-1 text-helper-text-sm color-text-secondary"
|
|
218
240
|
}, v.d));
|
|
219
241
|
}), finalFunctionCandidates.length === 0 && (/*#__PURE__*/_react.default.createElement("span", null, !isAuthorized && (/*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1485,7 +1485,7 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1485
1485
|
icon: "Minus",
|
|
1486
1486
|
variant: "ghost",
|
|
1487
1487
|
size: "sm",
|
|
1488
|
-
className: "
|
|
1488
|
+
className: "",
|
|
1489
1489
|
disabled: decimals === 1,
|
|
1490
1490
|
onClick: function onClick() {
|
|
1491
1491
|
return handleCurrencyDecimalsChange_1(Math.max(1, decimals - 1));
|
|
@@ -1502,7 +1502,6 @@ var Toolbar = function Toolbar(_a) {
|
|
|
1502
1502
|
icon: "Plus",
|
|
1503
1503
|
variant: "ghost",
|
|
1504
1504
|
size: "sm",
|
|
1505
|
-
className: "!bg-transparent",
|
|
1506
1505
|
disabled: decimals === 18,
|
|
1507
1506
|
onClick: function onClick() {
|
|
1508
1507
|
return handleCurrencyDecimalsChange_1(Math.min(18, decimals + 1));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.88-patch-1",
|
|
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.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.0.88-patch-1",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-21",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|