@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/index.cjs CHANGED
@@ -852,31 +852,31 @@ var init_useLayoutDataStore = __esm({
852
852
  "src/internal/hooks/useLayoutDataStore.ts"() {
853
853
  import_zustand = require("zustand");
854
854
  init_constants();
855
- PageKey = /* @__PURE__ */ ((PageKey3) => {
856
- PageKey3["AUTH"] = "auth";
857
- PageKey3["LANGUAGES"] = "languages";
858
- PageKey3["TERMS_OF_SERVICE"] = "terms-of-service";
859
- PageKey3["MAIN_MENU"] = "main-menu";
860
- PageKey3["SETTINGS"] = "settings";
861
- PageKey3["SEND"] = "send";
862
- PageKey3["RECEIVE"] = "receive";
863
- PageKey3["BUY"] = "buy";
864
- PageKey3["KYC"] = "kyc";
865
- PageKey3["TRANSACTIONS"] = "transactions";
866
- PageKey3["ASSETS"] = "assets";
867
- PageKey3["MANAGE_WALLET"] = "manage-wallet";
868
- PageKey3["UNLINK_PROVIDER"] = "unlink-provider";
869
- PageKey3["SECURITY"] = "security";
870
- PageKey3["KEYSARE_BACKUP"] = "keysare-backup";
871
- PageKey3["KEYSHARE_RESTORE"] = "keyshare-restore";
872
- PageKey3["CHAIN"] = "chain";
873
- PageKey3["CHAIN_SWITCH_REQUEST"] = "chain-switch-request";
874
- PageKey3["NICKNAME_SETTINGS"] = "nickname-settings";
875
- PageKey3["DEVICES"] = "devices";
876
- PageKey3["DEVICE_LINK"] = "device-link";
877
- PageKey3["DEVICE_MANAGE"] = "device-manage";
878
- PageKey3["DEVICE_RESTORE"] = "device-restore";
879
- return PageKey3;
855
+ PageKey = /* @__PURE__ */ ((PageKey4) => {
856
+ PageKey4["AUTH"] = "auth";
857
+ PageKey4["LANGUAGES"] = "languages";
858
+ PageKey4["TERMS_OF_SERVICE"] = "terms-of-service";
859
+ PageKey4["MAIN_MENU"] = "main-menu";
860
+ PageKey4["SETTINGS"] = "settings";
861
+ PageKey4["SEND"] = "send";
862
+ PageKey4["RECEIVE"] = "receive";
863
+ PageKey4["BUY"] = "buy";
864
+ PageKey4["KYC"] = "kyc";
865
+ PageKey4["TRANSACTIONS"] = "transactions";
866
+ PageKey4["ASSETS"] = "assets";
867
+ PageKey4["MANAGE_WALLET"] = "manage-wallet";
868
+ PageKey4["UNLINK_PROVIDER"] = "unlink-provider";
869
+ PageKey4["SECURITY"] = "security";
870
+ PageKey4["KEYSARE_BACKUP"] = "keysare-backup";
871
+ PageKey4["KEYSHARE_RESTORE"] = "keyshare-restore";
872
+ PageKey4["CHAIN"] = "chain";
873
+ PageKey4["CHAIN_SWITCH_REQUEST"] = "chain-switch-request";
874
+ PageKey4["NICKNAME_SETTINGS"] = "nickname-settings";
875
+ PageKey4["DEVICES"] = "devices";
876
+ PageKey4["DEVICE_LINK"] = "device-link";
877
+ PageKey4["DEVICE_MANAGE"] = "device-manage";
878
+ PageKey4["DEVICE_RESTORE"] = "device-restore";
879
+ return PageKey4;
880
880
  })(PageKey || {});
881
881
  useLayoutDataStore = (0, import_zustand.create)((set) => ({
882
882
  page: null,
@@ -2465,7 +2465,7 @@ function usePageParams() {
2465
2465
  currentParams.current = pageParams;
2466
2466
  setPageParams(null);
2467
2467
  }, []);
2468
- return currentParams.current;
2468
+ return currentParams;
2469
2469
  }
2470
2470
  var import_react4;
2471
2471
  var init_useOpenPage = __esm({
@@ -5516,7 +5516,7 @@ var init_en = __esm({
5516
5516
  selectToken: "Select Asset",
5517
5517
  estimations: "Estimations",
5518
5518
  estimatedFee: "Estimated Fee",
5519
- availableChainPairs: "Available Chain Pairs",
5519
+ availableChainPairs: "Select Chain Pairs",
5520
5520
  toChain: "To Chain",
5521
5521
  fromChain: "From Chain",
5522
5522
  optionalRecipient: "Recipient (optional, if empty - destination chain address = sender address on origin chain)",
@@ -5591,7 +5591,12 @@ var init_en = __esm({
5591
5591
  exchangeRate: "Exchange Rate",
5592
5592
  networkFee: "Network Fee",
5593
5593
  serviceFee: "Service Fee",
5594
- paymentMethod: "Payment Method"
5594
+ paymentMethod: "Payment Method",
5595
+ toAddress: {
5596
+ receiver: "ATTENTION! Receiving Address",
5597
+ message: "You are about to purchase crypto to an external address, not your embarkAI address.",
5598
+ suggestion: "Please make sure this is your correct wallet address, otherwise you may lose your funds."
5599
+ }
5595
5600
  },
5596
5601
  transactionHistory: {
5597
5602
  details: "Details"
@@ -5609,7 +5614,8 @@ var init_en = __esm({
5609
5614
  },
5610
5615
  portfolioMenu: {
5611
5616
  title: "Your Assets",
5612
- noAssets: "No assets found"
5617
+ noAssets: "No assets found",
5618
+ noBlockscout: "No Blockscout API found for chain: {{chain}}"
5613
5619
  },
5614
5620
  transactionsMenu: {
5615
5621
  title: "Transactions History",
@@ -8809,11 +8815,35 @@ var init_priceFormatter = __esm({
8809
8815
  });
8810
8816
 
8811
8817
  // src/internal/components/BuyMenu/useBuyMenuStore.ts
8812
- var import_zustand4, import_middleware, DEFAULT_MENU_SWITCHES, DEFAULT_PROVIDER, useBuyMenuStore;
8818
+ function useBuyMenuParams() {
8819
+ (0, import_react21.useEffect)(() => {
8820
+ const { pageParams, setPageParams } = useLayoutDataStore.getState();
8821
+ if (!pageParams || !(0, import_lodash_es4.keys)(pageParams).length) return;
8822
+ const { amount, crypto: crypto2, toWalletAddress, confirmationMessage, onRampWidgetRedirected } = pageParams || {};
8823
+ switch (true) {
8824
+ case !!amount:
8825
+ useBuyMenuStore.getState().setSrcInputAmount(amount);
8826
+ useBuyMenuStore.getState().setSrcQueryAmount(amount);
8827
+ case !!crypto2:
8828
+ useBuyMenuStore.getState().setSelectedCrypto(crypto2);
8829
+ case !!toWalletAddress:
8830
+ useBuyMenuStore.getState().setToWalletAddress(toWalletAddress);
8831
+ case !!onRampWidgetRedirected:
8832
+ useBuyMenuStore.getState().setOnRampWidgetRedirectedFn(onRampWidgetRedirected);
8833
+ case !!confirmationMessage:
8834
+ useBuyMenuStore.getState().setConfirmationMessage(confirmationMessage);
8835
+ }
8836
+ setPageParams(null);
8837
+ }, []);
8838
+ }
8839
+ var import_lodash_es4, import_react21, import_zustand4, import_middleware, DEFAULT_MENU_SWITCHES, DEFAULT_PROVIDER, useBuyMenuStore;
8813
8840
  var init_useBuyMenuStore = __esm({
8814
8841
  "src/internal/components/BuyMenu/useBuyMenuStore.ts"() {
8842
+ import_lodash_es4 = require("lodash-es");
8843
+ import_react21 = require("react");
8815
8844
  import_zustand4 = require("zustand");
8816
8845
  import_middleware = require("zustand/middleware");
8846
+ init_useLayoutDataStore();
8817
8847
  DEFAULT_MENU_SWITCHES = {
8818
8848
  isTransactionHistory: false,
8819
8849
  isProviderSelector: false,
@@ -8828,6 +8858,8 @@ var init_useBuyMenuStore = __esm({
8828
8858
  (set) => ({
8829
8859
  renderKey: "default-initial-buy-menu-render-key",
8830
8860
  setRenderKey: (key) => set({ renderKey: key }),
8861
+ toWalletAddress: null,
8862
+ setToWalletAddress: (toWalletAddress) => set({ toWalletAddress }),
8831
8863
  /** boolean flags */
8832
8864
  isTransactionHistory: false,
8833
8865
  setIsTransactionHistory: (isTransactionHistory) => {
@@ -8877,6 +8909,10 @@ var init_useBuyMenuStore = __esm({
8877
8909
  srcQueryAmount: 0,
8878
8910
  setSrcQueryAmount: (amount) => set({ srcQueryAmount: amount }),
8879
8911
  /** */
8912
+ onRampWidgetRedirected: import_lodash_es4.noop,
8913
+ setOnRampWidgetRedirectedFn: (cb) => set({ onRampWidgetRedirected: cb }),
8914
+ confirmationMessage: null,
8915
+ setConfirmationMessage: (message) => set({ confirmationMessage: message }),
8880
8916
  error: null,
8881
8917
  setError: (error) => set({ error })
8882
8918
  }),
@@ -8928,16 +8964,16 @@ function CryptoSelector(props) {
8928
8964
  const { coins } = props;
8929
8965
  const { t } = useT();
8930
8966
  const chainConfig = useSession((st) => st.chainConfig);
8931
- const [searchValue, setSearchValue] = (0, import_react21.useState)("");
8932
- const [target, setTarget] = (0, import_react21.useState)("");
8933
- const setSearchDebounced = (0, import_react21.useCallback)(
8934
- (0, import_lodash_es4.debounce)((value) => {
8967
+ const [searchValue, setSearchValue] = (0, import_react22.useState)("");
8968
+ const [target, setTarget] = (0, import_react22.useState)("");
8969
+ const setSearchDebounced = (0, import_react22.useCallback)(
8970
+ (0, import_lodash_es5.debounce)((value) => {
8935
8971
  setTarget(value);
8936
8972
  useBuyMenuStore.getState().setRenderKey(`on-ramp-crypto-selector-${Date.now()}`);
8937
8973
  }, 1e3),
8938
8974
  []
8939
8975
  );
8940
- const filteredCoins = (0, import_react21.useMemo)(() => {
8976
+ const filteredCoins = (0, import_react22.useMemo)(() => {
8941
8977
  const sorted = [...coins].sort((a, b) => {
8942
8978
  const aIdx = POPULAR_CRYPTOS.indexOf(a.symbol.toUpperCase());
8943
8979
  const bIdx = POPULAR_CRYPTOS.indexOf(b.symbol.toUpperCase());
@@ -8949,7 +8985,7 @@ function CryptoSelector(props) {
8949
8985
  if (!target) return sorted;
8950
8986
  return sorted.filter((f) => f.symbol.toLowerCase().includes(target.toLowerCase()));
8951
8987
  }, [coins, target]);
8952
- const groupedCoins = (0, import_lodash_es4.toPairs)(
8988
+ const groupedCoins = (0, import_lodash_es5.toPairs)(
8953
8989
  filteredCoins.reduce(
8954
8990
  (acc, coin) => {
8955
8991
  const network = coin.network;
@@ -9043,16 +9079,16 @@ function CryptoSelectorTrigger(props) {
9043
9079
  }
9044
9080
  );
9045
9081
  }
9046
- var import_lodash_es4, import_lucide_react9, import_react21, import_jsx_runtime32, POPULAR_CRYPTOS;
9082
+ var import_lodash_es5, import_lucide_react9, import_react22, import_jsx_runtime32, POPULAR_CRYPTOS;
9047
9083
  var init_CryptoSelector = __esm({
9048
9084
  "src/internal/components/BuyMenu/components/CryptoSelector.tsx"() {
9049
9085
  init_tokens();
9050
9086
  init_utils2();
9051
9087
  init_SessionContext();
9052
9088
  init_i18n();
9053
- import_lodash_es4 = require("lodash-es");
9089
+ import_lodash_es5 = require("lodash-es");
9054
9090
  import_lucide_react9 = require("lucide-react");
9055
- import_react21 = require("react");
9091
+ import_react22 = require("react");
9056
9092
  init_priceFormatter();
9057
9093
  init_button();
9058
9094
  init_highlight();
@@ -9154,16 +9190,16 @@ function FiatSelector(props) {
9154
9190
  const { fiats } = props;
9155
9191
  const { t, i18n } = useT();
9156
9192
  const locale = i18n.resolvedLanguage || "en";
9157
- const [searchValue, setSearchValue] = (0, import_react22.useState)("");
9158
- const [target, setTarget] = (0, import_react22.useState)("");
9159
- const setSearchDebounced = (0, import_react22.useCallback)(
9160
- (0, import_lodash_es5.debounce)((value) => {
9193
+ const [searchValue, setSearchValue] = (0, import_react23.useState)("");
9194
+ const [target, setTarget] = (0, import_react23.useState)("");
9195
+ const setSearchDebounced = (0, import_react23.useCallback)(
9196
+ (0, import_lodash_es6.debounce)((value) => {
9161
9197
  setTarget(value);
9162
9198
  useBuyMenuStore.getState().setRenderKey(`on-ramp-fiat-selector-${Date.now()}`);
9163
9199
  }, 1e3),
9164
9200
  []
9165
9201
  );
9166
- const filteredFiats = (0, import_react22.useMemo)(() => {
9202
+ const filteredFiats = (0, import_react23.useMemo)(() => {
9167
9203
  const sorted = [...fiats].sort((a, b) => {
9168
9204
  const aIdx = POPULAR_FIATS.indexOf(a.ticker.toUpperCase());
9169
9205
  const bIdx = POPULAR_FIATS.indexOf(b.ticker.toUpperCase());
@@ -9228,13 +9264,13 @@ function FiatSelectorTrigger(props) {
9228
9264
  }
9229
9265
  );
9230
9266
  }
9231
- var import_lodash_es5, import_lucide_react10, import_react22, import_jsx_runtime34, POPULAR_FIATS;
9267
+ var import_lodash_es6, import_lucide_react10, import_react23, import_jsx_runtime34, POPULAR_FIATS;
9232
9268
  var init_FiatSelector = __esm({
9233
9269
  "src/internal/components/BuyMenu/components/FiatSelector.tsx"() {
9234
9270
  init_i18n();
9235
- import_lodash_es5 = require("lodash-es");
9271
+ import_lodash_es6 = require("lodash-es");
9236
9272
  import_lucide_react10 = require("lucide-react");
9237
- import_react22 = require("react");
9273
+ import_react23 = require("react");
9238
9274
  init_button();
9239
9275
  init_highlight();
9240
9276
  init_input();
@@ -9459,6 +9495,62 @@ var init_api = __esm({
9459
9495
  }
9460
9496
  });
9461
9497
 
9498
+ // src/internal/utils/cn.ts
9499
+ function cn2(...inputs) {
9500
+ return twMerge((0, import_clsx2.clsx)(inputs));
9501
+ }
9502
+ var import_clsx2;
9503
+ var init_cn = __esm({
9504
+ "src/internal/utils/cn.ts"() {
9505
+ import_clsx2 = require("clsx");
9506
+ init_bundle_mjs();
9507
+ }
9508
+ });
9509
+
9510
+ // src/internal/components/ui/badge.tsx
9511
+ function Badge(props) {
9512
+ const { className, variant = "secondary", size = "default", ...rest } = props;
9513
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { ...rest, className: cn2(badgeVariants({ variant, size }), className) });
9514
+ }
9515
+ var import_class_variance_authority2, import_jsx_runtime36, badgeVariants;
9516
+ var init_badge = __esm({
9517
+ "src/internal/components/ui/badge.tsx"() {
9518
+ import_class_variance_authority2 = require("class-variance-authority");
9519
+ init_cn();
9520
+ import_jsx_runtime36 = require("react/jsx-runtime");
9521
+ badgeVariants = (0, import_class_variance_authority2.cva)(
9522
+ cn2(
9523
+ //
9524
+ "inline-flex items-center",
9525
+ "border font-semibold",
9526
+ "select-none"
9527
+ ),
9528
+ {
9529
+ variants: {
9530
+ variant: {
9531
+ outline: "border-[var(--ui-kit-bd)] bg-transparent text-[var(--ui-kit-fg)]",
9532
+ secondary: "border-[var(--ui-kit-secondary)] bg-[var(--ui-kit-secondary)] text-[var(--ui-kit-fg)]",
9533
+ destructive: "border-[var(--ui-kit-bg-error)] bg-[var(--ui-kit-bg-error)] text-[var(--ui-kit-error)]",
9534
+ success: "border-[var(--ui-kit-bg-success)] bg-[var(--ui-kit-bg-success)] text-[var(--ui-kit-success)]",
9535
+ warning: "border-[var(--ui-kit-bg-warning)] bg-[var(--ui-kit-bg-warning)] text-[var(--ui-kit-warning)]"
9536
+ },
9537
+ size: {
9538
+ default: "h-5 px-2 rounded-full text-[10px] gap-[var(--ui-kit-gap)]",
9539
+ medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] text-sm gap-[var(--ui-kit-gap)]",
9540
+ large: cn2(
9541
+ "whitespace-nowrap text-sm font-semibold font-sans",
9542
+ "h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]"
9543
+ )
9544
+ }
9545
+ },
9546
+ defaultVariants: {
9547
+ variant: "secondary"
9548
+ }
9549
+ }
9550
+ );
9551
+ }
9552
+ });
9553
+
9462
9554
  // src/internal/components/BuyMenu/binance/config.ts
9463
9555
  var import_read9, CHAIN_ID_TO_BINANCE_NETWORK_TICKER;
9464
9556
  var init_config = __esm({
@@ -9476,21 +9568,30 @@ function BinanceSummary(props) {
9476
9568
  const { payment } = props;
9477
9569
  const qc = (0, import_react_query7.useQueryClient)();
9478
9570
  const { t } = useT();
9479
- const walletAddress = useSession((st) => st.address);
9571
+ const embarkaiAddress = useSession((st) => st.address);
9480
9572
  const chainConfig = useSession((st) => st.chainConfig);
9481
- const { selectedFiat, selectedCrypto, srcQueryAmount, redirecting, setRedirecting } = useBuyMenuStore();
9573
+ const {
9574
+ toWalletAddress,
9575
+ selectedFiat,
9576
+ selectedCrypto,
9577
+ srcQueryAmount,
9578
+ redirecting,
9579
+ confirmationMessage,
9580
+ setRedirecting
9581
+ } = useBuyMenuStore();
9482
9582
  const quoteData = useBinanceStore((st) => st.quoteData);
9483
9583
  const cryptoToRecieve = Number(quoteData?.totalAmount || "0");
9484
9584
  const { mutate: checkoutFundWalletOrder, isPending: isFundWalletOrderCheckouting } = (0, import_react_query7.useMutation)({
9485
9585
  mutationFn: async () => {
9486
9586
  setRedirecting(true);
9487
9587
  return await createPreorderMutation({
9588
+ address: toWalletAddress || embarkaiAddress,
9488
9589
  amountType: 1,
9489
9590
  requestedAmount: String(srcQueryAmount),
9490
- address: walletAddress,
9491
9591
  fiatCurrency: selectedFiat,
9492
9592
  cryptoCurrency: selectedCrypto,
9493
9593
  network: CHAIN_ID_TO_BINANCE_NETWORK_TICKER[chainConfig.id],
9594
+ //
9494
9595
  payMethodCode: payment?.payMethodCode || void 0,
9495
9596
  payMethodSubCode: payment?.payMethodSubCode || void 0,
9496
9597
  // TODO: pass quote response to backend to create order with exact quote details (amount, fees, etc.)
@@ -9509,8 +9610,10 @@ function BinanceSummary(props) {
9509
9610
  setRedirecting(false);
9510
9611
  qc.invalidateQueries({ queryKey: [QUERY_KEYS2.binanceTransactions] });
9511
9612
  window.open(link, "_blank", "noopener,noreferrer");
9512
- useBuyMenuStore.getState().setError(null);
9513
- useBuyMenuStore.getState().setIsTransactionHistory(true);
9613
+ const { setError, setIsTransactionHistory, onRampWidgetRedirected } = useBuyMenuStore.getState();
9614
+ onRampWidgetRedirected(quoteData);
9615
+ setError(null);
9616
+ setIsTransactionHistory(true);
9514
9617
  }, REDIRECT_TIMEOUT_MS);
9515
9618
  }
9516
9619
  },
@@ -9522,51 +9625,59 @@ function BinanceSummary(props) {
9522
9625
  });
9523
9626
  const isContinueDisabled = !!redirecting || !!isFundWalletOrderCheckouting || !quoteData;
9524
9627
  if (!quoteData) {
9525
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Highlight, { type: "warning", className: "flex gap-[var(--ui-kit-gap)]", children: [
9526
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react12.InfoIcon, { className: "w-4 h-4" }),
9527
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: t("passport:common.errors.oops") })
9628
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Highlight, { type: "warning", className: "flex gap-[var(--ui-kit-gap)]", children: [
9629
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react12.InfoIcon, { className: "w-4 h-4" }),
9630
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:common.errors.oops") })
9528
9631
  ] }) });
9529
9632
  }
9530
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
9531
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-xs leading-5", children: [
9532
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "", children: t("passport:common.amount") }),
9533
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-bold", children: [
9633
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
9634
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex justify-between text-xs leading-5", children: [
9635
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "", children: t("passport:common.amount") }),
9636
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "font-bold", children: [
9534
9637
  formatPrice(srcQueryAmount),
9535
9638
  " ",
9536
9639
  selectedFiat.toUpperCase()
9537
9640
  ] })
9538
9641
  ] }),
9539
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex justify-between text-xs leading-5", children: [
9540
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "", children: t("passport:buyMenu.summary.youReceive") }),
9541
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "font-bold", children: [
9642
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex justify-between text-xs leading-5", children: [
9643
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "", children: t("passport:buyMenu.summary.youReceive") }),
9644
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "font-bold", children: [
9542
9645
  formatPrice(cryptoToRecieve),
9543
9646
  " ",
9544
9647
  selectedCrypto.toUpperCase()
9545
9648
  ] })
9546
9649
  ] }),
9547
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Highlight, { type: "info", className: "", children: [
9548
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
9549
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: t("passport:buyMenu.summary.networkFee") }),
9550
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("strong", { children: [
9650
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Highlight, { type: "info", className: "", children: [
9651
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
9652
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:buyMenu.summary.networkFee") }),
9653
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("strong", { children: [
9551
9654
  formatPrice(Number(quoteData?.networkFee || "0")),
9552
9655
  " ",
9553
9656
  quoteData?.feeCurrency || ""
9554
9657
  ] })
9555
9658
  ] }),
9556
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
9557
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: t("passport:buyMenu.summary.serviceFee") }),
9558
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("strong", { children: [
9659
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
9660
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:buyMenu.summary.serviceFee") }),
9661
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("strong", { children: [
9559
9662
  formatPrice(Number(quoteData?.feeAmount || "0")),
9560
9663
  " ",
9561
9664
  quoteData?.feeCurrency || ""
9562
9665
  ] })
9563
9666
  ] }),
9564
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
9565
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: t("passport:buyMenu.selectPaymentMode") }),
9566
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("strong", { children: payment.paymentMethod.toUpperCase() })
9667
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "flex justify-between gap-[var(--ui-kit-gap)] leading-5", children: [
9668
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:buyMenu.selectPaymentMode") }),
9669
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("strong", { children: payment?.paymentMethod?.toUpperCase() })
9670
+ ] })
9671
+ ] }),
9672
+ toWalletAddress && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Highlight, { type: "warning", children: [
9673
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "font-bold leading-6", children: t("passport:buyMenu.summary.toAddress.receiver") }),
9674
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Badge, { variant: "secondary", size: "medium", className: "w-full text-center justify-center text-[10px]", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "truncate leading-4", children: toWalletAddress }) }),
9675
+ !!confirmationMessage ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "leading-5", children: confirmationMessage }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("p", { className: "leading-4", children: [
9676
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:buyMenu.summary.toAddress.message") }),
9677
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: t("passport:buyMenu.summary.toAddress.suggestion") })
9567
9678
  ] })
9568
9679
  ] }),
9569
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
9680
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
9570
9681
  Button,
9571
9682
  {
9572
9683
  size: "large",
@@ -9575,9 +9686,9 @@ function BinanceSummary(props) {
9575
9686
  variant: "default",
9576
9687
  onClick: () => checkoutFundWalletOrder(),
9577
9688
  children: [
9578
- redirecting && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react12.LoaderIcon, { size: 16, className: "animate-spin" }),
9579
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: redirecting ? "REDIRECTING..." : String(t("passport:buyMenu.actions.confirmPurchase")).toUpperCase() }),
9580
- !!quoteData?.totalAmount && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("strong", { children: [
9689
+ redirecting && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react12.LoaderIcon, { size: 16, className: "animate-spin" }),
9690
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: redirecting ? "REDIRECTING..." : String(t("passport:buyMenu.actions.confirmPurchase")).toUpperCase() }),
9691
+ !!quoteData?.totalAmount && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("strong", { children: [
9581
9692
  formatPrice(Number(quoteData.totalAmount)),
9582
9693
  " ",
9583
9694
  selectedCrypto.toUpperCase()
@@ -9587,7 +9698,7 @@ function BinanceSummary(props) {
9587
9698
  )
9588
9699
  ] });
9589
9700
  }
9590
- var import_react_query7, import_lucide_react12, import_jsx_runtime36;
9701
+ var import_react_query7, import_lucide_react12, import_jsx_runtime37;
9591
9702
  var init_BinanceSummary = __esm({
9592
9703
  "src/internal/components/BuyMenu/binance/BinanceSummary.tsx"() {
9593
9704
  init_utils2();
@@ -9596,6 +9707,7 @@ var init_BinanceSummary = __esm({
9596
9707
  init_priceFormatter();
9597
9708
  import_react_query7 = require("@tanstack/react-query");
9598
9709
  import_lucide_react12 = require("lucide-react");
9710
+ init_badge();
9599
9711
  init_button();
9600
9712
  init_highlight();
9601
9713
  init_contants();
@@ -9604,71 +9716,15 @@ var init_BinanceSummary = __esm({
9604
9716
  init_api();
9605
9717
  init_config();
9606
9718
  init_useBinanceStore();
9607
- import_jsx_runtime36 = require("react/jsx-runtime");
9608
- }
9609
- });
9610
-
9611
- // src/internal/utils/cn.ts
9612
- function cn2(...inputs) {
9613
- return twMerge((0, import_clsx2.clsx)(inputs));
9614
- }
9615
- var import_clsx2;
9616
- var init_cn = __esm({
9617
- "src/internal/utils/cn.ts"() {
9618
- import_clsx2 = require("clsx");
9619
- init_bundle_mjs();
9620
- }
9621
- });
9622
-
9623
- // src/internal/components/ui/badge.tsx
9624
- function Badge(props) {
9625
- const { className, variant = "secondary", size = "default", ...rest } = props;
9626
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { ...rest, className: cn2(badgeVariants({ variant, size }), className) });
9627
- }
9628
- var import_class_variance_authority2, import_jsx_runtime37, badgeVariants;
9629
- var init_badge = __esm({
9630
- "src/internal/components/ui/badge.tsx"() {
9631
- import_class_variance_authority2 = require("class-variance-authority");
9632
- init_cn();
9633
9719
  import_jsx_runtime37 = require("react/jsx-runtime");
9634
- badgeVariants = (0, import_class_variance_authority2.cva)(
9635
- cn2(
9636
- //
9637
- "inline-flex items-center",
9638
- "border font-semibold",
9639
- "select-none"
9640
- ),
9641
- {
9642
- variants: {
9643
- variant: {
9644
- outline: "border-[var(--ui-kit-bd)] bg-transparent text-[var(--ui-kit-fg)]",
9645
- secondary: "border-[var(--ui-kit-secondary)] bg-[var(--ui-kit-secondary)] text-[var(--ui-kit-fg)]",
9646
- destructive: "border-[var(--ui-kit-bg-error)] bg-[var(--ui-kit-bg-error)] text-[var(--ui-kit-error)]",
9647
- success: "border-[var(--ui-kit-bg-success)] bg-[var(--ui-kit-bg-success)] text-[var(--ui-kit-success)]",
9648
- warning: "border-[var(--ui-kit-bg-warning)] bg-[var(--ui-kit-bg-warning)] text-[var(--ui-kit-warning)]"
9649
- },
9650
- size: {
9651
- default: "h-5 px-2 rounded-full text-[10px] gap-[var(--ui-kit-gap)]",
9652
- medium: "h-8 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)] text-sm gap-[var(--ui-kit-gap)]",
9653
- large: cn2(
9654
- "whitespace-nowrap text-sm font-semibold font-sans",
9655
- "h-12 px-[var(--ui-kit-pd)] rounded-[var(--ui-kit-el-bdrs)]"
9656
- )
9657
- }
9658
- },
9659
- defaultVariants: {
9660
- variant: "secondary"
9661
- }
9662
- }
9663
- );
9664
9720
  }
9665
9721
  });
9666
9722
 
9667
9723
  // src/internal/components/BuyMenu/binance/statuses.ts
9668
- var import_lodash_es6, STATUS_CODE_TO_MESSAGE, STATUSES_FILTERS;
9724
+ var import_lodash_es7, STATUS_CODE_TO_MESSAGE, STATUSES_FILTERS;
9669
9725
  var init_statuses = __esm({
9670
9726
  "src/internal/components/BuyMenu/binance/statuses.ts"() {
9671
- import_lodash_es6 = require("lodash-es");
9727
+ import_lodash_es7 = require("lodash-es");
9672
9728
  STATUS_CODE_TO_MESSAGE = {
9673
9729
  "0": {
9674
9730
  code: "0",
@@ -9773,7 +9829,7 @@ var init_statuses = __esm({
9773
9829
  remarks: "On-ramp"
9774
9830
  }
9775
9831
  };
9776
- STATUSES_FILTERS = (0, import_lodash_es6.values)(STATUS_CODE_TO_MESSAGE).filter(
9832
+ STATUSES_FILTERS = (0, import_lodash_es7.values)(STATUS_CODE_TO_MESSAGE).filter(
9777
9833
  (status) => status.remarks.toLowerCase().includes("on-ramp")
9778
9834
  );
9779
9835
  }
@@ -9909,17 +9965,17 @@ function BinanceTxHistory() {
9909
9965
  txStatuses: SHOW_STATUSES
9910
9966
  })
9911
9967
  });
9912
- const txList = (0, import_react23.useMemo)(
9968
+ const txList = (0, import_react24.useMemo)(
9913
9969
  () => historyData?.pages?.map((p) => p.data).flat(Infinity) || [],
9914
9970
  [historyData]
9915
9971
  );
9916
- const updateExpandable = (0, import_react23.useCallback)(
9917
- (0, import_lodash_es7.debounce)(() => {
9972
+ const updateExpandable = (0, import_react24.useCallback)(
9973
+ (0, import_lodash_es8.debounce)(() => {
9918
9974
  useBuyMenuStore.getState().setRenderKey(`binance-history-loaded-${Date.now()}`);
9919
9975
  }, 200),
9920
9976
  []
9921
9977
  );
9922
- (0, import_react23.useEffect)(() => {
9978
+ (0, import_react24.useEffect)(() => {
9923
9979
  if (isTxDataLoading || !txList?.length || txList.length > 10) return;
9924
9980
  updateExpandable();
9925
9981
  }, [isTxDataLoading, txList]);
@@ -9944,7 +10000,7 @@ function BinanceTxHistory() {
9944
10000
  )
9945
10001
  ] });
9946
10002
  }
9947
- var import_react_query8, import_dayjs, import_lodash_es7, import_lucide_react13, import_react23, import_jsx_runtime38, TRANSACTIONS_PAGESIZE, SHOW_STATUSES;
10003
+ var import_react_query8, import_dayjs, import_lodash_es8, import_lucide_react13, import_react24, import_jsx_runtime38, TRANSACTIONS_PAGESIZE, SHOW_STATUSES;
9948
10004
  var init_BinanceTxHistory = __esm({
9949
10005
  "src/internal/components/BuyMenu/binance/BinanceTxHistory.tsx"() {
9950
10006
  init_tokens();
@@ -9953,9 +10009,9 @@ var init_BinanceTxHistory = __esm({
9953
10009
  init_i18n();
9954
10010
  import_react_query8 = require("@tanstack/react-query");
9955
10011
  import_dayjs = __toESM(require("dayjs"), 1);
9956
- import_lodash_es7 = require("lodash-es");
10012
+ import_lodash_es8 = require("lodash-es");
9957
10013
  import_lucide_react13 = require("lucide-react");
9958
- import_react23 = require("react");
10014
+ import_react24 = require("react");
9959
10015
  init_priceFormatter();
9960
10016
  init_badge();
9961
10017
  init_button();
@@ -9973,8 +10029,8 @@ var init_BinanceTxHistory = __esm({
9973
10029
  // src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts
9974
10030
  function useBinanceSseTxTracing(walletAddress) {
9975
10031
  const qc = (0, import_react_query9.useQueryClient)();
9976
- const debounceRef = (0, import_react24.useRef)(null);
9977
- (0, import_react24.useEffect)(() => {
10032
+ const debounceRef = (0, import_react25.useRef)(null);
10033
+ (0, import_react25.useEffect)(() => {
9978
10034
  if (!walletAddress) return;
9979
10035
  const iframeManager = getIframeManager();
9980
10036
  if (!iframeManager) return;
@@ -9996,11 +10052,11 @@ function useBinanceSseTxTracing(walletAddress) {
9996
10052
  };
9997
10053
  }, [walletAddress, qc]);
9998
10054
  }
9999
- var import_react_query9, import_react24;
10055
+ var import_react_query9, import_react25;
10000
10056
  var init_useBinanceSseTracing = __esm({
10001
10057
  "src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts"() {
10002
10058
  import_react_query9 = require("@tanstack/react-query");
10003
- import_react24 = require("react");
10059
+ import_react25 = require("react");
10004
10060
  init_iframe_manager();
10005
10061
  init_queryKeys();
10006
10062
  init_api();
@@ -10037,7 +10093,7 @@ function Binance() {
10037
10093
  } = useBuyMenuStore();
10038
10094
  const paymentMode = useBinanceStore((st) => st.paymentMode);
10039
10095
  const isCurrurenciesSelected = !!selectedCrypto && !!selectedFiat;
10040
- (0, import_react25.useEffect)(() => {
10096
+ (0, import_react26.useEffect)(() => {
10041
10097
  if (!isCurrurenciesSelected) return;
10042
10098
  useBuyMenuStore.getState().setRenderKey(`${selectedCrypto}-${selectedFiat}-${Date.now()}`);
10043
10099
  }, [isCurrurenciesSelected]);
@@ -10072,7 +10128,7 @@ function Binance() {
10072
10128
  });
10073
10129
  const paymentModes = paymentModesData?.data?.paymentMethods || [];
10074
10130
  const selectedPaymentMode = paymentModes?.find((el) => getPayMethodID(el) === paymentMode) || null;
10075
- (0, import_react25.useEffect)(() => {
10131
+ (0, import_react26.useEffect)(() => {
10076
10132
  useBuyMenuStore.getState().setMinAmount(Number(selectedPaymentMode?.fiatMinLimit || "0"));
10077
10133
  }, [selectedPaymentMode]);
10078
10134
  const { mutate: estimateQuote, isPending: isQuoteEstimating } = (0, import_react_query10.useMutation)({
@@ -10100,21 +10156,22 @@ function Binance() {
10100
10156
  }
10101
10157
  });
10102
10158
  const availableFiats = (tradingPairsData?.data?.fiatCurrencies || []).map((ticker) => ({ ticker }));
10103
- (0, import_react25.useEffect)(() => {
10159
+ (0, import_react26.useEffect)(() => {
10104
10160
  if (!!selectedFiat || !availableFiats?.length) return;
10105
- const targetFiat = availableFiats.find((item) => item.ticker === "USD" || item.ticker === "EUR") || availableFiats[0];
10161
+ const targetFiat = availableFiats.find((item) => PREFERRED_FIATS.includes(item.ticker)) || availableFiats[0];
10106
10162
  useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
10107
10163
  }, [availableFiats, selectedFiat]);
10108
- (0, import_react25.useEffect)(() => {
10164
+ (0, import_react26.useEffect)(() => {
10109
10165
  if (!!selectedCrypto || !networkAvailableCryptoList?.length) return;
10110
- useBuyMenuStore.getState().setSelectedCrypto(networkAvailableCryptoList[0].cryptoCurrency);
10166
+ const targetCrypto = networkAvailableCryptoList.find((item) => PREFERRED_CRYPTOS.includes(item.cryptoCurrency)) || networkAvailableCryptoList[0];
10167
+ useBuyMenuStore.getState().setSelectedCrypto(targetCrypto.cryptoCurrency);
10111
10168
  }, [networkAvailableCryptoList, selectedCrypto]);
10112
- (0, import_react25.useEffect)(() => {
10169
+ (0, import_react26.useEffect)(() => {
10113
10170
  if (!!paymentMode || !paymentModes.length) return;
10114
10171
  const targetPaymentMode = paymentModes.find((item) => item.payMethodCode === PREFERRED_PAYMENT_METHOD) || paymentModes[0];
10115
10172
  useBinanceStore.getState().setPaymentMode(getPayMethodID(targetPaymentMode));
10116
10173
  }, [paymentModes]);
10117
- (0, import_react25.useEffect)(() => {
10174
+ (0, import_react26.useEffect)(() => {
10118
10175
  return () => {
10119
10176
  useBinanceStore.getState().setPaymentMode(null);
10120
10177
  qc.resetQueries({ queryKey: [QUERY_KEYS2.binanceTradingPairs] });
@@ -10236,7 +10293,7 @@ function Binance() {
10236
10293
  )
10237
10294
  ] });
10238
10295
  }
10239
- var import_react_query10, import_lucide_react14, import_react25, import_jsx_runtime39, PREFERRED_PAYMENT_METHOD;
10296
+ var import_react_query10, import_lucide_react14, import_react26, import_jsx_runtime39, PREFERRED_PAYMENT_METHOD, PREFERRED_FIATS, PREFERRED_CRYPTOS;
10240
10297
  var init_Binance = __esm({
10241
10298
  "src/internal/components/BuyMenu/binance/Binance.tsx"() {
10242
10299
  init_utils2();
@@ -10244,7 +10301,7 @@ var init_Binance = __esm({
10244
10301
  init_i18n();
10245
10302
  import_react_query10 = require("@tanstack/react-query");
10246
10303
  import_lucide_react14 = require("lucide-react");
10247
- import_react25 = require("react");
10304
+ import_react26 = require("react");
10248
10305
  init_button();
10249
10306
  init_highlight();
10250
10307
  init_input();
@@ -10261,6 +10318,8 @@ var init_Binance = __esm({
10261
10318
  init_utils6();
10262
10319
  import_jsx_runtime39 = require("react/jsx-runtime");
10263
10320
  PREFERRED_PAYMENT_METHOD = "BUY_CARD";
10321
+ PREFERRED_FIATS = ["USD", "EUR"];
10322
+ PREFERRED_CRYPTOS = ["USDT", "LUMIA"];
10264
10323
  }
10265
10324
  });
10266
10325
 
@@ -10516,7 +10575,7 @@ function FinchPayTxHistoryItem(props) {
10516
10575
  function FinchPayTxHistory() {
10517
10576
  const { t } = useT();
10518
10577
  const walletAddress = useSession((st) => st.address);
10519
- const [cursor, setCursor] = (0, import_react26.useState)(1);
10578
+ const [cursor, setCursor] = (0, import_react27.useState)(1);
10520
10579
  const {
10521
10580
  data: txData,
10522
10581
  isLoading: isTxDataLoading,
@@ -10538,7 +10597,7 @@ function FinchPayTxHistory() {
10538
10597
  const pageCount = loadedPages[loadedPages.length - 1]?.pageCount || 1;
10539
10598
  const txList = loadedPages.map((p) => p.data)[cursor - 1] || [];
10540
10599
  console.log("[FINCHPAY] txList", txData);
10541
- const handleNextPage = (0, import_react26.useCallback)(
10600
+ const handleNextPage = (0, import_react27.useCallback)(
10542
10601
  async (curCursor, curPageParams) => {
10543
10602
  const maxLoadedPage = Math.max(...curPageParams);
10544
10603
  if (curCursor !== maxLoadedPage) {
@@ -10593,7 +10652,7 @@ function FinchPayTxHistory() {
10593
10652
  ] })
10594
10653
  ] });
10595
10654
  }
10596
- var import_react_query12, import_dayjs2, import_lucide_react16, import_react26, import_jsx_runtime41, TRANSACTIONS_PAGESIZE2;
10655
+ var import_react_query12, import_dayjs2, import_lucide_react16, import_react27, import_jsx_runtime41, TRANSACTIONS_PAGESIZE2;
10597
10656
  var init_FinchPayTxHistory = __esm({
10598
10657
  "src/internal/components/BuyMenu/finchpay/FinchPayTxHistory.tsx"() {
10599
10658
  init_utils2();
@@ -10602,7 +10661,7 @@ var init_FinchPayTxHistory = __esm({
10602
10661
  import_react_query12 = require("@tanstack/react-query");
10603
10662
  import_dayjs2 = __toESM(require("dayjs"), 1);
10604
10663
  import_lucide_react16 = require("lucide-react");
10605
- import_react26 = require("react");
10664
+ import_react27 = require("react");
10606
10665
  init_priceFormatter();
10607
10666
  init_badge();
10608
10667
  init_button();
@@ -10629,8 +10688,8 @@ var init_networks = __esm({
10629
10688
  // src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts
10630
10689
  function useFinchpaySseTxTracing(walletAddress) {
10631
10690
  const qc = (0, import_react_query13.useQueryClient)();
10632
- const debounceRef = (0, import_react27.useRef)(null);
10633
- (0, import_react27.useEffect)(() => {
10691
+ const debounceRef = (0, import_react28.useRef)(null);
10692
+ (0, import_react28.useEffect)(() => {
10634
10693
  if (!walletAddress) return;
10635
10694
  const iframeManager = getIframeManager();
10636
10695
  if (!iframeManager) return;
@@ -10652,11 +10711,11 @@ function useFinchpaySseTxTracing(walletAddress) {
10652
10711
  };
10653
10712
  }, [walletAddress, qc]);
10654
10713
  }
10655
- var import_react_query13, import_react27;
10714
+ var import_react_query13, import_react28;
10656
10715
  var init_useFinchpaySseTxTracing = __esm({
10657
10716
  "src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts"() {
10658
10717
  import_react_query13 = require("@tanstack/react-query");
10659
- import_react27 = require("react");
10718
+ import_react28 = require("react");
10660
10719
  init_iframe_manager();
10661
10720
  init_queryKeys();
10662
10721
  init_api2();
@@ -10754,11 +10813,11 @@ function FinchPay() {
10754
10813
  })
10755
10814
  });
10756
10815
  const minimum = Number(limitsData?.min_amount || "0");
10757
- (0, import_react28.useEffect)(() => {
10816
+ (0, import_react29.useEffect)(() => {
10758
10817
  if (minimum <= 0) return;
10759
10818
  useBuyMenuStore.getState().setMinAmount(minimum);
10760
10819
  }, [minimum]);
10761
- (0, import_react28.useEffect)(() => {
10820
+ (0, import_react29.useEffect)(() => {
10762
10821
  if (srcInputAmount >= minimum) return;
10763
10822
  useBuyMenuStore.getState().setRenderKey(`finchpay-input-minimum-warning-${Date.now()}`);
10764
10823
  }, [minimum, srcInputAmount]);
@@ -10786,23 +10845,23 @@ function FinchPay() {
10786
10845
  // defaults to CARD estimation, widgetUrl
10787
10846
  })
10788
10847
  });
10789
- (0, import_react28.useEffect)(() => {
10848
+ (0, import_react29.useEffect)(() => {
10790
10849
  const { error: errorTitle, message: errorMessage } = handleErrors([currenciesError, limitsError, estimateError]);
10791
10850
  if (!errorTitle && !errorMessage) return;
10792
10851
  console.error(`[BuyModal][Binance] ${errorTitle}: ${errorMessage}`);
10793
10852
  useBuyMenuStore.getState().setError(errorMessage);
10794
10853
  }, [currenciesError, limitsError, estimateError]);
10795
- (0, import_react28.useEffect)(() => {
10854
+ (0, import_react29.useEffect)(() => {
10796
10855
  if (!!selectedFiat || currenciesData.fiats.length === 0) return;
10797
10856
  const fallbackFiat = currenciesData.fiats[0];
10798
10857
  const targetFiat = currenciesData.fiats.find((f) => f.ticker.toUpperCase() === "USD") || fallbackFiat;
10799
10858
  useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
10800
10859
  }, [currenciesData, selectedFiat]);
10801
- (0, import_react28.useEffect)(() => {
10860
+ (0, import_react29.useEffect)(() => {
10802
10861
  if (!!selectedCrypto || currenciesData.currentNetworkCoins.length === 0) return;
10803
10862
  useBuyMenuStore.getState().setSelectedCrypto(currenciesData.currentNetworkCoins[0].ticker);
10804
10863
  }, [currenciesData, selectedCrypto]);
10805
- (0, import_react28.useEffect)(() => {
10864
+ (0, import_react29.useEffect)(() => {
10806
10865
  return () => {
10807
10866
  qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayCurrencies] });
10808
10867
  qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayLimits] });
@@ -10924,7 +10983,7 @@ function FinchPay() {
10924
10983
  )
10925
10984
  ] });
10926
10985
  }
10927
- var import_react_query14, import_lucide_react17, import_react28, import_jsx_runtime42;
10986
+ var import_react_query14, import_lucide_react17, import_react29, import_jsx_runtime42;
10928
10987
  var init_FinchPay = __esm({
10929
10988
  "src/internal/components/BuyMenu/finchpay/FinchPay.tsx"() {
10930
10989
  init_priceFormatter();
@@ -10933,7 +10992,7 @@ var init_FinchPay = __esm({
10933
10992
  init_i18n();
10934
10993
  import_react_query14 = require("@tanstack/react-query");
10935
10994
  import_lucide_react17 = require("lucide-react");
10936
- import_react28 = require("react");
10995
+ import_react29 = require("react");
10937
10996
  init_button();
10938
10997
  init_highlight();
10939
10998
  init_input();
@@ -11061,62 +11120,44 @@ var init_ProviderSelector = __esm({
11061
11120
  }
11062
11121
  });
11063
11122
 
11064
- // src/internal/utils/debounce.ts
11065
- function debounce5(func, waitFor) {
11066
- let timeout;
11067
- return (...args) => {
11068
- if (timeout) clearTimeout(timeout);
11069
- timeout = setTimeout(() => func(...args), waitFor);
11070
- };
11071
- }
11072
- var init_debounce = __esm({
11073
- "src/internal/utils/debounce.ts"() {
11074
- }
11075
- });
11076
-
11077
11123
  // src/internal/components/BuyMenu/useHandleInputAmount.ts
11078
- var import_react29, ON_INPUT_QUERY_DELAY, useHandleInputAmount;
11124
+ var import_react30, ON_INPUT_QUERY_DELAY, useHandleInputAmount;
11079
11125
  var init_useHandleInputAmount = __esm({
11080
11126
  "src/internal/components/BuyMenu/useHandleInputAmount.ts"() {
11081
- import_react29 = require("react");
11082
- init_debounce();
11127
+ import_react30 = require("react");
11083
11128
  init_contants();
11084
11129
  init_useBuyMenuStore();
11085
11130
  ON_INPUT_QUERY_DELAY = 1500;
11086
11131
  useHandleInputAmount = () => {
11087
- const lastRampProviderRef = (0, import_react29.useRef)(DEFAULT_PROVIDER2);
11132
+ const lastRampProviderRef = (0, import_react30.useRef)(DEFAULT_PROVIDER2);
11088
11133
  const rampProvider = useBuyMenuStore((st) => st.rampProvider);
11089
11134
  const srcInputAmount = useBuyMenuStore((st) => st.srcInputAmount);
11090
11135
  const minAmount = useBuyMenuStore((st) => st.minAmount);
11091
- const setQueryAmountDebounced = (0, import_react29.useCallback)(
11092
- debounce5((inputAmount) => {
11093
- const checkedValue = Math.ceil(Math.max(inputAmount, minAmount));
11136
+ const queryAmountTimer = (0, import_react30.useRef)(null);
11137
+ (0, import_react30.useEffect)(() => {
11138
+ if (queryAmountTimer.current) clearTimeout(queryAmountTimer.current);
11139
+ queryAmountTimer.current = setTimeout(() => {
11140
+ const checkedValue = Math.ceil(Math.max(Number(srcInputAmount), Number(minAmount)));
11094
11141
  useBuyMenuStore.getState().setSrcInputAmount(checkedValue);
11095
11142
  useBuyMenuStore.getState().setSrcQueryAmount(checkedValue);
11096
- }, ON_INPUT_QUERY_DELAY),
11097
- [minAmount]
11098
- );
11099
- (0, import_react29.useEffect)(() => setQueryAmountDebounced(srcInputAmount), [srcInputAmount, setQueryAmountDebounced]);
11100
- (0, import_react29.useEffect)(() => {
11143
+ }, ON_INPUT_QUERY_DELAY);
11144
+ }, [minAmount, srcInputAmount]);
11145
+ (0, import_react30.useEffect)(() => {
11101
11146
  if (lastRampProviderRef.current === rampProvider) return;
11102
11147
  const {
11103
11148
  setIsProviderSummary,
11104
11149
  setIsCryptoSelector,
11105
11150
  setIsFiatSelector,
11106
- setIsPaymentModeSelector,
11107
- setSelectedCrypto,
11108
- setSelectedFiat,
11109
- setSrcInputAmount,
11110
- setSrcQueryAmount
11151
+ setIsPaymentModeSelector
11152
+ // setSelectedCrypto,
11153
+ // setSelectedFiat
11154
+ // setSrcInputAmount,
11155
+ // setSrcQueryAmount
11111
11156
  } = useBuyMenuStore.getState();
11112
11157
  setIsProviderSummary(false);
11113
11158
  setIsCryptoSelector(false);
11114
11159
  setIsFiatSelector(false);
11115
11160
  setIsPaymentModeSelector(false);
11116
- setSelectedCrypto(null);
11117
- setSelectedFiat(null);
11118
- setSrcInputAmount(0);
11119
- setSrcQueryAmount(0);
11120
11161
  lastRampProviderRef.current = rampProvider;
11121
11162
  }, [rampProvider]);
11122
11163
  };
@@ -11127,8 +11168,8 @@ var init_useHandleInputAmount = __esm({
11127
11168
  function BuyMenu() {
11128
11169
  const { t } = useT();
11129
11170
  const walletAddress = useSession((st) => st.address);
11130
- const setPage = useLayoutDataStore((st) => st.setPage);
11131
11171
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
11172
+ useBuyMenuParams();
11132
11173
  useHandleInputAmount();
11133
11174
  const renderKey = useBuyMenuStore((st) => st.renderKey);
11134
11175
  const rampProvider = useBuyMenuStore((st) => st.rampProvider);
@@ -11194,7 +11235,7 @@ function BuyMenu() {
11194
11235
  setIsPaymentModeSelector(false);
11195
11236
  return;
11196
11237
  }
11197
- setPage("main-menu" /* MAIN_MENU */);
11238
+ useLayoutDataStore.getState().setPage("main-menu" /* MAIN_MENU */);
11198
11239
  },
11199
11240
  children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react18.ArrowLeft, { className: "h-4 w-4" })
11200
11241
  }
@@ -11484,8 +11525,8 @@ function ChainItem(props) {
11484
11525
  const { t } = useT();
11485
11526
  const isSessionLoading = useSession((st) => st.isLoading);
11486
11527
  const activeChainId = useSession((st) => st.activeChainId);
11487
- const [copiedChainId, setCopiedChainId] = (0, import_react30.useState)(null);
11488
- const copiedResetTimerRef = (0, import_react30.useRef)(null);
11528
+ const [copiedChainId, setCopiedChainId] = (0, import_react31.useState)(null);
11529
+ const copiedResetTimerRef = (0, import_react31.useRef)(null);
11489
11530
  const isActiveChain = activeChainId === chainId;
11490
11531
  const paymasterAddress = isActiveChain ? activePaymasterData?.address : null;
11491
11532
  const paymasterExplorerUrl = paymasterAddress ? getPaymasterExplorerUrl(chainId, paymasterAddress) : null;
@@ -11582,7 +11623,7 @@ function ChainItem(props) {
11582
11623
  }
11583
11624
  );
11584
11625
  }
11585
- var import_read13, import_lucide_react19, import_react30, import_jsx_runtime51;
11626
+ var import_read13, import_lucide_react19, import_react31, import_jsx_runtime51;
11586
11627
  var init_ChainItem = __esm({
11587
11628
  "src/internal/components/ChainsMenu/ChainItem.tsx"() {
11588
11629
  init_SessionContext();
@@ -11592,7 +11633,7 @@ var init_ChainItem = __esm({
11592
11633
  init_truncateMiddle();
11593
11634
  import_read13 = require("@embarkai/core/read");
11594
11635
  import_lucide_react19 = require("lucide-react");
11595
- import_react30 = require("react");
11636
+ import_react31 = require("react");
11596
11637
  init_badge();
11597
11638
  init_button();
11598
11639
  import_jsx_runtime51 = require("react/jsx-runtime");
@@ -11603,11 +11644,11 @@ var init_ChainItem = __esm({
11603
11644
  function ChainsMenu() {
11604
11645
  const config = useProviderConfig().config;
11605
11646
  const activeChainId = useSession((st) => st.activeChainId);
11606
- const [isTestnets, setIsTestnets] = (0, import_react31.useState)(false);
11607
- const [nextChainId, setNextChainId] = (0, import_react31.useState)(null);
11647
+ const [isTestnets, setIsTestnets] = (0, import_react32.useState)(false);
11648
+ const [nextChainId, setNextChainId] = (0, import_react32.useState)(null);
11608
11649
  const { t } = useT();
11609
11650
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
11610
- const visibleNetworks = (0, import_react31.useMemo)(() => {
11651
+ const visibleNetworks = (0, import_react32.useMemo)(() => {
11611
11652
  return NETWORK_OPTIONS.filter(
11612
11653
  (option) => option.isActive && (isTestnets ? true : import_read14.SUPPORTED_MAINNETS.includes(option.chainId))
11613
11654
  );
@@ -11681,7 +11722,7 @@ function ChainsMenu() {
11681
11722
  }
11682
11723
  );
11683
11724
  }
11684
- var import_core2, import_read14, import_react_query15, import_lucide_react20, import_react31, import_jsx_runtime52;
11725
+ var import_core2, import_read14, import_react_query15, import_lucide_react20, import_react32, import_jsx_runtime52;
11685
11726
  var init_ChainsMenu = __esm({
11686
11727
  "src/internal/components/ChainsMenu/ChainsMenu.tsx"() {
11687
11728
  init_networks3();
@@ -11692,7 +11733,7 @@ var init_ChainsMenu = __esm({
11692
11733
  import_read14 = require("@embarkai/core/read");
11693
11734
  import_react_query15 = require("@tanstack/react-query");
11694
11735
  import_lucide_react20 = require("lucide-react");
11695
- import_react31 = require("react");
11736
+ import_react32 = require("react");
11696
11737
  init_resolve_paymaster();
11697
11738
  init_useLayoutDataStore();
11698
11739
  init_useLayoutStore();
@@ -11880,8 +11921,8 @@ function DeviceLinkScreen() {
11880
11921
  const setPage = useLayoutDataStore((s) => s.setPage);
11881
11922
  const maxScrollHeight = useLayoutStore((s) => s.maxScrollHeight);
11882
11923
  const { mutate: link, isPending } = useLinkDevice();
11883
- const [code, setCode] = (0, import_react32.useState)("");
11884
- const [error, setError] = (0, import_react32.useState)(null);
11924
+ const [code, setCode] = (0, import_react33.useState)("");
11925
+ const [error, setError] = (0, import_react33.useState)(null);
11885
11926
  const isValid = code.length === 6 && VALID_CHARS.test(code);
11886
11927
  function handleCodeChange(value) {
11887
11928
  const upper = value.toUpperCase().slice(0, 6);
@@ -11940,10 +11981,10 @@ function DeviceLinkScreen() {
11940
11981
  }
11941
11982
  );
11942
11983
  }
11943
- var import_react32, import_lucide_react22, import_jsx_runtime54, VALID_CHARS;
11984
+ var import_react33, import_lucide_react22, import_jsx_runtime54, VALID_CHARS;
11944
11985
  var init_DeviceLinkScreen = __esm({
11945
11986
  "src/internal/components/DevicesMenu/DeviceLinkScreen.tsx"() {
11946
- import_react32 = require("react");
11987
+ import_react33 = require("react");
11947
11988
  import_lucide_react22 = require("lucide-react");
11948
11989
  init_Expandable2();
11949
11990
  init_button();
@@ -12476,19 +12517,19 @@ function DeviceManageScreen() {
12476
12517
  const userId = session?.mpcUserId || "";
12477
12518
  const deviceId = pageParams?.deviceId;
12478
12519
  const deviceName = pageParams?.deviceName;
12479
- const guardianRef = (0, import_react33.useRef)(null);
12480
- const [screen, setScreen] = (0, import_react33.useState)({ step: "connecting" });
12481
- const [actionState, setActionState] = (0, import_react33.useState)(null);
12482
- const [password, setPassword] = (0, import_react33.useState)("");
12483
- const [statusMessage, setStatusMessage] = (0, import_react33.useState)(null);
12484
- const [errorMessage, setErrorMessage] = (0, import_react33.useState)(null);
12485
- const [waitingConfirm, setWaitingConfirm] = (0, import_react33.useState)(false);
12486
- (0, import_react33.useEffect)(() => {
12520
+ const guardianRef = (0, import_react34.useRef)(null);
12521
+ const [screen, setScreen] = (0, import_react34.useState)({ step: "connecting" });
12522
+ const [actionState, setActionState] = (0, import_react34.useState)(null);
12523
+ const [password, setPassword] = (0, import_react34.useState)("");
12524
+ const [statusMessage, setStatusMessage] = (0, import_react34.useState)(null);
12525
+ const [errorMessage, setErrorMessage] = (0, import_react34.useState)(null);
12526
+ const [waitingConfirm, setWaitingConfirm] = (0, import_react34.useState)(false);
12527
+ (0, import_react34.useEffect)(() => {
12487
12528
  if (!statusMessage) return;
12488
12529
  const t = setTimeout(() => setStatusMessage(null), 3e3);
12489
12530
  return () => clearTimeout(t);
12490
12531
  }, [statusMessage]);
12491
- (0, import_react33.useEffect)(() => {
12532
+ (0, import_react34.useEffect)(() => {
12492
12533
  if (!deviceId || !isWebSerialAvailable()) {
12493
12534
  setScreen({ step: "error", message: "WebSerial not available" });
12494
12535
  return;
@@ -12520,7 +12561,7 @@ function DeviceManageScreen() {
12520
12561
  guardianRef.current?.close();
12521
12562
  };
12522
12563
  }, [deviceId]);
12523
- const refreshList = (0, import_react33.useCallback)(async () => {
12564
+ const refreshList = (0, import_react34.useCallback)(async () => {
12524
12565
  const guardian = guardianRef.current;
12525
12566
  if (!guardian || screen.step !== "connected") return;
12526
12567
  try {
@@ -12529,7 +12570,7 @@ function DeviceManageScreen() {
12529
12570
  } catch {
12530
12571
  }
12531
12572
  }, [screen]);
12532
- const handleBackup = (0, import_react33.useCallback)(async () => {
12573
+ const handleBackup = (0, import_react34.useCallback)(async () => {
12533
12574
  const guardian = guardianRef.current;
12534
12575
  const iframe4 = getIframeManager();
12535
12576
  if (!guardian || !iframe4 || !userId) return;
@@ -12553,7 +12594,7 @@ function DeviceManageScreen() {
12553
12594
  setActionState(null);
12554
12595
  }
12555
12596
  }, [password, userId, refreshList]);
12556
- const handleOverwrite = (0, import_react33.useCallback)(async () => {
12597
+ const handleOverwrite = (0, import_react34.useCallback)(async () => {
12557
12598
  const guardian = guardianRef.current;
12558
12599
  const iframe4 = getIframeManager();
12559
12600
  if (!guardian || !iframe4 || !userId) return;
@@ -12573,7 +12614,7 @@ function DeviceManageScreen() {
12573
12614
  setActionState(null);
12574
12615
  }
12575
12616
  }, [password, userId, refreshList]);
12576
- const handleDelete = (0, import_react33.useCallback)(async (keyshareId) => {
12617
+ const handleDelete = (0, import_react34.useCallback)(async (keyshareId) => {
12577
12618
  const guardian = guardianRef.current;
12578
12619
  if (!guardian) return;
12579
12620
  setActionState({ action: "delete", keyshareId, substep: "confirm-device" });
@@ -12740,10 +12781,10 @@ function DeviceManageScreen() {
12740
12781
  }
12741
12782
  );
12742
12783
  }
12743
- var import_react33, import_lucide_react23, import_jsx_runtime55;
12784
+ var import_react34, import_lucide_react23, import_jsx_runtime55;
12744
12785
  var init_DeviceManageScreen = __esm({
12745
12786
  "src/internal/components/DevicesMenu/DeviceManageScreen.tsx"() {
12746
- import_react33 = require("react");
12787
+ import_react34 = require("react");
12747
12788
  import_lucide_react23 = require("lucide-react");
12748
12789
  init_Expandable2();
12749
12790
  init_button();
@@ -12766,11 +12807,11 @@ function DeviceRestoreScreen() {
12766
12807
  const keyshareId = pageParams?.keyshareId;
12767
12808
  const deviceId = pageParams?.deviceId;
12768
12809
  const deviceName = pageParams?.deviceName;
12769
- const [password, setPassword] = (0, import_react34.useState)("");
12770
- const [isWorking, setIsWorking] = (0, import_react34.useState)(false);
12771
- const [statusMessage, setStatusMessage] = (0, import_react34.useState)(null);
12772
- const [errorMessage, setErrorMessage] = (0, import_react34.useState)(null);
12773
- const handleRestore = (0, import_react34.useCallback)(async () => {
12810
+ const [password, setPassword] = (0, import_react35.useState)("");
12811
+ const [isWorking, setIsWorking] = (0, import_react35.useState)(false);
12812
+ const [statusMessage, setStatusMessage] = (0, import_react35.useState)(null);
12813
+ const [errorMessage, setErrorMessage] = (0, import_react35.useState)(null);
12814
+ const handleRestore = (0, import_react35.useCallback)(async () => {
12774
12815
  if (!password || !keyshareId || !userId) return;
12775
12816
  const iframe4 = getIframeManager();
12776
12817
  if (!iframe4) {
@@ -12857,10 +12898,10 @@ function DeviceRestoreScreen() {
12857
12898
  }
12858
12899
  );
12859
12900
  }
12860
- var import_react34, import_lucide_react24, import_jsx_runtime56;
12901
+ var import_react35, import_lucide_react24, import_jsx_runtime56;
12861
12902
  var init_DeviceRestoreScreen = __esm({
12862
12903
  "src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx"() {
12863
- import_react34 = require("react");
12904
+ import_react35 = require("react");
12864
12905
  import_lucide_react24 = require("lucide-react");
12865
12906
  init_Expandable2();
12866
12907
  init_button();
@@ -12883,8 +12924,8 @@ function truncateAddress(address) {
12883
12924
  return `${address.slice(0, 6)}...${address.slice(-4)}`;
12884
12925
  }
12885
12926
  function DeviceRow({ device }) {
12886
- const [confirmingUnlink, setConfirmingUnlink] = (0, import_react35.useState)(false);
12887
- const [unlinkError, setUnlinkError] = (0, import_react35.useState)(null);
12927
+ const [confirmingUnlink, setConfirmingUnlink] = (0, import_react36.useState)(false);
12928
+ const [unlinkError, setUnlinkError] = (0, import_react36.useState)(null);
12888
12929
  const { mutate: unlink, isPending } = useUnlinkDevice();
12889
12930
  if (confirmingUnlink) {
12890
12931
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-2 p-3 rounded-lg bg-[var(--ui-kit-bg)]", children: [
@@ -12998,10 +13039,10 @@ function DevicesMenu() {
12998
13039
  }
12999
13040
  );
13000
13041
  }
13001
- var import_react35, import_lucide_react25, import_jsx_runtime57;
13042
+ var import_react36, import_lucide_react25, import_jsx_runtime57;
13002
13043
  var init_DevicesMenu = __esm({
13003
13044
  "src/internal/components/DevicesMenu/DevicesMenu.tsx"() {
13004
- import_react35 = require("react");
13045
+ import_react36 = require("react");
13005
13046
  import_lucide_react25 = require("lucide-react");
13006
13047
  init_Expandable2();
13007
13048
  init_button();
@@ -13094,7 +13135,7 @@ function useOnRestoreSuccess() {
13094
13135
  setStatus
13095
13136
  } = useSession();
13096
13137
  const { setError, setSuccess } = useRestoreStore();
13097
- const createSessionWithKeyshare = (0, import_react36.useCallback)(
13138
+ const createSessionWithKeyshare = (0, import_react37.useCallback)(
13098
13139
  async (userId, hasServerKeyshare, isNewUser) => {
13099
13140
  try {
13100
13141
  try {
@@ -13135,7 +13176,7 @@ function useOnRestoreSuccess() {
13135
13176
  },
13136
13177
  [setStatus, usePaymaster, activeChainId, publicClient]
13137
13178
  );
13138
- const onRestoreSuccess = (0, import_react36.useCallback)(async () => {
13179
+ const onRestoreSuccess = (0, import_react37.useCallback)(async () => {
13139
13180
  const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
13140
13181
  const verify = await verifyToken2();
13141
13182
  const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
@@ -13200,12 +13241,12 @@ function useOnRestoreSuccess() {
13200
13241
  ]);
13201
13242
  return { onRestoreSuccess };
13202
13243
  }
13203
- var import_react36;
13244
+ var import_react37;
13204
13245
  var init_useOnRestoreSuccess = __esm({
13205
13246
  "src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts"() {
13206
13247
  init_ProviderContext();
13207
13248
  init_SessionContext();
13208
- import_react36 = require("react");
13249
+ import_react37 = require("react");
13209
13250
  init_useLayoutDataStore();
13210
13251
  init_useLayoutStore();
13211
13252
  init_useRestoreStore();
@@ -13630,7 +13671,7 @@ function useCreateBackup() {
13630
13671
  const usePasskey = useRestoreStore((st) => st.usePasskey);
13631
13672
  const restorePassword = useRestoreStore((st) => st.restorePassword);
13632
13673
  const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
13633
- (0, import_react37.useEffect)(() => {
13674
+ (0, import_react38.useEffect)(() => {
13634
13675
  if (!hasServerVault) {
13635
13676
  useRestoreStore.getState().setMethod("server");
13636
13677
  useLayoutStore.getState().setIsDialogForced(true);
@@ -13638,7 +13679,7 @@ function useCreateBackup() {
13638
13679
  }, [hasServerVault]);
13639
13680
  const recoveryUserId = useSession((st) => st.recoveryUserId);
13640
13681
  const passportUserId = session?.mpcUserId || recoveryUserId || "";
13641
- const onBackupSuccess = (0, import_react37.useCallback)(() => {
13682
+ const onBackupSuccess = (0, import_react38.useCallback)(() => {
13642
13683
  console.log("[EMBARKAI BACKUP] Backup created successfully");
13643
13684
  }, [hasServerVault]);
13644
13685
  const { mutate: createPasswordBackup, isPending: isPasswordBackupCreating } = (0, import_react_query17.useMutation)({
@@ -13798,12 +13839,12 @@ function useCreateBackup() {
13798
13839
  createPasskey
13799
13840
  };
13800
13841
  }
13801
- var import_react_query17, import_react37;
13842
+ var import_react_query17, import_react38;
13802
13843
  var init_useCreateBackup = __esm({
13803
13844
  "src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts"() {
13804
13845
  init_SessionContext();
13805
13846
  import_react_query17 = require("@tanstack/react-query");
13806
- import_react37 = require("react");
13847
+ import_react38 = require("react");
13807
13848
  init_auth();
13808
13849
  init_useLayoutStore();
13809
13850
  init_iframe_manager();
@@ -13938,7 +13979,7 @@ function useValidateFileBackup() {
13938
13979
  const restoreFile = useRestoreStore((st) => st.restoreFile);
13939
13980
  const setError = useRestoreStore((st) => st.setError);
13940
13981
  const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
13941
- (0, import_react38.useEffect)(() => {
13982
+ (0, import_react39.useEffect)(() => {
13942
13983
  if (!restoreFile) {
13943
13984
  return;
13944
13985
  }
@@ -13959,10 +14000,10 @@ function useValidateFileBackup() {
13959
14000
  reader.readAsText(restoreFile);
13960
14001
  }, [restoreFile]);
13961
14002
  }
13962
- var import_react38;
14003
+ var import_react39;
13963
14004
  var init_useValidateFileBackup = __esm({
13964
14005
  "src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts"() {
13965
- import_react38 = require("react");
14006
+ import_react39 = require("react");
13966
14007
  init_useRestoreStore();
13967
14008
  }
13968
14009
  });
@@ -13990,7 +14031,7 @@ function MethodSelector(props) {
13990
14031
  setError,
13991
14032
  setSuccess
13992
14033
  } = useRestoreStore();
13993
- const recoveryRenderMethods = (0, import_react39.useMemo)(() => {
14034
+ const recoveryRenderMethods = (0, import_react40.useMemo)(() => {
13994
14035
  const methodsWithBackupData = getRecoveryRenderMethods(mode).map((mt) => {
13995
14036
  let data = null;
13996
14037
  switch (true) {
@@ -14005,7 +14046,7 @@ function MethodSelector(props) {
14005
14046
  return methodsWithBackupData;
14006
14047
  }, [mode, serverRecoveryStatus]);
14007
14048
  if (!!selectedRecoveryMethod) return null;
14008
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react39.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
14049
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react40.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
14009
14050
  "div",
14010
14051
  {
14011
14052
  style: { gridTemplateColumns: `repeat(${recoveryRenderMethods.length}, minmax(0, 1fr))` },
@@ -14039,12 +14080,12 @@ function MethodSelector(props) {
14039
14080
  }
14040
14081
  ) });
14041
14082
  }
14042
- var import_lucide_react27, import_react39, import_jsx_runtime58, getRecoveryRenderMethods;
14083
+ var import_lucide_react27, import_react40, import_jsx_runtime58, getRecoveryRenderMethods;
14043
14084
  var init_MethodSelector = __esm({
14044
14085
  "src/internal/components/KeyshareRestoreMenu/components/MethodSelector.tsx"() {
14045
14086
  init_useT();
14046
14087
  import_lucide_react27 = require("lucide-react");
14047
- import_react39 = require("react");
14088
+ import_react40 = require("react");
14048
14089
  init_icons();
14049
14090
  init_guardian_backup();
14050
14091
  init_button();
@@ -14078,7 +14119,7 @@ function PasswordPasskey(props) {
14078
14119
  onCreatePasskey
14079
14120
  } = props;
14080
14121
  const hasServerVault = useSession((st) => st.hasServerVault);
14081
- const actionRef = (0, import_react40.useRef)(null);
14122
+ const actionRef = (0, import_react41.useRef)(null);
14082
14123
  const {
14083
14124
  showPassword,
14084
14125
  restorePassword,
@@ -14092,7 +14133,7 @@ function PasswordPasskey(props) {
14092
14133
  } = useRestoreStore();
14093
14134
  const { config } = useProviderConfig();
14094
14135
  const isPasskeyEnabled = config.current.passkey.enabled;
14095
- (0, import_react40.useEffect)(() => {
14136
+ (0, import_react41.useEffect)(() => {
14096
14137
  if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
14097
14138
  }, [isPasskeyEnabled, usePasskey]);
14098
14139
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
@@ -14247,7 +14288,7 @@ function PasswordPasskey(props) {
14247
14288
  ] })
14248
14289
  ] });
14249
14290
  }
14250
- var import_lucide_react28, import_react40, import_jsx_runtime59;
14291
+ var import_lucide_react28, import_react41, import_jsx_runtime59;
14251
14292
  var init_PasswordPasskey = __esm({
14252
14293
  "src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx"() {
14253
14294
  init_ProviderContext();
@@ -14255,7 +14296,7 @@ var init_PasswordPasskey = __esm({
14255
14296
  init_i18n();
14256
14297
  init_utils2();
14257
14298
  import_lucide_react28 = require("lucide-react");
14258
- import_react40 = require("react");
14299
+ import_react41 = require("react");
14259
14300
  init_icons();
14260
14301
  init_button();
14261
14302
  init_highlight();
@@ -14431,7 +14472,7 @@ function Server(props) {
14431
14472
  const usePasskey = useRestoreStore((st) => st.usePasskey);
14432
14473
  const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
14433
14474
  const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
14434
- (0, import_react41.useEffect)(() => {
14475
+ (0, import_react42.useEffect)(() => {
14435
14476
  if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
14436
14477
  setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
14437
14478
  }, [mode, serverRecoveryStatus, setUsePasskey]);
@@ -14466,7 +14507,7 @@ function Server(props) {
14466
14507
  ] })
14467
14508
  ] });
14468
14509
  }
14469
- var import_react_query19, import_dayjs3, import_lucide_react31, import_react41, import_jsx_runtime62;
14510
+ var import_react_query19, import_dayjs3, import_lucide_react31, import_react42, import_jsx_runtime62;
14470
14511
  var init_Server = __esm({
14471
14512
  "src/internal/components/KeyshareRestoreMenu/methods/Server.tsx"() {
14472
14513
  init_SessionContext();
@@ -14475,7 +14516,7 @@ var init_Server = __esm({
14475
14516
  import_react_query19 = require("@tanstack/react-query");
14476
14517
  import_dayjs3 = __toESM(require("dayjs"), 1);
14477
14518
  import_lucide_react31 = require("lucide-react");
14478
- import_react41 = require("react");
14519
+ import_react42 = require("react");
14479
14520
  init_highlight();
14480
14521
  init_PasswordPasskey();
14481
14522
  init_constants4();
@@ -14638,7 +14679,7 @@ function Cloud2(props) {
14638
14679
  return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
14639
14680
  }
14640
14681
  });
14641
- (0, import_react42.useEffect)(() => {
14682
+ (0, import_react43.useEffect)(() => {
14642
14683
  if (isCloudProvidersLoading) return;
14643
14684
  if (!!cloudProvidersError) {
14644
14685
  console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
@@ -14702,13 +14743,13 @@ function Cloud2(props) {
14702
14743
  )
14703
14744
  ] });
14704
14745
  }
14705
- var import_react_query20, import_lucide_react33, import_react42, import_jsx_runtime64;
14746
+ var import_react_query20, import_lucide_react33, import_react43, import_jsx_runtime64;
14706
14747
  var init_Cloud = __esm({
14707
14748
  "src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx"() {
14708
14749
  init_SessionContext();
14709
14750
  import_react_query20 = require("@tanstack/react-query");
14710
14751
  import_lucide_react33 = require("lucide-react");
14711
- import_react42 = require("react");
14752
+ import_react43 = require("react");
14712
14753
  init_button();
14713
14754
  init_select();
14714
14755
  init_PasswordPasskey();
@@ -14725,8 +14766,8 @@ function Guardian(props) {
14725
14766
  const session = useSession((st) => st.session);
14726
14767
  const recoveryUserId = useSession((st) => st.recoveryUserId);
14727
14768
  const { onRestoreSuccess } = useOnRestoreSuccess();
14728
- const [isWorking, setIsWorking] = (0, import_react43.useState)(false);
14729
- const [step, setStep] = (0, import_react43.useState)("idle");
14769
+ const [isWorking, setIsWorking] = (0, import_react44.useState)(false);
14770
+ const [step, setStep] = (0, import_react44.useState)("idle");
14730
14771
  const handleGuardianBackup = async () => {
14731
14772
  if (!restorePassword) {
14732
14773
  setError("Please enter a password");
@@ -14855,11 +14896,11 @@ function Guardian(props) {
14855
14896
  ] })
14856
14897
  ] });
14857
14898
  }
14858
- var import_react43, import_lucide_react34, import_jsx_runtime65;
14899
+ var import_react44, import_lucide_react34, import_jsx_runtime65;
14859
14900
  var init_Guardian = __esm({
14860
14901
  "src/internal/components/KeyshareRestoreMenu/methods/Guardian.tsx"() {
14861
14902
  init_SessionContext();
14862
- import_react43 = require("react");
14903
+ import_react44 = require("react");
14863
14904
  import_lucide_react34 = require("lucide-react");
14864
14905
  init_iframe_manager();
14865
14906
  init_guardian_backup();
@@ -14882,7 +14923,7 @@ var init_methods = __esm({
14882
14923
  });
14883
14924
 
14884
14925
  // src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
14885
- var import_react_query21, import_lucide_react35, import_react44, import_wagmi, import_jsx_runtime66, RESTORE_COMPONENTS, KeyshareRestoreMenu;
14926
+ var import_react_query21, import_lucide_react35, import_react45, import_wagmi, import_jsx_runtime66, RESTORE_COMPONENTS, KeyshareRestoreMenu;
14886
14927
  var init_KeyshareRestoreMenu = __esm({
14887
14928
  "src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
14888
14929
  init_ProviderContext();
@@ -14890,7 +14931,7 @@ var init_KeyshareRestoreMenu = __esm({
14890
14931
  init_i18n();
14891
14932
  import_react_query21 = require("@tanstack/react-query");
14892
14933
  import_lucide_react35 = require("lucide-react");
14893
- import_react44 = require("react");
14934
+ import_react45 = require("react");
14894
14935
  import_wagmi = require("wagmi");
14895
14936
  init_useLayoutDataStore();
14896
14937
  init_useLayoutStore();
@@ -14921,7 +14962,7 @@ var init_KeyshareRestoreMenu = __esm({
14921
14962
  const error = useRestoreStore((st) => st.error);
14922
14963
  const success = useRestoreStore((st) => st.success);
14923
14964
  const currentRestoreMethod = useRestoreStore((st) => st.method);
14924
- (0, import_react44.useEffect)(() => {
14965
+ (0, import_react45.useEffect)(() => {
14925
14966
  const { setIsDialogForced } = useLayoutStore.getState();
14926
14967
  const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
14927
14968
  setIsDialogForced(true);
@@ -14961,7 +15002,7 @@ var init_KeyshareRestoreMenu = __esm({
14961
15002
  queryFn: async () => await getShareRecoveryStats()
14962
15003
  });
14963
15004
  const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
14964
- (0, import_react44.useEffect)(() => {
15005
+ (0, import_react45.useEffect)(() => {
14965
15006
  if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
14966
15007
  }, [hasServerBackup]);
14967
15008
  const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query21.useMutation)({
@@ -15115,7 +15156,7 @@ function KeyshareBackupMenu() {
15115
15156
  const currentBackupMethod = useRestoreStore((st) => st.method);
15116
15157
  const error = useRestoreStore((st) => st.error);
15117
15158
  const success = useRestoreStore((st) => st.success);
15118
- (0, import_react45.useEffect)(() => {
15159
+ (0, import_react46.useEffect)(() => {
15119
15160
  const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
15120
15161
  return () => {
15121
15162
  setSuccess(null);
@@ -15134,7 +15175,7 @@ function KeyshareBackupMenu() {
15134
15175
  queryFn: async () => await getShareRecoveryStats()
15135
15176
  });
15136
15177
  const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
15137
- (0, import_react45.useEffect)(() => {
15178
+ (0, import_react46.useEffect)(() => {
15138
15179
  if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
15139
15180
  }, [hasRecoveryData]);
15140
15181
  const {
@@ -15253,14 +15294,14 @@ function KeyshareBackupMenu() {
15253
15294
  }
15254
15295
  );
15255
15296
  }
15256
- var import_react_query22, import_lucide_react36, import_react45, import_jsx_runtime67, COMPONENTS;
15297
+ var import_react_query22, import_lucide_react36, import_react46, import_jsx_runtime67, COMPONENTS;
15257
15298
  var init_KeyshareBackupMenu = __esm({
15258
15299
  "src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx"() {
15259
15300
  init_SessionContext();
15260
15301
  init_i18n();
15261
15302
  import_react_query22 = require("@tanstack/react-query");
15262
15303
  import_lucide_react36 = require("lucide-react");
15263
- import_react45 = require("react");
15304
+ import_react46 = require("react");
15264
15305
  init_useLayoutDataStore();
15265
15306
  init_useLayoutStore();
15266
15307
  init_vaultClient();
@@ -15298,14 +15339,14 @@ function useColorMode() {
15298
15339
  const preferedColorMode = config?.preferedColorMode;
15299
15340
  const colorMode = useLayoutStore((st) => st.colorMode);
15300
15341
  const handleStoreColorMode = useLayoutStore((st) => st.setColorMode);
15301
- const setColorMode = (0, import_react46.useCallback)(
15342
+ const setColorMode = (0, import_react47.useCallback)(
15302
15343
  (mode) => {
15303
15344
  localStorage.setItem(LOCAL_COLOR_MODE_KEY, mode);
15304
15345
  handleStoreColorMode(mode);
15305
15346
  },
15306
15347
  [handleStoreColorMode]
15307
15348
  );
15308
- (0, import_react46.useEffect)(() => {
15349
+ (0, import_react47.useEffect)(() => {
15309
15350
  let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
15310
15351
  if (!targetColorMode && !preferedColorMode) {
15311
15352
  const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
@@ -15320,10 +15361,10 @@ function useColorMode() {
15320
15361
  }, []);
15321
15362
  return { colorMode, setColorMode };
15322
15363
  }
15323
- var import_react46;
15364
+ var import_react47;
15324
15365
  var init_useColorMode = __esm({
15325
15366
  "src/hooks/useColorMode.ts"() {
15326
- import_react46 = require("react");
15367
+ import_react47 = require("react");
15327
15368
  init_ProviderContext();
15328
15369
  init_constants();
15329
15370
  init_useLayoutStore();
@@ -15425,13 +15466,13 @@ var init_SumsubIframeManager = __esm({
15425
15466
  function useSumsubIframe({ iframeUrl }) {
15426
15467
  const config = useProviderConfig().config;
15427
15468
  const { colorMode } = useColorMode();
15428
- const iframeRef = (0, import_react47.useRef)(null);
15429
- const [isLoading, setIsLoading] = (0, import_react47.useState)(true);
15430
- const [error, setError] = (0, import_react47.useState)(null);
15431
- const [height, setHeight] = (0, import_react47.useState)(0);
15432
- const [status, setStatus] = (0, import_react47.useState)("");
15469
+ const iframeRef = (0, import_react48.useRef)(null);
15470
+ const [isLoading, setIsLoading] = (0, import_react48.useState)(true);
15471
+ const [error, setError] = (0, import_react48.useState)(null);
15472
+ const [height, setHeight] = (0, import_react48.useState)(0);
15473
+ const [status, setStatus] = (0, import_react48.useState)("");
15433
15474
  const levelName = config.current?.kyc?.options?.levelName;
15434
- (0, import_react47.useEffect)(() => {
15475
+ (0, import_react48.useEffect)(() => {
15435
15476
  setError(null);
15436
15477
  setIsLoading(true);
15437
15478
  setStatus("Preparing verification...");
@@ -15472,12 +15513,12 @@ function useSumsubIframe({ iframeUrl }) {
15472
15513
  status
15473
15514
  };
15474
15515
  }
15475
- var import_react47;
15516
+ var import_react48;
15476
15517
  var init_useSumsubIframe = __esm({
15477
15518
  "src/internal/components/KYC/useSumsubIframe.ts"() {
15478
15519
  init_ProviderContext();
15479
15520
  init_useColorMode();
15480
- import_react47 = require("react");
15521
+ import_react48 = require("react");
15481
15522
  init_sumsub();
15482
15523
  init_SumsubIframeManager();
15483
15524
  }
@@ -15751,7 +15792,7 @@ function MainMenu() {
15751
15792
  const { t } = useT();
15752
15793
  const setPage = useLayoutDataStore((st) => st.setPage);
15753
15794
  const setTransitionPageHeight = useLayoutDataStore((st) => st.setTransitionPageHeight);
15754
- (0, import_react48.useEffect)(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
15795
+ (0, import_react49.useEffect)(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
15755
15796
  useProvidersList();
15756
15797
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "w-full p-[var(--ui-kit-pd)] flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "w-full grid grid-cols-4 gap-0 md:gap-[var(--ui-kit-gap)] py-[10px] md:py-1", children: MAIN_MENU_BUTTONS.map(({ id, label, icon: Icon2 }) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
15757
15798
  Button,
@@ -15769,13 +15810,13 @@ function MainMenu() {
15769
15810
  id
15770
15811
  )) }) });
15771
15812
  }
15772
- var import_lucide_react41, import_react48, import_jsx_runtime72, MAIN_MENU_BUTTONS;
15813
+ var import_lucide_react41, import_react49, import_jsx_runtime72, MAIN_MENU_BUTTONS;
15773
15814
  var init_MainMenu = __esm({
15774
15815
  "src/internal/components/MainMenu/MainMenu.tsx"() {
15775
15816
  init_SessionContext();
15776
15817
  init_useT();
15777
15818
  import_lucide_react41 = require("lucide-react");
15778
- import_react48 = require("react");
15819
+ import_react49 = require("react");
15779
15820
  init_constants();
15780
15821
  init_useLayoutDataStore();
15781
15822
  init_useProvidersList();
@@ -15821,16 +15862,16 @@ function useLinkedProfiles() {
15821
15862
  }
15822
15863
  });
15823
15864
  const { profiles = [], avatar = null } = data || {};
15824
- const refresh = (0, import_react49.useCallback)(async () => {
15865
+ const refresh = (0, import_react50.useCallback)(async () => {
15825
15866
  await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
15826
15867
  }, [qc, address]);
15827
15868
  return { profiles, avatar, isLoading, isFetching, error, refresh };
15828
15869
  }
15829
- var import_react_query25, import_react49, LINKED_PROFILES_QUERY_KEY;
15870
+ var import_react_query25, import_react50, LINKED_PROFILES_QUERY_KEY;
15830
15871
  var init_linkedProfiles = __esm({
15831
15872
  "src/modules/linkedProfiles.ts"() {
15832
15873
  import_react_query25 = require("@tanstack/react-query");
15833
- import_react49 = require("react");
15874
+ import_react50 = require("react");
15834
15875
  init_SessionContext();
15835
15876
  init_auth();
15836
15877
  init_common();
@@ -16321,7 +16362,7 @@ function useLinkSocial() {
16321
16362
  const setPage = useLayoutDataStore((st) => st.setPage);
16322
16363
  const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
16323
16364
  const { providerType, linkIsLoading, setProviderType, setAlert, setLinkIsLoading } = useManageWalletStore();
16324
- const handleLinkSocialProvider = import_react50.default.useCallback(
16365
+ const handleLinkSocialProvider = import_react51.default.useCallback(
16325
16366
  async (providerIdRaw) => {
16326
16367
  const providerKey = providerIdRaw.toLowerCase();
16327
16368
  const normalizedKey = providerKey === "twitter" ? "x" : providerKey;
@@ -16379,8 +16420,8 @@ function useLinkSocial() {
16379
16420
  },
16380
16421
  [config.social?.providers]
16381
16422
  );
16382
- const [socialLinkStarted, setSocialLinkStarted] = import_react50.default.useState(false);
16383
- (0, import_react50.useEffect)(() => {
16423
+ const [socialLinkStarted, setSocialLinkStarted] = import_react51.default.useState(false);
16424
+ (0, import_react51.useEffect)(() => {
16384
16425
  const key = providerType?.toLowerCase();
16385
16426
  console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
16386
16427
  if (isWalletLinking) {
@@ -16398,7 +16439,7 @@ function useLinkSocial() {
16398
16439
  }
16399
16440
  }, [providerType, linkIsLoading, socialLinkStarted, isWalletLinking, handleLinkSocialProvider]);
16400
16441
  }
16401
- var import_react_query30, import_react50;
16442
+ var import_react_query30, import_react51;
16402
16443
  var init_useLinkSocial = __esm({
16403
16444
  "src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts"() {
16404
16445
  init_useLayoutDataStore();
@@ -16406,7 +16447,7 @@ var init_useLinkSocial = __esm({
16406
16447
  init_SessionContext();
16407
16448
  init_linkedProfiles();
16408
16449
  import_react_query30 = require("@tanstack/react-query");
16409
- import_react50 = __toESM(require("react"), 1);
16450
+ import_react51 = __toESM(require("react"), 1);
16410
16451
  init_auth();
16411
16452
  init_telegramBrowser();
16412
16453
  init_useProvidersList();
@@ -16475,7 +16516,7 @@ function useLinkTelegram() {
16475
16516
  const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
16476
16517
  const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
16477
16518
  const setPage = useLayoutDataStore((st) => st.setPage);
16478
- const handleLinkTelegram = (0, import_react51.useCallback)(async () => {
16519
+ const handleLinkTelegram = (0, import_react52.useCallback)(async () => {
16479
16520
  try {
16480
16521
  if (shouldBlockSocialAuthInTelegram("telegram")) {
16481
16522
  setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
@@ -16522,8 +16563,8 @@ function useLinkTelegram() {
16522
16563
  setLinkIsLoading(false);
16523
16564
  }
16524
16565
  }, [config.social?.providers]);
16525
- const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react51.useState)(false);
16526
- (0, import_react51.useEffect)(() => {
16566
+ const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react52.useState)(false);
16567
+ (0, import_react52.useEffect)(() => {
16527
16568
  console.log("[useLinkTelegram] Effect triggered:", {
16528
16569
  providerType,
16529
16570
  linkIsLoading,
@@ -16540,20 +16581,20 @@ function useLinkTelegram() {
16540
16581
  handleLinkTelegram();
16541
16582
  }
16542
16583
  }, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
16543
- (0, import_react51.useEffect)(() => {
16584
+ (0, import_react52.useEffect)(() => {
16544
16585
  if (providerType !== "telegram") {
16545
16586
  setTelegramLinkStarted(false);
16546
16587
  }
16547
16588
  }, [providerType]);
16548
16589
  }
16549
- var import_react_query31, import_react51;
16590
+ var import_react_query31, import_react52;
16550
16591
  var init_useLinkTelegram = __esm({
16551
16592
  "src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts"() {
16552
16593
  init_ProviderContext();
16553
16594
  init_SessionContext();
16554
16595
  init_linkedProfiles();
16555
16596
  import_react_query31 = require("@tanstack/react-query");
16556
- import_react51 = require("react");
16597
+ import_react52 = require("react");
16557
16598
  init_telegram2();
16558
16599
  init_useLayoutDataStore();
16559
16600
  init_telegramBrowser();
@@ -16664,7 +16705,7 @@ function getConfiguredProviders(config) {
16664
16705
  });
16665
16706
  return acc;
16666
16707
  },
16667
- (0, import_lodash_es8.fromPairs)(POSSIBLE_PROVIDERS.map((p) => [p, false]))
16708
+ (0, import_lodash_es9.fromPairs)(POSSIBLE_PROVIDERS.map((p) => [p, false]))
16668
16709
  );
16669
16710
  }
16670
16711
  function ManageWalletMenu() {
@@ -16686,7 +16727,7 @@ function ManageWalletMenu() {
16686
16727
  } = useManageWalletStore();
16687
16728
  const configuredProviders = getConfiguredProviders(config.current);
16688
16729
  const { data: providers = [], isLoading: isProvidersLoading, error: providersError } = useProvidersList();
16689
- const renderProviders = (0, import_react52.useMemo)(() => {
16730
+ const renderProviders = (0, import_react53.useMemo)(() => {
16690
16731
  const normalizeProviderName = (name) => {
16691
16732
  if (name === "x") return "twitter";
16692
16733
  return name;
@@ -16808,16 +16849,16 @@ function ManageWalletMenu() {
16808
16849
  }
16809
16850
  );
16810
16851
  }
16811
- var import_lodash_es8, import_lucide_react45, import_react52, import_jsx_runtime77, POSSIBLE_PROVIDERS, MULTI_PROVIDERS;
16852
+ var import_lodash_es9, import_lucide_react45, import_react53, import_jsx_runtime77, POSSIBLE_PROVIDERS, MULTI_PROVIDERS;
16812
16853
  var init_ManageWallet = __esm({
16813
16854
  "src/internal/components/ManageWalletMenu/ManageWallet.tsx"() {
16814
16855
  init_useLayoutDataStore();
16815
16856
  init_useLayoutStore();
16816
16857
  init_ProviderContext();
16817
16858
  init_i18n();
16818
- import_lodash_es8 = require("lodash-es");
16859
+ import_lodash_es9 = require("lodash-es");
16819
16860
  import_lucide_react45 = require("lucide-react");
16820
- import_react52 = require("react");
16861
+ import_react53 = require("react");
16821
16862
  init_constants();
16822
16863
  init_telegramBrowser();
16823
16864
  init_Expandable2();
@@ -16854,7 +16895,7 @@ function UnlinkProviderMenu() {
16854
16895
  const { t } = useT();
16855
16896
  const setPage = useLayoutDataStore((st) => st.setPage);
16856
16897
  const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
16857
- const [confirmInput, setConfirmInput] = (0, import_react53.useState)("");
16898
+ const [confirmInput, setConfirmInput] = (0, import_react54.useState)("");
16858
16899
  const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0, import_react_query32.useMutation)({
16859
16900
  mutationFn: async () => {
16860
16901
  if (!confirmUnlink) {
@@ -16936,7 +16977,7 @@ function UnlinkProviderMenu() {
16936
16977
  ] })
16937
16978
  ] });
16938
16979
  }
16939
- var import_react_query32, import_lucide_react46, import_react53, import_wagmi2, import_jsx_runtime78;
16980
+ var import_react_query32, import_lucide_react46, import_react54, import_wagmi2, import_jsx_runtime78;
16940
16981
  var init_UnlinkProviderMenu = __esm({
16941
16982
  "src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
16942
16983
  init_useLayoutDataStore();
@@ -16946,7 +16987,7 @@ var init_UnlinkProviderMenu = __esm({
16946
16987
  init_linkedProfiles();
16947
16988
  import_react_query32 = require("@tanstack/react-query");
16948
16989
  import_lucide_react46 = require("lucide-react");
16949
- import_react53 = require("react");
16990
+ import_react54 = require("react");
16950
16991
  import_wagmi2 = require("wagmi");
16951
16992
  init_auth();
16952
16993
  init_useExternalWalletStore();
@@ -17067,7 +17108,7 @@ var init_useNicknameStore = __esm({
17067
17108
  function useNicknameAvailability(currentNickname) {
17068
17109
  const { t } = useT();
17069
17110
  const nicknameValue = useNicknameStore((st) => st.nicknameValue);
17070
- (0, import_react54.useEffect)(() => {
17111
+ (0, import_react55.useEffect)(() => {
17071
17112
  if (!currentNickname) return;
17072
17113
  useNicknameStore.getState().setNicknameValue(currentNickname);
17073
17114
  }, [currentNickname]);
@@ -17088,8 +17129,8 @@ function useNicknameAvailability(currentNickname) {
17088
17129
  useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
17089
17130
  }
17090
17131
  });
17091
- const debouncedCheckAvailability = (0, import_react54.useCallback)((0, import_lodash_es9.debounce)(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
17092
- (0, import_react54.useEffect)(() => {
17132
+ const debouncedCheckAvailability = (0, import_react55.useCallback)((0, import_lodash_es10.debounce)(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
17133
+ (0, import_react55.useEffect)(() => {
17093
17134
  if (!currentNickname) return;
17094
17135
  const normalizedInputValue = normalizeNickname(nicknameValue);
17095
17136
  const { valid: isNicknameValid } = validateNickname(nicknameValue);
@@ -17103,13 +17144,13 @@ function useNicknameAvailability(currentNickname) {
17103
17144
  }, [nicknameValue, currentNickname, debouncedCheckAvailability]);
17104
17145
  return { isCheckingAvailability };
17105
17146
  }
17106
- var import_react_query33, import_lodash_es9, import_react54, DEBOUNCE_MS;
17147
+ var import_react_query33, import_lodash_es10, import_react55, DEBOUNCE_MS;
17107
17148
  var init_useNicknameAvailability = __esm({
17108
17149
  "src/internal/components/NicknameMenu/useNicknameAvailability.ts"() {
17109
17150
  init_i18n();
17110
17151
  import_react_query33 = require("@tanstack/react-query");
17111
- import_lodash_es9 = require("lodash-es");
17112
- import_react54 = require("react");
17152
+ import_lodash_es10 = require("lodash-es");
17153
+ import_react55 = require("react");
17113
17154
  init_nickname();
17114
17155
  init_nickname_errors();
17115
17156
  init_nickname_validation();
@@ -17130,7 +17171,7 @@ function NicknameEditForm(props) {
17130
17171
  const nicknameValue = useNicknameStore((st) => st.nicknameValue);
17131
17172
  const nicknameAvailability = useNicknameStore((st) => st.availability);
17132
17173
  const { isCheckingAvailability } = useNicknameAvailability(nicknameInfo ? nicknameInfo.handle : "");
17133
- const [isNicknameCopied, setIsNicknameCopied] = (0, import_react55.useState)(false);
17174
+ const [isNicknameCopied, setIsNicknameCopied] = (0, import_react56.useState)(false);
17134
17175
  const {
17135
17176
  mutate: changeNickname2,
17136
17177
  isError: isNicknameChangeError,
@@ -17159,7 +17200,7 @@ function NicknameEditForm(props) {
17159
17200
  );
17160
17201
  }
17161
17202
  });
17162
- const handleNicknameInputChange = (0, import_react55.useCallback)(
17203
+ const handleNicknameInputChange = (0, import_react56.useCallback)(
17163
17204
  (e) => {
17164
17205
  const { error, setError, setNicknameValue } = useNicknameStore.getState();
17165
17206
  const value = e.target.value;
@@ -17174,7 +17215,7 @@ function NicknameEditForm(props) {
17174
17215
  },
17175
17216
  [isNicknameChangeError, isNicknameChangeSuccess, reset, t]
17176
17217
  );
17177
- const handleSubmit = (0, import_react55.useCallback)(
17218
+ const handleSubmit = (0, import_react56.useCallback)(
17178
17219
  (e) => {
17179
17220
  const { nicknameValue: nicknameValue2, setError } = useNicknameStore.getState();
17180
17221
  if (!canChange) {
@@ -17257,7 +17298,7 @@ function NicknameEditForm(props) {
17257
17298
  !!canChange && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "w-full flex items-center leadding-4 text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:nicknameMenu.hint") })
17258
17299
  ] });
17259
17300
  }
17260
- var import_react_query34, import_lucide_react47, import_react55, import_jsx_runtime79;
17301
+ var import_react_query34, import_lucide_react47, import_react56, import_jsx_runtime79;
17261
17302
  var init_NicknameEditForm = __esm({
17262
17303
  "src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
17263
17304
  init_ProviderContext();
@@ -17265,7 +17306,7 @@ var init_NicknameEditForm = __esm({
17265
17306
  init_i18n();
17266
17307
  import_react_query34 = require("@tanstack/react-query");
17267
17308
  import_lucide_react47 = require("lucide-react");
17268
- import_react55 = require("react");
17309
+ import_react56 = require("react");
17269
17310
  init_icons();
17270
17311
  init_nickname();
17271
17312
  init_profile();
@@ -17284,7 +17325,7 @@ var init_NicknameEditForm = __esm({
17284
17325
 
17285
17326
  // src/internal/components/NicknameMenu/NicknameMenu.tsx
17286
17327
  function NicknameMenu() {
17287
- const { isInitialUser } = usePageParams();
17328
+ const { isInitialUser } = usePageParams().current;
17288
17329
  const { t } = useT();
17289
17330
  const address = useSession((st) => st.address);
17290
17331
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
@@ -17419,11 +17460,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
17419
17460
  const activeChainConfig = useSession((st) => st.chainConfig);
17420
17461
  const resolvedChainId = chainId ?? activeChainId;
17421
17462
  const shouldUseActiveClient = !chainId || chainId === activeChainId;
17422
- const chainConfig = (0, import_react56.useMemo)(() => {
17463
+ const chainConfig = (0, import_react57.useMemo)(() => {
17423
17464
  if (shouldUseActiveClient) return activeChainConfig;
17424
17465
  return (0, import_read15.getChainConfig)(chainId);
17425
17466
  }, [activeChainConfig, chainId, shouldUseActiveClient]);
17426
- const publicClient = (0, import_react56.useMemo)(() => {
17467
+ const publicClient = (0, import_react57.useMemo)(() => {
17427
17468
  if (shouldUseActiveClient) return activePublicClient;
17428
17469
  if (!chainId) return activePublicClient;
17429
17470
  try {
@@ -17440,12 +17481,12 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
17440
17481
  resolvedChainId
17441
17482
  };
17442
17483
  }
17443
- var import_read15, import_react56, publicClientByChainId;
17484
+ var import_read15, import_react57, publicClientByChainId;
17444
17485
  var init_useResolvedPublicClient = __esm({
17445
17486
  "src/internal/hooks/useResolvedPublicClient.ts"() {
17446
17487
  init_SessionContext();
17447
17488
  import_read15 = require("@embarkai/core/read");
17448
- import_react56 = require("react");
17489
+ import_react57 = require("react");
17449
17490
  publicClientByChainId = /* @__PURE__ */ new Map();
17450
17491
  }
17451
17492
  });
@@ -17455,7 +17496,7 @@ function useWatchTokens(options) {
17455
17496
  const { address, chainId, enabled = true } = options;
17456
17497
  const { config } = useProviderConfig();
17457
17498
  const { publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useWatchTokens");
17458
- const watchTokens = (0, import_react57.useMemo)(() => {
17499
+ const watchTokens = (0, import_react58.useMemo)(() => {
17459
17500
  const allWatchTokens = config.current.watchTokens;
17460
17501
  const tokensForChain = resolvedChainId ? allWatchTokens?.[resolvedChainId] || [] : [];
17461
17502
  return tokensForChain;
@@ -17463,6 +17504,7 @@ function useWatchTokens(options) {
17463
17504
  const {
17464
17505
  data: assets,
17465
17506
  isLoading,
17507
+ isFetching,
17466
17508
  error,
17467
17509
  refetch
17468
17510
  } = (0, import_react_query36.useQuery)({
@@ -17533,16 +17575,17 @@ function useWatchTokens(options) {
17533
17575
  return {
17534
17576
  assets: assets || [],
17535
17577
  isLoading,
17578
+ isFetching,
17536
17579
  error: error || null,
17537
17580
  refetch
17538
17581
  };
17539
17582
  }
17540
- var import_react_query36, import_react57, import_viem6, WATCH_TOKENS_QUERY_KEY;
17583
+ var import_react_query36, import_react58, import_viem6, WATCH_TOKENS_QUERY_KEY;
17541
17584
  var init_useWatchTokens = __esm({
17542
17585
  "src/internal/hooks/useWatchTokens.ts"() {
17543
17586
  init_ProviderContext();
17544
17587
  import_react_query36 = require("@tanstack/react-query");
17545
- import_react57 = require("react");
17588
+ import_react58 = require("react");
17546
17589
  import_viem6 = require("viem");
17547
17590
  init_useResolvedPublicClient();
17548
17591
  WATCH_TOKENS_QUERY_KEY = "watch-tokens";
@@ -17681,19 +17724,21 @@ function useBlockscoutAssets(options) {
17681
17724
  const customTokenBalancesQuery = portfolioConfig?.tokenBalancesQuery;
17682
17725
  const customTokenBalancesQueryKey = portfolioConfig?.tokenBalancesQueryKey;
17683
17726
  const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
17684
- const blockscoutClient = (0, import_react58.useMemo)(
17727
+ const blockscoutClient = (0, import_react59.useMemo)(
17685
17728
  () => blockscoutApiUrl ? (0, import_clients2.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
17686
17729
  [blockscoutApiUrl]
17687
17730
  );
17688
- const lastRefreshRef = (0, import_react58.useRef)(0);
17731
+ const lastRefreshRef = (0, import_react59.useRef)(0);
17689
17732
  const {
17690
17733
  assets: watchTokenAssets,
17691
- isLoading: watchTokensLoading
17734
+ isLoading: watchTokensLoading,
17735
+ isFetching: watchTokensFetching
17692
17736
  // refetch: refetchWatchTokens
17693
17737
  } = useWatchTokens({ address, chainId: resolvedChainId, enabled });
17694
17738
  const {
17695
17739
  data: nativeBalanceData,
17696
- isLoading: nativeLoading
17740
+ isLoading: nativeLoading,
17741
+ isFetching: nativeFetching
17697
17742
  // refetch: refetchNative
17698
17743
  } = (0, import_react_query37.useQuery)({
17699
17744
  queryKey: [NATIVE_BALANCE_QUERY_KEY, resolvedChainId, address],
@@ -17717,6 +17762,7 @@ function useBlockscoutAssets(options) {
17717
17762
  const {
17718
17763
  data: tokenBalances,
17719
17764
  isLoading: tokensLoading,
17765
+ isFetching: tokensFetching,
17720
17766
  error: tokensError,
17721
17767
  // refetch: refetchTokens,
17722
17768
  dataUpdatedAt
@@ -17742,7 +17788,8 @@ function useBlockscoutAssets(options) {
17742
17788
  });
17743
17789
  const {
17744
17790
  data: nftItems,
17745
- isLoading: nftsLoading
17791
+ isLoading: nftsLoading,
17792
+ isFetching: nftsFetching
17746
17793
  // refetch: refetchNfts
17747
17794
  } = (0, import_react_query37.useQuery)({
17748
17795
  queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, address, blockscoutApiUrl],
@@ -17754,7 +17801,7 @@ function useBlockscoutAssets(options) {
17754
17801
  retry: 2,
17755
17802
  retryDelay: 1e3
17756
17803
  });
17757
- const erc20TokenAddresses = (0, import_react58.useMemo)(() => {
17804
+ const erc20TokenAddresses = (0, import_react59.useMemo)(() => {
17758
17805
  if (!tokenBalances) return [];
17759
17806
  return tokenBalances.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
17760
17807
  }, [tokenBalances]);
@@ -17798,7 +17845,7 @@ function useBlockscoutAssets(options) {
17798
17845
  gcTime: BLOCKSCOUT_QUERY_GC_TIME,
17799
17846
  retry: 1
17800
17847
  });
17801
- const assets = (0, import_react58.useMemo)(() => {
17848
+ const assets = (0, import_react59.useMemo)(() => {
17802
17849
  const result = [];
17803
17850
  const addedAddresses = /* @__PURE__ */ new Set();
17804
17851
  if (nativeBalanceData) {
@@ -17844,7 +17891,7 @@ function useBlockscoutAssets(options) {
17844
17891
  }
17845
17892
  return result;
17846
17893
  }, [nativeBalanceData, tokenBalances, nftItems, erc3643Results, watchTokenAssets, chainConfig]);
17847
- const nativeBalance = (0, import_react58.useMemo)(() => {
17894
+ const nativeBalance = (0, import_react59.useMemo)(() => {
17848
17895
  if (!nativeBalanceData) return null;
17849
17896
  return {
17850
17897
  value: nativeBalanceData.value,
@@ -17852,11 +17899,11 @@ function useBlockscoutAssets(options) {
17852
17899
  symbol: nativeBalanceData.symbol
17853
17900
  };
17854
17901
  }, [nativeBalanceData]);
17855
- const error = (0, import_react58.useMemo)(() => {
17902
+ const error = (0, import_react59.useMemo)(() => {
17856
17903
  if (!tokensError) return null;
17857
17904
  return createError(tokensError);
17858
17905
  }, [tokensError]);
17859
- const refreshBalances = (0, import_react58.useCallback)(async () => {
17906
+ const refreshBalances = (0, import_react59.useCallback)(async () => {
17860
17907
  const now = Date.now();
17861
17908
  if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
17862
17909
  return;
@@ -17873,7 +17920,7 @@ function useBlockscoutAssets(options) {
17873
17920
  qc.invalidateQueries({ queryKey: [WATCH_TOKENS_QUERY_KEY] })
17874
17921
  ]);
17875
17922
  }, [qc]);
17876
- const getTokenBalance = (0, import_react58.useCallback)(
17923
+ const getTokenBalance = (0, import_react59.useCallback)(
17877
17924
  (tokenAddress) => {
17878
17925
  return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
17879
17926
  },
@@ -17883,6 +17930,7 @@ function useBlockscoutAssets(options) {
17883
17930
  nativeBalance,
17884
17931
  assets,
17885
17932
  isLoading: nativeLoading || tokensLoading || nftsLoading || watchTokensLoading,
17933
+ isFetching: nativeFetching || tokensFetching || nftsFetching || watchTokensFetching,
17886
17934
  isInitialLoading: nativeLoading && !nativeBalanceData,
17887
17935
  error,
17888
17936
  isBlockscoutAvailable: !!blockscoutClient && !tokensError,
@@ -17891,13 +17939,13 @@ function useBlockscoutAssets(options) {
17891
17939
  lastUpdated: dataUpdatedAt || null
17892
17940
  };
17893
17941
  }
17894
- var import_clients2, import_react_query37, import_react58, import_viem7, NATIVE_BALANCE_QUERY_KEY, BLOCKSCOUT_QUERY_KEY, ERC3643_DETECTION_QUERY_KEY, ERC3643_ABI;
17942
+ var import_clients2, import_react_query37, import_react59, import_viem7, NATIVE_BALANCE_QUERY_KEY, BLOCKSCOUT_QUERY_KEY, ERC3643_DETECTION_QUERY_KEY, ERC3643_ABI;
17895
17943
  var init_useBlockscoutAssets = __esm({
17896
17944
  "src/internal/hooks/useBlockscoutAssets.ts"() {
17897
17945
  init_ProviderContext();
17898
17946
  import_clients2 = require("@embarkai/core/clients");
17899
17947
  import_react_query37 = require("@tanstack/react-query");
17900
- import_react58 = require("react");
17948
+ import_react59 = require("react");
17901
17949
  import_viem7 = require("viem");
17902
17950
  init_initial();
17903
17951
  init_constants();
@@ -18188,23 +18236,24 @@ function PortfolioMenu() {
18188
18236
  const { t } = useT();
18189
18237
  const qc = (0, import_react_query39.useQueryClient)();
18190
18238
  const address = useSession((st) => st.address);
18191
- const setPage = useLayoutDataStore((st) => st.setPage);
18239
+ const chainConfig = useSession((st) => st.chainConfig);
18192
18240
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
18193
18241
  const {
18194
18242
  assets: blockscoutAssets,
18195
18243
  refreshBalances: refreshBlockscoutBalances,
18196
18244
  isLoading: isBlockscoutLoading,
18245
+ isFetching: isBlockscoutFetching,
18197
18246
  error: blockscoutError,
18198
18247
  isBlockscoutAvailable
18199
18248
  } = useBlockscoutAssets({
18200
18249
  address,
18201
18250
  enabled: !!address
18202
18251
  });
18203
- const shownProjectAssests = projectAssets.filter((asset) => !asset.hideInPortfolio);
18204
- const refreshAllAssetsBalances = (0, import_react59.useCallback)(() => {
18205
- Promise.all(shownProjectAssests.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
18252
+ const shownProjectAssets = projectAssets.filter((asset) => !asset.hideInPortfolio);
18253
+ const refreshAllAssetsBalances = (0, import_react60.useCallback)(() => {
18254
+ Promise.all(shownProjectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
18206
18255
  refreshBlockscoutBalances();
18207
- }, [qc, shownProjectAssests, refreshBlockscoutBalances]);
18256
+ }, [qc, shownProjectAssets, refreshBlockscoutBalances]);
18208
18257
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
18209
18258
  "div",
18210
18259
  {
@@ -18215,7 +18264,16 @@ function PortfolioMenu() {
18215
18264
  className: "list-scrollbar-y w-full p-[var(--ui-kit-pd)]",
18216
18265
  children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
18217
18266
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
18218
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Button, { variant: "ghost", size: "icon", title: "Back", onClick: () => setPage("main-menu" /* MAIN_MENU */), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.ArrowLeft, { className: "h-4 w-4" }) }),
18267
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
18268
+ Button,
18269
+ {
18270
+ variant: "ghost",
18271
+ size: "icon",
18272
+ title: "Back",
18273
+ onClick: () => useLayoutDataStore.getState().setPage("main-menu" /* MAIN_MENU */),
18274
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.ArrowLeft, { className: "h-4 w-4" })
18275
+ }
18276
+ ),
18219
18277
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "text-xl font-semibold", children: t("passport:portfolioMenu.title") }),
18220
18278
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
18221
18279
  Button,
@@ -18224,8 +18282,8 @@ function PortfolioMenu() {
18224
18282
  variant: "ghost",
18225
18283
  size: "icon",
18226
18284
  onClick: refreshAllAssetsBalances,
18227
- disabled: isBlockscoutLoading,
18228
- children: isBlockscoutLoading ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.Loader, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.RefreshCw, { className: "h-4 w-4" })
18285
+ disabled: isBlockscoutLoading || isBlockscoutFetching,
18286
+ children: isBlockscoutLoading || isBlockscoutFetching ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.Loader, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.RefreshCw, { className: "h-4 w-4" })
18229
18287
  }
18230
18288
  )
18231
18289
  ] }),
@@ -18234,7 +18292,7 @@ function PortfolioMenu() {
18234
18292
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.Gem, { className: "w-8 h-8" }),
18235
18293
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "block", children: t("passport:portfolioMenu.noAssets") })
18236
18294
  ] }),
18237
- !isBlockscoutLoading && shownProjectAssests?.map((asset, index) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(PortfolioItem, { isProjectAsset: true, address, asset }, `project-${asset.symbol}-${index}`)),
18295
+ !isBlockscoutLoading && shownProjectAssets?.map((asset, index) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(PortfolioItem, { isProjectAsset: true, address, asset }, `project-${asset.symbol}-${index}`)),
18238
18296
  !isBlockscoutLoading && blockscoutAssets?.length > 0 && blockscoutAssets.map((asset, index) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
18239
18297
  PortfolioItem,
18240
18298
  {
@@ -18243,15 +18301,17 @@ function PortfolioMenu() {
18243
18301
  },
18244
18302
  `${asset.type}-${asset.address || "native"}-${asset.tokenId || index}`
18245
18303
  )),
18246
- blockscoutError && !isBlockscoutAvailable && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Highlight, { type: "error", className: "flex gap-[var(--ui-kit-gap)]", children: [
18247
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react50.AlertCircle, { className: "h-4 w-4 flex-shrink-0" }),
18248
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "text-xs", children: blockscoutError.message })
18249
- ] })
18304
+ !isBlockscoutAvailable && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Highlight, {
18305
+ type: "warning",
18306
+ //@ts-expect-error i18n typings
18307
+ children: t("passport:portfolioMenu.noBlockscout", { chain: chainConfig?.name?.toUpperCase() || "UNKNOWN" })
18308
+ }),
18309
+ blockscoutError && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Highlight, { type: "error", children: blockscoutError?.message })
18250
18310
  ] })
18251
18311
  }
18252
18312
  );
18253
18313
  }
18254
- var import_react_query39, import_lucide_react50, import_react59, import_jsx_runtime83;
18314
+ var import_react_query39, import_lucide_react50, import_react60, import_jsx_runtime83;
18255
18315
  var init_PortfolioMenu = __esm({
18256
18316
  "src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
18257
18317
  init_ProviderContext();
@@ -18259,7 +18319,7 @@ var init_PortfolioMenu = __esm({
18259
18319
  init_i18n();
18260
18320
  import_react_query39 = require("@tanstack/react-query");
18261
18321
  import_lucide_react50 = require("lucide-react");
18262
- import_react59 = require("react");
18322
+ import_react60 = require("react");
18263
18323
  init_useBlockscoutAssets();
18264
18324
  init_useLayoutDataStore();
18265
18325
  init_useLayoutStore();
@@ -18368,10 +18428,10 @@ function ReceiveMenu() {
18368
18428
  const { t } = useT();
18369
18429
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
18370
18430
  const open = page === "receive";
18371
- const [qrCodeUrl, setQrCodeUrl] = (0, import_react60.useState)("");
18372
- const [copied, setCopied] = (0, import_react60.useState)(false);
18373
- const [fingerprintCopied, setFingerprintCopied] = (0, import_react60.useState)(false);
18374
- const fingerprint = (0, import_react60.useMemo)(() => {
18431
+ const [qrCodeUrl, setQrCodeUrl] = (0, import_react61.useState)("");
18432
+ const [copied, setCopied] = (0, import_react61.useState)(false);
18433
+ const [fingerprintCopied, setFingerprintCopied] = (0, import_react61.useState)(false);
18434
+ const fingerprint = (0, import_react61.useMemo)(() => {
18375
18435
  if (!session?.ownerAddress) return null;
18376
18436
  try {
18377
18437
  return generateFingerprint(session.ownerAddress);
@@ -18379,7 +18439,7 @@ function ReceiveMenu() {
18379
18439
  return null;
18380
18440
  }
18381
18441
  }, [session?.ownerAddress]);
18382
- (0, import_react60.useEffect)(() => {
18442
+ (0, import_react61.useEffect)(() => {
18383
18443
  if (open && address) {
18384
18444
  import_qrcode.default.toDataURL(address, {
18385
18445
  width: 200,
@@ -18392,7 +18452,7 @@ function ReceiveMenu() {
18392
18452
  });
18393
18453
  }
18394
18454
  }, [open, address]);
18395
- const handleCopy = (0, import_react60.useCallback)(async () => {
18455
+ const handleCopy = (0, import_react61.useCallback)(async () => {
18396
18456
  if (!address) return;
18397
18457
  try {
18398
18458
  await navigator.clipboard.writeText(address);
@@ -18402,7 +18462,7 @@ function ReceiveMenu() {
18402
18462
  console.error("Failed to copy address:", error);
18403
18463
  }
18404
18464
  }, [address]);
18405
- const handleCopyFingerprint = (0, import_react60.useCallback)(async () => {
18465
+ const handleCopyFingerprint = (0, import_react61.useCallback)(async () => {
18406
18466
  if (!fingerprint) return;
18407
18467
  try {
18408
18468
  await navigator.clipboard.writeText(fingerprint);
@@ -18463,14 +18523,14 @@ function ReceiveMenu() {
18463
18523
  }
18464
18524
  );
18465
18525
  }
18466
- var import_lucide_react51, import_qrcode, import_react60, import_jsx_runtime84;
18526
+ var import_lucide_react51, import_qrcode, import_react61, import_jsx_runtime84;
18467
18527
  var init_ReceiveMenu = __esm({
18468
18528
  "src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
18469
18529
  init_SessionContext();
18470
18530
  init_i18n();
18471
18531
  import_lucide_react51 = require("lucide-react");
18472
18532
  import_qrcode = __toESM(require("qrcode"), 1);
18473
- import_react60 = require("react");
18533
+ import_react61 = require("react");
18474
18534
  init_useLayoutDataStore();
18475
18535
  init_useLayoutStore();
18476
18536
  init_nickname_fingerprint();
@@ -18487,6 +18547,24 @@ var init_ReceiveMenu2 = __esm({
18487
18547
  }
18488
18548
  });
18489
18549
 
18550
+ // src/internal/components/SecurityMenu/useSecurityStore.ts
18551
+ var import_lodash_es11, import_zustand10, useSecurityStore;
18552
+ var init_useSecurityStore = __esm({
18553
+ "src/internal/components/SecurityMenu/useSecurityStore.ts"() {
18554
+ import_lodash_es11 = require("lodash-es");
18555
+ import_zustand10 = require("zustand");
18556
+ useSecurityStore = (0, import_zustand10.create)((set) => ({
18557
+ renderKey: "security-store",
18558
+ setRenderKey: (0, import_lodash_es11.debounce)((renderKey) => {
18559
+ console.log("[SecurityMenu] Setting render key:", renderKey);
18560
+ set({ renderKey });
18561
+ }, 200),
18562
+ appToUntrust: null,
18563
+ untrustApp: (app) => set({ appToUntrust: app })
18564
+ }));
18565
+ }
18566
+ });
18567
+
18490
18568
  // src/internal/components/SecurityMenu/constants.ts
18491
18569
  var KEYSHARE_RECOVERY_STATS_QUERY, CONNECTED_TRUSTED_APPS_QUERY;
18492
18570
  var init_constants5 = __esm({
@@ -18496,7 +18574,7 @@ var init_constants5 = __esm({
18496
18574
  }
18497
18575
  });
18498
18576
 
18499
- // src/internal/components/SecurityMenu/hooks.ts
18577
+ // src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts
18500
18578
  function useConnectedApps() {
18501
18579
  const session = useSession((st) => st.session);
18502
18580
  const userId = session?.mpcUserId || null;
@@ -18513,44 +18591,29 @@ function useConnectedApps() {
18513
18591
  }
18514
18592
  });
18515
18593
  }
18516
- function useKeyshareRecoveryStats() {
18517
- const session = useSession((st) => st.session);
18518
- const userId = session?.mpcUserId || null;
18519
- return (0, import_react_query40.useQuery)({
18520
- enabled: !!userId,
18521
- queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
18522
- queryFn: async () => {
18523
- const iframeManager = getIframeManager();
18524
- if (!iframeManager) {
18525
- throw new Error("Iframe manager not available");
18526
- }
18527
- const keyshareInfo = await getKeyshareInfo(userId);
18528
- const shareRecoveryStats = await getShareRecoveryStats();
18529
- return {
18530
- keyshareInfo,
18531
- shareRecoveryStats
18532
- };
18533
- }
18534
- });
18535
- }
18536
18594
  var import_react_query40;
18537
- var init_hooks2 = __esm({
18538
- "src/internal/components/SecurityMenu/hooks.ts"() {
18595
+ var init_useConnectedApps = __esm({
18596
+ "src/internal/components/SecurityMenu/ConnectedApps/useConnectedApps.ts"() {
18539
18597
  init_SessionContext();
18540
18598
  import_react_query40 = require("@tanstack/react-query");
18541
- init_keyshare();
18542
18599
  init_httpClient();
18543
- init_iframe_manager();
18544
- init_vaultClient();
18545
18600
  init_constants5();
18546
18601
  }
18547
18602
  });
18548
18603
 
18549
- // src/internal/components/SecurityMenu/ConnectedApps.tsx
18604
+ // src/internal/components/SecurityMenu/ConnectedApps/ConnectedApps.tsx
18550
18605
  function Application(props) {
18551
- const { projectId, logo, name, appUrl, trustedAuthorizedApp, firstConnectedAt, untrustApp } = props;
18606
+ const {
18607
+ projectId,
18608
+ appUrl = null,
18609
+ //
18610
+ logo,
18611
+ name,
18612
+ trustedAuthorizedApp,
18613
+ firstConnectedAt
18614
+ // untrustApp
18615
+ } = props;
18552
18616
  const { t } = useT();
18553
- const projectUrl = appUrl || null;
18554
18617
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
18555
18618
  "div",
18556
18619
  {
@@ -18559,14 +18622,14 @@ function Application(props) {
18559
18622
  "select-none text-[10px] leading-tight",
18560
18623
  "p-2 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-secondary)]",
18561
18624
  {
18562
- "cursor-default": !projectUrl,
18563
- "cursor-pointer transition-colors duration-200": !!projectUrl,
18564
- "hover:bg-[var(--ui-kit-secondary-h)] active:bg-[var(--ui-kit-secondary-a)]": !!projectUrl
18625
+ "cursor-default": !appUrl,
18626
+ "cursor-pointer transition-colors duration-200": !!appUrl,
18627
+ "hover:bg-[var(--ui-kit-secondary-h)] active:bg-[var(--ui-kit-secondary-a)]": !!appUrl
18565
18628
  }
18566
18629
  ),
18567
18630
  onClick: () => {
18568
- if (!projectUrl) return;
18569
- window.open(projectUrl, "_blank", "noopener,noreferrer");
18631
+ if (!appUrl) return;
18632
+ window.open(appUrl, "_blank", "noopener,noreferrer");
18570
18633
  },
18571
18634
  children: [
18572
18635
  /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
@@ -18596,9 +18659,9 @@ function Application(props) {
18596
18659
  /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex-1 min-w-0", children: [
18597
18660
  /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "flex flex-col", children: [
18598
18661
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "text-sm font-semibold truncate", children: name }),
18599
- projectUrl && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
18662
+ appUrl && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
18600
18663
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react52.ExternalLinkIcon, { className: "w-3 h-3 flex-none", strokeWidth: 1 }),
18601
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "flex-1 truncate", children: new URL(projectUrl).hostname })
18664
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "flex-1 truncate", children: new URL(appUrl).hostname })
18602
18665
  ] })
18603
18666
  ] }),
18604
18667
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "text-[var(--ui-kit-fg-muted)] truncate", children: t(
@@ -18619,10 +18682,10 @@ function Application(props) {
18619
18682
  ),
18620
18683
  onClick: (e) => {
18621
18684
  e.stopPropagation();
18622
- untrustApp({
18685
+ useSecurityStore.getState().untrustApp({
18623
18686
  projectId,
18624
- origin: projectUrl || void 0,
18625
- hostname: projectUrl ? new URL(projectUrl).hostname : void 0,
18687
+ origin: appUrl || void 0,
18688
+ hostname: appUrl ? new URL(appUrl).hostname : void 0,
18626
18689
  appName: name,
18627
18690
  appLogo: logo
18628
18691
  });
@@ -18634,50 +18697,156 @@ function Application(props) {
18634
18697
  }
18635
18698
  );
18636
18699
  }
18637
- function ConnectedApps(props) {
18638
- const { isLoading: isParentLoading, untrustApp } = props;
18700
+ function ConnectedApps() {
18639
18701
  const { t } = useT();
18640
18702
  const { data: connectedApps = [], isLoading: isConnectedAppsLoading } = useConnectedApps();
18641
- const isLoading = isConnectedAppsLoading || isParentLoading;
18642
- if (isLoading) return null;
18643
- if (!isLoading && connectedApps.length === 0)
18703
+ (0, import_react62.useEffect)(() => {
18704
+ if (!connectedApps.length || isConnectedAppsLoading) return;
18705
+ useSecurityStore.getState().setRenderKey(`connected-apps-loaded-${Date.now()}`);
18706
+ }, [connectedApps, isConnectedAppsLoading]);
18707
+ if (!isConnectedAppsLoading && connectedApps.length === 0)
18644
18708
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Highlight, { type: "info", className: "flex gap-[var(--ui-kit-gap)] ", children: [
18645
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react52.Info, { className: "w-4 h-4" }),
18709
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react52.InfoIcon, { className: "w-4 h-4" }),
18646
18710
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: t("passport:securityMenu.connectedApps.noConnectedApps") })
18647
18711
  ] });
18648
18712
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
18649
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "font-medium text-xs text-[var(--ui-kit-fg)]", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: t("passport:securityMenu.connectedApps.connectedApps") }) }),
18650
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: connectedApps.map((app, index) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
18651
- Application,
18652
- {
18653
- ...app,
18654
- untrustApp
18655
- },
18656
- index
18657
- )) })
18713
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
18714
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "leading-4 text-xs", children: t("passport:securityMenu.connectedApps.connectedApps") }),
18715
+ isConnectedAppsLoading && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react52.LoaderIcon, { className: "h-4 w-4 animate-spin" })
18716
+ ] }),
18717
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: connectedApps.map((app, index) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Application, { ...app }, index)) })
18658
18718
  ] });
18659
18719
  }
18660
- var import_dayjs5, import_lucide_react52, import_jsx_runtime85;
18720
+ var import_dayjs5, import_lucide_react52, import_react62, import_jsx_runtime85;
18661
18721
  var init_ConnectedApps = __esm({
18662
- "src/internal/components/SecurityMenu/ConnectedApps.tsx"() {
18722
+ "src/internal/components/SecurityMenu/ConnectedApps/ConnectedApps.tsx"() {
18663
18723
  init_utils2();
18664
18724
  init_i18n();
18665
18725
  import_dayjs5 = __toESM(require("dayjs"), 1);
18666
18726
  import_lucide_react52 = require("lucide-react");
18727
+ import_react62 = require("react");
18667
18728
  init_button();
18668
18729
  init_highlight();
18669
- init_hooks2();
18730
+ init_useSecurityStore();
18731
+ init_useConnectedApps();
18670
18732
  import_jsx_runtime85 = require("react/jsx-runtime");
18671
18733
  }
18672
18734
  });
18673
18735
 
18736
+ // src/internal/components/SecurityMenu/ConnectedApps/UntrustApplication.tsx
18737
+ function UntrustApplication() {
18738
+ const { t } = useT();
18739
+ const qc = (0, import_react_query41.useQueryClient)();
18740
+ const userId = useSession((st) => st?.session?.mpcUserId);
18741
+ const appToUntrust = useSecurityStore((st) => st.appToUntrust);
18742
+ const { mutate: handleUntrustApp, isPending: isUntrustingApp } = (0, import_react_query41.useMutation)({
18743
+ mutationFn: async () => {
18744
+ if (!userId || !appToUntrust) return;
18745
+ const iframeManager = getIframeManager();
18746
+ if (!iframeManager) {
18747
+ throw new Error("Iframe manager not available");
18748
+ }
18749
+ return await iframeManager.removeTrustedApp(userId, appToUntrust.projectId, appToUntrust.origin);
18750
+ },
18751
+ onSuccess: (success) => {
18752
+ if (!success) {
18753
+ console.error("[SecurityMenu] Failed to remove trusted app from iframe");
18754
+ return;
18755
+ }
18756
+ qc.invalidateQueries({ queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId] });
18757
+ useSecurityStore.getState().untrustApp(null);
18758
+ },
18759
+ onError: (error) => {
18760
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
18761
+ console.error("[SecurityMenu] Error removing trusted app:", errorMessage);
18762
+ }
18763
+ });
18764
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex flex-col gap-[var(--ui-kit-gap)]", children: [
18765
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Highlight, { className: "flex flex-col gap-[var(--ui-kit-gap)]", type: "warning", children: [
18766
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("span", { className: "text-sm leading-5 font-bold", children: [
18767
+ t("passport:securityMenu.connectedApps.untrustApp"),
18768
+ "?"
18769
+ ] }),
18770
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)]", children: [
18771
+ appToUntrust.appLogo ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex-shrink-0 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("img", { src: appToUntrust.appLogo, alt: appToUntrust.appName, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("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__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react53.AppWindowMac, { className: "w-6 h-6" }) }),
18772
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex-1 text-left", children: [
18773
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "font-medium", children: appToUntrust.appName }),
18774
+ appToUntrust.hostname && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "text-[10px]", children: [
18775
+ "(",
18776
+ appToUntrust.hostname,
18777
+ ")"
18778
+ ] })
18779
+ ] })
18780
+ ] })
18781
+ ] }),
18782
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] text-left space-y-1", children: [
18783
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("p", { children: [
18784
+ t("passport:securityMenu.connectedApps.removalNoteTitle"),
18785
+ ":"
18786
+ ] }),
18787
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("ul", { className: "list-disc list-inside ml-2 space-y-0.5", children: [
18788
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg1") }),
18789
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg2") })
18790
+ ] })
18791
+ ] }),
18792
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
18793
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
18794
+ Button,
18795
+ {
18796
+ variant: "outline",
18797
+ size: "large",
18798
+ className: "flex-1",
18799
+ onClick: () => useSecurityStore.getState().untrustApp(null),
18800
+ disabled: isUntrustingApp,
18801
+ children: t("passport:common.cancel")
18802
+ }
18803
+ ),
18804
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
18805
+ Button,
18806
+ {
18807
+ variant: "default",
18808
+ size: "large",
18809
+ className: "flex-1",
18810
+ onClick: () => handleUntrustApp(),
18811
+ disabled: isUntrustingApp,
18812
+ children: isUntrustingApp ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react53.Loader, { className: "h-4 w-4 animate-spin" }) : t("passport:common.delete")
18813
+ }
18814
+ )
18815
+ ] })
18816
+ ] });
18817
+ }
18818
+ var import_react_query41, import_lucide_react53, import_jsx_runtime86;
18819
+ var init_UntrustApplication = __esm({
18820
+ "src/internal/components/SecurityMenu/ConnectedApps/UntrustApplication.tsx"() {
18821
+ init_SessionContext();
18822
+ init_i18n();
18823
+ import_react_query41 = require("@tanstack/react-query");
18824
+ import_lucide_react53 = require("lucide-react");
18825
+ init_iframe_manager();
18826
+ init_button();
18827
+ init_highlight();
18828
+ init_constants5();
18829
+ init_useSecurityStore();
18830
+ import_jsx_runtime86 = require("react/jsx-runtime");
18831
+ }
18832
+ });
18833
+
18834
+ // src/internal/components/SecurityMenu/ConnectedApps/index.ts
18835
+ var init_ConnectedApps2 = __esm({
18836
+ "src/internal/components/SecurityMenu/ConnectedApps/index.ts"() {
18837
+ init_ConnectedApps();
18838
+ init_UntrustApplication();
18839
+ init_useConnectedApps();
18840
+ }
18841
+ });
18842
+
18674
18843
  // src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx
18675
18844
  function KeyshareStatus(props) {
18676
18845
  const { isLoading, content, icon: Icon2, children } = props;
18677
- if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react53.Loader, { className: "w-4 h-4 animate-spin" });
18678
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "group relative w-full h-full", children: [
18846
+ if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react54.Loader, { className: "w-4 h-4 animate-spin" });
18847
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "group relative w-full h-full", children: [
18679
18848
  children,
18680
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
18849
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
18681
18850
  "div",
18682
18851
  {
18683
18852
  className: cn(
@@ -18685,10 +18854,10 @@ function KeyshareStatus(props) {
18685
18854
  "rounded-full bg-[var(--ui-kit-bg)]"
18686
18855
  // 'border border-[var(--ui-kit-bd)]'
18687
18856
  ),
18688
- children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Icon2, { className: "w-4 h-4" })
18857
+ children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Icon2, { className: "w-4 h-4" })
18689
18858
  }
18690
18859
  ),
18691
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
18860
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
18692
18861
  "div",
18693
18862
  {
18694
18863
  style: { transform: "translateY(calc(var(--ui-kit-gap) * -4))" },
@@ -18704,12 +18873,12 @@ function KeyshareStatus(props) {
18704
18873
  )
18705
18874
  ] });
18706
18875
  }
18707
- var import_lucide_react53, import_jsx_runtime86;
18876
+ var import_lucide_react54, import_jsx_runtime87;
18708
18877
  var init_KeyshareStatus = __esm({
18709
18878
  "src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx"() {
18710
- import_lucide_react53 = require("lucide-react");
18879
+ import_lucide_react54 = require("lucide-react");
18711
18880
  init_utils2();
18712
- import_jsx_runtime86 = require("react/jsx-runtime");
18881
+ import_jsx_runtime87 = require("react/jsx-runtime");
18713
18882
  }
18714
18883
  });
18715
18884
 
@@ -18739,29 +18908,29 @@ function LastBackup(props) {
18739
18908
  } = createdRecoveryStats || {};
18740
18909
  const hasBackupData = backup?.server?.enabled && backup.server.lastBackup || !backup.server.lastBackup && recoveryCreatedAt || backup.cloud.enabled && backup.cloud?.lastBackup || backup.local.enabled && backup.local.lastBackup;
18741
18910
  if (!hasBackupData || !createdRecoveryStats) return null;
18742
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Highlight, { type: "info", className: "text-[10px] leading-4", children: [
18743
- /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
18744
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react54.DatabaseBackup, { className: "w-4 h-4 flex-none" }),
18745
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "font-medium text-xs", children: t("passport:securityMenu.lastBackup") })
18911
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Highlight, { type: "info", className: "text-[10px] leading-4", children: [
18912
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
18913
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_lucide_react55.DatabaseBackup, { className: "w-4 h-4 flex-none" }),
18914
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "font-medium text-xs", children: t("passport:securityMenu.lastBackup") })
18746
18915
  ] }),
18747
- recoveryCreatedAt && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
18748
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "block font-mono! ", children: t("passport:securityMenu.lastBackupMeta", {
18916
+ recoveryCreatedAt && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
18917
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "block font-mono! ", children: t("passport:securityMenu.lastBackupMeta", {
18749
18918
  browser: cleanStringArtifacts(recoveryBrowser || "unknown"),
18750
18919
  os: parseOS(recoveryUa) || "unknown os",
18751
18920
  deviceName: cleanStringArtifacts(recoveryDeviceName || recoveryDeviceId || "")
18752
18921
  }) }),
18753
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "block font-mono! text-[var(--ui-kit-fg-muted)]", children: (0, import_dayjs6.default)(recoveryCreatedAt).format("MMMM DD, YYYY HH:mm") })
18922
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "block font-mono! text-[var(--ui-kit-fg-muted)]", children: (0, import_dayjs6.default)(recoveryCreatedAt).format("MMMM DD, YYYY HH:mm") })
18754
18923
  ] })
18755
18924
  ] });
18756
18925
  }
18757
- var import_dayjs6, import_lucide_react54, import_jsx_runtime87;
18926
+ var import_dayjs6, import_lucide_react55, import_jsx_runtime88;
18758
18927
  var init_LastBackup = __esm({
18759
18928
  "src/internal/components/SecurityMenu/Keyshare/LastBackup.tsx"() {
18760
18929
  init_useT();
18761
18930
  import_dayjs6 = __toESM(require("dayjs"), 1);
18762
- import_lucide_react54 = require("lucide-react");
18931
+ import_lucide_react55 = require("lucide-react");
18763
18932
  init_highlight();
18764
- import_jsx_runtime87 = require("react/jsx-runtime");
18933
+ import_jsx_runtime88 = require("react/jsx-runtime");
18765
18934
  {
18766
18935
  }
18767
18936
  {
@@ -18769,86 +18938,135 @@ var init_LastBackup = __esm({
18769
18938
  }
18770
18939
  });
18771
18940
 
18941
+ // src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts
18942
+ function useKeyshareRecoveryStats() {
18943
+ const session = useSession((st) => st.session);
18944
+ const userId = session?.mpcUserId || null;
18945
+ return (0, import_react_query42.useQuery)({
18946
+ enabled: !!userId,
18947
+ queryKey: [KEYSHARE_RECOVERY_STATS_QUERY, userId],
18948
+ queryFn: async () => {
18949
+ const iframeManager = getIframeManager();
18950
+ if (!iframeManager) {
18951
+ throw new Error("Iframe manager not available");
18952
+ }
18953
+ const keyshareInfo = await getKeyshareInfo(userId);
18954
+ const shareRecoveryStats = await getShareRecoveryStats();
18955
+ return {
18956
+ keyshareInfo,
18957
+ shareRecoveryStats
18958
+ };
18959
+ }
18960
+ });
18961
+ }
18962
+ var import_react_query42;
18963
+ var init_useKeyshareRecoveryStats = __esm({
18964
+ "src/internal/components/SecurityMenu/Keyshare/useKeyshareRecoveryStats.ts"() {
18965
+ init_SessionContext();
18966
+ import_react_query42 = require("@tanstack/react-query");
18967
+ init_keyshare();
18968
+ init_iframe_manager();
18969
+ init_vaultClient();
18970
+ init_constants5();
18971
+ }
18972
+ });
18973
+
18772
18974
  // src/internal/components/SecurityMenu/Keyshare/Keyshare.tsx
18773
- function Keyshare(props) {
18774
- const { userId, serverHasKeyshare, localInfo, hasServerBackup, createdRecoveryStats, isLoading } = props;
18975
+ function Keyshare() {
18976
+ const userId = useSession((st) => st?.session?.mpcUserId);
18775
18977
  const { t } = useT();
18978
+ const serverHasKeyshare = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
18979
+ const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
18980
+ (0, import_react63.useEffect)(() => {
18981
+ if (!recoveryData?.keyshareInfo || isRecoveryLoading) return;
18982
+ useSecurityStore.getState().setRenderKey(`keyshare-loaded-${Date.now()}`);
18983
+ }, [recoveryData, isRecoveryLoading]);
18984
+ const localInfo = recoveryData?.keyshareInfo || {};
18985
+ const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
18776
18986
  const backup = userId ? getBackupStatus(userId) : { server: { enabled: false }, cloud: { enabled: false }, local: { enabled: false } };
18777
- if (isLoading) {
18778
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "w-full flex items-center justify-center p-[var(--ui-kit-pd)]", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_lucide_react55.LoaderIcon, { className: "h-4 w-4 animate-spin" }) });
18779
- }
18780
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
18781
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "font-medium text-xs text-[var(--ui-kit-fg)]", children: t("passport:securityMenu.keyshareStatus.title") }),
18782
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "grid grid-cols-3 gap-[var(--ui-kit-gap)] px-[var(--ui-kit-gap)]", children: [
18783
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
18784
- KeyshareStatus,
18785
- {
18786
- content: serverHasKeyshare ? t("passport:securityMenu.keyshareStatus.serverReady") : t("passport:securityMenu.keyshareStatus.serverMissing"),
18787
- icon: serverHasKeyshare ? PositiveIcon : NegativeIcon,
18788
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
18789
- Highlight,
18790
- {
18791
- type: serverHasKeyshare ? "success" : "warning",
18792
- className: "w-full h-full flex flex-col items-center gap-0",
18793
- children: [
18794
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_lucide_react55.Cloud, { className: "h-6 w-6" }),
18795
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "text-[10px] font-medium leading-4", children: "Server Share" })
18796
- ]
18797
- }
18798
- )
18799
- }
18800
- ),
18801
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
18802
- KeyshareStatus,
18803
- {
18804
- content: localInfo?.hasKeyshare ? t("passport:securityMenu.keyshareStatus.localReady") : t("passport:securityMenu.keyshareStatus.localMissing"),
18805
- icon: localInfo?.hasKeyshare ? PositiveIcon : NegativeIcon,
18806
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
18807
- Highlight,
18808
- {
18809
- type: localInfo?.hasKeyshare ? "success" : "warning",
18810
- className: "w-full h-full flex flex-col items-center gap-0",
18811
- children: [
18812
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_lucide_react55.Laptop, { className: "h-6 w-6" }),
18813
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "text-[10px] font-medium leading-4", children: "Local Share" })
18814
- ]
18815
- }
18816
- )
18817
- }
18818
- ),
18819
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
18820
- KeyshareStatus,
18821
- {
18822
- content: hasServerBackup ? t("passport:securityMenu.keyshareStatus.valutBackupCreated") : t("passport:securityMenu.keyshareStatus.valutBackupMissing"),
18823
- icon: hasServerBackup ? PositiveIcon : NegativeIcon,
18824
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
18825
- Highlight,
18826
- {
18827
- type: hasServerBackup ? "success" : "warning",
18828
- className: "w-full h-full flex flex-col items-center gap-0",
18829
- children: [
18830
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_lucide_react55.Server, { className: "h-6 w-6" }),
18831
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "text-[10px] font-medium leading-4", children: "Vault Backup" })
18832
- ]
18833
- }
18834
- )
18835
- }
18836
- )
18987
+ const createdRecoveryStats = recoveryData?.shareRecoveryStats?.created;
18988
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
18989
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
18990
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-xs leading-4", children: t("passport:securityMenu.keyshareStatus.title") }),
18991
+ isRecoveryLoading && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.LoaderIcon, { className: "h-4 w-4 animate-spin" })
18837
18992
  ] }),
18838
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(LastBackup, { backup, createdRecoveryStats })
18993
+ !isRecoveryLoading && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
18994
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "grid grid-cols-3 gap-[var(--ui-kit-gap)] px-[var(--ui-kit-gap)]", children: [
18995
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
18996
+ KeyshareStatus,
18997
+ {
18998
+ content: serverHasKeyshare ? t("passport:securityMenu.keyshareStatus.serverReady") : t("passport:securityMenu.keyshareStatus.serverMissing"),
18999
+ icon: serverHasKeyshare ? PositiveIcon : NegativeIcon,
19000
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
19001
+ Highlight,
19002
+ {
19003
+ type: serverHasKeyshare ? "success" : "warning",
19004
+ className: "w-full h-full flex flex-col items-center gap-0",
19005
+ children: [
19006
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.Cloud, { className: "h-6 w-6" }),
19007
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-[10px] font-medium leading-4", children: "Server Share" })
19008
+ ]
19009
+ }
19010
+ )
19011
+ }
19012
+ ),
19013
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
19014
+ KeyshareStatus,
19015
+ {
19016
+ content: localInfo?.hasKeyshare ? t("passport:securityMenu.keyshareStatus.localReady") : t("passport:securityMenu.keyshareStatus.localMissing"),
19017
+ icon: localInfo?.hasKeyshare ? PositiveIcon : NegativeIcon,
19018
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
19019
+ Highlight,
19020
+ {
19021
+ type: localInfo?.hasKeyshare ? "success" : "warning",
19022
+ className: "w-full h-full flex flex-col items-center gap-0",
19023
+ children: [
19024
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.Laptop, { className: "h-6 w-6" }),
19025
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-[10px] font-medium leading-4", children: "Local Share" })
19026
+ ]
19027
+ }
19028
+ )
19029
+ }
19030
+ ),
19031
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
19032
+ KeyshareStatus,
19033
+ {
19034
+ content: hasServerBackup ? t("passport:securityMenu.keyshareStatus.valutBackupCreated") : t("passport:securityMenu.keyshareStatus.valutBackupMissing"),
19035
+ icon: hasServerBackup ? PositiveIcon : NegativeIcon,
19036
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
19037
+ Highlight,
19038
+ {
19039
+ type: hasServerBackup ? "success" : "warning",
19040
+ className: "w-full h-full flex flex-col items-center gap-0",
19041
+ children: [
19042
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.Server, { className: "h-6 w-6" }),
19043
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-[10px] font-medium leading-4", children: "Vault Backup" })
19044
+ ]
19045
+ }
19046
+ )
19047
+ }
19048
+ )
19049
+ ] }),
19050
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(LastBackup, { backup, createdRecoveryStats })
19051
+ ] })
18839
19052
  ] });
18840
19053
  }
18841
- var import_lucide_react55, import_jsx_runtime88;
19054
+ var import_lucide_react56, import_react63, import_jsx_runtime89;
18842
19055
  var init_Keyshare = __esm({
18843
19056
  "src/internal/components/SecurityMenu/Keyshare/Keyshare.tsx"() {
19057
+ init_SessionContext();
18844
19058
  init_useT();
18845
- import_lucide_react55 = require("lucide-react");
19059
+ import_lucide_react56 = require("lucide-react");
19060
+ import_react63 = require("react");
18846
19061
  init_icons();
19062
+ init_auth();
18847
19063
  init_vaultClient();
18848
19064
  init_highlight();
19065
+ init_useSecurityStore();
18849
19066
  init_KeyshareStatus();
18850
19067
  init_LastBackup();
18851
- import_jsx_runtime88 = require("react/jsx-runtime");
19068
+ init_useKeyshareRecoveryStats();
19069
+ import_jsx_runtime89 = require("react/jsx-runtime");
18852
19070
  {
18853
19071
  }
18854
19072
  {
@@ -18860,92 +19078,16 @@ var init_Keyshare = __esm({
18860
19078
  var init_Keyshare2 = __esm({
18861
19079
  "src/internal/components/SecurityMenu/Keyshare/index.ts"() {
18862
19080
  init_Keyshare();
18863
- }
18864
- });
18865
-
18866
- // src/internal/components/SecurityMenu/UntrustApplication.tsx
18867
- function UntrustApplication(props) {
18868
- const { appToUntrust, isPending, cancelUntrust, handleUntrustApp } = props;
18869
- const { t } = useT();
18870
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex flex-col gap-[var(--ui-kit-gap)]", children: [
18871
- /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Highlight, { className: "flex flex-col gap-[var(--ui-kit-gap)]", type: "warning", children: [
18872
- /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("span", { className: "text-sm leading-5 font-bold", children: [
18873
- t("passport:securityMenu.connectedApps.untrustApp"),
18874
- "?"
18875
- ] }),
18876
- /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "w-full flex items-center justify-center gap-[var(--ui-kit-gap)]", children: [
18877
- appToUntrust.appLogo ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "w-12 h-12 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg)] flex-shrink-0 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("img", { src: appToUntrust.appLogo, alt: appToUntrust.appName, className: "w-full h-full object-contain" }) }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("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__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.AppWindowMac, { className: "w-6 h-6" }) }),
18878
- /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex-1 text-left", children: [
18879
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "font-medium", children: appToUntrust.appName }),
18880
- appToUntrust.hostname && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "text-[10px]", children: [
18881
- "(",
18882
- appToUntrust.hostname,
18883
- ")"
18884
- ] })
18885
- ] })
18886
- ] })
18887
- ] }),
18888
- /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "text-[10px] text-[var(--ui-kit-fg-muted)] text-left space-y-1", children: [
18889
- /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("p", { children: [
18890
- t("passport:securityMenu.connectedApps.removalNoteTitle"),
18891
- ":"
18892
- ] }),
18893
- /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("ul", { className: "list-disc list-inside ml-2 space-y-0.5", children: [
18894
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg1") }),
18895
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("li", { children: t("passport:securityMenu.connectedApps.removalNoteMsg2") })
18896
- ] })
18897
- ] }),
18898
- /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
18899
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Button, { variant: "outline", size: "large", className: "flex-1", onClick: () => cancelUntrust(), disabled: isPending, children: t("passport:common.cancel") }),
18900
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Button, { variant: "default", size: "large", className: "flex-1", onClick: handleUntrustApp, disabled: isPending, children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react56.Loader, { className: "h-4 w-4 animate-spin" }) : t("passport:common.delete") })
18901
- ] })
18902
- ] });
18903
- }
18904
- var import_lucide_react56, import_jsx_runtime89;
18905
- var init_UntrustApplication = __esm({
18906
- "src/internal/components/SecurityMenu/UntrustApplication.tsx"() {
18907
- init_i18n();
18908
- import_lucide_react56 = require("lucide-react");
18909
- init_button();
18910
- init_highlight();
18911
- import_jsx_runtime89 = require("react/jsx-runtime");
19081
+ init_useKeyshareRecoveryStats();
18912
19082
  }
18913
19083
  });
18914
19084
 
18915
19085
  // src/internal/components/SecurityMenu/SecurityMenu.tsx
18916
19086
  function SecurityMenu() {
18917
- const qc = (0, import_react_query41.useQueryClient)();
18918
19087
  const { t } = useT();
18919
19088
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
18920
- const setPage = useLayoutDataStore((st) => st.setPage);
18921
- const userId = import_auth23.jwtTokenManager.getUserId();
18922
- const serverHasKeyshare = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
18923
- const [appToUntrust, untrustApp] = (0, import_react61.useState)(null);
18924
- const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
18925
- const localInfo = recoveryData?.keyshareInfo || {};
18926
- const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
18927
- const { mutate: handleUntrustApp, isPending: isUntrustingApp } = (0, import_react_query41.useMutation)({
18928
- mutationFn: async () => {
18929
- if (!userId || !appToUntrust) return;
18930
- const iframeManager = getIframeManager();
18931
- if (!iframeManager) {
18932
- throw new Error("Iframe manager not available");
18933
- }
18934
- return await iframeManager.removeTrustedApp(userId, appToUntrust.projectId, appToUntrust.origin);
18935
- },
18936
- onSuccess: (success) => {
18937
- if (!success) {
18938
- console.error("[SecurityMenu] Failed to remove trusted app from iframe");
18939
- return;
18940
- }
18941
- qc.invalidateQueries({ queryKey: [CONNECTED_TRUSTED_APPS_QUERY, userId] });
18942
- untrustApp(null);
18943
- },
18944
- onError: (error) => {
18945
- const errorMessage = error instanceof Error ? error.message : "Unknown error";
18946
- console.error("[SecurityMenu] Error removing trusted app:", errorMessage);
18947
- }
18948
- });
19089
+ const appToUntrust = useSecurityStore((st) => st.appToUntrust);
19090
+ const renderKey = useSecurityStore((st) => st.renderKey);
18949
19091
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
18950
19092
  "div",
18951
19093
  {
@@ -18963,57 +19105,40 @@ function SecurityMenu() {
18963
19105
  size: "icon",
18964
19106
  title: t("passport:common.back"),
18965
19107
  onClick: () => {
18966
- if (!!appToUntrust) untrustApp(null);
18967
- else setPage("settings" /* SETTINGS */);
19108
+ const { appToUntrust: appToUntrust2, untrustApp } = useSecurityStore.getState();
19109
+ if (!!appToUntrust2) {
19110
+ untrustApp(null);
19111
+ } else {
19112
+ useLayoutDataStore.getState().setPage("settings" /* SETTINGS */);
19113
+ }
18968
19114
  },
18969
19115
  children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react57.ArrowLeft, { className: "h-4 w-4" })
18970
19116
  }
18971
19117
  ),
18972
19118
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "text-xl font-semibold", children: t("passport:securityMenu.title") })
18973
19119
  ] }),
18974
- appToUntrust && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
18975
- UntrustApplication,
18976
- {
18977
- appToUntrust,
18978
- isPending: isRecoveryLoading || isUntrustingApp,
18979
- cancelUntrust: () => untrustApp(null),
18980
- handleUntrustApp: async () => await handleUntrustApp()
18981
- }
18982
- ),
18983
- !appToUntrust && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
18984
- Keyshare,
18985
- {
18986
- userId,
18987
- serverHasKeyshare,
18988
- localInfo,
18989
- hasServerBackup,
18990
- isLoading: isRecoveryLoading,
18991
- createdRecoveryStats: recoveryData?.shareRecoveryStats?.created
18992
- }
18993
- ),
18994
- !appToUntrust && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ConnectedApps, { isLoading: isRecoveryLoading, untrustApp })
19120
+ appToUntrust && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(UntrustApplication, {}),
19121
+ !appToUntrust && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
19122
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Keyshare, {}),
19123
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ConnectedApps, {})
19124
+ ] }),
19125
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "w-full" }, renderKey)
18995
19126
  ] })
18996
19127
  }
18997
19128
  );
18998
19129
  }
18999
- var import_react_query41, import_lucide_react57, import_react61, import_jsx_runtime90;
19130
+ var import_lucide_react57, import_jsx_runtime90;
19000
19131
  var init_SecurityMenu = __esm({
19001
19132
  "src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
19002
19133
  init_i18n();
19003
- import_react_query41 = require("@tanstack/react-query");
19004
19134
  import_lucide_react57 = require("lucide-react");
19005
- import_react61 = require("react");
19006
- init_auth();
19007
19135
  init_useLayoutDataStore();
19008
19136
  init_useLayoutStore();
19009
- init_iframe_manager();
19010
19137
  init_Expandable2();
19011
19138
  init_button();
19012
- init_ConnectedApps();
19013
- init_constants5();
19014
- init_hooks2();
19139
+ init_ConnectedApps2();
19015
19140
  init_Keyshare2();
19016
- init_UntrustApplication();
19141
+ init_useSecurityStore();
19017
19142
  import_jsx_runtime90 = require("react/jsx-runtime");
19018
19143
  }
19019
19144
  });
@@ -19022,6 +19147,8 @@ var init_SecurityMenu = __esm({
19022
19147
  var init_SecurityMenu2 = __esm({
19023
19148
  "src/internal/components/SecurityMenu/index.ts"() {
19024
19149
  init_SecurityMenu();
19150
+ init_ConnectedApps2();
19151
+ init_Keyshare2();
19025
19152
  }
19026
19153
  });
19027
19154
 
@@ -19117,12 +19244,12 @@ var init_wallet = __esm({
19117
19244
  });
19118
19245
 
19119
19246
  // src/internal/components/SendMenu/useFlowSelector.ts
19120
- var import_zustand10, import_middleware2, useFlowSelectorStore;
19247
+ var import_zustand11, import_middleware2, useFlowSelectorStore;
19121
19248
  var init_useFlowSelector = __esm({
19122
19249
  "src/internal/components/SendMenu/useFlowSelector.ts"() {
19123
- import_zustand10 = require("zustand");
19250
+ import_zustand11 = require("zustand");
19124
19251
  import_middleware2 = require("zustand/middleware");
19125
- useFlowSelectorStore = (0, import_zustand10.create)()(
19252
+ useFlowSelectorStore = (0, import_zustand11.create)()(
19126
19253
  (0, import_middleware2.persist)(
19127
19254
  (set) => ({
19128
19255
  renderKey: Date.now().toString(),
@@ -19187,10 +19314,10 @@ var init_chains = __esm({
19187
19314
  });
19188
19315
 
19189
19316
  // src/internal/components/SendMenu/hyperbridge/useBridgeStore.ts
19190
- var import_zustand11, import_middleware3, RESETABLE_STATES, useBridgeStore;
19317
+ var import_zustand12, import_middleware3, RESETABLE_STATES, useBridgeStore;
19191
19318
  var init_useBridgeStore = __esm({
19192
19319
  "src/internal/components/SendMenu/hyperbridge/useBridgeStore.ts"() {
19193
- import_zustand11 = require("zustand");
19320
+ import_zustand12 = require("zustand");
19194
19321
  import_middleware3 = require("zustand/middleware");
19195
19322
  init_useFlowSelector();
19196
19323
  RESETABLE_STATES = {
@@ -19203,7 +19330,7 @@ var init_useBridgeStore = __esm({
19203
19330
  isQuoteEstimating: false,
19204
19331
  bridgeHistoryItem: null
19205
19332
  };
19206
- useBridgeStore = (0, import_zustand11.create)()(
19333
+ useBridgeStore = (0, import_zustand12.create)()(
19207
19334
  (0, import_middleware3.persist)(
19208
19335
  (set, get) => ({
19209
19336
  bridgeSenders: [],
@@ -19267,15 +19394,15 @@ function SenderSelector(props) {
19267
19394
  const { openConnectModal } = (0, import_rainbowkit.useConnectModal)();
19268
19395
  const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
19269
19396
  const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
19270
- const pendingWalletRef = (0, import_react62.useRef)(null);
19397
+ const pendingWalletRef = (0, import_react64.useRef)(null);
19271
19398
  const originChain = useBridgeStore((st) => st.originChain);
19272
19399
  const bridgeSender = useBridgeStore((st) => st.bridgeSender);
19273
19400
  const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
19274
- const [walletMessage, setWalletMessage] = (0, import_react62.useState)(null);
19275
- (0, import_react62.useEffect)(() => {
19401
+ const [walletMessage, setWalletMessage] = (0, import_react64.useState)(null);
19402
+ (0, import_react64.useEffect)(() => {
19276
19403
  useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
19277
19404
  }, [walletMessage]);
19278
- const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = (0, import_react_query42.useMutation)({
19405
+ const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = (0, import_react_query43.useMutation)({
19279
19406
  mutationFn: async (walletProfile) => {
19280
19407
  if (!walletProfile?.meta?.walletName || !walletProfile?.externalId || !walletProfile?.meta?.walletType) {
19281
19408
  console.error("[SENDER SELECTOR] Invalid wallet profile:", walletProfile);
@@ -19328,7 +19455,7 @@ function SenderSelector(props) {
19328
19455
  setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
19329
19456
  }
19330
19457
  });
19331
- (0, import_react62.useEffect)(() => {
19458
+ (0, import_react64.useEffect)(() => {
19332
19459
  const pendingProfile = pendingWalletRef.current;
19333
19460
  if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
19334
19461
  if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
@@ -19403,14 +19530,14 @@ function SenderSelector(props) {
19403
19530
  ] })
19404
19531
  ] });
19405
19532
  }
19406
- var import_rainbowkit, import_react_query42, import_react62, import_wagmi3, import_jsx_runtime91;
19533
+ var import_rainbowkit, import_react_query43, import_react64, import_wagmi3, import_jsx_runtime91;
19407
19534
  var init_SenderSelector = __esm({
19408
19535
  "src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx"() {
19409
19536
  init_ProviderContext();
19410
19537
  init_i18n();
19411
19538
  import_rainbowkit = require("@rainbow-me/rainbowkit");
19412
- import_react_query42 = require("@tanstack/react-query");
19413
- import_react62 = require("react");
19539
+ import_react_query43 = require("@tanstack/react-query");
19540
+ import_react64 = require("react");
19414
19541
  import_wagmi3 = require("wagmi");
19415
19542
  init_wallet();
19416
19543
  init_useLayoutDataStore();
@@ -19510,8 +19637,8 @@ var init_wallets = __esm({
19510
19637
  function useAvailableSenders() {
19511
19638
  const address = useSession((st) => st.address);
19512
19639
  const { profiles } = useLinkedProfiles();
19513
- const lastCalcedSenders = (0, import_react63.useRef)([]);
19514
- (0, import_react63.useEffect)(() => {
19640
+ const lastCalcedSenders = (0, import_react65.useRef)([]);
19641
+ (0, import_react65.useEffect)(() => {
19515
19642
  const sendersAccumulator = [
19516
19643
  {
19517
19644
  type: "embarkai-wallet",
@@ -19542,13 +19669,13 @@ function useAvailableSenders() {
19542
19669
  directWalletProfile: profiles.filter((p) => p.provider === "wallet")[0] || null
19543
19670
  };
19544
19671
  }
19545
- var import_react63;
19672
+ var import_react65;
19546
19673
  var init_useAvailableSenders = __esm({
19547
19674
  "src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
19548
19675
  init_SessionContext();
19549
19676
  init_tokens();
19550
19677
  init_linkedProfiles();
19551
- import_react63 = require("react");
19678
+ import_react65 = require("react");
19552
19679
  init_wallets();
19553
19680
  init_useFlowSelector();
19554
19681
  init_useBridgeStore();
@@ -19881,7 +20008,7 @@ function useHyperlaneHistory() {
19881
20008
  const page = useLayoutDataStore((st) => st.page);
19882
20009
  const flow = useFlowSelectorStore((st) => st.flow);
19883
20010
  const bridgeStep = useBridgeStore((st) => st.bridgeStep);
19884
- const query = (0, import_react_query43.useInfiniteQuery)({
20011
+ const query = (0, import_react_query44.useInfiniteQuery)({
19885
20012
  retry: false,
19886
20013
  initialPageParam: 1,
19887
20014
  refetchInterval: TX_HISTORY_POLLING_INTERVAL,
@@ -19891,29 +20018,29 @@ function useHyperlaneHistory() {
19891
20018
  queryFn: async ({ pageParam }) => await getHyperlaneBridgeHistory({ page: pageParam, pageSize: TX_HISTORY_PAGE_SIZE })
19892
20019
  });
19893
20020
  const { data: txHistoryData, isLoading: isBridgeTxHistoryLoading } = query;
19894
- const txList = (0, import_react64.useMemo)(
20021
+ const txList = (0, import_react66.useMemo)(
19895
20022
  () => txHistoryData?.pages?.map((p) => p.data).flat(Infinity) || [],
19896
20023
  [txHistoryData]
19897
20024
  );
19898
- const updateExpandable = (0, import_react64.useCallback)(
19899
- (0, import_lodash_es10.debounce)(() => {
20025
+ const updateExpandable = (0, import_react66.useCallback)(
20026
+ (0, import_lodash_es12.debounce)(() => {
19900
20027
  useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
19901
20028
  }, 250),
19902
20029
  []
19903
20030
  );
19904
- (0, import_react64.useEffect)(() => {
20031
+ (0, import_react66.useEffect)(() => {
19905
20032
  if (isBridgeTxHistoryLoading || txList.length === 0) return;
19906
20033
  updateExpandable();
19907
20034
  }, [isBridgeTxHistoryLoading, txList]);
19908
20035
  return { query, txList };
19909
20036
  }
19910
- var import_react_query43, import_lodash_es10, import_react64, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
20037
+ var import_react_query44, import_lodash_es12, import_react66, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
19911
20038
  var init_useHyperlaneHistory = __esm({
19912
20039
  "src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
19913
20040
  init_SessionContext();
19914
- import_react_query43 = require("@tanstack/react-query");
19915
- import_lodash_es10 = require("lodash-es");
19916
- import_react64 = require("react");
20041
+ import_react_query44 = require("@tanstack/react-query");
20042
+ import_lodash_es12 = require("lodash-es");
20043
+ import_react66 = require("react");
19917
20044
  init_useLayoutDataStore();
19918
20045
  init_useFlowSelector();
19919
20046
  init_api3();
@@ -19925,11 +20052,11 @@ var init_useHyperlaneHistory = __esm({
19925
20052
  });
19926
20053
 
19927
20054
  // src/internal/components/SendMenu/hyperbridge/hooks/useOperationHashesStore.ts
19928
- var import_zustand12, useOperationHashesStore;
20055
+ var import_zustand13, useOperationHashesStore;
19929
20056
  var init_useOperationHashesStore = __esm({
19930
20057
  "src/internal/components/SendMenu/hyperbridge/hooks/useOperationHashesStore.ts"() {
19931
- import_zustand12 = require("zustand");
19932
- useOperationHashesStore = (0, import_zustand12.create)((set) => ({
20058
+ import_zustand13 = require("zustand");
20059
+ useOperationHashesStore = (0, import_zustand13.create)((set) => ({
19933
20060
  hyperlaneDatabaseTx: null,
19934
20061
  operationHashes: [],
19935
20062
  setHyperlaneDatabaseTx: (hyperlaneDatabaseTx) => set({ hyperlaneDatabaseTx }),
@@ -19940,12 +20067,12 @@ var init_useOperationHashesStore = __esm({
19940
20067
 
19941
20068
  // src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts
19942
20069
  function useBridge() {
19943
- const qc = (0, import_react_query44.useQueryClient)();
20070
+ const qc = (0, import_react_query45.useQueryClient)();
19944
20071
  const { t } = useT();
19945
20072
  const address = useSession((st) => st.address);
19946
20073
  const { data: walletClient } = (0, import_wagmi4.useWalletClient)();
19947
20074
  const { switchChainAsync } = (0, import_wagmi4.useSwitchChain)();
19948
- const swapDirection = (0, import_react65.useCallback)(() => {
20075
+ const swapDirection = (0, import_react67.useCallback)(() => {
19949
20076
  const {
19950
20077
  bridgeStep,
19951
20078
  originChain,
@@ -19959,7 +20086,7 @@ function useBridge() {
19959
20086
  setOriginChain(destinationChain);
19960
20087
  setDestinationChain(originChain);
19961
20088
  }, []);
19962
- const { mutate: estimateQuote } = (0, import_react_query44.useMutation)({
20089
+ const { mutate: estimateQuote } = (0, import_react_query45.useMutation)({
19963
20090
  mutationFn: async (amountToBridge) => {
19964
20091
  useFlowSelectorStore.getState().setError(null);
19965
20092
  useFlowSelectorStore.getState().setIsUiLocked(true);
@@ -19997,7 +20124,7 @@ function useBridge() {
19997
20124
  useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
19998
20125
  }
19999
20126
  });
20000
- const handleQuoteEstimation = (0, import_react65.useCallback)((amnt) => {
20127
+ const handleQuoteEstimation = (0, import_react67.useCallback)((amnt) => {
20001
20128
  const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
20002
20129
  if (!amnt || !Number(amnt)) {
20003
20130
  useBridgeStore.getState().setQuote(null);
@@ -20027,7 +20154,7 @@ function useBridge() {
20027
20154
  })
20028
20155
  );
20029
20156
  }, []);
20030
- const { mutate: bridgeAsset, isPending: isAssetBridging } = (0, import_react_query44.useMutation)({
20157
+ const { mutate: bridgeAsset, isPending: isAssetBridging } = (0, import_react_query45.useMutation)({
20031
20158
  mutationFn: async () => {
20032
20159
  const {
20033
20160
  hyperRoute,
@@ -20122,14 +20249,14 @@ function useBridge() {
20122
20249
  isAssetBridging
20123
20250
  };
20124
20251
  }
20125
- var import_react_query44, import_react65, import_wagmi4;
20252
+ var import_react_query45, import_react67, import_wagmi4;
20126
20253
  var init_useBridge = __esm({
20127
20254
  "src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
20128
20255
  init_SessionContext();
20129
20256
  init_i18n();
20130
20257
  init_useExternalWalletStore();
20131
- import_react_query44 = require("@tanstack/react-query");
20132
- import_react65 = require("react");
20258
+ import_react_query45 = require("@tanstack/react-query");
20259
+ import_react67 = require("react");
20133
20260
  import_wagmi4 = require("wagmi");
20134
20261
  init_useLayoutStore();
20135
20262
  init_useFlowSelector();
@@ -20153,7 +20280,7 @@ function useHyperlaneRoutes() {
20153
20280
  data: hyperlaneWarpRoutes = [],
20154
20281
  isLoading: isLoadingWarpRoutes,
20155
20282
  error: errorWarpRoutes
20156
- } = (0, import_react_query45.useQuery)({
20283
+ } = (0, import_react_query46.useQuery)({
20157
20284
  retry: false,
20158
20285
  enabled: !!address && page === "send" /* SEND */ && flow === "bridge",
20159
20286
  queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
@@ -20163,7 +20290,7 @@ function useHyperlaneRoutes() {
20163
20290
  return warpRoutes;
20164
20291
  }
20165
20292
  });
20166
- (0, import_react66.useEffect)(() => {
20293
+ (0, import_react68.useEffect)(() => {
20167
20294
  if (!errorWarpRoutes) return;
20168
20295
  useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
20169
20296
  const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
@@ -20172,7 +20299,7 @@ function useHyperlaneRoutes() {
20172
20299
  setOriginChain(null);
20173
20300
  setDestinationChain(null);
20174
20301
  }, [errorWarpRoutes]);
20175
- (0, import_react66.useEffect)(() => {
20302
+ (0, import_react68.useEffect)(() => {
20176
20303
  if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
20177
20304
  const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
20178
20305
  if (!warpRouteToAutoSelect) return;
@@ -20191,12 +20318,12 @@ function useHyperlaneRoutes() {
20191
20318
  }, [hyperRoute, hyperlaneWarpRoutes]);
20192
20319
  return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
20193
20320
  }
20194
- var import_react_query45, import_react66, HYPERLANE_WARP_ROUTES_QUERY_KEY;
20321
+ var import_react_query46, import_react68, HYPERLANE_WARP_ROUTES_QUERY_KEY;
20195
20322
  var init_useHyperlaneRoutes = __esm({
20196
20323
  "src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
20197
20324
  init_SessionContext();
20198
- import_react_query45 = require("@tanstack/react-query");
20199
- import_react66 = require("react");
20325
+ import_react_query46 = require("@tanstack/react-query");
20326
+ import_react68 = require("react");
20200
20327
  init_useLayoutDataStore();
20201
20328
  init_useFlowSelector();
20202
20329
  init_api3();
@@ -20212,7 +20339,7 @@ function useMenuTitle(warpRoutes) {
20212
20339
  const bridgeStep = useBridgeStore((st) => st.bridgeStep);
20213
20340
  const hyperRoute = useBridgeStore((st) => st.hyperRoute);
20214
20341
  const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
20215
- (0, import_react67.useEffect)(() => {
20342
+ (0, import_react69.useEffect)(() => {
20216
20343
  const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
20217
20344
  switch (true) {
20218
20345
  case bridgeStep === "sender-selector":
@@ -20240,11 +20367,11 @@ function useMenuTitle(warpRoutes) {
20240
20367
  }
20241
20368
  }, [bridgeStep, hyperRouteMeta, t]);
20242
20369
  }
20243
- var import_react67;
20370
+ var import_react69;
20244
20371
  var init_useMenuTitle = __esm({
20245
20372
  "src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
20246
20373
  init_i18n();
20247
- import_react67 = require("react");
20374
+ import_react69 = require("react");
20248
20375
  init_useFlowSelector();
20249
20376
  init_useBridgeStore();
20250
20377
  }
@@ -20272,7 +20399,7 @@ function checkWrapedTokenSymbol2(symbol) {
20272
20399
  return symbol.toUpperCase();
20273
20400
  }
20274
20401
  function useBridgeBalance(hyperlaneWarpRoutes) {
20275
- const qc = (0, import_react_query46.useQueryClient)();
20402
+ const qc = (0, import_react_query47.useQueryClient)();
20276
20403
  const { t } = useT();
20277
20404
  const address = useSession((st) => st.address);
20278
20405
  const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
@@ -20299,7 +20426,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
20299
20426
  const embarkTokenBalanace = assets.find((a) => selectedWarpRoute?.symbol === checkWrapedTokenSymbol2(a.symbol));
20300
20427
  const originChainMeta = CHAINS_UI_META[originChain];
20301
20428
  const isSelectedTokenNative = selectedWarpRoute?.symbol?.toUpperCase() === originChainMeta?.chain?.nativeCurrency?.symbol?.toUpperCase();
20302
- const { data: externalBalanceData, isLoading: isExternalBalanceLoading } = (0, import_react_query46.useQuery)({
20429
+ const { data: externalBalanceData, isLoading: isExternalBalanceLoading } = (0, import_react_query47.useQuery)({
20303
20430
  retry: false,
20304
20431
  enabled: bridgeSender === "direct-wallet" && !isSelectedTokenNative && !!directWalletAddress && !!routeTokenAddress && !!originChain,
20305
20432
  queryKey: [EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, originChain, directWalletAddress, routeTokenAddress],
@@ -20342,7 +20469,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
20342
20469
  return { value, decimals, symbol, formatted };
20343
20470
  }
20344
20471
  });
20345
- const { data: externalNativeBalanceData, isLoading: isExternalNativeBalanceLoading } = (0, import_react_query46.useQuery)({
20472
+ const { data: externalNativeBalanceData, isLoading: isExternalNativeBalanceLoading } = (0, import_react_query47.useQuery)({
20346
20473
  retry: false,
20347
20474
  enabled: bridgeSender === "direct-wallet" && isSelectedTokenNative && !!directWalletAddress && !!originChain,
20348
20475
  queryKey: [EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY, originChain, directWalletAddress],
@@ -20357,7 +20484,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
20357
20484
  };
20358
20485
  }
20359
20486
  });
20360
- const refreshRouteTokenBalance = (0, import_react68.useCallback)(
20487
+ const refreshRouteTokenBalance = (0, import_react70.useCallback)(
20361
20488
  (senderWallet) => {
20362
20489
  switch (true) {
20363
20490
  case senderWallet === "embarkai-wallet":
@@ -20373,7 +20500,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
20373
20500
  },
20374
20501
  [refreshBalances, qc]
20375
20502
  );
20376
- (0, import_react68.useEffect)(() => {
20503
+ (0, import_react70.useEffect)(() => {
20377
20504
  if (!bridgeSender || !originChain) return;
20378
20505
  switch (bridgeSender) {
20379
20506
  case "embarkai-wallet":
@@ -20404,15 +20531,15 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
20404
20531
  isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
20405
20532
  };
20406
20533
  }
20407
- var import_core6, import_react_query46, import_react68, import_viem13, import_wagmi5, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
20534
+ var import_core6, import_react_query47, import_react70, import_viem13, import_wagmi5, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
20408
20535
  var init_useBridgeBalance = __esm({
20409
20536
  "src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
20410
20537
  init_constants();
20411
20538
  init_SessionContext();
20412
20539
  init_i18n();
20413
20540
  import_core6 = require("@embarkai/core");
20414
- import_react_query46 = require("@tanstack/react-query");
20415
- import_react68 = require("react");
20541
+ import_react_query47 = require("@tanstack/react-query");
20542
+ import_react70 = require("react");
20416
20543
  import_viem13 = require("viem");
20417
20544
  import_wagmi5 = require("wagmi");
20418
20545
  init_useBlockscoutAssets();
@@ -20530,7 +20657,7 @@ function SelectStep(props) {
20530
20657
  variant: "outline",
20531
20658
  size: "medium",
20532
20659
  className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
20533
- children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_react69.Fragment, { children: [
20660
+ children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_react71.Fragment, { children: [
20534
20661
  chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_lucide_react59.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
20535
20662
  /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
20536
20663
  ] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
@@ -20665,13 +20792,13 @@ function SelectStep(props) {
20665
20792
  )
20666
20793
  ] });
20667
20794
  }
20668
- var import_lucide_react59, import_react69, import_jsx_runtime95;
20795
+ var import_lucide_react59, import_react71, import_jsx_runtime95;
20669
20796
  var init_SelectStep = __esm({
20670
20797
  "src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
20671
20798
  init_tokens();
20672
20799
  init_i18n();
20673
20800
  import_lucide_react59 = require("lucide-react");
20674
- import_react69 = require("react");
20801
+ import_react71 = require("react");
20675
20802
  init_priceFormatter();
20676
20803
  init_utils2();
20677
20804
  init_badge();
@@ -20720,7 +20847,7 @@ var init_checkbox = __esm({
20720
20847
  // src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
20721
20848
  function ConfirmStep(props) {
20722
20849
  const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
20723
- const [userConsent, setUserConsent] = (0, import_react70.useState)(false);
20850
+ const [userConsent, setUserConsent] = (0, import_react72.useState)(false);
20724
20851
  const { t } = useT();
20725
20852
  const address = useSession((st) => st.address);
20726
20853
  const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
@@ -20829,13 +20956,13 @@ function ConfirmStep(props) {
20829
20956
  )
20830
20957
  ] });
20831
20958
  }
20832
- var import_lucide_react61, import_react70, import_jsx_runtime97, P_CN;
20959
+ var import_lucide_react61, import_react72, import_jsx_runtime97, P_CN;
20833
20960
  var init_ConfirmStep = __esm({
20834
20961
  "src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
20835
20962
  init_SessionContext();
20836
20963
  init_i18n();
20837
20964
  import_lucide_react61 = require("lucide-react");
20838
- import_react70 = require("react");
20965
+ import_react72 = require("react");
20839
20966
  init_priceFormatter();
20840
20967
  init_utils2();
20841
20968
  init_button();
@@ -21057,7 +21184,7 @@ function HistoryItem(props) {
21057
21184
  txStatus
21058
21185
  } = props;
21059
21186
  const { t } = useT();
21060
- const qc = (0, import_react_query47.useQueryClient)();
21187
+ const qc = (0, import_react_query48.useQueryClient)();
21061
21188
  const address = useSession((st) => st.address);
21062
21189
  const warpRoutes = qc.getQueryData([HYPERLANE_WARP_ROUTES_QUERY_KEY, address]);
21063
21190
  const assetWarpRoute = warpRoutes?.find((route) => {
@@ -21182,12 +21309,12 @@ function HistoryStep() {
21182
21309
  )
21183
21310
  ] });
21184
21311
  }
21185
- var import_react_query47, import_dayjs7, import_lucide_react62, import_jsx_runtime99, P_CN3;
21312
+ var import_react_query48, import_dayjs7, import_lucide_react62, import_jsx_runtime99, P_CN3;
21186
21313
  var init_HistoryStep = __esm({
21187
21314
  "src/internal/components/SendMenu/hyperbridge/steps/HistoryStep.tsx"() {
21188
21315
  init_SessionContext();
21189
21316
  init_i18n();
21190
- import_react_query47 = require("@tanstack/react-query");
21317
+ import_react_query48 = require("@tanstack/react-query");
21191
21318
  import_dayjs7 = __toESM(require("dayjs"), 1);
21192
21319
  import_lucide_react62 = require("lucide-react");
21193
21320
  init_tokens();
@@ -21210,9 +21337,9 @@ var init_HistoryStep = __esm({
21210
21337
  function SelectAssetRoute(props) {
21211
21338
  const { hyperlaneWarpRoutes } = props;
21212
21339
  const { t } = useT();
21213
- const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0, import_react71.useState)(false);
21340
+ const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0, import_react73.useState)(false);
21214
21341
  const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
21215
- const tokenList = (0, import_react71.useMemo)(() => {
21342
+ const tokenList = (0, import_react73.useMemo)(() => {
21216
21343
  const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
21217
21344
  const uniqueTokens = Array.from(new Set(tokens));
21218
21345
  return uniqueTokens.map((symbol) => ({
@@ -21309,13 +21436,13 @@ function SelectAssetRoute(props) {
21309
21436
  ] })
21310
21437
  ] });
21311
21438
  }
21312
- var import_lucide_react63, import_react71, import_jsx_runtime100;
21439
+ var import_lucide_react63, import_react73, import_jsx_runtime100;
21313
21440
  var init_SelectAssetRoute = __esm({
21314
21441
  "src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
21315
21442
  init_tokens();
21316
21443
  init_i18n();
21317
21444
  import_lucide_react63 = require("lucide-react");
21318
- import_react71 = require("react");
21445
+ import_react73 = require("react");
21319
21446
  init_button();
21320
21447
  init_useFlowSelector();
21321
21448
  init_ResolveChainIcon();
@@ -21343,7 +21470,7 @@ function HyperlaneBridge() {
21343
21470
  const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
21344
21471
  const { directWalletProfile } = useAvailableSenders();
21345
21472
  useMenuTitle(hyperlaneWarpRoutes);
21346
- (0, import_react72.useEffect)(() => {
21473
+ (0, import_react74.useEffect)(() => {
21347
21474
  return () => {
21348
21475
  useBridgeStore.getState().resetSelections();
21349
21476
  };
@@ -21376,10 +21503,10 @@ function HyperlaneBridge() {
21376
21503
  bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(HistoryDetailsStep, {})
21377
21504
  ] });
21378
21505
  }
21379
- var import_react72, import_jsx_runtime101;
21506
+ var import_react74, import_jsx_runtime101;
21380
21507
  var init_HyperlaneBridge = __esm({
21381
21508
  "src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
21382
- import_react72 = require("react");
21509
+ import_react74 = require("react");
21383
21510
  init_SenderSelector();
21384
21511
  init_useAvailableSenders();
21385
21512
  init_useBridge();
@@ -21397,7 +21524,7 @@ function BridgeHistorySwitch(props) {
21397
21524
  const selectorFlow = useFlowSelectorStore((st) => st.flow);
21398
21525
  const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
21399
21526
  const bridgeStep = useBridgeStore((st) => st.bridgeStep);
21400
- const lastBridgeStepRef = (0, import_react73.useRef)(null);
21527
+ const lastBridgeStepRef = (0, import_react75.useRef)(null);
21401
21528
  if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
21402
21529
  return null;
21403
21530
  }
@@ -21416,10 +21543,10 @@ function BridgeHistorySwitch(props) {
21416
21543
  }
21417
21544
  );
21418
21545
  }
21419
- var import_react73, import_jsx_runtime102;
21546
+ var import_react75, import_jsx_runtime102;
21420
21547
  var init_HistorySwitch = __esm({
21421
21548
  "src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
21422
- import_react73 = require("react");
21549
+ import_react75 = require("react");
21423
21550
  init_switch();
21424
21551
  init_useFlowSelector();
21425
21552
  init_useBridgeStore();
@@ -21510,11 +21637,11 @@ function looksLikeNickname(input) {
21510
21637
  }
21511
21638
  function useNicknameResolve(input, options) {
21512
21639
  const { enabled = true, chainId } = options;
21513
- const [debouncedInput, setDebouncedInput] = (0, import_react74.useState)("");
21514
- const [isDebouncing, setIsDebouncing] = (0, import_react74.useState)(false);
21640
+ const [debouncedInput, setDebouncedInput] = (0, import_react76.useState)("");
21641
+ const [isDebouncing, setIsDebouncing] = (0, import_react76.useState)(false);
21515
21642
  const normalized = normalizeNickname(input);
21516
21643
  const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
21517
- (0, import_react74.useEffect)(() => {
21644
+ (0, import_react76.useEffect)(() => {
21518
21645
  if (!isNicknameInput || !enabled) {
21519
21646
  setDebouncedInput("");
21520
21647
  setIsDebouncing(false);
@@ -21529,7 +21656,7 @@ function useNicknameResolve(input, options) {
21529
21656
  clearTimeout(timer);
21530
21657
  };
21531
21658
  }, [normalized, isNicknameInput, enabled]);
21532
- const query = (0, import_react_query48.useQuery)({
21659
+ const query = (0, import_react_query49.useQuery)({
21533
21660
  queryKey: [...QUERY_KEYS.nicknameResolve(debouncedInput), chainId],
21534
21661
  queryFn: async () => await resolveNickname(debouncedInput, chainId),
21535
21662
  enabled: enabled && isNicknameInput && debouncedInput.length > 0,
@@ -21540,7 +21667,7 @@ function useNicknameResolve(input, options) {
21540
21667
  const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
21541
21668
  const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
21542
21669
  const isFrozen = query.data?.isFrozen ?? false;
21543
- const fingerprintVerification = (0, import_react74.useMemo)(() => {
21670
+ const fingerprintVerification = (0, import_react76.useMemo)(() => {
21544
21671
  if (!query.data?.owner || !query.data?.fingerprint) {
21545
21672
  return null;
21546
21673
  }
@@ -21562,11 +21689,11 @@ function useNicknameResolve(input, options) {
21562
21689
  resolvedAddress
21563
21690
  };
21564
21691
  }
21565
- var import_react_query48, import_react74, DEBOUNCE_MS2;
21692
+ var import_react_query49, import_react76, DEBOUNCE_MS2;
21566
21693
  var init_useNicknameResolve = __esm({
21567
21694
  "src/hooks/useNicknameResolve.ts"() {
21568
- import_react_query48 = require("@tanstack/react-query");
21569
- import_react74 = require("react");
21695
+ import_react_query49 = require("@tanstack/react-query");
21696
+ import_react76 = require("react");
21570
21697
  init_nickname();
21571
21698
  init_profile();
21572
21699
  init_nickname_fingerprint();
@@ -21579,10 +21706,10 @@ var init_useNicknameResolve = __esm({
21579
21706
  function useSendTransaction() {
21580
21707
  const session = useSession((st) => st.session);
21581
21708
  const address = useSession((st) => st.address);
21582
- const [isLoading, setIsLoading] = (0, import_react75.useState)(false);
21583
- const [error, setError] = (0, import_react75.useState)(null);
21584
- const [userOpHash, setUserOpHash] = (0, import_react75.useState)(null);
21585
- const sendTransaction = (0, import_react75.useCallback)(
21709
+ const [isLoading, setIsLoading] = (0, import_react77.useState)(false);
21710
+ const [error, setError] = (0, import_react77.useState)(null);
21711
+ const [userOpHash, setUserOpHash] = (0, import_react77.useState)(null);
21712
+ const sendTransaction = (0, import_react77.useCallback)(
21586
21713
  async (params) => {
21587
21714
  if (!session || !address) {
21588
21715
  setError("No active session");
@@ -21679,7 +21806,7 @@ function useSendTransaction() {
21679
21806
  },
21680
21807
  [session, address]
21681
21808
  );
21682
- const reset = (0, import_react75.useCallback)(() => {
21809
+ const reset = (0, import_react77.useCallback)(() => {
21683
21810
  setError(null);
21684
21811
  setUserOpHash(null);
21685
21812
  setIsLoading(false);
@@ -21692,10 +21819,10 @@ function useSendTransaction() {
21692
21819
  reset
21693
21820
  };
21694
21821
  }
21695
- var import_react75, import_viem14, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
21822
+ var import_react77, import_viem14, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
21696
21823
  var init_useSendTransaction = __esm({
21697
21824
  "src/hooks/useSendTransaction.ts"() {
21698
- import_react75 = require("react");
21825
+ import_react77 = require("react");
21699
21826
  import_viem14 = require("viem");
21700
21827
  init_SessionContext();
21701
21828
  init_account2();
@@ -21838,7 +21965,7 @@ var init_AssetInputIcon = __esm({
21838
21965
 
21839
21966
  // src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
21840
21967
  function NftDisplayCard({ asset }) {
21841
- const [imageError, setImageError] = (0, import_react76.useState)(false);
21968
+ const [imageError, setImageError] = (0, import_react78.useState)(false);
21842
21969
  const nftImage = asset.image || asset.nftMetadata?.image;
21843
21970
  return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
21844
21971
  nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
@@ -21866,22 +21993,22 @@ function NftDisplayCard({ asset }) {
21866
21993
  ] })
21867
21994
  ] });
21868
21995
  }
21869
- var import_lucide_react65, import_react76, import_jsx_runtime104;
21996
+ var import_lucide_react65, import_react78, import_jsx_runtime104;
21870
21997
  var init_NftDisplayCard = __esm({
21871
21998
  "src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
21872
21999
  import_lucide_react65 = require("lucide-react");
21873
- import_react76 = require("react");
22000
+ import_react78 = require("react");
21874
22001
  import_jsx_runtime104 = require("react/jsx-runtime");
21875
22002
  }
21876
22003
  });
21877
22004
 
21878
22005
  // src/internal/components/SendMenu/send/useSendStore.ts
21879
- var import_zustand13, useSendStore;
22006
+ var import_zustand14, useSendStore;
21880
22007
  var init_useSendStore = __esm({
21881
22008
  "src/internal/components/SendMenu/send/useSendStore.ts"() {
21882
- import_zustand13 = require("zustand");
22009
+ import_zustand14 = require("zustand");
21883
22010
  init_useFlowSelector();
21884
- useSendStore = (0, import_zustand13.create)((set) => ({
22011
+ useSendStore = (0, import_zustand14.create)((set) => ({
21885
22012
  recipient: "",
21886
22013
  //
21887
22014
  amount: "",
@@ -22029,11 +22156,11 @@ function NicknameData(props) {
22029
22156
  isWalletNotSetup,
22030
22157
  isFrozen
22031
22158
  } = resolvedNicknameData;
22032
- (0, import_react77.useEffect)(() => {
22159
+ (0, import_react79.useEffect)(() => {
22033
22160
  if (!resolvedNicknameData?.data?.fingerprint || !isNicknameInput) return;
22034
22161
  useFlowSelectorStore.getState().setRenderKey(`nickname-resolved-${Date.now()}`);
22035
22162
  }, [resolvedNicknameData, isNicknameInput]);
22036
- (0, import_react77.useEffect)(() => {
22163
+ (0, import_react79.useEffect)(() => {
22037
22164
  if (isResolving) return;
22038
22165
  let errMessage = null;
22039
22166
  switch (true) {
@@ -22088,11 +22215,11 @@ function NicknameData(props) {
22088
22215
  ] })
22089
22216
  ] });
22090
22217
  }
22091
- var import_lucide_react66, import_react77, import_jsx_runtime106;
22218
+ var import_lucide_react66, import_react79, import_jsx_runtime106;
22092
22219
  var init_NicknameData = __esm({
22093
22220
  "src/internal/components/SendMenu/send/components/NicknameData.tsx"() {
22094
22221
  import_lucide_react66 = require("lucide-react");
22095
- import_react77 = require("react");
22222
+ import_react79 = require("react");
22096
22223
  init_no_image();
22097
22224
  init_utils2();
22098
22225
  init_useFlowSelector();
@@ -22118,7 +22245,7 @@ function isNftAsset4(asset) {
22118
22245
  function useTokenBalance(asset) {
22119
22246
  const address = useSession((st) => st.address);
22120
22247
  const chainConfig = useSession((st) => st.chainConfig);
22121
- return (0, import_react_query49.useQuery)({
22248
+ return (0, import_react_query50.useQuery)({
22122
22249
  retry: false,
22123
22250
  enabled: !!address && !!chainConfig?.id && !!asset?.symbol,
22124
22251
  refetchInterval: 5e3,
@@ -22182,11 +22309,11 @@ function useTokenBalance(asset) {
22182
22309
  }
22183
22310
  });
22184
22311
  }
22185
- var import_react_query49, import_viem17, SEND_TOKEN_BALANCE_QUERY_KEY;
22312
+ var import_react_query50, import_viem17, SEND_TOKEN_BALANCE_QUERY_KEY;
22186
22313
  var init_useTokenBalance = __esm({
22187
22314
  "src/internal/components/SendMenu/send/useTokenBalance.ts"() {
22188
22315
  init_SessionContext();
22189
- import_react_query49 = require("@tanstack/react-query");
22316
+ import_react_query50 = require("@tanstack/react-query");
22190
22317
  import_viem17 = require("viem");
22191
22318
  SEND_TOKEN_BALANCE_QUERY_KEY = "current-chain-send-token-balance-query";
22192
22319
  }
@@ -22414,7 +22541,7 @@ function ConfirmSendStep(props) {
22414
22541
  const isNft = isNftAsset3(selectedAsset);
22415
22542
  const isSecurity = isSecurityToken2(selectedAsset);
22416
22543
  const effectiveAddress = isNicknameInput ? resolvedAddress : recipient;
22417
- const { mutate: handleConfirm, isPending: isTransactionPending } = (0, import_react_query50.useMutation)({
22544
+ const { mutate: handleConfirm, isPending: isTransactionPending } = (0, import_react_query51.useMutation)({
22418
22545
  mutationFn: async () => {
22419
22546
  if (!effectiveAddress || !selectedAsset) return;
22420
22547
  setTxStep("pending");
@@ -22568,12 +22695,12 @@ function ConfirmSendStep(props) {
22568
22695
  )
22569
22696
  ] });
22570
22697
  }
22571
- var import_react_query50, import_lucide_react68, import_jsx_runtime108;
22698
+ var import_react_query51, import_lucide_react68, import_jsx_runtime108;
22572
22699
  var init_ConfirmSendStep = __esm({
22573
22700
  "src/internal/components/SendMenu/send/sendSteps/ConfirmSendStep.tsx"() {
22574
22701
  init_SessionContext();
22575
22702
  init_i18n();
22576
- import_react_query50 = require("@tanstack/react-query");
22703
+ import_react_query51 = require("@tanstack/react-query");
22577
22704
  import_lucide_react68 = require("lucide-react");
22578
22705
  init_priceFormatter();
22579
22706
  init_utils2();
@@ -22613,10 +22740,10 @@ function SendMenu() {
22613
22740
  userOpHash,
22614
22741
  reset
22615
22742
  } = useSendTransaction();
22616
- (0, import_react78.useEffect)(() => {
22743
+ (0, import_react80.useEffect)(() => {
22617
22744
  useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
22618
22745
  }, [isAssetsLoading, isTransactionPending]);
22619
- (0, import_react78.useEffect)(() => {
22746
+ (0, import_react80.useEffect)(() => {
22620
22747
  useFlowSelectorStore.getState().setError(sendTransactionError || null);
22621
22748
  }, [sendTransactionError]);
22622
22749
  const {
@@ -22631,7 +22758,7 @@ function SendMenu() {
22631
22758
  } = useSendStore();
22632
22759
  const isNft = isNftAsset3(selectedAsset);
22633
22760
  const isSecurity = isSecurityToken2(selectedAsset);
22634
- (0, import_react78.useEffect)(() => {
22761
+ (0, import_react80.useEffect)(() => {
22635
22762
  const shouldDefaultAsset = assets.length > 0 && !selectedAsset;
22636
22763
  if (!shouldDefaultAsset) return;
22637
22764
  const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
@@ -22641,7 +22768,7 @@ function SendMenu() {
22641
22768
  if (isBalance(erc20)) return setSelectedAsset(erc20);
22642
22769
  setSelectedAsset(assets[0]);
22643
22770
  }, [assets, selectedAsset]);
22644
- (0, import_react78.useEffect)(
22771
+ (0, import_react80.useEffect)(
22645
22772
  () => () => {
22646
22773
  setSelectedAsset(null);
22647
22774
  setRecipient("");
@@ -22654,7 +22781,7 @@ function SendMenu() {
22654
22781
  const isNicknameInput = looksLikeNickname(recipient);
22655
22782
  const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
22656
22783
  const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
22657
- const complianceAmount = (0, import_react78.useMemo)(() => {
22784
+ const complianceAmount = (0, import_react80.useMemo)(() => {
22658
22785
  if (!isSecurity || !amount || !selectedAsset) return void 0;
22659
22786
  try {
22660
22787
  return (0, import_viem19.parseUnits)(amount, selectedAsset.decimals || 18);
@@ -22669,7 +22796,7 @@ function SendMenu() {
22669
22796
  enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
22670
22797
  chainId: activeChainId
22671
22798
  });
22672
- (0, import_react78.useEffect)(() => {
22799
+ (0, import_react80.useEffect)(() => {
22673
22800
  const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
22674
22801
  switch (true) {
22675
22802
  case txStep === "select-asset":
@@ -22739,7 +22866,7 @@ function SendMenu() {
22739
22866
  ] })
22740
22867
  ] });
22741
22868
  }
22742
- var import_lucide_react69, import_react78, import_viem19, import_jsx_runtime109;
22869
+ var import_lucide_react69, import_react80, import_viem19, import_jsx_runtime109;
22743
22870
  var init_SendMenu = __esm({
22744
22871
  "src/internal/components/SendMenu/send/SendMenu.tsx"() {
22745
22872
  init_SessionContext();
@@ -22748,7 +22875,7 @@ var init_SendMenu = __esm({
22748
22875
  init_useSendTransaction();
22749
22876
  init_useT();
22750
22877
  import_lucide_react69 = require("lucide-react");
22751
- import_react78 = require("react");
22878
+ import_react80 = require("react");
22752
22879
  import_viem19 = require("viem");
22753
22880
  init_useBlockscoutAssets();
22754
22881
  init_useLayoutDataStore();
@@ -22833,7 +22960,7 @@ function SendFlowSelector() {
22833
22960
  const error = useFlowSelectorStore((st) => st.error);
22834
22961
  const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
22835
22962
  const selectorFlow = useFlowSelectorStore((st) => st.flow);
22836
- (0, import_react79.useEffect)(
22963
+ (0, import_react81.useEffect)(
22837
22964
  () => () => {
22838
22965
  useFlowSelectorStore.getState().setError(null);
22839
22966
  },
@@ -22910,12 +23037,12 @@ function SendFlowSelector() {
22910
23037
  }
22911
23038
  );
22912
23039
  }
22913
- var import_lucide_react70, import_react79, import_jsx_runtime110, SELECTOR_FLOW;
23040
+ var import_lucide_react70, import_react81, import_jsx_runtime110, SELECTOR_FLOW;
22914
23041
  var init_SendFlowSelector = __esm({
22915
23042
  "src/internal/components/SendMenu/SendFlowSelector.tsx"() {
22916
23043
  init_i18n();
22917
23044
  import_lucide_react70 = require("lucide-react");
22918
- import_react79 = require("react");
23045
+ import_react81 = require("react");
22919
23046
  init_useLayoutDataStore();
22920
23047
  init_useLayoutStore();
22921
23048
  init_utils2();
@@ -22970,12 +23097,12 @@ function getServerSnapshot() {
22970
23097
  return false;
22971
23098
  }
22972
23099
  function useProMode() {
22973
- return (0, import_react80.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
23100
+ return (0, import_react82.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
22974
23101
  }
22975
- var import_react80, STORAGE_KEY, EVENT_NAME;
23102
+ var import_react82, STORAGE_KEY, EVENT_NAME;
22976
23103
  var init_pro_mode = __esm({
22977
23104
  "src/internal/lib/pro-mode.ts"() {
22978
- import_react80 = require("react");
23105
+ import_react82 = require("react");
22979
23106
  STORAGE_KEY = "embarkai_pro_mode";
22980
23107
  EVENT_NAME = "embarkai-pro-mode-changed";
22981
23108
  }
@@ -23017,7 +23144,7 @@ function useSettingsButtons() {
23017
23144
  if (proMode) {
23018
23145
  settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: import_lucide_react72.HardDrive });
23019
23146
  }
23020
- (0, import_react81.useEffect)(() => {
23147
+ (0, import_react83.useEffect)(() => {
23021
23148
  const cssvEl = document.querySelector(".embarkai-ui-scope");
23022
23149
  if (!cssvEl || !window?.getComputedStyle) {
23023
23150
  return;
@@ -23039,7 +23166,7 @@ function SettingsMenu() {
23039
23166
  const setPage = useLayoutDataStore((st) => st.setPage);
23040
23167
  const settingsButtons = useSettingsButtons();
23041
23168
  useProvidersList();
23042
- (0, import_react_query51.useQuery)({
23169
+ (0, import_react_query52.useQuery)({
23043
23170
  retry: 1,
23044
23171
  enabled: !!address,
23045
23172
  queryKey: [QUERY_KEYS.nicknameInfo, address],
@@ -23081,15 +23208,15 @@ function SettingsMenu() {
23081
23208
  }
23082
23209
  );
23083
23210
  }
23084
- var import_react_query51, import_lucide_react72, import_react81, import_jsx_runtime111;
23211
+ var import_react_query52, import_lucide_react72, import_react83, import_jsx_runtime111;
23085
23212
  var init_SettingsMenu = __esm({
23086
23213
  "src/internal/components/SettingsMenu/SettingsMenu.tsx"() {
23087
23214
  init_ProviderContext();
23088
23215
  init_SessionContext();
23089
23216
  init_i18n();
23090
- import_react_query51 = require("@tanstack/react-query");
23217
+ import_react_query52 = require("@tanstack/react-query");
23091
23218
  import_lucide_react72 = require("lucide-react");
23092
- import_react81 = require("react");
23219
+ import_react83 = require("react");
23093
23220
  init_nickname();
23094
23221
  init_profile();
23095
23222
  init_useLayoutDataStore();
@@ -23955,26 +24082,26 @@ var init_TransactionsGroup = __esm({
23955
24082
 
23956
24083
  // src/internal/components/TransactionsMenu/TransactionsMenu.tsx
23957
24084
  function TransactionsMenu() {
23958
- const qc = (0, import_react_query52.useQueryClient)();
24085
+ const qc = (0, import_react_query53.useQueryClient)();
23959
24086
  const address = useSession((st) => st.address);
23960
24087
  const chainConfig = useSession((st) => st.chainConfig);
23961
24088
  const { t } = useT();
23962
24089
  const setPage = useLayoutDataStore((st) => st.setPage);
23963
24090
  const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
23964
- const [expandedGroups, setExpandedGroups] = (0, import_react82.useState)({});
24091
+ const [expandedGroups, setExpandedGroups] = (0, import_react84.useState)({});
23965
24092
  const historySupported = isTransactionHistorySupported(chainConfig?.id);
23966
24093
  const {
23967
24094
  data: txHistoryGroups = [],
23968
24095
  isLoading: isTxHistoryLoading,
23969
24096
  isFetching: isTxHistoryFetching,
23970
24097
  error: txHistoryError
23971
- } = (0, import_react_query52.useQuery)({
24098
+ } = (0, import_react_query53.useQuery)({
23972
24099
  retry: false,
23973
24100
  enabled: !!address && !!chainConfig?.id && historySupported,
23974
24101
  queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
23975
24102
  queryFn: () => getTransactionsListQuery({ address, chainConfig })
23976
24103
  });
23977
- const refreshTxHistory = (0, import_react82.useCallback)(
24104
+ const refreshTxHistory = (0, import_react84.useCallback)(
23978
24105
  () => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
23979
24106
  [qc, chainConfig.id, address]
23980
24107
  );
@@ -24023,14 +24150,14 @@ function TransactionsMenu() {
24023
24150
  }
24024
24151
  );
24025
24152
  }
24026
- var import_react_query52, import_lucide_react75, import_react82, import_jsx_runtime114;
24153
+ var import_react_query53, import_lucide_react75, import_react84, import_jsx_runtime114;
24027
24154
  var init_TransactionsMenu = __esm({
24028
24155
  "src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
24029
24156
  init_SessionContext();
24030
24157
  init_i18n();
24031
- import_react_query52 = require("@tanstack/react-query");
24158
+ import_react_query53 = require("@tanstack/react-query");
24032
24159
  import_lucide_react75 = require("lucide-react");
24033
- import_react82 = require("react");
24160
+ import_react84 = require("react");
24034
24161
  init_useLayoutDataStore();
24035
24162
  init_useLayoutStore();
24036
24163
  init_Expandable2();
@@ -24228,7 +24355,7 @@ function usePageMapper() {
24228
24355
  setIsDialogOpen,
24229
24356
  setIsDialogClosing
24230
24357
  } = useLayoutStore();
24231
- const closeDialog = (0, import_react83.useCallback)(() => {
24358
+ const closeDialog = (0, import_react85.useCallback)(() => {
24232
24359
  setIsDialogClosing(true);
24233
24360
  setTimeout(() => {
24234
24361
  setDialogContent(null);
@@ -24239,7 +24366,7 @@ function usePageMapper() {
24239
24366
  setIsDialogOpen(false);
24240
24367
  }, CLEAR_DIALOG_TIMEOUT);
24241
24368
  }, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
24242
- const openDialog = (0, import_react83.useCallback)(
24369
+ const openDialog = (0, import_react85.useCallback)(
24243
24370
  (pageItem) => {
24244
24371
  const PageContentComponent = pageItem.component;
24245
24372
  setDialogTitle(pageItem.title);
@@ -24249,7 +24376,7 @@ function usePageMapper() {
24249
24376
  },
24250
24377
  [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
24251
24378
  );
24252
- (0, import_react83.useEffect)(() => {
24379
+ (0, import_react85.useEffect)(() => {
24253
24380
  if (page === null) return closeDialog();
24254
24381
  const pageItem = PAGE_MAP[page];
24255
24382
  if (!pageItem) {
@@ -24260,10 +24387,10 @@ function usePageMapper() {
24260
24387
  openDialog(pageItem);
24261
24388
  }, [page, closeDialog, openDialog]);
24262
24389
  }
24263
- var import_react83, import_jsx_runtime115, CLEAR_DIALOG_TIMEOUT;
24390
+ var import_react85, import_jsx_runtime115, CLEAR_DIALOG_TIMEOUT;
24264
24391
  var init_usePageMapper = __esm({
24265
24392
  "src/internal/hooks/usePageMapper.tsx"() {
24266
- import_react83 = require("react");
24393
+ import_react85 = require("react");
24267
24394
  init_PageMap();
24268
24395
  init_constants();
24269
24396
  init_useLayoutDataStore();
@@ -24279,32 +24406,32 @@ function useSettingsNotifications() {
24279
24406
  const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
24280
24407
  const providers = import_auth23.jwtTokenManager.getProviders();
24281
24408
  const hasEmail = providers.includes("email");
24282
- const { data: userProfile = null } = (0, import_react_query53.useQuery)({
24409
+ const { data: userProfile = null } = (0, import_react_query54.useQuery)({
24283
24410
  retry: false,
24284
24411
  enabled: !!address,
24285
24412
  queryKey: [QUERY_KEYS.userProfile, address],
24286
24413
  queryFn: getUserProfile
24287
24414
  });
24288
- (0, import_react84.useEffect)(() => {
24415
+ (0, import_react86.useEffect)(() => {
24289
24416
  const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
24290
24417
  setSettingsNotifications({
24291
24418
  ...COMPLETE_KYC_PROGRESS,
24292
24419
  status: isKYCVerified ? "resolved" : "active"
24293
24420
  });
24294
24421
  }, [userProfile, setSettingsNotifications]);
24295
- (0, import_react84.useEffect)(() => {
24422
+ (0, import_react86.useEffect)(() => {
24296
24423
  setSettingsNotifications({
24297
24424
  ...EMAIL_NOT_CONNECTED_NOTIFICATION,
24298
24425
  status: hasEmail ? "resolved" : "active"
24299
24426
  });
24300
24427
  }, [hasEmail, setSettingsNotifications]);
24301
24428
  }
24302
- var import_react_query53, import_react84, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
24429
+ var import_react_query54, import_react86, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
24303
24430
  var init_useSettingsNotifications = __esm({
24304
24431
  "src/internal/hooks/useSettingsNotifications.ts"() {
24305
24432
  init_SessionContext();
24306
- import_react_query53 = require("@tanstack/react-query");
24307
- import_react84 = require("react");
24433
+ import_react_query54 = require("@tanstack/react-query");
24434
+ import_react86 = require("react");
24308
24435
  init_auth();
24309
24436
  init_profile();
24310
24437
  init_useLayoutDataStore();
@@ -24327,7 +24454,7 @@ var init_package = __esm({
24327
24454
  "package.json"() {
24328
24455
  package_default = {
24329
24456
  name: "@embarkai/ui-kit",
24330
- version: "0.4.57",
24457
+ version: "0.4.58",
24331
24458
  description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
24332
24459
  type: "module",
24333
24460
  main: "./dist/index.cjs",
@@ -24429,7 +24556,7 @@ var init_package = __esm({
24429
24556
 
24430
24557
  // src/internal/components/Footer/Footer.tsx
24431
24558
  function Footer() {
24432
- const qc = (0, import_react_query54.useQueryClient)();
24559
+ const qc = (0, import_react_query55.useQueryClient)();
24433
24560
  const { callbacksRef } = useProviderConfig();
24434
24561
  const { t } = useT();
24435
24562
  const address = useSession((st) => st.address);
@@ -24446,7 +24573,7 @@ function Footer() {
24446
24573
  }
24447
24574
  }
24448
24575
  });
24449
- const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query54.useMutation)({
24576
+ const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query55.useMutation)({
24450
24577
  mutationFn: async (disconnectAddress) => {
24451
24578
  if (!disconnectAddress) throw new Error("No address to disconnect");
24452
24579
  const { setError, setStatus, setIsLoading } = useSession.getState();
@@ -24532,7 +24659,7 @@ function Footer() {
24532
24659
  }
24533
24660
  );
24534
24661
  }
24535
- var import_react_query54, import_lucide_react76, import_wagmi7, import_jsx_runtime116;
24662
+ var import_react_query55, import_lucide_react76, import_wagmi7, import_jsx_runtime116;
24536
24663
  var init_Footer = __esm({
24537
24664
  "src/internal/components/Footer/Footer.tsx"() {
24538
24665
  init_package();
@@ -24540,7 +24667,7 @@ var init_Footer = __esm({
24540
24667
  init_ProviderContext();
24541
24668
  init_SessionContext();
24542
24669
  init_i18n();
24543
- import_react_query54 = require("@tanstack/react-query");
24670
+ import_react_query55 = require("@tanstack/react-query");
24544
24671
  import_lucide_react76 = require("lucide-react");
24545
24672
  import_wagmi7 = require("wagmi");
24546
24673
  init_auth();
@@ -24573,11 +24700,11 @@ function Header() {
24573
24700
  const chainConfig = useSession((st) => st.chainConfig);
24574
24701
  const { t } = useT();
24575
24702
  const proMode = useProMode();
24576
- const [proToast, setProToast] = (0, import_react85.useState)(false);
24577
- const [copied, setCopied] = (0, import_react85.useState)(false);
24578
- const clickCountRef = (0, import_react85.useRef)(0);
24579
- const clickTimerRef = (0, import_react85.useRef)(null);
24580
- const handleAvatarClick = (0, import_react85.useCallback)(() => {
24703
+ const [proToast, setProToast] = (0, import_react87.useState)(false);
24704
+ const [copied, setCopied] = (0, import_react87.useState)(false);
24705
+ const clickCountRef = (0, import_react87.useRef)(0);
24706
+ const clickTimerRef = (0, import_react87.useRef)(null);
24707
+ const handleAvatarClick = (0, import_react87.useCallback)(() => {
24581
24708
  clickCountRef.current += 1;
24582
24709
  if (clickTimerRef.current) {
24583
24710
  clearTimeout(clickTimerRef.current);
@@ -24595,7 +24722,7 @@ function Header() {
24595
24722
  }, 1e3);
24596
24723
  }
24597
24724
  }, []);
24598
- const { data: profile, isLoading: isProfileLoading } = (0, import_react_query55.useQuery)({
24725
+ const { data: profile, isLoading: isProfileLoading } = (0, import_react_query56.useQuery)({
24599
24726
  retry: false,
24600
24727
  enabled: !!address,
24601
24728
  queryKey: [QUERY_KEYS.userProfile, address],
@@ -24677,7 +24804,7 @@ function Header() {
24677
24804
  }
24678
24805
  );
24679
24806
  }
24680
- var import_react_query55, import_lucide_react77, import_react85, import_jsx_runtime117;
24807
+ var import_react_query56, import_lucide_react77, import_react87, import_jsx_runtime117;
24681
24808
  var init_Header = __esm({
24682
24809
  "src/internal/components/Header/Header.tsx"() {
24683
24810
  init_lumia2();
@@ -24685,9 +24812,9 @@ var init_Header = __esm({
24685
24812
  init_ProviderContext();
24686
24813
  init_SessionContext();
24687
24814
  init_useT();
24688
- import_react_query55 = require("@tanstack/react-query");
24815
+ import_react_query56 = require("@tanstack/react-query");
24689
24816
  import_lucide_react77 = require("lucide-react");
24690
- import_react85 = require("react");
24817
+ import_react87 = require("react");
24691
24818
  init_icons();
24692
24819
  init_auth();
24693
24820
  init_profile();
@@ -24715,26 +24842,26 @@ function useDecideContentStyles() {
24715
24842
  return {
24716
24843
  isClosing,
24717
24844
  isMobileView,
24718
- style: (0, import_lodash_es11.merge)({}, mobileStyles)
24845
+ style: (0, import_lodash_es13.merge)({}, mobileStyles)
24719
24846
  };
24720
24847
  }
24721
- var DialogPrimitive, import_lodash_es11, import_lucide_react78, import_react86, import_jsx_runtime118, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
24848
+ var DialogPrimitive, import_lodash_es13, import_lucide_react78, import_react88, import_jsx_runtime118, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
24722
24849
  var init_dialog = __esm({
24723
24850
  "src/internal/components/ui/dialog.tsx"() {
24724
24851
  init_utils2();
24725
24852
  init_SessionContext();
24726
24853
  init_i18n();
24727
24854
  DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
24728
- import_lodash_es11 = require("lodash-es");
24855
+ import_lodash_es13 = require("lodash-es");
24729
24856
  import_lucide_react78 = require("lucide-react");
24730
- import_react86 = require("react");
24857
+ import_react88 = require("react");
24731
24858
  init_useLayoutDataStore();
24732
24859
  init_useLayoutStore();
24733
24860
  init_button();
24734
24861
  import_jsx_runtime118 = require("react/jsx-runtime");
24735
24862
  Dialog = DialogPrimitive.Root;
24736
24863
  DialogPortal = DialogPrimitive.Portal;
24737
- DialogOverlay = (0, import_react86.forwardRef)(
24864
+ DialogOverlay = (0, import_react88.forwardRef)(
24738
24865
  ({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
24739
24866
  DialogPrimitive.Overlay,
24740
24867
  {
@@ -24756,7 +24883,7 @@ var init_dialog = __esm({
24756
24883
  border: "1px solid var(--ui-kit-bd)",
24757
24884
  boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
24758
24885
  };
24759
- DialogContent = (0, import_react86.forwardRef)(
24886
+ DialogContent = (0, import_react88.forwardRef)(
24760
24887
  ({ className, children, colorMode, ...props }, ref) => {
24761
24888
  const { t, i18n } = useT();
24762
24889
  const isSessionLoading = useSession((st) => st.isLoading);
@@ -24859,7 +24986,7 @@ var init_dialog = __esm({
24859
24986
  DialogHeader.displayName = "DialogHeader";
24860
24987
  DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
24861
24988
  DialogFooter.displayName = "DialogFooter";
24862
- DialogTitle = (0, import_react86.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
24989
+ DialogTitle = (0, import_react88.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
24863
24990
  DialogPrimitive.Title,
24864
24991
  {
24865
24992
  ref,
@@ -24868,7 +24995,7 @@ var init_dialog = __esm({
24868
24995
  }
24869
24996
  ));
24870
24997
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
24871
- DialogDescription = (0, import_react86.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
24998
+ DialogDescription = (0, import_react88.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
24872
24999
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
24873
25000
  }
24874
25001
  });
@@ -24893,7 +25020,7 @@ function Dialog2() {
24893
25020
  const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
24894
25021
  const setPage = useLayoutDataStore((st) => st.setPage);
24895
25022
  const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
24896
- (0, import_react87.useEffect)(() => setIsSettings(!!session), [session, setIsSettings]);
25023
+ (0, import_react89.useEffect)(() => setIsSettings(!!session), [session, setIsSettings]);
24897
25024
  usePageMapper();
24898
25025
  useAutoConnect();
24899
25026
  useBackupStatusChanges();
@@ -24931,13 +25058,13 @@ function Dialog2() {
24931
25058
  }
24932
25059
  );
24933
25060
  }
24934
- var import_framer_motion, import_react87, import_jsx_runtime120;
25061
+ var import_framer_motion, import_react89, import_jsx_runtime120;
24935
25062
  var init_Dialog = __esm({
24936
25063
  "src/internal/components/Dialog/Dialog.tsx"() {
24937
25064
  init_ProviderContext();
24938
25065
  init_SessionContext();
24939
25066
  import_framer_motion = require("framer-motion");
24940
- import_react87 = require("react");
25067
+ import_react89 = require("react");
24941
25068
  init_constants();
24942
25069
  init_useAutoConnect();
24943
25070
  init_useBackupStatusChanges();
@@ -24963,14 +25090,14 @@ var init_Dialog2 = __esm({
24963
25090
  });
24964
25091
 
24965
25092
  // src/internal/components/TssManager.tsx
24966
- var import_react88, TssManagerWithRef;
25093
+ var import_react90, TssManagerWithRef;
24967
25094
  var init_TssManager = __esm({
24968
25095
  "src/internal/components/TssManager.tsx"() {
24969
25096
  init_SessionContext();
24970
- import_react88 = __toESM(require("react"), 1);
25097
+ import_react90 = __toESM(require("react"), 1);
24971
25098
  init_auth();
24972
25099
  init_clients();
24973
- TssManagerWithRef = import_react88.default.forwardRef((props, ref) => {
25100
+ TssManagerWithRef = import_react90.default.forwardRef((props, ref) => {
24974
25101
  const { mpcPin } = props;
24975
25102
  const usePaymaster = useSession((st) => st.usePaymaster);
24976
25103
  const publicClient = useSession((st) => st.publicClient);
@@ -24978,14 +25105,14 @@ var init_TssManager = __esm({
24978
25105
  const setStatus = useSession((st) => st.setStatus);
24979
25106
  const setSession = useSession((st) => st.setSession);
24980
25107
  const setAddress = useSession((st) => st.setAddress);
24981
- const onSessionCreated = (0, import_react88.useCallback)(
25108
+ const onSessionCreated = (0, import_react90.useCallback)(
24982
25109
  (session, address) => {
24983
25110
  setSession(session);
24984
25111
  setAddress(address);
24985
25112
  },
24986
25113
  [setSession, setAddress]
24987
25114
  );
24988
- const createSessionWithKeyshare = import_react88.default.useCallback(
25115
+ const createSessionWithKeyshare = import_react90.default.useCallback(
24989
25116
  async (userId, hasServerKeyshare, isNewUser) => {
24990
25117
  setStatus("checking key management setup...");
24991
25118
  await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
@@ -25010,7 +25137,7 @@ var init_TssManager = __esm({
25010
25137
  },
25011
25138
  [setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
25012
25139
  );
25013
- import_react88.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
25140
+ import_react90.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
25014
25141
  return null;
25015
25142
  });
25016
25143
  }
@@ -25018,7 +25145,7 @@ var init_TssManager = __esm({
25018
25145
 
25019
25146
  // src/internal/components/WalletConnectHandler.tsx
25020
25147
  function WalletConnectHandler() {
25021
- const qc = (0, import_react_query56.useQueryClient)();
25148
+ const qc = (0, import_react_query57.useQueryClient)();
25022
25149
  const { callbacksRef } = useProviderConfig();
25023
25150
  const passportWalletAddress = useSession((st) => st.address);
25024
25151
  const { address: walletAddress, isConnected, chain, connector } = (0, import_wagmi8.useAccount)();
@@ -25038,7 +25165,7 @@ function WalletConnectHandler() {
25038
25165
  const projectId = providerConfig?.projectId;
25039
25166
  const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
25040
25167
  const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
25041
- const onLinkingComplete = (0, import_react89.useCallback)(
25168
+ const onLinkingComplete = (0, import_react91.useCallback)(
25042
25169
  async (success) => {
25043
25170
  setIsWalletLinking(false);
25044
25171
  if (!success && !passportWalletAddress) {
@@ -25067,10 +25194,10 @@ function WalletConnectHandler() {
25067
25194
  },
25068
25195
  [qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
25069
25196
  );
25070
- const [hasStartedLinking, setHasStartedLinking] = import_react89.default.useState(false);
25071
- const [modalWasOpened, setModalWasOpened] = import_react89.default.useState(false);
25072
- const [pendingModalOpen, setPendingModalOpen] = import_react89.default.useState(false);
25073
- (0, import_react89.useEffect)(() => {
25197
+ const [hasStartedLinking, setHasStartedLinking] = import_react91.default.useState(false);
25198
+ const [modalWasOpened, setModalWasOpened] = import_react91.default.useState(false);
25199
+ const [pendingModalOpen, setPendingModalOpen] = import_react91.default.useState(false);
25200
+ (0, import_react91.useEffect)(() => {
25074
25201
  if (isWalletLinking && !hasStartedLinking) {
25075
25202
  console.log("[WalletConnectHandler] Starting wallet link flow:", {
25076
25203
  isConnected,
@@ -25108,18 +25235,18 @@ function WalletConnectHandler() {
25108
25235
  setProviderType,
25109
25236
  walletMode
25110
25237
  ]);
25111
- (0, import_react89.useEffect)(() => {
25238
+ (0, import_react91.useEffect)(() => {
25112
25239
  if (pendingModalOpen && !isConnected && openConnectModal) {
25113
25240
  setPendingModalOpen(false);
25114
25241
  openConnectModal();
25115
25242
  }
25116
25243
  }, [pendingModalOpen, isConnected, openConnectModal]);
25117
- (0, import_react89.useEffect)(() => {
25244
+ (0, import_react91.useEffect)(() => {
25118
25245
  if (connectModalOpen && hasStartedLinking) {
25119
25246
  setModalWasOpened(true);
25120
25247
  }
25121
25248
  }, [connectModalOpen, hasStartedLinking]);
25122
- (0, import_react89.useEffect)(() => {
25249
+ (0, import_react91.useEffect)(() => {
25123
25250
  if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
25124
25251
  console.log("[WalletConnectHandler] Modal closed without connecting");
25125
25252
  onLinkingComplete(false);
@@ -25127,7 +25254,7 @@ function WalletConnectHandler() {
25127
25254
  setModalWasOpened(false);
25128
25255
  }
25129
25256
  }, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
25130
- (0, import_react89.useEffect)(() => {
25257
+ (0, import_react91.useEffect)(() => {
25131
25258
  if (isWalletLinking) {
25132
25259
  const timeout = setTimeout(() => {
25133
25260
  console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
@@ -25146,7 +25273,7 @@ function WalletConnectHandler() {
25146
25273
  }
25147
25274
  }, [isWalletLinking, setIsWalletLinking, disconnect]);
25148
25275
  const isAuthFlow = !passportWalletAddress;
25149
- const { mutate: handleWalletSign, isPending: isWalletSigning } = (0, import_react_query56.useMutation)({
25276
+ const { mutate: handleWalletSign, isPending: isWalletSigning } = (0, import_react_query57.useMutation)({
25150
25277
  mutationFn: async (payload) => {
25151
25278
  const { chainId, signingWalletAddress } = payload;
25152
25279
  if (!signingWalletAddress || !chainId) {
@@ -25247,7 +25374,7 @@ function WalletConnectHandler() {
25247
25374
  setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
25248
25375
  }
25249
25376
  });
25250
- (0, import_react89.useEffect)(() => {
25377
+ (0, import_react91.useEffect)(() => {
25251
25378
  if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
25252
25379
  console.log("[WalletConnectHandler] handleWalletSign triggered");
25253
25380
  if (!passportWalletAddress) {
@@ -25257,7 +25384,7 @@ function WalletConnectHandler() {
25257
25384
  handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
25258
25385
  }
25259
25386
  }, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
25260
- (0, import_react89.useEffect)(() => {
25387
+ (0, import_react91.useEffect)(() => {
25261
25388
  if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
25262
25389
  const timeout = setTimeout(() => {
25263
25390
  console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
@@ -25279,15 +25406,15 @@ function WalletConnectHandler() {
25279
25406
  ]);
25280
25407
  return null;
25281
25408
  }
25282
- var import_rainbowkit2, import_react_query56, import_react89, import_wagmi8;
25409
+ var import_rainbowkit2, import_react_query57, import_react91, import_wagmi8;
25283
25410
  var init_WalletConnectHandler = __esm({
25284
25411
  "src/internal/components/WalletConnectHandler.tsx"() {
25285
25412
  init_ProviderContext();
25286
25413
  init_SessionContext();
25287
25414
  init_linkedProfiles();
25288
25415
  import_rainbowkit2 = require("@rainbow-me/rainbowkit");
25289
- import_react_query56 = require("@tanstack/react-query");
25290
- import_react89 = __toESM(require("react"), 1);
25416
+ import_react_query57 = require("@tanstack/react-query");
25417
+ import_react91 = __toESM(require("react"), 1);
25291
25418
  import_wagmi8 = require("wagmi");
25292
25419
  init_wallet();
25293
25420
  init_AuthMenu2();
@@ -25308,13 +25435,13 @@ function DirectWalletHandler() {
25308
25435
  const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
25309
25436
  const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
25310
25437
  const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
25311
- (0, import_react90.useEffect)(() => {
25438
+ (0, import_react92.useEffect)(() => {
25312
25439
  setConfigMode(walletMode);
25313
25440
  if (walletMode !== "both") {
25314
25441
  setActiveMode(walletMode);
25315
25442
  }
25316
25443
  }, [walletMode, setConfigMode, setActiveMode]);
25317
- (0, import_react90.useEffect)(() => {
25444
+ (0, import_react92.useEffect)(() => {
25318
25445
  if (isConnected && address && !isExternalConnected && connector && chain?.id) {
25319
25446
  setExternalWallet({
25320
25447
  address,
@@ -25323,17 +25450,17 @@ function DirectWalletHandler() {
25323
25450
  });
25324
25451
  }
25325
25452
  }, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
25326
- (0, import_react90.useEffect)(() => {
25453
+ (0, import_react92.useEffect)(() => {
25327
25454
  if (isExternalConnected && !isConnected) {
25328
25455
  clearExternalWallet();
25329
25456
  }
25330
25457
  }, [isConnected, isExternalConnected, clearExternalWallet]);
25331
- (0, import_react90.useEffect)(() => {
25458
+ (0, import_react92.useEffect)(() => {
25332
25459
  if (isExternalConnected && isConnected && chain?.id) {
25333
25460
  setExternalChainId(chain.id);
25334
25461
  }
25335
25462
  }, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
25336
- (0, import_react90.useEffect)(() => {
25463
+ (0, import_react92.useEffect)(() => {
25337
25464
  if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
25338
25465
  setExternalWallet({
25339
25466
  address,
@@ -25344,10 +25471,10 @@ function DirectWalletHandler() {
25344
25471
  }, [address, isConnected, isExternalConnected, externalAddress, chain?.id, connector, setExternalWallet]);
25345
25472
  return null;
25346
25473
  }
25347
- var import_react90, import_wagmi9;
25474
+ var import_react92, import_wagmi9;
25348
25475
  var init_DirectWalletHandler = __esm({
25349
25476
  "src/internal/components/DirectWalletHandler.tsx"() {
25350
- import_react90 = require("react");
25477
+ import_react92 = require("react");
25351
25478
  import_wagmi9 = require("wagmi");
25352
25479
  init_ProviderContext();
25353
25480
  init_useExternalWalletStore();
@@ -25372,7 +25499,7 @@ function waitForStoreHydration() {
25372
25499
  }
25373
25500
  function SessionProvider({ children }) {
25374
25501
  const config = useProviderConfig().config;
25375
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react91.Fragment, { children: [
25502
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react93.Fragment, { children: [
25376
25503
  children,
25377
25504
  config.current?.wallet?.enabled && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(WalletConnectHandler, {}),
25378
25505
  config.current?.wallet?.enabled && (config.current?.wallet?.mode === "direct" || config.current?.wallet?.mode === "both") && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(DirectWalletHandler, {}),
@@ -25387,12 +25514,12 @@ function SessionProvider({ children }) {
25387
25514
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Dialog2, {})
25388
25515
  ] });
25389
25516
  }
25390
- var import_read21, import_react91, import_zustand14, import_middleware4, import_jsx_runtime121, useSession, requireActiveChainId;
25517
+ var import_read21, import_react93, import_zustand15, import_middleware4, import_jsx_runtime121, useSession, requireActiveChainId;
25391
25518
  var init_SessionContext = __esm({
25392
25519
  "src/context/SessionContext.tsx"() {
25393
25520
  import_read21 = require("@embarkai/core/read");
25394
- import_react91 = require("react");
25395
- import_zustand14 = require("zustand");
25521
+ import_react93 = require("react");
25522
+ import_zustand15 = require("zustand");
25396
25523
  import_middleware4 = require("zustand/middleware");
25397
25524
  init_BalanceFeedProvider2();
25398
25525
  init_ChainSync2();
@@ -25402,7 +25529,7 @@ var init_SessionContext = __esm({
25402
25529
  init_DirectWalletHandler();
25403
25530
  init_ProviderContext();
25404
25531
  import_jsx_runtime121 = require("react/jsx-runtime");
25405
- useSession = (0, import_zustand14.create)()(
25532
+ useSession = (0, import_zustand15.create)()(
25406
25533
  (0, import_middleware4.persist)(
25407
25534
  (set) => ({
25408
25535
  isLoading: false,
@@ -26370,13 +26497,13 @@ async function clearLocalKeyshare(userId) {
26370
26497
  console.log("[clearLocalKeyshare] Keyshares are now managed by secure iframe");
26371
26498
  console.log("[clearLocalKeyshare] To clear keyshares, user must revoke authorization in iframe");
26372
26499
  if (typeof window !== "undefined" && window.localStorage) {
26373
- const keys = [
26500
+ const keys2 = [
26374
26501
  `tss.${userId}.keyshare`,
26375
26502
  `tss.${userId}.ownerAddress`,
26376
26503
  `tss.${userId}.sessionId`,
26377
26504
  ...Object.keys(window.localStorage).filter((key) => key.startsWith(`tss.${userId}.dkg.`))
26378
26505
  ];
26379
- keys.forEach((key) => window.localStorage.removeItem(key));
26506
+ keys2.forEach((key) => window.localStorage.removeItem(key));
26380
26507
  console.log("[clearLocalKeyshare] Cleared old localStorage keys for migration");
26381
26508
  }
26382
26509
  }
@@ -28060,7 +28187,7 @@ var init_rainbowkit = __esm({
28060
28187
  function RainbowKitProvider({ children }) {
28061
28188
  const config = useProviderConfig().config;
28062
28189
  const colorMode = useLayoutStore((st) => st.colorMode);
28063
- const rainbowConfig = (0, import_react92.useMemo)(
28190
+ const rainbowConfig = (0, import_react94.useMemo)(
28064
28191
  () => createRainbowConfig({
28065
28192
  projectId: config.current?.wallet?.walletConnectProjectId,
28066
28193
  allowedWallets: config.current?.wallet?.allowedWallets,
@@ -28074,7 +28201,7 @@ function RainbowKitProvider({ children }) {
28074
28201
  config.current?.wallet?.walletConnectProjectId
28075
28202
  ]
28076
28203
  );
28077
- const customTheme = (0, import_react92.useMemo)(() => {
28204
+ const customTheme = (0, import_react94.useMemo)(() => {
28078
28205
  if (!config.current?.wallet?.enabled) return {};
28079
28206
  return colorMode === "dark" ? {
28080
28207
  ...(0, import_rainbowkit4.darkTheme)(),
@@ -28091,11 +28218,11 @@ function RainbowKitProvider({ children }) {
28091
28218
  if (!config.current?.wallet?.enabled) return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_jsx_runtime122.Fragment, { children });
28092
28219
  return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_wagmi11.WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_rainbowkit4.RainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
28093
28220
  }
28094
- var import_rainbowkit4, import_react92, import_wagmi11, import_styles, import_jsx_runtime122;
28221
+ var import_rainbowkit4, import_react94, import_wagmi11, import_styles, import_jsx_runtime122;
28095
28222
  var init_RainbowKitContext = __esm({
28096
28223
  "src/context/RainbowKitContext.tsx"() {
28097
28224
  import_rainbowkit4 = require("@rainbow-me/rainbowkit");
28098
- import_react92 = require("react");
28225
+ import_react94 = require("react");
28099
28226
  import_wagmi11 = require("wagmi");
28100
28227
  init_rainbowkit();
28101
28228
  init_useLayoutStore();
@@ -28151,10 +28278,10 @@ function clearLegacyWagmiStorage() {
28151
28278
  }
28152
28279
  function Provider(props) {
28153
28280
  const { children, projectId, initialConfig = {}, callbacks } = props;
28154
- const callbacksRef = (0, import_react93.useRef)(callbacks);
28155
- (0, import_react93.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
28156
- const config = (0, import_react93.useRef)((0, import_lodash_es12.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
28157
- const updateConfig = (0, import_react93.useCallback)((updates) => {
28281
+ const callbacksRef = (0, import_react95.useRef)(callbacks);
28282
+ (0, import_react95.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
28283
+ const config = (0, import_react95.useRef)((0, import_lodash_es14.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
28284
+ const updateConfig = (0, import_react95.useCallback)((updates) => {
28158
28285
  const prev = config.current;
28159
28286
  const next = { ...prev };
28160
28287
  if (updates.projectId !== void 0) next.projectId = updates.projectId;
@@ -28188,14 +28315,14 @@ function Provider(props) {
28188
28315
  if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
28189
28316
  config.current = next;
28190
28317
  }, []);
28191
- const updateCallbacks = (0, import_react93.useCallback)((updates) => {
28318
+ const updateCallbacks = (0, import_react95.useCallback)((updates) => {
28192
28319
  const prev = callbacksRef.current;
28193
28320
  const next = updates ? { ...prev, ...updates } : void 0;
28194
28321
  callbacksRef.current = next;
28195
28322
  }, []);
28196
- (0, import_react93.useEffect)(() => {
28323
+ (0, import_react95.useEffect)(() => {
28197
28324
  if (typeof window === "undefined" || !projectId) return;
28198
- const mergedConfig = (0, import_lodash_es12.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
28325
+ const mergedConfig = (0, import_lodash_es14.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
28199
28326
  updateConfig(mergedConfig);
28200
28327
  if (mergedConfig.wallet?.enabled) {
28201
28328
  clearLegacyWagmiStorage();
@@ -28213,7 +28340,7 @@ function Provider(props) {
28213
28340
  useSession.getState().setActiveChainId(mergedConfig.network.chainId);
28214
28341
  }
28215
28342
  }, [projectId, initialConfig]);
28216
- (0, import_react93.useEffect)(() => {
28343
+ (0, import_react95.useEffect)(() => {
28217
28344
  if (typeof window === "undefined" || !projectId) return;
28218
28345
  try {
28219
28346
  (0, import_error_tracking4.initSdkErrorTracking)();
@@ -28242,7 +28369,7 @@ function Provider(props) {
28242
28369
  console.error("[PROVIDER] Error setting up iframe manager:", error);
28243
28370
  }
28244
28371
  }, [projectId]);
28245
- const contextValue = (0, import_react93.useMemo)(
28372
+ const contextValue = (0, import_react95.useMemo)(
28246
28373
  () => ({
28247
28374
  config,
28248
28375
  updateConfig,
@@ -28263,12 +28390,12 @@ function Provider(props) {
28263
28390
  /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(WagmiProvider2, { children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(SessionProvider, { children }) }) })
28264
28391
  );
28265
28392
  }
28266
- var import_error_tracking4, import_lodash_es12, import_react93, import_jsx_runtime124, UIContext, useProviderConfig;
28393
+ var import_error_tracking4, import_lodash_es14, import_react95, import_jsx_runtime124, UIContext, useProviderConfig;
28267
28394
  var init_ProviderContext = __esm({
28268
28395
  "src/context/ProviderContext.tsx"() {
28269
28396
  import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
28270
- import_lodash_es12 = require("lodash-es");
28271
- import_react93 = require("react");
28397
+ import_lodash_es14 = require("lodash-es");
28398
+ import_react95 = require("react");
28272
28399
  init_initial();
28273
28400
  init_iframe_manager();
28274
28401
  init_RainbowKitContext();
@@ -28276,9 +28403,9 @@ var init_ProviderContext = __esm({
28276
28403
  init_utils11();
28277
28404
  init_WagmiContext();
28278
28405
  import_jsx_runtime124 = require("react/jsx-runtime");
28279
- UIContext = (0, import_react93.createContext)(void 0);
28406
+ UIContext = (0, import_react95.createContext)(void 0);
28280
28407
  useProviderConfig = () => {
28281
- const ctx = (0, import_react93.useContext)(UIContext);
28408
+ const ctx = (0, import_react95.useContext)(UIContext);
28282
28409
  if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
28283
28410
  return ctx;
28284
28411
  };
@@ -28388,9 +28515,9 @@ init_ProviderContext();
28388
28515
  // src/components/ConnectWalletButton.tsx
28389
28516
  init_lumia2();
28390
28517
  init_embarkAI2();
28391
- var import_react_query57 = require("@tanstack/react-query");
28518
+ var import_react_query58 = require("@tanstack/react-query");
28392
28519
  var import_lucide_react79 = require("lucide-react");
28393
- var import_react94 = require("react");
28520
+ var import_react96 = require("react");
28394
28521
  init_SessionContext();
28395
28522
  init_auth();
28396
28523
  init_profile();
@@ -28423,15 +28550,15 @@ function ConnectWalletButton(props) {
28423
28550
  const colorMode = useLayoutStore((st) => st.colorMode);
28424
28551
  const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
28425
28552
  const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
28426
- (0, import_react94.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
28427
- const { data: profile, isLoading: isProfileLoading } = (0, import_react_query57.useQuery)({
28553
+ (0, import_react96.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
28554
+ const { data: profile, isLoading: isProfileLoading } = (0, import_react_query58.useQuery)({
28428
28555
  retry: false,
28429
28556
  enabled: !!address,
28430
28557
  queryKey: [QUERY_KEYS.userProfile, address],
28431
28558
  queryFn: getUserProfile
28432
28559
  });
28433
28560
  const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth23.jwtTokenManager.getDisplayName();
28434
- const indicators = (0, import_react94.useMemo)(() => {
28561
+ const indicators = (0, import_react96.useMemo)(() => {
28435
28562
  const userId = session?.mpcUserId;
28436
28563
  if (!userId) return { server: false, local: false, backup: false };
28437
28564
  const server = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
@@ -29070,14 +29197,14 @@ var Hash = ({
29070
29197
  };
29071
29198
 
29072
29199
  // src/internal/components/TransactionsMenu/TransactionsList.tsx
29073
- var import_react95 = require("react");
29200
+ var import_react97 = require("react");
29074
29201
  init_base2();
29075
29202
  var import_jsx_runtime131 = require("react/jsx-runtime");
29076
29203
  var TransactionsList = ({ address, itemsCount = 10 }) => {
29077
- const [transactions, setTransactions] = (0, import_react95.useState)([]);
29078
- const [loading, setLoading] = (0, import_react95.useState)(true);
29079
- const [error, setError] = (0, import_react95.useState)(null);
29080
- (0, import_react95.useEffect)(() => {
29204
+ const [transactions, setTransactions] = (0, import_react97.useState)([]);
29205
+ const [loading, setLoading] = (0, import_react97.useState)(true);
29206
+ const [error, setError] = (0, import_react97.useState)(null);
29207
+ (0, import_react97.useEffect)(() => {
29081
29208
  const fetchTransactions2 = async () => {
29082
29209
  try {
29083
29210
  setLoading(true);
@@ -29368,13 +29495,13 @@ function useUserOpStatus(options = {}) {
29368
29495
  init_useErc3643Compliance();
29369
29496
 
29370
29497
  // src/hooks/useWalletMode.ts
29371
- var import_react96 = require("react");
29498
+ var import_react98 = require("react");
29372
29499
  init_useExternalWalletStore();
29373
29500
  function useWalletMode() {
29374
29501
  const configMode = useExternalWalletStore((st) => st.configMode);
29375
29502
  const activeMode = useExternalWalletStore((st) => st.activeMode);
29376
29503
  const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
29377
- const switchMode = (0, import_react96.useCallback)(
29504
+ const switchMode = (0, import_react98.useCallback)(
29378
29505
  (mode) => {
29379
29506
  if (configMode !== "both") return;
29380
29507
  setActiveMode(mode);
@@ -29390,7 +29517,7 @@ function useWalletMode() {
29390
29517
  }
29391
29518
 
29392
29519
  // src/hooks/useDirectWallet.ts
29393
- var import_react97 = require("react");
29520
+ var import_react99 = require("react");
29394
29521
  var import_rainbowkit6 = require("@rainbow-me/rainbowkit");
29395
29522
  var import_wagmi13 = require("wagmi");
29396
29523
  init_useExternalWalletStore();
@@ -29404,13 +29531,13 @@ function useDirectWallet() {
29404
29531
  const { disconnect: wagmiDisconnect } = (0, import_wagmi13.useDisconnect)();
29405
29532
  const { openConnectModal } = (0, import_rainbowkit6.useConnectModal)();
29406
29533
  const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
29407
- const connect = (0, import_react97.useCallback)(() => {
29534
+ const connect = (0, import_react99.useCallback)(() => {
29408
29535
  setIsWalletLinking(true);
29409
29536
  }, [setIsWalletLinking]);
29410
- const reconnect = (0, import_react97.useCallback)(() => {
29537
+ const reconnect = (0, import_react99.useCallback)(() => {
29411
29538
  if (openConnectModal) openConnectModal();
29412
29539
  }, [openConnectModal]);
29413
- const disconnect = (0, import_react97.useCallback)(() => {
29540
+ const disconnect = (0, import_react99.useCallback)(() => {
29414
29541
  wagmiDisconnect();
29415
29542
  clearExternalWallet();
29416
29543
  }, [wagmiDisconnect, clearExternalWallet]);
@@ -29426,7 +29553,7 @@ function useDirectWallet() {
29426
29553
  }
29427
29554
 
29428
29555
  // src/hooks/useSendDirectTransaction.ts
29429
- var import_react98 = require("react");
29556
+ var import_react100 = require("react");
29430
29557
  var import_viem21 = require("viem");
29431
29558
  var import_wagmi14 = require("wagmi");
29432
29559
  init_useExternalWalletStore();
@@ -29435,10 +29562,10 @@ function useSendDirectTransaction() {
29435
29562
  const externalChainId = useExternalWalletStore((st) => st.externalChainId);
29436
29563
  const { sendTransactionAsync } = (0, import_wagmi14.useSendTransaction)();
29437
29564
  const { switchChainAsync } = (0, import_wagmi14.useSwitchChain)();
29438
- const [isPending, setIsPending] = (0, import_react98.useState)(false);
29439
- const [error, setError] = (0, import_react98.useState)(null);
29440
- const [txHash, setTxHash] = (0, import_react98.useState)(null);
29441
- const sendTransaction = (0, import_react98.useCallback)(
29565
+ const [isPending, setIsPending] = (0, import_react100.useState)(false);
29566
+ const [error, setError] = (0, import_react100.useState)(null);
29567
+ const [txHash, setTxHash] = (0, import_react100.useState)(null);
29568
+ const sendTransaction = (0, import_react100.useCallback)(
29442
29569
  async (params) => {
29443
29570
  if (!isConnected) {
29444
29571
  setError("No external wallet connected");
@@ -29472,7 +29599,7 @@ function useSendDirectTransaction() {
29472
29599
  },
29473
29600
  [isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
29474
29601
  );
29475
- const reset = (0, import_react98.useCallback)(() => {
29602
+ const reset = (0, import_react100.useCallback)(() => {
29476
29603
  setError(null);
29477
29604
  setTxHash(null);
29478
29605
  setIsPending(false);
@@ -29481,7 +29608,7 @@ function useSendDirectTransaction() {
29481
29608
  }
29482
29609
 
29483
29610
  // src/hooks/useTransferToLinkedWallet.ts
29484
- var import_react99 = require("react");
29611
+ var import_react101 = require("react");
29485
29612
  var import_viem22 = require("viem");
29486
29613
  init_SessionContext();
29487
29614
  init_account2();
@@ -29500,14 +29627,14 @@ var ERC20_TRANSFER_ABI2 = [
29500
29627
  function useTransferToLinkedWallet() {
29501
29628
  const session = useSession((st) => st.session);
29502
29629
  const { profiles } = useLinkedProfiles();
29503
- const [isPending, setIsPending] = (0, import_react99.useState)(false);
29504
- const [error, setError] = (0, import_react99.useState)(null);
29505
- const [userOpHash, setUserOpHash] = (0, import_react99.useState)(null);
29506
- const linkedWallets = (0, import_react99.useMemo)(
29630
+ const [isPending, setIsPending] = (0, import_react101.useState)(false);
29631
+ const [error, setError] = (0, import_react101.useState)(null);
29632
+ const [userOpHash, setUserOpHash] = (0, import_react101.useState)(null);
29633
+ const linkedWallets = (0, import_react101.useMemo)(
29507
29634
  () => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
29508
29635
  [profiles]
29509
29636
  );
29510
- const transfer = (0, import_react99.useCallback)(
29637
+ const transfer = (0, import_react101.useCallback)(
29511
29638
  async (params) => {
29512
29639
  if (!session) {
29513
29640
  setError("No active session");
@@ -29558,7 +29685,7 @@ function useTransferToLinkedWallet() {
29558
29685
  },
29559
29686
  [session, linkedWallets]
29560
29687
  );
29561
- const reset = (0, import_react99.useCallback)(() => {
29688
+ const reset = (0, import_react101.useCallback)(() => {
29562
29689
  setError(null);
29563
29690
  setUserOpHash(null);
29564
29691
  setIsPending(false);
@@ -29582,7 +29709,7 @@ function useNativeWalletSignature() {
29582
29709
 
29583
29710
  // src/hooks/useLogout.ts
29584
29711
  var import_auth25 = require("@embarkai/core/auth");
29585
- var import_react100 = require("react");
29712
+ var import_react102 = require("react");
29586
29713
  var import_wagmi16 = require("wagmi");
29587
29714
  init_ProviderContext();
29588
29715
  init_SessionContext();
@@ -29602,7 +29729,7 @@ function useLogout() {
29602
29729
  }
29603
29730
  }
29604
29731
  });
29605
- const logout2 = (0, import_react100.useCallback)(async () => {
29732
+ const logout2 = (0, import_react102.useCallback)(async () => {
29606
29733
  const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
29607
29734
  const prevAddress = address;
29608
29735
  let userId = null;
@@ -29645,7 +29772,7 @@ init_bundler();
29645
29772
  // src/index.ts
29646
29773
  init_auth();
29647
29774
  init_profile();
29648
- init_hooks2();
29775
+ init_SecurityMenu2();
29649
29776
  init_linkedProfiles();
29650
29777
  init_nickname_fingerprint();
29651
29778
  init_errors();
@@ -29720,7 +29847,7 @@ function useTransactions() {
29720
29847
 
29721
29848
  // src/modules/assets.ts
29722
29849
  init_SessionContext();
29723
- var import_react101 = __toESM(require("react"), 1);
29850
+ var import_react103 = __toESM(require("react"), 1);
29724
29851
  var import_viem24 = require("viem");
29725
29852
  var import_wagmi18 = require("wagmi");
29726
29853
  var COMMON_TOKENS = [
@@ -29876,7 +30003,7 @@ function useTokenBalance2(tokenAddress, userAddress) {
29876
30003
  }
29877
30004
  });
29878
30005
  const { tokenInfo } = useTokenInfo(tokenAddress);
29879
- const formattedBalance = import_react101.default.useMemo(() => {
30006
+ const formattedBalance = import_react103.default.useMemo(() => {
29880
30007
  if (!balance || !tokenInfo) return "0";
29881
30008
  return (0, import_viem24.formatUnits)(balance, tokenInfo.decimals);
29882
30009
  }, [balance, tokenInfo]);