@deframe-sdk/components 0.1.58 → 0.1.59

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
@@ -10508,7 +10508,7 @@ var ImageBannerCard = ({
10508
10508
  }
10509
10509
  );
10510
10510
  };
10511
- var GRID_COLS = "grid grid-cols-[1fr_100px_130px] gap-x-[var(--deframe-widget-size-gap-md)]";
10511
+ var GRID_COLS = "grid grid-cols-[1fr_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
10512
10512
  var HISTORY_COLORS = {
10513
10513
  deposit: "var(--deframe-widget-color-state-info)",
10514
10514
  withdraw: "var(--deframe-widget-color-text-secondary)",
@@ -10520,6 +10520,7 @@ var EarnHubStrategyCard = ({
10520
10520
  network,
10521
10521
  investedFormatted,
10522
10522
  earningsFormatted,
10523
+ profitFormatted,
10523
10524
  isLoading,
10524
10525
  onInvestClick,
10525
10526
  onWithdrawClick,
@@ -10570,6 +10571,7 @@ var EarnHubStrategyCard = ({
10570
10571
  children: earningsFormatted
10571
10572
  }
10572
10573
  ) }),
10574
+ /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: isLoading ? /* @__PURE__ */ jsx(Skeleton, { variant: "rect", width: 50, height: 16 }) : profitFormatted ? /* @__PURE__ */ 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__ */ jsx("span", { className: "text-[length:var(--deframe-widget-font-size-xs)] text-[color:var(--deframe-widget-color-text-tertiary)]", children: "\u2014" }) }),
10573
10575
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-[var(--deframe-widget-size-gap-xs)]", children: [
10574
10576
  /* @__PURE__ */ jsx("div", { className: "flex flex-col items-end", children: isLoading ? /* @__PURE__ */ jsx(Skeleton, { variant: "rect", width: 60, height: 16 }) : investedFormatted ? /* @__PURE__ */ jsxs(Fragment, { children: [
10575
10577
  /* @__PURE__ */ 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 }),
@@ -10773,7 +10775,7 @@ var columnHeaderClasses = [
10773
10775
  "text-[color:var(--deframe-widget-color-text-tertiary)]",
10774
10776
  "leading-[var(--deframe-widget-font-leading-xs)]"
10775
10777
  ].join(" ");
10776
- var GRID_COLS2 = "grid grid-cols-[1fr_100px_130px] gap-x-[var(--deframe-widget-size-gap-md)]";
10778
+ var GRID_COLS2 = "grid grid-cols-[1fr_100px_100px_100px] gap-x-[var(--deframe-widget-size-gap-md)]";
10777
10779
  var BANNER_COLORS = [
10778
10780
  "var(--deframe-widget-color-brand-primary)",
10779
10781
  "var(--deframe-widget-color-brand-secondary)"
@@ -10870,6 +10872,7 @@ var EarnDesktopViewSimple = ({
10870
10872
  network: p.strategy.network,
10871
10873
  investedFormatted: formatCurrency(p.spotPosition.underlyingBalanceUSD),
10872
10874
  earningsFormatted: `${(p.spotPosition.apy * 100).toFixed(2)}%`,
10875
+ profitFormatted: formatCurrency(p.spotPosition.profitInUSD),
10873
10876
  isLoading: false,
10874
10877
  history: (_a = historyByAsset.get(p.strategy.assetName.toUpperCase())) != null ? _a : [],
10875
10878
  onInvestClick: onDeposit ? () => onDeposit(p.strategy.id) : () => {
@@ -11020,13 +11023,13 @@ var EarnDesktopViewSimple = ({
11020
11023
  "px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-sm)]",
11021
11024
  "border-t border-[color:var(--deframe-widget-color-border-secondary)]"
11022
11025
  ),
11023
- children: [labels == null ? void 0 : labels.columnStrategy, labels == null ? void 0 : labels.columnYield, labels == null ? void 0 : labels.columnInvested].map((label, i) => /* @__PURE__ */ jsx(
11026
+ 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__ */ jsx(
11024
11027
  "span",
11025
11028
  {
11026
11029
  className: twMerge(
11027
11030
  columnHeaderClasses,
11028
- i === 1 && "text-center",
11029
- i === 2 && "text-right"
11031
+ (i === 1 || i === 2) && "text-center",
11032
+ i === 3 && "text-right"
11030
11033
  ),
11031
11034
  children: label
11032
11035
  },
@@ -16366,6 +16369,7 @@ var OnrampFormSimpleView = ({
16366
16369
  error
16367
16370
  }) => {
16368
16371
  const hasPixCode = !!pixCode;
16372
+ const isWaitingForPixPayment = hasPixCode && !isExpired;
16369
16373
  const isSubmitDisabled = !amount || amount === "0" || amount === "" || isBelowMinAmount || hasNoAmount || isProcessing;
16370
16374
  const panelBaseClasses = [
16371
16375
  "relative flex flex-col overflow-hidden w-[420px]",
@@ -16412,6 +16416,61 @@ var OnrampFormSimpleView = ({
16412
16416
  "hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_60%,transparent)]",
16413
16417
  "hover:text-[color:var(--deframe-widget-color-text-primary)]"
16414
16418
  ].join(" ");
16419
+ let footerContent;
16420
+ if (!hasPixCode) {
16421
+ footerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
16422
+ /* @__PURE__ */ jsx(
16423
+ SecondaryButton,
16424
+ {
16425
+ type: "button",
16426
+ className: secondaryButtonClasses,
16427
+ onClick: onBack,
16428
+ "aria-label": "Cancelar dep\xF3sito",
16429
+ "data-test-id": "onramp-form-simple-view-cancel",
16430
+ children: "Cancelar"
16431
+ }
16432
+ ),
16433
+ /* @__PURE__ */ jsx(
16434
+ PrimaryButton,
16435
+ {
16436
+ type: "button",
16437
+ className: "flex-1 h-12 rounded-[var(--deframe-widget-size-radius-sm)] text-[15px]",
16438
+ onClick: onSubmit,
16439
+ disabled: isSubmitDisabled,
16440
+ "aria-label": submitLabel,
16441
+ "data-test-id": "onramp-form-simple-view-submit",
16442
+ children: isProcessing ? "Processando..." : submitLabel
16443
+ }
16444
+ )
16445
+ ] });
16446
+ } else if (isWaitingForPixPayment) {
16447
+ footerContent = /* @__PURE__ */ jsxs(
16448
+ PrimaryButton,
16449
+ {
16450
+ type: "button",
16451
+ className: "w-full h-12 rounded-[var(--deframe-widget-size-radius-sm)] text-[15px]",
16452
+ disabled: true,
16453
+ "aria-label": "Aguardando pagamento PIX",
16454
+ "data-test-id": "onramp-form-simple-view-waiting-payment",
16455
+ children: [
16456
+ "Aguardando pagamento ",
16457
+ /* @__PURE__ */ jsx(LoadingDots, {})
16458
+ ]
16459
+ }
16460
+ );
16461
+ } else {
16462
+ footerContent = /* @__PURE__ */ jsx(
16463
+ SecondaryButton,
16464
+ {
16465
+ type: "button",
16466
+ className: twMerge(secondaryButtonClasses, "w-full"),
16467
+ onClick: onBack,
16468
+ "aria-label": "Cancelar",
16469
+ "data-test-id": "onramp-form-simple-view-cancel",
16470
+ children: "Cancelar"
16471
+ }
16472
+ );
16473
+ }
16415
16474
  return /* @__PURE__ */ jsxs(
16416
16475
  "div",
16417
16476
  {
@@ -16748,41 +16807,7 @@ var OnrampFormSimpleView = ({
16748
16807
  "data-slot": "onramp-form-simple-footer",
16749
16808
  "data-test-id": "onramp-form-simple-view-footer",
16750
16809
  className: footerBaseClasses,
16751
- children: !hasPixCode ? /* @__PURE__ */ jsxs(Fragment, { children: [
16752
- /* @__PURE__ */ jsx(
16753
- SecondaryButton,
16754
- {
16755
- type: "button",
16756
- className: secondaryButtonClasses,
16757
- onClick: onBack,
16758
- "aria-label": "Cancelar dep\xF3sito",
16759
- "data-test-id": "onramp-form-simple-view-cancel",
16760
- children: "Cancelar"
16761
- }
16762
- ),
16763
- /* @__PURE__ */ jsx(
16764
- PrimaryButton,
16765
- {
16766
- type: "button",
16767
- className: "flex-1 h-12 rounded-[var(--deframe-widget-size-radius-sm)] text-[15px]",
16768
- onClick: onSubmit,
16769
- disabled: isSubmitDisabled,
16770
- "aria-label": submitLabel,
16771
- "data-test-id": "onramp-form-simple-view-submit",
16772
- children: isProcessing ? "Processando..." : submitLabel
16773
- }
16774
- )
16775
- ] }) : /* @__PURE__ */ jsx(
16776
- SecondaryButton,
16777
- {
16778
- type: "button",
16779
- className: twMerge(secondaryButtonClasses, "w-full"),
16780
- onClick: onBack,
16781
- "aria-label": "Cancelar",
16782
- "data-test-id": "onramp-form-simple-view-cancel",
16783
- children: "Cancelar"
16784
- }
16785
- )
16810
+ children: footerContent
16786
16811
  }
16787
16812
  )
16788
16813
  ]