@fileverse-dev/fortune-react 1.0.45 → 1.0.46
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.
|
@@ -75,7 +75,7 @@ var SheetTab = function SheetTab() {
|
|
|
75
75
|
}, /*#__PURE__*/React.createElement("div", {
|
|
76
76
|
className: "max-w-7xl mx-auto px-4 py-1"
|
|
77
77
|
}, /*#__PURE__*/React.createElement("p", {
|
|
78
|
-
className: "text-
|
|
78
|
+
className: "text-center text-xsm"
|
|
79
79
|
}, /*#__PURE__*/React.createElement("span", {
|
|
80
80
|
className: "font-medium"
|
|
81
81
|
}, "Disclaimer:"), " Prices aren't updated in real time, so they might be slightly different from the source when you check. Updates can be delayed by up to 20 minutes."))), /*#__PURE__*/React.createElement("div", {
|
|
@@ -145,7 +145,7 @@ export function convertCellsToCrypto(_a) {
|
|
|
145
145
|
decimals = _a.decimals,
|
|
146
146
|
baseCurrency = _a.baseCurrency;
|
|
147
147
|
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
-
var selections, flowdata, selectedCells, denomStr, coingeckoId, price;
|
|
148
|
+
var selections, flowdata, selectedCells, denomStr, coingeckoId, price, cellUpdates;
|
|
149
149
|
return __generator(this, function (_b) {
|
|
150
150
|
switch (_b.label) {
|
|
151
151
|
case 0:
|
|
@@ -169,6 +169,7 @@ export function convertCellsToCrypto(_a) {
|
|
|
169
169
|
return [4, getCryptoPrice(String(coingeckoId), baseCurrency.toLowerCase())];
|
|
170
170
|
case 1:
|
|
171
171
|
price = _b.sent();
|
|
172
|
+
cellUpdates = [];
|
|
172
173
|
selectedCells.forEach(function (_a) {
|
|
173
174
|
var _b, _c, _d;
|
|
174
175
|
var row = _a.row,
|
|
@@ -192,9 +193,21 @@ export function convertCellsToCrypto(_a) {
|
|
|
192
193
|
}
|
|
193
194
|
if (!baseValue || Number.isNaN(baseValue)) return;
|
|
194
195
|
var cryptoValue = baseValue / price;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
cellUpdates.push({
|
|
197
|
+
row: row,
|
|
198
|
+
col: col,
|
|
199
|
+
baseValue: baseValue,
|
|
200
|
+
cryptoValue: cryptoValue
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
setContext(function (ctx) {
|
|
204
|
+
var d = getFlowdata(ctx);
|
|
205
|
+
if (!d || !Array.isArray(d)) return;
|
|
206
|
+
cellUpdates.forEach(function (_a) {
|
|
207
|
+
var row = _a.row,
|
|
208
|
+
col = _a.col,
|
|
209
|
+
baseValue = _a.baseValue,
|
|
210
|
+
cryptoValue = _a.cryptoValue;
|
|
198
211
|
if (!d[row]) d[row] = [];
|
|
199
212
|
if (!d[row][col]) d[row][col] = {};
|
|
200
213
|
var cellCp = d[row][col];
|
package/es/utils/cryptoApi.js
CHANGED
|
@@ -125,7 +125,9 @@ export function getCryptoPrice(crypto, fiat) {
|
|
|
125
125
|
case 0:
|
|
126
126
|
key = "".concat(crypto, "-").concat(fiat).toLowerCase();
|
|
127
127
|
now = Date.now();
|
|
128
|
+
console.log("Fetching crypto price for ".concat(key), priceCache);
|
|
128
129
|
if (priceCache[key] && now - priceCache[key].timestamp < CACHE_DURATION) {
|
|
130
|
+
console.log("Using cached price for ".concat(key));
|
|
129
131
|
return [2, priceCache[key].price];
|
|
130
132
|
}
|
|
131
133
|
url = "".concat(COINGECKO_API, "?ids=").concat(crypto, "&vs_currencies=").concat(fiat);
|
|
@@ -84,7 +84,7 @@ var SheetTab = function SheetTab() {
|
|
|
84
84
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
85
85
|
className: "max-w-7xl mx-auto px-4 py-1"
|
|
86
86
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
87
|
-
className: "text-
|
|
87
|
+
className: "text-center text-xsm"
|
|
88
88
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
89
89
|
className: "font-medium"
|
|
90
90
|
}, "Disclaimer:"), " Prices aren't updated in real time, so they might be slightly different from the source when you check. Updates can be delayed by up to 20 minutes."))), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -152,7 +152,7 @@ function convertCellsToCrypto(_a) {
|
|
|
152
152
|
decimals = _a.decimals,
|
|
153
153
|
baseCurrency = _a.baseCurrency;
|
|
154
154
|
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
-
var selections, flowdata, selectedCells, denomStr, coingeckoId, price;
|
|
155
|
+
var selections, flowdata, selectedCells, denomStr, coingeckoId, price, cellUpdates;
|
|
156
156
|
return __generator(this, function (_b) {
|
|
157
157
|
switch (_b.label) {
|
|
158
158
|
case 0:
|
|
@@ -176,6 +176,7 @@ function convertCellsToCrypto(_a) {
|
|
|
176
176
|
return [4, (0, _cryptoApi.getCryptoPrice)(String(coingeckoId), baseCurrency.toLowerCase())];
|
|
177
177
|
case 1:
|
|
178
178
|
price = _b.sent();
|
|
179
|
+
cellUpdates = [];
|
|
179
180
|
selectedCells.forEach(function (_a) {
|
|
180
181
|
var _b, _c, _d;
|
|
181
182
|
var row = _a.row,
|
|
@@ -199,9 +200,21 @@ function convertCellsToCrypto(_a) {
|
|
|
199
200
|
}
|
|
200
201
|
if (!baseValue || Number.isNaN(baseValue)) return;
|
|
201
202
|
var cryptoValue = baseValue / price;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
cellUpdates.push({
|
|
204
|
+
row: row,
|
|
205
|
+
col: col,
|
|
206
|
+
baseValue: baseValue,
|
|
207
|
+
cryptoValue: cryptoValue
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
setContext(function (ctx) {
|
|
211
|
+
var d = (0, _fortuneCore.getFlowdata)(ctx);
|
|
212
|
+
if (!d || !Array.isArray(d)) return;
|
|
213
|
+
cellUpdates.forEach(function (_a) {
|
|
214
|
+
var row = _a.row,
|
|
215
|
+
col = _a.col,
|
|
216
|
+
baseValue = _a.baseValue,
|
|
217
|
+
cryptoValue = _a.cryptoValue;
|
|
205
218
|
if (!d[row]) d[row] = [];
|
|
206
219
|
if (!d[row][col]) d[row][col] = {};
|
|
207
220
|
var cellCp = d[row][col];
|
package/lib/utils/cryptoApi.js
CHANGED
|
@@ -132,7 +132,9 @@ function getCryptoPrice(crypto, fiat) {
|
|
|
132
132
|
case 0:
|
|
133
133
|
key = "".concat(crypto, "-").concat(fiat).toLowerCase();
|
|
134
134
|
now = Date.now();
|
|
135
|
+
console.log("Fetching crypto price for ".concat(key), priceCache);
|
|
135
136
|
if (priceCache[key] && now - priceCache[key].timestamp < CACHE_DURATION) {
|
|
137
|
+
console.log("Using cached price for ".concat(key));
|
|
136
138
|
return [2, priceCache[key].price];
|
|
137
139
|
}
|
|
138
140
|
url = "".concat(COINGECKO_API, "?ids=").concat(crypto, "&vs_currencies=").concat(fiat);
|
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.46",
|
|
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.46",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-16",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|