@deframe-sdk/components 0.1.66 → 0.1.68

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 CHANGED
@@ -2239,6 +2239,23 @@ interface EarnDesktopViewProps {
2239
2239
  */
2240
2240
  declare const EarnDesktopView: React__default.FC<EarnDesktopViewProps>;
2241
2241
 
2242
+ interface EarnHistoryAsset {
2243
+ token?: {
2244
+ symbol?: string;
2245
+ };
2246
+ amountInUSD?: string | null;
2247
+ amountHumanized?: string;
2248
+ }
2249
+ interface EarnHistoryItem {
2250
+ id: string;
2251
+ type: string;
2252
+ createdAt: string;
2253
+ amounts?: {
2254
+ assetIn?: EarnHistoryAsset | null;
2255
+ assetOut?: EarnHistoryAsset | null;
2256
+ };
2257
+ }
2258
+
2242
2259
  interface EarnCategoryDefinition {
2243
2260
  id: string;
2244
2261
  imageUrl: string;
@@ -2252,11 +2269,19 @@ interface EarnStrategyInfo {
2252
2269
  assetName: string;
2253
2270
  network: string;
2254
2271
  logourl: string;
2272
+ metadata?: {
2273
+ displayName?: string;
2274
+ displayLogo?: string;
2275
+ } | null;
2255
2276
  }
2256
2277
  interface EarnSpotPosition {
2257
2278
  underlyingBalanceUSD: number;
2258
2279
  apy: number;
2259
2280
  profitInUSD: number;
2281
+ /** Pre-formatted invested amount in global currency — computed by the consumer (SDK). */
2282
+ investedFormatted: string;
2283
+ /** Pre-formatted total value in global currency — computed by the consumer (SDK). */
2284
+ totalValueFormatted?: string;
2260
2285
  }
2261
2286
  interface EarnPosition {
2262
2287
  strategy: EarnStrategyInfo;
@@ -2276,27 +2301,10 @@ interface EarnStrategy {
2276
2301
  logourl: string;
2277
2302
  apy: number;
2278
2303
  apyFormatted: string;
2279
- }
2280
- interface EarnHistoryItem {
2281
- id: string;
2282
- type: string;
2283
- createdAt: string;
2284
- amounts?: {
2285
- assetIn?: {
2286
- token?: {
2287
- symbol?: string;
2288
- };
2289
- amountInUSD?: string | null;
2290
- amountHumanized?: string;
2291
- } | null;
2292
- assetOut?: {
2293
- token?: {
2294
- symbol?: string;
2295
- };
2296
- amountInUSD?: string | null;
2297
- amountHumanized?: string;
2298
- } | null;
2299
- };
2304
+ metadata?: {
2305
+ displayName?: string;
2306
+ displayLogo?: string;
2307
+ } | null;
2300
2308
  }
2301
2309
  interface EarnDesktopViewSimpleProps extends Partial<EarnDesktopViewProps> {
2302
2310
  /** Positions data — mirrors WalletPositionsResponse */
package/dist/index.d.ts CHANGED
@@ -2239,6 +2239,23 @@ interface EarnDesktopViewProps {
2239
2239
  */
2240
2240
  declare const EarnDesktopView: React__default.FC<EarnDesktopViewProps>;
2241
2241
 
2242
+ interface EarnHistoryAsset {
2243
+ token?: {
2244
+ symbol?: string;
2245
+ };
2246
+ amountInUSD?: string | null;
2247
+ amountHumanized?: string;
2248
+ }
2249
+ interface EarnHistoryItem {
2250
+ id: string;
2251
+ type: string;
2252
+ createdAt: string;
2253
+ amounts?: {
2254
+ assetIn?: EarnHistoryAsset | null;
2255
+ assetOut?: EarnHistoryAsset | null;
2256
+ };
2257
+ }
2258
+
2242
2259
  interface EarnCategoryDefinition {
2243
2260
  id: string;
2244
2261
  imageUrl: string;
@@ -2252,11 +2269,19 @@ interface EarnStrategyInfo {
2252
2269
  assetName: string;
2253
2270
  network: string;
2254
2271
  logourl: string;
2272
+ metadata?: {
2273
+ displayName?: string;
2274
+ displayLogo?: string;
2275
+ } | null;
2255
2276
  }
2256
2277
  interface EarnSpotPosition {
2257
2278
  underlyingBalanceUSD: number;
2258
2279
  apy: number;
2259
2280
  profitInUSD: number;
2281
+ /** Pre-formatted invested amount in global currency — computed by the consumer (SDK). */
2282
+ investedFormatted: string;
2283
+ /** Pre-formatted total value in global currency — computed by the consumer (SDK). */
2284
+ totalValueFormatted?: string;
2260
2285
  }
2261
2286
  interface EarnPosition {
2262
2287
  strategy: EarnStrategyInfo;
@@ -2276,27 +2301,10 @@ interface EarnStrategy {
2276
2301
  logourl: string;
2277
2302
  apy: number;
2278
2303
  apyFormatted: string;
2279
- }
2280
- interface EarnHistoryItem {
2281
- id: string;
2282
- type: string;
2283
- createdAt: string;
2284
- amounts?: {
2285
- assetIn?: {
2286
- token?: {
2287
- symbol?: string;
2288
- };
2289
- amountInUSD?: string | null;
2290
- amountHumanized?: string;
2291
- } | null;
2292
- assetOut?: {
2293
- token?: {
2294
- symbol?: string;
2295
- };
2296
- amountInUSD?: string | null;
2297
- amountHumanized?: string;
2298
- } | null;
2299
- };
2304
+ metadata?: {
2305
+ displayName?: string;
2306
+ displayLogo?: string;
2307
+ } | null;
2300
2308
  }
2301
2309
  interface EarnDesktopViewSimpleProps extends Partial<EarnDesktopViewProps> {
2302
2310
  /** Positions data — mirrors WalletPositionsResponse */
package/dist/index.js CHANGED
@@ -10408,6 +10408,24 @@ var GroupedStrategyListView = ({
10408
10408
  ] })
10409
10409
  ] });
10410
10410
  };
10411
+
10412
+ // src/utils/strategyDisplayName.ts
10413
+ function getNormalizedMetadataString(value) {
10414
+ if (typeof value !== "string") return "";
10415
+ return value.trim();
10416
+ }
10417
+ function getStrategyDisplayName(strategy) {
10418
+ var _a, _b;
10419
+ const displayName = getNormalizedMetadataString((_a = strategy == null ? void 0 : strategy.metadata) == null ? void 0 : _a.displayName);
10420
+ if (displayName) return displayName;
10421
+ return (_b = strategy == null ? void 0 : strategy.assetName) != null ? _b : "";
10422
+ }
10423
+ function getStrategyDisplayLogo(strategy) {
10424
+ var _a, _b;
10425
+ const displayLogo = getNormalizedMetadataString((_a = strategy == null ? void 0 : strategy.metadata) == null ? void 0 : _a.displayLogo);
10426
+ if (displayLogo) return displayLogo;
10427
+ return (_b = strategy == null ? void 0 : strategy.logourl) != null ? _b : "";
10428
+ }
10411
10429
  var wrapperBaseClasses = [
10412
10430
  "w-full max-w-[900px] mx-auto flex flex-col",
10413
10431
  "gap-[var(--deframe-widget-size-gap-md)]",
@@ -10517,24 +10535,27 @@ var GroupedStrategyListViewSimple = ({
10517
10535
  {
10518
10536
  "data-test-id": "grouped-strategy-list-view-simple-items",
10519
10537
  className: "flex flex-col gap-[var(--deframe-widget-size-gap-sm)]",
10520
- children: filteredStrategies.map((s) => /* @__PURE__ */ jsxRuntime.jsx(
10521
- StrategyGridCardSimple,
10522
- {
10523
- logoUrl: s.logourl,
10524
- title: s.assetName,
10525
- subtitle: s.assetName,
10526
- chainName: s.network,
10527
- apyFormatted: s.apyFormatted,
10528
- apyLabel: yieldLabel,
10529
- riskLevel: "low",
10530
- onInvestClick: onDeposit ? () => onDeposit(s.id) : () => {
10531
- },
10532
- onWithdrawClick: onWithdraw ? () => onWithdraw(s.id) : () => {
10538
+ children: filteredStrategies.map((s) => {
10539
+ const displayName = getStrategyDisplayName(s);
10540
+ return /* @__PURE__ */ jsxRuntime.jsx(
10541
+ StrategyGridCardSimple,
10542
+ {
10543
+ logoUrl: getStrategyDisplayLogo(s),
10544
+ title: displayName,
10545
+ subtitle: displayName,
10546
+ chainName: s.network,
10547
+ apyFormatted: s.apyFormatted,
10548
+ apyLabel: yieldLabel,
10549
+ riskLevel: "low",
10550
+ onInvestClick: onDeposit ? () => onDeposit(s.id) : () => {
10551
+ },
10552
+ onWithdrawClick: onWithdraw ? () => onWithdraw(s.id) : () => {
10553
+ },
10554
+ labels: { investLabel, riskLow, riskMedium, riskHigh }
10533
10555
  },
10534
- labels: { investLabel, riskLow, riskMedium, riskHigh }
10535
- },
10536
- s.id
10537
- ))
10556
+ s.id
10557
+ );
10558
+ })
10538
10559
  }
10539
10560
  )
10540
10561
  ] });
@@ -10943,7 +10964,7 @@ var ImageBannerCard = ({
10943
10964
  "aria-label": alt,
10944
10965
  onClick,
10945
10966
  className: tailwindMerge.twMerge(
10946
- "relative w-full overflow-hidden text-left",
10967
+ "group relative w-full overflow-hidden text-left",
10947
10968
  "rounded-[var(--deframe-widget-size-radius-md)]",
10948
10969
  "border",
10949
10970
  "transition-[transform,opacity] duration-150",
@@ -10957,44 +10978,54 @@ var ImageBannerCard = ({
10957
10978
  /* @__PURE__ */ jsxRuntime.jsxs(
10958
10979
  "div",
10959
10980
  {
10960
- className: "flex flex-col gap-[var(--deframe-widget-size-gap-xs)] z-[1] px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-xl)]",
10981
+ className: "relative z-[2] flex flex-col justify-center",
10961
10982
  style: { flex: imageUrl ? "0 0 55%" : "1 1 auto" },
10962
10983
  children: [
10963
- /* @__PURE__ */ jsxRuntime.jsx(
10964
- "span",
10984
+ imageUrl && /* @__PURE__ */ jsxRuntime.jsx(
10985
+ "div",
10965
10986
  {
10966
- "data-test-id": "image-banner-card-name",
10967
- className: "text-[length:var(--deframe-widget-font-size-xs)] [font-weight:var(--deframe-widget-font-weight-medium)] font-[var(--deframe-widget-font-family)] uppercase tracking-[0.08em]",
10968
- style: { color: `color-mix(in srgb, ${colorToken} 80%, var(--deframe-widget-color-text-secondary))` },
10969
- children: alt
10987
+ "aria-hidden": "true",
10988
+ className: "absolute inset-y-0 left-full pointer-events-none transition-[width] duration-500 ease-out w-[33%]",
10989
+ style: { background: "linear-gradient(to right, #080a0e, transparent)" }
10970
10990
  }
10971
10991
  ),
10972
- apyFormatted && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-test-id": "image-banner-card-apy", className: "flex items-baseline gap-[4px]", children: [
10992
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-[var(--deframe-widget-size-gap-xs)] px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-xl)] transition-transform duration-500 ease-out origin-left group-hover:scale-[1.04]", children: [
10973
10993
  /* @__PURE__ */ jsxRuntime.jsx(
10974
10994
  "span",
10975
10995
  {
10976
- className: "text-[38px] [font-weight:var(--deframe-widget-font-weight-bold)] font-[var(--deframe-widget-font-family)] leading-[1]",
10977
- style: { color: colorToken },
10978
- children: apyFormatted
10996
+ "data-test-id": "image-banner-card-name",
10997
+ className: "text-[length:var(--deframe-widget-font-size-xs)] [font-weight:var(--deframe-widget-font-weight-medium)] font-[var(--deframe-widget-font-family)] uppercase tracking-[0.08em]",
10998
+ style: { color: `color-mix(in srgb, ${colorToken} 80%, var(--deframe-widget-color-text-secondary))` },
10999
+ children: alt
10979
11000
  }
10980
11001
  ),
10981
- /* @__PURE__ */ jsxRuntime.jsx(
11002
+ apyFormatted && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-test-id": "image-banner-card-apy", className: "flex items-baseline gap-[4px]", children: [
11003
+ /* @__PURE__ */ jsxRuntime.jsx(
11004
+ "span",
11005
+ {
11006
+ className: "text-[38px] [font-weight:var(--deframe-widget-font-weight-bold)] font-[var(--deframe-widget-font-family)] leading-[1]",
11007
+ style: { color: colorToken },
11008
+ children: apyFormatted
11009
+ }
11010
+ ),
11011
+ /* @__PURE__ */ jsxRuntime.jsx(
11012
+ "span",
11013
+ {
11014
+ className: "text-[length:var(--deframe-widget-font-size-xs)] [font-weight:var(--deframe-widget-font-weight-semibold)] font-[var(--deframe-widget-font-family)] uppercase tracking-[0.1em]",
11015
+ style: { color: `color-mix(in srgb, ${colorToken} 60%, transparent)` },
11016
+ children: "APY"
11017
+ }
11018
+ )
11019
+ ] }),
11020
+ description && /* @__PURE__ */ jsxRuntime.jsx(
10982
11021
  "span",
10983
11022
  {
10984
- className: "text-[length:var(--deframe-widget-font-size-xs)] [font-weight:var(--deframe-widget-font-weight-semibold)] font-[var(--deframe-widget-font-family)] uppercase tracking-[0.1em]",
10985
- style: { color: `color-mix(in srgb, ${colorToken} 60%, transparent)` },
10986
- children: "APY"
11023
+ "data-test-id": "image-banner-card-description",
11024
+ className: "text-[length:var(--deframe-widget-font-size-xs)] leading-[var(--deframe-widget-font-leading-sm)] text-[color:var(--deframe-widget-color-text-tertiary)] font-[var(--deframe-widget-font-family)]",
11025
+ children: description
10987
11026
  }
10988
11027
  )
10989
- ] }),
10990
- description && /* @__PURE__ */ jsxRuntime.jsx(
10991
- "span",
10992
- {
10993
- "data-test-id": "image-banner-card-description",
10994
- className: "text-[length:var(--deframe-widget-font-size-xs)] leading-[var(--deframe-widget-font-leading-sm)] text-[color:var(--deframe-widget-color-text-tertiary)] font-[var(--deframe-widget-font-family)]",
10995
- children: description
10996
- }
10997
- )
11028
+ ] })
10998
11029
  ]
10999
11030
  }
