@embarkai/ui-kit 0.4.57 → 0.4.59
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 +96 -89
- package/dist/index.cjs +1261 -1113
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +915 -770
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -197,6 +197,9 @@ var init_initial = __esm({
|
|
|
197
197
|
});
|
|
198
198
|
|
|
199
199
|
// src/lib/errors.ts
|
|
200
|
+
function isSessionExpiredError(error) {
|
|
201
|
+
return typeof error === "object" && error !== null && error.code === ErrorCodes.SESSION_EXPIRED;
|
|
202
|
+
}
|
|
200
203
|
function createAccountAbstractionError(params) {
|
|
201
204
|
const { message, code } = params;
|
|
202
205
|
if (!code) {
|
|
@@ -205,11 +208,13 @@ function createAccountAbstractionError(params) {
|
|
|
205
208
|
switch (code) {
|
|
206
209
|
case UserRejectedError.CODE:
|
|
207
210
|
return new UserRejectedError(message);
|
|
211
|
+
case SessionExpiredError.CODE:
|
|
212
|
+
return new SessionExpiredError(message);
|
|
208
213
|
default:
|
|
209
214
|
return new AccountAbstractionError(message, code);
|
|
210
215
|
}
|
|
211
216
|
}
|
|
212
|
-
var AccountAbstractionError, UserRejectedError, ErrorCodes;
|
|
217
|
+
var AccountAbstractionError, UserRejectedError, SessionExpiredError, ErrorCodes;
|
|
213
218
|
var init_errors = __esm({
|
|
214
219
|
"src/lib/errors.ts"() {
|
|
215
220
|
AccountAbstractionError = class _AccountAbstractionError extends Error {
|
|
@@ -231,9 +236,19 @@ var init_errors = __esm({
|
|
|
231
236
|
this.name = "UserRejectedError";
|
|
232
237
|
}
|
|
233
238
|
};
|
|
239
|
+
SessionExpiredError = class _SessionExpiredError extends AccountAbstractionError {
|
|
240
|
+
static {
|
|
241
|
+
this.CODE = "SESSION_EXPIRED";
|
|
242
|
+
}
|
|
243
|
+
constructor(message = "Session expired, please log in again") {
|
|
244
|
+
super(message, _SessionExpiredError.CODE);
|
|
245
|
+
this.name = "SessionExpiredError";
|
|
246
|
+
}
|
|
247
|
+
};
|
|
234
248
|
ErrorCodes = {
|
|
235
249
|
MPC_SIGNING_ERROR: "MPC_SIGNING_ERROR",
|
|
236
|
-
USER_REJECTED: UserRejectedError.CODE
|
|
250
|
+
USER_REJECTED: UserRejectedError.CODE,
|
|
251
|
+
SESSION_EXPIRED: SessionExpiredError.CODE
|
|
237
252
|
};
|
|
238
253
|
}
|
|
239
254
|
});
|
|
@@ -659,7 +674,10 @@ async function ensureDkgAndGetOwner(userId, _clientSeedHex) {
|
|
|
659
674
|
};
|
|
660
675
|
}
|
|
661
676
|
await iframeManager.authenticate(userId);
|
|
662
|
-
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
677
|
+
const { jwtTokenManager: jwtTokenManager4, ensureFreshSession: ensureFreshSession2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
678
|
+
if (await ensureFreshSession2(jwtTokenManager4) === "session_dead") {
|
|
679
|
+
throw new SessionExpiredError();
|
|
680
|
+
}
|
|
663
681
|
let accessToken = jwtTokenManager4.getAccessToken();
|
|
664
682
|
if (!accessToken) {
|
|
665
683
|
console.warn("[iframe-mpc-client] No access token available for DKG, attempting cookie-based session");
|
|
@@ -691,8 +709,12 @@ async function signDigestWithMpc(userId, digest32, userOpDetails) {
|
|
|
691
709
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
692
710
|
try {
|
|
693
711
|
const iframeManager = getIframeManager();
|
|
694
|
-
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
712
|
+
const { jwtTokenManager: jwtTokenManager4, ensureFreshSession: ensureFreshSession2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
713
|
+
const session = await ensureFreshSession2(jwtTokenManager4);
|
|
695
714
|
const accessToken = jwtTokenManager4.getAccessToken();
|
|
715
|
+
if (session === "session_dead") {
|
|
716
|
+
throw new SessionExpiredError();
|
|
717
|
+
}
|
|
696
718
|
if (!accessToken) {
|
|
697
719
|
throw new Error("No access token available for signing");
|
|
698
720
|
}
|
|
@@ -751,8 +773,12 @@ async function signTypedDataWithMpc(userId, digest32, typedData) {
|
|
|
751
773
|
digest32
|
|
752
774
|
});
|
|
753
775
|
const iframeManager = getIframeManager();
|
|
754
|
-
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
776
|
+
const { jwtTokenManager: jwtTokenManager4, ensureFreshSession: ensureFreshSession2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
777
|
+
const session = await ensureFreshSession2(jwtTokenManager4);
|
|
755
778
|
const accessToken = jwtTokenManager4.getAccessToken();
|
|
779
|
+
if (session === "session_dead") {
|
|
780
|
+
throw new SessionExpiredError();
|
|
781
|
+
}
|
|
756
782
|
if (!accessToken) {
|
|
757
783
|
console.error("[signTypedDataWithMpc] No access token available");
|
|
758
784
|
throw new Error("No access token available for signing");
|
|
@@ -841,31 +867,31 @@ var PageKey, useLayoutDataStore;
|
|
|
841
867
|
var init_useLayoutDataStore = __esm({
|
|
842
868
|
"src/internal/hooks/useLayoutDataStore.ts"() {
|
|
843
869
|
init_constants();
|
|
844
|
-
PageKey = /* @__PURE__ */ ((
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
return
|
|
870
|
+
PageKey = /* @__PURE__ */ ((PageKey4) => {
|
|
871
|
+
PageKey4["AUTH"] = "auth";
|
|
872
|
+
PageKey4["LANGUAGES"] = "languages";
|
|
873
|
+
PageKey4["TERMS_OF_SERVICE"] = "terms-of-service";
|
|
874
|
+
PageKey4["MAIN_MENU"] = "main-menu";
|
|
875
|
+
PageKey4["SETTINGS"] = "settings";
|
|
876
|
+
PageKey4["SEND"] = "send";
|
|
877
|
+
PageKey4["RECEIVE"] = "receive";
|
|
878
|
+
PageKey4["BUY"] = "buy";
|
|
879
|
+
PageKey4["KYC"] = "kyc";
|
|
880
|
+
PageKey4["TRANSACTIONS"] = "transactions";
|
|
881
|
+
PageKey4["ASSETS"] = "assets";
|
|
882
|
+
PageKey4["MANAGE_WALLET"] = "manage-wallet";
|
|
883
|
+
PageKey4["UNLINK_PROVIDER"] = "unlink-provider";
|
|
884
|
+
PageKey4["SECURITY"] = "security";
|
|
885
|
+
PageKey4["KEYSARE_BACKUP"] = "keysare-backup";
|
|
886
|
+
PageKey4["KEYSHARE_RESTORE"] = "keyshare-restore";
|
|
887
|
+
PageKey4["CHAIN"] = "chain";
|
|
888
|
+
PageKey4["CHAIN_SWITCH_REQUEST"] = "chain-switch-request";
|
|
889
|
+
PageKey4["NICKNAME_SETTINGS"] = "nickname-settings";
|
|
890
|
+
PageKey4["DEVICES"] = "devices";
|
|
891
|
+
PageKey4["DEVICE_LINK"] = "device-link";
|
|
892
|
+
PageKey4["DEVICE_MANAGE"] = "device-manage";
|
|
893
|
+
PageKey4["DEVICE_RESTORE"] = "device-restore";
|
|
894
|
+
return PageKey4;
|
|
869
895
|
})(PageKey || {});
|
|
870
896
|
useLayoutDataStore = create((set) => ({
|
|
871
897
|
page: null,
|
|
@@ -2451,7 +2477,7 @@ function usePageParams() {
|
|
|
2451
2477
|
currentParams.current = pageParams;
|
|
2452
2478
|
setPageParams(null);
|
|
2453
2479
|
}, []);
|
|
2454
|
-
return currentParams
|
|
2480
|
+
return currentParams;
|
|
2455
2481
|
}
|
|
2456
2482
|
var init_useOpenPage = __esm({
|
|
2457
2483
|
"src/hooks/useOpenPage.ts"() {
|
|
@@ -5497,7 +5523,7 @@ var init_en = __esm({
|
|
|
5497
5523
|
selectToken: "Select Asset",
|
|
5498
5524
|
estimations: "Estimations",
|
|
5499
5525
|
estimatedFee: "Estimated Fee",
|
|
5500
|
-
availableChainPairs: "
|
|
5526
|
+
availableChainPairs: "Select Chain Pairs",
|
|
5501
5527
|
toChain: "To Chain",
|
|
5502
5528
|
fromChain: "From Chain",
|
|
5503
5529
|
optionalRecipient: "Recipient (optional, if empty - destination chain address = sender address on origin chain)",
|
|
@@ -5572,7 +5598,12 @@ var init_en = __esm({
|
|
|
5572
5598
|
exchangeRate: "Exchange Rate",
|
|
5573
5599
|
networkFee: "Network Fee",
|
|
5574
5600
|
serviceFee: "Service Fee",
|
|
5575
|
-
paymentMethod: "Payment Method"
|
|
5601
|
+
paymentMethod: "Payment Method",
|
|
5602
|
+
toAddress: {
|
|
5603
|
+
receiver: "ATTENTION! Receiving Address",
|
|
5604
|
+
message: "You are about to purchase crypto to an external address, not your embarkAI address.",
|
|
5605
|
+
suggestion: "Please make sure this is your correct wallet address, otherwise you may lose your funds."
|
|
5606
|
+
}
|
|
5576
5607
|
},
|
|
5577
5608
|
transactionHistory: {
|
|
5578
5609
|
details: "Details"
|
|
@@ -5590,7 +5621,8 @@ var init_en = __esm({
|
|
|
5590
5621
|
},
|
|
5591
5622
|
portfolioMenu: {
|
|
5592
5623
|
title: "Your Assets",
|
|
5593
|
-
noAssets: "No assets found"
|
|
5624
|
+
noAssets: "No assets found",
|
|
5625
|
+
noBlockscout: "No Blockscout API found for chain: {{chain}}"
|
|
5594
5626
|
},
|
|
5595
5627
|
transactionsMenu: {
|
|
5596
5628
|
title: "Transactions History",
|
|
@@ -8776,11 +8808,35 @@ var init_priceFormatter = __esm({
|
|
|
8776
8808
|
});
|
|
8777
8809
|
|
|
8778
8810
|
// src/internal/components/BuyMenu/useBuyMenuStore.ts
|
|
8811
|
+
import { keys, noop } from "lodash-es";
|
|
8812
|
+
import { useEffect as useEffect12 } from "react";
|
|
8779
8813
|
import { create as create4 } from "zustand";
|
|
8780
8814
|
import { persist } from "zustand/middleware";
|
|
8815
|
+
function useBuyMenuParams() {
|
|
8816
|
+
useEffect12(() => {
|
|
8817
|
+
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
8818
|
+
if (!pageParams || !keys(pageParams).length) return;
|
|
8819
|
+
const { amount, crypto: crypto2, toWalletAddress, confirmationMessage, onRampWidgetRedirected } = pageParams || {};
|
|
8820
|
+
switch (true) {
|
|
8821
|
+
case !!amount:
|
|
8822
|
+
useBuyMenuStore.getState().setSrcInputAmount(amount);
|
|
8823
|
+
useBuyMenuStore.getState().setSrcQueryAmount(amount);
|
|
8824
|
+
case !!crypto2:
|
|
8825
|
+
useBuyMenuStore.getState().setSelectedCrypto(crypto2);
|
|
8826
|
+
case !!toWalletAddress:
|
|
8827
|
+
useBuyMenuStore.getState().setToWalletAddress(toWalletAddress);
|
|
8828
|
+
case !!onRampWidgetRedirected:
|
|
8829
|
+
useBuyMenuStore.getState().setOnRampWidgetRedirectedFn(onRampWidgetRedirected);
|
|
8830
|
+
case !!confirmationMessage:
|
|
8831
|
+
useBuyMenuStore.getState().setConfirmationMessage(confirmationMessage);
|
|
8832
|
+
}
|
|
8833
|
+
setPageParams(null);
|
|
8834
|
+
}, []);
|
|
8835
|
+
}
|
|
8781
8836
|
var DEFAULT_MENU_SWITCHES, DEFAULT_PROVIDER, useBuyMenuStore;
|
|
8782
8837
|
var init_useBuyMenuStore = __esm({
|
|
8783
8838
|
"src/internal/components/BuyMenu/useBuyMenuStore.ts"() {
|
|
8839
|
+
init_useLayoutDataStore();
|
|
8784
8840
|
DEFAULT_MENU_SWITCHES = {
|
|
8785
8841
|
isTransactionHistory: false,
|
|
8786
8842
|
isProviderSelector: false,
|
|
@@ -8795,6 +8851,8 @@ var init_useBuyMenuStore = __esm({
|
|
|
8795
8851
|
(set) => ({
|
|
8796
8852
|
renderKey: "default-initial-buy-menu-render-key",
|
|
8797
8853
|
setRenderKey: (key) => set({ renderKey: key }),
|
|
8854
|
+
toWalletAddress: null,
|
|
8855
|
+
setToWalletAddress: (toWalletAddress) => set({ toWalletAddress }),
|
|
8798
8856
|
/** boolean flags */
|
|
8799
8857
|
isTransactionHistory: false,
|
|
8800
8858
|
setIsTransactionHistory: (isTransactionHistory) => {
|
|
@@ -8844,6 +8902,10 @@ var init_useBuyMenuStore = __esm({
|
|
|
8844
8902
|
srcQueryAmount: 0,
|
|
8845
8903
|
setSrcQueryAmount: (amount) => set({ srcQueryAmount: amount }),
|
|
8846
8904
|
/** */
|
|
8905
|
+
onRampWidgetRedirected: noop,
|
|
8906
|
+
setOnRampWidgetRedirectedFn: (cb) => set({ onRampWidgetRedirected: cb }),
|
|
8907
|
+
confirmationMessage: null,
|
|
8908
|
+
setConfirmationMessage: (message) => set({ confirmationMessage: message }),
|
|
8847
8909
|
error: null,
|
|
8848
8910
|
setError: (error) => set({ error })
|
|
8849
8911
|
}),
|
|
@@ -9424,6 +9486,61 @@ var init_api = __esm({
|
|
|
9424
9486
|
}
|
|
9425
9487
|
});
|
|
9426
9488
|
|
|
9489
|
+
// src/internal/utils/cn.ts
|
|
9490
|
+
import { clsx as clsx2 } from "clsx";
|
|
9491
|
+
function cn2(...inputs) {
|
|
9492
|
+
return twMerge(clsx2(inputs));
|
|
9493
|
+
}
|
|
9494
|
+
var init_cn = __esm({
|
|
9495
|
+
"src/internal/utils/cn.ts"() {
|
|
9496
|
+
init_bundle_mjs();
|
|
9497
|
+
}
|
|
9498
|
+
});
|
|
9499
|
+
|
|
9500
|
+
// src/internal/components/ui/badge.tsx
|
|
9501
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
9502
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
9503
|
+
function Badge(props) {
|
|
9504
|
+
const { className, variant = "secondary", size = "default", ...rest } = props;
|
|
9505
|
+
return /* @__PURE__ */ jsx36("span", { ...rest, className: cn2(badgeVariants({ variant, size }), className) });
|
|
9506
|
+
}
|
|
9507
|
+
var badgeVariants;
|
|
9508
|
+
var init_badge = __esm({
|
|
9509
|
+
"src/internal/components/ui/badge.tsx"() {
|
|
9510
|
+
init_cn();
|
|
9511
|
+
badgeVariants = cva2(
|
|
9512
|
+
cn2(
|
|
9513
|
+
//
|
|
9514
|
+
"inline-flex items-center",
|
|
9515
|
+
"border font-semibold",
|
|
9516
|
+
"select-none"
|
|
9517
|
+
),
|
|
9518
|
+
{
|
|
9519
|
+
variants: {
|
|
9520
|
+
variant: {
|
|
9521
|
+
outline: "border-[var(--ui-kit-bd)] bg-transparent text-[var(--ui-kit-fg)]",
|
|
9522
|
+
secondary: "border-[var(--ui-kit-secondary)] bg-[var(--ui-kit-secondary)] text-[var(--ui-kit-fg)]",
|
|
9523
|
+
destructive: "border-[var(--ui-kit-bg-error)] bg-[var(--ui-kit-bg-error)] text-[var(--ui-kit-error)]",
|
|
9524
|
+
success: "border-[var(--ui-kit-bg-success)] bg-[var(--ui-kit-bg-success)] text-[var(--ui-kit-success)]",
|
|
9525
|
+
warning: "border-[var(--ui-kit-bg-warning)] bg-[var(--ui-kit-bg-warning)] text-[var(--ui-kit-warning)]"
|
|
9526
|
+
},
|
|
9527
|
+
size: {
|
|
9528
|
+
default: "h-5 px-2 rounded-full text-[10px] gap-[var(--ui-kit-gap)]",
|
|
9529
|
+
medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] text-sm gap-[var(--ui-kit-gap)]",
|
|
9530
|
+
large: cn2(
|
|
9531
|
+
"whitespace-nowrap text-sm font-semibold font-sans",
|
|
9532
|
+
"h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]"
|
|
9533
|
+
)
|
|
9534
|
+
}
|
|
9535
|
+
},
|
|
9536
|
+
defaultVariants: {
|
|
9537
|
+
variant: "secondary"
|
|
9538
|
+
}
|
|
9539
|
+
}
|
|
9540
|
+
);
|
|
9541
|
+
}
|
|
9542
|
+
});
|
|
9543
|
+
|
|
9427
9544
|
// src/internal/components/BuyMenu/binance/config.ts
|
|
9428
9545
|
import { BSC_MAINNET_CHAIN_ID, LUMIA_MAINNET_CHAIN_ID } from "@embarkai/core/read";
|
|
9429
9546
|
var CHAIN_ID_TO_BINANCE_NETWORK_TICKER;
|
|
@@ -9439,26 +9556,35 @@ var init_config = __esm({
|
|
|
9439
9556
|
// src/internal/components/BuyMenu/binance/BinanceSummary.tsx
|
|
9440
9557
|
import { useMutation as useMutation5, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
9441
9558
|
import { InfoIcon as InfoIcon3, LoaderIcon } from "lucide-react";
|
|
9442
|
-
import { jsx as
|
|
9559
|
+
import { jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
9443
9560
|
function BinanceSummary(props) {
|
|
9444
9561
|
const { payment } = props;
|
|
9445
9562
|
const qc = useQueryClient3();
|
|
9446
9563
|
const { t } = useT();
|
|
9447
|
-
const
|
|
9564
|
+
const embarkaiAddress = useSession((st) => st.address);
|
|
9448
9565
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
9449
|
-
const {
|
|
9566
|
+
const {
|
|
9567
|
+
toWalletAddress,
|
|
9568
|
+
selectedFiat,
|
|
9569
|
+
selectedCrypto,
|
|
9570
|
+
srcQueryAmount,
|
|
9571
|
+
redirecting,
|
|
9572
|
+
confirmationMessage,
|
|
9573
|
+
setRedirecting
|
|
9574
|
+
} = useBuyMenuStore();
|
|
9450
9575
|
const quoteData = useBinanceStore((st) => st.quoteData);
|
|
9451
9576
|
const cryptoToRecieve = Number(quoteData?.totalAmount || "0");
|
|
9452
9577
|
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = useMutation5({
|
|
9453
9578
|
mutationFn: async () => {
|
|
9454
9579
|
setRedirecting(true);
|
|
9455
9580
|
return await createPreorderMutation({
|
|
9581
|
+
address: toWalletAddress || embarkaiAddress,
|
|
9456
9582
|
amountType: 1,
|
|
9457
9583
|
requestedAmount: String(srcQueryAmount),
|
|
9458
|
-
address: walletAddress,
|
|
9459
9584
|
fiatCurrency: selectedFiat,
|
|
9460
9585
|
cryptoCurrency: selectedCrypto,
|
|
9461
9586
|
network: CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainConfig.id],
|
|
9587
|
+
//
|
|
9462
9588
|
payMethodCode: payment?.payMethodCode || void 0,
|
|
9463
9589
|
payMethodSubCode: payment?.payMethodSubCode || void 0,
|
|
9464
9590
|
// TODO: pass quote response to backend to create order with exact quote details (amount, fees, etc.)
|
|
@@ -9477,8 +9603,10 @@ function BinanceSummary(props) {
|
|
|
9477
9603
|
setRedirecting(false);
|
|
9478
9604
|
qc.invalidateQueries({ queryKey: [QUERY_KEYS2.binanceTransactions] });
|
|
9479
9605
|
window.open(link, "_blank", "noopener,noreferrer");
|
|
9480
|
-
useBuyMenuStore.getState()
|
|
9481
|
-
|
|
9606
|
+
const { setError, setIsTransactionHistory, onRampWidgetRedirected } = useBuyMenuStore.getState();
|
|
9607
|
+
onRampWidgetRedirected(quoteData);
|
|
9608
|
+
setError(null);
|
|
9609
|
+
setIsTransactionHistory(true);
|
|
9482
9610
|
}, REDIRECT_TIMEOUT_MS);
|
|
9483
9611
|
}
|
|
9484
9612
|
},
|
|
@@ -9490,14 +9618,14 @@ function BinanceSummary(props) {
|
|
|
9490
9618
|
});
|
|
9491
9619
|
const isContinueDisabled = !!redirecting || !!isFundWalletOrderCheckouting || !quoteData;
|
|
9492
9620
|
if (!quoteData) {
|
|
9493
|
-
return /* @__PURE__ */
|
|
9494
|
-
/* @__PURE__ */
|
|
9495
|
-
/* @__PURE__ */
|
|
9621
|
+
return /* @__PURE__ */ jsx37("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ jsxs31(Highlight, { type: "warning", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
9622
|
+
/* @__PURE__ */ jsx37(InfoIcon3, { className: "w-4 h-4" }),
|
|
9623
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:common.errors.oops") })
|
|
9496
9624
|
] }) });
|
|
9497
9625
|
}
|
|
9498
9626
|
return /* @__PURE__ */ jsxs31("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
9499
9627
|
/* @__PURE__ */ jsxs31("div", { className: "flex justify-between text-xs leading-5", children: [
|
|
9500
|
-
/* @__PURE__ */
|
|
9628
|
+
/* @__PURE__ */ jsx37("span", { className: "", children: t("passport:common.amount") }),
|
|
9501
9629
|
/* @__PURE__ */ jsxs31("span", { className: "font-bold", children: [
|
|
9502
9630
|
formatPrice(srcQueryAmount),
|
|
9503
9631
|
" ",
|
|
@@ -9505,7 +9633,7 @@ function BinanceSummary(props) {
|
|
|
9505
9633
|
] })
|
|
9506
9634
|
] }),
|
|
9507
9635
|
/* @__PURE__ */ jsxs31("div", { className: "flex justify-between text-xs leading-5", children: [
|
|
9508
|
-
/* @__PURE__ */
|
|
9636
|
+
/* @__PURE__ */ jsx37("span", { className: "", children: t("passport:buyMenu.summary.youReceive") }),
|
|
9509
9637
|
/* @__PURE__ */ jsxs31("span", { className: "font-bold", children: [
|
|
9510
9638
|
formatPrice(cryptoToRecieve),
|
|
9511
9639
|
" ",
|
|
@@ -9514,7 +9642,7 @@ function BinanceSummary(props) {
|
|
|
9514
9642
|
] }),
|
|
9515
9643
|
/* @__PURE__ */ jsxs31(Highlight, { type: "info", className: "", children: [
|
|
9516
9644
|
/* @__PURE__ */ jsxs31("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9517
|
-
/* @__PURE__ */
|
|
9645
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.networkFee") }),
|
|
9518
9646
|
/* @__PURE__ */ jsxs31("strong", { children: [
|
|
9519
9647
|
formatPrice(Number(quoteData?.networkFee || "0")),
|
|
9520
9648
|
" ",
|
|
@@ -9522,7 +9650,7 @@ function BinanceSummary(props) {
|
|
|
9522
9650
|
] })
|
|
9523
9651
|
] }),
|
|
9524
9652
|
/* @__PURE__ */ jsxs31("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9525
|
-
/* @__PURE__ */
|
|
9653
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.serviceFee") }),
|
|
9526
9654
|
/* @__PURE__ */ jsxs31("strong", { children: [
|
|
9527
9655
|
formatPrice(Number(quoteData?.feeAmount || "0")),
|
|
9528
9656
|
" ",
|
|
@@ -9530,8 +9658,16 @@ function BinanceSummary(props) {
|
|
|
9530
9658
|
] })
|
|
9531
9659
|
] }),
|
|
9532
9660
|
/* @__PURE__ */ jsxs31("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9533
|
-
/* @__PURE__ */
|
|
9534
|
-
/* @__PURE__ */
|
|
9661
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.selectPaymentMode") }),
|
|
9662
|
+
/* @__PURE__ */ jsx37("strong", { children: payment?.paymentMethod?.toUpperCase() })
|
|
9663
|
+
] })
|
|
9664
|
+
] }),
|
|
9665
|
+
toWalletAddress && /* @__PURE__ */ jsxs31(Highlight, { type: "warning", children: [
|
|
9666
|
+
/* @__PURE__ */ jsx37("p", { className: "font-bold leading-6", children: t("passport:buyMenu.summary.toAddress.receiver") }),
|
|
9667
|
+
/* @__PURE__ */ jsx37(Badge, { variant: "secondary", size: "medium", className: "w-full text-center justify-center text-[10px]", children: /* @__PURE__ */ jsx37("span", { className: "truncate leading-4", children: toWalletAddress }) }),
|
|
9668
|
+
!!confirmationMessage ? /* @__PURE__ */ jsx37("p", { className: "leading-5", children: confirmationMessage }) : /* @__PURE__ */ jsxs31("p", { className: "leading-4", children: [
|
|
9669
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.toAddress.message") }),
|
|
9670
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.toAddress.suggestion") })
|
|
9535
9671
|
] })
|
|
9536
9672
|
] }),
|
|
9537
9673
|
/* @__PURE__ */ jsxs31(
|
|
@@ -9543,8 +9679,8 @@ function BinanceSummary(props) {
|
|
|
9543
9679
|
variant: "default",
|
|
9544
9680
|
onClick: () => checkoutFundWalletOrder(),
|
|
9545
9681
|
children: [
|
|
9546
|
-
redirecting && /* @__PURE__ */
|
|
9547
|
-
/* @__PURE__ */
|
|
9682
|
+
redirecting && /* @__PURE__ */ jsx37(LoaderIcon, { size: 16, className: "animate-spin" }),
|
|
9683
|
+
/* @__PURE__ */ jsx37("span", { children: redirecting ? "REDIRECTING..." : String(t("passport:buyMenu.actions.confirmPurchase")).toUpperCase() }),
|
|
9548
9684
|
!!quoteData?.totalAmount && /* @__PURE__ */ jsxs31("strong", { children: [
|
|
9549
9685
|
formatPrice(Number(quoteData.totalAmount)),
|
|
9550
9686
|
" ",
|
|
@@ -9561,6 +9697,7 @@ var init_BinanceSummary = __esm({
|
|
|
9561
9697
|
init_SessionContext();
|
|
9562
9698
|
init_i18n();
|
|
9563
9699
|
init_priceFormatter();
|
|
9700
|
+
init_badge();
|
|
9564
9701
|
init_button();
|
|
9565
9702
|
init_highlight();
|
|
9566
9703
|
init_contants();
|
|
@@ -9572,61 +9709,6 @@ var init_BinanceSummary = __esm({
|
|
|
9572
9709
|
}
|
|
9573
9710
|
});
|
|
9574
9711
|
|
|
9575
|
-
// src/internal/utils/cn.ts
|
|
9576
|
-
import { clsx as clsx2 } from "clsx";
|
|
9577
|
-
function cn2(...inputs) {
|
|
9578
|
-
return twMerge(clsx2(inputs));
|
|
9579
|
-
}
|
|
9580
|
-
var init_cn = __esm({
|
|
9581
|
-
"src/internal/utils/cn.ts"() {
|
|
9582
|
-
init_bundle_mjs();
|
|
9583
|
-
}
|
|
9584
|
-
});
|
|
9585
|
-
|
|
9586
|
-
// src/internal/components/ui/badge.tsx
|
|
9587
|
-
import { cva as cva2 } from "class-variance-authority";
|
|
9588
|
-
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
9589
|
-
function Badge(props) {
|
|
9590
|
-
const { className, variant = "secondary", size = "default", ...rest } = props;
|
|
9591
|
-
return /* @__PURE__ */ jsx37("span", { ...rest, className: cn2(badgeVariants({ variant, size }), className) });
|
|
9592
|
-
}
|
|
9593
|
-
var badgeVariants;
|
|
9594
|
-
var init_badge = __esm({
|
|
9595
|
-
"src/internal/components/ui/badge.tsx"() {
|
|
9596
|
-
init_cn();
|
|
9597
|
-
badgeVariants = cva2(
|
|
9598
|
-
cn2(
|
|
9599
|
-
//
|
|
9600
|
-
"inline-flex items-center",
|
|
9601
|
-
"border font-semibold",
|
|
9602
|
-
"select-none"
|
|
9603
|
-
),
|
|
9604
|
-
{
|
|
9605
|
-
variants: {
|
|
9606
|
-
variant: {
|
|
9607
|
-
outline: "border-[var(--ui-kit-bd)] bg-transparent text-[var(--ui-kit-fg)]",
|
|
9608
|
-
secondary: "border-[var(--ui-kit-secondary)] bg-[var(--ui-kit-secondary)] text-[var(--ui-kit-fg)]",
|
|
9609
|
-
destructive: "border-[var(--ui-kit-bg-error)] bg-[var(--ui-kit-bg-error)] text-[var(--ui-kit-error)]",
|
|
9610
|
-
success: "border-[var(--ui-kit-bg-success)] bg-[var(--ui-kit-bg-success)] text-[var(--ui-kit-success)]",
|
|
9611
|
-
warning: "border-[var(--ui-kit-bg-warning)] bg-[var(--ui-kit-bg-warning)] text-[var(--ui-kit-warning)]"
|
|
9612
|
-
},
|
|
9613
|
-
size: {
|
|
9614
|
-
default: "h-5 px-2 rounded-full text-[10px] gap-[var(--ui-kit-gap)]",
|
|
9615
|
-
medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] text-sm gap-[var(--ui-kit-gap)]",
|
|
9616
|
-
large: cn2(
|
|
9617
|
-
"whitespace-nowrap text-sm font-semibold font-sans",
|
|
9618
|
-
"h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]"
|
|
9619
|
-
)
|
|
9620
|
-
}
|
|
9621
|
-
},
|
|
9622
|
-
defaultVariants: {
|
|
9623
|
-
variant: "secondary"
|
|
9624
|
-
}
|
|
9625
|
-
}
|
|
9626
|
-
);
|
|
9627
|
-
}
|
|
9628
|
-
});
|
|
9629
|
-
|
|
9630
9712
|
// src/internal/components/BuyMenu/binance/statuses.ts
|
|
9631
9713
|
import { values } from "lodash-es";
|
|
9632
9714
|
var STATUS_CODE_TO_MESSAGE, STATUSES_FILTERS;
|
|
@@ -9747,7 +9829,7 @@ import { useInfiniteQuery } from "@tanstack/react-query";
|
|
|
9747
9829
|
import dayjs from "dayjs";
|
|
9748
9830
|
import { debounce as debounce4 } from "lodash-es";
|
|
9749
9831
|
import { DownloadIcon, ExternalLinkIcon, LoaderIcon as LoaderIcon2 } from "lucide-react";
|
|
9750
|
-
import { useCallback as useCallback12, useEffect as
|
|
9832
|
+
import { useCallback as useCallback12, useEffect as useEffect13, useMemo as useMemo4 } from "react";
|
|
9751
9833
|
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
9752
9834
|
function getStatusVariant(status) {
|
|
9753
9835
|
switch (status) {
|
|
@@ -9888,7 +9970,7 @@ function BinanceTxHistory() {
|
|
|
9888
9970
|
}, 200),
|
|
9889
9971
|
[]
|
|
9890
9972
|
);
|
|
9891
|
-
|
|
9973
|
+
useEffect13(() => {
|
|
9892
9974
|
if (isTxDataLoading || !txList?.length || txList.length > 10) return;
|
|
9893
9975
|
updateExpandable();
|
|
9894
9976
|
}, [isTxDataLoading, txList]);
|
|
@@ -9935,11 +10017,11 @@ var init_BinanceTxHistory = __esm({
|
|
|
9935
10017
|
|
|
9936
10018
|
// src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts
|
|
9937
10019
|
import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
9938
|
-
import { useEffect as
|
|
10020
|
+
import { useEffect as useEffect14, useRef as useRef10 } from "react";
|
|
9939
10021
|
function useBinanceSseTxTracing(walletAddress) {
|
|
9940
10022
|
const qc = useQueryClient4();
|
|
9941
|
-
const debounceRef =
|
|
9942
|
-
|
|
10023
|
+
const debounceRef = useRef10(null);
|
|
10024
|
+
useEffect14(() => {
|
|
9943
10025
|
if (!walletAddress) return;
|
|
9944
10026
|
const iframeManager = getIframeManager();
|
|
9945
10027
|
if (!iframeManager) return;
|
|
@@ -9981,7 +10063,7 @@ var init_utils6 = __esm({
|
|
|
9981
10063
|
// src/internal/components/BuyMenu/binance/Binance.tsx
|
|
9982
10064
|
import { useMutation as useMutation6, useQuery as useQuery2, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
9983
10065
|
import { LoaderIcon as LoaderIcon3 } from "lucide-react";
|
|
9984
|
-
import { useEffect as
|
|
10066
|
+
import { useEffect as useEffect15 } from "react";
|
|
9985
10067
|
import { Fragment as Fragment11, jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9986
10068
|
function Binance() {
|
|
9987
10069
|
const qc = useQueryClient5();
|
|
@@ -10003,7 +10085,7 @@ function Binance() {
|
|
|
10003
10085
|
} = useBuyMenuStore();
|
|
10004
10086
|
const paymentMode = useBinanceStore((st) => st.paymentMode);
|
|
10005
10087
|
const isCurrurenciesSelected = !!selectedCrypto && !!selectedFiat;
|
|
10006
|
-
|
|
10088
|
+
useEffect15(() => {
|
|
10007
10089
|
if (!isCurrurenciesSelected) return;
|
|
10008
10090
|
useBuyMenuStore.getState().setRenderKey(`${selectedCrypto}-${selectedFiat}-${Date.now()}`);
|
|
10009
10091
|
}, [isCurrurenciesSelected]);
|
|
@@ -10038,7 +10120,7 @@ function Binance() {
|
|
|
10038
10120
|
});
|
|
10039
10121
|
const paymentModes = paymentModesData?.data?.paymentMethods || [];
|
|
10040
10122
|
const selectedPaymentMode = paymentModes?.find((el) => getPayMethodID(el) === paymentMode) || null;
|
|
10041
|
-
|
|
10123
|
+
useEffect15(() => {
|
|
10042
10124
|
useBuyMenuStore.getState().setMinAmount(Number(selectedPaymentMode?.fiatMinLimit || "0"));
|
|
10043
10125
|
}, [selectedPaymentMode]);
|
|
10044
10126
|
const { mutate: estimateQuote, isPending: isQuoteEstimating } = useMutation6({
|
|
@@ -10066,21 +10148,22 @@ function Binance() {
|
|
|
10066
10148
|
}
|
|
10067
10149
|
});
|
|
10068
10150
|
const availableFiats = (tradingPairsData?.data?.fiatCurrencies || []).map((ticker) => ({ ticker }));
|
|
10069
|
-
|
|
10151
|
+
useEffect15(() => {
|
|
10070
10152
|
if (!!selectedFiat || !availableFiats?.length) return;
|
|
10071
|
-
const targetFiat = availableFiats.find((item) =>
|
|
10153
|
+
const targetFiat = availableFiats.find((item) => PREFERRED_FIATS.includes(item.ticker)) || availableFiats[0];
|
|
10072
10154
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10073
10155
|
}, [availableFiats, selectedFiat]);
|
|
10074
|
-
|
|
10156
|
+
useEffect15(() => {
|
|
10075
10157
|
if (!!selectedCrypto || !networkAvailableCryptoList?.length) return;
|
|
10076
|
-
|
|
10158
|
+
const targetCrypto = networkAvailableCryptoList.find((item) => PREFERRED_CRYPTOS.includes(item.cryptoCurrency)) || networkAvailableCryptoList[0];
|
|
10159
|
+
useBuyMenuStore.getState().setSelectedCrypto(targetCrypto.cryptoCurrency);
|
|
10077
10160
|
}, [networkAvailableCryptoList, selectedCrypto]);
|
|
10078
|
-
|
|
10161
|
+
useEffect15(() => {
|
|
10079
10162
|
if (!!paymentMode || !paymentModes.length) return;
|
|
10080
10163
|
const targetPaymentMode = paymentModes.find((item) => item.payMethodCode === PREFERRED_PAYMENT_METHOD) || paymentModes[0];
|
|
10081
10164
|
useBinanceStore.getState().setPaymentMode(getPayMethodID(targetPaymentMode));
|
|
10082
10165
|
}, [paymentModes]);
|
|
10083
|
-
|
|
10166
|
+
useEffect15(() => {
|
|
10084
10167
|
return () => {
|
|
10085
10168
|
useBinanceStore.getState().setPaymentMode(null);
|
|
10086
10169
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binanceTradingPairs] });
|
|
@@ -10202,7 +10285,7 @@ function Binance() {
|
|
|
10202
10285
|
)
|
|
10203
10286
|
] });
|
|
10204
10287
|
}
|
|
10205
|
-
var PREFERRED_PAYMENT_METHOD;
|
|
10288
|
+
var PREFERRED_PAYMENT_METHOD, PREFERRED_FIATS, PREFERRED_CRYPTOS;
|
|
10206
10289
|
var init_Binance = __esm({
|
|
10207
10290
|
"src/internal/components/BuyMenu/binance/Binance.tsx"() {
|
|
10208
10291
|
init_utils2();
|
|
@@ -10223,6 +10306,8 @@ var init_Binance = __esm({
|
|
|
10223
10306
|
init_useBinanceStore();
|
|
10224
10307
|
init_utils6();
|
|
10225
10308
|
PREFERRED_PAYMENT_METHOD = "BUY_CARD";
|
|
10309
|
+
PREFERRED_FIATS = ["USD", "EUR"];
|
|
10310
|
+
PREFERRED_CRYPTOS = ["USDT", "LUMIA"];
|
|
10226
10311
|
}
|
|
10227
10312
|
});
|
|
10228
10313
|
|
|
@@ -10589,11 +10674,11 @@ var init_networks = __esm({
|
|
|
10589
10674
|
|
|
10590
10675
|
// src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts
|
|
10591
10676
|
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
10592
|
-
import { useEffect as
|
|
10677
|
+
import { useEffect as useEffect16, useRef as useRef11 } from "react";
|
|
10593
10678
|
function useFinchpaySseTxTracing(walletAddress) {
|
|
10594
10679
|
const qc = useQueryClient6();
|
|
10595
|
-
const debounceRef =
|
|
10596
|
-
|
|
10680
|
+
const debounceRef = useRef11(null);
|
|
10681
|
+
useEffect16(() => {
|
|
10597
10682
|
if (!walletAddress) return;
|
|
10598
10683
|
const iframeManager = getIframeManager();
|
|
10599
10684
|
if (!iframeManager) return;
|
|
@@ -10642,7 +10727,7 @@ var init_utils7 = __esm({
|
|
|
10642
10727
|
// src/internal/components/BuyMenu/finchpay/FinchPay.tsx
|
|
10643
10728
|
import { useQuery as useQuery3, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
10644
10729
|
import { DollarSign, LoaderIcon as LoaderIcon5 } from "lucide-react";
|
|
10645
|
-
import { useEffect as
|
|
10730
|
+
import { useEffect as useEffect17 } from "react";
|
|
10646
10731
|
import { Fragment as Fragment12, jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10647
10732
|
function FinchPay() {
|
|
10648
10733
|
const qc = useQueryClient7();
|
|
@@ -10718,11 +10803,11 @@ function FinchPay() {
|
|
|
10718
10803
|
})
|
|
10719
10804
|
});
|
|
10720
10805
|
const minimum = Number(limitsData?.min_amount || "0");
|
|
10721
|
-
|
|
10806
|
+
useEffect17(() => {
|
|
10722
10807
|
if (minimum <= 0) return;
|
|
10723
10808
|
useBuyMenuStore.getState().setMinAmount(minimum);
|
|
10724
10809
|
}, [minimum]);
|
|
10725
|
-
|
|
10810
|
+
useEffect17(() => {
|
|
10726
10811
|
if (srcInputAmount >= minimum) return;
|
|
10727
10812
|
useBuyMenuStore.getState().setRenderKey(`finchpay-input-minimum-warning-${Date.now()}`);
|
|
10728
10813
|
}, [minimum, srcInputAmount]);
|
|
@@ -10750,23 +10835,23 @@ function FinchPay() {
|
|
|
10750
10835
|
// defaults to CARD estimation, widgetUrl
|
|
10751
10836
|
})
|
|
10752
10837
|
});
|
|
10753
|
-
|
|
10838
|
+
useEffect17(() => {
|
|
10754
10839
|
const { error: errorTitle, message: errorMessage } = handleErrors([currenciesError, limitsError, estimateError]);
|
|
10755
10840
|
if (!errorTitle && !errorMessage) return;
|
|
10756
10841
|
console.error(`[BuyModal][Binance] ${errorTitle}: ${errorMessage}`);
|
|
10757
10842
|
useBuyMenuStore.getState().setError(errorMessage);
|
|
10758
10843
|
}, [currenciesError, limitsError, estimateError]);
|
|
10759
|
-
|
|
10844
|
+
useEffect17(() => {
|
|
10760
10845
|
if (!!selectedFiat || currenciesData.fiats.length === 0) return;
|
|
10761
10846
|
const fallbackFiat = currenciesData.fiats[0];
|
|
10762
10847
|
const targetFiat = currenciesData.fiats.find((f) => f.ticker.toUpperCase() === "USD") || fallbackFiat;
|
|
10763
10848
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10764
10849
|
}, [currenciesData, selectedFiat]);
|
|
10765
|
-
|
|
10850
|
+
useEffect17(() => {
|
|
10766
10851
|
if (!!selectedCrypto || currenciesData.currentNetworkCoins.length === 0) return;
|
|
10767
10852
|
useBuyMenuStore.getState().setSelectedCrypto(currenciesData.currentNetworkCoins[0].ticker);
|
|
10768
10853
|
}, [currenciesData, selectedCrypto]);
|
|
10769
|
-
|
|
10854
|
+
useEffect17(() => {
|
|
10770
10855
|
return () => {
|
|
10771
10856
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayCurrencies] });
|
|
10772
10857
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayLimits] });
|
|
@@ -11019,62 +11104,44 @@ var init_ProviderSelector = __esm({
|
|
|
11019
11104
|
}
|
|
11020
11105
|
});
|
|
11021
11106
|
|
|
11022
|
-
// src/internal/utils/debounce.ts
|
|
11023
|
-
function debounce5(func, waitFor) {
|
|
11024
|
-
let timeout;
|
|
11025
|
-
return (...args) => {
|
|
11026
|
-
if (timeout) clearTimeout(timeout);
|
|
11027
|
-
timeout = setTimeout(() => func(...args), waitFor);
|
|
11028
|
-
};
|
|
11029
|
-
}
|
|
11030
|
-
var init_debounce = __esm({
|
|
11031
|
-
"src/internal/utils/debounce.ts"() {
|
|
11032
|
-
}
|
|
11033
|
-
});
|
|
11034
|
-
|
|
11035
11107
|
// src/internal/components/BuyMenu/useHandleInputAmount.ts
|
|
11036
|
-
import {
|
|
11108
|
+
import { useEffect as useEffect18, useRef as useRef12 } from "react";
|
|
11037
11109
|
var ON_INPUT_QUERY_DELAY, useHandleInputAmount;
|
|
11038
11110
|
var init_useHandleInputAmount = __esm({
|
|
11039
11111
|
"src/internal/components/BuyMenu/useHandleInputAmount.ts"() {
|
|
11040
|
-
init_debounce();
|
|
11041
11112
|
init_contants();
|
|
11042
11113
|
init_useBuyMenuStore();
|
|
11043
11114
|
ON_INPUT_QUERY_DELAY = 1500;
|
|
11044
11115
|
useHandleInputAmount = () => {
|
|
11045
|
-
const lastRampProviderRef =
|
|
11116
|
+
const lastRampProviderRef = useRef12(DEFAULT_PROVIDER2);
|
|
11046
11117
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
11047
11118
|
const srcInputAmount = useBuyMenuStore((st) => st.srcInputAmount);
|
|
11048
11119
|
const minAmount = useBuyMenuStore((st) => st.minAmount);
|
|
11049
|
-
const
|
|
11050
|
-
|
|
11051
|
-
|
|
11120
|
+
const queryAmountTimer = useRef12(null);
|
|
11121
|
+
useEffect18(() => {
|
|
11122
|
+
if (queryAmountTimer.current) clearTimeout(queryAmountTimer.current);
|
|
11123
|
+
queryAmountTimer.current = setTimeout(() => {
|
|
11124
|
+
const checkedValue = Math.ceil(Math.max(Number(srcInputAmount), Number(minAmount)));
|
|
11052
11125
|
useBuyMenuStore.getState().setSrcInputAmount(checkedValue);
|
|
11053
11126
|
useBuyMenuStore.getState().setSrcQueryAmount(checkedValue);
|
|
11054
|
-
}, ON_INPUT_QUERY_DELAY)
|
|
11055
|
-
|
|
11056
|
-
)
|
|
11057
|
-
useEffect17(() => setQueryAmountDebounced(srcInputAmount), [srcInputAmount, setQueryAmountDebounced]);
|
|
11058
|
-
useEffect17(() => {
|
|
11127
|
+
}, ON_INPUT_QUERY_DELAY);
|
|
11128
|
+
}, [minAmount, srcInputAmount]);
|
|
11129
|
+
useEffect18(() => {
|
|
11059
11130
|
if (lastRampProviderRef.current === rampProvider) return;
|
|
11060
11131
|
const {
|
|
11061
11132
|
setIsProviderSummary,
|
|
11062
11133
|
setIsCryptoSelector,
|
|
11063
11134
|
setIsFiatSelector,
|
|
11064
|
-
setIsPaymentModeSelector
|
|
11065
|
-
setSelectedCrypto,
|
|
11066
|
-
setSelectedFiat
|
|
11067
|
-
setSrcInputAmount,
|
|
11068
|
-
setSrcQueryAmount
|
|
11135
|
+
setIsPaymentModeSelector
|
|
11136
|
+
// setSelectedCrypto,
|
|
11137
|
+
// setSelectedFiat
|
|
11138
|
+
// setSrcInputAmount,
|
|
11139
|
+
// setSrcQueryAmount
|
|
11069
11140
|
} = useBuyMenuStore.getState();
|
|
11070
11141
|
setIsProviderSummary(false);
|
|
11071
11142
|
setIsCryptoSelector(false);
|
|
11072
11143
|
setIsFiatSelector(false);
|
|
11073
11144
|
setIsPaymentModeSelector(false);
|
|
11074
|
-
setSelectedCrypto(null);
|
|
11075
|
-
setSelectedFiat(null);
|
|
11076
|
-
setSrcInputAmount(0);
|
|
11077
|
-
setSrcQueryAmount(0);
|
|
11078
11145
|
lastRampProviderRef.current = rampProvider;
|
|
11079
11146
|
}, [rampProvider]);
|
|
11080
11147
|
};
|
|
@@ -11087,8 +11154,8 @@ import { Fragment as Fragment14, jsx as jsx44, jsxs as jsxs38 } from "react/jsx-
|
|
|
11087
11154
|
function BuyMenu() {
|
|
11088
11155
|
const { t } = useT();
|
|
11089
11156
|
const walletAddress = useSession((st) => st.address);
|
|
11090
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11091
11157
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11158
|
+
useBuyMenuParams();
|
|
11092
11159
|
useHandleInputAmount();
|
|
11093
11160
|
const renderKey = useBuyMenuStore((st) => st.renderKey);
|
|
11094
11161
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
@@ -11154,7 +11221,7 @@ function BuyMenu() {
|
|
|
11154
11221
|
setIsPaymentModeSelector(false);
|
|
11155
11222
|
return;
|
|
11156
11223
|
}
|
|
11157
|
-
setPage("main-menu" /* MAIN_MENU */);
|
|
11224
|
+
useLayoutDataStore.getState().setPage("main-menu" /* MAIN_MENU */);
|
|
11158
11225
|
},
|
|
11159
11226
|
children: /* @__PURE__ */ jsx44(ArrowLeft3, { className: "h-4 w-4" })
|
|
11160
11227
|
}
|
|
@@ -11432,7 +11499,7 @@ var init_truncateMiddle = __esm({
|
|
|
11432
11499
|
// src/internal/components/ChainsMenu/ChainItem.tsx
|
|
11433
11500
|
import { getChainConfig as getChainConfig7 } from "@embarkai/core/read";
|
|
11434
11501
|
import { Copy, ExternalLink, Loader as Loader6 } from "lucide-react";
|
|
11435
|
-
import { useRef as
|
|
11502
|
+
import { useRef as useRef13, useState as useState9 } from "react";
|
|
11436
11503
|
import { jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
11437
11504
|
function getPaymasterExplorerUrl(chainId, paymasterAddress) {
|
|
11438
11505
|
const chainConfig = getChainConfig7(chainId);
|
|
@@ -11455,7 +11522,7 @@ function ChainItem(props) {
|
|
|
11455
11522
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
11456
11523
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
11457
11524
|
const [copiedChainId, setCopiedChainId] = useState9(null);
|
|
11458
|
-
const copiedResetTimerRef =
|
|
11525
|
+
const copiedResetTimerRef = useRef13(null);
|
|
11459
11526
|
const isActiveChain = activeChainId === chainId;
|
|
11460
11527
|
const paymasterAddress = isActiveChain ? activePaymasterData?.address : null;
|
|
11461
11528
|
const paymasterExplorerUrl = paymasterAddress ? getPaymasterExplorerUrl(chainId, paymasterAddress) : null;
|
|
@@ -12427,7 +12494,7 @@ var init_guardian_backup = __esm({
|
|
|
12427
12494
|
});
|
|
12428
12495
|
|
|
12429
12496
|
// src/internal/components/DevicesMenu/DeviceManageScreen.tsx
|
|
12430
|
-
import { useCallback as
|
|
12497
|
+
import { useCallback as useCallback14, useEffect as useEffect19, useRef as useRef14, useState as useState12 } from "react";
|
|
12431
12498
|
import { ArrowLeft as ArrowLeft7, Cpu, Download, HardDrive, Loader2 as Loader23, Trash2, Upload } from "lucide-react";
|
|
12432
12499
|
import { Fragment as Fragment15, jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
12433
12500
|
function formatSize(bytes) {
|
|
@@ -12442,19 +12509,19 @@ function DeviceManageScreen() {
|
|
|
12442
12509
|
const userId = session?.mpcUserId || "";
|
|
12443
12510
|
const deviceId = pageParams?.deviceId;
|
|
12444
12511
|
const deviceName = pageParams?.deviceName;
|
|
12445
|
-
const guardianRef =
|
|
12512
|
+
const guardianRef = useRef14(null);
|
|
12446
12513
|
const [screen, setScreen] = useState12({ step: "connecting" });
|
|
12447
12514
|
const [actionState, setActionState] = useState12(null);
|
|
12448
12515
|
const [password, setPassword] = useState12("");
|
|
12449
12516
|
const [statusMessage, setStatusMessage] = useState12(null);
|
|
12450
12517
|
const [errorMessage, setErrorMessage] = useState12(null);
|
|
12451
12518
|
const [waitingConfirm, setWaitingConfirm] = useState12(false);
|
|
12452
|
-
|
|
12519
|
+
useEffect19(() => {
|
|
12453
12520
|
if (!statusMessage) return;
|
|
12454
12521
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
12455
12522
|
return () => clearTimeout(t);
|
|
12456
12523
|
}, [statusMessage]);
|
|
12457
|
-
|
|
12524
|
+
useEffect19(() => {
|
|
12458
12525
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
12459
12526
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
12460
12527
|
return;
|
|
@@ -12486,7 +12553,7 @@ function DeviceManageScreen() {
|
|
|
12486
12553
|
guardianRef.current?.close();
|
|
12487
12554
|
};
|
|
12488
12555
|
}, [deviceId]);
|
|
12489
|
-
const refreshList =
|
|
12556
|
+
const refreshList = useCallback14(async () => {
|
|
12490
12557
|
const guardian = guardianRef.current;
|
|
12491
12558
|
if (!guardian || screen.step !== "connected") return;
|
|
12492
12559
|
try {
|
|
@@ -12495,7 +12562,7 @@ function DeviceManageScreen() {
|
|
|
12495
12562
|
} catch {
|
|
12496
12563
|
}
|
|
12497
12564
|
}, [screen]);
|
|
12498
|
-
const handleBackup =
|
|
12565
|
+
const handleBackup = useCallback14(async () => {
|
|
12499
12566
|
const guardian = guardianRef.current;
|
|
12500
12567
|
const iframe4 = getIframeManager();
|
|
12501
12568
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12519,7 +12586,7 @@ function DeviceManageScreen() {
|
|
|
12519
12586
|
setActionState(null);
|
|
12520
12587
|
}
|
|
12521
12588
|
}, [password, userId, refreshList]);
|
|
12522
|
-
const handleOverwrite =
|
|
12589
|
+
const handleOverwrite = useCallback14(async () => {
|
|
12523
12590
|
const guardian = guardianRef.current;
|
|
12524
12591
|
const iframe4 = getIframeManager();
|
|
12525
12592
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12539,7 +12606,7 @@ function DeviceManageScreen() {
|
|
|
12539
12606
|
setActionState(null);
|
|
12540
12607
|
}
|
|
12541
12608
|
}, [password, userId, refreshList]);
|
|
12542
|
-
const handleDelete =
|
|
12609
|
+
const handleDelete = useCallback14(async (keyshareId) => {
|
|
12543
12610
|
const guardian = guardianRef.current;
|
|
12544
12611
|
if (!guardian) return;
|
|
12545
12612
|
setActionState({ action: "delete", keyshareId, substep: "confirm-device" });
|
|
@@ -12719,7 +12786,7 @@ var init_DeviceManageScreen = __esm({
|
|
|
12719
12786
|
});
|
|
12720
12787
|
|
|
12721
12788
|
// src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx
|
|
12722
|
-
import { useCallback as
|
|
12789
|
+
import { useCallback as useCallback15, useState as useState13 } from "react";
|
|
12723
12790
|
import { AlertTriangle as AlertTriangle3, ArrowLeft as ArrowLeft8, Download as Download2, Loader2 as Loader24 } from "lucide-react";
|
|
12724
12791
|
import { Fragment as Fragment16, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
12725
12792
|
function DeviceRestoreScreen() {
|
|
@@ -12735,7 +12802,7 @@ function DeviceRestoreScreen() {
|
|
|
12735
12802
|
const [isWorking, setIsWorking] = useState13(false);
|
|
12736
12803
|
const [statusMessage, setStatusMessage] = useState13(null);
|
|
12737
12804
|
const [errorMessage, setErrorMessage] = useState13(null);
|
|
12738
|
-
const handleRestore =
|
|
12805
|
+
const handleRestore = useCallback15(async () => {
|
|
12739
12806
|
if (!password || !keyshareId || !userId) return;
|
|
12740
12807
|
const iframe4 = getIframeManager();
|
|
12741
12808
|
if (!iframe4) {
|
|
@@ -13039,7 +13106,7 @@ var init_useRestoreStore = __esm({
|
|
|
13039
13106
|
});
|
|
13040
13107
|
|
|
13041
13108
|
// src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts
|
|
13042
|
-
import { useCallback as
|
|
13109
|
+
import { useCallback as useCallback16 } from "react";
|
|
13043
13110
|
function useOnRestoreSuccess() {
|
|
13044
13111
|
const { config, callbacksRef } = useProviderConfig();
|
|
13045
13112
|
const setIsDialogForced = useLayoutStore((st) => st.setIsDialogForced);
|
|
@@ -13055,7 +13122,7 @@ function useOnRestoreSuccess() {
|
|
|
13055
13122
|
setStatus
|
|
13056
13123
|
} = useSession();
|
|
13057
13124
|
const { setError, setSuccess } = useRestoreStore();
|
|
13058
|
-
const createSessionWithKeyshare =
|
|
13125
|
+
const createSessionWithKeyshare = useCallback16(
|
|
13059
13126
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
13060
13127
|
try {
|
|
13061
13128
|
try {
|
|
@@ -13096,7 +13163,7 @@ function useOnRestoreSuccess() {
|
|
|
13096
13163
|
},
|
|
13097
13164
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
13098
13165
|
);
|
|
13099
|
-
const onRestoreSuccess =
|
|
13166
|
+
const onRestoreSuccess = useCallback16(async () => {
|
|
13100
13167
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
13101
13168
|
const verify = await verifyToken2();
|
|
13102
13169
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -13582,7 +13649,7 @@ var init_cloudStorage = __esm({
|
|
|
13582
13649
|
|
|
13583
13650
|
// src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts
|
|
13584
13651
|
import { useMutation as useMutation9, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
13585
|
-
import { useCallback as
|
|
13652
|
+
import { useCallback as useCallback17, useEffect as useEffect20 } from "react";
|
|
13586
13653
|
function useCreateBackup() {
|
|
13587
13654
|
const qc = useQueryClient9();
|
|
13588
13655
|
const session = useSession((st) => st.session);
|
|
@@ -13591,7 +13658,7 @@ function useCreateBackup() {
|
|
|
13591
13658
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
13592
13659
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
13593
13660
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
13594
|
-
|
|
13661
|
+
useEffect20(() => {
|
|
13595
13662
|
if (!hasServerVault) {
|
|
13596
13663
|
useRestoreStore.getState().setMethod("server");
|
|
13597
13664
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -13599,7 +13666,7 @@ function useCreateBackup() {
|
|
|
13599
13666
|
}, [hasServerVault]);
|
|
13600
13667
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
13601
13668
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
13602
|
-
const onBackupSuccess =
|
|
13669
|
+
const onBackupSuccess = useCallback17(() => {
|
|
13603
13670
|
console.log("[EMBARKAI BACKUP] Backup created successfully");
|
|
13604
13671
|
}, [hasServerVault]);
|
|
13605
13672
|
const { mutate: createPasswordBackup, isPending: isPasswordBackupCreating } = useMutation9({
|
|
@@ -13886,7 +13953,7 @@ var init_useRestoreAccount = __esm({
|
|
|
13886
13953
|
});
|
|
13887
13954
|
|
|
13888
13955
|
// src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts
|
|
13889
|
-
import { useEffect as
|
|
13956
|
+
import { useEffect as useEffect21 } from "react";
|
|
13890
13957
|
function validateRestoreFileFormat(parsedData) {
|
|
13891
13958
|
if (typeof parsedData !== "object" || parsedData === null) return false;
|
|
13892
13959
|
const data = parsedData;
|
|
@@ -13896,7 +13963,7 @@ function useValidateFileBackup() {
|
|
|
13896
13963
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
13897
13964
|
const setError = useRestoreStore((st) => st.setError);
|
|
13898
13965
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
13899
|
-
|
|
13966
|
+
useEffect21(() => {
|
|
13900
13967
|
if (!restoreFile) {
|
|
13901
13968
|
return;
|
|
13902
13969
|
}
|
|
@@ -14022,7 +14089,7 @@ var init_MethodSelector = __esm({
|
|
|
14022
14089
|
|
|
14023
14090
|
// src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx
|
|
14024
14091
|
import { ChevronRight as ChevronRight2, Eye, EyeOff, Info as Info3, Key as Key4, Loader as Loader8, Plus } from "lucide-react";
|
|
14025
|
-
import { useEffect as
|
|
14092
|
+
import { useEffect as useEffect22, useRef as useRef15 } from "react";
|
|
14026
14093
|
import { Fragment as Fragment18, jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
14027
14094
|
function PasswordPasskey(props) {
|
|
14028
14095
|
const { t } = useT();
|
|
@@ -14037,7 +14104,7 @@ function PasswordPasskey(props) {
|
|
|
14037
14104
|
onCreatePasskey
|
|
14038
14105
|
} = props;
|
|
14039
14106
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
14040
|
-
const actionRef =
|
|
14107
|
+
const actionRef = useRef15(null);
|
|
14041
14108
|
const {
|
|
14042
14109
|
showPassword,
|
|
14043
14110
|
restorePassword,
|
|
@@ -14051,7 +14118,7 @@ function PasswordPasskey(props) {
|
|
|
14051
14118
|
} = useRestoreStore();
|
|
14052
14119
|
const { config } = useProviderConfig();
|
|
14053
14120
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
14054
|
-
|
|
14121
|
+
useEffect22(() => {
|
|
14055
14122
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
14056
14123
|
}, [isPasskeyEnabled, usePasskey]);
|
|
14057
14124
|
return /* @__PURE__ */ jsxs53(Fragment18, { children: [
|
|
@@ -14379,7 +14446,7 @@ var init_File = __esm({
|
|
|
14379
14446
|
import { useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
14380
14447
|
import dayjs3 from "dayjs";
|
|
14381
14448
|
import { Download as Download3, Key as Key5, Upload as Upload3 } from "lucide-react";
|
|
14382
|
-
import { useEffect as
|
|
14449
|
+
import { useEffect as useEffect23 } from "react";
|
|
14383
14450
|
import { Fragment as Fragment21, jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
14384
14451
|
function Server(props) {
|
|
14385
14452
|
const { isLoading, mode = "restore", serverHandler, createPasskeyHandler } = props;
|
|
@@ -14389,7 +14456,7 @@ function Server(props) {
|
|
|
14389
14456
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
14390
14457
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
14391
14458
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
14392
|
-
|
|
14459
|
+
useEffect23(() => {
|
|
14393
14460
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
14394
14461
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
14395
14462
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -14572,7 +14639,7 @@ var init_select = __esm({
|
|
|
14572
14639
|
// src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx
|
|
14573
14640
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
14574
14641
|
import { ArrowLeft as ArrowLeft10, CloudDownload, CloudUpload, Loader as Loader9 } from "lucide-react";
|
|
14575
|
-
import { useEffect as
|
|
14642
|
+
import { useEffect as useEffect24 } from "react";
|
|
14576
14643
|
import { Fragment as Fragment22, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
14577
14644
|
function Cloud2(props) {
|
|
14578
14645
|
const { isLoading, mode = "restore", cloudHandler } = props;
|
|
@@ -14593,7 +14660,7 @@ function Cloud2(props) {
|
|
|
14593
14660
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
14594
14661
|
}
|
|
14595
14662
|
});
|
|
14596
|
-
|
|
14663
|
+
useEffect24(() => {
|
|
14597
14664
|
if (isCloudProvidersLoading) return;
|
|
14598
14665
|
if (!!cloudProvidersError) {
|
|
14599
14666
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -14833,7 +14900,7 @@ var init_methods = __esm({
|
|
|
14833
14900
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
14834
14901
|
import { useMutation as useMutation11, useQuery as useQuery7, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
14835
14902
|
import { AlertCircle as AlertCircle2, CheckCircle2, CloudDownload as CloudDownload2, Loader as Loader10, UserCircle as UserCircle2 } from "lucide-react";
|
|
14836
|
-
import { useEffect as
|
|
14903
|
+
import { useEffect as useEffect25 } from "react";
|
|
14837
14904
|
import { useDisconnect } from "wagmi";
|
|
14838
14905
|
import { Fragment as Fragment24, jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
14839
14906
|
var RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
@@ -14870,7 +14937,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14870
14937
|
const error = useRestoreStore((st) => st.error);
|
|
14871
14938
|
const success = useRestoreStore((st) => st.success);
|
|
14872
14939
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
14873
|
-
|
|
14940
|
+
useEffect25(() => {
|
|
14874
14941
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
14875
14942
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
14876
14943
|
setIsDialogForced(true);
|
|
@@ -14910,7 +14977,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14910
14977
|
queryFn: async () => await getShareRecoveryStats()
|
|
14911
14978
|
});
|
|
14912
14979
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
14913
|
-
|
|
14980
|
+
useEffect25(() => {
|
|
14914
14981
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
14915
14982
|
}, [hasServerBackup]);
|
|
14916
14983
|
const { mutate: disconnect, isPending: isDisconnecting } = useMutation11({
|
|
@@ -15057,7 +15124,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15057
15124
|
// src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx
|
|
15058
15125
|
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
15059
15126
|
import { AlertCircle as AlertCircle3, ArrowLeft as ArrowLeft11, CheckCircle2 as CheckCircle22, Loader as Loader11, LockIcon } from "lucide-react";
|
|
15060
|
-
import { useEffect as
|
|
15127
|
+
import { useEffect as useEffect26 } from "react";
|
|
15061
15128
|
import { Fragment as Fragment25, jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
15062
15129
|
function KeyshareBackupMenu() {
|
|
15063
15130
|
const address = useSession((st) => st.address);
|
|
@@ -15068,7 +15135,7 @@ function KeyshareBackupMenu() {
|
|
|
15068
15135
|
const currentBackupMethod = useRestoreStore((st) => st.method);
|
|
15069
15136
|
const error = useRestoreStore((st) => st.error);
|
|
15070
15137
|
const success = useRestoreStore((st) => st.success);
|
|
15071
|
-
|
|
15138
|
+
useEffect26(() => {
|
|
15072
15139
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15073
15140
|
return () => {
|
|
15074
15141
|
setSuccess(null);
|
|
@@ -15087,7 +15154,7 @@ function KeyshareBackupMenu() {
|
|
|
15087
15154
|
queryFn: async () => await getShareRecoveryStats()
|
|
15088
15155
|
});
|
|
15089
15156
|
const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15090
|
-
|
|
15157
|
+
useEffect26(() => {
|
|
15091
15158
|
if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
|
|
15092
15159
|
}, [hasRecoveryData]);
|
|
15093
15160
|
const {
|
|
@@ -15240,7 +15307,7 @@ var init_KeyshareRestoreMenu2 = __esm({
|
|
|
15240
15307
|
});
|
|
15241
15308
|
|
|
15242
15309
|
// src/hooks/useColorMode.ts
|
|
15243
|
-
import { useCallback as
|
|
15310
|
+
import { useCallback as useCallback18, useEffect as useEffect27 } from "react";
|
|
15244
15311
|
function useColorMode() {
|
|
15245
15312
|
const {
|
|
15246
15313
|
config: { current: config }
|
|
@@ -15248,14 +15315,14 @@ function useColorMode() {
|
|
|
15248
15315
|
const preferedColorMode = config?.preferedColorMode;
|
|
15249
15316
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
15250
15317
|
const handleStoreColorMode = useLayoutStore((st) => st.setColorMode);
|
|
15251
|
-
const setColorMode =
|
|
15318
|
+
const setColorMode = useCallback18(
|
|
15252
15319
|
(mode) => {
|
|
15253
15320
|
localStorage.setItem(LOCAL_COLOR_MODE_KEY, mode);
|
|
15254
15321
|
handleStoreColorMode(mode);
|
|
15255
15322
|
},
|
|
15256
15323
|
[handleStoreColorMode]
|
|
15257
15324
|
);
|
|
15258
|
-
|
|
15325
|
+
useEffect27(() => {
|
|
15259
15326
|
let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
|
|
15260
15327
|
if (!targetColorMode && !preferedColorMode) {
|
|
15261
15328
|
const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -15370,17 +15437,17 @@ var init_SumsubIframeManager = __esm({
|
|
|
15370
15437
|
});
|
|
15371
15438
|
|
|
15372
15439
|
// src/internal/components/KYC/useSumsubIframe.ts
|
|
15373
|
-
import { useEffect as
|
|
15440
|
+
import { useEffect as useEffect28, useRef as useRef16, useState as useState17 } from "react";
|
|
15374
15441
|
function useSumsubIframe({ iframeUrl }) {
|
|
15375
15442
|
const config = useProviderConfig().config;
|
|
15376
15443
|
const { colorMode } = useColorMode();
|
|
15377
|
-
const iframeRef =
|
|
15444
|
+
const iframeRef = useRef16(null);
|
|
15378
15445
|
const [isLoading, setIsLoading] = useState17(true);
|
|
15379
15446
|
const [error, setError] = useState17(null);
|
|
15380
15447
|
const [height, setHeight] = useState17(0);
|
|
15381
15448
|
const [status, setStatus] = useState17("");
|
|
15382
15449
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
15383
|
-
|
|
15450
|
+
useEffect28(() => {
|
|
15384
15451
|
setError(null);
|
|
15385
15452
|
setIsLoading(true);
|
|
15386
15453
|
setStatus("Preparing verification...");
|
|
@@ -15513,20 +15580,29 @@ var init_KycMenu = __esm({
|
|
|
15513
15580
|
}
|
|
15514
15581
|
});
|
|
15515
15582
|
|
|
15516
|
-
// src/internal/
|
|
15583
|
+
// src/internal/hooks/useUserProfile.ts
|
|
15517
15584
|
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
15518
|
-
|
|
15519
|
-
import { jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
15520
|
-
function KYCStatus() {
|
|
15585
|
+
function useUserProfile() {
|
|
15521
15586
|
const address = useSession((st) => st.address);
|
|
15522
|
-
|
|
15523
|
-
retry: false,
|
|
15524
|
-
enabled: !!address,
|
|
15587
|
+
return useQuery9({
|
|
15525
15588
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
15526
|
-
queryFn: getUserProfile
|
|
15589
|
+
queryFn: getUserProfile,
|
|
15590
|
+
enabled: !!address,
|
|
15591
|
+
retry: false
|
|
15527
15592
|
});
|
|
15528
|
-
|
|
15529
|
-
|
|
15593
|
+
}
|
|
15594
|
+
var init_useUserProfile = __esm({
|
|
15595
|
+
"src/internal/hooks/useUserProfile.ts"() {
|
|
15596
|
+
init_SessionContext();
|
|
15597
|
+
init_profile();
|
|
15598
|
+
}
|
|
15599
|
+
});
|
|
15600
|
+
|
|
15601
|
+
// src/internal/components/KYC/KYCStatus.tsx
|
|
15602
|
+
import { jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
15603
|
+
function KYCStatus() {
|
|
15604
|
+
const { data: userProfile = null, isLoading: isUserProfileLoading } = useUserProfile();
|
|
15605
|
+
const isKycVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
15530
15606
|
if (!isKycVerified) return null;
|
|
15531
15607
|
return /* @__PURE__ */ jsxs64("div", { className: "group relative flex flex-shrink-0", children: [
|
|
15532
15608
|
/* @__PURE__ */ jsx70(PositiveIcon, {}),
|
|
@@ -15547,9 +15623,8 @@ function KYCStatus() {
|
|
|
15547
15623
|
}
|
|
15548
15624
|
var init_KYCStatus = __esm({
|
|
15549
15625
|
"src/internal/components/KYC/KYCStatus.tsx"() {
|
|
15550
|
-
init_SessionContext();
|
|
15551
15626
|
init_icons();
|
|
15552
|
-
|
|
15627
|
+
init_useUserProfile();
|
|
15553
15628
|
init_utils2();
|
|
15554
15629
|
}
|
|
15555
15630
|
});
|
|
@@ -15692,14 +15767,14 @@ var init_useProvidersList = __esm({
|
|
|
15692
15767
|
|
|
15693
15768
|
// src/internal/components/MainMenu/MainMenu.tsx
|
|
15694
15769
|
import { ChevronLeft, ChevronRight as ChevronRight3, DollarSign as DollarSign2, Wallet2 as Wallet23 } from "lucide-react";
|
|
15695
|
-
import { useEffect as
|
|
15770
|
+
import { useEffect as useEffect29 } from "react";
|
|
15696
15771
|
import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
15697
15772
|
function MainMenu() {
|
|
15698
15773
|
const address = useSession((st) => st.address);
|
|
15699
15774
|
const { t } = useT();
|
|
15700
15775
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
15701
15776
|
const setTransitionPageHeight = useLayoutDataStore((st) => st.setTransitionPageHeight);
|
|
15702
|
-
|
|
15777
|
+
useEffect29(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
|
|
15703
15778
|
useProvidersList();
|
|
15704
15779
|
return /* @__PURE__ */ jsx72("div", { className: "w-full p-[var(--ui-kit-pd)] flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ jsx72("div", { className: "w-full grid grid-cols-4 gap-0 md:gap-[var(--ui-kit-gap)] py-[10px] md:py-1", children: MAIN_MENU_BUTTONS.map(({ id, label, icon: Icon2 }) => /* @__PURE__ */ jsxs66(
|
|
15705
15780
|
Button,
|
|
@@ -15744,7 +15819,7 @@ var init_MainMenu2 = __esm({
|
|
|
15744
15819
|
|
|
15745
15820
|
// src/modules/linkedProfiles.ts
|
|
15746
15821
|
import { useQuery as useQuery11, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
|
|
15747
|
-
import { useCallback as
|
|
15822
|
+
import { useCallback as useCallback19 } from "react";
|
|
15748
15823
|
function useLinkedProfiles() {
|
|
15749
15824
|
const qc = useQueryClient12();
|
|
15750
15825
|
const address = useSession((st) => st.address);
|
|
@@ -15768,7 +15843,7 @@ function useLinkedProfiles() {
|
|
|
15768
15843
|
}
|
|
15769
15844
|
});
|
|
15770
15845
|
const { profiles = [], avatar = null } = data || {};
|
|
15771
|
-
const refresh =
|
|
15846
|
+
const refresh = useCallback19(async () => {
|
|
15772
15847
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15773
15848
|
}, [qc, address]);
|
|
15774
15849
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
@@ -15814,7 +15889,7 @@ var init_useStore = __esm({
|
|
|
15814
15889
|
|
|
15815
15890
|
// src/internal/components/ManageWalletMenu/EmailForm.tsx
|
|
15816
15891
|
import { useMutation as useMutation12 } from "@tanstack/react-query";
|
|
15817
|
-
import { ChevronRight as ChevronRight4, Loader as
|
|
15892
|
+
import { ChevronRight as ChevronRight4, Loader as Loader12, Mail as Mail4 } from "lucide-react";
|
|
15818
15893
|
import { jsx as jsx73, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
15819
15894
|
function EmailForm() {
|
|
15820
15895
|
const { callbacksRef } = useProviderConfig();
|
|
@@ -15902,7 +15977,7 @@ function EmailForm() {
|
|
|
15902
15977
|
size: "large",
|
|
15903
15978
|
disabled: !email || isLoading,
|
|
15904
15979
|
onClick: () => onSendVerificationCode(),
|
|
15905
|
-
children: isLoading ? /* @__PURE__ */ jsx73(
|
|
15980
|
+
children: isLoading ? /* @__PURE__ */ jsx73(Loader12, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsx73(ChevronRight4, { className: "w-4 h-4" })
|
|
15906
15981
|
}
|
|
15907
15982
|
)
|
|
15908
15983
|
] });
|
|
@@ -16246,7 +16321,7 @@ var init_EmailNotConnectedWarning = __esm({
|
|
|
16246
16321
|
|
|
16247
16322
|
// src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts
|
|
16248
16323
|
import { useQueryClient as useQueryClient15 } from "@tanstack/react-query";
|
|
16249
|
-
import React21, { useEffect as
|
|
16324
|
+
import React21, { useEffect as useEffect30 } from "react";
|
|
16250
16325
|
function normalizeSocialLinkError(message) {
|
|
16251
16326
|
if (message === "X_ALREADY_LINKED") {
|
|
16252
16327
|
return "This X account is already linked to another account";
|
|
@@ -16322,7 +16397,7 @@ function useLinkSocial() {
|
|
|
16322
16397
|
[config.social?.providers]
|
|
16323
16398
|
);
|
|
16324
16399
|
const [socialLinkStarted, setSocialLinkStarted] = React21.useState(false);
|
|
16325
|
-
|
|
16400
|
+
useEffect30(() => {
|
|
16326
16401
|
const key = providerType?.toLowerCase();
|
|
16327
16402
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
|
|
16328
16403
|
if (isWalletLinking) {
|
|
@@ -16405,7 +16480,7 @@ var init_telegram2 = __esm({
|
|
|
16405
16480
|
|
|
16406
16481
|
// src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts
|
|
16407
16482
|
import { useQueryClient as useQueryClient16 } from "@tanstack/react-query";
|
|
16408
|
-
import { useCallback as
|
|
16483
|
+
import { useCallback as useCallback20, useEffect as useEffect31, useState as useState18 } from "react";
|
|
16409
16484
|
function useLinkTelegram() {
|
|
16410
16485
|
const {
|
|
16411
16486
|
config: { current: config },
|
|
@@ -16416,7 +16491,7 @@ function useLinkTelegram() {
|
|
|
16416
16491
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16417
16492
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16418
16493
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16419
|
-
const handleLinkTelegram =
|
|
16494
|
+
const handleLinkTelegram = useCallback20(async () => {
|
|
16420
16495
|
try {
|
|
16421
16496
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16422
16497
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16464,7 +16539,7 @@ function useLinkTelegram() {
|
|
|
16464
16539
|
}
|
|
16465
16540
|
}, [config.social?.providers]);
|
|
16466
16541
|
const [telegramLinkStarted, setTelegramLinkStarted] = useState18(false);
|
|
16467
|
-
|
|
16542
|
+
useEffect31(() => {
|
|
16468
16543
|
console.log("[useLinkTelegram] Effect triggered:", {
|
|
16469
16544
|
providerType,
|
|
16470
16545
|
linkIsLoading,
|
|
@@ -16481,7 +16556,7 @@ function useLinkTelegram() {
|
|
|
16481
16556
|
handleLinkTelegram();
|
|
16482
16557
|
}
|
|
16483
16558
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
|
|
16484
|
-
|
|
16559
|
+
useEffect31(() => {
|
|
16485
16560
|
if (providerType !== "telegram") {
|
|
16486
16561
|
setTelegramLinkStarted(false);
|
|
16487
16562
|
}
|
|
@@ -16584,7 +16659,7 @@ var init_ProviderCard = __esm({
|
|
|
16584
16659
|
|
|
16585
16660
|
// src/internal/components/ManageWalletMenu/ManageWallet.tsx
|
|
16586
16661
|
import { fromPairs } from "lodash-es";
|
|
16587
|
-
import { AlertTriangle as AlertTriangle4, ArrowLeft as ArrowLeft14, Loader as
|
|
16662
|
+
import { AlertTriangle as AlertTriangle4, ArrowLeft as ArrowLeft14, Loader as Loader13 } from "lucide-react";
|
|
16588
16663
|
import { useMemo as useMemo7 } from "react";
|
|
16589
16664
|
import { Fragment as Fragment28, jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
16590
16665
|
function getProviderName(provider) {
|
|
@@ -16731,7 +16806,7 @@ function ManageWalletMenu() {
|
|
|
16731
16806
|
),
|
|
16732
16807
|
/* @__PURE__ */ jsx77("span", { className: "text-xl font-semibold", children: t("passport:profilesMenu.title") })
|
|
16733
16808
|
] }),
|
|
16734
|
-
isProvidersLoading && /* @__PURE__ */ jsx77("div", { className: "flex items-center justify-center p-4 text-[var(--ui-kit-fg-muted)]", children: /* @__PURE__ */ jsx77(
|
|
16809
|
+
isProvidersLoading && /* @__PURE__ */ jsx77("div", { className: "flex items-center justify-center p-4 text-[var(--ui-kit-fg-muted)]", children: /* @__PURE__ */ jsx77(Loader13, { className: "w-4 h-4 animate-spin" }) }),
|
|
16735
16810
|
/* @__PURE__ */ jsx77(EmailNotConnectedWarning, {}),
|
|
16736
16811
|
showCurrentProviders && renderProviders.map((node) => node),
|
|
16737
16812
|
showExtraProvidersUi && /* @__PURE__ */ jsx77(AddProvider, {}),
|
|
@@ -16783,7 +16858,7 @@ var init_ManageWallet = __esm({
|
|
|
16783
16858
|
|
|
16784
16859
|
// src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx
|
|
16785
16860
|
import { useMutation as useMutation15, useQueryClient as useQueryClient17 } from "@tanstack/react-query";
|
|
16786
|
-
import { Key as Key6, Loader as
|
|
16861
|
+
import { Key as Key6, Loader as Loader14 } from "lucide-react";
|
|
16787
16862
|
import { useState as useState19 } from "react";
|
|
16788
16863
|
import { useDisconnect as useDisconnect2 } from "wagmi";
|
|
16789
16864
|
import { jsx as jsx78, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
@@ -16870,7 +16945,7 @@ function UnlinkProviderMenu() {
|
|
|
16870
16945
|
disabled: !!isProviderUnlinking || !confirmUnlink || confirmInput !== confirmUnlink.externalId,
|
|
16871
16946
|
className: "w-full flex-1",
|
|
16872
16947
|
children: [
|
|
16873
|
-
isProviderUnlinking && /* @__PURE__ */ jsx78(
|
|
16948
|
+
isProviderUnlinking && /* @__PURE__ */ jsx78(Loader14, { className: "animate-spin h-4 w-4" }),
|
|
16874
16949
|
t("passport:common.delete")
|
|
16875
16950
|
]
|
|
16876
16951
|
}
|
|
@@ -17001,12 +17076,12 @@ var init_useNicknameStore = __esm({
|
|
|
17001
17076
|
|
|
17002
17077
|
// src/internal/components/NicknameMenu/useNicknameAvailability.ts
|
|
17003
17078
|
import { useMutation as useMutation16 } from "@tanstack/react-query";
|
|
17004
|
-
import { debounce as
|
|
17005
|
-
import { useCallback as
|
|
17079
|
+
import { debounce as debounce5 } from "lodash-es";
|
|
17080
|
+
import { useCallback as useCallback21, useEffect as useEffect32 } from "react";
|
|
17006
17081
|
function useNicknameAvailability(currentNickname) {
|
|
17007
17082
|
const { t } = useT();
|
|
17008
17083
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
17009
|
-
|
|
17084
|
+
useEffect32(() => {
|
|
17010
17085
|
if (!currentNickname) return;
|
|
17011
17086
|
useNicknameStore.getState().setNicknameValue(currentNickname);
|
|
17012
17087
|
}, [currentNickname]);
|
|
@@ -17027,8 +17102,8 @@ function useNicknameAvailability(currentNickname) {
|
|
|
17027
17102
|
useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
|
|
17028
17103
|
}
|
|
17029
17104
|
});
|
|
17030
|
-
const debouncedCheckAvailability =
|
|
17031
|
-
|
|
17105
|
+
const debouncedCheckAvailability = useCallback21(debounce5(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
|
|
17106
|
+
useEffect32(() => {
|
|
17032
17107
|
if (!currentNickname) return;
|
|
17033
17108
|
const normalizedInputValue = normalizeNickname(nicknameValue);
|
|
17034
17109
|
const { valid: isNicknameValid } = validateNickname(nicknameValue);
|
|
@@ -17057,7 +17132,7 @@ var init_useNicknameAvailability = __esm({
|
|
|
17057
17132
|
// src/internal/components/NicknameMenu/NicknameEditForm.tsx
|
|
17058
17133
|
import { useMutation as useMutation17, useQueryClient as useQueryClient18 } from "@tanstack/react-query";
|
|
17059
17134
|
import { AtSignIcon, CheckIcon as CheckIcon2, CopyIcon, LoaderIcon as LoaderIcon7, SaveIcon } from "lucide-react";
|
|
17060
|
-
import { useCallback as
|
|
17135
|
+
import { useCallback as useCallback22, useState as useState20 } from "react";
|
|
17061
17136
|
import { Fragment as Fragment29, jsx as jsx79, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
17062
17137
|
function NicknameEditForm(props) {
|
|
17063
17138
|
const { isInitialUser, nicknameInfo } = props;
|
|
@@ -17099,7 +17174,7 @@ function NicknameEditForm(props) {
|
|
|
17099
17174
|
);
|
|
17100
17175
|
}
|
|
17101
17176
|
});
|
|
17102
|
-
const handleNicknameInputChange =
|
|
17177
|
+
const handleNicknameInputChange = useCallback22(
|
|
17103
17178
|
(e) => {
|
|
17104
17179
|
const { error, setError, setNicknameValue } = useNicknameStore.getState();
|
|
17105
17180
|
const value = e.target.value;
|
|
@@ -17114,7 +17189,7 @@ function NicknameEditForm(props) {
|
|
|
17114
17189
|
},
|
|
17115
17190
|
[isNicknameChangeError, isNicknameChangeSuccess, reset, t]
|
|
17116
17191
|
);
|
|
17117
|
-
const handleSubmit =
|
|
17192
|
+
const handleSubmit = useCallback22(
|
|
17118
17193
|
(e) => {
|
|
17119
17194
|
const { nicknameValue: nicknameValue2, setError } = useNicknameStore.getState();
|
|
17120
17195
|
if (!canChange) {
|
|
@@ -17220,10 +17295,10 @@ var init_NicknameEditForm = __esm({
|
|
|
17220
17295
|
// src/internal/components/NicknameMenu/NicknameMenu.tsx
|
|
17221
17296
|
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
17222
17297
|
import dayjs4 from "dayjs";
|
|
17223
|
-
import { ArrowLeft as ArrowLeft15, Info as Info4, Loader as
|
|
17298
|
+
import { ArrowLeft as ArrowLeft15, Info as Info4, Loader as Loader15 } from "lucide-react";
|
|
17224
17299
|
import { jsx as jsx80, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
17225
17300
|
function NicknameMenu() {
|
|
17226
|
-
const { isInitialUser } = usePageParams();
|
|
17301
|
+
const { isInitialUser } = usePageParams().current;
|
|
17227
17302
|
const { t } = useT();
|
|
17228
17303
|
const address = useSession((st) => st.address);
|
|
17229
17304
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
@@ -17259,7 +17334,7 @@ function NicknameMenu() {
|
|
|
17259
17334
|
),
|
|
17260
17335
|
/* @__PURE__ */ jsxs74("div", { className: "flex gap-[var(--ui-kit-gap)] items-center w-fit", children: [
|
|
17261
17336
|
/* @__PURE__ */ jsx80("span", { className: "text-xl font-semibold", children: t("passport:nicknameMenu.title") }),
|
|
17262
|
-
isNicknameInfoLoading && /* @__PURE__ */ jsx80(
|
|
17337
|
+
isNicknameInfoLoading && /* @__PURE__ */ jsx80(Loader15, { className: "w-4 h-4 animate-spin" })
|
|
17263
17338
|
] })
|
|
17264
17339
|
] }),
|
|
17265
17340
|
/* @__PURE__ */ jsx80("span", { className: "text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:nicknameMenu.yourNickname") }),
|
|
@@ -17400,6 +17475,7 @@ function useWatchTokens(options) {
|
|
|
17400
17475
|
const {
|
|
17401
17476
|
data: assets,
|
|
17402
17477
|
isLoading,
|
|
17478
|
+
isFetching,
|
|
17403
17479
|
error,
|
|
17404
17480
|
refetch
|
|
17405
17481
|
} = useQuery13({
|
|
@@ -17470,6 +17546,7 @@ function useWatchTokens(options) {
|
|
|
17470
17546
|
return {
|
|
17471
17547
|
assets: assets || [],
|
|
17472
17548
|
isLoading,
|
|
17549
|
+
isFetching,
|
|
17473
17550
|
error: error || null,
|
|
17474
17551
|
refetch
|
|
17475
17552
|
};
|
|
@@ -17486,7 +17563,7 @@ var init_useWatchTokens = __esm({
|
|
|
17486
17563
|
// src/internal/hooks/useBlockscoutAssets.ts
|
|
17487
17564
|
import { createBlockscoutClient } from "@embarkai/core/clients";
|
|
17488
17565
|
import { useQuery as useQuery14, useQueryClient as useQueryClient19 } from "@tanstack/react-query";
|
|
17489
|
-
import { useCallback as
|
|
17566
|
+
import { useCallback as useCallback23, useMemo as useMemo10, useRef as useRef17 } from "react";
|
|
17490
17567
|
import { formatEther, formatUnits as formatUnits3 } from "viem";
|
|
17491
17568
|
function resolveIpfsUri(uri) {
|
|
17492
17569
|
if (!uri) return "";
|
|
@@ -17623,15 +17700,17 @@ function useBlockscoutAssets(options) {
|
|
|
17623
17700
|
() => blockscoutApiUrl ? createBlockscoutClient({ baseUrl: blockscoutApiUrl }) : null,
|
|
17624
17701
|
[blockscoutApiUrl]
|
|
17625
17702
|
);
|
|
17626
|
-
const lastRefreshRef =
|
|
17703
|
+
const lastRefreshRef = useRef17(0);
|
|
17627
17704
|
const {
|
|
17628
17705
|
assets: watchTokenAssets,
|
|
17629
|
-
isLoading: watchTokensLoading
|
|
17706
|
+
isLoading: watchTokensLoading,
|
|
17707
|
+
isFetching: watchTokensFetching
|
|
17630
17708
|
// refetch: refetchWatchTokens
|
|
17631
17709
|
} = useWatchTokens({ address, chainId: resolvedChainId, enabled });
|
|
17632
17710
|
const {
|
|
17633
17711
|
data: nativeBalanceData,
|
|
17634
|
-
isLoading: nativeLoading
|
|
17712
|
+
isLoading: nativeLoading,
|
|
17713
|
+
isFetching: nativeFetching
|
|
17635
17714
|
// refetch: refetchNative
|
|
17636
17715
|
} = useQuery14({
|
|
17637
17716
|
queryKey: [NATIVE_BALANCE_QUERY_KEY, resolvedChainId, address],
|
|
@@ -17655,6 +17734,7 @@ function useBlockscoutAssets(options) {
|
|
|
17655
17734
|
const {
|
|
17656
17735
|
data: tokenBalances,
|
|
17657
17736
|
isLoading: tokensLoading,
|
|
17737
|
+
isFetching: tokensFetching,
|
|
17658
17738
|
error: tokensError,
|
|
17659
17739
|
// refetch: refetchTokens,
|
|
17660
17740
|
dataUpdatedAt
|
|
@@ -17680,7 +17760,8 @@ function useBlockscoutAssets(options) {
|
|
|
17680
17760
|
});
|
|
17681
17761
|
const {
|
|
17682
17762
|
data: nftItems,
|
|
17683
|
-
isLoading: nftsLoading
|
|
17763
|
+
isLoading: nftsLoading,
|
|
17764
|
+
isFetching: nftsFetching
|
|
17684
17765
|
// refetch: refetchNfts
|
|
17685
17766
|
} = useQuery14({
|
|
17686
17767
|
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, address, blockscoutApiUrl],
|
|
@@ -17794,7 +17875,7 @@ function useBlockscoutAssets(options) {
|
|
|
17794
17875
|
if (!tokensError) return null;
|
|
17795
17876
|
return createError(tokensError);
|
|
17796
17877
|
}, [tokensError]);
|
|
17797
|
-
const refreshBalances =
|
|
17878
|
+
const refreshBalances = useCallback23(async () => {
|
|
17798
17879
|
const now = Date.now();
|
|
17799
17880
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
17800
17881
|
return;
|
|
@@ -17811,7 +17892,7 @@ function useBlockscoutAssets(options) {
|
|
|
17811
17892
|
qc.invalidateQueries({ queryKey: [WATCH_TOKENS_QUERY_KEY] })
|
|
17812
17893
|
]);
|
|
17813
17894
|
}, [qc]);
|
|
17814
|
-
const getTokenBalance =
|
|
17895
|
+
const getTokenBalance = useCallback23(
|
|
17815
17896
|
(tokenAddress) => {
|
|
17816
17897
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
17817
17898
|
},
|
|
@@ -17821,6 +17902,7 @@ function useBlockscoutAssets(options) {
|
|
|
17821
17902
|
nativeBalance,
|
|
17822
17903
|
assets,
|
|
17823
17904
|
isLoading: nativeLoading || tokensLoading || nftsLoading || watchTokensLoading,
|
|
17905
|
+
isFetching: nativeFetching || tokensFetching || nftsFetching || watchTokensFetching,
|
|
17824
17906
|
isInitialLoading: nativeLoading && !nativeBalanceData,
|
|
17825
17907
|
error,
|
|
17826
17908
|
isBlockscoutAvailable: !!blockscoutClient && !tokensError,
|
|
@@ -18118,31 +18200,32 @@ var init_PortfolioItem = __esm({
|
|
|
18118
18200
|
|
|
18119
18201
|
// src/internal/components/PortfolioMenu/PortfolioMenu.tsx
|
|
18120
18202
|
import { useQueryClient as useQueryClient20 } from "@tanstack/react-query";
|
|
18121
|
-
import {
|
|
18122
|
-
import { useCallback as
|
|
18203
|
+
import { ArrowLeft as ArrowLeft16, Gem, Loader as Loader16, RefreshCw as RefreshCw2 } from "lucide-react";
|
|
18204
|
+
import { useCallback as useCallback24 } from "react";
|
|
18123
18205
|
import { jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
18124
18206
|
function PortfolioMenu() {
|
|
18125
18207
|
const { assets: projectAssets = [] } = useProviderConfig().config.current?.projectAssets || {};
|
|
18126
18208
|
const { t } = useT();
|
|
18127
18209
|
const qc = useQueryClient20();
|
|
18128
18210
|
const address = useSession((st) => st.address);
|
|
18129
|
-
const
|
|
18211
|
+
const chainConfig = useSession((st) => st.chainConfig);
|
|
18130
18212
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18131
18213
|
const {
|
|
18132
18214
|
assets: blockscoutAssets,
|
|
18133
18215
|
refreshBalances: refreshBlockscoutBalances,
|
|
18134
18216
|
isLoading: isBlockscoutLoading,
|
|
18217
|
+
isFetching: isBlockscoutFetching,
|
|
18135
18218
|
error: blockscoutError,
|
|
18136
18219
|
isBlockscoutAvailable
|
|
18137
18220
|
} = useBlockscoutAssets({
|
|
18138
18221
|
address,
|
|
18139
18222
|
enabled: !!address
|
|
18140
18223
|
});
|
|
18141
|
-
const
|
|
18142
|
-
const refreshAllAssetsBalances =
|
|
18143
|
-
Promise.all(
|
|
18224
|
+
const shownProjectAssets = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
18225
|
+
const refreshAllAssetsBalances = useCallback24(() => {
|
|
18226
|
+
Promise.all(shownProjectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
18144
18227
|
refreshBlockscoutBalances();
|
|
18145
|
-
}, [qc,
|
|
18228
|
+
}, [qc, shownProjectAssets, refreshBlockscoutBalances]);
|
|
18146
18229
|
return /* @__PURE__ */ jsx83(
|
|
18147
18230
|
"div",
|
|
18148
18231
|
{
|
|
@@ -18153,7 +18236,16 @@ function PortfolioMenu() {
|
|
|
18153
18236
|
className: "list-scrollbar-y w-full p-[var(--ui-kit-pd)]",
|
|
18154
18237
|
children: /* @__PURE__ */ jsxs77(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18155
18238
|
/* @__PURE__ */ jsxs77("div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18156
|
-
/* @__PURE__ */ jsx83(
|
|
18239
|
+
/* @__PURE__ */ jsx83(
|
|
18240
|
+
Button,
|
|
18241
|
+
{
|
|
18242
|
+
variant: "ghost",
|
|
18243
|
+
size: "icon",
|
|
18244
|
+
title: "Back",
|
|
18245
|
+
onClick: () => useLayoutDataStore.getState().setPage("main-menu" /* MAIN_MENU */),
|
|
18246
|
+
children: /* @__PURE__ */ jsx83(ArrowLeft16, { className: "h-4 w-4" })
|
|
18247
|
+
}
|
|
18248
|
+
),
|
|
18157
18249
|
/* @__PURE__ */ jsx83("span", { className: "text-xl font-semibold", children: t("passport:portfolioMenu.title") }),
|
|
18158
18250
|
/* @__PURE__ */ jsx83(
|
|
18159
18251
|
Button,
|
|
@@ -18162,17 +18254,17 @@ function PortfolioMenu() {
|
|
|
18162
18254
|
variant: "ghost",
|
|
18163
18255
|
size: "icon",
|
|
18164
18256
|
onClick: refreshAllAssetsBalances,
|
|
18165
|
-
disabled: isBlockscoutLoading,
|
|
18166
|
-
children: isBlockscoutLoading ? /* @__PURE__ */ jsx83(
|
|
18257
|
+
disabled: isBlockscoutLoading || isBlockscoutFetching,
|
|
18258
|
+
children: isBlockscoutLoading || isBlockscoutFetching ? /* @__PURE__ */ jsx83(Loader16, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx83(RefreshCw2, { className: "h-4 w-4" })
|
|
18167
18259
|
}
|
|
18168
18260
|
)
|
|
18169
18261
|
] }),
|
|
18170
|
-
isBlockscoutLoading && /* @__PURE__ */ jsx83("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)] p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx83(
|
|
18262
|
+
isBlockscoutLoading && /* @__PURE__ */ jsx83("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)] p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx83(Loader16, { className: "w-4 h-4 animate-spin" }) }),
|
|
18171
18263
|
!isBlockscoutLoading && blockscoutAssets?.length === 0 && /* @__PURE__ */ jsxs77(Highlight, { type: "info", className: "flex flex-col items-center justify-center gap-[var(--ui-kit-gap)]", children: [
|
|
18172
18264
|
/* @__PURE__ */ jsx83(Gem, { className: "w-8 h-8" }),
|
|
18173
18265
|
/* @__PURE__ */ jsx83("span", { className: "block", children: t("passport:portfolioMenu.noAssets") })
|
|
18174
18266
|
] }),
|
|
18175
|
-
!isBlockscoutLoading &&
|
|
18267
|
+
!isBlockscoutLoading && shownProjectAssets?.map((asset, index) => /* @__PURE__ */ jsx83(PortfolioItem, { isProjectAsset: true, address, asset }, `project-${asset.symbol}-${index}`)),
|
|
18176
18268
|
!isBlockscoutLoading && blockscoutAssets?.length > 0 && blockscoutAssets.map((asset, index) => /* @__PURE__ */ jsx83(
|
|
18177
18269
|
PortfolioItem,
|
|
18178
18270
|
{
|
|
@@ -18181,10 +18273,12 @@ function PortfolioMenu() {
|
|
|
18181
18273
|
},
|
|
18182
18274
|
`${asset.type}-${asset.address || "native"}-${asset.tokenId || index}`
|
|
18183
18275
|
)),
|
|
18184
|
-
|
|
18185
|
-
|
|
18186
|
-
|
|
18187
|
-
|
|
18276
|
+
!isBlockscoutAvailable && /* @__PURE__ */ jsx83(Highlight, {
|
|
18277
|
+
type: "warning",
|
|
18278
|
+
//@ts-expect-error i18n typings
|
|
18279
|
+
children: t("passport:portfolioMenu.noBlockscout", { chain: chainConfig?.name?.toUpperCase() || "UNKNOWN" })
|
|
18280
|
+
}),
|
|
18281
|
+
blockscoutError && /* @__PURE__ */ jsx83(Highlight, { type: "error", children: blockscoutError?.message })
|
|
18188
18282
|
] })
|
|
18189
18283
|
}
|
|
18190
18284
|
);
|
|
@@ -18292,9 +18386,9 @@ var init_nickname_fingerprint = __esm({
|
|
|
18292
18386
|
});
|
|
18293
18387
|
|
|
18294
18388
|
// src/internal/components/ReceiveMenu/ReceiveMenu.tsx
|
|
18295
|
-
import { ArrowLeft as ArrowLeft17, CheckCircle2 as CheckCircle23, Copy as Copy2, Info as Info5, Loader as
|
|
18389
|
+
import { ArrowLeft as ArrowLeft17, CheckCircle2 as CheckCircle23, Copy as Copy2, Info as Info5, Loader as Loader17, Shield } from "lucide-react";
|
|
18296
18390
|
import QRCode from "qrcode";
|
|
18297
|
-
import { useCallback as
|
|
18391
|
+
import { useCallback as useCallback25, useEffect as useEffect33, useMemo as useMemo11, useState as useState21 } from "react";
|
|
18298
18392
|
import { Fragment as Fragment31, jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
18299
18393
|
function ReceiveMenu() {
|
|
18300
18394
|
const session = useSession((st) => st.session);
|
|
@@ -18316,7 +18410,7 @@ function ReceiveMenu() {
|
|
|
18316
18410
|
return null;
|
|
18317
18411
|
}
|
|
18318
18412
|
}, [session?.ownerAddress]);
|
|
18319
|
-
|
|
18413
|
+
useEffect33(() => {
|
|
18320
18414
|
if (open && address) {
|
|
18321
18415
|
QRCode.toDataURL(address, {
|
|
18322
18416
|
width: 200,
|
|
@@ -18329,7 +18423,7 @@ function ReceiveMenu() {
|
|
|
18329
18423
|
});
|
|
18330
18424
|
}
|
|
18331
18425
|
}, [open, address]);
|
|
18332
|
-
const handleCopy =
|
|
18426
|
+
const handleCopy = useCallback25(async () => {
|
|
18333
18427
|
if (!address) return;
|
|
18334
18428
|
try {
|
|
18335
18429
|
await navigator.clipboard.writeText(address);
|
|
@@ -18339,7 +18433,7 @@ function ReceiveMenu() {
|
|
|
18339
18433
|
console.error("Failed to copy address:", error);
|
|
18340
18434
|
}
|
|
18341
18435
|
}, [address]);
|
|
18342
|
-
const handleCopyFingerprint =
|
|
18436
|
+
const handleCopyFingerprint = useCallback25(async () => {
|
|
18343
18437
|
if (!fingerprint) return;
|
|
18344
18438
|
try {
|
|
18345
18439
|
await navigator.clipboard.writeText(fingerprint);
|
|
@@ -18366,7 +18460,7 @@ function ReceiveMenu() {
|
|
|
18366
18460
|
/* @__PURE__ */ jsx84("strong", { className: "block w-full", children: `${t("passport:common.network")}: ${chainConfig.name}` }),
|
|
18367
18461
|
/* @__PURE__ */ jsx84("span", { className: "block w-full", children: t("passport:receiveMenu.warning") })
|
|
18368
18462
|
] }),
|
|
18369
|
-
/* @__PURE__ */ jsx84("div", { className: "flex items-center justify-center p-[var(--ui-kit-pd)]", style: { minHeight: "216px" }, children: qrCodeUrl ? /* @__PURE__ */ jsx84("img", { src: qrCodeUrl, alt: "Wallet QR Code", className: "w-48 h-48" }) : /* @__PURE__ */ jsx84(
|
|
18463
|
+
/* @__PURE__ */ jsx84("div", { className: "flex items-center justify-center p-[var(--ui-kit-pd)]", style: { minHeight: "216px" }, children: qrCodeUrl ? /* @__PURE__ */ jsx84("img", { src: qrCodeUrl, alt: "Wallet QR Code", className: "w-48 h-48" }) : /* @__PURE__ */ jsx84(Loader17, { className: "w-4 h-4 animate-spin" }) }),
|
|
18370
18464
|
fingerprint && /* @__PURE__ */ jsxs78("div", { className: "flex items-center justify-center gap-2 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
18371
18465
|
/* @__PURE__ */ jsx84(Shield, { className: "w-4 h-4 text-[var(--ui-kit-bg-success)]" }),
|
|
18372
18466
|
/* @__PURE__ */ jsx84("span", { className: "text-sm text-[var(--ui-kit-fg-muted)]", children: t("passport:common.fingerprint") }),
|
|
@@ -18419,6 +18513,24 @@ var init_ReceiveMenu2 = __esm({
|
|
|
18419
18513
|
}
|
|
18420
18514
|
});
|
|
18421
18515
|
|
|
18516
|
+
// src/internal/components/SecurityMenu/useSecurityStore.ts
|
|
18517
|
+
import { debounce as debounce6 } from "lodash-es";
|
|
18518
|
+
import { create as create10 } from "zustand";
|
|
18519
|
+
var useSecurityStore;
|
|
18520
|
+
var init_useSecurityStore = __esm({
|
|
18521
|
+
"src/internal/components/SecurityMenu/useSecurityStore.ts"() {
|
|
18522
|
+
useSecurityStore = create10((set) => ({
|
|
18523
|
+
renderKey: "security-store",
|
|
18524
|
+
setRenderKey: debounce6((renderKey) => {
|
|
18525
|
+
console.log("[SecurityMenu] Setting render key:", renderKey);
|
|
18526
|
+
set({ renderKey });
|
|
18527
|
+
}, 200),
|
|
18528
|
+
appToUntrust: null,
|
|
18529
|
+
untrustApp: (app) => set({ appToUntrust: app })
|
|
18530
|
+
}));
|
|
18531
|
+
}
|
|
18532
|
+
});
|
|
18533
|
+
|
|
18422
18534
|
// src/internal/components/SecurityMenu/constants.ts
|
|
18423
18535
|
var KEYSHARE_RECOVERY_STATS_QUERY, CONNECTED_TRUSTED_APPS_QUERY;
|
|
18424
18536
|
var init_constants5 = __esm({
|
|
@@ -18428,7 +18540,7 @@ var init_constants5 = __esm({
|
|
|
18428
18540
|
}
|
|
18429
18541
|
});
|
|
18430
18542
|
|
|
18431
|
-
// src/internal/components/SecurityMenu/
|
|
18543
|
+
// src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts
|
|
18432
18544
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
18433
18545
|
function useConnectedApps() {
|
|
18434
18546
|
const session = useSession((st) => st.session);
|
|
@@ -18446,45 +18558,31 @@ function useConnectedApps() {
|
|
|
18446
18558
|
}
|
|
18447
18559
|
});
|
|
18448
18560
|
}
|
|
18449
|
-
|
|
18450
|
-
|
|
18451
|
-
const userId = session?.mpcUserId || null;
|
|
18452
|
-
return useQuery16({
|
|
18453
|
-
enabled: !!userId,
|
|
18454
|
-
queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
|
|
18455
|
-
queryFn: async () => {
|
|
18456
|
-
const iframeManager = getIframeManager();
|
|
18457
|
-
if (!iframeManager) {
|
|
18458
|
-
throw new Error("Iframe manager not available");
|
|
18459
|
-
}
|
|
18460
|
-
const keyshareInfo = await getKeyshareInfo(userId);
|
|
18461
|
-
const shareRecoveryStats = await getShareRecoveryStats();
|
|
18462
|
-
return {
|
|
18463
|
-
keyshareInfo,
|
|
18464
|
-
shareRecoveryStats
|
|
18465
|
-
};
|
|
18466
|
-
}
|
|
18467
|
-
});
|
|
18468
|
-
}
|
|
18469
|
-
var init_hooks2 = __esm({
|
|
18470
|
-
"src/internal/components/SecurityMenu/hooks.ts"() {
|
|
18561
|
+
var init_useConnectedApps = __esm({
|
|
18562
|
+
"src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts"() {
|
|
18471
18563
|
init_SessionContext();
|
|
18472
|
-
init_keyshare();
|
|
18473
18564
|
init_httpClient();
|
|
18474
|
-
init_iframe_manager();
|
|
18475
|
-
init_vaultClient();
|
|
18476
18565
|
init_constants5();
|
|
18477
18566
|
}
|
|
18478
18567
|
});
|
|
18479
18568
|
|
|
18480
|
-
// src/internal/components/SecurityMenu/ConnectedApps.tsx
|
|
18569
|
+
// src/internal/components/SecurityMenu/ConnectedApps/ConnectedApps.tsx
|
|
18481
18570
|
import dayjs5 from "dayjs";
|
|
18482
|
-
import { AppWindowMac, ExternalLinkIcon as ExternalLinkIcon2,
|
|
18571
|
+
import { AppWindowMac, ExternalLinkIcon as ExternalLinkIcon2, InfoIcon as InfoIcon4, LoaderIcon as LoaderIcon9, ShieldBanIcon, ShieldCheckIcon } from "lucide-react";
|
|
18572
|
+
import { useEffect as useEffect34 } from "react";
|
|
18483
18573
|
import { Fragment as Fragment32, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
18484
18574
|
function Application(props) {
|
|
18485
|
-
const {
|
|
18575
|
+
const {
|
|
18576
|
+
projectId,
|
|
18577
|
+
appUrl = null,
|
|
18578
|
+
//
|
|
18579
|
+
logo,
|
|
18580
|
+
name,
|
|
18581
|
+
trustedAuthorizedApp,
|
|
18582
|
+
firstConnectedAt
|
|
18583
|
+
// untrustApp
|
|
18584
|
+
} = props;
|
|
18486
18585
|
const { t } = useT();
|
|
18487
|
-
const projectUrl = appUrl || null;
|
|
18488
18586
|
return /* @__PURE__ */ jsxs79(
|
|
18489
18587
|
"div",
|
|
18490
18588
|
{
|
|
@@ -18493,14 +18591,14 @@ function Application(props) {
|
|
|
18493
18591
|
"select-none text-[10px] leading-tight",
|
|
18494
18592
|
"p-2 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-secondary)]",
|
|
18495
18593
|
{
|
|
18496
|
-
"cursor-default": !
|
|
18497
|
-
"cursor-pointer transition-colors duration-200": !!
|
|
18498
|
-
"hover:bg-[var(--ui-kit-secondary-h)] active:bg-[var(--ui-kit-secondary-a)]": !!
|
|
18594
|
+
"cursor-default": !appUrl,
|
|
18595
|
+
"cursor-pointer transition-colors duration-200": !!appUrl,
|
|
18596
|
+
"hover:bg-[var(--ui-kit-secondary-h)] active:bg-[var(--ui-kit-secondary-a)]": !!appUrl
|
|
18499
18597
|
}
|
|
18500
18598
|
),
|
|
18501
18599
|
onClick: () => {
|
|
18502
|
-
if (!
|
|
18503
|
-
window.open(
|
|
18600
|
+
if (!appUrl) return;
|
|
18601
|
+
window.open(appUrl, "_blank", "noopener,noreferrer");
|
|
18504
18602
|
},
|
|
18505
18603
|
children: [
|
|
18506
18604
|
/* @__PURE__ */ jsxs79(
|
|
@@ -18530,9 +18628,9 @@ function Application(props) {
|
|
|
18530
18628
|
/* @__PURE__ */ jsxs79("div", { className: "flex-1 min-w-0", children: [
|
|
18531
18629
|
/* @__PURE__ */ jsxs79("span", { className: "flex flex-col", children: [
|
|
18532
18630
|
/* @__PURE__ */ jsx85("span", { className: "text-sm font-semibold truncate", children: name }),
|
|
18533
|
-
|
|
18631
|
+
appUrl && /* @__PURE__ */ jsxs79("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18534
18632
|
/* @__PURE__ */ jsx85(ExternalLinkIcon2, { className: "w-3 h-3 flex-none", strokeWidth: 1 }),
|
|
18535
|
-
/* @__PURE__ */ jsx85("span", { className: "flex-1 truncate", children: new URL(
|
|
18633
|
+
/* @__PURE__ */ jsx85("span", { className: "flex-1 truncate", children: new URL(appUrl).hostname })
|
|
18536
18634
|
] })
|
|
18537
18635
|
] }),
|
|
18538
18636
|
/* @__PURE__ */ jsx85("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: t(
|
|
@@ -18553,10 +18651,10 @@ function Application(props) {
|
|
|
18553
18651
|
),
|
|
18554
18652
|
onClick: (e) => {
|
|
18555
18653
|
e.stopPropagation();
|
|
18556
|
-
untrustApp({
|
|
18654
|
+
useSecurityStore.getState().untrustApp({
|
|
18557
18655
|
projectId,
|
|
18558
|
-
origin:
|
|
18559
|
-
hostname:
|
|
18656
|
+
origin: appUrl || void 0,
|
|
18657
|
+
hostname: appUrl ? new URL(appUrl).hostname : void 0,
|
|
18560
18658
|
appName: name,
|
|
18561
18659
|
appLogo: logo
|
|
18562
18660
|
});
|
|
@@ -18568,48 +18666,152 @@ function Application(props) {
|
|
|
18568
18666
|
}
|
|
18569
18667
|
);
|
|
18570
18668
|
}
|
|
18571
|
-
function ConnectedApps(
|
|
18572
|
-
const { isLoading: isParentLoading, untrustApp } = props;
|
|
18669
|
+
function ConnectedApps() {
|
|
18573
18670
|
const { t } = useT();
|
|
18574
18671
|
const { data: connectedApps = [], isLoading: isConnectedAppsLoading } = useConnectedApps();
|
|
18575
|
-
|
|
18576
|
-
|
|
18577
|
-
|
|
18672
|
+
useEffect34(() => {
|
|
18673
|
+
if (!connectedApps.length || isConnectedAppsLoading) return;
|
|
18674
|
+
useSecurityStore.getState().setRenderKey(`connected-apps-loaded-${Date.now()}`);
|
|
18675
|
+
}, [connectedApps, isConnectedAppsLoading]);
|
|
18676
|
+
if (!isConnectedAppsLoading && connectedApps.length === 0)
|
|
18578
18677
|
return /* @__PURE__ */ jsxs79(Highlight, { type: "info", className: "flex gap-[var(--ui-kit-gap)] ", children: [
|
|
18579
|
-
/* @__PURE__ */ jsx85(
|
|
18678
|
+
/* @__PURE__ */ jsx85(InfoIcon4, { className: "w-4 h-4" }),
|
|
18580
18679
|
/* @__PURE__ */ jsx85("span", { children: t("passport:securityMenu.connectedApps.noConnectedApps") })
|
|
18581
18680
|
] });
|
|
18582
18681
|
return /* @__PURE__ */ jsxs79(Fragment32, { children: [
|
|
18583
|
-
/* @__PURE__ */
|
|
18584
|
-
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
untrustApp
|
|
18589
|
-
},
|
|
18590
|
-
index
|
|
18591
|
-
)) })
|
|
18682
|
+
/* @__PURE__ */ jsxs79("div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
|
|
18683
|
+
/* @__PURE__ */ jsx85("span", { className: "leading-4 text-xs", children: t("passport:securityMenu.connectedApps.connectedApps") }),
|
|
18684
|
+
isConnectedAppsLoading && /* @__PURE__ */ jsx85(LoaderIcon9, { className: "h-4 w-4 animate-spin" })
|
|
18685
|
+
] }),
|
|
18686
|
+
/* @__PURE__ */ jsx85("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: connectedApps.map((app, index) => /* @__PURE__ */ jsx85(Application, { ...app }, index)) })
|
|
18592
18687
|
] });
|
|
18593
18688
|
}
|
|
18594
18689
|
var init_ConnectedApps = __esm({
|
|
18595
|
-
"src/internal/components/SecurityMenu/ConnectedApps.tsx"() {
|
|
18690
|
+
"src/internal/components/SecurityMenu/ConnectedApps/ConnectedApps.tsx"() {
|
|
18596
18691
|
init_utils2();
|
|
18597
18692
|
init_i18n();
|
|
18598
18693
|
init_button();
|
|
18599
18694
|
init_highlight();
|
|
18600
|
-
|
|
18695
|
+
init_useSecurityStore();
|
|
18696
|
+
init_useConnectedApps();
|
|
18697
|
+
}
|
|
18698
|
+
});
|
|
18699
|
+
|
|
18700
|
+
// src/internal/components/SecurityMenu/ConnectedApps/UntrustApplication.tsx
|
|
18701
|
+
import { useMutation as useMutation18, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
|
|
18702
|
+
import { AppWindowMac as AppWindowMac2, Loader as Loader18 } from "lucide-react";
|
|
18703
|
+
import { jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
18704
|
+
function UntrustApplication() {
|
|
18705
|
+
const { t } = useT();
|
|
18706
|
+
const qc = useQueryClient21();
|
|
18707
|
+
const userId = useSession((st) => st?.session?.mpcUserId);
|
|
18708
|
+
const appToUntrust = useSecurityStore((st) => st.appToUntrust);
|
|
18709
|
+
const { mutate: handleUntrustApp, isPending: isUntrustingApp } = useMutation18({
|
|
18710
|
+
mutationFn: async () => {
|
|
18711
|
+
if (!userId || !appToUntrust) return;
|
|
18712
|
+
const iframeManager = getIframeManager();
|
|
18713
|
+
if (!iframeManager) {
|
|
18714
|
+
throw new Error("Iframe manager not available");
|
|
18715
|
+
}
|
|
18716
|
+
return await iframeManager.removeTrustedApp(userId, appToUntrust.projectId, appToUntrust.origin);
|
|
18717
|
+
},
|
|
18718
|
+
onSuccess: (success) => {
|
|
18719
|
+
if (!success) {
|
|
18720
|
+
console.error("[SecurityMenu] Failed to remove trusted app from iframe");
|
|
18721
|
+
return;
|
|
18722
|
+
}
|
|
18723
|
+
qc.invalidateQueries({ queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId] });
|
|
18724
|
+
useSecurityStore.getState().untrustApp(null);
|
|
18725
|
+
},
|
|
18726
|
+
onError: (error) => {
|
|
18727
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
18728
|
+
console.error("[SecurityMenu] Error removing trusted app:", errorMessage);
|
|
18729
|
+
}
|
|
18730
|
+
});
|
|
18731
|
+
return /* @__PURE__ */ jsxs80("div", { className: "flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18732
|
+
/* @__PURE__ */ jsxs80(Highlight, { className: "flex flex-col gap-[var(--ui-kit-gap)]", type: "warning", children: [
|
|
18733
|
+
/* @__PURE__ */ jsxs80("span", { className: "text-sm leading-5 font-bold", children: [
|
|
18734
|
+
t("passport:securityMenu.connectedApps.untrustApp"),
|
|
18735
|
+
"?"
|
|
18736
|
+
] }),
|
|
18737
|
+
/* @__PURE__ */ jsxs80("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)]", children: [
|
|
18738
|
+
appToUntrust.appLogo ? /* @__PURE__ */ jsx86("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex-shrink-0 p-1", children: /* @__PURE__ */ jsx86("img", { src: appToUntrust.appLogo, alt: appToUntrust.appName, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ jsx86("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx86(AppWindowMac2, { className: "w-6 h-6" }) }),
|
|
18739
|
+
/* @__PURE__ */ jsxs80("div", { className: "flex-1 text-left", children: [
|
|
18740
|
+
/* @__PURE__ */ jsx86("div", { className: "font-medium", children: appToUntrust.appName }),
|
|
18741
|
+
appToUntrust.hostname && /* @__PURE__ */ jsxs80("div", { className: "text-[10px]", children: [
|
|
18742
|
+
"(",
|
|
18743
|
+
appToUntrust.hostname,
|
|
18744
|
+
")"
|
|
18745
|
+
] })
|
|
18746
|
+
] })
|
|
18747
|
+
] })
|
|
18748
|
+
] }),
|
|
18749
|
+
/* @__PURE__ */ jsxs80("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] text-left space-y-1", children: [
|
|
18750
|
+
/* @__PURE__ */ jsxs80("p", { children: [
|
|
18751
|
+
t("passport:securityMenu.connectedApps.removalNoteTitle"),
|
|
18752
|
+
":"
|
|
18753
|
+
] }),
|
|
18754
|
+
/* @__PURE__ */ jsxs80("ul", { className: "list-disc list-inside ml-2 space-y-0.5", children: [
|
|
18755
|
+
/* @__PURE__ */ jsx86("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg1") }),
|
|
18756
|
+
/* @__PURE__ */ jsx86("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg2") })
|
|
18757
|
+
] })
|
|
18758
|
+
] }),
|
|
18759
|
+
/* @__PURE__ */ jsxs80("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
18760
|
+
/* @__PURE__ */ jsx86(
|
|
18761
|
+
Button,
|
|
18762
|
+
{
|
|
18763
|
+
variant: "outline",
|
|
18764
|
+
size: "large",
|
|
18765
|
+
className: "flex-1",
|
|
18766
|
+
onClick: () => useSecurityStore.getState().untrustApp(null),
|
|
18767
|
+
disabled: isUntrustingApp,
|
|
18768
|
+
children: t("passport:common.cancel")
|
|
18769
|
+
}
|
|
18770
|
+
),
|
|
18771
|
+
/* @__PURE__ */ jsx86(
|
|
18772
|
+
Button,
|
|
18773
|
+
{
|
|
18774
|
+
variant: "default",
|
|
18775
|
+
size: "large",
|
|
18776
|
+
className: "flex-1",
|
|
18777
|
+
onClick: () => handleUntrustApp(),
|
|
18778
|
+
disabled: isUntrustingApp,
|
|
18779
|
+
children: isUntrustingApp ? /* @__PURE__ */ jsx86(Loader18, { className: "h-4 w-4 animate-spin" }) : t("passport:common.delete")
|
|
18780
|
+
}
|
|
18781
|
+
)
|
|
18782
|
+
] })
|
|
18783
|
+
] });
|
|
18784
|
+
}
|
|
18785
|
+
var init_UntrustApplication = __esm({
|
|
18786
|
+
"src/internal/components/SecurityMenu/ConnectedApps/UntrustApplication.tsx"() {
|
|
18787
|
+
init_SessionContext();
|
|
18788
|
+
init_i18n();
|
|
18789
|
+
init_iframe_manager();
|
|
18790
|
+
init_button();
|
|
18791
|
+
init_highlight();
|
|
18792
|
+
init_constants5();
|
|
18793
|
+
init_useSecurityStore();
|
|
18794
|
+
}
|
|
18795
|
+
});
|
|
18796
|
+
|
|
18797
|
+
// src/internal/components/SecurityMenu/ConnectedApps/index.ts
|
|
18798
|
+
var init_ConnectedApps2 = __esm({
|
|
18799
|
+
"src/internal/components/SecurityMenu/ConnectedApps/index.ts"() {
|
|
18800
|
+
init_ConnectedApps();
|
|
18801
|
+
init_UntrustApplication();
|
|
18802
|
+
init_useConnectedApps();
|
|
18601
18803
|
}
|
|
18602
18804
|
});
|
|
18603
18805
|
|
|
18604
18806
|
// src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx
|
|
18605
18807
|
import { Loader as Loader19 } from "lucide-react";
|
|
18606
|
-
import { jsx as
|
|
18808
|
+
import { jsx as jsx87, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
18607
18809
|
function KeyshareStatus(props) {
|
|
18608
18810
|
const { isLoading, content, icon: Icon2, children } = props;
|
|
18609
|
-
if (isLoading) return /* @__PURE__ */
|
|
18610
|
-
return /* @__PURE__ */
|
|
18811
|
+
if (isLoading) return /* @__PURE__ */ jsx87(Loader19, { className: "w-4 h-4 animate-spin" });
|
|
18812
|
+
return /* @__PURE__ */ jsxs81("div", { className: "group relative w-full h-full", children: [
|
|
18611
18813
|
children,
|
|
18612
|
-
/* @__PURE__ */
|
|
18814
|
+
/* @__PURE__ */ jsx87(
|
|
18613
18815
|
"div",
|
|
18614
18816
|
{
|
|
18615
18817
|
className: cn(
|
|
@@ -18617,10 +18819,10 @@ function KeyshareStatus(props) {
|
|
|
18617
18819
|
"rounded-full bg-[var(--ui-kit-bg)]"
|
|
18618
18820
|
// 'border border-[var(--ui-kit-bd)]'
|
|
18619
18821
|
),
|
|
18620
|
-
children: /* @__PURE__ */
|
|
18822
|
+
children: /* @__PURE__ */ jsx87(Icon2, { className: "w-4 h-4" })
|
|
18621
18823
|
}
|
|
18622
18824
|
),
|
|
18623
|
-
/* @__PURE__ */
|
|
18825
|
+
/* @__PURE__ */ jsx87(
|
|
18624
18826
|
"div",
|
|
18625
18827
|
{
|
|
18626
18828
|
style: { transform: "translateY(calc(var(--ui-kit-gap) * -4))" },
|
|
@@ -18645,7 +18847,7 @@ var init_KeyshareStatus = __esm({
|
|
|
18645
18847
|
// src/internal/components/SecurityMenu/Keyshare/LastBackup.tsx
|
|
18646
18848
|
import dayjs6 from "dayjs";
|
|
18647
18849
|
import { DatabaseBackup } from "lucide-react";
|
|
18648
|
-
import { Fragment as Fragment33, jsx as
|
|
18850
|
+
import { Fragment as Fragment33, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
18649
18851
|
function parseOS(ua) {
|
|
18650
18852
|
if (!ua) return null;
|
|
18651
18853
|
if (ua.includes("Mac OS X")) return "Mac OS";
|
|
@@ -18671,18 +18873,18 @@ function LastBackup(props) {
|
|
|
18671
18873
|
} = createdRecoveryStats || {};
|
|
18672
18874
|
const hasBackupData = backup?.server?.enabled && backup.server.lastBackup || !backup.server.lastBackup && recoveryCreatedAt || backup.cloud.enabled && backup.cloud?.lastBackup || backup.local.enabled && backup.local.lastBackup;
|
|
18673
18875
|
if (!hasBackupData || !createdRecoveryStats) return null;
|
|
18674
|
-
return /* @__PURE__ */
|
|
18675
|
-
/* @__PURE__ */
|
|
18676
|
-
/* @__PURE__ */
|
|
18677
|
-
/* @__PURE__ */
|
|
18876
|
+
return /* @__PURE__ */ jsxs82(Highlight, { type: "info", className: "text-[10px] leading-4", children: [
|
|
18877
|
+
/* @__PURE__ */ jsxs82("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18878
|
+
/* @__PURE__ */ jsx88(DatabaseBackup, { className: "w-4 h-4 flex-none" }),
|
|
18879
|
+
/* @__PURE__ */ jsx88("span", { className: "font-medium text-xs", children: t("passport:securityMenu.lastBackup") })
|
|
18678
18880
|
] }),
|
|
18679
|
-
recoveryCreatedAt && /* @__PURE__ */
|
|
18680
|
-
/* @__PURE__ */
|
|
18881
|
+
recoveryCreatedAt && /* @__PURE__ */ jsxs82(Fragment33, { children: [
|
|
18882
|
+
/* @__PURE__ */ jsx88("span", { className: "block font-mono! ", children: t("passport:securityMenu.lastBackupMeta", {
|
|
18681
18883
|
browser: cleanStringArtifacts(recoveryBrowser || "unknown"),
|
|
18682
18884
|
os: parseOS(recoveryUa) || "unknown os",
|
|
18683
18885
|
deviceName: cleanStringArtifacts(recoveryDeviceName || recoveryDeviceId || "")
|
|
18684
18886
|
}) }),
|
|
18685
|
-
/* @__PURE__ */
|
|
18887
|
+
/* @__PURE__ */ jsx88("span", { className: "block font-mono! text-[var(--ui-kit-fg-muted)]", children: dayjs6(recoveryCreatedAt).format("MMMM DD, YYYY HH:mm") })
|
|
18686
18888
|
] })
|
|
18687
18889
|
] });
|
|
18688
18890
|
}
|
|
@@ -18697,85 +18899,133 @@ var init_LastBackup = __esm({
|
|
|
18697
18899
|
}
|
|
18698
18900
|
});
|
|
18699
18901
|
|
|
18902
|
+
// src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts
|
|
18903
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
18904
|
+
function useKeyshareRecoveryStats() {
|
|
18905
|
+
const session = useSession((st) => st.session);
|
|
18906
|
+
const userId = session?.mpcUserId || null;
|
|
18907
|
+
return useQuery17({
|
|
18908
|
+
enabled: !!userId,
|
|
18909
|
+
queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
|
|
18910
|
+
queryFn: async () => {
|
|
18911
|
+
const iframeManager = getIframeManager();
|
|
18912
|
+
if (!iframeManager) {
|
|
18913
|
+
throw new Error("Iframe manager not available");
|
|
18914
|
+
}
|
|
18915
|
+
const keyshareInfo = await getKeyshareInfo(userId);
|
|
18916
|
+
const shareRecoveryStats = await getShareRecoveryStats();
|
|
18917
|
+
return {
|
|
18918
|
+
keyshareInfo,
|
|
18919
|
+
shareRecoveryStats
|
|
18920
|
+
};
|
|
18921
|
+
}
|
|
18922
|
+
});
|
|
18923
|
+
}
|
|
18924
|
+
var init_useKeyshareRecoveryStats = __esm({
|
|
18925
|
+
"src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts"() {
|
|
18926
|
+
init_SessionContext();
|
|
18927
|
+
init_keyshare();
|
|
18928
|
+
init_iframe_manager();
|
|
18929
|
+
init_vaultClient();
|
|
18930
|
+
init_constants5();
|
|
18931
|
+
}
|
|
18932
|
+
});
|
|
18933
|
+
|
|
18700
18934
|
// src/internal/components/SecurityMenu/Keyshare/Keyshare.tsx
|
|
18701
|
-
import { Cloud as Cloud3, Laptop, LoaderIcon as
|
|
18702
|
-
import {
|
|
18703
|
-
|
|
18704
|
-
|
|
18935
|
+
import { Cloud as Cloud3, Laptop, LoaderIcon as LoaderIcon10, Server as Server2 } from "lucide-react";
|
|
18936
|
+
import { useEffect as useEffect35 } from "react";
|
|
18937
|
+
import { Fragment as Fragment34, jsx as jsx89, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
18938
|
+
function Keyshare() {
|
|
18939
|
+
const userId = useSession((st) => st?.session?.mpcUserId);
|
|
18705
18940
|
const { t } = useT();
|
|
18941
|
+
const serverHasKeyshare = jwtTokenManager2.getHasKeyshare() ?? false;
|
|
18942
|
+
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
18943
|
+
useEffect35(() => {
|
|
18944
|
+
if (!recoveryData?.keyshareInfo || isRecoveryLoading) return;
|
|
18945
|
+
useSecurityStore.getState().setRenderKey(`keyshare-loaded-${Date.now()}`);
|
|
18946
|
+
}, [recoveryData, isRecoveryLoading]);
|
|
18947
|
+
const localInfo = recoveryData?.keyshareInfo || {};
|
|
18948
|
+
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
18706
18949
|
const backup = userId ? getBackupStatus(userId) : { server: { enabled: false }, cloud: { enabled: false }, local: { enabled: false } };
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
/* @__PURE__ */ jsxs82("div", { className: "grid grid-cols-3 gap-[var(--ui-kit-gap)] px-[var(--ui-kit-gap)]", children: [
|
|
18713
|
-
/* @__PURE__ */ jsx88(
|
|
18714
|
-
KeyshareStatus,
|
|
18715
|
-
{
|
|
18716
|
-
content: serverHasKeyshare ? t("passport:securityMenu.keyshareStatus.serverReady") : t("passport:securityMenu.keyshareStatus.serverMissing"),
|
|
18717
|
-
icon: serverHasKeyshare ? PositiveIcon : NegativeIcon,
|
|
18718
|
-
children: /* @__PURE__ */ jsxs82(
|
|
18719
|
-
Highlight,
|
|
18720
|
-
{
|
|
18721
|
-
type: serverHasKeyshare ? "success" : "warning",
|
|
18722
|
-
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18723
|
-
children: [
|
|
18724
|
-
/* @__PURE__ */ jsx88(Cloud3, { className: "h-6 w-6" }),
|
|
18725
|
-
/* @__PURE__ */ jsx88("span", { className: "text-[10px] font-medium leading-4", children: "Server Share" })
|
|
18726
|
-
]
|
|
18727
|
-
}
|
|
18728
|
-
)
|
|
18729
|
-
}
|
|
18730
|
-
),
|
|
18731
|
-
/* @__PURE__ */ jsx88(
|
|
18732
|
-
KeyshareStatus,
|
|
18733
|
-
{
|
|
18734
|
-
content: localInfo?.hasKeyshare ? t("passport:securityMenu.keyshareStatus.localReady") : t("passport:securityMenu.keyshareStatus.localMissing"),
|
|
18735
|
-
icon: localInfo?.hasKeyshare ? PositiveIcon : NegativeIcon,
|
|
18736
|
-
children: /* @__PURE__ */ jsxs82(
|
|
18737
|
-
Highlight,
|
|
18738
|
-
{
|
|
18739
|
-
type: localInfo?.hasKeyshare ? "success" : "warning",
|
|
18740
|
-
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18741
|
-
children: [
|
|
18742
|
-
/* @__PURE__ */ jsx88(Laptop, { className: "h-6 w-6" }),
|
|
18743
|
-
/* @__PURE__ */ jsx88("span", { className: "text-[10px] font-medium leading-4", children: "Local Share" })
|
|
18744
|
-
]
|
|
18745
|
-
}
|
|
18746
|
-
)
|
|
18747
|
-
}
|
|
18748
|
-
),
|
|
18749
|
-
/* @__PURE__ */ jsx88(
|
|
18750
|
-
KeyshareStatus,
|
|
18751
|
-
{
|
|
18752
|
-
content: hasServerBackup ? t("passport:securityMenu.keyshareStatus.valutBackupCreated") : t("passport:securityMenu.keyshareStatus.valutBackupMissing"),
|
|
18753
|
-
icon: hasServerBackup ? PositiveIcon : NegativeIcon,
|
|
18754
|
-
children: /* @__PURE__ */ jsxs82(
|
|
18755
|
-
Highlight,
|
|
18756
|
-
{
|
|
18757
|
-
type: hasServerBackup ? "success" : "warning",
|
|
18758
|
-
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18759
|
-
children: [
|
|
18760
|
-
/* @__PURE__ */ jsx88(Server2, { className: "h-6 w-6" }),
|
|
18761
|
-
/* @__PURE__ */ jsx88("span", { className: "text-[10px] font-medium leading-4", children: "Vault Backup" })
|
|
18762
|
-
]
|
|
18763
|
-
}
|
|
18764
|
-
)
|
|
18765
|
-
}
|
|
18766
|
-
)
|
|
18950
|
+
const createdRecoveryStats = recoveryData?.shareRecoveryStats?.created;
|
|
18951
|
+
return /* @__PURE__ */ jsxs83(Fragment34, { children: [
|
|
18952
|
+
/* @__PURE__ */ jsxs83("div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
|
|
18953
|
+
/* @__PURE__ */ jsx89("span", { className: "text-xs leading-4", children: t("passport:securityMenu.keyshareStatus.title") }),
|
|
18954
|
+
isRecoveryLoading && /* @__PURE__ */ jsx89(LoaderIcon10, { className: "h-4 w-4 animate-spin" })
|
|
18767
18955
|
] }),
|
|
18768
|
-
/* @__PURE__ */
|
|
18956
|
+
!isRecoveryLoading && /* @__PURE__ */ jsxs83(Fragment34, { children: [
|
|
18957
|
+
/* @__PURE__ */ jsxs83("div", { className: "grid grid-cols-3 gap-[var(--ui-kit-gap)] px-[var(--ui-kit-gap)]", children: [
|
|
18958
|
+
/* @__PURE__ */ jsx89(
|
|
18959
|
+
KeyshareStatus,
|
|
18960
|
+
{
|
|
18961
|
+
content: serverHasKeyshare ? t("passport:securityMenu.keyshareStatus.serverReady") : t("passport:securityMenu.keyshareStatus.serverMissing"),
|
|
18962
|
+
icon: serverHasKeyshare ? PositiveIcon : NegativeIcon,
|
|
18963
|
+
children: /* @__PURE__ */ jsxs83(
|
|
18964
|
+
Highlight,
|
|
18965
|
+
{
|
|
18966
|
+
type: serverHasKeyshare ? "success" : "warning",
|
|
18967
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18968
|
+
children: [
|
|
18969
|
+
/* @__PURE__ */ jsx89(Cloud3, { className: "h-6 w-6" }),
|
|
18970
|
+
/* @__PURE__ */ jsx89("span", { className: "text-[10px] font-medium leading-4", children: "Server Share" })
|
|
18971
|
+
]
|
|
18972
|
+
}
|
|
18973
|
+
)
|
|
18974
|
+
}
|
|
18975
|
+
),
|
|
18976
|
+
/* @__PURE__ */ jsx89(
|
|
18977
|
+
KeyshareStatus,
|
|
18978
|
+
{
|
|
18979
|
+
content: localInfo?.hasKeyshare ? t("passport:securityMenu.keyshareStatus.localReady") : t("passport:securityMenu.keyshareStatus.localMissing"),
|
|
18980
|
+
icon: localInfo?.hasKeyshare ? PositiveIcon : NegativeIcon,
|
|
18981
|
+
children: /* @__PURE__ */ jsxs83(
|
|
18982
|
+
Highlight,
|
|
18983
|
+
{
|
|
18984
|
+
type: localInfo?.hasKeyshare ? "success" : "warning",
|
|
18985
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18986
|
+
children: [
|
|
18987
|
+
/* @__PURE__ */ jsx89(Laptop, { className: "h-6 w-6" }),
|
|
18988
|
+
/* @__PURE__ */ jsx89("span", { className: "text-[10px] font-medium leading-4", children: "Local Share" })
|
|
18989
|
+
]
|
|
18990
|
+
}
|
|
18991
|
+
)
|
|
18992
|
+
}
|
|
18993
|
+
),
|
|
18994
|
+
/* @__PURE__ */ jsx89(
|
|
18995
|
+
KeyshareStatus,
|
|
18996
|
+
{
|
|
18997
|
+
content: hasServerBackup ? t("passport:securityMenu.keyshareStatus.valutBackupCreated") : t("passport:securityMenu.keyshareStatus.valutBackupMissing"),
|
|
18998
|
+
icon: hasServerBackup ? PositiveIcon : NegativeIcon,
|
|
18999
|
+
children: /* @__PURE__ */ jsxs83(
|
|
19000
|
+
Highlight,
|
|
19001
|
+
{
|
|
19002
|
+
type: hasServerBackup ? "success" : "warning",
|
|
19003
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
19004
|
+
children: [
|
|
19005
|
+
/* @__PURE__ */ jsx89(Server2, { className: "h-6 w-6" }),
|
|
19006
|
+
/* @__PURE__ */ jsx89("span", { className: "text-[10px] font-medium leading-4", children: "Vault Backup" })
|
|
19007
|
+
]
|
|
19008
|
+
}
|
|
19009
|
+
)
|
|
19010
|
+
}
|
|
19011
|
+
)
|
|
19012
|
+
] }),
|
|
19013
|
+
/* @__PURE__ */ jsx89(LastBackup, { backup, createdRecoveryStats })
|
|
19014
|
+
] })
|
|
18769
19015
|
] });
|
|
18770
19016
|
}
|
|
18771
19017
|
var init_Keyshare = __esm({
|
|
18772
19018
|
"src/internal/components/SecurityMenu/Keyshare/Keyshare.tsx"() {
|
|
19019
|
+
init_SessionContext();
|
|
18773
19020
|
init_useT();
|
|
18774
19021
|
init_icons();
|
|
19022
|
+
init_auth();
|
|
18775
19023
|
init_vaultClient();
|
|
18776
19024
|
init_highlight();
|
|
19025
|
+
init_useSecurityStore();
|
|
18777
19026
|
init_KeyshareStatus();
|
|
18778
19027
|
init_LastBackup();
|
|
19028
|
+
init_useKeyshareRecoveryStats();
|
|
18779
19029
|
{
|
|
18780
19030
|
}
|
|
18781
19031
|
{
|
|
@@ -18787,95 +19037,18 @@ var init_Keyshare = __esm({
|
|
|
18787
19037
|
var init_Keyshare2 = __esm({
|
|
18788
19038
|
"src/internal/components/SecurityMenu/Keyshare/index.ts"() {
|
|
18789
19039
|
init_Keyshare();
|
|
18790
|
-
|
|
18791
|
-
});
|
|
18792
|
-
|
|
18793
|
-
// src/internal/components/SecurityMenu/UntrustApplication.tsx
|
|
18794
|
-
import { AppWindowMac as AppWindowMac2, Loader as Loader20 } from "lucide-react";
|
|
18795
|
-
import { jsx as jsx89, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
18796
|
-
function UntrustApplication(props) {
|
|
18797
|
-
const { appToUntrust, isPending, cancelUntrust, handleUntrustApp } = props;
|
|
18798
|
-
const { t } = useT();
|
|
18799
|
-
return /* @__PURE__ */ jsxs83("div", { className: "flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18800
|
-
/* @__PURE__ */ jsxs83(Highlight, { className: "flex flex-col gap-[var(--ui-kit-gap)]", type: "warning", children: [
|
|
18801
|
-
/* @__PURE__ */ jsxs83("span", { className: "text-sm leading-5 font-bold", children: [
|
|
18802
|
-
t("passport:securityMenu.connectedApps.untrustApp"),
|
|
18803
|
-
"?"
|
|
18804
|
-
] }),
|
|
18805
|
-
/* @__PURE__ */ jsxs83("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)]", children: [
|
|
18806
|
-
appToUntrust.appLogo ? /* @__PURE__ */ jsx89("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex-shrink-0 p-1", children: /* @__PURE__ */ jsx89("img", { src: appToUntrust.appLogo, alt: appToUntrust.appName, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ jsx89("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx89(AppWindowMac2, { className: "w-6 h-6" }) }),
|
|
18807
|
-
/* @__PURE__ */ jsxs83("div", { className: "flex-1 text-left", children: [
|
|
18808
|
-
/* @__PURE__ */ jsx89("div", { className: "font-medium", children: appToUntrust.appName }),
|
|
18809
|
-
appToUntrust.hostname && /* @__PURE__ */ jsxs83("div", { className: "text-[10px]", children: [
|
|
18810
|
-
"(",
|
|
18811
|
-
appToUntrust.hostname,
|
|
18812
|
-
")"
|
|
18813
|
-
] })
|
|
18814
|
-
] })
|
|
18815
|
-
] })
|
|
18816
|
-
] }),
|
|
18817
|
-
/* @__PURE__ */ jsxs83("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] text-left space-y-1", children: [
|
|
18818
|
-
/* @__PURE__ */ jsxs83("p", { children: [
|
|
18819
|
-
t("passport:securityMenu.connectedApps.removalNoteTitle"),
|
|
18820
|
-
":"
|
|
18821
|
-
] }),
|
|
18822
|
-
/* @__PURE__ */ jsxs83("ul", { className: "list-disc list-inside ml-2 space-y-0.5", children: [
|
|
18823
|
-
/* @__PURE__ */ jsx89("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg1") }),
|
|
18824
|
-
/* @__PURE__ */ jsx89("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg2") })
|
|
18825
|
-
] })
|
|
18826
|
-
] }),
|
|
18827
|
-
/* @__PURE__ */ jsxs83("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
18828
|
-
/* @__PURE__ */ jsx89(Button, { variant: "outline", size: "large", className: "flex-1", onClick: () => cancelUntrust(), disabled: isPending, children: t("passport:common.cancel") }),
|
|
18829
|
-
/* @__PURE__ */ jsx89(Button, { variant: "default", size: "large", className: "flex-1", onClick: handleUntrustApp, disabled: isPending, children: isPending ? /* @__PURE__ */ jsx89(Loader20, { className: "h-4 w-4 animate-spin" }) : t("passport:common.delete") })
|
|
18830
|
-
] })
|
|
18831
|
-
] });
|
|
18832
|
-
}
|
|
18833
|
-
var init_UntrustApplication = __esm({
|
|
18834
|
-
"src/internal/components/SecurityMenu/UntrustApplication.tsx"() {
|
|
18835
|
-
init_i18n();
|
|
18836
|
-
init_button();
|
|
18837
|
-
init_highlight();
|
|
19040
|
+
init_useKeyshareRecoveryStats();
|
|
18838
19041
|
}
|
|
18839
19042
|
});
|
|
18840
19043
|
|
|
18841
19044
|
// src/internal/components/SecurityMenu/SecurityMenu.tsx
|
|
18842
|
-
import { useMutation as useMutation18, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
|
|
18843
19045
|
import { ArrowLeft as ArrowLeft18 } from "lucide-react";
|
|
18844
|
-
import {
|
|
18845
|
-
import { jsx as jsx90, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
19046
|
+
import { Fragment as Fragment35, jsx as jsx90, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
18846
19047
|
function SecurityMenu() {
|
|
18847
|
-
const qc = useQueryClient21();
|
|
18848
19048
|
const { t } = useT();
|
|
18849
19049
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18850
|
-
const
|
|
18851
|
-
const
|
|
18852
|
-
const serverHasKeyshare = jwtTokenManager2.getHasKeyshare() ?? false;
|
|
18853
|
-
const [appToUntrust, untrustApp] = useState22(null);
|
|
18854
|
-
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
18855
|
-
const localInfo = recoveryData?.keyshareInfo || {};
|
|
18856
|
-
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
18857
|
-
const { mutate: handleUntrustApp, isPending: isUntrustingApp } = useMutation18({
|
|
18858
|
-
mutationFn: async () => {
|
|
18859
|
-
if (!userId || !appToUntrust) return;
|
|
18860
|
-
const iframeManager = getIframeManager();
|
|
18861
|
-
if (!iframeManager) {
|
|
18862
|
-
throw new Error("Iframe manager not available");
|
|
18863
|
-
}
|
|
18864
|
-
return await iframeManager.removeTrustedApp(userId, appToUntrust.projectId, appToUntrust.origin);
|
|
18865
|
-
},
|
|
18866
|
-
onSuccess: (success) => {
|
|
18867
|
-
if (!success) {
|
|
18868
|
-
console.error("[SecurityMenu] Failed to remove trusted app from iframe");
|
|
18869
|
-
return;
|
|
18870
|
-
}
|
|
18871
|
-
qc.invalidateQueries({ queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId] });
|
|
18872
|
-
untrustApp(null);
|
|
18873
|
-
},
|
|
18874
|
-
onError: (error) => {
|
|
18875
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
18876
|
-
console.error("[SecurityMenu] Error removing trusted app:", errorMessage);
|
|
18877
|
-
}
|
|
18878
|
-
});
|
|
19050
|
+
const appToUntrust = useSecurityStore((st) => st.appToUntrust);
|
|
19051
|
+
const renderKey = useSecurityStore((st) => st.renderKey);
|
|
18879
19052
|
return /* @__PURE__ */ jsx90(
|
|
18880
19053
|
"div",
|
|
18881
19054
|
{
|
|
@@ -18893,35 +19066,24 @@ function SecurityMenu() {
|
|
|
18893
19066
|
size: "icon",
|
|
18894
19067
|
title: t("passport:common.back"),
|
|
18895
19068
|
onClick: () => {
|
|
18896
|
-
|
|
18897
|
-
|
|
19069
|
+
const { appToUntrust: appToUntrust2, untrustApp } = useSecurityStore.getState();
|
|
19070
|
+
if (!!appToUntrust2) {
|
|
19071
|
+
untrustApp(null);
|
|
19072
|
+
} else {
|
|
19073
|
+
useLayoutDataStore.getState().setPage("settings" /* SETTINGS */);
|
|
19074
|
+
}
|
|
18898
19075
|
},
|
|
18899
19076
|
children: /* @__PURE__ */ jsx90(ArrowLeft18, { className: "h-4 w-4" })
|
|
18900
19077
|
}
|
|
18901
19078
|
),
|
|
18902
19079
|
/* @__PURE__ */ jsx90("span", { className: "text-xl font-semibold", children: t("passport:securityMenu.title") })
|
|
18903
19080
|
] }),
|
|
18904
|
-
appToUntrust && /* @__PURE__ */ jsx90(
|
|
18905
|
-
|
|
18906
|
-
{
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
handleUntrustApp: async () => await handleUntrustApp()
|
|
18911
|
-
}
|
|
18912
|
-
),
|
|
18913
|
-
!appToUntrust && /* @__PURE__ */ jsx90(
|
|
18914
|
-
Keyshare,
|
|
18915
|
-
{
|
|
18916
|
-
userId,
|
|
18917
|
-
serverHasKeyshare,
|
|
18918
|
-
localInfo,
|
|
18919
|
-
hasServerBackup,
|
|
18920
|
-
isLoading: isRecoveryLoading,
|
|
18921
|
-
createdRecoveryStats: recoveryData?.shareRecoveryStats?.created
|
|
18922
|
-
}
|
|
18923
|
-
),
|
|
18924
|
-
!appToUntrust && /* @__PURE__ */ jsx90(ConnectedApps, { isLoading: isRecoveryLoading, untrustApp })
|
|
19081
|
+
appToUntrust && /* @__PURE__ */ jsx90(UntrustApplication, {}),
|
|
19082
|
+
!appToUntrust && /* @__PURE__ */ jsxs84(Fragment35, { children: [
|
|
19083
|
+
/* @__PURE__ */ jsx90(Keyshare, {}),
|
|
19084
|
+
/* @__PURE__ */ jsx90(ConnectedApps, {})
|
|
19085
|
+
] }),
|
|
19086
|
+
/* @__PURE__ */ jsx90("div", { className: "w-full" }, renderKey)
|
|
18925
19087
|
] })
|
|
18926
19088
|
}
|
|
18927
19089
|
);
|
|
@@ -18929,17 +19091,13 @@ function SecurityMenu() {
|
|
|
18929
19091
|
var init_SecurityMenu = __esm({
|
|
18930
19092
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
18931
19093
|
init_i18n();
|
|
18932
|
-
init_auth();
|
|
18933
19094
|
init_useLayoutDataStore();
|
|
18934
19095
|
init_useLayoutStore();
|
|
18935
|
-
init_iframe_manager();
|
|
18936
19096
|
init_Expandable2();
|
|
18937
19097
|
init_button();
|
|
18938
|
-
|
|
18939
|
-
init_constants5();
|
|
18940
|
-
init_hooks2();
|
|
19098
|
+
init_ConnectedApps2();
|
|
18941
19099
|
init_Keyshare2();
|
|
18942
|
-
|
|
19100
|
+
init_useSecurityStore();
|
|
18943
19101
|
}
|
|
18944
19102
|
});
|
|
18945
19103
|
|
|
@@ -18947,6 +19105,8 @@ var init_SecurityMenu = __esm({
|
|
|
18947
19105
|
var init_SecurityMenu2 = __esm({
|
|
18948
19106
|
"src/internal/components/SecurityMenu/index.ts"() {
|
|
18949
19107
|
init_SecurityMenu();
|
|
19108
|
+
init_ConnectedApps2();
|
|
19109
|
+
init_Keyshare2();
|
|
18950
19110
|
}
|
|
18951
19111
|
});
|
|
18952
19112
|
|
|
@@ -19042,12 +19202,12 @@ var init_wallet = __esm({
|
|
|
19042
19202
|
});
|
|
19043
19203
|
|
|
19044
19204
|
// src/internal/components/SendMenu/useFlowSelector.ts
|
|
19045
|
-
import { create as
|
|
19205
|
+
import { create as create11 } from "zustand";
|
|
19046
19206
|
import { persist as persist2 } from "zustand/middleware";
|
|
19047
19207
|
var useFlowSelectorStore;
|
|
19048
19208
|
var init_useFlowSelector = __esm({
|
|
19049
19209
|
"src/internal/components/SendMenu/useFlowSelector.ts"() {
|
|
19050
|
-
useFlowSelectorStore =
|
|
19210
|
+
useFlowSelectorStore = create11()(
|
|
19051
19211
|
persist2(
|
|
19052
19212
|
(set) => ({
|
|
19053
19213
|
renderKey: Date.now().toString(),
|
|
@@ -19112,7 +19272,7 @@ var init_chains = __esm({
|
|
|
19112
19272
|
});
|
|
19113
19273
|
|
|
19114
19274
|
// src/internal/components/SendMenu/hyperbridge/useBridgeStore.ts
|
|
19115
|
-
import { create as
|
|
19275
|
+
import { create as create12 } from "zustand";
|
|
19116
19276
|
import { persist as persist3 } from "zustand/middleware";
|
|
19117
19277
|
var RESETABLE_STATES, useBridgeStore;
|
|
19118
19278
|
var init_useBridgeStore = __esm({
|
|
@@ -19128,7 +19288,7 @@ var init_useBridgeStore = __esm({
|
|
|
19128
19288
|
isQuoteEstimating: false,
|
|
19129
19289
|
bridgeHistoryItem: null
|
|
19130
19290
|
};
|
|
19131
|
-
useBridgeStore =
|
|
19291
|
+
useBridgeStore = create12()(
|
|
19132
19292
|
persist3(
|
|
19133
19293
|
(set, get) => ({
|
|
19134
19294
|
bridgeSenders: [],
|
|
@@ -19186,7 +19346,7 @@ var init_useBridgeStore = __esm({
|
|
|
19186
19346
|
// src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx
|
|
19187
19347
|
import { useConnectModal } from "@rainbow-me/rainbowkit";
|
|
19188
19348
|
import { useMutation as useMutation19 } from "@tanstack/react-query";
|
|
19189
|
-
import { useEffect as
|
|
19349
|
+
import { useEffect as useEffect36, useRef as useRef18, useState as useState22 } from "react";
|
|
19190
19350
|
import { useSignMessage } from "wagmi";
|
|
19191
19351
|
import { jsx as jsx91, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
19192
19352
|
function SenderSelector(props) {
|
|
@@ -19197,12 +19357,12 @@ function SenderSelector(props) {
|
|
|
19197
19357
|
const { openConnectModal } = useConnectModal();
|
|
19198
19358
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19199
19359
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
19200
|
-
const pendingWalletRef =
|
|
19360
|
+
const pendingWalletRef = useRef18(null);
|
|
19201
19361
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
19202
19362
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
19203
19363
|
const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
|
|
19204
|
-
const [walletMessage, setWalletMessage] =
|
|
19205
|
-
|
|
19364
|
+
const [walletMessage, setWalletMessage] = useState22(null);
|
|
19365
|
+
useEffect36(() => {
|
|
19206
19366
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19207
19367
|
}, [walletMessage]);
|
|
19208
19368
|
const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = useMutation19({
|
|
@@ -19258,7 +19418,7 @@ function SenderSelector(props) {
|
|
|
19258
19418
|
setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
|
|
19259
19419
|
}
|
|
19260
19420
|
});
|
|
19261
|
-
|
|
19421
|
+
useEffect36(() => {
|
|
19262
19422
|
const pendingProfile = pendingWalletRef.current;
|
|
19263
19423
|
if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
|
|
19264
19424
|
if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
|
|
@@ -19431,12 +19591,12 @@ var init_wallets = __esm({
|
|
|
19431
19591
|
});
|
|
19432
19592
|
|
|
19433
19593
|
// src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts
|
|
19434
|
-
import { useEffect as
|
|
19594
|
+
import { useEffect as useEffect37, useRef as useRef19 } from "react";
|
|
19435
19595
|
function useAvailableSenders() {
|
|
19436
19596
|
const address = useSession((st) => st.address);
|
|
19437
19597
|
const { profiles } = useLinkedProfiles();
|
|
19438
|
-
const lastCalcedSenders =
|
|
19439
|
-
|
|
19598
|
+
const lastCalcedSenders = useRef19([]);
|
|
19599
|
+
useEffect37(() => {
|
|
19440
19600
|
const sendersAccumulator = [
|
|
19441
19601
|
{
|
|
19442
19602
|
type: "embarkai-wallet",
|
|
@@ -19798,7 +19958,7 @@ var init_utils8 = __esm({
|
|
|
19798
19958
|
// src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts
|
|
19799
19959
|
import { useInfiniteQuery as useInfiniteQuery3 } from "@tanstack/react-query";
|
|
19800
19960
|
import { debounce as debounce7 } from "lodash-es";
|
|
19801
|
-
import { useCallback as
|
|
19961
|
+
import { useCallback as useCallback26, useEffect as useEffect38, useMemo as useMemo12 } from "react";
|
|
19802
19962
|
function useHyperlaneHistory() {
|
|
19803
19963
|
const address = useSession((st) => st.address);
|
|
19804
19964
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -19818,13 +19978,13 @@ function useHyperlaneHistory() {
|
|
|
19818
19978
|
() => txHistoryData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
19819
19979
|
[txHistoryData]
|
|
19820
19980
|
);
|
|
19821
|
-
const updateExpandable =
|
|
19981
|
+
const updateExpandable = useCallback26(
|
|
19822
19982
|
debounce7(() => {
|
|
19823
19983
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
|
|
19824
19984
|
}, 250),
|
|
19825
19985
|
[]
|
|
19826
19986
|
);
|
|
19827
|
-
|
|
19987
|
+
useEffect38(() => {
|
|
19828
19988
|
if (isBridgeTxHistoryLoading || txList.length === 0) return;
|
|
19829
19989
|
updateExpandable();
|
|
19830
19990
|
}, [isBridgeTxHistoryLoading, txList]);
|
|
@@ -19845,11 +20005,11 @@ var init_useHyperlaneHistory = __esm({
|
|
|
19845
20005
|
});
|
|
19846
20006
|
|
|
19847
20007
|
// src/internal/components/SendMenu/hyperbridge/hooks/useOperationHashesStore.ts
|
|
19848
|
-
import { create as
|
|
20008
|
+
import { create as create13 } from "zustand";
|
|
19849
20009
|
var useOperationHashesStore;
|
|
19850
20010
|
var init_useOperationHashesStore = __esm({
|
|
19851
20011
|
"src/internal/components/SendMenu/hyperbridge/hooks/useOperationHashesStore.ts"() {
|
|
19852
|
-
useOperationHashesStore =
|
|
20012
|
+
useOperationHashesStore = create13((set) => ({
|
|
19853
20013
|
hyperlaneDatabaseTx: null,
|
|
19854
20014
|
operationHashes: [],
|
|
19855
20015
|
setHyperlaneDatabaseTx: (hyperlaneDatabaseTx) => set({ hyperlaneDatabaseTx }),
|
|
@@ -19860,7 +20020,7 @@ var init_useOperationHashesStore = __esm({
|
|
|
19860
20020
|
|
|
19861
20021
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts
|
|
19862
20022
|
import { useMutation as useMutation20, useQueryClient as useQueryClient22 } from "@tanstack/react-query";
|
|
19863
|
-
import { useCallback as
|
|
20023
|
+
import { useCallback as useCallback27 } from "react";
|
|
19864
20024
|
import { useSwitchChain, useWalletClient } from "wagmi";
|
|
19865
20025
|
function useBridge() {
|
|
19866
20026
|
const qc = useQueryClient22();
|
|
@@ -19868,7 +20028,7 @@ function useBridge() {
|
|
|
19868
20028
|
const address = useSession((st) => st.address);
|
|
19869
20029
|
const { data: walletClient } = useWalletClient();
|
|
19870
20030
|
const { switchChainAsync } = useSwitchChain();
|
|
19871
|
-
const swapDirection =
|
|
20031
|
+
const swapDirection = useCallback27(() => {
|
|
19872
20032
|
const {
|
|
19873
20033
|
bridgeStep,
|
|
19874
20034
|
originChain,
|
|
@@ -19920,7 +20080,7 @@ function useBridge() {
|
|
|
19920
20080
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
19921
20081
|
}
|
|
19922
20082
|
});
|
|
19923
|
-
const handleQuoteEstimation =
|
|
20083
|
+
const handleQuoteEstimation = useCallback27((amnt) => {
|
|
19924
20084
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
19925
20085
|
if (!amnt || !Number(amnt)) {
|
|
19926
20086
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -20064,7 +20224,7 @@ var init_useBridge = __esm({
|
|
|
20064
20224
|
|
|
20065
20225
|
// src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts
|
|
20066
20226
|
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
20067
|
-
import { useEffect as
|
|
20227
|
+
import { useEffect as useEffect39 } from "react";
|
|
20068
20228
|
function useHyperlaneRoutes() {
|
|
20069
20229
|
const address = useSession((st) => st.address);
|
|
20070
20230
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -20084,7 +20244,7 @@ function useHyperlaneRoutes() {
|
|
|
20084
20244
|
return warpRoutes;
|
|
20085
20245
|
}
|
|
20086
20246
|
});
|
|
20087
|
-
|
|
20247
|
+
useEffect39(() => {
|
|
20088
20248
|
if (!errorWarpRoutes) return;
|
|
20089
20249
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
20090
20250
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -20093,7 +20253,7 @@ function useHyperlaneRoutes() {
|
|
|
20093
20253
|
setOriginChain(null);
|
|
20094
20254
|
setDestinationChain(null);
|
|
20095
20255
|
}, [errorWarpRoutes]);
|
|
20096
|
-
|
|
20256
|
+
useEffect39(() => {
|
|
20097
20257
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
20098
20258
|
const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
20099
20259
|
if (!warpRouteToAutoSelect) return;
|
|
@@ -20126,13 +20286,13 @@ var init_useHyperlaneRoutes = __esm({
|
|
|
20126
20286
|
});
|
|
20127
20287
|
|
|
20128
20288
|
// src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts
|
|
20129
|
-
import { useEffect as
|
|
20289
|
+
import { useEffect as useEffect40 } from "react";
|
|
20130
20290
|
function useMenuTitle(warpRoutes) {
|
|
20131
20291
|
const { t } = useT();
|
|
20132
20292
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20133
20293
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20134
20294
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
20135
|
-
|
|
20295
|
+
useEffect40(() => {
|
|
20136
20296
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
20137
20297
|
switch (true) {
|
|
20138
20298
|
case bridgeStep === "sender-selector":
|
|
@@ -20184,7 +20344,7 @@ var init_ResolveChainIcon = __esm({
|
|
|
20184
20344
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts
|
|
20185
20345
|
import { CHAINS_BROWSERS_TRANSPORTS as CHAINS_BROWSERS_TRANSPORTS2 } from "@embarkai/core";
|
|
20186
20346
|
import { useQuery as useQuery19, useQueryClient as useQueryClient23 } from "@tanstack/react-query";
|
|
20187
|
-
import { useCallback as
|
|
20347
|
+
import { useCallback as useCallback28, useEffect as useEffect41 } from "react";
|
|
20188
20348
|
import { createPublicClient as createPublicClient2, erc20Abi as erc20Abi2, formatUnits as formatUnits7, http as http3 } from "viem";
|
|
20189
20349
|
import { useSwitchChain as useSwitchChain2 } from "wagmi";
|
|
20190
20350
|
function checkWrapedTokenSymbol2(symbol) {
|
|
@@ -20279,7 +20439,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20279
20439
|
};
|
|
20280
20440
|
}
|
|
20281
20441
|
});
|
|
20282
|
-
const refreshRouteTokenBalance =
|
|
20442
|
+
const refreshRouteTokenBalance = useCallback28(
|
|
20283
20443
|
(senderWallet) => {
|
|
20284
20444
|
switch (true) {
|
|
20285
20445
|
case senderWallet === "embarkai-wallet":
|
|
@@ -20295,7 +20455,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20295
20455
|
},
|
|
20296
20456
|
[refreshBalances, qc]
|
|
20297
20457
|
);
|
|
20298
|
-
|
|
20458
|
+
useEffect41(() => {
|
|
20299
20459
|
if (!bridgeSender || !originChain) return;
|
|
20300
20460
|
switch (bridgeSender) {
|
|
20301
20461
|
case "embarkai-wallet":
|
|
@@ -20344,9 +20504,9 @@ var init_useBridgeBalance = __esm({
|
|
|
20344
20504
|
});
|
|
20345
20505
|
|
|
20346
20506
|
// src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx
|
|
20347
|
-
import { ArrowLeftRightIcon, ArrowRightLeftIcon, LoaderIcon as
|
|
20348
|
-
import { Fragment as
|
|
20349
|
-
import { Fragment as
|
|
20507
|
+
import { ArrowLeftRightIcon, ArrowRightLeftIcon, LoaderIcon as LoaderIcon11, Wallet2Icon as Wallet2Icon2, XIcon } from "lucide-react";
|
|
20508
|
+
import { Fragment as Fragment36 } from "react";
|
|
20509
|
+
import { Fragment as Fragment37, jsx as jsx95, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
20350
20510
|
function SelectStep(props) {
|
|
20351
20511
|
const { swapChains, hyperlaneWarpRoutes = [], isLoadingWarpRoutes, handleQuoteEstimation } = props;
|
|
20352
20512
|
const { t } = useT();
|
|
@@ -20370,7 +20530,7 @@ function SelectStep(props) {
|
|
|
20370
20530
|
const SelectedWarpRoteIcon = TOKENS_ICONS[(selectedWarpRoute?.symbol || "null_icon").toUpperCase()] || TOKENS_ICONS.EMBARKAI;
|
|
20371
20531
|
const isError = useFlowSelectorStore((st) => !!st.error);
|
|
20372
20532
|
if (isLoadingWarpRoutes) {
|
|
20373
|
-
return /* @__PURE__ */ jsx95("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx95(
|
|
20533
|
+
return /* @__PURE__ */ jsx95("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx95(LoaderIcon11, { className: "w-4 h-4 animate-spin" }) });
|
|
20374
20534
|
}
|
|
20375
20535
|
const isBalanceInsufficient = !routeTokenBalance || Number(amount || 0) > Number(routeTokenBalance || 0);
|
|
20376
20536
|
const isFalsyAmount = !amount || !Number(amount) || Number(amount) <= 0;
|
|
@@ -20418,7 +20578,7 @@ function SelectStep(props) {
|
|
|
20418
20578
|
t("passport:common.balance"),
|
|
20419
20579
|
": "
|
|
20420
20580
|
] }),
|
|
20421
|
-
isRouteTokenBalanceLoading && /* @__PURE__ */ jsx95(
|
|
20581
|
+
isRouteTokenBalanceLoading && /* @__PURE__ */ jsx95(LoaderIcon11, { className: "w-4 h-4 animate-spin text-[var(--ui-kit-fg-muted)]" }),
|
|
20422
20582
|
!isRouteTokenBalanceLoading && /* @__PURE__ */ jsxs88("span", { className: cn("font-semibold", { "text-[var(--ui-kit-bg-error)]": isBalanceInsufficient }), children: [
|
|
20423
20583
|
formatPrice(Number(routeTokenBalance || 0)),
|
|
20424
20584
|
" ",
|
|
@@ -20450,7 +20610,7 @@ function SelectStep(props) {
|
|
|
20450
20610
|
variant: "outline",
|
|
20451
20611
|
size: "medium",
|
|
20452
20612
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
20453
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ jsxs88(
|
|
20613
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ jsxs88(Fragment36, { children: [
|
|
20454
20614
|
chIdx > 0 && /* @__PURE__ */ jsx95(ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
20455
20615
|
/* @__PURE__ */ jsx95(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
20456
20616
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -20473,7 +20633,7 @@ function SelectStep(props) {
|
|
|
20473
20633
|
}
|
|
20474
20634
|
),
|
|
20475
20635
|
/* @__PURE__ */ jsxs88("div", { className: "w-full flex items-center justify-center", children: [
|
|
20476
|
-
/* @__PURE__ */ jsx95(Badge, { variant: "outline", size: "large", className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center", children: originChain ? /* @__PURE__ */ jsxs88(
|
|
20636
|
+
/* @__PURE__ */ jsx95(Badge, { variant: "outline", size: "large", className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center", children: originChain ? /* @__PURE__ */ jsxs88(Fragment37, { children: [
|
|
20477
20637
|
/* @__PURE__ */ jsx95(ResolveChainIcon, { chainName: originChain, className: "w-6 h-6" }),
|
|
20478
20638
|
/* @__PURE__ */ jsx95("span", { className: "block max-w-[100px] truncate", children: CHAINS_UI_META[originChain]?.chainLabel })
|
|
20479
20639
|
] }) : /* @__PURE__ */ jsx95("span", { className: "text-[var(--ui-kit-fg-muted)]", children: "N/A" }) }),
|
|
@@ -20487,7 +20647,7 @@ function SelectStep(props) {
|
|
|
20487
20647
|
children: /* @__PURE__ */ jsx95(ArrowRightLeftIcon, { className: "w-4 h-4 " })
|
|
20488
20648
|
}
|
|
20489
20649
|
),
|
|
20490
|
-
/* @__PURE__ */ jsx95(Badge, { variant: "outline", size: "large", className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center", children: destinationChain ? /* @__PURE__ */ jsxs88(
|
|
20650
|
+
/* @__PURE__ */ jsx95(Badge, { variant: "outline", size: "large", className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center", children: destinationChain ? /* @__PURE__ */ jsxs88(Fragment37, { children: [
|
|
20491
20651
|
/* @__PURE__ */ jsx95(ResolveChainIcon, { chainName: destinationChain, className: "w-6 h-6" }),
|
|
20492
20652
|
/* @__PURE__ */ jsx95("span", { className: "block max-w-[100px] truncate", children: CHAINS_UI_META[destinationChain]?.chainLabel })
|
|
20493
20653
|
] }) : /* @__PURE__ */ jsx95("span", { className: "text-[var(--ui-kit-fg-muted)]", children: "N/A" }) })
|
|
@@ -20578,7 +20738,7 @@ function SelectStep(props) {
|
|
|
20578
20738
|
onClick: () => handleQuoteEstimation(amount),
|
|
20579
20739
|
disabled: isQuoteEstimationDisabled,
|
|
20580
20740
|
children: [
|
|
20581
|
-
isQuoteEstimating && /* @__PURE__ */ jsx95(
|
|
20741
|
+
isQuoteEstimating && /* @__PURE__ */ jsx95(LoaderIcon11, { className: "h-4 w-4 animate-spin" }),
|
|
20582
20742
|
/* @__PURE__ */ jsx95("span", { children: isBalanceInsufficient ? t("passport:bridgeMenu.statuses.balanceInsufficient").toUpperCase() : t("passport:bridgeMenu.actions.estimateQuote").toUpperCase() })
|
|
20583
20743
|
]
|
|
20584
20744
|
}
|
|
@@ -20633,12 +20793,12 @@ var init_checkbox = __esm({
|
|
|
20633
20793
|
});
|
|
20634
20794
|
|
|
20635
20795
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
20636
|
-
import { LoaderIcon as
|
|
20637
|
-
import { useState as
|
|
20796
|
+
import { LoaderIcon as LoaderIcon12 } from "lucide-react";
|
|
20797
|
+
import { useState as useState23 } from "react";
|
|
20638
20798
|
import { jsx as jsx97, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
20639
20799
|
function ConfirmStep(props) {
|
|
20640
20800
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
20641
|
-
const [userConsent, setUserConsent] =
|
|
20801
|
+
const [userConsent, setUserConsent] = useState23(false);
|
|
20642
20802
|
const { t } = useT();
|
|
20643
20803
|
const address = useSession((st) => st.address);
|
|
20644
20804
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -20740,7 +20900,7 @@ function ConfirmStep(props) {
|
|
|
20740
20900
|
onClick: () => bridgeAsset(),
|
|
20741
20901
|
className: "w-full",
|
|
20742
20902
|
children: [
|
|
20743
|
-
isAssetBridging && /* @__PURE__ */ jsx97(
|
|
20903
|
+
isAssetBridging && /* @__PURE__ */ jsx97(LoaderIcon12, { className: "h-4 w-4 animate-spin" }),
|
|
20744
20904
|
/* @__PURE__ */ jsx97("span", { children: (bridgeTxStatus || t("passport:common.continue")).toUpperCase() })
|
|
20745
20905
|
]
|
|
20746
20906
|
}
|
|
@@ -20857,7 +21017,7 @@ var init_SuccessStep = __esm({
|
|
|
20857
21017
|
// src/internal/components/SendMenu/hyperbridge/steps/HistoryStep.tsx
|
|
20858
21018
|
import { useQueryClient as useQueryClient24 } from "@tanstack/react-query";
|
|
20859
21019
|
import dayjs7 from "dayjs";
|
|
20860
|
-
import { ArrowRightIcon, DownloadIcon as DownloadIcon2, ExternalLinkIcon as ExternalLinkIcon3, InfoIcon as
|
|
21020
|
+
import { ArrowRightIcon, DownloadIcon as DownloadIcon2, ExternalLinkIcon as ExternalLinkIcon3, InfoIcon as InfoIcon5, LoaderIcon as LoaderIcon13 } from "lucide-react";
|
|
20861
21021
|
import { jsx as jsx99, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
20862
21022
|
function HistoryDetailsStep() {
|
|
20863
21023
|
const { t } = useT();
|
|
@@ -21064,7 +21224,7 @@ function HistoryItem(props) {
|
|
|
21064
21224
|
setBridgeStep("tx-history-details");
|
|
21065
21225
|
},
|
|
21066
21226
|
children: [
|
|
21067
|
-
/* @__PURE__ */ jsx99(
|
|
21227
|
+
/* @__PURE__ */ jsx99(InfoIcon5, { className: "w-4 h-4" }),
|
|
21068
21228
|
/* @__PURE__ */ jsx99("span", { className: "text-xs leading-5", children: t("passport:common.details") })
|
|
21069
21229
|
]
|
|
21070
21230
|
}
|
|
@@ -21083,7 +21243,7 @@ function HistoryStep() {
|
|
|
21083
21243
|
return /* @__PURE__ */ jsx99(Highlight, { type: "info", className: "w-full text-center text-[10px] text-[var(--ui-kit-fg-muted)] leading-4", children: t("passport:bridgeMenu.errors.noHistory") });
|
|
21084
21244
|
}
|
|
21085
21245
|
return /* @__PURE__ */ jsxs91("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
21086
|
-
isLoading && /* @__PURE__ */ jsx99("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx99(
|
|
21246
|
+
isLoading && /* @__PURE__ */ jsx99("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx99(LoaderIcon13, { className: "w-4 h-4 animate-spin" }) }),
|
|
21087
21247
|
!isLoading && txList.map((item) => /* @__PURE__ */ jsx99(HistoryItem, { ...item }, item.id)),
|
|
21088
21248
|
hasNextPage && /* @__PURE__ */ jsxs91(
|
|
21089
21249
|
Button,
|
|
@@ -21094,7 +21254,7 @@ function HistoryStep() {
|
|
|
21094
21254
|
className: "w-full",
|
|
21095
21255
|
onClick: () => fetchNextPage(),
|
|
21096
21256
|
children: [
|
|
21097
|
-
isTxDataFetching ? /* @__PURE__ */ jsx99(
|
|
21257
|
+
isTxDataFetching ? /* @__PURE__ */ jsx99(LoaderIcon13, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsx99(DownloadIcon2, { className: "w-4 h-4" }),
|
|
21098
21258
|
t("passport:common.loadMore")
|
|
21099
21259
|
]
|
|
21100
21260
|
}
|
|
@@ -21123,12 +21283,12 @@ var init_HistoryStep = __esm({
|
|
|
21123
21283
|
|
|
21124
21284
|
// src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx
|
|
21125
21285
|
import { ArrowLeftRightIcon as ArrowLeftRightIcon2 } from "lucide-react";
|
|
21126
|
-
import { useMemo as useMemo13, useState as
|
|
21127
|
-
import { Fragment as
|
|
21286
|
+
import { useMemo as useMemo13, useState as useState24 } from "react";
|
|
21287
|
+
import { Fragment as Fragment38, jsx as jsx100, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
21128
21288
|
function SelectAssetRoute(props) {
|
|
21129
21289
|
const { hyperlaneWarpRoutes } = props;
|
|
21130
21290
|
const { t } = useT();
|
|
21131
|
-
const [isTokenSymbolSelector, setIsTokenSymbolSelector] =
|
|
21291
|
+
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = useState24(false);
|
|
21132
21292
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
21133
21293
|
const tokenList = useMemo13(() => {
|
|
21134
21294
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
@@ -21170,13 +21330,13 @@ function SelectAssetRoute(props) {
|
|
|
21170
21330
|
setIsTokenSymbolSelector(true);
|
|
21171
21331
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-route-asset-selector-${Date.now()}`);
|
|
21172
21332
|
},
|
|
21173
|
-
children: selectedAsset ? /* @__PURE__ */ jsxs92(
|
|
21333
|
+
children: selectedAsset ? /* @__PURE__ */ jsxs92(Fragment38, { children: [
|
|
21174
21334
|
/* @__PURE__ */ jsx100(selectedAsset.Icon, { className: "w-6 h-6" }),
|
|
21175
21335
|
selectedAsset.symbol
|
|
21176
21336
|
] }) : t("passport:bridgeMenu.actions.selectAsset")
|
|
21177
21337
|
}
|
|
21178
21338
|
),
|
|
21179
|
-
availableChainPairs.length > 0 && /* @__PURE__ */ jsxs92(
|
|
21339
|
+
availableChainPairs.length > 0 && /* @__PURE__ */ jsxs92(Fragment38, { children: [
|
|
21180
21340
|
/* @__PURE__ */ jsx100("span", { className: "block text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:bridgeMenu.labels.availableChainPairs") }),
|
|
21181
21341
|
/* @__PURE__ */ jsx100("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: availableChainPairs.map(([fromChain, toChain]) => /* @__PURE__ */ jsxs92(
|
|
21182
21342
|
Button,
|
|
@@ -21251,20 +21411,20 @@ var init_steps = __esm({
|
|
|
21251
21411
|
});
|
|
21252
21412
|
|
|
21253
21413
|
// src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx
|
|
21254
|
-
import { useEffect as
|
|
21255
|
-
import { Fragment as
|
|
21414
|
+
import { useEffect as useEffect42 } from "react";
|
|
21415
|
+
import { Fragment as Fragment39, jsx as jsx101, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
21256
21416
|
function HyperlaneBridge() {
|
|
21257
21417
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21258
21418
|
const { swapDirection, handleQuoteEstimation, bridgeAsset, isAssetBridging } = useBridge();
|
|
21259
21419
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21260
21420
|
const { directWalletProfile } = useAvailableSenders();
|
|
21261
21421
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21262
|
-
|
|
21422
|
+
useEffect42(() => {
|
|
21263
21423
|
return () => {
|
|
21264
21424
|
useBridgeStore.getState().resetSelections();
|
|
21265
21425
|
};
|
|
21266
21426
|
}, []);
|
|
21267
|
-
return /* @__PURE__ */ jsxs93(
|
|
21427
|
+
return /* @__PURE__ */ jsxs93(Fragment39, { children: [
|
|
21268
21428
|
bridgeStep === "sender-selector" && /* @__PURE__ */ jsx101(SenderSelector, { directWalletProfile }),
|
|
21269
21429
|
bridgeStep === "select" && /* @__PURE__ */ jsx101(
|
|
21270
21430
|
SelectStep,
|
|
@@ -21305,14 +21465,14 @@ var init_HyperlaneBridge = __esm({
|
|
|
21305
21465
|
});
|
|
21306
21466
|
|
|
21307
21467
|
// src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx
|
|
21308
|
-
import { useRef as
|
|
21468
|
+
import { useRef as useRef20 } from "react";
|
|
21309
21469
|
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
21310
21470
|
function BridgeHistorySwitch(props) {
|
|
21311
21471
|
const { disabled } = props;
|
|
21312
21472
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
21313
21473
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
21314
21474
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21315
|
-
const lastBridgeStepRef =
|
|
21475
|
+
const lastBridgeStepRef = useRef20(null);
|
|
21316
21476
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
21317
21477
|
return null;
|
|
21318
21478
|
}
|
|
@@ -21414,7 +21574,7 @@ var init_useErc3643Compliance = __esm({
|
|
|
21414
21574
|
|
|
21415
21575
|
// src/hooks/useNicknameResolve.ts
|
|
21416
21576
|
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
21417
|
-
import { useEffect as
|
|
21577
|
+
import { useEffect as useEffect43, useMemo as useMemo14, useState as useState25 } from "react";
|
|
21418
21578
|
function looksLikeNickname(input) {
|
|
21419
21579
|
if (!input) return false;
|
|
21420
21580
|
if (input.startsWith("0x")) return false;
|
|
@@ -21424,11 +21584,11 @@ function looksLikeNickname(input) {
|
|
|
21424
21584
|
}
|
|
21425
21585
|
function useNicknameResolve(input, options) {
|
|
21426
21586
|
const { enabled = true, chainId } = options;
|
|
21427
|
-
const [debouncedInput, setDebouncedInput] =
|
|
21428
|
-
const [isDebouncing, setIsDebouncing] =
|
|
21587
|
+
const [debouncedInput, setDebouncedInput] = useState25("");
|
|
21588
|
+
const [isDebouncing, setIsDebouncing] = useState25(false);
|
|
21429
21589
|
const normalized = normalizeNickname(input);
|
|
21430
21590
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
21431
|
-
|
|
21591
|
+
useEffect43(() => {
|
|
21432
21592
|
if (!isNicknameInput || !enabled) {
|
|
21433
21593
|
setDebouncedInput("");
|
|
21434
21594
|
setIsDebouncing(false);
|
|
@@ -21488,15 +21648,15 @@ var init_useNicknameResolve = __esm({
|
|
|
21488
21648
|
});
|
|
21489
21649
|
|
|
21490
21650
|
// src/hooks/useSendTransaction.ts
|
|
21491
|
-
import { useCallback as
|
|
21651
|
+
import { useCallback as useCallback29, useState as useState26 } from "react";
|
|
21492
21652
|
import { encodeFunctionData as encodeFunctionData2, isAddress, parseEther as parseEther2, parseUnits } from "viem";
|
|
21493
21653
|
function useSendTransaction() {
|
|
21494
21654
|
const session = useSession((st) => st.session);
|
|
21495
21655
|
const address = useSession((st) => st.address);
|
|
21496
|
-
const [isLoading, setIsLoading] =
|
|
21497
|
-
const [error, setError] =
|
|
21498
|
-
const [userOpHash, setUserOpHash] =
|
|
21499
|
-
const sendTransaction =
|
|
21656
|
+
const [isLoading, setIsLoading] = useState26(false);
|
|
21657
|
+
const [error, setError] = useState26(null);
|
|
21658
|
+
const [userOpHash, setUserOpHash] = useState26(null);
|
|
21659
|
+
const sendTransaction = useCallback29(
|
|
21500
21660
|
async (params) => {
|
|
21501
21661
|
if (!session || !address) {
|
|
21502
21662
|
setError("No active session");
|
|
@@ -21593,7 +21753,7 @@ function useSendTransaction() {
|
|
|
21593
21753
|
},
|
|
21594
21754
|
[session, address]
|
|
21595
21755
|
);
|
|
21596
|
-
const reset =
|
|
21756
|
+
const reset = useCallback29(() => {
|
|
21597
21757
|
setError(null);
|
|
21598
21758
|
setUserOpHash(null);
|
|
21599
21759
|
setIsLoading(false);
|
|
@@ -21748,10 +21908,10 @@ var init_AssetInputIcon = __esm({
|
|
|
21748
21908
|
|
|
21749
21909
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
21750
21910
|
import { Image as ImageIcon2, Sparkles as Sparkles2 } from "lucide-react";
|
|
21751
|
-
import { useState as
|
|
21911
|
+
import { useState as useState27 } from "react";
|
|
21752
21912
|
import { jsx as jsx104, jsxs as jsxs95 } from "react/jsx-runtime";
|
|
21753
21913
|
function NftDisplayCard({ asset }) {
|
|
21754
|
-
const [imageError, setImageError] =
|
|
21914
|
+
const [imageError, setImageError] = useState27(false);
|
|
21755
21915
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
21756
21916
|
return /* @__PURE__ */ jsxs95("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
21757
21917
|
nftImage && !imageError ? /* @__PURE__ */ jsx104(
|
|
@@ -21785,12 +21945,12 @@ var init_NftDisplayCard = __esm({
|
|
|
21785
21945
|
});
|
|
21786
21946
|
|
|
21787
21947
|
// src/internal/components/SendMenu/send/useSendStore.ts
|
|
21788
|
-
import { create as
|
|
21948
|
+
import { create as create14 } from "zustand";
|
|
21789
21949
|
var useSendStore;
|
|
21790
21950
|
var init_useSendStore = __esm({
|
|
21791
21951
|
"src/internal/components/SendMenu/send/useSendStore.ts"() {
|
|
21792
21952
|
init_useFlowSelector();
|
|
21793
|
-
useSendStore =
|
|
21953
|
+
useSendStore = create14((set) => ({
|
|
21794
21954
|
recipient: "",
|
|
21795
21955
|
//
|
|
21796
21956
|
amount: "",
|
|
@@ -21825,7 +21985,7 @@ var init_useSendStore = __esm({
|
|
|
21825
21985
|
|
|
21826
21986
|
// src/internal/components/SendMenu/send/components/AssetList.tsx
|
|
21827
21987
|
import { formatUnits as formatUnits9 } from "viem";
|
|
21828
|
-
import { Fragment as
|
|
21988
|
+
import { Fragment as Fragment40, jsx as jsx105, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
21829
21989
|
function getAssetBalance3(asset) {
|
|
21830
21990
|
if (isNftAsset3(asset)) return "1";
|
|
21831
21991
|
const balance = Number(formatUnits9(BigInt(asset?.balance || "0"), asset?.decimals || 18));
|
|
@@ -21862,13 +22022,13 @@ function AssetListItem(props) {
|
|
|
21862
22022
|
" \xB7 ",
|
|
21863
22023
|
truncateMiddle(asset.address, 6, 4)
|
|
21864
22024
|
] }),
|
|
21865
|
-
/* @__PURE__ */ jsx105("span", { className: "block text-lg font-bold", children: isNft ? /* @__PURE__ */ jsxs96(
|
|
22025
|
+
/* @__PURE__ */ jsx105("span", { className: "block text-lg font-bold", children: isNft ? /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21866
22026
|
asset.symbol,
|
|
21867
22027
|
asset.tokenId && /* @__PURE__ */ jsxs96("span", { className: "ml-1", children: [
|
|
21868
22028
|
"#",
|
|
21869
22029
|
asset.tokenId.length > 6 ? `${asset.tokenId.slice(0, 4)}...` : asset.tokenId
|
|
21870
22030
|
] })
|
|
21871
|
-
] }) : /* @__PURE__ */ jsxs96(
|
|
22031
|
+
] }) : /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21872
22032
|
BALANCE_PREFIXES[asset.symbol] || null,
|
|
21873
22033
|
/* @__PURE__ */ jsx105("span", { children: getAssetBalance3(asset) }),
|
|
21874
22034
|
" ",
|
|
@@ -21893,20 +22053,20 @@ function AssetList(props) {
|
|
|
21893
22053
|
const tokenAssets = transferableAssets.filter((a) => a.type === "erc20");
|
|
21894
22054
|
const securityAssets = transferableAssets.filter((a) => a.type === "erc3643");
|
|
21895
22055
|
const nftAssets = transferableAssets.filter((a) => a.type === "erc721" || a.type === "erc1155");
|
|
21896
|
-
return /* @__PURE__ */ jsxs96(
|
|
21897
|
-
nativeAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22056
|
+
return /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
22057
|
+
nativeAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21898
22058
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "Crypto" }),
|
|
21899
22059
|
nativeAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `native-${asset.symbol}`))
|
|
21900
22060
|
] }),
|
|
21901
|
-
tokenAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22061
|
+
tokenAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21902
22062
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "Tokens" }),
|
|
21903
22063
|
tokenAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `token-${asset.address}`))
|
|
21904
22064
|
] }),
|
|
21905
|
-
securityAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22065
|
+
securityAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21906
22066
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "Security Tokens" }),
|
|
21907
22067
|
securityAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `security-${asset.address}`))
|
|
21908
22068
|
] }),
|
|
21909
|
-
nftAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22069
|
+
nftAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21910
22070
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "NFTs" }),
|
|
21911
22071
|
nftAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `nft-${asset.address}-${asset.tokenId}`))
|
|
21912
22072
|
] }),
|
|
@@ -21927,7 +22087,7 @@ var init_AssetList = __esm({
|
|
|
21927
22087
|
|
|
21928
22088
|
// src/internal/components/SendMenu/send/components/NicknameData.tsx
|
|
21929
22089
|
import { AtSign, CheckCircle2 as CheckCircle24, ShieldAlert, ShieldCheck as ShieldCheck2 } from "lucide-react";
|
|
21930
|
-
import { useEffect as
|
|
22090
|
+
import { useEffect as useEffect44 } from "react";
|
|
21931
22091
|
import { jsx as jsx106, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
21932
22092
|
function NicknameData(props) {
|
|
21933
22093
|
const { resolvedNicknameData, isNicknameInput } = props;
|
|
@@ -21940,11 +22100,11 @@ function NicknameData(props) {
|
|
|
21940
22100
|
isWalletNotSetup,
|
|
21941
22101
|
isFrozen
|
|
21942
22102
|
} = resolvedNicknameData;
|
|
21943
|
-
|
|
22103
|
+
useEffect44(() => {
|
|
21944
22104
|
if (!resolvedNicknameData?.data?.fingerprint || !isNicknameInput) return;
|
|
21945
22105
|
useFlowSelectorStore.getState().setRenderKey(`nickname-resolved-${Date.now()}`);
|
|
21946
22106
|
}, [resolvedNicknameData, isNicknameInput]);
|
|
21947
|
-
|
|
22107
|
+
useEffect44(() => {
|
|
21948
22108
|
if (isResolving) return;
|
|
21949
22109
|
let errMessage = null;
|
|
21950
22110
|
switch (true) {
|
|
@@ -22105,9 +22265,9 @@ var init_useTokenBalance = __esm({
|
|
|
22105
22265
|
});
|
|
22106
22266
|
|
|
22107
22267
|
// src/internal/components/SendMenu/send/sendSteps/InputSendStep.tsx
|
|
22108
|
-
import { AlertCircle as
|
|
22268
|
+
import { AlertCircle as AlertCircle4, AtSign as AtSign2, CheckCircle2 as CheckCircle25, Loader as Loader20, Wallet2 as Wallet24 } from "lucide-react";
|
|
22109
22269
|
import { formatUnits as formatUnits11, isAddress as isAddress2 } from "viem";
|
|
22110
|
-
import { Fragment as
|
|
22270
|
+
import { Fragment as Fragment41, jsx as jsx107, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
22111
22271
|
function InputSendStep(props) {
|
|
22112
22272
|
const { erc3643Compliance, isNicknameInput, resolvedNicknameData, isAssetsLoading } = props;
|
|
22113
22273
|
const address = useSession((st) => st.address);
|
|
@@ -22206,7 +22366,7 @@ function InputSendStep(props) {
|
|
|
22206
22366
|
setError(null);
|
|
22207
22367
|
return true;
|
|
22208
22368
|
};
|
|
22209
|
-
return /* @__PURE__ */ jsxs98(
|
|
22369
|
+
return /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22210
22370
|
/* @__PURE__ */ jsx107("span", { className: "block text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:sendMenu.selectAsset") }),
|
|
22211
22371
|
/* @__PURE__ */ jsxs98(
|
|
22212
22372
|
Button,
|
|
@@ -22221,7 +22381,7 @@ function InputSendStep(props) {
|
|
|
22221
22381
|
/* @__PURE__ */ jsx107(AssetInputIcon, { asset: selectedAsset }),
|
|
22222
22382
|
/* @__PURE__ */ jsx107("span", { children: (isNft ? selectedAsset.nftMetadata?.name || selectedAsset.symbol : selectedAsset.name).toUpperCase() })
|
|
22223
22383
|
] }) : /* @__PURE__ */ jsx107("span", { className: "text-[var(--ui-kit-fg-muted)]", children: "No Asset Selected" }),
|
|
22224
|
-
isAssetsLoading && /* @__PURE__ */ jsx107(
|
|
22384
|
+
isAssetsLoading && /* @__PURE__ */ jsx107(Loader20, { className: "w-4 h-4 animate-spin" })
|
|
22225
22385
|
]
|
|
22226
22386
|
}
|
|
22227
22387
|
),
|
|
@@ -22235,7 +22395,7 @@ function InputSendStep(props) {
|
|
|
22235
22395
|
disabled: isAssetsLoading,
|
|
22236
22396
|
onChange: (e) => setRecipient(e.target.value),
|
|
22237
22397
|
placeholder: "0x... or @nickname",
|
|
22238
|
-
element: isNicknameInput && isResolving ? /* @__PURE__ */ jsx107(
|
|
22398
|
+
element: isNicknameInput && isResolving ? /* @__PURE__ */ jsx107(Loader20, { className: "w-4 h-4 animate-spin text-[var(--ui-kit-fg-muted)]" }) : null
|
|
22239
22399
|
}
|
|
22240
22400
|
),
|
|
22241
22401
|
/* @__PURE__ */ jsx107(NicknameData, { resolvedNicknameData, isNicknameInput }),
|
|
@@ -22244,7 +22404,7 @@ function InputSendStep(props) {
|
|
|
22244
22404
|
!isNft && selectedAsset && /* @__PURE__ */ jsxs98("span", { className: "block text-[10px]", children: [
|
|
22245
22405
|
t("passport:common.balance"),
|
|
22246
22406
|
" ",
|
|
22247
|
-
isBalanceLoading ? /* @__PURE__ */ jsx107(
|
|
22407
|
+
isBalanceLoading ? /* @__PURE__ */ jsx107(Loader20, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxs98("span", { className: "text-[var(--ui-kit-fg)] font-semibold", children: [
|
|
22248
22408
|
formatPrice(balanceData.formatted),
|
|
22249
22409
|
" ",
|
|
22250
22410
|
balanceData.symbol
|
|
@@ -22270,14 +22430,14 @@ function InputSendStep(props) {
|
|
|
22270
22430
|
{
|
|
22271
22431
|
type: isComplianceLoading ? "info" : erc3643CanTransfer ? "success" : "error",
|
|
22272
22432
|
className: "flex gap-[var(--ui-kit-gap)]",
|
|
22273
|
-
children: isComplianceLoading ? /* @__PURE__ */ jsxs98(
|
|
22274
|
-
/* @__PURE__ */ jsx107(
|
|
22433
|
+
children: isComplianceLoading ? /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22434
|
+
/* @__PURE__ */ jsx107(Loader20, { className: "h-4 w-4 animate-spin" }),
|
|
22275
22435
|
/* @__PURE__ */ jsx107("span", { children: "Checking compliance..." })
|
|
22276
|
-
] }) : erc3643CanTransfer ? /* @__PURE__ */ jsxs98(
|
|
22436
|
+
] }) : erc3643CanTransfer ? /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22277
22437
|
/* @__PURE__ */ jsx107(CheckCircle25, { className: "h-4 w-4" }),
|
|
22278
22438
|
/* @__PURE__ */ jsx107("span", { children: "Transfer compliant" })
|
|
22279
|
-
] }) : /* @__PURE__ */ jsxs98(
|
|
22280
|
-
/* @__PURE__ */ jsx107(
|
|
22439
|
+
] }) : /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22440
|
+
/* @__PURE__ */ jsx107(AlertCircle4, { className: "h-4 w-4" }),
|
|
22281
22441
|
/* @__PURE__ */ jsx107("span", { children: complianceError || "Transfer not allowed" })
|
|
22282
22442
|
] })
|
|
22283
22443
|
}
|
|
@@ -22315,8 +22475,8 @@ var init_InputSendStep = __esm({
|
|
|
22315
22475
|
|
|
22316
22476
|
// src/internal/components/SendMenu/send/sendSteps/ConfirmSendStep.tsx
|
|
22317
22477
|
import { useMutation as useMutation21 } from "@tanstack/react-query";
|
|
22318
|
-
import { AlertTriangle as AlertTriangle5, AtSign as AtSign3, Loader as
|
|
22319
|
-
import { Fragment as
|
|
22478
|
+
import { AlertTriangle as AlertTriangle5, AtSign as AtSign3, Loader as Loader21, Shield as Shield2, ShieldAlert as ShieldAlert2, ShieldCheck as ShieldCheck3 } from "lucide-react";
|
|
22479
|
+
import { Fragment as Fragment42, jsx as jsx108, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
22320
22480
|
function ConfirmSendStep(props) {
|
|
22321
22481
|
const { sendTransaction, erc3643Compliance, isNicknameInput, resolvedNicknameData } = props;
|
|
22322
22482
|
const { t } = useT();
|
|
@@ -22353,7 +22513,7 @@ function ConfirmSendStep(props) {
|
|
|
22353
22513
|
useFlowSelectorStore.getState().setError(error?.message || "Transaction failed");
|
|
22354
22514
|
}
|
|
22355
22515
|
});
|
|
22356
|
-
return /* @__PURE__ */ jsxs99(
|
|
22516
|
+
return /* @__PURE__ */ jsxs99(Fragment42, { children: [
|
|
22357
22517
|
isNicknameInput && isFrozen && /* @__PURE__ */ jsxs99(Highlight, { type: "warning", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
22358
22518
|
/* @__PURE__ */ jsx108(AlertTriangle5, { className: "h-4 w-4" }),
|
|
22359
22519
|
/* @__PURE__ */ jsx108("span", { children: "This handle is frozen. Proceed with caution." })
|
|
@@ -22373,7 +22533,7 @@ function ConfirmSendStep(props) {
|
|
|
22373
22533
|
selectedAsset.symbol
|
|
22374
22534
|
] })
|
|
22375
22535
|
] }),
|
|
22376
|
-
/* @__PURE__ */ jsx108(Highlight, { type: "info", className: "flex flex-col gap-[var(--ui-kit-gap)]", children: isNicknameInput && nicknameData ? /* @__PURE__ */ jsxs99(
|
|
22536
|
+
/* @__PURE__ */ jsx108(Highlight, { type: "info", className: "flex flex-col gap-[var(--ui-kit-gap)]", children: isNicknameInput && nicknameData ? /* @__PURE__ */ jsxs99(Fragment42, { children: [
|
|
22377
22537
|
/* @__PURE__ */ jsxs99("div", { className: "flex items-start gap-[var(--ui-kit-gap)]", children: [
|
|
22378
22538
|
nicknameData.avatarSvg ? /* @__PURE__ */ jsx108(
|
|
22379
22539
|
"img",
|
|
@@ -22431,7 +22591,7 @@ function ConfirmSendStep(props) {
|
|
|
22431
22591
|
/* @__PURE__ */ jsx108("span", { className: "text-sm font-bold", children: chainConfig.name })
|
|
22432
22592
|
] })
|
|
22433
22593
|
] })
|
|
22434
|
-
] }) : /* @__PURE__ */ jsxs99(
|
|
22594
|
+
] }) : /* @__PURE__ */ jsxs99(Fragment42, { children: [
|
|
22435
22595
|
/* @__PURE__ */ jsx108("h3", { className: "font-medium mb-3 text-[var(--ui-kit-fg)]", children: "Transaction Details" }),
|
|
22436
22596
|
/* @__PURE__ */ jsxs99("div", { className: "space-y-2 text-sm text-[var(--ui-kit-fg)]", children: [
|
|
22437
22597
|
/* @__PURE__ */ jsxs99("div", { className: "flex justify-between", children: [
|
|
@@ -22440,7 +22600,7 @@ function ConfirmSendStep(props) {
|
|
|
22440
22600
|
] }),
|
|
22441
22601
|
isNft ? (
|
|
22442
22602
|
// NFT details
|
|
22443
|
-
/* @__PURE__ */ jsx108(
|
|
22603
|
+
/* @__PURE__ */ jsx108(Fragment42, { children: /* @__PURE__ */ jsxs99("div", { className: "flex justify-between items-start", children: [
|
|
22444
22604
|
/* @__PURE__ */ jsx108("span", { className: "text-[var(--ui-kit-fg-muted)]", children: "NFT:" }),
|
|
22445
22605
|
/* @__PURE__ */ jsxs99("div", { className: "text-right", children: [
|
|
22446
22606
|
/* @__PURE__ */ jsx108("span", { className: "font-semibold block", children: selectedAsset.nftMetadata?.name || selectedAsset.name }),
|
|
@@ -22475,7 +22635,7 @@ function ConfirmSendStep(props) {
|
|
|
22475
22635
|
className: "w-full",
|
|
22476
22636
|
size: "large",
|
|
22477
22637
|
children: [
|
|
22478
|
-
isTransactionPending && /* @__PURE__ */ jsx108(
|
|
22638
|
+
isTransactionPending && /* @__PURE__ */ jsx108(Loader21, { className: "h-4 w-4 animate-spin" }),
|
|
22479
22639
|
t("passport:common.confirm")
|
|
22480
22640
|
]
|
|
22481
22641
|
}
|
|
@@ -22505,10 +22665,10 @@ var init_sendSteps = __esm({
|
|
|
22505
22665
|
});
|
|
22506
22666
|
|
|
22507
22667
|
// src/internal/components/SendMenu/send/SendMenu.tsx
|
|
22508
|
-
import { CheckCircle2 as CheckCircle26, Loader as
|
|
22509
|
-
import { useEffect as
|
|
22668
|
+
import { CheckCircle2 as CheckCircle26, Loader as Loader27 } from "lucide-react";
|
|
22669
|
+
import { useEffect as useEffect45, useMemo as useMemo15 } from "react";
|
|
22510
22670
|
import { parseUnits as parseUnits2 } from "viem";
|
|
22511
|
-
import { Fragment as
|
|
22671
|
+
import { Fragment as Fragment43, jsx as jsx109, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
22512
22672
|
function SendMenu() {
|
|
22513
22673
|
const address = useSession((st) => st.address);
|
|
22514
22674
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
@@ -22527,10 +22687,10 @@ function SendMenu() {
|
|
|
22527
22687
|
userOpHash,
|
|
22528
22688
|
reset
|
|
22529
22689
|
} = useSendTransaction();
|
|
22530
|
-
|
|
22690
|
+
useEffect45(() => {
|
|
22531
22691
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
22532
22692
|
}, [isAssetsLoading, isTransactionPending]);
|
|
22533
|
-
|
|
22693
|
+
useEffect45(() => {
|
|
22534
22694
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
22535
22695
|
}, [sendTransactionError]);
|
|
22536
22696
|
const {
|
|
@@ -22545,7 +22705,7 @@ function SendMenu() {
|
|
|
22545
22705
|
} = useSendStore();
|
|
22546
22706
|
const isNft = isNftAsset3(selectedAsset);
|
|
22547
22707
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22548
|
-
|
|
22708
|
+
useEffect45(() => {
|
|
22549
22709
|
const shouldDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
22550
22710
|
if (!shouldDefaultAsset) return;
|
|
22551
22711
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -22555,7 +22715,7 @@ function SendMenu() {
|
|
|
22555
22715
|
if (isBalance(erc20)) return setSelectedAsset(erc20);
|
|
22556
22716
|
setSelectedAsset(assets[0]);
|
|
22557
22717
|
}, [assets, selectedAsset]);
|
|
22558
|
-
|
|
22718
|
+
useEffect45(
|
|
22559
22719
|
() => () => {
|
|
22560
22720
|
setSelectedAsset(null);
|
|
22561
22721
|
setRecipient("");
|
|
@@ -22583,7 +22743,7 @@ function SendMenu() {
|
|
|
22583
22743
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
22584
22744
|
chainId: activeChainId
|
|
22585
22745
|
});
|
|
22586
|
-
|
|
22746
|
+
useEffect45(() => {
|
|
22587
22747
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
22588
22748
|
switch (true) {
|
|
22589
22749
|
case txStep === "select-asset":
|
|
@@ -22606,7 +22766,7 @@ function SendMenu() {
|
|
|
22606
22766
|
break;
|
|
22607
22767
|
}
|
|
22608
22768
|
}, [txStep, selectedAsset, isNft, t]);
|
|
22609
|
-
return /* @__PURE__ */ jsxs100(
|
|
22769
|
+
return /* @__PURE__ */ jsxs100(Fragment43, { children: [
|
|
22610
22770
|
txStep === "select-asset" && /* @__PURE__ */ jsx109(AssetList, { assets }),
|
|
22611
22771
|
txStep === "input" && /* @__PURE__ */ jsx109(
|
|
22612
22772
|
InputSendStep,
|
|
@@ -22627,13 +22787,13 @@ function SendMenu() {
|
|
|
22627
22787
|
}
|
|
22628
22788
|
),
|
|
22629
22789
|
txStep === "pending" && /* @__PURE__ */ jsxs100(Highlight, { type: "info", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
22630
|
-
/* @__PURE__ */ jsx109(
|
|
22790
|
+
/* @__PURE__ */ jsx109(Loader27, { className: "h-4 w-4 animate-spin" }),
|
|
22631
22791
|
/* @__PURE__ */ jsxs100("span", { className: "flex-1", children: [
|
|
22632
22792
|
/* @__PURE__ */ jsx109("span", { className: "block leading-4 font-semibold", children: t("passport:sendMenu.pendingStep") }),
|
|
22633
22793
|
/* @__PURE__ */ jsx109("span", { children: t("passport:sendMenu.pendingStepMsg") })
|
|
22634
22794
|
] })
|
|
22635
22795
|
] }),
|
|
22636
|
-
txStep === "success" && userOpHash && /* @__PURE__ */ jsxs100(
|
|
22796
|
+
txStep === "success" && userOpHash && /* @__PURE__ */ jsxs100(Fragment43, { children: [
|
|
22637
22797
|
/* @__PURE__ */ jsxs100(Highlight, { type: "success", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
22638
22798
|
/* @__PURE__ */ jsx109(CheckCircle26, { className: "h-4 w-4" }),
|
|
22639
22799
|
/* @__PURE__ */ jsxs100("span", { className: "flex-1", children: [
|
|
@@ -22681,8 +22841,8 @@ var init_send = __esm({
|
|
|
22681
22841
|
});
|
|
22682
22842
|
|
|
22683
22843
|
// src/internal/components/SendMenu/SendFlowSelector.tsx
|
|
22684
|
-
import { ArrowLeft as ArrowLeft19, ArrowRightIcon as ArrowRightIcon2, ArrowRightLeftIcon as ArrowRightLeftIcon2, InfoIcon as
|
|
22685
|
-
import { useEffect as
|
|
22844
|
+
import { ArrowLeft as ArrowLeft19, ArrowRightIcon as ArrowRightIcon2, ArrowRightLeftIcon as ArrowRightLeftIcon2, InfoIcon as InfoIcon6 } from "lucide-react";
|
|
22845
|
+
import { useEffect as useEffect46 } from "react";
|
|
22686
22846
|
import { jsx as jsx110, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
22687
22847
|
function SelectorFlowButtons() {
|
|
22688
22848
|
const { t } = useT();
|
|
@@ -22745,7 +22905,7 @@ function SendFlowSelector() {
|
|
|
22745
22905
|
const error = useFlowSelectorStore((st) => st.error);
|
|
22746
22906
|
const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
|
|
22747
22907
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
22748
|
-
|
|
22908
|
+
useEffect46(
|
|
22749
22909
|
() => () => {
|
|
22750
22910
|
useFlowSelectorStore.getState().setError(null);
|
|
22751
22911
|
},
|
|
@@ -22803,7 +22963,7 @@ function SendFlowSelector() {
|
|
|
22803
22963
|
SELECTOR_FLOW[selectorFlow],
|
|
22804
22964
|
error && /* @__PURE__ */ jsxs101(Highlight, { type: "error", className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
22805
22965
|
/* @__PURE__ */ jsxs101("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
22806
|
-
/* @__PURE__ */ jsx110(
|
|
22966
|
+
/* @__PURE__ */ jsx110(InfoIcon6, { className: "h-4 w-4 flex-none" }),
|
|
22807
22967
|
/* @__PURE__ */ jsx110("span", { children: error })
|
|
22808
22968
|
] }),
|
|
22809
22969
|
/* @__PURE__ */ jsx110(
|
|
@@ -22911,7 +23071,7 @@ var init_constants6 = __esm({
|
|
|
22911
23071
|
// src/internal/components/SettingsMenu/SettingsMenu.tsx
|
|
22912
23072
|
import { useQuery as useQuery22 } from "@tanstack/react-query";
|
|
22913
23073
|
import { ArrowLeft as ArrowLeft20, HardDrive as HardDrive3 } from "lucide-react";
|
|
22914
|
-
import { useEffect as
|
|
23074
|
+
import { useEffect as useEffect47 } from "react";
|
|
22915
23075
|
import { jsx as jsx111, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
22916
23076
|
function useSettingsButtons() {
|
|
22917
23077
|
const config = useProviderConfig().config;
|
|
@@ -22930,7 +23090,7 @@ function useSettingsButtons() {
|
|
|
22930
23090
|
if (proMode) {
|
|
22931
23091
|
settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: HardDrive3 });
|
|
22932
23092
|
}
|
|
22933
|
-
|
|
23093
|
+
useEffect47(() => {
|
|
22934
23094
|
const cssvEl = document.querySelector(".embarkai-ui-scope");
|
|
22935
23095
|
if (!cssvEl || !window?.getComputedStyle) {
|
|
22936
23096
|
return;
|
|
@@ -23738,7 +23898,7 @@ var init_utils10 = __esm({
|
|
|
23738
23898
|
|
|
23739
23899
|
// src/internal/components/TransactionsMenu/TransactionsGroup.tsx
|
|
23740
23900
|
import { ChevronDown, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight5, ChevronUp, Copy as Copy3 } from "lucide-react";
|
|
23741
|
-
import { Fragment as
|
|
23901
|
+
import { Fragment as Fragment44, jsx as jsx113, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
23742
23902
|
function InternalTransaction({ internal, assetSymbol, assetDecimals }) {
|
|
23743
23903
|
const internalSymbol = internal.assetSymbol || assetSymbol;
|
|
23744
23904
|
const internalDecimals = internal.decimals ?? assetDecimals;
|
|
@@ -23813,7 +23973,7 @@ function TransactionsGroup(props) {
|
|
|
23813
23973
|
}
|
|
23814
23974
|
) })
|
|
23815
23975
|
] }),
|
|
23816
|
-
internalsToRender.length > 0 && /* @__PURE__ */ jsxs104(
|
|
23976
|
+
internalsToRender.length > 0 && /* @__PURE__ */ jsxs104(Fragment44, { children: [
|
|
23817
23977
|
/* @__PURE__ */ jsx113("div", { className: "w-full flex items-center h-4", children: /* @__PURE__ */ jsx113("div", { style: { borderTop: "1px solid var(--ui-kit-bd)" }, className: "flex-1" }) }),
|
|
23818
23978
|
/* @__PURE__ */ jsxs104(
|
|
23819
23979
|
"div",
|
|
@@ -23868,8 +24028,8 @@ var init_TransactionsGroup = __esm({
|
|
|
23868
24028
|
|
|
23869
24029
|
// src/internal/components/TransactionsMenu/TransactionsMenu.tsx
|
|
23870
24030
|
import { useQuery as useQuery23, useQueryClient as useQueryClient25 } from "@tanstack/react-query";
|
|
23871
|
-
import { ArrowLeft as ArrowLeft22, Loader as
|
|
23872
|
-
import { useCallback as
|
|
24031
|
+
import { ArrowLeft as ArrowLeft22, Loader as Loader28, RefreshCw as RefreshCw3, XCircle } from "lucide-react";
|
|
24032
|
+
import { useCallback as useCallback30, useState as useState28 } from "react";
|
|
23873
24033
|
import { jsx as jsx114, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
23874
24034
|
function TransactionsMenu() {
|
|
23875
24035
|
const qc = useQueryClient25();
|
|
@@ -23878,7 +24038,7 @@ function TransactionsMenu() {
|
|
|
23878
24038
|
const { t } = useT();
|
|
23879
24039
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
23880
24040
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
23881
|
-
const [expandedGroups, setExpandedGroups] =
|
|
24041
|
+
const [expandedGroups, setExpandedGroups] = useState28({});
|
|
23882
24042
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
23883
24043
|
const {
|
|
23884
24044
|
data: txHistoryGroups = [],
|
|
@@ -23891,7 +24051,7 @@ function TransactionsMenu() {
|
|
|
23891
24051
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
23892
24052
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
23893
24053
|
});
|
|
23894
|
-
const refreshTxHistory =
|
|
24054
|
+
const refreshTxHistory = useCallback30(
|
|
23895
24055
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
23896
24056
|
[qc, chainConfig.id, address]
|
|
23897
24057
|
);
|
|
@@ -23916,12 +24076,12 @@ function TransactionsMenu() {
|
|
|
23916
24076
|
onClick: refreshTxHistory,
|
|
23917
24077
|
disabled: isTxHistoryFetching,
|
|
23918
24078
|
title: "Refresh transactions",
|
|
23919
|
-
children: isTxHistoryFetching ? /* @__PURE__ */ jsx114(
|
|
24079
|
+
children: isTxHistoryFetching ? /* @__PURE__ */ jsx114(Loader28, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx114(RefreshCw3, { className: "h-4 w-4" })
|
|
23920
24080
|
}
|
|
23921
24081
|
)
|
|
23922
24082
|
] }),
|
|
23923
24083
|
!historySupported && /* @__PURE__ */ jsx114(Highlight, { type: "warning", children: /* @__PURE__ */ jsx114("span", { children: t("passport:transactionsMenu.comingSoon") }) }),
|
|
23924
|
-
historySupported && isTxHistoryLoading && /* @__PURE__ */ jsx114("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ jsx114(
|
|
24084
|
+
historySupported && isTxHistoryLoading && /* @__PURE__ */ jsx114("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ jsx114(Loader28, { className: "w-4 h-4 animate-spin" }) }),
|
|
23925
24085
|
historySupported && !isTxHistoryLoading && txHistoryResolvedError && /* @__PURE__ */ jsxs105(Highlight, { type: "error", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
23926
24086
|
/* @__PURE__ */ jsx114(XCircle, { className: "w-4 h-4 flex-none" }),
|
|
23927
24087
|
/* @__PURE__ */ jsx114("span", { className: "block w-full flex-1 text-center text-xs", children: txHistoryResolvedError })
|
|
@@ -24130,7 +24290,7 @@ var init_PageMap = __esm({
|
|
|
24130
24290
|
});
|
|
24131
24291
|
|
|
24132
24292
|
// src/internal/hooks/usePageMapper.tsx
|
|
24133
|
-
import { useCallback as
|
|
24293
|
+
import { useCallback as useCallback31, useEffect as useEffect48 } from "react";
|
|
24134
24294
|
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
24135
24295
|
function usePageMapper() {
|
|
24136
24296
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -24142,7 +24302,7 @@ function usePageMapper() {
|
|
|
24142
24302
|
setIsDialogOpen,
|
|
24143
24303
|
setIsDialogClosing
|
|
24144
24304
|
} = useLayoutStore();
|
|
24145
|
-
const closeDialog =
|
|
24305
|
+
const closeDialog = useCallback31(() => {
|
|
24146
24306
|
setIsDialogClosing(true);
|
|
24147
24307
|
setTimeout(() => {
|
|
24148
24308
|
setDialogContent(null);
|
|
@@ -24153,7 +24313,7 @@ function usePageMapper() {
|
|
|
24153
24313
|
setIsDialogOpen(false);
|
|
24154
24314
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
24155
24315
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
24156
|
-
const openDialog =
|
|
24316
|
+
const openDialog = useCallback31(
|
|
24157
24317
|
(pageItem) => {
|
|
24158
24318
|
const PageContentComponent = pageItem.component;
|
|
24159
24319
|
setDialogTitle(pageItem.title);
|
|
@@ -24163,7 +24323,7 @@ function usePageMapper() {
|
|
|
24163
24323
|
},
|
|
24164
24324
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
24165
24325
|
);
|
|
24166
|
-
|
|
24326
|
+
useEffect48(() => {
|
|
24167
24327
|
if (page === null) return closeDialog();
|
|
24168
24328
|
const pageItem = PAGE_MAP[page];
|
|
24169
24329
|
if (!pageItem) {
|
|
@@ -24186,27 +24346,20 @@ var init_usePageMapper = __esm({
|
|
|
24186
24346
|
});
|
|
24187
24347
|
|
|
24188
24348
|
// src/internal/hooks/useSettingsNotifications.ts
|
|
24189
|
-
import {
|
|
24190
|
-
import { useEffect as useEffect46 } from "react";
|
|
24349
|
+
import { useEffect as useEffect49 } from "react";
|
|
24191
24350
|
function useSettingsNotifications() {
|
|
24192
|
-
const address = useSession((st) => st.address);
|
|
24193
24351
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
24194
24352
|
const providers = jwtTokenManager2.getProviders();
|
|
24195
24353
|
const hasEmail = providers.includes("email");
|
|
24196
|
-
const { data: userProfile = null } =
|
|
24197
|
-
|
|
24198
|
-
enabled: !!address,
|
|
24199
|
-
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24200
|
-
queryFn: getUserProfile
|
|
24201
|
-
});
|
|
24202
|
-
useEffect46(() => {
|
|
24354
|
+
const { data: userProfile = null } = useUserProfile();
|
|
24355
|
+
useEffect49(() => {
|
|
24203
24356
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
24204
24357
|
setSettingsNotifications({
|
|
24205
24358
|
...COMPLETE_KYC_PROGRESS,
|
|
24206
24359
|
status: isKYCVerified ? "resolved" : "active"
|
|
24207
24360
|
});
|
|
24208
24361
|
}, [userProfile, setSettingsNotifications]);
|
|
24209
|
-
|
|
24362
|
+
useEffect49(() => {
|
|
24210
24363
|
setSettingsNotifications({
|
|
24211
24364
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
24212
24365
|
status: hasEmail ? "resolved" : "active"
|
|
@@ -24216,10 +24369,9 @@ function useSettingsNotifications() {
|
|
|
24216
24369
|
var EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
24217
24370
|
var init_useSettingsNotifications = __esm({
|
|
24218
24371
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
24219
|
-
init_SessionContext();
|
|
24220
24372
|
init_auth();
|
|
24221
|
-
init_profile();
|
|
24222
24373
|
init_useLayoutDataStore();
|
|
24374
|
+
init_useUserProfile();
|
|
24223
24375
|
EMAIL_NOT_CONNECTED_NOTIFICATION = {
|
|
24224
24376
|
id: "email-not-connected",
|
|
24225
24377
|
target: "manage-wallet" /* MANAGE_WALLET */,
|
|
@@ -24239,7 +24391,7 @@ var init_package = __esm({
|
|
|
24239
24391
|
"package.json"() {
|
|
24240
24392
|
package_default = {
|
|
24241
24393
|
name: "@embarkai/ui-kit",
|
|
24242
|
-
version: "0.4.
|
|
24394
|
+
version: "0.4.59",
|
|
24243
24395
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24244
24396
|
type: "module",
|
|
24245
24397
|
main: "./dist/index.cjs",
|
|
@@ -24341,7 +24493,7 @@ var init_package = __esm({
|
|
|
24341
24493
|
|
|
24342
24494
|
// src/internal/components/Footer/Footer.tsx
|
|
24343
24495
|
import { useMutation as useMutation22, useQueryClient as useQueryClient26 } from "@tanstack/react-query";
|
|
24344
|
-
import { Loader as
|
|
24496
|
+
import { Loader as Loader29, LogOut } from "lucide-react";
|
|
24345
24497
|
import { useDisconnect as useDisconnect3 } from "wagmi";
|
|
24346
24498
|
import { jsx as jsx116, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
24347
24499
|
function Footer() {
|
|
@@ -24429,7 +24581,7 @@ function Footer() {
|
|
|
24429
24581
|
disabled: isDisconnecting,
|
|
24430
24582
|
children: [
|
|
24431
24583
|
/* @__PURE__ */ jsx116("span", { children: t("passport:auth.logout") }),
|
|
24432
|
-
isDisconnecting ? /* @__PURE__ */ jsx116(
|
|
24584
|
+
isDisconnecting ? /* @__PURE__ */ jsx116(Loader29, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsx116(LogOut, { className: "w-4 h-4" })
|
|
24433
24585
|
]
|
|
24434
24586
|
}
|
|
24435
24587
|
) : null
|
|
@@ -24474,10 +24626,9 @@ var init_Footer2 = __esm({
|
|
|
24474
24626
|
});
|
|
24475
24627
|
|
|
24476
24628
|
// src/internal/components/Header/Header.tsx
|
|
24477
|
-
import {
|
|
24478
|
-
import {
|
|
24479
|
-
import {
|
|
24480
|
-
import { Fragment as Fragment44, jsx as jsx117, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
24629
|
+
import { Copy as Copy4, Loader as Loader30 } from "lucide-react";
|
|
24630
|
+
import { useCallback as useCallback32, useRef as useRef21, useState as useState29 } from "react";
|
|
24631
|
+
import { Fragment as Fragment45, jsx as jsx117, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
24481
24632
|
function formatAddress2(addr) {
|
|
24482
24633
|
if (!addr) return "";
|
|
24483
24634
|
return `${addr.slice(0, 10)}...${addr.slice(-4)}`;
|
|
@@ -24488,11 +24639,11 @@ function Header() {
|
|
|
24488
24639
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24489
24640
|
const { t } = useT();
|
|
24490
24641
|
const proMode = useProMode();
|
|
24491
|
-
const [proToast, setProToast] =
|
|
24492
|
-
const [copied, setCopied] =
|
|
24493
|
-
const clickCountRef =
|
|
24494
|
-
const clickTimerRef =
|
|
24495
|
-
const handleAvatarClick =
|
|
24642
|
+
const [proToast, setProToast] = useState29(false);
|
|
24643
|
+
const [copied, setCopied] = useState29(false);
|
|
24644
|
+
const clickCountRef = useRef21(0);
|
|
24645
|
+
const clickTimerRef = useRef21(null);
|
|
24646
|
+
const handleAvatarClick = useCallback32(() => {
|
|
24496
24647
|
clickCountRef.current += 1;
|
|
24497
24648
|
if (clickTimerRef.current) {
|
|
24498
24649
|
clearTimeout(clickTimerRef.current);
|
|
@@ -24510,12 +24661,7 @@ function Header() {
|
|
|
24510
24661
|
}, 1e3);
|
|
24511
24662
|
}
|
|
24512
24663
|
}, []);
|
|
24513
|
-
const { data: profile, isLoading: isProfileLoading } =
|
|
24514
|
-
retry: false,
|
|
24515
|
-
enabled: !!address,
|
|
24516
|
-
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24517
|
-
queryFn: getUserProfile
|
|
24518
|
-
});
|
|
24664
|
+
const { data: profile, isLoading: isProfileLoading } = useUserProfile();
|
|
24519
24665
|
const avatar = profile?.avatar || jwtTokenManager2.getAvatar();
|
|
24520
24666
|
const displayName = profile?.nicknameDisplay || profile?.displayName || jwtTokenManager2.getDisplayName();
|
|
24521
24667
|
const ChainIcon = NETWORK_OPTIONS.find((net) => net.chainId === chainConfig.id)?.Icon || (() => /* @__PURE__ */ jsx117("div", { className: "flex-none w-4 h-4 rounded-full flex items-center justify-center bg-[var(--ui-kit-primary)]", children: /* @__PURE__ */ jsx117("span", { className: "text-[var(--ui-kit-fg-inverted)] text-xs font-bold", children: chainConfig.name.charAt(0) }) }));
|
|
@@ -24543,8 +24689,8 @@ function Header() {
|
|
|
24543
24689
|
style: { width: "calc(100% - 48px - var(--ui-kit-gap))" },
|
|
24544
24690
|
className: "flex-1 flex flex-col justify-center gap-1",
|
|
24545
24691
|
children: [
|
|
24546
|
-
isProfileLoading && /* @__PURE__ */ jsx117(
|
|
24547
|
-
!!address && !isProfileLoading && !!profile && /* @__PURE__ */ jsxs107(
|
|
24692
|
+
isProfileLoading && /* @__PURE__ */ jsx117(Loader30, { className: "w-4 h-4 animate-spin" }),
|
|
24693
|
+
!!address && !isProfileLoading && !!profile && /* @__PURE__ */ jsxs107(Fragment45, { children: [
|
|
24548
24694
|
/* @__PURE__ */ jsxs107("div", { className: "w-full flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
24549
24695
|
/* @__PURE__ */ jsx117(
|
|
24550
24696
|
"span",
|
|
@@ -24601,7 +24747,7 @@ var init_Header = __esm({
|
|
|
24601
24747
|
init_useT();
|
|
24602
24748
|
init_icons();
|
|
24603
24749
|
init_auth();
|
|
24604
|
-
|
|
24750
|
+
init_useUserProfile();
|
|
24605
24751
|
init_pro_mode();
|
|
24606
24752
|
init_utils2();
|
|
24607
24753
|
init_BalanceView2();
|
|
@@ -24794,7 +24940,7 @@ var init_visually_hidden = __esm({
|
|
|
24794
24940
|
|
|
24795
24941
|
// src/internal/components/Dialog/Dialog.tsx
|
|
24796
24942
|
import { AnimatePresence, motion } from "framer-motion";
|
|
24797
|
-
import { useEffect as
|
|
24943
|
+
import { useEffect as useEffect50 } from "react";
|
|
24798
24944
|
import { jsx as jsx120, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
24799
24945
|
function Dialog2() {
|
|
24800
24946
|
const config = useProviderConfig().config;
|
|
@@ -24806,7 +24952,7 @@ function Dialog2() {
|
|
|
24806
24952
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
24807
24953
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24808
24954
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
24809
|
-
|
|
24955
|
+
useEffect50(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
24810
24956
|
usePageMapper();
|
|
24811
24957
|
useAutoConnect();
|
|
24812
24958
|
useBackupStatusChanges();
|
|
@@ -24872,7 +25018,7 @@ var init_Dialog2 = __esm({
|
|
|
24872
25018
|
});
|
|
24873
25019
|
|
|
24874
25020
|
// src/internal/components/TssManager.tsx
|
|
24875
|
-
import React26, { useCallback as
|
|
25021
|
+
import React26, { useCallback as useCallback33 } from "react";
|
|
24876
25022
|
var TssManagerWithRef;
|
|
24877
25023
|
var init_TssManager = __esm({
|
|
24878
25024
|
"src/internal/components/TssManager.tsx"() {
|
|
@@ -24887,7 +25033,7 @@ var init_TssManager = __esm({
|
|
|
24887
25033
|
const setStatus = useSession((st) => st.setStatus);
|
|
24888
25034
|
const setSession = useSession((st) => st.setSession);
|
|
24889
25035
|
const setAddress = useSession((st) => st.setAddress);
|
|
24890
|
-
const onSessionCreated =
|
|
25036
|
+
const onSessionCreated = useCallback33(
|
|
24891
25037
|
(session, address) => {
|
|
24892
25038
|
setSession(session);
|
|
24893
25039
|
setAddress(address);
|
|
@@ -24928,7 +25074,7 @@ var init_TssManager = __esm({
|
|
|
24928
25074
|
// src/internal/components/WalletConnectHandler.tsx
|
|
24929
25075
|
import { useConnectModal as useConnectModal2 } from "@rainbow-me/rainbowkit";
|
|
24930
25076
|
import { useMutation as useMutation23, useQueryClient as useQueryClient27 } from "@tanstack/react-query";
|
|
24931
|
-
import React27, { useCallback as
|
|
25077
|
+
import React27, { useCallback as useCallback34, useEffect as useEffect51 } from "react";
|
|
24932
25078
|
import { useAccount, useDisconnect as useDisconnect4, useSignMessage as useSignMessage2 } from "wagmi";
|
|
24933
25079
|
function WalletConnectHandler() {
|
|
24934
25080
|
const qc = useQueryClient27();
|
|
@@ -24951,7 +25097,7 @@ function WalletConnectHandler() {
|
|
|
24951
25097
|
const projectId = providerConfig?.projectId;
|
|
24952
25098
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
24953
25099
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
24954
|
-
const onLinkingComplete =
|
|
25100
|
+
const onLinkingComplete = useCallback34(
|
|
24955
25101
|
async (success) => {
|
|
24956
25102
|
setIsWalletLinking(false);
|
|
24957
25103
|
if (!success && !passportWalletAddress) {
|
|
@@ -24983,7 +25129,7 @@ function WalletConnectHandler() {
|
|
|
24983
25129
|
const [hasStartedLinking, setHasStartedLinking] = React27.useState(false);
|
|
24984
25130
|
const [modalWasOpened, setModalWasOpened] = React27.useState(false);
|
|
24985
25131
|
const [pendingModalOpen, setPendingModalOpen] = React27.useState(false);
|
|
24986
|
-
|
|
25132
|
+
useEffect51(() => {
|
|
24987
25133
|
if (isWalletLinking && !hasStartedLinking) {
|
|
24988
25134
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
24989
25135
|
isConnected,
|
|
@@ -25021,18 +25167,18 @@ function WalletConnectHandler() {
|
|
|
25021
25167
|
setProviderType,
|
|
25022
25168
|
walletMode
|
|
25023
25169
|
]);
|
|
25024
|
-
|
|
25170
|
+
useEffect51(() => {
|
|
25025
25171
|
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
25026
25172
|
setPendingModalOpen(false);
|
|
25027
25173
|
openConnectModal();
|
|
25028
25174
|
}
|
|
25029
25175
|
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
25030
|
-
|
|
25176
|
+
useEffect51(() => {
|
|
25031
25177
|
if (connectModalOpen && hasStartedLinking) {
|
|
25032
25178
|
setModalWasOpened(true);
|
|
25033
25179
|
}
|
|
25034
25180
|
}, [connectModalOpen, hasStartedLinking]);
|
|
25035
|
-
|
|
25181
|
+
useEffect51(() => {
|
|
25036
25182
|
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
25037
25183
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
25038
25184
|
onLinkingComplete(false);
|
|
@@ -25040,7 +25186,7 @@ function WalletConnectHandler() {
|
|
|
25040
25186
|
setModalWasOpened(false);
|
|
25041
25187
|
}
|
|
25042
25188
|
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
25043
|
-
|
|
25189
|
+
useEffect51(() => {
|
|
25044
25190
|
if (isWalletLinking) {
|
|
25045
25191
|
const timeout = setTimeout(() => {
|
|
25046
25192
|
console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
|
|
@@ -25160,7 +25306,7 @@ function WalletConnectHandler() {
|
|
|
25160
25306
|
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
25161
25307
|
}
|
|
25162
25308
|
});
|
|
25163
|
-
|
|
25309
|
+
useEffect51(() => {
|
|
25164
25310
|
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
25165
25311
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
25166
25312
|
if (!passportWalletAddress) {
|
|
@@ -25170,7 +25316,7 @@ function WalletConnectHandler() {
|
|
|
25170
25316
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
25171
25317
|
}
|
|
25172
25318
|
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
25173
|
-
|
|
25319
|
+
useEffect51(() => {
|
|
25174
25320
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
25175
25321
|
const timeout = setTimeout(() => {
|
|
25176
25322
|
console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
|
|
@@ -25206,7 +25352,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25206
25352
|
});
|
|
25207
25353
|
|
|
25208
25354
|
// src/internal/components/DirectWalletHandler.tsx
|
|
25209
|
-
import { useEffect as
|
|
25355
|
+
import { useEffect as useEffect52 } from "react";
|
|
25210
25356
|
import { useAccount as useAccount2 } from "wagmi";
|
|
25211
25357
|
function DirectWalletHandler() {
|
|
25212
25358
|
const walletMode = useProviderConfig().config.current?.wallet?.mode || "linked";
|
|
@@ -25218,13 +25364,13 @@ function DirectWalletHandler() {
|
|
|
25218
25364
|
const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
|
|
25219
25365
|
const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
|
|
25220
25366
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
25221
|
-
|
|
25367
|
+
useEffect52(() => {
|
|
25222
25368
|
setConfigMode(walletMode);
|
|
25223
25369
|
if (walletMode !== "both") {
|
|
25224
25370
|
setActiveMode(walletMode);
|
|
25225
25371
|
}
|
|
25226
25372
|
}, [walletMode, setConfigMode, setActiveMode]);
|
|
25227
|
-
|
|
25373
|
+
useEffect52(() => {
|
|
25228
25374
|
if (isConnected && address && !isExternalConnected && connector && chain?.id) {
|
|
25229
25375
|
setExternalWallet({
|
|
25230
25376
|
address,
|
|
@@ -25233,17 +25379,17 @@ function DirectWalletHandler() {
|
|
|
25233
25379
|
});
|
|
25234
25380
|
}
|
|
25235
25381
|
}, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
|
|
25236
|
-
|
|
25382
|
+
useEffect52(() => {
|
|
25237
25383
|
if (isExternalConnected && !isConnected) {
|
|
25238
25384
|
clearExternalWallet();
|
|
25239
25385
|
}
|
|
25240
25386
|
}, [isConnected, isExternalConnected, clearExternalWallet]);
|
|
25241
|
-
|
|
25387
|
+
useEffect52(() => {
|
|
25242
25388
|
if (isExternalConnected && isConnected && chain?.id) {
|
|
25243
25389
|
setExternalChainId(chain.id);
|
|
25244
25390
|
}
|
|
25245
25391
|
}, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
|
|
25246
|
-
|
|
25392
|
+
useEffect52(() => {
|
|
25247
25393
|
if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
|
|
25248
25394
|
setExternalWallet({
|
|
25249
25395
|
address,
|
|
@@ -25269,8 +25415,8 @@ import {
|
|
|
25269
25415
|
getChainConfig as getChainConfig12,
|
|
25270
25416
|
getViemChain as getViemChain2
|
|
25271
25417
|
} from "@embarkai/core/read";
|
|
25272
|
-
import { Fragment as
|
|
25273
|
-
import { create as
|
|
25418
|
+
import { Fragment as Fragment46 } from "react";
|
|
25419
|
+
import { create as create15 } from "zustand";
|
|
25274
25420
|
import { persist as persist4 } from "zustand/middleware";
|
|
25275
25421
|
import { jsx as jsx121, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
25276
25422
|
function getChainParams(chainCfg) {
|
|
@@ -25290,7 +25436,7 @@ function waitForStoreHydration() {
|
|
|
25290
25436
|
}
|
|
25291
25437
|
function SessionProvider({ children }) {
|
|
25292
25438
|
const config = useProviderConfig().config;
|
|
25293
|
-
return /* @__PURE__ */ jsxs110(
|
|
25439
|
+
return /* @__PURE__ */ jsxs110(Fragment46, { children: [
|
|
25294
25440
|
children,
|
|
25295
25441
|
config.current?.wallet?.enabled && /* @__PURE__ */ jsx121(WalletConnectHandler, {}),
|
|
25296
25442
|
config.current?.wallet?.enabled && (config.current?.wallet?.mode === "direct" || config.current?.wallet?.mode === "both") && /* @__PURE__ */ jsx121(DirectWalletHandler, {}),
|
|
@@ -25315,7 +25461,7 @@ var init_SessionContext = __esm({
|
|
|
25315
25461
|
init_WalletConnectHandler();
|
|
25316
25462
|
init_DirectWalletHandler();
|
|
25317
25463
|
init_ProviderContext();
|
|
25318
|
-
useSession =
|
|
25464
|
+
useSession = create15()(
|
|
25319
25465
|
persist4(
|
|
25320
25466
|
(set) => ({
|
|
25321
25467
|
isLoading: false,
|
|
@@ -26283,13 +26429,13 @@ async function clearLocalKeyshare(userId) {
|
|
|
26283
26429
|
console.log("[clearLocalKeyshare] Keyshares are now managed by secure iframe");
|
|
26284
26430
|
console.log("[clearLocalKeyshare] To clear keyshares, user must revoke authorization in iframe");
|
|
26285
26431
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
26286
|
-
const
|
|
26432
|
+
const keys2 = [
|
|
26287
26433
|
`tss.${userId}.keyshare`,
|
|
26288
26434
|
`tss.${userId}.ownerAddress`,
|
|
26289
26435
|
`tss.${userId}.sessionId`,
|
|
26290
26436
|
...Object.keys(window.localStorage).filter((key) => key.startsWith(`tss.${userId}.dkg.`))
|
|
26291
26437
|
];
|
|
26292
|
-
|
|
26438
|
+
keys2.forEach((key) => window.localStorage.removeItem(key));
|
|
26293
26439
|
console.log("[clearLocalKeyshare] Cleared old localStorage keys for migration");
|
|
26294
26440
|
}
|
|
26295
26441
|
}
|
|
@@ -26374,6 +26520,7 @@ __export(auth_exports, {
|
|
|
26374
26520
|
createPasskeyHelpers: () => createPasskeyHelpers,
|
|
26375
26521
|
createSignatureMessage: () => createSignatureMessage,
|
|
26376
26522
|
deriveDemoPrivateKey: () => deriveDemoPrivateKey,
|
|
26523
|
+
ensureFreshSession: () => ensureFreshSession,
|
|
26377
26524
|
ensureKeyshare: () => ensureKeyshare,
|
|
26378
26525
|
ensureValidToken: () => ensureValidToken,
|
|
26379
26526
|
fetchProjectName: () => fetchProjectName,
|
|
@@ -26417,6 +26564,7 @@ import {
|
|
|
26417
26564
|
configureJwtModule,
|
|
26418
26565
|
logout,
|
|
26419
26566
|
verifyToken,
|
|
26567
|
+
ensureFreshSession,
|
|
26420
26568
|
ensureValidToken,
|
|
26421
26569
|
getValidTokens,
|
|
26422
26570
|
authenticatedFetch,
|
|
@@ -26755,8 +26903,8 @@ var init_iframe_manager = __esm({
|
|
|
26755
26903
|
async handleTokenRefreshRequest(message) {
|
|
26756
26904
|
try {
|
|
26757
26905
|
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
26758
|
-
const
|
|
26759
|
-
if (
|
|
26906
|
+
const outcome = await jwtTokenManager4.refreshTokens();
|
|
26907
|
+
if (outcome === "refreshed") {
|
|
26760
26908
|
const newAccessToken = jwtTokenManager4.getAccessToken();
|
|
26761
26909
|
if (this.iframe && this.iframe.contentWindow) {
|
|
26762
26910
|
const iframeOrigin = new URL(this.iframeUrl).origin;
|
|
@@ -26778,6 +26926,7 @@ var init_iframe_manager = __esm({
|
|
|
26778
26926
|
type: "IFRAME_MSG_TOKEN_REFRESHED",
|
|
26779
26927
|
messageId: message.messageId,
|
|
26780
26928
|
error: "Token refresh failed",
|
|
26929
|
+
sessionDead: outcome === "session_dead",
|
|
26781
26930
|
timestamp: Date.now()
|
|
26782
26931
|
},
|
|
26783
26932
|
iframeOrigin
|
|
@@ -27994,7 +28143,7 @@ import { darkTheme, lightTheme, RainbowKitProvider as NativeRainbowKitProvider }
|
|
|
27994
28143
|
import { useMemo as useMemo16 } from "react";
|
|
27995
28144
|
import { WagmiProvider } from "wagmi";
|
|
27996
28145
|
import "@rainbow-me/rainbowkit/styles.css";
|
|
27997
|
-
import { Fragment as
|
|
28146
|
+
import { Fragment as Fragment47, jsx as jsx122 } from "react/jsx-runtime";
|
|
27998
28147
|
function RainbowKitProvider({ children }) {
|
|
27999
28148
|
const config = useProviderConfig().config;
|
|
28000
28149
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
@@ -28026,7 +28175,7 @@ function RainbowKitProvider({ children }) {
|
|
|
28026
28175
|
radii: rainbowTheme.lightMode.radii
|
|
28027
28176
|
};
|
|
28028
28177
|
}, [colorMode]);
|
|
28029
|
-
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ jsx122(
|
|
28178
|
+
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ jsx122(Fragment47, { children });
|
|
28030
28179
|
return /* @__PURE__ */ jsx122(WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ jsx122(NativeRainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
28031
28180
|
}
|
|
28032
28181
|
var init_RainbowKitContext = __esm({
|
|
@@ -28070,11 +28219,11 @@ import { initSdkErrorTracking } from "@embarkai/core/internal/error-tracking";
|
|
|
28070
28219
|
import { merge as merge3 } from "lodash-es";
|
|
28071
28220
|
import {
|
|
28072
28221
|
createContext,
|
|
28073
|
-
useCallback as
|
|
28222
|
+
useCallback as useCallback35,
|
|
28074
28223
|
useContext,
|
|
28075
|
-
useEffect as
|
|
28224
|
+
useEffect as useEffect53,
|
|
28076
28225
|
useMemo as useMemo17,
|
|
28077
|
-
useRef as
|
|
28226
|
+
useRef as useRef22
|
|
28078
28227
|
} from "react";
|
|
28079
28228
|
import { jsx as jsx124 } from "react/jsx-runtime";
|
|
28080
28229
|
function clearLegacyWagmiStorage() {
|
|
@@ -28094,10 +28243,10 @@ function clearLegacyWagmiStorage() {
|
|
|
28094
28243
|
}
|
|
28095
28244
|
function Provider(props) {
|
|
28096
28245
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
28097
|
-
const callbacksRef =
|
|
28098
|
-
|
|
28099
|
-
const config =
|
|
28100
|
-
const updateConfig =
|
|
28246
|
+
const callbacksRef = useRef22(callbacks);
|
|
28247
|
+
useEffect53(() => notifyNoProjetctId(projectId), [projectId]);
|
|
28248
|
+
const config = useRef22(merge3({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
28249
|
+
const updateConfig = useCallback35((updates) => {
|
|
28101
28250
|
const prev = config.current;
|
|
28102
28251
|
const next = { ...prev };
|
|
28103
28252
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -28131,12 +28280,12 @@ function Provider(props) {
|
|
|
28131
28280
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
28132
28281
|
config.current = next;
|
|
28133
28282
|
}, []);
|
|
28134
|
-
const updateCallbacks =
|
|
28283
|
+
const updateCallbacks = useCallback35((updates) => {
|
|
28135
28284
|
const prev = callbacksRef.current;
|
|
28136
28285
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
28137
28286
|
callbacksRef.current = next;
|
|
28138
28287
|
}, []);
|
|
28139
|
-
|
|
28288
|
+
useEffect53(() => {
|
|
28140
28289
|
if (typeof window === "undefined" || !projectId) return;
|
|
28141
28290
|
const mergedConfig = merge3(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
28142
28291
|
updateConfig(mergedConfig);
|
|
@@ -28156,7 +28305,7 @@ function Provider(props) {
|
|
|
28156
28305
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
28157
28306
|
}
|
|
28158
28307
|
}, [projectId, initialConfig]);
|
|
28159
|
-
|
|
28308
|
+
useEffect53(() => {
|
|
28160
28309
|
if (typeof window === "undefined" || !projectId) return;
|
|
28161
28310
|
try {
|
|
28162
28311
|
initSdkErrorTracking();
|
|
@@ -28236,18 +28385,17 @@ init_lumia2();
|
|
|
28236
28385
|
init_embarkAI2();
|
|
28237
28386
|
init_SessionContext();
|
|
28238
28387
|
init_auth();
|
|
28239
|
-
init_profile();
|
|
28240
28388
|
init_BalanceView2();
|
|
28241
28389
|
init_KYC();
|
|
28242
28390
|
init_button();
|
|
28243
28391
|
init_useLayoutDataStore();
|
|
28392
|
+
init_useUserProfile();
|
|
28244
28393
|
init_useLayoutStore();
|
|
28245
28394
|
init_pro_mode();
|
|
28246
28395
|
init_utils2();
|
|
28247
|
-
import {
|
|
28248
|
-
import {
|
|
28249
|
-
import {
|
|
28250
|
-
import { Fragment as Fragment47, jsx as jsx125, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
28396
|
+
import { Cloud as Cloud4, Laptop as Laptop2, Loader as Loader31, Shield as Shield3 } from "lucide-react";
|
|
28397
|
+
import { useEffect as useEffect54, useMemo as useMemo18 } from "react";
|
|
28398
|
+
import { Fragment as Fragment48, jsx as jsx125, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
28251
28399
|
function getFormattedStatus(label, status, showStatus) {
|
|
28252
28400
|
const isStatus = showStatus && status && status !== "idle" && status !== "ready";
|
|
28253
28401
|
if (!isStatus) return label;
|
|
@@ -28266,13 +28414,8 @@ function ConnectWalletButton(props) {
|
|
|
28266
28414
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28267
28415
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
28268
28416
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
28269
|
-
|
|
28270
|
-
const { data: profile, isLoading: isProfileLoading } =
|
|
28271
|
-
retry: false,
|
|
28272
|
-
enabled: !!address,
|
|
28273
|
-
queryKey: [QUERY_KEYS.userProfile, address],
|
|
28274
|
-
queryFn: getUserProfile
|
|
28275
|
-
});
|
|
28417
|
+
useEffect54(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
28418
|
+
const { data: profile, isLoading: isProfileLoading } = useUserProfile();
|
|
28276
28419
|
const displayName = profile?.nicknameDisplay || profile?.displayName || jwtTokenManager2.getDisplayName();
|
|
28277
28420
|
const indicators = useMemo18(() => {
|
|
28278
28421
|
const userId = session?.mpcUserId;
|
|
@@ -28285,14 +28428,14 @@ function ConnectWalletButton(props) {
|
|
|
28285
28428
|
const isConnecting = connectButtonLabel !== label || isLoading;
|
|
28286
28429
|
return /* @__PURE__ */ jsx125("div", { "data-current-theme-mode": colorMode, className: cn("embarkai-ui-scope w-fit h-fit", className), children: !address ? (
|
|
28287
28430
|
/** external Buttons can be provided */
|
|
28288
|
-
/* @__PURE__ */ jsx125(
|
|
28431
|
+
/* @__PURE__ */ jsx125(Fragment48, { children: ConnectButton ? /* @__PURE__ */ jsxs111(
|
|
28289
28432
|
ConnectButton,
|
|
28290
28433
|
{
|
|
28291
28434
|
type: "button",
|
|
28292
28435
|
disabled: isConnecting,
|
|
28293
28436
|
onClick: () => setPage("auth" /* AUTH */),
|
|
28294
28437
|
children: [
|
|
28295
|
-
isConnecting ? /* @__PURE__ */ jsx125("span", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ jsx125(
|
|
28438
|
+
isConnecting ? /* @__PURE__ */ jsx125("span", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ jsx125(Loader31, { className: "w-4 h-4 animate-spin" }) }) : /* @__PURE__ */ jsx125(embarkAI_default2, { className: "w-6 h-6" }),
|
|
28296
28439
|
connectButtonLabel
|
|
28297
28440
|
]
|
|
28298
28441
|
}
|
|
@@ -28313,7 +28456,7 @@ function ConnectWalletButton(props) {
|
|
|
28313
28456
|
"disabled:hover:bg-[var(--ui-kit-bg)] disabled:active:bg-[var(--ui-kit-bg)]"
|
|
28314
28457
|
),
|
|
28315
28458
|
children: [
|
|
28316
|
-
isConnecting ? /* @__PURE__ */ jsx125("span", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ jsx125(
|
|
28459
|
+
isConnecting ? /* @__PURE__ */ jsx125("span", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ jsx125(Loader31, { className: "w-4 h-4 animate-spin" }) }) : /* @__PURE__ */ jsx125(embarkAI_default2, { className: "w-6 h-6" }),
|
|
28317
28460
|
connectButtonLabel.toUpperCase()
|
|
28318
28461
|
]
|
|
28319
28462
|
}
|
|
@@ -28337,8 +28480,8 @@ function ConnectWalletButton(props) {
|
|
|
28337
28480
|
] }),
|
|
28338
28481
|
/* @__PURE__ */ jsxs111("div", { className: "text-left flex-1 min-w-0 text-[var(--ui-kit-fg)]", children: [
|
|
28339
28482
|
/* @__PURE__ */ jsxs111("div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
28340
|
-
isProfileLoading ? /* @__PURE__ */ jsx125(
|
|
28341
|
-
|
|
28483
|
+
isProfileLoading ? /* @__PURE__ */ jsx125(Loader31, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsx125("span", { className: "w-fit text-[14px] leading-4 truncate max-w-[144px] text-[var(--ui-kit-fg)]", children: displayName }),
|
|
28484
|
+
/* @__PURE__ */ jsx125(KYCStatus, {})
|
|
28342
28485
|
] }),
|
|
28343
28486
|
/* @__PURE__ */ jsx125(BalanceView, {})
|
|
28344
28487
|
] }),
|
|
@@ -28528,7 +28671,7 @@ init_useLayoutDataStore();
|
|
|
28528
28671
|
init_getUserOperationByHash();
|
|
28529
28672
|
init_getUserOperationReceipt();
|
|
28530
28673
|
init_cn();
|
|
28531
|
-
import { AlertCircle as
|
|
28674
|
+
import { AlertCircle as AlertCircle5, CheckCircle2 as CheckCircle27, Clock as Clock2, Copy as Copy6, ExternalLink as ExternalLink3, RefreshCw as RefreshCw4 } from "lucide-react";
|
|
28532
28675
|
import * as React29 from "react";
|
|
28533
28676
|
|
|
28534
28677
|
// src/internal/components/Address.tsx
|
|
@@ -28712,19 +28855,19 @@ var UserOpStatus = ({
|
|
|
28712
28855
|
if (receipt) {
|
|
28713
28856
|
const ok = !!receipt.success;
|
|
28714
28857
|
return /* @__PURE__ */ jsxs113(Badge, { variant: ok ? "success" : "destructive", children: [
|
|
28715
|
-
ok ? /* @__PURE__ */ jsx129(CheckCircle27, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx129(
|
|
28858
|
+
ok ? /* @__PURE__ */ jsx129(CheckCircle27, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx129(AlertCircle5, { className: "h-3 w-3" }),
|
|
28716
28859
|
ok ? "Included" : "Failed"
|
|
28717
28860
|
] });
|
|
28718
28861
|
}
|
|
28719
28862
|
if (rejected) {
|
|
28720
28863
|
return /* @__PURE__ */ jsxs113(Badge, { variant: "destructive", children: [
|
|
28721
|
-
/* @__PURE__ */ jsx129(
|
|
28864
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-3 w-3" }),
|
|
28722
28865
|
" Rejected by bundler"
|
|
28723
28866
|
] });
|
|
28724
28867
|
}
|
|
28725
28868
|
if (timedOut) {
|
|
28726
28869
|
return /* @__PURE__ */ jsxs113(Badge, { variant: "warning", children: [
|
|
28727
|
-
/* @__PURE__ */ jsx129(
|
|
28870
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-3 w-3" }),
|
|
28728
28871
|
" Timeout - may be rejected"
|
|
28729
28872
|
] });
|
|
28730
28873
|
}
|
|
@@ -28832,16 +28975,16 @@ var UserOpStatus = ({
|
|
|
28832
28975
|
] })
|
|
28833
28976
|
] }),
|
|
28834
28977
|
error && /* @__PURE__ */ jsxs113("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
28835
|
-
/* @__PURE__ */ jsx129(
|
|
28978
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-4 w-4" }),
|
|
28836
28979
|
" ",
|
|
28837
28980
|
error
|
|
28838
28981
|
] }),
|
|
28839
28982
|
rejected && /* @__PURE__ */ jsxs113("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
28840
|
-
/* @__PURE__ */ jsx129(
|
|
28983
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-4 w-4" }),
|
|
28841
28984
|
"UserOperation was dropped from bundler mempool. This usually means it was invalid or replaced."
|
|
28842
28985
|
] }),
|
|
28843
28986
|
timedOut && /* @__PURE__ */ jsxs113("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
28844
|
-
/* @__PURE__ */ jsx129(
|
|
28987
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-4 w-4" }),
|
|
28845
28988
|
"Stopped polling after ",
|
|
28846
28989
|
Math.round(maxPollTimeMs / 1e3),
|
|
28847
28990
|
"s. UserOperation may have been rejected by the bundler."
|
|
@@ -28917,13 +29060,13 @@ var Hash = ({
|
|
|
28917
29060
|
|
|
28918
29061
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
28919
29062
|
init_base2();
|
|
28920
|
-
import { useEffect as
|
|
29063
|
+
import { useEffect as useEffect56, useState as useState33 } from "react";
|
|
28921
29064
|
import { jsx as jsx131, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
28922
29065
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
28923
|
-
const [transactions, setTransactions] =
|
|
28924
|
-
const [loading, setLoading] =
|
|
28925
|
-
const [error, setError] =
|
|
28926
|
-
|
|
29066
|
+
const [transactions, setTransactions] = useState33([]);
|
|
29067
|
+
const [loading, setLoading] = useState33(true);
|
|
29068
|
+
const [error, setError] = useState33(null);
|
|
29069
|
+
useEffect56(() => {
|
|
28927
29070
|
const fetchTransactions2 = async () => {
|
|
28928
29071
|
try {
|
|
28929
29072
|
setLoading(true);
|
|
@@ -29215,12 +29358,12 @@ init_useErc3643Compliance();
|
|
|
29215
29358
|
|
|
29216
29359
|
// src/hooks/useWalletMode.ts
|
|
29217
29360
|
init_useExternalWalletStore();
|
|
29218
|
-
import { useCallback as
|
|
29361
|
+
import { useCallback as useCallback38 } from "react";
|
|
29219
29362
|
function useWalletMode() {
|
|
29220
29363
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
29221
29364
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
29222
29365
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
29223
|
-
const switchMode =
|
|
29366
|
+
const switchMode = useCallback38(
|
|
29224
29367
|
(mode) => {
|
|
29225
29368
|
if (configMode !== "both") return;
|
|
29226
29369
|
setActiveMode(mode);
|
|
@@ -29238,7 +29381,7 @@ function useWalletMode() {
|
|
|
29238
29381
|
// src/hooks/useDirectWallet.ts
|
|
29239
29382
|
init_useExternalWalletStore();
|
|
29240
29383
|
init_useLayoutDataStore();
|
|
29241
|
-
import { useCallback as
|
|
29384
|
+
import { useCallback as useCallback39 } from "react";
|
|
29242
29385
|
import { useConnectModal as useConnectModal3 } from "@rainbow-me/rainbowkit";
|
|
29243
29386
|
import { useDisconnect as useDisconnect5 } from "wagmi";
|
|
29244
29387
|
function useDirectWallet() {
|
|
@@ -29250,13 +29393,13 @@ function useDirectWallet() {
|
|
|
29250
29393
|
const { disconnect: wagmiDisconnect } = useDisconnect5();
|
|
29251
29394
|
const { openConnectModal } = useConnectModal3();
|
|
29252
29395
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29253
|
-
const connect =
|
|
29396
|
+
const connect = useCallback39(() => {
|
|
29254
29397
|
setIsWalletLinking(true);
|
|
29255
29398
|
}, [setIsWalletLinking]);
|
|
29256
|
-
const reconnect =
|
|
29399
|
+
const reconnect = useCallback39(() => {
|
|
29257
29400
|
if (openConnectModal) openConnectModal();
|
|
29258
29401
|
}, [openConnectModal]);
|
|
29259
|
-
const disconnect =
|
|
29402
|
+
const disconnect = useCallback39(() => {
|
|
29260
29403
|
wagmiDisconnect();
|
|
29261
29404
|
clearExternalWallet();
|
|
29262
29405
|
}, [wagmiDisconnect, clearExternalWallet]);
|
|
@@ -29273,7 +29416,7 @@ function useDirectWallet() {
|
|
|
29273
29416
|
|
|
29274
29417
|
// src/hooks/useSendDirectTransaction.ts
|
|
29275
29418
|
init_useExternalWalletStore();
|
|
29276
|
-
import { useCallback as
|
|
29419
|
+
import { useCallback as useCallback40, useState as useState35 } from "react";
|
|
29277
29420
|
import { isAddress as isAddress3, parseEther as parseEther3 } from "viem";
|
|
29278
29421
|
import { useSendTransaction as useWagmiSendTransaction, useSwitchChain as useSwitchChain3 } from "wagmi";
|
|
29279
29422
|
function useSendDirectTransaction() {
|
|
@@ -29281,10 +29424,10 @@ function useSendDirectTransaction() {
|
|
|
29281
29424
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29282
29425
|
const { sendTransactionAsync } = useWagmiSendTransaction();
|
|
29283
29426
|
const { switchChainAsync } = useSwitchChain3();
|
|
29284
|
-
const [isPending, setIsPending] =
|
|
29285
|
-
const [error, setError] =
|
|
29286
|
-
const [txHash, setTxHash] =
|
|
29287
|
-
const sendTransaction =
|
|
29427
|
+
const [isPending, setIsPending] = useState35(false);
|
|
29428
|
+
const [error, setError] = useState35(null);
|
|
29429
|
+
const [txHash, setTxHash] = useState35(null);
|
|
29430
|
+
const sendTransaction = useCallback40(
|
|
29288
29431
|
async (params) => {
|
|
29289
29432
|
if (!isConnected) {
|
|
29290
29433
|
setError("No external wallet connected");
|
|
@@ -29318,7 +29461,7 @@ function useSendDirectTransaction() {
|
|
|
29318
29461
|
},
|
|
29319
29462
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
29320
29463
|
);
|
|
29321
|
-
const reset =
|
|
29464
|
+
const reset = useCallback40(() => {
|
|
29322
29465
|
setError(null);
|
|
29323
29466
|
setTxHash(null);
|
|
29324
29467
|
setIsPending(false);
|
|
@@ -29330,7 +29473,7 @@ function useSendDirectTransaction() {
|
|
|
29330
29473
|
init_SessionContext();
|
|
29331
29474
|
init_account2();
|
|
29332
29475
|
init_linkedProfiles();
|
|
29333
|
-
import { useCallback as
|
|
29476
|
+
import { useCallback as useCallback41, useMemo as useMemo19, useState as useState36 } from "react";
|
|
29334
29477
|
import { encodeFunctionData as encodeFunctionData3, isAddress as isAddress4, parseEther as parseEther4, parseUnits as parseUnits3 } from "viem";
|
|
29335
29478
|
var ERC20_TRANSFER_ABI2 = [
|
|
29336
29479
|
{
|
|
@@ -29346,14 +29489,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
29346
29489
|
function useTransferToLinkedWallet() {
|
|
29347
29490
|
const session = useSession((st) => st.session);
|
|
29348
29491
|
const { profiles } = useLinkedProfiles();
|
|
29349
|
-
const [isPending, setIsPending] =
|
|
29350
|
-
const [error, setError] =
|
|
29351
|
-
const [userOpHash, setUserOpHash] =
|
|
29492
|
+
const [isPending, setIsPending] = useState36(false);
|
|
29493
|
+
const [error, setError] = useState36(null);
|
|
29494
|
+
const [userOpHash, setUserOpHash] = useState36(null);
|
|
29352
29495
|
const linkedWallets = useMemo19(
|
|
29353
29496
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
29354
29497
|
[profiles]
|
|
29355
29498
|
);
|
|
29356
|
-
const transfer =
|
|
29499
|
+
const transfer = useCallback41(
|
|
29357
29500
|
async (params) => {
|
|
29358
29501
|
if (!session) {
|
|
29359
29502
|
setError("No active session");
|
|
@@ -29404,7 +29547,7 @@ function useTransferToLinkedWallet() {
|
|
|
29404
29547
|
},
|
|
29405
29548
|
[session, linkedWallets]
|
|
29406
29549
|
);
|
|
29407
|
-
const reset =
|
|
29550
|
+
const reset = useCallback41(() => {
|
|
29408
29551
|
setError(null);
|
|
29409
29552
|
setUserOpHash(null);
|
|
29410
29553
|
setIsPending(false);
|
|
@@ -29431,7 +29574,7 @@ init_ProviderContext();
|
|
|
29431
29574
|
init_SessionContext();
|
|
29432
29575
|
init_useExternalWalletStore();
|
|
29433
29576
|
import { logout as coreLogout, jwtTokenManager as jwtTokenManager3 } from "@embarkai/core/auth";
|
|
29434
|
-
import { useCallback as
|
|
29577
|
+
import { useCallback as useCallback42 } from "react";
|
|
29435
29578
|
import { useDisconnect as useDisconnect6 } from "wagmi";
|
|
29436
29579
|
function useLogout() {
|
|
29437
29580
|
const { callbacksRef } = useProviderConfig();
|
|
@@ -29448,7 +29591,7 @@ function useLogout() {
|
|
|
29448
29591
|
}
|
|
29449
29592
|
}
|
|
29450
29593
|
});
|
|
29451
|
-
const logout2 =
|
|
29594
|
+
const logout2 = useCallback42(async () => {
|
|
29452
29595
|
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
29453
29596
|
const prevAddress = address;
|
|
29454
29597
|
let userId = null;
|
|
@@ -29491,7 +29634,7 @@ init_bundler();
|
|
|
29491
29634
|
// src/index.ts
|
|
29492
29635
|
init_auth();
|
|
29493
29636
|
init_profile();
|
|
29494
|
-
|
|
29637
|
+
init_SecurityMenu2();
|
|
29495
29638
|
init_linkedProfiles();
|
|
29496
29639
|
init_nickname_fingerprint();
|
|
29497
29640
|
init_errors();
|
|
@@ -29828,6 +29971,7 @@ export {
|
|
|
29828
29971
|
PASSPORT_TRANSLATIONS,
|
|
29829
29972
|
PageKey,
|
|
29830
29973
|
Provider,
|
|
29974
|
+
SessionExpiredError,
|
|
29831
29975
|
TOKENS_ICONS,
|
|
29832
29976
|
ThemeToggle,
|
|
29833
29977
|
TransactionsList,
|
|
@@ -29854,6 +29998,7 @@ export {
|
|
|
29854
29998
|
getUserOperationReceipt,
|
|
29855
29999
|
getUserProfile,
|
|
29856
30000
|
getValidTokens,
|
|
30001
|
+
isSessionExpiredError,
|
|
29857
30002
|
jwtTokenManager2 as jwtTokenManager,
|
|
29858
30003
|
logout,
|
|
29859
30004
|
looksLikeNickname,
|