@unifold/ui-web 0.1.68 → 0.1.69
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 +486 -180
- package/dist/index.mjs +486 -180
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -37103,6 +37103,7 @@ var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
|
|
|
37103
37103
|
var React211 = __toESM(require_react(), 1);
|
|
37104
37104
|
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
|
|
37105
37105
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
37106
|
+
var React522 = __toESM(require_react(), 1);
|
|
37106
37107
|
var import_react7 = __toESM(require_react(), 1);
|
|
37107
37108
|
var import_react8 = __toESM(require_react(), 1);
|
|
37108
37109
|
var import_react9 = __toESM(require_react(), 1);
|
|
@@ -37121,7 +37122,7 @@ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
|
|
|
37121
37122
|
var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
|
|
37122
37123
|
var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
|
|
37123
37124
|
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
|
|
37124
|
-
var
|
|
37125
|
+
var React622 = __toESM(require_react(), 1);
|
|
37125
37126
|
var import_react15 = __toESM(require_react(), 1);
|
|
37126
37127
|
var import_react16 = __toESM(require_react(), 1);
|
|
37127
37128
|
var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -37135,55 +37136,55 @@ var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
|
|
|
37135
37136
|
var import_react21 = __toESM(require_react(), 1);
|
|
37136
37137
|
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
|
|
37137
37138
|
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
|
|
37138
|
-
var React622 = __toESM(require_react(), 1);
|
|
37139
|
-
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
37140
37139
|
var React72 = __toESM(require_react(), 1);
|
|
37141
|
-
var
|
|
37140
|
+
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
37142
37141
|
var React82 = __toESM(require_react(), 1);
|
|
37142
|
+
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
|
|
37143
|
+
var React92 = __toESM(require_react(), 1);
|
|
37143
37144
|
var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
|
|
37145
|
+
var React112 = __toESM(require_react(), 1);
|
|
37144
37146
|
var React102 = __toESM(require_react(), 1);
|
|
37145
|
-
var React92 = __toESM(require_react(), 1);
|
|
37146
37147
|
var React25 = __toESM(require_react(), 1);
|
|
37147
37148
|
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
|
|
37148
37149
|
var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
|
|
37149
37150
|
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
|
|
37150
|
-
var React112 = __toESM(require_react(), 1);
|
|
37151
|
-
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
|
|
37152
37151
|
var React122 = __toESM(require_react(), 1);
|
|
37153
|
-
var
|
|
37152
|
+
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
|
|
37154
37153
|
var React132 = __toESM(require_react(), 1);
|
|
37155
|
-
var
|
|
37154
|
+
var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
|
|
37156
37155
|
var React142 = __toESM(require_react(), 1);
|
|
37157
|
-
var
|
|
37158
|
-
var React282 = __toESM(require_react(), 1);
|
|
37156
|
+
var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
|
|
37159
37157
|
var React152 = __toESM(require_react(), 1);
|
|
37158
|
+
var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
|
|
37159
|
+
var React292 = __toESM(require_react(), 1);
|
|
37160
37160
|
var React162 = __toESM(require_react(), 1);
|
|
37161
|
-
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
|
|
37162
37161
|
var React172 = __toESM(require_react(), 1);
|
|
37163
|
-
var
|
|
37162
|
+
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
|
|
37164
37163
|
var React182 = __toESM(require_react(), 1);
|
|
37165
|
-
var
|
|
37164
|
+
var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
|
|
37166
37165
|
var React192 = __toESM(require_react(), 1);
|
|
37167
|
-
var
|
|
37166
|
+
var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
|
|
37168
37167
|
var React202 = __toESM(require_react(), 1);
|
|
37169
|
-
var
|
|
37168
|
+
var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
|
|
37170
37169
|
var React212 = __toESM(require_react(), 1);
|
|
37171
|
-
var
|
|
37170
|
+
var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
|
|
37172
37171
|
var React2222 = __toESM(require_react(), 1);
|
|
37173
|
-
var
|
|
37172
|
+
var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
|
|
37174
37173
|
var React232 = __toESM(require_react(), 1);
|
|
37175
|
-
var
|
|
37174
|
+
var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
|
|
37176
37175
|
var React242 = __toESM(require_react(), 1);
|
|
37177
|
-
var
|
|
37176
|
+
var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
|
|
37178
37177
|
var React252 = __toESM(require_react(), 1);
|
|
37179
|
-
var
|
|
37178
|
+
var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
|
|
37180
37179
|
var React262 = __toESM(require_react(), 1);
|
|
37181
|
-
var
|
|
37180
|
+
var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
|
|
37182
37181
|
var React272 = __toESM(require_react(), 1);
|
|
37182
|
+
var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
|
|
37183
|
+
var React282 = __toESM(require_react(), 1);
|
|
37183
37184
|
var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
|
|
37184
37185
|
var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
|
|
37185
37186
|
var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
|
|
37186
|
-
var
|
|
37187
|
+
var React302 = __toESM(require_react(), 1);
|
|
37187
37188
|
var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
|
|
37188
37189
|
var import_react22 = __toESM(require_react(), 1);
|
|
37189
37190
|
var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -37193,7 +37194,7 @@ var import_react24 = __toESM(require_react(), 1);
|
|
|
37193
37194
|
var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
|
|
37194
37195
|
var import_react25 = __toESM(require_react(), 1);
|
|
37195
37196
|
var import_react26 = __toESM(require_react(), 1);
|
|
37196
|
-
var
|
|
37197
|
+
var React322 = __toESM(require_react(), 1);
|
|
37197
37198
|
var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
|
|
37198
37199
|
var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
|
|
37199
37200
|
var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -37203,7 +37204,7 @@ var import_react28 = __toESM(require_react(), 1);
|
|
|
37203
37204
|
var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
|
|
37204
37205
|
var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
|
|
37205
37206
|
var import_react29 = __toESM(require_react(), 1);
|
|
37206
|
-
var
|
|
37207
|
+
var React332 = __toESM(require_react(), 1);
|
|
37207
37208
|
var React31 = __toESM(require_react(), 1);
|
|
37208
37209
|
var React29 = __toESM(require_react(), 1);
|
|
37209
37210
|
var React26 = __toESM(require_react(), 1);
|
|
@@ -37220,7 +37221,7 @@ var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
|
|
|
37220
37221
|
var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
|
|
37221
37222
|
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
|
|
37222
37223
|
var import_react31 = __toESM(require_react(), 1);
|
|
37223
|
-
var
|
|
37224
|
+
var React342 = __toESM(require_react(), 1);
|
|
37224
37225
|
var React35 = __toESM(require_react(), 1);
|
|
37225
37226
|
var ReactDOM4 = __toESM(require_react_dom(), 1);
|
|
37226
37227
|
var import_react32 = __toESM(require_react(), 1);
|
|
@@ -37233,7 +37234,7 @@ var React34 = __toESM(require_react(), 1);
|
|
|
37233
37234
|
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
|
|
37234
37235
|
var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
|
|
37235
37236
|
var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
|
|
37236
|
-
var
|
|
37237
|
+
var React352 = __toESM(require_react(), 1);
|
|
37237
37238
|
var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
|
|
37238
37239
|
var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
|
|
37239
37240
|
var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -43445,6 +43446,27 @@ async function getFiatCurrencies(publishableKey) {
|
|
|
43445
43446
|
}
|
|
43446
43447
|
return response.json();
|
|
43447
43448
|
}
|
|
43449
|
+
async function getFiatExchangeRates(options2 = {}, publishableKey) {
|
|
43450
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43451
|
+
validatePublishableKey(pk);
|
|
43452
|
+
const params = new URLSearchParams();
|
|
43453
|
+
if (options2.currencies && options2.currencies.length > 0) {
|
|
43454
|
+
params.set("currencies", options2.currencies.join(","));
|
|
43455
|
+
}
|
|
43456
|
+
const queryString = params.toString();
|
|
43457
|
+
const url = `${API_BASE_URL}/v1/public/exchange_rates/fiat_currencies${queryString ? `?${queryString}` : ""}`;
|
|
43458
|
+
const response = await fetch(url, {
|
|
43459
|
+
method: "GET",
|
|
43460
|
+
headers: {
|
|
43461
|
+
accept: "application/json",
|
|
43462
|
+
"x-publishable-key": pk
|
|
43463
|
+
}
|
|
43464
|
+
});
|
|
43465
|
+
if (!response.ok) {
|
|
43466
|
+
throw new Error(`Failed to fetch fiat exchange rates: ${response.statusText}`);
|
|
43467
|
+
}
|
|
43468
|
+
return response.json();
|
|
43469
|
+
}
|
|
43448
43470
|
async function getOnrampQuotes(request, publishableKey) {
|
|
43449
43471
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43450
43472
|
validatePublishableKey(pk);
|
|
@@ -44109,6 +44131,7 @@ async function stripeGetDefaultToken(params, publishableKey) {
|
|
|
44109
44131
|
chain_type: params.chainType
|
|
44110
44132
|
});
|
|
44111
44133
|
if (params.countryCode) query.append("country_code", params.countryCode);
|
|
44134
|
+
if (params.subdivisionCode) query.append("subdivision_code", params.subdivisionCode);
|
|
44112
44135
|
const response = await fetch(
|
|
44113
44136
|
`${API_BASE_URL}${HEADLESS_STRIPE_BASE}/default_token?${query.toString()}`,
|
|
44114
44137
|
{
|
|
@@ -53162,13 +53185,25 @@ function BuyWithCard({
|
|
|
53162
53185
|
wallets: externalWallets,
|
|
53163
53186
|
assetCdnUrl,
|
|
53164
53187
|
hideDepositFlowInfo = false,
|
|
53165
|
-
hideDisplayDescription = false
|
|
53188
|
+
hideDisplayDescription = false,
|
|
53189
|
+
prefilledAmountUsd
|
|
53166
53190
|
}) {
|
|
53167
53191
|
const { colors: colors2, fonts, components } = useTheme();
|
|
53168
|
-
const
|
|
53192
|
+
const cleanedPrefilledAmountUsd = React522.useMemo(() => {
|
|
53193
|
+
if (!prefilledAmountUsd) return "";
|
|
53194
|
+
return prefilledAmountUsd.replace(/[^0-9.]/g, "");
|
|
53195
|
+
}, [prefilledAmountUsd]);
|
|
53196
|
+
const parsedPrefilledAmountUsd = React522.useMemo(() => {
|
|
53197
|
+
const parsed = parseFloat(cleanedPrefilledAmountUsd);
|
|
53198
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
53199
|
+
}, [cleanedPrefilledAmountUsd]);
|
|
53200
|
+
const shouldAutoConvertPrefilledRef = (0, import_react7.useRef)(!!cleanedPrefilledAmountUsd);
|
|
53201
|
+
const [amount, setAmount] = (0, import_react7.useState)(() => cleanedPrefilledAmountUsd);
|
|
53169
53202
|
const [currency, setCurrency] = (0, import_react7.useState)("usd");
|
|
53170
53203
|
const [hasManualCurrencySelection, setHasManualCurrencySelection] = (0, import_react7.useState)(false);
|
|
53171
|
-
const [hasManualAmountEntry, setHasManualAmountEntry] = (0, import_react7.useState)(
|
|
53204
|
+
const [hasManualAmountEntry, setHasManualAmountEntry] = (0, import_react7.useState)(
|
|
53205
|
+
() => !!cleanedPrefilledAmountUsd
|
|
53206
|
+
);
|
|
53172
53207
|
const [showCurrencyModal, setShowCurrencyModal] = (0, import_react7.useState)(false);
|
|
53173
53208
|
const [quotes, setQuotes] = (0, import_react7.useState)([]);
|
|
53174
53209
|
const [quotesLoading, setQuotesLoading] = (0, import_react7.useState)(false);
|
|
@@ -53225,6 +53260,71 @@ function BuyWithCard({
|
|
|
53225
53260
|
const [preferredCurrencyCodes, setPreferredCurrencyCodes] = (0, import_react7.useState)([]);
|
|
53226
53261
|
const [currenciesLoading, setCurrenciesLoading] = (0, import_react7.useState)(true);
|
|
53227
53262
|
const [destinationToken, setDestinationToken] = (0, import_react7.useState)(null);
|
|
53263
|
+
(0, import_react7.useEffect)(() => {
|
|
53264
|
+
const hasPrefilledAmount = !!cleanedPrefilledAmountUsd;
|
|
53265
|
+
shouldAutoConvertPrefilledRef.current = hasPrefilledAmount;
|
|
53266
|
+
if (!hasPrefilledAmount) return;
|
|
53267
|
+
setAmount(cleanedPrefilledAmountUsd);
|
|
53268
|
+
setHasManualAmountEntry(true);
|
|
53269
|
+
}, [cleanedPrefilledAmountUsd]);
|
|
53270
|
+
const { data: fiatExchangeRatesResponse, isLoading: isFiatExchangeRatesLoading } = useQuery({
|
|
53271
|
+
queryKey: ["fiat-exchange-rates", publishableKey],
|
|
53272
|
+
staleTime: 3e4,
|
|
53273
|
+
refetchInterval: 3e4,
|
|
53274
|
+
queryFn: async () => {
|
|
53275
|
+
try {
|
|
53276
|
+
return await getFiatExchangeRates({}, publishableKey);
|
|
53277
|
+
} catch (error) {
|
|
53278
|
+
console.error("Error fetching fiat exchange rates:", error);
|
|
53279
|
+
return { base_currency: "usd", rates: {} };
|
|
53280
|
+
}
|
|
53281
|
+
}
|
|
53282
|
+
});
|
|
53283
|
+
const fiatExchangeRates = fiatExchangeRatesResponse?.rates ?? {};
|
|
53284
|
+
const convertAmountBetweenCurrencies = React522.useCallback(
|
|
53285
|
+
(rawAmount, fromCurrencyCode, toCurrencyCode) => {
|
|
53286
|
+
const parsedAmount = parseFloat(rawAmount);
|
|
53287
|
+
if (!Number.isFinite(parsedAmount) || parsedAmount <= 0) return null;
|
|
53288
|
+
const fromCode = fromCurrencyCode.toLowerCase();
|
|
53289
|
+
const toCode = toCurrencyCode.toLowerCase();
|
|
53290
|
+
const fromRate = fromCode === "usd" ? 1 : fiatExchangeRates[fromCode];
|
|
53291
|
+
const toRate = toCode === "usd" ? 1 : fiatExchangeRates[toCode];
|
|
53292
|
+
if (!Number.isFinite(fromRate) || fromRate <= 0) return null;
|
|
53293
|
+
if (!Number.isFinite(toRate) || toRate <= 0) return null;
|
|
53294
|
+
const usdAmount = parsedAmount / fromRate;
|
|
53295
|
+
return parseFloat((usdAmount * toRate).toFixed(2)).toString();
|
|
53296
|
+
},
|
|
53297
|
+
[fiatExchangeRates]
|
|
53298
|
+
);
|
|
53299
|
+
const getConvertedPrefilledAmount = React522.useCallback(
|
|
53300
|
+
(targetCurrencyCode) => {
|
|
53301
|
+
if (!parsedPrefilledAmountUsd) return null;
|
|
53302
|
+
const normalizedTargetCurrency = targetCurrencyCode.toLowerCase();
|
|
53303
|
+
const rate = normalizedTargetCurrency === "usd" ? 1 : fiatExchangeRates[normalizedTargetCurrency];
|
|
53304
|
+
if (!Number.isFinite(rate) || rate <= 0) return null;
|
|
53305
|
+
return parseFloat((parsedPrefilledAmountUsd * rate).toFixed(2)).toString();
|
|
53306
|
+
},
|
|
53307
|
+
[parsedPrefilledAmountUsd, fiatExchangeRates]
|
|
53308
|
+
);
|
|
53309
|
+
(0, import_react7.useEffect)(() => {
|
|
53310
|
+
if (!cleanedPrefilledAmountUsd || !shouldAutoConvertPrefilledRef.current) return;
|
|
53311
|
+
const convertedAmount = getConvertedPrefilledAmount(currency);
|
|
53312
|
+
if (!convertedAmount) {
|
|
53313
|
+
if (isFiatExchangeRatesLoading) return;
|
|
53314
|
+
const targetCurrency = currency.toLowerCase();
|
|
53315
|
+
if (targetCurrency !== "usd") {
|
|
53316
|
+
setCurrency("usd");
|
|
53317
|
+
}
|
|
53318
|
+
return;
|
|
53319
|
+
}
|
|
53320
|
+
setAmount(convertedAmount);
|
|
53321
|
+
setHasManualAmountEntry(true);
|
|
53322
|
+
}, [
|
|
53323
|
+
cleanedPrefilledAmountUsd,
|
|
53324
|
+
currency,
|
|
53325
|
+
getConvertedPrefilledAmount,
|
|
53326
|
+
isFiatExchangeRatesLoading
|
|
53327
|
+
]);
|
|
53228
53328
|
const depositWalletId = defaultToken ? getWalletByChainType(wallets, defaultToken.destination_token_metadata.chain_type)?.id : void 0;
|
|
53229
53329
|
const { executions, isPolling, showWaitingUi } = useDepositPolling({
|
|
53230
53330
|
userId,
|
|
@@ -53255,6 +53355,7 @@ function BuyWithCard({
|
|
|
53255
53355
|
}, [publishableKey]);
|
|
53256
53356
|
(0, import_react7.useEffect)(() => {
|
|
53257
53357
|
if (hasManualCurrencySelection) return;
|
|
53358
|
+
if (hasManualAmountEntry && !shouldAutoConvertPrefilledRef.current) return;
|
|
53258
53359
|
if (fiatCurrencies.length === 0 || !userIpInfo?.alpha2) return;
|
|
53259
53360
|
const userCountryCode = userIpInfo.alpha2;
|
|
53260
53361
|
const matchingCurrency = fiatCurrencies.find((c) => c.country_codes.includes(userCountryCode));
|
|
@@ -53273,7 +53374,15 @@ function BuyWithCard({
|
|
|
53273
53374
|
const prevCurrencyRef = (0, import_react7.useRef)(null);
|
|
53274
53375
|
(0, import_react7.useEffect)(() => {
|
|
53275
53376
|
if (fiatCurrencies.length === 0) return;
|
|
53377
|
+
if (shouldAutoConvertPrefilledRef.current) {
|
|
53378
|
+
prevCurrencyRef.current = currency;
|
|
53379
|
+
return;
|
|
53380
|
+
}
|
|
53276
53381
|
if (prevCurrencyRef.current !== null && prevCurrencyRef.current !== currency) {
|
|
53382
|
+
if (hasManualAmountEntry) {
|
|
53383
|
+
prevCurrencyRef.current = currency;
|
|
53384
|
+
return;
|
|
53385
|
+
}
|
|
53277
53386
|
const currentCurrency = fiatCurrencies.find(
|
|
53278
53387
|
(c) => c.currency_code.toLowerCase() === currency.toLowerCase()
|
|
53279
53388
|
);
|
|
@@ -53282,7 +53391,7 @@ function BuyWithCard({
|
|
|
53282
53391
|
}
|
|
53283
53392
|
}
|
|
53284
53393
|
prevCurrencyRef.current = currency;
|
|
53285
|
-
}, [currency]);
|
|
53394
|
+
}, [currency, fiatCurrencies, hasManualAmountEntry]);
|
|
53286
53395
|
(0, import_react7.useEffect)(() => {
|
|
53287
53396
|
async function fetchDestinationToken() {
|
|
53288
53397
|
try {
|
|
@@ -53459,6 +53568,7 @@ function BuyWithCard({
|
|
|
53459
53568
|
return () => clearInterval(timer);
|
|
53460
53569
|
}, [quotes.length, amount]);
|
|
53461
53570
|
const handleAmountChange = (value) => {
|
|
53571
|
+
shouldAutoConvertPrefilledRef.current = false;
|
|
53462
53572
|
if (value === "") {
|
|
53463
53573
|
setAmount(value);
|
|
53464
53574
|
setHasManualAmountEntry(true);
|
|
@@ -53472,6 +53582,7 @@ function BuyWithCard({
|
|
|
53472
53582
|
}
|
|
53473
53583
|
};
|
|
53474
53584
|
const handleQuickAmount = (quickAmount) => {
|
|
53585
|
+
shouldAutoConvertPrefilledRef.current = false;
|
|
53475
53586
|
setAmount(quickAmount.toString());
|
|
53476
53587
|
setHasManualAmountEntry(true);
|
|
53477
53588
|
};
|
|
@@ -54075,8 +54186,43 @@ function BuyWithCard({
|
|
|
54075
54186
|
preferredCurrencyCodes,
|
|
54076
54187
|
selectedCurrency: currency,
|
|
54077
54188
|
onSelectCurrency: (currencyCode) => {
|
|
54078
|
-
|
|
54189
|
+
const nextCurrency = currencyCode.toLowerCase();
|
|
54190
|
+
if (nextCurrency === currency.toLowerCase()) {
|
|
54191
|
+
setHasManualCurrencySelection(true);
|
|
54192
|
+
return;
|
|
54193
|
+
}
|
|
54194
|
+
const currentCurrency = currency;
|
|
54079
54195
|
setHasManualCurrencySelection(true);
|
|
54196
|
+
if (shouldAutoConvertPrefilledRef.current) {
|
|
54197
|
+
const convertedAmount = getConvertedPrefilledAmount(nextCurrency);
|
|
54198
|
+
if (convertedAmount) {
|
|
54199
|
+
setCurrency(nextCurrency);
|
|
54200
|
+
setAmount(convertedAmount);
|
|
54201
|
+
setHasManualAmountEntry(true);
|
|
54202
|
+
} else {
|
|
54203
|
+
if (isFiatExchangeRatesLoading) return;
|
|
54204
|
+
const fallbackUsdAmount = getConvertedPrefilledAmount("usd");
|
|
54205
|
+
setCurrency("usd");
|
|
54206
|
+
if (fallbackUsdAmount) {
|
|
54207
|
+
setAmount(fallbackUsdAmount);
|
|
54208
|
+
setHasManualAmountEntry(true);
|
|
54209
|
+
}
|
|
54210
|
+
}
|
|
54211
|
+
return;
|
|
54212
|
+
}
|
|
54213
|
+
if (hasManualAmountEntry && amount) {
|
|
54214
|
+
const convertedAmount = convertAmountBetweenCurrencies(
|
|
54215
|
+
amount,
|
|
54216
|
+
currentCurrency,
|
|
54217
|
+
nextCurrency
|
|
54218
|
+
);
|
|
54219
|
+
if (convertedAmount) {
|
|
54220
|
+
setCurrency(nextCurrency);
|
|
54221
|
+
setAmount(convertedAmount);
|
|
54222
|
+
}
|
|
54223
|
+
return;
|
|
54224
|
+
}
|
|
54225
|
+
setCurrency(nextCurrency);
|
|
54080
54226
|
},
|
|
54081
54227
|
themeClass
|
|
54082
54228
|
}
|
|
@@ -54321,7 +54467,7 @@ function parseCoinbasePostMessage(raw) {
|
|
|
54321
54467
|
} : void 0
|
|
54322
54468
|
};
|
|
54323
54469
|
}
|
|
54324
|
-
var BuyWithApplePay =
|
|
54470
|
+
var BuyWithApplePay = React622.forwardRef(
|
|
54325
54471
|
function BuyWithApplePay2({
|
|
54326
54472
|
userId,
|
|
54327
54473
|
publishableKey,
|
|
@@ -54480,7 +54626,7 @@ var BuyWithApplePay = React522.forwardRef(
|
|
|
54480
54626
|
popupRef.current = null;
|
|
54481
54627
|
};
|
|
54482
54628
|
}, []);
|
|
54483
|
-
|
|
54629
|
+
React622.useImperativeHandle(
|
|
54484
54630
|
ref,
|
|
54485
54631
|
() => ({
|
|
54486
54632
|
requestBack: () => {
|
|
@@ -55790,7 +55936,7 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
55790
55936
|
children: [
|
|
55791
55937
|
"By continuing, you agree to Coinbase's",
|
|
55792
55938
|
" ",
|
|
55793
|
-
agreements.map((a, idx, arr) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
55939
|
+
agreements.map((a, idx, arr) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(React622.Fragment, { children: [
|
|
55794
55940
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
55795
55941
|
"a",
|
|
55796
55942
|
{
|
|
@@ -56219,6 +56365,7 @@ var POLL_INTERVAL_MS2 = 5e3;
|
|
|
56219
56365
|
var FALLBACK_MIN_USD = 5;
|
|
56220
56366
|
var SUGGESTED_AMOUNTS = [25, 50, 100];
|
|
56221
56367
|
var t3 = i18n2.depositModal.cashApp;
|
|
56368
|
+
var sanitizePrefilledUsd = (value) => value?.replace(/[^0-9.]/g, "") ?? "";
|
|
56222
56369
|
function PayWithCashApp({
|
|
56223
56370
|
userId,
|
|
56224
56371
|
publishableKey,
|
|
@@ -56233,6 +56380,7 @@ function PayWithCashApp({
|
|
|
56233
56380
|
onEvent,
|
|
56234
56381
|
onDepositSuccess,
|
|
56235
56382
|
onDepositError,
|
|
56383
|
+
prefilledAmountUsd,
|
|
56236
56384
|
wallets = []
|
|
56237
56385
|
}) {
|
|
56238
56386
|
const { colors: colors2, fonts, components } = useTheme();
|
|
@@ -56248,7 +56396,7 @@ function PayWithCashApp({
|
|
|
56248
56396
|
const { data: limits, isLoading: limitsLoading } = useCashAppLimits({ publishableKey });
|
|
56249
56397
|
const minUsd = limits?.minimum_amount ?? FALLBACK_MIN_USD;
|
|
56250
56398
|
const maxUsd = limits?.maximum_amount ?? null;
|
|
56251
|
-
const [amount, setAmount] = (0, import_react18.useState)(
|
|
56399
|
+
const [amount, setAmount] = (0, import_react18.useState)(() => sanitizePrefilledUsd(prefilledAmountUsd));
|
|
56252
56400
|
const [loading, setLoading] = (0, import_react18.useState)(false);
|
|
56253
56401
|
const [session, setSession] = (0, import_react18.useState)(null);
|
|
56254
56402
|
const [status, setStatus] = (0, import_react18.useState)("pending");
|
|
@@ -56371,6 +56519,13 @@ function PayWithCashApp({
|
|
|
56371
56519
|
return () => clearInterval(interval);
|
|
56372
56520
|
}, [session, view, status, publishableKey, onDepositSuccess, onDepositError]);
|
|
56373
56521
|
const [softExpired, setSoftExpired] = (0, import_react18.useState)(false);
|
|
56522
|
+
(0, import_react18.useEffect)(() => {
|
|
56523
|
+
if (!prefilledAmountUsd) return;
|
|
56524
|
+
const cleaned = sanitizePrefilledUsd(prefilledAmountUsd);
|
|
56525
|
+
if (!cleaned) return;
|
|
56526
|
+
setAmount(cleaned);
|
|
56527
|
+
onAmountChange?.(cleaned);
|
|
56528
|
+
}, [prefilledAmountUsd, onAmountChange]);
|
|
56374
56529
|
(0, import_react18.useEffect)(() => {
|
|
56375
56530
|
if (!session?.expires_at || view !== "payment") return;
|
|
56376
56531
|
const expiresMs = new Date(session.expires_at).getTime();
|
|
@@ -56763,7 +56918,8 @@ function BankTransfer({
|
|
|
56763
56918
|
assetCdnUrl,
|
|
56764
56919
|
onDepositSuccess,
|
|
56765
56920
|
onEvent,
|
|
56766
|
-
onDepositError
|
|
56921
|
+
onDepositError,
|
|
56922
|
+
prefilledAmountUsd
|
|
56767
56923
|
}) {
|
|
56768
56924
|
const { colors: colors2, fonts, components } = useTheme();
|
|
56769
56925
|
const [internalView, setInternalView] = (0, import_react21.useState)("providers");
|
|
@@ -56773,6 +56929,10 @@ function BankTransfer({
|
|
|
56773
56929
|
const [requestBase, setRequestBase] = (0, import_react21.useState)(null);
|
|
56774
56930
|
const [activeRequest, setActiveRequest] = (0, import_react21.useState)(null);
|
|
56775
56931
|
const [amount, setAmount] = (0, import_react21.useState)("");
|
|
56932
|
+
const [fiatExchangeRates, setFiatExchangeRates] = (0, import_react21.useState)({
|
|
56933
|
+
usd: 1
|
|
56934
|
+
});
|
|
56935
|
+
const providerSelectionRequestIdRef = (0, import_react21.useRef)(0);
|
|
56776
56936
|
const currentView = externalView ?? internalView;
|
|
56777
56937
|
const setView = (v) => {
|
|
56778
56938
|
setInternalView(v);
|
|
@@ -56822,7 +56982,38 @@ function BankTransfer({
|
|
|
56822
56982
|
() => destinationTokenSymbol?.toUpperCase() ?? defaultToken?.destination_token_metadata?.symbol?.toUpperCase() ?? defaultToken?.destination_currency?.toUpperCase() ?? "USDC",
|
|
56823
56983
|
[destinationTokenSymbol, defaultToken]
|
|
56824
56984
|
);
|
|
56825
|
-
const
|
|
56985
|
+
const resolvePrefilledSourceAmount = (0, import_react21.useCallback)(
|
|
56986
|
+
async (sourceCurrencyCode) => {
|
|
56987
|
+
const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
56988
|
+
if (!cleanedPrefilled) return "";
|
|
56989
|
+
const prefilledUsd = parseFloat(cleanedPrefilled);
|
|
56990
|
+
if (!Number.isFinite(prefilledUsd) || prefilledUsd <= 0) return "";
|
|
56991
|
+
const sourceCurrency2 = sourceCurrencyCode.toLowerCase();
|
|
56992
|
+
let rate = sourceCurrency2 === "usd" ? 1 : fiatExchangeRates[sourceCurrency2];
|
|
56993
|
+
if ((!rate || rate <= 0) && sourceCurrency2 !== "usd") {
|
|
56994
|
+
try {
|
|
56995
|
+
const response = await getFiatExchangeRates({}, publishableKey);
|
|
56996
|
+
if (response?.rates) {
|
|
56997
|
+
setFiatExchangeRates((prev) => ({
|
|
56998
|
+
...prev,
|
|
56999
|
+
...response.rates,
|
|
57000
|
+
usd: 1
|
|
57001
|
+
}));
|
|
57002
|
+
}
|
|
57003
|
+
const fetchedRate = response.rates?.[sourceCurrency2];
|
|
57004
|
+
if (Number.isFinite(fetchedRate) && fetchedRate > 0) {
|
|
57005
|
+
rate = fetchedRate;
|
|
57006
|
+
}
|
|
57007
|
+
} catch (error) {
|
|
57008
|
+
console.error("Error fetching fiat exchange rates for bank transfer:", error);
|
|
57009
|
+
}
|
|
57010
|
+
}
|
|
57011
|
+
if (!rate || rate <= 0) return sourceCurrency2 === "usd" ? cleanedPrefilled : "";
|
|
57012
|
+
return parseFloat((prefilledUsd * rate).toFixed(2)).toString();
|
|
57013
|
+
},
|
|
57014
|
+
[fiatExchangeRates, prefilledAmountUsd, publishableKey]
|
|
57015
|
+
);
|
|
57016
|
+
const handleProviderClick = async (provider) => {
|
|
56826
57017
|
if (!provider.enabled) return;
|
|
56827
57018
|
setSessionError(null);
|
|
56828
57019
|
if (!defaultToken) {
|
|
@@ -56841,6 +57032,7 @@ function BankTransfer({
|
|
|
56841
57032
|
});
|
|
56842
57033
|
return;
|
|
56843
57034
|
}
|
|
57035
|
+
const requestId = ++providerSelectionRequestIdRef.current;
|
|
56844
57036
|
setRequestBase({
|
|
56845
57037
|
service_provider: provider.service_provider,
|
|
56846
57038
|
country_code: (userIpInfo?.alpha2 || "DE").toUpperCase(),
|
|
@@ -56854,7 +57046,10 @@ function BankTransfer({
|
|
|
56854
57046
|
payment_method: provider.payment_methods[0]
|
|
56855
57047
|
});
|
|
56856
57048
|
setActiveProvider(provider);
|
|
56857
|
-
|
|
57049
|
+
const convertedPrefilled = await resolvePrefilledSourceAmount(provider.source_currency);
|
|
57050
|
+
if (requestId !== providerSelectionRequestIdRef.current) return;
|
|
57051
|
+
const hasPrefilledAmount = !!prefilledAmountUsd?.replace(/[^0-9.]/g, "");
|
|
57052
|
+
setAmount(hasPrefilledAmount ? convertedPrefilled : "100");
|
|
56858
57053
|
setView("amount");
|
|
56859
57054
|
};
|
|
56860
57055
|
const handleAmountChange = (value) => {
|
|
@@ -56952,7 +57147,7 @@ function BankTransfer({
|
|
|
56952
57147
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
56953
57148
|
"button",
|
|
56954
57149
|
{
|
|
56955
|
-
onClick: () => handleProviderClick(provider),
|
|
57150
|
+
onClick: () => void handleProviderClick(provider),
|
|
56956
57151
|
onMouseEnter: () => !disabled && setHoveredId(provider.service_provider),
|
|
56957
57152
|
onMouseLeave: () => setHoveredId(null),
|
|
56958
57153
|
disabled,
|
|
@@ -57521,9 +57716,9 @@ function TransferCryptoButton({
|
|
|
57521
57716
|
featuredTokens
|
|
57522
57717
|
}) {
|
|
57523
57718
|
const { colors: colors2, fonts, components } = useTheme();
|
|
57524
|
-
const [isHovered, setIsHovered] =
|
|
57525
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
57526
|
-
|
|
57719
|
+
const [isHovered, setIsHovered] = React72.useState(false);
|
|
57720
|
+
const [isTouchDevice, setIsTouchDevice] = React72.useState(false);
|
|
57721
|
+
React72.useEffect(() => {
|
|
57527
57722
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
57528
57723
|
}, []);
|
|
57529
57724
|
const sortedTokens = featuredTokens ? [...featuredTokens].sort((a, b) => a.position - b.position) : [];
|
|
@@ -57603,9 +57798,9 @@ function DepositWithCardButton({
|
|
|
57603
57798
|
paymentNetworks
|
|
57604
57799
|
}) {
|
|
57605
57800
|
const { colors: colors2, fonts, components } = useTheme();
|
|
57606
|
-
const [isHovered, setIsHovered] =
|
|
57607
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
57608
|
-
|
|
57801
|
+
const [isHovered, setIsHovered] = React82.useState(false);
|
|
57802
|
+
const [isTouchDevice, setIsTouchDevice] = React82.useState(false);
|
|
57803
|
+
React82.useEffect(() => {
|
|
57609
57804
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
57610
57805
|
}, []);
|
|
57611
57806
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
@@ -57684,9 +57879,9 @@ function PayWithExchangeButton({
|
|
|
57684
57879
|
loading = false
|
|
57685
57880
|
}) {
|
|
57686
57881
|
const { colors: colors2, fonts, components } = useTheme();
|
|
57687
|
-
const [isHovered, setIsHovered] =
|
|
57688
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
57689
|
-
|
|
57882
|
+
const [isHovered, setIsHovered] = React92.useState(false);
|
|
57883
|
+
const [isTouchDevice, setIsTouchDevice] = React92.useState(false);
|
|
57884
|
+
React92.useEffect(() => {
|
|
57690
57885
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
57691
57886
|
}, []);
|
|
57692
57887
|
if (loading) {
|
|
@@ -57788,11 +57983,11 @@ var buttonVariants = cva(
|
|
|
57788
57983
|
}
|
|
57789
57984
|
}
|
|
57790
57985
|
);
|
|
57791
|
-
var Button =
|
|
57986
|
+
var Button = React102.forwardRef(
|
|
57792
57987
|
({ className, variant, size: size4, asChild = false, style, ...props }, ref) => {
|
|
57793
57988
|
const Comp = asChild ? Slot2 : "button";
|
|
57794
57989
|
const { components, fonts } = useTheme();
|
|
57795
|
-
const themeStyle =
|
|
57990
|
+
const themeStyle = React102.useMemo(() => {
|
|
57796
57991
|
const baseStyle = { ...style };
|
|
57797
57992
|
if (variant === "default" || !variant) {
|
|
57798
57993
|
baseStyle.backgroundColor = components.button.primaryBackground;
|
|
@@ -57827,9 +58022,9 @@ function ConnectExchangeButton({
|
|
|
57827
58022
|
connectedExchange
|
|
57828
58023
|
}) {
|
|
57829
58024
|
const { colors: colors2, fonts, components } = useTheme();
|
|
57830
|
-
const [isHovered, setIsHovered] =
|
|
57831
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
57832
|
-
|
|
58025
|
+
const [isHovered, setIsHovered] = React112.useState(false);
|
|
58026
|
+
const [isTouchDevice, setIsTouchDevice] = React112.useState(false);
|
|
58027
|
+
React112.useEffect(() => {
|
|
57833
58028
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
57834
58029
|
}, []);
|
|
57835
58030
|
const isConnected = connectedExchange != null;
|
|
@@ -57974,9 +58169,9 @@ function DepositTrackerButton({
|
|
|
57974
58169
|
badge
|
|
57975
58170
|
}) {
|
|
57976
58171
|
const { colors: colors2, fonts, components } = useTheme();
|
|
57977
|
-
const [isHovered, setIsHovered] =
|
|
57978
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
57979
|
-
|
|
58172
|
+
const [isHovered, setIsHovered] = React122.useState(false);
|
|
58173
|
+
const [isTouchDevice, setIsTouchDevice] = React122.useState(false);
|
|
58174
|
+
React122.useEffect(() => {
|
|
57980
58175
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
57981
58176
|
}, []);
|
|
57982
58177
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
@@ -58047,9 +58242,9 @@ function DepositTrackerButton({
|
|
|
58047
58242
|
}
|
|
58048
58243
|
function CashAppButton({ onClick, title, subtitle, iconUrl }) {
|
|
58049
58244
|
const { colors: colors2, fonts, components } = useTheme();
|
|
58050
|
-
const [isHovered, setIsHovered] =
|
|
58051
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
58052
|
-
|
|
58245
|
+
const [isHovered, setIsHovered] = React132.useState(false);
|
|
58246
|
+
const [isTouchDevice, setIsTouchDevice] = React132.useState(false);
|
|
58247
|
+
React132.useEffect(() => {
|
|
58053
58248
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
58054
58249
|
}, []);
|
|
58055
58250
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
@@ -58133,9 +58328,9 @@ function AppleLogo({ className, style }) {
|
|
|
58133
58328
|
}
|
|
58134
58329
|
function ApplePayButton({ onClick, title, subtitle }) {
|
|
58135
58330
|
const { colors: colors2, fonts, components } = useTheme();
|
|
58136
|
-
const [isHovered, setIsHovered] =
|
|
58137
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
58138
|
-
|
|
58331
|
+
const [isHovered, setIsHovered] = React142.useState(false);
|
|
58332
|
+
const [isTouchDevice, setIsTouchDevice] = React142.useState(false);
|
|
58333
|
+
React142.useEffect(() => {
|
|
58139
58334
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
58140
58335
|
}, []);
|
|
58141
58336
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
@@ -58197,9 +58392,9 @@ function BankTransferButton({
|
|
|
58197
58392
|
comingSoon = false
|
|
58198
58393
|
}) {
|
|
58199
58394
|
const { colors: colors2, fonts, components } = useTheme();
|
|
58200
|
-
const [isHovered, setIsHovered] =
|
|
58201
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
58202
|
-
|
|
58395
|
+
const [isHovered, setIsHovered] = React152.useState(false);
|
|
58396
|
+
const [isTouchDevice, setIsTouchDevice] = React152.useState(false);
|
|
58397
|
+
React152.useEffect(() => {
|
|
58203
58398
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
58204
58399
|
}, []);
|
|
58205
58400
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
@@ -58448,18 +58643,18 @@ async function detectConnectedBrowserWallet(chainType) {
|
|
|
58448
58643
|
}
|
|
58449
58644
|
function useDetectedBrowserWallet(opts = {}) {
|
|
58450
58645
|
const { chainType, enabled = true, onDisconnect } = opts;
|
|
58451
|
-
const [wallet, setWallet] =
|
|
58452
|
-
const [isLoading, setIsLoading] =
|
|
58453
|
-
const [eip6963ProviderCount, setEip6963ProviderCount] =
|
|
58454
|
-
const onDisconnectRef =
|
|
58646
|
+
const [wallet, setWallet] = React162.useState(null);
|
|
58647
|
+
const [isLoading, setIsLoading] = React162.useState(enabled);
|
|
58648
|
+
const [eip6963ProviderCount, setEip6963ProviderCount] = React162.useState(0);
|
|
58649
|
+
const onDisconnectRef = React162.useRef(onDisconnect);
|
|
58455
58650
|
onDisconnectRef.current = onDisconnect;
|
|
58456
|
-
|
|
58651
|
+
React162.useEffect(() => {
|
|
58457
58652
|
const store = getEip6963Store();
|
|
58458
58653
|
if (!store) return;
|
|
58459
58654
|
setEip6963ProviderCount(store.getProviders().length);
|
|
58460
58655
|
return store.subscribe((providers) => setEip6963ProviderCount(providers.length));
|
|
58461
58656
|
}, []);
|
|
58462
|
-
|
|
58657
|
+
React162.useEffect(() => {
|
|
58463
58658
|
if (!enabled) {
|
|
58464
58659
|
setWallet(null);
|
|
58465
58660
|
setIsLoading(false);
|
|
@@ -58600,7 +58795,7 @@ async function disconnectInjectedBrowserWallet(wallet) {
|
|
|
58600
58795
|
);
|
|
58601
58796
|
}
|
|
58602
58797
|
function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
58603
|
-
const id =
|
|
58798
|
+
const id = React172.useId();
|
|
58604
58799
|
if (variant === "light" || variant === "dark") {
|
|
58605
58800
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
58606
58801
|
"svg",
|
|
@@ -58721,7 +58916,7 @@ function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
58721
58916
|
);
|
|
58722
58917
|
}
|
|
58723
58918
|
function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
58724
|
-
const id =
|
|
58919
|
+
const id = React182.useId();
|
|
58725
58920
|
if (variant === "light") {
|
|
58726
58921
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
58727
58922
|
"svg",
|
|
@@ -58788,7 +58983,7 @@ function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
58788
58983
|
);
|
|
58789
58984
|
}
|
|
58790
58985
|
function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
58791
|
-
const id =
|
|
58986
|
+
const id = React192.useId();
|
|
58792
58987
|
if (variant === "light") {
|
|
58793
58988
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
58794
58989
|
"svg",
|
|
@@ -58868,7 +59063,7 @@ function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
58868
59063
|
);
|
|
58869
59064
|
}
|
|
58870
59065
|
function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
58871
|
-
const id =
|
|
59066
|
+
const id = React202.useId();
|
|
58872
59067
|
if (variant === "light") {
|
|
58873
59068
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
58874
59069
|
"svg",
|
|
@@ -59215,7 +59410,7 @@ function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59215
59410
|
);
|
|
59216
59411
|
}
|
|
59217
59412
|
function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59218
|
-
const id =
|
|
59413
|
+
const id = React212.useId();
|
|
59219
59414
|
if (variant === "light") {
|
|
59220
59415
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
59221
59416
|
"svg",
|
|
@@ -59629,7 +59824,7 @@ function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59629
59824
|
);
|
|
59630
59825
|
}
|
|
59631
59826
|
function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59632
|
-
const id =
|
|
59827
|
+
const id = React2222.useId();
|
|
59633
59828
|
if (variant === "light") {
|
|
59634
59829
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
59635
59830
|
"svg",
|
|
@@ -59712,7 +59907,7 @@ function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59712
59907
|
);
|
|
59713
59908
|
}
|
|
59714
59909
|
function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59715
|
-
const id =
|
|
59910
|
+
const id = React232.useId();
|
|
59716
59911
|
if (variant === "light") {
|
|
59717
59912
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
59718
59913
|
"svg",
|
|
@@ -59767,7 +59962,7 @@ function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59767
59962
|
);
|
|
59768
59963
|
}
|
|
59769
59964
|
function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59770
|
-
const id =
|
|
59965
|
+
const id = React242.useId();
|
|
59771
59966
|
if (variant === "light") {
|
|
59772
59967
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
59773
59968
|
"svg",
|
|
@@ -59868,7 +60063,7 @@ function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59868
60063
|
);
|
|
59869
60064
|
}
|
|
59870
60065
|
function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59871
|
-
const id =
|
|
60066
|
+
const id = React252.useId();
|
|
59872
60067
|
if (variant === "light") {
|
|
59873
60068
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
59874
60069
|
"svg",
|
|
@@ -59941,7 +60136,7 @@ function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59941
60136
|
);
|
|
59942
60137
|
}
|
|
59943
60138
|
function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59944
|
-
const id =
|
|
60139
|
+
const id = React262.useId();
|
|
59945
60140
|
if (variant === "light") {
|
|
59946
60141
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
59947
60142
|
"svg",
|
|
@@ -60008,7 +60203,7 @@ function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
60008
60203
|
);
|
|
60009
60204
|
}
|
|
60010
60205
|
function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
60011
|
-
const id =
|
|
60206
|
+
const id = React272.useId();
|
|
60012
60207
|
if (variant === "light") {
|
|
60013
60208
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
60014
60209
|
"svg",
|
|
@@ -60132,7 +60327,7 @@ function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
60132
60327
|
);
|
|
60133
60328
|
}
|
|
60134
60329
|
function SolanaIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
60135
|
-
const id =
|
|
60330
|
+
const id = React282.useId();
|
|
60136
60331
|
if (variant === "light") {
|
|
60137
60332
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
60138
60333
|
"svg",
|
|
@@ -60377,19 +60572,19 @@ function BrowserWalletButton({
|
|
|
60377
60572
|
subtitle = i18n2.depositModal.browserWallet.subtitle
|
|
60378
60573
|
}) {
|
|
60379
60574
|
const { colors: colors2, fonts, components } = useTheme();
|
|
60380
|
-
const [isHovered, setIsHovered] =
|
|
60381
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
60575
|
+
const [isHovered, setIsHovered] = React292.useState(false);
|
|
60576
|
+
const [isTouchDevice, setIsTouchDevice] = React292.useState(false);
|
|
60382
60577
|
const { wallet, isLoading, setWallet } = useDetectedBrowserWallet({ chainType, onDisconnect });
|
|
60383
|
-
const [isConnecting, setIsConnecting] =
|
|
60384
|
-
const [balanceText, setBalanceText] =
|
|
60385
|
-
const [isLoadingBalance, setIsLoadingBalance] =
|
|
60386
|
-
const [isDisconnecting, setIsDisconnecting] =
|
|
60387
|
-
const onDisconnectRef =
|
|
60578
|
+
const [isConnecting, setIsConnecting] = React292.useState(false);
|
|
60579
|
+
const [balanceText, setBalanceText] = React292.useState(null);
|
|
60580
|
+
const [isLoadingBalance, setIsLoadingBalance] = React292.useState(false);
|
|
60581
|
+
const [isDisconnecting, setIsDisconnecting] = React292.useState(false);
|
|
60582
|
+
const onDisconnectRef = React292.useRef(onDisconnect);
|
|
60388
60583
|
onDisconnectRef.current = onDisconnect;
|
|
60389
|
-
|
|
60584
|
+
React292.useEffect(() => {
|
|
60390
60585
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
60391
60586
|
}, []);
|
|
60392
|
-
|
|
60587
|
+
React292.useEffect(() => {
|
|
60393
60588
|
if (!wallet || !publishableKey) {
|
|
60394
60589
|
setBalanceText(null);
|
|
60395
60590
|
return;
|
|
@@ -60516,7 +60711,7 @@ function BrowserWalletButton({
|
|
|
60516
60711
|
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
60517
60712
|
};
|
|
60518
60713
|
const sortedWallets = featuredWallets ? [...featuredWallets].sort((a, b) => a.position - b.position) : [];
|
|
60519
|
-
const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ?
|
|
60714
|
+
const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ? React292.createElement(WALLET_ICON_COMPONENTS[wallet.icon], {
|
|
60520
60715
|
size: 36,
|
|
60521
60716
|
className: "uf-rounded-lg",
|
|
60522
60717
|
variant: "color"
|
|
@@ -60667,9 +60862,9 @@ function StripeLinkButton({
|
|
|
60667
60862
|
iconUrl
|
|
60668
60863
|
}) {
|
|
60669
60864
|
const { colors: colors2, fonts, components } = useTheme();
|
|
60670
|
-
const [isHovered, setIsHovered] =
|
|
60671
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
60672
|
-
|
|
60865
|
+
const [isHovered, setIsHovered] = React302.useState(false);
|
|
60866
|
+
const [isTouchDevice, setIsTouchDevice] = React302.useState(false);
|
|
60867
|
+
React302.useEffect(() => {
|
|
60673
60868
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
60674
60869
|
}, []);
|
|
60675
60870
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
@@ -61155,6 +61350,8 @@ function PayWithStripeLink({
|
|
|
61155
61350
|
destinationChainType,
|
|
61156
61351
|
destinationChainId,
|
|
61157
61352
|
destinationTokenAddress,
|
|
61353
|
+
countryCode,
|
|
61354
|
+
subdivisionCode,
|
|
61158
61355
|
wallets: externalWallets,
|
|
61159
61356
|
email: emailProp,
|
|
61160
61357
|
iconUrl,
|
|
@@ -61549,7 +61746,9 @@ function PayWithStripeLink({
|
|
|
61549
61746
|
{
|
|
61550
61747
|
tokenAddress: destinationTokenAddress,
|
|
61551
61748
|
chainId: destinationChainId,
|
|
61552
|
-
chainType: destinationChainType
|
|
61749
|
+
chainType: destinationChainType,
|
|
61750
|
+
countryCode,
|
|
61751
|
+
subdivisionCode
|
|
61553
61752
|
},
|
|
61554
61753
|
publishableKey
|
|
61555
61754
|
).then((token) => {
|
|
@@ -61568,7 +61767,14 @@ function PayWithStripeLink({
|
|
|
61568
61767
|
return () => {
|
|
61569
61768
|
cancelled = true;
|
|
61570
61769
|
};
|
|
61571
|
-
}, [
|
|
61770
|
+
}, [
|
|
61771
|
+
publishableKey,
|
|
61772
|
+
destinationTokenAddress,
|
|
61773
|
+
destinationChainId,
|
|
61774
|
+
destinationChainType,
|
|
61775
|
+
countryCode,
|
|
61776
|
+
subdivisionCode
|
|
61777
|
+
]);
|
|
61572
61778
|
const destinationCurrency = stripeDestCurrency;
|
|
61573
61779
|
const authInnerRef = (0, import_react22.useRef)(null);
|
|
61574
61780
|
const paymentInnerRef = (0, import_react22.useRef)(null);
|
|
@@ -64544,7 +64750,8 @@ function CoinbaseConnect({
|
|
|
64544
64750
|
defaultSourceChainType,
|
|
64545
64751
|
defaultSourceChainId,
|
|
64546
64752
|
defaultSourceTokenAddress,
|
|
64547
|
-
defaultSourceSymbol
|
|
64753
|
+
defaultSourceSymbol,
|
|
64754
|
+
prefilledAmountUsd
|
|
64548
64755
|
}) {
|
|
64549
64756
|
const { colors: colors2, fonts, components } = useTheme();
|
|
64550
64757
|
const { projectConfig } = useProjectConfig({ publishableKey });
|
|
@@ -64867,7 +65074,8 @@ function CoinbaseConnect({
|
|
|
64867
65074
|
};
|
|
64868
65075
|
const handleSelectAsset = (asset) => {
|
|
64869
65076
|
setSelectedAsset(asset);
|
|
64870
|
-
|
|
65077
|
+
const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
65078
|
+
setSendAmount(cleanedPrefilled);
|
|
64871
65079
|
transitionTo("enter_amount");
|
|
64872
65080
|
};
|
|
64873
65081
|
const handleCreateTransfer = async () => {
|
|
@@ -66578,7 +66786,7 @@ function ThemeStyleInjector({
|
|
|
66578
66786
|
className
|
|
66579
66787
|
}) {
|
|
66580
66788
|
const { colors: colors2, fonts, mode } = useTheme();
|
|
66581
|
-
const cssVars =
|
|
66789
|
+
const cssVars = React322.useMemo(() => {
|
|
66582
66790
|
const hexToHSL = (hex) => {
|
|
66583
66791
|
hex = hex.replace("#", "");
|
|
66584
66792
|
const r2 = parseInt(hex.slice(0, 2), 16) / 255;
|
|
@@ -66638,7 +66846,7 @@ function ThemeStyleInjector({
|
|
|
66638
66846
|
...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
|
|
66639
66847
|
};
|
|
66640
66848
|
}, [colors2, fonts.regular]);
|
|
66641
|
-
|
|
66849
|
+
React322.useEffect(() => {
|
|
66642
66850
|
if (typeof document === "undefined") return;
|
|
66643
66851
|
if (fonts.regular) {
|
|
66644
66852
|
document.documentElement.style.setProperty("--uf-font-family", fonts.regular);
|
|
@@ -67783,14 +67991,14 @@ function useCopyAddress() {
|
|
|
67783
67991
|
return { copied, handleCopy };
|
|
67784
67992
|
}
|
|
67785
67993
|
var TooltipProvider2 = Provider;
|
|
67786
|
-
var TooltipContext =
|
|
67994
|
+
var TooltipContext = React332.createContext({
|
|
67787
67995
|
open: false,
|
|
67788
67996
|
onOpenChange: () => {
|
|
67789
67997
|
}
|
|
67790
67998
|
});
|
|
67791
|
-
var TooltipTrigger2 =
|
|
67792
|
-
const { open, onOpenChange } =
|
|
67793
|
-
const handleClick =
|
|
67999
|
+
var TooltipTrigger2 = React332.forwardRef(({ onClick, ...props }, ref) => {
|
|
68000
|
+
const { open, onOpenChange } = React332.useContext(TooltipContext);
|
|
68001
|
+
const handleClick = React332.useCallback(
|
|
67794
68002
|
(e) => {
|
|
67795
68003
|
onOpenChange(!open);
|
|
67796
68004
|
onClick?.(e);
|
|
@@ -67800,7 +68008,7 @@ var TooltipTrigger2 = React322.forwardRef(({ onClick, ...props }, ref) => {
|
|
|
67800
68008
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Trigger, { ref, onClick: handleClick, ...props });
|
|
67801
68009
|
});
|
|
67802
68010
|
TooltipTrigger2.displayName = Trigger.displayName;
|
|
67803
|
-
var TooltipContent2 =
|
|
68011
|
+
var TooltipContent2 = React332.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
|
|
67804
68012
|
const { themeClass, colors: colors2 } = useTheme();
|
|
67805
68013
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Portal3, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
67806
68014
|
Content22,
|
|
@@ -67910,6 +68118,7 @@ function TransferCryptoSingleInput({
|
|
|
67910
68118
|
onDepositError,
|
|
67911
68119
|
wallets: externalWallets,
|
|
67912
68120
|
onSourceTokenChange,
|
|
68121
|
+
prefilledAmountUsd,
|
|
67913
68122
|
checkoutQuote,
|
|
67914
68123
|
isCheckoutQuoteLoading = false,
|
|
67915
68124
|
persistCheckingIndicator = false,
|
|
@@ -68053,6 +68262,22 @@ function TransferCryptoSingleInput({
|
|
|
68053
68262
|
const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
|
|
68054
68263
|
const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
|
|
68055
68264
|
const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
|
|
68265
|
+
const parsedPrefilledUsd = (0, import_react25.useMemo)(() => {
|
|
68266
|
+
const value = parseFloat(prefilledAmountUsd ?? "");
|
|
68267
|
+
return Number.isFinite(value) && value > 0 ? value : null;
|
|
68268
|
+
}, [prefilledAmountUsd]);
|
|
68269
|
+
const effectivePrefilledUsd = (0, import_react25.useMemo)(() => {
|
|
68270
|
+
if (parsedPrefilledUsd === null) return null;
|
|
68271
|
+
return Math.max(parsedPrefilledUsd, minDepositUsd);
|
|
68272
|
+
}, [parsedPrefilledUsd, minDepositUsd]);
|
|
68273
|
+
const prefillDisplay = (0, import_react25.useMemo)(() => {
|
|
68274
|
+
if (effectivePrefilledUsd === null) return null;
|
|
68275
|
+
const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
|
|
68276
|
+
if (selectedToken?.is_stablecoin) {
|
|
68277
|
+
return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
|
|
68278
|
+
}
|
|
68279
|
+
return `${usdLabel} USD`;
|
|
68280
|
+
}, [effectivePrefilledUsd, selectedToken]);
|
|
68056
68281
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(TooltipProvider2, { delayDuration: 0, skipDelayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
68057
68282
|
"div",
|
|
68058
68283
|
{
|
|
@@ -68179,7 +68404,7 @@ function TransferCryptoSingleInput({
|
|
|
68179
68404
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "Retrying automatically every 5 seconds..." })
|
|
68180
68405
|
] })
|
|
68181
68406
|
] }),
|
|
68182
|
-
(checkoutQuote || isCheckoutQuoteLoading) && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
68407
|
+
(checkoutQuote || isCheckoutQuoteLoading || prefillDisplay) && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
68183
68408
|
"div",
|
|
68184
68409
|
{
|
|
68185
68410
|
className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
|
|
@@ -68223,6 +68448,13 @@ function TransferCryptoSingleInput({
|
|
|
68223
68448
|
)
|
|
68224
68449
|
]
|
|
68225
68450
|
}
|
|
68451
|
+
) : prefillDisplay ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
68452
|
+
"span",
|
|
68453
|
+
{
|
|
68454
|
+
className: "uf-text-sm uf-font-semibold",
|
|
68455
|
+
style: { color: components.card.titleColor, fontFamily: fonts.semibold },
|
|
68456
|
+
children: prefillDisplay
|
|
68457
|
+
}
|
|
68226
68458
|
) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
68227
68459
|
"div",
|
|
68228
68460
|
{
|
|
@@ -68552,7 +68784,7 @@ function TransferCryptoSingleInput({
|
|
|
68552
68784
|
}
|
|
68553
68785
|
var Select2 = Root23;
|
|
68554
68786
|
var SelectValue2 = Value;
|
|
68555
|
-
var SelectTrigger2 =
|
|
68787
|
+
var SelectTrigger2 = React342.forwardRef(({ className, style, children, ...props }, ref) => {
|
|
68556
68788
|
const { components } = useTheme();
|
|
68557
68789
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
68558
68790
|
Trigger2,
|
|
@@ -68576,7 +68808,7 @@ var SelectTrigger2 = React332.forwardRef(({ className, style, children, ...props
|
|
|
68576
68808
|
);
|
|
68577
68809
|
});
|
|
68578
68810
|
SelectTrigger2.displayName = Trigger2.displayName;
|
|
68579
|
-
var SelectScrollUpButton2 =
|
|
68811
|
+
var SelectScrollUpButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
68580
68812
|
ScrollUpButton,
|
|
68581
68813
|
{
|
|
68582
68814
|
ref,
|
|
@@ -68586,7 +68818,7 @@ var SelectScrollUpButton2 = React332.forwardRef(({ className, ...props }, ref) =
|
|
|
68586
68818
|
}
|
|
68587
68819
|
));
|
|
68588
68820
|
SelectScrollUpButton2.displayName = ScrollUpButton.displayName;
|
|
68589
|
-
var SelectScrollDownButton2 =
|
|
68821
|
+
var SelectScrollDownButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
68590
68822
|
ScrollDownButton,
|
|
68591
68823
|
{
|
|
68592
68824
|
ref,
|
|
@@ -68596,7 +68828,7 @@ var SelectScrollDownButton2 = React332.forwardRef(({ className, ...props }, ref)
|
|
|
68596
68828
|
}
|
|
68597
68829
|
));
|
|
68598
68830
|
SelectScrollDownButton2.displayName = ScrollDownButton.displayName;
|
|
68599
|
-
var SelectContent2 =
|
|
68831
|
+
var SelectContent2 = React342.forwardRef(({ className, style, children, position = "popper", ...props }, ref) => {
|
|
68600
68832
|
const { themeClass, colors: colors2, components } = useTheme();
|
|
68601
68833
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Portal4, { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
68602
68834
|
Content23,
|
|
@@ -68634,7 +68866,7 @@ var SelectContent2 = React332.forwardRef(({ className, style, children, position
|
|
|
68634
68866
|
) });
|
|
68635
68867
|
});
|
|
68636
68868
|
SelectContent2.displayName = Content23.displayName;
|
|
68637
|
-
var SelectLabel2 =
|
|
68869
|
+
var SelectLabel2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
68638
68870
|
Label,
|
|
68639
68871
|
{
|
|
68640
68872
|
ref,
|
|
@@ -68643,7 +68875,7 @@ var SelectLabel2 = React332.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
68643
68875
|
}
|
|
68644
68876
|
));
|
|
68645
68877
|
SelectLabel2.displayName = Label.displayName;
|
|
68646
|
-
var SelectItem2 =
|
|
68878
|
+
var SelectItem2 = React342.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
68647
68879
|
Item,
|
|
68648
68880
|
{
|
|
68649
68881
|
ref,
|
|
@@ -68659,7 +68891,7 @@ var SelectItem2 = React332.forwardRef(({ className, children, ...props }, ref) =
|
|
|
68659
68891
|
}
|
|
68660
68892
|
));
|
|
68661
68893
|
SelectItem2.displayName = Item.displayName;
|
|
68662
|
-
var SelectSeparator2 =
|
|
68894
|
+
var SelectSeparator2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
68663
68895
|
Separator,
|
|
68664
68896
|
{
|
|
68665
68897
|
ref,
|
|
@@ -68687,6 +68919,7 @@ function TransferCryptoDoubleInput({
|
|
|
68687
68919
|
defaultSourceChainId,
|
|
68688
68920
|
defaultSourceTokenAddress,
|
|
68689
68921
|
defaultSourceSymbol,
|
|
68922
|
+
prefilledAmountUsd,
|
|
68690
68923
|
depositConfirmationMode = "auto_ui",
|
|
68691
68924
|
onExecutionsChange,
|
|
68692
68925
|
onDepositSuccess,
|
|
@@ -68811,6 +69044,22 @@ function TransferCryptoDoubleInput({
|
|
|
68811
69044
|
const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
|
|
68812
69045
|
const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
|
|
68813
69046
|
const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
|
|
69047
|
+
const parsedPrefilledUsd = (0, import_react31.useMemo)(() => {
|
|
69048
|
+
const value = parseFloat(prefilledAmountUsd ?? "");
|
|
69049
|
+
return Number.isFinite(value) && value > 0 ? value : null;
|
|
69050
|
+
}, [prefilledAmountUsd]);
|
|
69051
|
+
const effectivePrefilledUsd = (0, import_react31.useMemo)(() => {
|
|
69052
|
+
if (parsedPrefilledUsd === null) return null;
|
|
69053
|
+
return Math.max(parsedPrefilledUsd, minDepositUsd);
|
|
69054
|
+
}, [parsedPrefilledUsd, minDepositUsd]);
|
|
69055
|
+
const prefillDisplay = (0, import_react31.useMemo)(() => {
|
|
69056
|
+
if (effectivePrefilledUsd === null) return null;
|
|
69057
|
+
const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
|
|
69058
|
+
if (selectedToken?.is_stablecoin) {
|
|
69059
|
+
return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
|
|
69060
|
+
}
|
|
69061
|
+
return `${usdLabel} USD`;
|
|
69062
|
+
}, [effectivePrefilledUsd, selectedToken]);
|
|
68814
69063
|
const renderTokenItem = (tokenData) => {
|
|
68815
69064
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
68816
69065
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
@@ -68991,6 +69240,35 @@ function TransferCryptoDoubleInput({
|
|
|
68991
69240
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { children: "Retrying automatically every 5 seconds..." })
|
|
68992
69241
|
] })
|
|
68993
69242
|
] }),
|
|
69243
|
+
prefillDisplay && /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
69244
|
+
"div",
|
|
69245
|
+
{
|
|
69246
|
+
className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
|
|
69247
|
+
style: {
|
|
69248
|
+
backgroundColor: components.card.backgroundColor,
|
|
69249
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`,
|
|
69250
|
+
borderRadius: components.card.borderRadius
|
|
69251
|
+
},
|
|
69252
|
+
children: [
|
|
69253
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
69254
|
+
"span",
|
|
69255
|
+
{
|
|
69256
|
+
className: "uf-text-xs",
|
|
69257
|
+
style: { color: components.card.subtitleColor, fontFamily: fonts.regular },
|
|
69258
|
+
children: "You send"
|
|
69259
|
+
}
|
|
69260
|
+
),
|
|
69261
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
69262
|
+
"span",
|
|
69263
|
+
{
|
|
69264
|
+
className: "uf-text-sm uf-font-semibold",
|
|
69265
|
+
style: { color: components.card.titleColor, fontFamily: fonts.semibold },
|
|
69266
|
+
children: prefillDisplay
|
|
69267
|
+
}
|
|
69268
|
+
)
|
|
69269
|
+
]
|
|
69270
|
+
}
|
|
69271
|
+
),
|
|
68994
69272
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-pt-2", children: [
|
|
68995
69273
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
68996
69274
|
"div",
|
|
@@ -70578,7 +70856,7 @@ function WalletConnect({
|
|
|
70578
70856
|
amountQuickSelect = "percentage",
|
|
70579
70857
|
onWalletDisconnect,
|
|
70580
70858
|
onWalletConnected,
|
|
70581
|
-
|
|
70859
|
+
prefilledAmountUsd,
|
|
70582
70860
|
checkoutAmountUsd,
|
|
70583
70861
|
checkoutReceivedUsd,
|
|
70584
70862
|
onNewDeposit,
|
|
@@ -70600,28 +70878,28 @@ function WalletConnect({
|
|
|
70600
70878
|
onExecutionsChange
|
|
70601
70879
|
}) {
|
|
70602
70880
|
const { colors: colors2, fonts, components, mode } = useTheme();
|
|
70603
|
-
const walletProvidedAtMount =
|
|
70604
|
-
const [activeWalletInfo, setActiveWalletInfo] =
|
|
70881
|
+
const walletProvidedAtMount = React352.useRef(!!initialWalletInfo && !!initialDepositWallet);
|
|
70882
|
+
const [activeWalletInfo, setActiveWalletInfo] = React352.useState(
|
|
70605
70883
|
initialWalletInfo ?? null
|
|
70606
70884
|
);
|
|
70607
|
-
const [activeDepositWallet, setActiveDepositWallet] =
|
|
70885
|
+
const [activeDepositWallet, setActiveDepositWallet] = React352.useState(
|
|
70608
70886
|
initialDepositWallet ?? null
|
|
70609
70887
|
);
|
|
70610
70888
|
const initialView = initialWalletInfo && initialDepositWallet ? "select_token" : "select_wallet";
|
|
70611
|
-
const [view, setView] =
|
|
70612
|
-
const [isTransitioning, setIsTransitioning] =
|
|
70613
|
-
const viewRef =
|
|
70889
|
+
const [view, setView] = React352.useState(initialView);
|
|
70890
|
+
const [isTransitioning, setIsTransitioning] = React352.useState(false);
|
|
70891
|
+
const viewRef = React352.useRef(initialView);
|
|
70614
70892
|
const standalone = !canGoBack && !walletProvidedAtMount.current;
|
|
70615
70893
|
const { wallet: detectedWallet, isLoading: detectingWallet } = useDetectedBrowserWallet({
|
|
70616
70894
|
enabled: standalone
|
|
70617
70895
|
});
|
|
70618
|
-
const [autoResolved, setAutoResolved] =
|
|
70619
|
-
const [selectedWalletDef, setSelectedWalletDef] =
|
|
70620
|
-
const [connectingNetwork, setConnectingNetwork] =
|
|
70621
|
-
const [walletError, setWalletError] =
|
|
70622
|
-
const [isWalletConnecting, setIsWalletConnecting] =
|
|
70623
|
-
const [eip6963ProviderCount, setEip6963ProviderCount] =
|
|
70624
|
-
|
|
70896
|
+
const [autoResolved, setAutoResolved] = React352.useState(false);
|
|
70897
|
+
const [selectedWalletDef, setSelectedWalletDef] = React352.useState(null);
|
|
70898
|
+
const [connectingNetwork, setConnectingNetwork] = React352.useState(null);
|
|
70899
|
+
const [walletError, setWalletError] = React352.useState(null);
|
|
70900
|
+
const [isWalletConnecting, setIsWalletConnecting] = React352.useState(false);
|
|
70901
|
+
const [eip6963ProviderCount, setEip6963ProviderCount] = React352.useState(0);
|
|
70902
|
+
React352.useEffect(() => {
|
|
70625
70903
|
const store = getEip6963Store();
|
|
70626
70904
|
if (!store) return;
|
|
70627
70905
|
setEip6963ProviderCount(store.getProviders().length);
|
|
@@ -70630,7 +70908,7 @@ function WalletConnect({
|
|
|
70630
70908
|
});
|
|
70631
70909
|
}, []);
|
|
70632
70910
|
const { wallets: backendWallets } = useExternalWallets({ publishableKey });
|
|
70633
|
-
const walletDefinitions =
|
|
70911
|
+
const walletDefinitions = React352.useMemo(
|
|
70634
70912
|
() => backendWallets.length > 0 ? backendWallets.map((w) => ({
|
|
70635
70913
|
id: w.id,
|
|
70636
70914
|
name: w.name,
|
|
@@ -70641,32 +70919,32 @@ function WalletConnect({
|
|
|
70641
70919
|
})) : FALLBACK_WALLET_DEFINITIONS,
|
|
70642
70920
|
[backendWallets]
|
|
70643
70921
|
);
|
|
70644
|
-
const [recentWalletId, setRecentWalletIdState] =
|
|
70645
|
-
|
|
70922
|
+
const [recentWalletId, setRecentWalletIdState] = React352.useState(getLastOpenedWallet);
|
|
70923
|
+
React352.useEffect(() => {
|
|
70646
70924
|
if (view === "select_wallet") {
|
|
70647
70925
|
setRecentWalletIdState(getLastOpenedWallet());
|
|
70648
70926
|
}
|
|
70649
70927
|
}, [view]);
|
|
70650
|
-
const availableWallets =
|
|
70928
|
+
const availableWallets = React352.useMemo(
|
|
70651
70929
|
() => detectAvailableWallets(walletDefinitions, recentWalletId),
|
|
70652
70930
|
[walletDefinitions, eip6963ProviderCount, recentWalletId]
|
|
70653
70931
|
);
|
|
70654
|
-
const [isMobile, setIsMobile] =
|
|
70655
|
-
|
|
70932
|
+
const [isMobile, setIsMobile] = React352.useState(false);
|
|
70933
|
+
React352.useEffect(() => {
|
|
70656
70934
|
setIsMobile(isMobileDevice());
|
|
70657
70935
|
}, []);
|
|
70658
|
-
const mobileDepositAddresses =
|
|
70936
|
+
const mobileDepositAddresses = React352.useMemo(
|
|
70659
70937
|
() => (depositWallets ?? []).map((w) => ({ chain_type: w.chain_type, address: w.address })),
|
|
70660
70938
|
[depositWallets]
|
|
70661
70939
|
);
|
|
70662
|
-
const mobileDepositWalletIds =
|
|
70940
|
+
const mobileDepositWalletIds = React352.useMemo(
|
|
70663
70941
|
() => (depositWallets ?? []).filter((w) => w.chain_type === "ethereum" || w.chain_type === "solana").map((w) => w.id),
|
|
70664
70942
|
[depositWallets]
|
|
70665
70943
|
);
|
|
70666
|
-
const [mobileRedirect, setMobileRedirect] =
|
|
70667
|
-
const [pendingMobileWallet, setPendingMobileWallet] =
|
|
70668
|
-
const [awaitingMobileDeposit, setAwaitingMobileDeposit] =
|
|
70669
|
-
|
|
70944
|
+
const [mobileRedirect, setMobileRedirect] = React352.useState(null);
|
|
70945
|
+
const [pendingMobileWallet, setPendingMobileWallet] = React352.useState(null);
|
|
70946
|
+
const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React352.useState(false);
|
|
70947
|
+
React352.useEffect(() => {
|
|
70670
70948
|
if (!standalone || autoResolved || detectingWallet) return;
|
|
70671
70949
|
if (!detectedWallet) {
|
|
70672
70950
|
setAutoResolved(true);
|
|
@@ -70692,32 +70970,36 @@ function WalletConnect({
|
|
|
70692
70970
|
depositWallets,
|
|
70693
70971
|
depositWalletsLoading
|
|
70694
70972
|
]);
|
|
70695
|
-
|
|
70973
|
+
React352.useEffect(() => {
|
|
70696
70974
|
if (!standalone || autoResolved) return;
|
|
70697
70975
|
const t13 = setTimeout(() => setAutoResolved(true), 5e3);
|
|
70698
70976
|
return () => clearTimeout(t13);
|
|
70699
70977
|
}, [standalone, autoResolved]);
|
|
70700
|
-
const [balances, setBalances] =
|
|
70701
|
-
const [isLoading, setIsLoading] =
|
|
70702
|
-
const [selectedBalance, setSelectedBalance] =
|
|
70703
|
-
const [totalBalanceUsd, setTotalBalanceUsd] =
|
|
70704
|
-
const [error, setError] =
|
|
70705
|
-
const [isDisconnectingWallet, setIsDisconnectingWallet] =
|
|
70706
|
-
const [amountUsd, setAmountUsd] =
|
|
70707
|
-
const [isConfirming, setIsConfirming] =
|
|
70708
|
-
const [hasSignedTransaction, setHasSignedTransaction] =
|
|
70709
|
-
const [tokenChainDetails, setTokenChainDetails] =
|
|
70710
|
-
const [loadingTokenDetails, setLoadingTokenDetails] =
|
|
70711
|
-
const [showTransactionDetails, setShowTransactionDetails] =
|
|
70712
|
-
const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] =
|
|
70978
|
+
const [balances, setBalances] = React352.useState([]);
|
|
70979
|
+
const [isLoading, setIsLoading] = React352.useState(false);
|
|
70980
|
+
const [selectedBalance, setSelectedBalance] = React352.useState(null);
|
|
70981
|
+
const [totalBalanceUsd, setTotalBalanceUsd] = React352.useState(null);
|
|
70982
|
+
const [error, setError] = React352.useState(null);
|
|
70983
|
+
const [isDisconnectingWallet, setIsDisconnectingWallet] = React352.useState(false);
|
|
70984
|
+
const [amountUsd, setAmountUsd] = React352.useState(prefilledAmountUsd ?? "");
|
|
70985
|
+
const [isConfirming, setIsConfirming] = React352.useState(false);
|
|
70986
|
+
const [hasSignedTransaction, setHasSignedTransaction] = React352.useState(false);
|
|
70987
|
+
const [tokenChainDetails, setTokenChainDetails] = React352.useState(null);
|
|
70988
|
+
const [loadingTokenDetails, setLoadingTokenDetails] = React352.useState(false);
|
|
70989
|
+
const [showTransactionDetails, setShowTransactionDetails] = React352.useState(false);
|
|
70990
|
+
const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] = React352.useState(null);
|
|
70713
70991
|
const walletInfo = activeWalletInfo;
|
|
70714
70992
|
const depositWallet = activeDepositWallet;
|
|
70715
70993
|
const hasWallet = !!activeWalletInfo && !!activeDepositWallet;
|
|
70994
|
+
React352.useEffect(() => {
|
|
70995
|
+
const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
70996
|
+
setAmountUsd(cleanedPrefilled);
|
|
70997
|
+
}, [prefilledAmountUsd]);
|
|
70716
70998
|
const chainType = activeDepositWallet?.chain_type ?? "ethereum";
|
|
70717
70999
|
const recipientAddress = activeDepositWallet?.address ?? "";
|
|
70718
71000
|
const isCheckoutMode = !!checkoutAmountUsd;
|
|
70719
71001
|
const supportedChainType = chainType === "algorand" || chainType === "xrpl" || chainType === "cardano" || chainType === "n1" ? "ethereum" : chainType;
|
|
70720
|
-
const transitionTo =
|
|
71002
|
+
const transitionTo = React352.useCallback((nextView) => {
|
|
70721
71003
|
if (nextView === viewRef.current) return;
|
|
70722
71004
|
setIsTransitioning(true);
|
|
70723
71005
|
setTimeout(() => {
|
|
@@ -70782,7 +71064,7 @@ function WalletConnect({
|
|
|
70782
71064
|
if (!selectedWalletDef) return;
|
|
70783
71065
|
handleConnectWallet(selectedWalletDef, network);
|
|
70784
71066
|
};
|
|
70785
|
-
|
|
71067
|
+
React352.useEffect(() => {
|
|
70786
71068
|
if (!pendingMobileWallet) return;
|
|
70787
71069
|
if (mobileDepositAddresses.length > 0) {
|
|
70788
71070
|
const wallet = pendingMobileWallet;
|
|
@@ -70946,7 +71228,7 @@ function WalletConnect({
|
|
|
70946
71228
|
publishableKey,
|
|
70947
71229
|
enabled: !!activeWalletInfo && !!recipientAddress
|
|
70948
71230
|
});
|
|
70949
|
-
const effectiveDestinationAmount =
|
|
71231
|
+
const effectiveDestinationAmount = React352.useMemo(() => {
|
|
70950
71232
|
if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
|
|
70951
71233
|
if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
|
|
70952
71234
|
const remaining = BigInt(checkoutRemainingBaseUnits);
|
|
@@ -70974,7 +71256,7 @@ function WalletConnect({
|
|
|
70974
71256
|
stablecoinParity,
|
|
70975
71257
|
enabled: isCheckoutMode && !!selectedToken && !!checkoutDestination && effectiveDestinationAmount !== "0"
|
|
70976
71258
|
});
|
|
70977
|
-
const activeCheckoutQuote =
|
|
71259
|
+
const activeCheckoutQuote = React352.useMemo(() => {
|
|
70978
71260
|
if (!isCheckoutMode) return null;
|
|
70979
71261
|
if (walletCheckoutQuote)
|
|
70980
71262
|
return {
|
|
@@ -71004,10 +71286,10 @@ function WalletConnect({
|
|
|
71004
71286
|
onDepositSuccess,
|
|
71005
71287
|
onDepositError
|
|
71006
71288
|
});
|
|
71007
|
-
|
|
71289
|
+
React352.useEffect(() => {
|
|
71008
71290
|
onExecutionsChange?.(depositExecutions);
|
|
71009
71291
|
}, [depositExecutions, onExecutionsChange]);
|
|
71010
|
-
const latestDepositExecution =
|
|
71292
|
+
const latestDepositExecution = React352.useMemo(() => {
|
|
71011
71293
|
if (depositExecutions.length === 0) return null;
|
|
71012
71294
|
return [...depositExecutions].sort((a, b) => {
|
|
71013
71295
|
const ta = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
@@ -71015,21 +71297,21 @@ function WalletConnect({
|
|
|
71015
71297
|
return tb - ta;
|
|
71016
71298
|
})[0];
|
|
71017
71299
|
}, [depositExecutions]);
|
|
71018
|
-
|
|
71300
|
+
React352.useEffect(() => {
|
|
71019
71301
|
if (awaitingMobileDeposit && latestDepositExecution && (viewRef.current === "mobile_redirect" || viewRef.current === "connecting")) {
|
|
71020
71302
|
transitionTo("mobile_deposit_status");
|
|
71021
71303
|
}
|
|
71022
71304
|
}, [awaitingMobileDeposit, latestDepositExecution, transitionTo]);
|
|
71023
|
-
|
|
71024
|
-
if (!
|
|
71305
|
+
React352.useEffect(() => {
|
|
71306
|
+
if (!isCheckoutMode || !tokenChainDetails || view !== "enter_amount") return;
|
|
71025
71307
|
const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
|
|
71026
71308
|
const currentAmount = parseFloat(amountUsd) || 0;
|
|
71027
71309
|
if (currentAmount > 0 && currentAmount < minDeposit) setAmountUsd(minDeposit.toFixed(2));
|
|
71028
|
-
}, [tokenChainDetails, view,
|
|
71029
|
-
|
|
71310
|
+
}, [isCheckoutMode, tokenChainDetails, view, amountUsd]);
|
|
71311
|
+
React352.useEffect(() => {
|
|
71030
71312
|
if (view === "review") setShowTransactionDetails(false);
|
|
71031
71313
|
}, [view]);
|
|
71032
|
-
|
|
71314
|
+
React352.useEffect(() => {
|
|
71033
71315
|
if (view !== "enter_amount" && view !== "review" || !selectedBalance || !activeDepositWallet)
|
|
71034
71316
|
return;
|
|
71035
71317
|
let cancelled = false;
|
|
@@ -71066,7 +71348,7 @@ function WalletConnect({
|
|
|
71066
71348
|
cancelled = true;
|
|
71067
71349
|
};
|
|
71068
71350
|
}, [view, selectedBalance, publishableKey, activeDepositWallet]);
|
|
71069
|
-
|
|
71351
|
+
React352.useEffect(() => {
|
|
71070
71352
|
if (!activeWalletInfo || !activeDepositWallet) return;
|
|
71071
71353
|
let cancelled = false;
|
|
71072
71354
|
setIsLoading(true);
|
|
@@ -71131,21 +71413,21 @@ function WalletConnect({
|
|
|
71131
71413
|
defaultSourceTokenAddress,
|
|
71132
71414
|
defaultSourceSymbol
|
|
71133
71415
|
]);
|
|
71134
|
-
const usdToTokenRate =
|
|
71416
|
+
const usdToTokenRate = React352.useMemo(() => {
|
|
71135
71417
|
if (!selectedBalance || !selectedBalance.amount_usd || !selectedToken) return 0;
|
|
71136
71418
|
const balanceAmount = Number(selectedBalance.amount) / 10 ** selectedToken.decimals;
|
|
71137
71419
|
const balanceUsd = parseFloat(selectedBalance.amount_usd);
|
|
71138
71420
|
if (balanceAmount === 0 || balanceUsd === 0) return 0;
|
|
71139
71421
|
return balanceAmount / balanceUsd;
|
|
71140
71422
|
}, [selectedBalance, selectedToken]);
|
|
71141
|
-
const tokenAmount =
|
|
71423
|
+
const tokenAmount = React352.useMemo(() => {
|
|
71142
71424
|
if (isCheckoutMode && activeCheckoutQuote && selectedToken)
|
|
71143
71425
|
return Number(activeCheckoutQuote.sourceAmount) / 10 ** activeCheckoutQuote.sourceTokenDecimals;
|
|
71144
71426
|
const usdNum = parseFloat(amountUsd) || 0;
|
|
71145
71427
|
if (usdNum === 0 || usdToTokenRate === 0) return 0;
|
|
71146
71428
|
return usdNum * usdToTokenRate;
|
|
71147
71429
|
}, [amountUsd, usdToTokenRate, isCheckoutMode, activeCheckoutQuote, selectedToken]);
|
|
71148
|
-
|
|
71430
|
+
React352.useEffect(() => {
|
|
71149
71431
|
if (isCheckoutMode && activeCheckoutQuote?.sourceAmountUsd && view === "enter_amount")
|
|
71150
71432
|
setAmountUsd(activeCheckoutQuote.sourceAmountUsd);
|
|
71151
71433
|
}, [isCheckoutMode, activeCheckoutQuote, view]);
|
|
@@ -71154,7 +71436,7 @@ function WalletConnect({
|
|
|
71154
71436
|
const inputUsdNum = parseFloat(amountUsd) || 0;
|
|
71155
71437
|
const minDepositUsd = tokenChainDetails?.minimum_deposit_amount_usd || 0;
|
|
71156
71438
|
const isValidAmount = isCheckoutMode && activeCheckoutQuote ? tokenAmount > 0 && tokenAmount <= maxTokenAmount : inputUsdNum > 0 && inputUsdNum <= maxUsdAmount && inputUsdNum >= minDepositUsd;
|
|
71157
|
-
const formattedTokenAmount =
|
|
71439
|
+
const formattedTokenAmount = React352.useMemo(() => {
|
|
71158
71440
|
if (tokenAmount === 0 || !selectedToken) return null;
|
|
71159
71441
|
return `${tokenAmount.toFixed(6)} ${selectedToken.symbol}`.replace(/\.?0+$/, "");
|
|
71160
71442
|
}, [tokenAmount, selectedToken]);
|
|
@@ -71187,7 +71469,7 @@ function WalletConnect({
|
|
|
71187
71469
|
break;
|
|
71188
71470
|
case "enter_amount":
|
|
71189
71471
|
transitionTo("select_token");
|
|
71190
|
-
setAmountUsd(
|
|
71472
|
+
setAmountUsd(prefilledAmountUsd ?? "");
|
|
71191
71473
|
setTokenChainDetails(null);
|
|
71192
71474
|
break;
|
|
71193
71475
|
case "review":
|
|
@@ -71219,7 +71501,7 @@ function WalletConnect({
|
|
|
71219
71501
|
setSelectedBalance(null);
|
|
71220
71502
|
setBalances([]);
|
|
71221
71503
|
setTotalBalanceUsd(null);
|
|
71222
|
-
setAmountUsd(
|
|
71504
|
+
setAmountUsd(prefilledAmountUsd ?? "");
|
|
71223
71505
|
setError(null);
|
|
71224
71506
|
};
|
|
71225
71507
|
if (standalone) {
|
|
@@ -71943,6 +72225,15 @@ function SkeletonButton({ variant = "default" }) {
|
|
|
71943
72225
|
] });
|
|
71944
72226
|
}
|
|
71945
72227
|
var t8 = i18n2.depositModal;
|
|
72228
|
+
function normalizePrefilledUsdAmount(value) {
|
|
72229
|
+
if (!value) return void 0;
|
|
72230
|
+
const cleaned = value.replace(/[^0-9.]/g, "");
|
|
72231
|
+
if (!cleaned) return void 0;
|
|
72232
|
+
const normalizedNumeric = cleaned.replace(/(\..*)\./g, "$1");
|
|
72233
|
+
const parsed = parseFloat(normalizedNumeric);
|
|
72234
|
+
if (!Number.isFinite(parsed) || parsed <= 0) return void 0;
|
|
72235
|
+
return parseFloat(parsed.toFixed(2)).toString();
|
|
72236
|
+
}
|
|
71946
72237
|
function depositTabForScreen(screen) {
|
|
71947
72238
|
return screen === "card" || screen === "cashapp" || screen === "bank_transfer" || screen === "stripe_link" || screen === "apple_pay" ? "cash" : "crypto";
|
|
71948
72239
|
}
|
|
@@ -71962,6 +72253,7 @@ function DepositModal({
|
|
|
71962
72253
|
defaultSourceChainId,
|
|
71963
72254
|
defaultSourceTokenAddress,
|
|
71964
72255
|
defaultSourceSymbol,
|
|
72256
|
+
prefilledAmountUsd,
|
|
71965
72257
|
hideDepositTracker,
|
|
71966
72258
|
showBalanceHeader = false,
|
|
71967
72259
|
transferInputVariant = "double_input",
|
|
@@ -71997,6 +72289,10 @@ function DepositModal({
|
|
|
71997
72289
|
depositTrackerSubTitle = t8.depositTracker.subtitle
|
|
71998
72290
|
}) {
|
|
71999
72291
|
const { colors: colors2, fonts, components } = useTheme();
|
|
72292
|
+
const normalizedPrefilledAmountUsd = (0, import_react3.useMemo)(
|
|
72293
|
+
() => normalizePrefilledUsdAmount(prefilledAmountUsd),
|
|
72294
|
+
[prefilledAmountUsd]
|
|
72295
|
+
);
|
|
72000
72296
|
const onDepositSuccessFor = (0, import_react3.useCallback)(
|
|
72001
72297
|
(method) => onDepositSuccess || onEvent ? (data) => {
|
|
72002
72298
|
const payload = { ...data, method };
|
|
@@ -72862,6 +73158,7 @@ function DepositModal({
|
|
|
72862
73158
|
defaultSourceChainId,
|
|
72863
73159
|
defaultSourceTokenAddress,
|
|
72864
73160
|
defaultSourceSymbol,
|
|
73161
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
72865
73162
|
depositConfirmationMode,
|
|
72866
73163
|
onExecutionsChange: setDepositExecutions,
|
|
72867
73164
|
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
@@ -72881,6 +73178,7 @@ function DepositModal({
|
|
|
72881
73178
|
defaultSourceChainId,
|
|
72882
73179
|
defaultSourceTokenAddress,
|
|
72883
73180
|
defaultSourceSymbol,
|
|
73181
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
72884
73182
|
depositConfirmationMode,
|
|
72885
73183
|
onExecutionsChange: setDepositExecutions,
|
|
72886
73184
|
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
@@ -72965,7 +73263,8 @@ function DepositModal({
|
|
|
72965
73263
|
wallets,
|
|
72966
73264
|
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
72967
73265
|
hideDepositFlowInfo,
|
|
72968
|
-
hideDisplayDescription
|
|
73266
|
+
hideDisplayDescription,
|
|
73267
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd
|
|
72969
73268
|
}
|
|
72970
73269
|
),
|
|
72971
73270
|
depositPoweredByFooter
|
|
@@ -73030,7 +73329,8 @@ function DepositModal({
|
|
|
73030
73329
|
defaultSourceChainType,
|
|
73031
73330
|
defaultSourceChainId,
|
|
73032
73331
|
defaultSourceTokenAddress,
|
|
73033
|
-
defaultSourceSymbol
|
|
73332
|
+
defaultSourceSymbol,
|
|
73333
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd
|
|
73034
73334
|
}
|
|
73035
73335
|
),
|
|
73036
73336
|
depositPoweredByFooter
|
|
@@ -73062,6 +73362,7 @@ function DepositModal({
|
|
|
73062
73362
|
onDepositSuccess: onDepositSuccessFor("wallet_connect"),
|
|
73063
73363
|
onDepositError: onDepositErrorFor("wallet_connect"),
|
|
73064
73364
|
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
73365
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
73065
73366
|
onWalletDisconnect: handleWalletDisconnect,
|
|
73066
73367
|
onWalletConnected: (info, dw) => {
|
|
73067
73368
|
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
@@ -73110,7 +73411,8 @@ function DepositModal({
|
|
|
73110
73411
|
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
73111
73412
|
onEvent,
|
|
73112
73413
|
onDepositSuccess,
|
|
73113
|
-
onDepositError
|
|
73414
|
+
onDepositError,
|
|
73415
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd
|
|
73114
73416
|
}
|
|
73115
73417
|
),
|
|
73116
73418
|
depositPoweredByFooter
|
|
@@ -73122,7 +73424,7 @@ function DepositModal({
|
|
|
73122
73424
|
title: "Deposit with Link",
|
|
73123
73425
|
showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
|
|
73124
73426
|
onBack: handleBack,
|
|
73125
|
-
showClose: stripeLinkStep !== "checkout",
|
|
73427
|
+
showClose: stripeLinkStep !== "checkout" && stripeLinkStep !== "auth",
|
|
73126
73428
|
onClose: handleClose
|
|
73127
73429
|
}
|
|
73128
73430
|
),
|
|
@@ -73153,6 +73455,8 @@ function DepositModal({
|
|
|
73153
73455
|
destinationChainType,
|
|
73154
73456
|
destinationChainId,
|
|
73155
73457
|
destinationTokenAddress,
|
|
73458
|
+
countryCode: userIpInfo?.alpha2,
|
|
73459
|
+
subdivisionCode: userIpInfo?.subdivisionCode ?? void 0,
|
|
73156
73460
|
wallets,
|
|
73157
73461
|
email: userEmail,
|
|
73158
73462
|
iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
|
|
@@ -73192,6 +73496,7 @@ function DepositModal({
|
|
|
73192
73496
|
onEvent,
|
|
73193
73497
|
onDepositSuccess: onDepositSuccessFor("cashapp"),
|
|
73194
73498
|
onDepositError: onDepositErrorFor("cashapp"),
|
|
73499
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
73195
73500
|
wallets
|
|
73196
73501
|
}
|
|
73197
73502
|
),
|
|
@@ -73891,7 +74196,7 @@ function CheckoutModal({
|
|
|
73891
74196
|
userId: paymentIntent.user_id || "",
|
|
73892
74197
|
publishableKey,
|
|
73893
74198
|
clientSecret,
|
|
73894
|
-
|
|
74199
|
+
prefilledAmountUsd: remainingAmountUsd,
|
|
73895
74200
|
checkoutAmountUsd: paymentIntent.amount_usd,
|
|
73896
74201
|
checkoutReceivedUsd: paymentIntent.amount_received_usd,
|
|
73897
74202
|
checkoutDestination: {
|
|
@@ -76254,6 +76559,7 @@ function UnifoldProvider2({
|
|
|
76254
76559
|
defaultSourceChainId: depositConfig.defaultSourceChainId,
|
|
76255
76560
|
defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
|
|
76256
76561
|
defaultSourceSymbol: depositConfig.defaultSourceSymbol,
|
|
76562
|
+
prefilledAmountUsd: depositConfig.prefilledAmountUsd,
|
|
76257
76563
|
userEmail: depositConfig.user?.email,
|
|
76258
76564
|
depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
|
|
76259
76565
|
hideDepositTracker: config?.hideDepositTracker,
|