@unifold/ui-react 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.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +47 -12
- package/dist/index.mjs +47 -12
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -185,6 +185,8 @@ interface DepositModalProps {
|
|
|
185
185
|
browserWalletAmountQuickSelect?: BrowserWalletAmountQuickSelect;
|
|
186
186
|
/** Enable "Pay with Exchange" option. Overrides dashboard default. Defaults to dashboard value or true. */
|
|
187
187
|
enablePayWithExchange?: boolean;
|
|
188
|
+
/** Enable the fiat on-ramp option (shown as "Deposit with Card"). Overrides dashboard default. Defaults to dashboard value or true. */
|
|
189
|
+
enableFiatOnramp?: boolean;
|
|
188
190
|
/** Enable "Connect Exchange" option for direct Coinbase Connect integration. Defaults to false. */
|
|
189
191
|
enableConnectExchange?: boolean;
|
|
190
192
|
/** Enable "Pay with Cash App" option. Defaults to false. */
|
|
@@ -210,7 +212,7 @@ interface DepositModalProps {
|
|
|
210
212
|
/** First screen when the modal opens. Default `main` (deposit menu). */
|
|
211
213
|
initialScreen?: DepositModalInitialScreen;
|
|
212
214
|
}
|
|
213
|
-
declare function DepositModal({ open, onOpenChange, userId, publishableKey, modalTitle, destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, hideDepositTracker, showBalanceHeader, transferInputVariant, depositConfirmationMode, enableConnectWallet, browserWalletAmountQuickSelect, enablePayWithExchange, enableConnectExchange, enableCashApp, hideDepositFlowInfo, hideDisplayDescription, onDepositSuccess, onDepositError, onEvent, theme, hideOverlay, initialScreen, transferCryptoTitle, depositWithCardTitle, payWithExchangeTitle, depositTrackerTitle, depositTrackerSubTitle, }: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
215
|
+
declare function DepositModal({ open, onOpenChange, userId, publishableKey, modalTitle, destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, hideDepositTracker, showBalanceHeader, transferInputVariant, depositConfirmationMode, enableConnectWallet, browserWalletAmountQuickSelect, enablePayWithExchange, enableFiatOnramp, enableConnectExchange, enableCashApp, hideDepositFlowInfo, hideDisplayDescription, onDepositSuccess, onDepositError, onEvent, theme, hideOverlay, initialScreen, transferCryptoTitle, depositWithCardTitle, payWithExchangeTitle, depositTrackerTitle, depositTrackerSubTitle, }: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
214
216
|
|
|
215
217
|
interface DepositHeaderProps {
|
|
216
218
|
title: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -185,6 +185,8 @@ interface DepositModalProps {
|
|
|
185
185
|
browserWalletAmountQuickSelect?: BrowserWalletAmountQuickSelect;
|
|
186
186
|
/** Enable "Pay with Exchange" option. Overrides dashboard default. Defaults to dashboard value or true. */
|
|
187
187
|
enablePayWithExchange?: boolean;
|
|
188
|
+
/** Enable the fiat on-ramp option (shown as "Deposit with Card"). Overrides dashboard default. Defaults to dashboard value or true. */
|
|
189
|
+
enableFiatOnramp?: boolean;
|
|
188
190
|
/** Enable "Connect Exchange" option for direct Coinbase Connect integration. Defaults to false. */
|
|
189
191
|
enableConnectExchange?: boolean;
|
|
190
192
|
/** Enable "Pay with Cash App" option. Defaults to false. */
|
|
@@ -210,7 +212,7 @@ interface DepositModalProps {
|
|
|
210
212
|
/** First screen when the modal opens. Default `main` (deposit menu). */
|
|
211
213
|
initialScreen?: DepositModalInitialScreen;
|
|
212
214
|
}
|
|
213
|
-
declare function DepositModal({ open, onOpenChange, userId, publishableKey, modalTitle, destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, hideDepositTracker, showBalanceHeader, transferInputVariant, depositConfirmationMode, enableConnectWallet, browserWalletAmountQuickSelect, enablePayWithExchange, enableConnectExchange, enableCashApp, hideDepositFlowInfo, hideDisplayDescription, onDepositSuccess, onDepositError, onEvent, theme, hideOverlay, initialScreen, transferCryptoTitle, depositWithCardTitle, payWithExchangeTitle, depositTrackerTitle, depositTrackerSubTitle, }: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
215
|
+
declare function DepositModal({ open, onOpenChange, userId, publishableKey, modalTitle, destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol, hideDepositTracker, showBalanceHeader, transferInputVariant, depositConfirmationMode, enableConnectWallet, browserWalletAmountQuickSelect, enablePayWithExchange, enableFiatOnramp, enableConnectExchange, enableCashApp, hideDepositFlowInfo, hideDisplayDescription, onDepositSuccess, onDepositError, onEvent, theme, hideOverlay, initialScreen, transferCryptoTitle, depositWithCardTitle, payWithExchangeTitle, depositTrackerTitle, depositTrackerSubTitle, }: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
214
216
|
|
|
215
217
|
interface DepositHeaderProps {
|
|
216
218
|
title: string;
|
package/dist/index.js
CHANGED
|
@@ -10307,6 +10307,7 @@ function DepositsModal({
|
|
|
10307
10307
|
// src/components/deposits/TokenSelectorSheet.tsx
|
|
10308
10308
|
var import_react14 = require("react");
|
|
10309
10309
|
var import_lucide_react19 = require("lucide-react");
|
|
10310
|
+
var import_fuse = __toESM(require("fuse.js"));
|
|
10310
10311
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
10311
10312
|
var STORAGE_KEY = "unifold_recent_tokens";
|
|
10312
10313
|
var MAX_RECENT_TOKENS = 5;
|
|
@@ -10412,13 +10413,25 @@ function TokenSelectorSheet({
|
|
|
10412
10413
|
});
|
|
10413
10414
|
setRecentTokens(updated);
|
|
10414
10415
|
};
|
|
10416
|
+
const fuse = (0, import_react14.useMemo)(
|
|
10417
|
+
() => new import_fuse.default(allOptions, {
|
|
10418
|
+
keys: [
|
|
10419
|
+
{ name: "token.symbol", weight: 2 },
|
|
10420
|
+
{ name: "token.name", weight: 1 },
|
|
10421
|
+
{ name: "chain.chain_name", weight: 0.5 }
|
|
10422
|
+
],
|
|
10423
|
+
threshold: 0.2,
|
|
10424
|
+
ignoreLocation: true,
|
|
10425
|
+
minMatchCharLength: 2
|
|
10426
|
+
}),
|
|
10427
|
+
[allOptions]
|
|
10428
|
+
);
|
|
10415
10429
|
const filteredOptions = (0, import_react14.useMemo)(() => {
|
|
10416
10430
|
if (!searchQuery.trim()) return allOptions;
|
|
10417
|
-
const query = searchQuery.
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
}, [allOptions, searchQuery]);
|
|
10431
|
+
const query = searchQuery.trim();
|
|
10432
|
+
const results = fuse.search(query);
|
|
10433
|
+
return results.map((r) => r.item);
|
|
10434
|
+
}, [fuse, allOptions, searchQuery]);
|
|
10422
10435
|
const isCommonToken = (symbol, chainType, chainId) => {
|
|
10423
10436
|
return COMMON_TOKENS.some(
|
|
10424
10437
|
(ct) => ct.symbol === symbol && ct.chainType === chainType && ct.chainId === chainId
|
|
@@ -14174,6 +14187,7 @@ function DepositModal({
|
|
|
14174
14187
|
enableConnectWallet = false,
|
|
14175
14188
|
browserWalletAmountQuickSelect = "percentage",
|
|
14176
14189
|
enablePayWithExchange,
|
|
14190
|
+
enableFiatOnramp,
|
|
14177
14191
|
enableConnectExchange = false,
|
|
14178
14192
|
enableCashApp = false,
|
|
14179
14193
|
hideDepositFlowInfo = false,
|
|
@@ -14195,8 +14209,9 @@ function DepositModal({
|
|
|
14195
14209
|
const s = initialScreen ?? "main";
|
|
14196
14210
|
if (s === "tracker" && hideDepositTracker) return "main";
|
|
14197
14211
|
if (s === "cashapp" && !enableCashApp) return "main";
|
|
14212
|
+
if (s === "card" && enableFiatOnramp === false) return "main";
|
|
14198
14213
|
return s;
|
|
14199
|
-
}, [initialScreen, hideDepositTracker, enableCashApp]);
|
|
14214
|
+
}, [initialScreen, hideDepositTracker, enableCashApp, enableFiatOnramp]);
|
|
14200
14215
|
const [containerEl, setContainerEl] = (0, import_react20.useState)(null);
|
|
14201
14216
|
const containerCallbackRef = (0, import_react20.useCallback)((el) => {
|
|
14202
14217
|
setContainerEl(el);
|
|
@@ -14312,6 +14327,13 @@ function DepositModal({
|
|
|
14312
14327
|
enabled: open
|
|
14313
14328
|
});
|
|
14314
14329
|
const showPayWithExchange = enablePayWithExchange ?? projectConfig?.pay_with_exchange?.enabled ?? true;
|
|
14330
|
+
const showFiatOnramp = enableFiatOnramp ?? projectConfig?.fiat_onramp?.enabled ?? true;
|
|
14331
|
+
(0, import_react20.useEffect)(() => {
|
|
14332
|
+
if (view === "card" && !showFiatOnramp) {
|
|
14333
|
+
setView("main");
|
|
14334
|
+
setCardView("amount");
|
|
14335
|
+
}
|
|
14336
|
+
}, [view, showFiatOnramp]);
|
|
14315
14337
|
const { exchanges, isLoading: exchangesLoading } = useExchanges({
|
|
14316
14338
|
publishableKey,
|
|
14317
14339
|
enabled: open && showPayWithExchange
|
|
@@ -14621,7 +14643,7 @@ function DepositModal({
|
|
|
14621
14643
|
featuredWallets: projectConfig?.connect_wallet?.wallets
|
|
14622
14644
|
}
|
|
14623
14645
|
),
|
|
14624
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
14646
|
+
showFiatOnramp && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
14625
14647
|
DepositWithCardButton,
|
|
14626
14648
|
{
|
|
14627
14649
|
onClick: () => setView("card"),
|
|
@@ -17606,6 +17628,7 @@ function WithdrawModal({
|
|
|
17606
17628
|
// src/components/withdrawals/WithdrawTokenSelector.tsx
|
|
17607
17629
|
var import_react27 = require("react");
|
|
17608
17630
|
var import_lucide_react34 = require("lucide-react");
|
|
17631
|
+
var import_fuse2 = __toESM(require("fuse.js"));
|
|
17609
17632
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
17610
17633
|
var t11 = i18n.withdrawModal;
|
|
17611
17634
|
function WithdrawTokenSelector({
|
|
@@ -17625,13 +17648,25 @@ function WithdrawTokenSelector({
|
|
|
17625
17648
|
});
|
|
17626
17649
|
return options;
|
|
17627
17650
|
}, [tokens]);
|
|
17651
|
+
const fuse = (0, import_react27.useMemo)(
|
|
17652
|
+
() => new import_fuse2.default(allOptions, {
|
|
17653
|
+
keys: [
|
|
17654
|
+
{ name: "token.symbol", weight: 2 },
|
|
17655
|
+
{ name: "token.name", weight: 1 },
|
|
17656
|
+
{ name: "chain.chain_name", weight: 0.5 }
|
|
17657
|
+
],
|
|
17658
|
+
threshold: 0.2,
|
|
17659
|
+
ignoreLocation: true,
|
|
17660
|
+
minMatchCharLength: 2
|
|
17661
|
+
}),
|
|
17662
|
+
[allOptions]
|
|
17663
|
+
);
|
|
17628
17664
|
const filteredOptions = (0, import_react27.useMemo)(() => {
|
|
17629
17665
|
if (!searchQuery.trim()) return allOptions;
|
|
17630
|
-
const query = searchQuery.
|
|
17631
|
-
|
|
17632
|
-
|
|
17633
|
-
|
|
17634
|
-
}, [allOptions, searchQuery]);
|
|
17666
|
+
const query = searchQuery.trim();
|
|
17667
|
+
const results = fuse.search(query);
|
|
17668
|
+
return results.map((r) => r.item);
|
|
17669
|
+
}, [fuse, allOptions, searchQuery]);
|
|
17635
17670
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
17636
17671
|
"div",
|
|
17637
17672
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -10284,6 +10284,7 @@ function DepositsModal({
|
|
|
10284
10284
|
// src/components/deposits/TokenSelectorSheet.tsx
|
|
10285
10285
|
import { useState as useState23, useMemo as useMemo6, useEffect as useEffect19 } from "react";
|
|
10286
10286
|
import { ArrowLeft as ArrowLeft2, X as X4 } from "lucide-react";
|
|
10287
|
+
import Fuse from "fuse.js";
|
|
10287
10288
|
import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
10288
10289
|
var STORAGE_KEY = "unifold_recent_tokens";
|
|
10289
10290
|
var MAX_RECENT_TOKENS = 5;
|
|
@@ -10389,13 +10390,25 @@ function TokenSelectorSheet({
|
|
|
10389
10390
|
});
|
|
10390
10391
|
setRecentTokens(updated);
|
|
10391
10392
|
};
|
|
10393
|
+
const fuse = useMemo6(
|
|
10394
|
+
() => new Fuse(allOptions, {
|
|
10395
|
+
keys: [
|
|
10396
|
+
{ name: "token.symbol", weight: 2 },
|
|
10397
|
+
{ name: "token.name", weight: 1 },
|
|
10398
|
+
{ name: "chain.chain_name", weight: 0.5 }
|
|
10399
|
+
],
|
|
10400
|
+
threshold: 0.2,
|
|
10401
|
+
ignoreLocation: true,
|
|
10402
|
+
minMatchCharLength: 2
|
|
10403
|
+
}),
|
|
10404
|
+
[allOptions]
|
|
10405
|
+
);
|
|
10392
10406
|
const filteredOptions = useMemo6(() => {
|
|
10393
10407
|
if (!searchQuery.trim()) return allOptions;
|
|
10394
|
-
const query = searchQuery.
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
}, [allOptions, searchQuery]);
|
|
10408
|
+
const query = searchQuery.trim();
|
|
10409
|
+
const results = fuse.search(query);
|
|
10410
|
+
return results.map((r) => r.item);
|
|
10411
|
+
}, [fuse, allOptions, searchQuery]);
|
|
10399
10412
|
const isCommonToken = (symbol, chainType, chainId) => {
|
|
10400
10413
|
return COMMON_TOKENS.some(
|
|
10401
10414
|
(ct) => ct.symbol === symbol && ct.chainType === chainType && ct.chainId === chainId
|
|
@@ -14176,6 +14189,7 @@ function DepositModal({
|
|
|
14176
14189
|
enableConnectWallet = false,
|
|
14177
14190
|
browserWalletAmountQuickSelect = "percentage",
|
|
14178
14191
|
enablePayWithExchange,
|
|
14192
|
+
enableFiatOnramp,
|
|
14179
14193
|
enableConnectExchange = false,
|
|
14180
14194
|
enableCashApp = false,
|
|
14181
14195
|
hideDepositFlowInfo = false,
|
|
@@ -14197,8 +14211,9 @@ function DepositModal({
|
|
|
14197
14211
|
const s = initialScreen ?? "main";
|
|
14198
14212
|
if (s === "tracker" && hideDepositTracker) return "main";
|
|
14199
14213
|
if (s === "cashapp" && !enableCashApp) return "main";
|
|
14214
|
+
if (s === "card" && enableFiatOnramp === false) return "main";
|
|
14200
14215
|
return s;
|
|
14201
|
-
}, [initialScreen, hideDepositTracker, enableCashApp]);
|
|
14216
|
+
}, [initialScreen, hideDepositTracker, enableCashApp, enableFiatOnramp]);
|
|
14202
14217
|
const [containerEl, setContainerEl] = useState31(null);
|
|
14203
14218
|
const containerCallbackRef = useCallback5((el) => {
|
|
14204
14219
|
setContainerEl(el);
|
|
@@ -14314,6 +14329,13 @@ function DepositModal({
|
|
|
14314
14329
|
enabled: open
|
|
14315
14330
|
});
|
|
14316
14331
|
const showPayWithExchange = enablePayWithExchange ?? projectConfig?.pay_with_exchange?.enabled ?? true;
|
|
14332
|
+
const showFiatOnramp = enableFiatOnramp ?? projectConfig?.fiat_onramp?.enabled ?? true;
|
|
14333
|
+
useEffect25(() => {
|
|
14334
|
+
if (view === "card" && !showFiatOnramp) {
|
|
14335
|
+
setView("main");
|
|
14336
|
+
setCardView("amount");
|
|
14337
|
+
}
|
|
14338
|
+
}, [view, showFiatOnramp]);
|
|
14317
14339
|
const { exchanges, isLoading: exchangesLoading } = useExchanges({
|
|
14318
14340
|
publishableKey,
|
|
14319
14341
|
enabled: open && showPayWithExchange
|
|
@@ -14623,7 +14645,7 @@ function DepositModal({
|
|
|
14623
14645
|
featuredWallets: projectConfig?.connect_wallet?.wallets
|
|
14624
14646
|
}
|
|
14625
14647
|
),
|
|
14626
|
-
/* @__PURE__ */ jsx55(
|
|
14648
|
+
showFiatOnramp && /* @__PURE__ */ jsx55(
|
|
14627
14649
|
DepositWithCardButton,
|
|
14628
14650
|
{
|
|
14629
14651
|
onClick: () => setView("card"),
|
|
@@ -17655,6 +17677,7 @@ function WithdrawModal({
|
|
|
17655
17677
|
// src/components/withdrawals/WithdrawTokenSelector.tsx
|
|
17656
17678
|
import { useState as useState37, useMemo as useMemo14 } from "react";
|
|
17657
17679
|
import { Search } from "lucide-react";
|
|
17680
|
+
import Fuse2 from "fuse.js";
|
|
17658
17681
|
import { jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
17659
17682
|
var t11 = i18n.withdrawModal;
|
|
17660
17683
|
function WithdrawTokenSelector({
|
|
@@ -17674,13 +17697,25 @@ function WithdrawTokenSelector({
|
|
|
17674
17697
|
});
|
|
17675
17698
|
return options;
|
|
17676
17699
|
}, [tokens]);
|
|
17700
|
+
const fuse = useMemo14(
|
|
17701
|
+
() => new Fuse2(allOptions, {
|
|
17702
|
+
keys: [
|
|
17703
|
+
{ name: "token.symbol", weight: 2 },
|
|
17704
|
+
{ name: "token.name", weight: 1 },
|
|
17705
|
+
{ name: "chain.chain_name", weight: 0.5 }
|
|
17706
|
+
],
|
|
17707
|
+
threshold: 0.2,
|
|
17708
|
+
ignoreLocation: true,
|
|
17709
|
+
minMatchCharLength: 2
|
|
17710
|
+
}),
|
|
17711
|
+
[allOptions]
|
|
17712
|
+
);
|
|
17677
17713
|
const filteredOptions = useMemo14(() => {
|
|
17678
17714
|
if (!searchQuery.trim()) return allOptions;
|
|
17679
|
-
const query = searchQuery.
|
|
17680
|
-
|
|
17681
|
-
|
|
17682
|
-
|
|
17683
|
-
}, [allOptions, searchQuery]);
|
|
17715
|
+
const query = searchQuery.trim();
|
|
17716
|
+
const results = fuse.search(query);
|
|
17717
|
+
return results.map((r) => r.item);
|
|
17718
|
+
}, [fuse, allOptions, searchQuery]);
|
|
17684
17719
|
return /* @__PURE__ */ jsxs56(
|
|
17685
17720
|
"div",
|
|
17686
17721
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/ui-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.59",
|
|
4
4
|
"description": "Unifold UI React - Deposit and onramp components for React applications",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"peerDependencies": {
|
|
22
|
+
"@solana/web3.js": "^1.87.0",
|
|
22
23
|
"react": "^18.2.0 || ^19.0.0",
|
|
23
|
-
"react-dom": "^18.2.0 || ^19.0.0"
|
|
24
|
-
"@solana/web3.js": "^1.87.0"
|
|
24
|
+
"react-dom": "^18.2.0 || ^19.0.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@radix-ui/react-dialog": "^1.0.5",
|
|
@@ -31,10 +31,11 @@
|
|
|
31
31
|
"@tanstack/react-query": "^5.90.11",
|
|
32
32
|
"class-variance-authority": "^0.7.0",
|
|
33
33
|
"clsx": "^2.0.0",
|
|
34
|
+
"fuse.js": "^7.4.0",
|
|
34
35
|
"lucide-react": "^0.454.0",
|
|
35
36
|
"qr-code-styling": "^1.6.0-rc.1",
|
|
36
37
|
"tailwind-merge": "^2.0.0",
|
|
37
|
-
"@unifold/core": "0.1.
|
|
38
|
+
"@unifold/core": "0.1.59"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@solana/web3.js": "^1.87.0",
|