@embarkai/ui-kit 0.4.52 → 0.4.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +540 -480
- package/dist/index.d.cts +20 -9
- package/dist/index.d.ts +20 -9
- package/dist/index.js +344 -285
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2421,10 +2421,50 @@ var init_useAutoConnect = __esm({
|
|
|
2421
2421
|
}
|
|
2422
2422
|
});
|
|
2423
2423
|
|
|
2424
|
+
// src/hooks/useOpenPage.ts
|
|
2425
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useRef as useRef3 } from "react";
|
|
2426
|
+
function useOpenPage() {
|
|
2427
|
+
const page = useLayoutDataStore((st) => st.page);
|
|
2428
|
+
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
2429
|
+
const setPageParams = useLayoutDataStore((st) => st.setPageParams);
|
|
2430
|
+
const address = useSession((st) => st.address);
|
|
2431
|
+
const open = useCallback3(
|
|
2432
|
+
(passportPage, params) => {
|
|
2433
|
+
if (!address) return setPage("auth" /* AUTH */);
|
|
2434
|
+
if (!!address && passportPage === "auth" /* AUTH */) return setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
2435
|
+
setPage(passportPage);
|
|
2436
|
+
if (!!params) setPageParams(params);
|
|
2437
|
+
},
|
|
2438
|
+
[setPage, setPageParams, address]
|
|
2439
|
+
);
|
|
2440
|
+
const close = useCallback3(() => {
|
|
2441
|
+
setPageParams(null);
|
|
2442
|
+
setPage(null);
|
|
2443
|
+
}, [setPage, setPageParams]);
|
|
2444
|
+
return { open, close, isOpen: page !== null };
|
|
2445
|
+
}
|
|
2446
|
+
function usePageParams() {
|
|
2447
|
+
const currentParams = useRef3({});
|
|
2448
|
+
useEffect4(() => {
|
|
2449
|
+
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
2450
|
+
if (!pageParams) return;
|
|
2451
|
+
currentParams.current = pageParams;
|
|
2452
|
+
setPageParams(null);
|
|
2453
|
+
}, []);
|
|
2454
|
+
return currentParams.current;
|
|
2455
|
+
}
|
|
2456
|
+
var init_useOpenPage = __esm({
|
|
2457
|
+
"src/hooks/useOpenPage.ts"() {
|
|
2458
|
+
init_SessionContext();
|
|
2459
|
+
init_useLayoutDataStore();
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2462
|
+
|
|
2424
2463
|
// src/internal/hooks/useBackupStatusChanges.ts
|
|
2425
2464
|
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
2426
|
-
import { useEffect as
|
|
2465
|
+
import { useEffect as useEffect5 } from "react";
|
|
2427
2466
|
function useBackupStatusChanges() {
|
|
2467
|
+
const { open: openPage } = useOpenPage();
|
|
2428
2468
|
const { mutate: handleBackupStatusChanged } = useMutation2({
|
|
2429
2469
|
mutationFn: async (event) => {
|
|
2430
2470
|
const customEvent = event;
|
|
@@ -2443,14 +2483,14 @@ function useBackupStatusChanges() {
|
|
|
2443
2483
|
const isNewUserTouched = localStorage.getItem(NEW_USER_TOUCHED_KEY) === "true";
|
|
2444
2484
|
if (!isNewUserTouched && !!jwt?.isNewUser) {
|
|
2445
2485
|
localStorage.setItem(NEW_USER_TOUCHED_KEY, "true");
|
|
2446
|
-
|
|
2486
|
+
openPage("nickname-settings" /* NICKNAME_SETTINGS */, { isInitialUser: true });
|
|
2447
2487
|
}
|
|
2448
2488
|
if (!!isNewUserTouched && !jwt?.isNewUser) {
|
|
2449
2489
|
localStorage.removeItem(NEW_USER_TOUCHED_KEY);
|
|
2450
2490
|
}
|
|
2451
2491
|
} else {
|
|
2452
2492
|
setHasServerVault(false);
|
|
2453
|
-
|
|
2493
|
+
openPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
2454
2494
|
console.warn("[BACKUP STATUS] No recovery data found in vault, marking as no-server-vault");
|
|
2455
2495
|
}
|
|
2456
2496
|
},
|
|
@@ -2459,7 +2499,7 @@ function useBackupStatusChanges() {
|
|
|
2459
2499
|
console.warn("[BACKUP STATUS] Failed to fetch initial vault status:", error);
|
|
2460
2500
|
}
|
|
2461
2501
|
});
|
|
2462
|
-
|
|
2502
|
+
useEffect5(() => {
|
|
2463
2503
|
window.addEventListener("lumia-passport-backup-status-changed", handleBackupStatusChanged);
|
|
2464
2504
|
return () => {
|
|
2465
2505
|
window.removeEventListener("lumia-passport-backup-status-changed", handleBackupStatusChanged);
|
|
@@ -2470,9 +2510,9 @@ var NEW_USER_TOUCHED_KEY;
|
|
|
2470
2510
|
var init_useBackupStatusChanges = __esm({
|
|
2471
2511
|
"src/internal/hooks/useBackupStatusChanges.ts"() {
|
|
2472
2512
|
init_SessionContext();
|
|
2513
|
+
init_useOpenPage();
|
|
2473
2514
|
init_auth();
|
|
2474
2515
|
init_vaultClient();
|
|
2475
|
-
init_useLayoutDataStore();
|
|
2476
2516
|
NEW_USER_TOUCHED_KEY = "embarkai-is-new-user-touhced";
|
|
2477
2517
|
}
|
|
2478
2518
|
});
|
|
@@ -2512,12 +2552,12 @@ var init_useLayoutStore = __esm({
|
|
|
2512
2552
|
|
|
2513
2553
|
// src/internal/hooks/useDetectMaxScrollHeight.ts
|
|
2514
2554
|
import { debounce } from "lodash-es";
|
|
2515
|
-
import { useCallback as
|
|
2555
|
+
import { useCallback as useCallback4, useEffect as useEffect6 } from "react";
|
|
2516
2556
|
function useDetectMaxScrollHeight() {
|
|
2517
2557
|
const page = useLayoutDataStore((state) => state.page);
|
|
2518
2558
|
const setIsMobileView = useLayoutStore((state) => state.setIsMobileView);
|
|
2519
2559
|
const setMaxScrollHeight = useLayoutStore((state) => state.setMaxScrollHeight);
|
|
2520
|
-
const onResize =
|
|
2560
|
+
const onResize = useCallback4(
|
|
2521
2561
|
debounce(({ width, height }) => {
|
|
2522
2562
|
const headerHeight = page === "auth" /* AUTH */ || page === "keyshare-restore" /* KEYSHARE_RESTORE */ ? 0 : 116;
|
|
2523
2563
|
const limContentHeight = height * 0.92 - headerHeight - 57;
|
|
@@ -2526,7 +2566,7 @@ function useDetectMaxScrollHeight() {
|
|
|
2526
2566
|
}, DEBOUNCE_DELAY),
|
|
2527
2567
|
[page, setMaxScrollHeight, setIsMobileView]
|
|
2528
2568
|
);
|
|
2529
|
-
|
|
2569
|
+
useEffect6(() => {
|
|
2530
2570
|
const obs = new ResizeObserver(([entry]) => onResize(entry.contentRect));
|
|
2531
2571
|
const doc = window.document.getElementsByTagName("html")[0];
|
|
2532
2572
|
if (doc) obs.observe(doc);
|
|
@@ -2544,11 +2584,11 @@ var init_useDetectMaxScrollHeight = __esm({
|
|
|
2544
2584
|
});
|
|
2545
2585
|
|
|
2546
2586
|
// src/internal/hooks/useListenIframeAuthEvents.ts
|
|
2547
|
-
import { useCallback as
|
|
2587
|
+
import { useCallback as useCallback5, useEffect as useEffect7 } from "react";
|
|
2548
2588
|
function useListenIframeAuthEvents() {
|
|
2549
2589
|
const setPage = useLayoutDataStore((state) => state.setPage);
|
|
2550
2590
|
const setIsIframeReady = useSession((state) => state.setIsIframeReady);
|
|
2551
|
-
const handleIframeMessage =
|
|
2591
|
+
const handleIframeMessage = useCallback5(
|
|
2552
2592
|
(event) => {
|
|
2553
2593
|
const type = event.data?.type?.startsWith?.("LUMIA_PASSPORT_") ? event.data.type.replace("LUMIA_PASSPORT_", "IFRAME_MSG_") : event.data?.type;
|
|
2554
2594
|
if (type === "IFRAME_MSG_IFRAME_READY") {
|
|
@@ -2564,7 +2604,7 @@ function useListenIframeAuthEvents() {
|
|
|
2564
2604
|
},
|
|
2565
2605
|
[setPage, setIsIframeReady]
|
|
2566
2606
|
);
|
|
2567
|
-
|
|
2607
|
+
useEffect7(() => {
|
|
2568
2608
|
window.addEventListener("message", handleIframeMessage);
|
|
2569
2609
|
return () => window.removeEventListener("message", handleIframeMessage);
|
|
2570
2610
|
}, [handleIframeMessage]);
|
|
@@ -5053,19 +5093,19 @@ var init_utils2 = __esm({
|
|
|
5053
5093
|
});
|
|
5054
5094
|
|
|
5055
5095
|
// src/internal/components/Expandable/hooks/useExpandable.ts
|
|
5056
|
-
import { useCallback as
|
|
5096
|
+
import { useCallback as useCallback6, useEffect as useEffect8, useRef as useRef4 } from "react";
|
|
5057
5097
|
var useExpandable;
|
|
5058
5098
|
var init_useExpandable = __esm({
|
|
5059
5099
|
"src/internal/components/Expandable/hooks/useExpandable.ts"() {
|
|
5060
5100
|
useExpandable = (props) => {
|
|
5061
5101
|
const { isExpanded = false, children, initHeight = 0, minHeight = 0 } = props;
|
|
5062
|
-
const expandableRef =
|
|
5063
|
-
const contentRef =
|
|
5064
|
-
|
|
5102
|
+
const expandableRef = useRef4(null);
|
|
5103
|
+
const contentRef = useRef4(null);
|
|
5104
|
+
useEffect8(() => {
|
|
5065
5105
|
if (!expandableRef.current) return;
|
|
5066
5106
|
expandableRef.current.style.setProperty("--ifo-basic-expandable-h", `${initHeight}px )`);
|
|
5067
5107
|
}, []);
|
|
5068
|
-
const setExpandableHeight =
|
|
5108
|
+
const setExpandableHeight = useCallback6(
|
|
5069
5109
|
(isExpnd) => {
|
|
5070
5110
|
if (!contentRef.current || !expandableRef.current) return;
|
|
5071
5111
|
expandableRef.current.style.setProperty(
|
|
@@ -5076,7 +5116,7 @@ var init_useExpandable = __esm({
|
|
|
5076
5116
|
// ON_RESIZE_DELEAY),
|
|
5077
5117
|
[minHeight]
|
|
5078
5118
|
);
|
|
5079
|
-
|
|
5119
|
+
useEffect8(() => {
|
|
5080
5120
|
if (!contentRef.current || !expandableRef.current) return;
|
|
5081
5121
|
const obs = new ResizeObserver(() => setExpandableHeight(isExpanded));
|
|
5082
5122
|
obs.observe(expandableRef.current);
|
|
@@ -5586,6 +5626,10 @@ var init_en = __esm({
|
|
|
5586
5626
|
checkingAvailability: "Checking availability...",
|
|
5587
5627
|
nicknameAvailable: "Nickname is available",
|
|
5588
5628
|
nicknameNotAvailable: "This nickname is not available"
|
|
5629
|
+
},
|
|
5630
|
+
initialUser: {
|
|
5631
|
+
welcome: "Your nickname is set as {{nickname}}",
|
|
5632
|
+
message: 'Change & Save on your demand, and "Continue":'
|
|
5589
5633
|
}
|
|
5590
5634
|
},
|
|
5591
5635
|
profilesMenu: {
|
|
@@ -5921,6 +5965,10 @@ var init_ru = __esm({
|
|
|
5921
5965
|
checkingAvailability: "\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0441\u0442\u0438...",
|
|
5922
5966
|
nicknameAvailable: "\u041D\u0438\u043A\u043D\u0435\u0439\u043C \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D",
|
|
5923
5967
|
nicknameNotAvailable: "\u042D\u0442\u043E\u0442 \u043D\u0438\u043A\u043D\u0435\u0439\u043C \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D"
|
|
5968
|
+
},
|
|
5969
|
+
initialUser: {
|
|
5970
|
+
welcome: "\u0412\u0430\u0448 \u043D\u0438\u043A\u043D\u0435\u0439\u043C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D \u043A\u0430\u043A {{nickname}}",
|
|
5971
|
+
message: '\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u0435 \u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0435 \u043F\u043E \u0432\u0430\u0448\u0435\u043C\u0443 \u0436\u0435\u043B\u0430\u043D\u0438\u044E, \u0438 \u0437\u0430\u0442\u0435\u043C "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C":'
|
|
5924
5972
|
}
|
|
5925
5973
|
},
|
|
5926
5974
|
profilesMenu: {
|
|
@@ -6256,6 +6304,10 @@ var init_zh = __esm({
|
|
|
6256
6304
|
checkingAvailability: "\u6B63\u5728\u68C0\u67E5\u53EF\u7528\u6027...",
|
|
6257
6305
|
nicknameAvailable: "\u6635\u79F0\u53EF\u7528",
|
|
6258
6306
|
nicknameNotAvailable: "\u6B64\u6635\u79F0\u4E0D\u53EF\u7528"
|
|
6307
|
+
},
|
|
6308
|
+
initialUser: {
|
|
6309
|
+
welcome: "\u60A8\u7684\u6635\u79F0\u5DF2\u8BBE\u7F6E\u4E3A {{nickname}}",
|
|
6310
|
+
message: "\u6839\u636E\u60A8\u7684\u9700\u6C42\u66F4\u6539\u5E76\u4FDD\u5B58\uFF0C\u7136\u540E\u70B9\u51FB\u201C\u7EE7\u7EED\u201D\uFF1A"
|
|
6259
6311
|
}
|
|
6260
6312
|
},
|
|
6261
6313
|
profilesMenu: {
|
|
@@ -6596,7 +6648,7 @@ var init_icons = __esm({
|
|
|
6596
6648
|
|
|
6597
6649
|
// src/internal/components/AuthMenu/PassKeyStep.tsx
|
|
6598
6650
|
import { ArrowLeft, Key as Key2 } from "lucide-react";
|
|
6599
|
-
import { useCallback as
|
|
6651
|
+
import { useCallback as useCallback7 } from "react";
|
|
6600
6652
|
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6601
6653
|
function normalizeWebAuthnError(err) {
|
|
6602
6654
|
const raw = err?.message || String(err || "");
|
|
@@ -6621,7 +6673,7 @@ function PassKeyStep(props) {
|
|
|
6621
6673
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
6622
6674
|
const autoCloseOnSuccess = !recoveryUserId;
|
|
6623
6675
|
const { passkeyStatus, setStep, setPasskeyStatus, setAlert, setEmail, setFailedType } = useAuthStore();
|
|
6624
|
-
const onPasskeyRegister =
|
|
6676
|
+
const onPasskeyRegister = useCallback7(async () => {
|
|
6625
6677
|
setAlert(null);
|
|
6626
6678
|
setPasskeyStatus("registering passkey...");
|
|
6627
6679
|
setIsLoading(true);
|
|
@@ -6680,7 +6732,7 @@ function PassKeyStep(props) {
|
|
|
6680
6732
|
setIsLoading(false);
|
|
6681
6733
|
}
|
|
6682
6734
|
}, [onAuthSuccess, setPage]);
|
|
6683
|
-
const onPasskeyAuth =
|
|
6735
|
+
const onPasskeyAuth = useCallback7(async () => {
|
|
6684
6736
|
setAlert(null);
|
|
6685
6737
|
setPasskeyStatus("checking available passkeys...");
|
|
6686
6738
|
setIsLoading(true);
|
|
@@ -6813,7 +6865,7 @@ var init_PassKeyStep = __esm({
|
|
|
6813
6865
|
});
|
|
6814
6866
|
|
|
6815
6867
|
// src/internal/components/ui/input.tsx
|
|
6816
|
-
import React4, { useImperativeHandle as useImperativeHandle2, useRef as
|
|
6868
|
+
import React4, { useImperativeHandle as useImperativeHandle2, useRef as useRef5 } from "react";
|
|
6817
6869
|
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6818
6870
|
var Input;
|
|
6819
6871
|
var init_input = __esm({
|
|
@@ -6821,7 +6873,7 @@ var init_input = __esm({
|
|
|
6821
6873
|
init_utils2();
|
|
6822
6874
|
Input = React4.forwardRef((props, ref) => {
|
|
6823
6875
|
const { className, disabled, error, Icon: Icon2, element, inputClassName, ...inputProps } = props;
|
|
6824
|
-
const internalRef =
|
|
6876
|
+
const internalRef = useRef5(null);
|
|
6825
6877
|
useImperativeHandle2(ref, () => internalRef.current);
|
|
6826
6878
|
return /* @__PURE__ */ jsxs9("div", { className: cn("w-full flex flex-col gap-1", className), children: [
|
|
6827
6879
|
/* @__PURE__ */ jsxs9(
|
|
@@ -6871,14 +6923,14 @@ var init_input = __esm({
|
|
|
6871
6923
|
// src/internal/components/AuthMenu/SignInStep/Email.tsx
|
|
6872
6924
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
6873
6925
|
import { ChevronRight, Loader as Loader2, Mail as Mail2 } from "lucide-react";
|
|
6874
|
-
import { useEffect as
|
|
6926
|
+
import { useEffect as useEffect9, useRef as useRef6 } from "react";
|
|
6875
6927
|
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
6876
6928
|
function Email() {
|
|
6877
6929
|
const { callbacksRef } = useProviderConfig();
|
|
6878
6930
|
const { t } = useT();
|
|
6879
|
-
const focusRef =
|
|
6880
|
-
const inputRef =
|
|
6881
|
-
const buttonRef =
|
|
6931
|
+
const focusRef = useRef6(null);
|
|
6932
|
+
const inputRef = useRef6(null);
|
|
6933
|
+
const buttonRef = useRef6(null);
|
|
6882
6934
|
const isLoading = useSession((st) => st.isLoading);
|
|
6883
6935
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
6884
6936
|
const isMobileView = useLayoutStore((st) => st.isMobileView);
|
|
@@ -6934,7 +6986,7 @@ function Email() {
|
|
|
6934
6986
|
setIsLoading(false);
|
|
6935
6987
|
}
|
|
6936
6988
|
});
|
|
6937
|
-
|
|
6989
|
+
useEffect9(() => {
|
|
6938
6990
|
if (!focusRef.current || !isMobileView) return;
|
|
6939
6991
|
focusRef.current?.focus();
|
|
6940
6992
|
setTimeout(() => {
|
|
@@ -7142,7 +7194,7 @@ var init_utils4 = __esm({
|
|
|
7142
7194
|
});
|
|
7143
7195
|
|
|
7144
7196
|
// src/internal/components/AuthMenu/SignInStep/Social.tsx
|
|
7145
|
-
import { useCallback as
|
|
7197
|
+
import { useCallback as useCallback8 } from "react";
|
|
7146
7198
|
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
7147
7199
|
function Social(props) {
|
|
7148
7200
|
const { pendingLoginResponseRef, onAuthSuccess } = props;
|
|
@@ -7152,7 +7204,7 @@ function Social(props) {
|
|
|
7152
7204
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
7153
7205
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
7154
7206
|
const { alert: alert2, setStep, setEmail, setFailedType, setAlert, setPasskeyStatus } = useAuthStore();
|
|
7155
|
-
const onSocialAuth =
|
|
7207
|
+
const onSocialAuth = useCallback8(
|
|
7156
7208
|
async (providerId) => {
|
|
7157
7209
|
const normalizedProviderId = providerId.toLowerCase();
|
|
7158
7210
|
const provider = config.current?.social?.providers?.find(
|
|
@@ -7642,18 +7694,18 @@ var init_constants4 = __esm({
|
|
|
7642
7694
|
|
|
7643
7695
|
// src/internal/components/AuthMenu/useAuthMenuHanders.ts
|
|
7644
7696
|
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
7645
|
-
import { useCallback as
|
|
7697
|
+
import { useCallback as useCallback9, useRef as useRef7, useState as useState2 } from "react";
|
|
7646
7698
|
function useAuthMenuHandlers() {
|
|
7647
7699
|
const { config, callbacksRef } = useProviderConfig();
|
|
7648
7700
|
const qc = useQueryClient2();
|
|
7649
|
-
const pendingLoginResponseRef =
|
|
7701
|
+
const pendingLoginResponseRef = useRef7(null);
|
|
7650
7702
|
const [telegramCleanup, setTelegramCleanup] = useState2(null);
|
|
7651
7703
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
7652
7704
|
const publicClient = useSession((st) => st.publicClient);
|
|
7653
7705
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
7654
7706
|
const setStep = useAuthStore((st) => st.setStep);
|
|
7655
7707
|
const setAlert = useAuthStore((st) => st.setAlert);
|
|
7656
|
-
const createSessionWithKeyshare =
|
|
7708
|
+
const createSessionWithKeyshare = useCallback9(
|
|
7657
7709
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
7658
7710
|
const { setStatus } = useSession.getState();
|
|
7659
7711
|
try {
|
|
@@ -7695,7 +7747,7 @@ function useAuthMenuHandlers() {
|
|
|
7695
7747
|
},
|
|
7696
7748
|
[usePaymaster, activeChainId]
|
|
7697
7749
|
);
|
|
7698
|
-
const onAuthSuccess =
|
|
7750
|
+
const onAuthSuccess = useCallback9(async () => {
|
|
7699
7751
|
const {
|
|
7700
7752
|
//
|
|
7701
7753
|
setSession,
|
|
@@ -7802,7 +7854,7 @@ function useAuthMenuHandlers() {
|
|
|
7802
7854
|
setStep("signin");
|
|
7803
7855
|
}
|
|
7804
7856
|
}, [qc, setStep, setAlert, createSessionWithKeyshare]);
|
|
7805
|
-
const goBackToSignIn =
|
|
7857
|
+
const goBackToSignIn = useCallback9(() => {
|
|
7806
7858
|
setStep("signin");
|
|
7807
7859
|
setAlert(null);
|
|
7808
7860
|
if (telegramCleanup) {
|
|
@@ -7829,7 +7881,7 @@ var init_useAuthMenuHanders = __esm({
|
|
|
7829
7881
|
});
|
|
7830
7882
|
|
|
7831
7883
|
// src/internal/components/AuthMenu/VerifyStep/VerificationCodeInput.tsx
|
|
7832
|
-
import { useEffect as
|
|
7884
|
+
import { useEffect as useEffect10, useRef as useRef8, useState as useState3 } from "react";
|
|
7833
7885
|
import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
7834
7886
|
var getRemainingSeconds, VerificationCodeInput;
|
|
7835
7887
|
var init_VerificationCodeInput = __esm({
|
|
@@ -7845,12 +7897,12 @@ var init_VerificationCodeInput = __esm({
|
|
|
7845
7897
|
const setAlert = useAuthStore((st) => st.setAlert);
|
|
7846
7898
|
const [expiresAt, setExpiresAt] = useState3(() => Date.now() + Math.max(0, expiresIn) * 1e3);
|
|
7847
7899
|
const [timeLeft, setTimeLeft] = useState3(() => getRemainingSeconds(expiresAt));
|
|
7848
|
-
|
|
7900
|
+
useEffect10(() => {
|
|
7849
7901
|
const nextExpiresAt = Date.now() + Math.max(0, expiresIn) * 1e3;
|
|
7850
7902
|
setExpiresAt(nextExpiresAt);
|
|
7851
7903
|
setTimeLeft(getRemainingSeconds(nextExpiresAt));
|
|
7852
7904
|
}, [expiresIn]);
|
|
7853
|
-
|
|
7905
|
+
useEffect10(() => {
|
|
7854
7906
|
let intervalId;
|
|
7855
7907
|
const syncTimeLeft = () => {
|
|
7856
7908
|
const remaining = getRemainingSeconds(expiresAt);
|
|
@@ -7871,10 +7923,10 @@ var init_VerificationCodeInput = __esm({
|
|
|
7871
7923
|
document.removeEventListener("visibilitychange", syncTimeLeft);
|
|
7872
7924
|
};
|
|
7873
7925
|
}, [expiresAt]);
|
|
7874
|
-
const lastSubmittedRef =
|
|
7875
|
-
const inputsRef =
|
|
7926
|
+
const lastSubmittedRef = useRef8(null);
|
|
7927
|
+
const inputsRef = useRef8([]);
|
|
7876
7928
|
const [digits, setDigits] = useState3(["", "", "", "", "", ""]);
|
|
7877
|
-
|
|
7929
|
+
useEffect10(() => {
|
|
7878
7930
|
const code = digits.join("");
|
|
7879
7931
|
if (code.length === 6 && digits.every((d) => d !== "") && !isLoading) {
|
|
7880
7932
|
if (lastSubmittedRef.current !== code) {
|
|
@@ -7883,7 +7935,7 @@ var init_VerificationCodeInput = __esm({
|
|
|
7883
7935
|
}
|
|
7884
7936
|
}
|
|
7885
7937
|
}, [digits, isLoading, onVerifyCode]);
|
|
7886
|
-
|
|
7938
|
+
useEffect10(() => {
|
|
7887
7939
|
const t2 = setTimeout(() => {
|
|
7888
7940
|
inputsRef.current[0]?.focus();
|
|
7889
7941
|
}, 0);
|
|
@@ -8180,7 +8232,7 @@ var init_VerifyStep2 = __esm({
|
|
|
8180
8232
|
|
|
8181
8233
|
// src/internal/components/AuthMenu/AuthMenu.tsx
|
|
8182
8234
|
import { AlertTriangle as AlertTriangle2, Loader as Loader4 } from "lucide-react";
|
|
8183
|
-
import { useEffect as
|
|
8235
|
+
import { useEffect as useEffect11, useMemo } from "react";
|
|
8184
8236
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
8185
8237
|
var AuthMenu;
|
|
8186
8238
|
var init_AuthMenu = __esm({
|
|
@@ -8207,7 +8259,7 @@ var init_AuthMenu = __esm({
|
|
|
8207
8259
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
8208
8260
|
const { step, alert: alert2, setStep, setPasskeyStatus, setEmail, setAlert } = useAuthStore();
|
|
8209
8261
|
const { pendingLoginResponseRef, onAuthSuccess, goBackToSignIn } = useAuthMenuHandlers();
|
|
8210
|
-
|
|
8262
|
+
useEffect11(() => {
|
|
8211
8263
|
if (!pendingWalletLogin) return;
|
|
8212
8264
|
const loginResponse = pendingWalletLogin;
|
|
8213
8265
|
setPendingWalletLogin(null);
|
|
@@ -8217,7 +8269,7 @@ var init_AuthMenu = __esm({
|
|
|
8217
8269
|
onAuthSuccess();
|
|
8218
8270
|
});
|
|
8219
8271
|
}, [pendingWalletLogin]);
|
|
8220
|
-
|
|
8272
|
+
useEffect11(() => {
|
|
8221
8273
|
setTransitionPageHeight(DEFAULT_AUTH_MENU_HEIGHT);
|
|
8222
8274
|
return () => {
|
|
8223
8275
|
setStep("signin");
|
|
@@ -8792,7 +8844,7 @@ var init_useBuyMenuStore = __esm({
|
|
|
8792
8844
|
// src/internal/components/BuyMenu/components/CryptoSelector.tsx
|
|
8793
8845
|
import { debounce as debounce2, toPairs } from "lodash-es";
|
|
8794
8846
|
import { InfoIcon, PointerIcon, SearchIcon } from "lucide-react";
|
|
8795
|
-
import { useCallback as
|
|
8847
|
+
import { useCallback as useCallback10, useMemo as useMemo2, useState as useState6 } from "react";
|
|
8796
8848
|
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8797
8849
|
function CryptoItem(props) {
|
|
8798
8850
|
const { symbol, network } = props;
|
|
@@ -8832,7 +8884,7 @@ function CryptoSelector(props) {
|
|
|
8832
8884
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
8833
8885
|
const [searchValue, setSearchValue] = useState6("");
|
|
8834
8886
|
const [target, setTarget] = useState6("");
|
|
8835
|
-
const setSearchDebounced =
|
|
8887
|
+
const setSearchDebounced = useCallback10(
|
|
8836
8888
|
debounce2((value) => {
|
|
8837
8889
|
setTarget(value);
|
|
8838
8890
|
useBuyMenuStore.getState().setRenderKey(`on-ramp-crypto-selector-${Date.now()}`);
|
|
@@ -9017,7 +9069,7 @@ var init_ResolvedFiatIcon = __esm({
|
|
|
9017
9069
|
// src/internal/components/BuyMenu/components/FiatSelector.tsx
|
|
9018
9070
|
import { debounce as debounce3 } from "lodash-es";
|
|
9019
9071
|
import { PointerIcon as PointerIcon2, SearchIcon as SearchIcon2 } from "lucide-react";
|
|
9020
|
-
import { useCallback as
|
|
9072
|
+
import { useCallback as useCallback11, useMemo as useMemo3, useState as useState7 } from "react";
|
|
9021
9073
|
import { Fragment as Fragment9, jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
9022
9074
|
function getCurrencyName(ticker, locale = "en") {
|
|
9023
9075
|
try {
|
|
@@ -9057,7 +9109,7 @@ function FiatSelector(props) {
|
|
|
9057
9109
|
const locale = i18n.resolvedLanguage || "en";
|
|
9058
9110
|
const [searchValue, setSearchValue] = useState7("");
|
|
9059
9111
|
const [target, setTarget] = useState7("");
|
|
9060
|
-
const setSearchDebounced =
|
|
9112
|
+
const setSearchDebounced = useCallback11(
|
|
9061
9113
|
debounce3((value) => {
|
|
9062
9114
|
setTarget(value);
|
|
9063
9115
|
useBuyMenuStore.getState().setRenderKey(`on-ramp-fiat-selector-${Date.now()}`);
|
|
@@ -9678,7 +9730,7 @@ import { useInfiniteQuery } from "@tanstack/react-query";
|
|
|
9678
9730
|
import dayjs from "dayjs";
|
|
9679
9731
|
import { debounce as debounce4 } from "lodash-es";
|
|
9680
9732
|
import { DownloadIcon, ExternalLinkIcon, LoaderIcon as LoaderIcon2 } from "lucide-react";
|
|
9681
|
-
import { useCallback as
|
|
9733
|
+
import { useCallback as useCallback12, useEffect as useEffect12, useMemo as useMemo4 } from "react";
|
|
9682
9734
|
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
9683
9735
|
function getStatusVariant(status) {
|
|
9684
9736
|
switch (status) {
|
|
@@ -9813,13 +9865,13 @@ function BinanceTxHistory() {
|
|
|
9813
9865
|
() => historyData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
9814
9866
|
[historyData]
|
|
9815
9867
|
);
|
|
9816
|
-
const updateExpandable =
|
|
9868
|
+
const updateExpandable = useCallback12(
|
|
9817
9869
|
debounce4(() => {
|
|
9818
9870
|
useBuyMenuStore.getState().setRenderKey(`binance-history-loaded-${Date.now()}`);
|
|
9819
9871
|
}, 200),
|
|
9820
9872
|
[]
|
|
9821
9873
|
);
|
|
9822
|
-
|
|
9874
|
+
useEffect12(() => {
|
|
9823
9875
|
if (isTxDataLoading || !txList?.length || txList.length > 10) return;
|
|
9824
9876
|
updateExpandable();
|
|
9825
9877
|
}, [isTxDataLoading, txList]);
|
|
@@ -9866,11 +9918,11 @@ var init_BinanceTxHistory = __esm({
|
|
|
9866
9918
|
|
|
9867
9919
|
// src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts
|
|
9868
9920
|
import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
9869
|
-
import { useEffect as
|
|
9921
|
+
import { useEffect as useEffect13, useRef as useRef9 } from "react";
|
|
9870
9922
|
function useBinanceSseTxTracing(walletAddress) {
|
|
9871
9923
|
const qc = useQueryClient4();
|
|
9872
|
-
const debounceRef =
|
|
9873
|
-
|
|
9924
|
+
const debounceRef = useRef9(null);
|
|
9925
|
+
useEffect13(() => {
|
|
9874
9926
|
if (!walletAddress) return;
|
|
9875
9927
|
const iframeManager = getIframeManager();
|
|
9876
9928
|
if (!iframeManager) return;
|
|
@@ -9912,7 +9964,7 @@ var init_utils6 = __esm({
|
|
|
9912
9964
|
// src/internal/components/BuyMenu/binance/Binance.tsx
|
|
9913
9965
|
import { useMutation as useMutation6, useQuery as useQuery2, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
9914
9966
|
import { LoaderIcon as LoaderIcon3 } from "lucide-react";
|
|
9915
|
-
import { useEffect as
|
|
9967
|
+
import { useEffect as useEffect14 } from "react";
|
|
9916
9968
|
import { Fragment as Fragment11, jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9917
9969
|
function Binance() {
|
|
9918
9970
|
const qc = useQueryClient5();
|
|
@@ -9934,7 +9986,7 @@ function Binance() {
|
|
|
9934
9986
|
} = useBuyMenuStore();
|
|
9935
9987
|
const paymentMode = useBinanceStore((st) => st.paymentMode);
|
|
9936
9988
|
const isCurrurenciesSelected = !!selectedCrypto && !!selectedFiat;
|
|
9937
|
-
|
|
9989
|
+
useEffect14(() => {
|
|
9938
9990
|
if (!isCurrurenciesSelected) return;
|
|
9939
9991
|
useBuyMenuStore.getState().setRenderKey(`${selectedCrypto}-${selectedFiat}-${Date.now()}`);
|
|
9940
9992
|
}, [isCurrurenciesSelected]);
|
|
@@ -9969,7 +10021,7 @@ function Binance() {
|
|
|
9969
10021
|
});
|
|
9970
10022
|
const paymentModes = paymentModesData?.data?.paymentMethods || [];
|
|
9971
10023
|
const selectedPaymentMode = paymentModes?.find((el) => getPayMethodID(el) === paymentMode) || null;
|
|
9972
|
-
|
|
10024
|
+
useEffect14(() => {
|
|
9973
10025
|
useBuyMenuStore.getState().setMinAmount(Number(selectedPaymentMode?.fiatMinLimit || "0"));
|
|
9974
10026
|
}, [selectedPaymentMode]);
|
|
9975
10027
|
const { mutate: estimateQuote, isPending: isQuoteEstimating } = useMutation6({
|
|
@@ -9997,21 +10049,21 @@ function Binance() {
|
|
|
9997
10049
|
}
|
|
9998
10050
|
});
|
|
9999
10051
|
const availableFiats = (tradingPairsData?.data?.fiatCurrencies || []).map((ticker) => ({ ticker }));
|
|
10000
|
-
|
|
10052
|
+
useEffect14(() => {
|
|
10001
10053
|
if (!!selectedFiat || !availableFiats?.length) return;
|
|
10002
10054
|
const targetFiat = availableFiats.find((item) => item.ticker === "USD" || item.ticker === "EUR") || availableFiats[0];
|
|
10003
10055
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10004
10056
|
}, [availableFiats, selectedFiat]);
|
|
10005
|
-
|
|
10057
|
+
useEffect14(() => {
|
|
10006
10058
|
if (!!selectedCrypto || !networkAvailableCryptoList?.length) return;
|
|
10007
10059
|
useBuyMenuStore.getState().setSelectedCrypto(networkAvailableCryptoList[0].cryptoCurrency);
|
|
10008
10060
|
}, [networkAvailableCryptoList, selectedCrypto]);
|
|
10009
|
-
|
|
10061
|
+
useEffect14(() => {
|
|
10010
10062
|
if (!!paymentMode || !paymentModes.length) return;
|
|
10011
10063
|
const targetPaymentMode = paymentModes.find((item) => item.payMethodCode === PREFERRED_PAYMENT_METHOD) || paymentModes[0];
|
|
10012
10064
|
useBinanceStore.getState().setPaymentMode(getPayMethodID(targetPaymentMode));
|
|
10013
10065
|
}, [paymentModes]);
|
|
10014
|
-
|
|
10066
|
+
useEffect14(() => {
|
|
10015
10067
|
return () => {
|
|
10016
10068
|
useBinanceStore.getState().setPaymentMode(null);
|
|
10017
10069
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binanceTradingPairs] });
|
|
@@ -10333,7 +10385,7 @@ var init_FinchPaySummary = __esm({
|
|
|
10333
10385
|
import { useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
|
|
10334
10386
|
import dayjs2 from "dayjs";
|
|
10335
10387
|
import { LoaderIcon as LoaderIcon4 } from "lucide-react";
|
|
10336
|
-
import { useCallback as
|
|
10388
|
+
import { useCallback as useCallback13, useState as useState8 } from "react";
|
|
10337
10389
|
import { jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
10338
10390
|
function getStatusVariant2(status) {
|
|
10339
10391
|
switch (status) {
|
|
@@ -10435,7 +10487,7 @@ function FinchPayTxHistory() {
|
|
|
10435
10487
|
const pageCount = loadedPages[loadedPages.length - 1]?.pageCount || 1;
|
|
10436
10488
|
const txList = loadedPages.map((p) => p.data)[cursor - 1] || [];
|
|
10437
10489
|
console.log("[FINCHPAY] txList", txData);
|
|
10438
|
-
const handleNextPage =
|
|
10490
|
+
const handleNextPage = useCallback13(
|
|
10439
10491
|
async (curCursor, curPageParams) => {
|
|
10440
10492
|
const maxLoadedPage = Math.max(...curPageParams);
|
|
10441
10493
|
if (curCursor !== maxLoadedPage) {
|
|
@@ -10526,11 +10578,11 @@ var init_networks = __esm({
|
|
|
10526
10578
|
|
|
10527
10579
|
// src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts
|
|
10528
10580
|
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
10529
|
-
import { useEffect as
|
|
10581
|
+
import { useEffect as useEffect15, useRef as useRef10 } from "react";
|
|
10530
10582
|
function useFinchpaySseTxTracing(walletAddress) {
|
|
10531
10583
|
const qc = useQueryClient6();
|
|
10532
|
-
const debounceRef =
|
|
10533
|
-
|
|
10584
|
+
const debounceRef = useRef10(null);
|
|
10585
|
+
useEffect15(() => {
|
|
10534
10586
|
if (!walletAddress) return;
|
|
10535
10587
|
const iframeManager = getIframeManager();
|
|
10536
10588
|
if (!iframeManager) return;
|
|
@@ -10579,7 +10631,7 @@ var init_utils7 = __esm({
|
|
|
10579
10631
|
// src/internal/components/BuyMenu/finchpay/FinchPay.tsx
|
|
10580
10632
|
import { useQuery as useQuery3, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
10581
10633
|
import { DollarSign, LoaderIcon as LoaderIcon5 } from "lucide-react";
|
|
10582
|
-
import { useEffect as
|
|
10634
|
+
import { useEffect as useEffect16 } from "react";
|
|
10583
10635
|
import { Fragment as Fragment12, jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10584
10636
|
function FinchPay() {
|
|
10585
10637
|
const qc = useQueryClient7();
|
|
@@ -10655,11 +10707,11 @@ function FinchPay() {
|
|
|
10655
10707
|
})
|
|
10656
10708
|
});
|
|
10657
10709
|
const minimum = Number(limitsData?.min_amount || "0");
|
|
10658
|
-
|
|
10710
|
+
useEffect16(() => {
|
|
10659
10711
|
if (minimum <= 0) return;
|
|
10660
10712
|
useBuyMenuStore.getState().setMinAmount(minimum);
|
|
10661
10713
|
}, [minimum]);
|
|
10662
|
-
|
|
10714
|
+
useEffect16(() => {
|
|
10663
10715
|
if (srcInputAmount >= minimum) return;
|
|
10664
10716
|
useBuyMenuStore.getState().setRenderKey(`finchpay-input-minimum-warning-${Date.now()}`);
|
|
10665
10717
|
}, [minimum, srcInputAmount]);
|
|
@@ -10687,23 +10739,23 @@ function FinchPay() {
|
|
|
10687
10739
|
// defaults to CARD estimation, widgetUrl
|
|
10688
10740
|
})
|
|
10689
10741
|
});
|
|
10690
|
-
|
|
10742
|
+
useEffect16(() => {
|
|
10691
10743
|
const { error: errorTitle, message: errorMessage } = handleErrors([currenciesError, limitsError, estimateError]);
|
|
10692
10744
|
if (!errorTitle && !errorMessage) return;
|
|
10693
10745
|
console.error(`[BuyModal][Binance] ${errorTitle}: ${errorMessage}`);
|
|
10694
10746
|
useBuyMenuStore.getState().setError(errorMessage);
|
|
10695
10747
|
}, [currenciesError, limitsError, estimateError]);
|
|
10696
|
-
|
|
10748
|
+
useEffect16(() => {
|
|
10697
10749
|
if (!!selectedFiat || currenciesData.fiats.length === 0) return;
|
|
10698
10750
|
const fallbackFiat = currenciesData.fiats[0];
|
|
10699
10751
|
const targetFiat = currenciesData.fiats.find((f) => f.ticker.toUpperCase() === "USD") || fallbackFiat;
|
|
10700
10752
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10701
10753
|
}, [currenciesData, selectedFiat]);
|
|
10702
|
-
|
|
10754
|
+
useEffect16(() => {
|
|
10703
10755
|
if (!!selectedCrypto || currenciesData.currentNetworkCoins.length === 0) return;
|
|
10704
10756
|
useBuyMenuStore.getState().setSelectedCrypto(currenciesData.currentNetworkCoins[0].ticker);
|
|
10705
10757
|
}, [currenciesData, selectedCrypto]);
|
|
10706
|
-
|
|
10758
|
+
useEffect16(() => {
|
|
10707
10759
|
return () => {
|
|
10708
10760
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayCurrencies] });
|
|
10709
10761
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayLimits] });
|
|
@@ -10970,7 +11022,7 @@ var init_debounce = __esm({
|
|
|
10970
11022
|
});
|
|
10971
11023
|
|
|
10972
11024
|
// src/internal/components/BuyMenu/useHandleInputAmount.ts
|
|
10973
|
-
import { useCallback as
|
|
11025
|
+
import { useCallback as useCallback14, useEffect as useEffect17, useRef as useRef11 } from "react";
|
|
10974
11026
|
var ON_INPUT_QUERY_DELAY, useHandleInputAmount;
|
|
10975
11027
|
var init_useHandleInputAmount = __esm({
|
|
10976
11028
|
"src/internal/components/BuyMenu/useHandleInputAmount.ts"() {
|
|
@@ -10979,11 +11031,11 @@ var init_useHandleInputAmount = __esm({
|
|
|
10979
11031
|
init_useBuyMenuStore();
|
|
10980
11032
|
ON_INPUT_QUERY_DELAY = 1500;
|
|
10981
11033
|
useHandleInputAmount = () => {
|
|
10982
|
-
const lastRampProviderRef =
|
|
11034
|
+
const lastRampProviderRef = useRef11(DEFAULT_PROVIDER2);
|
|
10983
11035
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
10984
11036
|
const srcInputAmount = useBuyMenuStore((st) => st.srcInputAmount);
|
|
10985
11037
|
const minAmount = useBuyMenuStore((st) => st.minAmount);
|
|
10986
|
-
const setQueryAmountDebounced =
|
|
11038
|
+
const setQueryAmountDebounced = useCallback14(
|
|
10987
11039
|
debounce5((inputAmount) => {
|
|
10988
11040
|
const checkedValue = Math.ceil(Math.max(inputAmount, minAmount));
|
|
10989
11041
|
useBuyMenuStore.getState().setSrcInputAmount(checkedValue);
|
|
@@ -10991,8 +11043,8 @@ var init_useHandleInputAmount = __esm({
|
|
|
10991
11043
|
}, ON_INPUT_QUERY_DELAY),
|
|
10992
11044
|
[minAmount]
|
|
10993
11045
|
);
|
|
10994
|
-
|
|
10995
|
-
|
|
11046
|
+
useEffect17(() => setQueryAmountDebounced(srcInputAmount), [srcInputAmount, setQueryAmountDebounced]);
|
|
11047
|
+
useEffect17(() => {
|
|
10996
11048
|
if (lastRampProviderRef.current === rampProvider) return;
|
|
10997
11049
|
const {
|
|
10998
11050
|
setIsProviderSummary,
|
|
@@ -11356,7 +11408,7 @@ var init_truncateMiddle = __esm({
|
|
|
11356
11408
|
// src/internal/components/ChainsMenu/ChainItem.tsx
|
|
11357
11409
|
import { getChainConfig as getChainConfig7 } from "@embarkai/core/read";
|
|
11358
11410
|
import { Copy, ExternalLink, Loader as Loader6 } from "lucide-react";
|
|
11359
|
-
import { useRef as
|
|
11411
|
+
import { useRef as useRef12, useState as useState9 } from "react";
|
|
11360
11412
|
import { jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
11361
11413
|
function getPaymasterExplorerUrl(chainId, paymasterAddress) {
|
|
11362
11414
|
const chainConfig = getChainConfig7(chainId);
|
|
@@ -11379,7 +11431,7 @@ function ChainItem(props) {
|
|
|
11379
11431
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
11380
11432
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
11381
11433
|
const [copiedChainId, setCopiedChainId] = useState9(null);
|
|
11382
|
-
const copiedResetTimerRef =
|
|
11434
|
+
const copiedResetTimerRef = useRef12(null);
|
|
11383
11435
|
const isActiveChain = activeChainId === chainId;
|
|
11384
11436
|
const paymasterAddress = isActiveChain ? activePaymasterData?.address : null;
|
|
11385
11437
|
const paymasterExplorerUrl = paymasterAddress ? getPaymasterExplorerUrl(chainId, paymasterAddress) : null;
|
|
@@ -12351,7 +12403,7 @@ var init_guardian_backup = __esm({
|
|
|
12351
12403
|
});
|
|
12352
12404
|
|
|
12353
12405
|
// src/internal/components/DevicesMenu/DeviceManageScreen.tsx
|
|
12354
|
-
import { useCallback as
|
|
12406
|
+
import { useCallback as useCallback15, useEffect as useEffect18, useRef as useRef13, useState as useState12 } from "react";
|
|
12355
12407
|
import { ArrowLeft as ArrowLeft7, Cpu, Download, HardDrive, Loader2 as Loader23, Trash2, Upload } from "lucide-react";
|
|
12356
12408
|
import { Fragment as Fragment15, jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
12357
12409
|
function formatSize(bytes) {
|
|
@@ -12366,19 +12418,19 @@ function DeviceManageScreen() {
|
|
|
12366
12418
|
const userId = session?.mpcUserId || "";
|
|
12367
12419
|
const deviceId = pageParams?.deviceId;
|
|
12368
12420
|
const deviceName = pageParams?.deviceName;
|
|
12369
|
-
const guardianRef =
|
|
12421
|
+
const guardianRef = useRef13(null);
|
|
12370
12422
|
const [screen, setScreen] = useState12({ step: "connecting" });
|
|
12371
12423
|
const [actionState, setActionState] = useState12(null);
|
|
12372
12424
|
const [password, setPassword] = useState12("");
|
|
12373
12425
|
const [statusMessage, setStatusMessage] = useState12(null);
|
|
12374
12426
|
const [errorMessage, setErrorMessage] = useState12(null);
|
|
12375
12427
|
const [waitingConfirm, setWaitingConfirm] = useState12(false);
|
|
12376
|
-
|
|
12428
|
+
useEffect18(() => {
|
|
12377
12429
|
if (!statusMessage) return;
|
|
12378
12430
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
12379
12431
|
return () => clearTimeout(t);
|
|
12380
12432
|
}, [statusMessage]);
|
|
12381
|
-
|
|
12433
|
+
useEffect18(() => {
|
|
12382
12434
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
12383
12435
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
12384
12436
|
return;
|
|
@@ -12410,7 +12462,7 @@ function DeviceManageScreen() {
|
|
|
12410
12462
|
guardianRef.current?.close();
|
|
12411
12463
|
};
|
|
12412
12464
|
}, [deviceId]);
|
|
12413
|
-
const refreshList =
|
|
12465
|
+
const refreshList = useCallback15(async () => {
|
|
12414
12466
|
const guardian = guardianRef.current;
|
|
12415
12467
|
if (!guardian || screen.step !== "connected") return;
|
|
12416
12468
|
try {
|
|
@@ -12419,7 +12471,7 @@ function DeviceManageScreen() {
|
|
|
12419
12471
|
} catch {
|
|
12420
12472
|
}
|
|
12421
12473
|
}, [screen]);
|
|
12422
|
-
const handleBackup =
|
|
12474
|
+
const handleBackup = useCallback15(async () => {
|
|
12423
12475
|
const guardian = guardianRef.current;
|
|
12424
12476
|
const iframe4 = getIframeManager();
|
|
12425
12477
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12443,7 +12495,7 @@ function DeviceManageScreen() {
|
|
|
12443
12495
|
setActionState(null);
|
|
12444
12496
|
}
|
|
12445
12497
|
}, [password, userId, refreshList]);
|
|
12446
|
-
const handleOverwrite =
|
|
12498
|
+
const handleOverwrite = useCallback15(async () => {
|
|
12447
12499
|
const guardian = guardianRef.current;
|
|
12448
12500
|
const iframe4 = getIframeManager();
|
|
12449
12501
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12463,7 +12515,7 @@ function DeviceManageScreen() {
|
|
|
12463
12515
|
setActionState(null);
|
|
12464
12516
|
}
|
|
12465
12517
|
}, [password, userId, refreshList]);
|
|
12466
|
-
const handleDelete =
|
|
12518
|
+
const handleDelete = useCallback15(async (keyshareId) => {
|
|
12467
12519
|
const guardian = guardianRef.current;
|
|
12468
12520
|
if (!guardian) return;
|
|
12469
12521
|
setActionState({ action: "delete", keyshareId, substep: "confirm-device" });
|
|
@@ -12643,7 +12695,7 @@ var init_DeviceManageScreen = __esm({
|
|
|
12643
12695
|
});
|
|
12644
12696
|
|
|
12645
12697
|
// src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx
|
|
12646
|
-
import { useCallback as
|
|
12698
|
+
import { useCallback as useCallback16, useState as useState13 } from "react";
|
|
12647
12699
|
import { AlertTriangle as AlertTriangle3, ArrowLeft as ArrowLeft8, Download as Download2, Loader2 as Loader24 } from "lucide-react";
|
|
12648
12700
|
import { Fragment as Fragment16, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
12649
12701
|
function DeviceRestoreScreen() {
|
|
@@ -12659,7 +12711,7 @@ function DeviceRestoreScreen() {
|
|
|
12659
12711
|
const [isWorking, setIsWorking] = useState13(false);
|
|
12660
12712
|
const [statusMessage, setStatusMessage] = useState13(null);
|
|
12661
12713
|
const [errorMessage, setErrorMessage] = useState13(null);
|
|
12662
|
-
const handleRestore =
|
|
12714
|
+
const handleRestore = useCallback16(async () => {
|
|
12663
12715
|
if (!password || !keyshareId || !userId) return;
|
|
12664
12716
|
const iframe4 = getIframeManager();
|
|
12665
12717
|
if (!iframe4) {
|
|
@@ -12963,7 +13015,7 @@ var init_useRestoreStore = __esm({
|
|
|
12963
13015
|
});
|
|
12964
13016
|
|
|
12965
13017
|
// src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts
|
|
12966
|
-
import { useCallback as
|
|
13018
|
+
import { useCallback as useCallback17 } from "react";
|
|
12967
13019
|
function useOnRestoreSuccess() {
|
|
12968
13020
|
const { config, callbacksRef } = useProviderConfig();
|
|
12969
13021
|
const setIsDialogForced = useLayoutStore((st) => st.setIsDialogForced);
|
|
@@ -12979,7 +13031,7 @@ function useOnRestoreSuccess() {
|
|
|
12979
13031
|
setStatus
|
|
12980
13032
|
} = useSession();
|
|
12981
13033
|
const { setError, setSuccess } = useRestoreStore();
|
|
12982
|
-
const createSessionWithKeyshare =
|
|
13034
|
+
const createSessionWithKeyshare = useCallback17(
|
|
12983
13035
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
12984
13036
|
try {
|
|
12985
13037
|
try {
|
|
@@ -13020,7 +13072,7 @@ function useOnRestoreSuccess() {
|
|
|
13020
13072
|
},
|
|
13021
13073
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
13022
13074
|
);
|
|
13023
|
-
const onRestoreSuccess =
|
|
13075
|
+
const onRestoreSuccess = useCallback17(async () => {
|
|
13024
13076
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
13025
13077
|
const verify = await verifyToken2();
|
|
13026
13078
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -13506,7 +13558,7 @@ var init_cloudStorage = __esm({
|
|
|
13506
13558
|
|
|
13507
13559
|
// src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts
|
|
13508
13560
|
import { useMutation as useMutation9, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
13509
|
-
import { useCallback as
|
|
13561
|
+
import { useCallback as useCallback18, useEffect as useEffect19 } from "react";
|
|
13510
13562
|
function useCreateBackup() {
|
|
13511
13563
|
const qc = useQueryClient9();
|
|
13512
13564
|
const session = useSession((st) => st.session);
|
|
@@ -13515,7 +13567,7 @@ function useCreateBackup() {
|
|
|
13515
13567
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
13516
13568
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
13517
13569
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
13518
|
-
|
|
13570
|
+
useEffect19(() => {
|
|
13519
13571
|
if (!hasServerVault) {
|
|
13520
13572
|
useRestoreStore.getState().setMethod("server");
|
|
13521
13573
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -13523,7 +13575,7 @@ function useCreateBackup() {
|
|
|
13523
13575
|
}, [hasServerVault]);
|
|
13524
13576
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
13525
13577
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
13526
|
-
const onBackupSuccess =
|
|
13578
|
+
const onBackupSuccess = useCallback18(() => {
|
|
13527
13579
|
console.log("[EMBARKAI BACKUP] Backup created successfully");
|
|
13528
13580
|
}, [hasServerVault]);
|
|
13529
13581
|
const { mutate: createPasswordBackup, isPending: isPasswordBackupCreating } = useMutation9({
|
|
@@ -13810,7 +13862,7 @@ var init_useRestoreAccount = __esm({
|
|
|
13810
13862
|
});
|
|
13811
13863
|
|
|
13812
13864
|
// src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts
|
|
13813
|
-
import { useEffect as
|
|
13865
|
+
import { useEffect as useEffect20 } from "react";
|
|
13814
13866
|
function validateRestoreFileFormat(parsedData) {
|
|
13815
13867
|
if (typeof parsedData !== "object" || parsedData === null) return false;
|
|
13816
13868
|
const data = parsedData;
|
|
@@ -13820,7 +13872,7 @@ function useValidateFileBackup() {
|
|
|
13820
13872
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
13821
13873
|
const setError = useRestoreStore((st) => st.setError);
|
|
13822
13874
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
13823
|
-
|
|
13875
|
+
useEffect20(() => {
|
|
13824
13876
|
if (!restoreFile) {
|
|
13825
13877
|
return;
|
|
13826
13878
|
}
|
|
@@ -13946,7 +13998,7 @@ var init_MethodSelector = __esm({
|
|
|
13946
13998
|
|
|
13947
13999
|
// src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx
|
|
13948
14000
|
import { ChevronRight as ChevronRight2, Eye, EyeOff, Info as Info3, Key as Key4, Loader as Loader8, Plus } from "lucide-react";
|
|
13949
|
-
import { useEffect as
|
|
14001
|
+
import { useEffect as useEffect21, useRef as useRef14 } from "react";
|
|
13950
14002
|
import { Fragment as Fragment18, jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
13951
14003
|
function PasswordPasskey(props) {
|
|
13952
14004
|
const { t } = useT();
|
|
@@ -13961,7 +14013,7 @@ function PasswordPasskey(props) {
|
|
|
13961
14013
|
onCreatePasskey
|
|
13962
14014
|
} = props;
|
|
13963
14015
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
13964
|
-
const actionRef =
|
|
14016
|
+
const actionRef = useRef14(null);
|
|
13965
14017
|
const {
|
|
13966
14018
|
showPassword,
|
|
13967
14019
|
restorePassword,
|
|
@@ -13975,7 +14027,7 @@ function PasswordPasskey(props) {
|
|
|
13975
14027
|
} = useRestoreStore();
|
|
13976
14028
|
const { config } = useProviderConfig();
|
|
13977
14029
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
13978
|
-
|
|
14030
|
+
useEffect21(() => {
|
|
13979
14031
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
13980
14032
|
}, [isPasskeyEnabled, usePasskey]);
|
|
13981
14033
|
return /* @__PURE__ */ jsxs53(Fragment18, { children: [
|
|
@@ -14303,7 +14355,7 @@ var init_File = __esm({
|
|
|
14303
14355
|
import { useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
14304
14356
|
import dayjs3 from "dayjs";
|
|
14305
14357
|
import { Download as Download3, Key as Key5, Upload as Upload3 } from "lucide-react";
|
|
14306
|
-
import { useEffect as
|
|
14358
|
+
import { useEffect as useEffect22 } from "react";
|
|
14307
14359
|
import { Fragment as Fragment21, jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
14308
14360
|
function Server(props) {
|
|
14309
14361
|
const { isLoading, mode = "restore", serverHandler, createPasskeyHandler } = props;
|
|
@@ -14313,7 +14365,7 @@ function Server(props) {
|
|
|
14313
14365
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
14314
14366
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
14315
14367
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
14316
|
-
|
|
14368
|
+
useEffect22(() => {
|
|
14317
14369
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
14318
14370
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
14319
14371
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -14496,7 +14548,7 @@ var init_select = __esm({
|
|
|
14496
14548
|
// src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx
|
|
14497
14549
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
14498
14550
|
import { ArrowLeft as ArrowLeft10, CloudDownload, CloudUpload, Loader as Loader9 } from "lucide-react";
|
|
14499
|
-
import { useEffect as
|
|
14551
|
+
import { useEffect as useEffect23 } from "react";
|
|
14500
14552
|
import { Fragment as Fragment22, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
14501
14553
|
function Cloud2(props) {
|
|
14502
14554
|
const { isLoading, mode = "restore", cloudHandler } = props;
|
|
@@ -14517,7 +14569,7 @@ function Cloud2(props) {
|
|
|
14517
14569
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
14518
14570
|
}
|
|
14519
14571
|
});
|
|
14520
|
-
|
|
14572
|
+
useEffect23(() => {
|
|
14521
14573
|
if (isCloudProvidersLoading) return;
|
|
14522
14574
|
if (!!cloudProvidersError) {
|
|
14523
14575
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -14757,7 +14809,7 @@ var init_methods = __esm({
|
|
|
14757
14809
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
14758
14810
|
import { useMutation as useMutation11, useQuery as useQuery7, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
14759
14811
|
import { AlertCircle as AlertCircle2, CheckCircle2, CloudDownload as CloudDownload2, Loader as Loader10, UserCircle as UserCircle2 } from "lucide-react";
|
|
14760
|
-
import { useEffect as
|
|
14812
|
+
import { useEffect as useEffect24 } from "react";
|
|
14761
14813
|
import { useDisconnect } from "wagmi";
|
|
14762
14814
|
import { Fragment as Fragment24, jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
14763
14815
|
var RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
@@ -14794,7 +14846,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14794
14846
|
const error = useRestoreStore((st) => st.error);
|
|
14795
14847
|
const success = useRestoreStore((st) => st.success);
|
|
14796
14848
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
14797
|
-
|
|
14849
|
+
useEffect24(() => {
|
|
14798
14850
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
14799
14851
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
14800
14852
|
setIsDialogForced(true);
|
|
@@ -14834,7 +14886,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14834
14886
|
queryFn: async () => await getShareRecoveryStats()
|
|
14835
14887
|
});
|
|
14836
14888
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
14837
|
-
|
|
14889
|
+
useEffect24(() => {
|
|
14838
14890
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
14839
14891
|
}, [hasServerBackup]);
|
|
14840
14892
|
const { mutate: disconnect, isPending: isDisconnecting } = useMutation11({
|
|
@@ -14981,7 +15033,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14981
15033
|
// src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx
|
|
14982
15034
|
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
14983
15035
|
import { AlertCircle as AlertCircle3, ArrowLeft as ArrowLeft11, CheckCircle2 as CheckCircle22, Loader as Loader11, LockIcon } from "lucide-react";
|
|
14984
|
-
import { useEffect as
|
|
15036
|
+
import { useEffect as useEffect25 } from "react";
|
|
14985
15037
|
import { Fragment as Fragment25, jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
14986
15038
|
function KeyshareBackupMenu() {
|
|
14987
15039
|
const address = useSession((st) => st.address);
|
|
@@ -14992,7 +15044,7 @@ function KeyshareBackupMenu() {
|
|
|
14992
15044
|
const currentBackupMethod = useRestoreStore((st) => st.method);
|
|
14993
15045
|
const error = useRestoreStore((st) => st.error);
|
|
14994
15046
|
const success = useRestoreStore((st) => st.success);
|
|
14995
|
-
|
|
15047
|
+
useEffect25(() => {
|
|
14996
15048
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
14997
15049
|
return () => {
|
|
14998
15050
|
setSuccess(null);
|
|
@@ -15011,7 +15063,7 @@ function KeyshareBackupMenu() {
|
|
|
15011
15063
|
queryFn: async () => await getShareRecoveryStats()
|
|
15012
15064
|
});
|
|
15013
15065
|
const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15014
|
-
|
|
15066
|
+
useEffect25(() => {
|
|
15015
15067
|
if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
|
|
15016
15068
|
}, [hasRecoveryData]);
|
|
15017
15069
|
const {
|
|
@@ -15164,7 +15216,7 @@ var init_KeyshareRestoreMenu2 = __esm({
|
|
|
15164
15216
|
});
|
|
15165
15217
|
|
|
15166
15218
|
// src/hooks/useColorMode.ts
|
|
15167
|
-
import { useCallback as
|
|
15219
|
+
import { useCallback as useCallback19, useEffect as useEffect26 } from "react";
|
|
15168
15220
|
function useColorMode() {
|
|
15169
15221
|
const {
|
|
15170
15222
|
config: { current: config }
|
|
@@ -15172,14 +15224,14 @@ function useColorMode() {
|
|
|
15172
15224
|
const preferedColorMode = config?.preferedColorMode;
|
|
15173
15225
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
15174
15226
|
const handleStoreColorMode = useLayoutStore((st) => st.setColorMode);
|
|
15175
|
-
const setColorMode =
|
|
15227
|
+
const setColorMode = useCallback19(
|
|
15176
15228
|
(mode) => {
|
|
15177
15229
|
localStorage.setItem(LOCAL_COLOR_MODE_KEY, mode);
|
|
15178
15230
|
handleStoreColorMode(mode);
|
|
15179
15231
|
},
|
|
15180
15232
|
[handleStoreColorMode]
|
|
15181
15233
|
);
|
|
15182
|
-
|
|
15234
|
+
useEffect26(() => {
|
|
15183
15235
|
let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
|
|
15184
15236
|
if (!targetColorMode && !preferedColorMode) {
|
|
15185
15237
|
const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -15294,17 +15346,17 @@ var init_SumsubIframeManager = __esm({
|
|
|
15294
15346
|
});
|
|
15295
15347
|
|
|
15296
15348
|
// src/internal/components/KYC/useSumsubIframe.ts
|
|
15297
|
-
import { useEffect as
|
|
15349
|
+
import { useEffect as useEffect27, useRef as useRef15, useState as useState17 } from "react";
|
|
15298
15350
|
function useSumsubIframe({ iframeUrl }) {
|
|
15299
15351
|
const config = useProviderConfig().config;
|
|
15300
15352
|
const { colorMode } = useColorMode();
|
|
15301
|
-
const iframeRef =
|
|
15353
|
+
const iframeRef = useRef15(null);
|
|
15302
15354
|
const [isLoading, setIsLoading] = useState17(true);
|
|
15303
15355
|
const [error, setError] = useState17(null);
|
|
15304
15356
|
const [height, setHeight] = useState17(0);
|
|
15305
15357
|
const [status, setStatus] = useState17("");
|
|
15306
15358
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
15307
|
-
|
|
15359
|
+
useEffect27(() => {
|
|
15308
15360
|
setError(null);
|
|
15309
15361
|
setIsLoading(true);
|
|
15310
15362
|
setStatus("Preparing verification...");
|
|
@@ -15616,14 +15668,14 @@ var init_useProvidersList = __esm({
|
|
|
15616
15668
|
|
|
15617
15669
|
// src/internal/components/MainMenu/MainMenu.tsx
|
|
15618
15670
|
import { ChevronLeft, ChevronRight as ChevronRight3, DollarSign as DollarSign2, Wallet2 as Wallet23 } from "lucide-react";
|
|
15619
|
-
import { useEffect as
|
|
15671
|
+
import { useEffect as useEffect28 } from "react";
|
|
15620
15672
|
import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
15621
15673
|
function MainMenu() {
|
|
15622
15674
|
const address = useSession((st) => st.address);
|
|
15623
15675
|
const { t } = useT();
|
|
15624
15676
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
15625
15677
|
const setTransitionPageHeight = useLayoutDataStore((st) => st.setTransitionPageHeight);
|
|
15626
|
-
|
|
15678
|
+
useEffect28(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
|
|
15627
15679
|
useProvidersList();
|
|
15628
15680
|
return /* @__PURE__ */ jsx72("div", { className: "w-full p-[var(--ui-kit-pd)] flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ jsx72("div", { className: "w-full grid grid-cols-4 gap-0 md:gap-[var(--ui-kit-gap)] py-[10px] md:py-1", children: MAIN_MENU_BUTTONS.map(({ id, label, icon: Icon2 }) => /* @__PURE__ */ jsxs66(
|
|
15629
15681
|
Button,
|
|
@@ -15668,7 +15720,7 @@ var init_MainMenu2 = __esm({
|
|
|
15668
15720
|
|
|
15669
15721
|
// src/modules/linkedProfiles.ts
|
|
15670
15722
|
import { useQuery as useQuery11, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
|
|
15671
|
-
import { useCallback as
|
|
15723
|
+
import { useCallback as useCallback20 } from "react";
|
|
15672
15724
|
function useLinkedProfiles() {
|
|
15673
15725
|
const qc = useQueryClient12();
|
|
15674
15726
|
const address = useSession((st) => st.address);
|
|
@@ -15692,7 +15744,7 @@ function useLinkedProfiles() {
|
|
|
15692
15744
|
}
|
|
15693
15745
|
});
|
|
15694
15746
|
const { profiles = [], avatar = null } = data || {};
|
|
15695
|
-
const refresh =
|
|
15747
|
+
const refresh = useCallback20(async () => {
|
|
15696
15748
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15697
15749
|
}, [qc, address]);
|
|
15698
15750
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
@@ -16170,7 +16222,7 @@ var init_EmailNotConnectedWarning = __esm({
|
|
|
16170
16222
|
|
|
16171
16223
|
// src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts
|
|
16172
16224
|
import { useQueryClient as useQueryClient15 } from "@tanstack/react-query";
|
|
16173
|
-
import React21, { useEffect as
|
|
16225
|
+
import React21, { useEffect as useEffect29 } from "react";
|
|
16174
16226
|
function normalizeSocialLinkError(message) {
|
|
16175
16227
|
if (message === "X_ALREADY_LINKED") {
|
|
16176
16228
|
return "This X account is already linked to another account";
|
|
@@ -16246,7 +16298,7 @@ function useLinkSocial() {
|
|
|
16246
16298
|
[config.social?.providers]
|
|
16247
16299
|
);
|
|
16248
16300
|
const [socialLinkStarted, setSocialLinkStarted] = React21.useState(false);
|
|
16249
|
-
|
|
16301
|
+
useEffect29(() => {
|
|
16250
16302
|
const key = providerType?.toLowerCase();
|
|
16251
16303
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
|
|
16252
16304
|
if (isWalletLinking) {
|
|
@@ -16329,7 +16381,7 @@ var init_telegram2 = __esm({
|
|
|
16329
16381
|
|
|
16330
16382
|
// src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts
|
|
16331
16383
|
import { useQueryClient as useQueryClient16 } from "@tanstack/react-query";
|
|
16332
|
-
import { useCallback as
|
|
16384
|
+
import { useCallback as useCallback21, useEffect as useEffect30, useState as useState18 } from "react";
|
|
16333
16385
|
function useLinkTelegram() {
|
|
16334
16386
|
const {
|
|
16335
16387
|
config: { current: config },
|
|
@@ -16340,7 +16392,7 @@ function useLinkTelegram() {
|
|
|
16340
16392
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16341
16393
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16342
16394
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16343
|
-
const handleLinkTelegram =
|
|
16395
|
+
const handleLinkTelegram = useCallback21(async () => {
|
|
16344
16396
|
try {
|
|
16345
16397
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16346
16398
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16388,7 +16440,7 @@ function useLinkTelegram() {
|
|
|
16388
16440
|
}
|
|
16389
16441
|
}, [config.social?.providers]);
|
|
16390
16442
|
const [telegramLinkStarted, setTelegramLinkStarted] = useState18(false);
|
|
16391
|
-
|
|
16443
|
+
useEffect30(() => {
|
|
16392
16444
|
console.log("[useLinkTelegram] Effect triggered:", {
|
|
16393
16445
|
providerType,
|
|
16394
16446
|
linkIsLoading,
|
|
@@ -16405,7 +16457,7 @@ function useLinkTelegram() {
|
|
|
16405
16457
|
handleLinkTelegram();
|
|
16406
16458
|
}
|
|
16407
16459
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
|
|
16408
|
-
|
|
16460
|
+
useEffect30(() => {
|
|
16409
16461
|
if (providerType !== "telegram") {
|
|
16410
16462
|
setTelegramLinkStarted(false);
|
|
16411
16463
|
}
|
|
@@ -16949,7 +17001,7 @@ var init_nickname_validation = __esm({
|
|
|
16949
17001
|
// src/internal/components/NicknameMenu/NicknameEditForm.tsx
|
|
16950
17002
|
import { useMutation as useMutation16, useQueryClient as useQueryClient18 } from "@tanstack/react-query";
|
|
16951
17003
|
import { AtSign, Check as Check2, ChevronRight as ChevronRight5, Copy as Copy2, Loader as Loader17 } from "lucide-react";
|
|
16952
|
-
import { useCallback as
|
|
17004
|
+
import { useCallback as useCallback22, useState as useState20 } from "react";
|
|
16953
17005
|
import { Fragment as Fragment29, jsx as jsx80, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
16954
17006
|
function NicknameEditForm(props) {
|
|
16955
17007
|
const {
|
|
@@ -17000,7 +17052,7 @@ function NicknameEditForm(props) {
|
|
|
17000
17052
|
);
|
|
17001
17053
|
}
|
|
17002
17054
|
});
|
|
17003
|
-
const handleInputChange =
|
|
17055
|
+
const handleInputChange = useCallback22(
|
|
17004
17056
|
(e) => {
|
|
17005
17057
|
const value = e.target.value;
|
|
17006
17058
|
setInputValue(value);
|
|
@@ -17014,7 +17066,7 @@ function NicknameEditForm(props) {
|
|
|
17014
17066
|
},
|
|
17015
17067
|
[clientError, isNicknameChangeError, isNicknameChangeSuccess, reset, t]
|
|
17016
17068
|
);
|
|
17017
|
-
const handleSubmit =
|
|
17069
|
+
const handleSubmit = useCallback22(
|
|
17018
17070
|
(e) => {
|
|
17019
17071
|
if (!canChange) return;
|
|
17020
17072
|
e.preventDefault();
|
|
@@ -17097,19 +17149,19 @@ var init_NicknameEditForm = __esm({
|
|
|
17097
17149
|
|
|
17098
17150
|
// src/internal/components/NicknameMenu/useNickname.ts
|
|
17099
17151
|
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
17100
|
-
import { useEffect as
|
|
17152
|
+
import { useEffect as useEffect31, useState as useState21 } from "react";
|
|
17101
17153
|
function useNicknameForm(currentNickname) {
|
|
17102
17154
|
const [inputValue, setInputValue] = useState21("");
|
|
17103
17155
|
const normalizedInputValue = normalizeNickname(inputValue);
|
|
17104
17156
|
const validation = validateNickname(inputValue);
|
|
17105
17157
|
const isValidForCheck = validation.valid && normalizedInputValue.length > 0;
|
|
17106
|
-
|
|
17158
|
+
useEffect31(() => {
|
|
17107
17159
|
setInputValue(currentNickname);
|
|
17108
17160
|
}, [currentNickname]);
|
|
17109
17161
|
const [queryInputValue, setQueryInputValue] = useState21("");
|
|
17110
17162
|
const isSameAsCurrentNickname = normalizedInputValue === currentNickname.toLowerCase();
|
|
17111
17163
|
const shouldCheckAvailability = validation.valid && !isSameAsCurrentNickname && inputValue.length > 0;
|
|
17112
|
-
|
|
17164
|
+
useEffect31(() => {
|
|
17113
17165
|
if (!isValidForCheck || !shouldCheckAvailability) {
|
|
17114
17166
|
setQueryInputValue("");
|
|
17115
17167
|
return;
|
|
@@ -17151,10 +17203,11 @@ var init_useNickname = __esm({
|
|
|
17151
17203
|
// src/internal/components/NicknameMenu/NicknameMenu.tsx
|
|
17152
17204
|
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
17153
17205
|
import dayjs4 from "dayjs";
|
|
17154
|
-
import {
|
|
17206
|
+
import { ArrowLeft as ArrowLeft15, Info as Info4, Loader as Loader18 } from "lucide-react";
|
|
17155
17207
|
import { useState as useState22 } from "react";
|
|
17156
17208
|
import { jsx as jsx81, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
17157
17209
|
function NicknameMenu() {
|
|
17210
|
+
const { isInitialUser } = usePageParams();
|
|
17158
17211
|
const address = useSession((st) => st.address);
|
|
17159
17212
|
const { t } = useT();
|
|
17160
17213
|
const [clientError, setClientError] = useState22(null);
|
|
@@ -17236,10 +17289,27 @@ function NicknameMenu() {
|
|
|
17236
17289
|
/* @__PURE__ */ jsx81("strong", { className: "text-[var(--ui-kit-fg)]", children: nicknameInfo.changeCount })
|
|
17237
17290
|
] })
|
|
17238
17291
|
] }),
|
|
17239
|
-
|
|
17240
|
-
/* @__PURE__ */ jsx81(
|
|
17241
|
-
|
|
17242
|
-
|
|
17292
|
+
isInitialUser && /* @__PURE__ */ jsxs75(Highlight, { type: "success", children: [
|
|
17293
|
+
/* @__PURE__ */ jsx81("p", {
|
|
17294
|
+
//@ts-expect-error i18n typings
|
|
17295
|
+
children: t("passport:nicknameMenu.initialUser.welcome", {
|
|
17296
|
+
nickname: nicknameInfo?.handle || "N/A"
|
|
17297
|
+
})
|
|
17298
|
+
}),
|
|
17299
|
+
/* @__PURE__ */ jsx81("p", { children: t("passport:nicknameMenu.initialUser.message") }),
|
|
17300
|
+
/* @__PURE__ */ jsx81(
|
|
17301
|
+
Button,
|
|
17302
|
+
{
|
|
17303
|
+
variant: "default-glow",
|
|
17304
|
+
size: "large",
|
|
17305
|
+
title: t("passport:common.continue"),
|
|
17306
|
+
onClick: () => setPage(null),
|
|
17307
|
+
className: "w-full",
|
|
17308
|
+
children: t("passport:common.continue")
|
|
17309
|
+
}
|
|
17310
|
+
)
|
|
17311
|
+
] }),
|
|
17312
|
+
!!resolvedError?.length && /* @__PURE__ */ jsx81(Highlight, { type: "error", children: resolvedError })
|
|
17243
17313
|
] })
|
|
17244
17314
|
}
|
|
17245
17315
|
);
|
|
@@ -17247,6 +17317,7 @@ function NicknameMenu() {
|
|
|
17247
17317
|
var init_NicknameMenu = __esm({
|
|
17248
17318
|
"src/internal/components/NicknameMenu/NicknameMenu.tsx"() {
|
|
17249
17319
|
init_SessionContext();
|
|
17320
|
+
init_useOpenPage();
|
|
17250
17321
|
init_i18n();
|
|
17251
17322
|
init_nickname();
|
|
17252
17323
|
init_profile();
|
|
@@ -17416,7 +17487,7 @@ var init_useWatchTokens = __esm({
|
|
|
17416
17487
|
// src/internal/hooks/useBlockscoutAssets.ts
|
|
17417
17488
|
import { createBlockscoutClient } from "@embarkai/core/clients";
|
|
17418
17489
|
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
17419
|
-
import { useCallback as
|
|
17490
|
+
import { useCallback as useCallback23, useMemo as useMemo10, useRef as useRef16 } from "react";
|
|
17420
17491
|
import { formatEther, formatUnits as formatUnits3 } from "viem";
|
|
17421
17492
|
function resolveIpfsUri(uri) {
|
|
17422
17493
|
if (!uri) return "";
|
|
@@ -17552,7 +17623,7 @@ function useBlockscoutAssets(options) {
|
|
|
17552
17623
|
() => blockscoutApiUrl ? createBlockscoutClient({ baseUrl: blockscoutApiUrl }) : null,
|
|
17553
17624
|
[blockscoutApiUrl]
|
|
17554
17625
|
);
|
|
17555
|
-
const lastRefreshRef =
|
|
17626
|
+
const lastRefreshRef = useRef16(0);
|
|
17556
17627
|
const {
|
|
17557
17628
|
assets: watchTokenAssets,
|
|
17558
17629
|
isLoading: watchTokensLoading,
|
|
@@ -17723,7 +17794,7 @@ function useBlockscoutAssets(options) {
|
|
|
17723
17794
|
if (!tokensError) return null;
|
|
17724
17795
|
return createError(tokensError);
|
|
17725
17796
|
}, [tokensError]);
|
|
17726
|
-
const refreshBalances =
|
|
17797
|
+
const refreshBalances = useCallback23(async () => {
|
|
17727
17798
|
const now = Date.now();
|
|
17728
17799
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
17729
17800
|
return;
|
|
@@ -17731,7 +17802,7 @@ function useBlockscoutAssets(options) {
|
|
|
17731
17802
|
lastRefreshRef.current = now;
|
|
17732
17803
|
await Promise.all([refetchNative(), refetchTokens(), refetchNfts(), refetchWatchTokens()]);
|
|
17733
17804
|
}, [refetchNative, refetchTokens, refetchNfts, refetchWatchTokens]);
|
|
17734
|
-
const getTokenBalance =
|
|
17805
|
+
const getTokenBalance = useCallback23(
|
|
17735
17806
|
(tokenAddress) => {
|
|
17736
17807
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
17737
17808
|
},
|
|
@@ -17826,7 +17897,7 @@ var init_BalanceView2 = __esm({
|
|
|
17826
17897
|
});
|
|
17827
17898
|
|
|
17828
17899
|
// src/internal/components/PortfolioMenu/PortfolioItem.tsx
|
|
17829
|
-
import { useQuery as useQuery16
|
|
17900
|
+
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
17830
17901
|
import { LoaderIcon as LoaderIcon7, ShieldAlertIcon, SparklesIcon } from "lucide-react";
|
|
17831
17902
|
import { formatUnits as formatUnits5 } from "viem";
|
|
17832
17903
|
import { Fragment as Fragment30, jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
@@ -17845,6 +17916,9 @@ function isSecurityToken(asset) {
|
|
|
17845
17916
|
if (!("type" in asset)) return false;
|
|
17846
17917
|
return asset.type === "erc3643";
|
|
17847
17918
|
}
|
|
17919
|
+
function isProjectAssetConfig(asset) {
|
|
17920
|
+
return "balanceQueryKey" in asset && "balanceQuery" in asset;
|
|
17921
|
+
}
|
|
17848
17922
|
function isAssetRateAvailable(symbol) {
|
|
17849
17923
|
switch (symbol) {
|
|
17850
17924
|
// list of prohibited symbols without market data on Binance
|
|
@@ -17928,11 +18002,17 @@ function PortfolioItemImage(props) {
|
|
|
17928
18002
|
function PortfolioItem(props) {
|
|
17929
18003
|
const { address, asset, isProjectAsset } = props;
|
|
17930
18004
|
const providerConfig = useProviderConfig().config.current;
|
|
17931
|
-
const { assets: projectAssets, showBalanceAs: showBalanceAsSymbol } = providerConfig.projectAssets || {};
|
|
17932
18005
|
const customAssetRateQuery = providerConfig.portfolio?.assetRateQuery;
|
|
17933
|
-
const
|
|
17934
|
-
|
|
17935
|
-
|
|
18006
|
+
const projectAssetQuery = isProjectAsset && isProjectAssetConfig(asset) ? {
|
|
18007
|
+
queryKey: asset.balanceQueryKey,
|
|
18008
|
+
queryFn: asset.balanceQuery
|
|
18009
|
+
} : void 0;
|
|
18010
|
+
const { data: projectAssetBalance } = useQuery16({
|
|
18011
|
+
enabled: !!projectAssetQuery,
|
|
18012
|
+
retry: false,
|
|
18013
|
+
queryKey: projectAssetQuery?.queryKey ?? ["project-asset-balance-disabled", asset.symbol],
|
|
18014
|
+
queryFn: async () => projectAssetQuery?.queryFn() ?? null
|
|
18015
|
+
});
|
|
17936
18016
|
const isNft = isNftAsset(asset);
|
|
17937
18017
|
const isSecurity = isSecurityToken(asset);
|
|
17938
18018
|
const embeddedRate = Number(asset.exchangeRateUsd || 0);
|
|
@@ -17945,8 +18025,8 @@ function PortfolioItem(props) {
|
|
|
17945
18025
|
// customAssetRateQueryKey
|
|
17946
18026
|
queryFn: async () => await resolveAssetRate(asset.symbol, asset.address, customAssetRateQuery)
|
|
17947
18027
|
});
|
|
17948
|
-
const
|
|
17949
|
-
const renderBalance =
|
|
18028
|
+
const hasProjectAssetBalance = isProjectAsset && projectAssetBalance != null;
|
|
18029
|
+
const renderBalance = hasProjectAssetBalance ? projectAssetBalance.cryptoFormatted : Number(formatUnits5(BigInt(asset?.balance || "0"), asset?.decimals || 18));
|
|
17950
18030
|
const resolvedRate = hasEmbeddedRate ? embeddedRate : Number(assetRate?.price || 0);
|
|
17951
18031
|
const usdRenderBalance = resolvedRate > 0 ? renderBalance * resolvedRate : 0;
|
|
17952
18032
|
const shortContractAddress = asset.address ? truncateMiddle(asset.address, 6, 4) : null;
|
|
@@ -18027,14 +18107,14 @@ var init_PortfolioItem = __esm({
|
|
|
18027
18107
|
});
|
|
18028
18108
|
|
|
18029
18109
|
// src/internal/components/PortfolioMenu/PortfolioMenu.tsx
|
|
18030
|
-
import { useQueryClient as
|
|
18110
|
+
import { useQueryClient as useQueryClient19 } from "@tanstack/react-query";
|
|
18031
18111
|
import { AlertCircle as AlertCircle4, ArrowLeft as ArrowLeft16, Gem, Loader as Loader19, RefreshCw as RefreshCw2 } from "lucide-react";
|
|
18032
|
-
import { useCallback as
|
|
18112
|
+
import { useCallback as useCallback24 } from "react";
|
|
18033
18113
|
import { jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
18034
18114
|
function PortfolioMenu() {
|
|
18035
18115
|
const { assets: projectAssets = [] } = useProviderConfig().config.current?.projectAssets || {};
|
|
18036
18116
|
const { t } = useT();
|
|
18037
|
-
const qc =
|
|
18117
|
+
const qc = useQueryClient19();
|
|
18038
18118
|
const address = useSession((st) => st.address);
|
|
18039
18119
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
18040
18120
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
@@ -18049,7 +18129,7 @@ function PortfolioMenu() {
|
|
|
18049
18129
|
enabled: !!address
|
|
18050
18130
|
});
|
|
18051
18131
|
const shownProjectAssests = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
18052
|
-
const refreshAllAssetsBalances =
|
|
18132
|
+
const refreshAllAssetsBalances = useCallback24(() => {
|
|
18053
18133
|
Promise.all(shownProjectAssests.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
18054
18134
|
refreshBlockscoutBalances();
|
|
18055
18135
|
}, [qc, shownProjectAssests, refreshBlockscoutBalances]);
|
|
@@ -18204,7 +18284,7 @@ var init_nickname_fingerprint = __esm({
|
|
|
18204
18284
|
// src/internal/components/ReceiveMenu/ReceiveMenu.tsx
|
|
18205
18285
|
import { ArrowLeft as ArrowLeft17, CheckCircle2 as CheckCircle23, Copy as Copy3, Info as Info5, Loader as Loader20, Shield } from "lucide-react";
|
|
18206
18286
|
import QRCode from "qrcode";
|
|
18207
|
-
import { useCallback as
|
|
18287
|
+
import { useCallback as useCallback25, useEffect as useEffect32, useMemo as useMemo11, useState as useState23 } from "react";
|
|
18208
18288
|
import { Fragment as Fragment31, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
18209
18289
|
function ReceiveMenu() {
|
|
18210
18290
|
const session = useSession((st) => st.session);
|
|
@@ -18226,7 +18306,7 @@ function ReceiveMenu() {
|
|
|
18226
18306
|
return null;
|
|
18227
18307
|
}
|
|
18228
18308
|
}, [session?.ownerAddress]);
|
|
18229
|
-
|
|
18309
|
+
useEffect32(() => {
|
|
18230
18310
|
if (open && address) {
|
|
18231
18311
|
QRCode.toDataURL(address, {
|
|
18232
18312
|
width: 200,
|
|
@@ -18239,7 +18319,7 @@ function ReceiveMenu() {
|
|
|
18239
18319
|
});
|
|
18240
18320
|
}
|
|
18241
18321
|
}, [open, address]);
|
|
18242
|
-
const handleCopy =
|
|
18322
|
+
const handleCopy = useCallback25(async () => {
|
|
18243
18323
|
if (!address) return;
|
|
18244
18324
|
try {
|
|
18245
18325
|
await navigator.clipboard.writeText(address);
|
|
@@ -18249,7 +18329,7 @@ function ReceiveMenu() {
|
|
|
18249
18329
|
console.error("Failed to copy address:", error);
|
|
18250
18330
|
}
|
|
18251
18331
|
}, [address]);
|
|
18252
|
-
const handleCopyFingerprint =
|
|
18332
|
+
const handleCopyFingerprint = useCallback25(async () => {
|
|
18253
18333
|
if (!fingerprint) return;
|
|
18254
18334
|
try {
|
|
18255
18335
|
await navigator.clipboard.writeText(fingerprint);
|
|
@@ -18749,12 +18829,12 @@ var init_UntrustApplication = __esm({
|
|
|
18749
18829
|
});
|
|
18750
18830
|
|
|
18751
18831
|
// src/internal/components/SecurityMenu/SecurityMenu.tsx
|
|
18752
|
-
import { useMutation as useMutation17, useQueryClient as
|
|
18832
|
+
import { useMutation as useMutation17, useQueryClient as useQueryClient20 } from "@tanstack/react-query";
|
|
18753
18833
|
import { ArrowLeft as ArrowLeft18 } from "lucide-react";
|
|
18754
18834
|
import { useState as useState24 } from "react";
|
|
18755
18835
|
import { jsx as jsx91, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
18756
18836
|
function SecurityMenu() {
|
|
18757
|
-
const qc =
|
|
18837
|
+
const qc = useQueryClient20();
|
|
18758
18838
|
const { t } = useT();
|
|
18759
18839
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18760
18840
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
@@ -19096,7 +19176,7 @@ var init_useBridgeStore = __esm({
|
|
|
19096
19176
|
// src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx
|
|
19097
19177
|
import { useConnectModal } from "@rainbow-me/rainbowkit";
|
|
19098
19178
|
import { useMutation as useMutation18 } from "@tanstack/react-query";
|
|
19099
|
-
import { useEffect as
|
|
19179
|
+
import { useEffect as useEffect33, useRef as useRef17, useState as useState25 } from "react";
|
|
19100
19180
|
import { useSignMessage } from "wagmi";
|
|
19101
19181
|
import { jsx as jsx92, jsxs as jsxs86 } from "react/jsx-runtime";
|
|
19102
19182
|
function SenderSelector(props) {
|
|
@@ -19107,12 +19187,12 @@ function SenderSelector(props) {
|
|
|
19107
19187
|
const { openConnectModal } = useConnectModal();
|
|
19108
19188
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19109
19189
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
19110
|
-
const pendingWalletRef =
|
|
19190
|
+
const pendingWalletRef = useRef17(null);
|
|
19111
19191
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
19112
19192
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
19113
19193
|
const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
|
|
19114
19194
|
const [walletMessage, setWalletMessage] = useState25(null);
|
|
19115
|
-
|
|
19195
|
+
useEffect33(() => {
|
|
19116
19196
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19117
19197
|
}, [walletMessage]);
|
|
19118
19198
|
const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = useMutation18({
|
|
@@ -19168,7 +19248,7 @@ function SenderSelector(props) {
|
|
|
19168
19248
|
setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
|
|
19169
19249
|
}
|
|
19170
19250
|
});
|
|
19171
|
-
|
|
19251
|
+
useEffect33(() => {
|
|
19172
19252
|
const pendingProfile = pendingWalletRef.current;
|
|
19173
19253
|
if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
|
|
19174
19254
|
if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
|
|
@@ -19341,12 +19421,12 @@ var init_wallets = __esm({
|
|
|
19341
19421
|
});
|
|
19342
19422
|
|
|
19343
19423
|
// src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts
|
|
19344
|
-
import { useEffect as
|
|
19424
|
+
import { useEffect as useEffect34, useRef as useRef18 } from "react";
|
|
19345
19425
|
function useAvailableSenders() {
|
|
19346
19426
|
const address = useSession((st) => st.address);
|
|
19347
19427
|
const { profiles } = useLinkedProfiles();
|
|
19348
|
-
const lastCalcedSenders =
|
|
19349
|
-
|
|
19428
|
+
const lastCalcedSenders = useRef18([]);
|
|
19429
|
+
useEffect34(() => {
|
|
19350
19430
|
const sendersAccumulator = [
|
|
19351
19431
|
{
|
|
19352
19432
|
type: "embarkai-wallet",
|
|
@@ -19708,7 +19788,7 @@ var init_utils8 = __esm({
|
|
|
19708
19788
|
// src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts
|
|
19709
19789
|
import { useInfiniteQuery as useInfiniteQuery3 } from "@tanstack/react-query";
|
|
19710
19790
|
import { debounce as debounce6 } from "lodash-es";
|
|
19711
|
-
import { useCallback as
|
|
19791
|
+
import { useCallback as useCallback26, useEffect as useEffect35, useMemo as useMemo12 } from "react";
|
|
19712
19792
|
function useHyperlaneHistory() {
|
|
19713
19793
|
const address = useSession((st) => st.address);
|
|
19714
19794
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -19728,13 +19808,13 @@ function useHyperlaneHistory() {
|
|
|
19728
19808
|
() => txHistoryData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
19729
19809
|
[txHistoryData]
|
|
19730
19810
|
);
|
|
19731
|
-
const updateExpandable =
|
|
19811
|
+
const updateExpandable = useCallback26(
|
|
19732
19812
|
debounce6(() => {
|
|
19733
19813
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
|
|
19734
19814
|
}, 250),
|
|
19735
19815
|
[]
|
|
19736
19816
|
);
|
|
19737
|
-
|
|
19817
|
+
useEffect35(() => {
|
|
19738
19818
|
if (isBridgeTxHistoryLoading || txList.length === 0) return;
|
|
19739
19819
|
updateExpandable();
|
|
19740
19820
|
}, [isBridgeTxHistoryLoading, txList]);
|
|
@@ -19769,16 +19849,16 @@ var init_useOperationHashesStore = __esm({
|
|
|
19769
19849
|
});
|
|
19770
19850
|
|
|
19771
19851
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts
|
|
19772
|
-
import { useMutation as useMutation19, useQueryClient as
|
|
19773
|
-
import { useCallback as
|
|
19852
|
+
import { useMutation as useMutation19, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
|
|
19853
|
+
import { useCallback as useCallback27 } from "react";
|
|
19774
19854
|
import { useSwitchChain, useWalletClient } from "wagmi";
|
|
19775
19855
|
function useBridge() {
|
|
19776
|
-
const qc =
|
|
19856
|
+
const qc = useQueryClient21();
|
|
19777
19857
|
const { t } = useT();
|
|
19778
19858
|
const address = useSession((st) => st.address);
|
|
19779
19859
|
const { data: walletClient } = useWalletClient();
|
|
19780
19860
|
const { switchChainAsync } = useSwitchChain();
|
|
19781
|
-
const swapDirection =
|
|
19861
|
+
const swapDirection = useCallback27(() => {
|
|
19782
19862
|
const {
|
|
19783
19863
|
bridgeStep,
|
|
19784
19864
|
originChain,
|
|
@@ -19830,7 +19910,7 @@ function useBridge() {
|
|
|
19830
19910
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
19831
19911
|
}
|
|
19832
19912
|
});
|
|
19833
|
-
const handleQuoteEstimation =
|
|
19913
|
+
const handleQuoteEstimation = useCallback27((amnt) => {
|
|
19834
19914
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
19835
19915
|
if (!amnt || !Number(amnt)) {
|
|
19836
19916
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -19974,7 +20054,7 @@ var init_useBridge = __esm({
|
|
|
19974
20054
|
|
|
19975
20055
|
// src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts
|
|
19976
20056
|
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
19977
|
-
import { useEffect as
|
|
20057
|
+
import { useEffect as useEffect36 } from "react";
|
|
19978
20058
|
function useHyperlaneRoutes() {
|
|
19979
20059
|
const address = useSession((st) => st.address);
|
|
19980
20060
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -19994,7 +20074,7 @@ function useHyperlaneRoutes() {
|
|
|
19994
20074
|
return warpRoutes;
|
|
19995
20075
|
}
|
|
19996
20076
|
});
|
|
19997
|
-
|
|
20077
|
+
useEffect36(() => {
|
|
19998
20078
|
if (!errorWarpRoutes) return;
|
|
19999
20079
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
20000
20080
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -20003,7 +20083,7 @@ function useHyperlaneRoutes() {
|
|
|
20003
20083
|
setOriginChain(null);
|
|
20004
20084
|
setDestinationChain(null);
|
|
20005
20085
|
}, [errorWarpRoutes]);
|
|
20006
|
-
|
|
20086
|
+
useEffect36(() => {
|
|
20007
20087
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
20008
20088
|
const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
20009
20089
|
if (!warpRouteToAutoSelect) return;
|
|
@@ -20036,13 +20116,13 @@ var init_useHyperlaneRoutes = __esm({
|
|
|
20036
20116
|
});
|
|
20037
20117
|
|
|
20038
20118
|
// src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts
|
|
20039
|
-
import { useEffect as
|
|
20119
|
+
import { useEffect as useEffect37 } from "react";
|
|
20040
20120
|
function useMenuTitle(warpRoutes) {
|
|
20041
20121
|
const { t } = useT();
|
|
20042
20122
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20043
20123
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20044
20124
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
20045
|
-
|
|
20125
|
+
useEffect37(() => {
|
|
20046
20126
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
20047
20127
|
switch (true) {
|
|
20048
20128
|
case bridgeStep === "sender-selector":
|
|
@@ -20093,8 +20173,8 @@ var init_ResolveChainIcon = __esm({
|
|
|
20093
20173
|
|
|
20094
20174
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts
|
|
20095
20175
|
import { CHAINS_BROWSERS_TRANSPORTS as CHAINS_BROWSERS_TRANSPORTS2 } from "@embarkai/core";
|
|
20096
|
-
import { useQuery as useQuery20, useQueryClient as
|
|
20097
|
-
import { useCallback as
|
|
20176
|
+
import { useQuery as useQuery20, useQueryClient as useQueryClient22 } from "@tanstack/react-query";
|
|
20177
|
+
import { useCallback as useCallback28, useEffect as useEffect38 } from "react";
|
|
20098
20178
|
import { createPublicClient as createPublicClient2, erc20Abi as erc20Abi2, formatUnits as formatUnits7, http as http3 } from "viem";
|
|
20099
20179
|
import { useSwitchChain as useSwitchChain2 } from "wagmi";
|
|
20100
20180
|
function checkWrapedTokenSymbol2(symbol) {
|
|
@@ -20104,7 +20184,7 @@ function checkWrapedTokenSymbol2(symbol) {
|
|
|
20104
20184
|
return symbol.toUpperCase();
|
|
20105
20185
|
}
|
|
20106
20186
|
function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
20107
|
-
const qc =
|
|
20187
|
+
const qc = useQueryClient22();
|
|
20108
20188
|
const { t } = useT();
|
|
20109
20189
|
const address = useSession((st) => st.address);
|
|
20110
20190
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
@@ -20189,7 +20269,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20189
20269
|
};
|
|
20190
20270
|
}
|
|
20191
20271
|
});
|
|
20192
|
-
const refreshRouteTokenBalance =
|
|
20272
|
+
const refreshRouteTokenBalance = useCallback28(
|
|
20193
20273
|
(senderWallet) => {
|
|
20194
20274
|
switch (true) {
|
|
20195
20275
|
case senderWallet === "embarkai-wallet":
|
|
@@ -20205,7 +20285,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20205
20285
|
},
|
|
20206
20286
|
[refreshBalances, qc]
|
|
20207
20287
|
);
|
|
20208
|
-
|
|
20288
|
+
useEffect38(() => {
|
|
20209
20289
|
if (!bridgeSender || !originChain) return;
|
|
20210
20290
|
switch (bridgeSender) {
|
|
20211
20291
|
case "embarkai-wallet":
|
|
@@ -20765,7 +20845,7 @@ var init_SuccessStep = __esm({
|
|
|
20765
20845
|
});
|
|
20766
20846
|
|
|
20767
20847
|
// src/internal/components/SendMenu/hyperbridge/steps/HistoryStep.tsx
|
|
20768
|
-
import { useQueryClient as
|
|
20848
|
+
import { useQueryClient as useQueryClient23 } from "@tanstack/react-query";
|
|
20769
20849
|
import dayjs7 from "dayjs";
|
|
20770
20850
|
import { ArrowRightIcon, DownloadIcon as DownloadIcon2, ExternalLinkIcon as ExternalLinkIcon3, InfoIcon as InfoIcon4, LoaderIcon as LoaderIcon11 } from "lucide-react";
|
|
20771
20851
|
import { jsx as jsx100, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
@@ -20886,7 +20966,7 @@ function HistoryItem(props) {
|
|
|
20886
20966
|
txStatus
|
|
20887
20967
|
} = props;
|
|
20888
20968
|
const { t } = useT();
|
|
20889
|
-
const qc =
|
|
20969
|
+
const qc = useQueryClient23();
|
|
20890
20970
|
const address = useSession((st) => st.address);
|
|
20891
20971
|
const warpRoutes = qc.getQueryData([HYPERLANE_WARP_ROUTES_QUERY_KEY, address]);
|
|
20892
20972
|
const assetWarpRoute = warpRoutes?.find((route) => {
|
|
@@ -21161,7 +21241,7 @@ var init_steps = __esm({
|
|
|
21161
21241
|
});
|
|
21162
21242
|
|
|
21163
21243
|
// src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx
|
|
21164
|
-
import { useEffect as
|
|
21244
|
+
import { useEffect as useEffect39 } from "react";
|
|
21165
21245
|
import { Fragment as Fragment38, jsx as jsx102, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
21166
21246
|
function HyperlaneBridge() {
|
|
21167
21247
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
@@ -21169,7 +21249,7 @@ function HyperlaneBridge() {
|
|
|
21169
21249
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21170
21250
|
const { directWalletProfile } = useAvailableSenders();
|
|
21171
21251
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21172
|
-
|
|
21252
|
+
useEffect39(() => {
|
|
21173
21253
|
return () => {
|
|
21174
21254
|
useBridgeStore.getState().resetSelections();
|
|
21175
21255
|
};
|
|
@@ -21215,14 +21295,14 @@ var init_HyperlaneBridge = __esm({
|
|
|
21215
21295
|
});
|
|
21216
21296
|
|
|
21217
21297
|
// src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx
|
|
21218
|
-
import { useRef as
|
|
21298
|
+
import { useRef as useRef19 } from "react";
|
|
21219
21299
|
import { jsx as jsx103 } from "react/jsx-runtime";
|
|
21220
21300
|
function BridgeHistorySwitch(props) {
|
|
21221
21301
|
const { disabled } = props;
|
|
21222
21302
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
21223
21303
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
21224
21304
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21225
|
-
const lastBridgeStepRef =
|
|
21305
|
+
const lastBridgeStepRef = useRef19(null);
|
|
21226
21306
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
21227
21307
|
return null;
|
|
21228
21308
|
}
|
|
@@ -21324,7 +21404,7 @@ var init_useErc3643Compliance = __esm({
|
|
|
21324
21404
|
|
|
21325
21405
|
// src/hooks/useNicknameResolve.ts
|
|
21326
21406
|
import { useQuery as useQuery21 } from "@tanstack/react-query";
|
|
21327
|
-
import { useEffect as
|
|
21407
|
+
import { useEffect as useEffect40, useMemo as useMemo14, useState as useState28 } from "react";
|
|
21328
21408
|
function looksLikeNickname(input) {
|
|
21329
21409
|
if (!input) return false;
|
|
21330
21410
|
if (input.startsWith("0x")) return false;
|
|
@@ -21338,7 +21418,7 @@ function useNicknameResolve(input, options) {
|
|
|
21338
21418
|
const [isDebouncing, setIsDebouncing] = useState28(false);
|
|
21339
21419
|
const normalized = normalizeNickname(input);
|
|
21340
21420
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
21341
|
-
|
|
21421
|
+
useEffect40(() => {
|
|
21342
21422
|
if (!isNicknameInput || !enabled) {
|
|
21343
21423
|
setDebouncedInput("");
|
|
21344
21424
|
setIsDebouncing(false);
|
|
@@ -21398,7 +21478,7 @@ var init_useNicknameResolve = __esm({
|
|
|
21398
21478
|
});
|
|
21399
21479
|
|
|
21400
21480
|
// src/hooks/useSendTransaction.ts
|
|
21401
|
-
import { useCallback as
|
|
21481
|
+
import { useCallback as useCallback29, useState as useState29 } from "react";
|
|
21402
21482
|
import { encodeFunctionData as encodeFunctionData2, isAddress, parseEther as parseEther2, parseUnits } from "viem";
|
|
21403
21483
|
function useSendTransaction() {
|
|
21404
21484
|
const session = useSession((st) => st.session);
|
|
@@ -21406,7 +21486,7 @@ function useSendTransaction() {
|
|
|
21406
21486
|
const [isLoading, setIsLoading] = useState29(false);
|
|
21407
21487
|
const [error, setError] = useState29(null);
|
|
21408
21488
|
const [userOpHash, setUserOpHash] = useState29(null);
|
|
21409
|
-
const sendTransaction =
|
|
21489
|
+
const sendTransaction = useCallback29(
|
|
21410
21490
|
async (params) => {
|
|
21411
21491
|
if (!session || !address) {
|
|
21412
21492
|
setError("No active session");
|
|
@@ -21503,7 +21583,7 @@ function useSendTransaction() {
|
|
|
21503
21583
|
},
|
|
21504
21584
|
[session, address]
|
|
21505
21585
|
);
|
|
21506
|
-
const reset =
|
|
21586
|
+
const reset = useCallback29(() => {
|
|
21507
21587
|
setError(null);
|
|
21508
21588
|
setUserOpHash(null);
|
|
21509
21589
|
setIsLoading(false);
|
|
@@ -21837,7 +21917,7 @@ var init_AssetList = __esm({
|
|
|
21837
21917
|
|
|
21838
21918
|
// src/internal/components/SendMenu/send/components/NicknameData.tsx
|
|
21839
21919
|
import { AtSign as AtSign2, CheckCircle2 as CheckCircle24, ShieldAlert, ShieldCheck as ShieldCheck2 } from "lucide-react";
|
|
21840
|
-
import { useEffect as
|
|
21920
|
+
import { useEffect as useEffect41 } from "react";
|
|
21841
21921
|
import { jsx as jsx107, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
21842
21922
|
function NicknameData(props) {
|
|
21843
21923
|
const { resolvedNicknameData, isNicknameInput } = props;
|
|
@@ -21850,11 +21930,11 @@ function NicknameData(props) {
|
|
|
21850
21930
|
isWalletNotSetup,
|
|
21851
21931
|
isFrozen
|
|
21852
21932
|
} = resolvedNicknameData;
|
|
21853
|
-
|
|
21933
|
+
useEffect41(() => {
|
|
21854
21934
|
if (!resolvedNicknameData?.data?.fingerprint || !isNicknameInput) return;
|
|
21855
21935
|
useFlowSelectorStore.getState().setRenderKey(`nickname-resolved-${Date.now()}`);
|
|
21856
21936
|
}, [resolvedNicknameData, isNicknameInput]);
|
|
21857
|
-
|
|
21937
|
+
useEffect41(() => {
|
|
21858
21938
|
if (isResolving) return;
|
|
21859
21939
|
let errMessage = null;
|
|
21860
21940
|
switch (true) {
|
|
@@ -22144,7 +22224,7 @@ var init_InputSendStep = __esm({
|
|
|
22144
22224
|
|
|
22145
22225
|
// src/internal/components/SendMenu/send/sendSteps/ConfirmSendStep.tsx
|
|
22146
22226
|
import { useMutation as useMutation20 } from "@tanstack/react-query";
|
|
22147
|
-
import { AlertTriangle as
|
|
22227
|
+
import { AlertTriangle as AlertTriangle5, AtSign as AtSign4, Loader as Loader29, Shield as Shield2, ShieldAlert as ShieldAlert2, ShieldCheck as ShieldCheck3 } from "lucide-react";
|
|
22148
22228
|
import { Fragment as Fragment41, jsx as jsx109, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
22149
22229
|
function ConfirmSendStep(props) {
|
|
22150
22230
|
const { sendTransaction, erc3643Compliance, isNicknameInput, resolvedNicknameData } = props;
|
|
@@ -22184,7 +22264,7 @@ function ConfirmSendStep(props) {
|
|
|
22184
22264
|
});
|
|
22185
22265
|
return /* @__PURE__ */ jsxs100(Fragment41, { children: [
|
|
22186
22266
|
isNicknameInput && isFrozen && /* @__PURE__ */ jsxs100(Highlight, { type: "warning", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
22187
|
-
/* @__PURE__ */ jsx109(
|
|
22267
|
+
/* @__PURE__ */ jsx109(AlertTriangle5, { className: "h-4 w-4" }),
|
|
22188
22268
|
/* @__PURE__ */ jsx109("span", { children: "This handle is frozen. Proceed with caution." })
|
|
22189
22269
|
] }),
|
|
22190
22270
|
isSecurity && erc3643CanTransfer && /* @__PURE__ */ jsxs100(Highlight, { type: "success", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
@@ -22335,7 +22415,7 @@ var init_sendSteps = __esm({
|
|
|
22335
22415
|
|
|
22336
22416
|
// src/internal/components/SendMenu/send/SendMenu.tsx
|
|
22337
22417
|
import { CheckCircle2 as CheckCircle26, Loader as Loader30 } from "lucide-react";
|
|
22338
|
-
import { useEffect as
|
|
22418
|
+
import { useEffect as useEffect42, useMemo as useMemo15 } from "react";
|
|
22339
22419
|
import { parseUnits as parseUnits2 } from "viem";
|
|
22340
22420
|
import { Fragment as Fragment42, jsx as jsx110, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
22341
22421
|
function SendMenu() {
|
|
@@ -22357,10 +22437,10 @@ function SendMenu() {
|
|
|
22357
22437
|
userOpHash,
|
|
22358
22438
|
reset
|
|
22359
22439
|
} = useSendTransaction();
|
|
22360
|
-
|
|
22440
|
+
useEffect42(() => {
|
|
22361
22441
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
22362
22442
|
}, [isAssetsLoading, isTransactionPending]);
|
|
22363
|
-
|
|
22443
|
+
useEffect42(() => {
|
|
22364
22444
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
22365
22445
|
}, [sendTransactionError]);
|
|
22366
22446
|
const {
|
|
@@ -22375,7 +22455,7 @@ function SendMenu() {
|
|
|
22375
22455
|
} = useSendStore();
|
|
22376
22456
|
const isNft = isNftAsset3(selectedAsset);
|
|
22377
22457
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22378
|
-
|
|
22458
|
+
useEffect42(
|
|
22379
22459
|
() => () => {
|
|
22380
22460
|
setSelectedAsset(null);
|
|
22381
22461
|
setRecipient("");
|
|
@@ -22385,7 +22465,7 @@ function SendMenu() {
|
|
|
22385
22465
|
},
|
|
22386
22466
|
[]
|
|
22387
22467
|
);
|
|
22388
|
-
|
|
22468
|
+
useEffect42(() => {
|
|
22389
22469
|
const shouldNativeDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
22390
22470
|
if (!shouldNativeDefaultAsset) return;
|
|
22391
22471
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -22413,7 +22493,7 @@ function SendMenu() {
|
|
|
22413
22493
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
22414
22494
|
chainId: activeChainId
|
|
22415
22495
|
});
|
|
22416
|
-
|
|
22496
|
+
useEffect42(() => {
|
|
22417
22497
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
22418
22498
|
switch (true) {
|
|
22419
22499
|
case txStep === "select-asset":
|
|
@@ -22504,7 +22584,7 @@ var init_send = __esm({
|
|
|
22504
22584
|
|
|
22505
22585
|
// src/internal/components/SendMenu/SendFlowSelector.tsx
|
|
22506
22586
|
import { ArrowLeft as ArrowLeft19, ArrowRightIcon as ArrowRightIcon2, ArrowRightLeftIcon as ArrowRightLeftIcon2, InfoIcon as InfoIcon5 } from "lucide-react";
|
|
22507
|
-
import { useEffect as
|
|
22587
|
+
import { useEffect as useEffect43 } from "react";
|
|
22508
22588
|
import { jsx as jsx111, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
22509
22589
|
function SelectorFlowButtons() {
|
|
22510
22590
|
const { t } = useT();
|
|
@@ -22567,7 +22647,7 @@ function SendFlowSelector() {
|
|
|
22567
22647
|
const error = useFlowSelectorStore((st) => st.error);
|
|
22568
22648
|
const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
|
|
22569
22649
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
22570
|
-
|
|
22650
|
+
useEffect43(
|
|
22571
22651
|
() => () => {
|
|
22572
22652
|
useFlowSelectorStore.getState().setError(null);
|
|
22573
22653
|
},
|
|
@@ -22733,7 +22813,7 @@ var init_constants6 = __esm({
|
|
|
22733
22813
|
// src/internal/components/SettingsMenu/SettingsMenu.tsx
|
|
22734
22814
|
import { useQuery as useQuery22 } from "@tanstack/react-query";
|
|
22735
22815
|
import { ArrowLeft as ArrowLeft20, HardDrive as HardDrive3 } from "lucide-react";
|
|
22736
|
-
import { useEffect as
|
|
22816
|
+
import { useEffect as useEffect44 } from "react";
|
|
22737
22817
|
import { jsx as jsx112, jsxs as jsxs103 } from "react/jsx-runtime";
|
|
22738
22818
|
function useSettingsButtons() {
|
|
22739
22819
|
const config = useProviderConfig().config;
|
|
@@ -22752,7 +22832,7 @@ function useSettingsButtons() {
|
|
|
22752
22832
|
if (proMode) {
|
|
22753
22833
|
settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: HardDrive3 });
|
|
22754
22834
|
}
|
|
22755
|
-
|
|
22835
|
+
useEffect44(() => {
|
|
22756
22836
|
const cssvEl = document.querySelector(".embarkai-ui-scope");
|
|
22757
22837
|
if (!cssvEl || !window?.getComputedStyle) {
|
|
22758
22838
|
return;
|
|
@@ -23689,12 +23769,12 @@ var init_TransactionsGroup = __esm({
|
|
|
23689
23769
|
});
|
|
23690
23770
|
|
|
23691
23771
|
// src/internal/components/TransactionsMenu/TransactionsMenu.tsx
|
|
23692
|
-
import { useQuery as useQuery23, useQueryClient as
|
|
23772
|
+
import { useQuery as useQuery23, useQueryClient as useQueryClient24 } from "@tanstack/react-query";
|
|
23693
23773
|
import { ArrowLeft as ArrowLeft22, Loader as Loader31, RefreshCw as RefreshCw3, XCircle } from "lucide-react";
|
|
23694
|
-
import { useCallback as
|
|
23774
|
+
import { useCallback as useCallback30, useState as useState31 } from "react";
|
|
23695
23775
|
import { jsx as jsx115, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
23696
23776
|
function TransactionsMenu() {
|
|
23697
|
-
const qc =
|
|
23777
|
+
const qc = useQueryClient24();
|
|
23698
23778
|
const address = useSession((st) => st.address);
|
|
23699
23779
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
23700
23780
|
const { t } = useT();
|
|
@@ -23713,7 +23793,7 @@ function TransactionsMenu() {
|
|
|
23713
23793
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
23714
23794
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
23715
23795
|
});
|
|
23716
|
-
const refreshTxHistory =
|
|
23796
|
+
const refreshTxHistory = useCallback30(
|
|
23717
23797
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
23718
23798
|
[qc, chainConfig.id, address]
|
|
23719
23799
|
);
|
|
@@ -23952,7 +24032,7 @@ var init_PageMap = __esm({
|
|
|
23952
24032
|
});
|
|
23953
24033
|
|
|
23954
24034
|
// src/internal/hooks/usePageMapper.tsx
|
|
23955
|
-
import { useCallback as
|
|
24035
|
+
import { useCallback as useCallback31, useEffect as useEffect45 } from "react";
|
|
23956
24036
|
import { jsx as jsx116 } from "react/jsx-runtime";
|
|
23957
24037
|
function usePageMapper() {
|
|
23958
24038
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -23964,7 +24044,7 @@ function usePageMapper() {
|
|
|
23964
24044
|
setIsDialogOpen,
|
|
23965
24045
|
setIsDialogClosing
|
|
23966
24046
|
} = useLayoutStore();
|
|
23967
|
-
const closeDialog =
|
|
24047
|
+
const closeDialog = useCallback31(() => {
|
|
23968
24048
|
setIsDialogClosing(true);
|
|
23969
24049
|
setTimeout(() => {
|
|
23970
24050
|
setDialogContent(null);
|
|
@@ -23975,7 +24055,7 @@ function usePageMapper() {
|
|
|
23975
24055
|
setIsDialogOpen(false);
|
|
23976
24056
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
23977
24057
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
23978
|
-
const openDialog =
|
|
24058
|
+
const openDialog = useCallback31(
|
|
23979
24059
|
(pageItem) => {
|
|
23980
24060
|
const PageContentComponent = pageItem.component;
|
|
23981
24061
|
setDialogTitle(pageItem.title);
|
|
@@ -23985,7 +24065,7 @@ function usePageMapper() {
|
|
|
23985
24065
|
},
|
|
23986
24066
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
23987
24067
|
);
|
|
23988
|
-
|
|
24068
|
+
useEffect45(() => {
|
|
23989
24069
|
if (page === null) return closeDialog();
|
|
23990
24070
|
const pageItem = PAGE_MAP[page];
|
|
23991
24071
|
if (!pageItem) {
|
|
@@ -24009,7 +24089,7 @@ var init_usePageMapper = __esm({
|
|
|
24009
24089
|
|
|
24010
24090
|
// src/internal/hooks/useSettingsNotifications.ts
|
|
24011
24091
|
import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
24012
|
-
import { useEffect as
|
|
24092
|
+
import { useEffect as useEffect46 } from "react";
|
|
24013
24093
|
function useSettingsNotifications() {
|
|
24014
24094
|
const address = useSession((st) => st.address);
|
|
24015
24095
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
@@ -24021,14 +24101,14 @@ function useSettingsNotifications() {
|
|
|
24021
24101
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24022
24102
|
queryFn: getUserProfile
|
|
24023
24103
|
});
|
|
24024
|
-
|
|
24104
|
+
useEffect46(() => {
|
|
24025
24105
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
24026
24106
|
setSettingsNotifications({
|
|
24027
24107
|
...COMPLETE_KYC_PROGRESS,
|
|
24028
24108
|
status: isKYCVerified ? "resolved" : "active"
|
|
24029
24109
|
});
|
|
24030
24110
|
}, [userProfile, setSettingsNotifications]);
|
|
24031
|
-
|
|
24111
|
+
useEffect46(() => {
|
|
24032
24112
|
setSettingsNotifications({
|
|
24033
24113
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
24034
24114
|
status: hasEmail ? "resolved" : "active"
|
|
@@ -24061,7 +24141,7 @@ var init_package = __esm({
|
|
|
24061
24141
|
"package.json"() {
|
|
24062
24142
|
package_default = {
|
|
24063
24143
|
name: "@embarkai/ui-kit",
|
|
24064
|
-
version: "0.4.
|
|
24144
|
+
version: "0.4.54",
|
|
24065
24145
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24066
24146
|
type: "module",
|
|
24067
24147
|
main: "./dist/index.cjs",
|
|
@@ -24162,12 +24242,12 @@ var init_package = __esm({
|
|
|
24162
24242
|
});
|
|
24163
24243
|
|
|
24164
24244
|
// src/internal/components/Footer/Footer.tsx
|
|
24165
|
-
import { useMutation as useMutation21, useQueryClient as
|
|
24245
|
+
import { useMutation as useMutation21, useQueryClient as useQueryClient25 } from "@tanstack/react-query";
|
|
24166
24246
|
import { Loader as Loader32, LogOut } from "lucide-react";
|
|
24167
24247
|
import { useDisconnect as useDisconnect3 } from "wagmi";
|
|
24168
24248
|
import { jsx as jsx117, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
24169
24249
|
function Footer() {
|
|
24170
|
-
const qc =
|
|
24250
|
+
const qc = useQueryClient25();
|
|
24171
24251
|
const { callbacksRef } = useProviderConfig();
|
|
24172
24252
|
const { t } = useT();
|
|
24173
24253
|
const address = useSession((st) => st.address);
|
|
@@ -24298,7 +24378,7 @@ var init_Footer2 = __esm({
|
|
|
24298
24378
|
// src/internal/components/Header/Header.tsx
|
|
24299
24379
|
import { useQuery as useQuery25 } from "@tanstack/react-query";
|
|
24300
24380
|
import { Copy as Copy5, Loader as Loader33 } from "lucide-react";
|
|
24301
|
-
import { useCallback as
|
|
24381
|
+
import { useCallback as useCallback32, useRef as useRef20, useState as useState32 } from "react";
|
|
24302
24382
|
import { Fragment as Fragment44, jsx as jsx118, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
24303
24383
|
function formatAddress2(addr) {
|
|
24304
24384
|
if (!addr) return "";
|
|
@@ -24312,9 +24392,9 @@ function Header() {
|
|
|
24312
24392
|
const proMode = useProMode();
|
|
24313
24393
|
const [proToast, setProToast] = useState32(false);
|
|
24314
24394
|
const [copied, setCopied] = useState32(false);
|
|
24315
|
-
const clickCountRef =
|
|
24316
|
-
const clickTimerRef =
|
|
24317
|
-
const handleAvatarClick =
|
|
24395
|
+
const clickCountRef = useRef20(0);
|
|
24396
|
+
const clickTimerRef = useRef20(null);
|
|
24397
|
+
const handleAvatarClick = useCallback32(() => {
|
|
24318
24398
|
clickCountRef.current += 1;
|
|
24319
24399
|
if (clickTimerRef.current) {
|
|
24320
24400
|
clearTimeout(clickTimerRef.current);
|
|
@@ -24616,7 +24696,7 @@ var init_visually_hidden = __esm({
|
|
|
24616
24696
|
|
|
24617
24697
|
// src/internal/components/Dialog/Dialog.tsx
|
|
24618
24698
|
import { AnimatePresence, motion } from "framer-motion";
|
|
24619
|
-
import { useEffect as
|
|
24699
|
+
import { useEffect as useEffect47 } from "react";
|
|
24620
24700
|
import { jsx as jsx121, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
24621
24701
|
function Dialog2() {
|
|
24622
24702
|
const config = useProviderConfig().config;
|
|
@@ -24628,7 +24708,7 @@ function Dialog2() {
|
|
|
24628
24708
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
24629
24709
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24630
24710
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
24631
|
-
|
|
24711
|
+
useEffect47(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
24632
24712
|
usePageMapper();
|
|
24633
24713
|
useAutoConnect();
|
|
24634
24714
|
useBackupStatusChanges();
|
|
@@ -24694,7 +24774,7 @@ var init_Dialog2 = __esm({
|
|
|
24694
24774
|
});
|
|
24695
24775
|
|
|
24696
24776
|
// src/internal/components/TssManager.tsx
|
|
24697
|
-
import React26, { useCallback as
|
|
24777
|
+
import React26, { useCallback as useCallback33 } from "react";
|
|
24698
24778
|
var TssManagerWithRef;
|
|
24699
24779
|
var init_TssManager = __esm({
|
|
24700
24780
|
"src/internal/components/TssManager.tsx"() {
|
|
@@ -24709,7 +24789,7 @@ var init_TssManager = __esm({
|
|
|
24709
24789
|
const setStatus = useSession((st) => st.setStatus);
|
|
24710
24790
|
const setSession = useSession((st) => st.setSession);
|
|
24711
24791
|
const setAddress = useSession((st) => st.setAddress);
|
|
24712
|
-
const onSessionCreated =
|
|
24792
|
+
const onSessionCreated = useCallback33(
|
|
24713
24793
|
(session, address) => {
|
|
24714
24794
|
setSession(session);
|
|
24715
24795
|
setAddress(address);
|
|
@@ -24749,11 +24829,11 @@ var init_TssManager = __esm({
|
|
|
24749
24829
|
|
|
24750
24830
|
// src/internal/components/WalletConnectHandler.tsx
|
|
24751
24831
|
import { useConnectModal as useConnectModal2 } from "@rainbow-me/rainbowkit";
|
|
24752
|
-
import { useMutation as useMutation22, useQueryClient as
|
|
24753
|
-
import React27, { useCallback as
|
|
24832
|
+
import { useMutation as useMutation22, useQueryClient as useQueryClient26 } from "@tanstack/react-query";
|
|
24833
|
+
import React27, { useCallback as useCallback34, useEffect as useEffect48 } from "react";
|
|
24754
24834
|
import { useAccount, useDisconnect as useDisconnect4, useSignMessage as useSignMessage2 } from "wagmi";
|
|
24755
24835
|
function WalletConnectHandler() {
|
|
24756
|
-
const qc =
|
|
24836
|
+
const qc = useQueryClient26();
|
|
24757
24837
|
const { callbacksRef } = useProviderConfig();
|
|
24758
24838
|
const passportWalletAddress = useSession((st) => st.address);
|
|
24759
24839
|
const { address: walletAddress, isConnected, chain, connector } = useAccount();
|
|
@@ -24773,7 +24853,7 @@ function WalletConnectHandler() {
|
|
|
24773
24853
|
const projectId = providerConfig?.projectId;
|
|
24774
24854
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
24775
24855
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
24776
|
-
const onLinkingComplete =
|
|
24856
|
+
const onLinkingComplete = useCallback34(
|
|
24777
24857
|
async (success) => {
|
|
24778
24858
|
setIsWalletLinking(false);
|
|
24779
24859
|
if (!success && !passportWalletAddress) {
|
|
@@ -24805,7 +24885,7 @@ function WalletConnectHandler() {
|
|
|
24805
24885
|
const [hasStartedLinking, setHasStartedLinking] = React27.useState(false);
|
|
24806
24886
|
const [modalWasOpened, setModalWasOpened] = React27.useState(false);
|
|
24807
24887
|
const [pendingModalOpen, setPendingModalOpen] = React27.useState(false);
|
|
24808
|
-
|
|
24888
|
+
useEffect48(() => {
|
|
24809
24889
|
if (isWalletLinking && !hasStartedLinking) {
|
|
24810
24890
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
24811
24891
|
isConnected,
|
|
@@ -24843,18 +24923,18 @@ function WalletConnectHandler() {
|
|
|
24843
24923
|
setProviderType,
|
|
24844
24924
|
walletMode
|
|
24845
24925
|
]);
|
|
24846
|
-
|
|
24926
|
+
useEffect48(() => {
|
|
24847
24927
|
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
24848
24928
|
setPendingModalOpen(false);
|
|
24849
24929
|
openConnectModal();
|
|
24850
24930
|
}
|
|
24851
24931
|
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
24852
|
-
|
|
24932
|
+
useEffect48(() => {
|
|
24853
24933
|
if (connectModalOpen && hasStartedLinking) {
|
|
24854
24934
|
setModalWasOpened(true);
|
|
24855
24935
|
}
|
|
24856
24936
|
}, [connectModalOpen, hasStartedLinking]);
|
|
24857
|
-
|
|
24937
|
+
useEffect48(() => {
|
|
24858
24938
|
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
24859
24939
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
24860
24940
|
onLinkingComplete(false);
|
|
@@ -24862,7 +24942,7 @@ function WalletConnectHandler() {
|
|
|
24862
24942
|
setModalWasOpened(false);
|
|
24863
24943
|
}
|
|
24864
24944
|
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
24865
|
-
|
|
24945
|
+
useEffect48(() => {
|
|
24866
24946
|
if (isWalletLinking) {
|
|
24867
24947
|
const timeout = setTimeout(() => {
|
|
24868
24948
|
console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
|
|
@@ -24982,7 +25062,7 @@ function WalletConnectHandler() {
|
|
|
24982
25062
|
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
24983
25063
|
}
|
|
24984
25064
|
});
|
|
24985
|
-
|
|
25065
|
+
useEffect48(() => {
|
|
24986
25066
|
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
24987
25067
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
24988
25068
|
if (!passportWalletAddress) {
|
|
@@ -24992,7 +25072,7 @@ function WalletConnectHandler() {
|
|
|
24992
25072
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
24993
25073
|
}
|
|
24994
25074
|
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
24995
|
-
|
|
25075
|
+
useEffect48(() => {
|
|
24996
25076
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
24997
25077
|
const timeout = setTimeout(() => {
|
|
24998
25078
|
console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
|
|
@@ -25028,7 +25108,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25028
25108
|
});
|
|
25029
25109
|
|
|
25030
25110
|
// src/internal/components/DirectWalletHandler.tsx
|
|
25031
|
-
import { useEffect as
|
|
25111
|
+
import { useEffect as useEffect49 } from "react";
|
|
25032
25112
|
import { useAccount as useAccount2 } from "wagmi";
|
|
25033
25113
|
function DirectWalletHandler() {
|
|
25034
25114
|
const walletMode = useProviderConfig().config.current?.wallet?.mode || "linked";
|
|
@@ -25040,13 +25120,13 @@ function DirectWalletHandler() {
|
|
|
25040
25120
|
const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
|
|
25041
25121
|
const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
|
|
25042
25122
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
25043
|
-
|
|
25123
|
+
useEffect49(() => {
|
|
25044
25124
|
setConfigMode(walletMode);
|
|
25045
25125
|
if (walletMode !== "both") {
|
|
25046
25126
|
setActiveMode(walletMode);
|
|
25047
25127
|
}
|
|
25048
25128
|
}, [walletMode, setConfigMode, setActiveMode]);
|
|
25049
|
-
|
|
25129
|
+
useEffect49(() => {
|
|
25050
25130
|
if (isConnected && address && !isExternalConnected && connector && chain?.id) {
|
|
25051
25131
|
setExternalWallet({
|
|
25052
25132
|
address,
|
|
@@ -25055,17 +25135,17 @@ function DirectWalletHandler() {
|
|
|
25055
25135
|
});
|
|
25056
25136
|
}
|
|
25057
25137
|
}, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
|
|
25058
|
-
|
|
25138
|
+
useEffect49(() => {
|
|
25059
25139
|
if (isExternalConnected && !isConnected) {
|
|
25060
25140
|
clearExternalWallet();
|
|
25061
25141
|
}
|
|
25062
25142
|
}, [isConnected, isExternalConnected, clearExternalWallet]);
|
|
25063
|
-
|
|
25143
|
+
useEffect49(() => {
|
|
25064
25144
|
if (isExternalConnected && isConnected && chain?.id) {
|
|
25065
25145
|
setExternalChainId(chain.id);
|
|
25066
25146
|
}
|
|
25067
25147
|
}, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
|
|
25068
|
-
|
|
25148
|
+
useEffect49(() => {
|
|
25069
25149
|
if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
|
|
25070
25150
|
setExternalWallet({
|
|
25071
25151
|
address,
|
|
@@ -27892,11 +27972,11 @@ import { initSdkErrorTracking } from "@embarkai/core/internal/error-tracking";
|
|
|
27892
27972
|
import { merge as merge3 } from "lodash-es";
|
|
27893
27973
|
import {
|
|
27894
27974
|
createContext,
|
|
27895
|
-
useCallback as
|
|
27975
|
+
useCallback as useCallback35,
|
|
27896
27976
|
useContext,
|
|
27897
|
-
useEffect as
|
|
27977
|
+
useEffect as useEffect50,
|
|
27898
27978
|
useMemo as useMemo17,
|
|
27899
|
-
useRef as
|
|
27979
|
+
useRef as useRef21
|
|
27900
27980
|
} from "react";
|
|
27901
27981
|
import { jsx as jsx125 } from "react/jsx-runtime";
|
|
27902
27982
|
function clearLegacyWagmiStorage() {
|
|
@@ -27916,10 +27996,10 @@ function clearLegacyWagmiStorage() {
|
|
|
27916
27996
|
}
|
|
27917
27997
|
function Provider(props) {
|
|
27918
27998
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
27919
|
-
const callbacksRef =
|
|
27920
|
-
|
|
27921
|
-
const config =
|
|
27922
|
-
const updateConfig =
|
|
27999
|
+
const callbacksRef = useRef21(callbacks);
|
|
28000
|
+
useEffect50(() => notifyNoProjetctId(projectId), [projectId]);
|
|
28001
|
+
const config = useRef21(merge3({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
28002
|
+
const updateConfig = useCallback35((updates) => {
|
|
27923
28003
|
const prev = config.current;
|
|
27924
28004
|
const next = { ...prev };
|
|
27925
28005
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -27953,12 +28033,12 @@ function Provider(props) {
|
|
|
27953
28033
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
27954
28034
|
config.current = next;
|
|
27955
28035
|
}, []);
|
|
27956
|
-
const updateCallbacks =
|
|
28036
|
+
const updateCallbacks = useCallback35((updates) => {
|
|
27957
28037
|
const prev = callbacksRef.current;
|
|
27958
28038
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
27959
28039
|
callbacksRef.current = next;
|
|
27960
28040
|
}, []);
|
|
27961
|
-
|
|
28041
|
+
useEffect50(() => {
|
|
27962
28042
|
if (typeof window === "undefined" || !projectId) return;
|
|
27963
28043
|
const mergedConfig = merge3(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
27964
28044
|
updateConfig(mergedConfig);
|
|
@@ -27978,7 +28058,7 @@ function Provider(props) {
|
|
|
27978
28058
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
27979
28059
|
}
|
|
27980
28060
|
}, [projectId, initialConfig]);
|
|
27981
|
-
|
|
28061
|
+
useEffect50(() => {
|
|
27982
28062
|
if (typeof window === "undefined" || !projectId) return;
|
|
27983
28063
|
try {
|
|
27984
28064
|
initSdkErrorTracking();
|
|
@@ -28068,7 +28148,7 @@ init_pro_mode();
|
|
|
28068
28148
|
init_utils2();
|
|
28069
28149
|
import { useQuery as useQuery26 } from "@tanstack/react-query";
|
|
28070
28150
|
import { Cloud as Cloud4, Laptop as Laptop2, Loader as Loader34, Shield as Shield3 } from "lucide-react";
|
|
28071
|
-
import { useEffect as
|
|
28151
|
+
import { useEffect as useEffect51, useMemo as useMemo18 } from "react";
|
|
28072
28152
|
import { Fragment as Fragment47, jsx as jsx126, jsxs as jsxs112 } from "react/jsx-runtime";
|
|
28073
28153
|
function getFormattedStatus(label, status, showStatus) {
|
|
28074
28154
|
const isStatus = showStatus && status && status !== "idle" && status !== "ready";
|
|
@@ -28088,7 +28168,7 @@ function ConnectWalletButton(props) {
|
|
|
28088
28168
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28089
28169
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
28090
28170
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
28091
|
-
|
|
28171
|
+
useEffect51(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
28092
28172
|
const { data: profile, isLoading: isProfileLoading } = useQuery26({
|
|
28093
28173
|
retry: false,
|
|
28094
28174
|
enabled: !!address,
|
|
@@ -28280,29 +28360,8 @@ var useHasServerVault = () => useSession((st) => st.hasServerVault);
|
|
|
28280
28360
|
var useActiveChainId = () => useSession((st) => st.activeChainId);
|
|
28281
28361
|
var useHydrated = () => useSession((st) => st.hasHydrated);
|
|
28282
28362
|
|
|
28283
|
-
// src/hooks/useOpenPage.ts
|
|
28284
|
-
init_SessionContext();
|
|
28285
|
-
init_useLayoutDataStore();
|
|
28286
|
-
import { useCallback as useCallback35 } from "react";
|
|
28287
|
-
function useOpenPage() {
|
|
28288
|
-
const page = useLayoutDataStore((st) => st.page);
|
|
28289
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
28290
|
-
const setPageParams = useLayoutDataStore((st) => st.setPageParams);
|
|
28291
|
-
const address = useSession((st) => st.address);
|
|
28292
|
-
const open = useCallback35(
|
|
28293
|
-
(passportPage, params) => {
|
|
28294
|
-
if (!address) return setPage("auth" /* AUTH */);
|
|
28295
|
-
if (!!address && passportPage === "auth" /* AUTH */) return setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
28296
|
-
setPage(passportPage);
|
|
28297
|
-
if (!!params) setPageParams(params);
|
|
28298
|
-
},
|
|
28299
|
-
[setPage, setPageParams, address]
|
|
28300
|
-
);
|
|
28301
|
-
const close = useCallback35(() => setPage(null), [setPage]);
|
|
28302
|
-
return { open, close, isOpen: page !== null };
|
|
28303
|
-
}
|
|
28304
|
-
|
|
28305
28363
|
// src/index.ts
|
|
28364
|
+
init_useOpenPage();
|
|
28306
28365
|
init_useColorMode();
|
|
28307
28366
|
|
|
28308
28367
|
// src/components/ThemeToggle.tsx
|
|
@@ -28760,13 +28819,13 @@ var Hash = ({
|
|
|
28760
28819
|
|
|
28761
28820
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
28762
28821
|
init_base2();
|
|
28763
|
-
import { useEffect as
|
|
28822
|
+
import { useEffect as useEffect53, useState as useState36 } from "react";
|
|
28764
28823
|
import { jsx as jsx132, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
28765
28824
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
28766
28825
|
const [transactions, setTransactions] = useState36([]);
|
|
28767
28826
|
const [loading, setLoading] = useState36(true);
|
|
28768
28827
|
const [error, setError] = useState36(null);
|
|
28769
|
-
|
|
28828
|
+
useEffect53(() => {
|
|
28770
28829
|
const fetchTransactions2 = async () => {
|
|
28771
28830
|
try {
|
|
28772
28831
|
setLoading(true);
|