@deframe-sdk/components 0.1.71 → 0.1.72

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.mjs CHANGED
@@ -9792,6 +9792,32 @@ function StatusBadge2({ status, labels, className }) {
9792
9792
  }
9793
9793
  );
9794
9794
  }
9795
+ var explorerLinkClass = "text-[color:var(--deframe-widget-color-brand-primary)] underline text-[12px] leading-none [font-weight:var(--deframe-widget-font-weight-semibold)]";
9796
+ function renderExplorerLink(tx) {
9797
+ return /* @__PURE__ */ jsx(
9798
+ "a",
9799
+ {
9800
+ "data-test-id": "history-list-item-simple-explorer",
9801
+ href: tx.explorerUrl,
9802
+ target: "_blank",
9803
+ rel: "noopener noreferrer",
9804
+ className: explorerLinkClass,
9805
+ children: tx.label
9806
+ }
9807
+ );
9808
+ }
9809
+ function renderExplorerLinks(transactions) {
9810
+ if (!(transactions == null ? void 0 : transactions.length)) return null;
9811
+ if (transactions.length === 1) return renderExplorerLink(transactions[0]);
9812
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-xs)] flex-wrap", children: transactions.map((tx, i) => /* @__PURE__ */ jsxs(React6.Fragment, { children: [
9813
+ i > 0 && /* @__PURE__ */ jsx("span", { className: "text-[color:var(--deframe-widget-color-text-tertiary)] text-[12px]", children: "\u2192" }),
9814
+ tx.prefix && /* @__PURE__ */ jsxs("span", { className: "text-[color:var(--deframe-widget-color-text-secondary)] text-[12px]", children: [
9815
+ tx.prefix,
9816
+ ":"
9817
+ ] }),
9818
+ renderExplorerLink(tx)
9819
+ ] }, tx.explorerUrl)) });
9820
+ }
9795
9821
  var HistoryListItemSimple = ({ item, labels, locale }) => {
9796
9822
  const label = historyResolveLabel(item, labels);
9797
9823
  const { primary, secondary } = historyResolveAmounts(item);
@@ -9854,7 +9880,8 @@ var HistoryListItemSimple = ({ item, labels, locale }) => {
9854
9880
  }
9855
9881
  )
9856
9882
  ] })
9857
- ] })
9883
+ ] }),
9884
+ renderExplorerLinks(item.transactions)
9858
9885
  ]
9859
9886
  }
9860
9887
  );
@@ -11350,7 +11377,12 @@ function formatEarnPositions(positions, { currency, locale, formatCurrency }) {
11350
11377
  const principalUSD = p.spotPosition.underlyingBalanceUSD - p.spotPosition.profitInUSD;
11351
11378
  const investedFormatted = isBrlPegged && p.spotPosition.principal ? formatHistoryAssetAmount({ amountHumanized: p.spotPosition.principal.humanized, symbol, currency, locale, formatCurrency }) : formatCurrency(principalUSD);
11352
11379
  const totalBrla = isBrlPegged && principalHumanized > 0 && principalUSD > 0 ? p.spotPosition.underlyingBalanceUSD * principalHumanized / principalUSD : null;
11353
- const totalValueFormatted = totalBrla !== null ? formatHistoryAssetAmount({ amountHumanized: String(totalBrla), symbol, currency, locale, formatCurrency }) : formatCurrency(p.spotPosition.underlyingBalanceUSD);
11380
+ const totalValueFormatted = (() => {
11381
+ if (totalBrla !== null) {
11382
+ return totalBrla < 0.01 ? investedFormatted : formatHistoryAssetAmount({ amountHumanized: String(totalBrla), symbol, currency, locale, formatCurrency });
11383
+ }
11384
+ return p.spotPosition.underlyingBalanceUSD < 0.01 ? investedFormatted : formatCurrency(p.spotPosition.underlyingBalanceUSD);
11385
+ })();
11354
11386
  return __spreadProps(__spreadValues({}, p), { spotPosition: __spreadProps(__spreadValues({}, p.spotPosition), { investedFormatted, totalValueFormatted }) });
11355
11387
  })
11356
11388
  });