@deframe-sdk/components 0.1.64 → 0.1.65
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/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11207,6 +11207,28 @@ var SimpleEmptyState = ({ title, description }) => {
|
|
|
11207
11207
|
}
|
|
11208
11208
|
);
|
|
11209
11209
|
};
|
|
11210
|
+
|
|
11211
|
+
// src/utils/formatHistoryAssetAmount.ts
|
|
11212
|
+
var BRL_PEGGED_SYMBOLS = /* @__PURE__ */ new Set(["BRLA"]);
|
|
11213
|
+
function formatHistoryAssetAmount(input) {
|
|
11214
|
+
const { amountHumanized, amountInUSD, symbol, currency, locale, formatCurrency } = input;
|
|
11215
|
+
if (currency === "BRL" && BRL_PEGGED_SYMBOLS.has(symbol) && amountHumanized) {
|
|
11216
|
+
const num = parseFloat(amountHumanized);
|
|
11217
|
+
if (Number.isFinite(num)) {
|
|
11218
|
+
return `R$${num.toLocaleString(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
11219
|
+
}
|
|
11220
|
+
}
|
|
11221
|
+
if (amountInUSD) {
|
|
11222
|
+
const num = parseFloat(amountInUSD);
|
|
11223
|
+
if (Number.isFinite(num)) {
|
|
11224
|
+
return formatCurrency(num);
|
|
11225
|
+
}
|
|
11226
|
+
}
|
|
11227
|
+
if (amountHumanized) {
|
|
11228
|
+
return `${amountHumanized} ${symbol}`;
|
|
11229
|
+
}
|
|
11230
|
+
return "";
|
|
11231
|
+
}
|
|
11210
11232
|
var EARN_CATEGORY_DEFINITIONS = [
|
|
11211
11233
|
{
|
|
11212
11234
|
id: "dolar",
|
|
@@ -11287,6 +11309,7 @@ var EarnDesktopViewSimple = ({
|
|
|
11287
11309
|
strategies = [],
|
|
11288
11310
|
historyItems = [],
|
|
11289
11311
|
formatCurrency = defaultFormatCurrency,
|
|
11312
|
+
currency,
|
|
11290
11313
|
locale = "pt-BR",
|
|
11291
11314
|
onDeposit,
|
|
11292
11315
|
onWithdraw,
|
|
@@ -11334,7 +11357,14 @@ var EarnDesktopViewSimple = ({
|
|
|
11334
11357
|
const primaryAsset = isDeposit ? (_a = item.amounts) == null ? void 0 : _a.assetIn : (_b = item.amounts) == null ? void 0 : _b.assetOut;
|
|
11335
11358
|
const symbol = (_e = primaryAsset && "token" in primaryAsset ? (_d = (_c = primaryAsset.token) == null ? void 0 : _c.symbol) == null ? void 0 : _d.toUpperCase() : null) != null ? _e : "";
|
|
11336
11359
|
if (!symbol) continue;
|
|
11337
|
-
const amount =
|
|
11360
|
+
const amount = formatHistoryAssetAmount({
|
|
11361
|
+
amountHumanized: primaryAsset && "amountHumanized" in primaryAsset ? primaryAsset.amountHumanized : void 0,
|
|
11362
|
+
amountInUSD: primaryAsset && "amountInUSD" in primaryAsset ? primaryAsset.amountInUSD : void 0,
|
|
11363
|
+
symbol,
|
|
11364
|
+
currency,
|
|
11365
|
+
locale,
|
|
11366
|
+
formatCurrency
|
|
11367
|
+
});
|
|
11338
11368
|
const date = new Date(item.createdAt).toLocaleString(locale, {
|
|
11339
11369
|
day: "2-digit",
|
|
11340
11370
|
month: "2-digit",
|
|
@@ -11353,7 +11383,7 @@ var EarnDesktopViewSimple = ({
|
|
|
11353
11383
|
map.get(symbol).push(entry);
|
|
11354
11384
|
}
|
|
11355
11385
|
return map;
|
|
11356
|
-
}, [historyItems, locale, formatCurrency, onHistoryDetail]);
|
|
11386
|
+
}, [historyItems, locale, formatCurrency, currency, onHistoryDetail]);
|
|
11357
11387
|
const cardLabels = React6__default.useMemo(() => ({
|
|
11358
11388
|
investLabel: labels == null ? void 0 : labels.investLabel,
|
|
11359
11389
|
withdrawLabel: labels == null ? void 0 : labels.cardWithdrawLabel,
|