@deframe-sdk/components 0.1.58 → 0.1.60

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
@@ -2193,6 +2193,8 @@ interface EarnDesktopLabels {
2193
2193
  historyAriaLabel?: string;
2194
2194
  columnStrategy?: string;
2195
2195
  columnYield?: string;
2196
+ columnApy?: string;
2197
+ columnProfit?: string;
2196
2198
  columnInvested?: string;
2197
2199
  totalInvestedLabel?: string;
2198
2200
  totalInvestedDescription?: string;
package/dist/index.d.ts CHANGED
@@ -2193,6 +2193,8 @@ interface EarnDesktopLabels {
2193
2193
  historyAriaLabel?: string;
2194
2194
  columnStrategy?: string;
2195
2195
  columnYield?: string;
2196
+ columnApy?: string;
2197
+ columnProfit?: string;
2196
2198
  columnInvested?: string;
2197
2199
  totalInvestedLabel?: string;
2198
2200
  totalInvestedDescription?: string;
package/dist/index.js CHANGED
@@ -5269,7 +5269,7 @@ var SwapSignatureWarningViewSimple = ({
5269
5269
  React6.useEffect(() => {
5270
5270
  const timer = setTimeout(() => {
5271
5271
  onCancel == null ? void 0 : onCancel();
5272
- }, 3e3);
5272
+ }, 2e3);
5273
5273
  return () => clearTimeout(timer);
5274
5274
  }, [onCancel]);
5275
5275
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5461,7 +5461,12 @@ function SuccessIcon() {
5461
5461
  }
5462
5462
  );
5463
5463
  }
