@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.cjs
CHANGED
|
@@ -2455,6 +2455,7 @@ var init_iframe_manager = __esm({
|
|
|
2455
2455
|
this.iframe = null;
|
|
2456
2456
|
this.sessionToken = null;
|
|
2457
2457
|
this.isReady = false;
|
|
2458
|
+
// private themeColors?: IframeManagerConfig['themeColors']
|
|
2458
2459
|
// Message handling
|
|
2459
2460
|
this.pendingRequests = /* @__PURE__ */ new Map();
|
|
2460
2461
|
this.usedNonces = /* @__PURE__ */ new Set();
|
|
@@ -2474,14 +2475,13 @@ var init_iframe_manager = __esm({
|
|
|
2474
2475
|
this.projectId = config.projectId;
|
|
2475
2476
|
this.debug = config.debug || false;
|
|
2476
2477
|
this.onWalletReadyCallback = config.onWalletReady;
|
|
2477
|
-
this.themeColors = config.themeColors;
|
|
2478
2478
|
this.readyPromise = new Promise((resolve) => {
|
|
2479
2479
|
this.readyResolve = resolve;
|
|
2480
2480
|
});
|
|
2481
2481
|
this.log("[IframeManager] Initialized with:", {
|
|
2482
2482
|
iframeUrl: this.iframeUrl,
|
|
2483
|
-
projectId: this.projectId
|
|
2484
|
-
hasThemeColors: !!this.themeColors
|
|
2483
|
+
projectId: this.projectId
|
|
2484
|
+
// hasThemeColors: !!this.themeColors
|
|
2485
2485
|
});
|
|
2486
2486
|
}
|
|
2487
2487
|
/**
|
|
@@ -2493,16 +2493,6 @@ var init_iframe_manager = __esm({
|
|
|
2493
2493
|
}
|
|
2494
2494
|
this.iframe = document.createElement("iframe");
|
|
2495
2495
|
let iframeUrl = this.iframeUrl;
|
|
2496
|
-
if (this.themeColors) {
|
|
2497
|
-
const params = new URLSearchParams();
|
|
2498
|
-
if (this.themeColors.background) params.set("bg", this.themeColors.background);
|
|
2499
|
-
if (this.themeColors.text) params.set("text", this.themeColors.text);
|
|
2500
|
-
if (this.themeColors.textSecondary) params.set("textSec", this.themeColors.textSecondary);
|
|
2501
|
-
if (this.themeColors.border) params.set("border", this.themeColors.border);
|
|
2502
|
-
if (params.toString()) {
|
|
2503
|
-
iframeUrl += (iframeUrl.includes("?") ? "&" : "?") + params.toString();
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
2496
|
this.iframe.src = iframeUrl;
|
|
2507
2497
|
this.iframe.id = "lumia-passport-iframe";
|
|
2508
2498
|
this.iframe.style.display = "none";
|
|
@@ -4281,6 +4271,7 @@ __export(index_exports, {
|
|
|
4281
4271
|
useLumiaPassportError: () => useLumiaPassportError,
|
|
4282
4272
|
useLumiaPassportHasServerVault: () => useLumiaPassportHasServerVault,
|
|
4283
4273
|
useLumiaPassportIFrameReady: () => useLumiaPassportIFrameReady,
|
|
4274
|
+
useLumiaPassportIsMobileView: () => useLumiaPassportIsMobileView,
|
|
4284
4275
|
useLumiaPassportLinkedProfiles: () => useLumiaPassportLinkedProfiles,
|
|
4285
4276
|
useLumiaPassportLoadingStatus: () => useLumiaPassportLoadingStatus,
|
|
4286
4277
|
useLumiaPassportOpen: () => useLumiaPassportOpen,
|
|
@@ -4302,17 +4293,17 @@ var built_default = '.container{width:100%}@media (min-width:640px){.container{m
|
|
|
4302
4293
|
// src/context/LumiaPassportContext.tsx
|
|
4303
4294
|
var import_error_tracking4 = require("@lumiapassport/core/internal/error-tracking");
|
|
4304
4295
|
var import_lodash_es4 = require("lodash-es");
|
|
4305
|
-
var
|
|
4296
|
+
var import_react49 = require("react");
|
|
4306
4297
|
init_lumiaPassport();
|
|
4307
4298
|
init_iframe_manager();
|
|
4308
4299
|
|
|
4309
4300
|
// src/context/LumiaPassportSessionContext.tsx
|
|
4310
|
-
var
|
|
4301
|
+
var import_react48 = require("react");
|
|
4311
4302
|
var import_zustand5 = require("zustand");
|
|
4312
4303
|
|
|
4313
4304
|
// src/internal/components/BalanceFeedProvider/BalanceFeedProvider.tsx
|
|
4314
|
-
var
|
|
4315
|
-
var
|
|
4305
|
+
var import_react_query = require("@tanstack/react-query");
|
|
4306
|
+
var import_react = require("react");
|
|
4316
4307
|
var import_wagmi = require("wagmi");
|
|
4317
4308
|
init_base();
|
|
4318
4309
|
|
|
@@ -4322,13 +4313,13 @@ var import_zustand = require("zustand");
|
|
|
4322
4313
|
// src/internal/constants.ts
|
|
4323
4314
|
var import_lucide_react2 = require("lucide-react");
|
|
4324
4315
|
init_assets();
|
|
4316
|
+
var LOCAL_COLOR_MODE_KEY = "lumia-passport-theme";
|
|
4325
4317
|
var DEFAULT_AUTH_MENU_HEIGHT = 253;
|
|
4326
4318
|
var DEFAULT_MAIN_MENU_HEIGHT = 90;
|
|
4327
4319
|
var DEFAULT_SETTINGS_MENU_HEIGHT = 346;
|
|
4328
4320
|
var MAX_CONTENT_HEIGHT = 640;
|
|
4329
4321
|
var MAIN_DIALOG_ANIMATION_SPEED = 375;
|
|
4330
4322
|
var Y_ANIMATION_SETUP = { duration: 0.15, ease: "easeInOut", height: { duration: 0.375 } };
|
|
4331
|
-
var LOCAL_COLOR_MODE_KEY = "lumia-passport-theme";
|
|
4332
4323
|
var PROVIDERS_META2 = {
|
|
4333
4324
|
passkey: { name: "Passkey", icon: import_lucide_react2.Key, description: "Biometric authentication" },
|
|
4334
4325
|
email: { name: "Email", icon: import_lucide_react2.Mail, description: "Email verification" },
|
|
@@ -4388,166 +4379,20 @@ var useLayoutDataStore = (0, import_zustand.create)((set) => ({
|
|
|
4388
4379
|
})
|
|
4389
4380
|
}));
|
|
4390
4381
|
|
|
4391
|
-
// src/internal/hooks/useLumiaPriceSSE.ts
|
|
4392
|
-
var import_react_query = require("@tanstack/react-query");
|
|
4393
|
-
var import_react = require("react");
|
|
4394
|
-
|
|
4395
|
-
// src/internal/lib/LumiaPriceSSEService.ts
|
|
4396
|
-
var FALLBACK = "https://fallback.lumia.passport.io";
|
|
4397
|
-
var API_DOMAIN = (true ? "" : FALLBACK) || FALLBACK;
|
|
4398
|
-
var LumiaPriceSSEService = class {
|
|
4399
|
-
// private readonly baseUrl: string = API_DOMAIN
|
|
4400
|
-
constructor() {
|
|
4401
|
-
this.eventSource = null;
|
|
4402
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
4403
|
-
this.currentPrice = null;
|
|
4404
|
-
this.isConnected = false;
|
|
4405
|
-
this.reconnectTimeout = null;
|
|
4406
|
-
}
|
|
4407
|
-
connect() {
|
|
4408
|
-
return new Promise((resolve, reject) => {
|
|
4409
|
-
console.log("[LumiaPriceSSEService]: Connecting to LUMIA Price SSE...");
|
|
4410
|
-
if (this.isConnected) {
|
|
4411
|
-
resolve();
|
|
4412
|
-
return;
|
|
4413
|
-
}
|
|
4414
|
-
try {
|
|
4415
|
-
this.eventSource = new EventSource(`${API_DOMAIN}/api/lumia/sse`);
|
|
4416
|
-
this.eventSource.onopen = () => {
|
|
4417
|
-
console.log("[LumiaPriceSSEService]: LUMIA Price SSE connected");
|
|
4418
|
-
this.isConnected = true;
|
|
4419
|
-
this.clearReconnectTimeout();
|
|
4420
|
-
resolve();
|
|
4421
|
-
};
|
|
4422
|
-
this.eventSource.onmessage = () => {
|
|
4423
|
-
};
|
|
4424
|
-
this.eventSource.addEventListener("rate", (event) => {
|
|
4425
|
-
try {
|
|
4426
|
-
const data = JSON.parse(event.data);
|
|
4427
|
-
if (data.price !== void 0 && data.symbol === "LUMIAUSDT") {
|
|
4428
|
-
this.currentPrice = typeof data.price === "number" ? data.price : parseFloat(data.price);
|
|
4429
|
-
if (this.currentPrice !== null) {
|
|
4430
|
-
const update = {
|
|
4431
|
-
symbol: data.symbol,
|
|
4432
|
-
price: this.currentPrice,
|
|
4433
|
-
ts: data.ts || Date.now()
|
|
4434
|
-
};
|
|
4435
|
-
this.listeners.forEach((listener) => listener(update));
|
|
4436
|
-
}
|
|
4437
|
-
}
|
|
4438
|
-
} catch (error) {
|
|
4439
|
-
console.error("Error parsing price event:", error, event.data);
|
|
4440
|
-
}
|
|
4441
|
-
});
|
|
4442
|
-
this.eventSource.addEventListener("ping", () => {
|
|
4443
|
-
});
|
|
4444
|
-
this.eventSource.onerror = (error) => {
|
|
4445
|
-
console.error("LUMIA Price SSE error:", error);
|
|
4446
|
-
this.isConnected = false;
|
|
4447
|
-
if (this.eventSource?.readyState === EventSource.CLOSED) {
|
|
4448
|
-
console.log("SSE connection closed, attempting to reconnect...");
|
|
4449
|
-
this.scheduleReconnect();
|
|
4450
|
-
reject(error);
|
|
4451
|
-
}
|
|
4452
|
-
};
|
|
4453
|
-
setTimeout(() => {
|
|
4454
|
-
if (!this.isConnected) {
|
|
4455
|
-
reject(new Error("SSE connection timeout"));
|
|
4456
|
-
}
|
|
4457
|
-
}, 1e4);
|
|
4458
|
-
} catch (error) {
|
|
4459
|
-
reject(error);
|
|
4460
|
-
}
|
|
4461
|
-
});
|
|
4462
|
-
}
|
|
4463
|
-
disconnect() {
|
|
4464
|
-
this.clearReconnectTimeout();
|
|
4465
|
-
if (this.eventSource) {
|
|
4466
|
-
this.eventSource.close();
|
|
4467
|
-
this.eventSource = null;
|
|
4468
|
-
}
|
|
4469
|
-
this.isConnected = false;
|
|
4470
|
-
this.currentPrice = null;
|
|
4471
|
-
console.log("[LumiaPriceSSEService]: LUMIA Price SSE disconnected");
|
|
4472
|
-
}
|
|
4473
|
-
addListener(listener) {
|
|
4474
|
-
this.listeners.add(listener);
|
|
4475
|
-
}
|
|
4476
|
-
removeListener(listener) {
|
|
4477
|
-
this.listeners.delete(listener);
|
|
4478
|
-
}
|
|
4479
|
-
clearListeners() {
|
|
4480
|
-
this.listeners.clear();
|
|
4481
|
-
}
|
|
4482
|
-
getCurrentPrice() {
|
|
4483
|
-
return this.currentPrice;
|
|
4484
|
-
}
|
|
4485
|
-
getConnectionStatus() {
|
|
4486
|
-
return this.isConnected;
|
|
4487
|
-
}
|
|
4488
|
-
scheduleReconnect() {
|
|
4489
|
-
this.clearReconnectTimeout();
|
|
4490
|
-
this.reconnectTimeout = window.setTimeout(() => {
|
|
4491
|
-
console.log("Attempting to reconnect to BTC Price SSE...");
|
|
4492
|
-
this.connect().catch((error) => {
|
|
4493
|
-
console.error("Reconnection failed:", error);
|
|
4494
|
-
this.scheduleReconnect();
|
|
4495
|
-
});
|
|
4496
|
-
}, 5e3);
|
|
4497
|
-
}
|
|
4498
|
-
clearReconnectTimeout() {
|
|
4499
|
-
if (this.reconnectTimeout) {
|
|
4500
|
-
clearTimeout(this.reconnectTimeout);
|
|
4501
|
-
this.reconnectTimeout = null;
|
|
4502
|
-
}
|
|
4503
|
-
}
|
|
4504
|
-
};
|
|
4505
|
-
var lumiaPriceSSE = new LumiaPriceSSEService();
|
|
4506
|
-
async function sseConnectMutation() {
|
|
4507
|
-
try {
|
|
4508
|
-
await lumiaPriceSSE.connect();
|
|
4509
|
-
console.info("[LUMIA SSE] price feed connected");
|
|
4510
|
-
return { ok: true };
|
|
4511
|
-
} catch (error) {
|
|
4512
|
-
console.error("[LUMIA SSE] Error connecting to SSE:", error);
|
|
4513
|
-
throw new Error("[LUMIA SSE] Error connecting to SSE");
|
|
4514
|
-
}
|
|
4515
|
-
}
|
|
4516
|
-
|
|
4517
|
-
// src/internal/hooks/useLumiaPriceSSE.ts
|
|
4518
|
-
function useLumiaPriceSSE(enabled, updateCurrentPrice) {
|
|
4519
|
-
const { mutate: connectSSE } = (0, import_react_query.useMutation)({
|
|
4520
|
-
mutationFn: sseConnectMutation,
|
|
4521
|
-
onSuccess: () => {
|
|
4522
|
-
lumiaPriceSSE.addListener(updateCurrentPrice);
|
|
4523
|
-
},
|
|
4524
|
-
onError: (err) => {
|
|
4525
|
-
console.error("Lumia Price SSE connection error:", err);
|
|
4526
|
-
}
|
|
4527
|
-
});
|
|
4528
|
-
(0, import_react.useEffect)(() => {
|
|
4529
|
-
const isConnected = lumiaPriceSSE.getConnectionStatus();
|
|
4530
|
-
console.log("[LUMIA PRICE SSE MANAGER] SSE status:", { enabled, isConnected });
|
|
4531
|
-
if (!enabled) {
|
|
4532
|
-
lumiaPriceSSE.clearListeners();
|
|
4533
|
-
lumiaPriceSSE.disconnect();
|
|
4534
|
-
return;
|
|
4535
|
-
}
|
|
4536
|
-
return () => {
|
|
4537
|
-
lumiaPriceSSE.clearListeners();
|
|
4538
|
-
lumiaPriceSSE.disconnect();
|
|
4539
|
-
};
|
|
4540
|
-
}, [enabled, connectSSE]);
|
|
4541
|
-
}
|
|
4542
|
-
|
|
4543
4382
|
// src/internal/components/BalanceFeedProvider/BalanceFeedProvider.tsx
|
|
4544
4383
|
var BALANCE_POLLING_INTERVAL = 3e4;
|
|
4384
|
+
async function getAssetRate(symbol = "LUMIA", fiat = "USDT") {
|
|
4385
|
+
const assetURL = `https://api.binance.com/api/v3/ticker/price?symbol=${symbol.toUpperCase()}${fiat.toUpperCase()}`;
|
|
4386
|
+
const response = await fetch(assetURL);
|
|
4387
|
+
return await response.json();
|
|
4388
|
+
}
|
|
4389
|
+
var LUMIA_RATE_QUERY_KEY = "lumia-passport-rate-query-key";
|
|
4545
4390
|
function BalanceFeedProvider() {
|
|
4546
4391
|
const config = useLumiaPassportConfig().config;
|
|
4547
4392
|
const address = useLumiaPassportSession((st) => st.address);
|
|
4548
|
-
const {
|
|
4549
|
-
const [balanceSymbol, setBalanceSymbol] = (0,
|
|
4550
|
-
(0,
|
|
4393
|
+
const { setCryptoRate, setFiatBalance, setBalance, setCryptoSymbol, setFiatSymbol } = useLayoutDataStore();
|
|
4394
|
+
const [balanceSymbol, setBalanceSymbol] = (0, import_react.useState)(null);
|
|
4395
|
+
(0, import_react.useEffect)(() => {
|
|
4551
4396
|
const { assets, showBalanceAs: customBalanceSymbol } = config.current?.projectAssets || {};
|
|
4552
4397
|
const { balanceQuery, balanceQueryKey } = assets?.find((a) => a.symbol === customBalanceSymbol) || {};
|
|
4553
4398
|
const isCustom = !!customBalanceSymbol && !!balanceQuery && !!balanceQueryKey;
|
|
@@ -4564,21 +4409,38 @@ function BalanceFeedProvider() {
|
|
|
4564
4409
|
refetchOnWindowFocus: true
|
|
4565
4410
|
}
|
|
4566
4411
|
});
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4412
|
+
const { data: cryptoRate } = (0, import_react_query.useQuery)({
|
|
4413
|
+
queryKey: [LUMIA_RATE_QUERY_KEY, address],
|
|
4414
|
+
enabled: !!address && !!isNativeBalanceFeedEnabled,
|
|
4415
|
+
refetchInterval: BALANCE_POLLING_INTERVAL,
|
|
4416
|
+
queryFn: async () => getAssetRate("LUMIA", "USDT")
|
|
4417
|
+
// TODO: get LUMIA-FIAT pair from config
|
|
4418
|
+
});
|
|
4419
|
+
(0, import_react.useEffect)(() => {
|
|
4420
|
+
const rate = cryptoRate ? Number(cryptoRate.price) : null;
|
|
4421
|
+
if (!isNativeBalanceFeedEnabled || !balance || !rate) return;
|
|
4422
|
+
setCryptoRate(rate);
|
|
4570
4423
|
setCryptoSymbol("LUMIA");
|
|
4571
4424
|
setFiatSymbol("USD");
|
|
4572
|
-
setFiatBalance(Number(balance?.formatted || 0) *
|
|
4425
|
+
setFiatBalance(Number(balance?.formatted || 0) * rate);
|
|
4573
4426
|
setBalance(balance);
|
|
4574
|
-
}, [
|
|
4427
|
+
}, [
|
|
4428
|
+
isNativeBalanceFeedEnabled,
|
|
4429
|
+
balance,
|
|
4430
|
+
cryptoRate,
|
|
4431
|
+
setFiatBalance,
|
|
4432
|
+
setCryptoRate,
|
|
4433
|
+
setBalance,
|
|
4434
|
+
setCryptoSymbol,
|
|
4435
|
+
setFiatSymbol
|
|
4436
|
+
]);
|
|
4575
4437
|
const {
|
|
4576
4438
|
balanceQuery: customBalanceQuery,
|
|
4577
4439
|
balanceQueryKey: CUSTOM_BALANCE_QUERY_KEY,
|
|
4578
4440
|
symbol: customAssetSymbol
|
|
4579
4441
|
} = config.current?.projectAssets?.assets?.find((a) => a.symbol === config.current?.projectAssets?.showBalanceAs) || {};
|
|
4580
4442
|
const isCustomBalanceEnabled = balanceSymbol === customAssetSymbol;
|
|
4581
|
-
const { data: customBalance } = (0,
|
|
4443
|
+
const { data: customBalance } = (0, import_react_query.useQuery)({
|
|
4582
4444
|
retry: false,
|
|
4583
4445
|
refetchInterval: BALANCE_POLLING_INTERVAL,
|
|
4584
4446
|
enabled: !!address && !!isCustomBalanceEnabled,
|
|
@@ -4586,7 +4448,7 @@ function BalanceFeedProvider() {
|
|
|
4586
4448
|
// should be invalidated by host app via provided queryKey
|
|
4587
4449
|
queryFn: async () => await customBalanceQuery?.()
|
|
4588
4450
|
});
|
|
4589
|
-
(0,
|
|
4451
|
+
(0, import_react.useEffect)(() => {
|
|
4590
4452
|
if (!isCustomBalanceEnabled || !customBalance) return;
|
|
4591
4453
|
const { cryptoFiatRate, fiatFormatted, cryptoFormatted, cryptoSymbol, fiatSymbol } = customBalance;
|
|
4592
4454
|
setCryptoSymbol(cryptoSymbol.toUpperCase());
|
|
@@ -4605,12 +4467,12 @@ function BalanceFeedProvider() {
|
|
|
4605
4467
|
|
|
4606
4468
|
// src/internal/components/Dialog/LumiaPassportDialog.tsx
|
|
4607
4469
|
var import_framer_motion4 = require("framer-motion");
|
|
4608
|
-
var
|
|
4470
|
+
var import_react45 = require("react");
|
|
4609
4471
|
|
|
4610
4472
|
// package.json
|
|
4611
4473
|
var package_default = {
|
|
4612
4474
|
name: "@lumiapassport/ui-kit",
|
|
4613
|
-
version: "1.13.
|
|
4475
|
+
version: "1.13.11",
|
|
4614
4476
|
description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
|
|
4615
4477
|
type: "module",
|
|
4616
4478
|
main: "./dist/index.cjs",
|
|
@@ -4698,13 +4560,13 @@ var package_default = {
|
|
|
4698
4560
|
};
|
|
4699
4561
|
|
|
4700
4562
|
// src/internal/components/Footer/Footer.tsx
|
|
4701
|
-
var
|
|
4563
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
4702
4564
|
var import_lucide_react3 = require("lucide-react");
|
|
4703
4565
|
|
|
4704
4566
|
// src/internal/assets/LumiaLogo.tsx
|
|
4705
|
-
var
|
|
4567
|
+
var import_react2 = require("react");
|
|
4706
4568
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
4707
|
-
var LumiaLogo = (0,
|
|
4569
|
+
var LumiaLogo = (0, import_react2.forwardRef)(({ size = 24, className = "" }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4708
4570
|
"svg",
|
|
4709
4571
|
{
|
|
4710
4572
|
ref,
|
|
@@ -4759,21 +4621,6 @@ init_base();
|
|
|
4759
4621
|
// src/internal/lib/utils.ts
|
|
4760
4622
|
var import_clsx = require("clsx");
|
|
4761
4623
|
var import_tailwind_merge = require("tailwind-merge");
|
|
4762
|
-
var LP_JWT_TOKENS_LS_KEY = "lumia-passport-jwt-tokens";
|
|
4763
|
-
function getBearer() {
|
|
4764
|
-
try {
|
|
4765
|
-
const sessionString = localStorage.getItem(LP_JWT_TOKENS_LS_KEY);
|
|
4766
|
-
if (!sessionString) return null;
|
|
4767
|
-
const session = JSON.parse(sessionString);
|
|
4768
|
-
if (session && typeof session.accessToken === "string" && typeof session.userId === "string") {
|
|
4769
|
-
return `Bearer ${session.accessToken}`;
|
|
4770
|
-
}
|
|
4771
|
-
return null;
|
|
4772
|
-
} catch (error) {
|
|
4773
|
-
console.error("Failed to parse Lumia Passport session:", error);
|
|
4774
|
-
return null;
|
|
4775
|
-
}
|
|
4776
|
-
}
|
|
4777
4624
|
function cn(...inputs) {
|
|
4778
4625
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
4779
4626
|
}
|
|
@@ -4843,7 +4690,7 @@ function Footer() {
|
|
|
4843
4690
|
const { callbacks } = useLumiaPassportConfig();
|
|
4844
4691
|
const { address, setSession, setAddress, setStatus, setError, setIsLoading } = useLumiaPassportSession();
|
|
4845
4692
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
4846
|
-
const { mutate: disconnect, isPending: isDisconnecting } = (0,
|
|
4693
|
+
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query2.useMutation)({
|
|
4847
4694
|
mutationFn: async (disconnectAddress) => {
|
|
4848
4695
|
if (!disconnectAddress) throw new Error("No address to disconnect");
|
|
4849
4696
|
setError(null);
|
|
@@ -4975,9 +4822,9 @@ function LumiaIcon(props) {
|
|
|
4975
4822
|
}
|
|
4976
4823
|
|
|
4977
4824
|
// src/internal/components/Header/Header.tsx
|
|
4978
|
-
var
|
|
4825
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
4979
4826
|
var import_lucide_react4 = require("lucide-react");
|
|
4980
|
-
var
|
|
4827
|
+
var import_react3 = require("react");
|
|
4981
4828
|
|
|
4982
4829
|
// src/internal/assets/PositiveIcon.tsx
|
|
4983
4830
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -5033,10 +4880,10 @@ function Header() {
|
|
|
5033
4880
|
config: { current: config }
|
|
5034
4881
|
} = useLumiaPassportConfig();
|
|
5035
4882
|
const address = useLumiaPassportSession((st) => st.address);
|
|
5036
|
-
const [copied, setCopied] = (0,
|
|
4883
|
+
const [copied, setCopied] = (0, import_react3.useState)(false);
|
|
5037
4884
|
const avatar = import_auth3.jwtTokenManager.getAvatar();
|
|
5038
4885
|
const displayName = import_auth3.jwtTokenManager.getDisplayName();
|
|
5039
|
-
const { data: userProfile = null, isLoading: isUserProfileLoading } = (0,
|
|
4886
|
+
const { data: userProfile = null, isLoading: isUserProfileLoading } = (0, import_react_query3.useQuery)({
|
|
5040
4887
|
retry: false,
|
|
5041
4888
|
enabled: !!address,
|
|
5042
4889
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
@@ -5154,7 +5001,7 @@ function Header() {
|
|
|
5154
5001
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
5155
5002
|
var import_lodash_es = require("lodash-es");
|
|
5156
5003
|
var import_lucide_react5 = require("lucide-react");
|
|
5157
|
-
var
|
|
5004
|
+
var import_react4 = require("react");
|
|
5158
5005
|
|
|
5159
5006
|
// src/internal/hooks/useLayoutStore.ts
|
|
5160
5007
|
var import_zustand2 = require("zustand");
|
|
@@ -5189,7 +5036,7 @@ var useLayoutStore = (0, import_zustand2.create)((set) => ({
|
|
|
5189
5036
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5190
5037
|
var Dialog = DialogPrimitive.Root;
|
|
5191
5038
|
var DialogPortal = DialogPrimitive.Portal;
|
|
5192
|
-
var DialogOverlay = (0,
|
|
5039
|
+
var DialogOverlay = (0, import_react4.forwardRef)(
|
|
5193
5040
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5194
5041
|
DialogPrimitive.Overlay,
|
|
5195
5042
|
{
|
|
@@ -5207,10 +5054,7 @@ var DialogOverlay = (0, import_react5.forwardRef)(
|
|
|
5207
5054
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
5208
5055
|
function useDecideContentStyles() {
|
|
5209
5056
|
const isMobileView = useLayoutStore((st) => st.isMobileView);
|
|
5210
|
-
const
|
|
5211
|
-
const isDialogClosing = useLayoutStore((st) => st.isDialogClosing);
|
|
5212
|
-
const isClosing = isDialogOpen && isDialogClosing;
|
|
5213
|
-
console.log("[IS_MOBILE_VIEW]", isMobileView);
|
|
5057
|
+
const isClosing = useLayoutStore((st) => !!st.isDialogOpen && !!st.isDialogClosing);
|
|
5214
5058
|
const mobileStyles = isMobileView ? { "--l-pass-maw": "100%", "--l-pass-bdrs": "20px 20px 0px 0px" } : {};
|
|
5215
5059
|
return {
|
|
5216
5060
|
isClosing,
|
|
@@ -5223,7 +5067,7 @@ var CONTENT_BG_SETUP = {
|
|
|
5223
5067
|
border: "1px solid var(--l-pass-bd)",
|
|
5224
5068
|
boxShadow: "0px 4px 10px var(--l-pass-shadow-c)"
|
|
5225
5069
|
};
|
|
5226
|
-
var DialogContent = (0,
|
|
5070
|
+
var DialogContent = (0, import_react4.forwardRef)(
|
|
5227
5071
|
({ className, children, hideClose, colorMode, ...props }, ref) => {
|
|
5228
5072
|
const isSettings = useLayoutStore((st) => st.isSettings);
|
|
5229
5073
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
@@ -5245,7 +5089,6 @@ var DialogContent = (0, import_react5.forwardRef)(
|
|
|
5245
5089
|
ref,
|
|
5246
5090
|
style: !!className ? void 0 : CONTENT_BG_SETUP,
|
|
5247
5091
|
className: cn(
|
|
5248
|
-
// isWalletLinking ? 'pointer-events-none' : 'pointer-events-auto',
|
|
5249
5092
|
"relative pointer-events-auto w-full",
|
|
5250
5093
|
"max-w-[var(--l-pass-maw)] max-h-[95dvh] p-0 gap-0",
|
|
5251
5094
|
"text-[var(--l-pass-fg)]",
|
|
@@ -5307,7 +5150,7 @@ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
5307
5150
|
DialogHeader.displayName = "DialogHeader";
|
|
5308
5151
|
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
|
|
5309
5152
|
DialogFooter.displayName = "DialogFooter";
|
|
5310
|
-
var DialogTitle = (0,
|
|
5153
|
+
var DialogTitle = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5311
5154
|
DialogPrimitive.Title,
|
|
5312
5155
|
{
|
|
5313
5156
|
ref,
|
|
@@ -5316,7 +5159,7 @@ var DialogTitle = (0, import_react5.forwardRef)(({ className, ...props }, ref) =
|
|
|
5316
5159
|
}
|
|
5317
5160
|
));
|
|
5318
5161
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
5319
|
-
var DialogDescription = (0,
|
|
5162
|
+
var DialogDescription = (0, import_react4.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
5320
5163
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
5321
5164
|
|
|
5322
5165
|
// src/internal/components/ui/visually-hidden.tsx
|
|
@@ -5324,7 +5167,7 @@ var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
|
5324
5167
|
var VisuallyHidden = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0", children });
|
|
5325
5168
|
|
|
5326
5169
|
// src/internal/hooks/useAutoConnect.ts
|
|
5327
|
-
var
|
|
5170
|
+
var import_react5 = require("react");
|
|
5328
5171
|
function useAutoConnect() {
|
|
5329
5172
|
const {
|
|
5330
5173
|
config: { current: config },
|
|
@@ -5344,7 +5187,7 @@ function useAutoConnect() {
|
|
|
5344
5187
|
setIsIframeReady,
|
|
5345
5188
|
setIsLoading
|
|
5346
5189
|
} = useLumiaPassportSession();
|
|
5347
|
-
const createSessionWithKeyshare = (0,
|
|
5190
|
+
const createSessionWithKeyshare = (0, import_react5.useCallback)(
|
|
5348
5191
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
5349
5192
|
try {
|
|
5350
5193
|
try {
|
|
@@ -5378,8 +5221,8 @@ function useAutoConnect() {
|
|
|
5378
5221
|
},
|
|
5379
5222
|
[usePaymaster, setStatus, callbacks]
|
|
5380
5223
|
);
|
|
5381
|
-
const autoConnectAttemptedRef = (0,
|
|
5382
|
-
(0,
|
|
5224
|
+
const autoConnectAttemptedRef = (0, import_react5.useRef)(false);
|
|
5225
|
+
(0, import_react5.useEffect)(() => {
|
|
5383
5226
|
if (autoConnectAttemptedRef.current) return;
|
|
5384
5227
|
setIsLoading(true);
|
|
5385
5228
|
const tryAutoConnect = async (attempt) => {
|
|
@@ -5498,11 +5341,11 @@ function useAutoConnect() {
|
|
|
5498
5341
|
}
|
|
5499
5342
|
|
|
5500
5343
|
// src/internal/hooks/useBackupStatusChanges.ts
|
|
5501
|
-
var
|
|
5344
|
+
var import_react6 = require("react");
|
|
5502
5345
|
init_vaultClient();
|
|
5503
5346
|
function useBackupStatusChanges() {
|
|
5504
5347
|
const setHasServerVault = useLumiaPassportSession((st) => st.setHasServerVault);
|
|
5505
|
-
(0,
|
|
5348
|
+
(0, import_react6.useEffect)(() => {
|
|
5506
5349
|
const handleBackupStatusChanged = async (event) => {
|
|
5507
5350
|
const customEvent = event;
|
|
5508
5351
|
const { method, success } = customEvent.detail || {};
|
|
@@ -5528,13 +5371,13 @@ function useBackupStatusChanges() {
|
|
|
5528
5371
|
}
|
|
5529
5372
|
|
|
5530
5373
|
// src/internal/hooks/useCheckVaultStatus.ts
|
|
5531
|
-
var
|
|
5532
|
-
var
|
|
5374
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
5375
|
+
var import_react7 = require("react");
|
|
5533
5376
|
init_vaultClient();
|
|
5534
5377
|
function useCheckVaultStatus() {
|
|
5535
5378
|
const address = useLumiaPassportSession((st) => st.address);
|
|
5536
5379
|
const setHasServerVault = useLumiaPassportSession((st) => st.setHasServerVault);
|
|
5537
|
-
const { mutate: checkVaultStatus } = (0,
|
|
5380
|
+
const { mutate: checkVaultStatus } = (0, import_react_query4.useMutation)({
|
|
5538
5381
|
mutationFn: async () => {
|
|
5539
5382
|
const stats = await getShareRecoveryStats();
|
|
5540
5383
|
const hasRecoveryData = stats && (stats.created || stats.devices && stats.devices.length > 0);
|
|
@@ -5548,7 +5391,7 @@ function useCheckVaultStatus() {
|
|
|
5548
5391
|
setHasServerVault(false);
|
|
5549
5392
|
}
|
|
5550
5393
|
});
|
|
5551
|
-
(0,
|
|
5394
|
+
(0, import_react7.useEffect)(() => {
|
|
5552
5395
|
if (!address) return setHasServerVault(false);
|
|
5553
5396
|
checkVaultStatus();
|
|
5554
5397
|
}, [address, checkVaultStatus]);
|
|
@@ -5556,12 +5399,12 @@ function useCheckVaultStatus() {
|
|
|
5556
5399
|
|
|
5557
5400
|
// src/internal/hooks/useDetectMaxScrollHeight.ts
|
|
5558
5401
|
var import_lodash_es2 = require("lodash-es");
|
|
5559
|
-
var
|
|
5402
|
+
var import_react8 = require("react");
|
|
5560
5403
|
var DEBOUNCE_DELAY = 50;
|
|
5561
5404
|
function useDetectMaxScrollHeight() {
|
|
5562
5405
|
const setIsMobileView = useLayoutStore((state) => state.setIsMobileView);
|
|
5563
5406
|
const setMaxScrollHeight = useLayoutStore((state) => state.setMaxScrollHeight);
|
|
5564
|
-
const onResize = (0,
|
|
5407
|
+
const onResize = (0, import_react8.useCallback)(
|
|
5565
5408
|
(0, import_lodash_es2.debounce)(({ width, height }) => {
|
|
5566
5409
|
const limContentHeight = height * 0.92 - 116 - 72;
|
|
5567
5410
|
setIsMobileView(width < height && (width < 475 || limContentHeight <= MAX_CONTENT_HEIGHT));
|
|
@@ -5569,7 +5412,7 @@ function useDetectMaxScrollHeight() {
|
|
|
5569
5412
|
}, DEBOUNCE_DELAY),
|
|
5570
5413
|
[setMaxScrollHeight, setIsMobileView]
|
|
5571
5414
|
);
|
|
5572
|
-
(0,
|
|
5415
|
+
(0, import_react8.useEffect)(() => {
|
|
5573
5416
|
const obs = new ResizeObserver(([entry]) => onResize(entry.contentRect));
|
|
5574
5417
|
const doc = window.document.getElementsByTagName("html")[0];
|
|
5575
5418
|
if (doc) obs.observe(doc);
|
|
@@ -5578,12 +5421,12 @@ function useDetectMaxScrollHeight() {
|
|
|
5578
5421
|
}
|
|
5579
5422
|
|
|
5580
5423
|
// src/internal/hooks/usePageMapper.tsx
|
|
5581
|
-
var
|
|
5424
|
+
var import_react42 = require("react");
|
|
5582
5425
|
|
|
5583
5426
|
// src/internal/components/AuthMenu/AuthMenu.tsx
|
|
5584
5427
|
var import_framer_motion = require("framer-motion");
|
|
5585
5428
|
var import_lucide_react14 = require("lucide-react");
|
|
5586
|
-
var
|
|
5429
|
+
var import_react18 = require("react");
|
|
5587
5430
|
|
|
5588
5431
|
// src/internal/components/AuthMenu/AuthFailedStep.tsx
|
|
5589
5432
|
var import_lucide_react6 = require("lucide-react");
|
|
@@ -5671,17 +5514,17 @@ function AuthFailedStep() {
|
|
|
5671
5514
|
|
|
5672
5515
|
// src/internal/components/AuthMenu/DisaplayNameStep/DisplayNameInput.tsx
|
|
5673
5516
|
var import_lucide_react7 = require("lucide-react");
|
|
5674
|
-
var
|
|
5517
|
+
var import_react10 = require("react");
|
|
5675
5518
|
init_auth();
|
|
5676
5519
|
init_profile();
|
|
5677
5520
|
|
|
5678
5521
|
// src/internal/components/ui/input.tsx
|
|
5679
|
-
var
|
|
5522
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
5680
5523
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
5681
|
-
var Input =
|
|
5524
|
+
var Input = import_react9.default.forwardRef((props, ref) => {
|
|
5682
5525
|
const { className, disabled, error, Icon, element, ...inputProps } = props;
|
|
5683
|
-
const internalRef = (0,
|
|
5684
|
-
(0,
|
|
5526
|
+
const internalRef = (0, import_react9.useRef)(null);
|
|
5527
|
+
(0, import_react9.useImperativeHandle)(ref, () => internalRef.current);
|
|
5685
5528
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("w-full flex flex-col gap-1", className), children: [
|
|
5686
5529
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
5687
5530
|
"div",
|
|
@@ -5727,9 +5570,9 @@ Input.displayName = "Input";
|
|
|
5727
5570
|
// src/internal/components/AuthMenu/DisaplayNameStep/DisplayNameInput.tsx
|
|
5728
5571
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
5729
5572
|
var DisplayNameInput = ({ onComplete, onSkip }) => {
|
|
5730
|
-
const [displayName, setDisplayName] = (0,
|
|
5731
|
-
const [isLoading, setIsLoading] = (0,
|
|
5732
|
-
const [error, setError] = (0,
|
|
5573
|
+
const [displayName, setDisplayName] = (0, import_react10.useState)("");
|
|
5574
|
+
const [isLoading, setIsLoading] = (0, import_react10.useState)(false);
|
|
5575
|
+
const [error, setError] = (0, import_react10.useState)("");
|
|
5733
5576
|
const handleSubmit = async (e) => {
|
|
5734
5577
|
e.preventDefault();
|
|
5735
5578
|
if (!displayName.trim()) {
|
|
@@ -5836,7 +5679,7 @@ function DisplayNameStep(props) {
|
|
|
5836
5679
|
|
|
5837
5680
|
// src/internal/components/AuthMenu/PassKeyStep.tsx
|
|
5838
5681
|
var import_lucide_react8 = require("lucide-react");
|
|
5839
|
-
var
|
|
5682
|
+
var import_react12 = require("react");
|
|
5840
5683
|
|
|
5841
5684
|
// src/internal/assets/PasskeyAddIcon.tsx
|
|
5842
5685
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
@@ -5869,16 +5712,16 @@ function PasskeyAddIcon(props) {
|
|
|
5869
5712
|
init_auth();
|
|
5870
5713
|
|
|
5871
5714
|
// src/internal/components/Expandable/hooks/useExpandable.ts
|
|
5872
|
-
var
|
|
5715
|
+
var import_react11 = require("react");
|
|
5873
5716
|
var useExpandable = (props) => {
|
|
5874
5717
|
const { isExpanded = false, children, initHeight = 0, minHeight = 0 } = props;
|
|
5875
|
-
const expandableRef = (0,
|
|
5876
|
-
const contentRef = (0,
|
|
5877
|
-
(0,
|
|
5718
|
+
const expandableRef = (0, import_react11.useRef)(null);
|
|
5719
|
+
const contentRef = (0, import_react11.useRef)(null);
|
|
5720
|
+
(0, import_react11.useEffect)(() => {
|
|
5878
5721
|
if (!expandableRef.current) return;
|
|
5879
5722
|
expandableRef.current.style.setProperty("--ifo-basic-expandable-h", `${initHeight}px )`);
|
|
5880
5723
|
}, []);
|
|
5881
|
-
const setExpandableHeight = (0,
|
|
5724
|
+
const setExpandableHeight = (0, import_react11.useCallback)(
|
|
5882
5725
|
(isExpnd) => {
|
|
5883
5726
|
if (!contentRef.current || !expandableRef.current) return;
|
|
5884
5727
|
expandableRef.current.style.setProperty(
|
|
@@ -5889,7 +5732,7 @@ var useExpandable = (props) => {
|
|
|
5889
5732
|
// ON_RESIZE_DELEAY),
|
|
5890
5733
|
[minHeight]
|
|
5891
5734
|
);
|
|
5892
|
-
(0,
|
|
5735
|
+
(0, import_react11.useEffect)(() => {
|
|
5893
5736
|
if (!contentRef.current || !expandableRef.current) return;
|
|
5894
5737
|
const obs = new ResizeObserver(() => setExpandableHeight(isExpanded));
|
|
5895
5738
|
obs.observe(expandableRef.current);
|
|
@@ -5953,7 +5796,7 @@ function PassKeyStep(props) {
|
|
|
5953
5796
|
setFailedMessage,
|
|
5954
5797
|
setFailedType
|
|
5955
5798
|
} = useAuthStore();
|
|
5956
|
-
const onPasskeyRegister = (0,
|
|
5799
|
+
const onPasskeyRegister = (0, import_react12.useCallback)(async () => {
|
|
5957
5800
|
setPasskeyError("");
|
|
5958
5801
|
setPasskeyStatus("registering passkey...");
|
|
5959
5802
|
setIsLoading(true);
|
|
@@ -6021,7 +5864,7 @@ function PassKeyStep(props) {
|
|
|
6021
5864
|
setIsLoading(false);
|
|
6022
5865
|
}
|
|
6023
5866
|
}, [onAuthSuccess, setPage, callbacks]);
|
|
6024
|
-
const onPasskeyAuth = (0,
|
|
5867
|
+
const onPasskeyAuth = (0, import_react12.useCallback)(async () => {
|
|
6025
5868
|
setPasskeyError("");
|
|
6026
5869
|
setPasskeyStatus("checking available passkeys...");
|
|
6027
5870
|
setIsLoading(true);
|
|
@@ -6143,11 +5986,11 @@ function PassKeyStep(props) {
|
|
|
6143
5986
|
|
|
6144
5987
|
// src/internal/components/AuthMenu/SignInStep/SignInStep.tsx
|
|
6145
5988
|
var import_lucide_react12 = require("lucide-react");
|
|
6146
|
-
var
|
|
5989
|
+
var import_react14 = require("react");
|
|
6147
5990
|
|
|
6148
5991
|
// src/internal/components/AuthMenu/SignInStep/Email.tsx
|
|
6149
5992
|
init_lumiaPassport();
|
|
6150
|
-
var
|
|
5993
|
+
var import_react_query5 = require("@tanstack/react-query");
|
|
6151
5994
|
var import_lucide_react9 = require("lucide-react");
|
|
6152
5995
|
init_projectId();
|
|
6153
5996
|
|
|
@@ -6184,7 +6027,7 @@ function Email() {
|
|
|
6184
6027
|
const isLoading = useLumiaPassportSession((st) => st.isLoading);
|
|
6185
6028
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
6186
6029
|
const { email, codeSendError, alert: alert2, setEmail, setCodeSendError, setExpiresIn, setStep, setAlert } = useAuthStore();
|
|
6187
|
-
const { mutate: onSendVerificationCode } = (0,
|
|
6030
|
+
const { mutate: onSendVerificationCode } = (0, import_react_query5.useMutation)({
|
|
6188
6031
|
mutationFn: async (mail) => {
|
|
6189
6032
|
const isEmailValid = mail.length !== 0 && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(mail);
|
|
6190
6033
|
if (!isEmailValid) {
|
|
@@ -6276,7 +6119,7 @@ function ErrorAlert(props) {
|
|
|
6276
6119
|
|
|
6277
6120
|
// src/internal/components/AuthMenu/SignInStep/Social.tsx
|
|
6278
6121
|
var import_lucide_react11 = require("lucide-react");
|
|
6279
|
-
var
|
|
6122
|
+
var import_react13 = require("react");
|
|
6280
6123
|
init_assets();
|
|
6281
6124
|
init_lumiaPassport();
|
|
6282
6125
|
init_auth();
|
|
@@ -6367,7 +6210,7 @@ function Social(props) {
|
|
|
6367
6210
|
setPasskeyError,
|
|
6368
6211
|
setPasskeyStatus
|
|
6369
6212
|
} = useAuthStore();
|
|
6370
|
-
const onSocialAuth = (0,
|
|
6213
|
+
const onSocialAuth = (0, import_react13.useCallback)(
|
|
6371
6214
|
async (providerId) => {
|
|
6372
6215
|
const normalizedProviderId = providerId.toLowerCase();
|
|
6373
6216
|
const provider = config.current?.social?.providers?.find(
|
|
@@ -6778,7 +6621,7 @@ function SignInStep(props) {
|
|
|
6778
6621
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-bold text-xl leading-6", children: "Sign In" })
|
|
6779
6622
|
] }),
|
|
6780
6623
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "w-full flex flex-col gap-[var(--l-pass-gap)]", children: [
|
|
6781
|
-
enabledWoPasskey.map((kind, idx) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
6624
|
+
enabledWoPasskey.map((kind, idx) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react14.Fragment, { children: [
|
|
6782
6625
|
idx > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center", children: [
|
|
6783
6626
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { borderTop: "1px solid var(--l-pass-bd)" }, className: "flex-1" }),
|
|
6784
6627
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-none px-2 text-xs leading-4", children: "Or sign in using" }),
|
|
@@ -6805,19 +6648,19 @@ function SignInStep(props) {
|
|
|
6805
6648
|
}
|
|
6806
6649
|
|
|
6807
6650
|
// src/internal/components/AuthMenu/useAuthMenuHanders.ts
|
|
6808
|
-
var
|
|
6651
|
+
var import_react15 = require("react");
|
|
6809
6652
|
init_auth();
|
|
6810
6653
|
function useAuthMenuHandlers() {
|
|
6811
6654
|
const {
|
|
6812
6655
|
config: { current: config },
|
|
6813
6656
|
callbacks
|
|
6814
6657
|
} = useLumiaPassportConfig();
|
|
6815
|
-
const pendingLoginResponseRef = (0,
|
|
6658
|
+
const pendingLoginResponseRef = (0, import_react15.useRef)(null);
|
|
6816
6659
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
6817
|
-
const [telegramCleanup, setTelegramCleanup] = (0,
|
|
6660
|
+
const [telegramCleanup, setTelegramCleanup] = (0, import_react15.useState)(null);
|
|
6818
6661
|
const { usePaymaster, setError, setStatus, setSession, setAddress, setRecoveryUserId, setHasServerVault } = useLumiaPassportSession();
|
|
6819
6662
|
const { setStep, setVerificationError, setCodeSendError, setFailedMessage } = useAuthStore();
|
|
6820
|
-
const createSessionWithKeyshare = (0,
|
|
6663
|
+
const createSessionWithKeyshare = (0, import_react15.useCallback)(
|
|
6821
6664
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
6822
6665
|
try {
|
|
6823
6666
|
try {
|
|
@@ -6851,7 +6694,7 @@ function useAuthMenuHandlers() {
|
|
|
6851
6694
|
},
|
|
6852
6695
|
[setStatus, callbacks, usePaymaster]
|
|
6853
6696
|
);
|
|
6854
|
-
const onAuthSuccess = (0,
|
|
6697
|
+
const onAuthSuccess = (0, import_react15.useCallback)(async () => {
|
|
6855
6698
|
console.log("[ConnectWalletButton] handleAuthModalSuccess called");
|
|
6856
6699
|
const loginResponse = pendingLoginResponseRef.current;
|
|
6857
6700
|
console.log("[ConnectWalletButton] loginResponse:", loginResponse);
|
|
@@ -6946,7 +6789,7 @@ function useAuthMenuHandlers() {
|
|
|
6946
6789
|
setHasServerVault,
|
|
6947
6790
|
createSessionWithKeyshare
|
|
6948
6791
|
]);
|
|
6949
|
-
const checkDisplayNameRequired = (0,
|
|
6792
|
+
const checkDisplayNameRequired = (0, import_react15.useCallback)(
|
|
6950
6793
|
async (loginResponse) => {
|
|
6951
6794
|
if (!config.features.displayNameNeeded) {
|
|
6952
6795
|
return false;
|
|
@@ -6973,7 +6816,7 @@ function useAuthMenuHandlers() {
|
|
|
6973
6816
|
},
|
|
6974
6817
|
[config.features.displayNameNeeded]
|
|
6975
6818
|
);
|
|
6976
|
-
const goBackToSignIn = (0,
|
|
6819
|
+
const goBackToSignIn = (0, import_react15.useCallback)(() => {
|
|
6977
6820
|
setStep("signin");
|
|
6978
6821
|
setVerificationError("");
|
|
6979
6822
|
setCodeSendError("");
|
|
@@ -6991,11 +6834,11 @@ function useAuthMenuHandlers() {
|
|
|
6991
6834
|
}
|
|
6992
6835
|
|
|
6993
6836
|
// src/internal/components/AuthMenu/useListenIframeAuthEvents.ts
|
|
6994
|
-
var
|
|
6837
|
+
var import_react16 = require("react");
|
|
6995
6838
|
function useListenIframeAuthEvents() {
|
|
6996
6839
|
const setPage = useLayoutDataStore((state) => state.setPage);
|
|
6997
6840
|
const setIsIframeReady = useLumiaPassportSession((state) => state.setIsIframeReady);
|
|
6998
|
-
const handleIframeMessage = (0,
|
|
6841
|
+
const handleIframeMessage = (0, import_react16.useCallback)(
|
|
6999
6842
|
(event) => {
|
|
7000
6843
|
console.log("[AuthMenu] Received iframe message:", event.data);
|
|
7001
6844
|
if (event.data?.type === "LUMIA_PASSPORT_IFRAME_READY") {
|
|
@@ -7013,7 +6856,7 @@ function useListenIframeAuthEvents() {
|
|
|
7013
6856
|
},
|
|
7014
6857
|
[setPage, setIsIframeReady]
|
|
7015
6858
|
);
|
|
7016
|
-
(0,
|
|
6859
|
+
(0, import_react16.useEffect)(() => {
|
|
7017
6860
|
window.addEventListener("message", handleIframeMessage);
|
|
7018
6861
|
return () => window.removeEventListener("message", handleIframeMessage);
|
|
7019
6862
|
}, [handleIframeMessage]);
|
|
@@ -7021,7 +6864,7 @@ function useListenIframeAuthEvents() {
|
|
|
7021
6864
|
|
|
7022
6865
|
// src/internal/components/AuthMenu/VerifyStep/VerifyStep.tsx
|
|
7023
6866
|
init_lumiaPassport();
|
|
7024
|
-
var
|
|
6867
|
+
var import_react_query6 = require("@tanstack/react-query");
|
|
7025
6868
|
var import_lucide_react13 = require("lucide-react");
|
|
7026
6869
|
|
|
7027
6870
|
// src/internal/assets/OtpIcon.tsx
|
|
@@ -7042,21 +6885,21 @@ init_auth();
|
|
|
7042
6885
|
init_projectId();
|
|
7043
6886
|
|
|
7044
6887
|
// src/internal/components/AuthMenu/VerifyStep/VerificationCodeInput.tsx
|
|
7045
|
-
var
|
|
6888
|
+
var import_react17 = require("react");
|
|
7046
6889
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
7047
6890
|
var VerificationCodeInput = (props) => {
|
|
7048
6891
|
const { onVerifyCode, onResendCode, isLoading, expiresIn, error } = props;
|
|
7049
6892
|
const setVerificationError = useAuthStore((st) => st.setVerificationError);
|
|
7050
|
-
const [timeLeft, setTimeLeft] = (0,
|
|
7051
|
-
(0,
|
|
7052
|
-
(0,
|
|
6893
|
+
const [timeLeft, setTimeLeft] = (0, import_react17.useState)(expiresIn);
|
|
6894
|
+
(0, import_react17.useEffect)(() => setTimeLeft(expiresIn), [expiresIn]);
|
|
6895
|
+
(0, import_react17.useEffect)(() => {
|
|
7053
6896
|
const t = setInterval(() => setTimeLeft((secs) => secs > 0 ? secs - 1 : 0), 1e3);
|
|
7054
6897
|
return () => clearInterval(t);
|
|
7055
6898
|
}, []);
|
|
7056
|
-
const lastSubmittedRef = (0,
|
|
7057
|
-
const inputsRef = (0,
|
|
7058
|
-
const [digits, setDigits] = (0,
|
|
7059
|
-
(0,
|
|
6899
|
+
const lastSubmittedRef = (0, import_react17.useRef)(null);
|
|
6900
|
+
const inputsRef = (0, import_react17.useRef)([]);
|
|
6901
|
+
const [digits, setDigits] = (0, import_react17.useState)(["", "", "", "", "", ""]);
|
|
6902
|
+
(0, import_react17.useEffect)(() => {
|
|
7060
6903
|
const code = digits.join("");
|
|
7061
6904
|
if (code.length === 6 && digits.every((d) => d !== "") && !isLoading) {
|
|
7062
6905
|
if (lastSubmittedRef.current !== code) {
|
|
@@ -7065,7 +6908,7 @@ var VerificationCodeInput = (props) => {
|
|
|
7065
6908
|
}
|
|
7066
6909
|
}
|
|
7067
6910
|
}, [digits, isLoading, onVerifyCode]);
|
|
7068
|
-
(0,
|
|
6911
|
+
(0, import_react17.useEffect)(() => {
|
|
7069
6912
|
const t = setTimeout(() => {
|
|
7070
6913
|
inputsRef.current[0]?.focus();
|
|
7071
6914
|
}, 0);
|
|
@@ -7190,7 +7033,7 @@ function VerifyStep(props) {
|
|
|
7190
7033
|
setEmail,
|
|
7191
7034
|
setExpiresIn
|
|
7192
7035
|
} = useAuthStore();
|
|
7193
|
-
const { mutate: onVerifyCode, isPending: isCodeVerifying } = (0,
|
|
7036
|
+
const { mutate: onVerifyCode, isPending: isCodeVerifying } = (0, import_react_query6.useMutation)({
|
|
7194
7037
|
mutationFn: async (code) => {
|
|
7195
7038
|
setIsLoading(true);
|
|
7196
7039
|
setVerificationError("");
|
|
@@ -7263,7 +7106,7 @@ function VerifyStep(props) {
|
|
|
7263
7106
|
setIsLoading(false);
|
|
7264
7107
|
}
|
|
7265
7108
|
});
|
|
7266
|
-
const { mutate: onResendCode, isPending: isCodeResending } = (0,
|
|
7109
|
+
const { mutate: onResendCode, isPending: isCodeResending } = (0, import_react_query6.useMutation)({
|
|
7267
7110
|
mutationFn: async () => {
|
|
7268
7111
|
setVerificationError("");
|
|
7269
7112
|
setIsLoading(true);
|
|
@@ -7341,7 +7184,7 @@ var AuthMenu = () => {
|
|
|
7341
7184
|
const isIframeReady = useLumiaPassportSession((st) => st.isIframeReady);
|
|
7342
7185
|
const page = useLayoutDataStore((st) => st.page);
|
|
7343
7186
|
const setMainPageHeight = useLayoutDataStore((st) => st.setMainPageHeight);
|
|
7344
|
-
(0,
|
|
7187
|
+
(0, import_react18.useEffect)(() => setMainPageHeight(DEFAULT_AUTH_MENU_HEIGHT), [setMainPageHeight]);
|
|
7345
7188
|
const {
|
|
7346
7189
|
step,
|
|
7347
7190
|
setStep,
|
|
@@ -7352,7 +7195,7 @@ var AuthMenu = () => {
|
|
|
7352
7195
|
setFailedMessage,
|
|
7353
7196
|
setCodeSendError
|
|
7354
7197
|
} = useAuthStore();
|
|
7355
|
-
(0,
|
|
7198
|
+
(0, import_react18.useEffect)(() => {
|
|
7356
7199
|
if (page !== "auth" /* AUTH */) {
|
|
7357
7200
|
setStep("signin");
|
|
7358
7201
|
setEmail("");
|
|
@@ -7371,7 +7214,7 @@ var AuthMenu = () => {
|
|
|
7371
7214
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-sm text-[var(--l-pass-fg-muted)]", children: "Initializing wallet..." })
|
|
7372
7215
|
] });
|
|
7373
7216
|
}
|
|
7374
|
-
const stepContent = (0,
|
|
7217
|
+
const stepContent = (0, import_react18.useMemo)(
|
|
7375
7218
|
() => ({
|
|
7376
7219
|
"failed": /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AuthFailedStep, {}),
|
|
7377
7220
|
"display-name": /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DisplayNameStep, { onAuthSuccess }),
|
|
@@ -7517,9 +7360,9 @@ function RampnowIcon() {
|
|
|
7517
7360
|
}
|
|
7518
7361
|
|
|
7519
7362
|
// src/internal/components/BuyMenu/binance/Binance.tsx
|
|
7520
|
-
var
|
|
7363
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
7521
7364
|
var import_lucide_react15 = require("lucide-react");
|
|
7522
|
-
var
|
|
7365
|
+
var import_react20 = require("react");
|
|
7523
7366
|
|
|
7524
7367
|
// src/internal/components/BuyMenu/components/PaymentSelector.tsx
|
|
7525
7368
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
@@ -7560,81 +7403,38 @@ var QUERY_KEYS2 = {
|
|
|
7560
7403
|
};
|
|
7561
7404
|
|
|
7562
7405
|
// src/internal/components/BuyMenu/binance/api.ts
|
|
7563
|
-
|
|
7406
|
+
init_iframe_manager();
|
|
7564
7407
|
async function getLumiaNetworkQuery() {
|
|
7565
|
-
const
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
headers: {
|
|
7569
|
-
"Content-Type": "application/json",
|
|
7570
|
-
...auth && { Authorization: auth }
|
|
7571
|
-
}
|
|
7572
|
-
});
|
|
7573
|
-
const data = await response.json();
|
|
7574
|
-
if (!data?.success) {
|
|
7575
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
7576
|
-
}
|
|
7577
|
-
const lumiaNetwork = data.data?.find((el) => el.cryptoCurrency === "LUMIA") || null;
|
|
7578
|
-
if (!lumiaNetwork) {
|
|
7579
|
-
console.error("Lumia is not available in Binance pairs API");
|
|
7580
|
-
throw new Error("Lumia is not available in API");
|
|
7408
|
+
const iframeManager = getIframeManager();
|
|
7409
|
+
if (!iframeManager) {
|
|
7410
|
+
throw new Error("Iframe manager is not initialized");
|
|
7581
7411
|
}
|
|
7582
|
-
return
|
|
7412
|
+
return await iframeManager.sendMessage("BINANCE_GET_LUMIA_NETWORK_QUERY", {});
|
|
7583
7413
|
}
|
|
7584
7414
|
async function getPaymentMethodsQuery(payload) {
|
|
7585
|
-
const
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
headers: {
|
|
7589
|
-
"Content-Type": "application/json",
|
|
7590
|
-
...auth && { Authorization: auth }
|
|
7591
|
-
},
|
|
7592
|
-
body: JSON.stringify(payload)
|
|
7593
|
-
});
|
|
7594
|
-
const data = await response.json();
|
|
7595
|
-
if (!data.success) {
|
|
7596
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
7415
|
+
const iframeManager = getIframeManager();
|
|
7416
|
+
if (!iframeManager) {
|
|
7417
|
+
throw new Error("Iframe manager is not initialized");
|
|
7597
7418
|
}
|
|
7598
|
-
|
|
7599
|
-
throw new Error("No payment methods available yet");
|
|
7600
|
-
}
|
|
7601
|
-
return data.data.paymentMethods;
|
|
7419
|
+
return await iframeManager.sendMessage("BINANCE_GET_PAYMENT_METHODS_QUERY", payload);
|
|
7602
7420
|
}
|
|
7603
7421
|
async function getQuoteQuery(payload) {
|
|
7604
|
-
const
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
headers: {
|
|
7608
|
-
"Content-Type": "application/json",
|
|
7609
|
-
...auth && { Authorization: auth }
|
|
7610
|
-
},
|
|
7611
|
-
body: JSON.stringify(payload)
|
|
7612
|
-
});
|
|
7613
|
-
const data = await response.json();
|
|
7614
|
-
if (!data.success) {
|
|
7615
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
7422
|
+
const iframeManager = getIframeManager();
|
|
7423
|
+
if (!iframeManager) {
|
|
7424
|
+
throw new Error("Iframe manager is not initialized");
|
|
7616
7425
|
}
|
|
7617
|
-
return
|
|
7426
|
+
return await iframeManager.sendMessage("BINANCE_GET_QUOTE_QUERY", payload);
|
|
7618
7427
|
}
|
|
7619
7428
|
async function createPreorderMutation(payload) {
|
|
7620
|
-
const
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
headers: {
|
|
7624
|
-
"Content-Type": "application/json",
|
|
7625
|
-
...auth && { Authorization: auth }
|
|
7626
|
-
},
|
|
7627
|
-
body: JSON.stringify(payload)
|
|
7628
|
-
});
|
|
7629
|
-
const data = await response.json();
|
|
7630
|
-
if (!data.success) {
|
|
7631
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
7429
|
+
const iframeManager = getIframeManager();
|
|
7430
|
+
if (!iframeManager) {
|
|
7431
|
+
throw new Error("Iframe manager is not initialized");
|
|
7632
7432
|
}
|
|
7633
|
-
return
|
|
7433
|
+
return await iframeManager.sendMessage("BINANCE_CREATE_PREORDER_MUTATION", payload);
|
|
7634
7434
|
}
|
|
7635
7435
|
|
|
7636
7436
|
// src/internal/components/BuyMenu/binance/useQueriesErrorHandler.ts
|
|
7637
|
-
var
|
|
7437
|
+
var import_react19 = require("react");
|
|
7638
7438
|
|
|
7639
7439
|
// src/internal/components/BuyMenu/binance/utils.ts
|
|
7640
7440
|
function getPayMethodID(pm) {
|
|
@@ -7654,7 +7454,7 @@ function handleErrors(errors) {
|
|
|
7654
7454
|
// src/internal/components/BuyMenu/binance/useQueriesErrorHandler.ts
|
|
7655
7455
|
var useQueriesErrorHandler = (errors, stateUpdater) => {
|
|
7656
7456
|
const { error: errorTitle, message: errorMessage } = handleErrors(errors);
|
|
7657
|
-
(0,
|
|
7457
|
+
(0, import_react19.useEffect)(() => {
|
|
7658
7458
|
if (!errorTitle && !errorMessage) return;
|
|
7659
7459
|
console.error(`[BuyModal][Binance] ${errorTitle}: ${errorMessage}`);
|
|
7660
7460
|
stateUpdater(1);
|
|
@@ -7679,12 +7479,12 @@ function Binance(props) {
|
|
|
7679
7479
|
setMinAmount,
|
|
7680
7480
|
setSrcInputAmount
|
|
7681
7481
|
} = control;
|
|
7682
|
-
const qc = (0,
|
|
7482
|
+
const qc = (0, import_react_query7.useQueryClient)();
|
|
7683
7483
|
const {
|
|
7684
7484
|
data: lumiaNetwork,
|
|
7685
7485
|
isLoading: isLumiaNetworkLoading,
|
|
7686
7486
|
error: lumiaNetworkError
|
|
7687
|
-
} = (0,
|
|
7487
|
+
} = (0, import_react_query7.useQuery)({
|
|
7688
7488
|
retry: false,
|
|
7689
7489
|
enabled: !!walletAddress,
|
|
7690
7490
|
queryKey: [QUERY_KEYS2.binanceNetworksQuery, walletAddress],
|
|
@@ -7695,27 +7495,27 @@ function Binance(props) {
|
|
|
7695
7495
|
data: paymentModes = null,
|
|
7696
7496
|
isLoading: isPaymentModesLoading,
|
|
7697
7497
|
error: paymentMethodsError
|
|
7698
|
-
} = (0,
|
|
7498
|
+
} = (0, import_react_query7.useQuery)({
|
|
7699
7499
|
retry: false,
|
|
7700
7500
|
enabled: !!isLumiaAvailable && !!walletAddress,
|
|
7701
7501
|
// && srcQueryAmount > 0,
|
|
7702
7502
|
queryKey: [QUERY_KEYS2.binancePaymentModes, walletAddress, isLumiaAvailable, srcQueryAmount],
|
|
7703
7503
|
queryFn: async () => getPaymentMethodsQuery({ totalAmount: String(srcQueryAmount || 1) })
|
|
7704
7504
|
});
|
|
7705
|
-
const lastLoadedPaymentModes = (0,
|
|
7706
|
-
(0,
|
|
7505
|
+
const lastLoadedPaymentModes = (0, import_react20.useRef)([]);
|
|
7506
|
+
(0, import_react20.useEffect)(() => {
|
|
7707
7507
|
if (!paymentModes?.length) return;
|
|
7708
7508
|
setPaymentMode(getPayMethodID(paymentModes[0]));
|
|
7709
7509
|
lastLoadedPaymentModes.current = paymentModes;
|
|
7710
7510
|
}, [paymentModes]);
|
|
7711
7511
|
const selectedPaymentMode = paymentModes?.find((el) => getPayMethodID(el) === paymentMode) || null;
|
|
7712
7512
|
const minimum = Number(selectedPaymentMode?.fiatMinLimit || "0");
|
|
7713
|
-
(0,
|
|
7513
|
+
(0, import_react20.useEffect)(() => setMinAmount(minimum), [minimum]);
|
|
7714
7514
|
const {
|
|
7715
7515
|
data: quoteData = null,
|
|
7716
7516
|
isLoading: isQuoteDataLoading,
|
|
7717
7517
|
error: quoteError
|
|
7718
|
-
} = (0,
|
|
7518
|
+
} = (0, import_react_query7.useQuery)({
|
|
7719
7519
|
retry: false,
|
|
7720
7520
|
enabled: !!walletAddress && srcQueryAmount > 0 && minimum > 0 && srcQueryAmount >= minimum,
|
|
7721
7521
|
queryKey: [QUERY_KEYS2.binanceQuote, walletAddress, selectedPaymentMode, srcQueryAmount],
|
|
@@ -7731,7 +7531,7 @@ function Binance(props) {
|
|
|
7731
7531
|
[lumiaNetworkError, paymentMethodsError, quoteError],
|
|
7732
7532
|
setSrcInputAmount
|
|
7733
7533
|
);
|
|
7734
|
-
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = (0,
|
|
7534
|
+
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = (0, import_react_query7.useMutation)({
|
|
7735
7535
|
mutationFn: async () => {
|
|
7736
7536
|
setRedirecting(true);
|
|
7737
7537
|
const returnUrl = window.location.href.split("?")[0];
|
|
@@ -7755,7 +7555,7 @@ function Binance(props) {
|
|
|
7755
7555
|
setRedirecting(false);
|
|
7756
7556
|
}
|
|
7757
7557
|
});
|
|
7758
|
-
(0,
|
|
7558
|
+
(0, import_react20.useEffect)(() => {
|
|
7759
7559
|
return () => {
|
|
7760
7560
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binanceNetworksQuery] });
|
|
7761
7561
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binancePaymentModes] });
|
|
@@ -7817,36 +7617,25 @@ function Binance(props) {
|
|
|
7817
7617
|
}
|
|
7818
7618
|
|
|
7819
7619
|
// src/internal/components/BuyMenu/rampnow/Rampnow.tsx
|
|
7820
|
-
var
|
|
7620
|
+
var import_react_query8 = require("@tanstack/react-query");
|
|
7821
7621
|
var import_lucide_react16 = require("lucide-react");
|
|
7822
|
-
var
|
|
7622
|
+
var import_react21 = require("react");
|
|
7823
7623
|
|
|
7824
7624
|
// src/internal/components/BuyMenu/rampnow/api.ts
|
|
7825
|
-
|
|
7625
|
+
init_iframe_manager();
|
|
7826
7626
|
async function getRampnowConfigQuery() {
|
|
7827
|
-
const
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
});
|
|
7832
|
-
const data = await response.json();
|
|
7833
|
-
return data;
|
|
7627
|
+
const iframeManager = getIframeManager();
|
|
7628
|
+
if (!iframeManager) {
|
|
7629
|
+
throw new Error("Iframe manager is not initialized");
|
|
7630
|
+
}
|
|
7631
|
+
return await iframeManager.sendMessage("RAMPNOW_GET_CONFIG", {});
|
|
7834
7632
|
}
|
|
7835
7633
|
async function getRampOrderQuoteQuery(payload) {
|
|
7836
|
-
const
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
headers: {
|
|
7840
|
-
"Content-Type": "application/json",
|
|
7841
|
-
...auth && { Authorization: auth }
|
|
7842
|
-
},
|
|
7843
|
-
body: JSON.stringify(payload)
|
|
7844
|
-
});
|
|
7845
|
-
const data = await response.json();
|
|
7846
|
-
if (!data.data) {
|
|
7847
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
7634
|
+
const iframeManager = getIframeManager();
|
|
7635
|
+
if (!iframeManager) {
|
|
7636
|
+
throw new Error("Iframe manager is not initialized");
|
|
7848
7637
|
}
|
|
7849
|
-
return
|
|
7638
|
+
return await iframeManager.sendMessage("RAMPNOW_GET_ORDER_QUOTE", payload);
|
|
7850
7639
|
}
|
|
7851
7640
|
|
|
7852
7641
|
// src/internal/components/BuyMenu/rampnow/constants.ts
|
|
@@ -7883,8 +7672,8 @@ function Rampnow(props) {
|
|
|
7883
7672
|
setSrcInputAmount,
|
|
7884
7673
|
setMinAmount
|
|
7885
7674
|
} = control;
|
|
7886
|
-
const qc = (0,
|
|
7887
|
-
(0,
|
|
7675
|
+
const qc = (0, import_react_query8.useQueryClient)();
|
|
7676
|
+
(0, import_react21.useEffect)(() => {
|
|
7888
7677
|
setMinAmount(MINIMUM_RAMP_AMOUNT);
|
|
7889
7678
|
setPaymentMode(PAYMENT_MODES[0].id);
|
|
7890
7679
|
}, []);
|
|
@@ -7892,7 +7681,7 @@ function Rampnow(props) {
|
|
|
7892
7681
|
data: configData,
|
|
7893
7682
|
isLoading: isConfigLoading,
|
|
7894
7683
|
error: configError
|
|
7895
|
-
} = (0,
|
|
7684
|
+
} = (0, import_react_query8.useQuery)({
|
|
7896
7685
|
retry: false,
|
|
7897
7686
|
enabled: !!walletAddress,
|
|
7898
7687
|
queryKey: [QUERY_KEYS2.getRampNowConfig, walletAddress],
|
|
@@ -7902,7 +7691,7 @@ function Rampnow(props) {
|
|
|
7902
7691
|
data: quoteData,
|
|
7903
7692
|
isLoading: isQuoteDataLoading,
|
|
7904
7693
|
error: quoteError
|
|
7905
|
-
} = (0,
|
|
7694
|
+
} = (0, import_react_query8.useQuery)({
|
|
7906
7695
|
retry: false,
|
|
7907
7696
|
enabled: !!configData && !!walletAddress && !!paymentMode && srcQueryAmount >= MINIMUM_RAMP_AMOUNT,
|
|
7908
7697
|
queryKey: [QUERY_KEYS2.getRampNowQuote, walletAddress, srcQueryAmount, paymentMode],
|
|
@@ -7912,7 +7701,7 @@ function Rampnow(props) {
|
|
|
7912
7701
|
paymentMode
|
|
7913
7702
|
})
|
|
7914
7703
|
});
|
|
7915
|
-
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = (0,
|
|
7704
|
+
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = (0, import_react_query8.useMutation)({
|
|
7916
7705
|
mutationFn: async () => {
|
|
7917
7706
|
if (!configData?.apiKey?.length || !configData?.orderUrl?.length) {
|
|
7918
7707
|
throw new Error("RampNow order service is not available");
|
|
@@ -7941,7 +7730,7 @@ function Rampnow(props) {
|
|
|
7941
7730
|
console.error("Create CheckoutOrder failed:", err);
|
|
7942
7731
|
}
|
|
7943
7732
|
});
|
|
7944
|
-
(0,
|
|
7733
|
+
(0, import_react21.useEffect)(() => {
|
|
7945
7734
|
return () => {
|
|
7946
7735
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.getRampNowConfig] });
|
|
7947
7736
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.getRampNowQuote] });
|
|
@@ -8023,7 +7812,7 @@ var RAMP_PROVIDERS = {
|
|
|
8023
7812
|
var REDIRECT_TIMEOUT_MS = 1500;
|
|
8024
7813
|
|
|
8025
7814
|
// src/internal/components/BuyMenu/useSelectables.ts
|
|
8026
|
-
var
|
|
7815
|
+
var import_react22 = require("react");
|
|
8027
7816
|
|
|
8028
7817
|
// src/internal/utils/debounce.ts
|
|
8029
7818
|
function debounce2(func, waitFor) {
|
|
@@ -8037,14 +7826,14 @@ function debounce2(func, waitFor) {
|
|
|
8037
7826
|
// src/internal/components/BuyMenu/useSelectables.ts
|
|
8038
7827
|
var ON_INPUT_QUERY_DELAY = 2e3;
|
|
8039
7828
|
var useSelectables = () => {
|
|
8040
|
-
const [redirecting, setRedirecting] = (0,
|
|
8041
|
-
const [rampProvider, setrRampProvider] = (0,
|
|
8042
|
-
const [minAmount, setMinAmount] = (0,
|
|
8043
|
-
const inputRef = (0,
|
|
8044
|
-
const [srcQueryAmount, setSrcQueryAmount] = (0,
|
|
8045
|
-
const [srcInputAmount, setSrcInputAmount] = (0,
|
|
8046
|
-
const [paymentMode, setPaymentMode] = (0,
|
|
8047
|
-
const setQueryAmountDebounced = (0,
|
|
7829
|
+
const [redirecting, setRedirecting] = (0, import_react22.useState)(false);
|
|
7830
|
+
const [rampProvider, setrRampProvider] = (0, import_react22.useState)("binance");
|
|
7831
|
+
const [minAmount, setMinAmount] = (0, import_react22.useState)(0);
|
|
7832
|
+
const inputRef = (0, import_react22.useRef)(null);
|
|
7833
|
+
const [srcQueryAmount, setSrcQueryAmount] = (0, import_react22.useState)(0);
|
|
7834
|
+
const [srcInputAmount, setSrcInputAmount] = (0, import_react22.useState)(0);
|
|
7835
|
+
const [paymentMode, setPaymentMode] = (0, import_react22.useState)(null);
|
|
7836
|
+
const setQueryAmountDebounced = (0, import_react22.useCallback)(
|
|
8048
7837
|
debounce2((inputAmount) => {
|
|
8049
7838
|
const checkedValue = Math.max(inputAmount, minAmount);
|
|
8050
7839
|
setSrcInputAmount(checkedValue);
|
|
@@ -8052,7 +7841,7 @@ var useSelectables = () => {
|
|
|
8052
7841
|
}, ON_INPUT_QUERY_DELAY),
|
|
8053
7842
|
[minAmount]
|
|
8054
7843
|
);
|
|
8055
|
-
(0,
|
|
7844
|
+
(0, import_react22.useEffect)(() => setQueryAmountDebounced(srcInputAmount), [srcInputAmount, setQueryAmountDebounced]);
|
|
8056
7845
|
return {
|
|
8057
7846
|
inputRef,
|
|
8058
7847
|
redirecting,
|
|
@@ -8104,7 +7893,7 @@ function BuyMenu() {
|
|
|
8104
7893
|
|
|
8105
7894
|
// src/internal/components/KeyshareBackupMenu/KeyshareBackupMenu.tsx
|
|
8106
7895
|
var import_lucide_react19 = require("lucide-react");
|
|
8107
|
-
var
|
|
7896
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
8108
7897
|
init_iframe_manager();
|
|
8109
7898
|
|
|
8110
7899
|
// src/internal/components/ui/checkbox.tsx
|
|
@@ -8140,30 +7929,30 @@ function KeyshareBackupMenu() {
|
|
|
8140
7929
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
8141
7930
|
const userId = session?.mpcUserId || "";
|
|
8142
7931
|
const onBackupSuccess = () => console.log("[ConnectWalletButton] Backup created successfully");
|
|
8143
|
-
(0,
|
|
7932
|
+
(0, import_react23.useEffect)(() => {
|
|
8144
7933
|
if (!userId) setPage("main-menu" /* MAIN_MENU */);
|
|
8145
7934
|
}, [userId, setPage]);
|
|
8146
|
-
const [backupStatus, setBackupStatus] =
|
|
7935
|
+
const [backupStatus, setBackupStatus] = import_react23.default.useState({
|
|
8147
7936
|
server: {},
|
|
8148
7937
|
cloud: {},
|
|
8149
7938
|
local: {}
|
|
8150
7939
|
});
|
|
8151
|
-
const [loading, setLoading] =
|
|
7940
|
+
const [loading, setLoading] = import_react23.default.useState({
|
|
8152
7941
|
server: false,
|
|
8153
7942
|
cloud: false,
|
|
8154
7943
|
local: false
|
|
8155
7944
|
});
|
|
8156
|
-
const [error, setError] =
|
|
8157
|
-
const [success, setSuccess] =
|
|
8158
|
-
const [showPassword, setShowPassword] =
|
|
8159
|
-
const [useCustomPassword, setUseCustomPassword] =
|
|
8160
|
-
const [customPassword, setCustomPassword] =
|
|
8161
|
-
const [cloudProviders, setCloudProviders] =
|
|
7945
|
+
const [error, setError] = import_react23.default.useState(null);
|
|
7946
|
+
const [success, setSuccess] = import_react23.default.useState(null);
|
|
7947
|
+
const [showPassword, setShowPassword] = import_react23.default.useState(false);
|
|
7948
|
+
const [useCustomPassword, setUseCustomPassword] = import_react23.default.useState(false);
|
|
7949
|
+
const [customPassword, setCustomPassword] = import_react23.default.useState("");
|
|
7950
|
+
const [cloudProviders, setCloudProviders] = import_react23.default.useState(
|
|
8162
7951
|
[]
|
|
8163
7952
|
);
|
|
8164
|
-
const [selectedCloudProvider, setSelectedCloudProvider] =
|
|
8165
|
-
const [hasKeyshareData, setHasKeyshareData] =
|
|
8166
|
-
const iframeManager =
|
|
7953
|
+
const [selectedCloudProvider, setSelectedCloudProvider] = import_react23.default.useState(null);
|
|
7954
|
+
const [hasKeyshareData, setHasKeyshareData] = import_react23.default.useState(true);
|
|
7955
|
+
const iframeManager = import_react23.default.useMemo(() => {
|
|
8167
7956
|
try {
|
|
8168
7957
|
return getIframeManager();
|
|
8169
7958
|
} catch (e) {
|
|
@@ -8171,7 +7960,7 @@ function KeyshareBackupMenu() {
|
|
|
8171
7960
|
return null;
|
|
8172
7961
|
}
|
|
8173
7962
|
}, []);
|
|
8174
|
-
(0,
|
|
7963
|
+
(0, import_react23.useEffect)(() => {
|
|
8175
7964
|
const loadCloudProviders = async () => {
|
|
8176
7965
|
try {
|
|
8177
7966
|
const { getAvailableCloudProviders: getAvailableCloudProviders3 } = await Promise.resolve().then(() => (init_cloudStorage(), cloudStorage_exports));
|
|
@@ -8191,7 +7980,7 @@ function KeyshareBackupMenu() {
|
|
|
8191
7980
|
};
|
|
8192
7981
|
loadCloudProviders();
|
|
8193
7982
|
}, [selectedCloudProvider]);
|
|
8194
|
-
const refreshStatus =
|
|
7983
|
+
const refreshStatus = import_react23.default.useCallback(async () => {
|
|
8195
7984
|
if (!iframeManager) return;
|
|
8196
7985
|
try {
|
|
8197
7986
|
const status = await iframeManager.getBackupStatus(userId);
|
|
@@ -8200,7 +7989,7 @@ function KeyshareBackupMenu() {
|
|
|
8200
7989
|
console.error("[KeyshareBackup] Failed to get backup status:", error2);
|
|
8201
7990
|
}
|
|
8202
7991
|
}, [iframeManager, userId]);
|
|
8203
|
-
(0,
|
|
7992
|
+
(0, import_react23.useEffect)(() => {
|
|
8204
7993
|
refreshStatus();
|
|
8205
7994
|
}, [refreshStatus]);
|
|
8206
7995
|
const handleBackup = async (method) => {
|
|
@@ -8429,21 +8218,21 @@ function KeyshareBackupMenu() {
|
|
|
8429
8218
|
}
|
|
8430
8219
|
|
|
8431
8220
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
8432
|
-
var
|
|
8221
|
+
var import_react_query9 = require("@tanstack/react-query");
|
|
8433
8222
|
var import_lucide_react22 = require("lucide-react");
|
|
8434
|
-
var
|
|
8223
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
8435
8224
|
init_vaultClient();
|
|
8436
8225
|
|
|
8437
8226
|
// src/internal/components/KeyshareRestoreMenu/NoBackupFound.tsx
|
|
8438
8227
|
var import_lucide_react20 = require("lucide-react");
|
|
8439
|
-
var
|
|
8228
|
+
var import_react24 = require("react");
|
|
8440
8229
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
8441
8230
|
var ACCOUNT_RECOVERY_TEXT = `This device doesn't have access to your wallet keyshare, and no backup was found in the Vault. To access your wallet: use the original device where you created the account, create a backup from that device first, then try restoring on this device.`;
|
|
8442
8231
|
var ACCOUNT_FILE_RECOVERY_TEXT = `Try uploading a backup file if you have one saved locally, or create a different new account`;
|
|
8443
8232
|
function NoBackupFound(props) {
|
|
8444
8233
|
const { isLoading, restoreFromFile } = props;
|
|
8445
|
-
const [restoreFile, setRestoreFile] = (0,
|
|
8446
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
8234
|
+
const [restoreFile, setRestoreFile] = (0, import_react24.useState)(null);
|
|
8235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react24.Fragment, { children: [
|
|
8447
8236
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Highlight, { type: "error", className: "animate-glow-warning flex gap-[var(--l-pass-gap)]", children: [
|
|
8448
8237
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react20.AlertCircle, { className: "h-4 w-4 flex-0" }),
|
|
8449
8238
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "w-full flex-1 flex flex-col gap-2", children: [
|
|
@@ -8484,7 +8273,7 @@ function NoBackupFound(props) {
|
|
|
8484
8273
|
|
|
8485
8274
|
// src/internal/components/KeyshareRestoreMenu/ServerBackupFound.tsx
|
|
8486
8275
|
var import_lucide_react21 = require("lucide-react");
|
|
8487
|
-
var
|
|
8276
|
+
var import_react25 = require("react");
|
|
8488
8277
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
8489
8278
|
function ServerBackupFound(props) {
|
|
8490
8279
|
const {
|
|
@@ -8500,7 +8289,7 @@ function ServerBackupFound(props) {
|
|
|
8500
8289
|
setRestorePassword,
|
|
8501
8290
|
setUseCustomPassword
|
|
8502
8291
|
} = props;
|
|
8503
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
8292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react25.Fragment, { children: [
|
|
8504
8293
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Highlight, { type: "success", className: "w-full flex gap-[var(--l-pass-gap)]", children: [
|
|
8505
8294
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react21.AlertCircle, { className: "h-4 w-4 flex-0" }),
|
|
8506
8295
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "w-full flex-1", children: [
|
|
@@ -8616,17 +8405,17 @@ var KeyshareRestoreMenu = () => {
|
|
|
8616
8405
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
8617
8406
|
const setIsDialogForced = useLayoutStore((st) => st.setIsDialogForced);
|
|
8618
8407
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
8619
|
-
(0,
|
|
8408
|
+
(0, import_react26.useEffect)(() => setIsDialogForced(true), []);
|
|
8620
8409
|
const { usePaymaster, recoveryUserId, setRecoveryUserId, setSession, setAddress, setStatus, setIsLoading } = useLumiaPassportSession();
|
|
8621
|
-
const [error, setError] =
|
|
8622
|
-
const [success, setSuccess] =
|
|
8623
|
-
const [showPassword, setShowPassword] =
|
|
8624
|
-
const [useCustomPassword, setUseCustomPassword] =
|
|
8625
|
-
const [restoreFile, setRestoreFile] =
|
|
8626
|
-
const [restorePassword, setRestorePassword] =
|
|
8627
|
-
const [hasServerBackup, setHasServerBackup] =
|
|
8628
|
-
const [checkingBackup, setCheckingBackup] =
|
|
8629
|
-
const createSessionWithKeyshare = (0,
|
|
8410
|
+
const [error, setError] = import_react26.default.useState(null);
|
|
8411
|
+
const [success, setSuccess] = import_react26.default.useState(null);
|
|
8412
|
+
const [showPassword, setShowPassword] = import_react26.default.useState(false);
|
|
8413
|
+
const [useCustomPassword, setUseCustomPassword] = import_react26.default.useState(false);
|
|
8414
|
+
const [restoreFile, setRestoreFile] = import_react26.default.useState(null);
|
|
8415
|
+
const [restorePassword, setRestorePassword] = import_react26.default.useState("");
|
|
8416
|
+
const [hasServerBackup, setHasServerBackup] = import_react26.default.useState(null);
|
|
8417
|
+
const [checkingBackup, setCheckingBackup] = import_react26.default.useState(true);
|
|
8418
|
+
const createSessionWithKeyshare = (0, import_react26.useCallback)(
|
|
8630
8419
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
8631
8420
|
try {
|
|
8632
8421
|
try {
|
|
@@ -8660,7 +8449,7 @@ var KeyshareRestoreMenu = () => {
|
|
|
8660
8449
|
},
|
|
8661
8450
|
[setStatus, callbacks, usePaymaster]
|
|
8662
8451
|
);
|
|
8663
|
-
const onRestoreSuccess = (0,
|
|
8452
|
+
const onRestoreSuccess = (0, import_react26.useCallback)(async () => {
|
|
8664
8453
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
8665
8454
|
const verify = await verifyToken2();
|
|
8666
8455
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -8725,7 +8514,7 @@ var KeyshareRestoreMenu = () => {
|
|
|
8725
8514
|
callbacks,
|
|
8726
8515
|
config.projectId
|
|
8727
8516
|
]);
|
|
8728
|
-
(0,
|
|
8517
|
+
(0, import_react26.useEffect)(() => {
|
|
8729
8518
|
const checkBackupAvailability = async () => {
|
|
8730
8519
|
try {
|
|
8731
8520
|
setCheckingBackup(true);
|
|
@@ -8743,7 +8532,7 @@ var KeyshareRestoreMenu = () => {
|
|
|
8743
8532
|
};
|
|
8744
8533
|
checkBackupAvailability();
|
|
8745
8534
|
}, [recoveryUserId]);
|
|
8746
|
-
const { mutate: restoreFromServer2, isPending: isRestoringFromServer } = (0,
|
|
8535
|
+
const { mutate: restoreFromServer2, isPending: isRestoringFromServer } = (0, import_react_query9.useMutation)({
|
|
8747
8536
|
mutationFn: async () => {
|
|
8748
8537
|
setError(null);
|
|
8749
8538
|
setSuccess(null);
|
|
@@ -8778,7 +8567,7 @@ var KeyshareRestoreMenu = () => {
|
|
|
8778
8567
|
setError(errorMsg);
|
|
8779
8568
|
}
|
|
8780
8569
|
});
|
|
8781
|
-
const { mutate: restoreFromFile, isPending: isRestoringFromFile } = (0,
|
|
8570
|
+
const { mutate: restoreFromFile, isPending: isRestoringFromFile } = (0, import_react_query9.useMutation)({
|
|
8782
8571
|
mutationFn: async () => {
|
|
8783
8572
|
if (!restoreFile) {
|
|
8784
8573
|
throw new Error("Please select a backup file");
|
|
@@ -8812,7 +8601,7 @@ var KeyshareRestoreMenu = () => {
|
|
|
8812
8601
|
setError(errorMsg);
|
|
8813
8602
|
}
|
|
8814
8603
|
});
|
|
8815
|
-
const { mutate: disconnect, isPending: isDisconnecting } = (0,
|
|
8604
|
+
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query9.useMutation)({
|
|
8816
8605
|
mutationFn: async () => {
|
|
8817
8606
|
setError(null);
|
|
8818
8607
|
setStatus("disconnecting");
|
|
@@ -8904,14 +8693,14 @@ var import_lucide_react24 = require("lucide-react");
|
|
|
8904
8693
|
var import_lucide_react23 = require("lucide-react");
|
|
8905
8694
|
|
|
8906
8695
|
// src/internal/components/KYC/useSumsubIframe.ts
|
|
8907
|
-
var
|
|
8696
|
+
var import_react27 = require("react");
|
|
8908
8697
|
|
|
8909
8698
|
// src/internal/components/KYC/api/sumsub.ts
|
|
8910
8699
|
init_httpClient();
|
|
8911
8700
|
|
|
8912
8701
|
// src/config/queryClient.ts
|
|
8913
|
-
var
|
|
8914
|
-
var queryClient = new
|
|
8702
|
+
var import_react_query10 = require("@tanstack/react-query");
|
|
8703
|
+
var queryClient = new import_react_query10.QueryClient({
|
|
8915
8704
|
defaultOptions: {
|
|
8916
8705
|
queries: {
|
|
8917
8706
|
staleTime: 1e3 * 60 * 6,
|
|
@@ -9027,13 +8816,13 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
9027
8816
|
config: { current: config }
|
|
9028
8817
|
} = useLumiaPassportConfig();
|
|
9029
8818
|
const { colorMode } = useLumiaPassportColorMode();
|
|
9030
|
-
const iframeRef = (0,
|
|
9031
|
-
const [isLoading, setIsLoading] = (0,
|
|
9032
|
-
const [error, setError] = (0,
|
|
9033
|
-
const [height, setHeight] = (0,
|
|
9034
|
-
const [status, setStatus] = (0,
|
|
8819
|
+
const iframeRef = (0, import_react27.useRef)(null);
|
|
8820
|
+
const [isLoading, setIsLoading] = (0, import_react27.useState)(true);
|
|
8821
|
+
const [error, setError] = (0, import_react27.useState)(null);
|
|
8822
|
+
const [height, setHeight] = (0, import_react27.useState)(0);
|
|
8823
|
+
const [status, setStatus] = (0, import_react27.useState)("");
|
|
9035
8824
|
const levelName = config.kyc?.options?.levelName;
|
|
9036
|
-
(0,
|
|
8825
|
+
(0, import_react27.useEffect)(() => {
|
|
9037
8826
|
setError(null);
|
|
9038
8827
|
setIsLoading(true);
|
|
9039
8828
|
setStatus("Preparing verification...");
|
|
@@ -9141,7 +8930,7 @@ function KycMenu() {
|
|
|
9141
8930
|
|
|
9142
8931
|
// src/internal/components/MainMenu/MainMenu.tsx
|
|
9143
8932
|
var import_lucide_react26 = require("lucide-react");
|
|
9144
|
-
var
|
|
8933
|
+
var import_react28 = require("react");
|
|
9145
8934
|
|
|
9146
8935
|
// src/internal/components/MainMenu/BackupWarning.tsx
|
|
9147
8936
|
var import_framer_motion2 = require("framer-motion");
|
|
@@ -9197,7 +8986,7 @@ function MainMenu() {
|
|
|
9197
8986
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9198
8987
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
9199
8988
|
const setMainPageHeight = useLayoutDataStore((st) => st.setMainPageHeight);
|
|
9200
|
-
(0,
|
|
8989
|
+
(0, import_react28.useEffect)(() => setMainPageHeight(DEFAULT_MAIN_MENU_HEIGHT), [setMainPageHeight]);
|
|
9201
8990
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "w-full p-[var(--l-pass-pd)] flex flex-col gap-[var(--l-pass-gap)]", children: [
|
|
9202
8991
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "grid grid-cols-4 gap-[var(--l-pass-gap)]", children: MAIN_MENU_BUTTONS.map(({ id, label, icon: Icon }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
9203
8992
|
Button,
|
|
@@ -9221,11 +9010,11 @@ function MainMenu() {
|
|
|
9221
9010
|
// src/internal/components/ManageWalletMenu/ManageWallet.tsx
|
|
9222
9011
|
var import_lodash_es3 = require("lodash-es");
|
|
9223
9012
|
var import_lucide_react30 = require("lucide-react");
|
|
9224
|
-
var
|
|
9013
|
+
var import_react32 = require("react");
|
|
9225
9014
|
|
|
9226
9015
|
// src/modules/linkedProfiles.ts
|
|
9227
|
-
var
|
|
9228
|
-
var
|
|
9016
|
+
var import_react_query11 = require("@tanstack/react-query");
|
|
9017
|
+
var import_react29 = require("react");
|
|
9229
9018
|
init_auth();
|
|
9230
9019
|
init_common();
|
|
9231
9020
|
init_types();
|
|
@@ -9245,32 +9034,32 @@ async function getLinkProfilesData() {
|
|
|
9245
9034
|
return { profiles: loadedProfiles, avatar };
|
|
9246
9035
|
}
|
|
9247
9036
|
function useLumiaPassportLinkedProfiles() {
|
|
9248
|
-
const qc = (0,
|
|
9037
|
+
const qc = (0, import_react_query11.useQueryClient)();
|
|
9249
9038
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9250
9039
|
const {
|
|
9251
9040
|
data,
|
|
9252
9041
|
isFetching: isLoading,
|
|
9253
9042
|
error
|
|
9254
|
-
} = (0,
|
|
9043
|
+
} = (0, import_react_query11.useQuery)({
|
|
9255
9044
|
retry: false,
|
|
9256
9045
|
enabled: !!address,
|
|
9257
9046
|
queryKey: [LINKED_PROFILES_QUERY_KEY, address],
|
|
9258
9047
|
queryFn: getLinkProfilesData
|
|
9259
9048
|
});
|
|
9260
9049
|
const { profiles = [], avatar = null } = data || {};
|
|
9261
|
-
const refresh = (0,
|
|
9050
|
+
const refresh = (0, import_react29.useCallback)(async () => {
|
|
9262
9051
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
9263
9052
|
}, [qc, address]);
|
|
9264
9053
|
return { profiles, avatar, isLoading, error, refresh };
|
|
9265
9054
|
}
|
|
9266
9055
|
|
|
9267
9056
|
// src/internal/components/ManageWalletMenu/AddProvider.tsx
|
|
9268
|
-
var
|
|
9057
|
+
var import_react_query16 = require("@tanstack/react-query");
|
|
9269
9058
|
init_passkey2();
|
|
9270
9059
|
|
|
9271
9060
|
// src/internal/components/ManageWalletMenu/EmailForm.tsx
|
|
9272
9061
|
init_lumiaPassport();
|
|
9273
|
-
var
|
|
9062
|
+
var import_react_query12 = require("@tanstack/react-query");
|
|
9274
9063
|
var import_lucide_react27 = require("lucide-react");
|
|
9275
9064
|
init_projectId();
|
|
9276
9065
|
|
|
@@ -9313,7 +9102,7 @@ function EmailForm() {
|
|
|
9313
9102
|
const isLoading = useLumiaPassportSession((st) => st.isLoading);
|
|
9314
9103
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
9315
9104
|
const { email, setEmail, setEmailCodeSentError, setEmailCodeExpiresIn, setEmailStep } = useManageWalletStore();
|
|
9316
|
-
const { mutate: onSendVerificationCode } = (0,
|
|
9105
|
+
const { mutate: onSendVerificationCode } = (0, import_react_query12.useMutation)({
|
|
9317
9106
|
mutationFn: async () => {
|
|
9318
9107
|
if (!email) return;
|
|
9319
9108
|
setIsLoading(true);
|
|
@@ -9390,13 +9179,13 @@ function EmailForm() {
|
|
|
9390
9179
|
}
|
|
9391
9180
|
|
|
9392
9181
|
// src/internal/components/ManageWalletMenu/hooks/useProvidersList.ts
|
|
9393
|
-
var
|
|
9182
|
+
var import_react_query13 = require("@tanstack/react-query");
|
|
9394
9183
|
init_common();
|
|
9395
9184
|
var PROVIDERS_QUERY_KEY = "lumia-passport-providers-query";
|
|
9396
9185
|
function useProvidersList() {
|
|
9397
9186
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9398
9187
|
const page = useLayoutDataStore((st) => st.page);
|
|
9399
|
-
return (0,
|
|
9188
|
+
return (0, import_react_query13.useQuery)({
|
|
9400
9189
|
retry: false,
|
|
9401
9190
|
enabled: !!address && page === "manage-wallet" /* MANAGE_WALLET */,
|
|
9402
9191
|
queryKey: [PROVIDERS_QUERY_KEY, address],
|
|
@@ -9405,11 +9194,11 @@ function useProvidersList() {
|
|
|
9405
9194
|
}
|
|
9406
9195
|
|
|
9407
9196
|
// src/internal/components/ManageWalletMenu/hooks/useSendVerificationCode.ts
|
|
9408
|
-
var
|
|
9197
|
+
var import_react_query14 = require("@tanstack/react-query");
|
|
9409
9198
|
init_email();
|
|
9410
9199
|
function useSendVerificationCode() {
|
|
9411
9200
|
const { setVerificationError, setLinkIsLoading, setEmailCodeSentError, setEmailCodeExpiresIn } = useManageWalletStore();
|
|
9412
|
-
return (0,
|
|
9201
|
+
return (0, import_react_query14.useMutation)({
|
|
9413
9202
|
mutationFn: async (email) => {
|
|
9414
9203
|
if (!email) {
|
|
9415
9204
|
throw new Error("Email is required");
|
|
@@ -9432,11 +9221,11 @@ function useSendVerificationCode() {
|
|
|
9432
9221
|
}
|
|
9433
9222
|
|
|
9434
9223
|
// src/internal/components/ManageWalletMenu/hooks/useVerifyCode.ts
|
|
9435
|
-
var
|
|
9224
|
+
var import_react_query15 = require("@tanstack/react-query");
|
|
9436
9225
|
init_email();
|
|
9437
9226
|
function useVerifyCode() {
|
|
9438
9227
|
const { callbacks } = useLumiaPassportConfig();
|
|
9439
|
-
const qc = (0,
|
|
9228
|
+
const qc = (0, import_react_query15.useQueryClient)();
|
|
9440
9229
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9441
9230
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
9442
9231
|
const {
|
|
@@ -9450,7 +9239,7 @@ function useVerifyCode() {
|
|
|
9450
9239
|
setVerificationError,
|
|
9451
9240
|
setEmailCodeSentError
|
|
9452
9241
|
} = useManageWalletStore();
|
|
9453
|
-
return (0,
|
|
9242
|
+
return (0, import_react_query15.useMutation)({
|
|
9454
9243
|
mutationFn: async (codeToVerify) => {
|
|
9455
9244
|
const code = codeToVerify ?? emailCode;
|
|
9456
9245
|
if (!code) {
|
|
@@ -9500,7 +9289,7 @@ function normalizePasskeyLinkError(msg) {
|
|
|
9500
9289
|
return msg;
|
|
9501
9290
|
}
|
|
9502
9291
|
function AddProvider() {
|
|
9503
|
-
const qc = (0,
|
|
9292
|
+
const qc = (0, import_react_query16.useQueryClient)();
|
|
9504
9293
|
const { callbacks } = useLumiaPassportConfig();
|
|
9505
9294
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9506
9295
|
const {
|
|
@@ -9660,11 +9449,11 @@ function EmailNotConnectedWarning() {
|
|
|
9660
9449
|
}
|
|
9661
9450
|
|
|
9662
9451
|
// src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts
|
|
9663
|
-
var
|
|
9664
|
-
var
|
|
9452
|
+
var import_react_query17 = require("@tanstack/react-query");
|
|
9453
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
9665
9454
|
init_auth();
|
|
9666
9455
|
function useLinkSocial() {
|
|
9667
|
-
const qc = (0,
|
|
9456
|
+
const qc = (0, import_react_query17.useQueryClient)();
|
|
9668
9457
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9669
9458
|
const {
|
|
9670
9459
|
config: { current: config },
|
|
@@ -9672,7 +9461,7 @@ function useLinkSocial() {
|
|
|
9672
9461
|
} = useLumiaPassportConfig();
|
|
9673
9462
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
9674
9463
|
const { providerType, linkIsLoading, isWalletLinking, setProviderType, setLinkIsLoading, setLinkError } = useManageWalletStore();
|
|
9675
|
-
const handleLinkSocialProvider =
|
|
9464
|
+
const handleLinkSocialProvider = import_react30.default.useCallback(
|
|
9676
9465
|
async (providerIdRaw) => {
|
|
9677
9466
|
const providerKey = providerIdRaw.toLowerCase();
|
|
9678
9467
|
const normalizedKey = providerKey === "twitter" ? "x" : providerKey;
|
|
@@ -9724,8 +9513,8 @@ function useLinkSocial() {
|
|
|
9724
9513
|
},
|
|
9725
9514
|
[config.social?.providers, callbacks]
|
|
9726
9515
|
);
|
|
9727
|
-
const [socialLinkStarted, setSocialLinkStarted] =
|
|
9728
|
-
(0,
|
|
9516
|
+
const [socialLinkStarted, setSocialLinkStarted] = import_react30.default.useState(false);
|
|
9517
|
+
(0, import_react30.useEffect)(() => {
|
|
9729
9518
|
const key = providerType?.toLowerCase();
|
|
9730
9519
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
|
|
9731
9520
|
if (isWalletLinking) {
|
|
@@ -9745,19 +9534,19 @@ function useLinkSocial() {
|
|
|
9745
9534
|
}
|
|
9746
9535
|
|
|
9747
9536
|
// src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts
|
|
9748
|
-
var
|
|
9749
|
-
var
|
|
9537
|
+
var import_react_query18 = require("@tanstack/react-query");
|
|
9538
|
+
var import_react31 = require("react");
|
|
9750
9539
|
init_telegram2();
|
|
9751
9540
|
function useLinkTelegram() {
|
|
9752
9541
|
const {
|
|
9753
9542
|
config: { current: config },
|
|
9754
9543
|
callbacks
|
|
9755
9544
|
} = useLumiaPassportConfig();
|
|
9756
|
-
const qc = (0,
|
|
9545
|
+
const qc = (0, import_react_query18.useQueryClient)();
|
|
9757
9546
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9758
9547
|
const { providerType, linkIsLoading, isWalletLinking, setLinkIsLoading, setProviderType, setLinkError } = useManageWalletStore();
|
|
9759
9548
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
9760
|
-
const handleLinkTelegram = (0,
|
|
9549
|
+
const handleLinkTelegram = (0, import_react31.useCallback)(async () => {
|
|
9761
9550
|
try {
|
|
9762
9551
|
setLinkIsLoading(true);
|
|
9763
9552
|
setLinkError("");
|
|
@@ -9799,8 +9588,8 @@ function useLinkTelegram() {
|
|
|
9799
9588
|
setLinkIsLoading(false);
|
|
9800
9589
|
}
|
|
9801
9590
|
}, [config.social?.providers, callbacks]);
|
|
9802
|
-
const [telegramLinkStarted, setTelegramLinkStarted] = (0,
|
|
9803
|
-
(0,
|
|
9591
|
+
const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react31.useState)(false);
|
|
9592
|
+
(0, import_react31.useEffect)(() => {
|
|
9804
9593
|
console.log("[useLinkTelegram] Effect triggered:", { providerType, linkIsLoading, telegramLinkStarted, isWalletLinking });
|
|
9805
9594
|
if (isWalletLinking) {
|
|
9806
9595
|
console.log("[useLinkTelegram] Skipping - wallet linking in progress");
|
|
@@ -9812,7 +9601,7 @@ function useLinkTelegram() {
|
|
|
9812
9601
|
handleLinkTelegram();
|
|
9813
9602
|
}
|
|
9814
9603
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
|
|
9815
|
-
(0,
|
|
9604
|
+
(0, import_react31.useEffect)(() => {
|
|
9816
9605
|
if (providerType !== "telegram") {
|
|
9817
9606
|
setTelegramLinkStarted(false);
|
|
9818
9607
|
}
|
|
@@ -9920,7 +9709,7 @@ function ManageWalletMenu() {
|
|
|
9920
9709
|
} = useManageWalletStore();
|
|
9921
9710
|
const configuredProviders = getConfiguredProviders(config);
|
|
9922
9711
|
const { data: providers = [], isLoading: isProvidersLoading, error: providersError } = useProvidersList();
|
|
9923
|
-
const renderProviders = (0,
|
|
9712
|
+
const renderProviders = (0, import_react32.useMemo)(() => {
|
|
9924
9713
|
const usedProviders = (0, import_lodash_es3.fromPairs)(providers.map((p) => [p.provider, true]));
|
|
9925
9714
|
const used = [];
|
|
9926
9715
|
const unused = [];
|
|
@@ -10022,19 +9811,19 @@ function ManageWalletMenu() {
|
|
|
10022
9811
|
}
|
|
10023
9812
|
|
|
10024
9813
|
// src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx
|
|
10025
|
-
var
|
|
9814
|
+
var import_react_query19 = require("@tanstack/react-query");
|
|
10026
9815
|
var import_lucide_react31 = require("lucide-react");
|
|
10027
|
-
var
|
|
9816
|
+
var import_react33 = require("react");
|
|
10028
9817
|
init_auth();
|
|
10029
9818
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
10030
9819
|
function UnlinkProviderMenu() {
|
|
10031
|
-
const qc = (0,
|
|
9820
|
+
const qc = (0, import_react_query19.useQueryClient)();
|
|
10032
9821
|
const address = useLumiaPassportSession((st) => st.address);
|
|
10033
9822
|
const { callbacks } = useLumiaPassportConfig();
|
|
10034
9823
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
10035
9824
|
const { confirmUnlink, setConfirmUnlink, setLinkError } = useManageWalletStore();
|
|
10036
|
-
const [confirmInput, setConfirmInput] = (0,
|
|
10037
|
-
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0,
|
|
9825
|
+
const [confirmInput, setConfirmInput] = (0, import_react33.useState)("");
|
|
9826
|
+
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0, import_react_query19.useMutation)({
|
|
10038
9827
|
mutationFn: async () => {
|
|
10039
9828
|
if (!confirmUnlink) {
|
|
10040
9829
|
throw new Error("No provider to unlink");
|
|
@@ -10107,12 +9896,12 @@ function UnlinkProviderMenu() {
|
|
|
10107
9896
|
}
|
|
10108
9897
|
|
|
10109
9898
|
// src/internal/components/PortfolioMenu/PortfolioMenu.tsx
|
|
10110
|
-
var
|
|
9899
|
+
var import_react_query21 = require("@tanstack/react-query");
|
|
10111
9900
|
var import_lucide_react33 = require("lucide-react");
|
|
10112
|
-
var
|
|
9901
|
+
var import_react35 = require("react");
|
|
10113
9902
|
|
|
10114
9903
|
// src/modules/assets.ts
|
|
10115
|
-
var
|
|
9904
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
10116
9905
|
var import_wagmi2 = require("wagmi");
|
|
10117
9906
|
var import_viem4 = require("viem");
|
|
10118
9907
|
init_base();
|
|
@@ -10259,7 +10048,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
10259
10048
|
}
|
|
10260
10049
|
});
|
|
10261
10050
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
10262
|
-
const formattedBalance =
|
|
10051
|
+
const formattedBalance = import_react34.default.useMemo(() => {
|
|
10263
10052
|
if (!balance || !tokenInfo) return "0";
|
|
10264
10053
|
return (0, import_viem4.formatUnits)(balance, tokenInfo.decimals);
|
|
10265
10054
|
}, [balance, tokenInfo]);
|
|
@@ -10273,7 +10062,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
10273
10062
|
}
|
|
10274
10063
|
|
|
10275
10064
|
// src/internal/components/PortfolioMenu/PortfolioItem.tsx
|
|
10276
|
-
var
|
|
10065
|
+
var import_react_query20 = require("@tanstack/react-query");
|
|
10277
10066
|
var import_lucide_react32 = require("lucide-react");
|
|
10278
10067
|
init_base();
|
|
10279
10068
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
@@ -10295,7 +10084,7 @@ function formatValue(price) {
|
|
|
10295
10084
|
function openInExplorer(address) {
|
|
10296
10085
|
window.open(`${LUMIA_EXPLORER_URL}/address/${address}`, "_blank");
|
|
10297
10086
|
}
|
|
10298
|
-
async function
|
|
10087
|
+
async function getAssetRate2(symbol) {
|
|
10299
10088
|
const assetURL = `https://api.binance.com/api/v3/ticker/price?symbol=${symbol.toUpperCase()}USDT`;
|
|
10300
10089
|
const response = await fetch(assetURL);
|
|
10301
10090
|
return await response.json();
|
|
@@ -10304,15 +10093,15 @@ var ASSETS_RATES_QUERY_KEY = "lumia-passport-assets-rates-query-key";
|
|
|
10304
10093
|
function PortfolioItem(props) {
|
|
10305
10094
|
const { address, asset, isProjectAsset } = props;
|
|
10306
10095
|
const { assets: projectAssets, showBalanceAs: showBalanceAsSymbol } = useLumiaPassportConfig().config.current.projectAssets || {};
|
|
10307
|
-
const qc = (0,
|
|
10096
|
+
const qc = (0, import_react_query20.useQueryClient)();
|
|
10308
10097
|
const { balanceQueryKey } = projectAssets?.find((a) => a.symbol === showBalanceAsSymbol) || {};
|
|
10309
10098
|
const projectAssetBalance = !!balanceQueryKey ? qc.getQueryData(balanceQueryKey) : null;
|
|
10310
|
-
const { data: assetRate, isLoading: isRateLoading } = (0,
|
|
10099
|
+
const { data: assetRate, isLoading: isRateLoading } = (0, import_react_query20.useQuery)({
|
|
10311
10100
|
retry: false,
|
|
10312
10101
|
staleTime: 4 * 60 * 1e3,
|
|
10313
10102
|
enabled: !!address && !!asset.symbol && !isProjectAsset,
|
|
10314
10103
|
queryKey: [ASSETS_RATES_QUERY_KEY, address, asset.symbol],
|
|
10315
|
-
queryFn: async () => await
|
|
10104
|
+
queryFn: async () => await getAssetRate2(asset.symbol)
|
|
10316
10105
|
});
|
|
10317
10106
|
const renderBalance = isProjectAsset && projectAssetBalance?.fiatFormatted ? projectAssetBalance.fiatFormatted : asset.formattedBalance;
|
|
10318
10107
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
@@ -10366,18 +10155,18 @@ function PortfolioItem(props) {
|
|
|
10366
10155
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
10367
10156
|
function PortfolioMenu() {
|
|
10368
10157
|
const { assets: projectAssets = [] } = useLumiaPassportConfig().config.current?.projectAssets || {};
|
|
10369
|
-
const qc = (0,
|
|
10158
|
+
const qc = (0, import_react_query21.useQueryClient)();
|
|
10370
10159
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
10371
10160
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
10372
|
-
const assetsContainerListRef = (0,
|
|
10373
|
-
const assetsListRef = (0,
|
|
10161
|
+
const assetsContainerListRef = (0, import_react35.useRef)(null);
|
|
10162
|
+
const assetsListRef = (0, import_react35.useRef)(null);
|
|
10374
10163
|
const address = useLumiaPassportSession((st) => st.address);
|
|
10375
10164
|
const { assets, refreshBalances, isLoading } = useAssets(address);
|
|
10376
|
-
const refreshAllAssetsBalances = (0,
|
|
10165
|
+
const refreshAllAssetsBalances = (0, import_react35.useCallback)(() => {
|
|
10377
10166
|
Promise.all(projectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
10378
10167
|
refreshBalances();
|
|
10379
10168
|
}, [qc, projectAssets, refreshBalances]);
|
|
10380
|
-
(0,
|
|
10169
|
+
(0, import_react35.useEffect)(() => {
|
|
10381
10170
|
if (!assetsContainerListRef.current || !assetsListRef.current) return;
|
|
10382
10171
|
const listTargetHeight = maxScrollHeight - 128;
|
|
10383
10172
|
assetsContainerListRef.current.style.setProperty("--l-pass-scrollbar-mah", `${listTargetHeight}px`);
|
|
@@ -10450,7 +10239,7 @@ function PortfolioMenu() {
|
|
|
10450
10239
|
|
|
10451
10240
|
// src/internal/components/SecurityMenu/SecurityMenu.tsx
|
|
10452
10241
|
var import_lucide_react34 = require("lucide-react");
|
|
10453
|
-
var
|
|
10242
|
+
var import_react36 = require("react");
|
|
10454
10243
|
init_auth();
|
|
10455
10244
|
init_keyshare();
|
|
10456
10245
|
init_vaultClient();
|
|
@@ -10462,18 +10251,18 @@ function SecurityMenu() {
|
|
|
10462
10251
|
const userId = import_auth3.jwtTokenManager.getUserId();
|
|
10463
10252
|
const serverHasKeyshare = import_auth3.jwtTokenManager.getHasKeyshare() ?? false;
|
|
10464
10253
|
const backup = userId ? getBackupStatus(userId) : { server: { enabled: false }, cloud: { enabled: false }, local: { enabled: false } };
|
|
10465
|
-
const [isRefreshing, setIsRefreshing] = (0,
|
|
10466
|
-
const [localInfo, setLocalInfo] = (0,
|
|
10467
|
-
const [recoveryCreatedAt, setRecoveryCreatedAt] = (0,
|
|
10468
|
-
const [recoveryBrowser, setRecoveryBrowser] = (0,
|
|
10469
|
-
const [recoveryUa, setRecoveryUa] = (0,
|
|
10470
|
-
const [recoveryDeviceId, setRecoveryDeviceId] = (0,
|
|
10471
|
-
const [recoveryDeviceName, setRecoveryDeviceName] = (0,
|
|
10472
|
-
const [recoveryCountry, setRecoveryCountry] = (0,
|
|
10473
|
-
const [hasServerBackup, setHasServerBackup] = (0,
|
|
10474
|
-
const [trustedApps, setTrustedApps] = (0,
|
|
10475
|
-
const [appToRemove, setAppToRemove] = (0,
|
|
10476
|
-
const fetchRecovery = (0,
|
|
10254
|
+
const [isRefreshing, setIsRefreshing] = (0, import_react36.useState)(false);
|
|
10255
|
+
const [localInfo, setLocalInfo] = (0, import_react36.useState)(null);
|
|
10256
|
+
const [recoveryCreatedAt, setRecoveryCreatedAt] = (0, import_react36.useState)(null);
|
|
10257
|
+
const [recoveryBrowser, setRecoveryBrowser] = (0, import_react36.useState)(null);
|
|
10258
|
+
const [recoveryUa, setRecoveryUa] = (0, import_react36.useState)(null);
|
|
10259
|
+
const [recoveryDeviceId, setRecoveryDeviceId] = (0, import_react36.useState)(null);
|
|
10260
|
+
const [recoveryDeviceName, setRecoveryDeviceName] = (0, import_react36.useState)(null);
|
|
10261
|
+
const [recoveryCountry, setRecoveryCountry] = (0, import_react36.useState)(null);
|
|
10262
|
+
const [hasServerBackup, setHasServerBackup] = (0, import_react36.useState)(false);
|
|
10263
|
+
const [trustedApps, setTrustedApps] = (0, import_react36.useState)([]);
|
|
10264
|
+
const [appToRemove, setAppToRemove] = (0, import_react36.useState)(null);
|
|
10265
|
+
const fetchRecovery = (0, import_react36.useCallback)(async () => {
|
|
10477
10266
|
if (!userId) return;
|
|
10478
10267
|
try {
|
|
10479
10268
|
setIsRefreshing(true);
|
|
@@ -10506,7 +10295,7 @@ function SecurityMenu() {
|
|
|
10506
10295
|
setIsRefreshing(false);
|
|
10507
10296
|
}
|
|
10508
10297
|
}, [userId]);
|
|
10509
|
-
(0,
|
|
10298
|
+
(0, import_react36.useEffect)(() => {
|
|
10510
10299
|
if (open) fetchRecovery();
|
|
10511
10300
|
}, [open, fetchRecovery]);
|
|
10512
10301
|
const parseOS = (ua) => {
|
|
@@ -10698,21 +10487,21 @@ function SecurityMenu() {
|
|
|
10698
10487
|
|
|
10699
10488
|
// src/internal/components/SendRecieveMenu/SendLumiaMenu.tsx
|
|
10700
10489
|
var import_lucide_react35 = require("lucide-react");
|
|
10701
|
-
var
|
|
10490
|
+
var import_react38 = require("react");
|
|
10702
10491
|
var import_viem6 = require("viem");
|
|
10703
10492
|
var import_wagmi3 = require("wagmi");
|
|
10704
10493
|
|
|
10705
10494
|
// src/hooks/useSendTransaction.ts
|
|
10706
|
-
var
|
|
10495
|
+
var import_react37 = require("react");
|
|
10707
10496
|
var import_viem5 = require("viem");
|
|
10708
10497
|
init_account();
|
|
10709
10498
|
function useSendTransaction() {
|
|
10710
10499
|
const session = useLumiaPassportSession((st) => st.session);
|
|
10711
10500
|
const address = useLumiaPassportSession((st) => st.address);
|
|
10712
|
-
const [isLoading, setIsLoading] = (0,
|
|
10713
|
-
const [error, setError] = (0,
|
|
10714
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
10715
|
-
const sendTransaction = (0,
|
|
10501
|
+
const [isLoading, setIsLoading] = (0, import_react37.useState)(false);
|
|
10502
|
+
const [error, setError] = (0, import_react37.useState)(null);
|
|
10503
|
+
const [userOpHash, setUserOpHash] = (0, import_react37.useState)(null);
|
|
10504
|
+
const sendTransaction = (0, import_react37.useCallback)(
|
|
10716
10505
|
async (params) => {
|
|
10717
10506
|
if (!session || !address) {
|
|
10718
10507
|
setError("No active session");
|
|
@@ -10752,7 +10541,7 @@ function useSendTransaction() {
|
|
|
10752
10541
|
},
|
|
10753
10542
|
[session, address]
|
|
10754
10543
|
);
|
|
10755
|
-
const reset = (0,
|
|
10544
|
+
const reset = (0, import_react37.useCallback)(() => {
|
|
10756
10545
|
setError(null);
|
|
10757
10546
|
setUserOpHash(null);
|
|
10758
10547
|
setIsLoading(false);
|
|
@@ -10780,13 +10569,13 @@ function SendLumiaMenu() {
|
|
|
10780
10569
|
address,
|
|
10781
10570
|
chainId: lumiaBeam.id
|
|
10782
10571
|
});
|
|
10783
|
-
const [recipient, setRecipient] = (0,
|
|
10784
|
-
const [amount, setAmount] = (0,
|
|
10785
|
-
const [txStep, setTxStep] = (0,
|
|
10786
|
-
const [validationError, setValidationError] = (0,
|
|
10572
|
+
const [recipient, setRecipient] = (0, import_react38.useState)("");
|
|
10573
|
+
const [amount, setAmount] = (0, import_react38.useState)("");
|
|
10574
|
+
const [txStep, setTxStep] = (0, import_react38.useState)("input");
|
|
10575
|
+
const [validationError, setValidationError] = (0, import_react38.useState)(null);
|
|
10787
10576
|
const nativeAsset = assets.find((a) => a.type === "native");
|
|
10788
10577
|
const balance = nativeAsset ? parseFloat(nativeAsset.formattedBalance) : 0;
|
|
10789
|
-
(0,
|
|
10578
|
+
(0, import_react38.useEffect)(() => {
|
|
10790
10579
|
if (open) {
|
|
10791
10580
|
setTxStep("input");
|
|
10792
10581
|
setValidationError(null);
|
|
@@ -10950,7 +10739,7 @@ function SendLumiaMenu() {
|
|
|
10950
10739
|
// src/internal/components/SendRecieveMenu/ReceiveLumiaMenu.tsx
|
|
10951
10740
|
var import_lucide_react36 = require("lucide-react");
|
|
10952
10741
|
var import_qrcode = __toESM(require("qrcode"), 1);
|
|
10953
|
-
var
|
|
10742
|
+
var import_react39 = require("react");
|
|
10954
10743
|
init_clients();
|
|
10955
10744
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
10956
10745
|
function ReceiveLumiaMenu() {
|
|
@@ -10959,9 +10748,9 @@ function ReceiveLumiaMenu() {
|
|
|
10959
10748
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
10960
10749
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
10961
10750
|
const open = page === "receive";
|
|
10962
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
10963
|
-
const [copied, setCopied] = (0,
|
|
10964
|
-
(0,
|
|
10751
|
+
const [qrCodeUrl, setQrCodeUrl] = (0, import_react39.useState)("");
|
|
10752
|
+
const [copied, setCopied] = (0, import_react39.useState)(false);
|
|
10753
|
+
(0, import_react39.useEffect)(() => {
|
|
10965
10754
|
if (open && address) {
|
|
10966
10755
|
import_qrcode.default.toDataURL(address, {
|
|
10967
10756
|
width: 200,
|
|
@@ -10974,7 +10763,7 @@ function ReceiveLumiaMenu() {
|
|
|
10974
10763
|
});
|
|
10975
10764
|
}
|
|
10976
10765
|
}, [open, address]);
|
|
10977
|
-
const handleCopy = (0,
|
|
10766
|
+
const handleCopy = (0, import_react39.useCallback)(async () => {
|
|
10978
10767
|
if (!address) return;
|
|
10979
10768
|
try {
|
|
10980
10769
|
await navigator.clipboard.writeText(address);
|
|
@@ -11020,7 +10809,7 @@ function ReceiveLumiaMenu() {
|
|
|
11020
10809
|
|
|
11021
10810
|
// src/internal/components/SettingsMenu/SettingsMenu.tsx
|
|
11022
10811
|
var import_lucide_react38 = require("lucide-react");
|
|
11023
|
-
var
|
|
10812
|
+
var import_react40 = require("react");
|
|
11024
10813
|
|
|
11025
10814
|
// src/internal/components/SettingsMenu/constants.ts
|
|
11026
10815
|
var import_lucide_react37 = require("lucide-react");
|
|
@@ -11054,7 +10843,7 @@ function SettingsMenu() {
|
|
|
11054
10843
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11055
10844
|
const settingsNotifications = useLayoutDataStore((st) => st.settingsNotifications);
|
|
11056
10845
|
const setMainPageHeight = useLayoutDataStore((st) => st.setMainPageHeight);
|
|
11057
|
-
(0,
|
|
10846
|
+
(0, import_react40.useEffect)(() => setMainPageHeight(DEFAULT_SETTINGS_MENU_HEIGHT), [setMainPageHeight]);
|
|
11058
10847
|
const navItems = NAV_BUTTONS.map((el) => ({ ...el, onClick: () => setPage(el.id) }));
|
|
11059
10848
|
const highlightedKeys = settingsNotifications.map((n) => n.target);
|
|
11060
10849
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "w-full p-[var(--l-pass-pd)] flex flex-col gap-[var(--l-pass-gap)]", children: [
|
|
@@ -11112,9 +10901,9 @@ function TermsOfService() {
|
|
|
11112
10901
|
}
|
|
11113
10902
|
|
|
11114
10903
|
// src/internal/components/TransactionsMenu/TransactionsMenu.tsx
|
|
11115
|
-
var
|
|
10904
|
+
var import_react_query22 = require("@tanstack/react-query");
|
|
11116
10905
|
var import_lucide_react41 = require("lucide-react");
|
|
11117
|
-
var
|
|
10906
|
+
var import_react41 = require("react");
|
|
11118
10907
|
|
|
11119
10908
|
// src/internal/components/TransactionsMenu/api.ts
|
|
11120
10909
|
init_base();
|
|
@@ -11590,31 +11379,31 @@ function TransactionsGroup(props) {
|
|
|
11590
11379
|
// src/internal/components/TransactionsMenu/TransactionsMenu.tsx
|
|
11591
11380
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
11592
11381
|
function TransactionsMenu() {
|
|
11593
|
-
const qc = (0,
|
|
11382
|
+
const qc = (0, import_react_query22.useQueryClient)();
|
|
11594
11383
|
const address = useLumiaPassportSession((st) => st.address);
|
|
11595
11384
|
const page = useLayoutDataStore((st) => st.page);
|
|
11596
11385
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11597
11386
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11598
|
-
const txContainerListRef = (0,
|
|
11599
|
-
const txListRef = (0,
|
|
11600
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
11387
|
+
const txContainerListRef = (0, import_react41.useRef)(null);
|
|
11388
|
+
const txListRef = (0, import_react41.useRef)(null);
|
|
11389
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react41.useState)({});
|
|
11601
11390
|
const {
|
|
11602
11391
|
data: txHistoryGroups = [],
|
|
11603
11392
|
isLoading: isTxHistoryLoading,
|
|
11604
11393
|
isFetching: isTxHistoryFetching,
|
|
11605
11394
|
error: txHistoryError
|
|
11606
|
-
} = (0,
|
|
11395
|
+
} = (0, import_react_query22.useQuery)({
|
|
11607
11396
|
retry: false,
|
|
11608
11397
|
enabled: !!address && page === "transactions",
|
|
11609
11398
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, address],
|
|
11610
11399
|
queryFn: () => getTransactionsListQuery(address)
|
|
11611
11400
|
});
|
|
11612
|
-
const refreshTxHistory = (0,
|
|
11401
|
+
const refreshTxHistory = (0, import_react41.useCallback)(
|
|
11613
11402
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, address] }),
|
|
11614
11403
|
[qc, address]
|
|
11615
11404
|
);
|
|
11616
11405
|
const txHistoryResolvedError = txHistoryError ? txHistoryError instanceof Error ? txHistoryError.message : "Failed to load transactions" : null;
|
|
11617
|
-
(0,
|
|
11406
|
+
(0, import_react41.useEffect)(() => {
|
|
11618
11407
|
if (!txContainerListRef.current || !txListRef.current) return;
|
|
11619
11408
|
const listTargetHeight = maxScrollHeight - 128;
|
|
11620
11409
|
txContainerListRef.current.style.setProperty("--l-pass-scrollbar-mah", `${listTargetHeight}px`);
|
|
@@ -11785,7 +11574,7 @@ function usePageMapper() {
|
|
|
11785
11574
|
setIsDialogOpen,
|
|
11786
11575
|
setIsDialogClosing
|
|
11787
11576
|
} = useLayoutStore();
|
|
11788
|
-
const closeDialog = (0,
|
|
11577
|
+
const closeDialog = (0, import_react42.useCallback)(() => {
|
|
11789
11578
|
setIsDialogClosing(true);
|
|
11790
11579
|
setTimeout(() => {
|
|
11791
11580
|
setDialogContent(null);
|
|
@@ -11796,7 +11585,7 @@ function usePageMapper() {
|
|
|
11796
11585
|
setIsDialogOpen(false);
|
|
11797
11586
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
11798
11587
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
11799
|
-
const openDialog = (0,
|
|
11588
|
+
const openDialog = (0, import_react42.useCallback)(
|
|
11800
11589
|
(pageItem) => {
|
|
11801
11590
|
const PageContentComponent = pageItem.component;
|
|
11802
11591
|
setDialogTitle(pageItem.title);
|
|
@@ -11806,7 +11595,7 @@ function usePageMapper() {
|
|
|
11806
11595
|
},
|
|
11807
11596
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
11808
11597
|
);
|
|
11809
|
-
(0,
|
|
11598
|
+
(0, import_react42.useEffect)(() => {
|
|
11810
11599
|
if (page === null) return closeDialog();
|
|
11811
11600
|
const pageItem = protectedRoutes[page];
|
|
11812
11601
|
if (!pageItem) {
|
|
@@ -11819,7 +11608,7 @@ function usePageMapper() {
|
|
|
11819
11608
|
}
|
|
11820
11609
|
|
|
11821
11610
|
// src/internal/hooks/useSettingsNotifications.ts
|
|
11822
|
-
var
|
|
11611
|
+
var import_react43 = require("react");
|
|
11823
11612
|
init_auth();
|
|
11824
11613
|
var EMAIL_NOT_CONNECTED_NOTIFICATION = {
|
|
11825
11614
|
id: "email-not-connected",
|
|
@@ -11836,13 +11625,13 @@ function useSettingsNotifications() {
|
|
|
11836
11625
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
11837
11626
|
const providers = import_auth3.jwtTokenManager.getProviders();
|
|
11838
11627
|
const hasEmail = providers.includes("email");
|
|
11839
|
-
(0,
|
|
11628
|
+
(0, import_react43.useEffect)(() => {
|
|
11840
11629
|
setSettingsNotifications({
|
|
11841
11630
|
...BACKUP_IS_NOT_CREATED_NOTIFICATION,
|
|
11842
11631
|
status: hasServerVault ? "resolved" : "active"
|
|
11843
11632
|
});
|
|
11844
11633
|
}, [hasServerVault, setSettingsNotifications]);
|
|
11845
|
-
(0,
|
|
11634
|
+
(0, import_react43.useEffect)(() => {
|
|
11846
11635
|
setSettingsNotifications({
|
|
11847
11636
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
11848
11637
|
status: hasEmail ? "resolved" : "active"
|
|
@@ -11851,7 +11640,7 @@ function useSettingsNotifications() {
|
|
|
11851
11640
|
}
|
|
11852
11641
|
|
|
11853
11642
|
// src/internal/hooks/useWalletStatus.ts
|
|
11854
|
-
var
|
|
11643
|
+
var import_react44 = require("react");
|
|
11855
11644
|
init_auth();
|
|
11856
11645
|
function useWalletStatus() {
|
|
11857
11646
|
const isIframeReady = useLumiaPassportSession((st) => st.isIframeReady);
|
|
@@ -11861,7 +11650,7 @@ function useWalletStatus() {
|
|
|
11861
11650
|
config: { current: config },
|
|
11862
11651
|
callbacks
|
|
11863
11652
|
} = useLumiaPassportConfig();
|
|
11864
|
-
(0,
|
|
11653
|
+
(0, import_react44.useEffect)(() => {
|
|
11865
11654
|
if (!isIframeReady || !config.projectId || !callbacks?.onWalletReady) return;
|
|
11866
11655
|
const userId = import_auth3.jwtTokenManager.getUserId();
|
|
11867
11656
|
const hasKeyshare = import_auth3.jwtTokenManager.getHasKeyshare();
|
|
@@ -11890,7 +11679,7 @@ function LumiaPassportDialog() {
|
|
|
11890
11679
|
const mainPageHeight = useLayoutDataStore((st) => st.mainPageHeight);
|
|
11891
11680
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11892
11681
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
11893
|
-
(0,
|
|
11682
|
+
(0, import_react45.useEffect)(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
11894
11683
|
usePageMapper();
|
|
11895
11684
|
useAutoConnect();
|
|
11896
11685
|
useCheckVaultStatus();
|
|
@@ -11929,23 +11718,23 @@ function LumiaPassportDialog() {
|
|
|
11929
11718
|
}
|
|
11930
11719
|
|
|
11931
11720
|
// src/internal/components/TssManager.tsx
|
|
11932
|
-
var
|
|
11721
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
11933
11722
|
init_auth();
|
|
11934
11723
|
init_clients();
|
|
11935
|
-
var TssManagerWithRef =
|
|
11724
|
+
var TssManagerWithRef = import_react46.default.forwardRef((props, ref) => {
|
|
11936
11725
|
const { mpcPin } = props;
|
|
11937
11726
|
const usePaymaster = useLumiaPassportSession((st) => st.usePaymaster);
|
|
11938
11727
|
const setStatus = useLumiaPassportSession((st) => st.setStatus);
|
|
11939
11728
|
const setSession = useLumiaPassportSession((st) => st.setSession);
|
|
11940
11729
|
const setAddress = useLumiaPassportSession((st) => st.setAddress);
|
|
11941
|
-
const onSessionCreated = (0,
|
|
11730
|
+
const onSessionCreated = (0, import_react46.useCallback)(
|
|
11942
11731
|
(session, address) => {
|
|
11943
11732
|
setSession(session);
|
|
11944
11733
|
setAddress(address);
|
|
11945
11734
|
},
|
|
11946
11735
|
[setSession, setAddress]
|
|
11947
11736
|
);
|
|
11948
|
-
const createSessionWithKeyshare =
|
|
11737
|
+
const createSessionWithKeyshare = import_react46.default.useCallback(
|
|
11949
11738
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
11950
11739
|
setStatus("checking key management setup...");
|
|
11951
11740
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -11966,18 +11755,18 @@ var TssManagerWithRef = import_react47.default.forwardRef((props, ref) => {
|
|
|
11966
11755
|
},
|
|
11967
11756
|
[setStatus, usePaymaster, mpcPin]
|
|
11968
11757
|
);
|
|
11969
|
-
|
|
11758
|
+
import_react46.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
11970
11759
|
return null;
|
|
11971
11760
|
});
|
|
11972
11761
|
|
|
11973
11762
|
// src/internal/components/WalletConnectHandler.tsx
|
|
11974
11763
|
var import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
11975
|
-
var
|
|
11976
|
-
var
|
|
11764
|
+
var import_react_query23 = require("@tanstack/react-query");
|
|
11765
|
+
var import_react47 = __toESM(require("react"), 1);
|
|
11977
11766
|
var import_wagmi4 = require("wagmi");
|
|
11978
11767
|
init_wallet();
|
|
11979
11768
|
function WalletConnectHandler() {
|
|
11980
|
-
const qc = (0,
|
|
11769
|
+
const qc = (0, import_react_query23.useQueryClient)();
|
|
11981
11770
|
const { callbacks } = useLumiaPassportConfig();
|
|
11982
11771
|
const userAddress = useLumiaPassportSession((st) => st.address);
|
|
11983
11772
|
const { address: walletAddress, isConnected, chain, connector } = (0, import_wagmi4.useAccount)();
|
|
@@ -11985,12 +11774,12 @@ function WalletConnectHandler() {
|
|
|
11985
11774
|
const { signMessageAsync } = (0, import_wagmi4.useSignMessage)();
|
|
11986
11775
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11987
11776
|
const { isWalletLinking, setLinkError, setIsWalletLinking, setLinkIsLoading, setProviderType } = useManageWalletStore();
|
|
11988
|
-
const onError = (0,
|
|
11777
|
+
const onError = (0, import_react47.useCallback)((error) => {
|
|
11989
11778
|
setLinkError(error);
|
|
11990
11779
|
setIsWalletLinking(false);
|
|
11991
11780
|
setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
11992
11781
|
}, []);
|
|
11993
|
-
const onLinkingComplete = (0,
|
|
11782
|
+
const onLinkingComplete = (0, import_react47.useCallback)(
|
|
11994
11783
|
async (success) => {
|
|
11995
11784
|
console.log("[WalletConnectHandler] onLinkingComplete called:", { success, userAddress });
|
|
11996
11785
|
setIsWalletLinking(false);
|
|
@@ -12013,9 +11802,9 @@ function WalletConnectHandler() {
|
|
|
12013
11802
|
[qc, userAddress, callbacks, setProviderType, setPage, setIsWalletLinking]
|
|
12014
11803
|
);
|
|
12015
11804
|
const { openConnectModal, connectModalOpen } = (0, import_rainbowkit.useConnectModal)();
|
|
12016
|
-
const [hasStartedLinking, setHasStartedLinking] =
|
|
12017
|
-
const timeoutRef =
|
|
12018
|
-
(0,
|
|
11805
|
+
const [hasStartedLinking, setHasStartedLinking] = import_react47.default.useState(false);
|
|
11806
|
+
const timeoutRef = import_react47.default.useRef();
|
|
11807
|
+
(0, import_react47.useEffect)(() => {
|
|
12019
11808
|
if (isWalletLinking && !hasStartedLinking) {
|
|
12020
11809
|
setHasStartedLinking(true);
|
|
12021
11810
|
setProviderType(null);
|
|
@@ -12040,7 +11829,7 @@ function WalletConnectHandler() {
|
|
|
12040
11829
|
if (isConnected) disconnect();
|
|
12041
11830
|
}
|
|
12042
11831
|
}, [isWalletLinking, hasStartedLinking, isConnected, openConnectModal, disconnect, setPage, setProviderType]);
|
|
12043
|
-
(0,
|
|
11832
|
+
(0, import_react47.useEffect)(() => {
|
|
12044
11833
|
console.log("[WalletConnectHandler] Modal state check:", {
|
|
12045
11834
|
hasStartedLinking,
|
|
12046
11835
|
connectModalOpen,
|
|
@@ -12053,7 +11842,7 @@ function WalletConnectHandler() {
|
|
|
12053
11842
|
setHasStartedLinking(false);
|
|
12054
11843
|
}
|
|
12055
11844
|
}, [connectModalOpen, hasStartedLinking, isConnected, isWalletLinking]);
|
|
12056
|
-
(0,
|
|
11845
|
+
(0, import_react47.useEffect)(() => {
|
|
12057
11846
|
if (isConnected && walletAddress && isWalletLinking && hasStartedLinking) {
|
|
12058
11847
|
handleWalletSign();
|
|
12059
11848
|
}
|
|
@@ -12138,12 +11927,10 @@ var useLumiaPassportSession = (0, import_zustand5.create)((set) => ({
|
|
|
12138
11927
|
setWalletReadyStatus: (status) => set({ walletReadyStatus: status })
|
|
12139
11928
|
}));
|
|
12140
11929
|
function LumiaPassportSessionProvider({ children }) {
|
|
12141
|
-
const
|
|
12142
|
-
|
|
12143
|
-
} = useLumiaPassportConfig();
|
|
12144
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react49.Fragment, { children: [
|
|
11930
|
+
const config = useLumiaPassportConfig().config;
|
|
11931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react48.Fragment, { children: [
|
|
12145
11932
|
children,
|
|
12146
|
-
config.wallet?.enabled && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(WalletConnectHandler, {}),
|
|
11933
|
+
config.current?.wallet?.enabled && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(WalletConnectHandler, {}),
|
|
12147
11934
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(BalanceFeedProvider, {}),
|
|
12148
11935
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
12149
11936
|
TssManagerWithRef,
|
|
@@ -12193,14 +11980,14 @@ var LumiaWagmiProvider = ({ children }) => {
|
|
|
12193
11980
|
|
|
12194
11981
|
// src/context/LumiaPassportContext.tsx
|
|
12195
11982
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
12196
|
-
var LumiaPassportContext = (0,
|
|
11983
|
+
var LumiaPassportContext = (0, import_react49.createContext)(void 0);
|
|
12197
11984
|
function LumiaPassportProvider(props) {
|
|
12198
11985
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
12199
11986
|
const setIsIframeReady = useLumiaPassportSession((st) => st.setIsIframeReady);
|
|
12200
11987
|
const setWalletReadyStatus = useLumiaPassportSession((st) => st.setWalletReadyStatus);
|
|
12201
|
-
(0,
|
|
12202
|
-
const config = (0,
|
|
12203
|
-
const updateConfig = (0,
|
|
11988
|
+
(0, import_react49.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
11989
|
+
const config = (0, import_react49.useRef)({ projectId, ...DEFAULT_LUMIA_PASSPORT_CONFIG });
|
|
11990
|
+
const updateConfig = (0, import_react49.useCallback)((updates) => {
|
|
12204
11991
|
const prev = config.current;
|
|
12205
11992
|
const next = { ...prev };
|
|
12206
11993
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -12235,7 +12022,7 @@ function LumiaPassportProvider(props) {
|
|
|
12235
12022
|
}
|
|
12236
12023
|
config.current = next;
|
|
12237
12024
|
}, []);
|
|
12238
|
-
(0,
|
|
12025
|
+
(0, import_react49.useEffect)(() => {
|
|
12239
12026
|
if (typeof window === "undefined" || !projectId) return;
|
|
12240
12027
|
const mergedConfig = (0, import_lodash_es4.merge)(DEFAULT_LUMIA_PASSPORT_CONFIG, initialConfig);
|
|
12241
12028
|
updateConfig(mergedConfig);
|
|
@@ -12280,18 +12067,18 @@ function LumiaPassportProvider(props) {
|
|
|
12280
12067
|
console.error("[LumiaPassport] Error setting up iframe manager:", error);
|
|
12281
12068
|
}
|
|
12282
12069
|
}, [projectId, initialConfig, callbacks, updateConfig, setIsIframeReady, setWalletReadyStatus]);
|
|
12283
|
-
const contextValue = (0,
|
|
12070
|
+
const contextValue = (0, import_react49.useMemo)(() => ({ config, updateConfig, callbacks }), [config, updateConfig, callbacks]);
|
|
12284
12071
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(LumiaWagmiProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(LumiaPassportContext.Provider, { value: contextValue, children }) });
|
|
12285
12072
|
}
|
|
12286
12073
|
var useLumiaPassportConfig = () => {
|
|
12287
|
-
const ctx = (0,
|
|
12074
|
+
const ctx = (0, import_react49.useContext)(LumiaPassportContext);
|
|
12288
12075
|
if (!ctx) throw new Error("useLumiaPassportConfig must be used within a LumiaPassportProvider");
|
|
12289
12076
|
return ctx;
|
|
12290
12077
|
};
|
|
12291
12078
|
|
|
12292
12079
|
// src/components/ConnectWalletButton.tsx
|
|
12293
12080
|
var import_lucide_react42 = require("lucide-react");
|
|
12294
|
-
var
|
|
12081
|
+
var import_react50 = require("react");
|
|
12295
12082
|
init_auth();
|
|
12296
12083
|
var import_jsx_runtime65 = (
|
|
12297
12084
|
/** external Buttons can be provided */
|
|
@@ -12314,10 +12101,10 @@ function ConnectWalletButton(props) {
|
|
|
12314
12101
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
12315
12102
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useLumiaPassportSession();
|
|
12316
12103
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
12317
|
-
(0,
|
|
12104
|
+
(0, import_react50.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
12318
12105
|
const avatar = import_auth3.jwtTokenManager.getAvatar();
|
|
12319
12106
|
const displayName = import_auth3.jwtTokenManager.getDisplayName();
|
|
12320
|
-
const indicators = (0,
|
|
12107
|
+
const indicators = (0, import_react50.useMemo)(() => {
|
|
12321
12108
|
const userId = import_auth3.jwtTokenManager.getUserId();
|
|
12322
12109
|
if (!userId) return { server: false, local: false, backup: false };
|
|
12323
12110
|
const server = import_auth3.jwtTokenManager.getHasKeyshare() ?? false;
|
|
@@ -12448,6 +12235,9 @@ function ConnectWalletButton(props) {
|
|
|
12448
12235
|
}
|
|
12449
12236
|
|
|
12450
12237
|
// src/hooks/childAppHooks.ts
|
|
12238
|
+
var useLumiaPassportIsMobileView = () => {
|
|
12239
|
+
return useLayoutStore((st) => st.isMobileView);
|
|
12240
|
+
};
|
|
12451
12241
|
var useLumiaPassportBalance = () => {
|
|
12452
12242
|
const walletBalance = useLayoutDataStore((st) => st.balance);
|
|
12453
12243
|
const fiatBalance = useLayoutDataStore((st) => st.fiatBalance);
|
|
@@ -12469,13 +12259,13 @@ var useLumiaPassportRecoveryUserId = () => useLumiaPassportSession((st) => st.re
|
|
|
12469
12259
|
var useLumiaPassportHasServerVault = () => useLumiaPassportSession((st) => st.hasServerVault);
|
|
12470
12260
|
|
|
12471
12261
|
// src/hooks/useLumiaPassportOpen.ts
|
|
12472
|
-
var
|
|
12262
|
+
var import_react51 = require("react");
|
|
12473
12263
|
function useLumiaPassportOpen() {
|
|
12474
12264
|
const page = useLayoutDataStore((st) => st.page);
|
|
12475
12265
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
12476
12266
|
const setPageParams = useLayoutDataStore((st) => st.setPageParams);
|
|
12477
12267
|
const address = useLumiaPassportSession((st) => st.address);
|
|
12478
|
-
const open = (0,
|
|
12268
|
+
const open = (0, import_react51.useCallback)(
|
|
12479
12269
|
(passportPage, params) => {
|
|
12480
12270
|
if (!address) return setPage("auth" /* AUTH */);
|
|
12481
12271
|
if (!!address && passportPage === "auth" /* AUTH */) return setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
@@ -12484,12 +12274,12 @@ function useLumiaPassportOpen() {
|
|
|
12484
12274
|
},
|
|
12485
12275
|
[setPage, setPageParams, address]
|
|
12486
12276
|
);
|
|
12487
|
-
const close = (0,
|
|
12277
|
+
const close = (0, import_react51.useCallback)(() => setPage(null), [setPage]);
|
|
12488
12278
|
return { open, close, isOpen: page !== null };
|
|
12489
12279
|
}
|
|
12490
12280
|
|
|
12491
12281
|
// src/hooks/useLumiaPassportColorMode.ts
|
|
12492
|
-
var
|
|
12282
|
+
var import_react52 = require("react");
|
|
12493
12283
|
function useLumiaPassportColorMode() {
|
|
12494
12284
|
const {
|
|
12495
12285
|
config: { current: config }
|
|
@@ -12497,14 +12287,14 @@ function useLumiaPassportColorMode() {
|
|
|
12497
12287
|
const preferedColorMode = config?.preferedColorMode;
|
|
12498
12288
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
12499
12289
|
const handleStoreColorMode = useLayoutStore((st) => st.setColorMode);
|
|
12500
|
-
const setColorMode = (0,
|
|
12290
|
+
const setColorMode = (0, import_react52.useCallback)(
|
|
12501
12291
|
(mode) => {
|
|
12502
12292
|
localStorage.setItem(LOCAL_COLOR_MODE_KEY, mode);
|
|
12503
12293
|
handleStoreColorMode(mode);
|
|
12504
12294
|
},
|
|
12505
12295
|
[handleStoreColorMode]
|
|
12506
12296
|
);
|
|
12507
|
-
(0,
|
|
12297
|
+
(0, import_react52.useEffect)(() => {
|
|
12508
12298
|
let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
|
|
12509
12299
|
if (!targetColorMode && !preferedColorMode) {
|
|
12510
12300
|
const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -12546,7 +12336,7 @@ function ThemeToggle(props) {
|
|
|
12546
12336
|
}
|
|
12547
12337
|
|
|
12548
12338
|
// src/context/RainbowKitContext.tsx
|
|
12549
|
-
var
|
|
12339
|
+
var import_react53 = __toESM(require("react"), 1);
|
|
12550
12340
|
var import_styles = require("@rainbow-me/rainbowkit/styles.css");
|
|
12551
12341
|
var import_rainbowkit3 = require("@rainbow-me/rainbowkit");
|
|
12552
12342
|
var import_wagmi8 = require("wagmi");
|
|
@@ -12693,10 +12483,10 @@ var LumiaRainbowKitProvider = ({ children }) => {
|
|
|
12693
12483
|
config: { current: config }
|
|
12694
12484
|
} = useLumiaPassportConfig();
|
|
12695
12485
|
const isDark = useLayoutStore((st) => st.colorMode === "dark");
|
|
12696
|
-
const rainbowConfig2 =
|
|
12486
|
+
const rainbowConfig2 = import_react53.default.useMemo(() => {
|
|
12697
12487
|
return createRainbowConfig(config.wallet?.walletConnectProjectId);
|
|
12698
12488
|
}, [config.wallet?.walletConnectProjectId]);
|
|
12699
|
-
const customTheme =
|
|
12489
|
+
const customTheme = import_react53.default.useMemo(
|
|
12700
12490
|
() => isDark ? {
|
|
12701
12491
|
...(0, import_rainbowkit3.darkTheme)(),
|
|
12702
12492
|
colors: {
|
|
@@ -13157,14 +12947,14 @@ var Hash = ({
|
|
|
13157
12947
|
};
|
|
13158
12948
|
|
|
13159
12949
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
13160
|
-
var
|
|
12950
|
+
var import_react54 = require("react");
|
|
13161
12951
|
init_base();
|
|
13162
12952
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13163
12953
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
13164
|
-
const [transactions, setTransactions] = (0,
|
|
13165
|
-
const [loading, setLoading] = (0,
|
|
13166
|
-
const [error, setError] = (0,
|
|
13167
|
-
(0,
|
|
12954
|
+
const [transactions, setTransactions] = (0, import_react54.useState)([]);
|
|
12955
|
+
const [loading, setLoading] = (0, import_react54.useState)(true);
|
|
12956
|
+
const [error, setError] = (0, import_react54.useState)(null);
|
|
12957
|
+
(0, import_react54.useEffect)(() => {
|
|
13168
12958
|
const fetchTransactions = async () => {
|
|
13169
12959
|
try {
|
|
13170
12960
|
setLoading(true);
|
|
@@ -13466,11 +13256,11 @@ function useUserOpStatus(options = {}) {
|
|
|
13466
13256
|
|
|
13467
13257
|
// src/hooks/useLogout.ts
|
|
13468
13258
|
var import_auth20 = require("@lumiapassport/core/auth");
|
|
13469
|
-
var
|
|
13259
|
+
var import_react55 = require("react");
|
|
13470
13260
|
function useLogout() {
|
|
13471
13261
|
const { setSession, setIsLoading, setAddress, setStatus, setError, address } = useLumiaPassportSession();
|
|
13472
13262
|
const { callbacks } = useLumiaPassportConfig();
|
|
13473
|
-
const logout2 = (0,
|
|
13263
|
+
const logout2 = (0, import_react55.useCallback)(async () => {
|
|
13474
13264
|
const prevAddress = address;
|
|
13475
13265
|
let userId = null;
|
|
13476
13266
|
setIsLoading(true);
|
|
@@ -13672,6 +13462,7 @@ init_iframe_manager();
|
|
|
13672
13462
|
useLumiaPassportError,
|
|
13673
13463
|
useLumiaPassportHasServerVault,
|
|
13674
13464
|
useLumiaPassportIFrameReady,
|
|
13465
|
+
useLumiaPassportIsMobileView,
|
|
13675
13466
|
useLumiaPassportLinkedProfiles,
|
|
13676
13467
|
useLumiaPassportLoadingStatus,
|
|
13677
13468
|
useLumiaPassportOpen,
|