@embarkai/ui-kit 0.4.100 → 0.4.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +367 -339
- package/dist/index.js +54 -26
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -10144,7 +10144,7 @@ var init_input = __esm({
|
|
|
10144
10144
|
const { className, disabled, error, Icon: Icon2, element, inputClassName, ...inputProps } = props;
|
|
10145
10145
|
const internalRef = (0, import_react17.useRef)(null);
|
|
10146
10146
|
(0, import_react17.useImperativeHandle)(ref, () => internalRef.current);
|
|
10147
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: cn2("w-full flex flex-col gap-1", className), children: [
|
|
10147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: cn2("w-full min-w-0 flex flex-col gap-1", className), children: [
|
|
10148
10148
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
10149
10149
|
"div",
|
|
10150
10150
|
{
|
|
@@ -10152,7 +10152,7 @@ var init_input = __esm({
|
|
|
10152
10152
|
internalRef.current?.focus();
|
|
10153
10153
|
},
|
|
10154
10154
|
className: cn2(
|
|
10155
|
-
"flex h-12 w-full items-center gap-[var(--ui-kit-gap)] px-[var(--ui-kit-pd)]",
|
|
10155
|
+
"flex h-12 w-full min-w-0 items-center gap-[var(--ui-kit-gap)] px-[var(--ui-kit-pd)]",
|
|
10156
10156
|
"bg-[var(--ui-kit-secondary)] rounded-[var(--ui-kit-el-bdrs)]",
|
|
10157
10157
|
"border border-transparent",
|
|
10158
10158
|
"transition-all duration-200 ease-in-out",
|
|
@@ -10173,7 +10173,7 @@ var init_input = __esm({
|
|
|
10173
10173
|
"placeholder:text-[var(--ui-kit-fg-muted)]",
|
|
10174
10174
|
"ring-0 ring-offset-0",
|
|
10175
10175
|
"outline-none focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0",
|
|
10176
|
-
"h-full flex-1 border-0 bg-transparent px-0",
|
|
10176
|
+
"h-full flex-1 min-w-0 border-0 bg-transparent px-0",
|
|
10177
10177
|
{ ["cursor-not-allowed"]: disabled },
|
|
10178
10178
|
inputClassName
|
|
10179
10179
|
),
|
|
@@ -17295,6 +17295,28 @@ var init_useConnectExternalWalletMenuParams = __esm({
|
|
|
17295
17295
|
}
|
|
17296
17296
|
});
|
|
17297
17297
|
|
|
17298
|
+
// src/internal/components/ConnectExternalWalletMenu/useHasInjectedWallet.ts
|
|
17299
|
+
function hasInjectedWallet() {
|
|
17300
|
+
if (typeof window === "undefined") return false;
|
|
17301
|
+
return mipdStore.getProviders().length > 0 || !!window.ethereum;
|
|
17302
|
+
}
|
|
17303
|
+
function useHasInjectedWallet() {
|
|
17304
|
+
return (0, import_react45.useSyncExternalStore)(
|
|
17305
|
+
(onStoreChange) => mipdStore?.subscribe(onStoreChange) ?? (() => {
|
|
17306
|
+
}),
|
|
17307
|
+
hasInjectedWallet,
|
|
17308
|
+
() => false
|
|
17309
|
+
);
|
|
17310
|
+
}
|
|
17311
|
+
var import_mipd, import_react45, mipdStore;
|
|
17312
|
+
var init_useHasInjectedWallet = __esm({
|
|
17313
|
+
"src/internal/components/ConnectExternalWalletMenu/useHasInjectedWallet.ts"() {
|
|
17314
|
+
import_mipd = require("mipd");
|
|
17315
|
+
import_react45 = require("react");
|
|
17316
|
+
mipdStore = typeof window !== "undefined" ? (0, import_mipd.createStore)() : void 0;
|
|
17317
|
+
}
|
|
17318
|
+
});
|
|
17319
|
+
|
|
17298
17320
|
// src/internal/components/ConnectExternalWalletMenu/ConnectExternalWalletMenu.tsx
|
|
17299
17321
|
function getConnectFlowType(params) {
|
|
17300
17322
|
const { isEmbarkAI, connectFlow } = params;
|
|
@@ -17308,9 +17330,10 @@ function ConnectExternalWalletMenu() {
|
|
|
17308
17330
|
const qc = (0, import_react_query25.useQueryClient)();
|
|
17309
17331
|
const { t } = useT();
|
|
17310
17332
|
const { address: embarkAiAddress } = useSession();
|
|
17311
|
-
const { open: openEmbarkAI } = useOpenPage();
|
|
17333
|
+
const { open: openEmbarkAI, close: closeEmbarkAI } = useOpenPage();
|
|
17312
17334
|
const menuParams = useConnectExternalWalletMenuParams();
|
|
17313
17335
|
const connectors = (0, import_wagmi2.useConnectors)();
|
|
17336
|
+
const hasInjectedWallet2 = useHasInjectedWallet();
|
|
17314
17337
|
const { isConnected: isExternalWalletConnected } = (0, import_wagmi2.useConnection)();
|
|
17315
17338
|
const { mutate: disconnect } = (0, import_wagmi2.useDisconnect)();
|
|
17316
17339
|
const { mutateAsync: signMessageAsync } = (0, import_wagmi2.useSignMessage)();
|
|
@@ -17370,6 +17393,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17370
17393
|
},
|
|
17371
17394
|
onError: (err, { walletData, connectFlowType }) => {
|
|
17372
17395
|
disconnect();
|
|
17396
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
17373
17397
|
const errorMsg = err?.message || "Failed to connect wallet";
|
|
17374
17398
|
const setAuthError = useAuthStore.getState().setAlert;
|
|
17375
17399
|
const setManageWalletLinkError = useManageWalletStore.getState().setAlert;
|
|
@@ -17412,7 +17436,6 @@ function ConnectExternalWalletMenu() {
|
|
|
17412
17436
|
}
|
|
17413
17437
|
switch (connectFlowType) {
|
|
17414
17438
|
case "auth":
|
|
17415
|
-
useLayoutDataStore.getState().setPage("auth" /* AUTH */);
|
|
17416
17439
|
break;
|
|
17417
17440
|
case "link":
|
|
17418
17441
|
onLinkingComplete(false);
|
|
@@ -17421,7 +17444,6 @@ function ConnectExternalWalletMenu() {
|
|
|
17421
17444
|
openEmbarkAI(walletMenuOpenedFrom || "main-menu" /* MAIN_MENU */);
|
|
17422
17445
|
break;
|
|
17423
17446
|
}
|
|
17424
|
-
useLayoutStore.getState().setIsDialogForced(false);
|
|
17425
17447
|
}
|
|
17426
17448
|
});
|
|
17427
17449
|
const {
|
|
@@ -17486,7 +17508,6 @@ function ConnectExternalWalletMenu() {
|
|
|
17486
17508
|
title: `Failed to connect: ${connector.name}`,
|
|
17487
17509
|
message: error2?.message || "Failed to connect wallet"
|
|
17488
17510
|
});
|
|
17489
|
-
setPage("auth" /* AUTH */);
|
|
17490
17511
|
break;
|
|
17491
17512
|
case "link":
|
|
17492
17513
|
useManageWalletStore.getState().setAlert({
|
|
@@ -17504,11 +17525,15 @@ function ConnectExternalWalletMenu() {
|
|
|
17504
17525
|
}
|
|
17505
17526
|
}
|
|
17506
17527
|
});
|
|
17507
|
-
const visibleConnectors = (0,
|
|
17528
|
+
const visibleConnectors = (0, import_react46.useMemo)(() => {
|
|
17508
17529
|
const seen = /* @__PURE__ */ new Set();
|
|
17509
17530
|
const unique = connectors.filter((connector) => {
|
|
17510
17531
|
const skipConnector = seen.has(connector.uid);
|
|
17511
17532
|
if (skipConnector) return false;
|
|
17533
|
+
if (connector.id === "extensionProvider" && !hasInjectedWallet2) {
|
|
17534
|
+
seen.add(connector.uid);
|
|
17535
|
+
return false;
|
|
17536
|
+
}
|
|
17512
17537
|
seen.add(connector.uid);
|
|
17513
17538
|
return true;
|
|
17514
17539
|
});
|
|
@@ -17517,8 +17542,8 @@ function ConnectExternalWalletMenu() {
|
|
|
17517
17542
|
return unique.filter(
|
|
17518
17543
|
(connector) => allowed.includes(connector.id.toLowerCase()) || allowed.includes(connector.name.toLowerCase())
|
|
17519
17544
|
);
|
|
17520
|
-
}, [connectors, allowedWallets]);
|
|
17521
|
-
const getInstructionSteps = (0,
|
|
17545
|
+
}, [connectors, allowedWallets, hasInjectedWallet2]);
|
|
17546
|
+
const getInstructionSteps = (0, import_react46.useCallback)(() => {
|
|
17522
17547
|
const connectFlowType = getConnectFlowType({
|
|
17523
17548
|
isEmbarkAI: !!embarkAiAddress,
|
|
17524
17549
|
connectFlow: menuParams.current?.connectFlowType || "auth"
|
|
@@ -17562,7 +17587,17 @@ function ConnectExternalWalletMenu() {
|
|
|
17562
17587
|
disconnect();
|
|
17563
17588
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
17564
17589
|
}
|
|
17565
|
-
|
|
17590
|
+
switch (true) {
|
|
17591
|
+
case (connector.id === "metaMaskSDK" && !hasInjectedWallet2):
|
|
17592
|
+
closeEmbarkAI();
|
|
17593
|
+
break;
|
|
17594
|
+
// case connector.id === 'walletConnect':
|
|
17595
|
+
// closeEmbarkAI() // close embarkAI since WalletConnect has dedicated UI
|
|
17596
|
+
// break
|
|
17597
|
+
default:
|
|
17598
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
17599
|
+
break;
|
|
17600
|
+
}
|
|
17566
17601
|
try {
|
|
17567
17602
|
await connect({ connector });
|
|
17568
17603
|
} catch {
|
|
@@ -17588,7 +17623,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17588
17623
|
error && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Highlight, { type: "error", children: error.message })
|
|
17589
17624
|
] });
|
|
17590
17625
|
}
|
|
17591
|
-
var import_react_query25, import_lucide_react33,
|
|
17626
|
+
var import_react_query25, import_lucide_react33, import_react46, import_wagmi2, import_jsx_runtime74;
|
|
17592
17627
|
var init_ConnectExternalWalletMenu = __esm({
|
|
17593
17628
|
"src/internal/components/ConnectExternalWalletMenu/ConnectExternalWalletMenu.tsx"() {
|
|
17594
17629
|
init_ProviderContext();
|
|
@@ -17599,7 +17634,7 @@ var init_ConnectExternalWalletMenu = __esm({
|
|
|
17599
17634
|
init_linkedProfiles();
|
|
17600
17635
|
import_react_query25 = require("@tanstack/react-query");
|
|
17601
17636
|
import_lucide_react33 = require("lucide-react");
|
|
17602
|
-
|
|
17637
|
+
import_react46 = require("react");
|
|
17603
17638
|
import_wagmi2 = require("wagmi");
|
|
17604
17639
|
init_common();
|
|
17605
17640
|
init_wallet();
|
|
@@ -17612,6 +17647,7 @@ var init_ConnectExternalWalletMenu = __esm({
|
|
|
17612
17647
|
init_button();
|
|
17613
17648
|
init_highlight();
|
|
17614
17649
|
init_useConnectExternalWalletMenuParams();
|
|
17650
|
+
init_useHasInjectedWallet();
|
|
17615
17651
|
import_jsx_runtime74 = require("react/jsx-runtime");
|
|
17616
17652
|
}
|
|
17617
17653
|
});
|
|
@@ -17644,11 +17680,11 @@ function useExternalWalletConnnect() {
|
|
|
17644
17680
|
}
|
|
17645
17681
|
}
|
|
17646
17682
|
});
|
|
17647
|
-
const disconnectExternalWallet = (0,
|
|
17683
|
+
const disconnectExternalWallet = (0, import_react47.useCallback)(() => {
|
|
17648
17684
|
disconnect();
|
|
17649
17685
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
17650
17686
|
}, [disconnect]);
|
|
17651
|
-
const connectExternalWallet = (0,
|
|
17687
|
+
const connectExternalWallet = (0, import_react47.useCallback)(
|
|
17652
17688
|
async (walletConnectorType) => {
|
|
17653
17689
|
const externalAddress = useExternalWalletStore.getState().externalAddress;
|
|
17654
17690
|
if (externalAddress) {
|
|
@@ -17671,11 +17707,11 @@ function useExternalWalletConnnect() {
|
|
|
17671
17707
|
...restUseConnect
|
|
17672
17708
|
};
|
|
17673
17709
|
}
|
|
17674
|
-
var
|
|
17710
|
+
var import_react47, import_wagmi3;
|
|
17675
17711
|
var init_useExternalWalletConnect = __esm({
|
|
17676
17712
|
"src/internal/components/ConnectExternalWalletMenu/useExternalWalletConnect.ts"() {
|
|
17677
17713
|
init_ProviderContext();
|
|
17678
|
-
|
|
17714
|
+
import_react47 = require("react");
|
|
17679
17715
|
import_wagmi3 = require("wagmi");
|
|
17680
17716
|
init_useLayoutStore();
|
|
17681
17717
|
init_useExternalWalletStore();
|
|
@@ -17767,8 +17803,8 @@ function getErrorMessage(err) {
|
|
|
17767
17803
|
function DeviceLinkScreen() {
|
|
17768
17804
|
const setPage = useLayoutDataStore((s) => s.setPage);
|
|
17769
17805
|
const { mutate: link, isPending } = useLinkDevice();
|
|
17770
|
-
const [code, setCode] = (0,
|
|
17771
|
-
const [error, setError] = (0,
|
|
17806
|
+
const [code, setCode] = (0, import_react48.useState)("");
|
|
17807
|
+
const [error, setError] = (0, import_react48.useState)(null);
|
|
17772
17808
|
const isValid = code.length === 6 && VALID_CHARS.test(code);
|
|
17773
17809
|
function handleCodeChange(value) {
|
|
17774
17810
|
const upper = value.toUpperCase().slice(0, 6);
|
|
@@ -17810,11 +17846,11 @@ function DeviceLinkScreen() {
|
|
|
17810
17846
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Button, { variant: "default", size: "large", className: "w-full", disabled: !isValid || isPending, onClick: handleLink, children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_lucide_react34.Loader2, { className: "w-4 h-4 animate-spin" }) : "Link" })
|
|
17811
17847
|
] });
|
|
17812
17848
|
}
|
|
17813
|
-
var import_lucide_react34,
|
|
17849
|
+
var import_lucide_react34, import_react48, import_jsx_runtime75, VALID_CHARS;
|
|
17814
17850
|
var init_DeviceLinkScreen = __esm({
|
|
17815
17851
|
"src/internal/components/DevicesMenu/DeviceLinkScreen.tsx"() {
|
|
17816
17852
|
import_lucide_react34 = require("lucide-react");
|
|
17817
|
-
|
|
17853
|
+
import_react48 = require("react");
|
|
17818
17854
|
init_devices();
|
|
17819
17855
|
init_useLayoutDataStore();
|
|
17820
17856
|
init_Expandable2();
|
|
@@ -18353,19 +18389,19 @@ function DeviceManageScreen() {
|
|
|
18353
18389
|
const userId = session?.mpcUserId || "";
|
|
18354
18390
|
const deviceId = pageParams?.deviceId;
|
|
18355
18391
|
const deviceName = pageParams?.deviceName;
|
|
18356
|
-
const guardianRef = (0,
|
|
18357
|
-
const [screen, setScreen] = (0,
|
|
18358
|
-
const [actionState, setActionState] = (0,
|
|
18359
|
-
const [password, setPassword] = (0,
|
|
18360
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
18361
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
18362
|
-
const [waitingConfirm, setWaitingConfirm] = (0,
|
|
18363
|
-
(0,
|
|
18392
|
+
const guardianRef = (0, import_react49.useRef)(null);
|
|
18393
|
+
const [screen, setScreen] = (0, import_react49.useState)({ step: "connecting" });
|
|
18394
|
+
const [actionState, setActionState] = (0, import_react49.useState)(null);
|
|
18395
|
+
const [password, setPassword] = (0, import_react49.useState)("");
|
|
18396
|
+
const [statusMessage, setStatusMessage] = (0, import_react49.useState)(null);
|
|
18397
|
+
const [errorMessage, setErrorMessage] = (0, import_react49.useState)(null);
|
|
18398
|
+
const [waitingConfirm, setWaitingConfirm] = (0, import_react49.useState)(false);
|
|
18399
|
+
(0, import_react49.useEffect)(() => {
|
|
18364
18400
|
if (!statusMessage) return;
|
|
18365
18401
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
18366
18402
|
return () => clearTimeout(t);
|
|
18367
18403
|
}, [statusMessage]);
|
|
18368
|
-
(0,
|
|
18404
|
+
(0, import_react49.useEffect)(() => {
|
|
18369
18405
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
18370
18406
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
18371
18407
|
return;
|
|
@@ -18397,7 +18433,7 @@ function DeviceManageScreen() {
|
|
|
18397
18433
|
guardianRef.current?.close();
|
|
18398
18434
|
};
|
|
18399
18435
|
}, [deviceId]);
|
|
18400
|
-
const refreshList = (0,
|
|
18436
|
+
const refreshList = (0, import_react49.useCallback)(async () => {
|
|
18401
18437
|
const guardian = guardianRef.current;
|
|
18402
18438
|
if (!guardian || screen.step !== "connected") return;
|
|
18403
18439
|
try {
|
|
@@ -18406,7 +18442,7 @@ function DeviceManageScreen() {
|
|
|
18406
18442
|
} catch {
|
|
18407
18443
|
}
|
|
18408
18444
|
}, [screen]);
|
|
18409
|
-
const handleBackup = (0,
|
|
18445
|
+
const handleBackup = (0, import_react49.useCallback)(async () => {
|
|
18410
18446
|
const guardian = guardianRef.current;
|
|
18411
18447
|
const iframe6 = getIframeManager();
|
|
18412
18448
|
if (!guardian || !iframe6 || !userId) return;
|
|
@@ -18430,7 +18466,7 @@ function DeviceManageScreen() {
|
|
|
18430
18466
|
setActionState(null);
|
|
18431
18467
|
}
|
|
18432
18468
|
}, [password, userId, refreshList]);
|
|
18433
|
-
const handleOverwrite = (0,
|
|
18469
|
+
const handleOverwrite = (0, import_react49.useCallback)(async () => {
|
|
18434
18470
|
const guardian = guardianRef.current;
|
|
18435
18471
|
const iframe6 = getIframeManager();
|
|
18436
18472
|
if (!guardian || !iframe6 || !userId) return;
|
|
@@ -18450,7 +18486,7 @@ function DeviceManageScreen() {
|
|
|
18450
18486
|
setActionState(null);
|
|
18451
18487
|
}
|
|
18452
18488
|
}, [password, userId, refreshList]);
|
|
18453
|
-
const handleDelete = (0,
|
|
18489
|
+
const handleDelete = (0, import_react49.useCallback)(
|
|
18454
18490
|
async (keyshareId) => {
|
|
18455
18491
|
const guardian = guardianRef.current;
|
|
18456
18492
|
if (!guardian) return;
|
|
@@ -18637,12 +18673,12 @@ function DeviceManageScreen() {
|
|
|
18637
18673
|
] })
|
|
18638
18674
|
] });
|
|
18639
18675
|
}
|
|
18640
|
-
var import_lucide_react35,
|
|
18676
|
+
var import_lucide_react35, import_react49, import_jsx_runtime76;
|
|
18641
18677
|
var init_DeviceManageScreen = __esm({
|
|
18642
18678
|
"src/internal/components/DevicesMenu/DeviceManageScreen.tsx"() {
|
|
18643
18679
|
init_SessionContext();
|
|
18644
18680
|
import_lucide_react35 = require("lucide-react");
|
|
18645
|
-
|
|
18681
|
+
import_react49 = require("react");
|
|
18646
18682
|
init_guardian_backup();
|
|
18647
18683
|
init_useLayoutDataStore();
|
|
18648
18684
|
init_iframe_manager();
|
|
@@ -18661,11 +18697,11 @@ function DeviceRestoreScreen() {
|
|
|
18661
18697
|
const keyshareId = pageParams?.keyshareId;
|
|
18662
18698
|
const deviceId = pageParams?.deviceId;
|
|
18663
18699
|
const deviceName = pageParams?.deviceName;
|
|
18664
|
-
const [password, setPassword] = (0,
|
|
18665
|
-
const [isWorking, setIsWorking] = (0,
|
|
18666
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
18667
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
18668
|
-
const handleRestore = (0,
|
|
18700
|
+
const [password, setPassword] = (0, import_react50.useState)("");
|
|
18701
|
+
const [isWorking, setIsWorking] = (0, import_react50.useState)(false);
|
|
18702
|
+
const [statusMessage, setStatusMessage] = (0, import_react50.useState)(null);
|
|
18703
|
+
const [errorMessage, setErrorMessage] = (0, import_react50.useState)(null);
|
|
18704
|
+
const handleRestore = (0, import_react50.useCallback)(async () => {
|
|
18669
18705
|
if (!password || !keyshareId || !userId) return;
|
|
18670
18706
|
const iframe6 = getIframeManager();
|
|
18671
18707
|
if (!iframe6) {
|
|
@@ -18745,12 +18781,12 @@ function DeviceRestoreScreen() {
|
|
|
18745
18781
|
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "text-sm text-[var(--ui-kit-bg-error)] p-2 text-center", children: errorMessage })
|
|
18746
18782
|
] });
|
|
18747
18783
|
}
|
|
18748
|
-
var import_lucide_react36,
|
|
18784
|
+
var import_lucide_react36, import_react50, import_jsx_runtime77;
|
|
18749
18785
|
var init_DeviceRestoreScreen = __esm({
|
|
18750
18786
|
"src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx"() {
|
|
18751
18787
|
init_SessionContext();
|
|
18752
18788
|
import_lucide_react36 = require("lucide-react");
|
|
18753
|
-
|
|
18789
|
+
import_react50 = require("react");
|
|
18754
18790
|
init_guardian_backup();
|
|
18755
18791
|
init_useLayoutDataStore();
|
|
18756
18792
|
init_iframe_manager();
|
|
@@ -18770,8 +18806,8 @@ function truncateAddress(address) {
|
|
|
18770
18806
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
18771
18807
|
}
|
|
18772
18808
|
function DeviceRow({ device }) {
|
|
18773
|
-
const [confirmingUnlink, setConfirmingUnlink] = (0,
|
|
18774
|
-
const [unlinkError, setUnlinkError] = (0,
|
|
18809
|
+
const [confirmingUnlink, setConfirmingUnlink] = (0, import_react51.useState)(false);
|
|
18810
|
+
const [unlinkError, setUnlinkError] = (0, import_react51.useState)(null);
|
|
18775
18811
|
const { mutate: unlink, isPending } = useUnlinkDevice();
|
|
18776
18812
|
if (confirmingUnlink) {
|
|
18777
18813
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex flex-col gap-2 p-3 rounded-lg bg-[var(--ui-kit-bg)]", children: [
|
|
@@ -18872,11 +18908,11 @@ function DevicesMenu() {
|
|
|
18872
18908
|
] })
|
|
18873
18909
|
] });
|
|
18874
18910
|
}
|
|
18875
|
-
var import_lucide_react37,
|
|
18911
|
+
var import_lucide_react37, import_react51, import_jsx_runtime78;
|
|
18876
18912
|
var init_DevicesMenu = __esm({
|
|
18877
18913
|
"src/internal/components/DevicesMenu/DevicesMenu.tsx"() {
|
|
18878
18914
|
import_lucide_react37 = require("lucide-react");
|
|
18879
|
-
|
|
18915
|
+
import_react51 = require("react");
|
|
18880
18916
|
init_devices();
|
|
18881
18917
|
init_guardian_backup();
|
|
18882
18918
|
init_useLayoutDataStore();
|
|
@@ -18936,7 +18972,7 @@ function useOnRestoreSuccess() {
|
|
|
18936
18972
|
setStatus
|
|
18937
18973
|
} = useSession();
|
|
18938
18974
|
const { setError, setSuccess } = useRestoreStore();
|
|
18939
|
-
const createSessionWithKeyshare = (0,
|
|
18975
|
+
const createSessionWithKeyshare = (0, import_react52.useCallback)(
|
|
18940
18976
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
18941
18977
|
try {
|
|
18942
18978
|
try {
|
|
@@ -18977,7 +19013,7 @@ function useOnRestoreSuccess() {
|
|
|
18977
19013
|
},
|
|
18978
19014
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
18979
19015
|
);
|
|
18980
|
-
const onRestoreSuccess = (0,
|
|
19016
|
+
const onRestoreSuccess = (0, import_react52.useCallback)(async () => {
|
|
18981
19017
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
18982
19018
|
const verify = await verifyToken2();
|
|
18983
19019
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -19043,12 +19079,12 @@ function useOnRestoreSuccess() {
|
|
|
19043
19079
|
]);
|
|
19044
19080
|
return { onRestoreSuccess };
|
|
19045
19081
|
}
|
|
19046
|
-
var
|
|
19082
|
+
var import_react52;
|
|
19047
19083
|
var init_useOnRestoreSuccess = __esm({
|
|
19048
19084
|
"src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts"() {
|
|
19049
19085
|
init_ProviderContext();
|
|
19050
19086
|
init_SessionContext();
|
|
19051
|
-
|
|
19087
|
+
import_react52 = require("react");
|
|
19052
19088
|
init_useLayoutDataStore();
|
|
19053
19089
|
init_useLayoutStore();
|
|
19054
19090
|
init_useRestoreStore();
|
|
@@ -19311,7 +19347,7 @@ function useCreateBackup() {
|
|
|
19311
19347
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
19312
19348
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
19313
19349
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
19314
|
-
(0,
|
|
19350
|
+
(0, import_react53.useEffect)(() => {
|
|
19315
19351
|
if (!hasServerVault) {
|
|
19316
19352
|
useRestoreStore.getState().setMethod("server");
|
|
19317
19353
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -19319,7 +19355,7 @@ function useCreateBackup() {
|
|
|
19319
19355
|
}, [hasServerVault]);
|
|
19320
19356
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
19321
19357
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
19322
|
-
const onBackupSuccess = (0,
|
|
19358
|
+
const onBackupSuccess = (0, import_react53.useCallback)((method) => {
|
|
19323
19359
|
console.log(`[EMBARKAI BACKUP] ${method} backup created successfully`);
|
|
19324
19360
|
if (method !== "server") return;
|
|
19325
19361
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
@@ -19492,12 +19528,12 @@ function useCreateBackup() {
|
|
|
19492
19528
|
createPasskey
|
|
19493
19529
|
};
|
|
19494
19530
|
}
|
|
19495
|
-
var import_react_query27,
|
|
19531
|
+
var import_react_query27, import_react53;
|
|
19496
19532
|
var init_useCreateBackup = __esm({
|
|
19497
19533
|
"src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts"() {
|
|
19498
19534
|
init_SessionContext();
|
|
19499
19535
|
import_react_query27 = require("@tanstack/react-query");
|
|
19500
|
-
|
|
19536
|
+
import_react53 = require("react");
|
|
19501
19537
|
init_auth();
|
|
19502
19538
|
init_useLayoutDataStore();
|
|
19503
19539
|
init_useLayoutStore();
|
|
@@ -19634,7 +19670,7 @@ function useValidateFileBackup() {
|
|
|
19634
19670
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
19635
19671
|
const setError = useRestoreStore((st) => st.setError);
|
|
19636
19672
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
19637
|
-
(0,
|
|
19673
|
+
(0, import_react54.useEffect)(() => {
|
|
19638
19674
|
if (!restoreFile) {
|
|
19639
19675
|
return;
|
|
19640
19676
|
}
|
|
@@ -19655,10 +19691,10 @@ function useValidateFileBackup() {
|
|
|
19655
19691
|
reader.readAsText(restoreFile);
|
|
19656
19692
|
}, [restoreFile]);
|
|
19657
19693
|
}
|
|
19658
|
-
var
|
|
19694
|
+
var import_react54;
|
|
19659
19695
|
var init_useValidateFileBackup = __esm({
|
|
19660
19696
|
"src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts"() {
|
|
19661
|
-
|
|
19697
|
+
import_react54 = require("react");
|
|
19662
19698
|
init_useRestoreStore();
|
|
19663
19699
|
}
|
|
19664
19700
|
});
|
|
@@ -19686,7 +19722,7 @@ function MethodSelector(props) {
|
|
|
19686
19722
|
setError,
|
|
19687
19723
|
setSuccess
|
|
19688
19724
|
} = useRestoreStore();
|
|
19689
|
-
const recoveryRenderMethods = (0,
|
|
19725
|
+
const recoveryRenderMethods = (0, import_react55.useMemo)(() => {
|
|
19690
19726
|
const methodsWithBackupData = getRecoveryRenderMethods(mode).map((mt) => {
|
|
19691
19727
|
let data = null;
|
|
19692
19728
|
switch (true) {
|
|
@@ -19701,7 +19737,7 @@ function MethodSelector(props) {
|
|
|
19701
19737
|
return methodsWithBackupData;
|
|
19702
19738
|
}, [mode, serverRecoveryStatus]);
|
|
19703
19739
|
if (!!selectedRecoveryMethod) return null;
|
|
19704
|
-
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
19740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react55.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
19705
19741
|
"div",
|
|
19706
19742
|
{
|
|
19707
19743
|
style: { gridTemplateColumns: `repeat(${recoveryRenderMethods.length}, minmax(0, 1fr))` },
|
|
@@ -19735,12 +19771,12 @@ function MethodSelector(props) {
|
|
|
19735
19771
|
}
|
|
19736
19772
|
) });
|
|
19737
19773
|
}
|
|
19738
|
-
var import_lucide_react38,
|
|
19774
|
+
var import_lucide_react38, import_react55, import_jsx_runtime79, getRecoveryRenderMethods;
|
|
19739
19775
|
var init_MethodSelector = __esm({
|
|
19740
19776
|
"src/internal/components/KeyshareRestoreMenu/components/MethodSelector.tsx"() {
|
|
19741
19777
|
init_useT();
|
|
19742
19778
|
import_lucide_react38 = require("lucide-react");
|
|
19743
|
-
|
|
19779
|
+
import_react55 = require("react");
|
|
19744
19780
|
init_icons();
|
|
19745
19781
|
init_guardian_backup();
|
|
19746
19782
|
init_button();
|
|
@@ -19876,7 +19912,7 @@ function PasswordPasskey(props) {
|
|
|
19876
19912
|
onCreatePasskey
|
|
19877
19913
|
} = props;
|
|
19878
19914
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
19879
|
-
const actionRef = (0,
|
|
19915
|
+
const actionRef = (0, import_react56.useRef)(null);
|
|
19880
19916
|
const {
|
|
19881
19917
|
showPassword,
|
|
19882
19918
|
restorePassword,
|
|
@@ -19890,7 +19926,7 @@ function PasswordPasskey(props) {
|
|
|
19890
19926
|
} = useRestoreStore();
|
|
19891
19927
|
const { config } = useProviderConfig();
|
|
19892
19928
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
19893
|
-
(0,
|
|
19929
|
+
(0, import_react56.useEffect)(() => {
|
|
19894
19930
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
19895
19931
|
}, [isPasskeyEnabled, usePasskey]);
|
|
19896
19932
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
@@ -20047,14 +20083,14 @@ function PasswordPasskey(props) {
|
|
|
20047
20083
|
onClick: actionHandler,
|
|
20048
20084
|
title: actionCaption,
|
|
20049
20085
|
disabled: isLoading || disabled || error?.includes("Invalid backup file") || !usePasskey && !restorePassword,
|
|
20050
|
-
className: "w-
|
|
20086
|
+
className: "w-12 h-12 flex-none rounded-[var(--ui-kit-el-bdrs)]",
|
|
20051
20087
|
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_lucide_react39.Loader, { className: "animate-spin h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_lucide_react39.ChevronRight, { className: "h-4 w-4" })
|
|
20052
20088
|
}
|
|
20053
20089
|
)
|
|
20054
20090
|
] })
|
|
20055
20091
|
] });
|
|
20056
20092
|
}
|
|
20057
|
-
var import_lucide_react39,
|
|
20093
|
+
var import_lucide_react39, import_react56, import_jsx_runtime80;
|
|
20058
20094
|
var init_PasswordPasskey = __esm({
|
|
20059
20095
|
"src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx"() {
|
|
20060
20096
|
init_ProviderContext();
|
|
@@ -20062,7 +20098,7 @@ var init_PasswordPasskey = __esm({
|
|
|
20062
20098
|
init_i18n();
|
|
20063
20099
|
init_utils();
|
|
20064
20100
|
import_lucide_react39 = require("lucide-react");
|
|
20065
|
-
|
|
20101
|
+
import_react56 = require("react");
|
|
20066
20102
|
init_icons();
|
|
20067
20103
|
init_Onboarding();
|
|
20068
20104
|
init_button();
|
|
@@ -20239,7 +20275,7 @@ function Server(props) {
|
|
|
20239
20275
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
20240
20276
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
20241
20277
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
20242
|
-
(0,
|
|
20278
|
+
(0, import_react57.useEffect)(() => {
|
|
20243
20279
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
20244
20280
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
20245
20281
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -20282,7 +20318,7 @@ function Server(props) {
|
|
|
20282
20318
|
)
|
|
20283
20319
|
] });
|
|
20284
20320
|
}
|
|
20285
|
-
var import_react_query29, import_dayjs4, import_lucide_react42,
|
|
20321
|
+
var import_react_query29, import_dayjs4, import_lucide_react42, import_react57, import_jsx_runtime83;
|
|
20286
20322
|
var init_Server = __esm({
|
|
20287
20323
|
"src/internal/components/KeyshareRestoreMenu/methods/Server.tsx"() {
|
|
20288
20324
|
init_SessionContext();
|
|
@@ -20291,7 +20327,7 @@ var init_Server = __esm({
|
|
|
20291
20327
|
import_react_query29 = require("@tanstack/react-query");
|
|
20292
20328
|
import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
20293
20329
|
import_lucide_react42 = require("lucide-react");
|
|
20294
|
-
|
|
20330
|
+
import_react57 = require("react");
|
|
20295
20331
|
init_Onboarding();
|
|
20296
20332
|
init_highlight();
|
|
20297
20333
|
init_PasswordPasskey();
|
|
@@ -20455,7 +20491,7 @@ function Cloud2(props) {
|
|
|
20455
20491
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
20456
20492
|
}
|
|
20457
20493
|
});
|
|
20458
|
-
(0,
|
|
20494
|
+
(0, import_react58.useEffect)(() => {
|
|
20459
20495
|
if (isCloudProvidersLoading) return;
|
|
20460
20496
|
if (!!cloudProvidersError) {
|
|
20461
20497
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -20519,13 +20555,13 @@ function Cloud2(props) {
|
|
|
20519
20555
|
)
|
|
20520
20556
|
] });
|
|
20521
20557
|
}
|
|
20522
|
-
var import_react_query30, import_lucide_react44,
|
|
20558
|
+
var import_react_query30, import_lucide_react44, import_react58, import_jsx_runtime85;
|
|
20523
20559
|
var init_Cloud = __esm({
|
|
20524
20560
|
"src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx"() {
|
|
20525
20561
|
init_SessionContext();
|
|
20526
20562
|
import_react_query30 = require("@tanstack/react-query");
|
|
20527
20563
|
import_lucide_react44 = require("lucide-react");
|
|
20528
|
-
|
|
20564
|
+
import_react58 = require("react");
|
|
20529
20565
|
init_button();
|
|
20530
20566
|
init_select();
|
|
20531
20567
|
init_PasswordPasskey();
|
|
@@ -20542,8 +20578,8 @@ function Guardian(props) {
|
|
|
20542
20578
|
const session = useSession((st) => st.session);
|
|
20543
20579
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
20544
20580
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
20545
|
-
const [isWorking, setIsWorking] = (0,
|
|
20546
|
-
const [step, setStep] = (0,
|
|
20581
|
+
const [isWorking, setIsWorking] = (0, import_react59.useState)(false);
|
|
20582
|
+
const [step, setStep] = (0, import_react59.useState)("idle");
|
|
20547
20583
|
const handleGuardianBackup = async () => {
|
|
20548
20584
|
if (!restorePassword) {
|
|
20549
20585
|
setError("Please enter a password");
|
|
@@ -20672,11 +20708,11 @@ function Guardian(props) {
|
|
|
20672
20708
|
] })
|
|
20673
20709
|
] });
|
|
20674
20710
|
}
|
|
20675
|
-
var
|
|
20711
|
+
var import_react59, import_lucide_react45, import_jsx_runtime86;
|
|
20676
20712
|
var init_Guardian = __esm({
|
|
20677
20713
|
"src/internal/components/KeyshareRestoreMenu/methods/Guardian.tsx"() {
|
|
20678
20714
|
init_SessionContext();
|
|
20679
|
-
|
|
20715
|
+
import_react59 = require("react");
|
|
20680
20716
|
import_lucide_react45 = require("lucide-react");
|
|
20681
20717
|
init_iframe_manager();
|
|
20682
20718
|
init_guardian_backup();
|
|
@@ -20699,7 +20735,7 @@ var init_methods = __esm({
|
|
|
20699
20735
|
});
|
|
20700
20736
|
|
|
20701
20737
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
20702
|
-
var import_react_query31, import_lucide_react46,
|
|
20738
|
+
var import_react_query31, import_lucide_react46, import_react60, import_wagmi4, import_jsx_runtime87, RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
20703
20739
|
var init_KeyshareRestoreMenu = __esm({
|
|
20704
20740
|
"src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
|
|
20705
20741
|
init_ProviderContext();
|
|
@@ -20707,7 +20743,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20707
20743
|
init_i18n();
|
|
20708
20744
|
import_react_query31 = require("@tanstack/react-query");
|
|
20709
20745
|
import_lucide_react46 = require("lucide-react");
|
|
20710
|
-
|
|
20746
|
+
import_react60 = require("react");
|
|
20711
20747
|
import_wagmi4 = require("wagmi");
|
|
20712
20748
|
init_useLayoutDataStore();
|
|
20713
20749
|
init_useLayoutStore();
|
|
@@ -20737,7 +20773,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20737
20773
|
const error = useRestoreStore((st) => st.error);
|
|
20738
20774
|
const success = useRestoreStore((st) => st.success);
|
|
20739
20775
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
20740
|
-
(0,
|
|
20776
|
+
(0, import_react60.useEffect)(() => {
|
|
20741
20777
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
20742
20778
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
20743
20779
|
setIsDialogForced(true);
|
|
@@ -20776,7 +20812,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20776
20812
|
queryFn: async () => await getShareRecoveryStats()
|
|
20777
20813
|
});
|
|
20778
20814
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
20779
|
-
(0,
|
|
20815
|
+
(0, import_react60.useEffect)(() => {
|
|
20780
20816
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
20781
20817
|
}, [hasServerBackup]);
|
|
20782
20818
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query31.useMutation)({
|
|
@@ -20923,7 +20959,7 @@ function KeyshareBackupMenu() {
|
|
|
20923
20959
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
20924
20960
|
const error = useRestoreStore((st) => st.error);
|
|
20925
20961
|
const success = useRestoreStore((st) => st.success);
|
|
20926
|
-
(0,
|
|
20962
|
+
(0, import_react61.useEffect)(() => {
|
|
20927
20963
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
20928
20964
|
return () => {
|
|
20929
20965
|
setSuccess(null);
|
|
@@ -20943,7 +20979,7 @@ function KeyshareBackupMenu() {
|
|
|
20943
20979
|
});
|
|
20944
20980
|
useOnboardingTourAvailable(!isRecoveryLoading && currentBackupMethod === "server" && !usePasskey);
|
|
20945
20981
|
const hasRecoveryData2 = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
20946
|
-
(0,
|
|
20982
|
+
(0, import_react61.useEffect)(() => {
|
|
20947
20983
|
if (!!hasRecoveryData2) useRestoreStore.getState().setMethod("server");
|
|
20948
20984
|
}, [hasRecoveryData2]);
|
|
20949
20985
|
const {
|
|
@@ -21062,14 +21098,14 @@ function KeyshareBackupMenu() {
|
|
|
21062
21098
|
] })
|
|
21063
21099
|
] });
|
|
21064
21100
|
}
|
|
21065
|
-
var import_react_query32, import_lucide_react47,
|
|
21101
|
+
var import_react_query32, import_lucide_react47, import_react61, import_jsx_runtime88, COMPONENTS;
|
|
21066
21102
|
var init_KeyshareBackupMenu = __esm({
|
|
21067
21103
|
"src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx"() {
|
|
21068
21104
|
init_SessionContext();
|
|
21069
21105
|
init_i18n();
|
|
21070
21106
|
import_react_query32 = require("@tanstack/react-query");
|
|
21071
21107
|
import_lucide_react47 = require("lucide-react");
|
|
21072
|
-
|
|
21108
|
+
import_react61 = require("react");
|
|
21073
21109
|
init_useLayoutDataStore();
|
|
21074
21110
|
init_vaultClient();
|
|
21075
21111
|
init_Expandable2();
|
|
@@ -21197,13 +21233,13 @@ var init_SumsubIframeManager = __esm({
|
|
|
21197
21233
|
function useSumsubIframe({ iframeUrl }) {
|
|
21198
21234
|
const config = useProviderConfig().config;
|
|
21199
21235
|
const { colorMode } = useColorMode();
|
|
21200
|
-
const iframeRef = (0,
|
|
21201
|
-
const [isLoading, setIsLoading] = (0,
|
|
21202
|
-
const [error, setError] = (0,
|
|
21203
|
-
const [height, setHeight] = (0,
|
|
21204
|
-
const [status, setStatus] = (0,
|
|
21236
|
+
const iframeRef = (0, import_react62.useRef)(null);
|
|
21237
|
+
const [isLoading, setIsLoading] = (0, import_react62.useState)(true);
|
|
21238
|
+
const [error, setError] = (0, import_react62.useState)(null);
|
|
21239
|
+
const [height, setHeight] = (0, import_react62.useState)(0);
|
|
21240
|
+
const [status, setStatus] = (0, import_react62.useState)("");
|
|
21205
21241
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
21206
|
-
(0,
|
|
21242
|
+
(0, import_react62.useEffect)(() => {
|
|
21207
21243
|
setError(null);
|
|
21208
21244
|
setIsLoading(true);
|
|
21209
21245
|
setStatus("Preparing verification...");
|
|
@@ -21244,12 +21280,12 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
21244
21280
|
status
|
|
21245
21281
|
};
|
|
21246
21282
|
}
|
|
21247
|
-
var
|
|
21283
|
+
var import_react62;
|
|
21248
21284
|
var init_useSumsubIframe = __esm({
|
|
21249
21285
|
"src/internal/components/KYC/useSumsubIframe.ts"() {
|
|
21250
21286
|
init_ProviderContext();
|
|
21251
21287
|
init_useColorMode();
|
|
21252
|
-
|
|
21288
|
+
import_react62 = require("react");
|
|
21253
21289
|
init_sumsub();
|
|
21254
21290
|
init_SumsubIframeManager();
|
|
21255
21291
|
}
|
|
@@ -21457,11 +21493,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
21457
21493
|
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
21458
21494
|
const resolvedChainId = chainId ?? activeChainId;
|
|
21459
21495
|
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
21460
|
-
const chainConfig = (0,
|
|
21496
|
+
const chainConfig = (0, import_react63.useMemo)(() => {
|
|
21461
21497
|
if (shouldUseActiveClient) return activeChainConfig;
|
|
21462
21498
|
return (0, import_read16.getChainConfig)(chainId);
|
|
21463
21499
|
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
21464
|
-
const publicClient = (0,
|
|
21500
|
+
const publicClient = (0, import_react63.useMemo)(() => {
|
|
21465
21501
|
if (shouldUseActiveClient) return activePublicClient;
|
|
21466
21502
|
if (!chainId) return activePublicClient;
|
|
21467
21503
|
try {
|
|
@@ -21478,12 +21514,12 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
21478
21514
|
resolvedChainId
|
|
21479
21515
|
};
|
|
21480
21516
|
}
|
|
21481
|
-
var import_read16,
|
|
21517
|
+
var import_read16, import_react63, publicClientByChainId;
|
|
21482
21518
|
var init_useResolvedPublicClient = __esm({
|
|
21483
21519
|
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
21484
21520
|
init_SessionContext();
|
|
21485
21521
|
import_read16 = require("@embarkai/core/read");
|
|
21486
|
-
|
|
21522
|
+
import_react63 = require("react");
|
|
21487
21523
|
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
21488
21524
|
}
|
|
21489
21525
|
});
|
|
@@ -21547,7 +21583,7 @@ var init_useNativeBalance = __esm({
|
|
|
21547
21583
|
function useWatchTokens(options) {
|
|
21548
21584
|
const { address, chainId, enabled, publicClient } = options;
|
|
21549
21585
|
const { config } = useProviderConfig();
|
|
21550
|
-
const watchTokens = (0,
|
|
21586
|
+
const watchTokens = (0, import_react64.useMemo)(() => {
|
|
21551
21587
|
const allWatchTokens = config.current.watchTokens;
|
|
21552
21588
|
const tokensForChain = chainId ? allWatchTokens?.[chainId] || [] : [];
|
|
21553
21589
|
return tokensForChain;
|
|
@@ -21615,12 +21651,12 @@ function useWatchTokens(options) {
|
|
|
21615
21651
|
}
|
|
21616
21652
|
});
|
|
21617
21653
|
}
|
|
21618
|
-
var import_react_query35,
|
|
21654
|
+
var import_react_query35, import_react64, import_viem8;
|
|
21619
21655
|
var init_useWatchTokens = __esm({
|
|
21620
21656
|
"src/internal/hooks/useBlockscoutAssets/useWatchTokens.ts"() {
|
|
21621
21657
|
init_ProviderContext();
|
|
21622
21658
|
import_react_query35 = require("@tanstack/react-query");
|
|
21623
|
-
|
|
21659
|
+
import_react64 = require("react");
|
|
21624
21660
|
import_viem8 = require("viem");
|
|
21625
21661
|
init_constants6();
|
|
21626
21662
|
}
|
|
@@ -21769,11 +21805,11 @@ function useBlockscoutAssets(options) {
|
|
|
21769
21805
|
tokenBalancesQueryKey: customTokenBalancesQueryKey
|
|
21770
21806
|
} = useProviderConfig().config?.current?.portfolio || {};
|
|
21771
21807
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
21772
|
-
const blockscoutClient = (0,
|
|
21808
|
+
const blockscoutClient = (0, import_react65.useMemo)(
|
|
21773
21809
|
() => blockscoutApiUrl ? (0, import_core4.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
21774
21810
|
[blockscoutApiUrl]
|
|
21775
21811
|
);
|
|
21776
|
-
const lastRefreshRef = (0,
|
|
21812
|
+
const lastRefreshRef = (0, import_react65.useRef)(0);
|
|
21777
21813
|
const {
|
|
21778
21814
|
data: watchTokenAssets = [],
|
|
21779
21815
|
isLoading: watchTokensLoading,
|
|
@@ -21845,7 +21881,7 @@ function useBlockscoutAssets(options) {
|
|
|
21845
21881
|
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, blockscoutApiUrl, address],
|
|
21846
21882
|
queryFn: () => blockscoutClient.getNfts(address)
|
|
21847
21883
|
});
|
|
21848
|
-
const erc20TokenAddresses = (0,
|
|
21884
|
+
const erc20TokenAddresses = (0, import_react65.useMemo)(() => {
|
|
21849
21885
|
if (!blockscoutItems) return [];
|
|
21850
21886
|
return blockscoutItems.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
21851
21887
|
}, [blockscoutItems]);
|
|
@@ -21890,7 +21926,7 @@ function useBlockscoutAssets(options) {
|
|
|
21890
21926
|
// 1 minute
|
|
21891
21927
|
// gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
21892
21928
|
});
|
|
21893
|
-
const assets = (0,
|
|
21929
|
+
const assets = (0, import_react65.useMemo)(() => {
|
|
21894
21930
|
const result = [];
|
|
21895
21931
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
21896
21932
|
if (nativeBalanceData) {
|
|
@@ -21984,7 +22020,7 @@ function useBlockscoutAssets(options) {
|
|
|
21984
22020
|
watchTokenAssets,
|
|
21985
22021
|
chainConfig
|
|
21986
22022
|
]);
|
|
21987
|
-
const nativeBalance = (0,
|
|
22023
|
+
const nativeBalance = (0, import_react65.useMemo)(() => {
|
|
21988
22024
|
if (!nativeBalanceData) return null;
|
|
21989
22025
|
return {
|
|
21990
22026
|
value: nativeBalanceData.value,
|
|
@@ -21992,11 +22028,11 @@ function useBlockscoutAssets(options) {
|
|
|
21992
22028
|
symbol: nativeBalanceData.symbol
|
|
21993
22029
|
};
|
|
21994
22030
|
}, [nativeBalanceData]);
|
|
21995
|
-
const error = (0,
|
|
22031
|
+
const error = (0, import_react65.useMemo)(() => {
|
|
21996
22032
|
if (!blockscoutError) return null;
|
|
21997
22033
|
return createError(blockscoutError);
|
|
21998
22034
|
}, [blockscoutError]);
|
|
21999
|
-
const refreshBalances = (0,
|
|
22035
|
+
const refreshBalances = (0, import_react65.useCallback)(async () => {
|
|
22000
22036
|
const now = Date.now();
|
|
22001
22037
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
22002
22038
|
return;
|
|
@@ -22012,7 +22048,7 @@ function useBlockscoutAssets(options) {
|
|
|
22012
22048
|
qc.invalidateQueries({ queryKey: [WATCH_TOKENS_QUERY_KEY] })
|
|
22013
22049
|
]);
|
|
22014
22050
|
}, [qc, customTokenBalancesQueryKey]);
|
|
22015
|
-
const getTokenBalance = (0,
|
|
22051
|
+
const getTokenBalance = (0, import_react65.useCallback)(
|
|
22016
22052
|
(tokenAddress) => {
|
|
22017
22053
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
22018
22054
|
},
|
|
@@ -22031,13 +22067,13 @@ function useBlockscoutAssets(options) {
|
|
|
22031
22067
|
lastUpdated: dataUpdatedAt || null
|
|
22032
22068
|
};
|
|
22033
22069
|
}
|
|
22034
|
-
var import_core4, import_react_query36,
|
|
22070
|
+
var import_core4, import_react_query36, import_react65;
|
|
22035
22071
|
var init_useBlockscoutAssets = __esm({
|
|
22036
22072
|
"src/internal/hooks/useBlockscoutAssets/useBlockscoutAssets.ts"() {
|
|
22037
22073
|
init_ProviderContext();
|
|
22038
22074
|
import_core4 = require("@embarkai/core");
|
|
22039
22075
|
import_react_query36 = require("@tanstack/react-query");
|
|
22040
|
-
|
|
22076
|
+
import_react65 = require("react");
|
|
22041
22077
|
init_initial();
|
|
22042
22078
|
init_constants();
|
|
22043
22079
|
init_useResolvedPublicClient();
|
|
@@ -22157,9 +22193,9 @@ function SecurityTokenBadge() {
|
|
|
22157
22193
|
}
|
|
22158
22194
|
function PortfolioItemImage(props) {
|
|
22159
22195
|
const { asset } = props;
|
|
22160
|
-
const [logoError, setLogoError] = (0,
|
|
22161
|
-
const [nftImageError, setNftImageError] = (0,
|
|
22162
|
-
const resolvedImage = (0,
|
|
22196
|
+
const [logoError, setLogoError] = (0, import_react66.useState)(false);
|
|
22197
|
+
const [nftImageError, setNftImageError] = (0, import_react66.useState)(false);
|
|
22198
|
+
const resolvedImage = (0, import_react66.useMemo)(() => {
|
|
22163
22199
|
const isNft = isNftAsset(asset);
|
|
22164
22200
|
const nftImage = getNftImage(asset);
|
|
22165
22201
|
const isSecurity = isSecurityToken(asset);
|
|
@@ -22314,13 +22350,13 @@ function PortfolioItem(props) {
|
|
|
22314
22350
|
}
|
|
22315
22351
|
);
|
|
22316
22352
|
}
|
|
22317
|
-
var import_react_query37, import_lucide_react51,
|
|
22353
|
+
var import_react_query37, import_lucide_react51, import_react66, import_viem11, import_jsx_runtime94, PORTFOLIO_ASSET_RATE_QUERY_KEY;
|
|
22318
22354
|
var init_PortfolioItem = __esm({
|
|
22319
22355
|
"src/internal/components/PortfolioMenu/PortfolioItem.tsx"() {
|
|
22320
22356
|
init_ProviderContext();
|
|
22321
22357
|
import_react_query37 = require("@tanstack/react-query");
|
|
22322
22358
|
import_lucide_react51 = require("lucide-react");
|
|
22323
|
-
|
|
22359
|
+
import_react66 = require("react");
|
|
22324
22360
|
import_viem11 = require("viem");
|
|
22325
22361
|
init_tokens();
|
|
22326
22362
|
init_base3();
|
|
@@ -22352,7 +22388,7 @@ function PortfolioMenu() {
|
|
|
22352
22388
|
enabled: !!address
|
|
22353
22389
|
});
|
|
22354
22390
|
const shownProjectAssets = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
22355
|
-
const refreshAllAssetsBalances = (0,
|
|
22391
|
+
const refreshAllAssetsBalances = (0, import_react67.useCallback)(() => {
|
|
22356
22392
|
Promise.all(shownProjectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
22357
22393
|
refreshBlockscoutBalances();
|
|
22358
22394
|
}, [qc, shownProjectAssets, refreshBlockscoutBalances]);
|
|
@@ -22398,7 +22434,7 @@ function PortfolioMenu() {
|
|
|
22398
22434
|
blockscoutError && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Highlight, { type: "error", children: blockscoutError?.message })
|
|
22399
22435
|
] });
|
|
22400
22436
|
}
|
|
22401
|
-
var import_react_query38, import_lucide_react52,
|
|
22437
|
+
var import_react_query38, import_lucide_react52, import_react67, import_jsx_runtime95;
|
|
22402
22438
|
var init_PortfolioMenu = __esm({
|
|
22403
22439
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
22404
22440
|
init_ProviderContext();
|
|
@@ -22406,7 +22442,7 @@ var init_PortfolioMenu = __esm({
|
|
|
22406
22442
|
init_i18n();
|
|
22407
22443
|
import_react_query38 = require("@tanstack/react-query");
|
|
22408
22444
|
import_lucide_react52 = require("lucide-react");
|
|
22409
|
-
|
|
22445
|
+
import_react67 = require("react");
|
|
22410
22446
|
init_useBlockscoutAssets2();
|
|
22411
22447
|
init_useLayoutDataStore();
|
|
22412
22448
|
init_Expandable2();
|
|
@@ -22717,7 +22753,7 @@ var init_useNicknameStore = __esm({
|
|
|
22717
22753
|
function useNicknameAvailability(currentNickname) {
|
|
22718
22754
|
const { t } = useT();
|
|
22719
22755
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
22720
|
-
(0,
|
|
22756
|
+
(0, import_react68.useEffect)(() => {
|
|
22721
22757
|
if (!currentNickname) return;
|
|
22722
22758
|
useNicknameStore.getState().setNicknameValue(currentNickname);
|
|
22723
22759
|
}, [currentNickname]);
|
|
@@ -22738,8 +22774,8 @@ function useNicknameAvailability(currentNickname) {
|
|
|
22738
22774
|
useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
|
|
22739
22775
|
}
|
|
22740
22776
|
});
|
|
22741
|
-
const debouncedCheckAvailability = (0,
|
|
22742
|
-
(0,
|
|
22777
|
+
const debouncedCheckAvailability = (0, import_react68.useCallback)((0, import_lodash_es13.debounce)(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
|
|
22778
|
+
(0, import_react68.useEffect)(() => {
|
|
22743
22779
|
if (!currentNickname) return;
|
|
22744
22780
|
const normalizedInputValue = normalizeNickname(nicknameValue);
|
|
22745
22781
|
const { valid: isNicknameValid } = validateNickname(nicknameValue);
|
|
@@ -22753,13 +22789,13 @@ function useNicknameAvailability(currentNickname) {
|
|
|
22753
22789
|
}, [nicknameValue, currentNickname, debouncedCheckAvailability]);
|
|
22754
22790
|
return { isCheckingAvailability };
|
|
22755
22791
|
}
|
|
22756
|
-
var import_react_query39, import_lodash_es13,
|
|
22792
|
+
var import_react_query39, import_lodash_es13, import_react68, DEBOUNCE_MS;
|
|
22757
22793
|
var init_useNicknameAvailability = __esm({
|
|
22758
22794
|
"src/internal/components/NicknameMenu/useNicknameAvailability.ts"() {
|
|
22759
22795
|
init_i18n();
|
|
22760
22796
|
import_react_query39 = require("@tanstack/react-query");
|
|
22761
22797
|
import_lodash_es13 = require("lodash-es");
|
|
22762
|
-
|
|
22798
|
+
import_react68 = require("react");
|
|
22763
22799
|
init_nickname();
|
|
22764
22800
|
init_nickname_errors();
|
|
22765
22801
|
init_nickname_validation();
|
|
@@ -22780,9 +22816,9 @@ function NicknameEditForm(props) {
|
|
|
22780
22816
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
22781
22817
|
const nicknameAvailability = useNicknameStore((st) => st.availability);
|
|
22782
22818
|
const { isCheckingAvailability } = useNicknameAvailability(nicknameInfo ? nicknameInfo.handle : "");
|
|
22783
|
-
const [isNicknameCopied, setIsNicknameCopied] = (0,
|
|
22784
|
-
const exitTimerRef = (0,
|
|
22785
|
-
(0,
|
|
22819
|
+
const [isNicknameCopied, setIsNicknameCopied] = (0, import_react69.useState)(false);
|
|
22820
|
+
const exitTimerRef = (0, import_react69.useRef)(null);
|
|
22821
|
+
(0, import_react69.useEffect)(() => () => {
|
|
22786
22822
|
if (exitTimerRef.current) clearTimeout(exitTimerRef.current);
|
|
22787
22823
|
}, []);
|
|
22788
22824
|
const { mutate: changeNickname2, isPending: isNicknameChanging } = (0, import_react_query40.useMutation)({
|
|
@@ -22816,7 +22852,7 @@ function NicknameEditForm(props) {
|
|
|
22816
22852
|
);
|
|
22817
22853
|
}
|
|
22818
22854
|
});
|
|
22819
|
-
const handleNicknameInputChange = (0,
|
|
22855
|
+
const handleNicknameInputChange = (0, import_react69.useCallback)(
|
|
22820
22856
|
(e) => {
|
|
22821
22857
|
const { error, setError, setNicknameValue } = useNicknameStore.getState();
|
|
22822
22858
|
const nextInputValue = e.target.value;
|
|
@@ -22830,7 +22866,7 @@ function NicknameEditForm(props) {
|
|
|
22830
22866
|
},
|
|
22831
22867
|
[t]
|
|
22832
22868
|
);
|
|
22833
|
-
const handleSubmit = (0,
|
|
22869
|
+
const handleSubmit = (0, import_react69.useCallback)(
|
|
22834
22870
|
(e) => {
|
|
22835
22871
|
const { nicknameValue: nicknameValue2, setError } = useNicknameStore.getState();
|
|
22836
22872
|
if (!canChange) {
|
|
@@ -22922,7 +22958,7 @@ function NicknameEditForm(props) {
|
|
|
22922
22958
|
!!canChange && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "w-full flex items-center leadding-4 text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:nicknameMenu.hint") })
|
|
22923
22959
|
] });
|
|
22924
22960
|
}
|
|
22925
|
-
var import_react_query40, import_lucide_react55,
|
|
22961
|
+
var import_react_query40, import_lucide_react55, import_react69, import_jsx_runtime98;
|
|
22926
22962
|
var init_NicknameEditForm = __esm({
|
|
22927
22963
|
"src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
|
|
22928
22964
|
init_ProviderContext();
|
|
@@ -22930,7 +22966,7 @@ var init_NicknameEditForm = __esm({
|
|
|
22930
22966
|
init_i18n();
|
|
22931
22967
|
import_react_query40 = require("@tanstack/react-query");
|
|
22932
22968
|
import_lucide_react55 = require("lucide-react");
|
|
22933
|
-
|
|
22969
|
+
import_react69 = require("react");
|
|
22934
22970
|
init_icons();
|
|
22935
22971
|
init_nickname();
|
|
22936
22972
|
init_profile();
|
|
@@ -22966,7 +23002,7 @@ function NicknameMenu() {
|
|
|
22966
23002
|
queryFn: async () => await getNicknameInfo()
|
|
22967
23003
|
});
|
|
22968
23004
|
const resolvedError = nicknameError || nicknameInfoError?.message || null;
|
|
22969
|
-
(0,
|
|
23005
|
+
(0, import_react70.useEffect)(() => () => useNicknameStore.getState().reset(), []);
|
|
22970
23006
|
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
22971
23007
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)] ", children: [
|
|
22972
23008
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
@@ -23033,7 +23069,7 @@ function NicknameMenu() {
|
|
|
23033
23069
|
!!resolvedError?.length && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Highlight, { type: "error", children: resolvedError })
|
|
23034
23070
|
] });
|
|
23035
23071
|
}
|
|
23036
|
-
var import_react_query41, import_dayjs5, import_lucide_react56,
|
|
23072
|
+
var import_react_query41, import_dayjs5, import_lucide_react56, import_react70, import_jsx_runtime99;
|
|
23037
23073
|
var init_NicknameMenu = __esm({
|
|
23038
23074
|
"src/internal/components/NicknameMenu/NicknameMenu.tsx"() {
|
|
23039
23075
|
init_SessionContext();
|
|
@@ -23042,7 +23078,7 @@ var init_NicknameMenu = __esm({
|
|
|
23042
23078
|
import_react_query41 = require("@tanstack/react-query");
|
|
23043
23079
|
import_dayjs5 = __toESM(require("dayjs"), 1);
|
|
23044
23080
|
import_lucide_react56 = require("lucide-react");
|
|
23045
|
-
|
|
23081
|
+
import_react70 = require("react");
|
|
23046
23082
|
init_nickname();
|
|
23047
23083
|
init_profile();
|
|
23048
23084
|
init_useLayoutDataStore();
|
|
@@ -23172,12 +23208,12 @@ function ReceiveMenu() {
|
|
|
23172
23208
|
queryKey: [QUERY_KEYS.nicknameInfo, address],
|
|
23173
23209
|
queryFn: async () => await getNicknameInfo()
|
|
23174
23210
|
});
|
|
23175
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
23176
|
-
const [isAddressCopied, setAddressCopied] = (0,
|
|
23177
|
-
const [isNicknameCopied, setNicknameCopied] = (0,
|
|
23178
|
-
const [fingerprintCopied, setFingerprintCopied] = (0,
|
|
23211
|
+
const [qrCodeUrl, setQrCodeUrl] = (0, import_react71.useState)("");
|
|
23212
|
+
const [isAddressCopied, setAddressCopied] = (0, import_react71.useState)(false);
|
|
23213
|
+
const [isNicknameCopied, setNicknameCopied] = (0, import_react71.useState)(false);
|
|
23214
|
+
const [fingerprintCopied, setFingerprintCopied] = (0, import_react71.useState)(false);
|
|
23179
23215
|
useOnboardingTourAvailable(true);
|
|
23180
|
-
const fingerprint = (0,
|
|
23216
|
+
const fingerprint = (0, import_react71.useMemo)(() => {
|
|
23181
23217
|
if (!session?.ownerAddress) return null;
|
|
23182
23218
|
try {
|
|
23183
23219
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -23185,7 +23221,7 @@ function ReceiveMenu() {
|
|
|
23185
23221
|
return null;
|
|
23186
23222
|
}
|
|
23187
23223
|
}, [session?.ownerAddress]);
|
|
23188
|
-
(0,
|
|
23224
|
+
(0, import_react71.useEffect)(() => {
|
|
23189
23225
|
if (!address) return;
|
|
23190
23226
|
import_qrcode.default.toDataURL(address, {
|
|
23191
23227
|
width: 200,
|
|
@@ -23284,7 +23320,7 @@ function ReceiveMenu() {
|
|
|
23284
23320
|
] })
|
|
23285
23321
|
] });
|
|
23286
23322
|
}
|
|
23287
|
-
var import_react_query42, import_lucide_react57, import_qrcode,
|
|
23323
|
+
var import_react_query42, import_lucide_react57, import_qrcode, import_react71, import_jsx_runtime100;
|
|
23288
23324
|
var init_ReceiveMenu = __esm({
|
|
23289
23325
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
23290
23326
|
init_SessionContext();
|
|
@@ -23292,7 +23328,7 @@ var init_ReceiveMenu = __esm({
|
|
|
23292
23328
|
import_react_query42 = require("@tanstack/react-query");
|
|
23293
23329
|
import_lucide_react57 = require("lucide-react");
|
|
23294
23330
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
23295
|
-
|
|
23331
|
+
import_react71 = require("react");
|
|
23296
23332
|
init_nickname();
|
|
23297
23333
|
init_profile();
|
|
23298
23334
|
init_useLayoutDataStore();
|
|
@@ -23672,14 +23708,14 @@ var init_ConnectedApps2 = __esm({
|
|
|
23672
23708
|
});
|
|
23673
23709
|
|
|
23674
23710
|
// src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx
|
|
23675
|
-
var import_lucide_react60,
|
|
23711
|
+
var import_lucide_react60, import_react72, import_jsx_runtime103, KeyshareStatus;
|
|
23676
23712
|
var init_KeyshareStatus = __esm({
|
|
23677
23713
|
"src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx"() {
|
|
23678
23714
|
import_lucide_react60 = require("lucide-react");
|
|
23679
|
-
|
|
23715
|
+
import_react72 = require("react");
|
|
23680
23716
|
init_utils();
|
|
23681
23717
|
import_jsx_runtime103 = require("react/jsx-runtime");
|
|
23682
|
-
KeyshareStatus = (0,
|
|
23718
|
+
KeyshareStatus = (0, import_react72.forwardRef)((props, ref) => {
|
|
23683
23719
|
const { isLoading, content, icon: Icon2, children } = props;
|
|
23684
23720
|
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react60.Loader, { className: "w-4 h-4 animate-spin" });
|
|
23685
23721
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { ref, className: "group relative w-full h-full", children: [
|
|
@@ -24006,10 +24042,10 @@ function updateLimits(patch) {
|
|
|
24006
24042
|
usePolicyForm.setState((st) => ({ ...st, limits: { ...st?.limits, ...patch } }));
|
|
24007
24043
|
}
|
|
24008
24044
|
function useWatchFormData() {
|
|
24009
|
-
const [showFormErrors, setShowFormErrors] = (0,
|
|
24045
|
+
const [showFormErrors, setShowFormErrors] = (0, import_react73.useState)(false);
|
|
24010
24046
|
const formData = usePolicyForm();
|
|
24011
24047
|
const formState = usePolicyFormValidation();
|
|
24012
|
-
(0,
|
|
24048
|
+
(0, import_react73.useEffect)(() => {
|
|
24013
24049
|
if (!formData) return;
|
|
24014
24050
|
setShowFormErrors(false);
|
|
24015
24051
|
const errors = {};
|
|
@@ -24036,7 +24072,7 @@ function useWatchFormData() {
|
|
|
24036
24072
|
}
|
|
24037
24073
|
usePolicyFormValidation.setState(errors, true);
|
|
24038
24074
|
}, [formData]);
|
|
24039
|
-
(0,
|
|
24075
|
+
(0, import_react73.useEffect)(() => () => usePolicyFormValidation.setState({}, true), []);
|
|
24040
24076
|
const formErrorItem = Object.entries(formState).find(([_, value]) => value?.error);
|
|
24041
24077
|
const formErrorMessage = formErrorItem ? `${formErrorItem[0].toUpperCase()}: ${formErrorItem[1]?.error}` : "";
|
|
24042
24078
|
return {
|
|
@@ -24047,10 +24083,10 @@ function useWatchFormData() {
|
|
|
24047
24083
|
setShowFormErrors
|
|
24048
24084
|
};
|
|
24049
24085
|
}
|
|
24050
|
-
var
|
|
24086
|
+
var import_react73, import_zustand14, usePolicyForm, usePolicyFormValidation;
|
|
24051
24087
|
var init_usePolicyForm = __esm({
|
|
24052
24088
|
"src/internal/components/SecurityMenu/UserPolicies/usePolicyForm.ts"() {
|
|
24053
|
-
|
|
24089
|
+
import_react73 = require("react");
|
|
24054
24090
|
import_zustand14 = require("zustand");
|
|
24055
24091
|
init_utils10();
|
|
24056
24092
|
usePolicyForm = (0, import_zustand14.create)(() => null);
|
|
@@ -24081,10 +24117,10 @@ var init_useUserAssetsPolicies = __esm({
|
|
|
24081
24117
|
// src/internal/components/SecurityMenu/UserPolicies/PolicyForm.tsx
|
|
24082
24118
|
function AddressListEditor(props) {
|
|
24083
24119
|
const { label, assets = [], addresses, onChange } = props;
|
|
24084
|
-
const [isAssetSelector, setIsAssetSelector] = (0,
|
|
24085
|
-
const [customAddress, setCustomAddress] = (0,
|
|
24086
|
-
const [customAddressError, setCustomAddressError] = (0,
|
|
24087
|
-
const handleAddress = (0,
|
|
24120
|
+
const [isAssetSelector, setIsAssetSelector] = (0, import_react74.useState)(false);
|
|
24121
|
+
const [customAddress, setCustomAddress] = (0, import_react74.useState)("");
|
|
24122
|
+
const [customAddressError, setCustomAddressError] = (0, import_react74.useState)(null);
|
|
24123
|
+
const handleAddress = (0, import_react74.useCallback)(
|
|
24088
24124
|
(addressToAdd) => {
|
|
24089
24125
|
if (!isValidAddress(addressToAdd)) {
|
|
24090
24126
|
setCustomAddressError("Bad address");
|
|
@@ -24311,14 +24347,14 @@ function PolicyForm() {
|
|
|
24311
24347
|
showFormErrors && formErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Highlight, { type: "error", children: formErrorMessage })
|
|
24312
24348
|
] });
|
|
24313
24349
|
}
|
|
24314
|
-
var import_react_query47, import_lucide_react63,
|
|
24350
|
+
var import_react_query47, import_lucide_react63, import_react74, import_jsx_runtime106;
|
|
24315
24351
|
var init_PolicyForm = __esm({
|
|
24316
24352
|
"src/internal/components/SecurityMenu/UserPolicies/PolicyForm.tsx"() {
|
|
24317
24353
|
init_SessionContext();
|
|
24318
24354
|
init_useT();
|
|
24319
24355
|
import_react_query47 = require("@tanstack/react-query");
|
|
24320
24356
|
import_lucide_react63 = require("lucide-react");
|
|
24321
|
-
|
|
24357
|
+
import_react74 = require("react");
|
|
24322
24358
|
init_button();
|
|
24323
24359
|
init_highlight();
|
|
24324
24360
|
init_input();
|
|
@@ -24400,7 +24436,7 @@ function UserPolicies() {
|
|
|
24400
24436
|
const config = useProviderConfig().config;
|
|
24401
24437
|
const mpcUserId = useSession((st) => st.session?.mpcUserId);
|
|
24402
24438
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
24403
|
-
const [isConfirmingDelete, setIsConfirmingDelete] = (0,
|
|
24439
|
+
const [isConfirmingDelete, setIsConfirmingDelete] = (0, import_react75.useState)(false);
|
|
24404
24440
|
const { data: policyView, isLoading: isPolicyLoading } = useUserAssetsPolicies(activeChainId);
|
|
24405
24441
|
const { mutate: cancelPending, isPending: isCancellingPending } = (0, import_react_query48.useMutation)({
|
|
24406
24442
|
mutationFn: async () => {
|
|
@@ -24513,7 +24549,7 @@ function UserPolicies() {
|
|
|
24513
24549
|
] })
|
|
24514
24550
|
] });
|
|
24515
24551
|
}
|
|
24516
|
-
var import_react_query48, import_clsx3, import_lucide_react64,
|
|
24552
|
+
var import_react_query48, import_clsx3, import_lucide_react64, import_react75, import_jsx_runtime107;
|
|
24517
24553
|
var init_UserPolicies = __esm({
|
|
24518
24554
|
"src/internal/components/SecurityMenu/UserPolicies/UserPolicies.tsx"() {
|
|
24519
24555
|
init_ProviderContext();
|
|
@@ -24522,7 +24558,7 @@ var init_UserPolicies = __esm({
|
|
|
24522
24558
|
import_react_query48 = require("@tanstack/react-query");
|
|
24523
24559
|
import_clsx3 = __toESM(require("clsx"), 1);
|
|
24524
24560
|
import_lucide_react64 = require("lucide-react");
|
|
24525
|
-
|
|
24561
|
+
import_react75 = require("react");
|
|
24526
24562
|
init_button();
|
|
24527
24563
|
init_highlight();
|
|
24528
24564
|
init_api4();
|
|
@@ -24547,7 +24583,7 @@ var init_UserPolicies2 = __esm({
|
|
|
24547
24583
|
|
|
24548
24584
|
// src/internal/components/SecurityMenu/useSecurityMenuParams.ts
|
|
24549
24585
|
function useSecurityMenuParams() {
|
|
24550
|
-
(0,
|
|
24586
|
+
(0, import_react76.useEffect)(() => {
|
|
24551
24587
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
24552
24588
|
if (!pageParams || !(0, import_lodash_es14.keys)(pageParams).length) return;
|
|
24553
24589
|
const { submenu } = pageParams;
|
|
@@ -24571,11 +24607,11 @@ function useSecurityMenuParams() {
|
|
|
24571
24607
|
setPageParams(null);
|
|
24572
24608
|
}, []);
|
|
24573
24609
|
}
|
|
24574
|
-
var import_lodash_es14,
|
|
24610
|
+
var import_lodash_es14, import_react76;
|
|
24575
24611
|
var init_useSecurityMenuParams = __esm({
|
|
24576
24612
|
"src/internal/components/SecurityMenu/useSecurityMenuParams.ts"() {
|
|
24577
24613
|
import_lodash_es14 = require("lodash-es");
|
|
24578
|
-
|
|
24614
|
+
import_react76 = require("react");
|
|
24579
24615
|
init_useLayoutDataStore();
|
|
24580
24616
|
init_UserPolicies2();
|
|
24581
24617
|
init_useSecurityStore();
|
|
@@ -24590,7 +24626,7 @@ function SecurityMenuContent() {
|
|
|
24590
24626
|
const { appToUntrust, showConnectedApps, showAssetsPolicies } = useSecurityStore();
|
|
24591
24627
|
const policyForm = usePolicyForm();
|
|
24592
24628
|
useOnboardingTourAvailable(!showConnectedApps && !showAssetsPolicies);
|
|
24593
|
-
(0,
|
|
24629
|
+
(0, import_react77.useEffect)(() => {
|
|
24594
24630
|
let securityTitle = "";
|
|
24595
24631
|
switch (true) {
|
|
24596
24632
|
case showConnectedApps:
|
|
@@ -24611,7 +24647,7 @@ function SecurityMenuContent() {
|
|
|
24611
24647
|
return () => {
|
|
24612
24648
|
};
|
|
24613
24649
|
}, [t, showConnectedApps, showAssetsPolicies, policyForm]);
|
|
24614
|
-
(0,
|
|
24650
|
+
(0, import_react77.useEffect)(
|
|
24615
24651
|
() => () => {
|
|
24616
24652
|
usePolicyForm.setState(null, true);
|
|
24617
24653
|
useSecurityStore.setState(
|
|
@@ -24705,13 +24741,13 @@ function SecurityMenu() {
|
|
|
24705
24741
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SecurityMenuContent, {})
|
|
24706
24742
|
] });
|
|
24707
24743
|
}
|
|
24708
|
-
var import_lucide_react65,
|
|
24744
|
+
var import_lucide_react65, import_react77, import_jsx_runtime108;
|
|
24709
24745
|
var init_SecurityMenu = __esm({
|
|
24710
24746
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
24711
24747
|
init_ProviderContext();
|
|
24712
24748
|
init_i18n();
|
|
24713
24749
|
import_lucide_react65 = require("lucide-react");
|
|
24714
|
-
|
|
24750
|
+
import_react77 = require("react");
|
|
24715
24751
|
init_useLayoutDataStore();
|
|
24716
24752
|
init_Expandable2();
|
|
24717
24753
|
init_Onboarding();
|
|
@@ -24914,8 +24950,8 @@ var init_SenderSelector = __esm({
|
|
|
24914
24950
|
function useAvailableSenders() {
|
|
24915
24951
|
const address = useSession((st) => st.address);
|
|
24916
24952
|
const { profiles } = useLinkedProfiles();
|
|
24917
|
-
const lastCalcedSenders = (0,
|
|
24918
|
-
(0,
|
|
24953
|
+
const lastCalcedSenders = (0, import_react78.useRef)([]);
|
|
24954
|
+
(0, import_react78.useEffect)(() => {
|
|
24919
24955
|
const sendersAccumulator = [
|
|
24920
24956
|
{
|
|
24921
24957
|
type: "embarkai-wallet",
|
|
@@ -24949,13 +24985,13 @@ function useAvailableSenders() {
|
|
|
24949
24985
|
directWalletProfiles: profiles.filter((p) => p.provider === "wallet")
|
|
24950
24986
|
};
|
|
24951
24987
|
}
|
|
24952
|
-
var
|
|
24988
|
+
var import_react78;
|
|
24953
24989
|
var init_useAvailableSenders = __esm({
|
|
24954
24990
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
24955
24991
|
init_SessionContext();
|
|
24956
24992
|
init_tokens();
|
|
24957
24993
|
init_linkedProfiles();
|
|
24958
|
-
|
|
24994
|
+
import_react78 = require("react");
|
|
24959
24995
|
init_wallets();
|
|
24960
24996
|
init_useBridgeStore();
|
|
24961
24997
|
}
|
|
@@ -25370,18 +25406,18 @@ function useHyperlaneHistory() {
|
|
|
25370
25406
|
getNextPageParam: (lastPage) => lastPage.page < lastPage.pageCount ? lastPage.page + 1 : void 0,
|
|
25371
25407
|
queryFn: async ({ pageParam }) => await getHyperlaneBridgeHistory({ page: pageParam, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
25372
25408
|
});
|
|
25373
|
-
const txList = (0,
|
|
25409
|
+
const txList = (0, import_react79.useMemo)(
|
|
25374
25410
|
() => query?.data?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
25375
25411
|
[query?.data]
|
|
25376
25412
|
);
|
|
25377
25413
|
return { query, txList };
|
|
25378
25414
|
}
|
|
25379
|
-
var import_react_query49,
|
|
25415
|
+
var import_react_query49, import_react79, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
25380
25416
|
var init_useHyperlaneHistory = __esm({
|
|
25381
25417
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
25382
25418
|
init_SessionContext();
|
|
25383
25419
|
import_react_query49 = require("@tanstack/react-query");
|
|
25384
|
-
|
|
25420
|
+
import_react79 = require("react");
|
|
25385
25421
|
init_useLayoutDataStore();
|
|
25386
25422
|
init_useFlowSelector();
|
|
25387
25423
|
init_api5();
|
|
@@ -25413,7 +25449,7 @@ function useBridge() {
|
|
|
25413
25449
|
const address = useSession((st) => st.address);
|
|
25414
25450
|
const { data: walletClient } = (0, import_wagmi5.useWalletClient)();
|
|
25415
25451
|
const { mutateAsync: switchChainAsync } = (0, import_wagmi5.useSwitchChain)();
|
|
25416
|
-
const swapDirection = (0,
|
|
25452
|
+
const swapDirection = (0, import_react80.useCallback)(() => {
|
|
25417
25453
|
const {
|
|
25418
25454
|
// bridgeStep,
|
|
25419
25455
|
originChain,
|
|
@@ -25464,7 +25500,7 @@ function useBridge() {
|
|
|
25464
25500
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
25465
25501
|
}
|
|
25466
25502
|
});
|
|
25467
|
-
const handleQuoteEstimation = (0,
|
|
25503
|
+
const handleQuoteEstimation = (0, import_react80.useCallback)((amnt) => {
|
|
25468
25504
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
25469
25505
|
if (!amnt || !Number(amnt)) {
|
|
25470
25506
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -25599,13 +25635,13 @@ function useBridge() {
|
|
|
25599
25635
|
isAssetBridging
|
|
25600
25636
|
};
|
|
25601
25637
|
}
|
|
25602
|
-
var import_react_query50,
|
|
25638
|
+
var import_react_query50, import_react80, import_wagmi5;
|
|
25603
25639
|
var init_useBridge = __esm({
|
|
25604
25640
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
25605
25641
|
init_SessionContext();
|
|
25606
25642
|
init_i18n();
|
|
25607
25643
|
import_react_query50 = require("@tanstack/react-query");
|
|
25608
|
-
|
|
25644
|
+
import_react80 = require("react");
|
|
25609
25645
|
import_wagmi5 = require("wagmi");
|
|
25610
25646
|
init_useLayoutStore();
|
|
25611
25647
|
init_useExternalWalletStore();
|
|
@@ -25636,7 +25672,7 @@ function useHyperlaneRoutes() {
|
|
|
25636
25672
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
25637
25673
|
queryFn: async () => await getHyperlaneWarpRoutes()
|
|
25638
25674
|
});
|
|
25639
|
-
(0,
|
|
25675
|
+
(0, import_react81.useEffect)(() => {
|
|
25640
25676
|
if (!errorWarpRoutes) return;
|
|
25641
25677
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
25642
25678
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -25645,7 +25681,7 @@ function useHyperlaneRoutes() {
|
|
|
25645
25681
|
setOriginChain(null);
|
|
25646
25682
|
setDestinationChain(null);
|
|
25647
25683
|
}, [errorWarpRoutes]);
|
|
25648
|
-
(0,
|
|
25684
|
+
(0, import_react81.useEffect)(() => {
|
|
25649
25685
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
25650
25686
|
let targetHyperRouteToSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
25651
25687
|
if (!targetHyperRouteToSelect) {
|
|
@@ -25670,12 +25706,12 @@ function useHyperlaneRoutes() {
|
|
|
25670
25706
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
25671
25707
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
25672
25708
|
}
|
|
25673
|
-
var import_react_query51,
|
|
25709
|
+
var import_react_query51, import_react81, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
25674
25710
|
var init_useHyperlaneRoutes = __esm({
|
|
25675
25711
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
25676
25712
|
init_SessionContext();
|
|
25677
25713
|
import_react_query51 = require("@tanstack/react-query");
|
|
25678
|
-
|
|
25714
|
+
import_react81 = require("react");
|
|
25679
25715
|
init_useLayoutDataStore();
|
|
25680
25716
|
init_useFlowSelector();
|
|
25681
25717
|
init_api5();
|
|
@@ -25691,7 +25727,7 @@ function useMenuTitle(warpRoutes) {
|
|
|
25691
25727
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
25692
25728
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
25693
25729
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
25694
|
-
(0,
|
|
25730
|
+
(0, import_react82.useEffect)(() => {
|
|
25695
25731
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
25696
25732
|
switch (true) {
|
|
25697
25733
|
case bridgeStep === "sender-selector":
|
|
@@ -25719,11 +25755,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
25719
25755
|
}
|
|
25720
25756
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
25721
25757
|
}
|
|
25722
|
-
var
|
|
25758
|
+
var import_react82;
|
|
25723
25759
|
var init_useMenuTitle = __esm({
|
|
25724
25760
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
25725
25761
|
init_i18n();
|
|
25726
|
-
|
|
25762
|
+
import_react82 = require("react");
|
|
25727
25763
|
init_useFlowSelector();
|
|
25728
25764
|
init_useBridgeStore();
|
|
25729
25765
|
}
|
|
@@ -25973,7 +26009,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
25973
26009
|
};
|
|
25974
26010
|
}
|
|
25975
26011
|
});
|
|
25976
|
-
const refreshRouteTokenBalance = (0,
|
|
26012
|
+
const refreshRouteTokenBalance = (0, import_react83.useCallback)(
|
|
25977
26013
|
(senderWallet) => {
|
|
25978
26014
|
switch (true) {
|
|
25979
26015
|
case senderWallet === "embarkai-wallet":
|
|
@@ -25989,7 +26025,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
25989
26025
|
},
|
|
25990
26026
|
[refreshBalances, qc]
|
|
25991
26027
|
);
|
|
25992
|
-
(0,
|
|
26028
|
+
(0, import_react83.useEffect)(() => {
|
|
25993
26029
|
if (!!isLoadingWarpRoutes || !bridgeSender || !originChain) return;
|
|
25994
26030
|
switch (bridgeSender) {
|
|
25995
26031
|
case "embarkai-wallet":
|
|
@@ -26020,14 +26056,14 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26020
26056
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
26021
26057
|
};
|
|
26022
26058
|
}
|
|
26023
|
-
var import_core8, import_react_query52,
|
|
26059
|
+
var import_core8, import_react_query52, import_react83, import_viem15, import_wagmi6, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
|
|
26024
26060
|
var init_useBridgeBalance = __esm({
|
|
26025
26061
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
26026
26062
|
init_SessionContext();
|
|
26027
26063
|
init_i18n();
|
|
26028
26064
|
import_core8 = require("@embarkai/core");
|
|
26029
26065
|
import_react_query52 = require("@tanstack/react-query");
|
|
26030
|
-
|
|
26066
|
+
import_react83 = require("react");
|
|
26031
26067
|
import_viem15 = require("viem");
|
|
26032
26068
|
import_wagmi6 = require("wagmi");
|
|
26033
26069
|
init_useBlockscoutAssets2();
|
|
@@ -26156,7 +26192,7 @@ function SelectStep(props) {
|
|
|
26156
26192
|
variant: "outline",
|
|
26157
26193
|
size: "medium",
|
|
26158
26194
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
26159
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
|
|
26195
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(import_react84.Fragment, { children: [
|
|
26160
26196
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_lucide_react67.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
26161
26197
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
26162
26198
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -26300,13 +26336,13 @@ function SelectStep(props) {
|
|
|
26300
26336
|
)
|
|
26301
26337
|
] });
|
|
26302
26338
|
}
|
|
26303
|
-
var import_lucide_react67,
|
|
26339
|
+
var import_lucide_react67, import_react84, import_jsx_runtime111;
|
|
26304
26340
|
var init_SelectStep = __esm({
|
|
26305
26341
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
26306
26342
|
init_tokens();
|
|
26307
26343
|
init_i18n();
|
|
26308
26344
|
import_lucide_react67 = require("lucide-react");
|
|
26309
|
-
|
|
26345
|
+
import_react84 = require("react");
|
|
26310
26346
|
init_priceFormatter();
|
|
26311
26347
|
init_utils();
|
|
26312
26348
|
init_useExternalWalletStore();
|
|
@@ -26357,7 +26393,7 @@ var init_checkbox = __esm({
|
|
|
26357
26393
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
26358
26394
|
function ConfirmStep(props) {
|
|
26359
26395
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
26360
|
-
const [userConsent, setUserConsent] = (0,
|
|
26396
|
+
const [userConsent, setUserConsent] = (0, import_react85.useState)(false);
|
|
26361
26397
|
const { t } = useT();
|
|
26362
26398
|
const address = useSession((st) => st.address);
|
|
26363
26399
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -26473,13 +26509,13 @@ function ConfirmStep(props) {
|
|
|
26473
26509
|
}
|
|
26474
26510
|
);
|
|
26475
26511
|
}
|
|
26476
|
-
var import_lucide_react69,
|
|
26512
|
+
var import_lucide_react69, import_react85, import_jsx_runtime113, P_CN;
|
|
26477
26513
|
var init_ConfirmStep = __esm({
|
|
26478
26514
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
26479
26515
|
init_SessionContext();
|
|
26480
26516
|
init_i18n();
|
|
26481
26517
|
import_lucide_react69 = require("lucide-react");
|
|
26482
|
-
|
|
26518
|
+
import_react85 = require("react");
|
|
26483
26519
|
init_priceFormatter();
|
|
26484
26520
|
init_utils();
|
|
26485
26521
|
init_Onboarding();
|
|
@@ -26856,7 +26892,7 @@ function SelectAssetRoute(props) {
|
|
|
26856
26892
|
const { hyperlaneWarpRoutes } = props;
|
|
26857
26893
|
const { t } = useT();
|
|
26858
26894
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
26859
|
-
const tokenList = (0,
|
|
26895
|
+
const tokenList = (0, import_react86.useMemo)(() => {
|
|
26860
26896
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
26861
26897
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
26862
26898
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -26933,13 +26969,13 @@ function SelectAssetRoute(props) {
|
|
|
26933
26969
|
] })
|
|
26934
26970
|
] });
|
|
26935
26971
|
}
|
|
26936
|
-
var import_lucide_react71,
|
|
26972
|
+
var import_lucide_react71, import_react86, import_jsx_runtime116;
|
|
26937
26973
|
var init_SelectAssetRoute = __esm({
|
|
26938
26974
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
26939
26975
|
init_tokens();
|
|
26940
26976
|
init_i18n();
|
|
26941
26977
|
import_lucide_react71 = require("lucide-react");
|
|
26942
|
-
|
|
26978
|
+
import_react86 = require("react");
|
|
26943
26979
|
init_button();
|
|
26944
26980
|
init_ResolveChainIcon();
|
|
26945
26981
|
init_useBridgeStore();
|
|
@@ -26966,7 +27002,7 @@ function HyperlaneBridge() {
|
|
|
26966
27002
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
26967
27003
|
const { directWalletProfiles } = useAvailableSenders();
|
|
26968
27004
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
26969
|
-
(0,
|
|
27005
|
+
(0, import_react87.useEffect)(() => {
|
|
26970
27006
|
return () => {
|
|
26971
27007
|
useBridgeStore.getState().resetSelections();
|
|
26972
27008
|
};
|
|
@@ -26999,10 +27035,10 @@ function HyperlaneBridge() {
|
|
|
26999
27035
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(HistoryDetailsStep, {})
|
|
27000
27036
|
] });
|
|
27001
27037
|
}
|
|
27002
|
-
var
|
|
27038
|
+
var import_react87, import_jsx_runtime117;
|
|
27003
27039
|
var init_HyperlaneBridge = __esm({
|
|
27004
27040
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
27005
|
-
|
|
27041
|
+
import_react87 = require("react");
|
|
27006
27042
|
init_SenderSelector();
|
|
27007
27043
|
init_useAvailableSenders();
|
|
27008
27044
|
init_useBridge();
|
|
@@ -27020,7 +27056,7 @@ function BridgeHistorySwitch(props) {
|
|
|
27020
27056
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
27021
27057
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
27022
27058
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
27023
|
-
const lastBridgeStepRef = (0,
|
|
27059
|
+
const lastBridgeStepRef = (0, import_react88.useRef)(null);
|
|
27024
27060
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
27025
27061
|
return null;
|
|
27026
27062
|
}
|
|
@@ -27039,10 +27075,10 @@ function BridgeHistorySwitch(props) {
|
|
|
27039
27075
|
}
|
|
27040
27076
|
);
|
|
27041
27077
|
}
|
|
27042
|
-
var
|
|
27078
|
+
var import_react88, import_jsx_runtime118;
|
|
27043
27079
|
var init_HistorySwitch = __esm({
|
|
27044
27080
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
27045
|
-
|
|
27081
|
+
import_react88 = require("react");
|
|
27046
27082
|
init_switch();
|
|
27047
27083
|
init_useFlowSelector();
|
|
27048
27084
|
init_useBridgeStore();
|
|
@@ -27133,11 +27169,11 @@ function looksLikeNickname(input) {
|
|
|
27133
27169
|
}
|
|
27134
27170
|
function useNicknameResolve(input, options) {
|
|
27135
27171
|
const { enabled = true, chainId } = options;
|
|
27136
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
27137
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
27172
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react89.useState)("");
|
|
27173
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react89.useState)(false);
|
|
27138
27174
|
const normalized = normalizeNickname(input);
|
|
27139
27175
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
27140
|
-
(0,
|
|
27176
|
+
(0, import_react89.useEffect)(() => {
|
|
27141
27177
|
if (!isNicknameInput || !enabled) {
|
|
27142
27178
|
setDebouncedInput("");
|
|
27143
27179
|
setIsDebouncing(false);
|
|
@@ -27163,7 +27199,7 @@ function useNicknameResolve(input, options) {
|
|
|
27163
27199
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
27164
27200
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
27165
27201
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
27166
|
-
const fingerprintVerification = (0,
|
|
27202
|
+
const fingerprintVerification = (0, import_react89.useMemo)(() => {
|
|
27167
27203
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
27168
27204
|
return null;
|
|
27169
27205
|
}
|
|
@@ -27185,11 +27221,11 @@ function useNicknameResolve(input, options) {
|
|
|
27185
27221
|
resolvedAddress
|
|
27186
27222
|
};
|
|
27187
27223
|
}
|
|
27188
|
-
var import_react_query54,
|
|
27224
|
+
var import_react_query54, import_react89, DEBOUNCE_MS2;
|
|
27189
27225
|
var init_useNicknameResolve = __esm({
|
|
27190
27226
|
"src/hooks/useNicknameResolve.ts"() {
|
|
27191
27227
|
import_react_query54 = require("@tanstack/react-query");
|
|
27192
|
-
|
|
27228
|
+
import_react89 = require("react");
|
|
27193
27229
|
init_nickname();
|
|
27194
27230
|
init_profile();
|
|
27195
27231
|
init_nickname_fingerprint();
|
|
@@ -27202,10 +27238,10 @@ var init_useNicknameResolve = __esm({
|
|
|
27202
27238
|
function useSendTransaction() {
|
|
27203
27239
|
const session = useSession((st) => st.session);
|
|
27204
27240
|
const address = useSession((st) => st.address);
|
|
27205
|
-
const [isLoading, setIsLoading] = (0,
|
|
27206
|
-
const [error, setError] = (0,
|
|
27207
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
27208
|
-
const sendTransaction = (0,
|
|
27241
|
+
const [isLoading, setIsLoading] = (0, import_react90.useState)(false);
|
|
27242
|
+
const [error, setError] = (0, import_react90.useState)(null);
|
|
27243
|
+
const [userOpHash, setUserOpHash] = (0, import_react90.useState)(null);
|
|
27244
|
+
const sendTransaction = (0, import_react90.useCallback)(
|
|
27209
27245
|
async (params) => {
|
|
27210
27246
|
if (!session || !address) {
|
|
27211
27247
|
setError("No active session");
|
|
@@ -27302,7 +27338,7 @@ function useSendTransaction() {
|
|
|
27302
27338
|
},
|
|
27303
27339
|
[session, address]
|
|
27304
27340
|
);
|
|
27305
|
-
const reset = (0,
|
|
27341
|
+
const reset = (0, import_react90.useCallback)(() => {
|
|
27306
27342
|
setError(null);
|
|
27307
27343
|
setUserOpHash(null);
|
|
27308
27344
|
setIsLoading(false);
|
|
@@ -27315,10 +27351,10 @@ function useSendTransaction() {
|
|
|
27315
27351
|
reset
|
|
27316
27352
|
};
|
|
27317
27353
|
}
|
|
27318
|
-
var
|
|
27354
|
+
var import_react90, import_viem16, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
27319
27355
|
var init_useSendTransaction = __esm({
|
|
27320
27356
|
"src/hooks/useSendTransaction.ts"() {
|
|
27321
|
-
|
|
27357
|
+
import_react90 = require("react");
|
|
27322
27358
|
import_viem16 = require("viem");
|
|
27323
27359
|
init_SessionContext();
|
|
27324
27360
|
init_account2();
|
|
@@ -27469,7 +27505,7 @@ var init_AssetInputIcon = __esm({
|
|
|
27469
27505
|
|
|
27470
27506
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
27471
27507
|
function NftDisplayCard({ asset }) {
|
|
27472
|
-
const [imageError, setImageError] = (0,
|
|
27508
|
+
const [imageError, setImageError] = (0, import_react91.useState)(false);
|
|
27473
27509
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
27474
27510
|
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
27475
27511
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
@@ -27497,11 +27533,11 @@ function NftDisplayCard({ asset }) {
|
|
|
27497
27533
|
] })
|
|
27498
27534
|
] });
|
|
27499
27535
|
}
|
|
27500
|
-
var import_lucide_react73,
|
|
27536
|
+
var import_lucide_react73, import_react91, import_jsx_runtime120;
|
|
27501
27537
|
var init_NftDisplayCard = __esm({
|
|
27502
27538
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
27503
27539
|
import_lucide_react73 = require("lucide-react");
|
|
27504
|
-
|
|
27540
|
+
import_react91 = require("react");
|
|
27505
27541
|
import_jsx_runtime120 = require("react/jsx-runtime");
|
|
27506
27542
|
}
|
|
27507
27543
|
});
|
|
@@ -27621,7 +27657,7 @@ function NicknameData(props) {
|
|
|
27621
27657
|
isWalletNotSetup,
|
|
27622
27658
|
isFrozen
|
|
27623
27659
|
} = resolvedNicknameData;
|
|
27624
|
-
(0,
|
|
27660
|
+
(0, import_react92.useEffect)(() => {
|
|
27625
27661
|
if (isResolving) return;
|
|
27626
27662
|
let errMessage = null;
|
|
27627
27663
|
switch (true) {
|
|
@@ -27676,11 +27712,11 @@ function NicknameData(props) {
|
|
|
27676
27712
|
] })
|
|
27677
27713
|
] });
|
|
27678
27714
|
}
|
|
27679
|
-
var import_lucide_react74,
|
|
27715
|
+
var import_lucide_react74, import_react92, import_jsx_runtime122;
|
|
27680
27716
|
var init_NicknameData = __esm({
|
|
27681
27717
|
"src/internal/components/SendMenu/send/components/NicknameData.tsx"() {
|
|
27682
27718
|
import_lucide_react74 = require("lucide-react");
|
|
27683
|
-
|
|
27719
|
+
import_react92 = require("react");
|
|
27684
27720
|
init_no_image();
|
|
27685
27721
|
init_utils();
|
|
27686
27722
|
init_useFlowSelector();
|
|
@@ -28213,16 +28249,16 @@ function SendMenu() {
|
|
|
28213
28249
|
userOpHash,
|
|
28214
28250
|
reset
|
|
28215
28251
|
} = useSendTransaction();
|
|
28216
|
-
(0,
|
|
28252
|
+
(0, import_react93.useEffect)(() => {
|
|
28217
28253
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
28218
28254
|
}, [isAssetsLoading, isTransactionPending]);
|
|
28219
|
-
(0,
|
|
28255
|
+
(0, import_react93.useEffect)(() => {
|
|
28220
28256
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
28221
28257
|
}, [sendTransactionError]);
|
|
28222
28258
|
const { txStep, recipient, amount, selectedAsset, setSelectedAsset } = useSendStore();
|
|
28223
28259
|
const isNft = isNftAsset3(selectedAsset);
|
|
28224
28260
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
28225
|
-
(0,
|
|
28261
|
+
(0, import_react93.useEffect)(() => {
|
|
28226
28262
|
const shouldDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
28227
28263
|
if (!shouldDefaultAsset) return;
|
|
28228
28264
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -28232,7 +28268,7 @@ function SendMenu() {
|
|
|
28232
28268
|
if (isBalance(erc20)) return setSelectedAsset(erc20);
|
|
28233
28269
|
setSelectedAsset(assets[0]);
|
|
28234
28270
|
}, [assets, selectedAsset]);
|
|
28235
|
-
(0,
|
|
28271
|
+
(0, import_react93.useEffect)(
|
|
28236
28272
|
() => () => {
|
|
28237
28273
|
useSendStore.getState().reset();
|
|
28238
28274
|
reset();
|
|
@@ -28242,7 +28278,7 @@ function SendMenu() {
|
|
|
28242
28278
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
28243
28279
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
28244
28280
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
28245
|
-
const complianceAmount = (0,
|
|
28281
|
+
const complianceAmount = (0, import_react93.useMemo)(() => {
|
|
28246
28282
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
28247
28283
|
try {
|
|
28248
28284
|
return (0, import_viem21.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -28257,7 +28293,7 @@ function SendMenu() {
|
|
|
28257
28293
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
28258
28294
|
chainId: activeChainId
|
|
28259
28295
|
});
|
|
28260
|
-
(0,
|
|
28296
|
+
(0, import_react93.useEffect)(() => {
|
|
28261
28297
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
28262
28298
|
switch (true) {
|
|
28263
28299
|
case txStep === "select-asset":
|
|
@@ -28327,7 +28363,7 @@ function SendMenu() {
|
|
|
28327
28363
|
] })
|
|
28328
28364
|
] });
|
|
28329
28365
|
}
|
|
28330
|
-
var import_lucide_react77,
|
|
28366
|
+
var import_lucide_react77, import_react93, import_viem21, import_jsx_runtime125;
|
|
28331
28367
|
var init_SendMenu = __esm({
|
|
28332
28368
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
28333
28369
|
init_SessionContext();
|
|
@@ -28336,7 +28372,7 @@ var init_SendMenu = __esm({
|
|
|
28336
28372
|
init_useSendTransaction();
|
|
28337
28373
|
init_useT();
|
|
28338
28374
|
import_lucide_react77 = require("lucide-react");
|
|
28339
|
-
|
|
28375
|
+
import_react93 = require("react");
|
|
28340
28376
|
import_viem21 = require("viem");
|
|
28341
28377
|
init_useBlockscoutAssets2();
|
|
28342
28378
|
init_useLayoutDataStore();
|
|
@@ -28362,7 +28398,7 @@ var init_send = __esm({
|
|
|
28362
28398
|
// src/internal/components/SendMenu/useSendMenuParams.ts
|
|
28363
28399
|
function useSendMenuParams() {
|
|
28364
28400
|
const { config } = useProviderConfig();
|
|
28365
|
-
(0,
|
|
28401
|
+
(0, import_react94.useEffect)(() => {
|
|
28366
28402
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
28367
28403
|
if (!pageParams || !(0, import_lodash_es15.keys)(pageParams).length) return;
|
|
28368
28404
|
const { sendFlow, send, bridge } = pageParams || {};
|
|
@@ -28415,12 +28451,12 @@ function useSendMenuParams() {
|
|
|
28415
28451
|
setPageParams(null);
|
|
28416
28452
|
}, []);
|
|
28417
28453
|
}
|
|
28418
|
-
var import_lodash_es15,
|
|
28454
|
+
var import_lodash_es15, import_react94;
|
|
28419
28455
|
var init_useSendMenuParams = __esm({
|
|
28420
28456
|
"src/internal/components/SendMenu/useSendMenuParams.ts"() {
|
|
28421
28457
|
init_ProviderContext();
|
|
28422
28458
|
import_lodash_es15 = require("lodash-es");
|
|
28423
|
-
|
|
28459
|
+
import_react94 = require("react");
|
|
28424
28460
|
init_useLayoutDataStore();
|
|
28425
28461
|
init_useBridgeStore();
|
|
28426
28462
|
init_useSendStore();
|
|
@@ -28488,17 +28524,17 @@ function SendFlowSelector() {
|
|
|
28488
28524
|
const sendStep = useSendStore((st) => st.txStep);
|
|
28489
28525
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
28490
28526
|
useOnboardingTourAvailable(sendStep === "input" && bridgeStep === "select");
|
|
28491
|
-
(0,
|
|
28527
|
+
(0, import_react95.useEffect)(
|
|
28492
28528
|
() => () => {
|
|
28493
28529
|
useFlowSelectorStore.getState().setError(null);
|
|
28494
28530
|
},
|
|
28495
28531
|
[]
|
|
28496
28532
|
);
|
|
28497
|
-
(0,
|
|
28533
|
+
(0, import_react95.useEffect)(() => {
|
|
28498
28534
|
if (!!config?.current?.features?.showAssetBridge) return;
|
|
28499
28535
|
if (selectorFlow === "bridge") useFlowSelectorStore.getState().setFlow("send");
|
|
28500
28536
|
}, [selectorFlow]);
|
|
28501
|
-
const availableFlows = (0,
|
|
28537
|
+
const availableFlows = (0, import_react95.useMemo)(() => {
|
|
28502
28538
|
const selectorFlows = { send: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(SendMenu, {}) };
|
|
28503
28539
|
if (!!config?.current?.features?.showAssetBridge) selectorFlows.bridge = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(HyperlaneBridge, {});
|
|
28504
28540
|
return selectorFlows;
|
|
@@ -28563,13 +28599,13 @@ function SendFlowSelector() {
|
|
|
28563
28599
|
] })
|
|
28564
28600
|
] });
|
|
28565
28601
|
}
|
|
28566
|
-
var import_lucide_react78,
|
|
28602
|
+
var import_lucide_react78, import_react95, import_jsx_runtime126;
|
|
28567
28603
|
var init_SendFlowSelector = __esm({
|
|
28568
28604
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
28569
28605
|
init_ProviderContext();
|
|
28570
28606
|
init_i18n();
|
|
28571
28607
|
import_lucide_react78 = require("lucide-react");
|
|
28572
|
-
|
|
28608
|
+
import_react95 = require("react");
|
|
28573
28609
|
init_useLayoutDataStore();
|
|
28574
28610
|
init_utils();
|
|
28575
28611
|
init_Expandable2();
|
|
@@ -28632,12 +28668,12 @@ function getServerSnapshot() {
|
|
|
28632
28668
|
return false;
|
|
28633
28669
|
}
|
|
28634
28670
|
function useProMode() {
|
|
28635
|
-
return (0,
|
|
28671
|
+
return (0, import_react96.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
28636
28672
|
}
|
|
28637
|
-
var
|
|
28673
|
+
var import_react96, STORAGE_KEY, EVENT_NAME;
|
|
28638
28674
|
var init_pro_mode = __esm({
|
|
28639
28675
|
"src/internal/lib/pro-mode.ts"() {
|
|
28640
|
-
|
|
28676
|
+
import_react96 = require("react");
|
|
28641
28677
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
28642
28678
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
28643
28679
|
}
|
|
@@ -29443,7 +29479,7 @@ function TransactionsMenu() {
|
|
|
29443
29479
|
const { t } = useT();
|
|
29444
29480
|
useOnboardingTourAvailable(true);
|
|
29445
29481
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
29446
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
29482
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react97.useState)({});
|
|
29447
29483
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
29448
29484
|
const {
|
|
29449
29485
|
data: txHistoryGroups = [],
|
|
@@ -29456,7 +29492,7 @@ function TransactionsMenu() {
|
|
|
29456
29492
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
29457
29493
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
29458
29494
|
});
|
|
29459
|
-
const refreshTxHistory = (0,
|
|
29495
|
+
const refreshTxHistory = (0, import_react97.useCallback)(
|
|
29460
29496
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
29461
29497
|
[qc, chainConfig.id, address]
|
|
29462
29498
|
);
|
|
@@ -29495,14 +29531,14 @@ function TransactionsMenu() {
|
|
|
29495
29531
|
)) })
|
|
29496
29532
|
] });
|
|
29497
29533
|
}
|
|
29498
|
-
var import_react_query57, import_lucide_react80,
|
|
29534
|
+
var import_react_query57, import_lucide_react80, import_react97, import_jsx_runtime128;
|
|
29499
29535
|
var init_TransactionsMenu = __esm({
|
|
29500
29536
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
29501
29537
|
init_SessionContext();
|
|
29502
29538
|
init_i18n();
|
|
29503
29539
|
import_react_query57 = require("@tanstack/react-query");
|
|
29504
29540
|
import_lucide_react80 = require("lucide-react");
|
|
29505
|
-
|
|
29541
|
+
import_react97 = require("react");
|
|
29506
29542
|
init_useLayoutDataStore();
|
|
29507
29543
|
init_Expandable2();
|
|
29508
29544
|
init_Onboarding();
|
|
@@ -29842,7 +29878,7 @@ var init_PageMap = __esm({
|
|
|
29842
29878
|
// src/internal/hooks/usePageMapper.tsx
|
|
29843
29879
|
function usePageMapper() {
|
|
29844
29880
|
const page = useLayoutDataStore((st) => st.page);
|
|
29845
|
-
const closeDialog = (0,
|
|
29881
|
+
const closeDialog = (0, import_react98.useCallback)(() => {
|
|
29846
29882
|
useLayoutStore.setState({ isDialogAnimating: true });
|
|
29847
29883
|
setTimeout(() => {
|
|
29848
29884
|
useLayoutStore.setState({
|
|
@@ -29854,14 +29890,14 @@ function usePageMapper() {
|
|
|
29854
29890
|
});
|
|
29855
29891
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
29856
29892
|
}, []);
|
|
29857
|
-
const openDialog = (0,
|
|
29893
|
+
const openDialog = (0, import_react98.useCallback)((pageItem) => {
|
|
29858
29894
|
useLayoutStore.setState({
|
|
29859
29895
|
dialogContent: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(pageItem.component, {}),
|
|
29860
29896
|
isDialogOpen: true
|
|
29861
29897
|
// isDialogAnimating: true
|
|
29862
29898
|
});
|
|
29863
29899
|
}, []);
|
|
29864
|
-
(0,
|
|
29900
|
+
(0, import_react98.useEffect)(() => {
|
|
29865
29901
|
if (page === null) return closeDialog();
|
|
29866
29902
|
const pageItem = PAGE_MAP[page];
|
|
29867
29903
|
if (!pageItem) {
|
|
@@ -29872,10 +29908,10 @@ function usePageMapper() {
|
|
|
29872
29908
|
openDialog(pageItem);
|
|
29873
29909
|
}, [page, closeDialog, openDialog]);
|
|
29874
29910
|
}
|
|
29875
|
-
var
|
|
29911
|
+
var import_react98, import_jsx_runtime130, CLEAR_DIALOG_TIMEOUT;
|
|
29876
29912
|
var init_usePageMapper = __esm({
|
|
29877
29913
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
29878
|
-
|
|
29914
|
+
import_react98 = require("react");
|
|
29879
29915
|
init_PageMap();
|
|
29880
29916
|
init_constants();
|
|
29881
29917
|
init_useLayoutDataStore();
|
|
@@ -29891,24 +29927,24 @@ function useSettingsNotifications() {
|
|
|
29891
29927
|
const providers = import_auth25.jwtTokenManager.getProviders();
|
|
29892
29928
|
const hasEmail = providers.includes("email");
|
|
29893
29929
|
const { data: userProfile = null } = useUserProfile();
|
|
29894
|
-
(0,
|
|
29930
|
+
(0, import_react99.useEffect)(() => {
|
|
29895
29931
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
29896
29932
|
setSettingsNotifications({
|
|
29897
29933
|
...COMPLETE_KYC_PROGRESS,
|
|
29898
29934
|
status: isKYCVerified ? "resolved" : "active"
|
|
29899
29935
|
});
|
|
29900
29936
|
}, [userProfile, setSettingsNotifications]);
|
|
29901
|
-
(0,
|
|
29937
|
+
(0, import_react99.useEffect)(() => {
|
|
29902
29938
|
setSettingsNotifications({
|
|
29903
29939
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
29904
29940
|
status: hasEmail ? "resolved" : "active"
|
|
29905
29941
|
});
|
|
29906
29942
|
}, [hasEmail, setSettingsNotifications]);
|
|
29907
29943
|
}
|
|
29908
|
-
var
|
|
29944
|
+
var import_react99, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
29909
29945
|
var init_useSettingsNotifications = __esm({
|
|
29910
29946
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
29911
|
-
|
|
29947
|
+
import_react99 = require("react");
|
|
29912
29948
|
init_auth();
|
|
29913
29949
|
init_useLayoutDataStore();
|
|
29914
29950
|
init_useUserProfile();
|
|
@@ -29931,7 +29967,7 @@ var init_package = __esm({
|
|
|
29931
29967
|
"package.json"() {
|
|
29932
29968
|
package_default = {
|
|
29933
29969
|
name: "@embarkai/ui-kit",
|
|
29934
|
-
version: "0.4.
|
|
29970
|
+
version: "0.4.102",
|
|
29935
29971
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
29936
29972
|
type: "module",
|
|
29937
29973
|
main: "./dist/index.cjs",
|
|
@@ -29988,6 +30024,7 @@ var init_package = __esm({
|
|
|
29988
30024
|
"dkls23-wasm": "^0.1.1",
|
|
29989
30025
|
"lodash-es": "^4.18.1",
|
|
29990
30026
|
"lucide-react": "^1.28.0",
|
|
30027
|
+
mipd: "^0.0.7",
|
|
29991
30028
|
motion: "^13.1.1",
|
|
29992
30029
|
qrcode: "^1.5.4",
|
|
29993
30030
|
viem: "^2.52.2",
|
|
@@ -30265,11 +30302,11 @@ function Header() {
|
|
|
30265
30302
|
const embarkPage = useLayoutDataStore((st) => st.page);
|
|
30266
30303
|
const isOnboardingTourAvailable = useOnboardingStore((st) => st.isTourAvailable);
|
|
30267
30304
|
const proMode = useProMode();
|
|
30268
|
-
const [proToast, setProToast] = (0,
|
|
30269
|
-
const [copied, setCopied] = (0,
|
|
30270
|
-
const clickCountRef = (0,
|
|
30271
|
-
const clickTimerRef = (0,
|
|
30272
|
-
const handleAvatarClick = (0,
|
|
30305
|
+
const [proToast, setProToast] = (0, import_react100.useState)(false);
|
|
30306
|
+
const [copied, setCopied] = (0, import_react100.useState)(false);
|
|
30307
|
+
const clickCountRef = (0, import_react100.useRef)(0);
|
|
30308
|
+
const clickTimerRef = (0, import_react100.useRef)(null);
|
|
30309
|
+
const handleAvatarClick = (0, import_react100.useCallback)(() => {
|
|
30273
30310
|
clickCountRef.current += 1;
|
|
30274
30311
|
if (clickTimerRef.current) {
|
|
30275
30312
|
clearTimeout(clickTimerRef.current);
|
|
@@ -30375,7 +30412,7 @@ function Header() {
|
|
|
30375
30412
|
}
|
|
30376
30413
|
);
|
|
30377
30414
|
}
|
|
30378
|
-
var import_lucide_react84,
|
|
30415
|
+
var import_lucide_react84, import_react100, import_jsx_runtime132;
|
|
30379
30416
|
var init_Header = __esm({
|
|
30380
30417
|
"src/internal/components/Header/Header.tsx"() {
|
|
30381
30418
|
init_lumia2();
|
|
@@ -30383,7 +30420,7 @@ var init_Header = __esm({
|
|
|
30383
30420
|
init_ProviderContext();
|
|
30384
30421
|
init_SessionContext();
|
|
30385
30422
|
import_lucide_react84 = require("lucide-react");
|
|
30386
|
-
|
|
30423
|
+
import_react100 = require("react");
|
|
30387
30424
|
init_icons();
|
|
30388
30425
|
init_auth();
|
|
30389
30426
|
init_useLayoutDataStore();
|
|
@@ -30418,7 +30455,7 @@ function useDecideContentStyles() {
|
|
|
30418
30455
|
style: (0, import_lodash_es16.merge)({}, mobileStyles)
|
|
30419
30456
|
};
|
|
30420
30457
|
}
|
|
30421
|
-
var DialogPrimitive, import_lodash_es16, import_lucide_react85,
|
|
30458
|
+
var DialogPrimitive, import_lodash_es16, import_lucide_react85, import_react101, import_jsx_runtime133, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
30422
30459
|
var init_dialog = __esm({
|
|
30423
30460
|
"src/internal/components/ui/dialog.tsx"() {
|
|
30424
30461
|
init_utils();
|
|
@@ -30427,14 +30464,14 @@ var init_dialog = __esm({
|
|
|
30427
30464
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
30428
30465
|
import_lodash_es16 = require("lodash-es");
|
|
30429
30466
|
import_lucide_react85 = require("lucide-react");
|
|
30430
|
-
|
|
30467
|
+
import_react101 = require("react");
|
|
30431
30468
|
init_useLayoutDataStore();
|
|
30432
30469
|
init_useLayoutStore();
|
|
30433
30470
|
init_button();
|
|
30434
30471
|
import_jsx_runtime133 = require("react/jsx-runtime");
|
|
30435
30472
|
Dialog = DialogPrimitive.Root;
|
|
30436
30473
|
DialogPortal = DialogPrimitive.Portal;
|
|
30437
|
-
DialogOverlay = (0,
|
|
30474
|
+
DialogOverlay = (0, import_react101.forwardRef)(
|
|
30438
30475
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30439
30476
|
DialogPrimitive.Overlay,
|
|
30440
30477
|
{
|
|
@@ -30456,7 +30493,7 @@ var init_dialog = __esm({
|
|
|
30456
30493
|
border: "1px solid var(--ui-kit-bd)",
|
|
30457
30494
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
30458
30495
|
};
|
|
30459
|
-
DialogContent = (0,
|
|
30496
|
+
DialogContent = (0, import_react101.forwardRef)(
|
|
30460
30497
|
({ className, children, colorMode, ...props }, ref) => {
|
|
30461
30498
|
const { t, i18n } = useT();
|
|
30462
30499
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -30567,7 +30604,7 @@ var init_dialog = __esm({
|
|
|
30567
30604
|
DialogHeader.displayName = "DialogHeader";
|
|
30568
30605
|
DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: cn2("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
|
|
30569
30606
|
DialogFooter.displayName = "DialogFooter";
|
|
30570
|
-
DialogTitle = (0,
|
|
30607
|
+
DialogTitle = (0, import_react101.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30571
30608
|
DialogPrimitive.Title,
|
|
30572
30609
|
{
|
|
30573
30610
|
ref,
|
|
@@ -30576,7 +30613,7 @@ var init_dialog = __esm({
|
|
|
30576
30613
|
}
|
|
30577
30614
|
));
|
|
30578
30615
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
30579
|
-
DialogDescription = (0,
|
|
30616
|
+
DialogDescription = (0, import_react101.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DialogPrimitive.Description, { ref, className: cn2("text-sm text-muted-foreground", className), ...props }));
|
|
30580
30617
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
30581
30618
|
}
|
|
30582
30619
|
});
|
|
@@ -30599,7 +30636,7 @@ function Dialog2() {
|
|
|
30599
30636
|
const { colorMode, maxScrollHeight, isDialogOpen, dialogContent, isDialogForced } = useLayoutStore();
|
|
30600
30637
|
const page = useLayoutDataStore((st) => st.page);
|
|
30601
30638
|
const transitionPageHeight = useLayoutDataStore((st) => st.transitionPageHeight);
|
|
30602
|
-
(0,
|
|
30639
|
+
(0, import_react103.useEffect)(() => useLayoutStore.setState({ isSettings: !!session }), [session]);
|
|
30603
30640
|
usePageMapper();
|
|
30604
30641
|
useAutoConnect();
|
|
30605
30642
|
useBackupStatusChanges();
|
|
@@ -30629,8 +30666,8 @@ function Dialog2() {
|
|
|
30629
30666
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DialogTitle, { children: "embarkAI" }) }),
|
|
30630
30667
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DialogDescription, { className: "sr-only", children: "embarkAI wallet" }),
|
|
30631
30668
|
!isHeaderHidden && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Header, {}),
|
|
30632
|
-
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
30633
|
-
|
|
30669
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_react102.AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
30670
|
+
import_react102.motion.div,
|
|
30634
30671
|
{
|
|
30635
30672
|
style: { overflow: "hidden" },
|
|
30636
30673
|
initial: { opacity: 0, height: transitionPageHeight },
|
|
@@ -30659,13 +30696,13 @@ function Dialog2() {
|
|
|
30659
30696
|
}
|
|
30660
30697
|
);
|
|
30661
30698
|
}
|
|
30662
|
-
var
|
|
30699
|
+
var import_react102, import_react103, import_jsx_runtime135;
|
|
30663
30700
|
var init_Dialog = __esm({
|
|
30664
30701
|
"src/internal/components/Dialog/Dialog.tsx"() {
|
|
30665
30702
|
init_ProviderContext();
|
|
30666
30703
|
init_SessionContext();
|
|
30667
|
-
|
|
30668
|
-
|
|
30704
|
+
import_react102 = require("motion/react");
|
|
30705
|
+
import_react103 = require("react");
|
|
30669
30706
|
init_constants();
|
|
30670
30707
|
init_useAutoConnect();
|
|
30671
30708
|
init_useBackupStatusChanges();
|
|
@@ -30697,12 +30734,12 @@ function DirectWalletHandler() {
|
|
|
30697
30734
|
const externalAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
30698
30735
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
30699
30736
|
const { address, isConnected, chain, connector } = (0, import_wagmi9.useConnection)();
|
|
30700
|
-
(0,
|
|
30737
|
+
(0, import_react104.useEffect)(() => {
|
|
30701
30738
|
const { setConfigMode, setActiveMode } = useExternalWalletStore.getState();
|
|
30702
30739
|
setConfigMode(walletMode);
|
|
30703
30740
|
if (walletMode !== "both") setActiveMode(walletMode);
|
|
30704
30741
|
}, [walletMode]);
|
|
30705
|
-
(0,
|
|
30742
|
+
(0, import_react104.useEffect)(() => {
|
|
30706
30743
|
if ((!!externalAddress || isExternalConnected) && !isConnected) {
|
|
30707
30744
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
30708
30745
|
return;
|
|
@@ -30717,10 +30754,10 @@ function DirectWalletHandler() {
|
|
|
30717
30754
|
}, [isConnected, address, isExternalConnected, externalAddress, connector, chain]);
|
|
30718
30755
|
return null;
|
|
30719
30756
|
}
|
|
30720
|
-
var
|
|
30757
|
+
var import_react104, import_wagmi9;
|
|
30721
30758
|
var init_DirectWalletHandler = __esm({
|
|
30722
30759
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
30723
|
-
|
|
30760
|
+
import_react104 = require("react");
|
|
30724
30761
|
import_wagmi9 = require("wagmi");
|
|
30725
30762
|
init_ProviderContext();
|
|
30726
30763
|
init_useExternalWalletStore();
|
|
@@ -30728,14 +30765,14 @@ var init_DirectWalletHandler = __esm({
|
|
|
30728
30765
|
});
|
|
30729
30766
|
|
|
30730
30767
|
// src/internal/components/TssManager.tsx
|
|
30731
|
-
var
|
|
30768
|
+
var import_react105, TssManagerWithRef;
|
|
30732
30769
|
var init_TssManager = __esm({
|
|
30733
30770
|
"src/internal/components/TssManager.tsx"() {
|
|
30734
30771
|
init_SessionContext();
|
|
30735
|
-
|
|
30772
|
+
import_react105 = __toESM(require("react"), 1);
|
|
30736
30773
|
init_auth();
|
|
30737
30774
|
init_clients();
|
|
30738
|
-
TssManagerWithRef =
|
|
30775
|
+
TssManagerWithRef = import_react105.default.forwardRef((props, ref) => {
|
|
30739
30776
|
const { mpcPin } = props;
|
|
30740
30777
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
30741
30778
|
const publicClient = useSession((st) => st.publicClient);
|
|
@@ -30743,14 +30780,14 @@ var init_TssManager = __esm({
|
|
|
30743
30780
|
const setStatus = useSession((st) => st.setStatus);
|
|
30744
30781
|
const setSession = useSession((st) => st.setSession);
|
|
30745
30782
|
const setAddress = useSession((st) => st.setAddress);
|
|
30746
|
-
const onSessionCreated = (0,
|
|
30783
|
+
const onSessionCreated = (0, import_react105.useCallback)(
|
|
30747
30784
|
(session, address) => {
|
|
30748
30785
|
setSession(session);
|
|
30749
30786
|
setAddress(address);
|
|
30750
30787
|
},
|
|
30751
30788
|
[setSession, setAddress]
|
|
30752
30789
|
);
|
|
30753
|
-
const createSessionWithKeyshare =
|
|
30790
|
+
const createSessionWithKeyshare = import_react105.default.useCallback(
|
|
30754
30791
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
30755
30792
|
setStatus("checking key management setup...");
|
|
30756
30793
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -30775,7 +30812,7 @@ var init_TssManager = __esm({
|
|
|
30775
30812
|
},
|
|
30776
30813
|
[setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
|
|
30777
30814
|
);
|
|
30778
|
-
|
|
30815
|
+
import_react105.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
30779
30816
|
return null;
|
|
30780
30817
|
});
|
|
30781
30818
|
}
|
|
@@ -30799,7 +30836,7 @@ function waitForStoreHydration() {
|
|
|
30799
30836
|
}
|
|
30800
30837
|
function SessionProvider({ children }) {
|
|
30801
30838
|
const config = useProviderConfig().config;
|
|
30802
|
-
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
|
|
30839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_react106.Fragment, {
|
|
30803
30840
|
/** dApp's router might have its own error boundaries setup via imported @embarkai/ui-kitErrorBoundary */
|
|
30804
30841
|
children: [
|
|
30805
30842
|
children,
|
|
@@ -30819,11 +30856,11 @@ function SessionProvider({ children }) {
|
|
|
30819
30856
|
]
|
|
30820
30857
|
});
|
|
30821
30858
|
}
|
|
30822
|
-
var import_read22,
|
|
30859
|
+
var import_read22, import_react106, import_zustand19, import_middleware5, import_jsx_runtime136, useSession, requireActiveChainId;
|
|
30823
30860
|
var init_SessionContext = __esm({
|
|
30824
30861
|
"src/context/SessionContext.tsx"() {
|
|
30825
30862
|
import_read22 = require("@embarkai/core/read");
|
|
30826
|
-
|
|
30863
|
+
import_react106 = require("react");
|
|
30827
30864
|
import_zustand19 = require("zustand");
|
|
30828
30865
|
import_middleware5 = require("zustand/middleware");
|
|
30829
30866
|
init_ErrorBoundary2();
|
|
@@ -33278,10 +33315,11 @@ function clearLegacyWagmiStorage() {
|
|
|
33278
33315
|
}
|
|
33279
33316
|
function Provider(props) {
|
|
33280
33317
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
33281
|
-
const callbacksRef = (0,
|
|
33282
|
-
(0,
|
|
33283
|
-
const config = (0,
|
|
33284
|
-
const
|
|
33318
|
+
const callbacksRef = (0, import_react107.useRef)(callbacks);
|
|
33319
|
+
(0, import_react107.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
33320
|
+
const config = (0, import_react107.useRef)((0, import_lodash_es17.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
33321
|
+
const wagmiConfig3 = (0, import_react107.useRef)((0, import_core9.getWagmiConfig)(config.current?.wallet?.walletConnectId || null));
|
|
33322
|
+
const updateConfig = (0, import_react107.useCallback)((updates) => {
|
|
33285
33323
|
const prev = config.current;
|
|
33286
33324
|
const next = { ...prev };
|
|
33287
33325
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -33315,12 +33353,12 @@ function Provider(props) {
|
|
|
33315
33353
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
33316
33354
|
config.current = next;
|
|
33317
33355
|
}, []);
|
|
33318
|
-
const updateCallbacks = (0,
|
|
33356
|
+
const updateCallbacks = (0, import_react107.useCallback)((updates) => {
|
|
33319
33357
|
const prev = callbacksRef.current;
|
|
33320
33358
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
33321
33359
|
callbacksRef.current = next;
|
|
33322
33360
|
}, []);
|
|
33323
|
-
(0,
|
|
33361
|
+
(0, import_react107.useEffect)(() => {
|
|
33324
33362
|
if (typeof window === "undefined" || !projectId) return;
|
|
33325
33363
|
const mergedConfig = (0, import_lodash_es17.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
33326
33364
|
updateConfig(mergedConfig);
|
|
@@ -33340,7 +33378,7 @@ function Provider(props) {
|
|
|
33340
33378
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
33341
33379
|
}
|
|
33342
33380
|
}, [projectId, initialConfig]);
|
|
33343
|
-
(0,
|
|
33381
|
+
(0, import_react107.useEffect)(() => {
|
|
33344
33382
|
if (typeof window === "undefined" || !projectId) return;
|
|
33345
33383
|
try {
|
|
33346
33384
|
(0, import_error_tracking4.initSdkErrorTracking)();
|
|
@@ -33369,7 +33407,7 @@ function Provider(props) {
|
|
|
33369
33407
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
33370
33408
|
}
|
|
33371
33409
|
}, [projectId]);
|
|
33372
|
-
const contextValue = (0,
|
|
33410
|
+
const contextValue = (0, import_react107.useMemo)(
|
|
33373
33411
|
() => ({
|
|
33374
33412
|
config,
|
|
33375
33413
|
updateConfig,
|
|
@@ -33380,34 +33418,24 @@ function Provider(props) {
|
|
|
33380
33418
|
}),
|
|
33381
33419
|
[config, updateConfig, callbacks, updateCallbacks]
|
|
33382
33420
|
);
|
|
33383
|
-
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
33384
|
-
import_wagmi10.WagmiProvider,
|
|
33385
|
-
{
|
|
33386
|
-
config: (0, import_wagmi10.createConfig)({
|
|
33387
|
-
chains: import_core9.WAGMI_CONFIG_CHAINS,
|
|
33388
|
-
connectors: (0, import_core9.getWagmiConnectors)(config.current?.wallet?.walletConnectId || null),
|
|
33389
|
-
transports: import_core9.WAGMI_CONFIG_TRANSPORTS
|
|
33390
|
-
}),
|
|
33391
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(SessionProvider, { children })
|
|
33392
|
-
}
|
|
33393
|
-
) });
|
|
33421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_wagmi10.WagmiProvider, { config: wagmiConfig3.current, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(SessionProvider, { children }) }) });
|
|
33394
33422
|
}
|
|
33395
|
-
var import_core9, import_error_tracking4, import_lodash_es17,
|
|
33423
|
+
var import_core9, import_error_tracking4, import_lodash_es17, import_react107, import_wagmi10, import_jsx_runtime137, UIContext, useProviderConfig;
|
|
33396
33424
|
var init_ProviderContext = __esm({
|
|
33397
33425
|
"src/context/ProviderContext.tsx"() {
|
|
33398
33426
|
import_core9 = require("@embarkai/core");
|
|
33399
33427
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
33400
33428
|
import_lodash_es17 = require("lodash-es");
|
|
33401
|
-
|
|
33429
|
+
import_react107 = require("react");
|
|
33402
33430
|
import_wagmi10 = require("wagmi");
|
|
33403
33431
|
init_initial();
|
|
33404
33432
|
init_iframe_manager();
|
|
33405
33433
|
init_SessionContext();
|
|
33406
33434
|
init_utils14();
|
|
33407
33435
|
import_jsx_runtime137 = require("react/jsx-runtime");
|
|
33408
|
-
UIContext = (0,
|
|
33436
|
+
UIContext = (0, import_react107.createContext)(void 0);
|
|
33409
33437
|
useProviderConfig = () => {
|
|
33410
|
-
const ctx = (0,
|
|
33438
|
+
const ctx = (0, import_react107.useContext)(UIContext);
|
|
33411
33439
|
if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
|
|
33412
33440
|
return ctx;
|
|
33413
33441
|
};
|
|
@@ -33530,7 +33558,7 @@ init_ErrorBoundary2();
|
|
|
33530
33558
|
init_lumia2();
|
|
33531
33559
|
init_embarkAI2();
|
|
33532
33560
|
var import_lucide_react86 = require("lucide-react");
|
|
33533
|
-
var
|
|
33561
|
+
var import_react108 = require("react");
|
|
33534
33562
|
init_SessionContext();
|
|
33535
33563
|
init_auth();
|
|
33536
33564
|
init_BalanceView2();
|
|
@@ -33563,10 +33591,10 @@ function ConnectWalletButton(props) {
|
|
|
33563
33591
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
33564
33592
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
33565
33593
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
33566
|
-
(0,
|
|
33594
|
+
(0, import_react108.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
33567
33595
|
const { data: profile, isLoading: isProfileLoading } = useUserProfile();
|
|
33568
33596
|
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth25.jwtTokenManager.getDisplayName();
|
|
33569
|
-
const indicators = (0,
|
|
33597
|
+
const indicators = (0, import_react108.useMemo)(() => {
|
|
33570
33598
|
const userId = session?.mpcUserId;
|
|
33571
33599
|
if (!userId) return { server: false, local: false, backup: false };
|
|
33572
33600
|
const server = import_auth25.jwtTokenManager.getHasKeyshare() ?? false;
|
|
@@ -34205,14 +34233,14 @@ var Hash = ({
|
|
|
34205
34233
|
};
|
|
34206
34234
|
|
|
34207
34235
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
34208
|
-
var
|
|
34236
|
+
var import_react109 = require("react");
|
|
34209
34237
|
init_base3();
|
|
34210
34238
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
34211
34239
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
34212
|
-
const [transactions, setTransactions] = (0,
|
|
34213
|
-
const [loading, setLoading] = (0,
|
|
34214
|
-
const [error, setError] = (0,
|
|
34215
|
-
(0,
|
|
34240
|
+
const [transactions, setTransactions] = (0, import_react109.useState)([]);
|
|
34241
|
+
const [loading, setLoading] = (0, import_react109.useState)(true);
|
|
34242
|
+
const [error, setError] = (0, import_react109.useState)(null);
|
|
34243
|
+
(0, import_react109.useEffect)(() => {
|
|
34216
34244
|
const fetchTransactions2 = async () => {
|
|
34217
34245
|
try {
|
|
34218
34246
|
setLoading(true);
|
|
@@ -34503,13 +34531,13 @@ function useUserOpStatus(options = {}) {
|
|
|
34503
34531
|
init_useErc3643Compliance();
|
|
34504
34532
|
|
|
34505
34533
|
// src/hooks/useWalletMode.ts
|
|
34506
|
-
var
|
|
34534
|
+
var import_react110 = require("react");
|
|
34507
34535
|
init_useExternalWalletStore();
|
|
34508
34536
|
function useWalletMode() {
|
|
34509
34537
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
34510
34538
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
34511
34539
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
34512
|
-
const switchMode = (0,
|
|
34540
|
+
const switchMode = (0, import_react110.useCallback)(
|
|
34513
34541
|
(mode) => {
|
|
34514
34542
|
if (configMode !== "both") return;
|
|
34515
34543
|
setActiveMode(mode);
|
|
@@ -34526,7 +34554,7 @@ function useWalletMode() {
|
|
|
34526
34554
|
|
|
34527
34555
|
// src/hooks/useDirectWallet.ts
|
|
34528
34556
|
init_useOpenPage();
|
|
34529
|
-
var
|
|
34557
|
+
var import_react111 = require("react");
|
|
34530
34558
|
var import_wagmi11 = require("wagmi");
|
|
34531
34559
|
init_useExternalWalletStore();
|
|
34532
34560
|
function useDirectWallet() {
|
|
@@ -34536,10 +34564,10 @@ function useDirectWallet() {
|
|
|
34536
34564
|
const connectorName = useExternalWalletStore((st) => st.connectorName);
|
|
34537
34565
|
const { open: openEmbarkAI } = useOpenPage();
|
|
34538
34566
|
const { mutate: wagmiDisconnect } = (0, import_wagmi11.useDisconnect)();
|
|
34539
|
-
const connect = (0,
|
|
34567
|
+
const connect = (0, import_react111.useCallback)((connectFlowType = "connect") => {
|
|
34540
34568
|
openEmbarkAI("connect-external-wallet" /* CONNECT_EXTERNAL_WALLET */, { connectFlowType });
|
|
34541
34569
|
}, []);
|
|
34542
|
-
const disconnect = (0,
|
|
34570
|
+
const disconnect = (0, import_react111.useCallback)(() => {
|
|
34543
34571
|
wagmiDisconnect();
|
|
34544
34572
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
34545
34573
|
}, [wagmiDisconnect]);
|
|
@@ -34555,7 +34583,7 @@ function useDirectWallet() {
|
|
|
34555
34583
|
}
|
|
34556
34584
|
|
|
34557
34585
|
// src/hooks/useSendDirectTransaction.ts
|
|
34558
|
-
var
|
|
34586
|
+
var import_react112 = require("react");
|
|
34559
34587
|
var import_viem23 = require("viem");
|
|
34560
34588
|
var import_wagmi12 = require("wagmi");
|
|
34561
34589
|
init_useExternalWalletStore();
|
|
@@ -34564,10 +34592,10 @@ function useSendDirectTransaction() {
|
|
|
34564
34592
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
34565
34593
|
const { sendTransactionAsync } = (0, import_wagmi12.useSendTransaction)();
|
|
34566
34594
|
const { switchChainAsync } = (0, import_wagmi12.useSwitchChain)();
|
|
34567
|
-
const [isPending, setIsPending] = (0,
|
|
34568
|
-
const [error, setError] = (0,
|
|
34569
|
-
const [txHash, setTxHash] = (0,
|
|
34570
|
-
const sendTransaction = (0,
|
|
34595
|
+
const [isPending, setIsPending] = (0, import_react112.useState)(false);
|
|
34596
|
+
const [error, setError] = (0, import_react112.useState)(null);
|
|
34597
|
+
const [txHash, setTxHash] = (0, import_react112.useState)(null);
|
|
34598
|
+
const sendTransaction = (0, import_react112.useCallback)(
|
|
34571
34599
|
async (params) => {
|
|
34572
34600
|
if (!isConnected) {
|
|
34573
34601
|
setError("No external wallet connected");
|
|
@@ -34601,7 +34629,7 @@ function useSendDirectTransaction() {
|
|
|
34601
34629
|
},
|
|
34602
34630
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
34603
34631
|
);
|
|
34604
|
-
const reset = (0,
|
|
34632
|
+
const reset = (0, import_react112.useCallback)(() => {
|
|
34605
34633
|
setError(null);
|
|
34606
34634
|
setTxHash(null);
|
|
34607
34635
|
setIsPending(false);
|
|
@@ -34610,7 +34638,7 @@ function useSendDirectTransaction() {
|
|
|
34610
34638
|
}
|
|
34611
34639
|
|
|
34612
34640
|
// src/hooks/useTransferToLinkedWallet.ts
|
|
34613
|
-
var
|
|
34641
|
+
var import_react113 = require("react");
|
|
34614
34642
|
var import_viem24 = require("viem");
|
|
34615
34643
|
init_SessionContext();
|
|
34616
34644
|
init_account2();
|
|
@@ -34629,14 +34657,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
34629
34657
|
function useTransferToLinkedWallet() {
|
|
34630
34658
|
const session = useSession((st) => st.session);
|
|
34631
34659
|
const { profiles } = useLinkedProfiles();
|
|
34632
|
-
const [isPending, setIsPending] = (0,
|
|
34633
|
-
const [error, setError] = (0,
|
|
34634
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
34635
|
-
const linkedWallets = (0,
|
|
34660
|
+
const [isPending, setIsPending] = (0, import_react113.useState)(false);
|
|
34661
|
+
const [error, setError] = (0, import_react113.useState)(null);
|
|
34662
|
+
const [userOpHash, setUserOpHash] = (0, import_react113.useState)(null);
|
|
34663
|
+
const linkedWallets = (0, import_react113.useMemo)(
|
|
34636
34664
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
34637
34665
|
[profiles]
|
|
34638
34666
|
);
|
|
34639
|
-
const transfer = (0,
|
|
34667
|
+
const transfer = (0, import_react113.useCallback)(
|
|
34640
34668
|
async (params) => {
|
|
34641
34669
|
if (!session) {
|
|
34642
34670
|
setError("No active session");
|
|
@@ -34687,7 +34715,7 @@ function useTransferToLinkedWallet() {
|
|
|
34687
34715
|
},
|
|
34688
34716
|
[session, linkedWallets]
|
|
34689
34717
|
);
|
|
34690
|
-
const reset = (0,
|
|
34718
|
+
const reset = (0, import_react113.useCallback)(() => {
|
|
34691
34719
|
setError(null);
|
|
34692
34720
|
setUserOpHash(null);
|
|
34693
34721
|
setIsPending(false);
|
|
@@ -34711,7 +34739,7 @@ function useNativeWalletSignature() {
|
|
|
34711
34739
|
|
|
34712
34740
|
// src/hooks/useLogout.ts
|
|
34713
34741
|
var import_auth27 = require("@embarkai/core/auth");
|
|
34714
|
-
var
|
|
34742
|
+
var import_react114 = require("react");
|
|
34715
34743
|
var import_wagmi14 = require("wagmi");
|
|
34716
34744
|
init_ProviderContext();
|
|
34717
34745
|
init_SessionContext();
|
|
@@ -34730,7 +34758,7 @@ function useLogout() {
|
|
|
34730
34758
|
}
|
|
34731
34759
|
}
|
|
34732
34760
|
});
|
|
34733
|
-
const logout2 = (0,
|
|
34761
|
+
const logout2 = (0, import_react114.useCallback)(async () => {
|
|
34734
34762
|
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
34735
34763
|
const prevAddress = address;
|
|
34736
34764
|
let userId = null;
|
|
@@ -34849,7 +34877,7 @@ function useTransactions() {
|
|
|
34849
34877
|
|
|
34850
34878
|
// src/modules/assets.ts
|
|
34851
34879
|
init_SessionContext();
|
|
34852
|
-
var
|
|
34880
|
+
var import_react115 = __toESM(require("react"), 1);
|
|
34853
34881
|
var import_viem26 = require("viem");
|
|
34854
34882
|
var import_wagmi16 = require("wagmi");
|
|
34855
34883
|
var COMMON_TOKENS = [
|
|
@@ -35004,7 +35032,7 @@ function useTokenBalance2(tokenAddress, userAddress) {
|
|
|
35004
35032
|
}
|
|
35005
35033
|
});
|
|
35006
35034
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
35007
|
-
const formattedBalance =
|
|
35035
|
+
const formattedBalance = import_react115.default.useMemo(() => {
|
|
35008
35036
|
if (!balance || !tokenInfo) return "0";
|
|
35009
35037
|
return (0, import_viem26.formatUnits)(balance, tokenInfo.decimals);
|
|
35010
35038
|
}, [balance, tokenInfo]);
|