5464
- var SwapSuccessViewSimple = ({ labels }) => {
5464
+ var SwapSuccessViewSimple = ({ labels, onClose }) => {
5465
+ React6__namespace.default.useEffect(() => {
5466
+ if (!onClose) return;
5467
+ const timer = setTimeout(onClose, 2e3);
5468
+ return () => clearTimeout(timer);
5469
+ }, [onClose]);
5465
5470
  return /* @__PURE__ */ jsxRuntime.jsxs(
5466
5471
  "div",
5467
5472
  {
@@ -5663,8 +5668,14 @@ function ErrorIcon() {
5663
5668
  }
5664
5669
  var SwapTransactionFailedViewSimple = ({
5665
5670
  errorTitle,
5666
- errorDescription
5671
+ errorDescription,
5672
+ onBack
5667
5673
  }) => {
5674
+ React6__namespace.default.useEffect(() => {
5675
+ if (!onBack) return;
5676
+ const timer = setTimeout(onBack, 2e3);
5677
+ return () => clearTimeout(timer);
5678
+ }, [onBack]);
5668
5679
  return /* @__PURE__ */ jsxRuntime.jsxs(
5669
5680
  "div",
5670
5681
  {
@@ -10532,7 +10543,7 @@ var ImageBannerCard = ({
10532
10543
  }
10533
10544
  );
10534
10545
  };
10535
- var GRID_COLS = "grid grid-cols-[1fr_100px_130px] gap-x-[var(--deframe-widget-size-gap-md)]";
10546
+ var GRID_COLS = "grid grid-cols-[1fr_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
10536
10547
  var HISTORY_COLORS = {
10537
10548
  deposit: "var(--deframe-widget-color-state-info)",
10538
10549
  withdraw: "var(--deframe-widget-color-text-secondary)",
@@ -10544,6 +10555,7 @@ var EarnHubStrategyCard = ({
10544
10555
  network,
10545
10556
  investedFormatted,
10546
10557
  earningsFormatted,
10558
+ profitFormatted,
10547
10559
  isLoading,
10548
10560
  onInvestClick,
10549
10561
  onWithdrawClick,
@@ -10594,6 +10606,7 @@ var EarnHubStrategyCard = ({
10594
10606
  children: earningsFormatted
10595
10607
  }
10596
10608
  ) }),
10609
+ /* @__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" }) }),
10597
10610
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-[var(--deframe-widget-size-gap-xs)]", children: [
10598
10611
  /* @__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: [
10599
10612
  /* @__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 }),
@@ -10797,7 +10810,7 @@ var columnHeaderClasses = [
10797
10810
  "text-[color:var(--deframe-widget-color-text-tertiary)]",
10798
10811
  "leading-[var(--deframe-widget-font-leading-xs)]"
10799
10812
  ].join(" ");
10800
- var GRID_COLS2 = "grid grid-cols-[1fr_100px_130px] gap-x-[var(--deframe-widget-size-gap-md)]";
10813
+ var GRID_COLS2 = "grid grid-cols-[1fr_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
10801
10814
  var BANNER_COLORS = [
10802
10815
  "var(--deframe-widget-color-brand-primary)",
10803
10816
  "var(--deframe-widget-color-brand-secondary)"
@@ -10894,6 +10907,7 @@ var EarnDesktopViewSimple = ({
10894
10907
  network: p.strategy.network,
10895
10908
  investedFormatted: formatCurrency(p.spotPosition.underlyingBalanceUSD),
10896
10909
  earningsFormatted: `${(p.spotPosition.apy * 100).toFixed(2)}%`,
10910
+ profitFormatted: formatCurrency(p.spotPosition.profitInUSD),
10897
10911
  isLoading: false,
10898
10912
  history: (_a = historyByAsset.get(p.strategy.assetName.toUpperCase())) != null ? _a : [],
10899
10913
  onInvestClick: onDeposit ? () => onDeposit(p.strategy.id) : () => {
@@ -11044,13 +11058,13 @@ var EarnDesktopViewSimple = ({
11044
11058
  "px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-sm)]",
11045
11059
  "border-t border-[color:var(--deframe-widget-color-border-secondary)]"
11046
11060
  ),
11047
- children: [labels == null ? void 0 : labels.columnStrategy, labels == null ? void 0 : labels.columnYield, labels == null ? void 0 : labels.columnInvested].map((label, i) => /* @__PURE__ */ jsxRuntime.jsx(
11061
+ 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].map((label, i) => /* @__PURE__ */ jsxRuntime.jsx(
11048
11062
  "span",
11049
11063
  {
11050
11064
  className: tailwindMerge.twMerge(
11051
11065
  columnHeaderClasses,
11052
- i === 1 && "text-center",
11053
- i === 2 && "text-right"
11066
+ (i === 1 || i === 2) && "text-center",
11067
+ i === 3 && "text-right"
11054
11068
  ),
11055
11069
  children: label
11056
11070
  },
@@ -13419,7 +13433,7 @@ var EarnDepositSuccessSimpleView = ({
13419
13433
  }) => {
13420
13434
  React6__namespace.default.useEffect(() => {
13421
13435
  if (!onClose) return;
13422
- const timer = setTimeout(onClose, 5e3);
13436
+ const timer = setTimeout(onClose, 2e3);
13423
13437
  return () => clearTimeout(timer);
13424
13438
  }, [onClose]);
13425
13439
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "earn-deposit-success-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -13509,7 +13523,7 @@ var EarnDepositWarningSimpleView = ({
13509
13523
  }) => {
13510
13524
  React6__namespace.default.useEffect(() => {
13511
13525
  if (!onBack) return;
13512
- const timer = setTimeout(onBack, 5e3);
13526
+ const timer = setTimeout(onBack, 2e3);
13513
13527
  return () => clearTimeout(timer);
13514
13528
  }, [onBack]);
13515
13529
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "earn-deposit-warning-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -13601,7 +13615,7 @@ var EarnDepositFailedSimpleView = ({
13601
13615
  }) => {
13602
13616
  React6__namespace.default.useEffect(() => {
13603
13617
  if (!onBack) return;
13604
- const timer = setTimeout(onBack, 5e3);
13618
+ const timer = setTimeout(onBack, 2e3);
13605
13619
  return () => clearTimeout(timer);
13606
13620
  }, [onBack]);
13607
13621
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "earn-deposit-failed-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -13787,7 +13801,7 @@ var EarnWithdrawSuccessSimpleView = ({
13787
13801
  }) => {
13788
13802
  React6__namespace.default.useEffect(() => {
13789
13803
  if (!onClose) return;
13790
- const timer = setTimeout(onClose, 5e3);
13804
+ const timer = setTimeout(onClose, 2e3);
13791
13805
  return () => clearTimeout(timer);
13792
13806
  }, [onClose]);
13793
13807
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "earn-withdraw-success-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -13877,7 +13891,7 @@ var EarnWithdrawWarningSimpleView = ({
13877
13891
  }) => {
13878
13892
  React6__namespace.default.useEffect(() => {
13879
13893
  if (!onBack) return;
13880
- const timer = setTimeout(onBack, 5e3);
13894
+ const timer = setTimeout(onBack, 2e3);
13881
13895
  return () => clearTimeout(timer);
13882
13896
  }, [onBack]);
13883
13897
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "earn-withdraw-warning-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -13969,7 +13983,7 @@ var EarnWithdrawFailedSimpleView = ({
13969
13983
  }) => {
13970
13984
  React6__namespace.default.useEffect(() => {
13971
13985
  if (!onBack) return;
13972
- const timer = setTimeout(onBack, 5e3);
13986
+ const timer = setTimeout(onBack, 2e3);
13973
13987
  return () => clearTimeout(timer);
13974
13988
  }, [onBack]);
13975
13989
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "earn-withdraw-failed-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -14690,7 +14704,7 @@ var OnchainDepositSuccessSimpleView = ({
14690
14704
  }) => {
14691
14705
  React6__namespace.useEffect(() => {
14692
14706
  if (!onClose) return;
14693
- const timer = setTimeout(onClose, 5e3);
14707
+ const timer = setTimeout(onClose, 2e3);
14694
14708
  return () => clearTimeout(timer);
14695
14709
  }, [onClose]);
14696
14710
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "onchain-deposit-success-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -15603,7 +15617,7 @@ var OnchainWithdrawSuccessSimpleView = ({
15603
15617
  }) => {
15604
15618
  React6__namespace.useEffect(() => {
15605
15619
  if (!onClose) return;
15606
- const timer = setTimeout(onClose, 5e3);
15620
+ const timer = setTimeout(onClose, 2e3);
15607
15621
  return () => clearTimeout(timer);
15608
15622
  }, [onClose]);
15609
15623
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "onchain-withdraw-success-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -16083,7 +16097,7 @@ var OnchainWithdrawSignatureWarningSimpleView = ({
16083
16097
  }) => {
16084
16098
  React6__namespace.useEffect(() => {
16085
16099
  if (!onCancel) return;
16086
- const timer = setTimeout(onCancel, 5e3);
16100
+ const timer = setTimeout(onCancel, 2e3);
16087
16101
  return () => clearTimeout(timer);
16088
16102
  }, [onCancel]);
16089
16103
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "onchain-withdraw-signature-warning-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -16390,6 +16404,7 @@ var OnrampFormSimpleView = ({
16390
16404
  error
16391
16405
  }) => {
16392
16406
  const hasPixCode = !!pixCode;
16407
+ const isWaitingForPixPayment = hasPixCode && !isExpired;
16393
16408
  const isSubmitDisabled = !amount || amount === "0" || amount === "" || isBelowMinAmount || hasNoAmount || isProcessing;
16394
16409
  const panelBaseClasses = [
16395
16410
  "relative flex flex-col overflow-hidden w-[420px]",
@@ -16436,6 +16451,61 @@ var OnrampFormSimpleView = ({
16436
16451
  "hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_60%,transparent)]",
16437
16452
  "hover:text-[color:var(--deframe-widget-color-text-primary)]"
16438
16453
  ].join(" ");
16454
+ let footerContent;
16455
+ if (!hasPixCode) {
16456
+ footerContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16457
+ /* @__PURE__ */ jsxRuntime.jsx(
16458
+ SecondaryButton,
16459
+ {
16460
+ type: "button",
16461
+ className: secondaryButtonClasses,
16462
+ onClick: onBack,
16463
+ "aria-label": "Cancelar dep\xF3sito",
16464
+ "data-test-id": "onramp-form-simple-view-cancel",
16465
+ children: "Cancelar"
16466
+ }
16467
+ ),
16468
+ /* @__PURE__ */ jsxRuntime.jsx(
16469
+ PrimaryButton,
16470
+ {
16471
+ type: "button",
16472
+ className: "flex-1 h-12 rounded-[var(--deframe-widget-size-radius-sm)] text-[15px]",
16473
+ onClick: onSubmit,
16474
+ disabled: isSubmitDisabled,
16475
+ "aria-label": submitLabel,
16476
+ "data-test-id": "onramp-form-simple-view-submit",
16477
+ children: isProcessing ? "Processando..." : submitLabel
16478
+ }
16479
+ )
16480
+ ] });
16481
+ } else if (isWaitingForPixPayment) {
16482
+ footerContent = /* @__PURE__ */ jsxRuntime.jsxs(
16483
+ PrimaryButton,
16484
+ {
16485
+ type: "button",
16486
+ className: "w-full h-12 rounded-[var(--deframe-widget-size-radius-sm)] text-[15px]",
16487
+ disabled: true,
16488
+ "aria-label": "Aguardando pagamento PIX",
16489
+ "data-test-id": "onramp-form-simple-view-waiting-payment",
16490
+ children: [
16491
+ "Aguardando pagamento ",
16492
+ /* @__PURE__ */ jsxRuntime.jsx(LoadingDots, {})
16493
+ ]
16494
+ }
16495
+ );
16496
+ } else {
16497
+ footerContent = /* @__PURE__ */ jsxRuntime.jsx(
16498
+ SecondaryButton,
16499
+ {
16500
+ type: "button",
16501
+ className: tailwindMerge.twMerge(secondaryButtonClasses, "w-full"),
16502
+ onClick: onBack,
16503
+ "aria-label": "Cancelar",
16504
+ "data-test-id": "onramp-form-simple-view-cancel",
16505
+ children: "Cancelar"
16506
+ }
16507
+ );
16508
+ }
16439
16509
  return /* @__PURE__ */ jsxRuntime.jsxs(
16440
16510
  "div",
16441
16511
  {
@@ -16772,41 +16842,7 @@ var OnrampFormSimpleView = ({
16772
16842
  "data-slot": "onramp-form-simple-footer",
16773
16843
  "data-test-id": "onramp-form-simple-view-footer",
16774
16844
  className: footerBaseClasses,
16775
- children: !hasPixCode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16776
- /* @__PURE__ */ jsxRuntime.jsx(
16777
- SecondaryButton,
16778
- {
16779
- type: "button",
16780
- className: secondaryButtonClasses,
16781
- onClick: onBack,
16782
- "aria-label": "Cancelar dep\xF3sito",
16783
- "data-test-id": "onramp-form-simple-view-cancel",
16784
- children: "Cancelar"
16785
- }
16786
- ),
16787
- /* @__PURE__ */ jsxRuntime.jsx(
16788
- PrimaryButton,
16789
- {
16790
- type: "button",
16791
- className: "flex-1 h-12 rounded-[var(--deframe-widget-size-radius-sm)] text-[15px]",
16792
- onClick: onSubmit,
16793
- disabled: isSubmitDisabled,
16794
- "aria-label": submitLabel,
16795
- "data-test-id": "onramp-form-simple-view-submit",
16796
- children: isProcessing ? "Processando..." : submitLabel
16797
- }
16798
- )
16799
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(
16800
- SecondaryButton,
16801
- {
16802
- type: "button",
16803
- className: tailwindMerge.twMerge(secondaryButtonClasses, "w-full"),
16804
- onClick: onBack,
16805
- "aria-label": "Cancelar",
16806
- "data-test-id": "onramp-form-simple-view-cancel",
16807
- children: "Cancelar"
16808
- }
16809
- )
16845
+ children: footerContent
16810
16846
  }
16811
16847
  )
16812
16848
  ]
@@ -17012,7 +17048,7 @@ var OnrampSuccessSimpleView = ({
17012
17048
  }) => {
17013
17049
  React6__namespace.useEffect(() => {
17014
17050
  if (!onGoToDashboard) return;
17015
- const timer = setTimeout(onGoToDashboard, 5e3);
17051
+ const timer = setTimeout(onGoToDashboard, 2e3);
17016
17052
  return () => clearTimeout(timer);
17017
17053
  }, [onGoToDashboard]);
17018
17054
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "onramp-success-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -18010,7 +18046,7 @@ var OfframpSuccessSimpleView = ({
18010
18046
  }) => {
18011
18047
  React6__namespace.useEffect(() => {
18012
18048
  if (!onClose) return;
18013
- const timer = setTimeout(onClose, 5e3);
18049
+ const timer = setTimeout(onClose, 2e3);
18014
18050
  return () => clearTimeout(timer);
18015
18051
  }, [onClose]);
18016
18052
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-test-id": "offramp-success-simple-view", children: /* @__PURE__ */ jsxRuntime.jsx(