@embarkai/ui-kit 0.4.57 → 0.4.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +1012 -885
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +832 -706
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -841,31 +841,31 @@ var PageKey, useLayoutDataStore;
|
|
|
841
841
|
var init_useLayoutDataStore = __esm({
|
|
842
842
|
"src/internal/hooks/useLayoutDataStore.ts"() {
|
|
843
843
|
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
|
|
844
|
+
PageKey = /* @__PURE__ */ ((PageKey4) => {
|
|
845
|
+
PageKey4["AUTH"] = "auth";
|
|
846
|
+
PageKey4["LANGUAGES"] = "languages";
|
|
847
|
+
PageKey4["TERMS_OF_SERVICE"] = "terms-of-service";
|
|
848
|
+
PageKey4["MAIN_MENU"] = "main-menu";
|
|
849
|
+
PageKey4["SETTINGS"] = "settings";
|
|
850
|
+
PageKey4["SEND"] = "send";
|
|
851
|
+
PageKey4["RECEIVE"] = "receive";
|
|
852
|
+
PageKey4["BUY"] = "buy";
|
|
853
|
+
PageKey4["KYC"] = "kyc";
|
|
854
|
+
PageKey4["TRANSACTIONS"] = "transactions";
|
|
855
|
+
PageKey4["ASSETS"] = "assets";
|
|
856
|
+
PageKey4["MANAGE_WALLET"] = "manage-wallet";
|
|
857
|
+
PageKey4["UNLINK_PROVIDER"] = "unlink-provider";
|
|
858
|
+
PageKey4["SECURITY"] = "security";
|
|
859
|
+
PageKey4["KEYSARE_BACKUP"] = "keysare-backup";
|
|
860
|
+
PageKey4["KEYSHARE_RESTORE"] = "keyshare-restore";
|
|
861
|
+
PageKey4["CHAIN"] = "chain";
|
|
862
|
+
PageKey4["CHAIN_SWITCH_REQUEST"] = "chain-switch-request";
|
|
863
|
+
PageKey4["NICKNAME_SETTINGS"] = "nickname-settings";
|
|
864
|
+
PageKey4["DEVICES"] = "devices";
|
|
865
|
+
PageKey4["DEVICE_LINK"] = "device-link";
|
|
866
|
+
PageKey4["DEVICE_MANAGE"] = "device-manage";
|
|
867
|
+
PageKey4["DEVICE_RESTORE"] = "device-restore";
|
|
868
|
+
return PageKey4;
|
|
869
869
|
})(PageKey || {});
|
|
870
870
|
useLayoutDataStore = create((set) => ({
|
|
871
871
|
page: null,
|
|
@@ -2451,7 +2451,7 @@ function usePageParams() {
|
|
|
2451
2451
|
currentParams.current = pageParams;
|
|
2452
2452
|
setPageParams(null);
|
|
2453
2453
|
}, []);
|
|
2454
|
-
return currentParams
|
|
2454
|
+
return currentParams;
|
|
2455
2455
|
}
|
|
2456
2456
|
var init_useOpenPage = __esm({
|
|
2457
2457
|
"src/hooks/useOpenPage.ts"() {
|
|
@@ -5497,7 +5497,7 @@ var init_en = __esm({
|
|
|
5497
5497
|
selectToken: "Select Asset",
|
|
5498
5498
|
estimations: "Estimations",
|
|
5499
5499
|
estimatedFee: "Estimated Fee",
|
|
5500
|
-
availableChainPairs: "
|
|
5500
|
+
availableChainPairs: "Select Chain Pairs",
|
|
5501
5501
|
toChain: "To Chain",
|
|
5502
5502
|
fromChain: "From Chain",
|
|
5503
5503
|
optionalRecipient: "Recipient (optional, if empty - destination chain address = sender address on origin chain)",
|
|
@@ -5572,7 +5572,12 @@ var init_en = __esm({
|
|
|
5572
5572
|
exchangeRate: "Exchange Rate",
|
|
5573
5573
|
networkFee: "Network Fee",
|
|
5574
5574
|
serviceFee: "Service Fee",
|
|
5575
|
-
paymentMethod: "Payment Method"
|
|
5575
|
+
paymentMethod: "Payment Method",
|
|
5576
|
+
toAddress: {
|
|
5577
|
+
receiver: "ATTENTION! Receiving Address",
|
|
5578
|
+
message: "You are about to purchase crypto to an external address, not your embarkAI address.",
|
|
5579
|
+
suggestion: "Please make sure this is your correct wallet address, otherwise you may lose your funds."
|
|
5580
|
+
}
|
|
5576
5581
|
},
|
|
5577
5582
|
transactionHistory: {
|
|
5578
5583
|
details: "Details"
|
|
@@ -5590,7 +5595,8 @@ var init_en = __esm({
|
|
|
5590
5595
|
},
|
|
5591
5596
|
portfolioMenu: {
|
|
5592
5597
|
title: "Your Assets",
|
|
5593
|
-
noAssets: "No assets found"
|
|
5598
|
+
noAssets: "No assets found",
|
|
5599
|
+
noBlockscout: "No Blockscout API found for chain: {{chain}}"
|
|
5594
5600
|
},
|
|
5595
5601
|
transactionsMenu: {
|
|
5596
5602
|
title: "Transactions History",
|
|
@@ -8776,11 +8782,35 @@ var init_priceFormatter = __esm({
|
|
|
8776
8782
|
});
|
|
8777
8783
|
|
|
8778
8784
|
// src/internal/components/BuyMenu/useBuyMenuStore.ts
|
|
8785
|
+
import { keys, noop } from "lodash-es";
|
|
8786
|
+
import { useEffect as useEffect12 } from "react";
|
|
8779
8787
|
import { create as create4 } from "zustand";
|
|
8780
8788
|
import { persist } from "zustand/middleware";
|
|
8789
|
+
function useBuyMenuParams() {
|
|
8790
|
+
useEffect12(() => {
|
|
8791
|
+
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
8792
|
+
if (!pageParams || !keys(pageParams).length) return;
|
|
8793
|
+
const { amount, crypto: crypto2, toWalletAddress, confirmationMessage, onRampWidgetRedirected } = pageParams || {};
|
|
8794
|
+
switch (true) {
|
|
8795
|
+
case !!amount:
|
|
8796
|
+
useBuyMenuStore.getState().setSrcInputAmount(amount);
|
|
8797
|
+
useBuyMenuStore.getState().setSrcQueryAmount(amount);
|
|
8798
|
+
case !!crypto2:
|
|
8799
|
+
useBuyMenuStore.getState().setSelectedCrypto(crypto2);
|
|
8800
|
+
case !!toWalletAddress:
|
|
8801
|
+
useBuyMenuStore.getState().setToWalletAddress(toWalletAddress);
|
|
8802
|
+
case !!onRampWidgetRedirected:
|
|
8803
|
+
useBuyMenuStore.getState().setOnRampWidgetRedirectedFn(onRampWidgetRedirected);
|
|
8804
|
+
case !!confirmationMessage:
|
|
8805
|
+
useBuyMenuStore.getState().setConfirmationMessage(confirmationMessage);
|
|
8806
|
+
}
|
|
8807
|
+
setPageParams(null);
|
|
8808
|
+
}, []);
|
|
8809
|
+
}
|
|
8781
8810
|
var DEFAULT_MENU_SWITCHES, DEFAULT_PROVIDER, useBuyMenuStore;
|
|
8782
8811
|
var init_useBuyMenuStore = __esm({
|
|
8783
8812
|
"src/internal/components/BuyMenu/useBuyMenuStore.ts"() {
|
|
8813
|
+
init_useLayoutDataStore();
|
|
8784
8814
|
DEFAULT_MENU_SWITCHES = {
|
|
8785
8815
|
isTransactionHistory: false,
|
|
8786
8816
|
isProviderSelector: false,
|
|
@@ -8795,6 +8825,8 @@ var init_useBuyMenuStore = __esm({
|
|
|
8795
8825
|
(set) => ({
|
|
8796
8826
|
renderKey: "default-initial-buy-menu-render-key",
|
|
8797
8827
|
setRenderKey: (key) => set({ renderKey: key }),
|
|
8828
|
+
toWalletAddress: null,
|
|
8829
|
+
setToWalletAddress: (toWalletAddress) => set({ toWalletAddress }),
|
|
8798
8830
|
/** boolean flags */
|
|
8799
8831
|
isTransactionHistory: false,
|
|
8800
8832
|
setIsTransactionHistory: (isTransactionHistory) => {
|
|
@@ -8844,6 +8876,10 @@ var init_useBuyMenuStore = __esm({
|
|
|
8844
8876
|
srcQueryAmount: 0,
|
|
8845
8877
|
setSrcQueryAmount: (amount) => set({ srcQueryAmount: amount }),
|
|
8846
8878
|
/** */
|
|
8879
|
+
onRampWidgetRedirected: noop,
|
|
8880
|
+
setOnRampWidgetRedirectedFn: (cb) => set({ onRampWidgetRedirected: cb }),
|
|
8881
|
+
confirmationMessage: null,
|
|
8882
|
+
setConfirmationMessage: (message) => set({ confirmationMessage: message }),
|
|
8847
8883
|
error: null,
|
|
8848
8884
|
setError: (error) => set({ error })
|
|
8849
8885
|
}),
|
|
@@ -9424,6 +9460,61 @@ var init_api = __esm({
|
|
|
9424
9460
|
}
|
|
9425
9461
|
});
|
|
9426
9462
|
|
|
9463
|
+
// src/internal/utils/cn.ts
|
|
9464
|
+
import { clsx as clsx2 } from "clsx";
|
|
9465
|
+
function cn2(...inputs) {
|
|
9466
|
+
return twMerge(clsx2(inputs));
|
|
9467
|
+
}
|
|
9468
|
+
var init_cn = __esm({
|
|
9469
|
+
"src/internal/utils/cn.ts"() {
|
|
9470
|
+
init_bundle_mjs();
|
|
9471
|
+
}
|
|
9472
|
+
});
|
|
9473
|
+
|
|
9474
|
+
// src/internal/components/ui/badge.tsx
|
|
9475
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
9476
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
9477
|
+
function Badge(props) {
|
|
9478
|
+
const { className, variant = "secondary", size = "default", ...rest } = props;
|
|
9479
|
+
return /* @__PURE__ */ jsx36("span", { ...rest, className: cn2(badgeVariants({ variant, size }), className) });
|
|
9480
|
+
}
|
|
9481
|
+
var badgeVariants;
|
|
9482
|
+
var init_badge = __esm({
|
|
9483
|
+
"src/internal/components/ui/badge.tsx"() {
|
|
9484
|
+
init_cn();
|
|
9485
|
+
badgeVariants = cva2(
|
|
9486
|
+
cn2(
|
|
9487
|
+
//
|
|
9488
|
+
"inline-flex items-center",
|
|
9489
|
+
"border font-semibold",
|
|
9490
|
+
"select-none"
|
|
9491
|
+
),
|
|
9492
|
+
{
|
|
9493
|
+
variants: {
|
|
9494
|
+
variant: {
|
|
9495
|
+
outline: "border-[var(--ui-kit-bd)] bg-transparent text-[var(--ui-kit-fg)]",
|
|
9496
|
+
secondary: "border-[var(--ui-kit-secondary)] bg-[var(--ui-kit-secondary)] text-[var(--ui-kit-fg)]",
|
|
9497
|
+
destructive: "border-[var(--ui-kit-bg-error)] bg-[var(--ui-kit-bg-error)] text-[var(--ui-kit-error)]",
|
|
9498
|
+
success: "border-[var(--ui-kit-bg-success)] bg-[var(--ui-kit-bg-success)] text-[var(--ui-kit-success)]",
|
|
9499
|
+
warning: "border-[var(--ui-kit-bg-warning)] bg-[var(--ui-kit-bg-warning)] text-[var(--ui-kit-warning)]"
|
|
9500
|
+
},
|
|
9501
|
+
size: {
|
|
9502
|
+
default: "h-5 px-2 rounded-full text-[10px] gap-[var(--ui-kit-gap)]",
|
|
9503
|
+
medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] text-sm gap-[var(--ui-kit-gap)]",
|
|
9504
|
+
large: cn2(
|
|
9505
|
+
"whitespace-nowrap text-sm font-semibold font-sans",
|
|
9506
|
+
"h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]"
|
|
9507
|
+
)
|
|
9508
|
+
}
|
|
9509
|
+
},
|
|
9510
|
+
defaultVariants: {
|
|
9511
|
+
variant: "secondary"
|
|
9512
|
+
}
|
|
9513
|
+
}
|
|
9514
|
+
);
|
|
9515
|
+
}
|
|
9516
|
+
});
|
|
9517
|
+
|
|
9427
9518
|
// src/internal/components/BuyMenu/binance/config.ts
|
|
9428
9519
|
import { BSC_MAINNET_CHAIN_ID, LUMIA_MAINNET_CHAIN_ID } from "@embarkai/core/read";
|
|
9429
9520
|
var CHAIN_ID_TO_BINANCE_NETWORK_TICKER;
|
|
@@ -9439,26 +9530,35 @@ var init_config = __esm({
|
|
|
9439
9530
|
// src/internal/components/BuyMenu/binance/BinanceSummary.tsx
|
|
9440
9531
|
import { useMutation as useMutation5, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
9441
9532
|
import { InfoIcon as InfoIcon3, LoaderIcon } from "lucide-react";
|
|
9442
|
-
import { jsx as
|
|
9533
|
+
import { jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
9443
9534
|
function BinanceSummary(props) {
|
|
9444
9535
|
const { payment } = props;
|
|
9445
9536
|
const qc = useQueryClient3();
|
|
9446
9537
|
const { t } = useT();
|
|
9447
|
-
const
|
|
9538
|
+
const embarkaiAddress = useSession((st) => st.address);
|
|
9448
9539
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
9449
|
-
const {
|
|
9540
|
+
const {
|
|
9541
|
+
toWalletAddress,
|
|
9542
|
+
selectedFiat,
|
|
9543
|
+
selectedCrypto,
|
|
9544
|
+
srcQueryAmount,
|
|
9545
|
+
redirecting,
|
|
9546
|
+
confirmationMessage,
|
|
9547
|
+
setRedirecting
|
|
9548
|
+
} = useBuyMenuStore();
|
|
9450
9549
|
const quoteData = useBinanceStore((st) => st.quoteData);
|
|
9451
9550
|
const cryptoToRecieve = Number(quoteData?.totalAmount || "0");
|
|
9452
9551
|
const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = useMutation5({
|
|
9453
9552
|
mutationFn: async () => {
|
|
9454
9553
|
setRedirecting(true);
|
|
9455
9554
|
return await createPreorderMutation({
|
|
9555
|
+
address: toWalletAddress || embarkaiAddress,
|
|
9456
9556
|
amountType: 1,
|
|
9457
9557
|
requestedAmount: String(srcQueryAmount),
|
|
9458
|
-
address: walletAddress,
|
|
9459
9558
|
fiatCurrency: selectedFiat,
|
|
9460
9559
|
cryptoCurrency: selectedCrypto,
|
|
9461
9560
|
network: CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainConfig.id],
|
|
9561
|
+
//
|
|
9462
9562
|
payMethodCode: payment?.payMethodCode || void 0,
|
|
9463
9563
|
payMethodSubCode: payment?.payMethodSubCode || void 0,
|
|
9464
9564
|
// TODO: pass quote response to backend to create order with exact quote details (amount, fees, etc.)
|
|
@@ -9477,8 +9577,10 @@ function BinanceSummary(props) {
|
|
|
9477
9577
|
setRedirecting(false);
|
|
9478
9578
|
qc.invalidateQueries({ queryKey: [QUERY_KEYS2.binanceTransactions] });
|
|
9479
9579
|
window.open(link, "_blank", "noopener,noreferrer");
|
|
9480
|
-
useBuyMenuStore.getState()
|
|
9481
|
-
|
|
9580
|
+
const { setError, setIsTransactionHistory, onRampWidgetRedirected } = useBuyMenuStore.getState();
|
|
9581
|
+
onRampWidgetRedirected(quoteData);
|
|
9582
|
+
setError(null);
|
|
9583
|
+
setIsTransactionHistory(true);
|
|
9482
9584
|
}, REDIRECT_TIMEOUT_MS);
|
|
9483
9585
|
}
|
|
9484
9586
|
},
|
|
@@ -9490,14 +9592,14 @@ function BinanceSummary(props) {
|
|
|
9490
9592
|
});
|
|
9491
9593
|
const isContinueDisabled = !!redirecting || !!isFundWalletOrderCheckouting || !quoteData;
|
|
9492
9594
|
if (!quoteData) {
|
|
9493
|
-
return /* @__PURE__ */
|
|
9494
|
-
/* @__PURE__ */
|
|
9495
|
-
/* @__PURE__ */
|
|
9595
|
+
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: [
|
|
9596
|
+
/* @__PURE__ */ jsx37(InfoIcon3, { className: "w-4 h-4" }),
|
|
9597
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:common.errors.oops") })
|
|
9496
9598
|
] }) });
|
|
9497
9599
|
}
|
|
9498
9600
|
return /* @__PURE__ */ jsxs31("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
9499
9601
|
/* @__PURE__ */ jsxs31("div", { className: "flex justify-between text-xs leading-5", children: [
|
|
9500
|
-
/* @__PURE__ */
|
|
9602
|
+
/* @__PURE__ */ jsx37("span", { className: "", children: t("passport:common.amount") }),
|
|
9501
9603
|
/* @__PURE__ */ jsxs31("span", { className: "font-bold", children: [
|
|
9502
9604
|
formatPrice(srcQueryAmount),
|
|
9503
9605
|
" ",
|
|
@@ -9505,7 +9607,7 @@ function BinanceSummary(props) {
|
|
|
9505
9607
|
] })
|
|
9506
9608
|
] }),
|
|
9507
9609
|
/* @__PURE__ */ jsxs31("div", { className: "flex justify-between text-xs leading-5", children: [
|
|
9508
|
-
/* @__PURE__ */
|
|
9610
|
+
/* @__PURE__ */ jsx37("span", { className: "", children: t("passport:buyMenu.summary.youReceive") }),
|
|
9509
9611
|
/* @__PURE__ */ jsxs31("span", { className: "font-bold", children: [
|
|
9510
9612
|
formatPrice(cryptoToRecieve),
|
|
9511
9613
|
" ",
|
|
@@ -9514,7 +9616,7 @@ function BinanceSummary(props) {
|
|
|
9514
9616
|
] }),
|
|
9515
9617
|
/* @__PURE__ */ jsxs31(Highlight, { type: "info", className: "", children: [
|
|
9516
9618
|
/* @__PURE__ */ jsxs31("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9517
|
-
/* @__PURE__ */
|
|
9619
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.networkFee") }),
|
|
9518
9620
|
/* @__PURE__ */ jsxs31("strong", { children: [
|
|
9519
9621
|
formatPrice(Number(quoteData?.networkFee || "0")),
|
|
9520
9622
|
" ",
|
|
@@ -9522,7 +9624,7 @@ function BinanceSummary(props) {
|
|
|
9522
9624
|
] })
|
|
9523
9625
|
] }),
|
|
9524
9626
|
/* @__PURE__ */ jsxs31("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9525
|
-
/* @__PURE__ */
|
|
9627
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.serviceFee") }),
|
|
9526
9628
|
/* @__PURE__ */ jsxs31("strong", { children: [
|
|
9527
9629
|
formatPrice(Number(quoteData?.feeAmount || "0")),
|
|
9528
9630
|
" ",
|
|
@@ -9530,8 +9632,16 @@ function BinanceSummary(props) {
|
|
|
9530
9632
|
] })
|
|
9531
9633
|
] }),
|
|
9532
9634
|
/* @__PURE__ */ jsxs31("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
|
|
9533
|
-
/* @__PURE__ */
|
|
9534
|
-
/* @__PURE__ */
|
|
9635
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.selectPaymentMode") }),
|
|
9636
|
+
/* @__PURE__ */ jsx37("strong", { children: payment?.paymentMethod?.toUpperCase() })
|
|
9637
|
+
] })
|
|
9638
|
+
] }),
|
|
9639
|
+
toWalletAddress && /* @__PURE__ */ jsxs31(Highlight, { type: "warning", children: [
|
|
9640
|
+
/* @__PURE__ */ jsx37("p", { className: "font-bold leading-6", children: t("passport:buyMenu.summary.toAddress.receiver") }),
|
|
9641
|
+
/* @__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 }) }),
|
|
9642
|
+
!!confirmationMessage ? /* @__PURE__ */ jsx37("p", { className: "leading-5", children: confirmationMessage }) : /* @__PURE__ */ jsxs31("p", { className: "leading-4", children: [
|
|
9643
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.toAddress.message") }),
|
|
9644
|
+
/* @__PURE__ */ jsx37("span", { children: t("passport:buyMenu.summary.toAddress.suggestion") })
|
|
9535
9645
|
] })
|
|
9536
9646
|
] }),
|
|
9537
9647
|
/* @__PURE__ */ jsxs31(
|
|
@@ -9543,8 +9653,8 @@ function BinanceSummary(props) {
|
|
|
9543
9653
|
variant: "default",
|
|
9544
9654
|
onClick: () => checkoutFundWalletOrder(),
|
|
9545
9655
|
children: [
|
|
9546
|
-
redirecting && /* @__PURE__ */
|
|
9547
|
-
/* @__PURE__ */
|
|
9656
|
+
redirecting && /* @__PURE__ */ jsx37(LoaderIcon, { size: 16, className: "animate-spin" }),
|
|
9657
|
+
/* @__PURE__ */ jsx37("span", { children: redirecting ? "REDIRECTING..." : String(t("passport:buyMenu.actions.confirmPurchase")).toUpperCase() }),
|
|
9548
9658
|
!!quoteData?.totalAmount && /* @__PURE__ */ jsxs31("strong", { children: [
|
|
9549
9659
|
formatPrice(Number(quoteData.totalAmount)),
|
|
9550
9660
|
" ",
|
|
@@ -9561,6 +9671,7 @@ var init_BinanceSummary = __esm({
|
|
|
9561
9671
|
init_SessionContext();
|
|
9562
9672
|
init_i18n();
|
|
9563
9673
|
init_priceFormatter();
|
|
9674
|
+
init_badge();
|
|
9564
9675
|
init_button();
|
|
9565
9676
|
init_highlight();
|
|
9566
9677
|
init_contants();
|
|
@@ -9572,61 +9683,6 @@ var init_BinanceSummary = __esm({
|
|
|
9572
9683
|
}
|
|
9573
9684
|
});
|
|
9574
9685
|
|
|
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
9686
|
// src/internal/components/BuyMenu/binance/statuses.ts
|
|
9631
9687
|
import { values } from "lodash-es";
|
|
9632
9688
|
var STATUS_CODE_TO_MESSAGE, STATUSES_FILTERS;
|
|
@@ -9747,7 +9803,7 @@ import { useInfiniteQuery } from "@tanstack/react-query";
|
|
|
9747
9803
|
import dayjs from "dayjs";
|
|
9748
9804
|
import { debounce as debounce4 } from "lodash-es";
|
|
9749
9805
|
import { DownloadIcon, ExternalLinkIcon, LoaderIcon as LoaderIcon2 } from "lucide-react";
|
|
9750
|
-
import { useCallback as useCallback12, useEffect as
|
|
9806
|
+
import { useCallback as useCallback12, useEffect as useEffect13, useMemo as useMemo4 } from "react";
|
|
9751
9807
|
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
9752
9808
|
function getStatusVariant(status) {
|
|
9753
9809
|
switch (status) {
|
|
@@ -9888,7 +9944,7 @@ function BinanceTxHistory() {
|
|
|
9888
9944
|
}, 200),
|
|
9889
9945
|
[]
|
|
9890
9946
|
);
|
|
9891
|
-
|
|
9947
|
+
useEffect13(() => {
|
|
9892
9948
|
if (isTxDataLoading || !txList?.length || txList.length > 10) return;
|
|
9893
9949
|
updateExpandable();
|
|
9894
9950
|
}, [isTxDataLoading, txList]);
|
|
@@ -9935,11 +9991,11 @@ var init_BinanceTxHistory = __esm({
|
|
|
9935
9991
|
|
|
9936
9992
|
// src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts
|
|
9937
9993
|
import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
9938
|
-
import { useEffect as
|
|
9994
|
+
import { useEffect as useEffect14, useRef as useRef10 } from "react";
|
|
9939
9995
|
function useBinanceSseTxTracing(walletAddress) {
|
|
9940
9996
|
const qc = useQueryClient4();
|
|
9941
|
-
const debounceRef =
|
|
9942
|
-
|
|
9997
|
+
const debounceRef = useRef10(null);
|
|
9998
|
+
useEffect14(() => {
|
|
9943
9999
|
if (!walletAddress) return;
|
|
9944
10000
|
const iframeManager = getIframeManager();
|
|
9945
10001
|
if (!iframeManager) return;
|
|
@@ -9981,7 +10037,7 @@ var init_utils6 = __esm({
|
|
|
9981
10037
|
// src/internal/components/BuyMenu/binance/Binance.tsx
|
|
9982
10038
|
import { useMutation as useMutation6, useQuery as useQuery2, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
9983
10039
|
import { LoaderIcon as LoaderIcon3 } from "lucide-react";
|
|
9984
|
-
import { useEffect as
|
|
10040
|
+
import { useEffect as useEffect15 } from "react";
|
|
9985
10041
|
import { Fragment as Fragment11, jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9986
10042
|
function Binance() {
|
|
9987
10043
|
const qc = useQueryClient5();
|
|
@@ -10003,7 +10059,7 @@ function Binance() {
|
|
|
10003
10059
|
} = useBuyMenuStore();
|
|
10004
10060
|
const paymentMode = useBinanceStore((st) => st.paymentMode);
|
|
10005
10061
|
const isCurrurenciesSelected = !!selectedCrypto && !!selectedFiat;
|
|
10006
|
-
|
|
10062
|
+
useEffect15(() => {
|
|
10007
10063
|
if (!isCurrurenciesSelected) return;
|
|
10008
10064
|
useBuyMenuStore.getState().setRenderKey(`${selectedCrypto}-${selectedFiat}-${Date.now()}`);
|
|
10009
10065
|
}, [isCurrurenciesSelected]);
|
|
@@ -10038,7 +10094,7 @@ function Binance() {
|
|
|
10038
10094
|
});
|
|
10039
10095
|
const paymentModes = paymentModesData?.data?.paymentMethods || [];
|
|
10040
10096
|
const selectedPaymentMode = paymentModes?.find((el) => getPayMethodID(el) === paymentMode) || null;
|
|
10041
|
-
|
|
10097
|
+
useEffect15(() => {
|
|
10042
10098
|
useBuyMenuStore.getState().setMinAmount(Number(selectedPaymentMode?.fiatMinLimit || "0"));
|
|
10043
10099
|
}, [selectedPaymentMode]);
|
|
10044
10100
|
const { mutate: estimateQuote, isPending: isQuoteEstimating } = useMutation6({
|
|
@@ -10066,21 +10122,22 @@ function Binance() {
|
|
|
10066
10122
|
}
|
|
10067
10123
|
});
|
|
10068
10124
|
const availableFiats = (tradingPairsData?.data?.fiatCurrencies || []).map((ticker) => ({ ticker }));
|
|
10069
|
-
|
|
10125
|
+
useEffect15(() => {
|
|
10070
10126
|
if (!!selectedFiat || !availableFiats?.length) return;
|
|
10071
|
-
const targetFiat = availableFiats.find((item) =>
|
|
10127
|
+
const targetFiat = availableFiats.find((item) => PREFERRED_FIATS.includes(item.ticker)) || availableFiats[0];
|
|
10072
10128
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10073
10129
|
}, [availableFiats, selectedFiat]);
|
|
10074
|
-
|
|
10130
|
+
useEffect15(() => {
|
|
10075
10131
|
if (!!selectedCrypto || !networkAvailableCryptoList?.length) return;
|
|
10076
|
-
|
|
10132
|
+
const targetCrypto = networkAvailableCryptoList.find((item) => PREFERRED_CRYPTOS.includes(item.cryptoCurrency)) || networkAvailableCryptoList[0];
|
|
10133
|
+
useBuyMenuStore.getState().setSelectedCrypto(targetCrypto.cryptoCurrency);
|
|
10077
10134
|
}, [networkAvailableCryptoList, selectedCrypto]);
|
|
10078
|
-
|
|
10135
|
+
useEffect15(() => {
|
|
10079
10136
|
if (!!paymentMode || !paymentModes.length) return;
|
|
10080
10137
|
const targetPaymentMode = paymentModes.find((item) => item.payMethodCode === PREFERRED_PAYMENT_METHOD) || paymentModes[0];
|
|
10081
10138
|
useBinanceStore.getState().setPaymentMode(getPayMethodID(targetPaymentMode));
|
|
10082
10139
|
}, [paymentModes]);
|
|
10083
|
-
|
|
10140
|
+
useEffect15(() => {
|
|
10084
10141
|
return () => {
|
|
10085
10142
|
useBinanceStore.getState().setPaymentMode(null);
|
|
10086
10143
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binanceTradingPairs] });
|
|
@@ -10202,7 +10259,7 @@ function Binance() {
|
|
|
10202
10259
|
)
|
|
10203
10260
|
] });
|
|
10204
10261
|
}
|
|
10205
|
-
var PREFERRED_PAYMENT_METHOD;
|
|
10262
|
+
var PREFERRED_PAYMENT_METHOD, PREFERRED_FIATS, PREFERRED_CRYPTOS;
|
|
10206
10263
|
var init_Binance = __esm({
|
|
10207
10264
|
"src/internal/components/BuyMenu/binance/Binance.tsx"() {
|
|
10208
10265
|
init_utils2();
|
|
@@ -10223,6 +10280,8 @@ var init_Binance = __esm({
|
|
|
10223
10280
|
init_useBinanceStore();
|
|
10224
10281
|
init_utils6();
|
|
10225
10282
|
PREFERRED_PAYMENT_METHOD = "BUY_CARD";
|
|
10283
|
+
PREFERRED_FIATS = ["USD", "EUR"];
|
|
10284
|
+
PREFERRED_CRYPTOS = ["USDT", "LUMIA"];
|
|
10226
10285
|
}
|
|
10227
10286
|
});
|
|
10228
10287
|
|
|
@@ -10589,11 +10648,11 @@ var init_networks = __esm({
|
|
|
10589
10648
|
|
|
10590
10649
|
// src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts
|
|
10591
10650
|
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
10592
|
-
import { useEffect as
|
|
10651
|
+
import { useEffect as useEffect16, useRef as useRef11 } from "react";
|
|
10593
10652
|
function useFinchpaySseTxTracing(walletAddress) {
|
|
10594
10653
|
const qc = useQueryClient6();
|
|
10595
|
-
const debounceRef =
|
|
10596
|
-
|
|
10654
|
+
const debounceRef = useRef11(null);
|
|
10655
|
+
useEffect16(() => {
|
|
10597
10656
|
if (!walletAddress) return;
|
|
10598
10657
|
const iframeManager = getIframeManager();
|
|
10599
10658
|
if (!iframeManager) return;
|
|
@@ -10642,7 +10701,7 @@ var init_utils7 = __esm({
|
|
|
10642
10701
|
// src/internal/components/BuyMenu/finchpay/FinchPay.tsx
|
|
10643
10702
|
import { useQuery as useQuery3, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
10644
10703
|
import { DollarSign, LoaderIcon as LoaderIcon5 } from "lucide-react";
|
|
10645
|
-
import { useEffect as
|
|
10704
|
+
import { useEffect as useEffect17 } from "react";
|
|
10646
10705
|
import { Fragment as Fragment12, jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10647
10706
|
function FinchPay() {
|
|
10648
10707
|
const qc = useQueryClient7();
|
|
@@ -10718,11 +10777,11 @@ function FinchPay() {
|
|
|
10718
10777
|
})
|
|
10719
10778
|
});
|
|
10720
10779
|
const minimum = Number(limitsData?.min_amount || "0");
|
|
10721
|
-
|
|
10780
|
+
useEffect17(() => {
|
|
10722
10781
|
if (minimum <= 0) return;
|
|
10723
10782
|
useBuyMenuStore.getState().setMinAmount(minimum);
|
|
10724
10783
|
}, [minimum]);
|
|
10725
|
-
|
|
10784
|
+
useEffect17(() => {
|
|
10726
10785
|
if (srcInputAmount >= minimum) return;
|
|
10727
10786
|
useBuyMenuStore.getState().setRenderKey(`finchpay-input-minimum-warning-${Date.now()}`);
|
|
10728
10787
|
}, [minimum, srcInputAmount]);
|
|
@@ -10750,23 +10809,23 @@ function FinchPay() {
|
|
|
10750
10809
|
// defaults to CARD estimation, widgetUrl
|
|
10751
10810
|
})
|
|
10752
10811
|
});
|
|
10753
|
-
|
|
10812
|
+
useEffect17(() => {
|
|
10754
10813
|
const { error: errorTitle, message: errorMessage } = handleErrors([currenciesError, limitsError, estimateError]);
|
|
10755
10814
|
if (!errorTitle && !errorMessage) return;
|
|
10756
10815
|
console.error(`[BuyModal][Binance] ${errorTitle}: ${errorMessage}`);
|
|
10757
10816
|
useBuyMenuStore.getState().setError(errorMessage);
|
|
10758
10817
|
}, [currenciesError, limitsError, estimateError]);
|
|
10759
|
-
|
|
10818
|
+
useEffect17(() => {
|
|
10760
10819
|
if (!!selectedFiat || currenciesData.fiats.length === 0) return;
|
|
10761
10820
|
const fallbackFiat = currenciesData.fiats[0];
|
|
10762
10821
|
const targetFiat = currenciesData.fiats.find((f) => f.ticker.toUpperCase() === "USD") || fallbackFiat;
|
|
10763
10822
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
10764
10823
|
}, [currenciesData, selectedFiat]);
|
|
10765
|
-
|
|
10824
|
+
useEffect17(() => {
|
|
10766
10825
|
if (!!selectedCrypto || currenciesData.currentNetworkCoins.length === 0) return;
|
|
10767
10826
|
useBuyMenuStore.getState().setSelectedCrypto(currenciesData.currentNetworkCoins[0].ticker);
|
|
10768
10827
|
}, [currenciesData, selectedCrypto]);
|
|
10769
|
-
|
|
10828
|
+
useEffect17(() => {
|
|
10770
10829
|
return () => {
|
|
10771
10830
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayCurrencies] });
|
|
10772
10831
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayLimits] });
|
|
@@ -11019,62 +11078,44 @@ var init_ProviderSelector = __esm({
|
|
|
11019
11078
|
}
|
|
11020
11079
|
});
|
|
11021
11080
|
|
|
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
11081
|
// src/internal/components/BuyMenu/useHandleInputAmount.ts
|
|
11036
|
-
import {
|
|
11082
|
+
import { useEffect as useEffect18, useRef as useRef12 } from "react";
|
|
11037
11083
|
var ON_INPUT_QUERY_DELAY, useHandleInputAmount;
|
|
11038
11084
|
var init_useHandleInputAmount = __esm({
|
|
11039
11085
|
"src/internal/components/BuyMenu/useHandleInputAmount.ts"() {
|
|
11040
|
-
init_debounce();
|
|
11041
11086
|
init_contants();
|
|
11042
11087
|
init_useBuyMenuStore();
|
|
11043
11088
|
ON_INPUT_QUERY_DELAY = 1500;
|
|
11044
11089
|
useHandleInputAmount = () => {
|
|
11045
|
-
const lastRampProviderRef =
|
|
11090
|
+
const lastRampProviderRef = useRef12(DEFAULT_PROVIDER2);
|
|
11046
11091
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
11047
11092
|
const srcInputAmount = useBuyMenuStore((st) => st.srcInputAmount);
|
|
11048
11093
|
const minAmount = useBuyMenuStore((st) => st.minAmount);
|
|
11049
|
-
const
|
|
11050
|
-
|
|
11051
|
-
|
|
11094
|
+
const queryAmountTimer = useRef12(null);
|
|
11095
|
+
useEffect18(() => {
|
|
11096
|
+
if (queryAmountTimer.current) clearTimeout(queryAmountTimer.current);
|
|
11097
|
+
queryAmountTimer.current = setTimeout(() => {
|
|
11098
|
+
const checkedValue = Math.ceil(Math.max(Number(srcInputAmount), Number(minAmount)));
|
|
11052
11099
|
useBuyMenuStore.getState().setSrcInputAmount(checkedValue);
|
|
11053
11100
|
useBuyMenuStore.getState().setSrcQueryAmount(checkedValue);
|
|
11054
|
-
}, ON_INPUT_QUERY_DELAY)
|
|
11055
|
-
|
|
11056
|
-
)
|
|
11057
|
-
useEffect17(() => setQueryAmountDebounced(srcInputAmount), [srcInputAmount, setQueryAmountDebounced]);
|
|
11058
|
-
useEffect17(() => {
|
|
11101
|
+
}, ON_INPUT_QUERY_DELAY);
|
|
11102
|
+
}, [minAmount, srcInputAmount]);
|
|
11103
|
+
useEffect18(() => {
|
|
11059
11104
|
if (lastRampProviderRef.current === rampProvider) return;
|
|
11060
11105
|
const {
|
|
11061
11106
|
setIsProviderSummary,
|
|
11062
11107
|
setIsCryptoSelector,
|
|
11063
11108
|
setIsFiatSelector,
|
|
11064
|
-
setIsPaymentModeSelector
|
|
11065
|
-
setSelectedCrypto,
|
|
11066
|
-
setSelectedFiat
|
|
11067
|
-
setSrcInputAmount,
|
|
11068
|
-
setSrcQueryAmount
|
|
11109
|
+
setIsPaymentModeSelector
|
|
11110
|
+
// setSelectedCrypto,
|
|
11111
|
+
// setSelectedFiat
|
|
11112
|
+
// setSrcInputAmount,
|
|
11113
|
+
// setSrcQueryAmount
|
|
11069
11114
|
} = useBuyMenuStore.getState();
|
|
11070
11115
|
setIsProviderSummary(false);
|
|
11071
11116
|
setIsCryptoSelector(false);
|
|
11072
11117
|
setIsFiatSelector(false);
|
|
11073
11118
|
setIsPaymentModeSelector(false);
|
|
11074
|
-
setSelectedCrypto(null);
|
|
11075
|
-
setSelectedFiat(null);
|
|
11076
|
-
setSrcInputAmount(0);
|
|
11077
|
-
setSrcQueryAmount(0);
|
|
11078
11119
|
lastRampProviderRef.current = rampProvider;
|
|
11079
11120
|
}, [rampProvider]);
|
|
11080
11121
|
};
|
|
@@ -11087,8 +11128,8 @@ import { Fragment as Fragment14, jsx as jsx44, jsxs as jsxs38 } from "react/jsx-
|
|
|
11087
11128
|
function BuyMenu() {
|
|
11088
11129
|
const { t } = useT();
|
|
11089
11130
|
const walletAddress = useSession((st) => st.address);
|
|
11090
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11091
11131
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11132
|
+
useBuyMenuParams();
|
|
11092
11133
|
useHandleInputAmount();
|
|
11093
11134
|
const renderKey = useBuyMenuStore((st) => st.renderKey);
|
|
11094
11135
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
@@ -11154,7 +11195,7 @@ function BuyMenu() {
|
|
|
11154
11195
|
setIsPaymentModeSelector(false);
|
|
11155
11196
|
return;
|
|
11156
11197
|
}
|
|
11157
|
-
setPage("main-menu" /* MAIN_MENU */);
|
|
11198
|
+
useLayoutDataStore.getState().setPage("main-menu" /* MAIN_MENU */);
|
|
11158
11199
|
},
|
|
11159
11200
|
children: /* @__PURE__ */ jsx44(ArrowLeft3, { className: "h-4 w-4" })
|
|
11160
11201
|
}
|
|
@@ -11432,7 +11473,7 @@ var init_truncateMiddle = __esm({
|
|
|
11432
11473
|
// src/internal/components/ChainsMenu/ChainItem.tsx
|
|
11433
11474
|
import { getChainConfig as getChainConfig7 } from "@embarkai/core/read";
|
|
11434
11475
|
import { Copy, ExternalLink, Loader as Loader6 } from "lucide-react";
|
|
11435
|
-
import { useRef as
|
|
11476
|
+
import { useRef as useRef13, useState as useState9 } from "react";
|
|
11436
11477
|
import { jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
11437
11478
|
function getPaymasterExplorerUrl(chainId, paymasterAddress) {
|
|
11438
11479
|
const chainConfig = getChainConfig7(chainId);
|
|
@@ -11455,7 +11496,7 @@ function ChainItem(props) {
|
|
|
11455
11496
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
11456
11497
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
11457
11498
|
const [copiedChainId, setCopiedChainId] = useState9(null);
|
|
11458
|
-
const copiedResetTimerRef =
|
|
11499
|
+
const copiedResetTimerRef = useRef13(null);
|
|
11459
11500
|
const isActiveChain = activeChainId === chainId;
|
|
11460
11501
|
const paymasterAddress = isActiveChain ? activePaymasterData?.address : null;
|
|
11461
11502
|
const paymasterExplorerUrl = paymasterAddress ? getPaymasterExplorerUrl(chainId, paymasterAddress) : null;
|
|
@@ -12427,7 +12468,7 @@ var init_guardian_backup = __esm({
|
|
|
12427
12468
|
});
|
|
12428
12469
|
|
|
12429
12470
|
// src/internal/components/DevicesMenu/DeviceManageScreen.tsx
|
|
12430
|
-
import { useCallback as
|
|
12471
|
+
import { useCallback as useCallback14, useEffect as useEffect19, useRef as useRef14, useState as useState12 } from "react";
|
|
12431
12472
|
import { ArrowLeft as ArrowLeft7, Cpu, Download, HardDrive, Loader2 as Loader23, Trash2, Upload } from "lucide-react";
|
|
12432
12473
|
import { Fragment as Fragment15, jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
12433
12474
|
function formatSize(bytes) {
|
|
@@ -12442,19 +12483,19 @@ function DeviceManageScreen() {
|
|
|
12442
12483
|
const userId = session?.mpcUserId || "";
|
|
12443
12484
|
const deviceId = pageParams?.deviceId;
|
|
12444
12485
|
const deviceName = pageParams?.deviceName;
|
|
12445
|
-
const guardianRef =
|
|
12486
|
+
const guardianRef = useRef14(null);
|
|
12446
12487
|
const [screen, setScreen] = useState12({ step: "connecting" });
|
|
12447
12488
|
const [actionState, setActionState] = useState12(null);
|
|
12448
12489
|
const [password, setPassword] = useState12("");
|
|
12449
12490
|
const [statusMessage, setStatusMessage] = useState12(null);
|
|
12450
12491
|
const [errorMessage, setErrorMessage] = useState12(null);
|
|
12451
12492
|
const [waitingConfirm, setWaitingConfirm] = useState12(false);
|
|
12452
|
-
|
|
12493
|
+
useEffect19(() => {
|
|
12453
12494
|
if (!statusMessage) return;
|
|
12454
12495
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
12455
12496
|
return () => clearTimeout(t);
|
|
12456
12497
|
}, [statusMessage]);
|
|
12457
|
-
|
|
12498
|
+
useEffect19(() => {
|
|
12458
12499
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
12459
12500
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
12460
12501
|
return;
|
|
@@ -12486,7 +12527,7 @@ function DeviceManageScreen() {
|
|
|
12486
12527
|
guardianRef.current?.close();
|
|
12487
12528
|
};
|
|
12488
12529
|
}, [deviceId]);
|
|
12489
|
-
const refreshList =
|
|
12530
|
+
const refreshList = useCallback14(async () => {
|
|
12490
12531
|
const guardian = guardianRef.current;
|
|
12491
12532
|
if (!guardian || screen.step !== "connected") return;
|
|
12492
12533
|
try {
|
|
@@ -12495,7 +12536,7 @@ function DeviceManageScreen() {
|
|
|
12495
12536
|
} catch {
|
|
12496
12537
|
}
|
|
12497
12538
|
}, [screen]);
|
|
12498
|
-
const handleBackup =
|
|
12539
|
+
const handleBackup = useCallback14(async () => {
|
|
12499
12540
|
const guardian = guardianRef.current;
|
|
12500
12541
|
const iframe4 = getIframeManager();
|
|
12501
12542
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12519,7 +12560,7 @@ function DeviceManageScreen() {
|
|
|
12519
12560
|
setActionState(null);
|
|
12520
12561
|
}
|
|
12521
12562
|
}, [password, userId, refreshList]);
|
|
12522
|
-
const handleOverwrite =
|
|
12563
|
+
const handleOverwrite = useCallback14(async () => {
|
|
12523
12564
|
const guardian = guardianRef.current;
|
|
12524
12565
|
const iframe4 = getIframeManager();
|
|
12525
12566
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12539,7 +12580,7 @@ function DeviceManageScreen() {
|
|
|
12539
12580
|
setActionState(null);
|
|
12540
12581
|
}
|
|
12541
12582
|
}, [password, userId, refreshList]);
|
|
12542
|
-
const handleDelete =
|
|
12583
|
+
const handleDelete = useCallback14(async (keyshareId) => {
|
|
12543
12584
|
const guardian = guardianRef.current;
|
|
12544
12585
|
if (!guardian) return;
|
|
12545
12586
|
setActionState({ action: "delete", keyshareId, substep: "confirm-device" });
|
|
@@ -12719,7 +12760,7 @@ var init_DeviceManageScreen = __esm({
|
|
|
12719
12760
|
});
|
|
12720
12761
|
|
|
12721
12762
|
// src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx
|
|
12722
|
-
import { useCallback as
|
|
12763
|
+
import { useCallback as useCallback15, useState as useState13 } from "react";
|
|
12723
12764
|
import { AlertTriangle as AlertTriangle3, ArrowLeft as ArrowLeft8, Download as Download2, Loader2 as Loader24 } from "lucide-react";
|
|
12724
12765
|
import { Fragment as Fragment16, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
12725
12766
|
function DeviceRestoreScreen() {
|
|
@@ -12735,7 +12776,7 @@ function DeviceRestoreScreen() {
|
|
|
12735
12776
|
const [isWorking, setIsWorking] = useState13(false);
|
|
12736
12777
|
const [statusMessage, setStatusMessage] = useState13(null);
|
|
12737
12778
|
const [errorMessage, setErrorMessage] = useState13(null);
|
|
12738
|
-
const handleRestore =
|
|
12779
|
+
const handleRestore = useCallback15(async () => {
|
|
12739
12780
|
if (!password || !keyshareId || !userId) return;
|
|
12740
12781
|
const iframe4 = getIframeManager();
|
|
12741
12782
|
if (!iframe4) {
|
|
@@ -13039,7 +13080,7 @@ var init_useRestoreStore = __esm({
|
|
|
13039
13080
|
});
|
|
13040
13081
|
|
|
13041
13082
|
// src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts
|
|
13042
|
-
import { useCallback as
|
|
13083
|
+
import { useCallback as useCallback16 } from "react";
|
|
13043
13084
|
function useOnRestoreSuccess() {
|
|
13044
13085
|
const { config, callbacksRef } = useProviderConfig();
|
|
13045
13086
|
const setIsDialogForced = useLayoutStore((st) => st.setIsDialogForced);
|
|
@@ -13055,7 +13096,7 @@ function useOnRestoreSuccess() {
|
|
|
13055
13096
|
setStatus
|
|
13056
13097
|
} = useSession();
|
|
13057
13098
|
const { setError, setSuccess } = useRestoreStore();
|
|
13058
|
-
const createSessionWithKeyshare =
|
|
13099
|
+
const createSessionWithKeyshare = useCallback16(
|
|
13059
13100
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
13060
13101
|
try {
|
|
13061
13102
|
try {
|
|
@@ -13096,7 +13137,7 @@ function useOnRestoreSuccess() {
|
|
|
13096
13137
|
},
|
|
13097
13138
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
13098
13139
|
);
|
|
13099
|
-
const onRestoreSuccess =
|
|
13140
|
+
const onRestoreSuccess = useCallback16(async () => {
|
|
13100
13141
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
13101
13142
|
const verify = await verifyToken2();
|
|
13102
13143
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -13582,7 +13623,7 @@ var init_cloudStorage = __esm({
|
|
|
13582
13623
|
|
|
13583
13624
|
// src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts
|
|
13584
13625
|
import { useMutation as useMutation9, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
13585
|
-
import { useCallback as
|
|
13626
|
+
import { useCallback as useCallback17, useEffect as useEffect20 } from "react";
|
|
13586
13627
|
function useCreateBackup() {
|
|
13587
13628
|
const qc = useQueryClient9();
|
|
13588
13629
|
const session = useSession((st) => st.session);
|
|
@@ -13591,7 +13632,7 @@ function useCreateBackup() {
|
|
|
13591
13632
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
13592
13633
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
13593
13634
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
13594
|
-
|
|
13635
|
+
useEffect20(() => {
|
|
13595
13636
|
if (!hasServerVault) {
|
|
13596
13637
|
useRestoreStore.getState().setMethod("server");
|
|
13597
13638
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -13599,7 +13640,7 @@ function useCreateBackup() {
|
|
|
13599
13640
|
}, [hasServerVault]);
|
|
13600
13641
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
13601
13642
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
13602
|
-
const onBackupSuccess =
|
|
13643
|
+
const onBackupSuccess = useCallback17(() => {
|
|
13603
13644
|
console.log("[EMBARKAI BACKUP] Backup created successfully");
|
|
13604
13645
|
}, [hasServerVault]);
|
|
13605
13646
|
const { mutate: createPasswordBackup, isPending: isPasswordBackupCreating } = useMutation9({
|
|
@@ -13886,7 +13927,7 @@ var init_useRestoreAccount = __esm({
|
|
|
13886
13927
|
});
|
|
13887
13928
|
|
|
13888
13929
|
// src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts
|
|
13889
|
-
import { useEffect as
|
|
13930
|
+
import { useEffect as useEffect21 } from "react";
|
|
13890
13931
|
function validateRestoreFileFormat(parsedData) {
|
|
13891
13932
|
if (typeof parsedData !== "object" || parsedData === null) return false;
|
|
13892
13933
|
const data = parsedData;
|
|
@@ -13896,7 +13937,7 @@ function useValidateFileBackup() {
|
|
|
13896
13937
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
13897
13938
|
const setError = useRestoreStore((st) => st.setError);
|
|
13898
13939
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
13899
|
-
|
|
13940
|
+
useEffect21(() => {
|
|
13900
13941
|
if (!restoreFile) {
|
|
13901
13942
|
return;
|
|
13902
13943
|
}
|
|
@@ -14022,7 +14063,7 @@ var init_MethodSelector = __esm({
|
|
|
14022
14063
|
|
|
14023
14064
|
// src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx
|
|
14024
14065
|
import { ChevronRight as ChevronRight2, Eye, EyeOff, Info as Info3, Key as Key4, Loader as Loader8, Plus } from "lucide-react";
|
|
14025
|
-
import { useEffect as
|
|
14066
|
+
import { useEffect as useEffect22, useRef as useRef15 } from "react";
|
|
14026
14067
|
import { Fragment as Fragment18, jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
14027
14068
|
function PasswordPasskey(props) {
|
|
14028
14069
|
const { t } = useT();
|
|
@@ -14037,7 +14078,7 @@ function PasswordPasskey(props) {
|
|
|
14037
14078
|
onCreatePasskey
|
|
14038
14079
|
} = props;
|
|
14039
14080
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
14040
|
-
const actionRef =
|
|
14081
|
+
const actionRef = useRef15(null);
|
|
14041
14082
|
const {
|
|
14042
14083
|
showPassword,
|
|
14043
14084
|
restorePassword,
|
|
@@ -14051,7 +14092,7 @@ function PasswordPasskey(props) {
|
|
|
14051
14092
|
} = useRestoreStore();
|
|
14052
14093
|
const { config } = useProviderConfig();
|
|
14053
14094
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
14054
|
-
|
|
14095
|
+
useEffect22(() => {
|
|
14055
14096
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
14056
14097
|
}, [isPasskeyEnabled, usePasskey]);
|
|
14057
14098
|
return /* @__PURE__ */ jsxs53(Fragment18, { children: [
|
|
@@ -14379,7 +14420,7 @@ var init_File = __esm({
|
|
|
14379
14420
|
import { useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
14380
14421
|
import dayjs3 from "dayjs";
|
|
14381
14422
|
import { Download as Download3, Key as Key5, Upload as Upload3 } from "lucide-react";
|
|
14382
|
-
import { useEffect as
|
|
14423
|
+
import { useEffect as useEffect23 } from "react";
|
|
14383
14424
|
import { Fragment as Fragment21, jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
14384
14425
|
function Server(props) {
|
|
14385
14426
|
const { isLoading, mode = "restore", serverHandler, createPasskeyHandler } = props;
|
|
@@ -14389,7 +14430,7 @@ function Server(props) {
|
|
|
14389
14430
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
14390
14431
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
14391
14432
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
14392
|
-
|
|
14433
|
+
useEffect23(() => {
|
|
14393
14434
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
14394
14435
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
14395
14436
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -14572,7 +14613,7 @@ var init_select = __esm({
|
|
|
14572
14613
|
// src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx
|
|
14573
14614
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
14574
14615
|
import { ArrowLeft as ArrowLeft10, CloudDownload, CloudUpload, Loader as Loader9 } from "lucide-react";
|
|
14575
|
-
import { useEffect as
|
|
14616
|
+
import { useEffect as useEffect24 } from "react";
|
|
14576
14617
|
import { Fragment as Fragment22, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
14577
14618
|
function Cloud2(props) {
|
|
14578
14619
|
const { isLoading, mode = "restore", cloudHandler } = props;
|
|
@@ -14593,7 +14634,7 @@ function Cloud2(props) {
|
|
|
14593
14634
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
14594
14635
|
}
|
|
14595
14636
|
});
|
|
14596
|
-
|
|
14637
|
+
useEffect24(() => {
|
|
14597
14638
|
if (isCloudProvidersLoading) return;
|
|
14598
14639
|
if (!!cloudProvidersError) {
|
|
14599
14640
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -14833,7 +14874,7 @@ var init_methods = __esm({
|
|
|
14833
14874
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
14834
14875
|
import { useMutation as useMutation11, useQuery as useQuery7, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
14835
14876
|
import { AlertCircle as AlertCircle2, CheckCircle2, CloudDownload as CloudDownload2, Loader as Loader10, UserCircle as UserCircle2 } from "lucide-react";
|
|
14836
|
-
import { useEffect as
|
|
14877
|
+
import { useEffect as useEffect25 } from "react";
|
|
14837
14878
|
import { useDisconnect } from "wagmi";
|
|
14838
14879
|
import { Fragment as Fragment24, jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
14839
14880
|
var RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
@@ -14870,7 +14911,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14870
14911
|
const error = useRestoreStore((st) => st.error);
|
|
14871
14912
|
const success = useRestoreStore((st) => st.success);
|
|
14872
14913
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
14873
|
-
|
|
14914
|
+
useEffect25(() => {
|
|
14874
14915
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
14875
14916
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
14876
14917
|
setIsDialogForced(true);
|
|
@@ -14910,7 +14951,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
14910
14951
|
queryFn: async () => await getShareRecoveryStats()
|
|
14911
14952
|
});
|
|
14912
14953
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
14913
|
-
|
|
14954
|
+
useEffect25(() => {
|
|
14914
14955
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
14915
14956
|
}, [hasServerBackup]);
|
|
14916
14957
|
const { mutate: disconnect, isPending: isDisconnecting } = useMutation11({
|
|
@@ -15057,7 +15098,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15057
15098
|
// src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx
|
|
15058
15099
|
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
15059
15100
|
import { AlertCircle as AlertCircle3, ArrowLeft as ArrowLeft11, CheckCircle2 as CheckCircle22, Loader as Loader11, LockIcon } from "lucide-react";
|
|
15060
|
-
import { useEffect as
|
|
15101
|
+
import { useEffect as useEffect26 } from "react";
|
|
15061
15102
|
import { Fragment as Fragment25, jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
15062
15103
|
function KeyshareBackupMenu() {
|
|
15063
15104
|
const address = useSession((st) => st.address);
|
|
@@ -15068,7 +15109,7 @@ function KeyshareBackupMenu() {
|
|
|
15068
15109
|
const currentBackupMethod = useRestoreStore((st) => st.method);
|
|
15069
15110
|
const error = useRestoreStore((st) => st.error);
|
|
15070
15111
|
const success = useRestoreStore((st) => st.success);
|
|
15071
|
-
|
|
15112
|
+
useEffect26(() => {
|
|
15072
15113
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15073
15114
|
return () => {
|
|
15074
15115
|
setSuccess(null);
|
|
@@ -15087,7 +15128,7 @@ function KeyshareBackupMenu() {
|
|
|
15087
15128
|
queryFn: async () => await getShareRecoveryStats()
|
|
15088
15129
|
});
|
|
15089
15130
|
const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15090
|
-
|
|
15131
|
+
useEffect26(() => {
|
|
15091
15132
|
if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
|
|
15092
15133
|
}, [hasRecoveryData]);
|
|
15093
15134
|
const {
|
|
@@ -15240,7 +15281,7 @@ var init_KeyshareRestoreMenu2 = __esm({
|
|
|
15240
15281
|
});
|
|
15241
15282
|
|
|
15242
15283
|
// src/hooks/useColorMode.ts
|
|
15243
|
-
import { useCallback as
|
|
15284
|
+
import { useCallback as useCallback18, useEffect as useEffect27 } from "react";
|
|
15244
15285
|
function useColorMode() {
|
|
15245
15286
|
const {
|
|
15246
15287
|
config: { current: config }
|
|
@@ -15248,14 +15289,14 @@ function useColorMode() {
|
|
|
15248
15289
|
const preferedColorMode = config?.preferedColorMode;
|
|
15249
15290
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
15250
15291
|
const handleStoreColorMode = useLayoutStore((st) => st.setColorMode);
|
|
15251
|
-
const setColorMode =
|
|
15292
|
+
const setColorMode = useCallback18(
|
|
15252
15293
|
(mode) => {
|
|
15253
15294
|
localStorage.setItem(LOCAL_COLOR_MODE_KEY, mode);
|
|
15254
15295
|
handleStoreColorMode(mode);
|
|
15255
15296
|
},
|
|
15256
15297
|
[handleStoreColorMode]
|
|
15257
15298
|
);
|
|
15258
|
-
|
|
15299
|
+
useEffect27(() => {
|
|
15259
15300
|
let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
|
|
15260
15301
|
if (!targetColorMode && !preferedColorMode) {
|
|
15261
15302
|
const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -15370,17 +15411,17 @@ var init_SumsubIframeManager = __esm({
|
|
|
15370
15411
|
});
|
|
15371
15412
|
|
|
15372
15413
|
// src/internal/components/KYC/useSumsubIframe.ts
|
|
15373
|
-
import { useEffect as
|
|
15414
|
+
import { useEffect as useEffect28, useRef as useRef16, useState as useState17 } from "react";
|
|
15374
15415
|
function useSumsubIframe({ iframeUrl }) {
|
|
15375
15416
|
const config = useProviderConfig().config;
|
|
15376
15417
|
const { colorMode } = useColorMode();
|
|
15377
|
-
const iframeRef =
|
|
15418
|
+
const iframeRef = useRef16(null);
|
|
15378
15419
|
const [isLoading, setIsLoading] = useState17(true);
|
|
15379
15420
|
const [error, setError] = useState17(null);
|
|
15380
15421
|
const [height, setHeight] = useState17(0);
|
|
15381
15422
|
const [status, setStatus] = useState17("");
|
|
15382
15423
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
15383
|
-
|
|
15424
|
+
useEffect28(() => {
|
|
15384
15425
|
setError(null);
|
|
15385
15426
|
setIsLoading(true);
|
|
15386
15427
|
setStatus("Preparing verification...");
|
|
@@ -15692,14 +15733,14 @@ var init_useProvidersList = __esm({
|
|
|
15692
15733
|
|
|
15693
15734
|
// src/internal/components/MainMenu/MainMenu.tsx
|
|
15694
15735
|
import { ChevronLeft, ChevronRight as ChevronRight3, DollarSign as DollarSign2, Wallet2 as Wallet23 } from "lucide-react";
|
|
15695
|
-
import { useEffect as
|
|
15736
|
+
import { useEffect as useEffect29 } from "react";
|
|
15696
15737
|
import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
15697
15738
|
function MainMenu() {
|
|
15698
15739
|
const address = useSession((st) => st.address);
|
|
15699
15740
|
const { t } = useT();
|
|
15700
15741
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
15701
15742
|
const setTransitionPageHeight = useLayoutDataStore((st) => st.setTransitionPageHeight);
|
|
15702
|
-
|
|
15743
|
+
useEffect29(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
|
|
15703
15744
|
useProvidersList();
|
|
15704
15745
|
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
15746
|
Button,
|
|
@@ -15744,7 +15785,7 @@ var init_MainMenu2 = __esm({
|
|
|
15744
15785
|
|
|
15745
15786
|
// src/modules/linkedProfiles.ts
|
|
15746
15787
|
import { useQuery as useQuery11, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
|
|
15747
|
-
import { useCallback as
|
|
15788
|
+
import { useCallback as useCallback19 } from "react";
|
|
15748
15789
|
function useLinkedProfiles() {
|
|
15749
15790
|
const qc = useQueryClient12();
|
|
15750
15791
|
const address = useSession((st) => st.address);
|
|
@@ -15768,7 +15809,7 @@ function useLinkedProfiles() {
|
|
|
15768
15809
|
}
|
|
15769
15810
|
});
|
|
15770
15811
|
const { profiles = [], avatar = null } = data || {};
|
|
15771
|
-
const refresh =
|
|
15812
|
+
const refresh = useCallback19(async () => {
|
|
15772
15813
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15773
15814
|
}, [qc, address]);
|
|
15774
15815
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
@@ -16246,7 +16287,7 @@ var init_EmailNotConnectedWarning = __esm({
|
|
|
16246
16287
|
|
|
16247
16288
|
// src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts
|
|
16248
16289
|
import { useQueryClient as useQueryClient15 } from "@tanstack/react-query";
|
|
16249
|
-
import React21, { useEffect as
|
|
16290
|
+
import React21, { useEffect as useEffect30 } from "react";
|
|
16250
16291
|
function normalizeSocialLinkError(message) {
|
|
16251
16292
|
if (message === "X_ALREADY_LINKED") {
|
|
16252
16293
|
return "This X account is already linked to another account";
|
|
@@ -16322,7 +16363,7 @@ function useLinkSocial() {
|
|
|
16322
16363
|
[config.social?.providers]
|
|
16323
16364
|
);
|
|
16324
16365
|
const [socialLinkStarted, setSocialLinkStarted] = React21.useState(false);
|
|
16325
|
-
|
|
16366
|
+
useEffect30(() => {
|
|
16326
16367
|
const key = providerType?.toLowerCase();
|
|
16327
16368
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
|
|
16328
16369
|
if (isWalletLinking) {
|
|
@@ -16405,7 +16446,7 @@ var init_telegram2 = __esm({
|
|
|
16405
16446
|
|
|
16406
16447
|
// src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts
|
|
16407
16448
|
import { useQueryClient as useQueryClient16 } from "@tanstack/react-query";
|
|
16408
|
-
import { useCallback as
|
|
16449
|
+
import { useCallback as useCallback20, useEffect as useEffect31, useState as useState18 } from "react";
|
|
16409
16450
|
function useLinkTelegram() {
|
|
16410
16451
|
const {
|
|
16411
16452
|
config: { current: config },
|
|
@@ -16416,7 +16457,7 @@ function useLinkTelegram() {
|
|
|
16416
16457
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16417
16458
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16418
16459
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16419
|
-
const handleLinkTelegram =
|
|
16460
|
+
const handleLinkTelegram = useCallback20(async () => {
|
|
16420
16461
|
try {
|
|
16421
16462
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16422
16463
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16464,7 +16505,7 @@ function useLinkTelegram() {
|
|
|
16464
16505
|
}
|
|
16465
16506
|
}, [config.social?.providers]);
|
|
16466
16507
|
const [telegramLinkStarted, setTelegramLinkStarted] = useState18(false);
|
|
16467
|
-
|
|
16508
|
+
useEffect31(() => {
|
|
16468
16509
|
console.log("[useLinkTelegram] Effect triggered:", {
|
|
16469
16510
|
providerType,
|
|
16470
16511
|
linkIsLoading,
|
|
@@ -16481,7 +16522,7 @@ function useLinkTelegram() {
|
|
|
16481
16522
|
handleLinkTelegram();
|
|
16482
16523
|
}
|
|
16483
16524
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
|
|
16484
|
-
|
|
16525
|
+
useEffect31(() => {
|
|
16485
16526
|
if (providerType !== "telegram") {
|
|
16486
16527
|
setTelegramLinkStarted(false);
|
|
16487
16528
|
}
|
|
@@ -17001,12 +17042,12 @@ var init_useNicknameStore = __esm({
|
|
|
17001
17042
|
|
|
17002
17043
|
// src/internal/components/NicknameMenu/useNicknameAvailability.ts
|
|
17003
17044
|
import { useMutation as useMutation16 } from "@tanstack/react-query";
|
|
17004
|
-
import { debounce as
|
|
17005
|
-
import { useCallback as
|
|
17045
|
+
import { debounce as debounce5 } from "lodash-es";
|
|
17046
|
+
import { useCallback as useCallback21, useEffect as useEffect32 } from "react";
|
|
17006
17047
|
function useNicknameAvailability(currentNickname) {
|
|
17007
17048
|
const { t } = useT();
|
|
17008
17049
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
17009
|
-
|
|
17050
|
+
useEffect32(() => {
|
|
17010
17051
|
if (!currentNickname) return;
|
|
17011
17052
|
useNicknameStore.getState().setNicknameValue(currentNickname);
|
|
17012
17053
|
}, [currentNickname]);
|
|
@@ -17027,8 +17068,8 @@ function useNicknameAvailability(currentNickname) {
|
|
|
17027
17068
|
useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
|
|
17028
17069
|
}
|
|
17029
17070
|
});
|
|
17030
|
-
const debouncedCheckAvailability =
|
|
17031
|
-
|
|
17071
|
+
const debouncedCheckAvailability = useCallback21(debounce5(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
|
|
17072
|
+
useEffect32(() => {
|
|
17032
17073
|
if (!currentNickname) return;
|
|
17033
17074
|
const normalizedInputValue = normalizeNickname(nicknameValue);
|
|
17034
17075
|
const { valid: isNicknameValid } = validateNickname(nicknameValue);
|
|
@@ -17057,7 +17098,7 @@ var init_useNicknameAvailability = __esm({
|
|
|
17057
17098
|
// src/internal/components/NicknameMenu/NicknameEditForm.tsx
|
|
17058
17099
|
import { useMutation as useMutation17, useQueryClient as useQueryClient18 } from "@tanstack/react-query";
|
|
17059
17100
|
import { AtSignIcon, CheckIcon as CheckIcon2, CopyIcon, LoaderIcon as LoaderIcon7, SaveIcon } from "lucide-react";
|
|
17060
|
-
import { useCallback as
|
|
17101
|
+
import { useCallback as useCallback22, useState as useState20 } from "react";
|
|
17061
17102
|
import { Fragment as Fragment29, jsx as jsx79, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
17062
17103
|
function NicknameEditForm(props) {
|
|
17063
17104
|
const { isInitialUser, nicknameInfo } = props;
|
|
@@ -17099,7 +17140,7 @@ function NicknameEditForm(props) {
|
|
|
17099
17140
|
);
|
|
17100
17141
|
}
|
|
17101
17142
|
});
|
|
17102
|
-
const handleNicknameInputChange =
|
|
17143
|
+
const handleNicknameInputChange = useCallback22(
|
|
17103
17144
|
(e) => {
|
|
17104
17145
|
const { error, setError, setNicknameValue } = useNicknameStore.getState();
|
|
17105
17146
|
const value = e.target.value;
|
|
@@ -17114,7 +17155,7 @@ function NicknameEditForm(props) {
|
|
|
17114
17155
|
},
|
|
17115
17156
|
[isNicknameChangeError, isNicknameChangeSuccess, reset, t]
|
|
17116
17157
|
);
|
|
17117
|
-
const handleSubmit =
|
|
17158
|
+
const handleSubmit = useCallback22(
|
|
17118
17159
|
(e) => {
|
|
17119
17160
|
const { nicknameValue: nicknameValue2, setError } = useNicknameStore.getState();
|
|
17120
17161
|
if (!canChange) {
|
|
@@ -17223,7 +17264,7 @@ import dayjs4 from "dayjs";
|
|
|
17223
17264
|
import { ArrowLeft as ArrowLeft15, Info as Info4, Loader as Loader16 } from "lucide-react";
|
|
17224
17265
|
import { jsx as jsx80, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
17225
17266
|
function NicknameMenu() {
|
|
17226
|
-
const { isInitialUser } = usePageParams();
|
|
17267
|
+
const { isInitialUser } = usePageParams().current;
|
|
17227
17268
|
const { t } = useT();
|
|
17228
17269
|
const address = useSession((st) => st.address);
|
|
17229
17270
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
@@ -17400,6 +17441,7 @@ function useWatchTokens(options) {
|
|
|
17400
17441
|
const {
|
|
17401
17442
|
data: assets,
|
|
17402
17443
|
isLoading,
|
|
17444
|
+
isFetching,
|
|
17403
17445
|
error,
|
|
17404
17446
|
refetch
|
|
17405
17447
|
} = useQuery13({
|
|
@@ -17470,6 +17512,7 @@ function useWatchTokens(options) {
|
|
|
17470
17512
|
return {
|
|
17471
17513
|
assets: assets || [],
|
|
17472
17514
|
isLoading,
|
|
17515
|
+
isFetching,
|
|
17473
17516
|
error: error || null,
|
|
17474
17517
|
refetch
|
|
17475
17518
|
};
|
|
@@ -17486,7 +17529,7 @@ var init_useWatchTokens = __esm({
|
|
|
17486
17529
|
// src/internal/hooks/useBlockscoutAssets.ts
|
|
17487
17530
|
import { createBlockscoutClient } from "@embarkai/core/clients";
|
|
17488
17531
|
import { useQuery as useQuery14, useQueryClient as useQueryClient19 } from "@tanstack/react-query";
|
|
17489
|
-
import { useCallback as
|
|
17532
|
+
import { useCallback as useCallback23, useMemo as useMemo10, useRef as useRef17 } from "react";
|
|
17490
17533
|
import { formatEther, formatUnits as formatUnits3 } from "viem";
|
|
17491
17534
|
function resolveIpfsUri(uri) {
|
|
17492
17535
|
if (!uri) return "";
|
|
@@ -17623,15 +17666,17 @@ function useBlockscoutAssets(options) {
|
|
|
17623
17666
|
() => blockscoutApiUrl ? createBlockscoutClient({ baseUrl: blockscoutApiUrl }) : null,
|
|
17624
17667
|
[blockscoutApiUrl]
|
|
17625
17668
|
);
|
|
17626
|
-
const lastRefreshRef =
|
|
17669
|
+
const lastRefreshRef = useRef17(0);
|
|
17627
17670
|
const {
|
|
17628
17671
|
assets: watchTokenAssets,
|
|
17629
|
-
isLoading: watchTokensLoading
|
|
17672
|
+
isLoading: watchTokensLoading,
|
|
17673
|
+
isFetching: watchTokensFetching
|
|
17630
17674
|
// refetch: refetchWatchTokens
|
|
17631
17675
|
} = useWatchTokens({ address, chainId: resolvedChainId, enabled });
|
|
17632
17676
|
const {
|
|
17633
17677
|
data: nativeBalanceData,
|
|
17634
|
-
isLoading: nativeLoading
|
|
17678
|
+
isLoading: nativeLoading,
|
|
17679
|
+
isFetching: nativeFetching
|
|
17635
17680
|
// refetch: refetchNative
|
|
17636
17681
|
} = useQuery14({
|
|
17637
17682
|
queryKey: [NATIVE_BALANCE_QUERY_KEY, resolvedChainId, address],
|
|
@@ -17655,6 +17700,7 @@ function useBlockscoutAssets(options) {
|
|
|
17655
17700
|
const {
|
|
17656
17701
|
data: tokenBalances,
|
|
17657
17702
|
isLoading: tokensLoading,
|
|
17703
|
+
isFetching: tokensFetching,
|
|
17658
17704
|
error: tokensError,
|
|
17659
17705
|
// refetch: refetchTokens,
|
|
17660
17706
|
dataUpdatedAt
|
|
@@ -17680,7 +17726,8 @@ function useBlockscoutAssets(options) {
|
|
|
17680
17726
|
});
|
|
17681
17727
|
const {
|
|
17682
17728
|
data: nftItems,
|
|
17683
|
-
isLoading: nftsLoading
|
|
17729
|
+
isLoading: nftsLoading,
|
|
17730
|
+
isFetching: nftsFetching
|
|
17684
17731
|
// refetch: refetchNfts
|
|
17685
17732
|
} = useQuery14({
|
|
17686
17733
|
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, address, blockscoutApiUrl],
|
|
@@ -17794,7 +17841,7 @@ function useBlockscoutAssets(options) {
|
|
|
17794
17841
|
if (!tokensError) return null;
|
|
17795
17842
|
return createError(tokensError);
|
|
17796
17843
|
}, [tokensError]);
|
|
17797
|
-
const refreshBalances =
|
|
17844
|
+
const refreshBalances = useCallback23(async () => {
|
|
17798
17845
|
const now = Date.now();
|
|
17799
17846
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
17800
17847
|
return;
|
|
@@ -17811,7 +17858,7 @@ function useBlockscoutAssets(options) {
|
|
|
17811
17858
|
qc.invalidateQueries({ queryKey: [WATCH_TOKENS_QUERY_KEY] })
|
|
17812
17859
|
]);
|
|
17813
17860
|
}, [qc]);
|
|
17814
|
-
const getTokenBalance =
|
|
17861
|
+
const getTokenBalance = useCallback23(
|
|
17815
17862
|
(tokenAddress) => {
|
|
17816
17863
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
17817
17864
|
},
|
|
@@ -17821,6 +17868,7 @@ function useBlockscoutAssets(options) {
|
|
|
17821
17868
|
nativeBalance,
|
|
17822
17869
|
assets,
|
|
17823
17870
|
isLoading: nativeLoading || tokensLoading || nftsLoading || watchTokensLoading,
|
|
17871
|
+
isFetching: nativeFetching || tokensFetching || nftsFetching || watchTokensFetching,
|
|
17824
17872
|
isInitialLoading: nativeLoading && !nativeBalanceData,
|
|
17825
17873
|
error,
|
|
17826
17874
|
isBlockscoutAvailable: !!blockscoutClient && !tokensError,
|
|
@@ -18118,31 +18166,32 @@ var init_PortfolioItem = __esm({
|
|
|
18118
18166
|
|
|
18119
18167
|
// src/internal/components/PortfolioMenu/PortfolioMenu.tsx
|
|
18120
18168
|
import { useQueryClient as useQueryClient20 } from "@tanstack/react-query";
|
|
18121
|
-
import {
|
|
18122
|
-
import { useCallback as
|
|
18169
|
+
import { ArrowLeft as ArrowLeft16, Gem, Loader as Loader17, RefreshCw as RefreshCw2 } from "lucide-react";
|
|
18170
|
+
import { useCallback as useCallback24 } from "react";
|
|
18123
18171
|
import { jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
18124
18172
|
function PortfolioMenu() {
|
|
18125
18173
|
const { assets: projectAssets = [] } = useProviderConfig().config.current?.projectAssets || {};
|
|
18126
18174
|
const { t } = useT();
|
|
18127
18175
|
const qc = useQueryClient20();
|
|
18128
18176
|
const address = useSession((st) => st.address);
|
|
18129
|
-
const
|
|
18177
|
+
const chainConfig = useSession((st) => st.chainConfig);
|
|
18130
18178
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18131
18179
|
const {
|
|
18132
18180
|
assets: blockscoutAssets,
|
|
18133
18181
|
refreshBalances: refreshBlockscoutBalances,
|
|
18134
18182
|
isLoading: isBlockscoutLoading,
|
|
18183
|
+
isFetching: isBlockscoutFetching,
|
|
18135
18184
|
error: blockscoutError,
|
|
18136
18185
|
isBlockscoutAvailable
|
|
18137
18186
|
} = useBlockscoutAssets({
|
|
18138
18187
|
address,
|
|
18139
18188
|
enabled: !!address
|
|
18140
18189
|
});
|
|
18141
|
-
const
|
|
18142
|
-
const refreshAllAssetsBalances =
|
|
18143
|
-
Promise.all(
|
|
18190
|
+
const shownProjectAssets = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
18191
|
+
const refreshAllAssetsBalances = useCallback24(() => {
|
|
18192
|
+
Promise.all(shownProjectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
18144
18193
|
refreshBlockscoutBalances();
|
|
18145
|
-
}, [qc,
|
|
18194
|
+
}, [qc, shownProjectAssets, refreshBlockscoutBalances]);
|
|
18146
18195
|
return /* @__PURE__ */ jsx83(
|
|
18147
18196
|
"div",
|
|
18148
18197
|
{
|
|
@@ -18153,7 +18202,16 @@ function PortfolioMenu() {
|
|
|
18153
18202
|
className: "list-scrollbar-y w-full p-[var(--ui-kit-pd)]",
|
|
18154
18203
|
children: /* @__PURE__ */ jsxs77(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18155
18204
|
/* @__PURE__ */ jsxs77("div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18156
|
-
/* @__PURE__ */ jsx83(
|
|
18205
|
+
/* @__PURE__ */ jsx83(
|
|
18206
|
+
Button,
|
|
18207
|
+
{
|
|
18208
|
+
variant: "ghost",
|
|
18209
|
+
size: "icon",
|
|
18210
|
+
title: "Back",
|
|
18211
|
+
onClick: () => useLayoutDataStore.getState().setPage("main-menu" /* MAIN_MENU */),
|
|
18212
|
+
children: /* @__PURE__ */ jsx83(ArrowLeft16, { className: "h-4 w-4" })
|
|
18213
|
+
}
|
|
18214
|
+
),
|
|
18157
18215
|
/* @__PURE__ */ jsx83("span", { className: "text-xl font-semibold", children: t("passport:portfolioMenu.title") }),
|
|
18158
18216
|
/* @__PURE__ */ jsx83(
|
|
18159
18217
|
Button,
|
|
@@ -18162,8 +18220,8 @@ function PortfolioMenu() {
|
|
|
18162
18220
|
variant: "ghost",
|
|
18163
18221
|
size: "icon",
|
|
18164
18222
|
onClick: refreshAllAssetsBalances,
|
|
18165
|
-
disabled: isBlockscoutLoading,
|
|
18166
|
-
children: isBlockscoutLoading ? /* @__PURE__ */ jsx83(Loader17, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx83(RefreshCw2, { className: "h-4 w-4" })
|
|
18223
|
+
disabled: isBlockscoutLoading || isBlockscoutFetching,
|
|
18224
|
+
children: isBlockscoutLoading || isBlockscoutFetching ? /* @__PURE__ */ jsx83(Loader17, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx83(RefreshCw2, { className: "h-4 w-4" })
|
|
18167
18225
|
}
|
|
18168
18226
|
)
|
|
18169
18227
|
] }),
|
|
@@ -18172,7 +18230,7 @@ function PortfolioMenu() {
|
|
|
18172
18230
|
/* @__PURE__ */ jsx83(Gem, { className: "w-8 h-8" }),
|
|
18173
18231
|
/* @__PURE__ */ jsx83("span", { className: "block", children: t("passport:portfolioMenu.noAssets") })
|
|
18174
18232
|
] }),
|
|
18175
|
-
!isBlockscoutLoading &&
|
|
18233
|
+
!isBlockscoutLoading && shownProjectAssets?.map((asset, index) => /* @__PURE__ */ jsx83(PortfolioItem, { isProjectAsset: true, address, asset }, `project-${asset.symbol}-${index}`)),
|
|
18176
18234
|
!isBlockscoutLoading && blockscoutAssets?.length > 0 && blockscoutAssets.map((asset, index) => /* @__PURE__ */ jsx83(
|
|
18177
18235
|
PortfolioItem,
|
|
18178
18236
|
{
|
|
@@ -18181,10 +18239,12 @@ function PortfolioMenu() {
|
|
|
18181
18239
|
},
|
|
18182
18240
|
`${asset.type}-${asset.address || "native"}-${asset.tokenId || index}`
|
|
18183
18241
|
)),
|
|
18184
|
-
|
|
18185
|
-
|
|
18186
|
-
|
|
18187
|
-
|
|
18242
|
+
!isBlockscoutAvailable && /* @__PURE__ */ jsx83(Highlight, {
|
|
18243
|
+
type: "warning",
|
|
18244
|
+
//@ts-expect-error i18n typings
|
|
18245
|
+
children: t("passport:portfolioMenu.noBlockscout", { chain: chainConfig?.name?.toUpperCase() || "UNKNOWN" })
|
|
18246
|
+
}),
|
|
18247
|
+
blockscoutError && /* @__PURE__ */ jsx83(Highlight, { type: "error", children: blockscoutError?.message })
|
|
18188
18248
|
] })
|
|
18189
18249
|
}
|
|
18190
18250
|
);
|
|
@@ -18294,7 +18354,7 @@ var init_nickname_fingerprint = __esm({
|
|
|
18294
18354
|
// src/internal/components/ReceiveMenu/ReceiveMenu.tsx
|
|
18295
18355
|
import { ArrowLeft as ArrowLeft17, CheckCircle2 as CheckCircle23, Copy as Copy2, Info as Info5, Loader as Loader18, Shield } from "lucide-react";
|
|
18296
18356
|
import QRCode from "qrcode";
|
|
18297
|
-
import { useCallback as
|
|
18357
|
+
import { useCallback as useCallback25, useEffect as useEffect33, useMemo as useMemo11, useState as useState21 } from "react";
|
|
18298
18358
|
import { Fragment as Fragment31, jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
18299
18359
|
function ReceiveMenu() {
|
|
18300
18360
|
const session = useSession((st) => st.session);
|
|
@@ -18316,7 +18376,7 @@ function ReceiveMenu() {
|
|
|
18316
18376
|
return null;
|
|
18317
18377
|
}
|
|
18318
18378
|
}, [session?.ownerAddress]);
|
|
18319
|
-
|
|
18379
|
+
useEffect33(() => {
|
|
18320
18380
|
if (open && address) {
|
|
18321
18381
|
QRCode.toDataURL(address, {
|
|
18322
18382
|
width: 200,
|
|
@@ -18329,7 +18389,7 @@ function ReceiveMenu() {
|
|
|
18329
18389
|
});
|
|
18330
18390
|
}
|
|
18331
18391
|
}, [open, address]);
|
|
18332
|
-
const handleCopy =
|
|
18392
|
+
const handleCopy = useCallback25(async () => {
|
|
18333
18393
|
if (!address) return;
|
|
18334
18394
|
try {
|
|
18335
18395
|
await navigator.clipboard.writeText(address);
|
|
@@ -18339,7 +18399,7 @@ function ReceiveMenu() {
|
|
|
18339
18399
|
console.error("Failed to copy address:", error);
|
|
18340
18400
|
}
|
|
18341
18401
|
}, [address]);
|
|
18342
|
-
const handleCopyFingerprint =
|
|
18402
|
+
const handleCopyFingerprint = useCallback25(async () => {
|
|
18343
18403
|
if (!fingerprint) return;
|
|
18344
18404
|
try {
|
|
18345
18405
|
await navigator.clipboard.writeText(fingerprint);
|
|
@@ -18419,6 +18479,24 @@ var init_ReceiveMenu2 = __esm({
|
|
|
18419
18479
|
}
|
|
18420
18480
|
});
|
|
18421
18481
|
|
|
18482
|
+
// src/internal/components/SecurityMenu/useSecurityStore.ts
|
|
18483
|
+
import { debounce as debounce6 } from "lodash-es";
|
|
18484
|
+
import { create as create10 } from "zustand";
|
|
18485
|
+
var useSecurityStore;
|
|
18486
|
+
var init_useSecurityStore = __esm({
|
|
18487
|
+
"src/internal/components/SecurityMenu/useSecurityStore.ts"() {
|
|
18488
|
+
useSecurityStore = create10((set) => ({
|
|
18489
|
+
renderKey: "security-store",
|
|
18490
|
+
setRenderKey: debounce6((renderKey) => {
|
|
18491
|
+
console.log("[SecurityMenu] Setting render key:", renderKey);
|
|
18492
|
+
set({ renderKey });
|
|
18493
|
+
}, 200),
|
|
18494
|
+
appToUntrust: null,
|
|
18495
|
+
untrustApp: (app) => set({ appToUntrust: app })
|
|
18496
|
+
}));
|
|
18497
|
+
}
|
|
18498
|
+
});
|
|
18499
|
+
|
|
18422
18500
|
// src/internal/components/SecurityMenu/constants.ts
|
|
18423
18501
|
var KEYSHARE_RECOVERY_STATS_QUERY, CONNECTED_TRUSTED_APPS_QUERY;
|
|
18424
18502
|
var init_constants5 = __esm({
|
|
@@ -18428,7 +18506,7 @@ var init_constants5 = __esm({
|
|
|
18428
18506
|
}
|
|
18429
18507
|
});
|
|
18430
18508
|
|
|
18431
|
-
// src/internal/components/SecurityMenu/
|
|
18509
|
+
// src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts
|
|
18432
18510
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
18433
18511
|
function useConnectedApps() {
|
|
18434
18512
|
const session = useSession((st) => st.session);
|
|
@@ -18446,45 +18524,31 @@ function useConnectedApps() {
|
|
|
18446
18524
|
}
|
|
18447
18525
|
});
|
|
18448
18526
|
}
|
|
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"() {
|
|
18527
|
+
var init_useConnectedApps = __esm({
|
|
18528
|
+
"src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts"() {
|
|
18471
18529
|
init_SessionContext();
|
|
18472
|
-
init_keyshare();
|
|
18473
18530
|
init_httpClient();
|
|
18474
|
-
init_iframe_manager();
|
|
18475
|
-
init_vaultClient();
|
|
18476
18531
|
init_constants5();
|
|
18477
18532
|
}
|
|
18478
18533
|
});
|
|
18479
18534
|
|
|
18480
|
-
// src/internal/components/SecurityMenu/ConnectedApps.tsx
|
|
18535
|
+
// src/internal/components/SecurityMenu/ConnectedApps/ConnectedApps.tsx
|
|
18481
18536
|
import dayjs5 from "dayjs";
|
|
18482
|
-
import { AppWindowMac, ExternalLinkIcon as ExternalLinkIcon2,
|
|
18537
|
+
import { AppWindowMac, ExternalLinkIcon as ExternalLinkIcon2, InfoIcon as InfoIcon4, LoaderIcon as LoaderIcon9, ShieldBanIcon, ShieldCheckIcon } from "lucide-react";
|
|
18538
|
+
import { useEffect as useEffect34 } from "react";
|
|
18483
18539
|
import { Fragment as Fragment32, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
18484
18540
|
function Application(props) {
|
|
18485
|
-
const {
|
|
18541
|
+
const {
|
|
18542
|
+
projectId,
|
|
18543
|
+
appUrl = null,
|
|
18544
|
+
//
|
|
18545
|
+
logo,
|
|
18546
|
+
name,
|
|
18547
|
+
trustedAuthorizedApp,
|
|
18548
|
+
firstConnectedAt
|
|
18549
|
+
// untrustApp
|
|
18550
|
+
} = props;
|
|
18486
18551
|
const { t } = useT();
|
|
18487
|
-
const projectUrl = appUrl || null;
|
|
18488
18552
|
return /* @__PURE__ */ jsxs79(
|
|
18489
18553
|
"div",
|
|
18490
18554
|
{
|
|
@@ -18493,14 +18557,14 @@ function Application(props) {
|
|
|
18493
18557
|
"select-none text-[10px] leading-tight",
|
|
18494
18558
|
"p-2 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-secondary)]",
|
|
18495
18559
|
{
|
|
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)]": !!
|
|
18560
|
+
"cursor-default": !appUrl,
|
|
18561
|
+
"cursor-pointer transition-colors duration-200": !!appUrl,
|
|
18562
|
+
"hover:bg-[var(--ui-kit-secondary-h)] active:bg-[var(--ui-kit-secondary-a)]": !!appUrl
|
|
18499
18563
|
}
|
|
18500
18564
|
),
|
|
18501
18565
|
onClick: () => {
|
|
18502
|
-
if (!
|
|
18503
|
-
window.open(
|
|
18566
|
+
if (!appUrl) return;
|
|
18567
|
+
window.open(appUrl, "_blank", "noopener,noreferrer");
|
|
18504
18568
|
},
|
|
18505
18569
|
children: [
|
|
18506
18570
|
/* @__PURE__ */ jsxs79(
|
|
@@ -18530,9 +18594,9 @@ function Application(props) {
|
|
|
18530
18594
|
/* @__PURE__ */ jsxs79("div", { className: "flex-1 min-w-0", children: [
|
|
18531
18595
|
/* @__PURE__ */ jsxs79("span", { className: "flex flex-col", children: [
|
|
18532
18596
|
/* @__PURE__ */ jsx85("span", { className: "text-sm font-semibold truncate", children: name }),
|
|
18533
|
-
|
|
18597
|
+
appUrl && /* @__PURE__ */ jsxs79("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18534
18598
|
/* @__PURE__ */ jsx85(ExternalLinkIcon2, { className: "w-3 h-3 flex-none", strokeWidth: 1 }),
|
|
18535
|
-
/* @__PURE__ */ jsx85("span", { className: "flex-1 truncate", children: new URL(
|
|
18599
|
+
/* @__PURE__ */ jsx85("span", { className: "flex-1 truncate", children: new URL(appUrl).hostname })
|
|
18536
18600
|
] })
|
|
18537
18601
|
] }),
|
|
18538
18602
|
/* @__PURE__ */ jsx85("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: t(
|
|
@@ -18553,10 +18617,10 @@ function Application(props) {
|
|
|
18553
18617
|
),
|
|
18554
18618
|
onClick: (e) => {
|
|
18555
18619
|
e.stopPropagation();
|
|
18556
|
-
untrustApp({
|
|
18620
|
+
useSecurityStore.getState().untrustApp({
|
|
18557
18621
|
projectId,
|
|
18558
|
-
origin:
|
|
18559
|
-
hostname:
|
|
18622
|
+
origin: appUrl || void 0,
|
|
18623
|
+
hostname: appUrl ? new URL(appUrl).hostname : void 0,
|
|
18560
18624
|
appName: name,
|
|
18561
18625
|
appLogo: logo
|
|
18562
18626
|
});
|
|
@@ -18568,59 +18632,163 @@ function Application(props) {
|
|
|
18568
18632
|
}
|
|
18569
18633
|
);
|
|
18570
18634
|
}
|
|
18571
|
-
function ConnectedApps(
|
|
18572
|
-
const { isLoading: isParentLoading, untrustApp } = props;
|
|
18635
|
+
function ConnectedApps() {
|
|
18573
18636
|
const { t } = useT();
|
|
18574
18637
|
const { data: connectedApps = [], isLoading: isConnectedAppsLoading } = useConnectedApps();
|
|
18575
|
-
|
|
18576
|
-
|
|
18577
|
-
|
|
18638
|
+
useEffect34(() => {
|
|
18639
|
+
if (!connectedApps.length || isConnectedAppsLoading) return;
|
|
18640
|
+
useSecurityStore.getState().setRenderKey(`connected-apps-loaded-${Date.now()}`);
|
|
18641
|
+
}, [connectedApps, isConnectedAppsLoading]);
|
|
18642
|
+
if (!isConnectedAppsLoading && connectedApps.length === 0)
|
|
18578
18643
|
return /* @__PURE__ */ jsxs79(Highlight, { type: "info", className: "flex gap-[var(--ui-kit-gap)] ", children: [
|
|
18579
|
-
/* @__PURE__ */ jsx85(
|
|
18644
|
+
/* @__PURE__ */ jsx85(InfoIcon4, { className: "w-4 h-4" }),
|
|
18580
18645
|
/* @__PURE__ */ jsx85("span", { children: t("passport:securityMenu.connectedApps.noConnectedApps") })
|
|
18581
18646
|
] });
|
|
18582
18647
|
return /* @__PURE__ */ jsxs79(Fragment32, { children: [
|
|
18583
|
-
/* @__PURE__ */
|
|
18584
|
-
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
untrustApp
|
|
18589
|
-
},
|
|
18590
|
-
index
|
|
18591
|
-
)) })
|
|
18648
|
+
/* @__PURE__ */ jsxs79("div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
|
|
18649
|
+
/* @__PURE__ */ jsx85("span", { className: "leading-4 text-xs", children: t("passport:securityMenu.connectedApps.connectedApps") }),
|
|
18650
|
+
isConnectedAppsLoading && /* @__PURE__ */ jsx85(LoaderIcon9, { className: "h-4 w-4 animate-spin" })
|
|
18651
|
+
] }),
|
|
18652
|
+
/* @__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
18653
|
] });
|
|
18593
18654
|
}
|
|
18594
18655
|
var init_ConnectedApps = __esm({
|
|
18595
|
-
"src/internal/components/SecurityMenu/ConnectedApps.tsx"() {
|
|
18656
|
+
"src/internal/components/SecurityMenu/ConnectedApps/ConnectedApps.tsx"() {
|
|
18596
18657
|
init_utils2();
|
|
18597
18658
|
init_i18n();
|
|
18598
18659
|
init_button();
|
|
18599
18660
|
init_highlight();
|
|
18600
|
-
|
|
18661
|
+
init_useSecurityStore();
|
|
18662
|
+
init_useConnectedApps();
|
|
18601
18663
|
}
|
|
18602
18664
|
});
|
|
18603
18665
|
|
|
18604
|
-
// src/internal/components/SecurityMenu/
|
|
18605
|
-
import {
|
|
18666
|
+
// src/internal/components/SecurityMenu/ConnectedApps/UntrustApplication.tsx
|
|
18667
|
+
import { useMutation as useMutation18, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
|
|
18668
|
+
import { AppWindowMac as AppWindowMac2, Loader as Loader19 } from "lucide-react";
|
|
18606
18669
|
import { jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
18607
|
-
function
|
|
18608
|
-
const {
|
|
18609
|
-
|
|
18610
|
-
|
|
18611
|
-
|
|
18612
|
-
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18616
|
-
|
|
18617
|
-
|
|
18618
|
-
|
|
18619
|
-
|
|
18620
|
-
|
|
18621
|
-
|
|
18670
|
+
function UntrustApplication() {
|
|
18671
|
+
const { t } = useT();
|
|
18672
|
+
const qc = useQueryClient21();
|
|
18673
|
+
const userId = useSession((st) => st?.session?.mpcUserId);
|
|
18674
|
+
const appToUntrust = useSecurityStore((st) => st.appToUntrust);
|
|
18675
|
+
const { mutate: handleUntrustApp, isPending: isUntrustingApp } = useMutation18({
|
|
18676
|
+
mutationFn: async () => {
|
|
18677
|
+
if (!userId || !appToUntrust) return;
|
|
18678
|
+
const iframeManager = getIframeManager();
|
|
18679
|
+
if (!iframeManager) {
|
|
18680
|
+
throw new Error("Iframe manager not available");
|
|
18681
|
+
}
|
|
18682
|
+
return await iframeManager.removeTrustedApp(userId, appToUntrust.projectId, appToUntrust.origin);
|
|
18683
|
+
},
|
|
18684
|
+
onSuccess: (success) => {
|
|
18685
|
+
if (!success) {
|
|
18686
|
+
console.error("[SecurityMenu] Failed to remove trusted app from iframe");
|
|
18687
|
+
return;
|
|
18688
|
+
}
|
|
18689
|
+
qc.invalidateQueries({ queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId] });
|
|
18690
|
+
useSecurityStore.getState().untrustApp(null);
|
|
18691
|
+
},
|
|
18692
|
+
onError: (error) => {
|
|
18693
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
18694
|
+
console.error("[SecurityMenu] Error removing trusted app:", errorMessage);
|
|
18695
|
+
}
|
|
18696
|
+
});
|
|
18697
|
+
return /* @__PURE__ */ jsxs80("div", { className: "flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
18698
|
+
/* @__PURE__ */ jsxs80(Highlight, { className: "flex flex-col gap-[var(--ui-kit-gap)]", type: "warning", children: [
|
|
18699
|
+
/* @__PURE__ */ jsxs80("span", { className: "text-sm leading-5 font-bold", children: [
|
|
18700
|
+
t("passport:securityMenu.connectedApps.untrustApp"),
|
|
18701
|
+
"?"
|
|
18702
|
+
] }),
|
|
18703
|
+
/* @__PURE__ */ jsxs80("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)]", children: [
|
|
18704
|
+
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" }) }),
|
|
18705
|
+
/* @__PURE__ */ jsxs80("div", { className: "flex-1 text-left", children: [
|
|
18706
|
+
/* @__PURE__ */ jsx86("div", { className: "font-medium", children: appToUntrust.appName }),
|
|
18707
|
+
appToUntrust.hostname && /* @__PURE__ */ jsxs80("div", { className: "text-[10px]", children: [
|
|
18708
|
+
"(",
|
|
18709
|
+
appToUntrust.hostname,
|
|
18710
|
+
")"
|
|
18711
|
+
] })
|
|
18712
|
+
] })
|
|
18713
|
+
] })
|
|
18714
|
+
] }),
|
|
18715
|
+
/* @__PURE__ */ jsxs80("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] text-left space-y-1", children: [
|
|
18716
|
+
/* @__PURE__ */ jsxs80("p", { children: [
|
|
18717
|
+
t("passport:securityMenu.connectedApps.removalNoteTitle"),
|
|
18718
|
+
":"
|
|
18719
|
+
] }),
|
|
18720
|
+
/* @__PURE__ */ jsxs80("ul", { className: "list-disc list-inside ml-2 space-y-0.5", children: [
|
|
18721
|
+
/* @__PURE__ */ jsx86("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg1") }),
|
|
18722
|
+
/* @__PURE__ */ jsx86("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg2") })
|
|
18723
|
+
] })
|
|
18724
|
+
] }),
|
|
18725
|
+
/* @__PURE__ */ jsxs80("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
18726
|
+
/* @__PURE__ */ jsx86(
|
|
18727
|
+
Button,
|
|
18728
|
+
{
|
|
18729
|
+
variant: "outline",
|
|
18730
|
+
size: "large",
|
|
18731
|
+
className: "flex-1",
|
|
18732
|
+
onClick: () => useSecurityStore.getState().untrustApp(null),
|
|
18733
|
+
disabled: isUntrustingApp,
|
|
18734
|
+
children: t("passport:common.cancel")
|
|
18735
|
+
}
|
|
18736
|
+
),
|
|
18737
|
+
/* @__PURE__ */ jsx86(
|
|
18738
|
+
Button,
|
|
18739
|
+
{
|
|
18740
|
+
variant: "default",
|
|
18741
|
+
size: "large",
|
|
18742
|
+
className: "flex-1",
|
|
18743
|
+
onClick: () => handleUntrustApp(),
|
|
18744
|
+
disabled: isUntrustingApp,
|
|
18745
|
+
children: isUntrustingApp ? /* @__PURE__ */ jsx86(Loader19, { className: "h-4 w-4 animate-spin" }) : t("passport:common.delete")
|
|
18746
|
+
}
|
|
18747
|
+
)
|
|
18748
|
+
] })
|
|
18749
|
+
] });
|
|
18750
|
+
}
|
|
18751
|
+
var init_UntrustApplication = __esm({
|
|
18752
|
+
"src/internal/components/SecurityMenu/ConnectedApps/UntrustApplication.tsx"() {
|
|
18753
|
+
init_SessionContext();
|
|
18754
|
+
init_i18n();
|
|
18755
|
+
init_iframe_manager();
|
|
18756
|
+
init_button();
|
|
18757
|
+
init_highlight();
|
|
18758
|
+
init_constants5();
|
|
18759
|
+
init_useSecurityStore();
|
|
18760
|
+
}
|
|
18761
|
+
});
|
|
18762
|
+
|
|
18763
|
+
// src/internal/components/SecurityMenu/ConnectedApps/index.ts
|
|
18764
|
+
var init_ConnectedApps2 = __esm({
|
|
18765
|
+
"src/internal/components/SecurityMenu/ConnectedApps/index.ts"() {
|
|
18766
|
+
init_ConnectedApps();
|
|
18767
|
+
init_UntrustApplication();
|
|
18768
|
+
init_useConnectedApps();
|
|
18769
|
+
}
|
|
18770
|
+
});
|
|
18771
|
+
|
|
18772
|
+
// src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx
|
|
18773
|
+
import { Loader as Loader20 } from "lucide-react";
|
|
18774
|
+
import { jsx as jsx87, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
18775
|
+
function KeyshareStatus(props) {
|
|
18776
|
+
const { isLoading, content, icon: Icon2, children } = props;
|
|
18777
|
+
if (isLoading) return /* @__PURE__ */ jsx87(Loader20, { className: "w-4 h-4 animate-spin" });
|
|
18778
|
+
return /* @__PURE__ */ jsxs81("div", { className: "group relative w-full h-full", children: [
|
|
18779
|
+
children,
|
|
18780
|
+
/* @__PURE__ */ jsx87(
|
|
18781
|
+
"div",
|
|
18782
|
+
{
|
|
18783
|
+
className: cn(
|
|
18784
|
+
"absolute -top-2 -right-2 w-6 h-6 flex items-center justify-center",
|
|
18785
|
+
"rounded-full bg-[var(--ui-kit-bg)]"
|
|
18786
|
+
// 'border border-[var(--ui-kit-bd)]'
|
|
18787
|
+
),
|
|
18788
|
+
children: /* @__PURE__ */ jsx87(Icon2, { className: "w-4 h-4" })
|
|
18789
|
+
}
|
|
18622
18790
|
),
|
|
18623
|
-
/* @__PURE__ */
|
|
18791
|
+
/* @__PURE__ */ jsx87(
|
|
18624
18792
|
"div",
|
|
18625
18793
|
{
|
|
18626
18794
|
style: { transform: "translateY(calc(var(--ui-kit-gap) * -4))" },
|
|
@@ -18645,7 +18813,7 @@ var init_KeyshareStatus = __esm({
|
|
|
18645
18813
|
// src/internal/components/SecurityMenu/Keyshare/LastBackup.tsx
|
|
18646
18814
|
import dayjs6 from "dayjs";
|
|
18647
18815
|
import { DatabaseBackup } from "lucide-react";
|
|
18648
|
-
import { Fragment as Fragment33, jsx as
|
|
18816
|
+
import { Fragment as Fragment33, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
18649
18817
|
function parseOS(ua) {
|
|
18650
18818
|
if (!ua) return null;
|
|
18651
18819
|
if (ua.includes("Mac OS X")) return "Mac OS";
|
|
@@ -18671,18 +18839,18 @@ function LastBackup(props) {
|
|
|
18671
18839
|
} = createdRecoveryStats || {};
|
|
18672
18840
|
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
18841
|
if (!hasBackupData || !createdRecoveryStats) return null;
|
|
18674
|
-
return /* @__PURE__ */
|
|
18675
|
-
/* @__PURE__ */
|
|
18676
|
-
/* @__PURE__ */
|
|
18677
|
-
/* @__PURE__ */
|
|
18842
|
+
return /* @__PURE__ */ jsxs82(Highlight, { type: "info", className: "text-[10px] leading-4", children: [
|
|
18843
|
+
/* @__PURE__ */ jsxs82("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
18844
|
+
/* @__PURE__ */ jsx88(DatabaseBackup, { className: "w-4 h-4 flex-none" }),
|
|
18845
|
+
/* @__PURE__ */ jsx88("span", { className: "font-medium text-xs", children: t("passport:securityMenu.lastBackup") })
|
|
18678
18846
|
] }),
|
|
18679
|
-
recoveryCreatedAt && /* @__PURE__ */
|
|
18680
|
-
/* @__PURE__ */
|
|
18847
|
+
recoveryCreatedAt && /* @__PURE__ */ jsxs82(Fragment33, { children: [
|
|
18848
|
+
/* @__PURE__ */ jsx88("span", { className: "block font-mono! ", children: t("passport:securityMenu.lastBackupMeta", {
|
|
18681
18849
|
browser: cleanStringArtifacts(recoveryBrowser || "unknown"),
|
|
18682
18850
|
os: parseOS(recoveryUa) || "unknown os",
|
|
18683
18851
|
deviceName: cleanStringArtifacts(recoveryDeviceName || recoveryDeviceId || "")
|
|
18684
18852
|
}) }),
|
|
18685
|
-
/* @__PURE__ */
|
|
18853
|
+
/* @__PURE__ */ jsx88("span", { className: "block font-mono! text-[var(--ui-kit-fg-muted)]", children: dayjs6(recoveryCreatedAt).format("MMMM DD, YYYY HH:mm") })
|
|
18686
18854
|
] })
|
|
18687
18855
|
] });
|
|
18688
18856
|
}
|
|
@@ -18697,85 +18865,133 @@ var init_LastBackup = __esm({
|
|
|
18697
18865
|
}
|
|
18698
18866
|
});
|
|
18699
18867
|
|
|
18868
|
+
// src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts
|
|
18869
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
18870
|
+
function useKeyshareRecoveryStats() {
|
|
18871
|
+
const session = useSession((st) => st.session);
|
|
18872
|
+
const userId = session?.mpcUserId || null;
|
|
18873
|
+
return useQuery17({
|
|
18874
|
+
enabled: !!userId,
|
|
18875
|
+
queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
|
|
18876
|
+
queryFn: async () => {
|
|
18877
|
+
const iframeManager = getIframeManager();
|
|
18878
|
+
if (!iframeManager) {
|
|
18879
|
+
throw new Error("Iframe manager not available");
|
|
18880
|
+
}
|
|
18881
|
+
const keyshareInfo = await getKeyshareInfo(userId);
|
|
18882
|
+
const shareRecoveryStats = await getShareRecoveryStats();
|
|
18883
|
+
return {
|
|
18884
|
+
keyshareInfo,
|
|
18885
|
+
shareRecoveryStats
|
|
18886
|
+
};
|
|
18887
|
+
}
|
|
18888
|
+
});
|
|
18889
|
+
}
|
|
18890
|
+
var init_useKeyshareRecoveryStats = __esm({
|
|
18891
|
+
"src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts"() {
|
|
18892
|
+
init_SessionContext();
|
|
18893
|
+
init_keyshare();
|
|
18894
|
+
init_iframe_manager();
|
|
18895
|
+
init_vaultClient();
|
|
18896
|
+
init_constants5();
|
|
18897
|
+
}
|
|
18898
|
+
});
|
|
18899
|
+
|
|
18700
18900
|
// src/internal/components/SecurityMenu/Keyshare/Keyshare.tsx
|
|
18701
|
-
import { Cloud as Cloud3, Laptop, LoaderIcon as
|
|
18702
|
-
import {
|
|
18703
|
-
|
|
18704
|
-
|
|
18901
|
+
import { Cloud as Cloud3, Laptop, LoaderIcon as LoaderIcon10, Server as Server2 } from "lucide-react";
|
|
18902
|
+
import { useEffect as useEffect35 } from "react";
|
|
18903
|
+
import { Fragment as Fragment34, jsx as jsx89, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
18904
|
+
function Keyshare() {
|
|
18905
|
+
const userId = useSession((st) => st?.session?.mpcUserId);
|
|
18705
18906
|
const { t } = useT();
|
|
18907
|
+
const serverHasKeyshare = jwtTokenManager2.getHasKeyshare() ?? false;
|
|
18908
|
+
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
18909
|
+
useEffect35(() => {
|
|
18910
|
+
if (!recoveryData?.keyshareInfo || isRecoveryLoading) return;
|
|
18911
|
+
useSecurityStore.getState().setRenderKey(`keyshare-loaded-${Date.now()}`);
|
|
18912
|
+
}, [recoveryData, isRecoveryLoading]);
|
|
18913
|
+
const localInfo = recoveryData?.keyshareInfo || {};
|
|
18914
|
+
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
18706
18915
|
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
|
-
)
|
|
18916
|
+
const createdRecoveryStats = recoveryData?.shareRecoveryStats?.created;
|
|
18917
|
+
return /* @__PURE__ */ jsxs83(Fragment34, { children: [
|
|
18918
|
+
/* @__PURE__ */ jsxs83("div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
|
|
18919
|
+
/* @__PURE__ */ jsx89("span", { className: "text-xs leading-4", children: t("passport:securityMenu.keyshareStatus.title") }),
|
|
18920
|
+
isRecoveryLoading && /* @__PURE__ */ jsx89(LoaderIcon10, { className: "h-4 w-4 animate-spin" })
|
|
18767
18921
|
] }),
|
|
18768
|
-
/* @__PURE__ */
|
|
18922
|
+
!isRecoveryLoading && /* @__PURE__ */ jsxs83(Fragment34, { children: [
|
|
18923
|
+
/* @__PURE__ */ jsxs83("div", { className: "grid grid-cols-3 gap-[var(--ui-kit-gap)] px-[var(--ui-kit-gap)]", children: [
|
|
18924
|
+
/* @__PURE__ */ jsx89(
|
|
18925
|
+
KeyshareStatus,
|
|
18926
|
+
{
|
|
18927
|
+
content: serverHasKeyshare ? t("passport:securityMenu.keyshareStatus.serverReady") : t("passport:securityMenu.keyshareStatus.serverMissing"),
|
|
18928
|
+
icon: serverHasKeyshare ? PositiveIcon : NegativeIcon,
|
|
18929
|
+
children: /* @__PURE__ */ jsxs83(
|
|
18930
|
+
Highlight,
|
|
18931
|
+
{
|
|
18932
|
+
type: serverHasKeyshare ? "success" : "warning",
|
|
18933
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18934
|
+
children: [
|
|
18935
|
+
/* @__PURE__ */ jsx89(Cloud3, { className: "h-6 w-6" }),
|
|
18936
|
+
/* @__PURE__ */ jsx89("span", { className: "text-[10px] font-medium leading-4", children: "Server Share" })
|
|
18937
|
+
]
|
|
18938
|
+
}
|
|
18939
|
+
)
|
|
18940
|
+
}
|
|
18941
|
+
),
|
|
18942
|
+
/* @__PURE__ */ jsx89(
|
|
18943
|
+
KeyshareStatus,
|
|
18944
|
+
{
|
|
18945
|
+
content: localInfo?.hasKeyshare ? t("passport:securityMenu.keyshareStatus.localReady") : t("passport:securityMenu.keyshareStatus.localMissing"),
|
|
18946
|
+
icon: localInfo?.hasKeyshare ? PositiveIcon : NegativeIcon,
|
|
18947
|
+
children: /* @__PURE__ */ jsxs83(
|
|
18948
|
+
Highlight,
|
|
18949
|
+
{
|
|
18950
|
+
type: localInfo?.hasKeyshare ? "success" : "warning",
|
|
18951
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18952
|
+
children: [
|
|
18953
|
+
/* @__PURE__ */ jsx89(Laptop, { className: "h-6 w-6" }),
|
|
18954
|
+
/* @__PURE__ */ jsx89("span", { className: "text-[10px] font-medium leading-4", children: "Local Share" })
|
|
18955
|
+
]
|
|
18956
|
+
}
|
|
18957
|
+
)
|
|
18958
|
+
}
|
|
18959
|
+
),
|
|
18960
|
+
/* @__PURE__ */ jsx89(
|
|
18961
|
+
KeyshareStatus,
|
|
18962
|
+
{
|
|
18963
|
+
content: hasServerBackup ? t("passport:securityMenu.keyshareStatus.valutBackupCreated") : t("passport:securityMenu.keyshareStatus.valutBackupMissing"),
|
|
18964
|
+
icon: hasServerBackup ? PositiveIcon : NegativeIcon,
|
|
18965
|
+
children: /* @__PURE__ */ jsxs83(
|
|
18966
|
+
Highlight,
|
|
18967
|
+
{
|
|
18968
|
+
type: hasServerBackup ? "success" : "warning",
|
|
18969
|
+
className: "w-full h-full flex flex-col items-center gap-0",
|
|
18970
|
+
children: [
|
|
18971
|
+
/* @__PURE__ */ jsx89(Server2, { className: "h-6 w-6" }),
|
|
18972
|
+
/* @__PURE__ */ jsx89("span", { className: "text-[10px] font-medium leading-4", children: "Vault Backup" })
|
|
18973
|
+
]
|
|
18974
|
+
}
|
|
18975
|
+
)
|
|
18976
|
+
}
|
|
18977
|
+
)
|
|
18978
|
+
] }),
|
|
18979
|
+
/* @__PURE__ */ jsx89(LastBackup, { backup, createdRecoveryStats })
|
|
18980
|
+
] })
|
|
18769
18981
|
] });
|
|
18770
18982
|
}
|
|
18771
18983
|
var init_Keyshare = __esm({
|
|
18772
18984
|
"src/internal/components/SecurityMenu/Keyshare/Keyshare.tsx"() {
|
|
18985
|
+
init_SessionContext();
|
|
18773
18986
|
init_useT();
|
|
18774
18987
|
init_icons();
|
|
18988
|
+
init_auth();
|
|
18775
18989
|
init_vaultClient();
|
|
18776
18990
|
init_highlight();
|
|
18991
|
+
init_useSecurityStore();
|
|
18777
18992
|
init_KeyshareStatus();
|
|
18778
18993
|
init_LastBackup();
|
|
18994
|
+
init_useKeyshareRecoveryStats();
|
|
18779
18995
|
{
|
|
18780
18996
|
}
|
|
18781
18997
|
{
|
|
@@ -18787,95 +19003,18 @@ var init_Keyshare = __esm({
|
|
|
18787
19003
|
var init_Keyshare2 = __esm({
|
|
18788
19004
|
"src/internal/components/SecurityMenu/Keyshare/index.ts"() {
|
|
18789
19005
|
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();
|
|
19006
|
+
init_useKeyshareRecoveryStats();
|
|
18838
19007
|
}
|
|
18839
19008
|
});
|
|
18840
19009
|
|
|
18841
19010
|
// src/internal/components/SecurityMenu/SecurityMenu.tsx
|
|
18842
|
-
import { useMutation as useMutation18, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
|
|
18843
19011
|
import { ArrowLeft as ArrowLeft18 } from "lucide-react";
|
|
18844
|
-
import {
|
|
18845
|
-
import { jsx as jsx90, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
19012
|
+
import { Fragment as Fragment35, jsx as jsx90, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
18846
19013
|
function SecurityMenu() {
|
|
18847
|
-
const qc = useQueryClient21();
|
|
18848
19014
|
const { t } = useT();
|
|
18849
19015
|
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
|
-
});
|
|
19016
|
+
const appToUntrust = useSecurityStore((st) => st.appToUntrust);
|
|
19017
|
+
const renderKey = useSecurityStore((st) => st.renderKey);
|
|
18879
19018
|
return /* @__PURE__ */ jsx90(
|
|
18880
19019
|
"div",
|
|
18881
19020
|
{
|
|
@@ -18893,35 +19032,24 @@ function SecurityMenu() {
|
|
|
18893
19032
|
size: "icon",
|
|
18894
19033
|
title: t("passport:common.back"),
|
|
18895
19034
|
onClick: () => {
|
|
18896
|
-
|
|
18897
|
-
|
|
19035
|
+
const { appToUntrust: appToUntrust2, untrustApp } = useSecurityStore.getState();
|
|
19036
|
+
if (!!appToUntrust2) {
|
|
19037
|
+
untrustApp(null);
|
|
19038
|
+
} else {
|
|
19039
|
+
useLayoutDataStore.getState().setPage("settings" /* SETTINGS */);
|
|
19040
|
+
}
|
|
18898
19041
|
},
|
|
18899
19042
|
children: /* @__PURE__ */ jsx90(ArrowLeft18, { className: "h-4 w-4" })
|
|
18900
19043
|
}
|
|
18901
19044
|
),
|
|
18902
19045
|
/* @__PURE__ */ jsx90("span", { className: "text-xl font-semibold", children: t("passport:securityMenu.title") })
|
|
18903
19046
|
] }),
|
|
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 })
|
|
19047
|
+
appToUntrust && /* @__PURE__ */ jsx90(UntrustApplication, {}),
|
|
19048
|
+
!appToUntrust && /* @__PURE__ */ jsxs84(Fragment35, { children: [
|
|
19049
|
+
/* @__PURE__ */ jsx90(Keyshare, {}),
|
|
19050
|
+
/* @__PURE__ */ jsx90(ConnectedApps, {})
|
|
19051
|
+
] }),
|
|
19052
|
+
/* @__PURE__ */ jsx90("div", { className: "w-full" }, renderKey)
|
|
18925
19053
|
] })
|
|
18926
19054
|
}
|
|
18927
19055
|
);
|
|
@@ -18929,17 +19057,13 @@ function SecurityMenu() {
|
|
|
18929
19057
|
var init_SecurityMenu = __esm({
|
|
18930
19058
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
18931
19059
|
init_i18n();
|
|
18932
|
-
init_auth();
|
|
18933
19060
|
init_useLayoutDataStore();
|
|
18934
19061
|
init_useLayoutStore();
|
|
18935
|
-
init_iframe_manager();
|
|
18936
19062
|
init_Expandable2();
|
|
18937
19063
|
init_button();
|
|
18938
|
-
|
|
18939
|
-
init_constants5();
|
|
18940
|
-
init_hooks2();
|
|
19064
|
+
init_ConnectedApps2();
|
|
18941
19065
|
init_Keyshare2();
|
|
18942
|
-
|
|
19066
|
+
init_useSecurityStore();
|
|
18943
19067
|
}
|
|
18944
19068
|
});
|
|
18945
19069
|
|
|
@@ -18947,6 +19071,8 @@ var init_SecurityMenu = __esm({
|
|
|
18947
19071
|
var init_SecurityMenu2 = __esm({
|
|
18948
19072
|
"src/internal/components/SecurityMenu/index.ts"() {
|
|
18949
19073
|
init_SecurityMenu();
|
|
19074
|
+
init_ConnectedApps2();
|
|
19075
|
+
init_Keyshare2();
|
|
18950
19076
|
}
|
|
18951
19077
|
});
|
|
18952
19078
|
|
|
@@ -19042,12 +19168,12 @@ var init_wallet = __esm({
|
|
|
19042
19168
|
});
|
|
19043
19169
|
|
|
19044
19170
|
// src/internal/components/SendMenu/useFlowSelector.ts
|
|
19045
|
-
import { create as
|
|
19171
|
+
import { create as create11 } from "zustand";
|
|
19046
19172
|
import { persist as persist2 } from "zustand/middleware";
|
|
19047
19173
|
var useFlowSelectorStore;
|
|
19048
19174
|
var init_useFlowSelector = __esm({
|
|
19049
19175
|
"src/internal/components/SendMenu/useFlowSelector.ts"() {
|
|
19050
|
-
useFlowSelectorStore =
|
|
19176
|
+
useFlowSelectorStore = create11()(
|
|
19051
19177
|
persist2(
|
|
19052
19178
|
(set) => ({
|
|
19053
19179
|
renderKey: Date.now().toString(),
|
|
@@ -19112,7 +19238,7 @@ var init_chains = __esm({
|
|
|
19112
19238
|
});
|
|
19113
19239
|
|
|
19114
19240
|
// src/internal/components/SendMenu/hyperbridge/useBridgeStore.ts
|
|
19115
|
-
import { create as
|
|
19241
|
+
import { create as create12 } from "zustand";
|
|
19116
19242
|
import { persist as persist3 } from "zustand/middleware";
|
|
19117
19243
|
var RESETABLE_STATES, useBridgeStore;
|
|
19118
19244
|
var init_useBridgeStore = __esm({
|
|
@@ -19128,7 +19254,7 @@ var init_useBridgeStore = __esm({
|
|
|
19128
19254
|
isQuoteEstimating: false,
|
|
19129
19255
|
bridgeHistoryItem: null
|
|
19130
19256
|
};
|
|
19131
|
-
useBridgeStore =
|
|
19257
|
+
useBridgeStore = create12()(
|
|
19132
19258
|
persist3(
|
|
19133
19259
|
(set, get) => ({
|
|
19134
19260
|
bridgeSenders: [],
|
|
@@ -19186,7 +19312,7 @@ var init_useBridgeStore = __esm({
|
|
|
19186
19312
|
// src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx
|
|
19187
19313
|
import { useConnectModal } from "@rainbow-me/rainbowkit";
|
|
19188
19314
|
import { useMutation as useMutation19 } from "@tanstack/react-query";
|
|
19189
|
-
import { useEffect as
|
|
19315
|
+
import { useEffect as useEffect36, useRef as useRef18, useState as useState22 } from "react";
|
|
19190
19316
|
import { useSignMessage } from "wagmi";
|
|
19191
19317
|
import { jsx as jsx91, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
19192
19318
|
function SenderSelector(props) {
|
|
@@ -19197,12 +19323,12 @@ function SenderSelector(props) {
|
|
|
19197
19323
|
const { openConnectModal } = useConnectModal();
|
|
19198
19324
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19199
19325
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
19200
|
-
const pendingWalletRef =
|
|
19326
|
+
const pendingWalletRef = useRef18(null);
|
|
19201
19327
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
19202
19328
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
19203
19329
|
const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
|
|
19204
|
-
const [walletMessage, setWalletMessage] =
|
|
19205
|
-
|
|
19330
|
+
const [walletMessage, setWalletMessage] = useState22(null);
|
|
19331
|
+
useEffect36(() => {
|
|
19206
19332
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19207
19333
|
}, [walletMessage]);
|
|
19208
19334
|
const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = useMutation19({
|
|
@@ -19258,7 +19384,7 @@ function SenderSelector(props) {
|
|
|
19258
19384
|
setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
|
|
19259
19385
|
}
|
|
19260
19386
|
});
|
|
19261
|
-
|
|
19387
|
+
useEffect36(() => {
|
|
19262
19388
|
const pendingProfile = pendingWalletRef.current;
|
|
19263
19389
|
if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
|
|
19264
19390
|
if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
|
|
@@ -19431,12 +19557,12 @@ var init_wallets = __esm({
|
|
|
19431
19557
|
});
|
|
19432
19558
|
|
|
19433
19559
|
// src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts
|
|
19434
|
-
import { useEffect as
|
|
19560
|
+
import { useEffect as useEffect37, useRef as useRef19 } from "react";
|
|
19435
19561
|
function useAvailableSenders() {
|
|
19436
19562
|
const address = useSession((st) => st.address);
|
|
19437
19563
|
const { profiles } = useLinkedProfiles();
|
|
19438
|
-
const lastCalcedSenders =
|
|
19439
|
-
|
|
19564
|
+
const lastCalcedSenders = useRef19([]);
|
|
19565
|
+
useEffect37(() => {
|
|
19440
19566
|
const sendersAccumulator = [
|
|
19441
19567
|
{
|
|
19442
19568
|
type: "embarkai-wallet",
|
|
@@ -19798,7 +19924,7 @@ var init_utils8 = __esm({
|
|
|
19798
19924
|
// src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts
|
|
19799
19925
|
import { useInfiniteQuery as useInfiniteQuery3 } from "@tanstack/react-query";
|
|
19800
19926
|
import { debounce as debounce7 } from "lodash-es";
|
|
19801
|
-
import { useCallback as
|
|
19927
|
+
import { useCallback as useCallback26, useEffect as useEffect38, useMemo as useMemo12 } from "react";
|
|
19802
19928
|
function useHyperlaneHistory() {
|
|
19803
19929
|
const address = useSession((st) => st.address);
|
|
19804
19930
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -19818,13 +19944,13 @@ function useHyperlaneHistory() {
|
|
|
19818
19944
|
() => txHistoryData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
19819
19945
|
[txHistoryData]
|
|
19820
19946
|
);
|
|
19821
|
-
const updateExpandable =
|
|
19947
|
+
const updateExpandable = useCallback26(
|
|
19822
19948
|
debounce7(() => {
|
|
19823
19949
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
|
|
19824
19950
|
}, 250),
|
|
19825
19951
|
[]
|
|
19826
19952
|
);
|
|
19827
|
-
|
|
19953
|
+
useEffect38(() => {
|
|
19828
19954
|
if (isBridgeTxHistoryLoading || txList.length === 0) return;
|
|
19829
19955
|
updateExpandable();
|
|
19830
19956
|
}, [isBridgeTxHistoryLoading, txList]);
|
|
@@ -19845,11 +19971,11 @@ var init_useHyperlaneHistory = __esm({
|
|
|
19845
19971
|
});
|
|
19846
19972
|
|
|
19847
19973
|
// src/internal/components/SendMenu/hyperbridge/hooks/useOperationHashesStore.ts
|
|
19848
|
-
import { create as
|
|
19974
|
+
import { create as create13 } from "zustand";
|
|
19849
19975
|
var useOperationHashesStore;
|
|
19850
19976
|
var init_useOperationHashesStore = __esm({
|
|
19851
19977
|
"src/internal/components/SendMenu/hyperbridge/hooks/useOperationHashesStore.ts"() {
|
|
19852
|
-
useOperationHashesStore =
|
|
19978
|
+
useOperationHashesStore = create13((set) => ({
|
|
19853
19979
|
hyperlaneDatabaseTx: null,
|
|
19854
19980
|
operationHashes: [],
|
|
19855
19981
|
setHyperlaneDatabaseTx: (hyperlaneDatabaseTx) => set({ hyperlaneDatabaseTx }),
|
|
@@ -19860,7 +19986,7 @@ var init_useOperationHashesStore = __esm({
|
|
|
19860
19986
|
|
|
19861
19987
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts
|
|
19862
19988
|
import { useMutation as useMutation20, useQueryClient as useQueryClient22 } from "@tanstack/react-query";
|
|
19863
|
-
import { useCallback as
|
|
19989
|
+
import { useCallback as useCallback27 } from "react";
|
|
19864
19990
|
import { useSwitchChain, useWalletClient } from "wagmi";
|
|
19865
19991
|
function useBridge() {
|
|
19866
19992
|
const qc = useQueryClient22();
|
|
@@ -19868,7 +19994,7 @@ function useBridge() {
|
|
|
19868
19994
|
const address = useSession((st) => st.address);
|
|
19869
19995
|
const { data: walletClient } = useWalletClient();
|
|
19870
19996
|
const { switchChainAsync } = useSwitchChain();
|
|
19871
|
-
const swapDirection =
|
|
19997
|
+
const swapDirection = useCallback27(() => {
|
|
19872
19998
|
const {
|
|
19873
19999
|
bridgeStep,
|
|
19874
20000
|
originChain,
|
|
@@ -19920,7 +20046,7 @@ function useBridge() {
|
|
|
19920
20046
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
19921
20047
|
}
|
|
19922
20048
|
});
|
|
19923
|
-
const handleQuoteEstimation =
|
|
20049
|
+
const handleQuoteEstimation = useCallback27((amnt) => {
|
|
19924
20050
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
19925
20051
|
if (!amnt || !Number(amnt)) {
|
|
19926
20052
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -20064,7 +20190,7 @@ var init_useBridge = __esm({
|
|
|
20064
20190
|
|
|
20065
20191
|
// src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts
|
|
20066
20192
|
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
20067
|
-
import { useEffect as
|
|
20193
|
+
import { useEffect as useEffect39 } from "react";
|
|
20068
20194
|
function useHyperlaneRoutes() {
|
|
20069
20195
|
const address = useSession((st) => st.address);
|
|
20070
20196
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -20084,7 +20210,7 @@ function useHyperlaneRoutes() {
|
|
|
20084
20210
|
return warpRoutes;
|
|
20085
20211
|
}
|
|
20086
20212
|
});
|
|
20087
|
-
|
|
20213
|
+
useEffect39(() => {
|
|
20088
20214
|
if (!errorWarpRoutes) return;
|
|
20089
20215
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
20090
20216
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -20093,7 +20219,7 @@ function useHyperlaneRoutes() {
|
|
|
20093
20219
|
setOriginChain(null);
|
|
20094
20220
|
setDestinationChain(null);
|
|
20095
20221
|
}, [errorWarpRoutes]);
|
|
20096
|
-
|
|
20222
|
+
useEffect39(() => {
|
|
20097
20223
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
20098
20224
|
const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
20099
20225
|
if (!warpRouteToAutoSelect) return;
|
|
@@ -20126,13 +20252,13 @@ var init_useHyperlaneRoutes = __esm({
|
|
|
20126
20252
|
});
|
|
20127
20253
|
|
|
20128
20254
|
// src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts
|
|
20129
|
-
import { useEffect as
|
|
20255
|
+
import { useEffect as useEffect40 } from "react";
|
|
20130
20256
|
function useMenuTitle(warpRoutes) {
|
|
20131
20257
|
const { t } = useT();
|
|
20132
20258
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20133
20259
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20134
20260
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
20135
|
-
|
|
20261
|
+
useEffect40(() => {
|
|
20136
20262
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
20137
20263
|
switch (true) {
|
|
20138
20264
|
case bridgeStep === "sender-selector":
|
|
@@ -20184,7 +20310,7 @@ var init_ResolveChainIcon = __esm({
|
|
|
20184
20310
|
// src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts
|
|
20185
20311
|
import { CHAINS_BROWSERS_TRANSPORTS as CHAINS_BROWSERS_TRANSPORTS2 } from "@embarkai/core";
|
|
20186
20312
|
import { useQuery as useQuery19, useQueryClient as useQueryClient23 } from "@tanstack/react-query";
|
|
20187
|
-
import { useCallback as
|
|
20313
|
+
import { useCallback as useCallback28, useEffect as useEffect41 } from "react";
|
|
20188
20314
|
import { createPublicClient as createPublicClient2, erc20Abi as erc20Abi2, formatUnits as formatUnits7, http as http3 } from "viem";
|
|
20189
20315
|
import { useSwitchChain as useSwitchChain2 } from "wagmi";
|
|
20190
20316
|
function checkWrapedTokenSymbol2(symbol) {
|
|
@@ -20279,7 +20405,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20279
20405
|
};
|
|
20280
20406
|
}
|
|
20281
20407
|
});
|
|
20282
|
-
const refreshRouteTokenBalance =
|
|
20408
|
+
const refreshRouteTokenBalance = useCallback28(
|
|
20283
20409
|
(senderWallet) => {
|
|
20284
20410
|
switch (true) {
|
|
20285
20411
|
case senderWallet === "embarkai-wallet":
|
|
@@ -20295,7 +20421,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20295
20421
|
},
|
|
20296
20422
|
[refreshBalances, qc]
|
|
20297
20423
|
);
|
|
20298
|
-
|
|
20424
|
+
useEffect41(() => {
|
|
20299
20425
|
if (!bridgeSender || !originChain) return;
|
|
20300
20426
|
switch (bridgeSender) {
|
|
20301
20427
|
case "embarkai-wallet":
|
|
@@ -20344,9 +20470,9 @@ var init_useBridgeBalance = __esm({
|
|
|
20344
20470
|
});
|
|
20345
20471
|
|
|
20346
20472
|
// src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx
|
|
20347
|
-
import { ArrowLeftRightIcon, ArrowRightLeftIcon, LoaderIcon as
|
|
20348
|
-
import { Fragment as
|
|
20349
|
-
import { Fragment as
|
|
20473
|
+
import { ArrowLeftRightIcon, ArrowRightLeftIcon, LoaderIcon as LoaderIcon11, Wallet2Icon as Wallet2Icon2, XIcon } from "lucide-react";
|
|
20474
|
+
import { Fragment as Fragment36 } from "react";
|
|
20475
|
+
import { Fragment as Fragment37, jsx as jsx95, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
20350
20476
|
function SelectStep(props) {
|
|
20351
20477
|
const { swapChains, hyperlaneWarpRoutes = [], isLoadingWarpRoutes, handleQuoteEstimation } = props;
|
|
20352
20478
|
const { t } = useT();
|
|
@@ -20370,7 +20496,7 @@ function SelectStep(props) {
|
|
|
20370
20496
|
const SelectedWarpRoteIcon = TOKENS_ICONS[(selectedWarpRoute?.symbol || "null_icon").toUpperCase()] || TOKENS_ICONS.EMBARKAI;
|
|
20371
20497
|
const isError = useFlowSelectorStore((st) => !!st.error);
|
|
20372
20498
|
if (isLoadingWarpRoutes) {
|
|
20373
|
-
return /* @__PURE__ */ jsx95("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ jsx95(
|
|
20499
|
+
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
20500
|
}
|
|
20375
20501
|
const isBalanceInsufficient = !routeTokenBalance || Number(amount || 0) > Number(routeTokenBalance || 0);
|
|
20376
20502
|
const isFalsyAmount = !amount || !Number(amount) || Number(amount) <= 0;
|
|
@@ -20418,7 +20544,7 @@ function SelectStep(props) {
|
|
|
20418
20544
|
t("passport:common.balance"),
|
|
20419
20545
|
": "
|
|
20420
20546
|
] }),
|
|
20421
|
-
isRouteTokenBalanceLoading && /* @__PURE__ */ jsx95(
|
|
20547
|
+
isRouteTokenBalanceLoading && /* @__PURE__ */ jsx95(LoaderIcon11, { className: "w-4 h-4 animate-spin text-[var(--ui-kit-fg-muted)]" }),
|
|
20422
20548
|
!isRouteTokenBalanceLoading && /* @__PURE__ */ jsxs88("span", { className: cn("font-semibold", { "text-[var(--ui-kit-bg-error)]": isBalanceInsufficient }), children: [
|
|
20423
20549
|
formatPrice(Number(routeTokenBalance || 0)),
|
|
20424
20550
|
" ",
|
|
@@ -20450,7 +20576,7 @@ function SelectStep(props) {
|
|
|
20450
20576
|
variant: "outline",
|
|
20451
20577
|
size: "medium",
|
|
20452
20578
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
20453
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ jsxs88(
|
|
20579
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ jsxs88(Fragment36, { children: [
|
|
20454
20580
|
chIdx > 0 && /* @__PURE__ */ jsx95(ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
20455
20581
|
/* @__PURE__ */ jsx95(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
20456
20582
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -20473,7 +20599,7 @@ function SelectStep(props) {
|
|
|
20473
20599
|
}
|
|
20474
20600
|
),
|
|
20475
20601
|
/* @__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(
|
|
20602
|
+
/* @__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
20603
|
/* @__PURE__ */ jsx95(ResolveChainIcon, { chainName: originChain, className: "w-6 h-6" }),
|
|
20478
20604
|
/* @__PURE__ */ jsx95("span", { className: "block max-w-[100px] truncate", children: CHAINS_UI_META[originChain]?.chainLabel })
|
|
20479
20605
|
] }) : /* @__PURE__ */ jsx95("span", { className: "text-[var(--ui-kit-fg-muted)]", children: "N/A" }) }),
|
|
@@ -20487,7 +20613,7 @@ function SelectStep(props) {
|
|
|
20487
20613
|
children: /* @__PURE__ */ jsx95(ArrowRightLeftIcon, { className: "w-4 h-4 " })
|
|
20488
20614
|
}
|
|
20489
20615
|
),
|
|
20490
|
-
/* @__PURE__ */ jsx95(Badge, { variant: "outline", size: "large", className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center", children: destinationChain ? /* @__PURE__ */ jsxs88(
|
|
20616
|
+
/* @__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
20617
|
/* @__PURE__ */ jsx95(ResolveChainIcon, { chainName: destinationChain, className: "w-6 h-6" }),
|
|
20492
20618
|
/* @__PURE__ */ jsx95("span", { className: "block max-w-[100px] truncate", children: CHAINS_UI_META[destinationChain]?.chainLabel })
|
|
20493
20619
|
] }) : /* @__PURE__ */ jsx95("span", { className: "text-[var(--ui-kit-fg-muted)]", children: "N/A" }) })
|
|
@@ -20578,7 +20704,7 @@ function SelectStep(props) {
|
|
|
20578
20704
|
onClick: () => handleQuoteEstimation(amount),
|
|
20579
20705
|
disabled: isQuoteEstimationDisabled,
|
|
20580
20706
|
children: [
|
|
20581
|
-
isQuoteEstimating && /* @__PURE__ */ jsx95(
|
|
20707
|
+
isQuoteEstimating && /* @__PURE__ */ jsx95(LoaderIcon11, { className: "h-4 w-4 animate-spin" }),
|
|
20582
20708
|
/* @__PURE__ */ jsx95("span", { children: isBalanceInsufficient ? t("passport:bridgeMenu.statuses.balanceInsufficient").toUpperCase() : t("passport:bridgeMenu.actions.estimateQuote").toUpperCase() })
|
|
20583
20709
|
]
|
|
20584
20710
|
}
|
|
@@ -20633,12 +20759,12 @@ var init_checkbox = __esm({
|
|
|
20633
20759
|
});
|
|
20634
20760
|
|
|
20635
20761
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
20636
|
-
import { LoaderIcon as
|
|
20637
|
-
import { useState as
|
|
20762
|
+
import { LoaderIcon as LoaderIcon12 } from "lucide-react";
|
|
20763
|
+
import { useState as useState23 } from "react";
|
|
20638
20764
|
import { jsx as jsx97, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
20639
20765
|
function ConfirmStep(props) {
|
|
20640
20766
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
20641
|
-
const [userConsent, setUserConsent] =
|
|
20767
|
+
const [userConsent, setUserConsent] = useState23(false);
|
|
20642
20768
|
const { t } = useT();
|
|
20643
20769
|
const address = useSession((st) => st.address);
|
|
20644
20770
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -20740,7 +20866,7 @@ function ConfirmStep(props) {
|
|
|
20740
20866
|
onClick: () => bridgeAsset(),
|
|
20741
20867
|
className: "w-full",
|
|
20742
20868
|
children: [
|
|
20743
|
-
isAssetBridging && /* @__PURE__ */ jsx97(
|
|
20869
|
+
isAssetBridging && /* @__PURE__ */ jsx97(LoaderIcon12, { className: "h-4 w-4 animate-spin" }),
|
|
20744
20870
|
/* @__PURE__ */ jsx97("span", { children: (bridgeTxStatus || t("passport:common.continue")).toUpperCase() })
|
|
20745
20871
|
]
|
|
20746
20872
|
}
|
|
@@ -20857,7 +20983,7 @@ var init_SuccessStep = __esm({
|
|
|
20857
20983
|
// src/internal/components/SendMenu/hyperbridge/steps/HistoryStep.tsx
|
|
20858
20984
|
import { useQueryClient as useQueryClient24 } from "@tanstack/react-query";
|
|
20859
20985
|
import dayjs7 from "dayjs";
|
|
20860
|
-
import { ArrowRightIcon, DownloadIcon as DownloadIcon2, ExternalLinkIcon as ExternalLinkIcon3, InfoIcon as
|
|
20986
|
+
import { ArrowRightIcon, DownloadIcon as DownloadIcon2, ExternalLinkIcon as ExternalLinkIcon3, InfoIcon as InfoIcon5, LoaderIcon as LoaderIcon13 } from "lucide-react";
|
|
20861
20987
|
import { jsx as jsx99, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
20862
20988
|
function HistoryDetailsStep() {
|
|
20863
20989
|
const { t } = useT();
|
|
@@ -21064,7 +21190,7 @@ function HistoryItem(props) {
|
|
|
21064
21190
|
setBridgeStep("tx-history-details");
|
|
21065
21191
|
},
|
|
21066
21192
|
children: [
|
|
21067
|
-
/* @__PURE__ */ jsx99(
|
|
21193
|
+
/* @__PURE__ */ jsx99(InfoIcon5, { className: "w-4 h-4" }),
|
|
21068
21194
|
/* @__PURE__ */ jsx99("span", { className: "text-xs leading-5", children: t("passport:common.details") })
|
|
21069
21195
|
]
|
|
21070
21196
|
}
|
|
@@ -21083,7 +21209,7 @@ function HistoryStep() {
|
|
|
21083
21209
|
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
21210
|
}
|
|
21085
21211
|
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(
|
|
21212
|
+
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
21213
|
!isLoading && txList.map((item) => /* @__PURE__ */ jsx99(HistoryItem, { ...item }, item.id)),
|
|
21088
21214
|
hasNextPage && /* @__PURE__ */ jsxs91(
|
|
21089
21215
|
Button,
|
|
@@ -21094,7 +21220,7 @@ function HistoryStep() {
|
|
|
21094
21220
|
className: "w-full",
|
|
21095
21221
|
onClick: () => fetchNextPage(),
|
|
21096
21222
|
children: [
|
|
21097
|
-
isTxDataFetching ? /* @__PURE__ */ jsx99(
|
|
21223
|
+
isTxDataFetching ? /* @__PURE__ */ jsx99(LoaderIcon13, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsx99(DownloadIcon2, { className: "w-4 h-4" }),
|
|
21098
21224
|
t("passport:common.loadMore")
|
|
21099
21225
|
]
|
|
21100
21226
|
}
|
|
@@ -21123,12 +21249,12 @@ var init_HistoryStep = __esm({
|
|
|
21123
21249
|
|
|
21124
21250
|
// src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx
|
|
21125
21251
|
import { ArrowLeftRightIcon as ArrowLeftRightIcon2 } from "lucide-react";
|
|
21126
|
-
import { useMemo as useMemo13, useState as
|
|
21127
|
-
import { Fragment as
|
|
21252
|
+
import { useMemo as useMemo13, useState as useState24 } from "react";
|
|
21253
|
+
import { Fragment as Fragment38, jsx as jsx100, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
21128
21254
|
function SelectAssetRoute(props) {
|
|
21129
21255
|
const { hyperlaneWarpRoutes } = props;
|
|
21130
21256
|
const { t } = useT();
|
|
21131
|
-
const [isTokenSymbolSelector, setIsTokenSymbolSelector] =
|
|
21257
|
+
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = useState24(false);
|
|
21132
21258
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
21133
21259
|
const tokenList = useMemo13(() => {
|
|
21134
21260
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
@@ -21170,13 +21296,13 @@ function SelectAssetRoute(props) {
|
|
|
21170
21296
|
setIsTokenSymbolSelector(true);
|
|
21171
21297
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-route-asset-selector-${Date.now()}`);
|
|
21172
21298
|
},
|
|
21173
|
-
children: selectedAsset ? /* @__PURE__ */ jsxs92(
|
|
21299
|
+
children: selectedAsset ? /* @__PURE__ */ jsxs92(Fragment38, { children: [
|
|
21174
21300
|
/* @__PURE__ */ jsx100(selectedAsset.Icon, { className: "w-6 h-6" }),
|
|
21175
21301
|
selectedAsset.symbol
|
|
21176
21302
|
] }) : t("passport:bridgeMenu.actions.selectAsset")
|
|
21177
21303
|
}
|
|
21178
21304
|
),
|
|
21179
|
-
availableChainPairs.length > 0 && /* @__PURE__ */ jsxs92(
|
|
21305
|
+
availableChainPairs.length > 0 && /* @__PURE__ */ jsxs92(Fragment38, { children: [
|
|
21180
21306
|
/* @__PURE__ */ jsx100("span", { className: "block text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:bridgeMenu.labels.availableChainPairs") }),
|
|
21181
21307
|
/* @__PURE__ */ jsx100("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: availableChainPairs.map(([fromChain, toChain]) => /* @__PURE__ */ jsxs92(
|
|
21182
21308
|
Button,
|
|
@@ -21251,20 +21377,20 @@ var init_steps = __esm({
|
|
|
21251
21377
|
});
|
|
21252
21378
|
|
|
21253
21379
|
// src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx
|
|
21254
|
-
import { useEffect as
|
|
21255
|
-
import { Fragment as
|
|
21380
|
+
import { useEffect as useEffect42 } from "react";
|
|
21381
|
+
import { Fragment as Fragment39, jsx as jsx101, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
21256
21382
|
function HyperlaneBridge() {
|
|
21257
21383
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21258
21384
|
const { swapDirection, handleQuoteEstimation, bridgeAsset, isAssetBridging } = useBridge();
|
|
21259
21385
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21260
21386
|
const { directWalletProfile } = useAvailableSenders();
|
|
21261
21387
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21262
|
-
|
|
21388
|
+
useEffect42(() => {
|
|
21263
21389
|
return () => {
|
|
21264
21390
|
useBridgeStore.getState().resetSelections();
|
|
21265
21391
|
};
|
|
21266
21392
|
}, []);
|
|
21267
|
-
return /* @__PURE__ */ jsxs93(
|
|
21393
|
+
return /* @__PURE__ */ jsxs93(Fragment39, { children: [
|
|
21268
21394
|
bridgeStep === "sender-selector" && /* @__PURE__ */ jsx101(SenderSelector, { directWalletProfile }),
|
|
21269
21395
|
bridgeStep === "select" && /* @__PURE__ */ jsx101(
|
|
21270
21396
|
SelectStep,
|
|
@@ -21305,14 +21431,14 @@ var init_HyperlaneBridge = __esm({
|
|
|
21305
21431
|
});
|
|
21306
21432
|
|
|
21307
21433
|
// src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx
|
|
21308
|
-
import { useRef as
|
|
21434
|
+
import { useRef as useRef20 } from "react";
|
|
21309
21435
|
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
21310
21436
|
function BridgeHistorySwitch(props) {
|
|
21311
21437
|
const { disabled } = props;
|
|
21312
21438
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
21313
21439
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
21314
21440
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21315
|
-
const lastBridgeStepRef =
|
|
21441
|
+
const lastBridgeStepRef = useRef20(null);
|
|
21316
21442
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
21317
21443
|
return null;
|
|
21318
21444
|
}
|
|
@@ -21414,7 +21540,7 @@ var init_useErc3643Compliance = __esm({
|
|
|
21414
21540
|
|
|
21415
21541
|
// src/hooks/useNicknameResolve.ts
|
|
21416
21542
|
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
21417
|
-
import { useEffect as
|
|
21543
|
+
import { useEffect as useEffect43, useMemo as useMemo14, useState as useState25 } from "react";
|
|
21418
21544
|
function looksLikeNickname(input) {
|
|
21419
21545
|
if (!input) return false;
|
|
21420
21546
|
if (input.startsWith("0x")) return false;
|
|
@@ -21424,11 +21550,11 @@ function looksLikeNickname(input) {
|
|
|
21424
21550
|
}
|
|
21425
21551
|
function useNicknameResolve(input, options) {
|
|
21426
21552
|
const { enabled = true, chainId } = options;
|
|
21427
|
-
const [debouncedInput, setDebouncedInput] =
|
|
21428
|
-
const [isDebouncing, setIsDebouncing] =
|
|
21553
|
+
const [debouncedInput, setDebouncedInput] = useState25("");
|
|
21554
|
+
const [isDebouncing, setIsDebouncing] = useState25(false);
|
|
21429
21555
|
const normalized = normalizeNickname(input);
|
|
21430
21556
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
21431
|
-
|
|
21557
|
+
useEffect43(() => {
|
|
21432
21558
|
if (!isNicknameInput || !enabled) {
|
|
21433
21559
|
setDebouncedInput("");
|
|
21434
21560
|
setIsDebouncing(false);
|
|
@@ -21488,15 +21614,15 @@ var init_useNicknameResolve = __esm({
|
|
|
21488
21614
|
});
|
|
21489
21615
|
|
|
21490
21616
|
// src/hooks/useSendTransaction.ts
|
|
21491
|
-
import { useCallback as
|
|
21617
|
+
import { useCallback as useCallback29, useState as useState26 } from "react";
|
|
21492
21618
|
import { encodeFunctionData as encodeFunctionData2, isAddress, parseEther as parseEther2, parseUnits } from "viem";
|
|
21493
21619
|
function useSendTransaction() {
|
|
21494
21620
|
const session = useSession((st) => st.session);
|
|
21495
21621
|
const address = useSession((st) => st.address);
|
|
21496
|
-
const [isLoading, setIsLoading] =
|
|
21497
|
-
const [error, setError] =
|
|
21498
|
-
const [userOpHash, setUserOpHash] =
|
|
21499
|
-
const sendTransaction =
|
|
21622
|
+
const [isLoading, setIsLoading] = useState26(false);
|
|
21623
|
+
const [error, setError] = useState26(null);
|
|
21624
|
+
const [userOpHash, setUserOpHash] = useState26(null);
|
|
21625
|
+
const sendTransaction = useCallback29(
|
|
21500
21626
|
async (params) => {
|
|
21501
21627
|
if (!session || !address) {
|
|
21502
21628
|
setError("No active session");
|
|
@@ -21593,7 +21719,7 @@ function useSendTransaction() {
|
|
|
21593
21719
|
},
|
|
21594
21720
|
[session, address]
|
|
21595
21721
|
);
|
|
21596
|
-
const reset =
|
|
21722
|
+
const reset = useCallback29(() => {
|
|
21597
21723
|
setError(null);
|
|
21598
21724
|
setUserOpHash(null);
|
|
21599
21725
|
setIsLoading(false);
|
|
@@ -21748,10 +21874,10 @@ var init_AssetInputIcon = __esm({
|
|
|
21748
21874
|
|
|
21749
21875
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
21750
21876
|
import { Image as ImageIcon2, Sparkles as Sparkles2 } from "lucide-react";
|
|
21751
|
-
import { useState as
|
|
21877
|
+
import { useState as useState27 } from "react";
|
|
21752
21878
|
import { jsx as jsx104, jsxs as jsxs95 } from "react/jsx-runtime";
|
|
21753
21879
|
function NftDisplayCard({ asset }) {
|
|
21754
|
-
const [imageError, setImageError] =
|
|
21880
|
+
const [imageError, setImageError] = useState27(false);
|
|
21755
21881
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
21756
21882
|
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
21883
|
nftImage && !imageError ? /* @__PURE__ */ jsx104(
|
|
@@ -21785,12 +21911,12 @@ var init_NftDisplayCard = __esm({
|
|
|
21785
21911
|
});
|
|
21786
21912
|
|
|
21787
21913
|
// src/internal/components/SendMenu/send/useSendStore.ts
|
|
21788
|
-
import { create as
|
|
21914
|
+
import { create as create14 } from "zustand";
|
|
21789
21915
|
var useSendStore;
|
|
21790
21916
|
var init_useSendStore = __esm({
|
|
21791
21917
|
"src/internal/components/SendMenu/send/useSendStore.ts"() {
|
|
21792
21918
|
init_useFlowSelector();
|
|
21793
|
-
useSendStore =
|
|
21919
|
+
useSendStore = create14((set) => ({
|
|
21794
21920
|
recipient: "",
|
|
21795
21921
|
//
|
|
21796
21922
|
amount: "",
|
|
@@ -21825,7 +21951,7 @@ var init_useSendStore = __esm({
|
|
|
21825
21951
|
|
|
21826
21952
|
// src/internal/components/SendMenu/send/components/AssetList.tsx
|
|
21827
21953
|
import { formatUnits as formatUnits9 } from "viem";
|
|
21828
|
-
import { Fragment as
|
|
21954
|
+
import { Fragment as Fragment40, jsx as jsx105, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
21829
21955
|
function getAssetBalance3(asset) {
|
|
21830
21956
|
if (isNftAsset3(asset)) return "1";
|
|
21831
21957
|
const balance = Number(formatUnits9(BigInt(asset?.balance || "0"), asset?.decimals || 18));
|
|
@@ -21862,13 +21988,13 @@ function AssetListItem(props) {
|
|
|
21862
21988
|
" \xB7 ",
|
|
21863
21989
|
truncateMiddle(asset.address, 6, 4)
|
|
21864
21990
|
] }),
|
|
21865
|
-
/* @__PURE__ */ jsx105("span", { className: "block text-lg font-bold", children: isNft ? /* @__PURE__ */ jsxs96(
|
|
21991
|
+
/* @__PURE__ */ jsx105("span", { className: "block text-lg font-bold", children: isNft ? /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21866
21992
|
asset.symbol,
|
|
21867
21993
|
asset.tokenId && /* @__PURE__ */ jsxs96("span", { className: "ml-1", children: [
|
|
21868
21994
|
"#",
|
|
21869
21995
|
asset.tokenId.length > 6 ? `${asset.tokenId.slice(0, 4)}...` : asset.tokenId
|
|
21870
21996
|
] })
|
|
21871
|
-
] }) : /* @__PURE__ */ jsxs96(
|
|
21997
|
+
] }) : /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21872
21998
|
BALANCE_PREFIXES[asset.symbol] || null,
|
|
21873
21999
|
/* @__PURE__ */ jsx105("span", { children: getAssetBalance3(asset) }),
|
|
21874
22000
|
" ",
|
|
@@ -21893,20 +22019,20 @@ function AssetList(props) {
|
|
|
21893
22019
|
const tokenAssets = transferableAssets.filter((a) => a.type === "erc20");
|
|
21894
22020
|
const securityAssets = transferableAssets.filter((a) => a.type === "erc3643");
|
|
21895
22021
|
const nftAssets = transferableAssets.filter((a) => a.type === "erc721" || a.type === "erc1155");
|
|
21896
|
-
return /* @__PURE__ */ jsxs96(
|
|
21897
|
-
nativeAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22022
|
+
return /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
22023
|
+
nativeAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21898
22024
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "Crypto" }),
|
|
21899
22025
|
nativeAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `native-${asset.symbol}`))
|
|
21900
22026
|
] }),
|
|
21901
|
-
tokenAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22027
|
+
tokenAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21902
22028
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "Tokens" }),
|
|
21903
22029
|
tokenAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `token-${asset.address}`))
|
|
21904
22030
|
] }),
|
|
21905
|
-
securityAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22031
|
+
securityAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21906
22032
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "Security Tokens" }),
|
|
21907
22033
|
securityAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `security-${asset.address}`))
|
|
21908
22034
|
] }),
|
|
21909
|
-
nftAssets.length > 0 && /* @__PURE__ */ jsxs96(
|
|
22035
|
+
nftAssets.length > 0 && /* @__PURE__ */ jsxs96(Fragment40, { children: [
|
|
21910
22036
|
/* @__PURE__ */ jsx105("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] uppercase", children: "NFTs" }),
|
|
21911
22037
|
nftAssets.map((asset) => /* @__PURE__ */ jsx105(AssetListItem, { asset }, `nft-${asset.address}-${asset.tokenId}`))
|
|
21912
22038
|
] }),
|
|
@@ -21927,7 +22053,7 @@ var init_AssetList = __esm({
|
|
|
21927
22053
|
|
|
21928
22054
|
// src/internal/components/SendMenu/send/components/NicknameData.tsx
|
|
21929
22055
|
import { AtSign, CheckCircle2 as CheckCircle24, ShieldAlert, ShieldCheck as ShieldCheck2 } from "lucide-react";
|
|
21930
|
-
import { useEffect as
|
|
22056
|
+
import { useEffect as useEffect44 } from "react";
|
|
21931
22057
|
import { jsx as jsx106, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
21932
22058
|
function NicknameData(props) {
|
|
21933
22059
|
const { resolvedNicknameData, isNicknameInput } = props;
|
|
@@ -21940,11 +22066,11 @@ function NicknameData(props) {
|
|
|
21940
22066
|
isWalletNotSetup,
|
|
21941
22067
|
isFrozen
|
|
21942
22068
|
} = resolvedNicknameData;
|
|
21943
|
-
|
|
22069
|
+
useEffect44(() => {
|
|
21944
22070
|
if (!resolvedNicknameData?.data?.fingerprint || !isNicknameInput) return;
|
|
21945
22071
|
useFlowSelectorStore.getState().setRenderKey(`nickname-resolved-${Date.now()}`);
|
|
21946
22072
|
}, [resolvedNicknameData, isNicknameInput]);
|
|
21947
|
-
|
|
22073
|
+
useEffect44(() => {
|
|
21948
22074
|
if (isResolving) return;
|
|
21949
22075
|
let errMessage = null;
|
|
21950
22076
|
switch (true) {
|
|
@@ -22105,9 +22231,9 @@ var init_useTokenBalance = __esm({
|
|
|
22105
22231
|
});
|
|
22106
22232
|
|
|
22107
22233
|
// src/internal/components/SendMenu/send/sendSteps/InputSendStep.tsx
|
|
22108
|
-
import { AlertCircle as
|
|
22234
|
+
import { AlertCircle as AlertCircle4, AtSign as AtSign2, CheckCircle2 as CheckCircle25, Loader as Loader21, Wallet2 as Wallet24 } from "lucide-react";
|
|
22109
22235
|
import { formatUnits as formatUnits11, isAddress as isAddress2 } from "viem";
|
|
22110
|
-
import { Fragment as
|
|
22236
|
+
import { Fragment as Fragment41, jsx as jsx107, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
22111
22237
|
function InputSendStep(props) {
|
|
22112
22238
|
const { erc3643Compliance, isNicknameInput, resolvedNicknameData, isAssetsLoading } = props;
|
|
22113
22239
|
const address = useSession((st) => st.address);
|
|
@@ -22206,7 +22332,7 @@ function InputSendStep(props) {
|
|
|
22206
22332
|
setError(null);
|
|
22207
22333
|
return true;
|
|
22208
22334
|
};
|
|
22209
|
-
return /* @__PURE__ */ jsxs98(
|
|
22335
|
+
return /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22210
22336
|
/* @__PURE__ */ jsx107("span", { className: "block text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:sendMenu.selectAsset") }),
|
|
22211
22337
|
/* @__PURE__ */ jsxs98(
|
|
22212
22338
|
Button,
|
|
@@ -22270,14 +22396,14 @@ function InputSendStep(props) {
|
|
|
22270
22396
|
{
|
|
22271
22397
|
type: isComplianceLoading ? "info" : erc3643CanTransfer ? "success" : "error",
|
|
22272
22398
|
className: "flex gap-[var(--ui-kit-gap)]",
|
|
22273
|
-
children: isComplianceLoading ? /* @__PURE__ */ jsxs98(
|
|
22399
|
+
children: isComplianceLoading ? /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22274
22400
|
/* @__PURE__ */ jsx107(Loader21, { className: "h-4 w-4 animate-spin" }),
|
|
22275
22401
|
/* @__PURE__ */ jsx107("span", { children: "Checking compliance..." })
|
|
22276
|
-
] }) : erc3643CanTransfer ? /* @__PURE__ */ jsxs98(
|
|
22402
|
+
] }) : erc3643CanTransfer ? /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22277
22403
|
/* @__PURE__ */ jsx107(CheckCircle25, { className: "h-4 w-4" }),
|
|
22278
22404
|
/* @__PURE__ */ jsx107("span", { children: "Transfer compliant" })
|
|
22279
|
-
] }) : /* @__PURE__ */ jsxs98(
|
|
22280
|
-
/* @__PURE__ */ jsx107(
|
|
22405
|
+
] }) : /* @__PURE__ */ jsxs98(Fragment41, { children: [
|
|
22406
|
+
/* @__PURE__ */ jsx107(AlertCircle4, { className: "h-4 w-4" }),
|
|
22281
22407
|
/* @__PURE__ */ jsx107("span", { children: complianceError || "Transfer not allowed" })
|
|
22282
22408
|
] })
|
|
22283
22409
|
}
|
|
@@ -22316,7 +22442,7 @@ var init_InputSendStep = __esm({
|
|
|
22316
22442
|
// src/internal/components/SendMenu/send/sendSteps/ConfirmSendStep.tsx
|
|
22317
22443
|
import { useMutation as useMutation21 } from "@tanstack/react-query";
|
|
22318
22444
|
import { AlertTriangle as AlertTriangle5, AtSign as AtSign3, Loader as Loader27, Shield as Shield2, ShieldAlert as ShieldAlert2, ShieldCheck as ShieldCheck3 } from "lucide-react";
|
|
22319
|
-
import { Fragment as
|
|
22445
|
+
import { Fragment as Fragment42, jsx as jsx108, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
22320
22446
|
function ConfirmSendStep(props) {
|
|
22321
22447
|
const { sendTransaction, erc3643Compliance, isNicknameInput, resolvedNicknameData } = props;
|
|
22322
22448
|
const { t } = useT();
|
|
@@ -22353,7 +22479,7 @@ function ConfirmSendStep(props) {
|
|
|
22353
22479
|
useFlowSelectorStore.getState().setError(error?.message || "Transaction failed");
|
|
22354
22480
|
}
|
|
22355
22481
|
});
|
|
22356
|
-
return /* @__PURE__ */ jsxs99(
|
|
22482
|
+
return /* @__PURE__ */ jsxs99(Fragment42, { children: [
|
|
22357
22483
|
isNicknameInput && isFrozen && /* @__PURE__ */ jsxs99(Highlight, { type: "warning", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
22358
22484
|
/* @__PURE__ */ jsx108(AlertTriangle5, { className: "h-4 w-4" }),
|
|
22359
22485
|
/* @__PURE__ */ jsx108("span", { children: "This handle is frozen. Proceed with caution." })
|
|
@@ -22373,7 +22499,7 @@ function ConfirmSendStep(props) {
|
|
|
22373
22499
|
selectedAsset.symbol
|
|
22374
22500
|
] })
|
|
22375
22501
|
] }),
|
|
22376
|
-
/* @__PURE__ */ jsx108(Highlight, { type: "info", className: "flex flex-col gap-[var(--ui-kit-gap)]", children: isNicknameInput && nicknameData ? /* @__PURE__ */ jsxs99(
|
|
22502
|
+
/* @__PURE__ */ jsx108(Highlight, { type: "info", className: "flex flex-col gap-[var(--ui-kit-gap)]", children: isNicknameInput && nicknameData ? /* @__PURE__ */ jsxs99(Fragment42, { children: [
|
|
22377
22503
|
/* @__PURE__ */ jsxs99("div", { className: "flex items-start gap-[var(--ui-kit-gap)]", children: [
|
|
22378
22504
|
nicknameData.avatarSvg ? /* @__PURE__ */ jsx108(
|
|
22379
22505
|
"img",
|
|
@@ -22431,7 +22557,7 @@ function ConfirmSendStep(props) {
|
|
|
22431
22557
|
/* @__PURE__ */ jsx108("span", { className: "text-sm font-bold", children: chainConfig.name })
|
|
22432
22558
|
] })
|
|
22433
22559
|
] })
|
|
22434
|
-
] }) : /* @__PURE__ */ jsxs99(
|
|
22560
|
+
] }) : /* @__PURE__ */ jsxs99(Fragment42, { children: [
|
|
22435
22561
|
/* @__PURE__ */ jsx108("h3", { className: "font-medium mb-3 text-[var(--ui-kit-fg)]", children: "Transaction Details" }),
|
|
22436
22562
|
/* @__PURE__ */ jsxs99("div", { className: "space-y-2 text-sm text-[var(--ui-kit-fg)]", children: [
|
|
22437
22563
|
/* @__PURE__ */ jsxs99("div", { className: "flex justify-between", children: [
|
|
@@ -22440,7 +22566,7 @@ function ConfirmSendStep(props) {
|
|
|
22440
22566
|
] }),
|
|
22441
22567
|
isNft ? (
|
|
22442
22568
|
// NFT details
|
|
22443
|
-
/* @__PURE__ */ jsx108(
|
|
22569
|
+
/* @__PURE__ */ jsx108(Fragment42, { children: /* @__PURE__ */ jsxs99("div", { className: "flex justify-between items-start", children: [
|
|
22444
22570
|
/* @__PURE__ */ jsx108("span", { className: "text-[var(--ui-kit-fg-muted)]", children: "NFT:" }),
|
|
22445
22571
|
/* @__PURE__ */ jsxs99("div", { className: "text-right", children: [
|
|
22446
22572
|
/* @__PURE__ */ jsx108("span", { className: "font-semibold block", children: selectedAsset.nftMetadata?.name || selectedAsset.name }),
|
|
@@ -22506,9 +22632,9 @@ var init_sendSteps = __esm({
|
|
|
22506
22632
|
|
|
22507
22633
|
// src/internal/components/SendMenu/send/SendMenu.tsx
|
|
22508
22634
|
import { CheckCircle2 as CheckCircle26, Loader as Loader28 } from "lucide-react";
|
|
22509
|
-
import { useEffect as
|
|
22635
|
+
import { useEffect as useEffect45, useMemo as useMemo15 } from "react";
|
|
22510
22636
|
import { parseUnits as parseUnits2 } from "viem";
|
|
22511
|
-
import { Fragment as
|
|
22637
|
+
import { Fragment as Fragment43, jsx as jsx109, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
22512
22638
|
function SendMenu() {
|
|
22513
22639
|
const address = useSession((st) => st.address);
|
|
22514
22640
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
@@ -22527,10 +22653,10 @@ function SendMenu() {
|
|
|
22527
22653
|
userOpHash,
|
|
22528
22654
|
reset
|
|
22529
22655
|
} = useSendTransaction();
|
|
22530
|
-
|
|
22656
|
+
useEffect45(() => {
|
|
22531
22657
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
22532
22658
|
}, [isAssetsLoading, isTransactionPending]);
|
|
22533
|
-
|
|
22659
|
+
useEffect45(() => {
|
|
22534
22660
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
22535
22661
|
}, [sendTransactionError]);
|
|
22536
22662
|
const {
|
|
@@ -22545,7 +22671,7 @@ function SendMenu() {
|
|
|
22545
22671
|
} = useSendStore();
|
|
22546
22672
|
const isNft = isNftAsset3(selectedAsset);
|
|
22547
22673
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22548
|
-
|
|
22674
|
+
useEffect45(() => {
|
|
22549
22675
|
const shouldDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
22550
22676
|
if (!shouldDefaultAsset) return;
|
|
22551
22677
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -22555,7 +22681,7 @@ function SendMenu() {
|
|
|
22555
22681
|
if (isBalance(erc20)) return setSelectedAsset(erc20);
|
|
22556
22682
|
setSelectedAsset(assets[0]);
|
|
22557
22683
|
}, [assets, selectedAsset]);
|
|
22558
|
-
|
|
22684
|
+
useEffect45(
|
|
22559
22685
|
() => () => {
|
|
22560
22686
|
setSelectedAsset(null);
|
|
22561
22687
|
setRecipient("");
|
|
@@ -22583,7 +22709,7 @@ function SendMenu() {
|
|
|
22583
22709
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
22584
22710
|
chainId: activeChainId
|
|
22585
22711
|
});
|
|
22586
|
-
|
|
22712
|
+
useEffect45(() => {
|
|
22587
22713
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
22588
22714
|
switch (true) {
|
|
22589
22715
|
case txStep === "select-asset":
|
|
@@ -22606,7 +22732,7 @@ function SendMenu() {
|
|
|
22606
22732
|
break;
|
|
22607
22733
|
}
|
|
22608
22734
|
}, [txStep, selectedAsset, isNft, t]);
|
|
22609
|
-
return /* @__PURE__ */ jsxs100(
|
|
22735
|
+
return /* @__PURE__ */ jsxs100(Fragment43, { children: [
|
|
22610
22736
|
txStep === "select-asset" && /* @__PURE__ */ jsx109(AssetList, { assets }),
|
|
22611
22737
|
txStep === "input" && /* @__PURE__ */ jsx109(
|
|
22612
22738
|
InputSendStep,
|
|
@@ -22633,7 +22759,7 @@ function SendMenu() {
|
|
|
22633
22759
|
/* @__PURE__ */ jsx109("span", { children: t("passport:sendMenu.pendingStepMsg") })
|
|
22634
22760
|
] })
|
|
22635
22761
|
] }),
|
|
22636
|
-
txStep === "success" && userOpHash && /* @__PURE__ */ jsxs100(
|
|
22762
|
+
txStep === "success" && userOpHash && /* @__PURE__ */ jsxs100(Fragment43, { children: [
|
|
22637
22763
|
/* @__PURE__ */ jsxs100(Highlight, { type: "success", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
22638
22764
|
/* @__PURE__ */ jsx109(CheckCircle26, { className: "h-4 w-4" }),
|
|
22639
22765
|
/* @__PURE__ */ jsxs100("span", { className: "flex-1", children: [
|
|
@@ -22681,8 +22807,8 @@ var init_send = __esm({
|
|
|
22681
22807
|
});
|
|
22682
22808
|
|
|
22683
22809
|
// src/internal/components/SendMenu/SendFlowSelector.tsx
|
|
22684
|
-
import { ArrowLeft as ArrowLeft19, ArrowRightIcon as ArrowRightIcon2, ArrowRightLeftIcon as ArrowRightLeftIcon2, InfoIcon as
|
|
22685
|
-
import { useEffect as
|
|
22810
|
+
import { ArrowLeft as ArrowLeft19, ArrowRightIcon as ArrowRightIcon2, ArrowRightLeftIcon as ArrowRightLeftIcon2, InfoIcon as InfoIcon6 } from "lucide-react";
|
|
22811
|
+
import { useEffect as useEffect46 } from "react";
|
|
22686
22812
|
import { jsx as jsx110, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
22687
22813
|
function SelectorFlowButtons() {
|
|
22688
22814
|
const { t } = useT();
|
|
@@ -22745,7 +22871,7 @@ function SendFlowSelector() {
|
|
|
22745
22871
|
const error = useFlowSelectorStore((st) => st.error);
|
|
22746
22872
|
const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
|
|
22747
22873
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
22748
|
-
|
|
22874
|
+
useEffect46(
|
|
22749
22875
|
() => () => {
|
|
22750
22876
|
useFlowSelectorStore.getState().setError(null);
|
|
22751
22877
|
},
|
|
@@ -22803,7 +22929,7 @@ function SendFlowSelector() {
|
|
|
22803
22929
|
SELECTOR_FLOW[selectorFlow],
|
|
22804
22930
|
error && /* @__PURE__ */ jsxs101(Highlight, { type: "error", className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
22805
22931
|
/* @__PURE__ */ jsxs101("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
22806
|
-
/* @__PURE__ */ jsx110(
|
|
22932
|
+
/* @__PURE__ */ jsx110(InfoIcon6, { className: "h-4 w-4 flex-none" }),
|
|
22807
22933
|
/* @__PURE__ */ jsx110("span", { children: error })
|
|
22808
22934
|
] }),
|
|
22809
22935
|
/* @__PURE__ */ jsx110(
|
|
@@ -22911,7 +23037,7 @@ var init_constants6 = __esm({
|
|
|
22911
23037
|
// src/internal/components/SettingsMenu/SettingsMenu.tsx
|
|
22912
23038
|
import { useQuery as useQuery22 } from "@tanstack/react-query";
|
|
22913
23039
|
import { ArrowLeft as ArrowLeft20, HardDrive as HardDrive3 } from "lucide-react";
|
|
22914
|
-
import { useEffect as
|
|
23040
|
+
import { useEffect as useEffect47 } from "react";
|
|
22915
23041
|
import { jsx as jsx111, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
22916
23042
|
function useSettingsButtons() {
|
|
22917
23043
|
const config = useProviderConfig().config;
|
|
@@ -22930,7 +23056,7 @@ function useSettingsButtons() {
|
|
|
22930
23056
|
if (proMode) {
|
|
22931
23057
|
settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: HardDrive3 });
|
|
22932
23058
|
}
|
|
22933
|
-
|
|
23059
|
+
useEffect47(() => {
|
|
22934
23060
|
const cssvEl = document.querySelector(".embarkai-ui-scope");
|
|
22935
23061
|
if (!cssvEl || !window?.getComputedStyle) {
|
|
22936
23062
|
return;
|
|
@@ -23738,7 +23864,7 @@ var init_utils10 = __esm({
|
|
|
23738
23864
|
|
|
23739
23865
|
// src/internal/components/TransactionsMenu/TransactionsGroup.tsx
|
|
23740
23866
|
import { ChevronDown, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight5, ChevronUp, Copy as Copy3 } from "lucide-react";
|
|
23741
|
-
import { Fragment as
|
|
23867
|
+
import { Fragment as Fragment44, jsx as jsx113, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
23742
23868
|
function InternalTransaction({ internal, assetSymbol, assetDecimals }) {
|
|
23743
23869
|
const internalSymbol = internal.assetSymbol || assetSymbol;
|
|
23744
23870
|
const internalDecimals = internal.decimals ?? assetDecimals;
|
|
@@ -23813,7 +23939,7 @@ function TransactionsGroup(props) {
|
|
|
23813
23939
|
}
|
|
23814
23940
|
) })
|
|
23815
23941
|
] }),
|
|
23816
|
-
internalsToRender.length > 0 && /* @__PURE__ */ jsxs104(
|
|
23942
|
+
internalsToRender.length > 0 && /* @__PURE__ */ jsxs104(Fragment44, { children: [
|
|
23817
23943
|
/* @__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
23944
|
/* @__PURE__ */ jsxs104(
|
|
23819
23945
|
"div",
|
|
@@ -23869,7 +23995,7 @@ var init_TransactionsGroup = __esm({
|
|
|
23869
23995
|
// src/internal/components/TransactionsMenu/TransactionsMenu.tsx
|
|
23870
23996
|
import { useQuery as useQuery23, useQueryClient as useQueryClient25 } from "@tanstack/react-query";
|
|
23871
23997
|
import { ArrowLeft as ArrowLeft22, Loader as Loader29, RefreshCw as RefreshCw3, XCircle } from "lucide-react";
|
|
23872
|
-
import { useCallback as
|
|
23998
|
+
import { useCallback as useCallback30, useState as useState28 } from "react";
|
|
23873
23999
|
import { jsx as jsx114, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
23874
24000
|
function TransactionsMenu() {
|
|
23875
24001
|
const qc = useQueryClient25();
|
|
@@ -23878,7 +24004,7 @@ function TransactionsMenu() {
|
|
|
23878
24004
|
const { t } = useT();
|
|
23879
24005
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
23880
24006
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
23881
|
-
const [expandedGroups, setExpandedGroups] =
|
|
24007
|
+
const [expandedGroups, setExpandedGroups] = useState28({});
|
|
23882
24008
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
23883
24009
|
const {
|
|
23884
24010
|
data: txHistoryGroups = [],
|
|
@@ -23891,7 +24017,7 @@ function TransactionsMenu() {
|
|
|
23891
24017
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
23892
24018
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
23893
24019
|
});
|
|
23894
|
-
const refreshTxHistory =
|
|
24020
|
+
const refreshTxHistory = useCallback30(
|
|
23895
24021
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
23896
24022
|
[qc, chainConfig.id, address]
|
|
23897
24023
|
);
|
|
@@ -24130,7 +24256,7 @@ var init_PageMap = __esm({
|
|
|
24130
24256
|
});
|
|
24131
24257
|
|
|
24132
24258
|
// src/internal/hooks/usePageMapper.tsx
|
|
24133
|
-
import { useCallback as
|
|
24259
|
+
import { useCallback as useCallback31, useEffect as useEffect48 } from "react";
|
|
24134
24260
|
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
24135
24261
|
function usePageMapper() {
|
|
24136
24262
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -24142,7 +24268,7 @@ function usePageMapper() {
|
|
|
24142
24268
|
setIsDialogOpen,
|
|
24143
24269
|
setIsDialogClosing
|
|
24144
24270
|
} = useLayoutStore();
|
|
24145
|
-
const closeDialog =
|
|
24271
|
+
const closeDialog = useCallback31(() => {
|
|
24146
24272
|
setIsDialogClosing(true);
|
|
24147
24273
|
setTimeout(() => {
|
|
24148
24274
|
setDialogContent(null);
|
|
@@ -24153,7 +24279,7 @@ function usePageMapper() {
|
|
|
24153
24279
|
setIsDialogOpen(false);
|
|
24154
24280
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
24155
24281
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
24156
|
-
const openDialog =
|
|
24282
|
+
const openDialog = useCallback31(
|
|
24157
24283
|
(pageItem) => {
|
|
24158
24284
|
const PageContentComponent = pageItem.component;
|
|
24159
24285
|
setDialogTitle(pageItem.title);
|
|
@@ -24163,7 +24289,7 @@ function usePageMapper() {
|
|
|
24163
24289
|
},
|
|
24164
24290
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
24165
24291
|
);
|
|
24166
|
-
|
|
24292
|
+
useEffect48(() => {
|
|
24167
24293
|
if (page === null) return closeDialog();
|
|
24168
24294
|
const pageItem = PAGE_MAP[page];
|
|
24169
24295
|
if (!pageItem) {
|
|
@@ -24187,7 +24313,7 @@ var init_usePageMapper = __esm({
|
|
|
24187
24313
|
|
|
24188
24314
|
// src/internal/hooks/useSettingsNotifications.ts
|
|
24189
24315
|
import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
24190
|
-
import { useEffect as
|
|
24316
|
+
import { useEffect as useEffect49 } from "react";
|
|
24191
24317
|
function useSettingsNotifications() {
|
|
24192
24318
|
const address = useSession((st) => st.address);
|
|
24193
24319
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
@@ -24199,14 +24325,14 @@ function useSettingsNotifications() {
|
|
|
24199
24325
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24200
24326
|
queryFn: getUserProfile
|
|
24201
24327
|
});
|
|
24202
|
-
|
|
24328
|
+
useEffect49(() => {
|
|
24203
24329
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
24204
24330
|
setSettingsNotifications({
|
|
24205
24331
|
...COMPLETE_KYC_PROGRESS,
|
|
24206
24332
|
status: isKYCVerified ? "resolved" : "active"
|
|
24207
24333
|
});
|
|
24208
24334
|
}, [userProfile, setSettingsNotifications]);
|
|
24209
|
-
|
|
24335
|
+
useEffect49(() => {
|
|
24210
24336
|
setSettingsNotifications({
|
|
24211
24337
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
24212
24338
|
status: hasEmail ? "resolved" : "active"
|
|
@@ -24239,7 +24365,7 @@ var init_package = __esm({
|
|
|
24239
24365
|
"package.json"() {
|
|
24240
24366
|
package_default = {
|
|
24241
24367
|
name: "@embarkai/ui-kit",
|
|
24242
|
-
version: "0.4.
|
|
24368
|
+
version: "0.4.58",
|
|
24243
24369
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24244
24370
|
type: "module",
|
|
24245
24371
|
main: "./dist/index.cjs",
|
|
@@ -24476,8 +24602,8 @@ var init_Footer2 = __esm({
|
|
|
24476
24602
|
// src/internal/components/Header/Header.tsx
|
|
24477
24603
|
import { useQuery as useQuery25 } from "@tanstack/react-query";
|
|
24478
24604
|
import { Copy as Copy4, Loader as Loader31 } from "lucide-react";
|
|
24479
|
-
import { useCallback as
|
|
24480
|
-
import { Fragment as
|
|
24605
|
+
import { useCallback as useCallback32, useRef as useRef21, useState as useState29 } from "react";
|
|
24606
|
+
import { Fragment as Fragment45, jsx as jsx117, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
24481
24607
|
function formatAddress2(addr) {
|
|
24482
24608
|
if (!addr) return "";
|
|
24483
24609
|
return `${addr.slice(0, 10)}...${addr.slice(-4)}`;
|
|
@@ -24488,11 +24614,11 @@ function Header() {
|
|
|
24488
24614
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24489
24615
|
const { t } = useT();
|
|
24490
24616
|
const proMode = useProMode();
|
|
24491
|
-
const [proToast, setProToast] =
|
|
24492
|
-
const [copied, setCopied] =
|
|
24493
|
-
const clickCountRef =
|
|
24494
|
-
const clickTimerRef =
|
|
24495
|
-
const handleAvatarClick =
|
|
24617
|
+
const [proToast, setProToast] = useState29(false);
|
|
24618
|
+
const [copied, setCopied] = useState29(false);
|
|
24619
|
+
const clickCountRef = useRef21(0);
|
|
24620
|
+
const clickTimerRef = useRef21(null);
|
|
24621
|
+
const handleAvatarClick = useCallback32(() => {
|
|
24496
24622
|
clickCountRef.current += 1;
|
|
24497
24623
|
if (clickTimerRef.current) {
|
|
24498
24624
|
clearTimeout(clickTimerRef.current);
|
|
@@ -24544,7 +24670,7 @@ function Header() {
|
|
|
24544
24670
|
className: "flex-1 flex flex-col justify-center gap-1",
|
|
24545
24671
|
children: [
|
|
24546
24672
|
isProfileLoading && /* @__PURE__ */ jsx117(Loader31, { className: "w-4 h-4 animate-spin" }),
|
|
24547
|
-
!!address && !isProfileLoading && !!profile && /* @__PURE__ */ jsxs107(
|
|
24673
|
+
!!address && !isProfileLoading && !!profile && /* @__PURE__ */ jsxs107(Fragment45, { children: [
|
|
24548
24674
|
/* @__PURE__ */ jsxs107("div", { className: "w-full flex items-center gap-[var(--ui-kit-gap)]", children: [
|
|
24549
24675
|
/* @__PURE__ */ jsx117(
|
|
24550
24676
|
"span",
|
|
@@ -24794,7 +24920,7 @@ var init_visually_hidden = __esm({
|
|
|
24794
24920
|
|
|
24795
24921
|
// src/internal/components/Dialog/Dialog.tsx
|
|
24796
24922
|
import { AnimatePresence, motion } from "framer-motion";
|
|
24797
|
-
import { useEffect as
|
|
24923
|
+
import { useEffect as useEffect50 } from "react";
|
|
24798
24924
|
import { jsx as jsx120, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
24799
24925
|
function Dialog2() {
|
|
24800
24926
|
const config = useProviderConfig().config;
|
|
@@ -24806,7 +24932,7 @@ function Dialog2() {
|
|
|
24806
24932
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
24807
24933
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24808
24934
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
24809
|
-
|
|
24935
|
+
useEffect50(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
24810
24936
|
usePageMapper();
|
|
24811
24937
|
useAutoConnect();
|
|
24812
24938
|
useBackupStatusChanges();
|
|
@@ -24872,7 +24998,7 @@ var init_Dialog2 = __esm({
|
|
|
24872
24998
|
});
|
|
24873
24999
|
|
|
24874
25000
|
// src/internal/components/TssManager.tsx
|
|
24875
|
-
import React26, { useCallback as
|
|
25001
|
+
import React26, { useCallback as useCallback33 } from "react";
|
|
24876
25002
|
var TssManagerWithRef;
|
|
24877
25003
|
var init_TssManager = __esm({
|
|
24878
25004
|
"src/internal/components/TssManager.tsx"() {
|
|
@@ -24887,7 +25013,7 @@ var init_TssManager = __esm({
|
|
|
24887
25013
|
const setStatus = useSession((st) => st.setStatus);
|
|
24888
25014
|
const setSession = useSession((st) => st.setSession);
|
|
24889
25015
|
const setAddress = useSession((st) => st.setAddress);
|
|
24890
|
-
const onSessionCreated =
|
|
25016
|
+
const onSessionCreated = useCallback33(
|
|
24891
25017
|
(session, address) => {
|
|
24892
25018
|
setSession(session);
|
|
24893
25019
|
setAddress(address);
|
|
@@ -24928,7 +25054,7 @@ var init_TssManager = __esm({
|
|
|
24928
25054
|
// src/internal/components/WalletConnectHandler.tsx
|
|
24929
25055
|
import { useConnectModal as useConnectModal2 } from "@rainbow-me/rainbowkit";
|
|
24930
25056
|
import { useMutation as useMutation23, useQueryClient as useQueryClient27 } from "@tanstack/react-query";
|
|
24931
|
-
import React27, { useCallback as
|
|
25057
|
+
import React27, { useCallback as useCallback34, useEffect as useEffect51 } from "react";
|
|
24932
25058
|
import { useAccount, useDisconnect as useDisconnect4, useSignMessage as useSignMessage2 } from "wagmi";
|
|
24933
25059
|
function WalletConnectHandler() {
|
|
24934
25060
|
const qc = useQueryClient27();
|
|
@@ -24951,7 +25077,7 @@ function WalletConnectHandler() {
|
|
|
24951
25077
|
const projectId = providerConfig?.projectId;
|
|
24952
25078
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
24953
25079
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
24954
|
-
const onLinkingComplete =
|
|
25080
|
+
const onLinkingComplete = useCallback34(
|
|
24955
25081
|
async (success) => {
|
|
24956
25082
|
setIsWalletLinking(false);
|
|
24957
25083
|
if (!success && !passportWalletAddress) {
|
|
@@ -24983,7 +25109,7 @@ function WalletConnectHandler() {
|
|
|
24983
25109
|
const [hasStartedLinking, setHasStartedLinking] = React27.useState(false);
|
|
24984
25110
|
const [modalWasOpened, setModalWasOpened] = React27.useState(false);
|
|
24985
25111
|
const [pendingModalOpen, setPendingModalOpen] = React27.useState(false);
|
|
24986
|
-
|
|
25112
|
+
useEffect51(() => {
|
|
24987
25113
|
if (isWalletLinking && !hasStartedLinking) {
|
|
24988
25114
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
24989
25115
|
isConnected,
|
|
@@ -25021,18 +25147,18 @@ function WalletConnectHandler() {
|
|
|
25021
25147
|
setProviderType,
|
|
25022
25148
|
walletMode
|
|
25023
25149
|
]);
|
|
25024
|
-
|
|
25150
|
+
useEffect51(() => {
|
|
25025
25151
|
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
25026
25152
|
setPendingModalOpen(false);
|
|
25027
25153
|
openConnectModal();
|
|
25028
25154
|
}
|
|
25029
25155
|
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
25030
|
-
|
|
25156
|
+
useEffect51(() => {
|
|
25031
25157
|
if (connectModalOpen && hasStartedLinking) {
|
|
25032
25158
|
setModalWasOpened(true);
|
|
25033
25159
|
}
|
|
25034
25160
|
}, [connectModalOpen, hasStartedLinking]);
|
|
25035
|
-
|
|
25161
|
+
useEffect51(() => {
|
|
25036
25162
|
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
25037
25163
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
25038
25164
|
onLinkingComplete(false);
|
|
@@ -25040,7 +25166,7 @@ function WalletConnectHandler() {
|
|
|
25040
25166
|
setModalWasOpened(false);
|
|
25041
25167
|
}
|
|
25042
25168
|
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
25043
|
-
|
|
25169
|
+
useEffect51(() => {
|
|
25044
25170
|
if (isWalletLinking) {
|
|
25045
25171
|
const timeout = setTimeout(() => {
|
|
25046
25172
|
console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
|
|
@@ -25160,7 +25286,7 @@ function WalletConnectHandler() {
|
|
|
25160
25286
|
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
25161
25287
|
}
|
|
25162
25288
|
});
|
|
25163
|
-
|
|
25289
|
+
useEffect51(() => {
|
|
25164
25290
|
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
25165
25291
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
25166
25292
|
if (!passportWalletAddress) {
|
|
@@ -25170,7 +25296,7 @@ function WalletConnectHandler() {
|
|
|
25170
25296
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
25171
25297
|
}
|
|
25172
25298
|
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
25173
|
-
|
|
25299
|
+
useEffect51(() => {
|
|
25174
25300
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
25175
25301
|
const timeout = setTimeout(() => {
|
|
25176
25302
|
console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
|
|
@@ -25206,7 +25332,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25206
25332
|
});
|
|
25207
25333
|
|
|
25208
25334
|
// src/internal/components/DirectWalletHandler.tsx
|
|
25209
|
-
import { useEffect as
|
|
25335
|
+
import { useEffect as useEffect52 } from "react";
|
|
25210
25336
|
import { useAccount as useAccount2 } from "wagmi";
|
|
25211
25337
|
function DirectWalletHandler() {
|
|
25212
25338
|
const walletMode = useProviderConfig().config.current?.wallet?.mode || "linked";
|
|
@@ -25218,13 +25344,13 @@ function DirectWalletHandler() {
|
|
|
25218
25344
|
const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
|
|
25219
25345
|
const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
|
|
25220
25346
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
25221
|
-
|
|
25347
|
+
useEffect52(() => {
|
|
25222
25348
|
setConfigMode(walletMode);
|
|
25223
25349
|
if (walletMode !== "both") {
|
|
25224
25350
|
setActiveMode(walletMode);
|
|
25225
25351
|
}
|
|
25226
25352
|
}, [walletMode, setConfigMode, setActiveMode]);
|
|
25227
|
-
|
|
25353
|
+
useEffect52(() => {
|
|
25228
25354
|
if (isConnected && address && !isExternalConnected && connector && chain?.id) {
|
|
25229
25355
|
setExternalWallet({
|
|
25230
25356
|
address,
|
|
@@ -25233,17 +25359,17 @@ function DirectWalletHandler() {
|
|
|
25233
25359
|
});
|
|
25234
25360
|
}
|
|
25235
25361
|
}, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
|
|
25236
|
-
|
|
25362
|
+
useEffect52(() => {
|
|
25237
25363
|
if (isExternalConnected && !isConnected) {
|
|
25238
25364
|
clearExternalWallet();
|
|
25239
25365
|
}
|
|
25240
25366
|
}, [isConnected, isExternalConnected, clearExternalWallet]);
|
|
25241
|
-
|
|
25367
|
+
useEffect52(() => {
|
|
25242
25368
|
if (isExternalConnected && isConnected && chain?.id) {
|
|
25243
25369
|
setExternalChainId(chain.id);
|
|
25244
25370
|
}
|
|
25245
25371
|
}, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
|
|
25246
|
-
|
|
25372
|
+
useEffect52(() => {
|
|
25247
25373
|
if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
|
|
25248
25374
|
setExternalWallet({
|
|
25249
25375
|
address,
|
|
@@ -25269,8 +25395,8 @@ import {
|
|
|
25269
25395
|
getChainConfig as getChainConfig12,
|
|
25270
25396
|
getViemChain as getViemChain2
|
|
25271
25397
|
} from "@embarkai/core/read";
|
|
25272
|
-
import { Fragment as
|
|
25273
|
-
import { create as
|
|
25398
|
+
import { Fragment as Fragment46 } from "react";
|
|
25399
|
+
import { create as create15 } from "zustand";
|
|
25274
25400
|
import { persist as persist4 } from "zustand/middleware";
|
|
25275
25401
|
import { jsx as jsx121, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
25276
25402
|
function getChainParams(chainCfg) {
|
|
@@ -25290,7 +25416,7 @@ function waitForStoreHydration() {
|
|
|
25290
25416
|
}
|
|
25291
25417
|
function SessionProvider({ children }) {
|
|
25292
25418
|
const config = useProviderConfig().config;
|
|
25293
|
-
return /* @__PURE__ */ jsxs110(
|
|
25419
|
+
return /* @__PURE__ */ jsxs110(Fragment46, { children: [
|
|
25294
25420
|
children,
|
|
25295
25421
|
config.current?.wallet?.enabled && /* @__PURE__ */ jsx121(WalletConnectHandler, {}),
|
|
25296
25422
|
config.current?.wallet?.enabled && (config.current?.wallet?.mode === "direct" || config.current?.wallet?.mode === "both") && /* @__PURE__ */ jsx121(DirectWalletHandler, {}),
|
|
@@ -25315,7 +25441,7 @@ var init_SessionContext = __esm({
|
|
|
25315
25441
|
init_WalletConnectHandler();
|
|
25316
25442
|
init_DirectWalletHandler();
|
|
25317
25443
|
init_ProviderContext();
|
|
25318
|
-
useSession =
|
|
25444
|
+
useSession = create15()(
|
|
25319
25445
|
persist4(
|
|
25320
25446
|
(set) => ({
|
|
25321
25447
|
isLoading: false,
|
|
@@ -26283,13 +26409,13 @@ async function clearLocalKeyshare(userId) {
|
|
|
26283
26409
|
console.log("[clearLocalKeyshare] Keyshares are now managed by secure iframe");
|
|
26284
26410
|
console.log("[clearLocalKeyshare] To clear keyshares, user must revoke authorization in iframe");
|
|
26285
26411
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
26286
|
-
const
|
|
26412
|
+
const keys2 = [
|
|
26287
26413
|
`tss.${userId}.keyshare`,
|
|
26288
26414
|
`tss.${userId}.ownerAddress`,
|
|
26289
26415
|
`tss.${userId}.sessionId`,
|
|
26290
26416
|
...Object.keys(window.localStorage).filter((key) => key.startsWith(`tss.${userId}.dkg.`))
|
|
26291
26417
|
];
|
|
26292
|
-
|
|
26418
|
+
keys2.forEach((key) => window.localStorage.removeItem(key));
|
|
26293
26419
|
console.log("[clearLocalKeyshare] Cleared old localStorage keys for migration");
|
|
26294
26420
|
}
|
|
26295
26421
|
}
|
|
@@ -27994,7 +28120,7 @@ import { darkTheme, lightTheme, RainbowKitProvider as NativeRainbowKitProvider }
|
|
|
27994
28120
|
import { useMemo as useMemo16 } from "react";
|
|
27995
28121
|
import { WagmiProvider } from "wagmi";
|
|
27996
28122
|
import "@rainbow-me/rainbowkit/styles.css";
|
|
27997
|
-
import { Fragment as
|
|
28123
|
+
import { Fragment as Fragment47, jsx as jsx122 } from "react/jsx-runtime";
|
|
27998
28124
|
function RainbowKitProvider({ children }) {
|
|
27999
28125
|
const config = useProviderConfig().config;
|
|
28000
28126
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
@@ -28026,7 +28152,7 @@ function RainbowKitProvider({ children }) {
|
|
|
28026
28152
|
radii: rainbowTheme.lightMode.radii
|
|
28027
28153
|
};
|
|
28028
28154
|
}, [colorMode]);
|
|
28029
|
-
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ jsx122(
|
|
28155
|
+
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ jsx122(Fragment47, { children });
|
|
28030
28156
|
return /* @__PURE__ */ jsx122(WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ jsx122(NativeRainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
28031
28157
|
}
|
|
28032
28158
|
var init_RainbowKitContext = __esm({
|
|
@@ -28070,11 +28196,11 @@ import { initSdkErrorTracking } from "@embarkai/core/internal/error-tracking";
|
|
|
28070
28196
|
import { merge as merge3 } from "lodash-es";
|
|
28071
28197
|
import {
|
|
28072
28198
|
createContext,
|
|
28073
|
-
useCallback as
|
|
28199
|
+
useCallback as useCallback35,
|
|
28074
28200
|
useContext,
|
|
28075
|
-
useEffect as
|
|
28201
|
+
useEffect as useEffect53,
|
|
28076
28202
|
useMemo as useMemo17,
|
|
28077
|
-
useRef as
|
|
28203
|
+
useRef as useRef22
|
|
28078
28204
|
} from "react";
|
|
28079
28205
|
import { jsx as jsx124 } from "react/jsx-runtime";
|
|
28080
28206
|
function clearLegacyWagmiStorage() {
|
|
@@ -28094,10 +28220,10 @@ function clearLegacyWagmiStorage() {
|
|
|
28094
28220
|
}
|
|
28095
28221
|
function Provider(props) {
|
|
28096
28222
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
28097
|
-
const callbacksRef =
|
|
28098
|
-
|
|
28099
|
-
const config =
|
|
28100
|
-
const updateConfig =
|
|
28223
|
+
const callbacksRef = useRef22(callbacks);
|
|
28224
|
+
useEffect53(() => notifyNoProjetctId(projectId), [projectId]);
|
|
28225
|
+
const config = useRef22(merge3({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
28226
|
+
const updateConfig = useCallback35((updates) => {
|
|
28101
28227
|
const prev = config.current;
|
|
28102
28228
|
const next = { ...prev };
|
|
28103
28229
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -28131,12 +28257,12 @@ function Provider(props) {
|
|
|
28131
28257
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
28132
28258
|
config.current = next;
|
|
28133
28259
|
}, []);
|
|
28134
|
-
const updateCallbacks =
|
|
28260
|
+
const updateCallbacks = useCallback35((updates) => {
|
|
28135
28261
|
const prev = callbacksRef.current;
|
|
28136
28262
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
28137
28263
|
callbacksRef.current = next;
|
|
28138
28264
|
}, []);
|
|
28139
|
-
|
|
28265
|
+
useEffect53(() => {
|
|
28140
28266
|
if (typeof window === "undefined" || !projectId) return;
|
|
28141
28267
|
const mergedConfig = merge3(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
28142
28268
|
updateConfig(mergedConfig);
|
|
@@ -28156,7 +28282,7 @@ function Provider(props) {
|
|
|
28156
28282
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
28157
28283
|
}
|
|
28158
28284
|
}, [projectId, initialConfig]);
|
|
28159
|
-
|
|
28285
|
+
useEffect53(() => {
|
|
28160
28286
|
if (typeof window === "undefined" || !projectId) return;
|
|
28161
28287
|
try {
|
|
28162
28288
|
initSdkErrorTracking();
|
|
@@ -28246,8 +28372,8 @@ init_pro_mode();
|
|
|
28246
28372
|
init_utils2();
|
|
28247
28373
|
import { useQuery as useQuery26 } from "@tanstack/react-query";
|
|
28248
28374
|
import { Cloud as Cloud4, Laptop as Laptop2, Loader as Loader32, Shield as Shield3 } from "lucide-react";
|
|
28249
|
-
import { useEffect as
|
|
28250
|
-
import { Fragment as
|
|
28375
|
+
import { useEffect as useEffect54, useMemo as useMemo18 } from "react";
|
|
28376
|
+
import { Fragment as Fragment48, jsx as jsx125, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
28251
28377
|
function getFormattedStatus(label, status, showStatus) {
|
|
28252
28378
|
const isStatus = showStatus && status && status !== "idle" && status !== "ready";
|
|
28253
28379
|
if (!isStatus) return label;
|
|
@@ -28266,7 +28392,7 @@ function ConnectWalletButton(props) {
|
|
|
28266
28392
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28267
28393
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
28268
28394
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
28269
|
-
|
|
28395
|
+
useEffect54(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
28270
28396
|
const { data: profile, isLoading: isProfileLoading } = useQuery26({
|
|
28271
28397
|
retry: false,
|
|
28272
28398
|
enabled: !!address,
|
|
@@ -28285,7 +28411,7 @@ function ConnectWalletButton(props) {
|
|
|
28285
28411
|
const isConnecting = connectButtonLabel !== label || isLoading;
|
|
28286
28412
|
return /* @__PURE__ */ jsx125("div", { "data-current-theme-mode": colorMode, className: cn("embarkai-ui-scope w-fit h-fit", className), children: !address ? (
|
|
28287
28413
|
/** external Buttons can be provided */
|
|
28288
|
-
/* @__PURE__ */ jsx125(
|
|
28414
|
+
/* @__PURE__ */ jsx125(Fragment48, { children: ConnectButton ? /* @__PURE__ */ jsxs111(
|
|
28289
28415
|
ConnectButton,
|
|
28290
28416
|
{
|
|
28291
28417
|
type: "button",
|
|
@@ -28528,7 +28654,7 @@ init_useLayoutDataStore();
|
|
|
28528
28654
|
init_getUserOperationByHash();
|
|
28529
28655
|
init_getUserOperationReceipt();
|
|
28530
28656
|
init_cn();
|
|
28531
|
-
import { AlertCircle as
|
|
28657
|
+
import { AlertCircle as AlertCircle5, CheckCircle2 as CheckCircle27, Clock as Clock2, Copy as Copy6, ExternalLink as ExternalLink3, RefreshCw as RefreshCw4 } from "lucide-react";
|
|
28532
28658
|
import * as React29 from "react";
|
|
28533
28659
|
|
|
28534
28660
|
// src/internal/components/Address.tsx
|
|
@@ -28712,19 +28838,19 @@ var UserOpStatus = ({
|
|
|
28712
28838
|
if (receipt) {
|
|
28713
28839
|
const ok = !!receipt.success;
|
|
28714
28840
|
return /* @__PURE__ */ jsxs113(Badge, { variant: ok ? "success" : "destructive", children: [
|
|
28715
|
-
ok ? /* @__PURE__ */ jsx129(CheckCircle27, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx129(
|
|
28841
|
+
ok ? /* @__PURE__ */ jsx129(CheckCircle27, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx129(AlertCircle5, { className: "h-3 w-3" }),
|
|
28716
28842
|
ok ? "Included" : "Failed"
|
|
28717
28843
|
] });
|
|
28718
28844
|
}
|
|
28719
28845
|
if (rejected) {
|
|
28720
28846
|
return /* @__PURE__ */ jsxs113(Badge, { variant: "destructive", children: [
|
|
28721
|
-
/* @__PURE__ */ jsx129(
|
|
28847
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-3 w-3" }),
|
|
28722
28848
|
" Rejected by bundler"
|
|
28723
28849
|
] });
|
|
28724
28850
|
}
|
|
28725
28851
|
if (timedOut) {
|
|
28726
28852
|
return /* @__PURE__ */ jsxs113(Badge, { variant: "warning", children: [
|
|
28727
|
-
/* @__PURE__ */ jsx129(
|
|
28853
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-3 w-3" }),
|
|
28728
28854
|
" Timeout - may be rejected"
|
|
28729
28855
|
] });
|
|
28730
28856
|
}
|
|
@@ -28832,16 +28958,16 @@ var UserOpStatus = ({
|
|
|
28832
28958
|
] })
|
|
28833
28959
|
] }),
|
|
28834
28960
|
error && /* @__PURE__ */ jsxs113("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
28835
|
-
/* @__PURE__ */ jsx129(
|
|
28961
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-4 w-4" }),
|
|
28836
28962
|
" ",
|
|
28837
28963
|
error
|
|
28838
28964
|
] }),
|
|
28839
28965
|
rejected && /* @__PURE__ */ jsxs113("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
28840
|
-
/* @__PURE__ */ jsx129(
|
|
28966
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-4 w-4" }),
|
|
28841
28967
|
"UserOperation was dropped from bundler mempool. This usually means it was invalid or replaced."
|
|
28842
28968
|
] }),
|
|
28843
28969
|
timedOut && /* @__PURE__ */ jsxs113("div", { className: "text-sm text-destructive flex items-center gap-1 mt-4", children: [
|
|
28844
|
-
/* @__PURE__ */ jsx129(
|
|
28970
|
+
/* @__PURE__ */ jsx129(AlertCircle5, { className: "h-4 w-4" }),
|
|
28845
28971
|
"Stopped polling after ",
|
|
28846
28972
|
Math.round(maxPollTimeMs / 1e3),
|
|
28847
28973
|
"s. UserOperation may have been rejected by the bundler."
|
|
@@ -28917,13 +29043,13 @@ var Hash = ({
|
|
|
28917
29043
|
|
|
28918
29044
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
28919
29045
|
init_base2();
|
|
28920
|
-
import { useEffect as
|
|
29046
|
+
import { useEffect as useEffect56, useState as useState33 } from "react";
|
|
28921
29047
|
import { jsx as jsx131, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
28922
29048
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
28923
|
-
const [transactions, setTransactions] =
|
|
28924
|
-
const [loading, setLoading] =
|
|
28925
|
-
const [error, setError] =
|
|
28926
|
-
|
|
29049
|
+
const [transactions, setTransactions] = useState33([]);
|
|
29050
|
+
const [loading, setLoading] = useState33(true);
|
|
29051
|
+
const [error, setError] = useState33(null);
|
|
29052
|
+
useEffect56(() => {
|
|
28927
29053
|
const fetchTransactions2 = async () => {
|
|
28928
29054
|
try {
|
|
28929
29055
|
setLoading(true);
|
|
@@ -29215,12 +29341,12 @@ init_useErc3643Compliance();
|
|
|
29215
29341
|
|
|
29216
29342
|
// src/hooks/useWalletMode.ts
|
|
29217
29343
|
init_useExternalWalletStore();
|
|
29218
|
-
import { useCallback as
|
|
29344
|
+
import { useCallback as useCallback38 } from "react";
|
|
29219
29345
|
function useWalletMode() {
|
|
29220
29346
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
29221
29347
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
29222
29348
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
29223
|
-
const switchMode =
|
|
29349
|
+
const switchMode = useCallback38(
|
|
29224
29350
|
(mode) => {
|
|
29225
29351
|
if (configMode !== "both") return;
|
|
29226
29352
|
setActiveMode(mode);
|
|
@@ -29238,7 +29364,7 @@ function useWalletMode() {
|
|
|
29238
29364
|
// src/hooks/useDirectWallet.ts
|
|
29239
29365
|
init_useExternalWalletStore();
|
|
29240
29366
|
init_useLayoutDataStore();
|
|
29241
|
-
import { useCallback as
|
|
29367
|
+
import { useCallback as useCallback39 } from "react";
|
|
29242
29368
|
import { useConnectModal as useConnectModal3 } from "@rainbow-me/rainbowkit";
|
|
29243
29369
|
import { useDisconnect as useDisconnect5 } from "wagmi";
|
|
29244
29370
|
function useDirectWallet() {
|
|
@@ -29250,13 +29376,13 @@ function useDirectWallet() {
|
|
|
29250
29376
|
const { disconnect: wagmiDisconnect } = useDisconnect5();
|
|
29251
29377
|
const { openConnectModal } = useConnectModal3();
|
|
29252
29378
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29253
|
-
const connect =
|
|
29379
|
+
const connect = useCallback39(() => {
|
|
29254
29380
|
setIsWalletLinking(true);
|
|
29255
29381
|
}, [setIsWalletLinking]);
|
|
29256
|
-
const reconnect =
|
|
29382
|
+
const reconnect = useCallback39(() => {
|
|
29257
29383
|
if (openConnectModal) openConnectModal();
|
|
29258
29384
|
}, [openConnectModal]);
|
|
29259
|
-
const disconnect =
|
|
29385
|
+
const disconnect = useCallback39(() => {
|
|
29260
29386
|
wagmiDisconnect();
|
|
29261
29387
|
clearExternalWallet();
|
|
29262
29388
|
}, [wagmiDisconnect, clearExternalWallet]);
|
|
@@ -29273,7 +29399,7 @@ function useDirectWallet() {
|
|
|
29273
29399
|
|
|
29274
29400
|
// src/hooks/useSendDirectTransaction.ts
|
|
29275
29401
|
init_useExternalWalletStore();
|
|
29276
|
-
import { useCallback as
|
|
29402
|
+
import { useCallback as useCallback40, useState as useState35 } from "react";
|
|
29277
29403
|
import { isAddress as isAddress3, parseEther as parseEther3 } from "viem";
|
|
29278
29404
|
import { useSendTransaction as useWagmiSendTransaction, useSwitchChain as useSwitchChain3 } from "wagmi";
|
|
29279
29405
|
function useSendDirectTransaction() {
|
|
@@ -29281,10 +29407,10 @@ function useSendDirectTransaction() {
|
|
|
29281
29407
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29282
29408
|
const { sendTransactionAsync } = useWagmiSendTransaction();
|
|
29283
29409
|
const { switchChainAsync } = useSwitchChain3();
|
|
29284
|
-
const [isPending, setIsPending] =
|
|
29285
|
-
const [error, setError] =
|
|
29286
|
-
const [txHash, setTxHash] =
|
|
29287
|
-
const sendTransaction =
|
|
29410
|
+
const [isPending, setIsPending] = useState35(false);
|
|
29411
|
+
const [error, setError] = useState35(null);
|
|
29412
|
+
const [txHash, setTxHash] = useState35(null);
|
|
29413
|
+
const sendTransaction = useCallback40(
|
|
29288
29414
|
async (params) => {
|
|
29289
29415
|
if (!isConnected) {
|
|
29290
29416
|
setError("No external wallet connected");
|
|
@@ -29318,7 +29444,7 @@ function useSendDirectTransaction() {
|
|
|
29318
29444
|
},
|
|
29319
29445
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
29320
29446
|
);
|
|
29321
|
-
const reset =
|
|
29447
|
+
const reset = useCallback40(() => {
|
|
29322
29448
|
setError(null);
|
|
29323
29449
|
setTxHash(null);
|
|
29324
29450
|
setIsPending(false);
|
|
@@ -29330,7 +29456,7 @@ function useSendDirectTransaction() {
|
|
|
29330
29456
|
init_SessionContext();
|
|
29331
29457
|
init_account2();
|
|
29332
29458
|
init_linkedProfiles();
|
|
29333
|
-
import { useCallback as
|
|
29459
|
+
import { useCallback as useCallback41, useMemo as useMemo19, useState as useState36 } from "react";
|
|
29334
29460
|
import { encodeFunctionData as encodeFunctionData3, isAddress as isAddress4, parseEther as parseEther4, parseUnits as parseUnits3 } from "viem";
|
|
29335
29461
|
var ERC20_TRANSFER_ABI2 = [
|
|
29336
29462
|
{
|
|
@@ -29346,14 +29472,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
29346
29472
|
function useTransferToLinkedWallet() {
|
|
29347
29473
|
const session = useSession((st) => st.session);
|
|
29348
29474
|
const { profiles } = useLinkedProfiles();
|
|
29349
|
-
const [isPending, setIsPending] =
|
|
29350
|
-
const [error, setError] =
|
|
29351
|
-
const [userOpHash, setUserOpHash] =
|
|
29475
|
+
const [isPending, setIsPending] = useState36(false);
|
|
29476
|
+
const [error, setError] = useState36(null);
|
|
29477
|
+
const [userOpHash, setUserOpHash] = useState36(null);
|
|
29352
29478
|
const linkedWallets = useMemo19(
|
|
29353
29479
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
29354
29480
|
[profiles]
|
|
29355
29481
|
);
|
|
29356
|
-
const transfer =
|
|
29482
|
+
const transfer = useCallback41(
|
|
29357
29483
|
async (params) => {
|
|
29358
29484
|
if (!session) {
|
|
29359
29485
|
setError("No active session");
|
|
@@ -29404,7 +29530,7 @@ function useTransferToLinkedWallet() {
|
|
|
29404
29530
|
},
|
|
29405
29531
|
[session, linkedWallets]
|
|
29406
29532
|
);
|
|
29407
|
-
const reset =
|
|
29533
|
+
const reset = useCallback41(() => {
|
|
29408
29534
|
setError(null);
|
|
29409
29535
|
setUserOpHash(null);
|
|
29410
29536
|
setIsPending(false);
|
|
@@ -29431,7 +29557,7 @@ init_ProviderContext();
|
|
|
29431
29557
|
init_SessionContext();
|
|
29432
29558
|
init_useExternalWalletStore();
|
|
29433
29559
|
import { logout as coreLogout, jwtTokenManager as jwtTokenManager3 } from "@embarkai/core/auth";
|
|
29434
|
-
import { useCallback as
|
|
29560
|
+
import { useCallback as useCallback42 } from "react";
|
|
29435
29561
|
import { useDisconnect as useDisconnect6 } from "wagmi";
|
|
29436
29562
|
function useLogout() {
|
|
29437
29563
|
const { callbacksRef } = useProviderConfig();
|
|
@@ -29448,7 +29574,7 @@ function useLogout() {
|
|
|
29448
29574
|
}
|
|
29449
29575
|
}
|
|
29450
29576
|
});
|
|
29451
|
-
const logout2 =
|
|
29577
|
+
const logout2 = useCallback42(async () => {
|
|
29452
29578
|
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
29453
29579
|
const prevAddress = address;
|
|
29454
29580
|
let userId = null;
|
|
@@ -29491,7 +29617,7 @@ init_bundler();
|
|
|
29491
29617
|
// src/index.ts
|
|
29492
29618
|
init_auth();
|
|
29493
29619
|
init_profile();
|
|
29494
|
-
|
|
29620
|
+
init_SecurityMenu2();
|
|
29495
29621
|
init_linkedProfiles();
|
|
29496
29622
|
init_nickname_fingerprint();
|
|
29497
29623
|
init_errors();
|