11000
11031
  ),
@@ -11003,7 +11034,7 @@ var ImageBannerCard = ({
11003
11034
  {
11004
11035
  "data-test-id": "image-banner-card-image-wrapper",
11005
11036
  className: "relative flex-1 overflow-hidden",
11006
- style: { minHeight: 160 },
11037
+ style: { background: "linear-gradient(to left, #080a0e, transparent)", minHeight: 160 },
11007
11038
  children: [
11008
11039
  /* @__PURE__ */ jsxRuntime.jsx(
11009
11040
  "img",
@@ -11012,16 +11043,14 @@ var ImageBannerCard = ({
11012
11043
  src: imageUrl,
11013
11044
  alt: "",
11014
11045
  "aria-hidden": "true",
11015
- className: "absolute inset-0 w-full h-full object-cover object-center"
11046
+ className: "absolute inset-0 w-full h-full object-cover object-center transition-transform duration-500 ease-out origin-right group-hover:scale-110"
11016
11047
  }
11017
11048
  ),
11018
11049
  /* @__PURE__ */ jsxRuntime.jsx(
11019
11050
  "div",
11020
11051
  {
11021
- className: "absolute inset-0",
11022
- style: {
11023
- background: "linear-gradient(to right, #080a0e 0%, transparent 40%)"
11024
- }
11052
+ "aria-hidden": "true",
11053
+ className: "absolute inset-y-0 left-0 z-[1] pointer-events-none transition-[width,transform] duration-500 ease-out w-[40%] group-hover:w-[80%] group-hover:-translate-x-3"
11025
11054
  }
11026
11055
  )
11027
11056
  ]
@@ -11031,7 +11060,7 @@ var ImageBannerCard = ({
11031
11060
  }
11032
11061
  );
11033
11062
  };
11034
- var GRID_COLS = "grid grid-cols-[1fr_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
11063
+ var GRID_COLS = "grid grid-cols-[1fr_100px_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
11035
11064
  var HISTORY_COLORS = {
11036
11065
  deposit: "var(--deframe-widget-color-state-info)",
11037
11066
  withdraw: "var(--deframe-widget-color-text-secondary)",
@@ -11044,6 +11073,7 @@ var EarnHubStrategyCard = ({
11044
11073
  investedFormatted,
11045
11074
  earningsFormatted,
11046
11075
  profitFormatted,
11076
+ totalValueFormatted,
11047
11077
  isLoading,
11048
11078
  onInvestClick,
11049
11079
  onWithdrawClick,
@@ -11064,7 +11094,7 @@ var EarnHubStrategyCard = ({
11064
11094
  {
11065
11095
  "data-slot": "earn-hub-strategy-card",
11066
11096
  "data-test-id": "earn-hub-strategy-card",
11067
- className: "border-t border-[color:var(--deframe-widget-color-border-secondary)] list-none",
11097
+ className: "border-t border-[color:var(--deframe-widget-color-border-secondary)] list-none overflow-hidden",
11068
11098
  children: [
11069
11099
  /* @__PURE__ */ jsxRuntime.jsxs(
11070
11100
  "div",
@@ -11073,14 +11103,14 @@ var EarnHubStrategyCard = ({
11073
11103
  onClick: () => setExpanded((v) => !v),
11074
11104
  className: tailwindMerge.twMerge(
11075
11105
  GRID_COLS,
11076
- "items-center cursor-pointer",
11106
+ "group items-center cursor-pointer",
11077
11107
  "px-[var(--deframe-widget-size-padding-x-md)] py-[13px]",
11078
11108
  "transition-colors duration-150",
11079
11109
  "hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_60%,transparent)]"
11080
11110
  ),
11081
11111
  children: [
11082
11112
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-[var(--deframe-widget-size-gap-sm)] min-w-0", children: [
11083
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[36px] h-[36px] rounded-full bg-[var(--deframe-widget-color-bg-tertiary)] flex items-center justify-center overflow-hidden shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx("img", { alt: assetName, src: logoUrl, referrerPolicy: "no-referrer", className: "w-full h-full object-contain" }) }),
11113
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[36px] h-[36px] rounded-full bg-[var(--deframe-widget-color-bg-tertiary)] flex items-center justify-center overflow-hidden shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx("img", { alt: assetName, src: logoUrl, referrerPolicy: "no-referrer", className: "w-full h-full object-contain transition-transform duration-500 ease-out group-hover:scale-110" }) }),
11084
11114
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0", children: [
11085
11115
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] leading-[var(--deframe-widget-font-leading-sm)] font-[var(--deframe-widget-font-family)] truncate", children: assetName }),
11086
11116
  network && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-secondary)] leading-[var(--deframe-widget-font-leading-xs)]", children: network })
@@ -11095,11 +11125,9 @@ var EarnHubStrategyCard = ({
11095
11125
  }
11096
11126
  ) }),
11097
11127
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { variant: "rect", width: 50, height: 16 }) : profitFormatted ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] font-[var(--deframe-widget-font-family)] leading-none", children: profitFormatted }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-tertiary)]", children: "\u2014" }) }),
11128
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { variant: "rect", width: 60, height: 16 }) : investedFormatted ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] leading-[var(--deframe-widget-font-leading-sm)] font-[var(--deframe-widget-font-family)]", children: investedFormatted }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-tertiary)]", children: "\u2014" }) }),
11098
11129
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-[var(--deframe-widget-size-gap-xs)]", children: [
11099
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-end", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { variant: "rect", width: 60, height: 16 }) : investedFormatted ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11100
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] leading-[var(--deframe-widget-font-leading-sm)] font-[var(--deframe-widget-font-family)]", children: investedFormatted }),
11101
- (labels == null ? void 0 : labels.investedLabel) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-secondary)] leading-[var(--deframe-widget-font-leading-xs)]", children: labels.investedLabel })
11102
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-tertiary)]", children: "\u2014" }) }),
11130
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { variant: "rect", width: 60, height: 16 }) : totalValueFormatted ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-sm)] [font-weight:var(--deframe-widget-font-weight-semibold)] text-[color:var(--deframe-widget-color-text-primary)] leading-[var(--deframe-widget-font-leading-sm)] font-[var(--deframe-widget-font-family)]", children: totalValueFormatted }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-tertiary)]", children: "\u2014" }),
11103
11131
  /* @__PURE__ */ jsxRuntime.jsx(
11104
11132
  "svg",
11105
11133
  {
@@ -11253,11 +11281,65 @@ function formatHistoryAssetAmount(input) {
11253
11281
  }
11254
11282
  return "";
11255
11283
  }
11284
+
11285
+ // src/utils/formatEarnPositions.ts
11286
+ function formatEarnPositions(positions, { currency, locale, formatCurrency }) {
11287
+ return __spreadProps(__spreadValues({}, positions), {
11288
+ positions: positions.positions.map((p) => {
11289
+ var _a, _b;
11290
+ const symbol = p.strategy.assetName.toUpperCase();
11291
+ const isBrlPegged = currency === "BRL" && BRL_PEGGED_SYMBOLS.has(symbol);
11292
+ const principalHumanized = parseFloat((_b = (_a = p.spotPosition.principal) == null ? void 0 : _a.humanized) != null ? _b : "0");
11293
+ const principalUSD = p.spotPosition.underlyingBalanceUSD - p.spotPosition.profitInUSD;
11294
+ const investedFormatted = isBrlPegged && p.spotPosition.principal ? formatHistoryAssetAmount({ amountHumanized: p.spotPosition.principal.humanized, symbol, currency, locale, formatCurrency }) : formatCurrency(principalUSD);
11295
+ const totalBrla = isBrlPegged && principalHumanized > 0 && principalUSD > 0 ? p.spotPosition.underlyingBalanceUSD * principalHumanized / principalUSD : null;
11296
+ const totalValueFormatted = totalBrla !== null ? formatHistoryAssetAmount({ amountHumanized: String(totalBrla), symbol, currency, locale, formatCurrency }) : formatCurrency(p.spotPosition.underlyingBalanceUSD);
11297
+ return __spreadProps(__spreadValues({}, p), { spotPosition: __spreadProps(__spreadValues({}, p.spotPosition), { investedFormatted, totalValueFormatted }) });
11298
+ })
11299
+ });
11300
+ }
11301
+
11302
+ // src/utils/buildEarnHistoryByAsset.ts
11303
+ function buildEarnHistoryByAsset(items, { currency, locale, formatCurrency, onHistoryDetail }) {
11304
+ var _a, _b, _c, _d, _e;
11305
+ const map = {};
11306
+ for (const item of items) {
11307
+ const isDeposit = item.type.includes("DEPOSIT");
11308
+ const primaryAsset = isDeposit ? (_a = item.amounts) == null ? void 0 : _a.assetIn : (_b = item.amounts) == null ? void 0 : _b.assetOut;
11309
+ const symbol = (_e = (_d = (_c = primaryAsset == null ? void 0 : primaryAsset.token) == null ? void 0 : _c.symbol) == null ? void 0 : _d.toUpperCase()) != null ? _e : "";
11310
+ if (!symbol || !primaryAsset) continue;
11311
+ const amount = formatHistoryAssetAmount({
11312
+ amountHumanized: primaryAsset.amountHumanized,
11313
+ amountInUSD: primaryAsset.amountInUSD,
11314
+ symbol,
11315
+ currency,
11316
+ locale,
11317
+ formatCurrency
11318
+ });
11319
+ const date = new Date(item.createdAt).toLocaleString(locale, {
11320
+ day: "2-digit",
11321
+ month: "2-digit",
11322
+ year: "numeric",
11323
+ hour: "2-digit",
11324
+ minute: "2-digit"
11325
+ });
11326
+ const entry = {
11327
+ id: item.id,
11328
+ date,
11329
+ type: isDeposit ? "deposit" : "withdraw",
11330
+ amount,
11331
+ onClick: () => onHistoryDetail(item.id, isDeposit)
11332
+ };
11333
+ if (!map[symbol]) map[symbol] = [];
11334
+ map[symbol].push(entry);
11335
+ }
11336
+ return map;
11337
+ }
11256
11338
  var EARN_CATEGORY_DEFINITIONS = [
11257
11339
  {
11258
11340
  id: "dolar",
11259
11341
  imageUrl: mascotUsdUrl,
11260
- assetFilter: ["USDC", "USDT", "DAI", "thbill"]
11342
+ assetFilter: ["USDC", "USDT", "DAI", "thbill", "podsUSDCy"]
11261
11343
  },
11262
11344
  {
11263
11345
  id: "real",
@@ -11320,7 +11402,7 @@ var columnHeaderClasses = [
11320
11402
  "text-[color:var(--deframe-widget-color-text-tertiary)]",
11321
11403
  "leading-[var(--deframe-widget-font-leading-xs)]"
11322
11404
  ].join(" ");
11323
- var GRID_COLS2 = "grid grid-cols-[1fr_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
11405
+ var GRID_COLS2 = "grid grid-cols-[1fr_100px_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
11324
11406
  var BANNER_COLORS = [
11325
11407
  "var(--deframe-widget-color-brand-primary)",
11326
11408
  "var(--deframe-widget-color-brand-secondary)"
@@ -11373,41 +11455,6 @@ var EarnDesktopViewSimple = ({
11373
11455
  };
11374
11456
  });
11375
11457
  }, [categories, strategies, labels == null ? void 0 : labels.stablecoinsBannerDescription, labels == null ? void 0 : labels.realsBannerDescription]);
11376
- const historyByAsset = React6__namespace.default.useMemo(() => {
11377
- var _a, _b, _c, _d, _e;
11378
- const map = /* @__PURE__ */ new Map();
11379
- for (const item of historyItems) {
11380
- const isDeposit = item.type.includes("DEPOSIT");
11381
- const primaryAsset = isDeposit ? (_a = item.amounts) == null ? void 0 : _a.assetIn : (_b = item.amounts) == null ? void 0 : _b.assetOut;
11382
- const symbol = (_e = primaryAsset && "token" in primaryAsset ? (_d = (_c = primaryAsset.token) == null ? void 0 : _c.symbol) == null ? void 0 : _d.toUpperCase() : null) != null ? _e : "";
11383
- if (!symbol) continue;
11384
- const amount = formatHistoryAssetAmount({
11385
- amountHumanized: primaryAsset && "amountHumanized" in primaryAsset ? primaryAsset.amountHumanized : void 0,
11386
- amountInUSD: primaryAsset && "amountInUSD" in primaryAsset ? primaryAsset.amountInUSD : void 0,
11387
- symbol,
11388
- currency,
11389
- locale,
11390
- formatCurrency
11391
- });
11392
- const date = new Date(item.createdAt).toLocaleString(locale, {
11393
- day: "2-digit",
11394
- month: "2-digit",
11395
- year: "numeric",
11396
- hour: "2-digit",
11397
- minute: "2-digit"
11398
- });
11399
- const entry = {
11400
- id: item.id,
11401
- date,
11402
- type: isDeposit ? "deposit" : "withdraw",
11403
- amount,
11404
- onClick: onHistoryDetail ? () => onHistoryDetail(item.id, isDeposit) : void 0
11405
- };
11406
- if (!map.has(symbol)) map.set(symbol, []);
11407
- map.get(symbol).push(entry);
11408
- }
11409
- return map;
11410
- }, [historyItems, locale, formatCurrency, currency, onHistoryDetail]);
11411
11458
  const cardLabels = React6__namespace.default.useMemo(() => ({
11412
11459
  investLabel: labels == null ? void 0 : labels.investLabel,
11413
11460
  withdrawLabel: labels == null ? void 0 : labels.cardWithdrawLabel,
@@ -11417,18 +11464,33 @@ var EarnDesktopViewSimple = ({
11417
11464
  historyWithdrawnLabel: labels == null ? void 0 : labels.cardHistoryWithdrawnLabel,
11418
11465
  historyInterestReceivedLabel: labels == null ? void 0 : labels.cardHistoryInterestReceivedLabel
11419
11466
  }), [labels == null ? void 0 : labels.investLabel, labels == null ? void 0 : labels.cardWithdrawLabel, labels == null ? void 0 : labels.cardInvestedLabel, labels == null ? void 0 : labels.cardHistoryTitle, labels == null ? void 0 : labels.cardHistoryDepositedLabel, labels == null ? void 0 : labels.cardHistoryWithdrawnLabel, labels == null ? void 0 : labels.cardHistoryInterestReceivedLabel]);
11467
+ const formattedPositions = React6.useMemo(
11468
+ () => formatEarnPositions(positions, { currency, locale, formatCurrency }),
11469
+ [positions, currency, locale, formatCurrency]
11470
+ );
11471
+ const historyByAsset = React6.useMemo(
11472
+ () => buildEarnHistoryByAsset(historyItems, {
11473
+ currency,
11474
+ locale,
11475
+ formatCurrency,
11476
+ onHistoryDetail: (id, isDeposit) => onHistoryDetail == null ? void 0 : onHistoryDetail(id, isDeposit)
11477
+ }),
11478
+ [historyItems, currency, locale, formatCurrency, onHistoryDetail]
11479
+ );
11420
11480
  const strategyRows = React6__namespace.default.useMemo(() => {
11421
- return positions.positions.filter((p) => p.spotPosition.underlyingBalanceUSD > 0.01).map((p) => {
11422
- var _a;
11481
+ return formattedPositions.positions.filter((p) => p.spotPosition.underlyingBalanceUSD > 0.01).map((p) => {
11482
+ var _a, _b;
11483
+ const strategyDisplayName = getStrategyDisplayName(p.strategy);
11423
11484
  return {
11424
- logoUrl: p.strategy.logourl,
11425
- assetName: p.strategy.assetName,
11485
+ logoUrl: getStrategyDisplayLogo(p.strategy),
11486
+ assetName: strategyDisplayName,
11426
11487
  network: p.strategy.network,
11427
- investedFormatted: formatCurrency(p.spotPosition.underlyingBalanceUSD),
11488
+ investedFormatted: p.spotPosition.investedFormatted,
11428
11489
  earningsFormatted: `${(p.spotPosition.apy * 100).toFixed(2)}%`,
11429
11490
  profitFormatted: formatCurrency(p.spotPosition.profitInUSD),
11491
+ totalValueFormatted: (_a = p.spotPosition.totalValueFormatted) != null ? _a : formatCurrency(p.spotPosition.underlyingBalanceUSD),
11430
11492
  isLoading: false,
11431
- history: (_a = historyByAsset.get(p.strategy.assetName.toUpperCase())) != null ? _a : [],
11493
+ history: (_b = historyByAsset[p.strategy.assetName.toUpperCase()]) != null ? _b : [],
11432
11494
  onInvestClick: onDeposit ? () => onDeposit(p.strategy.id) : () => {
11433
11495
  },
11434
11496
  onWithdrawClick: onWithdraw ? () => onWithdraw(p.strategy.id) : () => {
@@ -11438,7 +11500,7 @@ var EarnDesktopViewSimple = ({
11438
11500
  labels: cardLabels
11439
11501
  };
11440
11502
  });
11441
- }, [positions.positions, formatCurrency, historyByAsset, onDeposit, onWithdraw, onDetails, cardLabels]);
11503
+ }, [formattedPositions.positions, formatCurrency, historyByAsset, onDeposit, onWithdraw, onDetails, cardLabels]);
11442
11504
  if (isLoading) {
11443
11505
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-test-id": "earn-hub-view-simple-loading", className: tailwindMerge.twMerge(wrapperBaseClasses2, className), children: [
11444
11506
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-[var(--deframe-widget-size-gap-sm)]", children: [0, 1].map((i) => /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { variant: "rect", width: "100%", height: 100 }, i)) }),
@@ -11585,13 +11647,13 @@ var EarnDesktopViewSimple = ({
11585
11647
  "px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-sm)]",
11586
11648
  "border-t border-[color:var(--deframe-widget-color-border-secondary)]"
11587
11649
  ),
11588
- children: [labels == null ? void 0 : labels.columnStrategy, labels == null ? void 0 : labels.columnApy, labels == null ? void 0 : labels.columnProfit, labels == null ? void 0 : labels.columnTotalValue].map((label, i) => /* @__PURE__ */ jsxRuntime.jsx(
11650
+ children: [labels == null ? void 0 : labels.columnStrategy, labels == null ? void 0 : labels.columnApy, labels == null ? void 0 : labels.columnProfit, labels == null ? void 0 : labels.columnInvested, labels == null ? void 0 : labels.columnTotalValue].map((label, i) => /* @__PURE__ */ jsxRuntime.jsx(
11589
11651
  "span",
11590
11652
  {
11591
11653
  className: tailwindMerge.twMerge(
11592
11654
  columnHeaderClasses,
11593
11655
  (i === 1 || i === 2) && "text-center",
11594
- i === 3 && "text-right"
11656
+ (i === 3 || i === 4) && "text-right"
11595
11657
  ),
11596
11658
  children: label
11597
11659
  },