@unifold/ui-react 0.1.68-beta.2 → 0.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +990 -889
- package/dist/index.mjs +903 -805
- package/dist/styles-base.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -583,6 +583,7 @@ var DialogContent = React3.forwardRef(({ className, style, children, omitOverlay
|
|
|
583
583
|
className: cn(
|
|
584
584
|
portalContainer ? "uf-absolute" : "uf-fixed",
|
|
585
585
|
"uf-bottom-0 uf-left-0 uf-right-0 uf-top-0 uf-z-50 uf-grid uf-w-full uf-max-w-full uf-h-full",
|
|
586
|
+
"focus:uf-outline-none focus-visible:uf-outline-none",
|
|
586
587
|
!portalContainer && "sm:uf-left-[50%] sm:uf-top-[50%] sm:uf-bottom-auto sm:uf-right-auto sm:uf-translate-x-[-50%] sm:uf-translate-y-[-50%] sm:uf-h-auto",
|
|
587
588
|
"uf-border uf-bg-background",
|
|
588
589
|
omitOverlayEmbed ? "uf-gap-0 uf-p-0" : "uf-gap-4 uf-p-6 uf-shadow-lg uf-duration-200",
|
|
@@ -598,6 +599,14 @@ var DialogContent = React3.forwardRef(({ className, style, children, omitOverlay
|
|
|
598
599
|
),
|
|
599
600
|
style: {
|
|
600
601
|
"--uf-container-radius": `${components.container.borderRadius}px`,
|
|
602
|
+
// Radix traps focus and, when the focused control unmounts during an
|
|
603
|
+
// in-modal screen transition, moves focus onto this container. Modern
|
|
604
|
+
// browsers paint the default focus ring via `:focus-visible`, which
|
|
605
|
+
// flashes a highlight around the whole modal until focus settles on
|
|
606
|
+
// the next screen. Suppress it inline so it works regardless of the
|
|
607
|
+
// Tailwind build (the container is a programmatic focus target, not an
|
|
608
|
+
// interactive control, so it should never show a focus ring).
|
|
609
|
+
outline: "none",
|
|
601
610
|
...portalContainer ? { display: "flex", flexDirection: "column" } : {},
|
|
602
611
|
...style
|
|
603
612
|
},
|
|
@@ -13016,10 +13025,16 @@ function PayWithStripeLink({
|
|
|
13016
13025
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
13017
13026
|
"div",
|
|
13018
13027
|
{
|
|
13019
|
-
className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-max-h-[70vh]",
|
|
13028
|
+
className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-overflow-x-hidden uf-max-h-[70vh]",
|
|
13020
13029
|
style: { backgroundColor: colors2.background },
|
|
13021
13030
|
children: [
|
|
13022
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
13031
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
13032
|
+
"div",
|
|
13033
|
+
{
|
|
13034
|
+
ref: paymentMountRef,
|
|
13035
|
+
className: "uf-w-full uf-flex-1 uf-overflow-y-auto uf-overflow-x-hidden"
|
|
13036
|
+
}
|
|
13037
|
+
),
|
|
13023
13038
|
!stripePaymentUIReady && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "uf-flex uf-items-center uf-justify-center uf-py-8", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Loader2, { className: "uf-w-8 uf-h-8 uf-animate-spin", style: { color: colors2.primary } }) }),
|
|
13024
13039
|
error && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
13025
13040
|
"div",
|
|
@@ -13037,7 +13052,7 @@ function PayWithStripeLink({
|
|
|
13037
13052
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
13038
13053
|
"div",
|
|
13039
13054
|
{
|
|
13040
|
-
className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-max-h-[70vh]",
|
|
13055
|
+
className: "uf-flex uf-flex-col uf-py-4 uf-overflow-y-auto uf-overflow-x-hidden uf-max-h-[70vh]",
|
|
13041
13056
|
style: { backgroundColor: colors2.background },
|
|
13042
13057
|
children: [
|
|
13043
13058
|
displayPaymentTokens.length === 0 && !loading && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "uf-px-1 uf-mb-3 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
@@ -14156,17 +14171,30 @@ var import_react_query8 = require("@tanstack/react-query");
|
|
|
14156
14171
|
var import_core22 = require("@unifold/core");
|
|
14157
14172
|
function useProjectConfig({
|
|
14158
14173
|
publishableKey,
|
|
14159
|
-
enabled = true
|
|
14174
|
+
enabled = true,
|
|
14175
|
+
countryCode,
|
|
14176
|
+
subdivisionCode
|
|
14160
14177
|
}) {
|
|
14161
|
-
const {
|
|
14162
|
-
|
|
14163
|
-
|
|
14178
|
+
const {
|
|
14179
|
+
data: projectConfig,
|
|
14180
|
+
isLoading,
|
|
14181
|
+
error
|
|
14182
|
+
} = (0, import_react_query8.useQuery)({
|
|
14183
|
+
// Country is part of the key so a region change refetches the region-aware
|
|
14184
|
+
// config. Omitted when undefined so callers that don't pass a country keep
|
|
14185
|
+
// sharing the base cache entry.
|
|
14186
|
+
queryKey: countryCode ? ["unifold", "projectConfig", publishableKey, countryCode, subdivisionCode ?? null] : ["unifold", "projectConfig", publishableKey],
|
|
14187
|
+
queryFn: () => (0, import_core22.getProjectConfig)(publishableKey, countryCode ? { countryCode, subdivisionCode } : void 0),
|
|
14164
14188
|
enabled,
|
|
14189
|
+
// Keep the previous (e.g. no-country) config visible while the region-aware
|
|
14190
|
+
// config refetches after the country resolves, so unrelated config-driven
|
|
14191
|
+
// UI doesn't flash back to defaults.
|
|
14192
|
+
placeholderData: import_react_query8.keepPreviousData,
|
|
14165
14193
|
staleTime: 1e3 * 60 * 30,
|
|
14166
14194
|
refetchOnMount: true,
|
|
14167
14195
|
refetchOnWindowFocus: true
|
|
14168
14196
|
});
|
|
14169
|
-
return { projectConfig, isLoading };
|
|
14197
|
+
return { projectConfig, isLoading, error: error ?? null };
|
|
14170
14198
|
}
|
|
14171
14199
|
|
|
14172
14200
|
// src/hooks/use-supported-deposit-tokens.ts
|
|
@@ -16227,50 +16255,32 @@ function useApplePayProviders({
|
|
|
16227
16255
|
}
|
|
16228
16256
|
|
|
16229
16257
|
// src/components/deposits/DepositModal.tsx
|
|
16230
|
-
var
|
|
16258
|
+
var import_core37 = require("@unifold/core");
|
|
16231
16259
|
|
|
16232
16260
|
// src/hooks/use-allowed-country.ts
|
|
16233
|
-
var import_react_query13 = require("@tanstack/react-query");
|
|
16234
|
-
var import_core28 = require("@unifold/core");
|
|
16235
16261
|
function useAllowedCountry(publishableKey) {
|
|
16262
|
+
const { userIpInfo, isLoading: isIpLoading, error: ipError } = useUserIp();
|
|
16236
16263
|
const {
|
|
16237
|
-
|
|
16238
|
-
isLoading: isIpLoading,
|
|
16239
|
-
error: ipError
|
|
16240
|
-
} = (0, import_react_query13.useQuery)({
|
|
16241
|
-
queryKey: ["unifold", "ipAddress"],
|
|
16242
|
-
queryFn: () => (0, import_core28.getIpAddress)(),
|
|
16243
|
-
refetchOnMount: false,
|
|
16244
|
-
refetchOnReconnect: true,
|
|
16245
|
-
refetchOnWindowFocus: false,
|
|
16246
|
-
staleTime: 1e3 * 60 * 60,
|
|
16247
|
-
// 1 hour
|
|
16248
|
-
gcTime: 1e3 * 60 * 60 * 24
|
|
16249
|
-
// 24 hours
|
|
16250
|
-
});
|
|
16251
|
-
const {
|
|
16252
|
-
data: configData,
|
|
16264
|
+
projectConfig,
|
|
16253
16265
|
isLoading: isConfigLoading,
|
|
16254
16266
|
error: configError
|
|
16255
|
-
} = (
|
|
16256
|
-
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16263
|
-
gcTime: 1e3 * 60 * 60
|
|
16264
|
-
// 1 hour
|
|
16267
|
+
} = useProjectConfig({
|
|
16268
|
+
publishableKey,
|
|
16269
|
+
// Wait for the IP so we issue a single country-aware config request rather
|
|
16270
|
+
// than a country-less fetch followed by a country-aware refetch. Shares the
|
|
16271
|
+
// query key with DepositModal's useProjectConfig, so they dedupe.
|
|
16272
|
+
enabled: !isIpLoading,
|
|
16273
|
+
countryCode: userIpInfo?.alpha2,
|
|
16274
|
+
subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
|
|
16265
16275
|
});
|
|
16266
16276
|
const isLoading = isIpLoading || isConfigLoading;
|
|
16267
16277
|
const error = ipError || configError || null;
|
|
16278
|
+
const userSubdivision = userIpInfo?.subdivisionCode || userIpInfo?.state || "";
|
|
16268
16279
|
let isAllowed = null;
|
|
16269
|
-
if (
|
|
16270
|
-
const blockedCodes =
|
|
16271
|
-
const blockedSubdivisions =
|
|
16272
|
-
const userCountryUpper =
|
|
16273
|
-
const userSubdivision = ipData.subdivision_code || ipData.state || "";
|
|
16280
|
+
if (userIpInfo && projectConfig) {
|
|
16281
|
+
const blockedCodes = projectConfig.blocked_country_codes || [];
|
|
16282
|
+
const blockedSubdivisions = projectConfig.blocked_country_subdivisions || [];
|
|
16283
|
+
const userCountryUpper = userIpInfo.alpha2.toUpperCase();
|
|
16274
16284
|
const userSubdivisionUpper = userSubdivision.toUpperCase();
|
|
16275
16285
|
const isCountryBlocked = blockedCodes.some((code) => code.toUpperCase() === userCountryUpper);
|
|
16276
16286
|
const isSubdivisionBlocked = blockedSubdivisions.some((entry) => {
|
|
@@ -16279,20 +16289,19 @@ function useAllowedCountry(publishableKey) {
|
|
|
16279
16289
|
});
|
|
16280
16290
|
isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
|
|
16281
16291
|
}
|
|
16282
|
-
const subdivisionCode = ipData?.subdivision_code || ipData?.state || "" || null;
|
|
16283
16292
|
return {
|
|
16284
16293
|
isAllowed,
|
|
16285
|
-
alpha2:
|
|
16286
|
-
country:
|
|
16287
|
-
subdivisionCode,
|
|
16294
|
+
alpha2: userIpInfo?.alpha2 ?? null,
|
|
16295
|
+
country: userIpInfo?.country ?? null,
|
|
16296
|
+
subdivisionCode: userSubdivision || null,
|
|
16288
16297
|
isLoading,
|
|
16289
16298
|
error
|
|
16290
16299
|
};
|
|
16291
16300
|
}
|
|
16292
16301
|
|
|
16293
16302
|
// src/hooks/use-address-validation.ts
|
|
16294
|
-
var
|
|
16295
|
-
var
|
|
16303
|
+
var import_react_query13 = require("@tanstack/react-query");
|
|
16304
|
+
var import_core28 = require("@unifold/core");
|
|
16296
16305
|
function useAddressValidation({
|
|
16297
16306
|
recipientAddress,
|
|
16298
16307
|
destinationChainType,
|
|
@@ -16303,7 +16312,7 @@ function useAddressValidation({
|
|
|
16303
16312
|
refetchOnMount = false
|
|
16304
16313
|
}) {
|
|
16305
16314
|
const shouldValidate = enabled && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
16306
|
-
const { data, isLoading, error } = (0,
|
|
16315
|
+
const { data, isLoading, error } = (0, import_react_query13.useQuery)({
|
|
16307
16316
|
queryKey: [
|
|
16308
16317
|
"unifold",
|
|
16309
16318
|
"addressValidation",
|
|
@@ -16312,7 +16321,7 @@ function useAddressValidation({
|
|
|
16312
16321
|
destinationChainId,
|
|
16313
16322
|
destinationTokenAddress
|
|
16314
16323
|
],
|
|
16315
|
-
queryFn: () => (0,
|
|
16324
|
+
queryFn: () => (0, import_core28.verifyRecipientAddress)(
|
|
16316
16325
|
{
|
|
16317
16326
|
chain_type: destinationChainType,
|
|
16318
16327
|
chain_id: destinationChainId,
|
|
@@ -16593,7 +16602,7 @@ function PoweredByUnifold({
|
|
|
16593
16602
|
}
|
|
16594
16603
|
|
|
16595
16604
|
// src/components/deposits/DepositsModal.tsx
|
|
16596
|
-
var
|
|
16605
|
+
var import_core29 = require("@unifold/core");
|
|
16597
16606
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
16598
16607
|
function DepositsModal({
|
|
16599
16608
|
open,
|
|
@@ -16611,7 +16620,7 @@ function DepositsModal({
|
|
|
16611
16620
|
if (!open || !userId) return;
|
|
16612
16621
|
const fetchExecutions = async () => {
|
|
16613
16622
|
try {
|
|
16614
|
-
const response = await (0,
|
|
16623
|
+
const response = await (0, import_core29.queryExecutions)(userId, publishableKey, import_core29.ActionType.Deposit);
|
|
16615
16624
|
const sorted = [...response.data].sort((a, b) => {
|
|
16616
16625
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
16617
16626
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -17648,11 +17657,11 @@ var TooltipContent = React32.forwardRef(({ className, sideOffset = 4, ...props }
|
|
|
17648
17657
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
17649
17658
|
|
|
17650
17659
|
// src/components/deposits/TransferCryptoSingleInput.tsx
|
|
17651
|
-
var
|
|
17660
|
+
var import_core31 = require("@unifold/core");
|
|
17652
17661
|
|
|
17653
17662
|
// src/hooks/use-hypercore-activation.ts
|
|
17654
|
-
var
|
|
17655
|
-
var
|
|
17663
|
+
var import_react_query14 = require("@tanstack/react-query");
|
|
17664
|
+
var import_core30 = require("@unifold/core");
|
|
17656
17665
|
|
|
17657
17666
|
// src/lib/constants.ts
|
|
17658
17667
|
var HYPERCORE_CHAIN_ID = "1337";
|
|
@@ -17670,9 +17679,9 @@ function useHypercoreActivation(params) {
|
|
|
17670
17679
|
const recipient = recipientAddress?.trim() ?? "";
|
|
17671
17680
|
const source = sourceAddress?.trim() ?? "";
|
|
17672
17681
|
const hasAddresses = !!recipient && !!source;
|
|
17673
|
-
const { data, isLoading } = (0,
|
|
17682
|
+
const { data, isLoading } = (0, import_react_query14.useQuery)({
|
|
17674
17683
|
queryKey: ["unifold", "hypercoreActivation", source, recipient, publishableKey],
|
|
17675
|
-
queryFn: () => (0,
|
|
17684
|
+
queryFn: () => (0, import_core30.checkHypercoreActivation)(
|
|
17676
17685
|
{
|
|
17677
17686
|
source_address: source,
|
|
17678
17687
|
recipient_address: recipient
|
|
@@ -17820,7 +17829,7 @@ function TransferCryptoSingleInput({
|
|
|
17820
17829
|
(c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
|
|
17821
17830
|
) : void 0;
|
|
17822
17831
|
const currentChainType = currentChainData?.chain_type || "ethereum";
|
|
17823
|
-
const currentWallet = (0,
|
|
17832
|
+
const currentWallet = (0, import_core31.getWalletByChainType)(wallets, currentChainType);
|
|
17824
17833
|
const depositAddress = currentWallet?.address || "";
|
|
17825
17834
|
const {
|
|
17826
17835
|
executions: depositExecutions,
|
|
@@ -18049,7 +18058,7 @@ function TransferCryptoSingleInput({
|
|
|
18049
18058
|
className: "uf-text-sm uf-font-semibold",
|
|
18050
18059
|
style: { color: components.card.titleColor, fontFamily: fonts.semibold },
|
|
18051
18060
|
children: [
|
|
18052
|
-
checkoutQuote.isStablecoin ? (0,
|
|
18061
|
+
checkoutQuote.isStablecoin ? (0, import_core31.formatStablecoinAmount)(
|
|
18053
18062
|
checkoutQuote.sourceAmount,
|
|
18054
18063
|
checkoutQuote.sourceTokenDecimals
|
|
18055
18064
|
) : (Number(checkoutQuote.sourceAmount) / 10 ** checkoutQuote.sourceTokenDecimals).toFixed(Math.min(checkoutQuote.sourceTokenDecimals, 6)),
|
|
@@ -18527,7 +18536,7 @@ var SelectSeparator = React33.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
18527
18536
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
18528
18537
|
|
|
18529
18538
|
// src/components/deposits/TransferCryptoDoubleInput.tsx
|
|
18530
|
-
var
|
|
18539
|
+
var import_core32 = require("@unifold/core");
|
|
18531
18540
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
18532
18541
|
var t7 = i18n.transferCrypto;
|
|
18533
18542
|
var getChainKey3 = (chainId, chainType) => {
|
|
@@ -18611,7 +18620,7 @@ function TransferCryptoDoubleInput({
|
|
|
18611
18620
|
(c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
|
|
18612
18621
|
) : void 0;
|
|
18613
18622
|
const currentChainType = currentChainData?.chain_type || "ethereum";
|
|
18614
|
-
const currentWallet = (0,
|
|
18623
|
+
const currentWallet = (0, import_core32.getWalletByChainType)(wallets, currentChainType);
|
|
18615
18624
|
const depositAddress = currentWallet?.address || "";
|
|
18616
18625
|
const {
|
|
18617
18626
|
executions: depositExecutions,
|
|
@@ -19136,10 +19145,10 @@ function TransferCryptoDoubleInput({
|
|
|
19136
19145
|
// src/components/deposits/WalletConnect.tsx
|
|
19137
19146
|
var React34 = __toESM(require("react"));
|
|
19138
19147
|
var import_lucide_react36 = require("lucide-react");
|
|
19139
|
-
var
|
|
19148
|
+
var import_core36 = require("@unifold/core");
|
|
19140
19149
|
|
|
19141
19150
|
// src/lib/send-hypercore.ts
|
|
19142
|
-
var
|
|
19151
|
+
var import_core33 = require("@unifold/core");
|
|
19143
19152
|
function isHypercoreChain(chainId) {
|
|
19144
19153
|
return chainId === HYPERCORE_CHAIN_ID;
|
|
19145
19154
|
}
|
|
@@ -19150,7 +19159,7 @@ async function sendHypercoreEvmTransfer(params) {
|
|
|
19150
19159
|
params: []
|
|
19151
19160
|
});
|
|
19152
19161
|
const activeChainId = String(parseInt(currentChainHex, 16));
|
|
19153
|
-
const buildResult = await (0,
|
|
19162
|
+
const buildResult = await (0, import_core33.buildHypercoreTransaction)(
|
|
19154
19163
|
{
|
|
19155
19164
|
signature_chain_id: activeChainId,
|
|
19156
19165
|
recipient_address: recipientAddress,
|
|
@@ -19163,7 +19172,7 @@ async function sendHypercoreEvmTransfer(params) {
|
|
|
19163
19172
|
method: "eth_signTypedData_v4",
|
|
19164
19173
|
params: [fromAddress, JSON.stringify(buildResult.typed_data)]
|
|
19165
19174
|
});
|
|
19166
|
-
await (0,
|
|
19175
|
+
await (0, import_core33.sendHypercoreTransaction)(
|
|
19167
19176
|
{
|
|
19168
19177
|
action_payload: buildResult.action_payload,
|
|
19169
19178
|
signature,
|
|
@@ -19175,8 +19184,8 @@ async function sendHypercoreEvmTransfer(params) {
|
|
|
19175
19184
|
}
|
|
19176
19185
|
|
|
19177
19186
|
// src/hooks/use-deposit-quote.ts
|
|
19178
|
-
var
|
|
19179
|
-
var
|
|
19187
|
+
var import_react_query15 = require("@tanstack/react-query");
|
|
19188
|
+
var import_core34 = require("@unifold/core");
|
|
19180
19189
|
function useDepositQuote(params) {
|
|
19181
19190
|
const {
|
|
19182
19191
|
publishableKey,
|
|
@@ -19202,7 +19211,7 @@ function useDepositQuote(params) {
|
|
|
19202
19211
|
...adjustForSlippage ? { adjust_for_slippage: true } : {},
|
|
19203
19212
|
...stablecoinParity ? { stablecoin_parity: true } : {}
|
|
19204
19213
|
};
|
|
19205
|
-
return (0,
|
|
19214
|
+
return (0, import_react_query15.useQuery)({
|
|
19206
19215
|
queryKey: [
|
|
19207
19216
|
"unifold",
|
|
19208
19217
|
"depositQuote",
|
|
@@ -19217,7 +19226,7 @@ function useDepositQuote(params) {
|
|
|
19217
19226
|
stablecoinParity,
|
|
19218
19227
|
publishableKey
|
|
19219
19228
|
],
|
|
19220
|
-
queryFn: () => (0,
|
|
19229
|
+
queryFn: () => (0, import_core34.getDepositQuote)(request, publishableKey),
|
|
19221
19230
|
enabled: enabled && !!publishableKey && !!sourceChainType && !!sourceChainId && !!sourceTokenAddress && !!destinationAmount && destinationAmount !== "0" && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress,
|
|
19222
19231
|
staleTime: 3e4,
|
|
19223
19232
|
gcTime: 5 * 6e4,
|
|
@@ -19230,15 +19239,15 @@ function useDepositQuote(params) {
|
|
|
19230
19239
|
}
|
|
19231
19240
|
|
|
19232
19241
|
// src/hooks/use-external-wallets.ts
|
|
19233
|
-
var
|
|
19234
|
-
var
|
|
19242
|
+
var import_react_query16 = require("@tanstack/react-query");
|
|
19243
|
+
var import_core35 = require("@unifold/core");
|
|
19235
19244
|
function useExternalWallets({
|
|
19236
19245
|
publishableKey,
|
|
19237
19246
|
enabled = true
|
|
19238
19247
|
}) {
|
|
19239
|
-
const { data: wallets = [], isLoading } = (0,
|
|
19248
|
+
const { data: wallets = [], isLoading } = (0, import_react_query16.useQuery)({
|
|
19240
19249
|
queryKey: ["unifold", "external-wallets", publishableKey],
|
|
19241
|
-
queryFn: () => (0,
|
|
19250
|
+
queryFn: () => (0, import_core35.getExternalWallets)(publishableKey).then((res) => res.data),
|
|
19242
19251
|
enabled: enabled && !!publishableKey,
|
|
19243
19252
|
staleTime: 1e3 * 60 * 30,
|
|
19244
19253
|
refetchOnMount: false,
|
|
@@ -20638,7 +20647,7 @@ function WalletConnect({
|
|
|
20638
20647
|
};
|
|
20639
20648
|
const openMobileWalletBrowse = async (wallet, depositAddresses) => {
|
|
20640
20649
|
try {
|
|
20641
|
-
const res = await (0,
|
|
20650
|
+
const res = await (0, import_core36.getWalletMobileDeepLink)(
|
|
20642
20651
|
wallet.id,
|
|
20643
20652
|
depositAddresses,
|
|
20644
20653
|
publishableKey
|
|
@@ -20949,7 +20958,7 @@ function WalletConnect({
|
|
|
20949
20958
|
destination_chain_type: activeDepositWallet.destination_chain_type,
|
|
20950
20959
|
...productType ? { product_type: productType } : {}
|
|
20951
20960
|
};
|
|
20952
|
-
const response = await (0,
|
|
20961
|
+
const response = await (0, import_core36.getSupportedDepositTokens)(publishableKey, options);
|
|
20953
20962
|
if (cancelled) return;
|
|
20954
20963
|
const supportedToken = response.data.find(
|
|
20955
20964
|
(t13) => t13.symbol.toLowerCase() === token.symbol.toLowerCase()
|
|
@@ -20977,7 +20986,7 @@ function WalletConnect({
|
|
|
20977
20986
|
setIsLoading(true);
|
|
20978
20987
|
setError(null);
|
|
20979
20988
|
const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" || activeDepositWallet.chain_type === "cardano" || activeDepositWallet.chain_type === "n1" ? "ethereum" : activeDepositWallet.chain_type;
|
|
20980
|
-
(0,
|
|
20989
|
+
(0, import_core36.getAddressBalances)(activeWalletInfo.address, sct, publishableKey).then((response) => {
|
|
20981
20990
|
if (cancelled) return;
|
|
20982
20991
|
const nonZero = response.balances.filter((b) => b.amount !== "0");
|
|
20983
20992
|
const defaultSource = {
|
|
@@ -21253,7 +21262,7 @@ function WalletConnect({
|
|
|
21253
21262
|
if (!provider.publicKey) await provider.connect();
|
|
21254
21263
|
const isNative = token.token_address === "native" || token.token_address === "So11111111111111111111111111111111111111112" || token.token_address === "";
|
|
21255
21264
|
const smallestUnit = isNative ? decimalToSmallestUnit(amountStr, 9) : decimalToSmallestUnit(amountStr, token.decimals);
|
|
21256
|
-
const buildResp = await (0,
|
|
21265
|
+
const buildResp = await (0, import_core36.buildSolanaTransaction)(
|
|
21257
21266
|
{
|
|
21258
21267
|
chain_id: "mainnet",
|
|
21259
21268
|
token_address: token.token_address === "" ? "native" : token.token_address,
|
|
@@ -21275,7 +21284,7 @@ function WalletConnect({
|
|
|
21275
21284
|
const ser = signed.serialize();
|
|
21276
21285
|
let bs = "";
|
|
21277
21286
|
for (let i = 0; i < ser.length; i++) bs += String.fromCharCode(ser[i]);
|
|
21278
|
-
const resp = await (0,
|
|
21287
|
+
const resp = await (0, import_core36.sendSolanaTransaction)(
|
|
21279
21288
|
{ chain_id: "mainnet", signed_transaction: btoa(bs) },
|
|
21280
21289
|
publishableKey
|
|
21281
21290
|
);
|
|
@@ -21321,7 +21330,7 @@ function WalletConnect({
|
|
|
21321
21330
|
} else if (isHypercoreToken) {
|
|
21322
21331
|
let sendAmount = tokenAmount;
|
|
21323
21332
|
try {
|
|
21324
|
-
const activation = await (0,
|
|
21333
|
+
const activation = await (0, import_core36.checkHypercoreActivation)(
|
|
21325
21334
|
{ source_address: walletInfo.address, recipient_address: recipientAddress },
|
|
21326
21335
|
publishableKey
|
|
21327
21336
|
);
|
|
@@ -21369,116 +21378,131 @@ function WalletConnect({
|
|
|
21369
21378
|
] });
|
|
21370
21379
|
}
|
|
21371
21380
|
if (view === "select_wallet") {
|
|
21372
|
-
return
|
|
21373
|
-
|
|
21374
|
-
|
|
21381
|
+
return (
|
|
21382
|
+
// Mobile: flex column that fills the full-height sheet so the wallet list
|
|
21383
|
+
// scrolls and the footer pins to the bottom. Desktop (sm:): content-sized.
|
|
21384
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
21385
|
+
"div",
|
|
21375
21386
|
{
|
|
21376
|
-
|
|
21377
|
-
|
|
21378
|
-
|
|
21379
|
-
|
|
21380
|
-
|
|
21381
|
-
|
|
21382
|
-
|
|
21383
|
-
|
|
21384
|
-
|
|
21385
|
-
|
|
21386
|
-
|
|
21387
|
-
|
|
21388
|
-
|
|
21389
|
-
|
|
21390
|
-
|
|
21391
|
-
|
|
21392
|
-
|
|
21393
|
-
|
|
21394
|
-
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
|
-
|
|
21398
|
-
|
|
21399
|
-
|
|
21400
|
-
|
|
21401
|
-
|
|
21402
|
-
|
|
21403
|
-
|
|
21404
|
-
|
|
21405
|
-
|
|
21406
|
-
|
|
21407
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
21408
|
-
WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21409
|
-
WalletIconWithNetwork,
|
|
21410
|
-
{
|
|
21411
|
-
WalletIcon: WALLET_ICONS3[wallet.id],
|
|
21412
|
-
networks: wallet.networks,
|
|
21413
|
-
size: 40,
|
|
21414
|
-
className: "uf-rounded-lg"
|
|
21415
|
-
}
|
|
21416
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
|
|
21417
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
21418
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21419
|
-
"div",
|
|
21420
|
-
{
|
|
21421
|
-
className: "uf-text-sm uf-font-medium",
|
|
21422
|
-
style: { color: components.card.titleColor, fontFamily: fonts.medium },
|
|
21423
|
-
children: wallet.name
|
|
21424
|
-
}
|
|
21425
|
-
),
|
|
21426
|
-
wallet.id === recentWalletId && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21427
|
-
"span",
|
|
21428
|
-
{
|
|
21429
|
-
className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full",
|
|
21430
|
-
style: {
|
|
21431
|
-
backgroundColor: colors2.primary + "20",
|
|
21432
|
-
color: colors2.primary,
|
|
21433
|
-
fontFamily: fonts.medium
|
|
21434
|
-
},
|
|
21435
|
-
children: "Last used"
|
|
21436
|
-
}
|
|
21437
|
-
)
|
|
21438
|
-
] })
|
|
21439
|
-
] }),
|
|
21440
|
-
isPending ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21441
|
-
import_lucide_react36.Loader2,
|
|
21442
|
-
{
|
|
21443
|
-
className: "uf-w-4 uf-h-4 uf-animate-spin",
|
|
21444
|
-
style: { color: colors2.primary }
|
|
21445
|
-
}
|
|
21446
|
-
) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21447
|
-
"span",
|
|
21387
|
+
style: viewTransitionStyle,
|
|
21388
|
+
className: "uf-flex uf-min-h-0 uf-flex-1 uf-flex-col sm:uf-block",
|
|
21389
|
+
children: [
|
|
21390
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21391
|
+
DepositHeader,
|
|
21392
|
+
{
|
|
21393
|
+
title: "Connect Wallet",
|
|
21394
|
+
showBack: canGoBack,
|
|
21395
|
+
onBack: handleBack,
|
|
21396
|
+
onClose
|
|
21397
|
+
}
|
|
21398
|
+
),
|
|
21399
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "uf-pb-4 uf-flex uf-min-h-0 uf-flex-1 uf-flex-col sm:uf-block", children: [
|
|
21400
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21401
|
+
"p",
|
|
21402
|
+
{
|
|
21403
|
+
className: "uf-text-sm uf-text-center uf-pb-4",
|
|
21404
|
+
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
21405
|
+
children: isMobile ? "Open this page in your wallet's app to connect" : "Select a wallet to connect"
|
|
21406
|
+
}
|
|
21407
|
+
),
|
|
21408
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-space-y-2 uf-min-h-0 uf-flex-1 uf-overflow-y-auto sm:uf-flex-none sm:uf-max-h-[330px] [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: availableWallets.filter((wallet) => {
|
|
21409
|
+
if (!isMobile || wallet.isInstalled) return true;
|
|
21410
|
+
const platformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
|
|
21411
|
+
return wallet.supportsMobileBrowse !== false && platformAllowed;
|
|
21412
|
+
}).map((wallet) => {
|
|
21413
|
+
const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
|
|
21414
|
+
const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
|
|
21415
|
+
const isPending = pendingMobileWallet?.id === wallet.id;
|
|
21416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
21417
|
+
"button",
|
|
21448
21418
|
{
|
|
21449
|
-
|
|
21419
|
+
onClick: () => void handleWalletClick(wallet),
|
|
21420
|
+
disabled: isWalletConnecting || !!pendingMobileWallet,
|
|
21421
|
+
className: "uf-w-full uf-transition-colors uf-p-3 uf-flex uf-items-center uf-justify-between hover:uf-opacity-90 disabled:uf-opacity-50",
|
|
21450
21422
|
style: {
|
|
21451
|
-
backgroundColor:
|
|
21452
|
-
|
|
21453
|
-
|
|
21423
|
+
backgroundColor: components.card.backgroundColor,
|
|
21424
|
+
borderRadius: components.card.borderRadius,
|
|
21425
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
21454
21426
|
},
|
|
21455
|
-
children:
|
|
21456
|
-
|
|
21457
|
-
|
|
21458
|
-
|
|
21459
|
-
|
|
21460
|
-
|
|
21461
|
-
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
|
|
21468
|
-
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
21472
|
-
|
|
21473
|
-
|
|
21474
|
-
|
|
21475
|
-
|
|
21476
|
-
|
|
21477
|
-
|
|
21478
|
-
|
|
21479
|
-
|
|
21480
|
-
|
|
21481
|
-
|
|
21427
|
+
children: [
|
|
21428
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
21429
|
+
WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21430
|
+
WalletIconWithNetwork,
|
|
21431
|
+
{
|
|
21432
|
+
WalletIcon: WALLET_ICONS3[wallet.id],
|
|
21433
|
+
networks: wallet.networks,
|
|
21434
|
+
size: 40,
|
|
21435
|
+
className: "uf-rounded-lg"
|
|
21436
|
+
}
|
|
21437
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
|
|
21438
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
21439
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21440
|
+
"div",
|
|
21441
|
+
{
|
|
21442
|
+
className: "uf-text-sm uf-font-medium",
|
|
21443
|
+
style: { color: components.card.titleColor, fontFamily: fonts.medium },
|
|
21444
|
+
children: wallet.name
|
|
21445
|
+
}
|
|
21446
|
+
),
|
|
21447
|
+
wallet.id === recentWalletId && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21448
|
+
"span",
|
|
21449
|
+
{
|
|
21450
|
+
className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full",
|
|
21451
|
+
style: {
|
|
21452
|
+
backgroundColor: colors2.primary + "20",
|
|
21453
|
+
color: colors2.primary,
|
|
21454
|
+
fontFamily: fonts.medium
|
|
21455
|
+
},
|
|
21456
|
+
children: "Last used"
|
|
21457
|
+
}
|
|
21458
|
+
)
|
|
21459
|
+
] })
|
|
21460
|
+
] }),
|
|
21461
|
+
isPending ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21462
|
+
import_lucide_react36.Loader2,
|
|
21463
|
+
{
|
|
21464
|
+
className: "uf-w-4 uf-h-4 uf-animate-spin",
|
|
21465
|
+
style: { color: colors2.primary }
|
|
21466
|
+
}
|
|
21467
|
+
) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21468
|
+
"span",
|
|
21469
|
+
{
|
|
21470
|
+
className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full",
|
|
21471
|
+
style: {
|
|
21472
|
+
backgroundColor: colors2.primary + "20",
|
|
21473
|
+
color: colors2.primary,
|
|
21474
|
+
fontFamily: fonts.medium
|
|
21475
|
+
},
|
|
21476
|
+
children: "Detected"
|
|
21477
|
+
}
|
|
21478
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
|
|
21479
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21480
|
+
"span",
|
|
21481
|
+
{
|
|
21482
|
+
className: "uf-text-xs",
|
|
21483
|
+
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
21484
|
+
children: showOpenInApp ? "Open" : "Install"
|
|
21485
|
+
}
|
|
21486
|
+
),
|
|
21487
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
21488
|
+
import_lucide_react36.ExternalLink,
|
|
21489
|
+
{
|
|
21490
|
+
className: "uf-w-3 uf-h-3",
|
|
21491
|
+
style: { color: colors2.foregroundMuted }
|
|
21492
|
+
}
|
|
21493
|
+
)
|
|
21494
|
+
] })
|
|
21495
|
+
]
|
|
21496
|
+
},
|
|
21497
|
+
wallet.id
|
|
21498
|
+
);
|
|
21499
|
+
}) }),
|
|
21500
|
+
walletError && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
|
|
21501
|
+
] })
|
|
21502
|
+
]
|
|
21503
|
+
}
|
|
21504
|
+
)
|
|
21505
|
+
);
|
|
21482
21506
|
}
|
|
21483
21507
|
const preConnectAccent = selectedWalletDef ? getWalletBrandColor(selectedWalletDef.id, mode) : void 0;
|
|
21484
21508
|
const preConnectFg = preConnectAccent ? getContrastingTextColor(preConnectAccent) : void 0;
|
|
@@ -21683,8 +21707,8 @@ function WalletConnect({
|
|
|
21683
21707
|
] }) });
|
|
21684
21708
|
}
|
|
21685
21709
|
if (view === "mobile_deposit_status" && latestDepositExecution) {
|
|
21686
|
-
const isComplete = latestDepositExecution.status ===
|
|
21687
|
-
const isFailed = latestDepositExecution.status ===
|
|
21710
|
+
const isComplete = latestDepositExecution.status === import_core36.ExecutionStatus.SUCCEEDED;
|
|
21711
|
+
const isFailed = latestDepositExecution.status === import_core36.ExecutionStatus.FAILED;
|
|
21688
21712
|
const title = isComplete ? "Payment Complete" : isFailed ? "Payment Failed" : "Payment Processing";
|
|
21689
21713
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
21690
21714
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
@@ -21870,7 +21894,9 @@ function DepositModal({
|
|
|
21870
21894
|
applePayTitle = "Pay with Apple Pay",
|
|
21871
21895
|
applePaySubTitle = "Instant",
|
|
21872
21896
|
enableBankTransfer,
|
|
21873
|
-
|
|
21897
|
+
// No default: left undefined so the backend `stripe_link.enabled` can govern
|
|
21898
|
+
// (via the `??` chain in showStripeLink) once a dashboard toggle exists.
|
|
21899
|
+
enableStripeLink,
|
|
21874
21900
|
userEmail,
|
|
21875
21901
|
hideDepositFlowInfo = false,
|
|
21876
21902
|
hideDisplayDescription = false,
|
|
@@ -21951,14 +21977,18 @@ function DepositModal({
|
|
|
21951
21977
|
const [allExecutions, setAllExecutions] = (0, import_react26.useState)([]);
|
|
21952
21978
|
const [selectedExecution, setSelectedExecution] = (0, import_react26.useState)(null);
|
|
21953
21979
|
const [depositExecutions, setDepositExecutions] = (0, import_react26.useState)([]);
|
|
21980
|
+
const { userIpInfo, isLoading: isLoadingIp } = useUserIp();
|
|
21954
21981
|
const { projectConfig } = useProjectConfig({
|
|
21955
21982
|
publishableKey,
|
|
21956
|
-
enabled: open
|
|
21983
|
+
enabled: open && !isLoadingIp,
|
|
21984
|
+
countryCode: userIpInfo?.alpha2,
|
|
21985
|
+
subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
|
|
21957
21986
|
});
|
|
21958
21987
|
const showTransferCrypto = enableTransferCrypto ?? projectConfig?.transfer_crypto?.enabled ?? true;
|
|
21959
21988
|
const showConnectWallet = enableConnectWallet ?? projectConfig?.connect_wallet?.enabled ?? true;
|
|
21960
21989
|
const showPayWithExchange = enablePayWithExchange ?? projectConfig?.pay_with_exchange?.enabled ?? true;
|
|
21961
21990
|
const showFiatOnramp = !projectConfig?.fiat_onramp?.is_hidden && (enableFiatOnramp ?? projectConfig?.fiat_onramp?.enabled ?? true);
|
|
21991
|
+
const showStripeLink = !projectConfig?.stripe_link?.is_hidden && (enableStripeLink ?? projectConfig?.stripe_link?.enabled ?? false);
|
|
21962
21992
|
const showConnectExchange = enableConnectExchange ?? projectConfig?.connect_exchange?.enabled ?? true;
|
|
21963
21993
|
const showCashApp = enableCashApp ?? projectConfig?.cash_app?.enabled ?? true;
|
|
21964
21994
|
const showApplePay = enableApplePay ?? projectConfig?.apple_pay?.enabled ?? true;
|
|
@@ -21967,18 +21997,18 @@ function DepositModal({
|
|
|
21967
21997
|
const [integrationExchanges, setIntegrationExchanges] = (0, import_react26.useState)([]);
|
|
21968
21998
|
(0, import_react26.useEffect)(() => {
|
|
21969
21999
|
if (!showConnectExchange || !open) return;
|
|
21970
|
-
(0,
|
|
22000
|
+
(0, import_core37.getIntegrationExchanges)(publishableKey).then((res) => setIntegrationExchanges(res.data)).catch(() => {
|
|
21971
22001
|
});
|
|
21972
22002
|
}, [showConnectExchange, open, publishableKey]);
|
|
21973
22003
|
const [connectedExchange, setConnectedExchange] = (0, import_react26.useState)(() => {
|
|
21974
22004
|
if (!showConnectExchange) return null;
|
|
21975
|
-
const stored = getStoredIntegrationToken(
|
|
22005
|
+
const stored = getStoredIntegrationToken(import_core37.IntegrationProvider.COINBASE);
|
|
21976
22006
|
if (!stored) return null;
|
|
21977
22007
|
return { name: "Coinbase", iconUrl: void 0, balanceUsd: null, isLoading: true };
|
|
21978
22008
|
});
|
|
21979
22009
|
(0, import_react26.useEffect)(() => {
|
|
21980
22010
|
if (!showConnectExchange || !open || view !== "main") return;
|
|
21981
|
-
const stored = getStoredIntegrationToken(
|
|
22011
|
+
const stored = getStoredIntegrationToken(import_core37.IntegrationProvider.COINBASE);
|
|
21982
22012
|
if (!stored) {
|
|
21983
22013
|
setConnectedExchange(null);
|
|
21984
22014
|
return;
|
|
@@ -21998,24 +22028,24 @@ function DepositModal({
|
|
|
21998
22028
|
}) : null;
|
|
21999
22029
|
setConnectedExchange((prev) => prev ? { ...prev, balanceUsd, isLoading: false } : null);
|
|
22000
22030
|
};
|
|
22001
|
-
(0,
|
|
22031
|
+
(0, import_core37.getIntegrationHoldings)(import_core37.IntegrationProvider.COINBASE, stored.access_token, publishableKey).then(processHoldings).catch(async () => {
|
|
22002
22032
|
try {
|
|
22003
|
-
const refreshResult = await (0,
|
|
22004
|
-
if (!getStoredIntegrationToken(
|
|
22033
|
+
const refreshResult = await (0, import_core37.refreshIntegrationToken)(stored.access_token, publishableKey);
|
|
22034
|
+
if (!getStoredIntegrationToken(import_core37.IntegrationProvider.COINBASE)) return;
|
|
22005
22035
|
setStoredIntegrationToken({
|
|
22006
|
-
integration_provider:
|
|
22036
|
+
integration_provider: import_core37.IntegrationProvider.COINBASE,
|
|
22007
22037
|
access_token: refreshResult.access_token,
|
|
22008
22038
|
expires_at: refreshResult.expires_at
|
|
22009
22039
|
});
|
|
22010
|
-
const retryResult = await (0,
|
|
22011
|
-
|
|
22040
|
+
const retryResult = await (0, import_core37.getIntegrationHoldings)(
|
|
22041
|
+
import_core37.IntegrationProvider.COINBASE,
|
|
22012
22042
|
refreshResult.access_token,
|
|
22013
22043
|
publishableKey
|
|
22014
22044
|
);
|
|
22015
22045
|
processHoldings(retryResult);
|
|
22016
22046
|
} catch {
|
|
22017
|
-
if (!getStoredIntegrationToken(
|
|
22018
|
-
clearStoredIntegrationToken(
|
|
22047
|
+
if (!getStoredIntegrationToken(import_core37.IntegrationProvider.COINBASE)) return;
|
|
22048
|
+
clearStoredIntegrationToken(import_core37.IntegrationProvider.COINBASE);
|
|
22019
22049
|
setConnectedExchange(null);
|
|
22020
22050
|
}
|
|
22021
22051
|
});
|
|
@@ -22023,7 +22053,7 @@ function DepositModal({
|
|
|
22023
22053
|
(0, import_react26.useEffect)(() => {
|
|
22024
22054
|
if (!connectedExchange || integrationExchanges.length === 0) return;
|
|
22025
22055
|
const cbExchange = integrationExchanges.find(
|
|
22026
|
-
(e) => e.service_provider ===
|
|
22056
|
+
(e) => e.service_provider === import_core37.IntegrationProvider.COINBASE
|
|
22027
22057
|
);
|
|
22028
22058
|
const iconUrl = cbExchange?.icon_urls?.find((u) => u.format === "svg")?.url || cbExchange?.icon_urls?.find((u) => u.format === "png")?.url || cbExchange?.icon_url;
|
|
22029
22059
|
if (iconUrl && iconUrl !== connectedExchange.iconUrl) {
|
|
@@ -22104,7 +22134,6 @@ function DepositModal({
|
|
|
22104
22134
|
publishableKey,
|
|
22105
22135
|
enabled: open && showPayWithExchange
|
|
22106
22136
|
});
|
|
22107
|
-
const { userIpInfo, isLoading: isLoadingIp } = useUserIp();
|
|
22108
22137
|
const { providers: bankTransferProviders, isLoading: bankTransferProvidersLoading } = useBankTransferProviders({
|
|
22109
22138
|
publishableKey,
|
|
22110
22139
|
enabled: open && !!userIpInfo?.alpha2,
|
|
@@ -22129,7 +22158,7 @@ function DepositModal({
|
|
|
22129
22158
|
if (view !== "tracker" || !userId) return;
|
|
22130
22159
|
const fetchExecutions = async () => {
|
|
22131
22160
|
try {
|
|
22132
|
-
const response = await (0,
|
|
22161
|
+
const response = await (0, import_core37.queryExecutions)(userId, publishableKey, import_core37.ActionType.Deposit);
|
|
22133
22162
|
const sorted = [...response.data].sort((a, b) => {
|
|
22134
22163
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
22135
22164
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -22231,11 +22260,11 @@ function DepositModal({
|
|
|
22231
22260
|
if (view === "wallet_connect" && sessionOpenedFromMenu) setView("main");
|
|
22232
22261
|
};
|
|
22233
22262
|
const handleExchangeDisconnect = () => {
|
|
22234
|
-
const stored = getStoredIntegrationToken(
|
|
22263
|
+
const stored = getStoredIntegrationToken(import_core37.IntegrationProvider.COINBASE);
|
|
22235
22264
|
if (stored) {
|
|
22236
|
-
(0,
|
|
22265
|
+
(0, import_core37.revokeIntegrationToken)(stored.access_token, publishableKey);
|
|
22237
22266
|
}
|
|
22238
|
-
clearStoredIntegrationToken(
|
|
22267
|
+
clearStoredIntegrationToken(import_core37.IntegrationProvider.COINBASE);
|
|
22239
22268
|
setConnectedExchange(null);
|
|
22240
22269
|
if (view === "coinbase_connect" && sessionOpenedFromMenu) setView("main");
|
|
22241
22270
|
};
|
|
@@ -22282,6 +22311,12 @@ function DepositModal({
|
|
|
22282
22311
|
const [cashAppView, setCashAppView] = (0, import_react26.useState)("amount");
|
|
22283
22312
|
const [stripeLinkStep, setStripeLinkStep] = (0, import_react26.useState)("amount");
|
|
22284
22313
|
const stripeLinkBackRef = (0, import_react26.useRef)(null);
|
|
22314
|
+
(0, import_react26.useEffect)(() => {
|
|
22315
|
+
if (view === "stripe_link" && !showStripeLink && effectiveInitialScreen === "main") {
|
|
22316
|
+
setView("main");
|
|
22317
|
+
setStripeLinkStep("amount");
|
|
22318
|
+
}
|
|
22319
|
+
}, [view, showStripeLink, effectiveInitialScreen]);
|
|
22285
22320
|
const [cashAppAmount, setCashAppAmount] = (0, import_react26.useState)("");
|
|
22286
22321
|
const [applePayView, setApplePayView] = (0, import_react26.useState)("email_input");
|
|
22287
22322
|
const applePayHandleRef = (0, import_react26.useRef)(null);
|
|
@@ -22506,7 +22541,7 @@ function DepositModal({
|
|
|
22506
22541
|
},
|
|
22507
22542
|
"cashapp"
|
|
22508
22543
|
) : null;
|
|
22509
|
-
const stripeLinkMenuButton =
|
|
22544
|
+
const stripeLinkMenuButton = showStripeLink ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22510
22545
|
StripeLinkButton,
|
|
22511
22546
|
{
|
|
22512
22547
|
onClick: () => setView("stripe_link"),
|
|
@@ -22554,11 +22589,13 @@ function DepositModal({
|
|
|
22554
22589
|
connectExchangeMenuButton
|
|
22555
22590
|
].filter(Boolean);
|
|
22556
22591
|
const cashMenuButtons = [
|
|
22592
|
+
// Stripe "Pay with Link" is intentionally listed first so it always sits
|
|
22593
|
+
// above "Deposit with Card".
|
|
22594
|
+
stripeLinkMenuButton,
|
|
22557
22595
|
depositWithCardMenuButton,
|
|
22558
22596
|
applePayMenuButton,
|
|
22559
22597
|
cashAppMenuButton,
|
|
22560
|
-
bankTransferMenuButton
|
|
22561
|
-
stripeLinkMenuButton
|
|
22598
|
+
bankTransferMenuButton
|
|
22562
22599
|
].filter(Boolean);
|
|
22563
22600
|
const depositTabs = [
|
|
22564
22601
|
{ id: "crypto", label: "Use Crypto", icon: import_lucide_react37.Bitcoin, buttons: cryptoMenuButtons },
|
|
@@ -22653,13 +22690,13 @@ function DepositModal({
|
|
|
22653
22690
|
const stackedOptions = [
|
|
22654
22691
|
transferCryptoMenuButton,
|
|
22655
22692
|
connectWalletMenuButton,
|
|
22693
|
+
stripeLinkMenuButton,
|
|
22656
22694
|
depositWithCardMenuButton,
|
|
22657
22695
|
applePayMenuButton,
|
|
22658
22696
|
payWithExchangeMenuButton,
|
|
22659
22697
|
connectExchangeMenuButton,
|
|
22660
22698
|
cashAppMenuButton,
|
|
22661
22699
|
bankTransferMenuButton,
|
|
22662
|
-
stripeLinkMenuButton,
|
|
22663
22700
|
depositTrackerMenuButton
|
|
22664
22701
|
].filter(Boolean);
|
|
22665
22702
|
return renderScrollableOptions(stackedOptions);
|
|
@@ -22675,410 +22712,452 @@ function DepositModal({
|
|
|
22675
22712
|
{
|
|
22676
22713
|
ref: hideOverlay ? containerCallbackRef : void 0,
|
|
22677
22714
|
hideOverlay,
|
|
22678
|
-
className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden ${hideOverlay ? `uf-p-6 uf-overflow-hidden ${themeClass}` : `uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[85vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${
|
|
22715
|
+
className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden ${hideOverlay ? `uf-p-6 uf-overflow-hidden ${themeClass}` : `uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[85vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${// wallet_connect fills the full-height mobile sheet. DialogContent
|
|
22716
|
+
// is a grid, and its single auto row only *grows* to fill free
|
|
22717
|
+
// space (align-content: stretch) — it never shrinks below content,
|
|
22718
|
+
// so a long wallet list would balloon the row past the viewport and
|
|
22719
|
+
// push the footer off-screen instead of scrolling. Clamp the row to
|
|
22720
|
+
// the modal height with minmax(0,1fr) so the inner overflow-y-auto
|
|
22721
|
+
// list scrolls with the footer pinned. Reset to content-sized on
|
|
22722
|
+
// desktop (sm:) where the modal is auto-height and centered.
|
|
22723
|
+
view === "wallet_connect" ? "[grid-template-rows:minmax(0,1fr)] sm:[grid-template-rows:none]" : ""} ${themeClass}`}`,
|
|
22679
22724
|
style: { backgroundColor: colors2.background },
|
|
22680
22725
|
onPointerDownOutside: (e) => e.preventDefault(),
|
|
22681
22726
|
onInteractOutside: (e) => e.preventDefault(),
|
|
22682
22727
|
children: [
|
|
22683
22728
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DialogTitle, { className: "uf-sr-only", children: modalTitle || "Deposit" }),
|
|
22684
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
|
|
22694
|
-
|
|
22695
|
-
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
|
|
22718
|
-
|
|
22719
|
-
|
|
22720
|
-
|
|
22721
|
-
|
|
22722
|
-
|
|
22723
|
-
|
|
22724
|
-
|
|
22725
|
-
|
|
22726
|
-
|
|
22727
|
-
|
|
22728
|
-
|
|
22729
|
-
|
|
22730
|
-
|
|
22731
|
-
|
|
22732
|
-
|
|
22733
|
-
|
|
22734
|
-
|
|
22735
|
-
|
|
22736
|
-
|
|
22737
|
-
|
|
22738
|
-
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
|
|
22742
|
-
userId,
|
|
22743
|
-
publishableKey,
|
|
22744
|
-
recipientAddress,
|
|
22745
|
-
destinationChainType,
|
|
22746
|
-
destinationChainId,
|
|
22747
|
-
destinationTokenAddress,
|
|
22748
|
-
defaultSourceChainType,
|
|
22749
|
-
defaultSourceChainId,
|
|
22750
|
-
defaultSourceTokenAddress,
|
|
22751
|
-
defaultSourceSymbol,
|
|
22752
|
-
depositConfirmationMode,
|
|
22753
|
-
onExecutionsChange: setDepositExecutions,
|
|
22754
|
-
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
22755
|
-
onDepositError: onDepositErrorFor("transfer"),
|
|
22756
|
-
wallets
|
|
22757
|
-
}
|
|
22758
|
-
),
|
|
22759
|
-
depositPoweredByFooter
|
|
22760
|
-
] })
|
|
22761
|
-
] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
22762
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22763
|
-
DepositHeader,
|
|
22764
|
-
{
|
|
22765
|
-
title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
|
|
22766
|
-
showBack: showBackTracker,
|
|
22767
|
-
onBack: handleBack,
|
|
22768
|
-
onClose: handleClose
|
|
22769
|
-
}
|
|
22770
|
-
),
|
|
22771
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22772
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22773
|
-
"div",
|
|
22774
|
-
{
|
|
22775
|
-
className: "uf-text-sm",
|
|
22776
|
-
style: {
|
|
22777
|
-
color: components.container.subtitleColor,
|
|
22778
|
-
fontFamily: fonts.regular
|
|
22779
|
-
},
|
|
22780
|
-
children: "No deposits yet"
|
|
22781
|
-
}
|
|
22782
|
-
) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22783
|
-
DepositExecutionItem,
|
|
22784
|
-
{
|
|
22785
|
-
execution,
|
|
22786
|
-
onClick: () => setSelectedExecution(execution)
|
|
22787
|
-
},
|
|
22788
|
-
execution.id
|
|
22789
|
-
)) }) }),
|
|
22790
|
-
depositPoweredByFooter
|
|
22791
|
-
] })
|
|
22792
|
-
] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
22793
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22794
|
-
DepositHeader,
|
|
22795
|
-
{
|
|
22796
|
-
title: cardView === "quotes" ? t8.quotes : depositWithCardTitle,
|
|
22797
|
-
showBack: showBackCard,
|
|
22798
|
-
onBack: handleBack,
|
|
22799
|
-
onClose: handleClose,
|
|
22800
|
-
badge: cardView === "quotes" ? { count: quotesCount } : void 0,
|
|
22801
|
-
showBalance: showBalanceHeader,
|
|
22802
|
-
balanceAddress: recipientAddress,
|
|
22803
|
-
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
|
|
22804
|
-
balanceChainId: destinationChainId,
|
|
22805
|
-
balanceTokenAddress: destinationTokenAddress,
|
|
22806
|
-
projectName: projectConfig?.project_name,
|
|
22807
|
-
publishableKey
|
|
22808
|
-
}
|
|
22809
|
-
),
|
|
22810
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22811
|
-
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : !showFiatOnramp ? (
|
|
22812
|
-
// Fiat on-ramp resolved hidden/disabled after a direct open
|
|
22813
|
-
// (e.g. platform `is_hidden` for a Stripe Link-only project).
|
|
22814
|
-
// Show a geo-restriction screen rather than the card UI so the
|
|
22815
|
-
// hard-hide is honoured without a flash of "Pay with Card".
|
|
22816
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(GeoRestrictionScreen, { methodName: "Card" })
|
|
22817
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22818
|
-
BuyWithCard,
|
|
22819
|
-
{
|
|
22820
|
-
userId,
|
|
22821
|
-
publishableKey,
|
|
22822
|
-
view: cardView,
|
|
22823
|
-
onViewChange: handleCardViewChange,
|
|
22824
|
-
destinationTokenSymbol,
|
|
22825
|
-
recipientAddress,
|
|
22826
|
-
destinationChainType,
|
|
22827
|
-
destinationChainId,
|
|
22828
|
-
destinationTokenAddress,
|
|
22829
|
-
onDepositSuccess: onDepositSuccessFor("card"),
|
|
22830
|
-
onDepositError: onDepositErrorFor("card"),
|
|
22831
|
-
onEvent,
|
|
22832
|
-
themeClass,
|
|
22833
|
-
wallets,
|
|
22834
|
-
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
22835
|
-
hideDepositFlowInfo,
|
|
22836
|
-
hideDisplayDescription
|
|
22837
|
-
}
|
|
22838
|
-
),
|
|
22839
|
-
depositPoweredByFooter
|
|
22840
|
-
] })
|
|
22841
|
-
] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
22842
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22843
|
-
DepositHeader,
|
|
22844
|
-
{
|
|
22845
|
-
title: payWithExchangeTitle,
|
|
22846
|
-
showBack: exchangeView === "pending" || sessionOpenedFromMenu,
|
|
22847
|
-
onBack: handleBack,
|
|
22848
|
-
onClose: handleClose
|
|
22849
|
-
}
|
|
22850
|
-
),
|
|
22851
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22852
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22853
|
-
PayWithExchange,
|
|
22854
|
-
{
|
|
22855
|
-
userId,
|
|
22856
|
-
publishableKey,
|
|
22857
|
-
exchanges,
|
|
22858
|
-
view: exchangeView,
|
|
22859
|
-
onViewChange: setExchangeView,
|
|
22860
|
-
destinationTokenSymbol,
|
|
22861
|
-
recipientAddress,
|
|
22862
|
-
destinationChainType,
|
|
22863
|
-
destinationChainId,
|
|
22864
|
-
destinationTokenAddress,
|
|
22865
|
-
onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
|
|
22866
|
-
onDepositError: onDepositErrorFor("pay_with_exchange"),
|
|
22867
|
-
wallets,
|
|
22868
|
-
defaultToken: defaultToken ?? null
|
|
22869
|
-
}
|
|
22870
|
-
),
|
|
22871
|
-
depositPoweredByFooter
|
|
22872
|
-
] })
|
|
22873
|
-
] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22874
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22875
|
-
CoinbaseConnect,
|
|
22876
|
-
{
|
|
22877
|
-
publishableKey,
|
|
22878
|
-
userId,
|
|
22879
|
-
wallets,
|
|
22880
|
-
recipientAddress,
|
|
22881
|
-
destinationTokenAddress: destinationTokenAddress ?? "",
|
|
22882
|
-
destinationChainId: destinationChainId ?? "",
|
|
22883
|
-
destinationChainType: destinationChainType ?? "",
|
|
22884
|
-
onDepositSuccess: onDepositSuccessFor("exchange_connect"),
|
|
22885
|
-
onDepositError: onDepositErrorFor("exchange_connect"),
|
|
22886
|
-
onTransferError: (error) => {
|
|
22887
|
-
onDepositErrorFor("exchange_connect")?.({
|
|
22888
|
-
message: error.message,
|
|
22889
|
-
error
|
|
22890
|
-
});
|
|
22891
|
-
},
|
|
22892
|
-
onBack: handleBack,
|
|
22893
|
-
onClose: handleClose,
|
|
22894
|
-
onDisconnect: handleExchangeDisconnect,
|
|
22895
|
-
skipToHoldings: coinbaseSkipToHoldings,
|
|
22896
|
-
canGoBack: sessionOpenedFromMenu,
|
|
22897
|
-
onExecutionsChange: setDepositExecutions,
|
|
22898
|
-
defaultSourceChainType,
|
|
22899
|
-
defaultSourceChainId,
|
|
22900
|
-
defaultSourceTokenAddress,
|
|
22901
|
-
defaultSourceSymbol
|
|
22902
|
-
}
|
|
22903
|
-
),
|
|
22904
|
-
depositPoweredByFooter
|
|
22905
|
-
] }) : view === "wallet_connect" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22906
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22907
|
-
WalletConnect,
|
|
22908
|
-
{
|
|
22909
|
-
walletInfo: browserWalletInfo ?? void 0,
|
|
22910
|
-
depositWallet: browserWalletInfo?.depositWallet ?? void 0,
|
|
22911
|
-
wallets,
|
|
22912
|
-
userId,
|
|
22913
|
-
publishableKey,
|
|
22914
|
-
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
22915
|
-
projectName: projectConfig?.project_name,
|
|
22916
|
-
onError: (error) => {
|
|
22917
|
-
onDepositErrorFor("wallet_connect")?.({
|
|
22918
|
-
message: error.message,
|
|
22919
|
-
error
|
|
22920
|
-
});
|
|
22921
|
-
},
|
|
22922
|
-
onDepositSuccess: onDepositSuccessFor("wallet_connect"),
|
|
22923
|
-
onDepositError: onDepositErrorFor("wallet_connect"),
|
|
22924
|
-
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
22925
|
-
onWalletDisconnect: handleWalletDisconnect,
|
|
22926
|
-
onWalletConnected: (info, dw) => {
|
|
22927
|
-
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
22928
|
-
setStoredWalletState(info.type);
|
|
22929
|
-
setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
|
|
22930
|
-
},
|
|
22931
|
-
onBack: handleBack,
|
|
22932
|
-
onClose: handleClose,
|
|
22933
|
-
defaultSourceChainType,
|
|
22934
|
-
defaultSourceChainId,
|
|
22935
|
-
defaultSourceTokenAddress,
|
|
22936
|
-
defaultSourceSymbol,
|
|
22937
|
-
canGoBack: sessionOpenedFromMenu,
|
|
22938
|
-
depositWalletsLoading: walletsLoading
|
|
22939
|
-
}
|
|
22940
|
-
),
|
|
22941
|
-
depositPoweredByFooter
|
|
22942
|
-
] }) : view === "bank_transfer" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
22943
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22944
|
-
DepositHeader,
|
|
22945
|
-
{
|
|
22946
|
-
title: t8.bankTransfer.title,
|
|
22947
|
-
showBack: bankTransferView !== "providers" || sessionOpenedFromMenu,
|
|
22948
|
-
onBack: handleBack,
|
|
22949
|
-
onClose: handleClose
|
|
22950
|
-
}
|
|
22951
|
-
),
|
|
22952
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22953
|
-
bankTransferProvidersLoading ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SkeletonButton, { variant: "with-icons" }) : !hasEnabledBankTransferProvider ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(GeoRestrictionScreen, { methodName: "Bank Transfer" }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22954
|
-
BankTransfer,
|
|
22955
|
-
{
|
|
22956
|
-
userId,
|
|
22957
|
-
publishableKey,
|
|
22958
|
-
view: bankTransferView,
|
|
22959
|
-
onViewChange: setBankTransferView,
|
|
22960
|
-
recipientAddress,
|
|
22961
|
-
destinationChainType,
|
|
22962
|
-
destinationChainId,
|
|
22963
|
-
destinationTokenAddress,
|
|
22964
|
-
destinationTokenSymbol,
|
|
22965
|
-
wallets,
|
|
22966
|
-
defaultToken: defaultToken ?? null,
|
|
22967
|
-
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
22968
|
-
onEvent,
|
|
22969
|
-
onDepositSuccess,
|
|
22970
|
-
onDepositError
|
|
22971
|
-
}
|
|
22972
|
-
),
|
|
22973
|
-
depositPoweredByFooter
|
|
22974
|
-
] })
|
|
22975
|
-
] }) : view === "stripe_link" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
22976
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22977
|
-
DepositHeader,
|
|
22978
|
-
{
|
|
22979
|
-
title: "Deposit with Link",
|
|
22980
|
-
showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
|
|
22981
|
-
onBack: handleBack,
|
|
22982
|
-
showClose: stripeLinkStep !== "checkout",
|
|
22983
|
-
onClose: handleClose
|
|
22984
|
-
}
|
|
22985
|
-
),
|
|
22986
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22987
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22988
|
-
PayWithStripeLink,
|
|
22989
|
-
{
|
|
22990
|
-
userId,
|
|
22991
|
-
publishableKey,
|
|
22992
|
-
recipientAddress,
|
|
22993
|
-
destinationChainType,
|
|
22994
|
-
destinationChainId,
|
|
22995
|
-
destinationTokenAddress,
|
|
22996
|
-
wallets,
|
|
22997
|
-
email: userEmail,
|
|
22998
|
-
iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
|
|
22999
|
-
step: stripeLinkStep,
|
|
23000
|
-
onStepChange: setStripeLinkStep,
|
|
23001
|
-
backHandlerRef: stripeLinkBackRef,
|
|
23002
|
-
onDepositSuccess,
|
|
23003
|
-
onDepositError
|
|
23004
|
-
}
|
|
23005
|
-
),
|
|
23006
|
-
depositPoweredByFooter
|
|
23007
|
-
] })
|
|
23008
|
-
] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
23009
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23010
|
-
DepositHeader,
|
|
23011
|
-
{
|
|
23012
|
-
title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
|
|
23013
|
-
showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
|
|
23014
|
-
onBack: handleBack,
|
|
23015
|
-
onClose: handleClose
|
|
23016
|
-
}
|
|
23017
|
-
),
|
|
23018
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
23019
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23020
|
-
PayWithCashApp,
|
|
23021
|
-
{
|
|
23022
|
-
userId,
|
|
23023
|
-
publishableKey,
|
|
23024
|
-
recipientAddress,
|
|
23025
|
-
destinationChainType,
|
|
23026
|
-
destinationChainId,
|
|
23027
|
-
destinationTokenAddress,
|
|
23028
|
-
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
23029
|
-
view: cashAppView,
|
|
23030
|
-
onViewChange: setCashAppView,
|
|
23031
|
-
onAmountChange: setCashAppAmount,
|
|
23032
|
-
onEvent,
|
|
23033
|
-
onDepositSuccess: onDepositSuccessFor("cashapp"),
|
|
23034
|
-
onDepositError: onDepositErrorFor("cashapp"),
|
|
23035
|
-
wallets
|
|
23036
|
-
}
|
|
23037
|
-
),
|
|
23038
|
-
depositPoweredByFooter
|
|
23039
|
-
] })
|
|
23040
|
-
] }) : view === "apple_pay" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
23041
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23042
|
-
DepositHeader,
|
|
23043
|
-
{
|
|
23044
|
-
title: applePayHeaderTitle,
|
|
23045
|
-
showBack: applePayShowBack,
|
|
23046
|
-
onBack: () => {
|
|
23047
|
-
const handled = applePayHandleRef.current?.requestBack() ?? false;
|
|
23048
|
-
if (!handled) handleBack();
|
|
23049
|
-
},
|
|
23050
|
-
onClose: handleClose
|
|
23051
|
-
}
|
|
23052
|
-
),
|
|
23053
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
23054
|
-
applePayProvidersLoading ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SkeletonButton, { variant: "with-icons" }) : !hasEnabledApplePayProvider ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(GeoRestrictionScreen, { methodName: "Apple Pay" }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23055
|
-
BuyWithApplePay,
|
|
23056
|
-
{
|
|
23057
|
-
ref: applePayHandleRef,
|
|
23058
|
-
userId,
|
|
23059
|
-
publishableKey,
|
|
23060
|
-
destinationChainType,
|
|
23061
|
-
destinationChainId,
|
|
23062
|
-
destinationTokenAddress,
|
|
23063
|
-
userEmail,
|
|
23064
|
-
wallets,
|
|
23065
|
-
onViewChange: setApplePayView,
|
|
23066
|
-
onEvent,
|
|
23067
|
-
onDepositSuccess: onDepositSuccessFor("apple_pay"),
|
|
23068
|
-
onDepositError: onDepositErrorFor("apple_pay"),
|
|
23069
|
-
exitLabel: sessionOpenedFromMenu ? "Return" : "Close",
|
|
23070
|
-
onExit: () => {
|
|
23071
|
-
if (sessionOpenedFromMenu) {
|
|
23072
|
-
setView("main");
|
|
23073
|
-
} else {
|
|
23074
|
-
handleClose();
|
|
22729
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22730
|
+
ThemeStyleInjector,
|
|
22731
|
+
{
|
|
22732
|
+
className: view === "wallet_connect" ? "uf-flex uf-min-h-0 uf-flex-col" : void 0,
|
|
22733
|
+
children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-min-h-0 uf-max-h-full", children: [
|
|
22734
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22735
|
+
DepositHeader,
|
|
22736
|
+
{
|
|
22737
|
+
title: modalTitle || "Deposit",
|
|
22738
|
+
showClose: !hideOverlay,
|
|
22739
|
+
onClose: handleClose,
|
|
22740
|
+
showBalance: showBalanceHeader,
|
|
22741
|
+
balanceAddress: recipientAddress,
|
|
22742
|
+
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
|
|
22743
|
+
balanceChainId: destinationChainId,
|
|
22744
|
+
balanceTokenAddress: destinationTokenAddress,
|
|
22745
|
+
projectName: projectConfig?.project_name,
|
|
22746
|
+
publishableKey
|
|
22747
|
+
}
|
|
22748
|
+
) }),
|
|
22749
|
+
renderMainMenuBody(),
|
|
22750
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-flex-shrink-0", children: depositPoweredByFooter })
|
|
22751
|
+
] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
22752
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22753
|
+
DepositHeader,
|
|
22754
|
+
{
|
|
22755
|
+
title: transferCryptoTitle,
|
|
22756
|
+
showBack: showBackTransfer,
|
|
22757
|
+
onBack: handleBack,
|
|
22758
|
+
onClose: handleClose,
|
|
22759
|
+
showBalance: showBalanceHeader,
|
|
22760
|
+
balanceAddress: recipientAddress,
|
|
22761
|
+
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
|
|
22762
|
+
balanceChainId: destinationChainId,
|
|
22763
|
+
balanceTokenAddress: destinationTokenAddress,
|
|
22764
|
+
projectName: projectConfig?.project_name,
|
|
22765
|
+
publishableKey
|
|
22766
|
+
}
|
|
22767
|
+
),
|
|
22768
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22769
|
+
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22770
|
+
TransferCryptoSingleInput,
|
|
22771
|
+
{
|
|
22772
|
+
userId,
|
|
22773
|
+
publishableKey,
|
|
22774
|
+
recipientAddress,
|
|
22775
|
+
destinationChainType,
|
|
22776
|
+
destinationChainId,
|
|
22777
|
+
destinationTokenAddress,
|
|
22778
|
+
defaultSourceChainType,
|
|
22779
|
+
defaultSourceChainId,
|
|
22780
|
+
defaultSourceTokenAddress,
|
|
22781
|
+
defaultSourceSymbol,
|
|
22782
|
+
depositConfirmationMode,
|
|
22783
|
+
onExecutionsChange: setDepositExecutions,
|
|
22784
|
+
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
22785
|
+
onDepositError: onDepositErrorFor("transfer"),
|
|
22786
|
+
wallets
|
|
23075
22787
|
}
|
|
22788
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22789
|
+
TransferCryptoDoubleInput,
|
|
22790
|
+
{
|
|
22791
|
+
userId,
|
|
22792
|
+
publishableKey,
|
|
22793
|
+
recipientAddress,
|
|
22794
|
+
destinationChainType,
|
|
22795
|
+
destinationChainId,
|
|
22796
|
+
destinationTokenAddress,
|
|
22797
|
+
defaultSourceChainType,
|
|
22798
|
+
defaultSourceChainId,
|
|
22799
|
+
defaultSourceTokenAddress,
|
|
22800
|
+
defaultSourceSymbol,
|
|
22801
|
+
depositConfirmationMode,
|
|
22802
|
+
onExecutionsChange: setDepositExecutions,
|
|
22803
|
+
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
22804
|
+
onDepositError: onDepositErrorFor("transfer"),
|
|
22805
|
+
wallets
|
|
22806
|
+
}
|
|
22807
|
+
),
|
|
22808
|
+
depositPoweredByFooter
|
|
22809
|
+
] })
|
|
22810
|
+
] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
22811
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22812
|
+
DepositHeader,
|
|
22813
|
+
{
|
|
22814
|
+
title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
|
|
22815
|
+
showBack: showBackTracker,
|
|
22816
|
+
onBack: handleBack,
|
|
22817
|
+
onClose: handleClose
|
|
23076
22818
|
}
|
|
23077
|
-
|
|
23078
|
-
|
|
23079
|
-
|
|
23080
|
-
|
|
23081
|
-
|
|
22819
|
+
),
|
|
22820
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22821
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22822
|
+
"div",
|
|
22823
|
+
{
|
|
22824
|
+
className: "uf-text-sm",
|
|
22825
|
+
style: {
|
|
22826
|
+
color: components.container.subtitleColor,
|
|
22827
|
+
fontFamily: fonts.regular
|
|
22828
|
+
},
|
|
22829
|
+
children: "No deposits yet"
|
|
22830
|
+
}
|
|
22831
|
+
) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22832
|
+
DepositExecutionItem,
|
|
22833
|
+
{
|
|
22834
|
+
execution,
|
|
22835
|
+
onClick: () => setSelectedExecution(execution)
|
|
22836
|
+
},
|
|
22837
|
+
execution.id
|
|
22838
|
+
)) }) }),
|
|
22839
|
+
depositPoweredByFooter
|
|
22840
|
+
] })
|
|
22841
|
+
] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
22842
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22843
|
+
DepositHeader,
|
|
22844
|
+
{
|
|
22845
|
+
title: cardView === "quotes" ? t8.quotes : depositWithCardTitle,
|
|
22846
|
+
showBack: showBackCard,
|
|
22847
|
+
onBack: handleBack,
|
|
22848
|
+
onClose: handleClose,
|
|
22849
|
+
badge: cardView === "quotes" ? { count: quotesCount } : void 0,
|
|
22850
|
+
showBalance: showBalanceHeader,
|
|
22851
|
+
balanceAddress: recipientAddress,
|
|
22852
|
+
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
|
|
22853
|
+
balanceChainId: destinationChainId,
|
|
22854
|
+
balanceTokenAddress: destinationTokenAddress,
|
|
22855
|
+
projectName: projectConfig?.project_name,
|
|
22856
|
+
publishableKey
|
|
22857
|
+
}
|
|
22858
|
+
),
|
|
22859
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22860
|
+
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : !showFiatOnramp ? (
|
|
22861
|
+
// Fiat on-ramp resolved hidden/disabled after a direct open
|
|
22862
|
+
// (e.g. platform `is_hidden` for a Stripe Link-only project).
|
|
22863
|
+
// Show a geo-restriction screen rather than the card UI so the
|
|
22864
|
+
// hard-hide is honoured without a flash of "Pay with Card".
|
|
22865
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(GeoRestrictionScreen, { methodName: "Card" })
|
|
22866
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22867
|
+
BuyWithCard,
|
|
22868
|
+
{
|
|
22869
|
+
userId,
|
|
22870
|
+
publishableKey,
|
|
22871
|
+
view: cardView,
|
|
22872
|
+
onViewChange: handleCardViewChange,
|
|
22873
|
+
destinationTokenSymbol,
|
|
22874
|
+
recipientAddress,
|
|
22875
|
+
destinationChainType,
|
|
22876
|
+
destinationChainId,
|
|
22877
|
+
destinationTokenAddress,
|
|
22878
|
+
onDepositSuccess: onDepositSuccessFor("card"),
|
|
22879
|
+
onDepositError: onDepositErrorFor("card"),
|
|
22880
|
+
onEvent,
|
|
22881
|
+
themeClass,
|
|
22882
|
+
wallets,
|
|
22883
|
+
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
22884
|
+
hideDepositFlowInfo,
|
|
22885
|
+
hideDisplayDescription
|
|
22886
|
+
}
|
|
22887
|
+
),
|
|
22888
|
+
depositPoweredByFooter
|
|
22889
|
+
] })
|
|
22890
|
+
] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
22891
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22892
|
+
DepositHeader,
|
|
22893
|
+
{
|
|
22894
|
+
title: payWithExchangeTitle,
|
|
22895
|
+
showBack: exchangeView === "pending" || sessionOpenedFromMenu,
|
|
22896
|
+
onBack: handleBack,
|
|
22897
|
+
onClose: handleClose
|
|
22898
|
+
}
|
|
22899
|
+
),
|
|
22900
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22901
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22902
|
+
PayWithExchange,
|
|
22903
|
+
{
|
|
22904
|
+
userId,
|
|
22905
|
+
publishableKey,
|
|
22906
|
+
exchanges,
|
|
22907
|
+
view: exchangeView,
|
|
22908
|
+
onViewChange: setExchangeView,
|
|
22909
|
+
destinationTokenSymbol,
|
|
22910
|
+
recipientAddress,
|
|
22911
|
+
destinationChainType,
|
|
22912
|
+
destinationChainId,
|
|
22913
|
+
destinationTokenAddress,
|
|
22914
|
+
onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
|
|
22915
|
+
onDepositError: onDepositErrorFor("pay_with_exchange"),
|
|
22916
|
+
wallets,
|
|
22917
|
+
defaultToken: defaultToken ?? null
|
|
22918
|
+
}
|
|
22919
|
+
),
|
|
22920
|
+
depositPoweredByFooter
|
|
22921
|
+
] })
|
|
22922
|
+
] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
22923
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22924
|
+
CoinbaseConnect,
|
|
22925
|
+
{
|
|
22926
|
+
publishableKey,
|
|
22927
|
+
userId,
|
|
22928
|
+
wallets,
|
|
22929
|
+
recipientAddress,
|
|
22930
|
+
destinationTokenAddress: destinationTokenAddress ?? "",
|
|
22931
|
+
destinationChainId: destinationChainId ?? "",
|
|
22932
|
+
destinationChainType: destinationChainType ?? "",
|
|
22933
|
+
onDepositSuccess: onDepositSuccessFor("exchange_connect"),
|
|
22934
|
+
onDepositError: onDepositErrorFor("exchange_connect"),
|
|
22935
|
+
onTransferError: (error) => {
|
|
22936
|
+
onDepositErrorFor("exchange_connect")?.({
|
|
22937
|
+
message: error.message,
|
|
22938
|
+
error
|
|
22939
|
+
});
|
|
22940
|
+
},
|
|
22941
|
+
onBack: handleBack,
|
|
22942
|
+
onClose: handleClose,
|
|
22943
|
+
onDisconnect: handleExchangeDisconnect,
|
|
22944
|
+
skipToHoldings: coinbaseSkipToHoldings,
|
|
22945
|
+
canGoBack: sessionOpenedFromMenu,
|
|
22946
|
+
onExecutionsChange: setDepositExecutions,
|
|
22947
|
+
defaultSourceChainType,
|
|
22948
|
+
defaultSourceChainId,
|
|
22949
|
+
defaultSourceTokenAddress,
|
|
22950
|
+
defaultSourceSymbol
|
|
22951
|
+
}
|
|
22952
|
+
),
|
|
22953
|
+
depositPoweredByFooter
|
|
22954
|
+
] }) : view === "wallet_connect" ? (
|
|
22955
|
+
// Mobile: flex-fill the full-height dialog body so the wallet list
|
|
22956
|
+
// can grow and scroll, with the footer pinned to the bottom.
|
|
22957
|
+
// Desktop (sm:): stays content-sized.
|
|
22958
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
22959
|
+
"div",
|
|
22960
|
+
{
|
|
22961
|
+
className: "uf-flex uf-flex-col uf-gap-1.5 uf-min-h-0 uf-flex-1 sm:uf-flex-none",
|
|
22962
|
+
children: [
|
|
22963
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
22964
|
+
WalletConnect,
|
|
22965
|
+
{
|
|
22966
|
+
walletInfo: browserWalletInfo ?? void 0,
|
|
22967
|
+
depositWallet: browserWalletInfo?.depositWallet ?? void 0,
|
|
22968
|
+
wallets,
|
|
22969
|
+
userId,
|
|
22970
|
+
publishableKey,
|
|
22971
|
+
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
22972
|
+
projectName: projectConfig?.project_name,
|
|
22973
|
+
onError: (error) => {
|
|
22974
|
+
onDepositErrorFor("wallet_connect")?.({
|
|
22975
|
+
message: error.message,
|
|
22976
|
+
error
|
|
22977
|
+
});
|
|
22978
|
+
},
|
|
22979
|
+
onDepositSuccess: onDepositSuccessFor("wallet_connect"),
|
|
22980
|
+
onDepositError: onDepositErrorFor("wallet_connect"),
|
|
22981
|
+
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
22982
|
+
onWalletDisconnect: handleWalletDisconnect,
|
|
22983
|
+
onWalletConnected: (info, dw) => {
|
|
22984
|
+
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
22985
|
+
setStoredWalletState(info.type);
|
|
22986
|
+
setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
|
|
22987
|
+
},
|
|
22988
|
+
onBack: handleBack,
|
|
22989
|
+
onClose: handleClose,
|
|
22990
|
+
defaultSourceChainType,
|
|
22991
|
+
defaultSourceChainId,
|
|
22992
|
+
defaultSourceTokenAddress,
|
|
22993
|
+
defaultSourceSymbol,
|
|
22994
|
+
canGoBack: sessionOpenedFromMenu,
|
|
22995
|
+
depositWalletsLoading: walletsLoading
|
|
22996
|
+
}
|
|
22997
|
+
),
|
|
22998
|
+
depositPoweredByFooter
|
|
22999
|
+
]
|
|
23000
|
+
}
|
|
23001
|
+
)
|
|
23002
|
+
) : view === "bank_transfer" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
23003
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23004
|
+
DepositHeader,
|
|
23005
|
+
{
|
|
23006
|
+
title: t8.bankTransfer.title,
|
|
23007
|
+
showBack: bankTransferView !== "providers" || sessionOpenedFromMenu,
|
|
23008
|
+
onBack: handleBack,
|
|
23009
|
+
onClose: handleClose
|
|
23010
|
+
}
|
|
23011
|
+
),
|
|
23012
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
23013
|
+
bankTransferProvidersLoading ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SkeletonButton, { variant: "with-icons" }) : !hasEnabledBankTransferProvider ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(GeoRestrictionScreen, { methodName: "Bank Transfer" }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23014
|
+
BankTransfer,
|
|
23015
|
+
{
|
|
23016
|
+
userId,
|
|
23017
|
+
publishableKey,
|
|
23018
|
+
view: bankTransferView,
|
|
23019
|
+
onViewChange: setBankTransferView,
|
|
23020
|
+
recipientAddress,
|
|
23021
|
+
destinationChainType,
|
|
23022
|
+
destinationChainId,
|
|
23023
|
+
destinationTokenAddress,
|
|
23024
|
+
destinationTokenSymbol,
|
|
23025
|
+
wallets,
|
|
23026
|
+
defaultToken: defaultToken ?? null,
|
|
23027
|
+
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
23028
|
+
onEvent,
|
|
23029
|
+
onDepositSuccess,
|
|
23030
|
+
onDepositError
|
|
23031
|
+
}
|
|
23032
|
+
),
|
|
23033
|
+
depositPoweredByFooter
|
|
23034
|
+
] })
|
|
23035
|
+
] }) : view === "stripe_link" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
23036
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23037
|
+
DepositHeader,
|
|
23038
|
+
{
|
|
23039
|
+
title: "Deposit with Link",
|
|
23040
|
+
showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
|
|
23041
|
+
onBack: handleBack,
|
|
23042
|
+
showClose: stripeLinkStep !== "checkout",
|
|
23043
|
+
onClose: handleClose
|
|
23044
|
+
}
|
|
23045
|
+
),
|
|
23046
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
23047
|
+
isLoadingIp ? (
|
|
23048
|
+
// Hold the geo decision until IP resolves so we don't mount
|
|
23049
|
+
// PayWithStripeLink (which kicks off config/OAuth work) for a
|
|
23050
|
+
// deep-link user who turns out to be outside the US.
|
|
23051
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SkeletonButton, { variant: "with-icons" })
|
|
23052
|
+
) : !showStripeLink ? (
|
|
23053
|
+
// Stripe Link's crypto on-ramp is US-only. On a direct open
|
|
23054
|
+
// (initialScreen="stripe_link") the row isn't in a menu to
|
|
23055
|
+
// fall back to, so show a geo-restriction screen rather than
|
|
23056
|
+
// the Link UI.
|
|
23057
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23058
|
+
GeoRestrictionScreen,
|
|
23059
|
+
{
|
|
23060
|
+
methodName: t8.stripeLink.title,
|
|
23061
|
+
message: "Pay with Link is only available in the US."
|
|
23062
|
+
}
|
|
23063
|
+
)
|
|
23064
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23065
|
+
PayWithStripeLink,
|
|
23066
|
+
{
|
|
23067
|
+
userId,
|
|
23068
|
+
publishableKey,
|
|
23069
|
+
recipientAddress,
|
|
23070
|
+
destinationChainType,
|
|
23071
|
+
destinationChainId,
|
|
23072
|
+
destinationTokenAddress,
|
|
23073
|
+
wallets,
|
|
23074
|
+
email: userEmail,
|
|
23075
|
+
iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
|
|
23076
|
+
step: stripeLinkStep,
|
|
23077
|
+
onStepChange: setStripeLinkStep,
|
|
23078
|
+
backHandlerRef: stripeLinkBackRef,
|
|
23079
|
+
onDepositSuccess,
|
|
23080
|
+
onDepositError
|
|
23081
|
+
}
|
|
23082
|
+
),
|
|
23083
|
+
depositPoweredByFooter
|
|
23084
|
+
] })
|
|
23085
|
+
] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
23086
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23087
|
+
DepositHeader,
|
|
23088
|
+
{
|
|
23089
|
+
title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
|
|
23090
|
+
showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
|
|
23091
|
+
onBack: handleBack,
|
|
23092
|
+
onClose: handleClose
|
|
23093
|
+
}
|
|
23094
|
+
),
|
|
23095
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
23096
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23097
|
+
PayWithCashApp,
|
|
23098
|
+
{
|
|
23099
|
+
userId,
|
|
23100
|
+
publishableKey,
|
|
23101
|
+
recipientAddress,
|
|
23102
|
+
destinationChainType,
|
|
23103
|
+
destinationChainId,
|
|
23104
|
+
destinationTokenAddress,
|
|
23105
|
+
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
23106
|
+
view: cashAppView,
|
|
23107
|
+
onViewChange: setCashAppView,
|
|
23108
|
+
onAmountChange: setCashAppAmount,
|
|
23109
|
+
onEvent,
|
|
23110
|
+
onDepositSuccess: onDepositSuccessFor("cashapp"),
|
|
23111
|
+
onDepositError: onDepositErrorFor("cashapp"),
|
|
23112
|
+
wallets
|
|
23113
|
+
}
|
|
23114
|
+
),
|
|
23115
|
+
depositPoweredByFooter
|
|
23116
|
+
] })
|
|
23117
|
+
] }) : view === "apple_pay" ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
23118
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23119
|
+
DepositHeader,
|
|
23120
|
+
{
|
|
23121
|
+
title: applePayHeaderTitle,
|
|
23122
|
+
showBack: applePayShowBack,
|
|
23123
|
+
onBack: () => {
|
|
23124
|
+
const handled = applePayHandleRef.current?.requestBack() ?? false;
|
|
23125
|
+
if (!handled) handleBack();
|
|
23126
|
+
},
|
|
23127
|
+
onClose: handleClose
|
|
23128
|
+
}
|
|
23129
|
+
),
|
|
23130
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
23131
|
+
applePayProvidersLoading ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SkeletonButton, { variant: "with-icons" }) : !hasEnabledApplePayProvider ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(GeoRestrictionScreen, { methodName: "Apple Pay" }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
23132
|
+
BuyWithApplePay,
|
|
23133
|
+
{
|
|
23134
|
+
ref: applePayHandleRef,
|
|
23135
|
+
userId,
|
|
23136
|
+
publishableKey,
|
|
23137
|
+
destinationChainType,
|
|
23138
|
+
destinationChainId,
|
|
23139
|
+
destinationTokenAddress,
|
|
23140
|
+
userEmail,
|
|
23141
|
+
wallets,
|
|
23142
|
+
onViewChange: setApplePayView,
|
|
23143
|
+
onEvent,
|
|
23144
|
+
onDepositSuccess: onDepositSuccessFor("apple_pay"),
|
|
23145
|
+
onDepositError: onDepositErrorFor("apple_pay"),
|
|
23146
|
+
exitLabel: sessionOpenedFromMenu ? "Return" : "Close",
|
|
23147
|
+
onExit: () => {
|
|
23148
|
+
if (sessionOpenedFromMenu) {
|
|
23149
|
+
setView("main");
|
|
23150
|
+
} else {
|
|
23151
|
+
handleClose();
|
|
23152
|
+
}
|
|
23153
|
+
}
|
|
23154
|
+
}
|
|
23155
|
+
),
|
|
23156
|
+
depositPoweredByFooter
|
|
23157
|
+
] })
|
|
23158
|
+
] }) : null
|
|
23159
|
+
}
|
|
23160
|
+
)
|
|
23082
23161
|
]
|
|
23083
23162
|
}
|
|
23084
23163
|
)
|
|
@@ -23091,14 +23170,14 @@ var import_react27 = require("react");
|
|
|
23091
23170
|
var import_lucide_react38 = require("lucide-react");
|
|
23092
23171
|
|
|
23093
23172
|
// src/hooks/use-payment-intent.ts
|
|
23094
|
-
var
|
|
23095
|
-
var
|
|
23173
|
+
var import_react_query17 = require("@tanstack/react-query");
|
|
23174
|
+
var import_core38 = require("@unifold/core");
|
|
23096
23175
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "expired", "refunded", "canceled"]);
|
|
23097
23176
|
function usePaymentIntent(params) {
|
|
23098
23177
|
const { clientSecret, publishableKey, enabled = true, pollingInterval = 3e3 } = params;
|
|
23099
|
-
return (0,
|
|
23178
|
+
return (0, import_react_query17.useQuery)({
|
|
23100
23179
|
queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
|
|
23101
|
-
queryFn: () => (0,
|
|
23180
|
+
queryFn: () => (0, import_core38.retrievePaymentIntent)(clientSecret, publishableKey),
|
|
23102
23181
|
enabled: enabled && !!clientSecret && !!publishableKey,
|
|
23103
23182
|
staleTime: 0,
|
|
23104
23183
|
refetchInterval: (query) => {
|
|
@@ -23114,7 +23193,7 @@ function usePaymentIntent(params) {
|
|
|
23114
23193
|
}
|
|
23115
23194
|
|
|
23116
23195
|
// src/components/checkout/CheckoutModal.tsx
|
|
23117
|
-
var
|
|
23196
|
+
var import_core39 = require("@unifold/core");
|
|
23118
23197
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
23119
23198
|
function mapToCheckoutPaymentIntent(pi) {
|
|
23120
23199
|
return {
|
|
@@ -23200,8 +23279,8 @@ function CheckoutModal({
|
|
|
23200
23279
|
if (isSucceeded && richIntent) {
|
|
23201
23280
|
const createdSec = data.paymentIntent?.updated_at ? Math.floor(new Date(data.paymentIntent.updated_at).getTime() / 1e3) : Math.floor(Date.now() / 1e3);
|
|
23202
23281
|
onEvent?.({
|
|
23203
|
-
id: (0,
|
|
23204
|
-
type:
|
|
23282
|
+
id: (0, import_core39.generatePrefixedKSUID)("sevt"),
|
|
23283
|
+
type: import_core39.CheckoutEventType.PAYMENT_INTENT_SUCCEEDED,
|
|
23205
23284
|
created: createdSec,
|
|
23206
23285
|
method,
|
|
23207
23286
|
data: { object: richIntent }
|
|
@@ -23529,253 +23608,275 @@ function CheckoutModal({
|
|
|
23529
23608
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(PortalContainerProvider, { value: null, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Dialog, { open, onOpenChange: handleClose, modal: true, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23530
23609
|
DialogContent,
|
|
23531
23610
|
{
|
|
23532
|
-
className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[60vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${
|
|
23611
|
+
className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden uf-p-0 uf-overflow-visible ${view === "main" ? "!uf-top-auto !uf-h-auto !uf-max-h-[60vh] sm:!uf-max-h-none sm:!uf-top-[50%]" : "!uf-top-0 !uf-h-full sm:!uf-h-auto sm:!uf-top-[50%]"} ${// wallet_connect fills the full-height mobile sheet. DialogContent is a
|
|
23612
|
+
// grid whose single auto row only grows to fill free space and never
|
|
23613
|
+
// shrinks below content, so a long wallet list would balloon the row
|
|
23614
|
+
// past the viewport and push the footer off-screen. Clamp the row to
|
|
23615
|
+
// the modal height with minmax(0,1fr) so the inner overflow-y-auto list
|
|
23616
|
+
// scrolls with the footer pinned. Reset to content-sized on desktop.
|
|
23617
|
+
view === "wallet_connect" ? "[grid-template-rows:minmax(0,1fr)] sm:[grid-template-rows:none]" : ""} ${themeClass}`,
|
|
23533
23618
|
style: { backgroundColor: colors2.background },
|
|
23534
23619
|
onPointerDownOutside: (e) => e.preventDefault(),
|
|
23535
23620
|
onInteractOutside: (e) => e.preventDefault(),
|
|
23536
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23537
|
-
|
|
23538
|
-
|
|
23539
|
-
|
|
23540
|
-
|
|
23541
|
-
|
|
23542
|
-
|
|
23543
|
-
|
|
23544
|
-
|
|
23545
|
-
|
|
23546
|
-
|
|
23547
|
-
|
|
23548
|
-
|
|
23549
|
-
|
|
23550
|
-
|
|
23551
|
-
|
|
23621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23622
|
+
ThemeStyleInjector,
|
|
23623
|
+
{
|
|
23624
|
+
className: view === "wallet_connect" ? "uf-flex uf-min-h-0 uf-flex-col" : void 0,
|
|
23625
|
+
children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
23626
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DepositHeader, { title: modalTitle || "Checkout", showClose: true, onClose: handleClose }),
|
|
23627
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
23628
|
+
piLoading ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-space-y-3", children: [
|
|
23629
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23630
|
+
"div",
|
|
23631
|
+
{
|
|
23632
|
+
className: "uf-rounded-xl uf-p-4 uf-animate-pulse",
|
|
23633
|
+
style: {
|
|
23634
|
+
backgroundColor: components.card.backgroundColor,
|
|
23635
|
+
borderRadius: components.card.borderRadius,
|
|
23636
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
23637
|
+
},
|
|
23638
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-gap-2", children: [
|
|
23639
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23640
|
+
"div",
|
|
23641
|
+
{
|
|
23642
|
+
className: "uf-h-8 uf-w-24 uf-rounded",
|
|
23643
|
+
style: {
|
|
23644
|
+
backgroundColor: components.card.borderColor
|
|
23645
|
+
}
|
|
23646
|
+
}
|
|
23647
|
+
),
|
|
23648
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23649
|
+
"div",
|
|
23650
|
+
{
|
|
23651
|
+
className: "uf-h-4 uf-w-16 uf-rounded",
|
|
23652
|
+
style: {
|
|
23653
|
+
backgroundColor: components.card.borderColor
|
|
23654
|
+
}
|
|
23655
|
+
}
|
|
23656
|
+
)
|
|
23657
|
+
] })
|
|
23658
|
+
}
|
|
23659
|
+
),
|
|
23660
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SkeletonButton2, {}),
|
|
23661
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SkeletonButton2, {})
|
|
23662
|
+
] }) : piError ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
|
|
23663
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react38.AlertTriangle, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
|
|
23664
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23665
|
+
"h3",
|
|
23666
|
+
{
|
|
23667
|
+
className: "uf-text-lg uf-font-semibold uf-mb-2",
|
|
23668
|
+
style: {
|
|
23669
|
+
color: colors2.foreground,
|
|
23670
|
+
fontFamily: fonts.semibold
|
|
23671
|
+
},
|
|
23672
|
+
children: "Unable to Load Checkout"
|
|
23673
|
+
}
|
|
23674
|
+
),
|
|
23675
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23676
|
+
"p",
|
|
23677
|
+
{
|
|
23678
|
+
className: "uf-text-sm uf-max-w-[280px]",
|
|
23679
|
+
style: {
|
|
23680
|
+
color: colors2.foregroundMuted,
|
|
23681
|
+
fontFamily: fonts.regular
|
|
23682
|
+
},
|
|
23683
|
+
children: piError instanceof Error ? piError.message : "Something went wrong. Please try again."
|
|
23684
|
+
}
|
|
23685
|
+
)
|
|
23686
|
+
] }) : paymentIntent ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-space-y-3", children: [
|
|
23687
|
+
progressSection,
|
|
23688
|
+
(paymentIntent.status === "requires_payment" || paymentIntent.status === "processing") && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
23689
|
+
showTransferCrypto && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23690
|
+
TransferCryptoButton,
|
|
23552
23691
|
{
|
|
23553
|
-
|
|
23554
|
-
|
|
23555
|
-
|
|
23556
|
-
}
|
|
23692
|
+
onClick: () => {
|
|
23693
|
+
lastCheckoutMethodRef.current = "transfer";
|
|
23694
|
+
setView("transfer");
|
|
23695
|
+
},
|
|
23696
|
+
title: i18n.checkoutModal.transferCrypto.title,
|
|
23697
|
+
subtitle: i18n.checkoutModal.transferCrypto.subtitle,
|
|
23698
|
+
featuredTokens: projectConfig?.transfer_crypto.networks
|
|
23557
23699
|
}
|
|
23558
23700
|
),
|
|
23559
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23560
|
-
|
|
23701
|
+
showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23702
|
+
BrowserWalletButton,
|
|
23561
23703
|
{
|
|
23562
|
-
|
|
23563
|
-
|
|
23564
|
-
|
|
23565
|
-
|
|
23704
|
+
onClick: handleBrowserWalletClick,
|
|
23705
|
+
onConnectClick: handleWalletConnectClick,
|
|
23706
|
+
onDisconnect: handleWalletDisconnect,
|
|
23707
|
+
chainType: browserWalletChainType,
|
|
23708
|
+
publishableKey,
|
|
23709
|
+
featuredWallets: projectConfig?.connect_wallet?.wallets,
|
|
23710
|
+
subtitle: i18n.checkoutModal.browserWallet.subtitle
|
|
23566
23711
|
}
|
|
23567
23712
|
)
|
|
23568
23713
|
] })
|
|
23569
|
-
}
|
|
23570
|
-
|
|
23571
|
-
|
|
23572
|
-
|
|
23573
|
-
] }) : piError ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
|
|
23574
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react38.AlertTriangle, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
|
|
23714
|
+
] }) : null,
|
|
23715
|
+
poweredByFooter
|
|
23716
|
+
] })
|
|
23717
|
+
] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
23575
23718
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23576
|
-
|
|
23719
|
+
DepositHeader,
|
|
23577
23720
|
{
|
|
23578
|
-
|
|
23579
|
-
|
|
23580
|
-
|
|
23581
|
-
|
|
23582
|
-
},
|
|
23583
|
-
children: "Unable to Load Checkout"
|
|
23721
|
+
title: modalTitle || "Checkout",
|
|
23722
|
+
showBack: true,
|
|
23723
|
+
onBack: handleBack,
|
|
23724
|
+
onClose: handleClose
|
|
23584
23725
|
}
|
|
23585
23726
|
),
|
|
23586
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.
|
|
23587
|
-
|
|
23588
|
-
|
|
23589
|
-
|
|
23590
|
-
|
|
23591
|
-
|
|
23592
|
-
|
|
23593
|
-
|
|
23594
|
-
|
|
23595
|
-
|
|
23596
|
-
|
|
23597
|
-
|
|
23598
|
-
|
|
23599
|
-
|
|
23600
|
-
|
|
23601
|
-
|
|
23602
|
-
|
|
23603
|
-
|
|
23604
|
-
|
|
23605
|
-
|
|
23606
|
-
|
|
23607
|
-
|
|
23608
|
-
|
|
23609
|
-
|
|
23610
|
-
|
|
23611
|
-
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
|
|
23617
|
-
|
|
23618
|
-
|
|
23619
|
-
|
|
23620
|
-
|
|
23621
|
-
subtitle: i18n.checkoutModal.browserWallet.subtitle
|
|
23622
|
-
}
|
|
23623
|
-
)
|
|
23624
|
-
] })
|
|
23625
|
-
] }) : null,
|
|
23626
|
-
poweredByFooter
|
|
23627
|
-
] })
|
|
23628
|
-
] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
23629
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23630
|
-
DepositHeader,
|
|
23631
|
-
{
|
|
23632
|
-
title: modalTitle || "Checkout",
|
|
23633
|
-
showBack: true,
|
|
23634
|
-
onBack: handleBack,
|
|
23635
|
-
onClose: handleClose
|
|
23636
|
-
}
|
|
23637
|
-
),
|
|
23638
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
23639
|
-
paymentIntent ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
23640
|
-
(() => {
|
|
23641
|
-
const receivedUsd = parseFloat(
|
|
23642
|
-
paymentIntent.destination_amount_received_usd || paymentIntent.amount_received_usd
|
|
23643
|
-
);
|
|
23644
|
-
const totalUsd = parseFloat(
|
|
23645
|
-
paymentIntent.destination_amount_usd || paymentIntent.amount_usd
|
|
23646
|
-
);
|
|
23647
|
-
const pct = totalUsd > 0 ? Math.min(receivedUsd / totalUsd * 100, 100) : 0;
|
|
23648
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-space-y-2", children: [
|
|
23649
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between", children: [
|
|
23650
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23651
|
-
"span",
|
|
23652
|
-
{
|
|
23653
|
-
className: "uf-text-xs",
|
|
23654
|
-
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
23655
|
-
children: "Received"
|
|
23656
|
-
}
|
|
23657
|
-
),
|
|
23658
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
23659
|
-
"span",
|
|
23660
|
-
{
|
|
23661
|
-
className: "uf-text-xs",
|
|
23662
|
-
style: { color: colors2.foreground, fontFamily: fonts.medium },
|
|
23663
|
-
children: [
|
|
23664
|
-
"$",
|
|
23665
|
-
receivedUsd.toFixed(2),
|
|
23666
|
-
" / $",
|
|
23667
|
-
totalUsd.toFixed(2)
|
|
23668
|
-
]
|
|
23669
|
-
}
|
|
23670
|
-
)
|
|
23671
|
-
] }),
|
|
23672
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23673
|
-
"div",
|
|
23674
|
-
{
|
|
23675
|
-
className: "uf-w-full uf-h-1.5 uf-rounded-full uf-overflow-hidden",
|
|
23676
|
-
style: { backgroundColor: colors2.border },
|
|
23677
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23727
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
23728
|
+
paymentIntent ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
23729
|
+
(() => {
|
|
23730
|
+
const receivedUsd = parseFloat(
|
|
23731
|
+
paymentIntent.destination_amount_received_usd || paymentIntent.amount_received_usd
|
|
23732
|
+
);
|
|
23733
|
+
const totalUsd = parseFloat(
|
|
23734
|
+
paymentIntent.destination_amount_usd || paymentIntent.amount_usd
|
|
23735
|
+
);
|
|
23736
|
+
const pct = totalUsd > 0 ? Math.min(receivedUsd / totalUsd * 100, 100) : 0;
|
|
23737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-space-y-2", children: [
|
|
23738
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between", children: [
|
|
23739
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23740
|
+
"span",
|
|
23741
|
+
{
|
|
23742
|
+
className: "uf-text-xs",
|
|
23743
|
+
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
23744
|
+
children: "Received"
|
|
23745
|
+
}
|
|
23746
|
+
),
|
|
23747
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
23748
|
+
"span",
|
|
23749
|
+
{
|
|
23750
|
+
className: "uf-text-xs",
|
|
23751
|
+
style: { color: colors2.foreground, fontFamily: fonts.medium },
|
|
23752
|
+
children: [
|
|
23753
|
+
"$",
|
|
23754
|
+
receivedUsd.toFixed(2),
|
|
23755
|
+
" / $",
|
|
23756
|
+
totalUsd.toFixed(2)
|
|
23757
|
+
]
|
|
23758
|
+
}
|
|
23759
|
+
)
|
|
23760
|
+
] }),
|
|
23761
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23678
23762
|
"div",
|
|
23679
23763
|
{
|
|
23680
|
-
className: "uf-
|
|
23681
|
-
style: {
|
|
23682
|
-
|
|
23683
|
-
|
|
23684
|
-
|
|
23764
|
+
className: "uf-w-full uf-h-1.5 uf-rounded-full uf-overflow-hidden",
|
|
23765
|
+
style: { backgroundColor: colors2.border },
|
|
23766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23767
|
+
"div",
|
|
23768
|
+
{
|
|
23769
|
+
className: "uf-h-full uf-rounded-full uf-transition-all uf-duration-500",
|
|
23770
|
+
style: {
|
|
23771
|
+
width: `${pct}%`,
|
|
23772
|
+
backgroundColor: paymentIntent.status === "succeeded" ? "rgb(34, 197, 94)" : colors2.primary
|
|
23773
|
+
}
|
|
23774
|
+
}
|
|
23775
|
+
)
|
|
23685
23776
|
}
|
|
23686
23777
|
)
|
|
23778
|
+
] });
|
|
23779
|
+
})(),
|
|
23780
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23781
|
+
TransferCryptoSingleInput,
|
|
23782
|
+
{
|
|
23783
|
+
userId: paymentIntent.user_id || "",
|
|
23784
|
+
publishableKey,
|
|
23785
|
+
clientSecret,
|
|
23786
|
+
recipientAddress: paymentIntent.recipient_address,
|
|
23787
|
+
destinationChainType: paymentIntent.destination_chain_type,
|
|
23788
|
+
destinationChainId: paymentIntent.destination_chain_id,
|
|
23789
|
+
destinationTokenAddress: paymentIntent.destination_token_address,
|
|
23790
|
+
defaultSourceChainType,
|
|
23791
|
+
defaultSourceChainId,
|
|
23792
|
+
defaultSourceTokenAddress,
|
|
23793
|
+
defaultSourceSymbol,
|
|
23794
|
+
depositConfirmationMode: "auto_ui",
|
|
23795
|
+
wallets,
|
|
23796
|
+
onSourceTokenChange: setSelectedSource,
|
|
23797
|
+
persistCheckingIndicator: true,
|
|
23798
|
+
productType: "payment",
|
|
23799
|
+
checkoutQuote: effectiveCheckoutQuote,
|
|
23800
|
+
isCheckoutQuoteLoading: isQuoteLoading || isQuoteFetching
|
|
23687
23801
|
}
|
|
23688
23802
|
)
|
|
23689
|
-
] })
|
|
23690
|
-
|
|
23691
|
-
|
|
23692
|
-
|
|
23803
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SkeletonButton2, {}),
|
|
23804
|
+
poweredByFooter
|
|
23805
|
+
] })
|
|
23806
|
+
] }) : view === "wallet_connect" && paymentIntent ? (
|
|
23807
|
+
// Mobile: flex-fill the full-height sheet so the wallet list grows and
|
|
23808
|
+
// scrolls with the footer pinned. Desktop (sm:): content-sized.
|
|
23809
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
23810
|
+
"div",
|
|
23693
23811
|
{
|
|
23694
|
-
|
|
23695
|
-
|
|
23696
|
-
|
|
23697
|
-
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
23702
|
-
|
|
23703
|
-
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
|
|
23707
|
-
|
|
23708
|
-
|
|
23709
|
-
|
|
23710
|
-
|
|
23711
|
-
|
|
23812
|
+
className: "uf-flex uf-flex-col uf-gap-1.5 uf-min-h-0 uf-flex-1 sm:uf-flex-none",
|
|
23813
|
+
children: [
|
|
23814
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23815
|
+
WalletConnect,
|
|
23816
|
+
{
|
|
23817
|
+
walletInfo: browserWalletInfo ?? void 0,
|
|
23818
|
+
depositWallet: browserWalletInfo?.depositWallet ?? void 0,
|
|
23819
|
+
wallets,
|
|
23820
|
+
userId: paymentIntent.user_id || "",
|
|
23821
|
+
publishableKey,
|
|
23822
|
+
clientSecret,
|
|
23823
|
+
prefillAmountUsd: remainingAmountUsd,
|
|
23824
|
+
checkoutAmountUsd: paymentIntent.amount_usd,
|
|
23825
|
+
checkoutReceivedUsd: paymentIntent.amount_received_usd,
|
|
23826
|
+
checkoutDestination: {
|
|
23827
|
+
chainType: paymentIntent.destination_chain_type,
|
|
23828
|
+
chainId: paymentIntent.destination_chain_id,
|
|
23829
|
+
tokenAddress: paymentIntent.destination_token_address,
|
|
23830
|
+
decimals: paymentIntent.destination_token_decimals ?? 6
|
|
23831
|
+
},
|
|
23832
|
+
productType: "payment",
|
|
23833
|
+
stablecoinParity: paymentIntent.stablecoin_parity ?? false,
|
|
23834
|
+
checkoutRemainingBaseUnits: (() => {
|
|
23835
|
+
const remaining = BigInt(paymentIntent.amount) - BigInt(paymentIntent.amount_received);
|
|
23836
|
+
return remaining > 0n ? remaining.toString() : "0";
|
|
23837
|
+
})(),
|
|
23838
|
+
onSuccess: (_txHash) => {
|
|
23839
|
+
emitCheckoutSuccess(
|
|
23840
|
+
{
|
|
23841
|
+
paymentIntentId: paymentIntent.id,
|
|
23842
|
+
status: "processing",
|
|
23843
|
+
paymentIntent
|
|
23844
|
+
},
|
|
23845
|
+
"wallet_connect"
|
|
23846
|
+
);
|
|
23847
|
+
},
|
|
23848
|
+
onError: (error) => {
|
|
23849
|
+
onCheckoutError?.({
|
|
23850
|
+
message: error.message,
|
|
23851
|
+
error,
|
|
23852
|
+
method: "wallet_connect"
|
|
23853
|
+
});
|
|
23854
|
+
},
|
|
23855
|
+
onWalletDisconnect: handleWalletDisconnect,
|
|
23856
|
+
onWalletConnected: (info, dw) => {
|
|
23857
|
+
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
23858
|
+
setStoredWalletState(info.type);
|
|
23859
|
+
setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
|
|
23860
|
+
lastCheckoutMethodRef.current = "wallet_connect";
|
|
23861
|
+
},
|
|
23862
|
+
onNewDeposit: () => setView("main"),
|
|
23863
|
+
onDone: () => setView("main"),
|
|
23864
|
+
paymentIntentStatus: paymentIntent.status,
|
|
23865
|
+
onBack: handleBack,
|
|
23866
|
+
onClose: handleClose,
|
|
23867
|
+
defaultSourceChainType,
|
|
23868
|
+
defaultSourceChainId,
|
|
23869
|
+
defaultSourceTokenAddress,
|
|
23870
|
+
defaultSourceSymbol
|
|
23871
|
+
}
|
|
23872
|
+
),
|
|
23873
|
+
poweredByFooter
|
|
23874
|
+
]
|
|
23712
23875
|
}
|
|
23713
23876
|
)
|
|
23714
|
-
|
|
23715
|
-
|
|
23716
|
-
|
|
23717
|
-
] }) : view === "wallet_connect" && paymentIntent ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
23718
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
23719
|
-
WalletConnect,
|
|
23720
|
-
{
|
|
23721
|
-
walletInfo: browserWalletInfo ?? void 0,
|
|
23722
|
-
depositWallet: browserWalletInfo?.depositWallet ?? void 0,
|
|
23723
|
-
wallets,
|
|
23724
|
-
userId: paymentIntent.user_id || "",
|
|
23725
|
-
publishableKey,
|
|
23726
|
-
clientSecret,
|
|
23727
|
-
prefillAmountUsd: remainingAmountUsd,
|
|
23728
|
-
checkoutAmountUsd: paymentIntent.amount_usd,
|
|
23729
|
-
checkoutReceivedUsd: paymentIntent.amount_received_usd,
|
|
23730
|
-
checkoutDestination: {
|
|
23731
|
-
chainType: paymentIntent.destination_chain_type,
|
|
23732
|
-
chainId: paymentIntent.destination_chain_id,
|
|
23733
|
-
tokenAddress: paymentIntent.destination_token_address,
|
|
23734
|
-
decimals: paymentIntent.destination_token_decimals ?? 6
|
|
23735
|
-
},
|
|
23736
|
-
productType: "payment",
|
|
23737
|
-
stablecoinParity: paymentIntent.stablecoin_parity ?? false,
|
|
23738
|
-
checkoutRemainingBaseUnits: (() => {
|
|
23739
|
-
const remaining = BigInt(paymentIntent.amount) - BigInt(paymentIntent.amount_received);
|
|
23740
|
-
return remaining > 0n ? remaining.toString() : "0";
|
|
23741
|
-
})(),
|
|
23742
|
-
onSuccess: (_txHash) => {
|
|
23743
|
-
emitCheckoutSuccess(
|
|
23744
|
-
{
|
|
23745
|
-
paymentIntentId: paymentIntent.id,
|
|
23746
|
-
status: "processing",
|
|
23747
|
-
paymentIntent
|
|
23748
|
-
},
|
|
23749
|
-
"wallet_connect"
|
|
23750
|
-
);
|
|
23751
|
-
},
|
|
23752
|
-
onError: (error) => {
|
|
23753
|
-
onCheckoutError?.({
|
|
23754
|
-
message: error.message,
|
|
23755
|
-
error,
|
|
23756
|
-
method: "wallet_connect"
|
|
23757
|
-
});
|
|
23758
|
-
},
|
|
23759
|
-
onWalletDisconnect: handleWalletDisconnect,
|
|
23760
|
-
onWalletConnected: (info, dw) => {
|
|
23761
|
-
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
23762
|
-
setStoredWalletState(info.type);
|
|
23763
|
-
setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
|
|
23764
|
-
lastCheckoutMethodRef.current = "wallet_connect";
|
|
23765
|
-
},
|
|
23766
|
-
onNewDeposit: () => setView("main"),
|
|
23767
|
-
onDone: () => setView("main"),
|
|
23768
|
-
paymentIntentStatus: paymentIntent.status,
|
|
23769
|
-
onBack: handleBack,
|
|
23770
|
-
onClose: handleClose,
|
|
23771
|
-
defaultSourceChainType,
|
|
23772
|
-
defaultSourceChainId,
|
|
23773
|
-
defaultSourceTokenAddress,
|
|
23774
|
-
defaultSourceSymbol
|
|
23775
|
-
}
|
|
23776
|
-
),
|
|
23777
|
-
poweredByFooter
|
|
23778
|
-
] }) : null })
|
|
23877
|
+
) : null
|
|
23878
|
+
}
|
|
23879
|
+
)
|
|
23779
23880
|
}
|
|
23780
23881
|
) }) });
|
|
23781
23882
|
}
|
|
@@ -23785,12 +23886,12 @@ var import_react32 = require("react");
|
|
|
23785
23886
|
var import_lucide_react41 = require("lucide-react");
|
|
23786
23887
|
|
|
23787
23888
|
// src/hooks/use-supported-destination-tokens.ts
|
|
23788
|
-
var
|
|
23789
|
-
var
|
|
23889
|
+
var import_react_query18 = require("@tanstack/react-query");
|
|
23890
|
+
var import_core40 = require("@unifold/core");
|
|
23790
23891
|
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
23791
|
-
return (0,
|
|
23892
|
+
return (0, import_react_query18.useQuery)({
|
|
23792
23893
|
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
23793
|
-
queryFn: () => (0,
|
|
23894
|
+
queryFn: () => (0, import_core40.getSupportedDestinationTokens)(publishableKey),
|
|
23794
23895
|
staleTime: 1e3 * 60 * 5,
|
|
23795
23896
|
gcTime: 1e3 * 60 * 30,
|
|
23796
23897
|
refetchOnMount: false,
|
|
@@ -23817,8 +23918,8 @@ function useDefaultDestinationToken({
|
|
|
23817
23918
|
}
|
|
23818
23919
|
|
|
23819
23920
|
// src/hooks/use-source-token-validation.ts
|
|
23820
|
-
var
|
|
23821
|
-
var
|
|
23921
|
+
var import_react_query19 = require("@tanstack/react-query");
|
|
23922
|
+
var import_core41 = require("@unifold/core");
|
|
23822
23923
|
function useSourceTokenValidation(params) {
|
|
23823
23924
|
const {
|
|
23824
23925
|
sourceChainType,
|
|
@@ -23829,7 +23930,7 @@ function useSourceTokenValidation(params) {
|
|
|
23829
23930
|
enabled = true
|
|
23830
23931
|
} = params;
|
|
23831
23932
|
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
23832
|
-
return (0,
|
|
23933
|
+
return (0, import_react_query19.useQuery)({
|
|
23833
23934
|
queryKey: [
|
|
23834
23935
|
"unifold",
|
|
23835
23936
|
"sourceTokenValidation",
|
|
@@ -23839,7 +23940,7 @@ function useSourceTokenValidation(params) {
|
|
|
23839
23940
|
publishableKey
|
|
23840
23941
|
],
|
|
23841
23942
|
queryFn: async () => {
|
|
23842
|
-
const res = await (0,
|
|
23943
|
+
const res = await (0, import_core41.getSupportedDepositTokens)(publishableKey);
|
|
23843
23944
|
let matchedMinUsd = null;
|
|
23844
23945
|
let matchedProcessingTime = null;
|
|
23845
23946
|
let matchedSlippage = null;
|
|
@@ -23877,12 +23978,12 @@ function useSourceTokenValidation(params) {
|
|
|
23877
23978
|
}
|
|
23878
23979
|
|
|
23879
23980
|
// src/hooks/use-address-balance.ts
|
|
23880
|
-
var
|
|
23881
|
-
var
|
|
23981
|
+
var import_react_query20 = require("@tanstack/react-query");
|
|
23982
|
+
var import_core42 = require("@unifold/core");
|
|
23882
23983
|
function useAddressBalance(params) {
|
|
23883
23984
|
const { address, chainType, chainId, tokenAddress, publishableKey, enabled = true } = params;
|
|
23884
23985
|
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
23885
|
-
return (0,
|
|
23986
|
+
return (0, import_react_query20.useQuery)({
|
|
23886
23987
|
queryKey: [
|
|
23887
23988
|
"unifold",
|
|
23888
23989
|
"addressBalance",
|
|
@@ -23893,7 +23994,7 @@ function useAddressBalance(params) {
|
|
|
23893
23994
|
publishableKey
|
|
23894
23995
|
],
|
|
23895
23996
|
queryFn: async () => {
|
|
23896
|
-
const res = await (0,
|
|
23997
|
+
const res = await (0, import_core42.getAddressBalance)(
|
|
23897
23998
|
address,
|
|
23898
23999
|
chainType,
|
|
23899
24000
|
chainId,
|
|
@@ -23938,13 +24039,13 @@ function useAddressBalance(params) {
|
|
|
23938
24039
|
}
|
|
23939
24040
|
|
|
23940
24041
|
// src/hooks/use-executions.ts
|
|
23941
|
-
var
|
|
23942
|
-
var
|
|
24042
|
+
var import_react_query21 = require("@tanstack/react-query");
|
|
24043
|
+
var import_core43 = require("@unifold/core");
|
|
23943
24044
|
function useExecutions(userId, publishableKey, options) {
|
|
23944
|
-
const actionType = options?.actionType ??
|
|
23945
|
-
return (0,
|
|
24045
|
+
const actionType = options?.actionType ?? import_core43.ActionType.Deposit;
|
|
24046
|
+
return (0, import_react_query21.useQuery)({
|
|
23946
24047
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
23947
|
-
queryFn: () => (0,
|
|
24048
|
+
queryFn: () => (0, import_core43.queryExecutions)(userId, publishableKey, actionType),
|
|
23948
24049
|
enabled: (options?.enabled ?? true) && !!userId,
|
|
23949
24050
|
refetchInterval: options?.refetchInterval ?? 3e3,
|
|
23950
24051
|
staleTime: 0,
|
|
@@ -23955,7 +24056,7 @@ function useExecutions(userId, publishableKey, options) {
|
|
|
23955
24056
|
|
|
23956
24057
|
// src/hooks/use-withdraw-polling.ts
|
|
23957
24058
|
var import_react28 = require("react");
|
|
23958
|
-
var
|
|
24059
|
+
var import_core44 = require("@unifold/core");
|
|
23959
24060
|
var POLL_INTERVAL_MS3 = 2500;
|
|
23960
24061
|
var POLL_ENDPOINT_INTERVAL_MS2 = 5e3;
|
|
23961
24062
|
var CUTOFF_BUFFER_MS2 = 6e4;
|
|
@@ -23968,8 +24069,8 @@ function useWithdrawPolling({
|
|
|
23968
24069
|
onWithdrawError
|
|
23969
24070
|
}) {
|
|
23970
24071
|
const createExecutionSuccessEvent = (execution) => ({
|
|
23971
|
-
id: (0,
|
|
23972
|
-
type:
|
|
24072
|
+
id: (0, import_core44.generatePrefixedKSUID)("sevt"),
|
|
24073
|
+
type: import_core44.WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED,
|
|
23973
24074
|
created: execution.updated_at ? Math.floor(new Date(execution.updated_at).getTime() / 1e3) : execution.created_at ? Math.floor(new Date(execution.created_at).getTime() / 1e3) : Math.floor(Date.now() / 1e3),
|
|
23974
24075
|
data: { object: mapToDirectExecution(execution) }
|
|
23975
24076
|
});
|
|
@@ -24020,7 +24121,7 @@ function useWithdrawPolling({
|
|
|
24020
24121
|
const enabledAt = enabledAtRef.current;
|
|
24021
24122
|
const poll = async () => {
|
|
24022
24123
|
try {
|
|
24023
|
-
const response = await (0,
|
|
24124
|
+
const response = await (0, import_core44.queryExecutions)(userId, publishableKey, import_core44.ActionType.Withdraw);
|
|
24024
24125
|
const cutoff = new Date(enabledAt.getTime() - CUTOFF_BUFFER_MS2);
|
|
24025
24126
|
const sorted = [...response.data].sort((a, b) => {
|
|
24026
24127
|
const tA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
@@ -24028,11 +24129,11 @@ function useWithdrawPolling({
|
|
|
24028
24129
|
return tB - tA;
|
|
24029
24130
|
});
|
|
24030
24131
|
const inProgress = [
|
|
24031
|
-
|
|
24032
|
-
|
|
24033
|
-
|
|
24132
|
+
import_core44.ExecutionStatus.PENDING,
|
|
24133
|
+
import_core44.ExecutionStatus.WAITING,
|
|
24134
|
+
import_core44.ExecutionStatus.DELAYED
|
|
24034
24135
|
];
|
|
24035
|
-
const terminal = [
|
|
24136
|
+
const terminal = [import_core44.ExecutionStatus.SUCCEEDED, import_core44.ExecutionStatus.FAILED];
|
|
24036
24137
|
let target = null;
|
|
24037
24138
|
for (const ex of sorted) {
|
|
24038
24139
|
const t13 = ex.created_at ? new Date(ex.created_at) : null;
|
|
@@ -24062,7 +24163,7 @@ function useWithdrawPolling({
|
|
|
24062
24163
|
}
|
|
24063
24164
|
return [...list, ex];
|
|
24064
24165
|
});
|
|
24065
|
-
if (ex.status ===
|
|
24166
|
+
if (ex.status === import_core44.ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
24066
24167
|
onSuccessRef.current?.({
|
|
24067
24168
|
message: "Withdrawal completed successfully",
|
|
24068
24169
|
executionId: ex.id,
|
|
@@ -24070,7 +24171,7 @@ function useWithdrawPolling({
|
|
|
24070
24171
|
transaction: ex,
|
|
24071
24172
|
execution: createExecutionSuccessEvent(ex)
|
|
24072
24173
|
});
|
|
24073
|
-
} else if (ex.status ===
|
|
24174
|
+
} else if (ex.status === import_core44.ExecutionStatus.FAILED && prev !== import_core44.ExecutionStatus.FAILED) {
|
|
24074
24175
|
onErrorRef.current?.({
|
|
24075
24176
|
message: "Withdrawal failed",
|
|
24076
24177
|
code: "WITHDRAW_FAILED",
|
|
@@ -24099,7 +24200,7 @@ function useWithdrawPolling({
|
|
|
24099
24200
|
if (!enabled || !depositWalletId) return;
|
|
24100
24201
|
const trigger = async () => {
|
|
24101
24202
|
try {
|
|
24102
|
-
await (0,
|
|
24203
|
+
await (0, import_core44.pollDirectExecutions)({ deposit_wallet_id: depositWalletId }, publishableKey);
|
|
24103
24204
|
} catch {
|
|
24104
24205
|
}
|
|
24105
24206
|
};
|
|
@@ -24268,11 +24369,11 @@ function WithdrawDoubleInput({
|
|
|
24268
24369
|
// src/components/withdrawals/WithdrawForm.tsx
|
|
24269
24370
|
var import_react30 = require("react");
|
|
24270
24371
|
var import_lucide_react39 = require("lucide-react");
|
|
24271
|
-
var
|
|
24372
|
+
var import_core49 = require("@unifold/core");
|
|
24272
24373
|
|
|
24273
24374
|
// src/hooks/use-verify-recipient-address.ts
|
|
24274
|
-
var
|
|
24275
|
-
var
|
|
24375
|
+
var import_react_query22 = require("@tanstack/react-query");
|
|
24376
|
+
var import_core45 = require("@unifold/core");
|
|
24276
24377
|
function useVerifyRecipientAddress(params) {
|
|
24277
24378
|
const {
|
|
24278
24379
|
chainType,
|
|
@@ -24284,7 +24385,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
24284
24385
|
} = params;
|
|
24285
24386
|
const trimmedAddress = recipientAddress?.trim() || "";
|
|
24286
24387
|
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
24287
|
-
return (0,
|
|
24388
|
+
return (0, import_react_query22.useQuery)({
|
|
24288
24389
|
queryKey: [
|
|
24289
24390
|
"unifold",
|
|
24290
24391
|
"verifyRecipientAddress",
|
|
@@ -24294,7 +24395,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
24294
24395
|
trimmedAddress,
|
|
24295
24396
|
publishableKey
|
|
24296
24397
|
],
|
|
24297
|
-
queryFn: () => (0,
|
|
24398
|
+
queryFn: () => (0, import_core45.verifyRecipientAddress)(
|
|
24298
24399
|
{
|
|
24299
24400
|
chain_type: chainType,
|
|
24300
24401
|
chain_id: chainId,
|
|
@@ -24313,7 +24414,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
24313
24414
|
}
|
|
24314
24415
|
|
|
24315
24416
|
// src/components/withdrawals/send-withdraw.ts
|
|
24316
|
-
var
|
|
24417
|
+
var import_core46 = require("@unifold/core");
|
|
24317
24418
|
async function sendEvmWithdraw(params) {
|
|
24318
24419
|
const {
|
|
24319
24420
|
provider,
|
|
@@ -24402,7 +24503,7 @@ async function sendSolanaWithdraw(params) {
|
|
|
24402
24503
|
if (!provider.publicKey) {
|
|
24403
24504
|
await provider.connect();
|
|
24404
24505
|
}
|
|
24405
|
-
const buildResponse = await (0,
|
|
24506
|
+
const buildResponse = await (0, import_core46.buildSolanaTransaction)(
|
|
24406
24507
|
{
|
|
24407
24508
|
chain_id: "mainnet",
|
|
24408
24509
|
token_address: sourceTokenAddress === "" ? "native" : sourceTokenAddress,
|
|
@@ -24428,7 +24529,7 @@ async function sendSolanaWithdraw(params) {
|
|
|
24428
24529
|
for (let i = 0; i < serialized.length; i++) {
|
|
24429
24530
|
binaryStr += String.fromCharCode(serialized[i]);
|
|
24430
24531
|
}
|
|
24431
|
-
const sendResponse = await (0,
|
|
24532
|
+
const sendResponse = await (0, import_core46.sendSolanaTransaction)(
|
|
24432
24533
|
{ chain_id: "mainnet", signed_transaction: btoa(binaryStr) },
|
|
24433
24534
|
publishableKey
|
|
24434
24535
|
);
|
|
@@ -24529,11 +24630,11 @@ async function detectBrowserWallet(chainType, senderAddress) {
|
|
|
24529
24630
|
|
|
24530
24631
|
// src/hooks/use-hypercore-withdraw-activation.ts
|
|
24531
24632
|
var import_react29 = require("react");
|
|
24532
|
-
var
|
|
24633
|
+
var import_core48 = require("@unifold/core");
|
|
24533
24634
|
|
|
24534
24635
|
// src/hooks/use-get-deposit-address.ts
|
|
24535
|
-
var
|
|
24536
|
-
var
|
|
24636
|
+
var import_react_query23 = require("@tanstack/react-query");
|
|
24637
|
+
var import_core47 = require("@unifold/core");
|
|
24537
24638
|
function useGetDepositAddress(params) {
|
|
24538
24639
|
const {
|
|
24539
24640
|
userId,
|
|
@@ -24546,7 +24647,7 @@ function useGetDepositAddress(params) {
|
|
|
24546
24647
|
enabled = true
|
|
24547
24648
|
} = params;
|
|
24548
24649
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
24549
|
-
return (0,
|
|
24650
|
+
return (0, import_react_query23.useQuery)({
|
|
24550
24651
|
queryKey: [
|
|
24551
24652
|
"unifold",
|
|
24552
24653
|
"getDepositAddress",
|
|
@@ -24558,7 +24659,7 @@ function useGetDepositAddress(params) {
|
|
|
24558
24659
|
actionType ?? null,
|
|
24559
24660
|
publishableKey
|
|
24560
24661
|
],
|
|
24561
|
-
queryFn: () => (0,
|
|
24662
|
+
queryFn: () => (0, import_core47.getDepositAddress)(
|
|
24562
24663
|
{
|
|
24563
24664
|
external_user_id: userId,
|
|
24564
24665
|
recipient_address: recipientAddress,
|
|
@@ -24612,7 +24713,7 @@ function useHypercoreWithdrawActivation(params) {
|
|
|
24612
24713
|
destinationChainType,
|
|
24613
24714
|
destinationChainId,
|
|
24614
24715
|
destinationTokenAddress,
|
|
24615
|
-
actionType:
|
|
24716
|
+
actionType: import_core48.ActionType.Withdraw,
|
|
24616
24717
|
enabled: enabled && isHypercore(sourceChainId)
|
|
24617
24718
|
});
|
|
24618
24719
|
const depositWalletAddress = (0, import_react29.useMemo)(() => {
|
|
@@ -24903,7 +25004,7 @@ function WithdrawForm({
|
|
|
24903
25004
|
let humanAmount = isMaxed ? balanceData.balanceHuman : toSafeDecimalString(cryptoAmountFromInput, sourceDecimals);
|
|
24904
25005
|
if (isHypercoreChain(sourceChainId)) {
|
|
24905
25006
|
try {
|
|
24906
|
-
const check = await (0,
|
|
25007
|
+
const check = await (0, import_core49.checkHypercoreActivation)(
|
|
24907
25008
|
{
|
|
24908
25009
|
source_address: senderAddress,
|
|
24909
25010
|
recipient_address: depositWallet.address
|
|
@@ -25352,11 +25453,11 @@ function WithdrawForm({
|
|
|
25352
25453
|
|
|
25353
25454
|
// src/components/withdrawals/WithdrawExecutionItem.tsx
|
|
25354
25455
|
var import_lucide_react40 = require("lucide-react");
|
|
25355
|
-
var
|
|
25456
|
+
var import_core50 = require("@unifold/core");
|
|
25356
25457
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
25357
25458
|
function WithdrawExecutionItem({ execution, onClick }) {
|
|
25358
25459
|
const { colors: colors2, fonts, components } = useTheme();
|
|
25359
|
-
const isPending = execution.status ===
|
|
25460
|
+
const isPending = execution.status === import_core50.ExecutionStatus.PENDING || execution.status === import_core50.ExecutionStatus.WAITING || execution.status === import_core50.ExecutionStatus.DELAYED;
|
|
25360
25461
|
const formatDateTime = (timestamp) => {
|
|
25361
25462
|
try {
|
|
25362
25463
|
const date = new Date(timestamp);
|
|
@@ -25403,7 +25504,7 @@ function WithdrawExecutionItem({ execution, onClick }) {
|
|
|
25403
25504
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
25404
25505
|
"img",
|
|
25405
25506
|
{
|
|
25406
|
-
src: execution.destination_token_metadata?.icon_url || (0,
|
|
25507
|
+
src: execution.destination_token_metadata?.icon_url || (0, import_core50.getIconUrl)("/icons/tokens/svg/usdc.svg"),
|
|
25407
25508
|
alt: "Token",
|
|
25408
25509
|
width: 36,
|
|
25409
25510
|
height: 36,
|
|
@@ -25639,7 +25740,7 @@ function WithdrawConfirmingView({
|
|
|
25639
25740
|
}
|
|
25640
25741
|
|
|
25641
25742
|
// src/components/withdrawals/WithdrawModal.tsx
|
|
25642
|
-
var
|
|
25743
|
+
var import_core51 = require("@unifold/core");
|
|
25643
25744
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
25644
25745
|
var t11 = i18n.withdrawModal;
|
|
25645
25746
|
var getChainKey5 = (chainId, chainType) => `${chainType}:${chainId}`;
|
|
@@ -25745,26 +25846,26 @@ function WithdrawModal({
|
|
|
25745
25846
|
onWithdrawError
|
|
25746
25847
|
});
|
|
25747
25848
|
const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
|
|
25748
|
-
actionType:
|
|
25849
|
+
actionType: import_core51.ActionType.Withdraw,
|
|
25749
25850
|
enabled: open,
|
|
25750
25851
|
refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
|
|
25751
25852
|
});
|
|
25752
25853
|
const allWithdrawals = allWithdrawalsData?.data ?? [];
|
|
25753
25854
|
const handleDepositWalletCreation = (0, import_react32.useCallback)(
|
|
25754
25855
|
async (params) => {
|
|
25755
|
-
const { data: wallets } = await (0,
|
|
25856
|
+
const { data: wallets } = await (0, import_core51.createDepositAddress)(
|
|
25756
25857
|
{
|
|
25757
25858
|
external_user_id: externalUserId,
|
|
25758
25859
|
destination_chain_type: params.destinationChainType,
|
|
25759
25860
|
destination_chain_id: params.destinationChainId,
|
|
25760
25861
|
destination_token_address: params.destinationTokenAddress,
|
|
25761
25862
|
recipient_address: params.recipientAddress,
|
|
25762
|
-
action_type:
|
|
25863
|
+
action_type: import_core51.ActionType.Withdraw,
|
|
25763
25864
|
source_chain_type: sourceChainType
|
|
25764
25865
|
},
|
|
25765
25866
|
publishableKey
|
|
25766
25867
|
);
|
|
25767
|
-
const depositWallet = (0,
|
|
25868
|
+
const depositWallet = (0, import_core51.getWalletByChainType)(wallets, sourceChainType);
|
|
25768
25869
|
if (!depositWallet) {
|
|
25769
25870
|
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
25770
25871
|
}
|