@compass-labs/widgets 0.1.17 → 0.1.19

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.js CHANGED
@@ -2074,33 +2074,7 @@ function EarnAccountGuard({
2074
2074
  const { isDeployed, isChecking, isCreating, createAccount, error } = useEarnAccount();
2075
2075
  const [createError, setCreateError] = react.useState(null);
2076
2076
  if (!isConnected) {
2077
- return /* @__PURE__ */ jsxRuntime.jsxs(
2078
- "div",
2079
- {
2080
- className: "compass-earn-guard p-6 text-center",
2081
- style: {
2082
- backgroundColor: "var(--compass-color-surface)",
2083
- borderRadius: "var(--compass-border-radius-xl)",
2084
- fontFamily: "var(--compass-font-family)"
2085
- },
2086
- children: [
2087
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm mb-4", style: { color: "var(--compass-color-text-secondary)" }, children: "Connect your wallet to continue" }),
2088
- login && /* @__PURE__ */ jsxRuntime.jsx(
2089
- "button",
2090
- {
2091
- onClick: login,
2092
- className: "px-4 py-2 font-medium transition-colors",
2093
- style: {
2094
- backgroundColor: "var(--compass-color-primary)",
2095
- color: "var(--compass-color-primary-text)",
2096
- borderRadius: "var(--compass-border-radius-lg)"
2097
- },
2098
- children: "Connect Wallet"
2099
- }
2100
- )
2101
- ]
2102
- }
2103
- );
2077
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
2104
2078
  }
2105
2079
  if (isChecking) {
2106
2080
  if (loadingComponent) {
@@ -4696,7 +4670,7 @@ function EarnAccount({
4696
4670
  defaultMarketType = "aave",
4697
4671
  defaultMinTvl = 0
4698
4672
  }) {
4699
- const { address, signTypedData, switchChain, walletChainId } = useEmbeddableWallet();
4673
+ const { address, isConnected, login, signTypedData, switchChain, walletChainId } = useEmbeddableWallet();
4700
4674
  const { isDeployed } = useEarnAccount();
4701
4675
  const { chainId: CHAIN_ID } = useChain();
4702
4676
  const queryClient = reactQuery.useQueryClient();
@@ -5723,8 +5697,8 @@ function EarnAccount({
5723
5697
  /* @__PURE__ */ jsxRuntime.jsx(
5724
5698
  "button",
5725
5699
  {
5726
- onClick: handleAction,
5727
- disabled: isProcessing || !selectedMarket || !amount || parseFloat(amount) <= 0 || parseFloat(amount) > maxAmount,
5700
+ onClick: !isConnected && login ? login : handleAction,
5701
+ disabled: isConnected && (isProcessing || !selectedMarket || !amount || parseFloat(amount) <= 0 || parseFloat(amount) > maxAmount),
5728
5702
  className: "w-full font-semibold transition-all disabled:opacity-50 disabled:cursor-not-allowed",
5729
5703
  style: {
5730
5704
  backgroundColor: "var(--compass-color-primary)",
@@ -5734,7 +5708,7 @@ function EarnAccount({
5734
5708
  fontSize: compact ? "0.875rem" : "1rem",
5735
5709
  transition: "var(--compass-transition-normal)"
5736
5710
  },
5737
- children: isProcessing ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center justify-center", style: { gap: "calc(var(--compass-spacing-unit) * 0.5)" }, children: [
5711
+ children: !isConnected ? "Connect Wallet" : isProcessing ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center justify-center", style: { gap: "calc(var(--compass-spacing-unit) * 0.5)" }, children: [
5738
5712
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { size: compact ? 16 : 20, className: "animate-spin" }),
5739
5713
  "Processing..."
5740
5714
  ] }) : !selectedMarket ? "Select a market" : needsActionSwap ? activeTab === "deposit" ? `Swap & Deposit` : `Withdraw & Swap` : activeTab === "deposit" ? "Deposit funds" : "Withdraw funds"