@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.cjs
CHANGED
|
@@ -2436,8 +2436,49 @@ var init_useAutoConnect = __esm({
|
|
|
2436
2436
|
}
|
|
2437
2437
|
});
|
|
2438
2438
|
|
|
2439
|
+
// src/hooks/useOpenPage.ts
|
|
2440
|
+
function useOpenPage() {
|
|
2441
|
+
const page = useLayoutDataStore((st) => st.page);
|
|
2442
|
+
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
2443
|
+
const setPageParams = useLayoutDataStore((st) => st.setPageParams);
|
|
2444
|
+
const address = useSession((st) => st.address);
|
|
2445
|
+
const open = (0, import_react4.useCallback)(
|
|
2446
|
+
(passportPage, params) => {
|
|
2447
|
+
if (!address) return setPage("auth" /* AUTH */);
|
|
2448
|
+
if (!!address && passportPage === "auth" /* AUTH */) return setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
2449
|
+
setPage(passportPage);
|
|
2450
|
+
if (!!params) setPageParams(params);
|
|
2451
|
+
},
|
|
2452
|
+
[setPage, setPageParams, address]
|
|
2453
|
+
);
|
|
2454
|
+
const close = (0, import_react4.useCallback)(() => {
|
|
2455
|
+
setPageParams(null);
|
|
2456
|
+
setPage(null);
|
|
2457
|
+
}, [setPage, setPageParams]);
|
|
2458
|
+
return { open, close, isOpen: page !== null };
|
|
2459
|
+
}
|
|
2460
|
+
function usePageParams() {
|
|
2461
|
+
const currentParams = (0, import_react4.useRef)({});
|
|
2462
|
+
(0, import_react4.useEffect)(() => {
|
|
2463
|
+
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
2464
|
+
if (!pageParams) return;
|
|
2465
|
+
currentParams.current = pageParams;
|
|
2466
|
+
setPageParams(null);
|
|
2467
|
+
}, []);
|
|
2468
|
+
return currentParams.current;
|
|
2469
|
+
}
|
|
2470
|
+
var import_react4;
|
|
2471
|
+
var init_useOpenPage = __esm({
|
|
2472
|
+
"src/hooks/useOpenPage.ts"() {
|
|
2473
|
+
import_react4 = require("react");
|
|
2474
|
+
init_SessionContext();
|
|
2475
|
+
init_useLayoutDataStore();
|
|
2476
|
+
}
|
|
2477
|
+
});
|
|
2478
|
+
|
|
2439
2479
|
// src/internal/hooks/useBackupStatusChanges.ts
|
|
2440
2480
|
function useBackupStatusChanges() {
|
|
2481
|
+
const { open: openPage } = useOpenPage();
|
|
2441
2482
|
const { mutate: handleBackupStatusChanged } = (0, import_react_query3.useMutation)({
|
|
2442
2483
|
mutationFn: async (event) => {
|
|
2443
2484
|
const customEvent = event;
|
|
@@ -2456,14 +2497,14 @@ function useBackupStatusChanges() {
|
|
|
2456
2497
|
const isNewUserTouched = localStorage.getItem(NEW_USER_TOUCHED_KEY) === "true";
|
|
2457
2498
|
if (!isNewUserTouched && !!jwt?.isNewUser) {
|
|
2458
2499
|
localStorage.setItem(NEW_USER_TOUCHED_KEY, "true");
|
|
2459
|
-
|
|
2500
|
+
openPage("nickname-settings" /* NICKNAME_SETTINGS */, { isInitialUser: true });
|
|
2460
2501
|
}
|
|
2461
2502
|
if (!!isNewUserTouched && !jwt?.isNewUser) {
|
|
2462
2503
|
localStorage.removeItem(NEW_USER_TOUCHED_KEY);
|
|
2463
2504
|
}
|
|
2464
2505
|
} else {
|
|
2465
2506
|
setHasServerVault(false);
|
|
2466
|
-
|
|
2507
|
+
openPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
2467
2508
|
console.warn("[BACKUP STATUS] No recovery data found in vault, marking as no-server-vault");
|
|
2468
2509
|
}
|
|
2469
2510
|
},
|
|
@@ -2472,22 +2513,22 @@ function useBackupStatusChanges() {
|
|
|
2472
2513
|
console.warn("[BACKUP STATUS] Failed to fetch initial vault status:", error);
|
|
2473
2514
|
}
|
|
2474
2515
|
});
|
|
2475
|
-
(0,
|
|
2516
|
+
(0, import_react5.useEffect)(() => {
|
|
2476
2517
|
window.addEventListener("lumia-passport-backup-status-changed", handleBackupStatusChanged);
|
|
2477
2518
|
return () => {
|
|
2478
2519
|
window.removeEventListener("lumia-passport-backup-status-changed", handleBackupStatusChanged);
|
|
2479
2520
|
};
|
|
2480
2521
|
}, []);
|
|
2481
2522
|
}
|
|
2482
|
-
var import_react_query3,
|
|
2523
|
+
var import_react_query3, import_react5, NEW_USER_TOUCHED_KEY;
|
|
2483
2524
|
var init_useBackupStatusChanges = __esm({
|
|
2484
2525
|
"src/internal/hooks/useBackupStatusChanges.ts"() {
|
|
2485
2526
|
init_SessionContext();
|
|
2527
|
+
init_useOpenPage();
|
|
2486
2528
|
import_react_query3 = require("@tanstack/react-query");
|
|
2487
|
-
|
|
2529
|
+
import_react5 = require("react");
|
|
2488
2530
|
init_auth();
|
|
2489
2531
|
init_vaultClient();
|
|
2490
|
-
init_useLayoutDataStore();
|
|
2491
2532
|
NEW_USER_TOUCHED_KEY = "embarkai-is-new-user-touhced";
|
|
2492
2533
|
}
|
|
2493
2534
|
});
|
|
@@ -2530,7 +2571,7 @@ function useDetectMaxScrollHeight() {
|
|
|
2530
2571
|
const page = useLayoutDataStore((state) => state.page);
|
|
2531
2572
|
const setIsMobileView = useLayoutStore((state) => state.setIsMobileView);
|
|
2532
2573
|
const setMaxScrollHeight = useLayoutStore((state) => state.setMaxScrollHeight);
|
|
2533
|
-
const onResize = (0,
|
|
2574
|
+
const onResize = (0, import_react6.useCallback)(
|
|
2534
2575
|
(0, import_lodash_es2.debounce)(({ width, height }) => {
|
|
2535
2576
|
const headerHeight = page === "auth" /* AUTH */ || page === "keyshare-restore" /* KEYSHARE_RESTORE */ ? 0 : 116;
|
|
2536
2577
|
const limContentHeight = height * 0.92 - headerHeight - 57;
|
|
@@ -2539,18 +2580,18 @@ function useDetectMaxScrollHeight() {
|
|
|
2539
2580
|
}, DEBOUNCE_DELAY),
|
|
2540
2581
|
[page, setMaxScrollHeight, setIsMobileView]
|
|
2541
2582
|
);
|
|
2542
|
-
(0,
|
|
2583
|
+
(0, import_react6.useEffect)(() => {
|
|
2543
2584
|
const obs = new ResizeObserver(([entry]) => onResize(entry.contentRect));
|
|
2544
2585
|
const doc = window.document.getElementsByTagName("html")[0];
|
|
2545
2586
|
if (doc) obs.observe(doc);
|
|
2546
2587
|
return () => obs.disconnect();
|
|
2547
2588
|
}, [onResize]);
|
|
2548
2589
|
}
|
|
2549
|
-
var import_lodash_es2,
|
|
2590
|
+
var import_lodash_es2, import_react6, DEBOUNCE_DELAY;
|
|
2550
2591
|
var init_useDetectMaxScrollHeight = __esm({
|
|
2551
2592
|
"src/internal/hooks/useDetectMaxScrollHeight.ts"() {
|
|
2552
2593
|
import_lodash_es2 = require("lodash-es");
|
|
2553
|
-
|
|
2594
|
+
import_react6 = require("react");
|
|
2554
2595
|
init_constants();
|
|
2555
2596
|
init_useLayoutDataStore();
|
|
2556
2597
|
init_useLayoutStore();
|
|
@@ -2562,7 +2603,7 @@ var init_useDetectMaxScrollHeight = __esm({
|
|
|
2562
2603
|
function useListenIframeAuthEvents() {
|
|
2563
2604
|
const setPage = useLayoutDataStore((state) => state.setPage);
|
|
2564
2605
|
const setIsIframeReady = useSession((state) => state.setIsIframeReady);
|
|
2565
|
-
const handleIframeMessage = (0,
|
|
2606
|
+
const handleIframeMessage = (0, import_react7.useCallback)(
|
|
2566
2607
|
(event) => {
|
|
2567
2608
|
const type = event.data?.type?.startsWith?.("LUMIA_PASSPORT_") ? event.data.type.replace("LUMIA_PASSPORT_", "IFRAME_MSG_") : event.data?.type;
|
|
2568
2609
|
if (type === "IFRAME_MSG_IFRAME_READY") {
|
|
@@ -2578,16 +2619,16 @@ function useListenIframeAuthEvents() {
|
|
|
2578
2619
|
},
|
|
2579
2620
|
[setPage, setIsIframeReady]
|
|
2580
2621
|
);
|
|
2581
|
-
(0,
|
|
2622
|
+
(0, import_react7.useEffect)(() => {
|
|
2582
2623
|
window.addEventListener("message", handleIframeMessage);
|
|
2583
2624
|
return () => window.removeEventListener("message", handleIframeMessage);
|
|
2584
2625
|
}, [handleIframeMessage]);
|
|
2585
2626
|
}
|
|
2586
|
-
var
|
|
2627
|
+
var import_react7;
|
|
2587
2628
|
var init_useListenIframeAuthEvents = __esm({
|
|
2588
2629
|
"src/internal/hooks/useListenIframeAuthEvents.ts"() {
|
|
2589
2630
|
init_SessionContext();
|
|
2590
|
-
|
|
2631
|
+
import_react7 = require("react");
|
|
2591
2632
|
init_useLayoutDataStore();
|
|
2592
2633
|
}
|
|
2593
2634
|
});
|
|
@@ -5070,19 +5111,19 @@ var init_utils2 = __esm({
|
|
|
5070
5111
|
});
|
|
5071
5112
|
|
|
5072
5113
|
// src/internal/components/Expandable/hooks/useExpandable.ts
|
|
5073
|
-
var
|
|
5114
|
+
var import_react8, useExpandable;
|
|
5074
5115
|
var init_useExpandable = __esm({
|
|
5075
5116
|
"src/internal/components/Expandable/hooks/useExpandable.ts"() {
|
|
5076
|
-
|
|
5117
|
+
import_react8 = require("react");
|
|
5077
5118
|
useExpandable = (props) => {
|
|
5078
5119
|
const { isExpanded = false, children, initHeight = 0, minHeight = 0 } = props;
|
|
5079
|
-
const expandableRef = (0,
|
|
5080
|
-
const contentRef = (0,
|
|
5081
|
-
(0,
|
|
5120
|
+
const expandableRef = (0, import_react8.useRef)(null);
|
|
5121
|
+
const contentRef = (0, import_react8.useRef)(null);
|
|
5122
|
+
(0, import_react8.useEffect)(() => {
|
|
5082
5123
|
if (!expandableRef.current) return;
|
|
5083
5124
|
expandableRef.current.style.setProperty("--ifo-basic-expandable-h", `${initHeight}px )`);
|
|
5084
5125
|
}, []);
|
|
5085
|
-
const setExpandableHeight = (0,
|
|
5126
|
+
const setExpandableHeight = (0, import_react8.useCallback)(
|
|
5086
5127
|
(isExpnd) => {
|
|
5087
5128
|
if (!contentRef.current || !expandableRef.current) return;
|
|
5088
5129
|
expandableRef.current.style.setProperty(
|
|
@@ -5093,7 +5134,7 @@ var init_useExpandable = __esm({
|
|
|
5093
5134
|
// ON_RESIZE_DELEAY),
|
|
5094
5135
|
[minHeight]
|
|
5095
5136
|
);
|
|
5096
|
-
(0,
|
|
5137
|
+
(0, import_react8.useEffect)(() => {
|
|
5097
5138
|
if (!contentRef.current || !expandableRef.current) return;
|
|
5098
5139
|
const obs = new ResizeObserver(() => setExpandableHeight(isExpanded));
|
|
5099
5140
|
obs.observe(expandableRef.current);
|
|
@@ -5108,17 +5149,17 @@ var init_useExpandable = __esm({
|
|
|
5108
5149
|
});
|
|
5109
5150
|
|
|
5110
5151
|
// src/internal/components/Expandable/Expandable.tsx
|
|
5111
|
-
var
|
|
5152
|
+
var import_react9, import_jsx_runtime2, Expandable;
|
|
5112
5153
|
var init_Expandable = __esm({
|
|
5113
5154
|
"src/internal/components/Expandable/Expandable.tsx"() {
|
|
5114
5155
|
init_utils2();
|
|
5115
|
-
|
|
5156
|
+
import_react9 = require("react");
|
|
5116
5157
|
init_useExpandable();
|
|
5117
5158
|
import_jsx_runtime2 = require("react/jsx-runtime");
|
|
5118
|
-
Expandable = (0,
|
|
5159
|
+
Expandable = (0, import_react9.forwardRef)((props, ref) => {
|
|
5119
5160
|
const { children, className, contentClassName, minHeight, divProps } = props;
|
|
5120
5161
|
const { expandableRef, contentRef } = useExpandable(props);
|
|
5121
|
-
(0,
|
|
5162
|
+
(0, import_react9.useImperativeHandle)(ref, () => expandableRef.current);
|
|
5122
5163
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5123
5164
|
"div",
|
|
5124
5165
|
{
|
|
@@ -5172,13 +5213,13 @@ var init_highlight = __esm({
|
|
|
5172
5213
|
});
|
|
5173
5214
|
|
|
5174
5215
|
// src/internal/components/ui/button.tsx
|
|
5175
|
-
var import_react_slot, import_class_variance_authority,
|
|
5216
|
+
var import_react_slot, import_class_variance_authority, import_react10, import_jsx_runtime4, buttonVariants, BORDER_RADIUSES, Button;
|
|
5176
5217
|
var init_button = __esm({
|
|
5177
5218
|
"src/internal/components/ui/button.tsx"() {
|
|
5178
5219
|
init_utils2();
|
|
5179
5220
|
import_react_slot = require("@radix-ui/react-slot");
|
|
5180
5221
|
import_class_variance_authority = require("class-variance-authority");
|
|
5181
|
-
|
|
5222
|
+
import_react10 = require("react");
|
|
5182
5223
|
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
5183
5224
|
buttonVariants = (0, import_class_variance_authority.cva)(
|
|
5184
5225
|
cn(
|
|
@@ -5248,7 +5289,7 @@ var init_button = __esm({
|
|
|
5248
5289
|
large: "var(--ui-kit-el-bdrs)",
|
|
5249
5290
|
icon: ""
|
|
5250
5291
|
};
|
|
5251
|
-
Button = (0,
|
|
5292
|
+
Button = (0, import_react10.forwardRef)((props, ref) => {
|
|
5252
5293
|
const { className, variant = "default", size = "large", asChild = false, children, ...buttonProps } = props;
|
|
5253
5294
|
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
5254
5295
|
const isBorderGlow = variant === "secondary-glow" || variant === "default-glow";
|
|
@@ -5604,6 +5645,10 @@ var init_en = __esm({
|
|
|
5604
5645
|
checkingAvailability: "Checking availability...",
|
|
5605
5646
|
nicknameAvailable: "Nickname is available",
|
|
5606
5647
|
nicknameNotAvailable: "This nickname is not available"
|
|
5648
|
+
},
|
|
5649
|
+
initialUser: {
|
|
5650
|
+
welcome: "Your nickname is set as {{nickname}}",
|
|
5651
|
+
message: 'Change & Save on your demand, and "Continue":'
|
|
5607
5652
|
}
|
|
5608
5653
|
},
|
|
5609
5654
|
profilesMenu: {
|
|
@@ -5939,6 +5984,10 @@ var init_ru = __esm({
|
|
|
5939
5984
|
checkingAvailability: "\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0441\u0442\u0438...",
|
|
5940
5985
|
nicknameAvailable: "\u041D\u0438\u043A\u043D\u0435\u0439\u043C \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D",
|
|
5941
5986
|
nicknameNotAvailable: "\u042D\u0442\u043E\u0442 \u043D\u0438\u043A\u043D\u0435\u0439\u043C \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D"
|
|
5987
|
+
},
|
|
5988
|
+
initialUser: {
|
|
5989
|
+
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}}",
|
|
5990
|
+
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":'
|
|
5942
5991
|
}
|
|
5943
5992
|
},
|
|
5944
5993
|
profilesMenu: {
|
|
@@ -6274,6 +6323,10 @@ var init_zh = __esm({
|
|
|
6274
6323
|
checkingAvailability: "\u6B63\u5728\u68C0\u67E5\u53EF\u7528\u6027...",
|
|
6275
6324
|
nicknameAvailable: "\u6635\u79F0\u53EF\u7528",
|
|
6276
6325
|
nicknameNotAvailable: "\u6B64\u6635\u79F0\u4E0D\u53EF\u7528"
|
|
6326
|
+
},
|
|
6327
|
+
initialUser: {
|
|
6328
|
+
welcome: "\u60A8\u7684\u6635\u79F0\u5DF2\u8BBE\u7F6E\u4E3A {{nickname}}",
|
|
6329
|
+
message: "\u6839\u636E\u60A8\u7684\u9700\u6C42\u66F4\u6539\u5E76\u4FDD\u5B58\uFF0C\u7136\u540E\u70B9\u51FB\u201C\u7EE7\u7EED\u201D\uFF1A"
|
|
6277
6330
|
}
|
|
6278
6331
|
},
|
|
6279
6332
|
profilesMenu: {
|
|
@@ -6641,7 +6694,7 @@ function PassKeyStep(props) {
|
|
|
6641
6694
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
6642
6695
|
const autoCloseOnSuccess = !recoveryUserId;
|
|
6643
6696
|
const { passkeyStatus, setStep, setPasskeyStatus, setAlert, setEmail, setFailedType } = useAuthStore();
|
|
6644
|
-
const onPasskeyRegister = (0,
|
|
6697
|
+
const onPasskeyRegister = (0, import_react11.useCallback)(async () => {
|
|
6645
6698
|
setAlert(null);
|
|
6646
6699
|
setPasskeyStatus("registering passkey...");
|
|
6647
6700
|
setIsLoading(true);
|
|
@@ -6700,7 +6753,7 @@ function PassKeyStep(props) {
|
|
|
6700
6753
|
setIsLoading(false);
|
|
6701
6754
|
}
|
|
6702
6755
|
}, [onAuthSuccess, setPage]);
|
|
6703
|
-
const onPasskeyAuth = (0,
|
|
6756
|
+
const onPasskeyAuth = (0, import_react11.useCallback)(async () => {
|
|
6704
6757
|
setAlert(null);
|
|
6705
6758
|
setPasskeyStatus("checking available passkeys...");
|
|
6706
6759
|
setIsLoading(true);
|
|
@@ -6818,14 +6871,14 @@ function PassKeyStep(props) {
|
|
|
6818
6871
|
] })
|
|
6819
6872
|
] });
|
|
6820
6873
|
}
|
|
6821
|
-
var import_lucide_react4,
|
|
6874
|
+
var import_lucide_react4, import_react11, import_jsx_runtime12;
|
|
6822
6875
|
var init_PassKeyStep = __esm({
|
|
6823
6876
|
"src/internal/components/AuthMenu/PassKeyStep.tsx"() {
|
|
6824
6877
|
init_ProviderContext();
|
|
6825
6878
|
init_SessionContext();
|
|
6826
6879
|
init_i18n();
|
|
6827
6880
|
import_lucide_react4 = require("lucide-react");
|
|
6828
|
-
|
|
6881
|
+
import_react11 = require("react");
|
|
6829
6882
|
init_icons();
|
|
6830
6883
|
init_auth();
|
|
6831
6884
|
init_useLayoutDataStore();
|
|
@@ -6837,16 +6890,16 @@ var init_PassKeyStep = __esm({
|
|
|
6837
6890
|
});
|
|
6838
6891
|
|
|
6839
6892
|
// src/internal/components/ui/input.tsx
|
|
6840
|
-
var
|
|
6893
|
+
var import_react12, import_jsx_runtime13, Input;
|
|
6841
6894
|
var init_input = __esm({
|
|
6842
6895
|
"src/internal/components/ui/input.tsx"() {
|
|
6843
|
-
|
|
6896
|
+
import_react12 = __toESM(require("react"), 1);
|
|
6844
6897
|
init_utils2();
|
|
6845
6898
|
import_jsx_runtime13 = require("react/jsx-runtime");
|
|
6846
|
-
Input =
|
|
6899
|
+
Input = import_react12.default.forwardRef((props, ref) => {
|
|
6847
6900
|
const { className, disabled, error, Icon: Icon2, element, inputClassName, ...inputProps } = props;
|
|
6848
|
-
const internalRef = (0,
|
|
6849
|
-
(0,
|
|
6901
|
+
const internalRef = (0, import_react12.useRef)(null);
|
|
6902
|
+
(0, import_react12.useImperativeHandle)(ref, () => internalRef.current);
|
|
6850
6903
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("w-full flex flex-col gap-1", className), children: [
|
|
6851
6904
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
6852
6905
|
"div",
|
|
@@ -6896,9 +6949,9 @@ var init_input = __esm({
|
|
|
6896
6949
|
function Email() {
|
|
6897
6950
|
const { callbacksRef } = useProviderConfig();
|
|
6898
6951
|
const { t } = useT();
|
|
6899
|
-
const focusRef = (0,
|
|
6900
|
-
const inputRef = (0,
|
|
6901
|
-
const buttonRef = (0,
|
|
6952
|
+
const focusRef = (0, import_react13.useRef)(null);
|
|
6953
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
6954
|
+
const buttonRef = (0, import_react13.useRef)(null);
|
|
6902
6955
|
const isLoading = useSession((st) => st.isLoading);
|
|
6903
6956
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
6904
6957
|
const isMobileView = useLayoutStore((st) => st.isMobileView);
|
|
@@ -6954,7 +7007,7 @@ function Email() {
|
|
|
6954
7007
|
setIsLoading(false);
|
|
6955
7008
|
}
|
|
6956
7009
|
});
|
|
6957
|
-
(0,
|
|
7010
|
+
(0, import_react13.useEffect)(() => {
|
|
6958
7011
|
if (!focusRef.current || !isMobileView) return;
|
|
6959
7012
|
focusRef.current?.focus();
|
|
6960
7013
|
setTimeout(() => {
|
|
@@ -7016,7 +7069,7 @@ function Email() {
|
|
|
7016
7069
|
)
|
|
7017
7070
|
] });
|
|
7018
7071
|
}
|
|
7019
|
-
var import_react_query4, import_lucide_react5,
|
|
7072
|
+
var import_react_query4, import_lucide_react5, import_react13, import_jsx_runtime14;
|
|
7020
7073
|
var init_Email = __esm({
|
|
7021
7074
|
"src/internal/components/AuthMenu/SignInStep/Email.tsx"() {
|
|
7022
7075
|
init_initial();
|
|
@@ -7025,7 +7078,7 @@ var init_Email = __esm({
|
|
|
7025
7078
|
init_i18n();
|
|
7026
7079
|
import_react_query4 = require("@tanstack/react-query");
|
|
7027
7080
|
import_lucide_react5 = require("lucide-react");
|
|
7028
|
-
|
|
7081
|
+
import_react13 = require("react");
|
|
7029
7082
|
init_useLayoutStore();
|
|
7030
7083
|
init_projectId();
|
|
7031
7084
|
init_button();
|
|
@@ -7175,7 +7228,7 @@ function Social(props) {
|
|
|
7175
7228
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
7176
7229
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
7177
7230
|
const { alert: alert2, setStep, setEmail, setFailedType, setAlert, setPasskeyStatus } = useAuthStore();
|
|
7178
|
-
const onSocialAuth = (0,
|
|
7231
|
+
const onSocialAuth = (0, import_react14.useCallback)(
|
|
7179
7232
|
async (providerId) => {
|
|
7180
7233
|
const normalizedProviderId = providerId.toLowerCase();
|
|
7181
7234
|
const provider = config.current?.social?.providers?.find(
|
|
@@ -7435,7 +7488,7 @@ function Social(props) {
|
|
|
7435
7488
|
}
|
|
7436
7489
|
);
|
|
7437
7490
|
}
|
|
7438
|
-
var
|
|
7491
|
+
var import_react14, import_jsx_runtime15, SUPPORTED_PROVIDERS, SOCIAL_ICONS, fetchTokensFromRefreshEndpoint, enrichLoginResponseWithTokens;
|
|
7439
7492
|
var init_Social = __esm({
|
|
7440
7493
|
"src/internal/components/AuthMenu/SignInStep/Social.tsx"() {
|
|
7441
7494
|
init_assets();
|
|
@@ -7444,7 +7497,7 @@ var init_Social = __esm({
|
|
|
7444
7497
|
init_SessionContext();
|
|
7445
7498
|
init_i18n();
|
|
7446
7499
|
init_useLayoutDataStore();
|
|
7447
|
-
|
|
7500
|
+
import_react14 = require("react");
|
|
7448
7501
|
init_auth();
|
|
7449
7502
|
init_constants();
|
|
7450
7503
|
init_utils2();
|
|
@@ -7611,7 +7664,7 @@ function SignInStep(props) {
|
|
|
7611
7664
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react6.UserCircle, { className: "w-6 h-6" }),
|
|
7612
7665
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-bold text-xl leading-6", children: t("passport:auth.signin") })
|
|
7613
7666
|
] }),
|
|
7614
|
-
enabledSigninMethods.map((kind, idx) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
7667
|
+
enabledSigninMethods.map((kind, idx) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react15.Fragment, { children: [
|
|
7615
7668
|
idx > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center h-4", children: [
|
|
7616
7669
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { borderTop: "1px solid var(--ui-kit-bd)" }, className: "flex-1" }),
|
|
7617
7670
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "text-[10px] px-2 flex-none leading-4", children: t("passport:auth.orSeparator") }),
|
|
@@ -7634,13 +7687,13 @@ function SignInStep(props) {
|
|
|
7634
7687
|
] })
|
|
7635
7688
|
] });
|
|
7636
7689
|
}
|
|
7637
|
-
var import_lucide_react6,
|
|
7690
|
+
var import_lucide_react6, import_react15, import_jsx_runtime17;
|
|
7638
7691
|
var init_SignInStep = __esm({
|
|
7639
7692
|
"src/internal/components/AuthMenu/SignInStep/SignInStep.tsx"() {
|
|
7640
7693
|
init_ProviderContext();
|
|
7641
7694
|
init_i18n();
|
|
7642
7695
|
import_lucide_react6 = require("lucide-react");
|
|
7643
|
-
|
|
7696
|
+
import_react15 = require("react");
|
|
7644
7697
|
init_useLayoutDataStore();
|
|
7645
7698
|
init_button();
|
|
7646
7699
|
init_Email();
|
|
@@ -7671,14 +7724,14 @@ var init_constants4 = __esm({
|
|
|
7671
7724
|
function useAuthMenuHandlers() {
|
|
7672
7725
|
const { config, callbacksRef } = useProviderConfig();
|
|
7673
7726
|
const qc = (0, import_react_query5.useQueryClient)();
|
|
7674
|
-
const pendingLoginResponseRef = (0,
|
|
7675
|
-
const [telegramCleanup, setTelegramCleanup] = (0,
|
|
7727
|
+
const pendingLoginResponseRef = (0, import_react16.useRef)(null);
|
|
7728
|
+
const [telegramCleanup, setTelegramCleanup] = (0, import_react16.useState)(null);
|
|
7676
7729
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
7677
7730
|
const publicClient = useSession((st) => st.publicClient);
|
|
7678
7731
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
7679
7732
|
const setStep = useAuthStore((st) => st.setStep);
|
|
7680
7733
|
const setAlert = useAuthStore((st) => st.setAlert);
|
|
7681
|
-
const createSessionWithKeyshare = (0,
|
|
7734
|
+
const createSessionWithKeyshare = (0, import_react16.useCallback)(
|
|
7682
7735
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
7683
7736
|
const { setStatus } = useSession.getState();
|
|
7684
7737
|
try {
|
|
@@ -7720,7 +7773,7 @@ function useAuthMenuHandlers() {
|
|
|
7720
7773
|
},
|
|
7721
7774
|
[usePaymaster, activeChainId]
|
|
7722
7775
|
);
|
|
7723
|
-
const onAuthSuccess = (0,
|
|
7776
|
+
const onAuthSuccess = (0, import_react16.useCallback)(async () => {
|
|
7724
7777
|
const {
|
|
7725
7778
|
//
|
|
7726
7779
|
setSession,
|
|
@@ -7827,7 +7880,7 @@ function useAuthMenuHandlers() {
|
|
|
7827
7880
|
setStep("signin");
|
|
7828
7881
|
}
|
|
7829
7882
|
}, [qc, setStep, setAlert, createSessionWithKeyshare]);
|
|
7830
|
-
const goBackToSignIn = (0,
|
|
7883
|
+
const goBackToSignIn = (0, import_react16.useCallback)(() => {
|
|
7831
7884
|
setStep("signin");
|
|
7832
7885
|
setAlert(null);
|
|
7833
7886
|
if (telegramCleanup) {
|
|
@@ -7841,13 +7894,13 @@ function useAuthMenuHandlers() {
|
|
|
7841
7894
|
goBackToSignIn
|
|
7842
7895
|
};
|
|
7843
7896
|
}
|
|
7844
|
-
var import_react_query5,
|
|
7897
|
+
var import_react_query5, import_react16;
|
|
7845
7898
|
var init_useAuthMenuHanders = __esm({
|
|
7846
7899
|
"src/internal/components/AuthMenu/useAuthMenuHanders.ts"() {
|
|
7847
7900
|
init_ProviderContext();
|
|
7848
7901
|
init_SessionContext();
|
|
7849
7902
|
import_react_query5 = require("@tanstack/react-query");
|
|
7850
|
-
|
|
7903
|
+
import_react16 = require("react");
|
|
7851
7904
|
init_auth();
|
|
7852
7905
|
init_useLayoutDataStore();
|
|
7853
7906
|
init_useLayoutStore();
|
|
@@ -7857,11 +7910,11 @@ var init_useAuthMenuHanders = __esm({
|
|
|
7857
7910
|
});
|
|
7858
7911
|
|
|
7859
7912
|
// src/internal/components/AuthMenu/VerifyStep/VerificationCodeInput.tsx
|
|
7860
|
-
var
|
|
7913
|
+
var import_react17, import_jsx_runtime18, getRemainingSeconds, VerificationCodeInput;
|
|
7861
7914
|
var init_VerificationCodeInput = __esm({
|
|
7862
7915
|
"src/internal/components/AuthMenu/VerifyStep/VerificationCodeInput.tsx"() {
|
|
7863
7916
|
init_i18n();
|
|
7864
|
-
|
|
7917
|
+
import_react17 = require("react");
|
|
7865
7918
|
init_utils2();
|
|
7866
7919
|
init_button();
|
|
7867
7920
|
init_useAuthStore();
|
|
@@ -7871,14 +7924,14 @@ var init_VerificationCodeInput = __esm({
|
|
|
7871
7924
|
const { onVerifyCode, onResendCode, isLoading, expiresIn } = props;
|
|
7872
7925
|
const { t } = useT();
|
|
7873
7926
|
const setAlert = useAuthStore((st) => st.setAlert);
|
|
7874
|
-
const [expiresAt, setExpiresAt] = (0,
|
|
7875
|
-
const [timeLeft, setTimeLeft] = (0,
|
|
7876
|
-
(0,
|
|
7927
|
+
const [expiresAt, setExpiresAt] = (0, import_react17.useState)(() => Date.now() + Math.max(0, expiresIn) * 1e3);
|
|
7928
|
+
const [timeLeft, setTimeLeft] = (0, import_react17.useState)(() => getRemainingSeconds(expiresAt));
|
|
7929
|
+
(0, import_react17.useEffect)(() => {
|
|
7877
7930
|
const nextExpiresAt = Date.now() + Math.max(0, expiresIn) * 1e3;
|
|
7878
7931
|
setExpiresAt(nextExpiresAt);
|
|
7879
7932
|
setTimeLeft(getRemainingSeconds(nextExpiresAt));
|
|
7880
7933
|
}, [expiresIn]);
|
|
7881
|
-
(0,
|
|
7934
|
+
(0, import_react17.useEffect)(() => {
|
|
7882
7935
|
let intervalId;
|
|
7883
7936
|
const syncTimeLeft = () => {
|
|
7884
7937
|
const remaining = getRemainingSeconds(expiresAt);
|
|
@@ -7899,10 +7952,10 @@ var init_VerificationCodeInput = __esm({
|
|
|
7899
7952
|
document.removeEventListener("visibilitychange", syncTimeLeft);
|
|
7900
7953
|
};
|
|
7901
7954
|
}, [expiresAt]);
|
|
7902
|
-
const lastSubmittedRef = (0,
|
|
7903
|
-
const inputsRef = (0,
|
|
7904
|
-
const [digits, setDigits] = (0,
|
|
7905
|
-
(0,
|
|
7955
|
+
const lastSubmittedRef = (0, import_react17.useRef)(null);
|
|
7956
|
+
const inputsRef = (0, import_react17.useRef)([]);
|
|
7957
|
+
const [digits, setDigits] = (0, import_react17.useState)(["", "", "", "", "", ""]);
|
|
7958
|
+
(0, import_react17.useEffect)(() => {
|
|
7906
7959
|
const code = digits.join("");
|
|
7907
7960
|
if (code.length === 6 && digits.every((d) => d !== "") && !isLoading) {
|
|
7908
7961
|
if (lastSubmittedRef.current !== code) {
|
|
@@ -7911,7 +7964,7 @@ var init_VerificationCodeInput = __esm({
|
|
|
7911
7964
|
}
|
|
7912
7965
|
}
|
|
7913
7966
|
}, [digits, isLoading, onVerifyCode]);
|
|
7914
|
-
(0,
|
|
7967
|
+
(0, import_react17.useEffect)(() => {
|
|
7915
7968
|
const t2 = setTimeout(() => {
|
|
7916
7969
|
inputsRef.current[0]?.focus();
|
|
7917
7970
|
}, 0);
|
|
@@ -8032,7 +8085,7 @@ function VerifyStep(props) {
|
|
|
8032
8085
|
setExpiresIn,
|
|
8033
8086
|
setAlert
|
|
8034
8087
|
} = useAuthStore();
|
|
8035
|
-
const [resendCount, setResendCount] = (0,
|
|
8088
|
+
const [resendCount, setResendCount] = (0, import_react18.useState)(0);
|
|
8036
8089
|
const { mutate: onVerifyCode, isPending: isCodeVerifying } = (0, import_react_query6.useMutation)({
|
|
8037
8090
|
mutationFn: async (code) => {
|
|
8038
8091
|
setIsLoading(true);
|
|
@@ -8181,7 +8234,7 @@ function VerifyStep(props) {
|
|
|
8181
8234
|
)
|
|
8182
8235
|
] });
|
|
8183
8236
|
}
|
|
8184
|
-
var import_react_query6, import_lucide_react7,
|
|
8237
|
+
var import_react_query6, import_lucide_react7, import_react18, import_jsx_runtime19;
|
|
8185
8238
|
var init_VerifyStep = __esm({
|
|
8186
8239
|
"src/internal/components/AuthMenu/VerifyStep/VerifyStep.tsx"() {
|
|
8187
8240
|
init_initial();
|
|
@@ -8190,7 +8243,7 @@ var init_VerifyStep = __esm({
|
|
|
8190
8243
|
init_i18n();
|
|
8191
8244
|
import_react_query6 = require("@tanstack/react-query");
|
|
8192
8245
|
import_lucide_react7 = require("lucide-react");
|
|
8193
|
-
|
|
8246
|
+
import_react18 = require("react");
|
|
8194
8247
|
init_icons();
|
|
8195
8248
|
init_projectId();
|
|
8196
8249
|
init_button();
|
|
@@ -8208,12 +8261,12 @@ var init_VerifyStep2 = __esm({
|
|
|
8208
8261
|
});
|
|
8209
8262
|
|
|
8210
8263
|
// src/internal/components/AuthMenu/AuthMenu.tsx
|
|
8211
|
-
var import_lucide_react8,
|
|
8264
|
+
var import_lucide_react8, import_react19, import_jsx_runtime20, AuthMenu;
|
|
8212
8265
|
var init_AuthMenu = __esm({
|
|
8213
8266
|
"src/internal/components/AuthMenu/AuthMenu.tsx"() {
|
|
8214
8267
|
init_SessionContext();
|
|
8215
8268
|
import_lucide_react8 = require("lucide-react");
|
|
8216
|
-
|
|
8269
|
+
import_react19 = require("react");
|
|
8217
8270
|
init_auth();
|
|
8218
8271
|
init_constants();
|
|
8219
8272
|
init_useLayoutDataStore();
|
|
@@ -8236,7 +8289,7 @@ var init_AuthMenu = __esm({
|
|
|
8236
8289
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
8237
8290
|
const { step, alert: alert2, setStep, setPasskeyStatus, setEmail, setAlert } = useAuthStore();
|
|
8238
8291
|
const { pendingLoginResponseRef, onAuthSuccess, goBackToSignIn } = useAuthMenuHandlers();
|
|
8239
|
-
(0,
|
|
8292
|
+
(0, import_react19.useEffect)(() => {
|
|
8240
8293
|
if (!pendingWalletLogin) return;
|
|
8241
8294
|
const loginResponse = pendingWalletLogin;
|
|
8242
8295
|
setPendingWalletLogin(null);
|
|
@@ -8246,7 +8299,7 @@ var init_AuthMenu = __esm({
|
|
|
8246
8299
|
onAuthSuccess();
|
|
8247
8300
|
});
|
|
8248
8301
|
}, [pendingWalletLogin]);
|
|
8249
|
-
(0,
|
|
8302
|
+
(0, import_react19.useEffect)(() => {
|
|
8250
8303
|
setTransitionPageHeight(DEFAULT_AUTH_MENU_HEIGHT);
|
|
8251
8304
|
return () => {
|
|
8252
8305
|
setStep("signin");
|
|
@@ -8261,7 +8314,7 @@ var init_AuthMenu = __esm({
|
|
|
8261
8314
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-sm text-[var(--ui-kit-fg-muted)]", children: "Initializing wallet..." })
|
|
8262
8315
|
] });
|
|
8263
8316
|
}
|
|
8264
|
-
const stepContent = (0,
|
|
8317
|
+
const stepContent = (0, import_react19.useMemo)(
|
|
8265
8318
|
() => ({
|
|
8266
8319
|
"loading": /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LoadingStep, {}),
|
|
8267
8320
|
"failed": /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AuthFailedStep, {}),
|
|
@@ -8311,17 +8364,17 @@ var init_AuthMenu2 = __esm({
|
|
|
8311
8364
|
});
|
|
8312
8365
|
|
|
8313
8366
|
// src/internal/components/ui/switch.tsx
|
|
8314
|
-
var
|
|
8367
|
+
var import_react20, import_jsx_runtime21, Switch;
|
|
8315
8368
|
var init_switch = __esm({
|
|
8316
8369
|
"src/internal/components/ui/switch.tsx"() {
|
|
8317
|
-
|
|
8370
|
+
import_react20 = require("react");
|
|
8318
8371
|
init_useLayoutStore();
|
|
8319
8372
|
init_utils2();
|
|
8320
8373
|
import_jsx_runtime21 = require("react/jsx-runtime");
|
|
8321
|
-
Switch = (0,
|
|
8374
|
+
Switch = (0, import_react20.forwardRef)((props, ref) => {
|
|
8322
8375
|
const { className, labels, ...inputProps } = props;
|
|
8323
8376
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
8324
|
-
const [labelW, setLabelW] = (0,
|
|
8377
|
+
const [labelW, setLabelW] = (0, import_react20.useState)(0);
|
|
8325
8378
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8326
8379
|
"div",
|
|
8327
8380
|
{
|
|
@@ -8858,16 +8911,16 @@ function CryptoSelector(props) {
|
|
|
8858
8911
|
const { coins } = props;
|
|
8859
8912
|
const { t } = useT();
|
|
8860
8913
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
8861
|
-
const [searchValue, setSearchValue] = (0,
|
|
8862
|
-
const [target, setTarget] = (0,
|
|
8863
|
-
const setSearchDebounced = (0,
|
|
8914
|
+
const [searchValue, setSearchValue] = (0, import_react21.useState)("");
|
|
8915
|
+
const [target, setTarget] = (0, import_react21.useState)("");
|
|
8916
|
+
const setSearchDebounced = (0, import_react21.useCallback)(
|
|
8864
8917
|
(0, import_lodash_es4.debounce)((value) => {
|
|
8865
8918
|
setTarget(value);
|
|
8866
8919
|
useBuyMenuStore.getState().setRenderKey(`on-ramp-crypto-selector-${Date.now()}`);
|
|
8867
8920
|
}, 1e3),
|
|
8868
8921
|
[]
|
|
8869
8922
|
);
|
|
8870
|
-
const filteredCoins = (0,
|
|
8923
|
+
const filteredCoins = (0, import_react21.useMemo)(() => {
|
|
8871
8924
|
const sorted = [...coins].sort((a, b) => {
|
|
8872
8925
|
const aIdx = POPULAR_CRYPTOS.indexOf(a.symbol.toUpperCase());
|
|
8873
8926
|
const bIdx = POPULAR_CRYPTOS.indexOf(b.symbol.toUpperCase());
|
|
@@ -8973,7 +9026,7 @@ function CryptoSelectorTrigger(props) {
|
|
|
8973
9026
|
}
|
|
8974
9027
|
);
|
|
8975
9028
|
}
|
|
8976
|
-
var import_lodash_es4, import_lucide_react9,
|
|
9029
|
+
var import_lodash_es4, import_lucide_react9, import_react21, import_jsx_runtime32, POPULAR_CRYPTOS;
|
|
8977
9030
|
var init_CryptoSelector = __esm({
|
|
8978
9031
|
"src/internal/components/BuyMenu/components/CryptoSelector.tsx"() {
|
|
8979
9032
|
init_tokens();
|
|
@@ -8982,7 +9035,7 @@ var init_CryptoSelector = __esm({
|
|
|
8982
9035
|
init_i18n();
|
|
8983
9036
|
import_lodash_es4 = require("lodash-es");
|
|
8984
9037
|
import_lucide_react9 = require("lucide-react");
|
|
8985
|
-
|
|
9038
|
+
import_react21 = require("react");
|
|
8986
9039
|
init_priceFormatter();
|
|
8987
9040
|
init_button();
|
|
8988
9041
|
init_highlight();
|
|
@@ -9084,16 +9137,16 @@ function FiatSelector(props) {
|
|
|
9084
9137
|
const { fiats } = props;
|
|
9085
9138
|
const { t, i18n } = useT();
|
|
9086
9139
|
const locale = i18n.resolvedLanguage || "en";
|
|
9087
|
-
const [searchValue, setSearchValue] = (0,
|
|
9088
|
-
const [target, setTarget] = (0,
|
|
9089
|
-
const setSearchDebounced = (0,
|
|
9140
|
+
const [searchValue, setSearchValue] = (0, import_react22.useState)("");
|
|
9141
|
+
const [target, setTarget] = (0, import_react22.useState)("");
|
|
9142
|
+
const setSearchDebounced = (0, import_react22.useCallback)(
|
|
9090
9143
|
(0, import_lodash_es5.debounce)((value) => {
|
|
9091
9144
|
setTarget(value);
|
|
9092
9145
|
useBuyMenuStore.getState().setRenderKey(`on-ramp-fiat-selector-${Date.now()}`);
|
|
9093
9146
|
}, 1e3),
|
|
9094
9147
|
[]
|
|
9095
9148
|
);
|
|
9096
|
-
const filteredFiats = (0,
|
|
9149
|
+
const filteredFiats = (0, import_react22.useMemo)(() => {
|
|
9097
9150
|
const sorted = [...fiats].sort((a, b) => {
|
|
9098
9151
|
const aIdx = POPULAR_FIATS.indexOf(a.ticker.toUpperCase());
|
|
9099
9152
|
const bIdx = POPULAR_FIATS.indexOf(b.ticker.toUpperCase());
|
|
@@ -9158,13 +9211,13 @@ function FiatSelectorTrigger(props) {
|
|
|
9158
9211
|
}
|
|
9159
9212
|
);
|
|
9160
9213
|
}
|
|
9161
|
-
var import_lodash_es5, import_lucide_react10,
|
|
9214
|
+
var import_lodash_es5, import_lucide_react10, import_react22, import_jsx_runtime34, POPULAR_FIATS;
|
|
9162
9215
|
var init_FiatSelector = __esm({
|
|
9163
9216
|
"src/internal/components/BuyMenu/components/FiatSelector.tsx"() {
|
|
9164
9217
|
init_i18n();
|
|
9165
9218
|
import_lodash_es5 = require("lodash-es");
|
|
9166
9219
|
import_lucide_react10 = require("lucide-react");
|
|
9167
|
-
|
|
9220
|
+
import_react22 = require("react");
|
|
9168
9221
|
init_button();
|
|
9169
9222
|
init_highlight();
|
|
9170
9223
|
init_input();
|
|
@@ -9839,17 +9892,17 @@ function BinanceTxHistory() {
|
|
|
9839
9892
|
txStatuses: SHOW_STATUSES
|
|
9840
9893
|
})
|
|
9841
9894
|
});
|
|
9842
|
-
const txList = (0,
|
|
9895
|
+
const txList = (0, import_react23.useMemo)(
|
|
9843
9896
|
() => historyData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
9844
9897
|
[historyData]
|
|
9845
9898
|
);
|
|
9846
|
-
const updateExpandable = (0,
|
|
9899
|
+
const updateExpandable = (0, import_react23.useCallback)(
|
|
9847
9900
|
(0, import_lodash_es7.debounce)(() => {
|
|
9848
9901
|
useBuyMenuStore.getState().setRenderKey(`binance-history-loaded-${Date.now()}`);
|
|
9849
9902
|
}, 200),
|
|
9850
9903
|
[]
|
|
9851
9904
|
);
|
|
9852
|
-
(0,
|
|
9905
|
+
(0, import_react23.useEffect)(() => {
|
|
9853
9906
|
if (isTxDataLoading || !txList?.length || txList.length > 10) return;
|
|
9854
9907
|
updateExpandable();
|
|
9855
9908
|
}, [isTxDataLoading, txList]);
|
|
@@ -9874,7 +9927,7 @@ function BinanceTxHistory() {
|
|
|
9874
9927
|
)
|
|
9875
9928
|
] });
|
|
9876
9929
|
}
|
|
9877
|
-
var import_react_query8, import_dayjs, import_lodash_es7, import_lucide_react13,
|
|
9930
|
+
var import_react_query8, import_dayjs, import_lodash_es7, import_lucide_react13, import_react23, import_jsx_runtime38, TRANSACTIONS_PAGESIZE, SHOW_STATUSES;
|
|
9878
9931
|
var init_BinanceTxHistory = __esm({
|
|
9879
9932
|
"src/internal/components/BuyMenu/binance/BinanceTxHistory.tsx"() {
|
|
9880
9933
|
init_tokens();
|
|
@@ -9885,7 +9938,7 @@ var init_BinanceTxHistory = __esm({
|
|
|
9885
9938
|
import_dayjs = __toESM(require("dayjs"), 1);
|
|
9886
9939
|
import_lodash_es7 = require("lodash-es");
|
|
9887
9940
|
import_lucide_react13 = require("lucide-react");
|
|
9888
|
-
|
|
9941
|
+
import_react23 = require("react");
|
|
9889
9942
|
init_priceFormatter();
|
|
9890
9943
|
init_badge();
|
|
9891
9944
|
init_button();
|
|
@@ -9903,8 +9956,8 @@ var init_BinanceTxHistory = __esm({
|
|
|
9903
9956
|
// src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts
|
|
9904
9957
|
function useBinanceSseTxTracing(walletAddress) {
|
|
9905
9958
|
const qc = (0, import_react_query9.useQueryClient)();
|
|
9906
|
-
const debounceRef = (0,
|
|
9907
|
-
(0,
|
|
9959
|
+
const debounceRef = (0, import_react24.useRef)(null);
|
|
9960
|
+
(0, import_react24.useEffect)(() => {
|
|
9908
9961
|
if (!walletAddress) return;
|
|
9909
9962
|
const iframeManager = getIframeManager();
|
|
9910
9963
|
if (!iframeManager) return;
|
|
@@ -9926,11 +9979,11 @@ function useBinanceSseTxTracing(walletAddress) {
|
|
|
9926
9979
|
};
|
|
9927
9980
|
}, [walletAddress, qc]);
|
|
9928
9981
|
}
|
|
9929
|
-
var import_react_query9,
|
|
9982
|
+
var import_react_query9, import_react24;
|
|
9930
9983
|
var init_useBinanceSseTracing = __esm({
|
|
9931
9984
|
"src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts"() {
|
|
9932
9985
|
import_react_query9 = require("@tanstack/react-query");
|
|
9933
|
-
|
|
9986
|
+
import_react24 = require("react");
|
|
9934
9987
|
init_iframe_manager();
|
|
9935
9988
|
init_queryKeys();
|
|
9936
9989
|
init_api();
|
|
@@ -9967,7 +10020,7 @@ function Binance() {
|
|
|
9967
10020
|
} = useBuyMenuStore();
|
|
9968
10021
|
const paymentMode = useBinanceStore((st) => st.paymentMode);
|
|
9969
10022
|
const isCurrurenciesSelected = !!selectedCrypto && !!selectedFiat;
|
|
9970
|
-
(0,
|
|
10023
|
+
(0, import_react25.useEffect)(() => {
|
|
9971
10024
|
if (!isCurrurenciesSelected) return;
|
|
9972
10025
|
useBuyMenuStore.getState().setRenderKey(`${selectedCrypto}-${selectedFiat}-${Date.now()}`);
|
|
9973
10026
|
}, [isCurrurenciesSelected]);
|
|
@@ -10002,7 +10055,7 @@ function Binance() {
|
|
|
10002
10055
|
});
|
|
10003
10056
|
const paymentModes = paymentModesData?.data?.paymentMethods || [];
|
|
10004
10057
|
const selectedPaymentMode = paymentModes?.find((el) => getPayMethodID(el) === paymentMode) || null;
|
|
10005
|
-
(0,
|
|
10058
|
+
(0, import_react25.useEffect)(() => {
|
|
10006
10059
|
useBuyMenuStore.getState().setMinAmount(Number(selectedPaymentMode?.fiatMinLimit || "0"));
|
|
10007
10060
|
}, [selectedPaymentMode]);
|
|
10008
10061
|
const { mutate: estimateQuote, isPending: isQuoteEstimating } = (0, import_react_query10.useMutation)({
|
|
@@ -10030,21 +10083,21 @@ function Binance() {
|
|
|
10030
10083
|
}
|
|
10031
10084
|
});
|
|
10032
10085
|
const availableFiats = (tradingPairsData?.data?.fiatCurrencies || []).map((ticker) => ({ ticker }));
|
|
10033
|
-
(0,
|
|
10086
|
+
(0, import_react25.useEffect)(() => {
|
|
10034
10087
|
if (!!selectedFiat || !availableFiats?.length) return;
|
|
10035
10088
|
const targetFiat = availableFiats.find((item) => item.ticker === "USD" || item.ticker === "EUR") || availableFiats[0];
|
|
10036
10089
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10037
10090
|
}, [availableFiats, selectedFiat]);
|
|
10038
|
-
(0,
|
|
10091
|
+
(0, import_react25.useEffect)(() => {
|
|
10039
10092
|
if (!!selectedCrypto || !networkAvailableCryptoList?.length) return;
|
|
10040
10093
|
useBuyMenuStore.getState().setSelectedCrypto(networkAvailableCryptoList[0].cryptoCurrency);
|
|
10041
10094
|
}, [networkAvailableCryptoList, selectedCrypto]);
|
|
10042
|
-
(0,
|
|
10095
|
+
(0, import_react25.useEffect)(() => {
|
|
10043
10096
|
if (!!paymentMode || !paymentModes.length) return;
|
|
10044
10097
|
const targetPaymentMode = paymentModes.find((item) => item.payMethodCode === PREFERRED_PAYMENT_METHOD) || paymentModes[0];
|
|
10045
10098
|
useBinanceStore.getState().setPaymentMode(getPayMethodID(targetPaymentMode));
|
|
10046
10099
|
}, [paymentModes]);
|
|
10047
|
-
(0,
|
|
10100
|
+
(0, import_react25.useEffect)(() => {
|
|
10048
10101
|
return () => {
|
|
10049
10102
|
useBinanceStore.getState().setPaymentMode(null);
|
|
10050
10103
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binanceTradingPairs] });
|
|
@@ -10166,7 +10219,7 @@ function Binance() {
|
|
|
10166
10219
|
)
|
|
10167
10220
|
] });
|
|
10168
10221
|
}
|
|
10169
|
-
var import_react_query10, import_lucide_react14,
|
|
10222
|
+
var import_react_query10, import_lucide_react14, import_react25, import_jsx_runtime39, PREFERRED_PAYMENT_METHOD;
|
|
10170
10223
|
var init_Binance = __esm({
|
|
10171
10224
|
"src/internal/components/BuyMenu/binance/Binance.tsx"() {
|
|
10172
10225
|
init_utils2();
|
|
@@ -10174,7 +10227,7 @@ var init_Binance = __esm({
|
|
|
10174
10227
|
init_i18n();
|
|
10175
10228
|
import_react_query10 = require("@tanstack/react-query");
|
|
10176
10229
|
import_lucide_react14 = require("lucide-react");
|
|
10177
|
-
|
|
10230
|
+
import_react25 = require("react");
|
|
10178
10231
|
init_button();
|
|
10179
10232
|
init_highlight();
|
|
10180
10233
|
init_input();
|
|
@@ -10446,7 +10499,7 @@ function FinchPayTxHistoryItem(props) {
|
|
|
10446
10499
|
function FinchPayTxHistory() {
|
|
10447
10500
|
const { t } = useT();
|
|
10448
10501
|
const walletAddress = useSession((st) => st.address);
|
|
10449
|
-
const [cursor, setCursor] = (0,
|
|
10502
|
+
const [cursor, setCursor] = (0, import_react26.useState)(1);
|
|
10450
10503
|
const {
|
|
10451
10504
|
data: txData,
|
|
10452
10505
|
isLoading: isTxDataLoading,
|
|
@@ -10468,7 +10521,7 @@ function FinchPayTxHistory() {
|
|
|
10468
10521
|
const pageCount = loadedPages[loadedPages.length - 1]?.pageCount || 1;
|
|
10469
10522
|
const txList = loadedPages.map((p) => p.data)[cursor - 1] || [];
|
|
10470
10523
|
console.log("[FINCHPAY] txList", txData);
|
|
10471
|
-
const handleNextPage = (0,
|
|
10524
|
+
const handleNextPage = (0, import_react26.useCallback)(
|
|
10472
10525
|
async (curCursor, curPageParams) => {
|
|
10473
10526
|
const maxLoadedPage = Math.max(...curPageParams);
|
|
10474
10527
|
if (curCursor !== maxLoadedPage) {
|
|
@@ -10523,7 +10576,7 @@ function FinchPayTxHistory() {
|
|
|
10523
10576
|
] })
|
|
10524
10577
|
] });
|
|
10525
10578
|
}
|
|
10526
|
-
var import_react_query12, import_dayjs2, import_lucide_react16,
|
|
10579
|
+
var import_react_query12, import_dayjs2, import_lucide_react16, import_react26, import_jsx_runtime41, TRANSACTIONS_PAGESIZE2;
|
|
10527
10580
|
var init_FinchPayTxHistory = __esm({
|
|
10528
10581
|
"src/internal/components/BuyMenu/finchpay/FinchPayTxHistory.tsx"() {
|
|
10529
10582
|
init_utils2();
|
|
@@ -10532,7 +10585,7 @@ var init_FinchPayTxHistory = __esm({
|
|
|
10532
10585
|
import_react_query12 = require("@tanstack/react-query");
|
|
10533
10586
|
import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
10534
10587
|
import_lucide_react16 = require("lucide-react");
|
|
10535
|
-
|
|
10588
|
+
import_react26 = require("react");
|
|
10536
10589
|
init_priceFormatter();
|
|
10537
10590
|
init_badge();
|
|
10538
10591
|
init_button();
|
|
@@ -10561,8 +10614,8 @@ var init_networks = __esm({
|
|
|
10561
10614
|
// src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts
|
|
10562
10615
|
function useFinchpaySseTxTracing(walletAddress) {
|
|
10563
10616
|
const qc = (0, import_react_query13.useQueryClient)();
|
|
10564
|
-
const debounceRef = (0,
|
|
10565
|
-
(0,
|
|
10617
|
+
const debounceRef = (0, import_react27.useRef)(null);
|
|
10618
|
+
(0, import_react27.useEffect)(() => {
|
|
10566
10619
|
if (!walletAddress) return;
|
|
10567
10620
|
const iframeManager = getIframeManager();
|
|
10568
10621
|
if (!iframeManager) return;
|
|
@@ -10584,11 +10637,11 @@ function useFinchpaySseTxTracing(walletAddress) {
|
|
|
10584
10637
|
};
|
|
10585
10638
|
}, [walletAddress, qc]);
|
|
10586
10639
|
}
|
|
10587
|
-
var import_react_query13,
|
|
10640
|
+
var import_react_query13, import_react27;
|
|
10588
10641
|
var init_useFinchpaySseTxTracing = __esm({
|
|
10589
10642
|
"src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts"() {
|
|
10590
10643
|
import_react_query13 = require("@tanstack/react-query");
|
|
10591
|
-
|
|
10644
|
+
import_react27 = require("react");
|
|
10592
10645
|
init_iframe_manager();
|
|
10593
10646
|
init_queryKeys();
|
|
10594
10647
|
init_api2();
|
|
@@ -10686,11 +10739,11 @@ function FinchPay() {
|
|
|
10686
10739
|
})
|
|
10687
10740
|
});
|
|
10688
10741
|
const minimum = Number(limitsData?.min_amount || "0");
|
|
10689
|
-
(0,
|
|
10742
|
+
(0, import_react28.useEffect)(() => {
|
|
10690
10743
|
if (minimum <= 0) return;
|
|
10691
10744
|
useBuyMenuStore.getState().setMinAmount(minimum);
|
|
10692
10745
|
}, [minimum]);
|
|
10693
|
-
(0,
|
|
10746
|
+
(0, import_react28.useEffect)(() => {
|
|
10694
10747
|
if (srcInputAmount >= minimum) return;
|
|
10695
10748
|
useBuyMenuStore.getState().setRenderKey(`finchpay-input-minimum-warning-${Date.now()}`);
|
|
10696
10749
|
}, [minimum, srcInputAmount]);
|
|
@@ -10718,23 +10771,23 @@ function FinchPay() {
|
|
|
10718
10771
|
// defaults to CARD estimation, widgetUrl
|
|
10719
10772
|
})
|
|
10720
10773
|
});
|
|
10721
|
-
(0,
|
|
10774
|
+
(0, import_react28.useEffect)(() => {
|
|
10722
10775
|
const { error: errorTitle, message: errorMessage } = handleErrors([currenciesError, limitsError, estimateError]);
|
|
10723
10776
|
if (!errorTitle && !errorMessage) return;
|
|
10724
10777
|
console.error(`[BuyModal][Binance] ${errorTitle}: ${errorMessage}`);
|
|
10725
10778
|
useBuyMenuStore.getState().setError(errorMessage);
|
|
10726
10779
|
}, [currenciesError, limitsError, estimateError]);
|
|
10727
|
-
(0,
|
|
10780
|
+
(0, import_react28.useEffect)(() => {
|
|
10728
10781
|
if (!!selectedFiat || currenciesData.fiats.length === 0) return;
|
|
10729
10782
|
const fallbackFiat = currenciesData.fiats[0];
|
|
10730
10783
|
const targetFiat = currenciesData.fiats.find((f) => f.ticker.toUpperCase() === "USD") || fallbackFiat;
|
|
10731
10784
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10732
10785
|
}, [currenciesData, selectedFiat]);
|
|
10733
|
-
(0,
|
|
10786
|
+
(0, import_react28.useEffect)(() => {
|
|
10734
10787
|
if (!!selectedCrypto || currenciesData.currentNetworkCoins.length === 0) return;
|
|
10735
10788
|
useBuyMenuStore.getState().setSelectedCrypto(currenciesData.currentNetworkCoins[0].ticker);
|
|
10736
10789
|
}, [currenciesData, selectedCrypto]);
|
|
10737
|
-
(0,
|
|
10790
|
+
(0, import_react28.useEffect)(() => {
|
|
10738
10791
|
return () => {
|
|
10739
10792
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayCurrencies] });
|
|
10740
10793
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayLimits] });
|
|
@@ -10856,7 +10909,7 @@ function FinchPay() {
|
|
|
10856
10909
|
)
|
|
10857
10910
|
] });
|
|
10858
10911
|
}
|
|
10859
|
-
var import_react_query14, import_lucide_react17,
|
|
10912
|
+
var import_react_query14, import_lucide_react17, import_react28, import_jsx_runtime42;
|
|
10860
10913
|
var init_FinchPay = __esm({
|
|
10861
10914
|
"src/internal/components/BuyMenu/finchpay/FinchPay.tsx"() {
|
|
10862
10915
|
init_priceFormatter();
|
|
@@ -10865,7 +10918,7 @@ var init_FinchPay = __esm({
|
|
|
10865
10918
|
init_i18n();
|
|
10866
10919
|
import_react_query14 = require("@tanstack/react-query");
|
|
10867
10920
|
import_lucide_react17 = require("lucide-react");
|
|
10868
|
-
|
|
10921
|
+
import_react28 = require("react");
|
|
10869
10922
|
init_button();
|
|
10870
10923
|
init_highlight();
|
|
10871
10924
|
init_input();
|
|
@@ -11007,20 +11060,20 @@ var init_debounce = __esm({
|
|
|
11007
11060
|
});
|
|
11008
11061
|
|
|
11009
11062
|
// src/internal/components/BuyMenu/useHandleInputAmount.ts
|
|
11010
|
-
var
|
|
11063
|
+
var import_react29, ON_INPUT_QUERY_DELAY, useHandleInputAmount;
|
|
11011
11064
|
var init_useHandleInputAmount = __esm({
|
|
11012
11065
|
"src/internal/components/BuyMenu/useHandleInputAmount.ts"() {
|
|
11013
|
-
|
|
11066
|
+
import_react29 = require("react");
|
|
11014
11067
|
init_debounce();
|
|
11015
11068
|
init_contants();
|
|
11016
11069
|
init_useBuyMenuStore();
|
|
11017
11070
|
ON_INPUT_QUERY_DELAY = 1500;
|
|
11018
11071
|
useHandleInputAmount = () => {
|
|
11019
|
-
const lastRampProviderRef = (0,
|
|
11072
|
+
const lastRampProviderRef = (0, import_react29.useRef)(DEFAULT_PROVIDER2);
|
|
11020
11073
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
11021
11074
|
const srcInputAmount = useBuyMenuStore((st) => st.srcInputAmount);
|
|
11022
11075
|
const minAmount = useBuyMenuStore((st) => st.minAmount);
|
|
11023
|
-
const setQueryAmountDebounced = (0,
|
|
11076
|
+
const setQueryAmountDebounced = (0, import_react29.useCallback)(
|
|
11024
11077
|
debounce5((inputAmount) => {
|
|
11025
11078
|
const checkedValue = Math.ceil(Math.max(inputAmount, minAmount));
|
|
11026
11079
|
useBuyMenuStore.getState().setSrcInputAmount(checkedValue);
|
|
@@ -11028,8 +11081,8 @@ var init_useHandleInputAmount = __esm({
|
|
|
11028
11081
|
}, ON_INPUT_QUERY_DELAY),
|
|
11029
11082
|
[minAmount]
|
|
11030
11083
|
);
|
|
11031
|
-
(0,
|
|
11032
|
-
(0,
|
|
11084
|
+
(0, import_react29.useEffect)(() => setQueryAmountDebounced(srcInputAmount), [srcInputAmount, setQueryAmountDebounced]);
|
|
11085
|
+
(0, import_react29.useEffect)(() => {
|
|
11033
11086
|
if (lastRampProviderRef.current === rampProvider) return;
|
|
11034
11087
|
const {
|
|
11035
11088
|
setIsProviderSummary,
|
|
@@ -11403,8 +11456,8 @@ function ChainItem(props) {
|
|
|
11403
11456
|
const { t } = useT();
|
|
11404
11457
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
11405
11458
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
11406
|
-
const [copiedChainId, setCopiedChainId] = (0,
|
|
11407
|
-
const copiedResetTimerRef = (0,
|
|
11459
|
+
const [copiedChainId, setCopiedChainId] = (0, import_react30.useState)(null);
|
|
11460
|
+
const copiedResetTimerRef = (0, import_react30.useRef)(null);
|
|
11408
11461
|
const isActiveChain = activeChainId === chainId;
|
|
11409
11462
|
const paymasterAddress = isActiveChain ? activePaymasterData?.address : null;
|
|
11410
11463
|
const paymasterExplorerUrl = paymasterAddress ? getPaymasterExplorerUrl(chainId, paymasterAddress) : null;
|
|
@@ -11501,7 +11554,7 @@ function ChainItem(props) {
|
|
|
11501
11554
|
}
|
|
11502
11555
|
);
|
|
11503
11556
|
}
|
|
11504
|
-
var import_read13, import_lucide_react19,
|
|
11557
|
+
var import_read13, import_lucide_react19, import_react30, import_jsx_runtime51;
|
|
11505
11558
|
var init_ChainItem = __esm({
|
|
11506
11559
|
"src/internal/components/ChainsMenu/ChainItem.tsx"() {
|
|
11507
11560
|
init_SessionContext();
|
|
@@ -11511,7 +11564,7 @@ var init_ChainItem = __esm({
|
|
|
11511
11564
|
init_truncateMiddle();
|
|
11512
11565
|
import_read13 = require("@embarkai/core/read");
|
|
11513
11566
|
import_lucide_react19 = require("lucide-react");
|
|
11514
|
-
|
|
11567
|
+
import_react30 = require("react");
|
|
11515
11568
|
init_badge();
|
|
11516
11569
|
init_button();
|
|
11517
11570
|
import_jsx_runtime51 = require("react/jsx-runtime");
|
|
@@ -11522,11 +11575,11 @@ var init_ChainItem = __esm({
|
|
|
11522
11575
|
function ChainsMenu() {
|
|
11523
11576
|
const config = useProviderConfig().config;
|
|
11524
11577
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
11525
|
-
const [isTestnets, setIsTestnets] = (0,
|
|
11526
|
-
const [nextChainId, setNextChainId] = (0,
|
|
11578
|
+
const [isTestnets, setIsTestnets] = (0, import_react31.useState)(false);
|
|
11579
|
+
const [nextChainId, setNextChainId] = (0, import_react31.useState)(null);
|
|
11527
11580
|
const { t } = useT();
|
|
11528
11581
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11529
|
-
const visibleNetworks = (0,
|
|
11582
|
+
const visibleNetworks = (0, import_react31.useMemo)(() => {
|
|
11530
11583
|
return NETWORK_OPTIONS.filter(
|
|
11531
11584
|
(option) => option.isActive && (isTestnets ? true : import_read14.SUPPORTED_MAINNETS.includes(option.chainId))
|
|
11532
11585
|
);
|
|
@@ -11600,7 +11653,7 @@ function ChainsMenu() {
|
|
|
11600
11653
|
}
|
|
11601
11654
|
);
|
|
11602
11655
|
}
|
|
11603
|
-
var import_core2, import_read14, import_react_query15, import_lucide_react20,
|
|
11656
|
+
var import_core2, import_read14, import_react_query15, import_lucide_react20, import_react31, import_jsx_runtime52;
|
|
11604
11657
|
var init_ChainsMenu = __esm({
|
|
11605
11658
|
"src/internal/components/ChainsMenu/ChainsMenu.tsx"() {
|
|
11606
11659
|
init_networks3();
|
|
@@ -11611,7 +11664,7 @@ var init_ChainsMenu = __esm({
|
|
|
11611
11664
|
import_read14 = require("@embarkai/core/read");
|
|
11612
11665
|
import_react_query15 = require("@tanstack/react-query");
|
|
11613
11666
|
import_lucide_react20 = require("lucide-react");
|
|
11614
|
-
|
|
11667
|
+
import_react31 = require("react");
|
|
11615
11668
|
init_resolve_paymaster();
|
|
11616
11669
|
init_useLayoutDataStore();
|
|
11617
11670
|
init_useLayoutStore();
|
|
@@ -11799,8 +11852,8 @@ function DeviceLinkScreen() {
|
|
|
11799
11852
|
const setPage = useLayoutDataStore((s) => s.setPage);
|
|
11800
11853
|
const maxScrollHeight = useLayoutStore((s) => s.maxScrollHeight);
|
|
11801
11854
|
const { mutate: link, isPending } = useLinkDevice();
|
|
11802
|
-
const [code, setCode] = (0,
|
|
11803
|
-
const [error, setError] = (0,
|
|
11855
|
+
const [code, setCode] = (0, import_react32.useState)("");
|
|
11856
|
+
const [error, setError] = (0, import_react32.useState)(null);
|
|
11804
11857
|
const isValid = code.length === 6 && VALID_CHARS.test(code);
|
|
11805
11858
|
function handleCodeChange(value) {
|
|
11806
11859
|
const upper = value.toUpperCase().slice(0, 6);
|
|
@@ -11859,10 +11912,10 @@ function DeviceLinkScreen() {
|
|
|
11859
11912
|
}
|
|
11860
11913
|
);
|
|
11861
11914
|
}
|
|
11862
|
-
var
|
|
11915
|
+
var import_react32, import_lucide_react22, import_jsx_runtime54, VALID_CHARS;
|
|
11863
11916
|
var init_DeviceLinkScreen = __esm({
|
|
11864
11917
|
"src/internal/components/DevicesMenu/DeviceLinkScreen.tsx"() {
|
|
11865
|
-
|
|
11918
|
+
import_react32 = require("react");
|
|
11866
11919
|
import_lucide_react22 = require("lucide-react");
|
|
11867
11920
|
init_Expandable2();
|
|
11868
11921
|
init_button();
|
|
@@ -12395,19 +12448,19 @@ function DeviceManageScreen() {
|
|
|
12395
12448
|
const userId = session?.mpcUserId || "";
|
|
12396
12449
|
const deviceId = pageParams?.deviceId;
|
|
12397
12450
|
const deviceName = pageParams?.deviceName;
|
|
12398
|
-
const guardianRef = (0,
|
|
12399
|
-
const [screen, setScreen] = (0,
|
|
12400
|
-
const [actionState, setActionState] = (0,
|
|
12401
|
-
const [password, setPassword] = (0,
|
|
12402
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
12403
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
12404
|
-
const [waitingConfirm, setWaitingConfirm] = (0,
|
|
12405
|
-
(0,
|
|
12451
|
+
const guardianRef = (0, import_react33.useRef)(null);
|
|
12452
|
+
const [screen, setScreen] = (0, import_react33.useState)({ step: "connecting" });
|
|
12453
|
+
const [actionState, setActionState] = (0, import_react33.useState)(null);
|
|
12454
|
+
const [password, setPassword] = (0, import_react33.useState)("");
|
|
12455
|
+
const [statusMessage, setStatusMessage] = (0, import_react33.useState)(null);
|
|
12456
|
+
const [errorMessage, setErrorMessage] = (0, import_react33.useState)(null);
|
|
12457
|
+
const [waitingConfirm, setWaitingConfirm] = (0, import_react33.useState)(false);
|
|
12458
|
+
(0, import_react33.useEffect)(() => {
|
|
12406
12459
|
if (!statusMessage) return;
|
|
12407
12460
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
12408
12461
|
return () => clearTimeout(t);
|
|
12409
12462
|
}, [statusMessage]);
|
|
12410
|
-
(0,
|
|
12463
|
+
(0, import_react33.useEffect)(() => {
|
|
12411
12464
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
12412
12465
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
12413
12466
|
return;
|
|
@@ -12439,7 +12492,7 @@ function DeviceManageScreen() {
|
|
|
12439
12492
|
guardianRef.current?.close();
|
|
12440
12493
|
};
|
|
12441
12494
|
}, [deviceId]);
|
|
12442
|
-
const refreshList = (0,
|
|
12495
|
+
const refreshList = (0, import_react33.useCallback)(async () => {
|
|
12443
12496
|
const guardian = guardianRef.current;
|
|
12444
12497
|
if (!guardian || screen.step !== "connected") return;
|
|
12445
12498
|
try {
|
|
@@ -12448,7 +12501,7 @@ function DeviceManageScreen() {
|
|
|
12448
12501
|
} catch {
|
|
12449
12502
|
}
|
|
12450
12503
|
}, [screen]);
|
|
12451
|
-
const handleBackup = (0,
|
|
12504
|
+
const handleBackup = (0, import_react33.useCallback)(async () => {
|
|
12452
12505
|
const guardian = guardianRef.current;
|
|
12453
12506
|
const iframe4 = getIframeManager();
|
|
12454
12507
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12472,7 +12525,7 @@ function DeviceManageScreen() {
|
|
|
12472
12525
|
setActionState(null);
|
|
12473
12526
|
}
|
|
12474
12527
|
}, [password, userId, refreshList]);
|
|
12475
|
-
const handleOverwrite = (0,
|
|
12528
|
+
const handleOverwrite = (0, import_react33.useCallback)(async () => {
|
|
12476
12529
|
const guardian = guardianRef.current;
|
|
12477
12530
|
const iframe4 = getIframeManager();
|
|
12478
12531
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12492,7 +12545,7 @@ function DeviceManageScreen() {
|
|
|
12492
12545
|
setActionState(null);
|
|
12493
12546
|
}
|
|
12494
12547
|
}, [password, userId, refreshList]);
|
|
12495
|
-
const handleDelete = (0,
|
|
12548
|
+
const handleDelete = (0, import_react33.useCallback)(async (keyshareId) => {
|
|
12496
12549
|
const guardian = guardianRef.current;
|
|
12497
12550
|
if (!guardian) return;
|
|
12498
12551
|
setActionState({ action: "delete", keyshareId, substep: "confirm-device" });
|
|
@@ -12659,10 +12712,10 @@ function DeviceManageScreen() {
|
|
|
12659
12712
|
}
|
|
12660
12713
|
);
|
|
12661
12714
|
}
|
|
12662
|
-
var
|
|
12715
|
+
var import_react33, import_lucide_react23, import_jsx_runtime55;
|
|
12663
12716
|
var init_DeviceManageScreen = __esm({
|
|
12664
12717
|
"src/internal/components/DevicesMenu/DeviceManageScreen.tsx"() {
|
|
12665
|
-
|
|
12718
|
+
import_react33 = require("react");
|
|
12666
12719
|
import_lucide_react23 = require("lucide-react");
|
|
12667
12720
|
init_Expandable2();
|
|
12668
12721
|
init_button();
|
|
@@ -12685,11 +12738,11 @@ function DeviceRestoreScreen() {
|
|
|
12685
12738
|
const keyshareId = pageParams?.keyshareId;
|
|
12686
12739
|
const deviceId = pageParams?.deviceId;
|
|
12687
12740
|
const deviceName = pageParams?.deviceName;
|
|
12688
|
-
const [password, setPassword] = (0,
|
|
12689
|
-
const [isWorking, setIsWorking] = (0,
|
|
12690
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
12691
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
12692
|
-
const handleRestore = (0,
|
|
12741
|
+
const [password, setPassword] = (0, import_react34.useState)("");
|
|
12742
|
+
const [isWorking, setIsWorking] = (0, import_react34.useState)(false);
|
|
12743
|
+
const [statusMessage, setStatusMessage] = (0, import_react34.useState)(null);
|
|
12744
|
+
const [errorMessage, setErrorMessage] = (0, import_react34.useState)(null);
|
|
12745
|
+
const handleRestore = (0, import_react34.useCallback)(async () => {
|
|
12693
12746
|
if (!password || !keyshareId || !userId) return;
|
|
12694
12747
|
const iframe4 = getIframeManager();
|
|
12695
12748
|
if (!iframe4) {
|
|
@@ -12776,10 +12829,10 @@ function DeviceRestoreScreen() {
|
|
|
12776
12829
|
}
|
|
12777
12830
|
);
|
|
12778
12831
|
}
|
|
12779
|
-
var
|
|
12832
|
+
var import_react34, import_lucide_react24, import_jsx_runtime56;
|
|
12780
12833
|
var init_DeviceRestoreScreen = __esm({
|
|
12781
12834
|
"src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx"() {
|
|
12782
|
-
|
|
12835
|
+
import_react34 = require("react");
|
|
12783
12836
|
import_lucide_react24 = require("lucide-react");
|
|
12784
12837
|
init_Expandable2();
|
|
12785
12838
|
init_button();
|
|
@@ -12802,8 +12855,8 @@ function truncateAddress(address) {
|
|
|
12802
12855
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
12803
12856
|
}
|
|
12804
12857
|
function DeviceRow({ device }) {
|
|
12805
|
-
const [confirmingUnlink, setConfirmingUnlink] = (0,
|
|
12806
|
-
const [unlinkError, setUnlinkError] = (0,
|
|
12858
|
+
const [confirmingUnlink, setConfirmingUnlink] = (0, import_react35.useState)(false);
|
|
12859
|
+
const [unlinkError, setUnlinkError] = (0, import_react35.useState)(null);
|
|
12807
12860
|
const { mutate: unlink, isPending } = useUnlinkDevice();
|
|
12808
12861
|
if (confirmingUnlink) {
|
|
12809
12862
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-2 p-3 rounded-lg bg-[var(--ui-kit-bg)]", children: [
|
|
@@ -12917,10 +12970,10 @@ function DevicesMenu() {
|
|
|
12917
12970
|
}
|
|
12918
12971
|
);
|
|
12919
12972
|
}
|
|
12920
|
-
var
|
|
12973
|
+
var import_react35, import_lucide_react25, import_jsx_runtime57;
|
|
12921
12974
|
var init_DevicesMenu = __esm({
|
|
12922
12975
|
"src/internal/components/DevicesMenu/DevicesMenu.tsx"() {
|
|
12923
|
-
|
|
12976
|
+
import_react35 = require("react");
|
|
12924
12977
|
import_lucide_react25 = require("lucide-react");
|
|
12925
12978
|
init_Expandable2();
|
|
12926
12979
|
init_button();
|
|
@@ -13013,7 +13066,7 @@ function useOnRestoreSuccess() {
|
|
|
13013
13066
|
setStatus
|
|
13014
13067
|
} = useSession();
|
|
13015
13068
|
const { setError, setSuccess } = useRestoreStore();
|
|
13016
|
-
const createSessionWithKeyshare = (0,
|
|
13069
|
+
const createSessionWithKeyshare = (0, import_react36.useCallback)(
|
|
13017
13070
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
13018
13071
|
try {
|
|
13019
13072
|
try {
|
|
@@ -13054,7 +13107,7 @@ function useOnRestoreSuccess() {
|
|
|
13054
13107
|
},
|
|
13055
13108
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
13056
13109
|
);
|
|
13057
|
-
const onRestoreSuccess = (0,
|
|
13110
|
+
const onRestoreSuccess = (0, import_react36.useCallback)(async () => {
|
|
13058
13111
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
13059
13112
|
const verify = await verifyToken2();
|
|
13060
13113
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -13119,12 +13172,12 @@ function useOnRestoreSuccess() {
|
|
|
13119
13172
|
]);
|
|
13120
13173
|
return { onRestoreSuccess };
|
|
13121
13174
|
}
|
|
13122
|
-
var
|
|
13175
|
+
var import_react36;
|
|
13123
13176
|
var init_useOnRestoreSuccess = __esm({
|
|
13124
13177
|
"src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts"() {
|
|
13125
13178
|
init_ProviderContext();
|
|
13126
13179
|
init_SessionContext();
|
|
13127
|
-
|
|
13180
|
+
import_react36 = require("react");
|
|
13128
13181
|
init_useLayoutDataStore();
|
|
13129
13182
|
init_useLayoutStore();
|
|
13130
13183
|
init_useRestoreStore();
|
|
@@ -13549,7 +13602,7 @@ function useCreateBackup() {
|
|
|
13549
13602
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
13550
13603
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
13551
13604
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
13552
|
-
(0,
|
|
13605
|
+
(0, import_react37.useEffect)(() => {
|
|
13553
13606
|
if (!hasServerVault) {
|
|
13554
13607
|
useRestoreStore.getState().setMethod("server");
|
|
13555
13608
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -13557,7 +13610,7 @@ function useCreateBackup() {
|
|
|
13557
13610
|
}, [hasServerVault]);
|
|
13558
13611
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
13559
13612
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
13560
|
-
const onBackupSuccess = (0,
|
|
13613
|
+
const onBackupSuccess = (0, import_react37.useCallback)(() => {
|
|
13561
13614
|
console.log("[EMBARKAI BACKUP] Backup created successfully");
|
|
13562
13615
|
}, [hasServerVault]);
|
|
13563
13616
|
const { mutate: createPasswordBackup, isPending: isPasswordBackupCreating } = (0, import_react_query17.useMutation)({
|
|
@@ -13717,12 +13770,12 @@ function useCreateBackup() {
|
|
|
13717
13770
|
createPasskey
|
|
13718
13771
|
};
|
|
13719
13772
|
}
|
|
13720
|
-
var import_react_query17,
|
|
13773
|
+
var import_react_query17, import_react37;
|
|
13721
13774
|
var init_useCreateBackup = __esm({
|
|
13722
13775
|
"src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts"() {
|
|
13723
13776
|
init_SessionContext();
|
|
13724
13777
|
import_react_query17 = require("@tanstack/react-query");
|
|
13725
|
-
|
|
13778
|
+
import_react37 = require("react");
|
|
13726
13779
|
init_auth();
|
|
13727
13780
|
init_useLayoutStore();
|
|
13728
13781
|
init_iframe_manager();
|
|
@@ -13857,7 +13910,7 @@ function useValidateFileBackup() {
|
|
|
13857
13910
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
13858
13911
|
const setError = useRestoreStore((st) => st.setError);
|
|
13859
13912
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
13860
|
-
(0,
|
|
13913
|
+
(0, import_react38.useEffect)(() => {
|
|
13861
13914
|
if (!restoreFile) {
|
|
13862
13915
|
return;
|
|
13863
13916
|
}
|
|
@@ -13878,10 +13931,10 @@ function useValidateFileBackup() {
|
|
|
13878
13931
|
reader.readAsText(restoreFile);
|
|
13879
13932
|
}, [restoreFile]);
|
|
13880
13933
|
}
|
|
13881
|
-
var
|
|
13934
|
+
var import_react38;
|
|
13882
13935
|
var init_useValidateFileBackup = __esm({
|
|
13883
13936
|
"src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts"() {
|
|
13884
|
-
|
|
13937
|
+
import_react38 = require("react");
|
|
13885
13938
|
init_useRestoreStore();
|
|
13886
13939
|
}
|
|
13887
13940
|
});
|
|
@@ -13909,7 +13962,7 @@ function MethodSelector(props) {
|
|
|
13909
13962
|
setError,
|
|
13910
13963
|
setSuccess
|
|
13911
13964
|
} = useRestoreStore();
|
|
13912
|
-
const recoveryRenderMethods = (0,
|
|
13965
|
+
const recoveryRenderMethods = (0, import_react39.useMemo)(() => {
|
|
13913
13966
|
const methodsWithBackupData = getRecoveryRenderMethods(mode).map((mt) => {
|
|
13914
13967
|
let data = null;
|
|
13915
13968
|
switch (true) {
|
|
@@ -13924,7 +13977,7 @@ function MethodSelector(props) {
|
|
|
13924
13977
|
return methodsWithBackupData;
|
|
13925
13978
|
}, [mode, serverRecoveryStatus]);
|
|
13926
13979
|
if (!!selectedRecoveryMethod) return null;
|
|
13927
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
13980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react39.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
13928
13981
|
"div",
|
|
13929
13982
|
{
|
|
13930
13983
|
style: { gridTemplateColumns: `repeat(${recoveryRenderMethods.length}, minmax(0, 1fr))` },
|
|
@@ -13958,12 +14011,12 @@ function MethodSelector(props) {
|
|
|
13958
14011
|
}
|
|
13959
14012
|
) });
|
|
13960
14013
|
}
|
|
13961
|
-
var import_lucide_react27,
|
|
14014
|
+
var import_lucide_react27, import_react39, import_jsx_runtime58, getRecoveryRenderMethods;
|
|
13962
14015
|
var init_MethodSelector = __esm({
|
|
13963
14016
|
"src/internal/components/KeyshareRestoreMenu/components/MethodSelector.tsx"() {
|
|
13964
14017
|
init_useT();
|
|
13965
14018
|
import_lucide_react27 = require("lucide-react");
|
|
13966
|
-
|
|
14019
|
+
import_react39 = require("react");
|
|
13967
14020
|
init_icons();
|
|
13968
14021
|
init_guardian_backup();
|
|
13969
14022
|
init_button();
|
|
@@ -13997,7 +14050,7 @@ function PasswordPasskey(props) {
|
|
|
13997
14050
|
onCreatePasskey
|
|
13998
14051
|
} = props;
|
|
13999
14052
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
14000
|
-
const actionRef = (0,
|
|
14053
|
+
const actionRef = (0, import_react40.useRef)(null);
|
|
14001
14054
|
const {
|
|
14002
14055
|
showPassword,
|
|
14003
14056
|
restorePassword,
|
|
@@ -14011,7 +14064,7 @@ function PasswordPasskey(props) {
|
|
|
14011
14064
|
} = useRestoreStore();
|
|
14012
14065
|
const { config } = useProviderConfig();
|
|
14013
14066
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
14014
|
-
(0,
|
|
14067
|
+
(0, import_react40.useEffect)(() => {
|
|
14015
14068
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
14016
14069
|
}, [isPasskeyEnabled, usePasskey]);
|
|
14017
14070
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
@@ -14166,7 +14219,7 @@ function PasswordPasskey(props) {
|
|
|
14166
14219
|
] })
|
|
14167
14220
|
] });
|
|
14168
14221
|
}
|
|
14169
|
-
var import_lucide_react28,
|
|
14222
|
+
var import_lucide_react28, import_react40, import_jsx_runtime59;
|
|
14170
14223
|
var init_PasswordPasskey = __esm({
|
|
14171
14224
|
"src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx"() {
|
|
14172
14225
|
init_ProviderContext();
|
|
@@ -14174,7 +14227,7 @@ var init_PasswordPasskey = __esm({
|
|
|
14174
14227
|
init_i18n();
|
|
14175
14228
|
init_utils2();
|
|
14176
14229
|
import_lucide_react28 = require("lucide-react");
|
|
14177
|
-
|
|
14230
|
+
import_react40 = require("react");
|
|
14178
14231
|
init_icons();
|
|
14179
14232
|
init_button();
|
|
14180
14233
|
init_highlight();
|
|
@@ -14350,7 +14403,7 @@ function Server(props) {
|
|
|
14350
14403
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
14351
14404
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
14352
14405
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
14353
|
-
(0,
|
|
14406
|
+
(0, import_react41.useEffect)(() => {
|
|
14354
14407
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
14355
14408
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
14356
14409
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -14385,7 +14438,7 @@ function Server(props) {
|
|
|
14385
14438
|
] })
|
|
14386
14439
|
] });
|
|
14387
14440
|
}
|
|
14388
|
-
var import_react_query19, import_dayjs3, import_lucide_react31,
|
|
14441
|
+
var import_react_query19, import_dayjs3, import_lucide_react31, import_react41, import_jsx_runtime62;
|
|
14389
14442
|
var init_Server = __esm({
|
|
14390
14443
|
"src/internal/components/KeyshareRestoreMenu/methods/Server.tsx"() {
|
|
14391
14444
|
init_SessionContext();
|
|
@@ -14394,7 +14447,7 @@ var init_Server = __esm({
|
|
|
14394
14447
|
import_react_query19 = require("@tanstack/react-query");
|
|
14395
14448
|
import_dayjs3 = __toESM(require("dayjs"), 1);
|
|
14396
14449
|
import_lucide_react31 = require("lucide-react");
|
|
14397
|
-
|
|
14450
|
+
import_react41 = require("react");
|
|
14398
14451
|
init_highlight();
|
|
14399
14452
|
init_PasswordPasskey();
|
|
14400
14453
|
init_constants4();
|
|
@@ -14557,7 +14610,7 @@ function Cloud2(props) {
|
|
|
14557
14610
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
14558
14611
|
}
|
|
14559
14612
|
});
|
|
14560
|
-
(0,
|
|
14613
|
+
(0, import_react42.useEffect)(() => {
|
|
14561
14614
|
if (isCloudProvidersLoading) return;
|
|
14562
14615
|
if (!!cloudProvidersError) {
|
|
14563
14616
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -14621,13 +14674,13 @@ function Cloud2(props) {
|
|
|
14621
14674
|
)
|
|
14622
14675
|
] });
|
|
14623
14676
|
}
|
|
14624
|
-
var import_react_query20, import_lucide_react33,
|
|
14677
|
+
var import_react_query20, import_lucide_react33, import_react42, import_jsx_runtime64;
|
|
14625
14678
|
var init_Cloud = __esm({
|
|
14626
14679
|
"src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx"() {
|
|
14627
14680
|
init_SessionContext();
|
|
14628
14681
|
import_react_query20 = require("@tanstack/react-query");
|
|
14629
14682
|
import_lucide_react33 = require("lucide-react");
|
|
14630
|
-
|
|
14683
|
+
import_react42 = require("react");
|
|
14631
14684
|
init_button();
|
|
14632
14685
|
init_select();
|
|
14633
14686
|
init_PasswordPasskey();
|
|
@@ -14644,8 +14697,8 @@ function Guardian(props) {
|
|
|
14644
14697
|
const session = useSession((st) => st.session);
|
|
14645
14698
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
14646
14699
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
14647
|
-
const [isWorking, setIsWorking] = (0,
|
|
14648
|
-
const [step, setStep] = (0,
|
|
14700
|
+
const [isWorking, setIsWorking] = (0, import_react43.useState)(false);
|
|
14701
|
+
const [step, setStep] = (0, import_react43.useState)("idle");
|
|
14649
14702
|
const handleGuardianBackup = async () => {
|
|
14650
14703
|
if (!restorePassword) {
|
|
14651
14704
|
setError("Please enter a password");
|
|
@@ -14774,11 +14827,11 @@ function Guardian(props) {
|
|
|
14774
14827
|
] })
|
|
14775
14828
|
] });
|
|
14776
14829
|
}
|
|
14777
|
-
var
|
|
14830
|
+
var import_react43, import_lucide_react34, import_jsx_runtime65;
|
|
14778
14831
|
var init_Guardian = __esm({
|
|
14779
14832
|
"src/internal/components/KeyshareRestoreMenu/methods/Guardian.tsx"() {
|
|
14780
14833
|
init_SessionContext();
|
|
14781
|
-
|
|
14834
|
+
import_react43 = require("react");
|
|
14782
14835
|
import_lucide_react34 = require("lucide-react");
|
|
14783
14836
|
init_iframe_manager();
|
|
14784
14837
|
init_guardian_backup();
|
|
@@ -14801,7 +14854,7 @@ var init_methods = __esm({
|
|
|
14801
14854
|
});
|
|
14802
14855
|
|
|
14803
14856
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
14804
|
-
var import_react_query21, import_lucide_react35,
|
|
14857
|
+
var import_react_query21, import_lucide_react35, import_react44, import_wagmi, import_jsx_runtime66, RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
14805
14858
|
var init_KeyshareRestoreMenu = __esm({
|
|
14806
14859
|
"src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
|
|
14807
14860
|
init_ProviderContext();
|
|
@@ -14809,7 +14862,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14809
14862
|
init_i18n();
|
|
14810
14863
|
import_react_query21 = require("@tanstack/react-query");
|
|
14811
14864
|
import_lucide_react35 = require("lucide-react");
|
|
14812
|
-
|
|
14865
|
+
import_react44 = require("react");
|
|
14813
14866
|
import_wagmi = require("wagmi");
|
|
14814
14867
|
init_useLayoutDataStore();
|
|
14815
14868
|
init_useLayoutStore();
|
|
@@ -14840,7 +14893,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14840
14893
|
const error = useRestoreStore((st) => st.error);
|
|
14841
14894
|
const success = useRestoreStore((st) => st.success);
|
|
14842
14895
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
14843
|
-
(0,
|
|
14896
|
+
(0, import_react44.useEffect)(() => {
|
|
14844
14897
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
14845
14898
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
14846
14899
|
setIsDialogForced(true);
|
|
@@ -14880,7 +14933,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14880
14933
|
queryFn: async () => await getShareRecoveryStats()
|
|
14881
14934
|
});
|
|
14882
14935
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
14883
|
-
(0,
|
|
14936
|
+
(0, import_react44.useEffect)(() => {
|
|
14884
14937
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
14885
14938
|
}, [hasServerBackup]);
|
|
14886
14939
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query21.useMutation)({
|
|
@@ -15034,7 +15087,7 @@ function KeyshareBackupMenu() {
|
|
|
15034
15087
|
const currentBackupMethod = useRestoreStore((st) => st.method);
|
|
15035
15088
|
const error = useRestoreStore((st) => st.error);
|
|
15036
15089
|
const success = useRestoreStore((st) => st.success);
|
|
15037
|
-
(0,
|
|
15090
|
+
(0, import_react45.useEffect)(() => {
|
|
15038
15091
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15039
15092
|
return () => {
|
|
15040
15093
|
setSuccess(null);
|
|
@@ -15053,7 +15106,7 @@ function KeyshareBackupMenu() {
|
|
|
15053
15106
|
queryFn: async () => await getShareRecoveryStats()
|
|
15054
15107
|
});
|
|
15055
15108
|
const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15056
|
-
(0,
|
|
15109
|
+
(0, import_react45.useEffect)(() => {
|
|
15057
15110
|
if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
|
|
15058
15111
|
}, [hasRecoveryData]);
|
|
15059
15112
|
const {
|
|
@@ -15172,14 +15225,14 @@ function KeyshareBackupMenu() {
|
|
|
15172
15225
|
}
|
|
15173
15226
|
);
|
|
15174
15227
|
}
|
|
15175
|
-
var import_react_query22, import_lucide_react36,
|
|
15228
|
+
var import_react_query22, import_lucide_react36, import_react45, import_jsx_runtime67, COMPONENTS;
|
|
15176
15229
|
var init_KeyshareBackupMenu = __esm({
|
|
15177
15230
|
"src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx"() {
|
|
15178
15231
|
init_SessionContext();
|
|
15179
15232
|
init_i18n();
|
|
15180
15233
|
import_react_query22 = require("@tanstack/react-query");
|
|
15181
15234
|
import_lucide_react36 = require("lucide-react");
|
|
15182
|
-
|
|
15235
|
+
import_react45 = require("react");
|
|
15183
15236
|
init_useLayoutDataStore();
|
|
15184
15237
|
init_useLayoutStore();
|
|
15185
15238
|
init_vaultClient();
|
|
@@ -15217,14 +15270,14 @@ function useColorMode() {
|
|
|
15217
15270
|
const preferedColorMode = config?.preferedColorMode;
|
|
15218
15271
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
15219
15272
|
const handleStoreColorMode = useLayoutStore((st) => st.setColorMode);
|
|
15220
|
-
const setColorMode = (0,
|
|
15273
|
+
const setColorMode = (0, import_react46.useCallback)(
|
|
15221
15274
|
(mode) => {
|
|
15222
15275
|
localStorage.setItem(LOCAL_COLOR_MODE_KEY, mode);
|
|
15223
15276
|
handleStoreColorMode(mode);
|
|
15224
15277
|
},
|
|
15225
15278
|
[handleStoreColorMode]
|
|
15226
15279
|
);
|
|
15227
|
-
(0,
|
|
15280
|
+
(0, import_react46.useEffect)(() => {
|
|
15228
15281
|
let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
|
|
15229
15282
|
if (!targetColorMode && !preferedColorMode) {
|
|
15230
15283
|
const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -15239,10 +15292,10 @@ function useColorMode() {
|
|
|
15239
15292
|
}, []);
|
|
15240
15293
|
return { colorMode, setColorMode };
|
|
15241
15294
|
}
|
|
15242
|
-
var
|
|
15295
|
+
var import_react46;
|
|
15243
15296
|
var init_useColorMode = __esm({
|
|
15244
15297
|
"src/hooks/useColorMode.ts"() {
|
|
15245
|
-
|
|
15298
|
+
import_react46 = require("react");
|
|
15246
15299
|
init_ProviderContext();
|
|
15247
15300
|
init_constants();
|
|
15248
15301
|
init_useLayoutStore();
|
|
@@ -15344,13 +15397,13 @@ var init_SumsubIframeManager = __esm({
|
|
|
15344
15397
|
function useSumsubIframe({ iframeUrl }) {
|
|
15345
15398
|
const config = useProviderConfig().config;
|
|
15346
15399
|
const { colorMode } = useColorMode();
|
|
15347
|
-
const iframeRef = (0,
|
|
15348
|
-
const [isLoading, setIsLoading] = (0,
|
|
15349
|
-
const [error, setError] = (0,
|
|
15350
|
-
const [height, setHeight] = (0,
|
|
15351
|
-
const [status, setStatus] = (0,
|
|
15400
|
+
const iframeRef = (0, import_react47.useRef)(null);
|
|
15401
|
+
const [isLoading, setIsLoading] = (0, import_react47.useState)(true);
|
|
15402
|
+
const [error, setError] = (0, import_react47.useState)(null);
|
|
15403
|
+
const [height, setHeight] = (0, import_react47.useState)(0);
|
|
15404
|
+
const [status, setStatus] = (0, import_react47.useState)("");
|
|
15352
15405
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
15353
|
-
(0,
|
|
15406
|
+
(0, import_react47.useEffect)(() => {
|
|
15354
15407
|
setError(null);
|
|
15355
15408
|
setIsLoading(true);
|
|
15356
15409
|
setStatus("Preparing verification...");
|
|
@@ -15391,12 +15444,12 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
15391
15444
|
status
|
|
15392
15445
|
};
|
|
15393
15446
|
}
|
|
15394
|
-
var
|
|
15447
|
+
var import_react47;
|
|
15395
15448
|
var init_useSumsubIframe = __esm({
|
|
15396
15449
|
"src/internal/components/KYC/useSumsubIframe.ts"() {
|
|
15397
15450
|
init_ProviderContext();
|
|
15398
15451
|
init_useColorMode();
|
|
15399
|
-
|
|
15452
|
+
import_react47 = require("react");
|
|
15400
15453
|
init_sumsub();
|
|
15401
15454
|
init_SumsubIframeManager();
|
|
15402
15455
|
}
|
|
@@ -15670,7 +15723,7 @@ function MainMenu() {
|
|
|
15670
15723
|
const { t } = useT();
|
|
15671
15724
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
15672
15725
|
const setTransitionPageHeight = useLayoutDataStore((st) => st.setTransitionPageHeight);
|
|
15673
|
-
(0,
|
|
15726
|
+
(0, import_react48.useEffect)(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
|
|
15674
15727
|
useProvidersList();
|
|
15675
15728
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "w-full p-[var(--ui-kit-pd)] flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("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__ */ (0, import_jsx_runtime72.jsxs)(
|
|
15676
15729
|
Button,
|
|
@@ -15688,13 +15741,13 @@ function MainMenu() {
|
|
|
15688
15741
|
id
|
|
15689
15742
|
)) }) });
|
|
15690
15743
|
}
|
|
15691
|
-
var import_lucide_react41,
|
|
15744
|
+
var import_lucide_react41, import_react48, import_jsx_runtime72, MAIN_MENU_BUTTONS;
|
|
15692
15745
|
var init_MainMenu = __esm({
|
|
15693
15746
|
"src/internal/components/MainMenu/MainMenu.tsx"() {
|
|
15694
15747
|
init_SessionContext();
|
|
15695
15748
|
init_useT();
|
|
15696
15749
|
import_lucide_react41 = require("lucide-react");
|
|
15697
|
-
|
|
15750
|
+
import_react48 = require("react");
|
|
15698
15751
|
init_constants();
|
|
15699
15752
|
init_useLayoutDataStore();
|
|
15700
15753
|
init_useProvidersList();
|
|
@@ -15740,16 +15793,16 @@ function useLinkedProfiles() {
|
|
|
15740
15793
|
}
|
|
15741
15794
|
});
|
|
15742
15795
|
const { profiles = [], avatar = null } = data || {};
|
|
15743
|
-
const refresh = (0,
|
|
15796
|
+
const refresh = (0, import_react49.useCallback)(async () => {
|
|
15744
15797
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15745
15798
|
}, [qc, address]);
|
|
15746
15799
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
15747
15800
|
}
|
|
15748
|
-
var import_react_query25,
|
|
15801
|
+
var import_react_query25, import_react49, LINKED_PROFILES_QUERY_KEY;
|
|
15749
15802
|
var init_linkedProfiles = __esm({
|
|
15750
15803
|
"src/modules/linkedProfiles.ts"() {
|
|
15751
15804
|
import_react_query25 = require("@tanstack/react-query");
|
|
15752
|
-
|
|
15805
|
+
import_react49 = require("react");
|
|
15753
15806
|
init_SessionContext();
|
|
15754
15807
|
init_auth();
|
|
15755
15808
|
init_common();
|
|
@@ -16240,7 +16293,7 @@ function useLinkSocial() {
|
|
|
16240
16293
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16241
16294
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16242
16295
|
const { providerType, linkIsLoading, setProviderType, setAlert, setLinkIsLoading } = useManageWalletStore();
|
|
16243
|
-
const handleLinkSocialProvider =
|
|
16296
|
+
const handleLinkSocialProvider = import_react50.default.useCallback(
|
|
16244
16297
|
async (providerIdRaw) => {
|
|
16245
16298
|
const providerKey = providerIdRaw.toLowerCase();
|
|
16246
16299
|
const normalizedKey = providerKey === "twitter" ? "x" : providerKey;
|
|
@@ -16298,8 +16351,8 @@ function useLinkSocial() {
|
|
|
16298
16351
|
},
|
|
16299
16352
|
[config.social?.providers]
|
|
16300
16353
|
);
|
|
16301
|
-
const [socialLinkStarted, setSocialLinkStarted] =
|
|
16302
|
-
(0,
|
|
16354
|
+
const [socialLinkStarted, setSocialLinkStarted] = import_react50.default.useState(false);
|
|
16355
|
+
(0, import_react50.useEffect)(() => {
|
|
16303
16356
|
const key = providerType?.toLowerCase();
|
|
16304
16357
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
|
|
16305
16358
|
if (isWalletLinking) {
|
|
@@ -16317,7 +16370,7 @@ function useLinkSocial() {
|
|
|
16317
16370
|
}
|
|
16318
16371
|
}, [providerType, linkIsLoading, socialLinkStarted, isWalletLinking, handleLinkSocialProvider]);
|
|
16319
16372
|
}
|
|
16320
|
-
var import_react_query30,
|
|
16373
|
+
var import_react_query30, import_react50;
|
|
16321
16374
|
var init_useLinkSocial = __esm({
|
|
16322
16375
|
"src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts"() {
|
|
16323
16376
|
init_useLayoutDataStore();
|
|
@@ -16325,7 +16378,7 @@ var init_useLinkSocial = __esm({
|
|
|
16325
16378
|
init_SessionContext();
|
|
16326
16379
|
init_linkedProfiles();
|
|
16327
16380
|
import_react_query30 = require("@tanstack/react-query");
|
|
16328
|
-
|
|
16381
|
+
import_react50 = __toESM(require("react"), 1);
|
|
16329
16382
|
init_auth();
|
|
16330
16383
|
init_telegramBrowser();
|
|
16331
16384
|
init_useProvidersList();
|
|
@@ -16394,7 +16447,7 @@ function useLinkTelegram() {
|
|
|
16394
16447
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16395
16448
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16396
16449
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16397
|
-
const handleLinkTelegram = (0,
|
|
16450
|
+
const handleLinkTelegram = (0, import_react51.useCallback)(async () => {
|
|
16398
16451
|
try {
|
|
16399
16452
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16400
16453
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16441,8 +16494,8 @@ function useLinkTelegram() {
|
|
|
16441
16494
|
setLinkIsLoading(false);
|
|
16442
16495
|
}
|
|
16443
16496
|
}, [config.social?.providers]);
|
|
16444
|
-
const [telegramLinkStarted, setTelegramLinkStarted] = (0,
|
|
16445
|
-
(0,
|
|
16497
|
+
const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react51.useState)(false);
|
|
16498
|
+
(0, import_react51.useEffect)(() => {
|
|
16446
16499
|
console.log("[useLinkTelegram] Effect triggered:", {
|
|
16447
16500
|
providerType,
|
|
16448
16501
|
linkIsLoading,
|
|
@@ -16459,20 +16512,20 @@ function useLinkTelegram() {
|
|
|
16459
16512
|
handleLinkTelegram();
|
|
16460
16513
|
}
|
|
16461
16514
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
|
|
16462
|
-
(0,
|
|
16515
|
+
(0, import_react51.useEffect)(() => {
|
|
16463
16516
|
if (providerType !== "telegram") {
|
|
16464
16517
|
setTelegramLinkStarted(false);
|
|
16465
16518
|
}
|
|
16466
16519
|
}, [providerType]);
|
|
16467
16520
|
}
|
|
16468
|
-
var import_react_query31,
|
|
16521
|
+
var import_react_query31, import_react51;
|
|
16469
16522
|
var init_useLinkTelegram = __esm({
|
|
16470
16523
|
"src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts"() {
|
|
16471
16524
|
init_ProviderContext();
|
|
16472
16525
|
init_SessionContext();
|
|
16473
16526
|
init_linkedProfiles();
|
|
16474
16527
|
import_react_query31 = require("@tanstack/react-query");
|
|
16475
|
-
|
|
16528
|
+
import_react51 = require("react");
|
|
16476
16529
|
init_telegram2();
|
|
16477
16530
|
init_useLayoutDataStore();
|
|
16478
16531
|
init_telegramBrowser();
|
|
@@ -16605,7 +16658,7 @@ function ManageWalletMenu() {
|
|
|
16605
16658
|
} = useManageWalletStore();
|
|
16606
16659
|
const configuredProviders = getConfiguredProviders(config.current);
|
|
16607
16660
|
const { data: providers = [], isLoading: isProvidersLoading, error: providersError } = useProvidersList();
|
|
16608
|
-
const renderProviders = (0,
|
|
16661
|
+
const renderProviders = (0, import_react52.useMemo)(() => {
|
|
16609
16662
|
const normalizeProviderName = (name) => {
|
|
16610
16663
|
if (name === "x") return "twitter";
|
|
16611
16664
|
return name;
|
|
@@ -16727,7 +16780,7 @@ function ManageWalletMenu() {
|
|
|
16727
16780
|
}
|
|
16728
16781
|
);
|
|
16729
16782
|
}
|
|
16730
|
-
var import_lodash_es8, import_lucide_react45,
|
|
16783
|
+
var import_lodash_es8, import_lucide_react45, import_react52, import_jsx_runtime77, POSSIBLE_PROVIDERS, MULTI_PROVIDERS;
|
|
16731
16784
|
var init_ManageWallet = __esm({
|
|
16732
16785
|
"src/internal/components/ManageWalletMenu/ManageWallet.tsx"() {
|
|
16733
16786
|
init_useLayoutDataStore();
|
|
@@ -16736,7 +16789,7 @@ var init_ManageWallet = __esm({
|
|
|
16736
16789
|
init_i18n();
|
|
16737
16790
|
import_lodash_es8 = require("lodash-es");
|
|
16738
16791
|
import_lucide_react45 = require("lucide-react");
|
|
16739
|
-
|
|
16792
|
+
import_react52 = require("react");
|
|
16740
16793
|
init_constants();
|
|
16741
16794
|
init_telegramBrowser();
|
|
16742
16795
|
init_Expandable2();
|
|
@@ -16773,7 +16826,7 @@ function UnlinkProviderMenu() {
|
|
|
16773
16826
|
const { t } = useT();
|
|
16774
16827
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16775
16828
|
const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
|
|
16776
|
-
const [confirmInput, setConfirmInput] = (0,
|
|
16829
|
+
const [confirmInput, setConfirmInput] = (0, import_react53.useState)("");
|
|
16777
16830
|
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0, import_react_query32.useMutation)({
|
|
16778
16831
|
mutationFn: async () => {
|
|
16779
16832
|
if (!confirmUnlink) {
|
|
@@ -16855,7 +16908,7 @@ function UnlinkProviderMenu() {
|
|
|
16855
16908
|
] })
|
|
16856
16909
|
] });
|
|
16857
16910
|
}
|
|
16858
|
-
var import_react_query32, import_lucide_react46,
|
|
16911
|
+
var import_react_query32, import_lucide_react46, import_react53, import_wagmi2, import_jsx_runtime78;
|
|
16859
16912
|
var init_UnlinkProviderMenu = __esm({
|
|
16860
16913
|
"src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
|
|
16861
16914
|
init_useLayoutDataStore();
|
|
@@ -16865,7 +16918,7 @@ var init_UnlinkProviderMenu = __esm({
|
|
|
16865
16918
|
init_linkedProfiles();
|
|
16866
16919
|
import_react_query32 = require("@tanstack/react-query");
|
|
16867
16920
|
import_lucide_react46 = require("lucide-react");
|
|
16868
|
-
|
|
16921
|
+
import_react53 = require("react");
|
|
16869
16922
|
import_wagmi2 = require("wagmi");
|
|
16870
16923
|
init_auth();
|
|
16871
16924
|
init_useExternalWalletStore();
|
|
@@ -17024,7 +17077,7 @@ function NicknameEditForm(props) {
|
|
|
17024
17077
|
const { t } = useT();
|
|
17025
17078
|
const passportWalletAddress = useSession((st) => st.address);
|
|
17026
17079
|
const { callbacksRef } = useProviderConfig();
|
|
17027
|
-
const [isNicknameCopied, setIsNicknameCopied] = (0,
|
|
17080
|
+
const [isNicknameCopied, setIsNicknameCopied] = (0, import_react54.useState)(false);
|
|
17028
17081
|
const {
|
|
17029
17082
|
mutate: changeNickname2,
|
|
17030
17083
|
isError: isNicknameChangeError,
|
|
@@ -17056,7 +17109,7 @@ function NicknameEditForm(props) {
|
|
|
17056
17109
|
);
|
|
17057
17110
|
}
|
|
17058
17111
|
});
|
|
17059
|
-
const handleInputChange = (0,
|
|
17112
|
+
const handleInputChange = (0, import_react54.useCallback)(
|
|
17060
17113
|
(e) => {
|
|
17061
17114
|
const value = e.target.value;
|
|
17062
17115
|
setInputValue(value);
|
|
@@ -17070,7 +17123,7 @@ function NicknameEditForm(props) {
|
|
|
17070
17123
|
},
|
|
17071
17124
|
[clientError, isNicknameChangeError, isNicknameChangeSuccess, reset, t]
|
|
17072
17125
|
);
|
|
17073
|
-
const handleSubmit = (0,
|
|
17126
|
+
const handleSubmit = (0, import_react54.useCallback)(
|
|
17074
17127
|
(e) => {
|
|
17075
17128
|
if (!canChange) return;
|
|
17076
17129
|
e.preventDefault();
|
|
@@ -17134,7 +17187,7 @@ function NicknameEditForm(props) {
|
|
|
17134
17187
|
!!canChange && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "w-full flex items-center leadding-4 text-[10px]", children: t("passport:nicknameMenu.hint") })
|
|
17135
17188
|
] });
|
|
17136
17189
|
}
|
|
17137
|
-
var import_react_query33, import_lucide_react48,
|
|
17190
|
+
var import_react_query33, import_lucide_react48, import_react54, import_jsx_runtime80;
|
|
17138
17191
|
var init_NicknameEditForm = __esm({
|
|
17139
17192
|
"src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
|
|
17140
17193
|
init_ProviderContext();
|
|
@@ -17142,7 +17195,7 @@ var init_NicknameEditForm = __esm({
|
|
|
17142
17195
|
init_i18n();
|
|
17143
17196
|
import_react_query33 = require("@tanstack/react-query");
|
|
17144
17197
|
import_lucide_react48 = require("lucide-react");
|
|
17145
|
-
|
|
17198
|
+
import_react54 = require("react");
|
|
17146
17199
|
init_icons();
|
|
17147
17200
|
init_nickname();
|
|
17148
17201
|
init_profile();
|
|
@@ -17158,17 +17211,17 @@ var init_NicknameEditForm = __esm({
|
|
|
17158
17211
|
|
|
17159
17212
|
// src/internal/components/NicknameMenu/useNickname.ts
|
|
17160
17213
|
function useNicknameForm(currentNickname) {
|
|
17161
|
-
const [inputValue, setInputValue] = (0,
|
|
17214
|
+
const [inputValue, setInputValue] = (0, import_react55.useState)("");
|
|
17162
17215
|
const normalizedInputValue = normalizeNickname(inputValue);
|
|
17163
17216
|
const validation = validateNickname(inputValue);
|
|
17164
17217
|
const isValidForCheck = validation.valid && normalizedInputValue.length > 0;
|
|
17165
|
-
(0,
|
|
17218
|
+
(0, import_react55.useEffect)(() => {
|
|
17166
17219
|
setInputValue(currentNickname);
|
|
17167
17220
|
}, [currentNickname]);
|
|
17168
|
-
const [queryInputValue, setQueryInputValue] = (0,
|
|
17221
|
+
const [queryInputValue, setQueryInputValue] = (0, import_react55.useState)("");
|
|
17169
17222
|
const isSameAsCurrentNickname = normalizedInputValue === currentNickname.toLowerCase();
|
|
17170
17223
|
const shouldCheckAvailability = validation.valid && !isSameAsCurrentNickname && inputValue.length > 0;
|
|
17171
|
-
(0,
|
|
17224
|
+
(0, import_react55.useEffect)(() => {
|
|
17172
17225
|
if (!isValidForCheck || !shouldCheckAvailability) {
|
|
17173
17226
|
setQueryInputValue("");
|
|
17174
17227
|
return;
|
|
@@ -17197,11 +17250,11 @@ function useNicknameForm(currentNickname) {
|
|
|
17197
17250
|
availabilityQuery: query
|
|
17198
17251
|
};
|
|
17199
17252
|
}
|
|
17200
|
-
var import_react_query34,
|
|
17253
|
+
var import_react_query34, import_react55, DEBOUNCE_MS;
|
|
17201
17254
|
var init_useNickname = __esm({
|
|
17202
17255
|
"src/internal/components/NicknameMenu/useNickname.ts"() {
|
|
17203
17256
|
import_react_query34 = require("@tanstack/react-query");
|
|
17204
|
-
|
|
17257
|
+
import_react55 = require("react");
|
|
17205
17258
|
init_nickname();
|
|
17206
17259
|
init_profile();
|
|
17207
17260
|
init_nickname_validation();
|
|
@@ -17211,9 +17264,10 @@ var init_useNickname = __esm({
|
|
|
17211
17264
|
|
|
17212
17265
|
// src/internal/components/NicknameMenu/NicknameMenu.tsx
|
|
17213
17266
|
function NicknameMenu() {
|
|
17267
|
+
const { isInitialUser } = usePageParams();
|
|
17214
17268
|
const address = useSession((st) => st.address);
|
|
17215
17269
|
const { t } = useT();
|
|
17216
|
-
const [clientError, setClientError] = (0,
|
|
17270
|
+
const [clientError, setClientError] = (0, import_react56.useState)(null);
|
|
17217
17271
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
17218
17272
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
17219
17273
|
const {
|
|
@@ -17292,23 +17346,41 @@ function NicknameMenu() {
|
|
|
17292
17346
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("strong", { className: "text-[var(--ui-kit-fg)]", children: nicknameInfo.changeCount })
|
|
17293
17347
|
] })
|
|
17294
17348
|
] }),
|
|
17295
|
-
|
|
17296
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
17297
|
-
|
|
17298
|
-
|
|
17349
|
+
isInitialUser && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(Highlight, { type: "success", children: [
|
|
17350
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("p", {
|
|
17351
|
+
//@ts-expect-error i18n typings
|
|
17352
|
+
children: t("passport:nicknameMenu.initialUser.welcome", {
|
|
17353
|
+
nickname: nicknameInfo?.handle || "N/A"
|
|
17354
|
+
})
|
|
17355
|
+
}),
|
|
17356
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("p", { children: t("passport:nicknameMenu.initialUser.message") }),
|
|
17357
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
17358
|
+
Button,
|
|
17359
|
+
{
|
|
17360
|
+
variant: "default-glow",
|
|
17361
|
+
size: "large",
|
|
17362
|
+
title: t("passport:common.continue"),
|
|
17363
|
+
onClick: () => setPage(null),
|
|
17364
|
+
className: "w-full",
|
|
17365
|
+
children: t("passport:common.continue")
|
|
17366
|
+
}
|
|
17367
|
+
)
|
|
17368
|
+
] }),
|
|
17369
|
+
!!resolvedError?.length && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Highlight, { type: "error", children: resolvedError })
|
|
17299
17370
|
] })
|
|
17300
17371
|
}
|
|
17301
17372
|
);
|
|
17302
17373
|
}
|
|
17303
|
-
var import_react_query35, import_dayjs4, import_lucide_react49,
|
|
17374
|
+
var import_react_query35, import_dayjs4, import_lucide_react49, import_react56, import_jsx_runtime81;
|
|
17304
17375
|
var init_NicknameMenu = __esm({
|
|
17305
17376
|
"src/internal/components/NicknameMenu/NicknameMenu.tsx"() {
|
|
17306
17377
|
init_SessionContext();
|
|
17378
|
+
init_useOpenPage();
|
|
17307
17379
|
init_i18n();
|
|
17308
17380
|
import_react_query35 = require("@tanstack/react-query");
|
|
17309
17381
|
import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
17310
17382
|
import_lucide_react49 = require("lucide-react");
|
|
17311
|
-
|
|
17383
|
+
import_react56 = require("react");
|
|
17312
17384
|
init_nickname();
|
|
17313
17385
|
init_profile();
|
|
17314
17386
|
init_useLayoutDataStore();
|
|
@@ -17345,11 +17417,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
17345
17417
|
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
17346
17418
|
const resolvedChainId = chainId ?? activeChainId;
|
|
17347
17419
|
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
17348
|
-
const chainConfig = (0,
|
|
17420
|
+
const chainConfig = (0, import_react57.useMemo)(() => {
|
|
17349
17421
|
if (shouldUseActiveClient) return activeChainConfig;
|
|
17350
17422
|
return (0, import_read15.getChainConfig)(chainId);
|
|
17351
17423
|
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
17352
|
-
const publicClient = (0,
|
|
17424
|
+
const publicClient = (0, import_react57.useMemo)(() => {
|
|
17353
17425
|
if (shouldUseActiveClient) return activePublicClient;
|
|
17354
17426
|
if (!chainId) return activePublicClient;
|
|
17355
17427
|
try {
|
|
@@ -17366,12 +17438,12 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
17366
17438
|
resolvedChainId
|
|
17367
17439
|
};
|
|
17368
17440
|
}
|
|
17369
|
-
var import_read15,
|
|
17441
|
+
var import_read15, import_react57, publicClientByChainId;
|
|
17370
17442
|
var init_useResolvedPublicClient = __esm({
|
|
17371
17443
|
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
17372
17444
|
init_SessionContext();
|
|
17373
17445
|
import_read15 = require("@embarkai/core/read");
|
|
17374
|
-
|
|
17446
|
+
import_react57 = require("react");
|
|
17375
17447
|
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
17376
17448
|
}
|
|
17377
17449
|
});
|
|
@@ -17381,7 +17453,7 @@ function useWatchTokens(options) {
|
|
|
17381
17453
|
const { address, chainId, enabled = true } = options;
|
|
17382
17454
|
const { config } = useProviderConfig();
|
|
17383
17455
|
const { publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useWatchTokens");
|
|
17384
|
-
const watchTokens = (0,
|
|
17456
|
+
const watchTokens = (0, import_react58.useMemo)(() => {
|
|
17385
17457
|
const allWatchTokens = config.current.watchTokens;
|
|
17386
17458
|
const tokensForChain = resolvedChainId ? allWatchTokens?.[resolvedChainId] || [] : [];
|
|
17387
17459
|
return tokensForChain;
|
|
@@ -17463,12 +17535,12 @@ function useWatchTokens(options) {
|
|
|
17463
17535
|
refetch
|
|
17464
17536
|
};
|
|
17465
17537
|
}
|
|
17466
|
-
var import_react_query36,
|
|
17538
|
+
var import_react_query36, import_react58, import_viem6, WATCH_TOKENS_QUERY_KEY;
|
|
17467
17539
|
var init_useWatchTokens = __esm({
|
|
17468
17540
|
"src/internal/hooks/useWatchTokens.ts"() {
|
|
17469
17541
|
init_ProviderContext();
|
|
17470
17542
|
import_react_query36 = require("@tanstack/react-query");
|
|
17471
|
-
|
|
17543
|
+
import_react58 = require("react");
|
|
17472
17544
|
import_viem6 = require("viem");
|
|
17473
17545
|
init_useResolvedPublicClient();
|
|
17474
17546
|
WATCH_TOKENS_QUERY_KEY = "watch-tokens";
|
|
@@ -17606,11 +17678,11 @@ function useBlockscoutAssets(options) {
|
|
|
17606
17678
|
const customTokenBalancesQuery = portfolioConfig?.tokenBalancesQuery;
|
|
17607
17679
|
const customTokenBalancesQueryKey = portfolioConfig?.tokenBalancesQueryKey;
|
|
17608
17680
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
17609
|
-
const blockscoutClient = (0,
|
|
17681
|
+
const blockscoutClient = (0, import_react59.useMemo)(
|
|
17610
17682
|
() => blockscoutApiUrl ? (0, import_clients2.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
17611
17683
|
[blockscoutApiUrl]
|
|
17612
17684
|
);
|
|
17613
|
-
const lastRefreshRef = (0,
|
|
17685
|
+
const lastRefreshRef = (0, import_react59.useRef)(0);
|
|
17614
17686
|
const {
|
|
17615
17687
|
assets: watchTokenAssets,
|
|
17616
17688
|
isLoading: watchTokensLoading,
|
|
@@ -17679,7 +17751,7 @@ function useBlockscoutAssets(options) {
|
|
|
17679
17751
|
retry: 2,
|
|
17680
17752
|
retryDelay: 1e3
|
|
17681
17753
|
});
|
|
17682
|
-
const erc20TokenAddresses = (0,
|
|
17754
|
+
const erc20TokenAddresses = (0, import_react59.useMemo)(() => {
|
|
17683
17755
|
if (!tokenBalances) return [];
|
|
17684
17756
|
return tokenBalances.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
17685
17757
|
}, [tokenBalances]);
|
|
@@ -17723,7 +17795,7 @@ function useBlockscoutAssets(options) {
|
|
|
17723
17795
|
gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
17724
17796
|
retry: 1
|
|
17725
17797
|
});
|
|
17726
|
-
const assets = (0,
|
|
17798
|
+
const assets = (0, import_react59.useMemo)(() => {
|
|
17727
17799
|
const result = [];
|
|
17728
17800
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
17729
17801
|
if (nativeBalanceData) {
|
|
@@ -17769,7 +17841,7 @@ function useBlockscoutAssets(options) {
|
|
|
17769
17841
|
}
|
|
17770
17842
|
return result;
|
|
17771
17843
|
}, [nativeBalanceData, tokenBalances, nftItems, erc3643Results, watchTokenAssets, chainConfig]);
|
|
17772
|
-
const nativeBalance = (0,
|
|
17844
|
+
const nativeBalance = (0, import_react59.useMemo)(() => {
|
|
17773
17845
|
if (!nativeBalanceData) return null;
|
|
17774
17846
|
return {
|
|
17775
17847
|
value: nativeBalanceData.value,
|
|
@@ -17777,11 +17849,11 @@ function useBlockscoutAssets(options) {
|
|
|
17777
17849
|
symbol: nativeBalanceData.symbol
|
|
17778
17850
|
};
|
|
17779
17851
|
}, [nativeBalanceData]);
|
|
17780
|
-
const error = (0,
|
|
17852
|
+
const error = (0, import_react59.useMemo)(() => {
|
|
17781
17853
|
if (!tokensError) return null;
|
|
17782
17854
|
return createError(tokensError);
|
|
17783
17855
|
}, [tokensError]);
|
|
17784
|
-
const refreshBalances = (0,
|
|
17856
|
+
const refreshBalances = (0, import_react59.useCallback)(async () => {
|
|
17785
17857
|
const now = Date.now();
|
|
17786
17858
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
17787
17859
|
return;
|
|
@@ -17789,7 +17861,7 @@ function useBlockscoutAssets(options) {
|
|
|
17789
17861
|
lastRefreshRef.current = now;
|
|
17790
17862
|
await Promise.all([refetchNative(), refetchTokens(), refetchNfts(), refetchWatchTokens()]);
|
|
17791
17863
|
}, [refetchNative, refetchTokens, refetchNfts, refetchWatchTokens]);
|
|
17792
|
-
const getTokenBalance = (0,
|
|
17864
|
+
const getTokenBalance = (0, import_react59.useCallback)(
|
|
17793
17865
|
(tokenAddress) => {
|
|
17794
17866
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
17795
17867
|
},
|
|
@@ -17807,13 +17879,13 @@ function useBlockscoutAssets(options) {
|
|
|
17807
17879
|
lastUpdated: dataUpdatedAt || null
|
|
17808
17880
|
};
|
|
17809
17881
|
}
|
|
17810
|
-
var import_clients2, import_react_query37,
|
|
17882
|
+
var import_clients2, import_react_query37, import_react59, import_viem7, BLOCKSCOUT_QUERY_KEY, ERC3643_DETECTION_QUERY_KEY, ERC3643_ABI;
|
|
17811
17883
|
var init_useBlockscoutAssets = __esm({
|
|
17812
17884
|
"src/internal/hooks/useBlockscoutAssets.ts"() {
|
|
17813
17885
|
init_ProviderContext();
|
|
17814
17886
|
import_clients2 = require("@embarkai/core/clients");
|
|
17815
17887
|
import_react_query37 = require("@tanstack/react-query");
|
|
17816
|
-
|
|
17888
|
+
import_react59 = require("react");
|
|
17817
17889
|
import_viem7 = require("viem");
|
|
17818
17890
|
init_initial();
|
|
17819
17891
|
init_constants();
|
|
@@ -17903,6 +17975,9 @@ function isSecurityToken(asset) {
|
|
|
17903
17975
|
if (!("type" in asset)) return false;
|
|
17904
17976
|
return asset.type === "erc3643";
|
|
17905
17977
|
}
|
|
17978
|
+
function isProjectAssetConfig(asset) {
|
|
17979
|
+
return "balanceQueryKey" in asset && "balanceQuery" in asset;
|
|
17980
|
+
}
|
|
17906
17981
|
function isAssetRateAvailable(symbol) {
|
|
17907
17982
|
switch (symbol) {
|
|
17908
17983
|
// list of prohibited symbols without market data on Binance
|
|
@@ -17986,11 +18061,17 @@ function PortfolioItemImage(props) {
|
|
|
17986
18061
|
function PortfolioItem(props) {
|
|
17987
18062
|
const { address, asset, isProjectAsset } = props;
|
|
17988
18063
|
const providerConfig = useProviderConfig().config.current;
|
|
17989
|
-
const { assets: projectAssets, showBalanceAs: showBalanceAsSymbol } = providerConfig.projectAssets || {};
|
|
17990
18064
|
const customAssetRateQuery = providerConfig.portfolio?.assetRateQuery;
|
|
17991
|
-
const
|
|
17992
|
-
|
|
17993
|
-
|
|
18065
|
+
const projectAssetQuery = isProjectAsset && isProjectAssetConfig(asset) ? {
|
|
18066
|
+
queryKey: asset.balanceQueryKey,
|
|
18067
|
+
queryFn: asset.balanceQuery
|
|
18068
|
+
} : void 0;
|
|
18069
|
+
const { data: projectAssetBalance } = (0, import_react_query38.useQuery)({
|
|
18070
|
+
enabled: !!projectAssetQuery,
|
|
18071
|
+
retry: false,
|
|
18072
|
+
queryKey: projectAssetQuery?.queryKey ?? ["project-asset-balance-disabled", asset.symbol],
|
|
18073
|
+
queryFn: async () => projectAssetQuery?.queryFn() ?? null
|
|
18074
|
+
});
|
|
17994
18075
|
const isNft = isNftAsset(asset);
|
|
17995
18076
|
const isSecurity = isSecurityToken(asset);
|
|
17996
18077
|
const embeddedRate = Number(asset.exchangeRateUsd || 0);
|
|
@@ -18003,8 +18084,8 @@ function PortfolioItem(props) {
|
|
|
18003
18084
|
// customAssetRateQueryKey
|
|
18004
18085
|
queryFn: async () => await resolveAssetRate(asset.symbol, asset.address, customAssetRateQuery)
|
|
18005
18086
|
});
|
|
18006
|
-
const
|
|
18007
|
-
const renderBalance =
|
|
18087
|
+
const hasProjectAssetBalance = isProjectAsset && projectAssetBalance != null;
|
|
18088
|
+
const renderBalance = hasProjectAssetBalance ? projectAssetBalance.cryptoFormatted : Number((0, import_viem9.formatUnits)(BigInt(asset?.balance || "0"), asset?.decimals || 18));
|
|
18008
18089
|
const resolvedRate = hasEmbeddedRate ? embeddedRate : Number(assetRate?.price || 0);
|
|
18009
18090
|
const usdRenderBalance = resolvedRate > 0 ? renderBalance * resolvedRate : 0;
|
|
18010
18091
|
const shortContractAddress = asset.address ? truncateMiddle(asset.address, 6, 4) : null;
|
|
@@ -18107,7 +18188,7 @@ function PortfolioMenu() {
|
|
|
18107
18188
|
enabled: !!address
|
|
18108
18189
|
});
|
|
18109
18190
|
const shownProjectAssests = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
18110
|
-
const refreshAllAssetsBalances = (0,
|
|
18191
|
+
const refreshAllAssetsBalances = (0, import_react60.useCallback)(() => {
|
|
18111
18192
|
Promise.all(shownProjectAssests.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
18112
18193
|
refreshBlockscoutBalances();
|
|
18113
18194
|
}, [qc, shownProjectAssests, refreshBlockscoutBalances]);
|
|
@@ -18157,7 +18238,7 @@ function PortfolioMenu() {
|
|
|
18157
18238
|
}
|
|
18158
18239
|
);
|
|
18159
18240
|
}
|
|
18160
|
-
var import_react_query39, import_lucide_react51,
|
|
18241
|
+
var import_react_query39, import_lucide_react51, import_react60, import_jsx_runtime84;
|
|
18161
18242
|
var init_PortfolioMenu = __esm({
|
|
18162
18243
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
18163
18244
|
init_ProviderContext();
|
|
@@ -18165,7 +18246,7 @@ var init_PortfolioMenu = __esm({
|
|
|
18165
18246
|
init_i18n();
|
|
18166
18247
|
import_react_query39 = require("@tanstack/react-query");
|
|
18167
18248
|
import_lucide_react51 = require("lucide-react");
|
|
18168
|
-
|
|
18249
|
+
import_react60 = require("react");
|
|
18169
18250
|
init_useBlockscoutAssets();
|
|
18170
18251
|
init_useLayoutDataStore();
|
|
18171
18252
|
init_useLayoutStore();
|
|
@@ -18274,10 +18355,10 @@ function ReceiveMenu() {
|
|
|
18274
18355
|
const { t } = useT();
|
|
18275
18356
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18276
18357
|
const open = page === "receive";
|
|
18277
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
18278
|
-
const [copied, setCopied] = (0,
|
|
18279
|
-
const [fingerprintCopied, setFingerprintCopied] = (0,
|
|
18280
|
-
const fingerprint = (0,
|
|
18358
|
+
const [qrCodeUrl, setQrCodeUrl] = (0, import_react61.useState)("");
|
|
18359
|
+
const [copied, setCopied] = (0, import_react61.useState)(false);
|
|
18360
|
+
const [fingerprintCopied, setFingerprintCopied] = (0, import_react61.useState)(false);
|
|
18361
|
+
const fingerprint = (0, import_react61.useMemo)(() => {
|
|
18281
18362
|
if (!session?.ownerAddress) return null;
|
|
18282
18363
|
try {
|
|
18283
18364
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -18285,7 +18366,7 @@ function ReceiveMenu() {
|
|
|
18285
18366
|
return null;
|
|
18286
18367
|
}
|
|
18287
18368
|
}, [session?.ownerAddress]);
|
|
18288
|
-
(0,
|
|
18369
|
+
(0, import_react61.useEffect)(() => {
|
|
18289
18370
|
if (open && address) {
|
|
18290
18371
|
import_qrcode.default.toDataURL(address, {
|
|
18291
18372
|
width: 200,
|
|
@@ -18298,7 +18379,7 @@ function ReceiveMenu() {
|
|
|
18298
18379
|
});
|
|
18299
18380
|
}
|
|
18300
18381
|
}, [open, address]);
|
|
18301
|
-
const handleCopy = (0,
|
|
18382
|
+
const handleCopy = (0, import_react61.useCallback)(async () => {
|
|
18302
18383
|
if (!address) return;
|
|
18303
18384
|
try {
|
|
18304
18385
|
await navigator.clipboard.writeText(address);
|
|
@@ -18308,7 +18389,7 @@ function ReceiveMenu() {
|
|
|
18308
18389
|
console.error("Failed to copy address:", error);
|
|
18309
18390
|
}
|
|
18310
18391
|
}, [address]);
|
|
18311
|
-
const handleCopyFingerprint = (0,
|
|
18392
|
+
const handleCopyFingerprint = (0, import_react61.useCallback)(async () => {
|
|
18312
18393
|
if (!fingerprint) return;
|
|
18313
18394
|
try {
|
|
18314
18395
|
await navigator.clipboard.writeText(fingerprint);
|
|
@@ -18369,14 +18450,14 @@ function ReceiveMenu() {
|
|
|
18369
18450
|
}
|
|
18370
18451
|
);
|
|
18371
18452
|
}
|
|
18372
|
-
var import_lucide_react52, import_qrcode,
|
|
18453
|
+
var import_lucide_react52, import_qrcode, import_react61, import_jsx_runtime85;
|
|
18373
18454
|
var init_ReceiveMenu = __esm({
|
|
18374
18455
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
18375
18456
|
init_SessionContext();
|
|
18376
18457
|
init_i18n();
|
|
18377
18458
|
import_lucide_react52 = require("lucide-react");
|
|
18378
18459
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
18379
|
-
|
|
18460
|
+
import_react61 = require("react");
|
|
18380
18461
|
init_useLayoutDataStore();
|
|
18381
18462
|
init_useLayoutStore();
|
|
18382
18463
|
init_nickname_fingerprint();
|
|
@@ -18826,7 +18907,7 @@ function SecurityMenu() {
|
|
|
18826
18907
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
18827
18908
|
const userId = import_auth23.jwtTokenManager.getUserId();
|
|
18828
18909
|
const serverHasKeyshare = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
|
|
18829
|
-
const [appToUntrust, untrustApp] = (0,
|
|
18910
|
+
const [appToUntrust, untrustApp] = (0, import_react62.useState)(null);
|
|
18830
18911
|
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
18831
18912
|
const localInfo = recoveryData?.keyshareInfo || {};
|
|
18832
18913
|
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
@@ -18902,13 +18983,13 @@ function SecurityMenu() {
|
|
|
18902
18983
|
}
|
|
18903
18984
|
);
|
|
18904
18985
|
}
|
|
18905
|
-
var import_react_query41, import_lucide_react58,
|
|
18986
|
+
var import_react_query41, import_lucide_react58, import_react62, import_jsx_runtime91;
|
|
18906
18987
|
var init_SecurityMenu = __esm({
|
|
18907
18988
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
18908
18989
|
init_i18n();
|
|
18909
18990
|
import_react_query41 = require("@tanstack/react-query");
|
|
18910
18991
|
import_lucide_react58 = require("lucide-react");
|
|
18911
|
-
|
|
18992
|
+
import_react62 = require("react");
|
|
18912
18993
|
init_auth();
|
|
18913
18994
|
init_useLayoutDataStore();
|
|
18914
18995
|
init_useLayoutStore();
|
|
@@ -19173,12 +19254,12 @@ function SenderSelector(props) {
|
|
|
19173
19254
|
const { openConnectModal } = (0, import_rainbowkit.useConnectModal)();
|
|
19174
19255
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19175
19256
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
19176
|
-
const pendingWalletRef = (0,
|
|
19257
|
+
const pendingWalletRef = (0, import_react63.useRef)(null);
|
|
19177
19258
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
19178
19259
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
19179
19260
|
const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
|
|
19180
|
-
const [walletMessage, setWalletMessage] = (0,
|
|
19181
|
-
(0,
|
|
19261
|
+
const [walletMessage, setWalletMessage] = (0, import_react63.useState)(null);
|
|
19262
|
+
(0, import_react63.useEffect)(() => {
|
|
19182
19263
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19183
19264
|
}, [walletMessage]);
|
|
19184
19265
|
const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = (0, import_react_query42.useMutation)({
|
|
@@ -19234,7 +19315,7 @@ function SenderSelector(props) {
|
|
|
19234
19315
|
setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
|
|
19235
19316
|
}
|
|
19236
19317
|
});
|
|
19237
|
-
(0,
|
|
19318
|
+
(0, import_react63.useEffect)(() => {
|
|
19238
19319
|
const pendingProfile = pendingWalletRef.current;
|
|
19239
19320
|
if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
|
|
19240
19321
|
if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
|
|
@@ -19309,14 +19390,14 @@ function SenderSelector(props) {
|
|
|
19309
19390
|
] })
|
|
19310
19391
|
] });
|
|
19311
19392
|
}
|
|
19312
|
-
var import_rainbowkit, import_react_query42,
|
|
19393
|
+
var import_rainbowkit, import_react_query42, import_react63, import_wagmi3, import_jsx_runtime92;
|
|
19313
19394
|
var init_SenderSelector = __esm({
|
|
19314
19395
|
"src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx"() {
|
|
19315
19396
|
init_ProviderContext();
|
|
19316
19397
|
init_i18n();
|
|
19317
19398
|
import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
19318
19399
|
import_react_query42 = require("@tanstack/react-query");
|
|
19319
|
-
|
|
19400
|
+
import_react63 = require("react");
|
|
19320
19401
|
import_wagmi3 = require("wagmi");
|
|
19321
19402
|
init_wallet();
|
|
19322
19403
|
init_useLayoutDataStore();
|
|
@@ -19416,8 +19497,8 @@ var init_wallets = __esm({
|
|
|
19416
19497
|
function useAvailableSenders() {
|
|
19417
19498
|
const address = useSession((st) => st.address);
|
|
19418
19499
|
const { profiles } = useLinkedProfiles();
|
|
19419
|
-
const lastCalcedSenders = (0,
|
|
19420
|
-
(0,
|
|
19500
|
+
const lastCalcedSenders = (0, import_react64.useRef)([]);
|
|
19501
|
+
(0, import_react64.useEffect)(() => {
|
|
19421
19502
|
const sendersAccumulator = [
|
|
19422
19503
|
{
|
|
19423
19504
|
type: "embarkai-wallet",
|
|
@@ -19448,13 +19529,13 @@ function useAvailableSenders() {
|
|
|
19448
19529
|
directWalletProfile: profiles.filter((p) => p.provider === "wallet")[0] || null
|
|
19449
19530
|
};
|
|
19450
19531
|
}
|
|
19451
|
-
var
|
|
19532
|
+
var import_react64;
|
|
19452
19533
|
var init_useAvailableSenders = __esm({
|
|
19453
19534
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
19454
19535
|
init_SessionContext();
|
|
19455
19536
|
init_tokens();
|
|
19456
19537
|
init_linkedProfiles();
|
|
19457
|
-
|
|
19538
|
+
import_react64 = require("react");
|
|
19458
19539
|
init_wallets();
|
|
19459
19540
|
init_useFlowSelector();
|
|
19460
19541
|
init_useBridgeStore();
|
|
@@ -19797,29 +19878,29 @@ function useHyperlaneHistory() {
|
|
|
19797
19878
|
queryFn: async ({ pageParam }) => await getHyperlaneBridgeHistory({ page: pageParam, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
19798
19879
|
});
|
|
19799
19880
|
const { data: txHistoryData, isLoading: isBridgeTxHistoryLoading } = query;
|
|
19800
|
-
const txList = (0,
|
|
19881
|
+
const txList = (0, import_react65.useMemo)(
|
|
19801
19882
|
() => txHistoryData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
19802
19883
|
[txHistoryData]
|
|
19803
19884
|
);
|
|
19804
|
-
const updateExpandable = (0,
|
|
19885
|
+
const updateExpandable = (0, import_react65.useCallback)(
|
|
19805
19886
|
(0, import_lodash_es9.debounce)(() => {
|
|
19806
19887
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
|
|
19807
19888
|
}, 250),
|
|
19808
19889
|
[]
|
|
19809
19890
|
);
|
|
19810
|
-
(0,
|
|
19891
|
+
(0, import_react65.useEffect)(() => {
|
|
19811
19892
|
if (isBridgeTxHistoryLoading || txList.length === 0) return;
|
|
19812
19893
|
updateExpandable();
|
|
19813
19894
|
}, [isBridgeTxHistoryLoading, txList]);
|
|
19814
19895
|
return { query, txList };
|
|
19815
19896
|
}
|
|
19816
|
-
var import_react_query43, import_lodash_es9,
|
|
19897
|
+
var import_react_query43, import_lodash_es9, import_react65, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
19817
19898
|
var init_useHyperlaneHistory = __esm({
|
|
19818
19899
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
19819
19900
|
init_SessionContext();
|
|
19820
19901
|
import_react_query43 = require("@tanstack/react-query");
|
|
19821
19902
|
import_lodash_es9 = require("lodash-es");
|
|
19822
|
-
|
|
19903
|
+
import_react65 = require("react");
|
|
19823
19904
|
init_useLayoutDataStore();
|
|
19824
19905
|
init_useFlowSelector();
|
|
19825
19906
|
init_api3();
|
|
@@ -19851,7 +19932,7 @@ function useBridge() {
|
|
|
19851
19932
|
const address = useSession((st) => st.address);
|
|
19852
19933
|
const { data: walletClient } = (0, import_wagmi4.useWalletClient)();
|
|
19853
19934
|
const { switchChainAsync } = (0, import_wagmi4.useSwitchChain)();
|
|
19854
|
-
const swapDirection = (0,
|
|
19935
|
+
const swapDirection = (0, import_react66.useCallback)(() => {
|
|
19855
19936
|
const {
|
|
19856
19937
|
bridgeStep,
|
|
19857
19938
|
originChain,
|
|
@@ -19903,7 +19984,7 @@ function useBridge() {
|
|
|
19903
19984
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
19904
19985
|
}
|
|
19905
19986
|
});
|
|
19906
|
-
const handleQuoteEstimation = (0,
|
|
19987
|
+
const handleQuoteEstimation = (0, import_react66.useCallback)((amnt) => {
|
|
19907
19988
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
19908
19989
|
if (!amnt || !Number(amnt)) {
|
|
19909
19990
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -20028,14 +20109,14 @@ function useBridge() {
|
|
|
20028
20109
|
isAssetBridging
|
|
20029
20110
|
};
|
|
20030
20111
|
}
|
|
20031
|
-
var import_react_query44,
|
|
20112
|
+
var import_react_query44, import_react66, import_wagmi4;
|
|
20032
20113
|
var init_useBridge = __esm({
|
|
20033
20114
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
20034
20115
|
init_SessionContext();
|
|
20035
20116
|
init_i18n();
|
|
20036
20117
|
init_useExternalWalletStore();
|
|
20037
20118
|
import_react_query44 = require("@tanstack/react-query");
|
|
20038
|
-
|
|
20119
|
+
import_react66 = require("react");
|
|
20039
20120
|
import_wagmi4 = require("wagmi");
|
|
20040
20121
|
init_useLayoutStore();
|
|
20041
20122
|
init_useFlowSelector();
|
|
@@ -20069,7 +20150,7 @@ function useHyperlaneRoutes() {
|
|
|
20069
20150
|
return warpRoutes;
|
|
20070
20151
|
}
|
|
20071
20152
|
});
|
|
20072
|
-
(0,
|
|
20153
|
+
(0, import_react67.useEffect)(() => {
|
|
20073
20154
|
if (!errorWarpRoutes) return;
|
|
20074
20155
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
20075
20156
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -20078,7 +20159,7 @@ function useHyperlaneRoutes() {
|
|
|
20078
20159
|
setOriginChain(null);
|
|
20079
20160
|
setDestinationChain(null);
|
|
20080
20161
|
}, [errorWarpRoutes]);
|
|
20081
|
-
(0,
|
|
20162
|
+
(0, import_react67.useEffect)(() => {
|
|
20082
20163
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
20083
20164
|
const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
20084
20165
|
if (!warpRouteToAutoSelect) return;
|
|
@@ -20097,12 +20178,12 @@ function useHyperlaneRoutes() {
|
|
|
20097
20178
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
20098
20179
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
20099
20180
|
}
|
|
20100
|
-
var import_react_query45,
|
|
20181
|
+
var import_react_query45, import_react67, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
20101
20182
|
var init_useHyperlaneRoutes = __esm({
|
|
20102
20183
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
20103
20184
|
init_SessionContext();
|
|
20104
20185
|
import_react_query45 = require("@tanstack/react-query");
|
|
20105
|
-
|
|
20186
|
+
import_react67 = require("react");
|
|
20106
20187
|
init_useLayoutDataStore();
|
|
20107
20188
|
init_useFlowSelector();
|
|
20108
20189
|
init_api3();
|
|
@@ -20118,7 +20199,7 @@ function useMenuTitle(warpRoutes) {
|
|
|
20118
20199
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20119
20200
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20120
20201
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
20121
|
-
(0,
|
|
20202
|
+
(0, import_react68.useEffect)(() => {
|
|
20122
20203
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
20123
20204
|
switch (true) {
|
|
20124
20205
|
case bridgeStep === "sender-selector":
|
|
@@ -20146,11 +20227,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
20146
20227
|
}
|
|
20147
20228
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
20148
20229
|
}
|
|
20149
|
-
var
|
|
20230
|
+
var import_react68;
|
|
20150
20231
|
var init_useMenuTitle = __esm({
|
|
20151
20232
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
20152
20233
|
init_i18n();
|
|
20153
|
-
|
|
20234
|
+
import_react68 = require("react");
|
|
20154
20235
|
init_useFlowSelector();
|
|
20155
20236
|
init_useBridgeStore();
|
|
20156
20237
|
}
|
|
@@ -20263,7 +20344,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20263
20344
|
};
|
|
20264
20345
|
}
|
|
20265
20346
|
});
|
|
20266
|
-
const refreshRouteTokenBalance = (0,
|
|
20347
|
+
const refreshRouteTokenBalance = (0, import_react69.useCallback)(
|
|
20267
20348
|
(senderWallet) => {
|
|
20268
20349
|
switch (true) {
|
|
20269
20350
|
case senderWallet === "embarkai-wallet":
|
|
@@ -20279,7 +20360,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20279
20360
|
},
|
|
20280
20361
|
[refreshBalances, qc]
|
|
20281
20362
|
);
|
|
20282
|
-
(0,
|
|
20363
|
+
(0, import_react69.useEffect)(() => {
|
|
20283
20364
|
if (!bridgeSender || !originChain) return;
|
|
20284
20365
|
switch (bridgeSender) {
|
|
20285
20366
|
case "embarkai-wallet":
|
|
@@ -20310,7 +20391,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20310
20391
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
20311
20392
|
};
|
|
20312
20393
|
}
|
|
20313
|
-
var import_core6, import_react_query46,
|
|
20394
|
+
var import_core6, import_react_query46, import_react69, import_viem13, import_wagmi5, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
|
|
20314
20395
|
var init_useBridgeBalance = __esm({
|
|
20315
20396
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
20316
20397
|
init_constants();
|
|
@@ -20318,7 +20399,7 @@ var init_useBridgeBalance = __esm({
|
|
|
20318
20399
|
init_i18n();
|
|
20319
20400
|
import_core6 = require("@embarkai/core");
|
|
20320
20401
|
import_react_query46 = require("@tanstack/react-query");
|
|
20321
|
-
|
|
20402
|
+
import_react69 = require("react");
|
|
20322
20403
|
import_viem13 = require("viem");
|
|
20323
20404
|
import_wagmi5 = require("wagmi");
|
|
20324
20405
|
init_useBlockscoutAssets();
|
|
@@ -20436,7 +20517,7 @@ function SelectStep(props) {
|
|
|
20436
20517
|
variant: "outline",
|
|
20437
20518
|
size: "medium",
|
|
20438
20519
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
20439
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
20520
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_react70.Fragment, { children: [
|
|
20440
20521
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_lucide_react60.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
20441
20522
|
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
20442
20523
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -20571,13 +20652,13 @@ function SelectStep(props) {
|
|
|
20571
20652
|
)
|
|
20572
20653
|
] });
|
|
20573
20654
|
}
|
|
20574
|
-
var import_lucide_react60,
|
|
20655
|
+
var import_lucide_react60, import_react70, import_jsx_runtime96;
|
|
20575
20656
|
var init_SelectStep = __esm({
|
|
20576
20657
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
20577
20658
|
init_tokens();
|
|
20578
20659
|
init_i18n();
|
|
20579
20660
|
import_lucide_react60 = require("lucide-react");
|
|
20580
|
-
|
|
20661
|
+
import_react70 = require("react");
|
|
20581
20662
|
init_priceFormatter();
|
|
20582
20663
|
init_utils2();
|
|
20583
20664
|
init_badge();
|
|
@@ -20626,7 +20707,7 @@ var init_checkbox = __esm({
|
|
|
20626
20707
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
20627
20708
|
function ConfirmStep(props) {
|
|
20628
20709
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
20629
|
-
const [userConsent, setUserConsent] = (0,
|
|
20710
|
+
const [userConsent, setUserConsent] = (0, import_react71.useState)(false);
|
|
20630
20711
|
const { t } = useT();
|
|
20631
20712
|
const address = useSession((st) => st.address);
|
|
20632
20713
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -20735,13 +20816,13 @@ function ConfirmStep(props) {
|
|
|
20735
20816
|
)
|
|
20736
20817
|
] });
|
|
20737
20818
|
}
|
|
20738
|
-
var import_lucide_react62,
|
|
20819
|
+
var import_lucide_react62, import_react71, import_jsx_runtime98, P_CN;
|
|
20739
20820
|
var init_ConfirmStep = __esm({
|
|
20740
20821
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
20741
20822
|
init_SessionContext();
|
|
20742
20823
|
init_i18n();
|
|
20743
20824
|
import_lucide_react62 = require("lucide-react");
|
|
20744
|
-
|
|
20825
|
+
import_react71 = require("react");
|
|
20745
20826
|
init_priceFormatter();
|
|
20746
20827
|
init_utils2();
|
|
20747
20828
|
init_button();
|
|
@@ -21116,9 +21197,9 @@ var init_HistoryStep = __esm({
|
|
|
21116
21197
|
function SelectAssetRoute(props) {
|
|
21117
21198
|
const { hyperlaneWarpRoutes } = props;
|
|
21118
21199
|
const { t } = useT();
|
|
21119
|
-
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0,
|
|
21200
|
+
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0, import_react72.useState)(false);
|
|
21120
21201
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
21121
|
-
const tokenList = (0,
|
|
21202
|
+
const tokenList = (0, import_react72.useMemo)(() => {
|
|
21122
21203
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
21123
21204
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
21124
21205
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -21215,13 +21296,13 @@ function SelectAssetRoute(props) {
|
|
|
21215
21296
|
] })
|
|
21216
21297
|
] });
|
|
21217
21298
|
}
|
|
21218
|
-
var import_lucide_react64,
|
|
21299
|
+
var import_lucide_react64, import_react72, import_jsx_runtime101;
|
|
21219
21300
|
var init_SelectAssetRoute = __esm({
|
|
21220
21301
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
21221
21302
|
init_tokens();
|
|
21222
21303
|
init_i18n();
|
|
21223
21304
|
import_lucide_react64 = require("lucide-react");
|
|
21224
|
-
|
|
21305
|
+
import_react72 = require("react");
|
|
21225
21306
|
init_button();
|
|
21226
21307
|
init_useFlowSelector();
|
|
21227
21308
|
init_ResolveChainIcon();
|
|
@@ -21249,7 +21330,7 @@ function HyperlaneBridge() {
|
|
|
21249
21330
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21250
21331
|
const { directWalletProfile } = useAvailableSenders();
|
|
21251
21332
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21252
|
-
(0,
|
|
21333
|
+
(0, import_react73.useEffect)(() => {
|
|
21253
21334
|
return () => {
|
|
21254
21335
|
useBridgeStore.getState().resetSelections();
|
|
21255
21336
|
};
|
|
@@ -21282,10 +21363,10 @@ function HyperlaneBridge() {
|
|
|
21282
21363
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(HistoryDetailsStep, {})
|
|
21283
21364
|
] });
|
|
21284
21365
|
}
|
|
21285
|
-
var
|
|
21366
|
+
var import_react73, import_jsx_runtime102;
|
|
21286
21367
|
var init_HyperlaneBridge = __esm({
|
|
21287
21368
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
21288
|
-
|
|
21369
|
+
import_react73 = require("react");
|
|
21289
21370
|
init_SenderSelector();
|
|
21290
21371
|
init_useAvailableSenders();
|
|
21291
21372
|
init_useBridge();
|
|
@@ -21303,7 +21384,7 @@ function BridgeHistorySwitch(props) {
|
|
|
21303
21384
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
21304
21385
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
21305
21386
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21306
|
-
const lastBridgeStepRef = (0,
|
|
21387
|
+
const lastBridgeStepRef = (0, import_react74.useRef)(null);
|
|
21307
21388
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
21308
21389
|
return null;
|
|
21309
21390
|
}
|
|
@@ -21322,10 +21403,10 @@ function BridgeHistorySwitch(props) {
|
|
|
21322
21403
|
}
|
|
21323
21404
|
);
|
|
21324
21405
|
}
|
|
21325
|
-
var
|
|
21406
|
+
var import_react74, import_jsx_runtime103;
|
|
21326
21407
|
var init_HistorySwitch = __esm({
|
|
21327
21408
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
21328
|
-
|
|
21409
|
+
import_react74 = require("react");
|
|
21329
21410
|
init_switch();
|
|
21330
21411
|
init_useFlowSelector();
|
|
21331
21412
|
init_useBridgeStore();
|
|
@@ -21416,11 +21497,11 @@ function looksLikeNickname(input) {
|
|
|
21416
21497
|
}
|
|
21417
21498
|
function useNicknameResolve(input, options) {
|
|
21418
21499
|
const { enabled = true, chainId } = options;
|
|
21419
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
21420
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
21500
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react75.useState)("");
|
|
21501
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react75.useState)(false);
|
|
21421
21502
|
const normalized = normalizeNickname(input);
|
|
21422
21503
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
21423
|
-
(0,
|
|
21504
|
+
(0, import_react75.useEffect)(() => {
|
|
21424
21505
|
if (!isNicknameInput || !enabled) {
|
|
21425
21506
|
setDebouncedInput("");
|
|
21426
21507
|
setIsDebouncing(false);
|
|
@@ -21446,7 +21527,7 @@ function useNicknameResolve(input, options) {
|
|
|
21446
21527
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
21447
21528
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
21448
21529
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
21449
|
-
const fingerprintVerification = (0,
|
|
21530
|
+
const fingerprintVerification = (0, import_react75.useMemo)(() => {
|
|
21450
21531
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
21451
21532
|
return null;
|
|
21452
21533
|
}
|
|
@@ -21468,11 +21549,11 @@ function useNicknameResolve(input, options) {
|
|
|
21468
21549
|
resolvedAddress
|
|
21469
21550
|
};
|
|
21470
21551
|
}
|
|
21471
|
-
var import_react_query48,
|
|
21552
|
+
var import_react_query48, import_react75, DEBOUNCE_MS2;
|
|
21472
21553
|
var init_useNicknameResolve = __esm({
|
|
21473
21554
|
"src/hooks/useNicknameResolve.ts"() {
|
|
21474
21555
|
import_react_query48 = require("@tanstack/react-query");
|
|
21475
|
-
|
|
21556
|
+
import_react75 = require("react");
|
|
21476
21557
|
init_nickname();
|
|
21477
21558
|
init_profile();
|
|
21478
21559
|
init_nickname_fingerprint();
|
|
@@ -21485,10 +21566,10 @@ var init_useNicknameResolve = __esm({
|
|
|
21485
21566
|
function useSendTransaction() {
|
|
21486
21567
|
const session = useSession((st) => st.session);
|
|
21487
21568
|
const address = useSession((st) => st.address);
|
|
21488
|
-
const [isLoading, setIsLoading] = (0,
|
|
21489
|
-
const [error, setError] = (0,
|
|
21490
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
21491
|
-
const sendTransaction = (0,
|
|
21569
|
+
const [isLoading, setIsLoading] = (0, import_react76.useState)(false);
|
|
21570
|
+
const [error, setError] = (0, import_react76.useState)(null);
|
|
21571
|
+
const [userOpHash, setUserOpHash] = (0, import_react76.useState)(null);
|
|
21572
|
+
const sendTransaction = (0, import_react76.useCallback)(
|
|
21492
21573
|
async (params) => {
|
|
21493
21574
|
if (!session || !address) {
|
|
21494
21575
|
setError("No active session");
|
|
@@ -21585,7 +21666,7 @@ function useSendTransaction() {
|
|
|
21585
21666
|
},
|
|
21586
21667
|
[session, address]
|
|
21587
21668
|
);
|
|
21588
|
-
const reset = (0,
|
|
21669
|
+
const reset = (0, import_react76.useCallback)(() => {
|
|
21589
21670
|
setError(null);
|
|
21590
21671
|
setUserOpHash(null);
|
|
21591
21672
|
setIsLoading(false);
|
|
@@ -21598,10 +21679,10 @@ function useSendTransaction() {
|
|
|
21598
21679
|
reset
|
|
21599
21680
|
};
|
|
21600
21681
|
}
|
|
21601
|
-
var
|
|
21682
|
+
var import_react76, import_viem14, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
21602
21683
|
var init_useSendTransaction = __esm({
|
|
21603
21684
|
"src/hooks/useSendTransaction.ts"() {
|
|
21604
|
-
|
|
21685
|
+
import_react76 = require("react");
|
|
21605
21686
|
import_viem14 = require("viem");
|
|
21606
21687
|
init_SessionContext();
|
|
21607
21688
|
init_account2();
|
|
@@ -21744,7 +21825,7 @@ var init_AssetInputIcon = __esm({
|
|
|
21744
21825
|
|
|
21745
21826
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
21746
21827
|
function NftDisplayCard({ asset }) {
|
|
21747
|
-
const [imageError, setImageError] = (0,
|
|
21828
|
+
const [imageError, setImageError] = (0, import_react77.useState)(false);
|
|
21748
21829
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
21749
21830
|
return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
21750
21831
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
@@ -21772,11 +21853,11 @@ function NftDisplayCard({ asset }) {
|
|
|
21772
21853
|
] })
|
|
21773
21854
|
] });
|
|
21774
21855
|
}
|
|
21775
|
-
var import_lucide_react66,
|
|
21856
|
+
var import_lucide_react66, import_react77, import_jsx_runtime105;
|
|
21776
21857
|
var init_NftDisplayCard = __esm({
|
|
21777
21858
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
21778
21859
|
import_lucide_react66 = require("lucide-react");
|
|
21779
|
-
|
|
21860
|
+
import_react77 = require("react");
|
|
21780
21861
|
import_jsx_runtime105 = require("react/jsx-runtime");
|
|
21781
21862
|
}
|
|
21782
21863
|
});
|
|
@@ -21935,11 +22016,11 @@ function NicknameData(props) {
|
|
|
21935
22016
|
isWalletNotSetup,
|
|
21936
22017
|
isFrozen
|
|
21937
22018
|
} = resolvedNicknameData;
|
|
21938
|
-
(0,
|
|
22019
|
+
(0, import_react78.useEffect)(() => {
|
|
21939
22020
|
if (!resolvedNicknameData?.data?.fingerprint || !isNicknameInput) return;
|
|
21940
22021
|
useFlowSelectorStore.getState().setRenderKey(`nickname-resolved-${Date.now()}`);
|
|
21941
22022
|
}, [resolvedNicknameData, isNicknameInput]);
|
|
21942
|
-
(0,
|
|
22023
|
+
(0, import_react78.useEffect)(() => {
|
|
21943
22024
|
if (isResolving) return;
|
|
21944
22025
|
let errMessage = null;
|
|
21945
22026
|
switch (true) {
|
|
@@ -21994,11 +22075,11 @@ function NicknameData(props) {
|
|
|
21994
22075
|
] })
|
|
21995
22076
|
] });
|
|
21996
22077
|
}
|
|
21997
|
-
var import_lucide_react67,
|
|
22078
|
+
var import_lucide_react67, import_react78, import_jsx_runtime107;
|
|
21998
22079
|
var init_NicknameData = __esm({
|
|
21999
22080
|
"src/internal/components/SendMenu/send/components/NicknameData.tsx"() {
|
|
22000
22081
|
import_lucide_react67 = require("lucide-react");
|
|
22001
|
-
|
|
22082
|
+
import_react78 = require("react");
|
|
22002
22083
|
init_no_image();
|
|
22003
22084
|
init_utils2();
|
|
22004
22085
|
init_useFlowSelector();
|
|
@@ -22444,10 +22525,10 @@ function SendMenu() {
|
|
|
22444
22525
|
userOpHash,
|
|
22445
22526
|
reset
|
|
22446
22527
|
} = useSendTransaction();
|
|
22447
|
-
(0,
|
|
22528
|
+
(0, import_react79.useEffect)(() => {
|
|
22448
22529
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
22449
22530
|
}, [isAssetsLoading, isTransactionPending]);
|
|
22450
|
-
(0,
|
|
22531
|
+
(0, import_react79.useEffect)(() => {
|
|
22451
22532
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
22452
22533
|
}, [sendTransactionError]);
|
|
22453
22534
|
const {
|
|
@@ -22462,7 +22543,7 @@ function SendMenu() {
|
|
|
22462
22543
|
} = useSendStore();
|
|
22463
22544
|
const isNft = isNftAsset3(selectedAsset);
|
|
22464
22545
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22465
|
-
(0,
|
|
22546
|
+
(0, import_react79.useEffect)(
|
|
22466
22547
|
() => () => {
|
|
22467
22548
|
setSelectedAsset(null);
|
|
22468
22549
|
setRecipient("");
|
|
@@ -22472,7 +22553,7 @@ function SendMenu() {
|
|
|
22472
22553
|
},
|
|
22473
22554
|
[]
|
|
22474
22555
|
);
|
|
22475
|
-
(0,
|
|
22556
|
+
(0, import_react79.useEffect)(() => {
|
|
22476
22557
|
const shouldNativeDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
22477
22558
|
if (!shouldNativeDefaultAsset) return;
|
|
22478
22559
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -22485,7 +22566,7 @@ function SendMenu() {
|
|
|
22485
22566
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
22486
22567
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
22487
22568
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
22488
|
-
const complianceAmount = (0,
|
|
22569
|
+
const complianceAmount = (0, import_react79.useMemo)(() => {
|
|
22489
22570
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
22490
22571
|
try {
|
|
22491
22572
|
return (0, import_viem18.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -22500,7 +22581,7 @@ function SendMenu() {
|
|
|
22500
22581
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
22501
22582
|
chainId: activeChainId
|
|
22502
22583
|
});
|
|
22503
|
-
(0,
|
|
22584
|
+
(0, import_react79.useEffect)(() => {
|
|
22504
22585
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
22505
22586
|
switch (true) {
|
|
22506
22587
|
case txStep === "select-asset":
|
|
@@ -22562,7 +22643,7 @@ function SendMenu() {
|
|
|
22562
22643
|
] })
|
|
22563
22644
|
] });
|
|
22564
22645
|
}
|
|
22565
|
-
var import_lucide_react70,
|
|
22646
|
+
var import_lucide_react70, import_react79, import_viem18, import_jsx_runtime110;
|
|
22566
22647
|
var init_SendMenu = __esm({
|
|
22567
22648
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
22568
22649
|
init_SessionContext();
|
|
@@ -22571,7 +22652,7 @@ var init_SendMenu = __esm({
|
|
|
22571
22652
|
init_useSendTransaction();
|
|
22572
22653
|
init_useT();
|
|
22573
22654
|
import_lucide_react70 = require("lucide-react");
|
|
22574
|
-
|
|
22655
|
+
import_react79 = require("react");
|
|
22575
22656
|
import_viem18 = require("viem");
|
|
22576
22657
|
init_useBlockscoutAssets();
|
|
22577
22658
|
init_useLayoutDataStore();
|
|
@@ -22656,7 +22737,7 @@ function SendFlowSelector() {
|
|
|
22656
22737
|
const error = useFlowSelectorStore((st) => st.error);
|
|
22657
22738
|
const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
|
|
22658
22739
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
22659
|
-
(0,
|
|
22740
|
+
(0, import_react80.useEffect)(
|
|
22660
22741
|
() => () => {
|
|
22661
22742
|
useFlowSelectorStore.getState().setError(null);
|
|
22662
22743
|
},
|
|
@@ -22733,12 +22814,12 @@ function SendFlowSelector() {
|
|
|
22733
22814
|
}
|
|
22734
22815
|
);
|
|
22735
22816
|
}
|
|
22736
|
-
var import_lucide_react71,
|
|
22817
|
+
var import_lucide_react71, import_react80, import_jsx_runtime111, SELECTOR_FLOW;
|
|
22737
22818
|
var init_SendFlowSelector = __esm({
|
|
22738
22819
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
22739
22820
|
init_i18n();
|
|
22740
22821
|
import_lucide_react71 = require("lucide-react");
|
|
22741
|
-
|
|
22822
|
+
import_react80 = require("react");
|
|
22742
22823
|
init_useLayoutDataStore();
|
|
22743
22824
|
init_useLayoutStore();
|
|
22744
22825
|
init_utils2();
|
|
@@ -22793,12 +22874,12 @@ function getServerSnapshot() {
|
|
|
22793
22874
|
return false;
|
|
22794
22875
|
}
|
|
22795
22876
|
function useProMode() {
|
|
22796
|
-
return (0,
|
|
22877
|
+
return (0, import_react81.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
22797
22878
|
}
|
|
22798
|
-
var
|
|
22879
|
+
var import_react81, STORAGE_KEY, EVENT_NAME;
|
|
22799
22880
|
var init_pro_mode = __esm({
|
|
22800
22881
|
"src/internal/lib/pro-mode.ts"() {
|
|
22801
|
-
|
|
22882
|
+
import_react81 = require("react");
|
|
22802
22883
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
22803
22884
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
22804
22885
|
}
|
|
@@ -22840,7 +22921,7 @@ function useSettingsButtons() {
|
|
|
22840
22921
|
if (proMode) {
|
|
22841
22922
|
settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: import_lucide_react73.HardDrive });
|
|
22842
22923
|
}
|
|
22843
|
-
(0,
|
|
22924
|
+
(0, import_react82.useEffect)(() => {
|
|
22844
22925
|
const cssvEl = document.querySelector(".embarkai-ui-scope");
|
|
22845
22926
|
if (!cssvEl || !window?.getComputedStyle) {
|
|
22846
22927
|
return;
|
|
@@ -22904,7 +22985,7 @@ function SettingsMenu() {
|
|
|
22904
22985
|
}
|
|
22905
22986
|
);
|
|
22906
22987
|
}
|
|
22907
|
-
var import_react_query50, import_lucide_react73,
|
|
22988
|
+
var import_react_query50, import_lucide_react73, import_react82, import_jsx_runtime112;
|
|
22908
22989
|
var init_SettingsMenu = __esm({
|
|
22909
22990
|
"src/internal/components/SettingsMenu/SettingsMenu.tsx"() {
|
|
22910
22991
|
init_ProviderContext();
|
|
@@ -22912,7 +22993,7 @@ var init_SettingsMenu = __esm({
|
|
|
22912
22993
|
init_i18n();
|
|
22913
22994
|
import_react_query50 = require("@tanstack/react-query");
|
|
22914
22995
|
import_lucide_react73 = require("lucide-react");
|
|
22915
|
-
|
|
22996
|
+
import_react82 = require("react");
|
|
22916
22997
|
init_nickname();
|
|
22917
22998
|
init_profile();
|
|
22918
22999
|
init_useLayoutDataStore();
|
|
@@ -23784,7 +23865,7 @@ function TransactionsMenu() {
|
|
|
23784
23865
|
const { t } = useT();
|
|
23785
23866
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
23786
23867
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
23787
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
23868
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react83.useState)({});
|
|
23788
23869
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
23789
23870
|
const {
|
|
23790
23871
|
data: txHistoryGroups = [],
|
|
@@ -23797,7 +23878,7 @@ function TransactionsMenu() {
|
|
|
23797
23878
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
23798
23879
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
23799
23880
|
});
|
|
23800
|
-
const refreshTxHistory = (0,
|
|
23881
|
+
const refreshTxHistory = (0, import_react83.useCallback)(
|
|
23801
23882
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
23802
23883
|
[qc, chainConfig.id, address]
|
|
23803
23884
|
);
|
|
@@ -23846,14 +23927,14 @@ function TransactionsMenu() {
|
|
|
23846
23927
|
}
|
|
23847
23928
|
);
|
|
23848
23929
|
}
|
|
23849
|
-
var import_react_query51, import_lucide_react76,
|
|
23930
|
+
var import_react_query51, import_lucide_react76, import_react83, import_jsx_runtime115;
|
|
23850
23931
|
var init_TransactionsMenu = __esm({
|
|
23851
23932
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
23852
23933
|
init_SessionContext();
|
|
23853
23934
|
init_i18n();
|
|
23854
23935
|
import_react_query51 = require("@tanstack/react-query");
|
|
23855
23936
|
import_lucide_react76 = require("lucide-react");
|
|
23856
|
-
|
|
23937
|
+
import_react83 = require("react");
|
|
23857
23938
|
init_useLayoutDataStore();
|
|
23858
23939
|
init_useLayoutStore();
|
|
23859
23940
|
init_Expandable2();
|
|
@@ -24051,7 +24132,7 @@ function usePageMapper() {
|
|
|
24051
24132
|
setIsDialogOpen,
|
|
24052
24133
|
setIsDialogClosing
|
|
24053
24134
|
} = useLayoutStore();
|
|
24054
|
-
const closeDialog = (0,
|
|
24135
|
+
const closeDialog = (0, import_react84.useCallback)(() => {
|
|
24055
24136
|
setIsDialogClosing(true);
|
|
24056
24137
|
setTimeout(() => {
|
|
24057
24138
|
setDialogContent(null);
|
|
@@ -24062,7 +24143,7 @@ function usePageMapper() {
|
|
|
24062
24143
|
setIsDialogOpen(false);
|
|
24063
24144
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
24064
24145
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
24065
|
-
const openDialog = (0,
|
|
24146
|
+
const openDialog = (0, import_react84.useCallback)(
|
|
24066
24147
|
(pageItem) => {
|
|
24067
24148
|
const PageContentComponent = pageItem.component;
|
|
24068
24149
|
setDialogTitle(pageItem.title);
|
|
@@ -24072,7 +24153,7 @@ function usePageMapper() {
|
|
|
24072
24153
|
},
|
|
24073
24154
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
24074
24155
|
);
|
|
24075
|
-
(0,
|
|
24156
|
+
(0, import_react84.useEffect)(() => {
|
|
24076
24157
|
if (page === null) return closeDialog();
|
|
24077
24158
|
const pageItem = PAGE_MAP[page];
|
|
24078
24159
|
if (!pageItem) {
|
|
@@ -24083,10 +24164,10 @@ function usePageMapper() {
|
|
|
24083
24164
|
openDialog(pageItem);
|
|
24084
24165
|
}, [page, closeDialog, openDialog]);
|
|
24085
24166
|
}
|
|
24086
|
-
var
|
|
24167
|
+
var import_react84, import_jsx_runtime116, CLEAR_DIALOG_TIMEOUT;
|
|
24087
24168
|
var init_usePageMapper = __esm({
|
|
24088
24169
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
24089
|
-
|
|
24170
|
+
import_react84 = require("react");
|
|
24090
24171
|
init_PageMap();
|
|
24091
24172
|
init_constants();
|
|
24092
24173
|
init_useLayoutDataStore();
|
|
@@ -24108,26 +24189,26 @@ function useSettingsNotifications() {
|
|
|
24108
24189
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24109
24190
|
queryFn: getUserProfile
|
|
24110
24191
|
});
|
|
24111
|
-
(0,
|
|
24192
|
+
(0, import_react85.useEffect)(() => {
|
|
24112
24193
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
24113
24194
|
setSettingsNotifications({
|
|
24114
24195
|
...COMPLETE_KYC_PROGRESS,
|
|
24115
24196
|
status: isKYCVerified ? "resolved" : "active"
|
|
24116
24197
|
});
|
|
24117
24198
|
}, [userProfile, setSettingsNotifications]);
|
|
24118
|
-
(0,
|
|
24199
|
+
(0, import_react85.useEffect)(() => {
|
|
24119
24200
|
setSettingsNotifications({
|
|
24120
24201
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
24121
24202
|
status: hasEmail ? "resolved" : "active"
|
|
24122
24203
|
});
|
|
24123
24204
|
}, [hasEmail, setSettingsNotifications]);
|
|
24124
24205
|
}
|
|
24125
|
-
var import_react_query52,
|
|
24206
|
+
var import_react_query52, import_react85, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
24126
24207
|
var init_useSettingsNotifications = __esm({
|
|
24127
24208
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
24128
24209
|
init_SessionContext();
|
|
24129
24210
|
import_react_query52 = require("@tanstack/react-query");
|
|
24130
|
-
|
|
24211
|
+
import_react85 = require("react");
|
|
24131
24212
|
init_auth();
|
|
24132
24213
|
init_profile();
|
|
24133
24214
|
init_useLayoutDataStore();
|
|
@@ -24150,7 +24231,7 @@ var init_package = __esm({
|
|
|
24150
24231
|
"package.json"() {
|
|
24151
24232
|
package_default = {
|
|
24152
24233
|
name: "@embarkai/ui-kit",
|
|
24153
|
-
version: "0.4.
|
|
24234
|
+
version: "0.4.54",
|
|
24154
24235
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24155
24236
|
type: "module",
|
|
24156
24237
|
main: "./dist/index.cjs",
|
|
@@ -24396,11 +24477,11 @@ function Header() {
|
|
|
24396
24477
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24397
24478
|
const { t } = useT();
|
|
24398
24479
|
const proMode = useProMode();
|
|
24399
|
-
const [proToast, setProToast] = (0,
|
|
24400
|
-
const [copied, setCopied] = (0,
|
|
24401
|
-
const clickCountRef = (0,
|
|
24402
|
-
const clickTimerRef = (0,
|
|
24403
|
-
const handleAvatarClick = (0,
|
|
24480
|
+
const [proToast, setProToast] = (0, import_react86.useState)(false);
|
|
24481
|
+
const [copied, setCopied] = (0, import_react86.useState)(false);
|
|
24482
|
+
const clickCountRef = (0, import_react86.useRef)(0);
|
|
24483
|
+
const clickTimerRef = (0, import_react86.useRef)(null);
|
|
24484
|
+
const handleAvatarClick = (0, import_react86.useCallback)(() => {
|
|
24404
24485
|
clickCountRef.current += 1;
|
|
24405
24486
|
if (clickTimerRef.current) {
|
|
24406
24487
|
clearTimeout(clickTimerRef.current);
|
|
@@ -24500,7 +24581,7 @@ function Header() {
|
|
|
24500
24581
|
}
|
|
24501
24582
|
);
|
|
24502
24583
|
}
|
|
24503
|
-
var import_react_query54, import_lucide_react78,
|
|
24584
|
+
var import_react_query54, import_lucide_react78, import_react86, import_jsx_runtime118;
|
|
24504
24585
|
var init_Header = __esm({
|
|
24505
24586
|
"src/internal/components/Header/Header.tsx"() {
|
|
24506
24587
|
init_lumia2();
|
|
@@ -24510,7 +24591,7 @@ var init_Header = __esm({
|
|
|
24510
24591
|
init_useT();
|
|
24511
24592
|
import_react_query54 = require("@tanstack/react-query");
|
|
24512
24593
|
import_lucide_react78 = require("lucide-react");
|
|
24513
|
-
|
|
24594
|
+
import_react86 = require("react");
|
|
24514
24595
|
init_icons();
|
|
24515
24596
|
init_auth();
|
|
24516
24597
|
init_profile();
|
|
@@ -24541,7 +24622,7 @@ function useDecideContentStyles() {
|
|
|
24541
24622
|
style: (0, import_lodash_es10.merge)({}, mobileStyles)
|
|
24542
24623
|
};
|
|
24543
24624
|
}
|
|
24544
|
-
var DialogPrimitive, import_lodash_es10, import_lucide_react79,
|
|
24625
|
+
var DialogPrimitive, import_lodash_es10, import_lucide_react79, import_react87, import_jsx_runtime119, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
24545
24626
|
var init_dialog = __esm({
|
|
24546
24627
|
"src/internal/components/ui/dialog.tsx"() {
|
|
24547
24628
|
init_utils2();
|
|
@@ -24550,14 +24631,14 @@ var init_dialog = __esm({
|
|
|
24550
24631
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
24551
24632
|
import_lodash_es10 = require("lodash-es");
|
|
24552
24633
|
import_lucide_react79 = require("lucide-react");
|
|
24553
|
-
|
|
24634
|
+
import_react87 = require("react");
|
|
24554
24635
|
init_useLayoutDataStore();
|
|
24555
24636
|
init_useLayoutStore();
|
|
24556
24637
|
init_button();
|
|
24557
24638
|
import_jsx_runtime119 = require("react/jsx-runtime");
|
|
24558
24639
|
Dialog = DialogPrimitive.Root;
|
|
24559
24640
|
DialogPortal = DialogPrimitive.Portal;
|
|
24560
|
-
DialogOverlay = (0,
|
|
24641
|
+
DialogOverlay = (0, import_react87.forwardRef)(
|
|
24561
24642
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
24562
24643
|
DialogPrimitive.Overlay,
|
|
24563
24644
|
{
|
|
@@ -24579,7 +24660,7 @@ var init_dialog = __esm({
|
|
|
24579
24660
|
border: "1px solid var(--ui-kit-bd)",
|
|
24580
24661
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
24581
24662
|
};
|
|
24582
|
-
DialogContent = (0,
|
|
24663
|
+
DialogContent = (0, import_react87.forwardRef)(
|
|
24583
24664
|
({ className, children, colorMode, ...props }, ref) => {
|
|
24584
24665
|
const { t, i18n } = useT();
|
|
24585
24666
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -24682,7 +24763,7 @@ var init_dialog = __esm({
|
|
|
24682
24763
|
DialogHeader.displayName = "DialogHeader";
|
|
24683
24764
|
DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
|
|
24684
24765
|
DialogFooter.displayName = "DialogFooter";
|
|
24685
|
-
DialogTitle = (0,
|
|
24766
|
+
DialogTitle = (0, import_react87.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
24686
24767
|
DialogPrimitive.Title,
|
|
24687
24768
|
{
|
|
24688
24769
|
ref,
|
|
@@ -24691,7 +24772,7 @@ var init_dialog = __esm({
|
|
|
24691
24772
|
}
|
|
24692
24773
|
));
|
|
24693
24774
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
24694
|
-
DialogDescription = (0,
|
|
24775
|
+
DialogDescription = (0, import_react87.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
24695
24776
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
24696
24777
|
}
|
|
24697
24778
|
});
|
|
@@ -24716,7 +24797,7 @@ function Dialog2() {
|
|
|
24716
24797
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
24717
24798
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24718
24799
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
24719
|
-
(0,
|
|
24800
|
+
(0, import_react88.useEffect)(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
24720
24801
|
usePageMapper();
|
|
24721
24802
|
useAutoConnect();
|
|
24722
24803
|
useBackupStatusChanges();
|
|
@@ -24754,13 +24835,13 @@ function Dialog2() {
|
|
|
24754
24835
|
}
|
|
24755
24836
|
);
|
|
24756
24837
|
}
|
|
24757
|
-
var import_framer_motion,
|
|
24838
|
+
var import_framer_motion, import_react88, import_jsx_runtime121;
|
|
24758
24839
|
var init_Dialog = __esm({
|
|
24759
24840
|
"src/internal/components/Dialog/Dialog.tsx"() {
|
|
24760
24841
|
init_ProviderContext();
|
|
24761
24842
|
init_SessionContext();
|
|
24762
24843
|
import_framer_motion = require("framer-motion");
|
|
24763
|
-
|
|
24844
|
+
import_react88 = require("react");
|
|
24764
24845
|
init_constants();
|
|
24765
24846
|
init_useAutoConnect();
|
|
24766
24847
|
init_useBackupStatusChanges();
|
|
@@ -24786,14 +24867,14 @@ var init_Dialog2 = __esm({
|
|
|
24786
24867
|
});
|
|
24787
24868
|
|
|
24788
24869
|
// src/internal/components/TssManager.tsx
|
|
24789
|
-
var
|
|
24870
|
+
var import_react89, TssManagerWithRef;
|
|
24790
24871
|
var init_TssManager = __esm({
|
|
24791
24872
|
"src/internal/components/TssManager.tsx"() {
|
|
24792
24873
|
init_SessionContext();
|
|
24793
|
-
|
|
24874
|
+
import_react89 = __toESM(require("react"), 1);
|
|
24794
24875
|
init_auth();
|
|
24795
24876
|
init_clients();
|
|
24796
|
-
TssManagerWithRef =
|
|
24877
|
+
TssManagerWithRef = import_react89.default.forwardRef((props, ref) => {
|
|
24797
24878
|
const { mpcPin } = props;
|
|
24798
24879
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
24799
24880
|
const publicClient = useSession((st) => st.publicClient);
|
|
@@ -24801,14 +24882,14 @@ var init_TssManager = __esm({
|
|
|
24801
24882
|
const setStatus = useSession((st) => st.setStatus);
|
|
24802
24883
|
const setSession = useSession((st) => st.setSession);
|
|
24803
24884
|
const setAddress = useSession((st) => st.setAddress);
|
|
24804
|
-
const onSessionCreated = (0,
|
|
24885
|
+
const onSessionCreated = (0, import_react89.useCallback)(
|
|
24805
24886
|
(session, address) => {
|
|
24806
24887
|
setSession(session);
|
|
24807
24888
|
setAddress(address);
|
|
24808
24889
|
},
|
|
24809
24890
|
[setSession, setAddress]
|
|
24810
24891
|
);
|
|
24811
|
-
const createSessionWithKeyshare =
|
|
24892
|
+
const createSessionWithKeyshare = import_react89.default.useCallback(
|
|
24812
24893
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
24813
24894
|
setStatus("checking key management setup...");
|
|
24814
24895
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -24833,7 +24914,7 @@ var init_TssManager = __esm({
|
|
|
24833
24914
|
},
|
|
24834
24915
|
[setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
|
|
24835
24916
|
);
|
|
24836
|
-
|
|
24917
|
+
import_react89.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
24837
24918
|
return null;
|
|
24838
24919
|
});
|
|
24839
24920
|
}
|
|
@@ -24861,7 +24942,7 @@ function WalletConnectHandler() {
|
|
|
24861
24942
|
const projectId = providerConfig?.projectId;
|
|
24862
24943
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
24863
24944
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
24864
|
-
const onLinkingComplete = (0,
|
|
24945
|
+
const onLinkingComplete = (0, import_react90.useCallback)(
|
|
24865
24946
|
async (success) => {
|
|
24866
24947
|
setIsWalletLinking(false);
|
|
24867
24948
|
if (!success && !passportWalletAddress) {
|
|
@@ -24890,10 +24971,10 @@ function WalletConnectHandler() {
|
|
|
24890
24971
|
},
|
|
24891
24972
|
[qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
|
|
24892
24973
|
);
|
|
24893
|
-
const [hasStartedLinking, setHasStartedLinking] =
|
|
24894
|
-
const [modalWasOpened, setModalWasOpened] =
|
|
24895
|
-
const [pendingModalOpen, setPendingModalOpen] =
|
|
24896
|
-
(0,
|
|
24974
|
+
const [hasStartedLinking, setHasStartedLinking] = import_react90.default.useState(false);
|
|
24975
|
+
const [modalWasOpened, setModalWasOpened] = import_react90.default.useState(false);
|
|
24976
|
+
const [pendingModalOpen, setPendingModalOpen] = import_react90.default.useState(false);
|
|
24977
|
+
(0, import_react90.useEffect)(() => {
|
|
24897
24978
|
if (isWalletLinking && !hasStartedLinking) {
|
|
24898
24979
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
24899
24980
|
isConnected,
|
|
@@ -24931,18 +25012,18 @@ function WalletConnectHandler() {
|
|
|
24931
25012
|
setProviderType,
|
|
24932
25013
|
walletMode
|
|
24933
25014
|
]);
|
|
24934
|
-
(0,
|
|
25015
|
+
(0, import_react90.useEffect)(() => {
|
|
24935
25016
|
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
24936
25017
|
setPendingModalOpen(false);
|
|
24937
25018
|
openConnectModal();
|
|
24938
25019
|
}
|
|
24939
25020
|
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
24940
|
-
(0,
|
|
25021
|
+
(0, import_react90.useEffect)(() => {
|
|
24941
25022
|
if (connectModalOpen && hasStartedLinking) {
|
|
24942
25023
|
setModalWasOpened(true);
|
|
24943
25024
|
}
|
|
24944
25025
|
}, [connectModalOpen, hasStartedLinking]);
|
|
24945
|
-
(0,
|
|
25026
|
+
(0, import_react90.useEffect)(() => {
|
|
24946
25027
|
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
24947
25028
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
24948
25029
|
onLinkingComplete(false);
|
|
@@ -24950,7 +25031,7 @@ function WalletConnectHandler() {
|
|
|
24950
25031
|
setModalWasOpened(false);
|
|
24951
25032
|
}
|
|
24952
25033
|
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
24953
|
-
(0,
|
|
25034
|
+
(0, import_react90.useEffect)(() => {
|
|
24954
25035
|
if (isWalletLinking) {
|
|
24955
25036
|
const timeout = setTimeout(() => {
|
|
24956
25037
|
console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
|
|
@@ -25070,7 +25151,7 @@ function WalletConnectHandler() {
|
|
|
25070
25151
|
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
25071
25152
|
}
|
|
25072
25153
|
});
|
|
25073
|
-
(0,
|
|
25154
|
+
(0, import_react90.useEffect)(() => {
|
|
25074
25155
|
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
25075
25156
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
25076
25157
|
if (!passportWalletAddress) {
|
|
@@ -25080,7 +25161,7 @@ function WalletConnectHandler() {
|
|
|
25080
25161
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
25081
25162
|
}
|
|
25082
25163
|
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
25083
|
-
(0,
|
|
25164
|
+
(0, import_react90.useEffect)(() => {
|
|
25084
25165
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
25085
25166
|
const timeout = setTimeout(() => {
|
|
25086
25167
|
console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
|
|
@@ -25102,7 +25183,7 @@ function WalletConnectHandler() {
|
|
|
25102
25183
|
]);
|
|
25103
25184
|
return null;
|
|
25104
25185
|
}
|
|
25105
|
-
var import_rainbowkit2, import_react_query55,
|
|
25186
|
+
var import_rainbowkit2, import_react_query55, import_react90, import_wagmi8;
|
|
25106
25187
|
var init_WalletConnectHandler = __esm({
|
|
25107
25188
|
"src/internal/components/WalletConnectHandler.tsx"() {
|
|
25108
25189
|
init_ProviderContext();
|
|
@@ -25110,7 +25191,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25110
25191
|
init_linkedProfiles();
|
|
25111
25192
|
import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
25112
25193
|
import_react_query55 = require("@tanstack/react-query");
|
|
25113
|
-
|
|
25194
|
+
import_react90 = __toESM(require("react"), 1);
|
|
25114
25195
|
import_wagmi8 = require("wagmi");
|
|
25115
25196
|
init_wallet();
|
|
25116
25197
|
init_AuthMenu2();
|
|
@@ -25131,13 +25212,13 @@ function DirectWalletHandler() {
|
|
|
25131
25212
|
const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
|
|
25132
25213
|
const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
|
|
25133
25214
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
25134
|
-
(0,
|
|
25215
|
+
(0, import_react91.useEffect)(() => {
|
|
25135
25216
|
setConfigMode(walletMode);
|
|
25136
25217
|
if (walletMode !== "both") {
|
|
25137
25218
|
setActiveMode(walletMode);
|
|
25138
25219
|
}
|
|
25139
25220
|
}, [walletMode, setConfigMode, setActiveMode]);
|
|
25140
|
-
(0,
|
|
25221
|
+
(0, import_react91.useEffect)(() => {
|
|
25141
25222
|
if (isConnected && address && !isExternalConnected && connector && chain?.id) {
|
|
25142
25223
|
setExternalWallet({
|
|
25143
25224
|
address,
|
|
@@ -25146,17 +25227,17 @@ function DirectWalletHandler() {
|
|
|
25146
25227
|
});
|
|
25147
25228
|
}
|
|
25148
25229
|
}, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
|
|
25149
|
-
(0,
|
|
25230
|
+
(0, import_react91.useEffect)(() => {
|
|
25150
25231
|
if (isExternalConnected && !isConnected) {
|
|
25151
25232
|
clearExternalWallet();
|
|
25152
25233
|
}
|
|
25153
25234
|
}, [isConnected, isExternalConnected, clearExternalWallet]);
|
|
25154
|
-
(0,
|
|
25235
|
+
(0, import_react91.useEffect)(() => {
|
|
25155
25236
|
if (isExternalConnected && isConnected && chain?.id) {
|
|
25156
25237
|
setExternalChainId(chain.id);
|
|
25157
25238
|
}
|
|
25158
25239
|
}, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
|
|
25159
|
-
(0,
|
|
25240
|
+
(0, import_react91.useEffect)(() => {
|
|
25160
25241
|
if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
|
|
25161
25242
|
setExternalWallet({
|
|
25162
25243
|
address,
|
|
@@ -25167,10 +25248,10 @@ function DirectWalletHandler() {
|
|
|
25167
25248
|
}, [address, isConnected, isExternalConnected, externalAddress, chain?.id, connector, setExternalWallet]);
|
|
25168
25249
|
return null;
|
|
25169
25250
|
}
|
|
25170
|
-
var
|
|
25251
|
+
var import_react91, import_wagmi9;
|
|
25171
25252
|
var init_DirectWalletHandler = __esm({
|
|
25172
25253
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
25173
|
-
|
|
25254
|
+
import_react91 = require("react");
|
|
25174
25255
|
import_wagmi9 = require("wagmi");
|
|
25175
25256
|
init_ProviderContext();
|
|
25176
25257
|
init_useExternalWalletStore();
|
|
@@ -25195,7 +25276,7 @@ function waitForStoreHydration() {
|
|
|
25195
25276
|
}
|
|
25196
25277
|
function SessionProvider({ children }) {
|
|
25197
25278
|
const config = useProviderConfig().config;
|
|
25198
|
-
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
25279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_react92.Fragment, { children: [
|
|
25199
25280
|
children,
|
|
25200
25281
|
config.current?.wallet?.enabled && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(WalletConnectHandler, {}),
|
|
25201
25282
|
config.current?.wallet?.enabled && (config.current?.wallet?.mode === "direct" || config.current?.wallet?.mode === "both") && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(DirectWalletHandler, {}),
|
|
@@ -25210,11 +25291,11 @@ function SessionProvider({ children }) {
|
|
|
25210
25291
|
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Dialog2, {})
|
|
25211
25292
|
] });
|
|
25212
25293
|
}
|
|
25213
|
-
var import_read21,
|
|
25294
|
+
var import_read21, import_react92, import_zustand13, import_middleware4, import_jsx_runtime122, useSession, requireActiveChainId;
|
|
25214
25295
|
var init_SessionContext = __esm({
|
|
25215
25296
|
"src/context/SessionContext.tsx"() {
|
|
25216
25297
|
import_read21 = require("@embarkai/core/read");
|
|
25217
|
-
|
|
25298
|
+
import_react92 = require("react");
|
|
25218
25299
|
import_zustand13 = require("zustand");
|
|
25219
25300
|
import_middleware4 = require("zustand/middleware");
|
|
25220
25301
|
init_BalanceFeedProvider2();
|
|
@@ -27883,7 +27964,7 @@ var init_rainbowkit = __esm({
|
|
|
27883
27964
|
function RainbowKitProvider({ children }) {
|
|
27884
27965
|
const config = useProviderConfig().config;
|
|
27885
27966
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
27886
|
-
const rainbowConfig = (0,
|
|
27967
|
+
const rainbowConfig = (0, import_react93.useMemo)(
|
|
27887
27968
|
() => createRainbowConfig({
|
|
27888
27969
|
projectId: config.current?.wallet?.walletConnectProjectId,
|
|
27889
27970
|
allowedWallets: config.current?.wallet?.allowedWallets,
|
|
@@ -27897,7 +27978,7 @@ function RainbowKitProvider({ children }) {
|
|
|
27897
27978
|
config.current?.wallet?.walletConnectProjectId
|
|
27898
27979
|
]
|
|
27899
27980
|
);
|
|
27900
|
-
const customTheme = (0,
|
|
27981
|
+
const customTheme = (0, import_react93.useMemo)(() => {
|
|
27901
27982
|
if (!config.current?.wallet?.enabled) return {};
|
|
27902
27983
|
return colorMode === "dark" ? {
|
|
27903
27984
|
...(0, import_rainbowkit4.darkTheme)(),
|
|
@@ -27914,11 +27995,11 @@ function RainbowKitProvider({ children }) {
|
|
|
27914
27995
|
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_jsx_runtime123.Fragment, { children });
|
|
27915
27996
|
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_wagmi11.WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_rainbowkit4.RainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
27916
27997
|
}
|
|
27917
|
-
var import_rainbowkit4,
|
|
27998
|
+
var import_rainbowkit4, import_react93, import_wagmi11, import_styles, import_jsx_runtime123;
|
|
27918
27999
|
var init_RainbowKitContext = __esm({
|
|
27919
28000
|
"src/context/RainbowKitContext.tsx"() {
|
|
27920
28001
|
import_rainbowkit4 = require("@rainbow-me/rainbowkit");
|
|
27921
|
-
|
|
28002
|
+
import_react93 = require("react");
|
|
27922
28003
|
import_wagmi11 = require("wagmi");
|
|
27923
28004
|
init_rainbowkit();
|
|
27924
28005
|
init_useLayoutStore();
|
|
@@ -27974,10 +28055,10 @@ function clearLegacyWagmiStorage() {
|
|
|
27974
28055
|
}
|
|
27975
28056
|
function Provider(props) {
|
|
27976
28057
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
27977
|
-
const callbacksRef = (0,
|
|
27978
|
-
(0,
|
|
27979
|
-
const config = (0,
|
|
27980
|
-
const updateConfig = (0,
|
|
28058
|
+
const callbacksRef = (0, import_react94.useRef)(callbacks);
|
|
28059
|
+
(0, import_react94.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
28060
|
+
const config = (0, import_react94.useRef)((0, import_lodash_es11.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
28061
|
+
const updateConfig = (0, import_react94.useCallback)((updates) => {
|
|
27981
28062
|
const prev = config.current;
|
|
27982
28063
|
const next = { ...prev };
|
|
27983
28064
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -28011,12 +28092,12 @@ function Provider(props) {
|
|
|
28011
28092
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
28012
28093
|
config.current = next;
|
|
28013
28094
|
}, []);
|
|
28014
|
-
const updateCallbacks = (0,
|
|
28095
|
+
const updateCallbacks = (0, import_react94.useCallback)((updates) => {
|
|
28015
28096
|
const prev = callbacksRef.current;
|
|
28016
28097
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
28017
28098
|
callbacksRef.current = next;
|
|
28018
28099
|
}, []);
|
|
28019
|
-
(0,
|
|
28100
|
+
(0, import_react94.useEffect)(() => {
|
|
28020
28101
|
if (typeof window === "undefined" || !projectId) return;
|
|
28021
28102
|
const mergedConfig = (0, import_lodash_es11.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
28022
28103
|
updateConfig(mergedConfig);
|
|
@@ -28036,7 +28117,7 @@ function Provider(props) {
|
|
|
28036
28117
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
28037
28118
|
}
|
|
28038
28119
|
}, [projectId, initialConfig]);
|
|
28039
|
-
(0,
|
|
28120
|
+
(0, import_react94.useEffect)(() => {
|
|
28040
28121
|
if (typeof window === "undefined" || !projectId) return;
|
|
28041
28122
|
try {
|
|
28042
28123
|
(0, import_error_tracking4.initSdkErrorTracking)();
|
|
@@ -28065,7 +28146,7 @@ function Provider(props) {
|
|
|
28065
28146
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
28066
28147
|
}
|
|
28067
28148
|
}, [projectId]);
|
|
28068
|
-
const contextValue = (0,
|
|
28149
|
+
const contextValue = (0, import_react94.useMemo)(
|
|
28069
28150
|
() => ({
|
|
28070
28151
|
config,
|
|
28071
28152
|
updateConfig,
|
|
@@ -28086,12 +28167,12 @@ function Provider(props) {
|
|
|
28086
28167
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(WagmiProvider2, { children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(SessionProvider, { children }) }) })
|
|
28087
28168
|
);
|
|
28088
28169
|
}
|
|
28089
|
-
var import_error_tracking4, import_lodash_es11,
|
|
28170
|
+
var import_error_tracking4, import_lodash_es11, import_react94, import_jsx_runtime125, UIContext, useProviderConfig;
|
|
28090
28171
|
var init_ProviderContext = __esm({
|
|
28091
28172
|
"src/context/ProviderContext.tsx"() {
|
|
28092
28173
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
28093
28174
|
import_lodash_es11 = require("lodash-es");
|
|
28094
|
-
|
|
28175
|
+
import_react94 = require("react");
|
|
28095
28176
|
init_initial();
|
|
28096
28177
|
init_iframe_manager();
|
|
28097
28178
|
init_RainbowKitContext();
|
|
@@ -28099,9 +28180,9 @@ var init_ProviderContext = __esm({
|
|
|
28099
28180
|
init_utils11();
|
|
28100
28181
|
init_WagmiContext();
|
|
28101
28182
|
import_jsx_runtime125 = require("react/jsx-runtime");
|
|
28102
|
-
UIContext = (0,
|
|
28183
|
+
UIContext = (0, import_react94.createContext)(void 0);
|
|
28103
28184
|
useProviderConfig = () => {
|
|
28104
|
-
const ctx = (0,
|
|
28185
|
+
const ctx = (0, import_react94.useContext)(UIContext);
|
|
28105
28186
|
if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
|
|
28106
28187
|
return ctx;
|
|
28107
28188
|
};
|
|
@@ -28212,7 +28293,7 @@ init_lumia2();
|
|
|
28212
28293
|
init_embarkAI2();
|
|
28213
28294
|
var import_react_query56 = require("@tanstack/react-query");
|
|
28214
28295
|
var import_lucide_react80 = require("lucide-react");
|
|
28215
|
-
var
|
|
28296
|
+
var import_react95 = require("react");
|
|
28216
28297
|
init_SessionContext();
|
|
28217
28298
|
init_auth();
|
|
28218
28299
|
init_profile();
|
|
@@ -28245,7 +28326,7 @@ function ConnectWalletButton(props) {
|
|
|
28245
28326
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28246
28327
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
28247
28328
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
28248
|
-
(0,
|
|
28329
|
+
(0, import_react95.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
28249
28330
|
const { data: profile, isLoading: isProfileLoading } = (0, import_react_query56.useQuery)({
|
|
28250
28331
|
retry: false,
|
|
28251
28332
|
enabled: !!address,
|
|
@@ -28253,7 +28334,7 @@ function ConnectWalletButton(props) {
|
|
|
28253
28334
|
queryFn: getUserProfile
|
|
28254
28335
|
});
|
|
28255
28336
|
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth23.jwtTokenManager.getDisplayName();
|
|
28256
|
-
const indicators = (0,
|
|
28337
|
+
const indicators = (0, import_react95.useMemo)(() => {
|
|
28257
28338
|
const userId = session?.mpcUserId;
|
|
28258
28339
|
if (!userId) return { server: false, local: false, backup: false };
|
|
28259
28340
|
const server = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
|
|
@@ -28434,29 +28515,8 @@ var useHasServerVault = () => useSession((st) => st.hasServerVault);
|
|
|
28434
28515
|
var useActiveChainId = () => useSession((st) => st.activeChainId);
|
|
28435
28516
|
var useHydrated = () => useSession((st) => st.hasHydrated);
|
|
28436
28517
|
|
|
28437
|
-
// src/hooks/useOpenPage.ts
|
|
28438
|
-
var import_react95 = require("react");
|
|
28439
|
-
init_SessionContext();
|
|
28440
|
-
init_useLayoutDataStore();
|
|
28441
|
-
function useOpenPage() {
|
|
28442
|
-
const page = useLayoutDataStore((st) => st.page);
|
|
28443
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
28444
|
-
const setPageParams = useLayoutDataStore((st) => st.setPageParams);
|
|
28445
|
-
const address = useSession((st) => st.address);
|
|
28446
|
-
const open = (0, import_react95.useCallback)(
|
|
28447
|
-
(passportPage, params) => {
|
|
28448
|
-
if (!address) return setPage("auth" /* AUTH */);
|
|
28449
|
-
if (!!address && passportPage === "auth" /* AUTH */) return setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
28450
|
-
setPage(passportPage);
|
|
28451
|
-
if (!!params) setPageParams(params);
|
|
28452
|
-
},
|
|
28453
|
-
[setPage, setPageParams, address]
|
|
28454
|
-
);
|
|
28455
|
-
const close = (0, import_react95.useCallback)(() => setPage(null), [setPage]);
|
|
28456
|
-
return { open, close, isOpen: page !== null };
|
|
28457
|
-
}
|
|
28458
|
-
|
|
28459
28518
|
// src/index.ts
|
|
28519
|
+
init_useOpenPage();
|
|
28460
28520
|
init_useColorMode();
|
|
28461
28521
|
|
|
28462
28522
|
// src/components/ThemeToggle.tsx
|