@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.js
CHANGED
|
@@ -37116,6 +37116,7 @@ var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
|
|
|
37116
37116
|
var React211 = __toESM(require_react(), 1);
|
|
37117
37117
|
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
|
|
37118
37118
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
37119
|
+
var React522 = __toESM(require_react(), 1);
|
|
37119
37120
|
var import_react7 = __toESM(require_react(), 1);
|
|
37120
37121
|
var import_react8 = __toESM(require_react(), 1);
|
|
37121
37122
|
var import_react9 = __toESM(require_react(), 1);
|
|
@@ -37134,7 +37135,7 @@ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
|
|
|
37134
37135
|
var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
|
|
37135
37136
|
var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
|
|
37136
37137
|
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
|
|
37137
|
-
var
|
|
37138
|
+
var React622 = __toESM(require_react(), 1);
|
|
37138
37139
|
var import_react15 = __toESM(require_react(), 1);
|
|
37139
37140
|
var import_react16 = __toESM(require_react(), 1);
|
|
37140
37141
|
var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -37148,55 +37149,55 @@ var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
|
|
|
37148
37149
|
var import_react21 = __toESM(require_react(), 1);
|
|
37149
37150
|
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
|
|
37150
37151
|
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
|
|
37151
|
-
var React622 = __toESM(require_react(), 1);
|
|
37152
|
-
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
37153
37152
|
var React72 = __toESM(require_react(), 1);
|
|
37154
|
-
var
|
|
37153
|
+
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
37155
37154
|
var React82 = __toESM(require_react(), 1);
|
|
37155
|
+
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
|
|
37156
|
+
var React92 = __toESM(require_react(), 1);
|
|
37156
37157
|
var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
|
|
37158
|
+
var React112 = __toESM(require_react(), 1);
|
|
37157
37159
|
var React102 = __toESM(require_react(), 1);
|
|
37158
|
-
var React92 = __toESM(require_react(), 1);
|
|
37159
37160
|
var React25 = __toESM(require_react(), 1);
|
|
37160
37161
|
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
|
|
37161
37162
|
var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
|
|
37162
37163
|
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
|
|
37163
|
-
var React112 = __toESM(require_react(), 1);
|
|
37164
|
-
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
|
|
37165
37164
|
var React122 = __toESM(require_react(), 1);
|
|
37166
|
-
var
|
|
37165
|
+
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
|
|
37167
37166
|
var React132 = __toESM(require_react(), 1);
|
|
37168
|
-
var
|
|
37167
|
+
var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
|
|
37169
37168
|
var React142 = __toESM(require_react(), 1);
|
|
37170
|
-
var
|
|
37171
|
-
var React282 = __toESM(require_react(), 1);
|
|
37169
|
+
var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
|
|
37172
37170
|
var React152 = __toESM(require_react(), 1);
|
|
37171
|
+
var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
|
|
37172
|
+
var React292 = __toESM(require_react(), 1);
|
|
37173
37173
|
var React162 = __toESM(require_react(), 1);
|
|
37174
|
-
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
|
|
37175
37174
|
var React172 = __toESM(require_react(), 1);
|
|
37176
|
-
var
|
|
37175
|
+
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
|
|
37177
37176
|
var React182 = __toESM(require_react(), 1);
|
|
37178
|
-
var
|
|
37177
|
+
var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
|
|
37179
37178
|
var React192 = __toESM(require_react(), 1);
|
|
37180
|
-
var
|
|
37179
|
+
var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
|
|
37181
37180
|
var React202 = __toESM(require_react(), 1);
|
|
37182
|
-
var
|
|
37181
|
+
var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
|
|
37183
37182
|
var React212 = __toESM(require_react(), 1);
|
|
37184
|
-
var
|
|
37183
|
+
var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
|
|
37185
37184
|
var React2222 = __toESM(require_react(), 1);
|
|
37186
|
-
var
|
|
37185
|
+
var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
|
|
37187
37186
|
var React232 = __toESM(require_react(), 1);
|
|
37188
|
-
var
|
|
37187
|
+
var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
|
|
37189
37188
|
var React242 = __toESM(require_react(), 1);
|
|
37190
|
-
var
|
|
37189
|
+
var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
|
|
37191
37190
|
var React252 = __toESM(require_react(), 1);
|
|
37192
|
-
var
|
|
37191
|
+
var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
|
|
37193
37192
|
var React262 = __toESM(require_react(), 1);
|
|
37194
|
-
var
|
|
37193
|
+
var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
|
|
37195
37194
|
var React272 = __toESM(require_react(), 1);
|
|
37195
|
+
var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
|
|
37196
|
+
var React282 = __toESM(require_react(), 1);
|
|
37196
37197
|
var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
|
|
37197
37198
|
var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
|
|
37198
37199
|
var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
|
|
37199
|
-
var
|
|
37200
|
+
var React302 = __toESM(require_react(), 1);
|
|
37200
37201
|
var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
|
|
37201
37202
|
var import_react22 = __toESM(require_react(), 1);
|
|
37202
37203
|
var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -37206,7 +37207,7 @@ var import_react24 = __toESM(require_react(), 1);
|
|
|
37206
37207
|
var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
|
|
37207
37208
|
var import_react25 = __toESM(require_react(), 1);
|
|
37208
37209
|
var import_react26 = __toESM(require_react(), 1);
|
|
37209
|
-
var
|
|
37210
|
+
var React322 = __toESM(require_react(), 1);
|
|
37210
37211
|
var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
|
|
37211
37212
|
var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
|
|
37212
37213
|
var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -37216,7 +37217,7 @@ var import_react28 = __toESM(require_react(), 1);
|
|
|
37216
37217
|
var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
|
|
37217
37218
|
var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
|
|
37218
37219
|
var import_react29 = __toESM(require_react(), 1);
|
|
37219
|
-
var
|
|
37220
|
+
var React332 = __toESM(require_react(), 1);
|
|
37220
37221
|
var React31 = __toESM(require_react(), 1);
|
|
37221
37222
|
var React29 = __toESM(require_react(), 1);
|
|
37222
37223
|
var React26 = __toESM(require_react(), 1);
|
|
@@ -37233,7 +37234,7 @@ var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
|
|
|
37233
37234
|
var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
|
|
37234
37235
|
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
|
|
37235
37236
|
var import_react31 = __toESM(require_react(), 1);
|
|
37236
|
-
var
|
|
37237
|
+
var React342 = __toESM(require_react(), 1);
|
|
37237
37238
|
var React35 = __toESM(require_react(), 1);
|
|
37238
37239
|
var ReactDOM4 = __toESM(require_react_dom(), 1);
|
|
37239
37240
|
var import_react32 = __toESM(require_react(), 1);
|
|
@@ -37246,7 +37247,7 @@ var React34 = __toESM(require_react(), 1);
|
|
|
37246
37247
|
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
|
|
37247
37248
|
var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
|
|
37248
37249
|
var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
|
|
37249
|
-
var
|
|
37250
|
+
var React352 = __toESM(require_react(), 1);
|
|
37250
37251
|
var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
|
|
37251
37252
|
var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
|
|
37252
37253
|
var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -43458,6 +43459,27 @@ async function getFiatCurrencies(publishableKey) {
|
|
|
43458
43459
|
}
|
|
43459
43460
|
return response.json();
|
|
43460
43461
|
}
|
|
43462
|
+
async function getFiatExchangeRates(options2 = {}, publishableKey) {
|
|
43463
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43464
|
+
validatePublishableKey(pk);
|
|
43465
|
+
const params = new URLSearchParams();
|
|
43466
|
+
if (options2.currencies && options2.currencies.length > 0) {
|
|
43467
|
+
params.set("currencies", options2.currencies.join(","));
|
|
43468
|
+
}
|
|
43469
|
+
const queryString = params.toString();
|
|
43470
|
+
const url = `${API_BASE_URL}/v1/public/exchange_rates/fiat_currencies${queryString ? `?${queryString}` : ""}`;
|
|
43471
|
+
const response = await fetch(url, {
|
|
43472
|
+
method: "GET",
|
|
43473
|
+
headers: {
|
|
43474
|
+
accept: "application/json",
|
|
43475
|
+
"x-publishable-key": pk
|
|
43476
|
+
}
|
|
43477
|
+
});
|
|
43478
|
+
if (!response.ok) {
|
|
43479
|
+
throw new Error(`Failed to fetch fiat exchange rates: ${response.statusText}`);
|
|
43480
|
+
}
|
|
43481
|
+
return response.json();
|
|
43482
|
+
}
|
|
43461
43483
|
async function getOnrampQuotes(request, publishableKey) {
|
|
43462
43484
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43463
43485
|
validatePublishableKey(pk);
|
|
@@ -44122,6 +44144,7 @@ async function stripeGetDefaultToken(params, publishableKey) {
|
|
|
44122
44144
|
chain_type: params.chainType
|
|
44123
44145
|
});
|
|
44124
44146
|
if (params.countryCode) query.append("country_code", params.countryCode);
|
|
44147
|
+
if (params.subdivisionCode) query.append("subdivision_code", params.subdivisionCode);
|
|
44125
44148
|
const response = await fetch(
|
|
44126
44149
|
`${API_BASE_URL}${HEADLESS_STRIPE_BASE}/default_token?${query.toString()}`,
|
|
44127
44150
|
{
|
|
@@ -53175,13 +53198,25 @@ function BuyWithCard({
|
|
|
53175
53198
|
wallets: externalWallets,
|
|
53176
53199
|
assetCdnUrl,
|
|
53177
53200
|
hideDepositFlowInfo = false,
|
|
53178
|
-
hideDisplayDescription = false
|
|
53201
|
+
hideDisplayDescription = false,
|
|
53202
|
+
prefilledAmountUsd
|
|
53179
53203
|
}) {
|
|
53180
53204
|
const { colors: colors2, fonts, components } = useTheme();
|
|
53181
|
-
const
|
|
53205
|
+
const cleanedPrefilledAmountUsd = React522.useMemo(() => {
|
|
53206
|
+
if (!prefilledAmountUsd) return "";
|
|
53207
|
+
return prefilledAmountUsd.replace(/[^0-9.]/g, "");
|
|
53208
|
+
}, [prefilledAmountUsd]);
|
|
53209
|
+
const parsedPrefilledAmountUsd = React522.useMemo(() => {
|
|
53210
|
+
const parsed = parseFloat(cleanedPrefilledAmountUsd);
|
|
53211
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
53212
|
+
}, [cleanedPrefilledAmountUsd]);
|
|
53213
|
+
const shouldAutoConvertPrefilledRef = (0, import_react7.useRef)(!!cleanedPrefilledAmountUsd);
|
|
53214
|
+
const [amount, setAmount] = (0, import_react7.useState)(() => cleanedPrefilledAmountUsd);
|
|
53182
53215
|
const [currency, setCurrency] = (0, import_react7.useState)("usd");
|
|
53183
53216
|
const [hasManualCurrencySelection, setHasManualCurrencySelection] = (0, import_react7.useState)(false);
|
|
53184
|
-
const [hasManualAmountEntry, setHasManualAmountEntry] = (0, import_react7.useState)(
|
|
53217
|
+
const [hasManualAmountEntry, setHasManualAmountEntry] = (0, import_react7.useState)(
|
|
53218
|
+
() => !!cleanedPrefilledAmountUsd
|
|
53219
|
+
);
|
|
53185
53220
|
const [showCurrencyModal, setShowCurrencyModal] = (0, import_react7.useState)(false);
|
|
53186
53221
|
const [quotes, setQuotes] = (0, import_react7.useState)([]);
|
|
53187
53222
|
const [quotesLoading, setQuotesLoading] = (0, import_react7.useState)(false);
|
|
@@ -53238,6 +53273,71 @@ function BuyWithCard({
|
|
|
53238
53273
|
const [preferredCurrencyCodes, setPreferredCurrencyCodes] = (0, import_react7.useState)([]);
|
|
53239
53274
|
const [currenciesLoading, setCurrenciesLoading] = (0, import_react7.useState)(true);
|
|
53240
53275
|
const [destinationToken, setDestinationToken] = (0, import_react7.useState)(null);
|
|
53276
|
+
(0, import_react7.useEffect)(() => {
|
|
53277
|
+
const hasPrefilledAmount = !!cleanedPrefilledAmountUsd;
|
|
53278
|
+
shouldAutoConvertPrefilledRef.current = hasPrefilledAmount;
|
|
53279
|
+
if (!hasPrefilledAmount) return;
|
|
53280
|
+
setAmount(cleanedPrefilledAmountUsd);
|
|
53281
|
+
setHasManualAmountEntry(true);
|
|
53282
|
+
}, [cleanedPrefilledAmountUsd]);
|
|
53283
|
+
const { data: fiatExchangeRatesResponse, isLoading: isFiatExchangeRatesLoading } = useQuery({
|
|
53284
|
+
queryKey: ["fiat-exchange-rates", publishableKey],
|
|
53285
|
+
staleTime: 3e4,
|
|
53286
|
+
refetchInterval: 3e4,
|
|
53287
|
+
queryFn: async () => {
|
|
53288
|
+
try {
|
|
53289
|
+
return await getFiatExchangeRates({}, publishableKey);
|
|
53290
|
+
} catch (error) {
|
|
53291
|
+
console.error("Error fetching fiat exchange rates:", error);
|
|
53292
|
+
return { base_currency: "usd", rates: {} };
|
|
53293
|
+
}
|
|
53294
|
+
}
|
|
53295
|
+
});
|
|
53296
|
+
const fiatExchangeRates = fiatExchangeRatesResponse?.rates ?? {};
|
|
53297
|
+
const convertAmountBetweenCurrencies = React522.useCallback(
|
|
53298
|
+
(rawAmount, fromCurrencyCode, toCurrencyCode) => {
|
|
53299
|
+
const parsedAmount = parseFloat(rawAmount);
|
|
53300
|
+
if (!Number.isFinite(parsedAmount) || parsedAmount <= 0) return null;
|
|
53301
|
+
const fromCode = fromCurrencyCode.toLowerCase();
|
|
53302
|
+
const toCode = toCurrencyCode.toLowerCase();
|
|
53303
|
+
const fromRate = fromCode === "usd" ? 1 : fiatExchangeRates[fromCode];
|
|
53304
|
+
const toRate = toCode === "usd" ? 1 : fiatExchangeRates[toCode];
|
|
53305
|
+
if (!Number.isFinite(fromRate) || fromRate <= 0) return null;
|
|
53306
|
+
if (!Number.isFinite(toRate) || toRate <= 0) return null;
|
|
53307
|
+
const usdAmount = parsedAmount / fromRate;
|
|
53308
|
+
return parseFloat((usdAmount * toRate).toFixed(2)).toString();
|
|
53309
|
+
},
|
|
53310
|
+
[fiatExchangeRates]
|
|
53311
|
+
);
|
|
53312
|
+
const getConvertedPrefilledAmount = React522.useCallback(
|
|
53313
|
+
(targetCurrencyCode) => {
|
|
53314
|
+
if (!parsedPrefilledAmountUsd) return null;
|
|
53315
|
+
const normalizedTargetCurrency = targetCurrencyCode.toLowerCase();
|
|
53316
|
+
const rate = normalizedTargetCurrency === "usd" ? 1 : fiatExchangeRates[normalizedTargetCurrency];
|
|
53317
|
+
if (!Number.isFinite(rate) || rate <= 0) return null;
|
|
53318
|
+
return parseFloat((parsedPrefilledAmountUsd * rate).toFixed(2)).toString();
|
|
53319
|
+
},
|
|
53320
|
+
[parsedPrefilledAmountUsd, fiatExchangeRates]
|
|
53321
|
+
);
|
|
53322
|
+
(0, import_react7.useEffect)(() => {
|
|
53323
|
+
if (!cleanedPrefilledAmountUsd || !shouldAutoConvertPrefilledRef.current) return;
|
|
53324
|
+
const convertedAmount = getConvertedPrefilledAmount(currency);
|
|
53325
|
+
if (!convertedAmount) {
|
|
53326
|
+
if (isFiatExchangeRatesLoading) return;
|
|
53327
|
+
const targetCurrency = currency.toLowerCase();
|
|
53328
|
+
if (targetCurrency !== "usd") {
|
|
53329
|
+
setCurrency("usd");
|
|
53330
|
+
}
|
|
53331
|
+
return;
|
|
53332
|
+
}
|
|
53333
|
+
setAmount(convertedAmount);
|
|
53334
|
+
setHasManualAmountEntry(true);
|
|
53335
|
+
}, [
|
|
53336
|
+
cleanedPrefilledAmountUsd,
|
|
53337
|
+
currency,
|
|
53338
|
+
getConvertedPrefilledAmount,
|
|
53339
|
+
isFiatExchangeRatesLoading
|
|
53340
|
+
]);
|
|
53241
53341
|
const depositWalletId = defaultToken ? getWalletByChainType(wallets, defaultToken.destination_token_metadata.chain_type)?.id : void 0;
|
|
53242
53342
|
const { executions, isPolling, showWaitingUi } = useDepositPolling({
|
|
53243
53343
|
userId,
|
|
@@ -53268,6 +53368,7 @@ function BuyWithCard({
|
|
|
53268
53368
|
}, [publishableKey]);
|
|
53269
53369
|
(0, import_react7.useEffect)(() => {
|
|
53270
53370
|
if (hasManualCurrencySelection) return;
|
|
53371
|
+
if (hasManualAmountEntry && !shouldAutoConvertPrefilledRef.current) return;
|
|
53271
53372
|
if (fiatCurrencies.length === 0 || !userIpInfo?.alpha2) return;
|
|
53272
53373
|
const userCountryCode = userIpInfo.alpha2;
|
|
53273
53374
|
const matchingCurrency = fiatCurrencies.find((c) => c.country_codes.includes(userCountryCode));
|
|
@@ -53286,7 +53387,15 @@ function BuyWithCard({
|
|
|
53286
53387
|
const prevCurrencyRef = (0, import_react7.useRef)(null);
|
|
53287
53388
|
(0, import_react7.useEffect)(() => {
|
|
53288
53389
|
if (fiatCurrencies.length === 0) return;
|
|
53390
|
+
if (shouldAutoConvertPrefilledRef.current) {
|
|
53391
|
+
prevCurrencyRef.current = currency;
|
|
53392
|
+
return;
|
|
53393
|
+
}
|
|
53289
53394
|
if (prevCurrencyRef.current !== null && prevCurrencyRef.current !== currency) {
|
|
53395
|
+
if (hasManualAmountEntry) {
|
|
53396
|
+
prevCurrencyRef.current = currency;
|
|
53397
|
+
return;
|
|
53398
|
+
}
|
|
53290
53399
|
const currentCurrency = fiatCurrencies.find(
|
|
53291
53400
|
(c) => c.currency_code.toLowerCase() === currency.toLowerCase()
|
|
53292
53401
|
);
|
|
@@ -53295,7 +53404,7 @@ function BuyWithCard({
|
|
|
53295
53404
|
}
|
|
53296
53405
|
}
|
|
53297
53406
|
prevCurrencyRef.current = currency;
|
|
53298
|
-
}, [currency]);
|
|
53407
|
+
}, [currency, fiatCurrencies, hasManualAmountEntry]);
|
|
53299
53408
|
(0, import_react7.useEffect)(() => {
|
|
53300
53409
|
async function fetchDestinationToken() {
|
|
53301
53410
|
try {
|
|
@@ -53472,6 +53581,7 @@ function BuyWithCard({
|
|
|
53472
53581
|
return () => clearInterval(timer);
|
|
53473
53582
|
}, [quotes.length, amount]);
|
|
53474
53583
|
const handleAmountChange = (value) => {
|
|
53584
|
+
shouldAutoConvertPrefilledRef.current = false;
|
|
53475
53585
|
if (value === "") {
|
|
53476
53586
|
setAmount(value);
|
|
53477
53587
|
setHasManualAmountEntry(true);
|
|
@@ -53485,6 +53595,7 @@ function BuyWithCard({
|
|
|
53485
53595
|
}
|
|
53486
53596
|
};
|
|
53487
53597
|
const handleQuickAmount = (quickAmount) => {
|
|
53598
|
+
shouldAutoConvertPrefilledRef.current = false;
|
|
53488
53599
|
setAmount(quickAmount.toString());
|
|
53489
53600
|
setHasManualAmountEntry(true);
|
|
53490
53601
|
};
|
|
@@ -54088,8 +54199,43 @@ function BuyWithCard({
|
|
|
54088
54199
|
preferredCurrencyCodes,
|
|
54089
54200
|
selectedCurrency: currency,
|
|
54090
54201
|
onSelectCurrency: (currencyCode) => {
|
|
54091
|
-
|
|
54202
|
+
const nextCurrency = currencyCode.toLowerCase();
|
|
54203
|
+
if (nextCurrency === currency.toLowerCase()) {
|
|
54204
|
+
setHasManualCurrencySelection(true);
|
|
54205
|
+
return;
|
|
54206
|
+
}
|
|
54207
|
+
const currentCurrency = currency;
|
|
54092
54208
|
setHasManualCurrencySelection(true);
|
|
54209
|
+
if (shouldAutoConvertPrefilledRef.current) {
|
|
54210
|
+
const convertedAmount = getConvertedPrefilledAmount(nextCurrency);
|
|
54211
|
+
if (convertedAmount) {
|
|
54212
|
+
setCurrency(nextCurrency);
|
|
54213
|
+
setAmount(convertedAmount);
|
|
54214
|
+
setHasManualAmountEntry(true);
|
|
54215
|
+
} else {
|
|
54216
|
+
if (isFiatExchangeRatesLoading) return;
|
|
54217
|
+
const fallbackUsdAmount = getConvertedPrefilledAmount("usd");
|
|
54218
|
+
setCurrency("usd");
|
|
54219
|
+
if (fallbackUsdAmount) {
|
|
54220
|
+
setAmount(fallbackUsdAmount);
|
|
54221
|
+
setHasManualAmountEntry(true);
|
|
54222
|
+
}
|
|
54223
|
+
}
|
|
54224
|
+
return;
|
|
54225
|
+
}
|
|
54226
|
+
if (hasManualAmountEntry && amount) {
|
|
54227
|
+
const convertedAmount = convertAmountBetweenCurrencies(
|
|
54228
|
+
amount,
|
|
54229
|
+
currentCurrency,
|
|
54230
|
+
nextCurrency
|
|
54231
|
+
);
|
|
54232
|
+
if (convertedAmount) {
|
|
54233
|
+
setCurrency(nextCurrency);
|
|
54234
|
+
setAmount(convertedAmount);
|
|
54235
|
+
}
|
|
54236
|
+
return;
|
|
54237
|
+
}
|
|
54238
|
+
setCurrency(nextCurrency);
|
|
54093
54239
|
},
|
|
54094
54240
|
themeClass
|
|
54095
54241
|
}
|
|
@@ -54334,7 +54480,7 @@ function parseCoinbasePostMessage(raw) {
|
|
|
54334
54480
|
} : void 0
|
|
54335
54481
|
};
|
|
54336
54482
|
}
|
|
54337
|
-
var BuyWithApplePay =
|
|
54483
|
+
var BuyWithApplePay = React622.forwardRef(
|
|
54338
54484
|
function BuyWithApplePay2({
|
|
54339
54485
|
userId,
|
|
54340
54486
|
publishableKey,
|
|
@@ -54493,7 +54639,7 @@ var BuyWithApplePay = React522.forwardRef(
|
|
|
54493
54639
|
popupRef.current = null;
|
|
54494
54640
|
};
|
|
54495
54641
|
}, []);
|
|
54496
|
-
|
|
54642
|
+
React622.useImperativeHandle(
|
|
54497
54643
|
ref,
|
|
54498
54644
|
() => ({
|
|
54499
54645
|
requestBack: () => {
|
|
@@ -55803,7 +55949,7 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
55803
55949
|
children: [
|
|
55804
55950
|
"By continuing, you agree to Coinbase's",
|
|
55805
55951
|
" ",
|
|
55806
|
-
agreements.map((a, idx, arr) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
55952
|
+
agreements.map((a, idx, arr) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(React622.Fragment, { children: [
|
|
55807
55953
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
55808
55954
|
"a",
|
|
55809
55955
|
{
|
|
@@ -56232,6 +56378,7 @@ var POLL_INTERVAL_MS2 = 5e3;
|
|
|
56232
56378
|
var FALLBACK_MIN_USD = 5;
|
|
56233
56379
|
var SUGGESTED_AMOUNTS = [25, 50, 100];
|
|
56234
56380
|
var t3 = i18n2.depositModal.cashApp;
|
|
56381
|
+
var sanitizePrefilledUsd = (value) => value?.replace(/[^0-9.]/g, "") ?? "";
|
|
56235
56382
|
function PayWithCashApp({
|
|
56236
56383
|
userId,
|
|
56237
56384
|
publishableKey,
|
|
@@ -56246,6 +56393,7 @@ function PayWithCashApp({
|
|
|
56246
56393
|
onEvent,
|
|
56247
56394
|
onDepositSuccess,
|
|
56248
56395
|
onDepositError,
|
|
56396
|
+
prefilledAmountUsd,
|
|
56249
56397
|
wallets = []
|
|
56250
56398
|
}) {
|
|
56251
56399
|
const { colors: colors2, fonts, components } = useTheme();
|
|
@@ -56261,7 +56409,7 @@ function PayWithCashApp({
|
|
|
56261
56409
|
const { data: limits, isLoading: limitsLoading } = useCashAppLimits({ publishableKey });
|
|
56262
56410
|
const minUsd = limits?.minimum_amount ?? FALLBACK_MIN_USD;
|
|
56263
56411
|
const maxUsd = limits?.maximum_amount ?? null;
|
|
56264
|
-
const [amount, setAmount] = (0, import_react18.useState)(
|
|
56412
|
+
const [amount, setAmount] = (0, import_react18.useState)(() => sanitizePrefilledUsd(prefilledAmountUsd));
|
|
56265
56413
|
const [loading, setLoading] = (0, import_react18.useState)(false);
|
|
56266
56414
|
const [session, setSession] = (0, import_react18.useState)(null);
|
|
56267
56415
|
const [status, setStatus] = (0, import_react18.useState)("pending");
|
|
@@ -56384,6 +56532,13 @@ function PayWithCashApp({
|
|
|
56384
56532
|
return () => clearInterval(interval);
|
|
56385
56533
|
}, [session, view, status, publishableKey, onDepositSuccess, onDepositError]);
|
|
56386
56534
|
const [softExpired, setSoftExpired] = (0, import_react18.useState)(false);
|
|
56535
|
+
(0, import_react18.useEffect)(() => {
|
|
56536
|
+
if (!prefilledAmountUsd) return;
|
|
56537
|
+
const cleaned = sanitizePrefilledUsd(prefilledAmountUsd);
|
|
56538
|
+
if (!cleaned) return;
|
|
56539
|
+
setAmount(cleaned);
|
|
56540
|
+
onAmountChange?.(cleaned);
|
|
56541
|
+
}, [prefilledAmountUsd, onAmountChange]);
|
|
56387
56542
|
(0, import_react18.useEffect)(() => {
|
|
56388
56543
|
if (!session?.expires_at || view !== "payment") return;
|
|
56389
56544
|
const expiresMs = new Date(session.expires_at).getTime();
|
|
@@ -56776,7 +56931,8 @@ function BankTransfer({
|
|
|
56776
56931
|
assetCdnUrl,
|
|
56777
56932
|
onDepositSuccess,
|
|
56778
56933
|
onEvent,
|
|
56779
|
-
onDepositError
|
|
56934
|
+
onDepositError,
|
|
56935
|
+
prefilledAmountUsd
|
|
56780
56936
|
}) {
|
|
56781
56937
|
const { colors: colors2, fonts, components } = useTheme();
|
|
56782
56938
|
const [internalView, setInternalView] = (0, import_react21.useState)("providers");
|
|
@@ -56786,6 +56942,10 @@ function BankTransfer({
|
|
|
56786
56942
|
const [requestBase, setRequestBase] = (0, import_react21.useState)(null);
|
|
56787
56943
|
const [activeRequest, setActiveRequest] = (0, import_react21.useState)(null);
|
|
56788
56944
|
const [amount, setAmount] = (0, import_react21.useState)("");
|
|
56945
|
+
const [fiatExchangeRates, setFiatExchangeRates] = (0, import_react21.useState)({
|
|
56946
|
+
usd: 1
|
|
56947
|
+
});
|
|
56948
|
+
const providerSelectionRequestIdRef = (0, import_react21.useRef)(0);
|
|
56789
56949
|
const currentView = externalView ?? internalView;
|
|
56790
56950
|
const setView = (v) => {
|
|
56791
56951
|
setInternalView(v);
|
|
@@ -56835,7 +56995,38 @@ function BankTransfer({
|
|
|
56835
56995
|
() => destinationTokenSymbol?.toUpperCase() ?? defaultToken?.destination_token_metadata?.symbol?.toUpperCase() ?? defaultToken?.destination_currency?.toUpperCase() ?? "USDC",
|
|
56836
56996
|
[destinationTokenSymbol, defaultToken]
|
|
56837
56997
|
);
|
|
56838
|
-
const
|
|
56998
|
+
const resolvePrefilledSourceAmount = (0, import_react21.useCallback)(
|
|
56999
|
+
async (sourceCurrencyCode) => {
|
|
57000
|
+
const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
57001
|
+
if (!cleanedPrefilled) return "";
|
|
57002
|
+
const prefilledUsd = parseFloat(cleanedPrefilled);
|
|
57003
|
+
if (!Number.isFinite(prefilledUsd) || prefilledUsd <= 0) return "";
|
|
57004
|
+
const sourceCurrency2 = sourceCurrencyCode.toLowerCase();
|
|
57005
|
+
let rate = sourceCurrency2 === "usd" ? 1 : fiatExchangeRates[sourceCurrency2];
|
|
57006
|
+
if ((!rate || rate <= 0) && sourceCurrency2 !== "usd") {
|
|
57007
|
+
try {
|
|
57008
|
+
const response = await getFiatExchangeRates({}, publishableKey);
|
|
57009
|
+
if (response?.rates) {
|
|
57010
|
+
setFiatExchangeRates((prev) => ({
|
|
57011
|
+
...prev,
|
|
57012
|
+
...response.rates,
|
|
57013
|
+
usd: 1
|
|
57014
|
+
}));
|
|
57015
|
+
}
|
|
57016
|
+
const fetchedRate = response.rates?.[sourceCurrency2];
|
|
57017
|
+
if (Number.isFinite(fetchedRate) && fetchedRate > 0) {
|
|
57018
|
+
rate = fetchedRate;
|
|
57019
|
+
}
|
|
57020
|
+
} catch (error) {
|
|
57021
|
+
console.error("Error fetching fiat exchange rates for bank transfer:", error);
|
|
57022
|
+
}
|
|
57023
|
+
}
|
|
57024
|
+
if (!rate || rate <= 0) return sourceCurrency2 === "usd" ? cleanedPrefilled : "";
|
|
57025
|
+
return parseFloat((prefilledUsd * rate).toFixed(2)).toString();
|
|
57026
|
+
},
|
|
57027
|
+
[fiatExchangeRates, prefilledAmountUsd, publishableKey]
|
|
57028
|
+
);
|
|
57029
|
+
const handleProviderClick = async (provider) => {
|
|
56839
57030
|
if (!provider.enabled) return;
|
|
56840
57031
|
setSessionError(null);
|
|
56841
57032
|
if (!defaultToken) {
|
|
@@ -56854,6 +57045,7 @@ function BankTransfer({
|
|
|
56854
57045
|
});
|
|
56855
57046
|
return;
|
|
56856
57047
|
}
|
|
57048
|
+
const requestId = ++providerSelectionRequestIdRef.current;
|
|
56857
57049
|
setRequestBase({
|
|
56858
57050
|
service_provider: provider.service_provider,
|
|
56859
57051
|
country_code: (userIpInfo?.alpha2 || "DE").toUpperCase(),
|
|
@@ -56867,7 +57059,10 @@ function BankTransfer({
|
|
|
56867
57059
|
payment_method: provider.payment_methods[0]
|
|
56868
57060
|
});
|
|
56869
57061
|
setActiveProvider(provider);
|
|
56870
|
-
|
|
57062
|
+
const convertedPrefilled = await resolvePrefilledSourceAmount(provider.source_currency);
|
|
57063
|
+
if (requestId !== providerSelectionRequestIdRef.current) return;
|
|
57064
|
+
const hasPrefilledAmount = !!prefilledAmountUsd?.replace(/[^0-9.]/g, "");
|
|
57065
|
+
setAmount(hasPrefilledAmount ? convertedPrefilled : "100");
|
|
56871
57066
|
setView("amount");
|
|
56872
57067
|
};
|
|
56873
57068
|
const handleAmountChange = (value) => {
|
|
@@ -56965,7 +57160,7 @@ function BankTransfer({
|
|
|
56965
57160
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
56966
57161
|
"button",
|
|
56967
57162
|
{
|
|
56968
|
-
onClick: () => handleProviderClick(provider),
|
|
57163
|
+
onClick: () => void handleProviderClick(provider),
|
|
56969
57164
|
onMouseEnter: () => !disabled && setHoveredId(provider.service_provider),
|
|
56970
57165
|
onMouseLeave: () => setHoveredId(null),
|
|
56971
57166
|
disabled,
|
|
@@ -57534,9 +57729,9 @@ function TransferCryptoButton({
|
|
|
57534
57729
|
featuredTokens
|
|
57535
57730
|
}) {
|
|
57536
57731
|
const { colors: colors2, fonts, components } = useTheme();
|
|
57537
|
-
const [isHovered, setIsHovered] =
|
|
57538
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
57539
|
-
|
|
57732
|
+
const [isHovered, setIsHovered] = React72.useState(false);
|
|
57733
|
+
const [isTouchDevice, setIsTouchDevice] = React72.useState(false);
|
|
57734
|
+
React72.useEffect(() => {
|
|
57540
57735
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
57541
57736
|
}, []);
|
|
57542
57737
|
const sortedTokens = featuredTokens ? [...featuredTokens].sort((a, b) => a.position - b.position) : [];
|
|
@@ -57616,9 +57811,9 @@ function DepositWithCardButton({
|
|
|
57616
57811
|
paymentNetworks
|
|
57617
57812
|
}) {
|
|
57618
57813
|
const { colors: colors2, fonts, components } = useTheme();
|
|
57619
|
-
const [isHovered, setIsHovered] =
|
|
57620
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
57621
|
-
|
|
57814
|
+
const [isHovered, setIsHovered] = React82.useState(false);
|
|
57815
|
+
const [isTouchDevice, setIsTouchDevice] = React82.useState(false);
|
|
57816
|
+
React82.useEffect(() => {
|
|
57622
57817
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
57623
57818
|
}, []);
|
|
57624
57819
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
@@ -57697,9 +57892,9 @@ function PayWithExchangeButton({
|
|
|
57697
57892
|
loading = false
|
|
57698
57893
|
}) {
|
|
57699
57894
|
const { colors: colors2, fonts, components } = useTheme();
|
|
57700
|
-
const [isHovered, setIsHovered] =
|
|
57701
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
57702
|
-
|
|
57895
|
+
const [isHovered, setIsHovered] = React92.useState(false);
|
|
57896
|
+
const [isTouchDevice, setIsTouchDevice] = React92.useState(false);
|
|
57897
|
+
React92.useEffect(() => {
|
|
57703
57898
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
57704
57899
|
}, []);
|
|
57705
57900
|
if (loading) {
|
|
@@ -57801,11 +57996,11 @@ var buttonVariants = cva(
|
|
|
57801
57996
|
}
|
|
57802
57997
|
}
|
|
57803
57998
|
);
|
|
57804
|
-
var Button =
|
|
57999
|
+
var Button = React102.forwardRef(
|
|
57805
58000
|
({ className, variant, size: size4, asChild = false, style, ...props }, ref) => {
|
|
57806
58001
|
const Comp = asChild ? Slot2 : "button";
|
|
57807
58002
|
const { components, fonts } = useTheme();
|
|
57808
|
-
const themeStyle =
|
|
58003
|
+
const themeStyle = React102.useMemo(() => {
|
|
57809
58004
|
const baseStyle = { ...style };
|
|
57810
58005
|
if (variant === "default" || !variant) {
|
|
57811
58006
|
baseStyle.backgroundColor = components.button.primaryBackground;
|
|
@@ -57840,9 +58035,9 @@ function ConnectExchangeButton({
|
|
|
57840
58035
|
connectedExchange
|
|
57841
58036
|
}) {
|
|
57842
58037
|
const { colors: colors2, fonts, components } = useTheme();
|
|
57843
|
-
const [isHovered, setIsHovered] =
|
|
57844
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
57845
|
-
|
|
58038
|
+
const [isHovered, setIsHovered] = React112.useState(false);
|
|
58039
|
+
const [isTouchDevice, setIsTouchDevice] = React112.useState(false);
|
|
58040
|
+
React112.useEffect(() => {
|
|
57846
58041
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
57847
58042
|
}, []);
|
|
57848
58043
|
const isConnected = connectedExchange != null;
|
|
@@ -57987,9 +58182,9 @@ function DepositTrackerButton({
|
|
|
57987
58182
|
badge
|
|
57988
58183
|
}) {
|
|
57989
58184
|
const { colors: colors2, fonts, components } = useTheme();
|
|
57990
|
-
const [isHovered, setIsHovered] =
|
|
57991
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
57992
|
-
|
|
58185
|
+
const [isHovered, setIsHovered] = React122.useState(false);
|
|
58186
|
+
const [isTouchDevice, setIsTouchDevice] = React122.useState(false);
|
|
58187
|
+
React122.useEffect(() => {
|
|
57993
58188
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
57994
58189
|
}, []);
|
|
57995
58190
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
@@ -58060,9 +58255,9 @@ function DepositTrackerButton({
|
|
|
58060
58255
|
}
|
|
58061
58256
|
function CashAppButton({ onClick, title, subtitle, iconUrl }) {
|
|
58062
58257
|
const { colors: colors2, fonts, components } = useTheme();
|
|
58063
|
-
const [isHovered, setIsHovered] =
|
|
58064
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
58065
|
-
|
|
58258
|
+
const [isHovered, setIsHovered] = React132.useState(false);
|
|
58259
|
+
const [isTouchDevice, setIsTouchDevice] = React132.useState(false);
|
|
58260
|
+
React132.useEffect(() => {
|
|
58066
58261
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
58067
58262
|
}, []);
|
|
58068
58263
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
@@ -58146,9 +58341,9 @@ function AppleLogo({ className, style }) {
|
|
|
58146
58341
|
}
|
|
58147
58342
|
function ApplePayButton({ onClick, title, subtitle }) {
|
|
58148
58343
|
const { colors: colors2, fonts, components } = useTheme();
|
|
58149
|
-
const [isHovered, setIsHovered] =
|
|
58150
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
58151
|
-
|
|
58344
|
+
const [isHovered, setIsHovered] = React142.useState(false);
|
|
58345
|
+
const [isTouchDevice, setIsTouchDevice] = React142.useState(false);
|
|
58346
|
+
React142.useEffect(() => {
|
|
58152
58347
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
58153
58348
|
}, []);
|
|
58154
58349
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
@@ -58210,9 +58405,9 @@ function BankTransferButton({
|
|
|
58210
58405
|
comingSoon = false
|
|
58211
58406
|
}) {
|
|
58212
58407
|
const { colors: colors2, fonts, components } = useTheme();
|
|
58213
|
-
const [isHovered, setIsHovered] =
|
|
58214
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
58215
|
-
|
|
58408
|
+
const [isHovered, setIsHovered] = React152.useState(false);
|
|
58409
|
+
const [isTouchDevice, setIsTouchDevice] = React152.useState(false);
|
|
58410
|
+
React152.useEffect(() => {
|
|
58216
58411
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
58217
58412
|
}, []);
|
|
58218
58413
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
@@ -58461,18 +58656,18 @@ async function detectConnectedBrowserWallet(chainType) {
|
|
|
58461
58656
|
}
|
|
58462
58657
|
function useDetectedBrowserWallet(opts = {}) {
|
|
58463
58658
|
const { chainType, enabled = true, onDisconnect } = opts;
|
|
58464
|
-
const [wallet, setWallet] =
|
|
58465
|
-
const [isLoading, setIsLoading] =
|
|
58466
|
-
const [eip6963ProviderCount, setEip6963ProviderCount] =
|
|
58467
|
-
const onDisconnectRef =
|
|
58659
|
+
const [wallet, setWallet] = React162.useState(null);
|
|
58660
|
+
const [isLoading, setIsLoading] = React162.useState(enabled);
|
|
58661
|
+
const [eip6963ProviderCount, setEip6963ProviderCount] = React162.useState(0);
|
|
58662
|
+
const onDisconnectRef = React162.useRef(onDisconnect);
|
|
58468
58663
|
onDisconnectRef.current = onDisconnect;
|
|
58469
|
-
|
|
58664
|
+
React162.useEffect(() => {
|
|
58470
58665
|
const store = getEip6963Store();
|
|
58471
58666
|
if (!store) return;
|
|
58472
58667
|
setEip6963ProviderCount(store.getProviders().length);
|
|
58473
58668
|
return store.subscribe((providers) => setEip6963ProviderCount(providers.length));
|
|
58474
58669
|
}, []);
|
|
58475
|
-
|
|
58670
|
+
React162.useEffect(() => {
|
|
58476
58671
|
if (!enabled) {
|
|
58477
58672
|
setWallet(null);
|
|
58478
58673
|
setIsLoading(false);
|
|
@@ -58613,7 +58808,7 @@ async function disconnectInjectedBrowserWallet(wallet) {
|
|
|
58613
58808
|
);
|
|
58614
58809
|
}
|
|
58615
58810
|
function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
58616
|
-
const id =
|
|
58811
|
+
const id = React172.useId();
|
|
58617
58812
|
if (variant === "light" || variant === "dark") {
|
|
58618
58813
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
58619
58814
|
"svg",
|
|
@@ -58734,7 +58929,7 @@ function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
58734
58929
|
);
|
|
58735
58930
|
}
|
|
58736
58931
|
function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
58737
|
-
const id =
|
|
58932
|
+
const id = React182.useId();
|
|
58738
58933
|
if (variant === "light") {
|
|
58739
58934
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
58740
58935
|
"svg",
|
|
@@ -58801,7 +58996,7 @@ function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
58801
58996
|
);
|
|
58802
58997
|
}
|
|
58803
58998
|
function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
58804
|
-
const id =
|
|
58999
|
+
const id = React192.useId();
|
|
58805
59000
|
if (variant === "light") {
|
|
58806
59001
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
58807
59002
|
"svg",
|
|
@@ -58881,7 +59076,7 @@ function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
58881
59076
|
);
|
|
58882
59077
|
}
|
|
58883
59078
|
function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
58884
|
-
const id =
|
|
59079
|
+
const id = React202.useId();
|
|
58885
59080
|
if (variant === "light") {
|
|
58886
59081
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
58887
59082
|
"svg",
|
|
@@ -59228,7 +59423,7 @@ function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59228
59423
|
);
|
|
59229
59424
|
}
|
|
59230
59425
|
function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59231
|
-
const id =
|
|
59426
|
+
const id = React212.useId();
|
|
59232
59427
|
if (variant === "light") {
|
|
59233
59428
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
59234
59429
|
"svg",
|
|
@@ -59642,7 +59837,7 @@ function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59642
59837
|
);
|
|
59643
59838
|
}
|
|
59644
59839
|
function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59645
|
-
const id =
|
|
59840
|
+
const id = React2222.useId();
|
|
59646
59841
|
if (variant === "light") {
|
|
59647
59842
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
59648
59843
|
"svg",
|
|
@@ -59725,7 +59920,7 @@ function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59725
59920
|
);
|
|
59726
59921
|
}
|
|
59727
59922
|
function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59728
|
-
const id =
|
|
59923
|
+
const id = React232.useId();
|
|
59729
59924
|
if (variant === "light") {
|
|
59730
59925
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
59731
59926
|
"svg",
|
|
@@ -59780,7 +59975,7 @@ function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59780
59975
|
);
|
|
59781
59976
|
}
|
|
59782
59977
|
function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59783
|
-
const id =
|
|
59978
|
+
const id = React242.useId();
|
|
59784
59979
|
if (variant === "light") {
|
|
59785
59980
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
59786
59981
|
"svg",
|
|
@@ -59881,7 +60076,7 @@ function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59881
60076
|
);
|
|
59882
60077
|
}
|
|
59883
60078
|
function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59884
|
-
const id =
|
|
60079
|
+
const id = React252.useId();
|
|
59885
60080
|
if (variant === "light") {
|
|
59886
60081
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
59887
60082
|
"svg",
|
|
@@ -59954,7 +60149,7 @@ function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
59954
60149
|
);
|
|
59955
60150
|
}
|
|
59956
60151
|
function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
59957
|
-
const id =
|
|
60152
|
+
const id = React262.useId();
|
|
59958
60153
|
if (variant === "light") {
|
|
59959
60154
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
59960
60155
|
"svg",
|
|
@@ -60021,7 +60216,7 @@ function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
60021
60216
|
);
|
|
60022
60217
|
}
|
|
60023
60218
|
function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
60024
|
-
const id =
|
|
60219
|
+
const id = React272.useId();
|
|
60025
60220
|
if (variant === "light") {
|
|
60026
60221
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
60027
60222
|
"svg",
|
|
@@ -60145,7 +60340,7 @@ function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
60145
60340
|
);
|
|
60146
60341
|
}
|
|
60147
60342
|
function SolanaIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
60148
|
-
const id =
|
|
60343
|
+
const id = React282.useId();
|
|
60149
60344
|
if (variant === "light") {
|
|
60150
60345
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
60151
60346
|
"svg",
|
|
@@ -60390,19 +60585,19 @@ function BrowserWalletButton({
|
|
|
60390
60585
|
subtitle = i18n2.depositModal.browserWallet.subtitle
|
|
60391
60586
|
}) {
|
|
60392
60587
|
const { colors: colors2, fonts, components } = useTheme();
|
|
60393
|
-
const [isHovered, setIsHovered] =
|
|
60394
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
60588
|
+
const [isHovered, setIsHovered] = React292.useState(false);
|
|
60589
|
+
const [isTouchDevice, setIsTouchDevice] = React292.useState(false);
|
|
60395
60590
|
const { wallet, isLoading, setWallet } = useDetectedBrowserWallet({ chainType, onDisconnect });
|
|
60396
|
-
const [isConnecting, setIsConnecting] =
|
|
60397
|
-
const [balanceText, setBalanceText] =
|
|
60398
|
-
const [isLoadingBalance, setIsLoadingBalance] =
|
|
60399
|
-
const [isDisconnecting, setIsDisconnecting] =
|
|
60400
|
-
const onDisconnectRef =
|
|
60591
|
+
const [isConnecting, setIsConnecting] = React292.useState(false);
|
|
60592
|
+
const [balanceText, setBalanceText] = React292.useState(null);
|
|
60593
|
+
const [isLoadingBalance, setIsLoadingBalance] = React292.useState(false);
|
|
60594
|
+
const [isDisconnecting, setIsDisconnecting] = React292.useState(false);
|
|
60595
|
+
const onDisconnectRef = React292.useRef(onDisconnect);
|
|
60401
60596
|
onDisconnectRef.current = onDisconnect;
|
|
60402
|
-
|
|
60597
|
+
React292.useEffect(() => {
|
|
60403
60598
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
60404
60599
|
}, []);
|
|
60405
|
-
|
|
60600
|
+
React292.useEffect(() => {
|
|
60406
60601
|
if (!wallet || !publishableKey) {
|
|
60407
60602
|
setBalanceText(null);
|
|
60408
60603
|
return;
|
|
@@ -60529,7 +60724,7 @@ function BrowserWalletButton({
|
|
|
60529
60724
|
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
60530
60725
|
};
|
|
60531
60726
|
const sortedWallets = featuredWallets ? [...featuredWallets].sort((a, b) => a.position - b.position) : [];
|
|
60532
|
-
const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ?
|
|
60727
|
+
const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ? React292.createElement(WALLET_ICON_COMPONENTS[wallet.icon], {
|
|
60533
60728
|
size: 36,
|
|
60534
60729
|
className: "uf-rounded-lg",
|
|
60535
60730
|
variant: "color"
|
|
@@ -60680,9 +60875,9 @@ function StripeLinkButton({
|
|
|
60680
60875
|
iconUrl
|
|
60681
60876
|
}) {
|
|
60682
60877
|
const { colors: colors2, fonts, components } = useTheme();
|
|
60683
|
-
const [isHovered, setIsHovered] =
|
|
60684
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
60685
|
-
|
|
60878
|
+
const [isHovered, setIsHovered] = React302.useState(false);
|
|
60879
|
+
const [isTouchDevice, setIsTouchDevice] = React302.useState(false);
|
|
60880
|
+
React302.useEffect(() => {
|
|
60686
60881
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
60687
60882
|
}, []);
|
|
60688
60883
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
@@ -61168,6 +61363,8 @@ function PayWithStripeLink({
|
|
|
61168
61363
|
destinationChainType,
|
|
61169
61364
|
destinationChainId,
|
|
61170
61365
|
destinationTokenAddress,
|
|
61366
|
+
countryCode,
|
|
61367
|
+
subdivisionCode,
|
|
61171
61368
|
wallets: externalWallets,
|
|
61172
61369
|
email: emailProp,
|
|
61173
61370
|
iconUrl,
|
|
@@ -61562,7 +61759,9 @@ function PayWithStripeLink({
|
|
|
61562
61759
|
{
|
|
61563
61760
|
tokenAddress: destinationTokenAddress,
|
|
61564
61761
|
chainId: destinationChainId,
|
|
61565
|
-
chainType: destinationChainType
|
|
61762
|
+
chainType: destinationChainType,
|
|
61763
|
+
countryCode,
|
|
61764
|
+
subdivisionCode
|
|
61566
61765
|
},
|
|
61567
61766
|
publishableKey
|
|
61568
61767
|
).then((token) => {
|
|
@@ -61581,7 +61780,14 @@ function PayWithStripeLink({
|
|
|
61581
61780
|
return () => {
|
|
61582
61781
|
cancelled = true;
|
|
61583
61782
|
};
|
|
61584
|
-
}, [
|
|
61783
|
+
}, [
|
|
61784
|
+
publishableKey,
|
|
61785
|
+
destinationTokenAddress,
|
|
61786
|
+
destinationChainId,
|
|
61787
|
+
destinationChainType,
|
|
61788
|
+
countryCode,
|
|
61789
|
+
subdivisionCode
|
|
61790
|
+
]);
|
|
61585
61791
|
const destinationCurrency = stripeDestCurrency;
|
|
61586
61792
|
const authInnerRef = (0, import_react22.useRef)(null);
|
|
61587
61793
|
const paymentInnerRef = (0, import_react22.useRef)(null);
|
|
@@ -64557,7 +64763,8 @@ function CoinbaseConnect({
|
|
|
64557
64763
|
defaultSourceChainType,
|
|
64558
64764
|
defaultSourceChainId,
|
|
64559
64765
|
defaultSourceTokenAddress,
|
|
64560
|
-
defaultSourceSymbol
|
|
64766
|
+
defaultSourceSymbol,
|
|
64767
|
+
prefilledAmountUsd
|
|
64561
64768
|
}) {
|
|
64562
64769
|
const { colors: colors2, fonts, components } = useTheme();
|
|
64563
64770
|
const { projectConfig } = useProjectConfig({ publishableKey });
|
|
@@ -64880,7 +65087,8 @@ function CoinbaseConnect({
|
|
|
64880
65087
|
};
|
|
64881
65088
|
const handleSelectAsset = (asset) => {
|
|
64882
65089
|
setSelectedAsset(asset);
|
|
64883
|
-
|
|
65090
|
+
const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
65091
|
+
setSendAmount(cleanedPrefilled);
|
|
64884
65092
|
transitionTo("enter_amount");
|
|
64885
65093
|
};
|
|
64886
65094
|
const handleCreateTransfer = async () => {
|
|
@@ -66591,7 +66799,7 @@ function ThemeStyleInjector({
|
|
|
66591
66799
|
className
|
|
66592
66800
|
}) {
|
|
66593
66801
|
const { colors: colors2, fonts, mode } = useTheme();
|
|
66594
|
-
const cssVars =
|
|
66802
|
+
const cssVars = React322.useMemo(() => {
|
|
66595
66803
|
const hexToHSL = (hex) => {
|
|
66596
66804
|
hex = hex.replace("#", "");
|
|
66597
66805
|
const r2 = parseInt(hex.slice(0, 2), 16) / 255;
|
|
@@ -66651,7 +66859,7 @@ function ThemeStyleInjector({
|
|
|
66651
66859
|
...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
|
|
66652
66860
|
};
|
|
66653
66861
|
}, [colors2, fonts.regular]);
|
|
66654
|
-
|
|
66862
|
+
React322.useEffect(() => {
|
|
66655
66863
|
if (typeof document === "undefined") return;
|
|
66656
66864
|
if (fonts.regular) {
|
|
66657
66865
|
document.documentElement.style.setProperty("--uf-font-family", fonts.regular);
|
|
@@ -67796,14 +68004,14 @@ function useCopyAddress() {
|
|
|
67796
68004
|
return { copied, handleCopy };
|
|
67797
68005
|
}
|
|
67798
68006
|
var TooltipProvider2 = Provider;
|
|
67799
|
-
var TooltipContext =
|
|
68007
|
+
var TooltipContext = React332.createContext({
|
|
67800
68008
|
open: false,
|
|
67801
68009
|
onOpenChange: () => {
|
|
67802
68010
|
}
|
|
67803
68011
|
});
|
|
67804
|
-
var TooltipTrigger2 =
|
|
67805
|
-
const { open, onOpenChange } =
|
|
67806
|
-
const handleClick =
|
|
68012
|
+
var TooltipTrigger2 = React332.forwardRef(({ onClick, ...props }, ref) => {
|
|
68013
|
+
const { open, onOpenChange } = React332.useContext(TooltipContext);
|
|
68014
|
+
const handleClick = React332.useCallback(
|
|
67807
68015
|
(e) => {
|
|
67808
68016
|
onOpenChange(!open);
|
|
67809
68017
|
onClick?.(e);
|
|
@@ -67813,7 +68021,7 @@ var TooltipTrigger2 = React322.forwardRef(({ onClick, ...props }, ref) => {
|
|
|
67813
68021
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Trigger, { ref, onClick: handleClick, ...props });
|
|
67814
68022
|
});
|
|
67815
68023
|
TooltipTrigger2.displayName = Trigger.displayName;
|
|
67816
|
-
var TooltipContent2 =
|
|
68024
|
+
var TooltipContent2 = React332.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
|
|
67817
68025
|
const { themeClass, colors: colors2 } = useTheme();
|
|
67818
68026
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Portal3, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
67819
68027
|
Content22,
|
|
@@ -67923,6 +68131,7 @@ function TransferCryptoSingleInput({
|
|
|
67923
68131
|
onDepositError,
|
|
67924
68132
|
wallets: externalWallets,
|
|
67925
68133
|
onSourceTokenChange,
|
|
68134
|
+
prefilledAmountUsd,
|
|
67926
68135
|
checkoutQuote,
|
|
67927
68136
|
isCheckoutQuoteLoading = false,
|
|
67928
68137
|
persistCheckingIndicator = false,
|
|
@@ -68066,6 +68275,22 @@ function TransferCryptoSingleInput({
|
|
|
68066
68275
|
const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
|
|
68067
68276
|
const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
|
|
68068
68277
|
const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
|
|
68278
|
+
const parsedPrefilledUsd = (0, import_react25.useMemo)(() => {
|
|
68279
|
+
const value = parseFloat(prefilledAmountUsd ?? "");
|
|
68280
|
+
return Number.isFinite(value) && value > 0 ? value : null;
|
|
68281
|
+
}, [prefilledAmountUsd]);
|
|
68282
|
+
const effectivePrefilledUsd = (0, import_react25.useMemo)(() => {
|
|
68283
|
+
if (parsedPrefilledUsd === null) return null;
|
|
68284
|
+
return Math.max(parsedPrefilledUsd, minDepositUsd);
|
|
68285
|
+
}, [parsedPrefilledUsd, minDepositUsd]);
|
|
68286
|
+
const prefillDisplay = (0, import_react25.useMemo)(() => {
|
|
68287
|
+
if (effectivePrefilledUsd === null) return null;
|
|
68288
|
+
const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
|
|
68289
|
+
if (selectedToken?.is_stablecoin) {
|
|
68290
|
+
return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
|
|
68291
|
+
}
|
|
68292
|
+
return `${usdLabel} USD`;
|
|
68293
|
+
}, [effectivePrefilledUsd, selectedToken]);
|
|
68069
68294
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(TooltipProvider2, { delayDuration: 0, skipDelayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
68070
68295
|
"div",
|
|
68071
68296
|
{
|
|
@@ -68192,7 +68417,7 @@ function TransferCryptoSingleInput({
|
|
|
68192
68417
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: "Retrying automatically every 5 seconds..." })
|
|
68193
68418
|
] })
|
|
68194
68419
|
] }),
|
|
68195
|
-
(checkoutQuote || isCheckoutQuoteLoading) && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
68420
|
+
(checkoutQuote || isCheckoutQuoteLoading || prefillDisplay) && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
68196
68421
|
"div",
|
|
68197
68422
|
{
|
|
68198
68423
|
className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
|
|
@@ -68236,6 +68461,13 @@ function TransferCryptoSingleInput({
|
|
|
68236
68461
|
)
|
|
68237
68462
|
]
|
|
68238
68463
|
}
|
|
68464
|
+
) : prefillDisplay ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
68465
|
+
"span",
|
|
68466
|
+
{
|
|
68467
|
+
className: "uf-text-sm uf-font-semibold",
|
|
68468
|
+
style: { color: components.card.titleColor, fontFamily: fonts.semibold },
|
|
68469
|
+
children: prefillDisplay
|
|
68470
|
+
}
|
|
68239
68471
|
) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
68240
68472
|
"div",
|
|
68241
68473
|
{
|
|
@@ -68565,7 +68797,7 @@ function TransferCryptoSingleInput({
|
|
|
68565
68797
|
}
|
|
68566
68798
|
var Select2 = Root23;
|
|
68567
68799
|
var SelectValue2 = Value;
|
|
68568
|
-
var SelectTrigger2 =
|
|
68800
|
+
var SelectTrigger2 = React342.forwardRef(({ className, style, children, ...props }, ref) => {
|
|
68569
68801
|
const { components } = useTheme();
|
|
68570
68802
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
68571
68803
|
Trigger2,
|
|
@@ -68589,7 +68821,7 @@ var SelectTrigger2 = React332.forwardRef(({ className, style, children, ...props
|
|
|
68589
68821
|
);
|
|
68590
68822
|
});
|
|
68591
68823
|
SelectTrigger2.displayName = Trigger2.displayName;
|
|
68592
|
-
var SelectScrollUpButton2 =
|
|
68824
|
+
var SelectScrollUpButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
68593
68825
|
ScrollUpButton,
|
|
68594
68826
|
{
|
|
68595
68827
|
ref,
|
|
@@ -68599,7 +68831,7 @@ var SelectScrollUpButton2 = React332.forwardRef(({ className, ...props }, ref) =
|
|
|
68599
68831
|
}
|
|
68600
68832
|
));
|
|
68601
68833
|
SelectScrollUpButton2.displayName = ScrollUpButton.displayName;
|
|
68602
|
-
var SelectScrollDownButton2 =
|
|
68834
|
+
var SelectScrollDownButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
68603
68835
|
ScrollDownButton,
|
|
68604
68836
|
{
|
|
68605
68837
|
ref,
|
|
@@ -68609,7 +68841,7 @@ var SelectScrollDownButton2 = React332.forwardRef(({ className, ...props }, ref)
|
|
|
68609
68841
|
}
|
|
68610
68842
|
));
|
|
68611
68843
|
SelectScrollDownButton2.displayName = ScrollDownButton.displayName;
|
|
68612
|
-
var SelectContent2 =
|
|
68844
|
+
var SelectContent2 = React342.forwardRef(({ className, style, children, position = "popper", ...props }, ref) => {
|
|
68613
68845
|
const { themeClass, colors: colors2, components } = useTheme();
|
|
68614
68846
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Portal4, { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
68615
68847
|
Content23,
|
|
@@ -68647,7 +68879,7 @@ var SelectContent2 = React332.forwardRef(({ className, style, children, position
|
|
|
68647
68879
|
) });
|
|
68648
68880
|
});
|
|
68649
68881
|
SelectContent2.displayName = Content23.displayName;
|
|
68650
|
-
var SelectLabel2 =
|
|
68882
|
+
var SelectLabel2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
68651
68883
|
Label,
|
|
68652
68884
|
{
|
|
68653
68885
|
ref,
|
|
@@ -68656,7 +68888,7 @@ var SelectLabel2 = React332.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
68656
68888
|
}
|
|
68657
68889
|
));
|
|
68658
68890
|
SelectLabel2.displayName = Label.displayName;
|
|
68659
|
-
var SelectItem2 =
|
|
68891
|
+
var SelectItem2 = React342.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
68660
68892
|
Item,
|
|
68661
68893
|
{
|
|
68662
68894
|
ref,
|
|
@@ -68672,7 +68904,7 @@ var SelectItem2 = React332.forwardRef(({ className, children, ...props }, ref) =
|
|
|
68672
68904
|
}
|
|
68673
68905
|
));
|
|
68674
68906
|
SelectItem2.displayName = Item.displayName;
|
|
68675
|
-
var SelectSeparator2 =
|
|
68907
|
+
var SelectSeparator2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
68676
68908
|
Separator,
|
|
68677
68909
|
{
|
|
68678
68910
|
ref,
|
|
@@ -68700,6 +68932,7 @@ function TransferCryptoDoubleInput({
|
|
|
68700
68932
|
defaultSourceChainId,
|
|
68701
68933
|
defaultSourceTokenAddress,
|
|
68702
68934
|
defaultSourceSymbol,
|
|
68935
|
+
prefilledAmountUsd,
|
|
68703
68936
|
depositConfirmationMode = "auto_ui",
|
|
68704
68937
|
onExecutionsChange,
|
|
68705
68938
|
onDepositSuccess,
|
|
@@ -68824,6 +69057,22 @@ function TransferCryptoDoubleInput({
|
|
|
68824
69057
|
const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
|
|
68825
69058
|
const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
|
|
68826
69059
|
const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
|
|
69060
|
+
const parsedPrefilledUsd = (0, import_react31.useMemo)(() => {
|
|
69061
|
+
const value = parseFloat(prefilledAmountUsd ?? "");
|
|
69062
|
+
return Number.isFinite(value) && value > 0 ? value : null;
|
|
69063
|
+
}, [prefilledAmountUsd]);
|
|
69064
|
+
const effectivePrefilledUsd = (0, import_react31.useMemo)(() => {
|
|
69065
|
+
if (parsedPrefilledUsd === null) return null;
|
|
69066
|
+
return Math.max(parsedPrefilledUsd, minDepositUsd);
|
|
69067
|
+
}, [parsedPrefilledUsd, minDepositUsd]);
|
|
69068
|
+
const prefillDisplay = (0, import_react31.useMemo)(() => {
|
|
69069
|
+
if (effectivePrefilledUsd === null) return null;
|
|
69070
|
+
const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
|
|
69071
|
+
if (selectedToken?.is_stablecoin) {
|
|
69072
|
+
return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
|
|
69073
|
+
}
|
|
69074
|
+
return `${usdLabel} USD`;
|
|
69075
|
+
}, [effectivePrefilledUsd, selectedToken]);
|
|
68827
69076
|
const renderTokenItem = (tokenData) => {
|
|
68828
69077
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
68829
69078
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
@@ -69004,6 +69253,35 @@ function TransferCryptoDoubleInput({
|
|
|
69004
69253
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { children: "Retrying automatically every 5 seconds..." })
|
|
69005
69254
|
] })
|
|
69006
69255
|
] }),
|
|
69256
|
+
prefillDisplay && /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
69257
|
+
"div",
|
|
69258
|
+
{
|
|
69259
|
+
className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
|
|
69260
|
+
style: {
|
|
69261
|
+
backgroundColor: components.card.backgroundColor,
|
|
69262
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`,
|
|
69263
|
+
borderRadius: components.card.borderRadius
|
|
69264
|
+
},
|
|
69265
|
+
children: [
|
|
69266
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
69267
|
+
"span",
|
|
69268
|
+
{
|
|
69269
|
+
className: "uf-text-xs",
|
|
69270
|
+
style: { color: components.card.subtitleColor, fontFamily: fonts.regular },
|
|
69271
|
+
children: "You send"
|
|
69272
|
+
}
|
|
69273
|
+
),
|
|
69274
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
69275
|
+
"span",
|
|
69276
|
+
{
|
|
69277
|
+
className: "uf-text-sm uf-font-semibold",
|
|
69278
|
+
style: { color: components.card.titleColor, fontFamily: fonts.semibold },
|
|
69279
|
+
children: prefillDisplay
|
|
69280
|
+
}
|
|
69281
|
+
)
|
|
69282
|
+
]
|
|
69283
|
+
}
|
|
69284
|
+
),
|
|
69007
69285
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-pt-2", children: [
|
|
69008
69286
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
69009
69287
|
"div",
|
|
@@ -70591,7 +70869,7 @@ function WalletConnect({
|
|
|
70591
70869
|
amountQuickSelect = "percentage",
|
|
70592
70870
|
onWalletDisconnect,
|
|
70593
70871
|
onWalletConnected,
|
|
70594
|
-
|
|
70872
|
+
prefilledAmountUsd,
|
|
70595
70873
|
checkoutAmountUsd,
|
|
70596
70874
|
checkoutReceivedUsd,
|
|
70597
70875
|
onNewDeposit,
|
|
@@ -70613,28 +70891,28 @@ function WalletConnect({
|
|
|
70613
70891
|
onExecutionsChange
|
|
70614
70892
|
}) {
|
|
70615
70893
|
const { colors: colors2, fonts, components, mode } = useTheme();
|
|
70616
|
-
const walletProvidedAtMount =
|
|
70617
|
-
const [activeWalletInfo, setActiveWalletInfo] =
|
|
70894
|
+
const walletProvidedAtMount = React352.useRef(!!initialWalletInfo && !!initialDepositWallet);
|
|
70895
|
+
const [activeWalletInfo, setActiveWalletInfo] = React352.useState(
|
|
70618
70896
|
initialWalletInfo ?? null
|
|
70619
70897
|
);
|
|
70620
|
-
const [activeDepositWallet, setActiveDepositWallet] =
|
|
70898
|
+
const [activeDepositWallet, setActiveDepositWallet] = React352.useState(
|
|
70621
70899
|
initialDepositWallet ?? null
|
|
70622
70900
|
);
|
|
70623
70901
|
const initialView = initialWalletInfo && initialDepositWallet ? "select_token" : "select_wallet";
|
|
70624
|
-
const [view, setView] =
|
|
70625
|
-
const [isTransitioning, setIsTransitioning] =
|
|
70626
|
-
const viewRef =
|
|
70902
|
+
const [view, setView] = React352.useState(initialView);
|
|
70903
|
+
const [isTransitioning, setIsTransitioning] = React352.useState(false);
|
|
70904
|
+
const viewRef = React352.useRef(initialView);
|
|
70627
70905
|
const standalone = !canGoBack && !walletProvidedAtMount.current;
|
|
70628
70906
|
const { wallet: detectedWallet, isLoading: detectingWallet } = useDetectedBrowserWallet({
|
|
70629
70907
|
enabled: standalone
|
|
70630
70908
|
});
|
|
70631
|
-
const [autoResolved, setAutoResolved] =
|
|
70632
|
-
const [selectedWalletDef, setSelectedWalletDef] =
|
|
70633
|
-
const [connectingNetwork, setConnectingNetwork] =
|
|
70634
|
-
const [walletError, setWalletError] =
|
|
70635
|
-
const [isWalletConnecting, setIsWalletConnecting] =
|
|
70636
|
-
const [eip6963ProviderCount, setEip6963ProviderCount] =
|
|
70637
|
-
|
|
70909
|
+
const [autoResolved, setAutoResolved] = React352.useState(false);
|
|
70910
|
+
const [selectedWalletDef, setSelectedWalletDef] = React352.useState(null);
|
|
70911
|
+
const [connectingNetwork, setConnectingNetwork] = React352.useState(null);
|
|
70912
|
+
const [walletError, setWalletError] = React352.useState(null);
|
|
70913
|
+
const [isWalletConnecting, setIsWalletConnecting] = React352.useState(false);
|
|
70914
|
+
const [eip6963ProviderCount, setEip6963ProviderCount] = React352.useState(0);
|
|
70915
|
+
React352.useEffect(() => {
|
|
70638
70916
|
const store = getEip6963Store();
|
|
70639
70917
|
if (!store) return;
|
|
70640
70918
|
setEip6963ProviderCount(store.getProviders().length);
|
|
@@ -70643,7 +70921,7 @@ function WalletConnect({
|
|
|
70643
70921
|
});
|
|
70644
70922
|
}, []);
|
|
70645
70923
|
const { wallets: backendWallets } = useExternalWallets({ publishableKey });
|
|
70646
|
-
const walletDefinitions =
|
|
70924
|
+
const walletDefinitions = React352.useMemo(
|
|
70647
70925
|
() => backendWallets.length > 0 ? backendWallets.map((w) => ({
|
|
70648
70926
|
id: w.id,
|
|
70649
70927
|
name: w.name,
|
|
@@ -70654,32 +70932,32 @@ function WalletConnect({
|
|
|
70654
70932
|
})) : FALLBACK_WALLET_DEFINITIONS,
|
|
70655
70933
|
[backendWallets]
|
|
70656
70934
|
);
|
|
70657
|
-
const [recentWalletId, setRecentWalletIdState] =
|
|
70658
|
-
|
|
70935
|
+
const [recentWalletId, setRecentWalletIdState] = React352.useState(getLastOpenedWallet);
|
|
70936
|
+
React352.useEffect(() => {
|
|
70659
70937
|
if (view === "select_wallet") {
|
|
70660
70938
|
setRecentWalletIdState(getLastOpenedWallet());
|
|
70661
70939
|
}
|
|
70662
70940
|
}, [view]);
|
|
70663
|
-
const availableWallets =
|
|
70941
|
+
const availableWallets = React352.useMemo(
|
|
70664
70942
|
() => detectAvailableWallets(walletDefinitions, recentWalletId),
|
|
70665
70943
|
[walletDefinitions, eip6963ProviderCount, recentWalletId]
|
|
70666
70944
|
);
|
|
70667
|
-
const [isMobile, setIsMobile] =
|
|
70668
|
-
|
|
70945
|
+
const [isMobile, setIsMobile] = React352.useState(false);
|
|
70946
|
+
React352.useEffect(() => {
|
|
70669
70947
|
setIsMobile(isMobileDevice());
|
|
70670
70948
|
}, []);
|
|
70671
|
-
const mobileDepositAddresses =
|
|
70949
|
+
const mobileDepositAddresses = React352.useMemo(
|
|
70672
70950
|
() => (depositWallets ?? []).map((w) => ({ chain_type: w.chain_type, address: w.address })),
|
|
70673
70951
|
[depositWallets]
|
|
70674
70952
|
);
|
|
70675
|
-
const mobileDepositWalletIds =
|
|
70953
|
+
const mobileDepositWalletIds = React352.useMemo(
|
|
70676
70954
|
() => (depositWallets ?? []).filter((w) => w.chain_type === "ethereum" || w.chain_type === "solana").map((w) => w.id),
|
|
70677
70955
|
[depositWallets]
|
|
70678
70956
|
);
|
|
70679
|
-
const [mobileRedirect, setMobileRedirect] =
|
|
70680
|
-
const [pendingMobileWallet, setPendingMobileWallet] =
|
|
70681
|
-
const [awaitingMobileDeposit, setAwaitingMobileDeposit] =
|
|
70682
|
-
|
|
70957
|
+
const [mobileRedirect, setMobileRedirect] = React352.useState(null);
|
|
70958
|
+
const [pendingMobileWallet, setPendingMobileWallet] = React352.useState(null);
|
|
70959
|
+
const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React352.useState(false);
|
|
70960
|
+
React352.useEffect(() => {
|
|
70683
70961
|
if (!standalone || autoResolved || detectingWallet) return;
|
|
70684
70962
|
if (!detectedWallet) {
|
|
70685
70963
|
setAutoResolved(true);
|
|
@@ -70705,32 +70983,36 @@ function WalletConnect({
|
|
|
70705
70983
|
depositWallets,
|
|
70706
70984
|
depositWalletsLoading
|
|
70707
70985
|
]);
|
|
70708
|
-
|
|
70986
|
+
React352.useEffect(() => {
|
|
70709
70987
|
if (!standalone || autoResolved) return;
|
|
70710
70988
|
const t13 = setTimeout(() => setAutoResolved(true), 5e3);
|
|
70711
70989
|
return () => clearTimeout(t13);
|
|
70712
70990
|
}, [standalone, autoResolved]);
|
|
70713
|
-
const [balances, setBalances] =
|
|
70714
|
-
const [isLoading, setIsLoading] =
|
|
70715
|
-
const [selectedBalance, setSelectedBalance] =
|
|
70716
|
-
const [totalBalanceUsd, setTotalBalanceUsd] =
|
|
70717
|
-
const [error, setError] =
|
|
70718
|
-
const [isDisconnectingWallet, setIsDisconnectingWallet] =
|
|
70719
|
-
const [amountUsd, setAmountUsd] =
|
|
70720
|
-
const [isConfirming, setIsConfirming] =
|
|
70721
|
-
const [hasSignedTransaction, setHasSignedTransaction] =
|
|
70722
|
-
const [tokenChainDetails, setTokenChainDetails] =
|
|
70723
|
-
const [loadingTokenDetails, setLoadingTokenDetails] =
|
|
70724
|
-
const [showTransactionDetails, setShowTransactionDetails] =
|
|
70725
|
-
const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] =
|
|
70991
|
+
const [balances, setBalances] = React352.useState([]);
|
|
70992
|
+
const [isLoading, setIsLoading] = React352.useState(false);
|
|
70993
|
+
const [selectedBalance, setSelectedBalance] = React352.useState(null);
|
|
70994
|
+
const [totalBalanceUsd, setTotalBalanceUsd] = React352.useState(null);
|
|
70995
|
+
const [error, setError] = React352.useState(null);
|
|
70996
|
+
const [isDisconnectingWallet, setIsDisconnectingWallet] = React352.useState(false);
|
|
70997
|
+
const [amountUsd, setAmountUsd] = React352.useState(prefilledAmountUsd ?? "");
|
|
70998
|
+
const [isConfirming, setIsConfirming] = React352.useState(false);
|
|
70999
|
+
const [hasSignedTransaction, setHasSignedTransaction] = React352.useState(false);
|
|
71000
|
+
const [tokenChainDetails, setTokenChainDetails] = React352.useState(null);
|
|
71001
|
+
const [loadingTokenDetails, setLoadingTokenDetails] = React352.useState(false);
|
|
71002
|
+
const [showTransactionDetails, setShowTransactionDetails] = React352.useState(false);
|
|
71003
|
+
const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] = React352.useState(null);
|
|
70726
71004
|
const walletInfo = activeWalletInfo;
|
|
70727
71005
|
const depositWallet = activeDepositWallet;
|
|
70728
71006
|
const hasWallet = !!activeWalletInfo && !!activeDepositWallet;
|
|
71007
|
+
React352.useEffect(() => {
|
|
71008
|
+
const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
71009
|
+
setAmountUsd(cleanedPrefilled);
|
|
71010
|
+
}, [prefilledAmountUsd]);
|
|
70729
71011
|
const chainType = activeDepositWallet?.chain_type ?? "ethereum";
|
|
70730
71012
|
const recipientAddress = activeDepositWallet?.address ?? "";
|
|
70731
71013
|
const isCheckoutMode = !!checkoutAmountUsd;
|
|
70732
71014
|
const supportedChainType = chainType === "algorand" || chainType === "xrpl" || chainType === "cardano" || chainType === "n1" ? "ethereum" : chainType;
|
|
70733
|
-
const transitionTo =
|
|
71015
|
+
const transitionTo = React352.useCallback((nextView) => {
|
|
70734
71016
|
if (nextView === viewRef.current) return;
|
|
70735
71017
|
setIsTransitioning(true);
|
|
70736
71018
|
setTimeout(() => {
|
|
@@ -70795,7 +71077,7 @@ function WalletConnect({
|
|
|
70795
71077
|
if (!selectedWalletDef) return;
|
|
70796
71078
|
handleConnectWallet(selectedWalletDef, network);
|
|
70797
71079
|
};
|
|
70798
|
-
|
|
71080
|
+
React352.useEffect(() => {
|
|
70799
71081
|
if (!pendingMobileWallet) return;
|
|
70800
71082
|
if (mobileDepositAddresses.length > 0) {
|
|
70801
71083
|
const wallet = pendingMobileWallet;
|
|
@@ -70959,7 +71241,7 @@ function WalletConnect({
|
|
|
70959
71241
|
publishableKey,
|
|
70960
71242
|
enabled: !!activeWalletInfo && !!recipientAddress
|
|
70961
71243
|
});
|
|
70962
|
-
const effectiveDestinationAmount =
|
|
71244
|
+
const effectiveDestinationAmount = React352.useMemo(() => {
|
|
70963
71245
|
if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
|
|
70964
71246
|
if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
|
|
70965
71247
|
const remaining = BigInt(checkoutRemainingBaseUnits);
|
|
@@ -70987,7 +71269,7 @@ function WalletConnect({
|
|
|
70987
71269
|
stablecoinParity,
|
|
70988
71270
|
enabled: isCheckoutMode && !!selectedToken && !!checkoutDestination && effectiveDestinationAmount !== "0"
|
|
70989
71271
|
});
|
|
70990
|
-
const activeCheckoutQuote =
|
|
71272
|
+
const activeCheckoutQuote = React352.useMemo(() => {
|
|
70991
71273
|
if (!isCheckoutMode) return null;
|
|
70992
71274
|
if (walletCheckoutQuote)
|
|
70993
71275
|
return {
|
|
@@ -71017,10 +71299,10 @@ function WalletConnect({
|
|
|
71017
71299
|
onDepositSuccess,
|
|
71018
71300
|
onDepositError
|
|
71019
71301
|
});
|
|
71020
|
-
|
|
71302
|
+
React352.useEffect(() => {
|
|
71021
71303
|
onExecutionsChange?.(depositExecutions);
|
|
71022
71304
|
}, [depositExecutions, onExecutionsChange]);
|
|
71023
|
-
const latestDepositExecution =
|
|
71305
|
+
const latestDepositExecution = React352.useMemo(() => {
|
|
71024
71306
|
if (depositExecutions.length === 0) return null;
|
|
71025
71307
|
return [...depositExecutions].sort((a, b) => {
|
|
71026
71308
|
const ta = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
@@ -71028,21 +71310,21 @@ function WalletConnect({
|
|
|
71028
71310
|
return tb - ta;
|
|
71029
71311
|
})[0];
|
|
71030
71312
|
}, [depositExecutions]);
|
|
71031
|
-
|
|
71313
|
+
React352.useEffect(() => {
|
|
71032
71314
|
if (awaitingMobileDeposit && latestDepositExecution && (viewRef.current === "mobile_redirect" || viewRef.current === "connecting")) {
|
|
71033
71315
|
transitionTo("mobile_deposit_status");
|
|
71034
71316
|
}
|
|
71035
71317
|
}, [awaitingMobileDeposit, latestDepositExecution, transitionTo]);
|
|
71036
|
-
|
|
71037
|
-
if (!
|
|
71318
|
+
React352.useEffect(() => {
|
|
71319
|
+
if (!isCheckoutMode || !tokenChainDetails || view !== "enter_amount") return;
|
|
71038
71320
|
const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
|
|
71039
71321
|
const currentAmount = parseFloat(amountUsd) || 0;
|
|
71040
71322
|
if (currentAmount > 0 && currentAmount < minDeposit) setAmountUsd(minDeposit.toFixed(2));
|
|
71041
|
-
}, [tokenChainDetails, view,
|
|
71042
|
-
|
|
71323
|
+
}, [isCheckoutMode, tokenChainDetails, view, amountUsd]);
|
|
71324
|
+
React352.useEffect(() => {
|
|
71043
71325
|
if (view === "review") setShowTransactionDetails(false);
|
|
71044
71326
|
}, [view]);
|
|
71045
|
-
|
|
71327
|
+
React352.useEffect(() => {
|
|
71046
71328
|
if (view !== "enter_amount" && view !== "review" || !selectedBalance || !activeDepositWallet)
|
|
71047
71329
|
return;
|
|
71048
71330
|
let cancelled = false;
|
|
@@ -71079,7 +71361,7 @@ function WalletConnect({
|
|
|
71079
71361
|
cancelled = true;
|
|
71080
71362
|
};
|
|
71081
71363
|
}, [view, selectedBalance, publishableKey, activeDepositWallet]);
|
|
71082
|
-
|
|
71364
|
+
React352.useEffect(() => {
|
|
71083
71365
|
if (!activeWalletInfo || !activeDepositWallet) return;
|
|
71084
71366
|
let cancelled = false;
|
|
71085
71367
|
setIsLoading(true);
|
|
@@ -71144,21 +71426,21 @@ function WalletConnect({
|
|
|
71144
71426
|
defaultSourceTokenAddress,
|
|
71145
71427
|
defaultSourceSymbol
|
|
71146
71428
|
]);
|
|
71147
|
-
const usdToTokenRate =
|
|
71429
|
+
const usdToTokenRate = React352.useMemo(() => {
|
|
71148
71430
|
if (!selectedBalance || !selectedBalance.amount_usd || !selectedToken) return 0;
|
|
71149
71431
|
const balanceAmount = Number(selectedBalance.amount) / 10 ** selectedToken.decimals;
|
|
71150
71432
|
const balanceUsd = parseFloat(selectedBalance.amount_usd);
|
|
71151
71433
|
if (balanceAmount === 0 || balanceUsd === 0) return 0;
|
|
71152
71434
|
return balanceAmount / balanceUsd;
|
|
71153
71435
|
}, [selectedBalance, selectedToken]);
|
|
71154
|
-
const tokenAmount =
|
|
71436
|
+
const tokenAmount = React352.useMemo(() => {
|
|
71155
71437
|
if (isCheckoutMode && activeCheckoutQuote && selectedToken)
|
|
71156
71438
|
return Number(activeCheckoutQuote.sourceAmount) / 10 ** activeCheckoutQuote.sourceTokenDecimals;
|
|
71157
71439
|
const usdNum = parseFloat(amountUsd) || 0;
|
|
71158
71440
|
if (usdNum === 0 || usdToTokenRate === 0) return 0;
|
|
71159
71441
|
return usdNum * usdToTokenRate;
|
|
71160
71442
|
}, [amountUsd, usdToTokenRate, isCheckoutMode, activeCheckoutQuote, selectedToken]);
|
|
71161
|
-
|
|
71443
|
+
React352.useEffect(() => {
|
|
71162
71444
|
if (isCheckoutMode && activeCheckoutQuote?.sourceAmountUsd && view === "enter_amount")
|
|
71163
71445
|
setAmountUsd(activeCheckoutQuote.sourceAmountUsd);
|
|
71164
71446
|
}, [isCheckoutMode, activeCheckoutQuote, view]);
|
|
@@ -71167,7 +71449,7 @@ function WalletConnect({
|
|
|
71167
71449
|
const inputUsdNum = parseFloat(amountUsd) || 0;
|
|
71168
71450
|
const minDepositUsd = tokenChainDetails?.minimum_deposit_amount_usd || 0;
|
|
71169
71451
|
const isValidAmount = isCheckoutMode && activeCheckoutQuote ? tokenAmount > 0 && tokenAmount <= maxTokenAmount : inputUsdNum > 0 && inputUsdNum <= maxUsdAmount && inputUsdNum >= minDepositUsd;
|
|
71170
|
-
const formattedTokenAmount =
|
|
71452
|
+
const formattedTokenAmount = React352.useMemo(() => {
|
|
71171
71453
|
if (tokenAmount === 0 || !selectedToken) return null;
|
|
71172
71454
|
return `${tokenAmount.toFixed(6)} ${selectedToken.symbol}`.replace(/\.?0+$/, "");
|
|
71173
71455
|
}, [tokenAmount, selectedToken]);
|
|
@@ -71200,7 +71482,7 @@ function WalletConnect({
|
|
|
71200
71482
|
break;
|
|
71201
71483
|
case "enter_amount":
|
|
71202
71484
|
transitionTo("select_token");
|
|
71203
|
-
setAmountUsd(
|
|
71485
|
+
setAmountUsd(prefilledAmountUsd ?? "");
|
|
71204
71486
|
setTokenChainDetails(null);
|
|
71205
71487
|
break;
|
|
71206
71488
|
case "review":
|
|
@@ -71232,7 +71514,7 @@ function WalletConnect({
|
|
|
71232
71514
|
setSelectedBalance(null);
|
|
71233
71515
|
setBalances([]);
|
|
71234
71516
|
setTotalBalanceUsd(null);
|
|
71235
|
-
setAmountUsd(
|
|
71517
|
+
setAmountUsd(prefilledAmountUsd ?? "");
|
|
71236
71518
|
setError(null);
|
|
71237
71519
|
};
|
|
71238
71520
|
if (standalone) {
|
|
@@ -71956,6 +72238,15 @@ function SkeletonButton({ variant = "default" }) {
|
|
|
71956
72238
|
] });
|
|
71957
72239
|
}
|
|
71958
72240
|
var t8 = i18n2.depositModal;
|
|
72241
|
+
function normalizePrefilledUsdAmount(value) {
|
|
72242
|
+
if (!value) return void 0;
|
|
72243
|
+
const cleaned = value.replace(/[^0-9.]/g, "");
|
|
72244
|
+
if (!cleaned) return void 0;
|
|
72245
|
+
const normalizedNumeric = cleaned.replace(/(\..*)\./g, "$1");
|
|
72246
|
+
const parsed = parseFloat(normalizedNumeric);
|
|
72247
|
+
if (!Number.isFinite(parsed) || parsed <= 0) return void 0;
|
|
72248
|
+
return parseFloat(parsed.toFixed(2)).toString();
|
|
72249
|
+
}
|
|
71959
72250
|
function depositTabForScreen(screen) {
|
|
71960
72251
|
return screen === "card" || screen === "cashapp" || screen === "bank_transfer" || screen === "stripe_link" || screen === "apple_pay" ? "cash" : "crypto";
|
|
71961
72252
|
}
|
|
@@ -71975,6 +72266,7 @@ function DepositModal({
|
|
|
71975
72266
|
defaultSourceChainId,
|
|
71976
72267
|
defaultSourceTokenAddress,
|
|
71977
72268
|
defaultSourceSymbol,
|
|
72269
|
+
prefilledAmountUsd,
|
|
71978
72270
|
hideDepositTracker,
|
|
71979
72271
|
showBalanceHeader = false,
|
|
71980
72272
|
transferInputVariant = "double_input",
|
|
@@ -72010,6 +72302,10 @@ function DepositModal({
|
|
|
72010
72302
|
depositTrackerSubTitle = t8.depositTracker.subtitle
|
|
72011
72303
|
}) {
|
|
72012
72304
|
const { colors: colors2, fonts, components } = useTheme();
|
|
72305
|
+
const normalizedPrefilledAmountUsd = (0, import_react3.useMemo)(
|
|
72306
|
+
() => normalizePrefilledUsdAmount(prefilledAmountUsd),
|
|
72307
|
+
[prefilledAmountUsd]
|
|
72308
|
+
);
|
|
72013
72309
|
const onDepositSuccessFor = (0, import_react3.useCallback)(
|
|
72014
72310
|
(method) => onDepositSuccess || onEvent ? (data) => {
|
|
72015
72311
|
const payload = { ...data, method };
|
|
@@ -72875,6 +73171,7 @@ function DepositModal({
|
|
|
72875
73171
|
defaultSourceChainId,
|
|
72876
73172
|
defaultSourceTokenAddress,
|
|
72877
73173
|
defaultSourceSymbol,
|
|
73174
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
72878
73175
|
depositConfirmationMode,
|
|
72879
73176
|
onExecutionsChange: setDepositExecutions,
|
|
72880
73177
|
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
@@ -72894,6 +73191,7 @@ function DepositModal({
|
|
|
72894
73191
|
defaultSourceChainId,
|
|
72895
73192
|
defaultSourceTokenAddress,
|
|
72896
73193
|
defaultSourceSymbol,
|
|
73194
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
72897
73195
|
depositConfirmationMode,
|
|
72898
73196
|
onExecutionsChange: setDepositExecutions,
|
|
72899
73197
|
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
@@ -72978,7 +73276,8 @@ function DepositModal({
|
|
|
72978
73276
|
wallets,
|
|
72979
73277
|
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
72980
73278
|
hideDepositFlowInfo,
|
|
72981
|
-
hideDisplayDescription
|
|
73279
|
+
hideDisplayDescription,
|
|
73280
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd
|
|
72982
73281
|
}
|
|
72983
73282
|
),
|
|
72984
73283
|
depositPoweredByFooter
|
|
@@ -73043,7 +73342,8 @@ function DepositModal({
|
|
|
73043
73342
|
defaultSourceChainType,
|
|
73044
73343
|
defaultSourceChainId,
|
|
73045
73344
|
defaultSourceTokenAddress,
|
|
73046
|
-
defaultSourceSymbol
|
|
73345
|
+
defaultSourceSymbol,
|
|
73346
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd
|
|
73047
73347
|
}
|
|
73048
73348
|
),
|
|
73049
73349
|
depositPoweredByFooter
|
|
@@ -73075,6 +73375,7 @@ function DepositModal({
|
|
|
73075
73375
|
onDepositSuccess: onDepositSuccessFor("wallet_connect"),
|
|
73076
73376
|
onDepositError: onDepositErrorFor("wallet_connect"),
|
|
73077
73377
|
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
73378
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
73078
73379
|
onWalletDisconnect: handleWalletDisconnect,
|
|
73079
73380
|
onWalletConnected: (info, dw) => {
|
|
73080
73381
|
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
@@ -73123,7 +73424,8 @@ function DepositModal({
|
|
|
73123
73424
|
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
73124
73425
|
onEvent,
|
|
73125
73426
|
onDepositSuccess,
|
|
73126
|
-
onDepositError
|
|
73427
|
+
onDepositError,
|
|
73428
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd
|
|
73127
73429
|
}
|
|
73128
73430
|
),
|
|
73129
73431
|
depositPoweredByFooter
|
|
@@ -73135,7 +73437,7 @@ function DepositModal({
|
|
|
73135
73437
|
title: "Deposit with Link",
|
|
73136
73438
|
showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
|
|
73137
73439
|
onBack: handleBack,
|
|
73138
|
-
showClose: stripeLinkStep !== "checkout",
|
|
73440
|
+
showClose: stripeLinkStep !== "checkout" && stripeLinkStep !== "auth",
|
|
73139
73441
|
onClose: handleClose
|
|
73140
73442
|
}
|
|
73141
73443
|
),
|
|
@@ -73166,6 +73468,8 @@ function DepositModal({
|
|
|
73166
73468
|
destinationChainType,
|
|
73167
73469
|
destinationChainId,
|
|
73168
73470
|
destinationTokenAddress,
|
|
73471
|
+
countryCode: userIpInfo?.alpha2,
|
|
73472
|
+
subdivisionCode: userIpInfo?.subdivisionCode ?? void 0,
|
|
73169
73473
|
wallets,
|
|
73170
73474
|
email: userEmail,
|
|
73171
73475
|
iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
|
|
@@ -73205,6 +73509,7 @@ function DepositModal({
|
|
|
73205
73509
|
onEvent,
|
|
73206
73510
|
onDepositSuccess: onDepositSuccessFor("cashapp"),
|
|
73207
73511
|
onDepositError: onDepositErrorFor("cashapp"),
|
|
73512
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
73208
73513
|
wallets
|
|
73209
73514
|
}
|
|
73210
73515
|
),
|
|
@@ -73904,7 +74209,7 @@ function CheckoutModal({
|
|
|
73904
74209
|
userId: paymentIntent.user_id || "",
|
|
73905
74210
|
publishableKey,
|
|
73906
74211
|
clientSecret,
|
|
73907
|
-
|
|
74212
|
+
prefilledAmountUsd: remainingAmountUsd,
|
|
73908
74213
|
checkoutAmountUsd: paymentIntent.amount_usd,
|
|
73909
74214
|
checkoutReceivedUsd: paymentIntent.amount_received_usd,
|
|
73910
74215
|
checkoutDestination: {
|
|
@@ -76267,6 +76572,7 @@ function UnifoldProvider2({
|
|
|
76267
76572
|
defaultSourceChainId: depositConfig.defaultSourceChainId,
|
|
76268
76573
|
defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
|
|
76269
76574
|
defaultSourceSymbol: depositConfig.defaultSourceSymbol,
|
|
76575
|
+
prefilledAmountUsd: depositConfig.prefilledAmountUsd,
|
|
76270
76576
|
userEmail: depositConfig.user?.email,
|
|
76271
76577
|
depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
|
|
76272
76578
|
hideDepositTracker: config?.hideDepositTracker,
|