@lumiapassport/ui-kit 1.13.10 → 1.13.11
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/README.md +15 -4
- package/dist/iframe/index.html +1 -1
- package/dist/iframe/main.js +286 -29
- package/dist/iframe/main.js.map +1 -1
- package/dist/index.cjs +377 -586
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +180 -390
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2458,6 +2458,7 @@ var init_iframe_manager = __esm({
|
|
|
2458
2458
|
this.iframe = null;
|
|
2459
2459
|
this.sessionToken = null;
|
|
2460
2460
|
this.isReady = false;
|
|
2461
|
+
// private themeColors?: IframeManagerConfig['themeColors']
|
|
2461
2462
|
// Message handling
|
|
2462
2463
|
this.pendingRequests = /* @__PURE__ */ new Map();
|
|
2463
2464
|
this.usedNonces = /* @__PURE__ */ new Set();
|
|
@@ -2477,14 +2478,13 @@ var init_iframe_manager = __esm({
|
|
|
2477
2478
|
this.projectId = config.projectId;
|
|
2478
2479
|
this.debug = config.debug || false;
|
|
2479
2480
|
this.onWalletReadyCallback = config.onWalletReady;
|
|
2480
|
-
this.themeColors = config.themeColors;
|
|
2481
2481
|
this.readyPromise = new Promise((resolve) => {
|
|
2482
2482
|
this.readyResolve = resolve;
|
|
2483
2483
|
});
|
|
2484
2484
|
this.log("[IframeManager] Initialized with:", {
|
|
2485
2485
|
iframeUrl: this.iframeUrl,
|
|
2486
|
-
projectId: this.projectId
|
|
2487
|
-
hasThemeColors: !!this.themeColors
|
|
2486
|
+
projectId: this.projectId
|
|
2487
|
+
// hasThemeColors: !!this.themeColors
|
|
2488
2488
|
});
|
|
2489
2489
|
}
|
|
2490
2490
|
/**
|
|
@@ -2496,16 +2496,6 @@ var init_iframe_manager = __esm({
|
|
|
2496
2496
|
}
|
|
2497
2497
|
this.iframe = document.createElement("iframe");
|
|
2498
2498
|
let iframeUrl = this.iframeUrl;
|
|
2499
|
-
if (this.themeColors) {
|
|
2500
|
-
const params = new URLSearchParams();
|
|
2501
|
-
if (this.themeColors.background) params.set("bg", this.themeColors.background);
|
|
2502
|
-
if (this.themeColors.text) params.set("text", this.themeColors.text);
|
|
2503
|
-
if (this.themeColors.textSecondary) params.set("textSec", this.themeColors.textSecondary);
|
|
2504
|
-
if (this.themeColors.border) params.set("border", this.themeColors.border);
|
|
2505
|
-
if (params.toString()) {
|
|
2506
|
-
iframeUrl += (iframeUrl.includes("?") ? "&" : "?") + params.toString();
|
|
2507
|
-
}
|
|
2508
|
-
}
|
|
2509
2499
|
this.iframe.src = iframeUrl;
|
|
2510
2500
|
this.iframe.id = "lumia-passport-iframe";
|
|
2511
2501
|
this.iframe.style.display = "none";
|
|
@@ -4260,7 +4250,7 @@ import {
|
|
|
4260
4250
|
createContext,
|
|
4261
4251
|
useCallback as useCallback20,
|
|
4262
4252
|
useContext,
|
|
4263
|
-
useEffect as
|
|
4253
|
+
useEffect as useEffect31,
|
|
4264
4254
|
useMemo as useMemo3,
|
|
4265
4255
|
useRef as useRef11
|
|
4266
4256
|
} from "react";
|
|
@@ -4272,7 +4262,7 @@ import { create as create5 } from "zustand";
|
|
|
4272
4262
|
// src/internal/components/BalanceFeedProvider/BalanceFeedProvider.tsx
|
|
4273
4263
|
init_base();
|
|
4274
4264
|
import { useQuery } from "@tanstack/react-query";
|
|
4275
|
-
import { useEffect
|
|
4265
|
+
import { useEffect, useState } from "react";
|
|
4276
4266
|
import { useBalance } from "wagmi";
|
|
4277
4267
|
|
|
4278
4268
|
// src/internal/hooks/useLayoutDataStore.ts
|
|
@@ -4281,13 +4271,13 @@ import { create } from "zustand";
|
|
|
4281
4271
|
// src/internal/constants.ts
|
|
4282
4272
|
init_assets();
|
|
4283
4273
|
import { Key as Key2, Mail as Mail2, Wallet2 as Wallet22 } from "lucide-react";
|
|
4274
|
+
var LOCAL_COLOR_MODE_KEY = "lumia-passport-theme";
|
|
4284
4275
|
var DEFAULT_AUTH_MENU_HEIGHT = 253;
|
|
4285
4276
|
var DEFAULT_MAIN_MENU_HEIGHT = 90;
|
|
4286
4277
|
var DEFAULT_SETTINGS_MENU_HEIGHT = 346;
|
|
4287
4278
|
var MAX_CONTENT_HEIGHT = 640;
|
|
4288
4279
|
var MAIN_DIALOG_ANIMATION_SPEED = 375;
|
|
4289
4280
|
var Y_ANIMATION_SETUP = { duration: 0.15, ease: "easeInOut", height: { duration: 0.375 } };
|
|
4290
|
-
var LOCAL_COLOR_MODE_KEY = "lumia-passport-theme";
|
|
4291
4281
|
var PROVIDERS_META2 = {
|
|
4292
4282
|
passkey: { name: "Passkey", icon: Key2, description: "Biometric authentication" },
|
|
4293
4283
|
email: { name: "Email", icon: Mail2, description: "Email verification" },
|
|
@@ -4347,166 +4337,20 @@ var useLayoutDataStore = create((set) => ({
|
|
|
4347
4337
|
})
|
|
4348
4338
|
}));
|
|
4349
4339
|
|
|
4350
|
-
// src/internal/hooks/useLumiaPriceSSE.ts
|
|
4351
|
-
import { useMutation } from "@tanstack/react-query";
|
|
4352
|
-
import { useEffect } from "react";
|
|
4353
|
-
|
|
4354
|
-
// src/internal/lib/LumiaPriceSSEService.ts
|
|
4355
|
-
var FALLBACK = "https://fallback.lumia.passport.io";
|
|
4356
|
-
var API_DOMAIN = (true ? "" : FALLBACK) || FALLBACK;
|
|
4357
|
-
var LumiaPriceSSEService = class {
|
|
4358
|
-
// private readonly baseUrl: string = API_DOMAIN
|
|
4359
|
-
constructor() {
|
|
4360
|
-
this.eventSource = null;
|
|
4361
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
4362
|
-
this.currentPrice = null;
|
|
4363
|
-
this.isConnected = false;
|
|
4364
|
-
this.reconnectTimeout = null;
|
|
4365
|
-
}
|
|
4366
|
-
connect() {
|
|
4367
|
-
return new Promise((resolve, reject) => {
|
|
4368
|
-
console.log("[LumiaPriceSSEService]: Connecting to LUMIA Price SSE...");
|
|
4369
|
-
if (this.isConnected) {
|
|
4370
|
-
resolve();
|
|
4371
|
-
return;
|
|
4372
|
-
}
|
|
4373
|
-
try {
|
|
4374
|
-
this.eventSource = new EventSource(`${API_DOMAIN}/api/lumia/sse`);
|
|
4375
|
-
this.eventSource.onopen = () => {
|
|
4376
|
-
console.log("[LumiaPriceSSEService]: LUMIA Price SSE connected");
|
|
4377
|
-
this.isConnected = true;
|
|
4378
|
-
this.clearReconnectTimeout();
|
|
4379
|
-
resolve();
|
|
4380
|
-
};
|
|
4381
|
-
this.eventSource.onmessage = () => {
|
|
4382
|
-
};
|
|
4383
|
-
this.eventSource.addEventListener("rate", (event) => {
|
|
4384
|
-
try {
|
|
4385
|
-
const data = JSON.parse(event.data);
|
|
4386
|
-
if (data.price !== void 0 && data.symbol === "LUMIAUSDT") {
|
|
4387
|
-
this.currentPrice = typeof data.price === "number" ? data.price : parseFloat(data.price);
|
|
4388
|
-
if (this.currentPrice !== null) {
|
|
4389
|
-
const update = {
|
|
4390
|
-
symbol: data.symbol,
|
|
4391
|
-
price: this.currentPrice,
|
|
4392
|
-
ts: data.ts || Date.now()
|
|
4393
|
-
};
|
|
4394
|
-
this.listeners.forEach((listener) => listener(update));
|
|
4395
|
-
}
|
|
4396
|
-
}
|
|
4397
|
-
} catch (error) {
|
|
4398
|
-
console.error("Error parsing price event:", error, event.data);
|
|
4399
|
-
}
|
|
4400
|
-
});
|
|
4401
|
-
this.eventSource.addEventListener("ping", () => {
|
|
4402
|
-
});
|
|
4403
|
-
this.eventSource.onerror = (error) => {
|
|
4404
|
-
console.error("LUMIA Price SSE error:", error);
|
|
4405
|
-
this.isConnected = false;
|
|
4406
|
-
if (this.eventSource?.readyState === EventSource.CLOSED) {
|
|
4407
|
-
console.log("SSE connection closed, attempting to reconnect...");
|
|
4408
|
-
this.scheduleReconnect();
|
|
4409
|
-
reject(error);
|
|
4410
|
-
}
|
|
4411
|
-
};
|
|
4412
|
-
setTimeout(() => {
|
|
4413
|
-
if (!this.isConnected) {
|
|
4414
|
-
reject(new Error("SSE connection timeout"));
|
|
4415
|
-
}
|
|
4416
|
-
}, 1e4);
|
|
4417
|
-
} catch (error) {
|
|
4418
|
-
reject(error);
|
|
4419
|
-
}
|
|
4420
|
-
});
|
|
4421
|
-
}
|
|
4422
|
-
disconnect() {
|
|
4423
|
-
this.clearReconnectTimeout();
|
|
4424
|
-
if (this.eventSource) {
|
|
4425
|
-
this.eventSource.close();
|
|
4426
|
-
this.eventSource = null;
|
|
4427
|
-
}
|
|
4428
|
-
this.isConnected = false;
|
|
4429
|
-
this.currentPrice = null;
|
|
4430
|
-
console.log("[LumiaPriceSSEService]: LUMIA Price SSE disconnected");
|
|
4431
|
-
}
|
|
4432
|
-
addListener(listener) {
|
|
4433
|
-
this.listeners.add(listener);
|
|
4434
|
-
}
|
|
4435
|
-
removeListener(listener) {
|
|
4436
|
-
this.listeners.delete(listener);
|
|
4437
|
-
}
|
|
4438
|
-
clearListeners() {
|
|
4439
|
-
this.listeners.clear();
|
|
4440
|
-
}
|
|
4441
|
-
getCurrentPrice() {
|
|
4442
|
-
return this.currentPrice;
|
|
4443
|
-
}
|
|
4444
|
-
getConnectionStatus() {
|
|
4445
|
-
return this.isConnected;
|
|
4446
|
-
}
|
|
4447
|
-
scheduleReconnect() {
|
|
4448
|
-
this.clearReconnectTimeout();
|
|
4449
|
-
this.reconnectTimeout = window.setTimeout(() => {
|
|
4450
|
-
console.log("Attempting to reconnect to BTC Price SSE...");
|
|
4451
|
-
this.connect().catch((error) => {
|
|
4452
|
-
console.error("Reconnection failed:", error);
|
|
4453
|
-
this.scheduleReconnect();
|
|
4454
|
-
});
|
|
4455
|
-
}, 5e3);
|
|
4456
|
-
}
|
|
4457
|
-
clearReconnectTimeout() {
|
|
4458
|
-
if (this.reconnectTimeout) {
|
|
4459
|
-
clearTimeout(this.reconnectTimeout);
|
|
4460
|
-
this.reconnectTimeout = null;
|
|
4461
|
-
}
|
|
4462
|
-
}
|
|
4463
|
-
};
|
|
4464
|
-
var lumiaPriceSSE = new LumiaPriceSSEService();
|
|
4465
|
-
async function sseConnectMutation() {
|
|
4466
|
-
try {
|
|
4467
|
-
await lumiaPriceSSE.connect();
|
|
4468
|
-
console.info("[LUMIA SSE] price feed connected");
|
|
4469
|
-
return { ok: true };
|
|
4470
|
-
} catch (error) {
|
|
4471
|
-
console.error("[LUMIA SSE] Error connecting to SSE:", error);
|
|
4472
|
-
throw new Error("[LUMIA SSE] Error connecting to SSE");
|
|
4473
|
-
}
|
|
4474
|
-
}
|
|
4475
|
-
|
|
4476
|
-
// src/internal/hooks/useLumiaPriceSSE.ts
|
|
4477
|
-
function useLumiaPriceSSE(enabled, updateCurrentPrice) {
|
|
4478
|
-
const { mutate: connectSSE } = useMutation({
|
|
4479
|
-
mutationFn: sseConnectMutation,
|
|
4480
|
-
onSuccess: () => {
|
|
4481
|
-
lumiaPriceSSE.addListener(updateCurrentPrice);
|
|
4482
|
-
},
|
|
4483
|
-
onError: (err) => {
|
|
4484
|
-
console.error("Lumia Price SSE connection error:", err);
|
|
4485
|
-
}
|
|
4486
|
-
});
|
|
4487
|
-
useEffect(() => {
|
|
4488
|
-
const isConnected = lumiaPriceSSE.getConnectionStatus();
|
|
4489
|
-
console.log("[LUMIA PRICE SSE MANAGER] SSE status:", { enabled, isConnected });
|
|
4490
|
-
if (!enabled) {
|
|
4491
|
-
lumiaPriceSSE.clearListeners();
|
|
4492
|
-
lumiaPriceSSE.disconnect();
|
|
4493
|
-
return;
|
|
4494
|
-
}
|
|
4495
|
-
return () => {
|
|
4496
|
-
lumiaPriceSSE.clearListeners();
|
|
4497
|
-
lumiaPriceSSE.disconnect();
|
|
4498
|
-
};
|
|
4499
|
-
}, [enabled, connectSSE]);
|
|
4500
|
-
}
|
|
4501
|
-
|
|
4502
4340
|
// src/internal/components/BalanceFeedProvider/BalanceFeedProvider.tsx
|
|
4503
4341
|
var BALANCE_POLLING_INTERVAL = 3e4;
|
|
4342
|
+
async function getAssetRate(symbol = "LUMIA", fiat = "USDT") {
|
|
4343
|
+
const assetURL = `https://api.binance.com/api/v3/ticker/price?symbol=${symbol.toUpperCase()}${fiat.toUpperCase()}`;
|
|
4344
|
+
const response = await fetch(assetURL);
|
|
4345
|
+
return await response.json();
|
|
4346
|
+
}
|
|
4347
|
+
var LUMIA_RATE_QUERY_KEY = "lumia-passport-rate-query-key";
|
|
4504
4348
|
function BalanceFeedProvider() {
|
|
4505
4349
|
const config = useLumiaPassportConfig().config;
|
|
4506
4350
|
const address = useLumiaPassportSession((st) => st.address);
|
|
4507
|
-
const {
|
|
4351
|
+
const { setCryptoRate, setFiatBalance, setBalance, setCryptoSymbol, setFiatSymbol } = useLayoutDataStore();
|
|
4508
4352
|
const [balanceSymbol, setBalanceSymbol] = useState(null);
|
|
4509
|
-
|
|
4353
|
+
useEffect(() => {
|
|
4510
4354
|
const { assets, showBalanceAs: customBalanceSymbol } = config.current?.projectAssets || {};
|
|
4511
4355
|
const { balanceQuery, balanceQueryKey } = assets?.find((a) => a.symbol === customBalanceSymbol) || {};
|
|
4512
4356
|
const isCustom = !!customBalanceSymbol && !!balanceQuery && !!balanceQueryKey;
|
|
@@ -4523,14 +4367,31 @@ function BalanceFeedProvider() {
|
|
|
4523
4367
|
refetchOnWindowFocus: true
|
|
4524
4368
|
}
|
|
4525
4369
|
});
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4370
|
+
const { data: cryptoRate } = useQuery({
|
|
4371
|
+
queryKey: [LUMIA_RATE_QUERY_KEY, address],
|
|
4372
|
+
enabled: !!address && !!isNativeBalanceFeedEnabled,
|
|
4373
|
+
refetchInterval: BALANCE_POLLING_INTERVAL,
|
|
4374
|
+
queryFn: async () => getAssetRate("LUMIA", "USDT")
|
|
4375
|
+
// TODO: get LUMIA-FIAT pair from config
|
|
4376
|
+
});
|
|
4377
|
+
useEffect(() => {
|
|
4378
|
+
const rate = cryptoRate ? Number(cryptoRate.price) : null;
|
|
4379
|
+
if (!isNativeBalanceFeedEnabled || !balance || !rate) return;
|
|
4380
|
+
setCryptoRate(rate);
|
|
4529
4381
|
setCryptoSymbol("LUMIA");
|
|
4530
4382
|
setFiatSymbol("USD");
|
|
4531
|
-
setFiatBalance(Number(balance?.formatted || 0) *
|
|
4383
|
+
setFiatBalance(Number(balance?.formatted || 0) * rate);
|
|
4532
4384
|
setBalance(balance);
|
|
4533
|
-
}, [
|
|
4385
|
+
}, [
|
|
4386
|
+
isNativeBalanceFeedEnabled,
|
|
4387
|
+
balance,
|
|
4388
|
+
cryptoRate,
|
|
4389
|
+
setFiatBalance,
|
|
4390
|
+
setCryptoRate,
|
|
4391
|
+
setBalance,
|
|
4392
|
+
setCryptoSymbol,
|
|
4393
|
+
setFiatSymbol
|
|
4394
|
+
]);
|
|
4534
4395
|
const {
|
|
4535
4396
|
balanceQuery: customBalanceQuery,
|
|
4536
4397
|
balanceQueryKey: CUSTOM_BALANCE_QUERY_KEY,
|
|
@@ -4545,7 +4406,7 @@ function BalanceFeedProvider() {
|
|
|
4545
4406
|
// should be invalidated by host app via provided queryKey
|
|
4546
4407
|
queryFn: async () => await customBalanceQuery?.()
|
|
4547
4408
|
});
|
|
4548
|
-
|
|
4409
|
+
useEffect(() => {
|
|
4549
4410
|
if (!isCustomBalanceEnabled || !customBalance) return;
|
|
4550
4411
|
const { cryptoFiatRate, fiatFormatted, cryptoFormatted, cryptoSymbol, fiatSymbol } = customBalance;
|
|
4551
4412
|
setCryptoSymbol(cryptoSymbol.toUpperCase());
|
|
@@ -4564,12 +4425,12 @@ function BalanceFeedProvider() {
|
|
|
4564
4425
|
|
|
4565
4426
|
// src/internal/components/Dialog/LumiaPassportDialog.tsx
|
|
4566
4427
|
import { AnimatePresence as AnimatePresence4, motion as motion4 } from "framer-motion";
|
|
4567
|
-
import { useEffect as
|
|
4428
|
+
import { useEffect as useEffect29 } from "react";
|
|
4568
4429
|
|
|
4569
4430
|
// package.json
|
|
4570
4431
|
var package_default = {
|
|
4571
4432
|
name: "@lumiapassport/ui-kit",
|
|
4572
|
-
version: "1.13.
|
|
4433
|
+
version: "1.13.11",
|
|
4573
4434
|
description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
|
|
4574
4435
|
type: "module",
|
|
4575
4436
|
main: "./dist/index.cjs",
|
|
@@ -4657,7 +4518,7 @@ var package_default = {
|
|
|
4657
4518
|
};
|
|
4658
4519
|
|
|
4659
4520
|
// src/internal/components/Footer/Footer.tsx
|
|
4660
|
-
import { useMutation
|
|
4521
|
+
import { useMutation } from "@tanstack/react-query";
|
|
4661
4522
|
import { Loader, LogOut } from "lucide-react";
|
|
4662
4523
|
|
|
4663
4524
|
// src/internal/assets/LumiaLogo.tsx
|
|
@@ -4718,21 +4579,6 @@ init_base();
|
|
|
4718
4579
|
// src/internal/lib/utils.ts
|
|
4719
4580
|
import { clsx } from "clsx";
|
|
4720
4581
|
import { twMerge } from "tailwind-merge";
|
|
4721
|
-
var LP_JWT_TOKENS_LS_KEY = "lumia-passport-jwt-tokens";
|
|
4722
|
-
function getBearer() {
|
|
4723
|
-
try {
|
|
4724
|
-
const sessionString = localStorage.getItem(LP_JWT_TOKENS_LS_KEY);
|
|
4725
|
-
if (!sessionString) return null;
|
|
4726
|
-
const session = JSON.parse(sessionString);
|
|
4727
|
-
if (session && typeof session.accessToken === "string" && typeof session.userId === "string") {
|
|
4728
|
-
return `Bearer ${session.accessToken}`;
|
|
4729
|
-
}
|
|
4730
|
-
return null;
|
|
4731
|
-
} catch (error) {
|
|
4732
|
-
console.error("Failed to parse Lumia Passport session:", error);
|
|
4733
|
-
return null;
|
|
4734
|
-
}
|
|
4735
|
-
}
|
|
4736
4582
|
function cn(...inputs) {
|
|
4737
4583
|
return twMerge(clsx(inputs));
|
|
4738
4584
|
}
|
|
@@ -4802,7 +4648,7 @@ function Footer() {
|
|
|
4802
4648
|
const { callbacks } = useLumiaPassportConfig();
|
|
4803
4649
|
const { address, setSession, setAddress, setStatus, setError, setIsLoading } = useLumiaPassportSession();
|
|
4804
4650
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
4805
|
-
const { mutate: disconnect, isPending: isDisconnecting } =
|
|
4651
|
+
const { mutate: disconnect, isPending: isDisconnecting } = useMutation({
|
|
4806
4652
|
mutationFn: async (disconnectAddress) => {
|
|
4807
4653
|
if (!disconnectAddress) throw new Error("No address to disconnect");
|
|
4808
4654
|
setError(null);
|
|
@@ -5166,10 +5012,7 @@ var DialogOverlay = forwardRef3(
|
|
|
5166
5012
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
5167
5013
|
function useDecideContentStyles() {
|
|
5168
5014
|
const isMobileView = useLayoutStore((st) => st.isMobileView);
|
|
5169
|
-
const
|
|
5170
|
-
const isDialogClosing = useLayoutStore((st) => st.isDialogClosing);
|
|
5171
|
-
const isClosing = isDialogOpen && isDialogClosing;
|
|
5172
|
-
console.log("[IS_MOBILE_VIEW]", isMobileView);
|
|
5015
|
+
const isClosing = useLayoutStore((st) => !!st.isDialogOpen && !!st.isDialogClosing);
|
|
5173
5016
|
const mobileStyles = isMobileView ? { "--l-pass-maw": "100%", "--l-pass-bdrs": "20px 20px 0px 0px" } : {};
|
|
5174
5017
|
return {
|
|
5175
5018
|
isClosing,
|
|
@@ -5204,7 +5047,6 @@ var DialogContent = forwardRef3(
|
|
|
5204
5047
|
ref,
|
|
5205
5048
|
style: !!className ? void 0 : CONTENT_BG_SETUP,
|
|
5206
5049
|
className: cn(
|
|
5207
|
-
// isWalletLinking ? 'pointer-events-none' : 'pointer-events-auto',
|
|
5208
5050
|
"relative pointer-events-auto w-full",
|
|
5209
5051
|
"max-w-[var(--l-pass-maw)] max-h-[95dvh] p-0 gap-0",
|
|
5210
5052
|
"text-[var(--l-pass-fg)]",
|
|
@@ -5283,7 +5125,7 @@ import { jsx as jsx10 } from "react/jsx-runtime";
|
|
|
5283
5125
|
var VisuallyHidden = ({ children }) => /* @__PURE__ */ jsx10("span", { className: "sr-only absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0", children });
|
|
5284
5126
|
|
|
5285
5127
|
// src/internal/hooks/useAutoConnect.ts
|
|
5286
|
-
import { useCallback, useEffect as
|
|
5128
|
+
import { useCallback, useEffect as useEffect2, useRef } from "react";
|
|
5287
5129
|
function useAutoConnect() {
|
|
5288
5130
|
const {
|
|
5289
5131
|
config: { current: config },
|
|
@@ -5338,7 +5180,7 @@ function useAutoConnect() {
|
|
|
5338
5180
|
[usePaymaster, setStatus, callbacks]
|
|
5339
5181
|
);
|
|
5340
5182
|
const autoConnectAttemptedRef = useRef(false);
|
|
5341
|
-
|
|
5183
|
+
useEffect2(() => {
|
|
5342
5184
|
if (autoConnectAttemptedRef.current) return;
|
|
5343
5185
|
setIsLoading(true);
|
|
5344
5186
|
const tryAutoConnect = async (attempt) => {
|
|
@@ -5457,11 +5299,11 @@ function useAutoConnect() {
|
|
|
5457
5299
|
}
|
|
5458
5300
|
|
|
5459
5301
|
// src/internal/hooks/useBackupStatusChanges.ts
|
|
5460
|
-
import { useEffect as
|
|
5302
|
+
import { useEffect as useEffect3 } from "react";
|
|
5461
5303
|
init_vaultClient();
|
|
5462
5304
|
function useBackupStatusChanges() {
|
|
5463
5305
|
const setHasServerVault = useLumiaPassportSession((st) => st.setHasServerVault);
|
|
5464
|
-
|
|
5306
|
+
useEffect3(() => {
|
|
5465
5307
|
const handleBackupStatusChanged = async (event) => {
|
|
5466
5308
|
const customEvent = event;
|
|
5467
5309
|
const { method, success } = customEvent.detail || {};
|
|
@@ -5487,13 +5329,13 @@ function useBackupStatusChanges() {
|
|
|
5487
5329
|
}
|
|
5488
5330
|
|
|
5489
5331
|
// src/internal/hooks/useCheckVaultStatus.ts
|
|
5490
|
-
import { useMutation as
|
|
5491
|
-
import { useEffect as
|
|
5332
|
+
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
5333
|
+
import { useEffect as useEffect4 } from "react";
|
|
5492
5334
|
init_vaultClient();
|
|
5493
5335
|
function useCheckVaultStatus() {
|
|
5494
5336
|
const address = useLumiaPassportSession((st) => st.address);
|
|
5495
5337
|
const setHasServerVault = useLumiaPassportSession((st) => st.setHasServerVault);
|
|
5496
|
-
const { mutate: checkVaultStatus } =
|
|
5338
|
+
const { mutate: checkVaultStatus } = useMutation2({
|
|
5497
5339
|
mutationFn: async () => {
|
|
5498
5340
|
const stats = await getShareRecoveryStats();
|
|
5499
5341
|
const hasRecoveryData = stats && (stats.created || stats.devices && stats.devices.length > 0);
|
|
@@ -5507,7 +5349,7 @@ function useCheckVaultStatus() {
|
|
|
5507
5349
|
setHasServerVault(false);
|
|
5508
5350
|
}
|
|
5509
5351
|
});
|
|
5510
|
-
|
|
5352
|
+
useEffect4(() => {
|
|
5511
5353
|
if (!address) return setHasServerVault(false);
|
|
5512
5354
|
checkVaultStatus();
|
|
5513
5355
|
}, [address, checkVaultStatus]);
|
|
@@ -5515,7 +5357,7 @@ function useCheckVaultStatus() {
|
|
|
5515
5357
|
|
|
5516
5358
|
// src/internal/hooks/useDetectMaxScrollHeight.ts
|
|
5517
5359
|
import { debounce } from "lodash-es";
|
|
5518
|
-
import { useCallback as useCallback2, useEffect as
|
|
5360
|
+
import { useCallback as useCallback2, useEffect as useEffect5 } from "react";
|
|
5519
5361
|
var DEBOUNCE_DELAY = 50;
|
|
5520
5362
|
function useDetectMaxScrollHeight() {
|
|
5521
5363
|
const setIsMobileView = useLayoutStore((state) => state.setIsMobileView);
|
|
@@ -5528,7 +5370,7 @@ function useDetectMaxScrollHeight() {
|
|
|
5528
5370
|
}, DEBOUNCE_DELAY),
|
|
5529
5371
|
[setMaxScrollHeight, setIsMobileView]
|
|
5530
5372
|
);
|
|
5531
|
-
|
|
5373
|
+
useEffect5(() => {
|
|
5532
5374
|
const obs = new ResizeObserver(([entry]) => onResize(entry.contentRect));
|
|
5533
5375
|
const doc = window.document.getElementsByTagName("html")[0];
|
|
5534
5376
|
if (doc) obs.observe(doc);
|
|
@@ -5537,12 +5379,12 @@ function useDetectMaxScrollHeight() {
|
|
|
5537
5379
|
}
|
|
5538
5380
|
|
|
5539
5381
|
// src/internal/hooks/usePageMapper.tsx
|
|
5540
|
-
import { useCallback as useCallback17, useEffect as
|
|
5382
|
+
import { useCallback as useCallback17, useEffect as useEffect26 } from "react";
|
|
5541
5383
|
|
|
5542
5384
|
// src/internal/components/AuthMenu/AuthMenu.tsx
|
|
5543
5385
|
import { AnimatePresence, motion } from "framer-motion";
|
|
5544
5386
|
import { Loader as Loader5 } from "lucide-react";
|
|
5545
|
-
import { useEffect as
|
|
5387
|
+
import { useEffect as useEffect9, useMemo } from "react";
|
|
5546
5388
|
|
|
5547
5389
|
// src/internal/components/AuthMenu/AuthFailedStep.tsx
|
|
5548
5390
|
import { AlertTriangle, Cross } from "lucide-react";
|
|
@@ -5828,12 +5670,12 @@ function PasskeyAddIcon(props) {
|
|
|
5828
5670
|
init_auth();
|
|
5829
5671
|
|
|
5830
5672
|
// src/internal/components/Expandable/hooks/useExpandable.ts
|
|
5831
|
-
import { useCallback as useCallback3, useEffect as
|
|
5673
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
5832
5674
|
var useExpandable = (props) => {
|
|
5833
5675
|
const { isExpanded = false, children, initHeight = 0, minHeight = 0 } = props;
|
|
5834
5676
|
const expandableRef = useRef3(null);
|
|
5835
5677
|
const contentRef = useRef3(null);
|
|
5836
|
-
|
|
5678
|
+
useEffect6(() => {
|
|
5837
5679
|
if (!expandableRef.current) return;
|
|
5838
5680
|
expandableRef.current.style.setProperty("--ifo-basic-expandable-h", `${initHeight}px )`);
|
|
5839
5681
|
}, []);
|
|
@@ -5848,7 +5690,7 @@ var useExpandable = (props) => {
|
|
|
5848
5690
|
// ON_RESIZE_DELEAY),
|
|
5849
5691
|
[minHeight]
|
|
5850
5692
|
);
|
|
5851
|
-
|
|
5693
|
+
useEffect6(() => {
|
|
5852
5694
|
if (!contentRef.current || !expandableRef.current) return;
|
|
5853
5695
|
const obs = new ResizeObserver(() => setExpandableHeight(isExpanded));
|
|
5854
5696
|
obs.observe(expandableRef.current);
|
|
@@ -6107,7 +5949,7 @@ import { Fragment as Fragment2 } from "react";
|
|
|
6107
5949
|
// src/internal/components/AuthMenu/SignInStep/Email.tsx
|
|
6108
5950
|
init_lumiaPassport();
|
|
6109
5951
|
init_projectId();
|
|
6110
|
-
import { useMutation as
|
|
5952
|
+
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
6111
5953
|
import { ChevronRight, Loader as Loader3, Mail as Mail3 } from "lucide-react";
|
|
6112
5954
|
|
|
6113
5955
|
// src/internal/components/ui/highlight.tsx
|
|
@@ -6143,7 +5985,7 @@ function Email() {
|
|
|
6143
5985
|
const isLoading = useLumiaPassportSession((st) => st.isLoading);
|
|
6144
5986
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
6145
5987
|
const { email, codeSendError, alert: alert2, setEmail, setCodeSendError, setExpiresIn, setStep, setAlert } = useAuthStore();
|
|
6146
|
-
const { mutate: onSendVerificationCode } =
|
|
5988
|
+
const { mutate: onSendVerificationCode } = useMutation3({
|
|
6147
5989
|
mutationFn: async (mail) => {
|
|
6148
5990
|
const isEmailValid = mail.length !== 0 && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(mail);
|
|
6149
5991
|
if (!isEmailValid) {
|
|
@@ -6950,7 +6792,7 @@ function useAuthMenuHandlers() {
|
|
|
6950
6792
|
}
|
|
6951
6793
|
|
|
6952
6794
|
// src/internal/components/AuthMenu/useListenIframeAuthEvents.ts
|
|
6953
|
-
import { useCallback as useCallback7, useEffect as
|
|
6795
|
+
import { useCallback as useCallback7, useEffect as useEffect7 } from "react";
|
|
6954
6796
|
function useListenIframeAuthEvents() {
|
|
6955
6797
|
const setPage = useLayoutDataStore((state) => state.setPage);
|
|
6956
6798
|
const setIsIframeReady = useLumiaPassportSession((state) => state.setIsIframeReady);
|
|
@@ -6972,7 +6814,7 @@ function useListenIframeAuthEvents() {
|
|
|
6972
6814
|
},
|
|
6973
6815
|
[setPage, setIsIframeReady]
|
|
6974
6816
|
);
|
|
6975
|
-
|
|
6817
|
+
useEffect7(() => {
|
|
6976
6818
|
window.addEventListener("message", handleIframeMessage);
|
|
6977
6819
|
return () => window.removeEventListener("message", handleIframeMessage);
|
|
6978
6820
|
}, [handleIframeMessage]);
|
|
@@ -6980,7 +6822,7 @@ function useListenIframeAuthEvents() {
|
|
|
6980
6822
|
|
|
6981
6823
|
// src/internal/components/AuthMenu/VerifyStep/VerifyStep.tsx
|
|
6982
6824
|
init_lumiaPassport();
|
|
6983
|
-
import { useMutation as
|
|
6825
|
+
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
6984
6826
|
import { ArrowLeft as ArrowLeft3, Loader as Loader4 } from "lucide-react";
|
|
6985
6827
|
|
|
6986
6828
|
// src/internal/assets/OtpIcon.tsx
|
|
@@ -7001,21 +6843,21 @@ init_auth();
|
|
|
7001
6843
|
init_projectId();
|
|
7002
6844
|
|
|
7003
6845
|
// src/internal/components/AuthMenu/VerifyStep/VerificationCodeInput.tsx
|
|
7004
|
-
import { useEffect as
|
|
6846
|
+
import { useEffect as useEffect8, useRef as useRef5, useState as useState5 } from "react";
|
|
7005
6847
|
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7006
6848
|
var VerificationCodeInput = (props) => {
|
|
7007
6849
|
const { onVerifyCode, onResendCode, isLoading, expiresIn, error } = props;
|
|
7008
6850
|
const setVerificationError = useAuthStore((st) => st.setVerificationError);
|
|
7009
6851
|
const [timeLeft, setTimeLeft] = useState5(expiresIn);
|
|
7010
|
-
|
|
7011
|
-
|
|
6852
|
+
useEffect8(() => setTimeLeft(expiresIn), [expiresIn]);
|
|
6853
|
+
useEffect8(() => {
|
|
7012
6854
|
const t = setInterval(() => setTimeLeft((secs) => secs > 0 ? secs - 1 : 0), 1e3);
|
|
7013
6855
|
return () => clearInterval(t);
|
|
7014
6856
|
}, []);
|
|
7015
6857
|
const lastSubmittedRef = useRef5(null);
|
|
7016
6858
|
const inputsRef = useRef5([]);
|
|
7017
6859
|
const [digits, setDigits] = useState5(["", "", "", "", "", ""]);
|
|
7018
|
-
|
|
6860
|
+
useEffect8(() => {
|
|
7019
6861
|
const code = digits.join("");
|
|
7020
6862
|
if (code.length === 6 && digits.every((d) => d !== "") && !isLoading) {
|
|
7021
6863
|
if (lastSubmittedRef.current !== code) {
|
|
@@ -7024,7 +6866,7 @@ var VerificationCodeInput = (props) => {
|
|
|
7024
6866
|
}
|
|
7025
6867
|
}
|
|
7026
6868
|
}, [digits, isLoading, onVerifyCode]);
|
|
7027
|
-
|
|
6869
|
+
useEffect8(() => {
|
|
7028
6870
|
const t = setTimeout(() => {
|
|
7029
6871
|
inputsRef.current[0]?.focus();
|
|
7030
6872
|
}, 0);
|
|
@@ -7149,7 +6991,7 @@ function VerifyStep(props) {
|
|
|
7149
6991
|
setEmail,
|
|
7150
6992
|
setExpiresIn
|
|
7151
6993
|
} = useAuthStore();
|
|
7152
|
-
const { mutate: onVerifyCode, isPending: isCodeVerifying } =
|
|
6994
|
+
const { mutate: onVerifyCode, isPending: isCodeVerifying } = useMutation4({
|
|
7153
6995
|
mutationFn: async (code) => {
|
|
7154
6996
|
setIsLoading(true);
|
|
7155
6997
|
setVerificationError("");
|
|
@@ -7222,7 +7064,7 @@ function VerifyStep(props) {
|
|
|
7222
7064
|
setIsLoading(false);
|
|
7223
7065
|
}
|
|
7224
7066
|
});
|
|
7225
|
-
const { mutate: onResendCode, isPending: isCodeResending } =
|
|
7067
|
+
const { mutate: onResendCode, isPending: isCodeResending } = useMutation4({
|
|
7226
7068
|
mutationFn: async () => {
|
|
7227
7069
|
setVerificationError("");
|
|
7228
7070
|
setIsLoading(true);
|
|
@@ -7300,7 +7142,7 @@ var AuthMenu = () => {
|
|
|
7300
7142
|
const isIframeReady = useLumiaPassportSession((st) => st.isIframeReady);
|
|
7301
7143
|
const page = useLayoutDataStore((st) => st.page);
|
|
7302
7144
|
const setMainPageHeight = useLayoutDataStore((st) => st.setMainPageHeight);
|
|
7303
|
-
|
|
7145
|
+
useEffect9(() => setMainPageHeight(DEFAULT_AUTH_MENU_HEIGHT), [setMainPageHeight]);
|
|
7304
7146
|
const {
|
|
7305
7147
|
step,
|
|
7306
7148
|
setStep,
|
|
@@ -7311,7 +7153,7 @@ var AuthMenu = () => {
|
|
|
7311
7153
|
setFailedMessage,
|
|
7312
7154
|
setCodeSendError
|
|
7313
7155
|
} = useAuthStore();
|
|
7314
|
-
|
|
7156
|
+
useEffect9(() => {
|
|
7315
7157
|
if (page !== "auth" /* AUTH */) {
|
|
7316
7158
|
setStep("signin");
|
|
7317
7159
|
setEmail("");
|
|
@@ -7476,9 +7318,9 @@ function RampnowIcon() {
|
|
|
7476
7318
|
}
|
|
7477
7319
|
|
|
7478
7320
|
// src/internal/components/BuyMenu/binance/Binance.tsx
|
|
7479
|
-
import { useMutation as
|
|
7321
|
+
import { useMutation as useMutation5, useQuery as useQuery3, useQueryClient } from "@tanstack/react-query";
|
|
7480
7322
|
import { DollarSign, LoaderIcon } from "lucide-react";
|
|
7481
|
-
import { useEffect as
|
|
7323
|
+
import { useEffect as useEffect11, useRef as useRef6 } from "react";
|
|
7482
7324
|
|
|
7483
7325
|
// src/internal/components/BuyMenu/components/PaymentSelector.tsx
|
|
7484
7326
|
import { jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
@@ -7519,81 +7361,38 @@ var QUERY_KEYS2 = {
|
|
|
7519
7361
|
};
|
|
7520
7362
|
|
|
7521
7363
|
// src/internal/components/BuyMenu/binance/api.ts
|
|
7522
|
-
|
|
7364
|
+
init_iframe_manager();
|
|
7523
7365
|
async function getLumiaNetworkQuery() {
|
|
7524
|
-
const
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
headers: {
|
|
7528
|
-
"Content-Type": "application/json",
|
|
7529
|
-
...auth && { Authorization: auth }
|
|
7530
|
-
}
|
|
7531
|
-
});
|
|
7532
|
-
const data = await response.json();
|
|
7533
|
-
if (!data?.success) {
|
|
7534
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
7535
|
-
}
|
|
7536
|
-
const lumiaNetwork = data.data?.find((el) => el.cryptoCurrency === "LUMIA") || null;
|
|
7537
|
-
if (!lumiaNetwork) {
|
|
7538
|
-
console.error("Lumia is not available in Binance pairs API");
|
|
7539
|
-
throw new Error("Lumia is not available in API");
|
|
7366
|
+
const iframeManager = getIframeManager();
|
|
7367
|
+
if (!iframeManager) {
|
|
7368
|
+
throw new Error("Iframe manager is not initialized");
|
|
7540
7369
|
}
|
|
7541
|
-
return
|
|
7370
|
+
return await iframeManager.sendMessage("BINANCE_GET_LUMIA_NETWORK_QUERY", {});
|
|
7542
7371
|
}
|
|
7543
7372
|
async function getPaymentMethodsQuery(payload) {
|
|
7544
|
-
const
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
headers: {
|
|
7548
|
-
"Content-Type": "application/json",
|
|
7549
|
-
...auth && { Authorization: auth }
|
|
7550
|
-
},
|
|
7551
|
-
body: JSON.stringify(payload)
|
|
7552
|
-
});
|
|
7553
|
-
const data = await response.json();
|
|
7554
|
-
if (!data.success) {
|
|
7555
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
7556
|
-
}
|
|
7557
|
-
if (!data.data.paymentMethods.length) {
|
|
7558
|
-
throw new Error("No payment methods available yet");
|
|
7373
|
+
const iframeManager = getIframeManager();
|
|
7374
|
+
if (!iframeManager) {
|
|
7375
|
+
throw new Error("Iframe manager is not initialized");
|
|
7559
7376
|
}
|
|
7560
|
-
return
|
|
7377
|
+
return await iframeManager.sendMessage("BINANCE_GET_PAYMENT_METHODS_QUERY", payload);
|
|
7561
7378
|
}
|
|
7562
7379
|
async function getQuoteQuery(payload) {
|
|
7563
|
-
const
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
headers: {
|
|
7567
|
-
"Content-Type": "application/json",
|
|
7568
|
-
...auth && { Authorization: auth }
|
|
7569
|
-
},
|
|
7570
|
-
body: JSON.stringify(payload)
|
|
7571
|
-
});
|
|
7572
|
-
const data = await response.json();
|
|
7573
|
-
if (!data.success) {
|
|
7574
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
7380
|
+
const iframeManager = getIframeManager();
|
|
7381
|
+
if (!iframeManager) {
|
|
7382
|
+
throw new Error("Iframe manager is not initialized");
|
|
7575
7383
|
}
|
|
7576
|
-
return
|
|
7384
|
+
return await iframeManager.sendMessage("BINANCE_GET_QUOTE_QUERY", payload);
|
|
7577
7385
|
}
|
|
7578
7386
|
async function createPreorderMutation(payload) {
|
|
7579
|
-
const
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
headers: {
|
|
7583
|
-
"Content-Type": "application/json",
|
|
7584
|
-
...auth && { Authorization: auth }
|
|
7585
|
-
},
|
|
7586
|
-
body: JSON.stringify(payload)
|
|
7587
|
-
});
|
|
7588
|
-
const data = await response.json();
|
|
7589
|
-
if (!data.success) {
|
|
7590
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
7387
|
+
const iframeManager = getIframeManager();
|
|
7388
|
+
if (!iframeManager) {
|
|
7389
|
+
throw new Error("Iframe manager is not initialized");
|
|
7591
7390
|
}
|
|
7592
|
-
return
|
|
7391
|
+
return await iframeManager.sendMessage("BINANCE_CREATE_PREORDER_MUTATION", payload);
|
|
7593
7392
|
}
|
|
7594
7393
|
|
|
7595
7394
|
// src/internal/components/BuyMenu/binance/useQueriesErrorHandler.ts
|
|
7596
|
-
import { useEffect as
|
|
7395
|
+
import { useEffect as useEffect10 } from "react";
|
|
7597
7396
|
|
|
7598
7397
|
// src/internal/components/BuyMenu/binance/utils.ts
|
|
7599
7398
|
function getPayMethodID(pm) {
|
|
@@ -7613,7 +7412,7 @@ function handleErrors(errors) {
|
|
|
7613
7412
|
// src/internal/components/BuyMenu/binance/useQueriesErrorHandler.ts
|
|
7614
7413
|
var useQueriesErrorHandler = (errors, stateUpdater) => {
|
|
7615
7414
|
const { error: errorTitle, message: errorMessage } = handleErrors(errors);
|
|
7616
|
-
|
|
7415
|
+
useEffect10(() => {
|
|
7617
7416
|
if (!errorTitle && !errorMessage) return;
|
|
7618
7417
|
console.error(`[BuyModal][Binance] ${errorTitle}: ${errorMessage}`);
|
|
7619
7418
|
stateUpdater(1);
|
|
@@ -7662,14 +7461,14 @@ function Binance(props) {
|
|
|
7662
7461
|
queryFn: async () => getPaymentMethodsQuery({ totalAmount: String(srcQueryAmount || 1) })
|
|
7663
7462
|
});
|
|
7664
7463
|
const lastLoadedPaymentModes = useRef6([]);
|
|
7665
|
-
|
|
7464
|
+
useEffect11(() => {
|
|
7666
7465
|
if (!paymentModes?.length) return;
|
|
7667
7466
|
setPaymentMode(getPayMethodID(paymentModes[0]));
|
|
7668
7467
|
lastLoadedPaymentModes.current = paymentModes;
|
|
7669
7468
|
}, [paymentModes]);
|
|
7670
7469
|
const selectedPaymentMode = paymentModes?.find((el) => getPayMethodID(el) === paymentMode) || null;
|
|
7671
7470
|
const minimum = Number(selectedPaymentMode?.fiatMinLimit || "0");
|
|
7672
|
-
|
|
7471
|
+
useEffect11(() => setMinAmount(minimum), [minimum]);
|
|
7673
7472
|
const {
|
|
7674
7473
|
data: quoteData = null,
|
|
7675
7474
|
isLoading: isQuoteDataLoading,
|
|
@@ -7690,7 +7489,7 @@ function Binance(props) {
|
|
|
7690
7489
|
[lumiaNetworkError, paymentMethodsError, quoteError],
|
|
7691
7490
|
setSrcInputAmount
|
|
7692
7491
|
);
|
|
7693
|
-
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } =
|
|
7492
|
+
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = useMutation5({
|
|
7694
7493
|
mutationFn: async () => {
|
|
7695
7494
|
setRedirecting(true);
|
|
7696
7495
|
const returnUrl = window.location.href.split("?")[0];
|
|
@@ -7714,7 +7513,7 @@ function Binance(props) {
|
|
|
7714
7513
|
setRedirecting(false);
|
|
7715
7514
|
}
|
|
7716
7515
|
});
|
|
7717
|
-
|
|
7516
|
+
useEffect11(() => {
|
|
7718
7517
|
return () => {
|
|
7719
7518
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binanceNetworksQuery] });
|
|
7720
7519
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binancePaymentModes] });
|
|
@@ -7776,36 +7575,25 @@ function Binance(props) {
|
|
|
7776
7575
|
}
|
|
7777
7576
|
|
|
7778
7577
|
// src/internal/components/BuyMenu/rampnow/Rampnow.tsx
|
|
7779
|
-
import { useMutation as
|
|
7578
|
+
import { useMutation as useMutation6, useQuery as useQuery4, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
7780
7579
|
import { DollarSign as DollarSign2, LoaderIcon as LoaderIcon2 } from "lucide-react";
|
|
7781
|
-
import { useEffect as
|
|
7580
|
+
import { useEffect as useEffect12 } from "react";
|
|
7782
7581
|
|
|
7783
7582
|
// src/internal/components/BuyMenu/rampnow/api.ts
|
|
7784
|
-
|
|
7583
|
+
init_iframe_manager();
|
|
7785
7584
|
async function getRampnowConfigQuery() {
|
|
7786
|
-
const
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
});
|
|
7791
|
-
const data = await response.json();
|
|
7792
|
-
return data;
|
|
7585
|
+
const iframeManager = getIframeManager();
|
|
7586
|
+
if (!iframeManager) {
|
|
7587
|
+
throw new Error("Iframe manager is not initialized");
|
|
7588
|
+
}
|
|
7589
|
+
return await iframeManager.sendMessage("RAMPNOW_GET_CONFIG", {});
|
|
7793
7590
|
}
|
|
7794
7591
|
async function getRampOrderQuoteQuery(payload) {
|
|
7795
|
-
const
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
headers: {
|
|
7799
|
-
"Content-Type": "application/json",
|
|
7800
|
-
...auth && { Authorization: auth }
|
|
7801
|
-
},
|
|
7802
|
-
body: JSON.stringify(payload)
|
|
7803
|
-
});
|
|
7804
|
-
const data = await response.json();
|
|
7805
|
-
if (!data.data) {
|
|
7806
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
7592
|
+
const iframeManager = getIframeManager();
|
|
7593
|
+
if (!iframeManager) {
|
|
7594
|
+
throw new Error("Iframe manager is not initialized");
|
|
7807
7595
|
}
|
|
7808
|
-
return
|
|
7596
|
+
return await iframeManager.sendMessage("RAMPNOW_GET_ORDER_QUOTE", payload);
|
|
7809
7597
|
}
|
|
7810
7598
|
|
|
7811
7599
|
// src/internal/components/BuyMenu/rampnow/constants.ts
|
|
@@ -7843,7 +7631,7 @@ function Rampnow(props) {
|
|
|
7843
7631
|
setMinAmount
|
|
7844
7632
|
} = control;
|
|
7845
7633
|
const qc = useQueryClient2();
|
|
7846
|
-
|
|
7634
|
+
useEffect12(() => {
|
|
7847
7635
|
setMinAmount(MINIMUM_RAMP_AMOUNT);
|
|
7848
7636
|
setPaymentMode(PAYMENT_MODES[0].id);
|
|
7849
7637
|
}, []);
|
|
@@ -7871,7 +7659,7 @@ function Rampnow(props) {
|
|
|
7871
7659
|
paymentMode
|
|
7872
7660
|
})
|
|
7873
7661
|
});
|
|
7874
|
-
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } =
|
|
7662
|
+
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = useMutation6({
|
|
7875
7663
|
mutationFn: async () => {
|
|
7876
7664
|
if (!configData?.apiKey?.length || !configData?.orderUrl?.length) {
|
|
7877
7665
|
throw new Error("RampNow order service is not available");
|
|
@@ -7900,7 +7688,7 @@ function Rampnow(props) {
|
|
|
7900
7688
|
console.error("Create CheckoutOrder failed:", err);
|
|
7901
7689
|
}
|
|
7902
7690
|
});
|
|
7903
|
-
|
|
7691
|
+
useEffect12(() => {
|
|
7904
7692
|
return () => {
|
|
7905
7693
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.getRampNowConfig] });
|
|
7906
7694
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.getRampNowQuote] });
|
|
@@ -7982,7 +7770,7 @@ var RAMP_PROVIDERS = {
|
|
|
7982
7770
|
var REDIRECT_TIMEOUT_MS = 1500;
|
|
7983
7771
|
|
|
7984
7772
|
// src/internal/components/BuyMenu/useSelectables.ts
|
|
7985
|
-
import { useCallback as useCallback8, useEffect as
|
|
7773
|
+
import { useCallback as useCallback8, useEffect as useEffect13, useRef as useRef7, useState as useState6 } from "react";
|
|
7986
7774
|
|
|
7987
7775
|
// src/internal/utils/debounce.ts
|
|
7988
7776
|
function debounce2(func, waitFor) {
|
|
@@ -8011,7 +7799,7 @@ var useSelectables = () => {
|
|
|
8011
7799
|
}, ON_INPUT_QUERY_DELAY),
|
|
8012
7800
|
[minAmount]
|
|
8013
7801
|
);
|
|
8014
|
-
|
|
7802
|
+
useEffect13(() => setQueryAmountDebounced(srcInputAmount), [srcInputAmount, setQueryAmountDebounced]);
|
|
8015
7803
|
return {
|
|
8016
7804
|
inputRef,
|
|
8017
7805
|
redirecting,
|
|
@@ -8074,7 +7862,7 @@ import {
|
|
|
8074
7862
|
Loader as Loader6,
|
|
8075
7863
|
Lock
|
|
8076
7864
|
} from "lucide-react";
|
|
8077
|
-
import React7, { useEffect as
|
|
7865
|
+
import React7, { useEffect as useEffect14 } from "react";
|
|
8078
7866
|
init_iframe_manager();
|
|
8079
7867
|
|
|
8080
7868
|
// src/internal/components/ui/checkbox.tsx
|
|
@@ -8110,7 +7898,7 @@ function KeyshareBackupMenu() {
|
|
|
8110
7898
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
8111
7899
|
const userId = session?.mpcUserId || "";
|
|
8112
7900
|
const onBackupSuccess = () => console.log("[ConnectWalletButton] Backup created successfully");
|
|
8113
|
-
|
|
7901
|
+
useEffect14(() => {
|
|
8114
7902
|
if (!userId) setPage("main-menu" /* MAIN_MENU */);
|
|
8115
7903
|
}, [userId, setPage]);
|
|
8116
7904
|
const [backupStatus, setBackupStatus] = React7.useState({
|
|
@@ -8141,7 +7929,7 @@ function KeyshareBackupMenu() {
|
|
|
8141
7929
|
return null;
|
|
8142
7930
|
}
|
|
8143
7931
|
}, []);
|
|
8144
|
-
|
|
7932
|
+
useEffect14(() => {
|
|
8145
7933
|
const loadCloudProviders = async () => {
|
|
8146
7934
|
try {
|
|
8147
7935
|
const { getAvailableCloudProviders: getAvailableCloudProviders3 } = await Promise.resolve().then(() => (init_cloudStorage(), cloudStorage_exports));
|
|
@@ -8170,7 +7958,7 @@ function KeyshareBackupMenu() {
|
|
|
8170
7958
|
console.error("[KeyshareBackup] Failed to get backup status:", error2);
|
|
8171
7959
|
}
|
|
8172
7960
|
}, [iframeManager, userId]);
|
|
8173
|
-
|
|
7961
|
+
useEffect14(() => {
|
|
8174
7962
|
refreshStatus();
|
|
8175
7963
|
}, [refreshStatus]);
|
|
8176
7964
|
const handleBackup = async (method) => {
|
|
@@ -8399,9 +8187,9 @@ function KeyshareBackupMenu() {
|
|
|
8399
8187
|
}
|
|
8400
8188
|
|
|
8401
8189
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
8402
|
-
import { useMutation as
|
|
8190
|
+
import { useMutation as useMutation7 } from "@tanstack/react-query";
|
|
8403
8191
|
import { AlertCircle as AlertCircle4, CheckCircle2 as CheckCircle22, Loader as Loader9, LogOut as LogOut2 } from "lucide-react";
|
|
8404
|
-
import React8, { useCallback as useCallback9, useEffect as
|
|
8192
|
+
import React8, { useCallback as useCallback9, useEffect as useEffect15 } from "react";
|
|
8405
8193
|
init_vaultClient();
|
|
8406
8194
|
|
|
8407
8195
|
// src/internal/components/KeyshareRestoreMenu/NoBackupFound.tsx
|
|
@@ -8586,7 +8374,7 @@ var KeyshareRestoreMenu = () => {
|
|
|
8586
8374
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
8587
8375
|
const setIsDialogForced = useLayoutStore((st) => st.setIsDialogForced);
|
|
8588
8376
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
8589
|
-
|
|
8377
|
+
useEffect15(() => setIsDialogForced(true), []);
|
|
8590
8378
|
const { usePaymaster, recoveryUserId, setRecoveryUserId, setSession, setAddress, setStatus, setIsLoading } = useLumiaPassportSession();
|
|
8591
8379
|
const [error, setError] = React8.useState(null);
|
|
8592
8380
|
const [success, setSuccess] = React8.useState(null);
|
|
@@ -8695,7 +8483,7 @@ var KeyshareRestoreMenu = () => {
|
|
|
8695
8483
|
callbacks,
|
|
8696
8484
|
config.projectId
|
|
8697
8485
|
]);
|
|
8698
|
-
|
|
8486
|
+
useEffect15(() => {
|
|
8699
8487
|
const checkBackupAvailability = async () => {
|
|
8700
8488
|
try {
|
|
8701
8489
|
setCheckingBackup(true);
|
|
@@ -8713,7 +8501,7 @@ var KeyshareRestoreMenu = () => {
|
|
|
8713
8501
|
};
|
|
8714
8502
|
checkBackupAvailability();
|
|
8715
8503
|
}, [recoveryUserId]);
|
|
8716
|
-
const { mutate: restoreFromServer2, isPending: isRestoringFromServer } =
|
|
8504
|
+
const { mutate: restoreFromServer2, isPending: isRestoringFromServer } = useMutation7({
|
|
8717
8505
|
mutationFn: async () => {
|
|
8718
8506
|
setError(null);
|
|
8719
8507
|
setSuccess(null);
|
|
@@ -8748,7 +8536,7 @@ var KeyshareRestoreMenu = () => {
|
|
|
8748
8536
|
setError(errorMsg);
|
|
8749
8537
|
}
|
|
8750
8538
|
});
|
|
8751
|
-
const { mutate: restoreFromFile, isPending: isRestoringFromFile } =
|
|
8539
|
+
const { mutate: restoreFromFile, isPending: isRestoringFromFile } = useMutation7({
|
|
8752
8540
|
mutationFn: async () => {
|
|
8753
8541
|
if (!restoreFile) {
|
|
8754
8542
|
throw new Error("Please select a backup file");
|
|
@@ -8782,7 +8570,7 @@ var KeyshareRestoreMenu = () => {
|
|
|
8782
8570
|
setError(errorMsg);
|
|
8783
8571
|
}
|
|
8784
8572
|
});
|
|
8785
|
-
const { mutate: disconnect, isPending: isDisconnecting } =
|
|
8573
|
+
const { mutate: disconnect, isPending: isDisconnecting } = useMutation7({
|
|
8786
8574
|
mutationFn: async () => {
|
|
8787
8575
|
setError(null);
|
|
8788
8576
|
setStatus("disconnecting");
|
|
@@ -8874,7 +8662,7 @@ import { ArrowLeft as ArrowLeft6 } from "lucide-react";
|
|
|
8874
8662
|
import { LoaderIcon as LoaderIcon3 } from "lucide-react";
|
|
8875
8663
|
|
|
8876
8664
|
// src/internal/components/KYC/useSumsubIframe.ts
|
|
8877
|
-
import { useEffect as
|
|
8665
|
+
import { useEffect as useEffect16, useRef as useRef8, useState as useState8 } from "react";
|
|
8878
8666
|
|
|
8879
8667
|
// src/internal/components/KYC/api/sumsub.ts
|
|
8880
8668
|
init_httpClient();
|
|
@@ -9003,7 +8791,7 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
9003
8791
|
const [height, setHeight] = useState8(0);
|
|
9004
8792
|
const [status, setStatus] = useState8("");
|
|
9005
8793
|
const levelName = config.kyc?.options?.levelName;
|
|
9006
|
-
|
|
8794
|
+
useEffect16(() => {
|
|
9007
8795
|
setError(null);
|
|
9008
8796
|
setIsLoading(true);
|
|
9009
8797
|
setStatus("Preparing verification...");
|
|
@@ -9111,7 +8899,7 @@ function KycMenu() {
|
|
|
9111
8899
|
|
|
9112
8900
|
// src/internal/components/MainMenu/MainMenu.tsx
|
|
9113
8901
|
import { ChevronLeft, ChevronRight as ChevronRight2, DollarSign as DollarSign3, Wallet2 as Wallet23 } from "lucide-react";
|
|
9114
|
-
import { useEffect as
|
|
8902
|
+
import { useEffect as useEffect17 } from "react";
|
|
9115
8903
|
|
|
9116
8904
|
// src/internal/components/MainMenu/BackupWarning.tsx
|
|
9117
8905
|
import { AnimatePresence as AnimatePresence2, motion as motion2 } from "framer-motion";
|
|
@@ -9167,7 +8955,7 @@ function MainMenu() {
|
|
|
9167
8955
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9168
8956
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
9169
8957
|
const setMainPageHeight = useLayoutDataStore((st) => st.setMainPageHeight);
|
|
9170
|
-
|
|
8958
|
+
useEffect17(() => setMainPageHeight(DEFAULT_MAIN_MENU_HEIGHT), [setMainPageHeight]);
|
|
9171
8959
|
return /* @__PURE__ */ jsxs33("div", { className: "w-full p-[var(--l-pass-pd)] flex flex-col gap-[var(--l-pass-gap)]", children: [
|
|
9172
8960
|
/* @__PURE__ */ jsx42("div", { className: "grid grid-cols-4 gap-[var(--l-pass-gap)]", children: MAIN_MENU_BUTTONS.map(({ id, label, icon: Icon }) => /* @__PURE__ */ jsxs33(
|
|
9173
8961
|
Button,
|
|
@@ -9241,7 +9029,7 @@ init_passkey2();
|
|
|
9241
9029
|
// src/internal/components/ManageWalletMenu/EmailForm.tsx
|
|
9242
9030
|
init_lumiaPassport();
|
|
9243
9031
|
init_projectId();
|
|
9244
|
-
import { useMutation as
|
|
9032
|
+
import { useMutation as useMutation8 } from "@tanstack/react-query";
|
|
9245
9033
|
import { ChevronRight as ChevronRight3, Loader as Loader10, Mail as Mail4 } from "lucide-react";
|
|
9246
9034
|
|
|
9247
9035
|
// src/internal/components/ManageWalletMenu/hooks/useStore.ts
|
|
@@ -9283,7 +9071,7 @@ function EmailForm() {
|
|
|
9283
9071
|
const isLoading = useLumiaPassportSession((st) => st.isLoading);
|
|
9284
9072
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
9285
9073
|
const { email, setEmail, setEmailCodeSentError, setEmailCodeExpiresIn, setEmailStep } = useManageWalletStore();
|
|
9286
|
-
const { mutate: onSendVerificationCode } =
|
|
9074
|
+
const { mutate: onSendVerificationCode } = useMutation8({
|
|
9287
9075
|
mutationFn: async () => {
|
|
9288
9076
|
if (!email) return;
|
|
9289
9077
|
setIsLoading(true);
|
|
@@ -9376,10 +9164,10 @@ function useProvidersList() {
|
|
|
9376
9164
|
|
|
9377
9165
|
// src/internal/components/ManageWalletMenu/hooks/useSendVerificationCode.ts
|
|
9378
9166
|
init_email();
|
|
9379
|
-
import { useMutation as
|
|
9167
|
+
import { useMutation as useMutation9 } from "@tanstack/react-query";
|
|
9380
9168
|
function useSendVerificationCode() {
|
|
9381
9169
|
const { setVerificationError, setLinkIsLoading, setEmailCodeSentError, setEmailCodeExpiresIn } = useManageWalletStore();
|
|
9382
|
-
return
|
|
9170
|
+
return useMutation9({
|
|
9383
9171
|
mutationFn: async (email) => {
|
|
9384
9172
|
if (!email) {
|
|
9385
9173
|
throw new Error("Email is required");
|
|
@@ -9402,7 +9190,7 @@ function useSendVerificationCode() {
|
|
|
9402
9190
|
}
|
|
9403
9191
|
|
|
9404
9192
|
// src/internal/components/ManageWalletMenu/hooks/useVerifyCode.ts
|
|
9405
|
-
import { useMutation as
|
|
9193
|
+
import { useMutation as useMutation10, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
9406
9194
|
init_email();
|
|
9407
9195
|
function useVerifyCode() {
|
|
9408
9196
|
const { callbacks } = useLumiaPassportConfig();
|
|
@@ -9420,7 +9208,7 @@ function useVerifyCode() {
|
|
|
9420
9208
|
setVerificationError,
|
|
9421
9209
|
setEmailCodeSentError
|
|
9422
9210
|
} = useManageWalletStore();
|
|
9423
|
-
return
|
|
9211
|
+
return useMutation10({
|
|
9424
9212
|
mutationFn: async (codeToVerify) => {
|
|
9425
9213
|
const code = codeToVerify ?? emailCode;
|
|
9426
9214
|
if (!code) {
|
|
@@ -9631,7 +9419,7 @@ function EmailNotConnectedWarning() {
|
|
|
9631
9419
|
|
|
9632
9420
|
// src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts
|
|
9633
9421
|
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
9634
|
-
import React9, { useEffect as
|
|
9422
|
+
import React9, { useEffect as useEffect18 } from "react";
|
|
9635
9423
|
init_auth();
|
|
9636
9424
|
function useLinkSocial() {
|
|
9637
9425
|
const qc = useQueryClient6();
|
|
@@ -9695,7 +9483,7 @@ function useLinkSocial() {
|
|
|
9695
9483
|
[config.social?.providers, callbacks]
|
|
9696
9484
|
);
|
|
9697
9485
|
const [socialLinkStarted, setSocialLinkStarted] = React9.useState(false);
|
|
9698
|
-
|
|
9486
|
+
useEffect18(() => {
|
|
9699
9487
|
const key = providerType?.toLowerCase();
|
|
9700
9488
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
|
|
9701
9489
|
if (isWalletLinking) {
|
|
@@ -9716,7 +9504,7 @@ function useLinkSocial() {
|
|
|
9716
9504
|
|
|
9717
9505
|
// src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts
|
|
9718
9506
|
import { useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
9719
|
-
import { useCallback as useCallback11, useEffect as
|
|
9507
|
+
import { useCallback as useCallback11, useEffect as useEffect19, useState as useState9 } from "react";
|
|
9720
9508
|
init_telegram2();
|
|
9721
9509
|
function useLinkTelegram() {
|
|
9722
9510
|
const {
|
|
@@ -9770,7 +9558,7 @@ function useLinkTelegram() {
|
|
|
9770
9558
|
}
|
|
9771
9559
|
}, [config.social?.providers, callbacks]);
|
|
9772
9560
|
const [telegramLinkStarted, setTelegramLinkStarted] = useState9(false);
|
|
9773
|
-
|
|
9561
|
+
useEffect19(() => {
|
|
9774
9562
|
console.log("[useLinkTelegram] Effect triggered:", { providerType, linkIsLoading, telegramLinkStarted, isWalletLinking });
|
|
9775
9563
|
if (isWalletLinking) {
|
|
9776
9564
|
console.log("[useLinkTelegram] Skipping - wallet linking in progress");
|
|
@@ -9782,7 +9570,7 @@ function useLinkTelegram() {
|
|
|
9782
9570
|
handleLinkTelegram();
|
|
9783
9571
|
}
|
|
9784
9572
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
|
|
9785
|
-
|
|
9573
|
+
useEffect19(() => {
|
|
9786
9574
|
if (providerType !== "telegram") {
|
|
9787
9575
|
setTelegramLinkStarted(false);
|
|
9788
9576
|
}
|
|
@@ -9992,7 +9780,7 @@ function ManageWalletMenu() {
|
|
|
9992
9780
|
}
|
|
9993
9781
|
|
|
9994
9782
|
// src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx
|
|
9995
|
-
import { useMutation as
|
|
9783
|
+
import { useMutation as useMutation11, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
9996
9784
|
import { Key as Key7, Loader as Loader12 } from "lucide-react";
|
|
9997
9785
|
import { useState as useState10 } from "react";
|
|
9998
9786
|
init_auth();
|
|
@@ -10004,7 +9792,7 @@ function UnlinkProviderMenu() {
|
|
|
10004
9792
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
10005
9793
|
const { confirmUnlink, setConfirmUnlink, setLinkError } = useManageWalletStore();
|
|
10006
9794
|
const [confirmInput, setConfirmInput] = useState10("");
|
|
10007
|
-
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } =
|
|
9795
|
+
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = useMutation11({
|
|
10008
9796
|
mutationFn: async () => {
|
|
10009
9797
|
if (!confirmUnlink) {
|
|
10010
9798
|
throw new Error("No provider to unlink");
|
|
@@ -10079,7 +9867,7 @@ function UnlinkProviderMenu() {
|
|
|
10079
9867
|
// src/internal/components/PortfolioMenu/PortfolioMenu.tsx
|
|
10080
9868
|
import { useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
10081
9869
|
import { ArrowLeft as ArrowLeft8, Gem, Loader as Loader14, RefreshCw } from "lucide-react";
|
|
10082
|
-
import { useCallback as useCallback12, useEffect as
|
|
9870
|
+
import { useCallback as useCallback12, useEffect as useEffect20, useRef as useRef9 } from "react";
|
|
10083
9871
|
|
|
10084
9872
|
// src/modules/assets.ts
|
|
10085
9873
|
init_base();
|
|
@@ -10265,7 +10053,7 @@ function formatValue(price) {
|
|
|
10265
10053
|
function openInExplorer(address) {
|
|
10266
10054
|
window.open(`${LUMIA_EXPLORER_URL}/address/${address}`, "_blank");
|
|
10267
10055
|
}
|
|
10268
|
-
async function
|
|
10056
|
+
async function getAssetRate2(symbol) {
|
|
10269
10057
|
const assetURL = `https://api.binance.com/api/v3/ticker/price?symbol=${symbol.toUpperCase()}USDT`;
|
|
10270
10058
|
const response = await fetch(assetURL);
|
|
10271
10059
|
return await response.json();
|
|
@@ -10282,7 +10070,7 @@ function PortfolioItem(props) {
|
|
|
10282
10070
|
staleTime: 4 * 60 * 1e3,
|
|
10283
10071
|
enabled: !!address && !!asset.symbol && !isProjectAsset,
|
|
10284
10072
|
queryKey: [ASSETS_RATES_QUERY_KEY, address, asset.symbol],
|
|
10285
|
-
queryFn: async () => await
|
|
10073
|
+
queryFn: async () => await getAssetRate2(asset.symbol)
|
|
10286
10074
|
});
|
|
10287
10075
|
const renderBalance = isProjectAsset && projectAssetBalance?.fiatFormatted ? projectAssetBalance.fiatFormatted : asset.formattedBalance;
|
|
10288
10076
|
return /* @__PURE__ */ jsxs40(
|
|
@@ -10347,7 +10135,7 @@ function PortfolioMenu() {
|
|
|
10347
10135
|
Promise.all(projectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
10348
10136
|
refreshBalances();
|
|
10349
10137
|
}, [qc, projectAssets, refreshBalances]);
|
|
10350
|
-
|
|
10138
|
+
useEffect20(() => {
|
|
10351
10139
|
if (!assetsContainerListRef.current || !assetsListRef.current) return;
|
|
10352
10140
|
const listTargetHeight = maxScrollHeight - 128;
|
|
10353
10141
|
assetsContainerListRef.current.style.setProperty("--l-pass-scrollbar-mah", `${listTargetHeight}px`);
|
|
@@ -10434,7 +10222,7 @@ import {
|
|
|
10434
10222
|
Shield,
|
|
10435
10223
|
Trash2 as Trash22
|
|
10436
10224
|
} from "lucide-react";
|
|
10437
|
-
import { useCallback as useCallback13, useEffect as
|
|
10225
|
+
import { useCallback as useCallback13, useEffect as useEffect21, useState as useState11 } from "react";
|
|
10438
10226
|
init_vaultClient();
|
|
10439
10227
|
import { jsx as jsx51, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
10440
10228
|
function SecurityMenu() {
|
|
@@ -10488,7 +10276,7 @@ function SecurityMenu() {
|
|
|
10488
10276
|
setIsRefreshing(false);
|
|
10489
10277
|
}
|
|
10490
10278
|
}, [userId]);
|
|
10491
|
-
|
|
10279
|
+
useEffect21(() => {
|
|
10492
10280
|
if (open) fetchRecovery();
|
|
10493
10281
|
}, [open, fetchRecovery]);
|
|
10494
10282
|
const parseOS = (ua) => {
|
|
@@ -10680,7 +10468,7 @@ function SecurityMenu() {
|
|
|
10680
10468
|
|
|
10681
10469
|
// src/internal/components/SendRecieveMenu/SendLumiaMenu.tsx
|
|
10682
10470
|
import { AlertCircle as AlertCircle5, ArrowLeft as ArrowLeft10, CheckCircle2 as CheckCircle24, Loader as Loader16, Wallet } from "lucide-react";
|
|
10683
|
-
import { useEffect as
|
|
10471
|
+
import { useEffect as useEffect22, useState as useState13 } from "react";
|
|
10684
10472
|
import { isAddress as isAddress2 } from "viem";
|
|
10685
10473
|
import { useBalance as useBalance3 } from "wagmi";
|
|
10686
10474
|
|
|
@@ -10768,7 +10556,7 @@ function SendLumiaMenu() {
|
|
|
10768
10556
|
const [validationError, setValidationError] = useState13(null);
|
|
10769
10557
|
const nativeAsset = assets.find((a) => a.type === "native");
|
|
10770
10558
|
const balance = nativeAsset ? parseFloat(nativeAsset.formattedBalance) : 0;
|
|
10771
|
-
|
|
10559
|
+
useEffect22(() => {
|
|
10772
10560
|
if (open) {
|
|
10773
10561
|
setTxStep("input");
|
|
10774
10562
|
setValidationError(null);
|
|
@@ -10933,7 +10721,7 @@ function SendLumiaMenu() {
|
|
|
10933
10721
|
init_clients();
|
|
10934
10722
|
import { ArrowLeft as ArrowLeft11, CheckCircle2 as CheckCircle25, Copy as Copy2, Loader as Loader17 } from "lucide-react";
|
|
10935
10723
|
import QRCode from "qrcode";
|
|
10936
|
-
import { useCallback as useCallback15, useEffect as
|
|
10724
|
+
import { useCallback as useCallback15, useEffect as useEffect23, useState as useState14 } from "react";
|
|
10937
10725
|
import { Fragment as Fragment13, jsx as jsx53, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10938
10726
|
function ReceiveLumiaMenu() {
|
|
10939
10727
|
const address = useLumiaPassportSession((st) => st.address);
|
|
@@ -10943,7 +10731,7 @@ function ReceiveLumiaMenu() {
|
|
|
10943
10731
|
const open = page === "receive";
|
|
10944
10732
|
const [qrCodeUrl, setQrCodeUrl] = useState14("");
|
|
10945
10733
|
const [copied, setCopied] = useState14(false);
|
|
10946
|
-
|
|
10734
|
+
useEffect23(() => {
|
|
10947
10735
|
if (open && address) {
|
|
10948
10736
|
QRCode.toDataURL(address, {
|
|
10949
10737
|
width: 200,
|
|
@@ -11002,7 +10790,7 @@ function ReceiveLumiaMenu() {
|
|
|
11002
10790
|
|
|
11003
10791
|
// src/internal/components/SettingsMenu/SettingsMenu.tsx
|
|
11004
10792
|
import { ArrowLeft as ArrowLeft12 } from "lucide-react";
|
|
11005
|
-
import { useEffect as
|
|
10793
|
+
import { useEffect as useEffect24 } from "react";
|
|
11006
10794
|
|
|
11007
10795
|
// src/internal/components/SettingsMenu/constants.ts
|
|
11008
10796
|
import { ArrowLeftRight, DatabaseBackup as DatabaseBackup2, LockKeyhole, UsersRound } from "lucide-react";
|
|
@@ -11036,7 +10824,7 @@ function SettingsMenu() {
|
|
|
11036
10824
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11037
10825
|
const settingsNotifications = useLayoutDataStore((st) => st.settingsNotifications);
|
|
11038
10826
|
const setMainPageHeight = useLayoutDataStore((st) => st.setMainPageHeight);
|
|
11039
|
-
|
|
10827
|
+
useEffect24(() => setMainPageHeight(DEFAULT_SETTINGS_MENU_HEIGHT), [setMainPageHeight]);
|
|
11040
10828
|
const navItems = NAV_BUTTONS.map((el) => ({ ...el, onClick: () => setPage(el.id) }));
|
|
11041
10829
|
const highlightedKeys = settingsNotifications.map((n) => n.target);
|
|
11042
10830
|
return /* @__PURE__ */ jsxs45("div", { className: "w-full p-[var(--l-pass-pd)] flex flex-col gap-[var(--l-pass-gap)]", children: [
|
|
@@ -11096,7 +10884,7 @@ function TermsOfService() {
|
|
|
11096
10884
|
// src/internal/components/TransactionsMenu/TransactionsMenu.tsx
|
|
11097
10885
|
import { useQuery as useQuery8, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
11098
10886
|
import { ArrowLeft as ArrowLeft14, Loader as Loader18, RefreshCw as RefreshCw3, XCircle as XCircle2 } from "lucide-react";
|
|
11099
|
-
import { useCallback as useCallback16, useEffect as
|
|
10887
|
+
import { useCallback as useCallback16, useEffect as useEffect25, useRef as useRef10, useState as useState15 } from "react";
|
|
11100
10888
|
|
|
11101
10889
|
// src/internal/components/TransactionsMenu/api.ts
|
|
11102
10890
|
init_base();
|
|
@@ -11596,7 +11384,7 @@ function TransactionsMenu() {
|
|
|
11596
11384
|
[qc, address]
|
|
11597
11385
|
);
|
|
11598
11386
|
const txHistoryResolvedError = txHistoryError ? txHistoryError instanceof Error ? txHistoryError.message : "Failed to load transactions" : null;
|
|
11599
|
-
|
|
11387
|
+
useEffect25(() => {
|
|
11600
11388
|
if (!txContainerListRef.current || !txListRef.current) return;
|
|
11601
11389
|
const listTargetHeight = maxScrollHeight - 128;
|
|
11602
11390
|
txContainerListRef.current.style.setProperty("--l-pass-scrollbar-mah", `${listTargetHeight}px`);
|
|
@@ -11788,7 +11576,7 @@ function usePageMapper() {
|
|
|
11788
11576
|
},
|
|
11789
11577
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
11790
11578
|
);
|
|
11791
|
-
|
|
11579
|
+
useEffect26(() => {
|
|
11792
11580
|
if (page === null) return closeDialog();
|
|
11793
11581
|
const pageItem = protectedRoutes[page];
|
|
11794
11582
|
if (!pageItem) {
|
|
@@ -11802,7 +11590,7 @@ function usePageMapper() {
|
|
|
11802
11590
|
|
|
11803
11591
|
// src/internal/hooks/useSettingsNotifications.ts
|
|
11804
11592
|
init_auth();
|
|
11805
|
-
import { useEffect as
|
|
11593
|
+
import { useEffect as useEffect27 } from "react";
|
|
11806
11594
|
var EMAIL_NOT_CONNECTED_NOTIFICATION = {
|
|
11807
11595
|
id: "email-not-connected",
|
|
11808
11596
|
target: "manage-wallet" /* MANAGE_WALLET */,
|
|
@@ -11818,13 +11606,13 @@ function useSettingsNotifications() {
|
|
|
11818
11606
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
11819
11607
|
const providers = jwtTokenManager2.getProviders();
|
|
11820
11608
|
const hasEmail = providers.includes("email");
|
|
11821
|
-
|
|
11609
|
+
useEffect27(() => {
|
|
11822
11610
|
setSettingsNotifications({
|
|
11823
11611
|
...BACKUP_IS_NOT_CREATED_NOTIFICATION,
|
|
11824
11612
|
status: hasServerVault ? "resolved" : "active"
|
|
11825
11613
|
});
|
|
11826
11614
|
}, [hasServerVault, setSettingsNotifications]);
|
|
11827
|
-
|
|
11615
|
+
useEffect27(() => {
|
|
11828
11616
|
setSettingsNotifications({
|
|
11829
11617
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
11830
11618
|
status: hasEmail ? "resolved" : "active"
|
|
@@ -11833,7 +11621,7 @@ function useSettingsNotifications() {
|
|
|
11833
11621
|
}
|
|
11834
11622
|
|
|
11835
11623
|
// src/internal/hooks/useWalletStatus.ts
|
|
11836
|
-
import { useEffect as
|
|
11624
|
+
import { useEffect as useEffect28 } from "react";
|
|
11837
11625
|
init_auth();
|
|
11838
11626
|
function useWalletStatus() {
|
|
11839
11627
|
const isIframeReady = useLumiaPassportSession((st) => st.isIframeReady);
|
|
@@ -11843,7 +11631,7 @@ function useWalletStatus() {
|
|
|
11843
11631
|
config: { current: config },
|
|
11844
11632
|
callbacks
|
|
11845
11633
|
} = useLumiaPassportConfig();
|
|
11846
|
-
|
|
11634
|
+
useEffect28(() => {
|
|
11847
11635
|
if (!isIframeReady || !config.projectId || !callbacks?.onWalletReady) return;
|
|
11848
11636
|
const userId = jwtTokenManager2.getUserId();
|
|
11849
11637
|
const hasKeyshare = jwtTokenManager2.getHasKeyshare();
|
|
@@ -11872,7 +11660,7 @@ function LumiaPassportDialog() {
|
|
|
11872
11660
|
const mainPageHeight = useLayoutDataStore((st) => st.mainPageHeight);
|
|
11873
11661
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11874
11662
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
11875
|
-
|
|
11663
|
+
useEffect29(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
11876
11664
|
usePageMapper();
|
|
11877
11665
|
useAutoConnect();
|
|
11878
11666
|
useCheckVaultStatus();
|
|
@@ -11956,7 +11744,7 @@ var TssManagerWithRef = React12.forwardRef((props, ref) => {
|
|
|
11956
11744
|
init_wallet();
|
|
11957
11745
|
import { useConnectModal } from "@rainbow-me/rainbowkit";
|
|
11958
11746
|
import { useQueryClient as useQueryClient12 } from "@tanstack/react-query";
|
|
11959
|
-
import React13, { useCallback as useCallback19, useEffect as
|
|
11747
|
+
import React13, { useCallback as useCallback19, useEffect as useEffect30 } from "react";
|
|
11960
11748
|
import { useAccount, useDisconnect, useSignMessage } from "wagmi";
|
|
11961
11749
|
function WalletConnectHandler() {
|
|
11962
11750
|
const qc = useQueryClient12();
|
|
@@ -11997,7 +11785,7 @@ function WalletConnectHandler() {
|
|
|
11997
11785
|
const { openConnectModal, connectModalOpen } = useConnectModal();
|
|
11998
11786
|
const [hasStartedLinking, setHasStartedLinking] = React13.useState(false);
|
|
11999
11787
|
const timeoutRef = React13.useRef();
|
|
12000
|
-
|
|
11788
|
+
useEffect30(() => {
|
|
12001
11789
|
if (isWalletLinking && !hasStartedLinking) {
|
|
12002
11790
|
setHasStartedLinking(true);
|
|
12003
11791
|
setProviderType(null);
|
|
@@ -12022,7 +11810,7 @@ function WalletConnectHandler() {
|
|
|
12022
11810
|
if (isConnected) disconnect();
|
|
12023
11811
|
}
|
|
12024
11812
|
}, [isWalletLinking, hasStartedLinking, isConnected, openConnectModal, disconnect, setPage, setProviderType]);
|
|
12025
|
-
|
|
11813
|
+
useEffect30(() => {
|
|
12026
11814
|
console.log("[WalletConnectHandler] Modal state check:", {
|
|
12027
11815
|
hasStartedLinking,
|
|
12028
11816
|
connectModalOpen,
|
|
@@ -12035,7 +11823,7 @@ function WalletConnectHandler() {
|
|
|
12035
11823
|
setHasStartedLinking(false);
|
|
12036
11824
|
}
|
|
12037
11825
|
}, [connectModalOpen, hasStartedLinking, isConnected, isWalletLinking]);
|
|
12038
|
-
|
|
11826
|
+
useEffect30(() => {
|
|
12039
11827
|
if (isConnected && walletAddress && isWalletLinking && hasStartedLinking) {
|
|
12040
11828
|
handleWalletSign();
|
|
12041
11829
|
}
|
|
@@ -12120,12 +11908,10 @@ var useLumiaPassportSession = create5((set) => ({
|
|
|
12120
11908
|
setWalletReadyStatus: (status) => set({ walletReadyStatus: status })
|
|
12121
11909
|
}));
|
|
12122
11910
|
function LumiaPassportSessionProvider({ children }) {
|
|
12123
|
-
const
|
|
12124
|
-
config: { current: config }
|
|
12125
|
-
} = useLumiaPassportConfig();
|
|
11911
|
+
const config = useLumiaPassportConfig().config;
|
|
12126
11912
|
return /* @__PURE__ */ jsxs51(Fragment15, { children: [
|
|
12127
11913
|
children,
|
|
12128
|
-
config.wallet?.enabled && /* @__PURE__ */ jsx62(WalletConnectHandler, {}),
|
|
11914
|
+
config.current?.wallet?.enabled && /* @__PURE__ */ jsx62(WalletConnectHandler, {}),
|
|
12129
11915
|
/* @__PURE__ */ jsx62(BalanceFeedProvider, {}),
|
|
12130
11916
|
/* @__PURE__ */ jsx62(
|
|
12131
11917
|
TssManagerWithRef,
|
|
@@ -12180,7 +11966,7 @@ function LumiaPassportProvider(props) {
|
|
|
12180
11966
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
12181
11967
|
const setIsIframeReady = useLumiaPassportSession((st) => st.setIsIframeReady);
|
|
12182
11968
|
const setWalletReadyStatus = useLumiaPassportSession((st) => st.setWalletReadyStatus);
|
|
12183
|
-
|
|
11969
|
+
useEffect31(() => notifyNoProjetctId(projectId), [projectId]);
|
|
12184
11970
|
const config = useRef11({ projectId, ...DEFAULT_LUMIA_PASSPORT_CONFIG });
|
|
12185
11971
|
const updateConfig = useCallback20((updates) => {
|
|
12186
11972
|
const prev = config.current;
|
|
@@ -12217,7 +12003,7 @@ function LumiaPassportProvider(props) {
|
|
|
12217
12003
|
}
|
|
12218
12004
|
config.current = next;
|
|
12219
12005
|
}, []);
|
|
12220
|
-
|
|
12006
|
+
useEffect31(() => {
|
|
12221
12007
|
if (typeof window === "undefined" || !projectId) return;
|
|
12222
12008
|
const mergedConfig = merge2(DEFAULT_LUMIA_PASSPORT_CONFIG, initialConfig);
|
|
12223
12009
|
updateConfig(mergedConfig);
|
|
@@ -12273,7 +12059,7 @@ var useLumiaPassportConfig = () => {
|
|
|
12273
12059
|
|
|
12274
12060
|
// src/components/ConnectWalletButton.tsx
|
|
12275
12061
|
import { Cloud as Cloud3, Laptop as Laptop2, Loader as Loader19, Shield as Shield2 } from "lucide-react";
|
|
12276
|
-
import { useEffect as
|
|
12062
|
+
import { useEffect as useEffect32, useMemo as useMemo4 } from "react";
|
|
12277
12063
|
init_auth();
|
|
12278
12064
|
import { Fragment as Fragment16, jsx as jsx65, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
12279
12065
|
function getFormattedStatus(label, status, showStatus) {
|
|
@@ -12293,7 +12079,7 @@ function ConnectWalletButton(props) {
|
|
|
12293
12079
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
12294
12080
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useLumiaPassportSession();
|
|
12295
12081
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
12296
|
-
|
|
12082
|
+
useEffect32(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
12297
12083
|
const avatar = jwtTokenManager2.getAvatar();
|
|
12298
12084
|
const displayName = jwtTokenManager2.getDisplayName();
|
|
12299
12085
|
const indicators = useMemo4(() => {
|
|
@@ -12430,6 +12216,9 @@ function ConnectWalletButton(props) {
|
|
|
12430
12216
|
}
|
|
12431
12217
|
|
|
12432
12218
|
// src/hooks/childAppHooks.ts
|
|
12219
|
+
var useLumiaPassportIsMobileView = () => {
|
|
12220
|
+
return useLayoutStore((st) => st.isMobileView);
|
|
12221
|
+
};
|
|
12433
12222
|
var useLumiaPassportBalance = () => {
|
|
12434
12223
|
const walletBalance = useLayoutDataStore((st) => st.balance);
|
|
12435
12224
|
const fiatBalance = useLayoutDataStore((st) => st.fiatBalance);
|
|
@@ -12471,7 +12260,7 @@ function useLumiaPassportOpen() {
|
|
|
12471
12260
|
}
|
|
12472
12261
|
|
|
12473
12262
|
// src/hooks/useLumiaPassportColorMode.ts
|
|
12474
|
-
import { useCallback as useCallback22, useEffect as
|
|
12263
|
+
import { useCallback as useCallback22, useEffect as useEffect33 } from "react";
|
|
12475
12264
|
function useLumiaPassportColorMode() {
|
|
12476
12265
|
const {
|
|
12477
12266
|
config: { current: config }
|
|
@@ -12486,7 +12275,7 @@ function useLumiaPassportColorMode() {
|
|
|
12486
12275
|
},
|
|
12487
12276
|
[handleStoreColorMode]
|
|
12488
12277
|
);
|
|
12489
|
-
|
|
12278
|
+
useEffect33(() => {
|
|
12490
12279
|
let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
|
|
12491
12280
|
if (!targetColorMode && !preferedColorMode) {
|
|
12492
12281
|
const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -13149,13 +12938,13 @@ var Hash = ({
|
|
|
13149
12938
|
|
|
13150
12939
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
13151
12940
|
init_base();
|
|
13152
|
-
import { useEffect as
|
|
12941
|
+
import { useEffect as useEffect35, useState as useState19 } from "react";
|
|
13153
12942
|
import { jsx as jsx72, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
13154
12943
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
13155
12944
|
const [transactions, setTransactions] = useState19([]);
|
|
13156
12945
|
const [loading, setLoading] = useState19(true);
|
|
13157
12946
|
const [error, setError] = useState19(null);
|
|
13158
|
-
|
|
12947
|
+
useEffect35(() => {
|
|
13159
12948
|
const fetchTransactions = async () => {
|
|
13160
12949
|
try {
|
|
13161
12950
|
setLoading(true);
|
|
@@ -13662,6 +13451,7 @@ export {
|
|
|
13662
13451
|
useLumiaPassportError,
|
|
13663
13452
|
useLumiaPassportHasServerVault,
|
|
13664
13453
|
useLumiaPassportIFrameReady,
|
|
13454
|
+
useLumiaPassportIsMobileView,
|
|
13665
13455
|
useLumiaPassportLinkedProfiles,
|
|
13666
13456
|
useLumiaPassportLoadingStatus,
|
|
13667
13457
|
useLumiaPassportOpen,
|