@embarkai/ui-kit 0.6.12 → 0.6.13
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 +2 -2
- package/dist/index.cjs +360 -328
- package/dist/index.js +40 -8
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -333,7 +333,7 @@ var import_auth, UI_KIT_VERSION;
|
|
|
333
333
|
var init_sdk_version = __esm({
|
|
334
334
|
"src/internal/lib/sdk-version.ts"() {
|
|
335
335
|
import_auth = require("@embarkai/core/auth");
|
|
336
|
-
UI_KIT_VERSION = "0.6.
|
|
336
|
+
UI_KIT_VERSION = "0.6.13";
|
|
337
337
|
if (UI_KIT_VERSION) (0, import_auth.setSdkVersion)(UI_KIT_VERSION);
|
|
338
338
|
}
|
|
339
339
|
});
|
|
@@ -22325,6 +22325,29 @@ var init_DevicesMenu = __esm({
|
|
|
22325
22325
|
}
|
|
22326
22326
|
});
|
|
22327
22327
|
|
|
22328
|
+
// src/internal/hooks/useHasAuthSession.ts
|
|
22329
|
+
function useHasAuthSession() {
|
|
22330
|
+
return (0, import_react58.useSyncExternalStore)(subscribe, hasAuthSession, hasAuthSession);
|
|
22331
|
+
}
|
|
22332
|
+
var import_react58, subscribe, hasAuthSession;
|
|
22333
|
+
var init_useHasAuthSession = __esm({
|
|
22334
|
+
"src/internal/hooks/useHasAuthSession.ts"() {
|
|
22335
|
+
import_react58 = require("react");
|
|
22336
|
+
init_auth();
|
|
22337
|
+
subscribe = (onChange) => import_auth7.jwtTokenManager.subscribe(onChange);
|
|
22338
|
+
hasAuthSession = () => !!import_auth7.jwtTokenManager.getUserId();
|
|
22339
|
+
}
|
|
22340
|
+
});
|
|
22341
|
+
|
|
22342
|
+
// src/internal/components/KeyshareRestoreMenu/backup-check.ts
|
|
22343
|
+
function canCheckBackup(sessionStatus, hasAuthSession2) {
|
|
22344
|
+
return sessionStatus !== "disconnecting" && hasAuthSession2;
|
|
22345
|
+
}
|
|
22346
|
+
var init_backup_check = __esm({
|
|
22347
|
+
"src/internal/components/KeyshareRestoreMenu/backup-check.ts"() {
|
|
22348
|
+
}
|
|
22349
|
+
});
|
|
22350
|
+
|
|
22328
22351
|
// src/internal/components/ui/tooltip.tsx
|
|
22329
22352
|
function Tooltip(props) {
|
|
22330
22353
|
const {
|
|
@@ -22335,7 +22358,7 @@ function Tooltip(props) {
|
|
|
22335
22358
|
container = document.querySelector(".embarkai-ui-scope-content") || document.body
|
|
22336
22359
|
} = props;
|
|
22337
22360
|
const isMobileView = useLayoutStore((st) => st.isMobileView);
|
|
22338
|
-
const [open, setOpen] = (0,
|
|
22361
|
+
const [open, setOpen] = (0, import_react59.useState)(false);
|
|
22339
22362
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(TooltipPrimitive.Provider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(TooltipPrimitive.Root, { open: isMobileView ? open : void 0, onOpenChange: isMobileView ? setOpen : void 0, children: [
|
|
22340
22363
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
22341
22364
|
TooltipPrimitive.Trigger,
|
|
@@ -22351,12 +22374,12 @@ function Tooltip(props) {
|
|
|
22351
22374
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(TooltipPrimitive.Portal, { container, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(TooltipPrimitive.Content, { side: position, align, sideOffset: 8, className: "z-100 w-55", children: content }) })
|
|
22352
22375
|
] }) });
|
|
22353
22376
|
}
|
|
22354
|
-
var TooltipPrimitive, import_lucide_react38,
|
|
22377
|
+
var TooltipPrimitive, import_lucide_react38, import_react59, import_jsx_runtime78;
|
|
22355
22378
|
var init_tooltip = __esm({
|
|
22356
22379
|
"src/internal/components/ui/tooltip.tsx"() {
|
|
22357
22380
|
TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
22358
22381
|
import_lucide_react38 = require("lucide-react");
|
|
22359
|
-
|
|
22382
|
+
import_react59 = require("react");
|
|
22360
22383
|
init_useLayoutStore();
|
|
22361
22384
|
import_jsx_runtime78 = require("react/jsx-runtime");
|
|
22362
22385
|
}
|
|
@@ -22410,7 +22433,7 @@ function useOnRestoreSuccess() {
|
|
|
22410
22433
|
setStatus
|
|
22411
22434
|
} = useSession();
|
|
22412
22435
|
const { setError, setSuccess } = useRestoreStore();
|
|
22413
|
-
const createSessionWithKeyshare = (0,
|
|
22436
|
+
const createSessionWithKeyshare = (0, import_react60.useCallback)(
|
|
22414
22437
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
22415
22438
|
try {
|
|
22416
22439
|
try {
|
|
@@ -22451,7 +22474,7 @@ function useOnRestoreSuccess() {
|
|
|
22451
22474
|
},
|
|
22452
22475
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
22453
22476
|
);
|
|
22454
|
-
const onRestoreSuccess = (0,
|
|
22477
|
+
const onRestoreSuccess = (0, import_react60.useCallback)(async () => {
|
|
22455
22478
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager6 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
22456
22479
|
const verify = await verifyToken2();
|
|
22457
22480
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager6.getHasKeyshare() ?? false;
|
|
@@ -22524,12 +22547,12 @@ function useOnRestoreSuccess() {
|
|
|
22524
22547
|
]);
|
|
22525
22548
|
return { onRestoreSuccess };
|
|
22526
22549
|
}
|
|
22527
|
-
var
|
|
22550
|
+
var import_react60;
|
|
22528
22551
|
var init_useOnRestoreSuccess = __esm({
|
|
22529
22552
|
"src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts"() {
|
|
22530
22553
|
init_ProviderContext();
|
|
22531
22554
|
init_SessionContext();
|
|
22532
|
-
|
|
22555
|
+
import_react60 = require("react");
|
|
22533
22556
|
init_useLayoutDataStore();
|
|
22534
22557
|
init_useLayoutStore();
|
|
22535
22558
|
init_useRestoreStore();
|
|
@@ -22546,7 +22569,7 @@ function useCreateBackup() {
|
|
|
22546
22569
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
22547
22570
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
22548
22571
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
22549
|
-
const onBackupSuccess = (0,
|
|
22572
|
+
const onBackupSuccess = (0, import_react61.useCallback)((method) => {
|
|
22550
22573
|
console.log(`[EMBARKAI BACKUP] ${method} backup created successfully`);
|
|
22551
22574
|
if (method !== "securedServer" && method !== "server") return;
|
|
22552
22575
|
useSession.getState().setHasServerVault(true);
|
|
@@ -22712,12 +22735,12 @@ function useCreateBackup() {
|
|
|
22712
22735
|
createPasskey
|
|
22713
22736
|
};
|
|
22714
22737
|
}
|
|
22715
|
-
var import_react_query30,
|
|
22738
|
+
var import_react_query30, import_react61;
|
|
22716
22739
|
var init_useCreateBackup = __esm({
|
|
22717
22740
|
"src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts"() {
|
|
22718
22741
|
init_SessionContext();
|
|
22719
22742
|
import_react_query30 = require("@tanstack/react-query");
|
|
22720
|
-
|
|
22743
|
+
import_react61 = require("react");
|
|
22721
22744
|
init_auth();
|
|
22722
22745
|
init_profile();
|
|
22723
22746
|
init_useLayoutStore();
|
|
@@ -22857,7 +22880,7 @@ function useValidateFileBackup() {
|
|
|
22857
22880
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
22858
22881
|
const setError = useRestoreStore((st) => st.setError);
|
|
22859
22882
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
22860
|
-
(0,
|
|
22883
|
+
(0, import_react62.useEffect)(() => {
|
|
22861
22884
|
if (!restoreFile) {
|
|
22862
22885
|
return;
|
|
22863
22886
|
}
|
|
@@ -22878,10 +22901,10 @@ function useValidateFileBackup() {
|
|
|
22878
22901
|
reader.readAsText(restoreFile);
|
|
22879
22902
|
}, [restoreFile]);
|
|
22880
22903
|
}
|
|
22881
|
-
var
|
|
22904
|
+
var import_react62;
|
|
22882
22905
|
var init_useValidateFileBackup = __esm({
|
|
22883
22906
|
"src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts"() {
|
|
22884
|
-
|
|
22907
|
+
import_react62 = require("react");
|
|
22885
22908
|
init_useRestoreStore();
|
|
22886
22909
|
}
|
|
22887
22910
|
});
|
|
@@ -22912,9 +22935,9 @@ function MethodSelector(props) {
|
|
|
22912
22935
|
if (!!selectedRecoveryMethod) return null;
|
|
22913
22936
|
const availableMethods = getBackupMethods(mode);
|
|
22914
22937
|
const { activeLevel, isBackupManagedByUser } = getActiveLevel(securityStatus);
|
|
22915
|
-
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
22938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_react63.Fragment, { children: [
|
|
22916
22939
|
mode === "restore" && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "text-xs text-(--ui-kit-fg-muted)", children: t("passport:restoreMenu.availableRestoreMethods") }),
|
|
22917
|
-
availableMethods.map((methodGroup, methodGroupIdx) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
22940
|
+
availableMethods.map((methodGroup, methodGroupIdx) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_react63.Fragment, { children: [
|
|
22918
22941
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex items-center gap-(--ui-kit-gap)", children: [
|
|
22919
22942
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "flex-1 block h-px bg-(--ui-kit-bd)" }),
|
|
22920
22943
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "text-[10px] uppercase text-(--ui-kit-fg-muted)", children: t(methodGroupIdx === 0 ? "passport:backupMenu.vault" : "passport:common.extra") }),
|
|
@@ -22988,14 +23011,14 @@ function MethodSelector(props) {
|
|
|
22988
23011
|
] }, `method-group-${methodGroupIdx}`))
|
|
22989
23012
|
] });
|
|
22990
23013
|
}
|
|
22991
|
-
var import_lucide_react39,
|
|
23014
|
+
var import_lucide_react39, import_react63, import_react_i18next3, import_jsx_runtime79, getBackupMethods, getActiveLevel;
|
|
22992
23015
|
var init_MethodSelector = __esm({
|
|
22993
23016
|
"src/internal/components/KeyshareRestoreMenu/components/MethodSelector.tsx"() {
|
|
22994
23017
|
init_useT();
|
|
22995
23018
|
init_icons();
|
|
22996
23019
|
init_utils();
|
|
22997
23020
|
import_lucide_react39 = require("lucide-react");
|
|
22998
|
-
|
|
23021
|
+
import_react63 = require("react");
|
|
22999
23022
|
import_react_i18next3 = require("react-i18next");
|
|
23000
23023
|
init_guardian_backup();
|
|
23001
23024
|
init_highlight();
|
|
@@ -23202,7 +23225,7 @@ var init_onboarding_setup4 = __esm({
|
|
|
23202
23225
|
// src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx
|
|
23203
23226
|
function PasswordPasskey(props) {
|
|
23204
23227
|
const { t } = useT();
|
|
23205
|
-
const radioId = (0,
|
|
23228
|
+
const radioId = (0, import_react64.useId)();
|
|
23206
23229
|
const {
|
|
23207
23230
|
mode = "restore",
|
|
23208
23231
|
actionCaption,
|
|
@@ -23213,7 +23236,7 @@ function PasswordPasskey(props) {
|
|
|
23213
23236
|
actionHandler,
|
|
23214
23237
|
onCreatePasskey
|
|
23215
23238
|
} = props;
|
|
23216
|
-
const actionRef = (0,
|
|
23239
|
+
const actionRef = (0, import_react64.useRef)(null);
|
|
23217
23240
|
const {
|
|
23218
23241
|
showPassword,
|
|
23219
23242
|
restorePassword,
|
|
@@ -23227,7 +23250,7 @@ function PasswordPasskey(props) {
|
|
|
23227
23250
|
} = useRestoreStore();
|
|
23228
23251
|
const { config } = useProviderConfig();
|
|
23229
23252
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
23230
|
-
(0,
|
|
23253
|
+
(0, import_react64.useEffect)(() => {
|
|
23231
23254
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
23232
23255
|
}, [isPasskeyEnabled, usePasskey]);
|
|
23233
23256
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
@@ -23367,13 +23390,13 @@ function PasswordPasskey(props) {
|
|
|
23367
23390
|
] })
|
|
23368
23391
|
] });
|
|
23369
23392
|
}
|
|
23370
|
-
var import_lucide_react40,
|
|
23393
|
+
var import_lucide_react40, import_react64, import_jsx_runtime81;
|
|
23371
23394
|
var init_PasswordPasskey = __esm({
|
|
23372
23395
|
"src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx"() {
|
|
23373
23396
|
init_ProviderContext();
|
|
23374
23397
|
init_i18n();
|
|
23375
23398
|
import_lucide_react40 = require("lucide-react");
|
|
23376
|
-
|
|
23399
|
+
import_react64 = require("react");
|
|
23377
23400
|
init_icons();
|
|
23378
23401
|
init_Onboarding();
|
|
23379
23402
|
init_button();
|
|
@@ -23525,10 +23548,10 @@ function SwitchArrow({ left, right, className }) {
|
|
|
23525
23548
|
] });
|
|
23526
23549
|
}
|
|
23527
23550
|
function NodeGraph({ activeLevel }) {
|
|
23528
|
-
const maskId = `node-graph-${(0,
|
|
23529
|
-
const containerRef = (0,
|
|
23530
|
-
const [width, setWidth] = (0,
|
|
23531
|
-
(0,
|
|
23551
|
+
const maskId = `node-graph-${(0, import_react65.useId)().replace(/:/g, "")}`;
|
|
23552
|
+
const containerRef = (0, import_react65.useRef)(null);
|
|
23553
|
+
const [width, setWidth] = (0, import_react65.useState)(0);
|
|
23554
|
+
(0, import_react65.useLayoutEffect)(() => {
|
|
23532
23555
|
const el = containerRef.current;
|
|
23533
23556
|
if (!el) return;
|
|
23534
23557
|
setWidth(el.clientWidth);
|
|
@@ -23589,13 +23612,13 @@ function NodeGraph({ activeLevel }) {
|
|
|
23589
23612
|
}
|
|
23590
23613
|
);
|
|
23591
23614
|
}
|
|
23592
|
-
var import_lucide_react42,
|
|
23615
|
+
var import_lucide_react42, import_react65, import_react_i18next4, import_jsx_runtime83, CIRCLE_RADIUS, NODE_TOP, LOWER_TIER_OFFSET, CONNECTOR_GAP, GRAPH_HEIGHT, BASIC_NODE, UPGRADE_NODES, getNodeState, Circle, ARROW_HEAD_LENGTH, ARROW_HEAD_SPREAD, ARROW_START_ANGLE, ARROW_SAG, arrowHeadPath;
|
|
23593
23616
|
var init_NodeGraph = __esm({
|
|
23594
23617
|
"src/internal/components/KeyshareRestoreMenu/components/NodeGraph.tsx"() {
|
|
23595
23618
|
init_useT();
|
|
23596
23619
|
init_wallets();
|
|
23597
23620
|
import_lucide_react42 = require("lucide-react");
|
|
23598
|
-
|
|
23621
|
+
import_react65 = require("react");
|
|
23599
23622
|
import_react_i18next4 = require("react-i18next");
|
|
23600
23623
|
init_cn();
|
|
23601
23624
|
init_badge();
|
|
@@ -23637,7 +23660,7 @@ var init_NodeGraph = __esm({
|
|
|
23637
23660
|
if (level === "basic" && activeLevel !== null) return "completed";
|
|
23638
23661
|
return "upcoming";
|
|
23639
23662
|
};
|
|
23640
|
-
Circle = (0,
|
|
23663
|
+
Circle = (0, import_react65.forwardRef)(function Circle2({ state, Icon: Icon2, backupValidator, className, ...rest }, ref) {
|
|
23641
23664
|
const ValidatorIcon = backupValidator === "embarkAI" ? WALLET_ICONS.embarkai : import_lucide_react42.UserIcon;
|
|
23642
23665
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { ...rest, ref, className: cn("relative flex-none h-8 w-8", className), children: [
|
|
23643
23666
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
@@ -23685,7 +23708,7 @@ function BackupProgress(props) {
|
|
|
23685
23708
|
const { securityStatus = null, noBackupNotice } = props;
|
|
23686
23709
|
const { t } = useT();
|
|
23687
23710
|
const backupMethod = useRestoreStore((st) => st.method);
|
|
23688
|
-
const [isBackupNoticeVisible, setIsBackupNoticeVisible] = (0,
|
|
23711
|
+
const [isBackupNoticeVisible, setIsBackupNoticeVisible] = (0, import_react66.useState)(false);
|
|
23689
23712
|
if (!!backupMethod) return null;
|
|
23690
23713
|
const { activeLevel, isBackupManagedByUser } = getActiveLevel2(securityStatus);
|
|
23691
23714
|
const isMaxBackupSecurity = isBackupManagedByUser;
|
|
@@ -23775,14 +23798,14 @@ function BackupProgress(props) {
|
|
|
23775
23798
|
] })
|
|
23776
23799
|
] });
|
|
23777
23800
|
}
|
|
23778
|
-
var import_dayjs4, import_lucide_react43,
|
|
23801
|
+
var import_dayjs4, import_lucide_react43, import_react66, import_react_i18next5, import_jsx_runtime84, getActiveLevel2;
|
|
23779
23802
|
var init_BackupProgress = __esm({
|
|
23780
23803
|
"src/internal/components/KeyshareRestoreMenu/components/BackupProgress.tsx"() {
|
|
23781
23804
|
init_useT();
|
|
23782
23805
|
init_icons();
|
|
23783
23806
|
import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
23784
23807
|
import_lucide_react43 = require("lucide-react");
|
|
23785
|
-
|
|
23808
|
+
import_react66 = require("react");
|
|
23786
23809
|
import_react_i18next5 = require("react-i18next");
|
|
23787
23810
|
init_cn();
|
|
23788
23811
|
init_button();
|
|
@@ -23803,7 +23826,7 @@ var init_BackupProgress = __esm({
|
|
|
23803
23826
|
function PasswordForm(props) {
|
|
23804
23827
|
const { mode = "backup", actionCaption, isLoading, disabled, actionHandler } = props;
|
|
23805
23828
|
const { t } = useT();
|
|
23806
|
-
const actionRef = (0,
|
|
23829
|
+
const actionRef = (0, import_react67.useRef)(null);
|
|
23807
23830
|
const showPassword = useRestoreStore((st) => st.showPassword);
|
|
23808
23831
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
23809
23832
|
const error = useRestoreStore((st) => st.error);
|
|
@@ -23853,12 +23876,12 @@ function PasswordForm(props) {
|
|
|
23853
23876
|
)
|
|
23854
23877
|
] });
|
|
23855
23878
|
}
|
|
23856
|
-
var import_lucide_react44,
|
|
23879
|
+
var import_lucide_react44, import_react67, import_jsx_runtime85;
|
|
23857
23880
|
var init_PasswordForm = __esm({
|
|
23858
23881
|
"src/internal/components/KeyshareRestoreMenu/components/PasswordForm.tsx"() {
|
|
23859
23882
|
init_useT();
|
|
23860
23883
|
import_lucide_react44 = require("lucide-react");
|
|
23861
|
-
|
|
23884
|
+
import_react67 = require("react");
|
|
23862
23885
|
init_button();
|
|
23863
23886
|
init_input();
|
|
23864
23887
|
init_useRestoreStore();
|
|
@@ -24358,7 +24381,7 @@ function Cloud2(props) {
|
|
|
24358
24381
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
24359
24382
|
}
|
|
24360
24383
|
});
|
|
24361
|
-
(0,
|
|
24384
|
+
(0, import_react68.useEffect)(() => {
|
|
24362
24385
|
if (isCloudProvidersLoading) return;
|
|
24363
24386
|
if (!!cloudProvidersError) {
|
|
24364
24387
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -24422,13 +24445,13 @@ function Cloud2(props) {
|
|
|
24422
24445
|
)
|
|
24423
24446
|
] });
|
|
24424
24447
|
}
|
|
24425
|
-
var import_react_query32, import_lucide_react49,
|
|
24448
|
+
var import_react_query32, import_lucide_react49, import_react68, import_jsx_runtime91;
|
|
24426
24449
|
var init_Cloud = __esm({
|
|
24427
24450
|
"src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx"() {
|
|
24428
24451
|
init_SessionContext();
|
|
24429
24452
|
import_react_query32 = require("@tanstack/react-query");
|
|
24430
24453
|
import_lucide_react49 = require("lucide-react");
|
|
24431
|
-
|
|
24454
|
+
import_react68 = require("react");
|
|
24432
24455
|
init_button();
|
|
24433
24456
|
init_select();
|
|
24434
24457
|
init_PasswordPasskey();
|
|
@@ -24445,8 +24468,8 @@ function Guardian(props) {
|
|
|
24445
24468
|
const session = useSession((st) => st.session);
|
|
24446
24469
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
24447
24470
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
24448
|
-
const [isWorking, setIsWorking] = (0,
|
|
24449
|
-
const [step, setStep] = (0,
|
|
24471
|
+
const [isWorking, setIsWorking] = (0, import_react69.useState)(false);
|
|
24472
|
+
const [step, setStep] = (0, import_react69.useState)("idle");
|
|
24450
24473
|
const handleGuardianBackup = async () => {
|
|
24451
24474
|
if (!restorePassword) {
|
|
24452
24475
|
setError("Please enter a password");
|
|
@@ -24575,11 +24598,11 @@ function Guardian(props) {
|
|
|
24575
24598
|
] })
|
|
24576
24599
|
] });
|
|
24577
24600
|
}
|
|
24578
|
-
var
|
|
24601
|
+
var import_react69, import_lucide_react50, import_jsx_runtime92;
|
|
24579
24602
|
var init_Guardian = __esm({
|
|
24580
24603
|
"src/internal/components/KeyshareRestoreMenu/methods/Guardian.tsx"() {
|
|
24581
24604
|
init_SessionContext();
|
|
24582
|
-
|
|
24605
|
+
import_react69 = require("react");
|
|
24583
24606
|
import_lucide_react50 = require("lucide-react");
|
|
24584
24607
|
init_iframe_manager();
|
|
24585
24608
|
init_guardian_backup();
|
|
@@ -24603,7 +24626,7 @@ var init_methods = __esm({
|
|
|
24603
24626
|
});
|
|
24604
24627
|
|
|
24605
24628
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
24606
|
-
var import_react_query33, import_lucide_react51,
|
|
24629
|
+
var import_react_query33, import_lucide_react51, import_react70, import_jsx_runtime93, RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
24607
24630
|
var init_KeyshareRestoreMenu = __esm({
|
|
24608
24631
|
"src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
|
|
24609
24632
|
init_ProviderContext();
|
|
@@ -24612,7 +24635,8 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
24612
24635
|
init_useSafeDisconnect();
|
|
24613
24636
|
import_react_query33 = require("@tanstack/react-query");
|
|
24614
24637
|
import_lucide_react51 = require("lucide-react");
|
|
24615
|
-
|
|
24638
|
+
import_react70 = require("react");
|
|
24639
|
+
init_useHasAuthSession();
|
|
24616
24640
|
init_useLayoutDataStore();
|
|
24617
24641
|
init_useLayoutStore();
|
|
24618
24642
|
init_security_status();
|
|
@@ -24621,6 +24645,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
24621
24645
|
init_Expandable2();
|
|
24622
24646
|
init_button();
|
|
24623
24647
|
init_highlight();
|
|
24648
|
+
init_backup_check();
|
|
24624
24649
|
init_components2();
|
|
24625
24650
|
init_constants5();
|
|
24626
24651
|
init_hooks();
|
|
@@ -24639,10 +24664,12 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
24639
24664
|
const { callbacksRef } = useProviderConfig();
|
|
24640
24665
|
const { t } = useT();
|
|
24641
24666
|
const address = useSession((st) => st.address);
|
|
24667
|
+
const sessionStatus = useSession((st) => st.status);
|
|
24668
|
+
const hasAuthSession2 = useHasAuthSession();
|
|
24642
24669
|
const error = useRestoreStore((st) => st.error);
|
|
24643
24670
|
const success = useRestoreStore((st) => st.success);
|
|
24644
24671
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
24645
|
-
(0,
|
|
24672
|
+
(0, import_react70.useEffect)(() => {
|
|
24646
24673
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
24647
24674
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
24648
24675
|
setIsDialogForced(true);
|
|
@@ -24681,11 +24708,12 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
24681
24708
|
isError: isBackupStatusUnavailable
|
|
24682
24709
|
} = (0, import_react_query33.useQuery)({
|
|
24683
24710
|
retry: false,
|
|
24711
|
+
enabled: canCheckBackup(sessionStatus, hasAuthSession2),
|
|
24684
24712
|
queryKey: [CHECK_BACKUP_QUERY_KEY, address],
|
|
24685
24713
|
queryFn: async () => await readShareRecoveryStats()
|
|
24686
24714
|
});
|
|
24687
24715
|
const hasServerBackup = deriveSecurityStatus(serverRecoveryStatus).hasBackup || isBackupStatusUnavailable;
|
|
24688
|
-
(0,
|
|
24716
|
+
(0, import_react70.useEffect)(() => {
|
|
24689
24717
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("securedServer");
|
|
24690
24718
|
}, [hasServerBackup]);
|
|
24691
24719
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query33.useMutation)({
|
|
@@ -24704,7 +24732,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
24704
24732
|
return { disconnectedUserId: userId };
|
|
24705
24733
|
},
|
|
24706
24734
|
onSuccess: async ({ disconnectedUserId }) => {
|
|
24707
|
-
|
|
24735
|
+
qc.removeQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
|
|
24708
24736
|
if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
|
|
24709
24737
|
const { setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
|
|
24710
24738
|
setSession(null);
|
|
@@ -24831,12 +24859,14 @@ function KeyshareBackupMenu() {
|
|
|
24831
24859
|
const qc = (0, import_react_query34.useQueryClient)();
|
|
24832
24860
|
const { t } = useT();
|
|
24833
24861
|
const address = useSession((st) => st.address);
|
|
24862
|
+
const sessionStatus = useSession((st) => st.status);
|
|
24863
|
+
const hasAuthSession2 = useHasAuthSession();
|
|
24834
24864
|
const isBackupRequired = useLayoutStore((st) => st.isBackupRequired);
|
|
24835
24865
|
const isBackupFailureNotice = useLayoutStore((st) => st.isBackupFailureNotice);
|
|
24836
24866
|
const currentBackupMethod = useRestoreStore((st) => st.method);
|
|
24837
24867
|
const error = useRestoreStore((st) => st.error);
|
|
24838
24868
|
const success = useRestoreStore((st) => st.success);
|
|
24839
|
-
(0,
|
|
24869
|
+
(0, import_react71.useEffect)(() => {
|
|
24840
24870
|
return () => {
|
|
24841
24871
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
24842
24872
|
setSuccess(null);
|
|
@@ -24855,11 +24885,11 @@ function KeyshareBackupMenu() {
|
|
|
24855
24885
|
isError: isRecoveryUnavailable
|
|
24856
24886
|
} = (0, import_react_query34.useQuery)({
|
|
24857
24887
|
retry: false,
|
|
24858
|
-
enabled: !!address,
|
|
24888
|
+
enabled: !!address && canCheckBackup(sessionStatus, hasAuthSession2),
|
|
24859
24889
|
queryKey: [CHECK_BACKUP_QUERY_KEY, address],
|
|
24860
24890
|
queryFn: async () => await readShareRecoveryStats()
|
|
24861
24891
|
});
|
|
24862
|
-
(0,
|
|
24892
|
+
(0, import_react71.useEffect)(() => {
|
|
24863
24893
|
const refresh = () => qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
|
|
24864
24894
|
window.addEventListener("lumia-passport-backup-status-changed", refresh);
|
|
24865
24895
|
return () => window.removeEventListener("lumia-passport-backup-status-changed", refresh);
|
|
@@ -24878,7 +24908,7 @@ function KeyshareBackupMenu() {
|
|
|
24878
24908
|
isPasskeyCreating,
|
|
24879
24909
|
createPasskey
|
|
24880
24910
|
} = useCreateBackup();
|
|
24881
|
-
const [isMethodSelectorVisible, setIsMethodSelectorVisible] = (0,
|
|
24911
|
+
const [isMethodSelectorVisible, setIsMethodSelectorVisible] = (0, import_react71.useState)(false);
|
|
24882
24912
|
const BackupComponent = !!currentBackupMethod ? COMPONENTS[currentBackupMethod] : null;
|
|
24883
24913
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-(--ui-kit-gap)", children: [
|
|
24884
24914
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
@@ -25025,7 +25055,7 @@ function KeyshareBackupMenu() {
|
|
|
25025
25055
|
] })
|
|
25026
25056
|
] });
|
|
25027
25057
|
}
|
|
25028
|
-
var import_react_query34, import_lucide_react52,
|
|
25058
|
+
var import_react_query34, import_lucide_react52, import_react71, import_jsx_runtime94, COMPONENTS;
|
|
25029
25059
|
var init_KeyshareBackupMenu = __esm({
|
|
25030
25060
|
"src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx"() {
|
|
25031
25061
|
init_SessionContext();
|
|
@@ -25033,7 +25063,8 @@ var init_KeyshareBackupMenu = __esm({
|
|
|
25033
25063
|
init_embarkAI2();
|
|
25034
25064
|
import_react_query34 = require("@tanstack/react-query");
|
|
25035
25065
|
import_lucide_react52 = require("lucide-react");
|
|
25036
|
-
|
|
25066
|
+
import_react71 = require("react");
|
|
25067
|
+
init_useHasAuthSession();
|
|
25037
25068
|
init_useLayoutDataStore();
|
|
25038
25069
|
init_useLayoutStore();
|
|
25039
25070
|
init_security_status();
|
|
@@ -25042,6 +25073,7 @@ var init_KeyshareBackupMenu = __esm({
|
|
|
25042
25073
|
init_Onboarding();
|
|
25043
25074
|
init_button();
|
|
25044
25075
|
init_highlight();
|
|
25076
|
+
init_backup_check();
|
|
25045
25077
|
init_components2();
|
|
25046
25078
|
init_constants5();
|
|
25047
25079
|
init_hooks();
|
|
@@ -25171,13 +25203,13 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
25171
25203
|
const { colorMode } = useColorMode();
|
|
25172
25204
|
const { t, i18n } = useT();
|
|
25173
25205
|
const lang = toSumsubLang(i18n.resolvedLanguage);
|
|
25174
|
-
const iframeRef = (0,
|
|
25175
|
-
const [isLoading, setIsLoading] = (0,
|
|
25176
|
-
const [error, setError] = (0,
|
|
25177
|
-
const [height, setHeight] = (0,
|
|
25178
|
-
const [status, setStatus] = (0,
|
|
25206
|
+
const iframeRef = (0, import_react72.useRef)(null);
|
|
25207
|
+
const [isLoading, setIsLoading] = (0, import_react72.useState)(true);
|
|
25208
|
+
const [error, setError] = (0, import_react72.useState)(null);
|
|
25209
|
+
const [height, setHeight] = (0, import_react72.useState)(0);
|
|
25210
|
+
const [status, setStatus] = (0, import_react72.useState)("");
|
|
25179
25211
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
25180
|
-
(0,
|
|
25212
|
+
(0, import_react72.useEffect)(() => {
|
|
25181
25213
|
setError(null);
|
|
25182
25214
|
setIsLoading(true);
|
|
25183
25215
|
setStatus(t("passport:kycMenu.preparing"));
|
|
@@ -25221,13 +25253,13 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
25221
25253
|
lang
|
|
25222
25254
|
};
|
|
25223
25255
|
}
|
|
25224
|
-
var
|
|
25256
|
+
var import_react72;
|
|
25225
25257
|
var init_useSumsubIframe = __esm({
|
|
25226
25258
|
"src/internal/components/KYC/useSumsubIframe.ts"() {
|
|
25227
25259
|
init_ProviderContext();
|
|
25228
25260
|
init_useColorMode();
|
|
25229
25261
|
init_i18n();
|
|
25230
|
-
|
|
25262
|
+
import_react72 = require("react");
|
|
25231
25263
|
init_useLayoutStore();
|
|
25232
25264
|
init_sumsub();
|
|
25233
25265
|
init_SumsubIframeManager();
|
|
@@ -25277,7 +25309,7 @@ function KycMenu() {
|
|
|
25277
25309
|
const { t } = useT();
|
|
25278
25310
|
const qc = (0, import_react_query35.useQueryClient)();
|
|
25279
25311
|
const isMobileView = useLayoutStore((st) => st.isMobileView);
|
|
25280
|
-
const [isConsent, setIsConsent] = (0,
|
|
25312
|
+
const [isConsent, setIsConsent] = (0, import_react73.useState)(false);
|
|
25281
25313
|
const { mutate: handleBackBtnClick } = (0, import_react_query35.useMutation)({
|
|
25282
25314
|
mutationFn: async () => {
|
|
25283
25315
|
const address = useSession.getState().address;
|
|
@@ -25294,7 +25326,7 @@ function KycMenu() {
|
|
|
25294
25326
|
}
|
|
25295
25327
|
}
|
|
25296
25328
|
});
|
|
25297
|
-
(0,
|
|
25329
|
+
(0, import_react73.useEffect)(() => {
|
|
25298
25330
|
if (isMobileView) return;
|
|
25299
25331
|
const embarkaiContentElement = document.querySelector(".embarkai-ui-scope-content");
|
|
25300
25332
|
embarkaiContentElement?.style.setProperty("--ui-kit-content-maw", "clamp(0px, 100dvw, 768px)");
|
|
@@ -25339,7 +25371,7 @@ function KycMenu() {
|
|
|
25339
25371
|
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(KycContent, {})
|
|
25340
25372
|
] });
|
|
25341
25373
|
}
|
|
25342
|
-
var import_react_query35, import_lucide_react54,
|
|
25374
|
+
var import_react_query35, import_lucide_react54, import_react73, import_jsx_runtime96, KycContent;
|
|
25343
25375
|
var init_KycMenu = __esm({
|
|
25344
25376
|
"src/internal/components/KYC/KycMenu.tsx"() {
|
|
25345
25377
|
init_ProviderContext();
|
|
@@ -25347,7 +25379,7 @@ var init_KycMenu = __esm({
|
|
|
25347
25379
|
init_i18n();
|
|
25348
25380
|
import_react_query35 = require("@tanstack/react-query");
|
|
25349
25381
|
import_lucide_react54 = require("lucide-react");
|
|
25350
|
-
|
|
25382
|
+
import_react73 = require("react");
|
|
25351
25383
|
init_profile();
|
|
25352
25384
|
init_useLayoutDataStore();
|
|
25353
25385
|
init_useLayoutStore();
|
|
@@ -25451,11 +25483,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
25451
25483
|
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
25452
25484
|
const resolvedChainId = chainId ?? activeChainId;
|
|
25453
25485
|
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
25454
|
-
const chainConfig = (0,
|
|
25486
|
+
const chainConfig = (0, import_react74.useMemo)(() => {
|
|
25455
25487
|
if (shouldUseActiveClient) return activeChainConfig;
|
|
25456
25488
|
return (0, import_read18.getChainConfig)(chainId);
|
|
25457
25489
|
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
25458
|
-
const publicClient = (0,
|
|
25490
|
+
const publicClient = (0, import_react74.useMemo)(() => {
|
|
25459
25491
|
if (shouldUseActiveClient) return activePublicClient;
|
|
25460
25492
|
if (!chainId) return activePublicClient;
|
|
25461
25493
|
try {
|
|
@@ -25472,12 +25504,12 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
25472
25504
|
resolvedChainId
|
|
25473
25505
|
};
|
|
25474
25506
|
}
|
|
25475
|
-
var import_read18,
|
|
25507
|
+
var import_read18, import_react74, publicClientByChainId;
|
|
25476
25508
|
var init_useResolvedPublicClient = __esm({
|
|
25477
25509
|
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
25478
25510
|
init_SessionContext();
|
|
25479
25511
|
import_read18 = require("@embarkai/core/read");
|
|
25480
|
-
|
|
25512
|
+
import_react74 = require("react");
|
|
25481
25513
|
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
25482
25514
|
}
|
|
25483
25515
|
});
|
|
@@ -25541,7 +25573,7 @@ var init_useNativeBalance = __esm({
|
|
|
25541
25573
|
function useWatchTokens(options) {
|
|
25542
25574
|
const { address, chainId, enabled, publicClient } = options;
|
|
25543
25575
|
const { config } = useProviderConfig();
|
|
25544
|
-
const watchTokens = (0,
|
|
25576
|
+
const watchTokens = (0, import_react75.useMemo)(() => {
|
|
25545
25577
|
const allWatchTokens = config.current.watchTokens;
|
|
25546
25578
|
const tokensForChain = chainId ? allWatchTokens?.[chainId] || [] : [];
|
|
25547
25579
|
return tokensForChain;
|
|
@@ -25609,12 +25641,12 @@ function useWatchTokens(options) {
|
|
|
25609
25641
|
}
|
|
25610
25642
|
});
|
|
25611
25643
|
}
|
|
25612
|
-
var import_react_query37,
|
|
25644
|
+
var import_react_query37, import_react75, import_viem9;
|
|
25613
25645
|
var init_useWatchTokens = __esm({
|
|
25614
25646
|
"src/internal/hooks/useBlockscoutAssets/useWatchTokens.ts"() {
|
|
25615
25647
|
init_ProviderContext();
|
|
25616
25648
|
import_react_query37 = require("@tanstack/react-query");
|
|
25617
|
-
|
|
25649
|
+
import_react75 = require("react");
|
|
25618
25650
|
import_viem9 = require("viem");
|
|
25619
25651
|
init_constants6();
|
|
25620
25652
|
}
|
|
@@ -25763,11 +25795,11 @@ function useBlockscoutAssets(options) {
|
|
|
25763
25795
|
tokenBalancesQueryKey: customTokenBalancesQueryKey
|
|
25764
25796
|
} = useProviderConfig().config?.current?.portfolio || {};
|
|
25765
25797
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
25766
|
-
const blockscoutClient = (0,
|
|
25798
|
+
const blockscoutClient = (0, import_react76.useMemo)(
|
|
25767
25799
|
() => blockscoutApiUrl ? (0, import_core4.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
25768
25800
|
[blockscoutApiUrl]
|
|
25769
25801
|
);
|
|
25770
|
-
const lastRefreshRef = (0,
|
|
25802
|
+
const lastRefreshRef = (0, import_react76.useRef)(0);
|
|
25771
25803
|
const {
|
|
25772
25804
|
data: watchTokenAssets = [],
|
|
25773
25805
|
isLoading: watchTokensLoading,
|
|
@@ -25839,7 +25871,7 @@ function useBlockscoutAssets(options) {
|
|
|
25839
25871
|
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, blockscoutApiUrl, address],
|
|
25840
25872
|
queryFn: () => blockscoutClient.getNfts(address)
|
|
25841
25873
|
});
|
|
25842
|
-
const erc20TokenAddresses = (0,
|
|
25874
|
+
const erc20TokenAddresses = (0, import_react76.useMemo)(() => {
|
|
25843
25875
|
if (!blockscoutItems) return [];
|
|
25844
25876
|
return blockscoutItems.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
25845
25877
|
}, [blockscoutItems]);
|
|
@@ -25884,7 +25916,7 @@ function useBlockscoutAssets(options) {
|
|
|
25884
25916
|
// 1 minute
|
|
25885
25917
|
// gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
25886
25918
|
});
|
|
25887
|
-
const assets = (0,
|
|
25919
|
+
const assets = (0, import_react76.useMemo)(() => {
|
|
25888
25920
|
const result = [];
|
|
25889
25921
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
25890
25922
|
if (nativeBalanceData) {
|
|
@@ -25978,7 +26010,7 @@ function useBlockscoutAssets(options) {
|
|
|
25978
26010
|
watchTokenAssets,
|
|
25979
26011
|
chainConfig
|
|
25980
26012
|
]);
|
|
25981
|
-
const nativeBalance = (0,
|
|
26013
|
+
const nativeBalance = (0, import_react76.useMemo)(() => {
|
|
25982
26014
|
if (!nativeBalanceData) return null;
|
|
25983
26015
|
return {
|
|
25984
26016
|
value: nativeBalanceData.value,
|
|
@@ -25986,11 +26018,11 @@ function useBlockscoutAssets(options) {
|
|
|
25986
26018
|
symbol: nativeBalanceData.symbol
|
|
25987
26019
|
};
|
|
25988
26020
|
}, [nativeBalanceData]);
|
|
25989
|
-
const error = (0,
|
|
26021
|
+
const error = (0, import_react76.useMemo)(() => {
|
|
25990
26022
|
if (!blockscoutError) return null;
|
|
25991
26023
|
return createError(blockscoutError);
|
|
25992
26024
|
}, [blockscoutError]);
|
|
25993
|
-
const refreshBalances = (0,
|
|
26025
|
+
const refreshBalances = (0, import_react76.useCallback)(async () => {
|
|
25994
26026
|
const now = Date.now();
|
|
25995
26027
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
25996
26028
|
return;
|
|
@@ -26006,7 +26038,7 @@ function useBlockscoutAssets(options) {
|
|
|
26006
26038
|
qc.invalidateQueries({ queryKey: [WATCH_TOKENS_QUERY_KEY] })
|
|
26007
26039
|
]);
|
|
26008
26040
|
}, [qc, customTokenBalancesQueryKey]);
|
|
26009
|
-
const getTokenBalance = (0,
|
|
26041
|
+
const getTokenBalance = (0, import_react76.useCallback)(
|
|
26010
26042
|
(tokenAddress) => {
|
|
26011
26043
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
26012
26044
|
},
|
|
@@ -26025,13 +26057,13 @@ function useBlockscoutAssets(options) {
|
|
|
26025
26057
|
lastUpdated: dataUpdatedAt || null
|
|
26026
26058
|
};
|
|
26027
26059
|
}
|
|
26028
|
-
var import_core4, import_react_query38,
|
|
26060
|
+
var import_core4, import_react_query38, import_react76;
|
|
26029
26061
|
var init_useBlockscoutAssets = __esm({
|
|
26030
26062
|
"src/internal/hooks/useBlockscoutAssets/useBlockscoutAssets.ts"() {
|
|
26031
26063
|
init_ProviderContext();
|
|
26032
26064
|
import_core4 = require("@embarkai/core");
|
|
26033
26065
|
import_react_query38 = require("@tanstack/react-query");
|
|
26034
|
-
|
|
26066
|
+
import_react76 = require("react");
|
|
26035
26067
|
init_initial();
|
|
26036
26068
|
init_constants();
|
|
26037
26069
|
init_useResolvedPublicClient();
|
|
@@ -26151,9 +26183,9 @@ function SecurityTokenBadge() {
|
|
|
26151
26183
|
}
|
|
26152
26184
|
function PortfolioItemImage(props) {
|
|
26153
26185
|
const { asset } = props;
|
|
26154
|
-
const [logoError, setLogoError] = (0,
|
|
26155
|
-
const [nftImageError, setNftImageError] = (0,
|
|
26156
|
-
const resolvedImage = (0,
|
|
26186
|
+
const [logoError, setLogoError] = (0, import_react77.useState)(false);
|
|
26187
|
+
const [nftImageError, setNftImageError] = (0, import_react77.useState)(false);
|
|
26188
|
+
const resolvedImage = (0, import_react77.useMemo)(() => {
|
|
26157
26189
|
const isNft = isNftAsset(asset);
|
|
26158
26190
|
const nftImage = getNftImage(asset);
|
|
26159
26191
|
const isSecurity = isSecurityToken(asset);
|
|
@@ -26308,13 +26340,13 @@ function PortfolioItem(props) {
|
|
|
26308
26340
|
}
|
|
26309
26341
|
);
|
|
26310
26342
|
}
|
|
26311
|
-
var import_react_query39, import_lucide_react56,
|
|
26343
|
+
var import_react_query39, import_lucide_react56, import_react77, import_viem12, import_jsx_runtime99, PORTFOLIO_ASSET_RATE_QUERY_KEY;
|
|
26312
26344
|
var init_PortfolioItem = __esm({
|
|
26313
26345
|
"src/internal/components/PortfolioMenu/PortfolioItem.tsx"() {
|
|
26314
26346
|
init_ProviderContext();
|
|
26315
26347
|
import_react_query39 = require("@tanstack/react-query");
|
|
26316
26348
|
import_lucide_react56 = require("lucide-react");
|
|
26317
|
-
|
|
26349
|
+
import_react77 = require("react");
|
|
26318
26350
|
import_viem12 = require("viem");
|
|
26319
26351
|
init_tokens();
|
|
26320
26352
|
init_base();
|
|
@@ -26346,7 +26378,7 @@ function PortfolioMenu() {
|
|
|
26346
26378
|
enabled: !!address
|
|
26347
26379
|
});
|
|
26348
26380
|
const shownProjectAssets = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
26349
|
-
const refreshAllAssetsBalances = (0,
|
|
26381
|
+
const refreshAllAssetsBalances = (0, import_react78.useCallback)(() => {
|
|
26350
26382
|
Promise.all(shownProjectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
26351
26383
|
refreshBlockscoutBalances();
|
|
26352
26384
|
}, [qc, shownProjectAssets, refreshBlockscoutBalances]);
|
|
@@ -26392,7 +26424,7 @@ function PortfolioMenu() {
|
|
|
26392
26424
|
blockscoutError && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Highlight, { type: "error", children: blockscoutError?.message })
|
|
26393
26425
|
] });
|
|
26394
26426
|
}
|
|
26395
|
-
var import_react_query40, import_lucide_react57,
|
|
26427
|
+
var import_react_query40, import_lucide_react57, import_react78, import_jsx_runtime100;
|
|
26396
26428
|
var init_PortfolioMenu = __esm({
|
|
26397
26429
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
26398
26430
|
init_ProviderContext();
|
|
@@ -26400,7 +26432,7 @@ var init_PortfolioMenu = __esm({
|
|
|
26400
26432
|
init_i18n();
|
|
26401
26433
|
import_react_query40 = require("@tanstack/react-query");
|
|
26402
26434
|
import_lucide_react57 = require("lucide-react");
|
|
26403
|
-
|
|
26435
|
+
import_react78 = require("react");
|
|
26404
26436
|
init_useBlockscoutAssets2();
|
|
26405
26437
|
init_useLayoutDataStore();
|
|
26406
26438
|
init_Expandable2();
|
|
@@ -26744,7 +26776,7 @@ var init_useNicknameStore = __esm({
|
|
|
26744
26776
|
function useNicknameAvailability(currentNickname) {
|
|
26745
26777
|
const { t } = useT();
|
|
26746
26778
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
26747
|
-
(0,
|
|
26779
|
+
(0, import_react79.useEffect)(() => {
|
|
26748
26780
|
if (!currentNickname) return;
|
|
26749
26781
|
useNicknameStore.getState().setNicknameValue(currentNickname);
|
|
26750
26782
|
}, [currentNickname]);
|
|
@@ -26765,8 +26797,8 @@ function useNicknameAvailability(currentNickname) {
|
|
|
26765
26797
|
useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
|
|
26766
26798
|
}
|
|
26767
26799
|
});
|
|
26768
|
-
const debouncedCheckAvailability = (0,
|
|
26769
|
-
(0,
|
|
26800
|
+
const debouncedCheckAvailability = (0, import_react79.useCallback)((0, import_lodash_es13.debounce)(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
|
|
26801
|
+
(0, import_react79.useEffect)(() => {
|
|
26770
26802
|
if (!currentNickname) return;
|
|
26771
26803
|
const normalizedInputValue = normalizeNickname(nicknameValue);
|
|
26772
26804
|
const { valid: isNicknameValid } = validateNickname(nicknameValue);
|
|
@@ -26780,13 +26812,13 @@ function useNicknameAvailability(currentNickname) {
|
|
|
26780
26812
|
}, [nicknameValue, currentNickname, debouncedCheckAvailability]);
|
|
26781
26813
|
return { isCheckingAvailability };
|
|
26782
26814
|
}
|
|
26783
|
-
var import_react_query41, import_lodash_es13,
|
|
26815
|
+
var import_react_query41, import_lodash_es13, import_react79, DEBOUNCE_MS;
|
|
26784
26816
|
var init_useNicknameAvailability = __esm({
|
|
26785
26817
|
"src/internal/components/NicknameMenu/useNicknameAvailability.ts"() {
|
|
26786
26818
|
init_i18n();
|
|
26787
26819
|
import_react_query41 = require("@tanstack/react-query");
|
|
26788
26820
|
import_lodash_es13 = require("lodash-es");
|
|
26789
|
-
|
|
26821
|
+
import_react79 = require("react");
|
|
26790
26822
|
init_nickname();
|
|
26791
26823
|
init_nickname_errors();
|
|
26792
26824
|
init_nickname_validation();
|
|
@@ -26807,9 +26839,9 @@ function NicknameEditForm(props) {
|
|
|
26807
26839
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
26808
26840
|
const nicknameAvailability = useNicknameStore((st) => st.availability);
|
|
26809
26841
|
const { isCheckingAvailability } = useNicknameAvailability(nicknameInfo ? nicknameInfo.handle : "");
|
|
26810
|
-
const [isNicknameCopied, setIsNicknameCopied] = (0,
|
|
26811
|
-
const exitTimerRef = (0,
|
|
26812
|
-
(0,
|
|
26842
|
+
const [isNicknameCopied, setIsNicknameCopied] = (0, import_react80.useState)(false);
|
|
26843
|
+
const exitTimerRef = (0, import_react80.useRef)(null);
|
|
26844
|
+
(0, import_react80.useEffect)(
|
|
26813
26845
|
() => () => {
|
|
26814
26846
|
if (exitTimerRef.current) clearTimeout(exitTimerRef.current);
|
|
26815
26847
|
},
|
|
@@ -26846,7 +26878,7 @@ function NicknameEditForm(props) {
|
|
|
26846
26878
|
);
|
|
26847
26879
|
}
|
|
26848
26880
|
});
|
|
26849
|
-
const handleNicknameInputChange = (0,
|
|
26881
|
+
const handleNicknameInputChange = (0, import_react80.useCallback)(
|
|
26850
26882
|
(e) => {
|
|
26851
26883
|
const { error, setError, setNicknameValue } = useNicknameStore.getState();
|
|
26852
26884
|
const nextInputValue = e.target.value;
|
|
@@ -26860,7 +26892,7 @@ function NicknameEditForm(props) {
|
|
|
26860
26892
|
},
|
|
26861
26893
|
[t]
|
|
26862
26894
|
);
|
|
26863
|
-
const handleSubmit = (0,
|
|
26895
|
+
const handleSubmit = (0, import_react80.useCallback)(
|
|
26864
26896
|
(e) => {
|
|
26865
26897
|
const { nicknameValue: nicknameValue2, setError } = useNicknameStore.getState();
|
|
26866
26898
|
if (!canChange) {
|
|
@@ -26952,7 +26984,7 @@ function NicknameEditForm(props) {
|
|
|
26952
26984
|
!!canChange && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "w-full flex items-center leadding-4 text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:nicknameMenu.hint") })
|
|
26953
26985
|
] });
|
|
26954
26986
|
}
|
|
26955
|
-
var import_react_query42, import_lucide_react61,
|
|
26987
|
+
var import_react_query42, import_lucide_react61, import_react80, import_jsx_runtime103;
|
|
26956
26988
|
var init_NicknameEditForm = __esm({
|
|
26957
26989
|
"src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
|
|
26958
26990
|
init_ProviderContext();
|
|
@@ -26960,7 +26992,7 @@ var init_NicknameEditForm = __esm({
|
|
|
26960
26992
|
init_i18n();
|
|
26961
26993
|
import_react_query42 = require("@tanstack/react-query");
|
|
26962
26994
|
import_lucide_react61 = require("lucide-react");
|
|
26963
|
-
|
|
26995
|
+
import_react80 = require("react");
|
|
26964
26996
|
init_icons();
|
|
26965
26997
|
init_nickname();
|
|
26966
26998
|
init_profile();
|
|
@@ -26996,7 +27028,7 @@ function NicknameMenu() {
|
|
|
26996
27028
|
queryFn: async () => await getNicknameInfo()
|
|
26997
27029
|
});
|
|
26998
27030
|
const resolvedError = nicknameError || nicknameInfoError?.message || null;
|
|
26999
|
-
(0,
|
|
27031
|
+
(0, import_react81.useEffect)(() => () => useNicknameStore.getState().reset(), []);
|
|
27000
27032
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
27001
27033
|
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)] ", children: [
|
|
27002
27034
|
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
@@ -27063,7 +27095,7 @@ function NicknameMenu() {
|
|
|
27063
27095
|
!!resolvedError?.length && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Highlight, { type: "error", children: resolvedError })
|
|
27064
27096
|
] });
|
|
27065
27097
|
}
|
|
27066
|
-
var import_react_query43, import_dayjs5, import_lucide_react62,
|
|
27098
|
+
var import_react_query43, import_dayjs5, import_lucide_react62, import_react81, import_jsx_runtime104;
|
|
27067
27099
|
var init_NicknameMenu = __esm({
|
|
27068
27100
|
"src/internal/components/NicknameMenu/NicknameMenu.tsx"() {
|
|
27069
27101
|
init_SessionContext();
|
|
@@ -27072,7 +27104,7 @@ var init_NicknameMenu = __esm({
|
|
|
27072
27104
|
import_react_query43 = require("@tanstack/react-query");
|
|
27073
27105
|
import_dayjs5 = __toESM(require("dayjs"), 1);
|
|
27074
27106
|
import_lucide_react62 = require("lucide-react");
|
|
27075
|
-
|
|
27107
|
+
import_react81 = require("react");
|
|
27076
27108
|
init_nickname();
|
|
27077
27109
|
init_profile();
|
|
27078
27110
|
init_useLayoutDataStore();
|
|
@@ -27202,12 +27234,12 @@ function ReceiveMenu() {
|
|
|
27202
27234
|
queryKey: [PROFILE_QUERY_KEYS.nicknameInfo, address],
|
|
27203
27235
|
queryFn: async () => await getNicknameInfo()
|
|
27204
27236
|
});
|
|
27205
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
27206
|
-
const [isAddressCopied, setAddressCopied] = (0,
|
|
27207
|
-
const [isNicknameCopied, setNicknameCopied] = (0,
|
|
27208
|
-
const [fingerprintCopied, setFingerprintCopied] = (0,
|
|
27237
|
+
const [qrCodeUrl, setQrCodeUrl] = (0, import_react82.useState)("");
|
|
27238
|
+
const [isAddressCopied, setAddressCopied] = (0, import_react82.useState)(false);
|
|
27239
|
+
const [isNicknameCopied, setNicknameCopied] = (0, import_react82.useState)(false);
|
|
27240
|
+
const [fingerprintCopied, setFingerprintCopied] = (0, import_react82.useState)(false);
|
|
27209
27241
|
useOnboardingTourAvailable(true);
|
|
27210
|
-
const fingerprint = (0,
|
|
27242
|
+
const fingerprint = (0, import_react82.useMemo)(() => {
|
|
27211
27243
|
if (!session?.ownerAddress) return null;
|
|
27212
27244
|
try {
|
|
27213
27245
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -27215,7 +27247,7 @@ function ReceiveMenu() {
|
|
|
27215
27247
|
return null;
|
|
27216
27248
|
}
|
|
27217
27249
|
}, [session?.ownerAddress]);
|
|
27218
|
-
(0,
|
|
27250
|
+
(0, import_react82.useEffect)(() => {
|
|
27219
27251
|
if (!address) return;
|
|
27220
27252
|
import_qrcode.default.toDataURL(address, {
|
|
27221
27253
|
width: 200,
|
|
@@ -27314,7 +27346,7 @@ function ReceiveMenu() {
|
|
|
27314
27346
|
] })
|
|
27315
27347
|
] });
|
|
27316
27348
|
}
|
|
27317
|
-
var import_react_query44, import_lucide_react63, import_qrcode,
|
|
27349
|
+
var import_react_query44, import_lucide_react63, import_qrcode, import_react82, import_jsx_runtime105;
|
|
27318
27350
|
var init_ReceiveMenu = __esm({
|
|
27319
27351
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
27320
27352
|
init_SessionContext();
|
|
@@ -27322,7 +27354,7 @@ var init_ReceiveMenu = __esm({
|
|
|
27322
27354
|
import_react_query44 = require("@tanstack/react-query");
|
|
27323
27355
|
import_lucide_react63 = require("lucide-react");
|
|
27324
27356
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
27325
|
-
|
|
27357
|
+
import_react82 = require("react");
|
|
27326
27358
|
init_nickname();
|
|
27327
27359
|
init_profile();
|
|
27328
27360
|
init_useLayoutDataStore();
|
|
@@ -27696,7 +27728,7 @@ function useSecurityStatus() {
|
|
|
27696
27728
|
const qc = (0, import_react_query47.useQueryClient)();
|
|
27697
27729
|
const userId = useSession((st) => st.session?.mpcUserId);
|
|
27698
27730
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
27699
|
-
(0,
|
|
27731
|
+
(0, import_react83.useEffect)(() => {
|
|
27700
27732
|
const refresh = () => qc.invalidateQueries({ queryKey: [SECURITY_STATUS_QUERY] });
|
|
27701
27733
|
window.addEventListener("lumia-passport-backup-status-changed", refresh);
|
|
27702
27734
|
return () => window.removeEventListener("lumia-passport-backup-status-changed", refresh);
|
|
@@ -27709,12 +27741,12 @@ function useSecurityStatus() {
|
|
|
27709
27741
|
staleTime: 3e4
|
|
27710
27742
|
});
|
|
27711
27743
|
}
|
|
27712
|
-
var import_react_query47,
|
|
27744
|
+
var import_react_query47, import_react83, SECURITY_STATUS_QUERY;
|
|
27713
27745
|
var init_useSecurityStatus = __esm({
|
|
27714
27746
|
"src/internal/hooks/useSecurityStatus.ts"() {
|
|
27715
27747
|
init_SessionContext();
|
|
27716
27748
|
import_react_query47 = require("@tanstack/react-query");
|
|
27717
|
-
|
|
27749
|
+
import_react83 = require("react");
|
|
27718
27750
|
init_security_status();
|
|
27719
27751
|
init_vaultClient();
|
|
27720
27752
|
SECURITY_STATUS_QUERY = "security-status-query";
|
|
@@ -28308,7 +28340,7 @@ function PolicyForm() {
|
|
|
28308
28340
|
const userId = session?.mpcUserId || null;
|
|
28309
28341
|
const tv = t;
|
|
28310
28342
|
const { form, overridden, pending, readOnly, updateField, close } = usePolicyForm();
|
|
28311
|
-
const [formError, setFormError] = (0,
|
|
28343
|
+
const [formError, setFormError] = (0, import_react84.useState)(null);
|
|
28312
28344
|
const overriddenLabel = t("passport:securityMenu.walletPolicies.form.restrictedByProject");
|
|
28313
28345
|
const isOverridden = (field) => overridden.includes(field);
|
|
28314
28346
|
const invalidate = () => qc.invalidateQueries({ queryKey: [USER_POLICIES_QUERY_KEY] });
|
|
@@ -28496,7 +28528,7 @@ function PolicyForm() {
|
|
|
28496
28528
|
formError && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Highlight, { type: "error", children: formError })
|
|
28497
28529
|
] });
|
|
28498
28530
|
}
|
|
28499
|
-
var import_react_query51, import_clsx3, import_lucide_react70,
|
|
28531
|
+
var import_react_query51, import_clsx3, import_lucide_react70, import_react84, import_jsx_runtime112, AMOUNT_FIELDS;
|
|
28500
28532
|
var init_PolicyForm = __esm({
|
|
28501
28533
|
"src/internal/components/SecurityMenu/UserPolicies/PolicyForm.tsx"() {
|
|
28502
28534
|
init_networks3();
|
|
@@ -28505,7 +28537,7 @@ var init_PolicyForm = __esm({
|
|
|
28505
28537
|
import_react_query51 = require("@tanstack/react-query");
|
|
28506
28538
|
import_clsx3 = __toESM(require("clsx"), 1);
|
|
28507
28539
|
import_lucide_react70 = require("lucide-react");
|
|
28508
|
-
|
|
28540
|
+
import_react84 = require("react");
|
|
28509
28541
|
init_errors();
|
|
28510
28542
|
init_badge();
|
|
28511
28543
|
init_button();
|
|
@@ -28631,7 +28663,7 @@ var init_UserPolicies2 = __esm({
|
|
|
28631
28663
|
|
|
28632
28664
|
// src/internal/components/SecurityMenu/useSecurityMenuParams.ts
|
|
28633
28665
|
function useSecurityMenuParams() {
|
|
28634
|
-
(0,
|
|
28666
|
+
(0, import_react85.useEffect)(() => {
|
|
28635
28667
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
28636
28668
|
if (!pageParams || !(0, import_lodash_es14.keys)(pageParams).length) return;
|
|
28637
28669
|
const { submenu, policy, createPolicy } = pageParams;
|
|
@@ -28658,11 +28690,11 @@ function useSecurityMenuParams() {
|
|
|
28658
28690
|
setPageParams(null);
|
|
28659
28691
|
}, []);
|
|
28660
28692
|
}
|
|
28661
|
-
var import_lodash_es14,
|
|
28693
|
+
var import_lodash_es14, import_react85;
|
|
28662
28694
|
var init_useSecurityMenuParams = __esm({
|
|
28663
28695
|
"src/internal/components/SecurityMenu/useSecurityMenuParams.ts"() {
|
|
28664
28696
|
import_lodash_es14 = require("lodash-es");
|
|
28665
|
-
|
|
28697
|
+
import_react85 = require("react");
|
|
28666
28698
|
init_useLayoutDataStore();
|
|
28667
28699
|
init_UserPolicies2();
|
|
28668
28700
|
init_useSecurityStore();
|
|
@@ -28679,7 +28711,7 @@ function SecurityMenuContent() {
|
|
|
28679
28711
|
const isPolicyFormOpen = usePolicyForm((st) => st.isOpen);
|
|
28680
28712
|
const isPolicyNew = usePolicyForm((st) => st.form.isNew);
|
|
28681
28713
|
useOnboardingTourAvailable(!showConnectedApps && !showAssetsPolicies && !showKeyshareReshare);
|
|
28682
|
-
(0,
|
|
28714
|
+
(0, import_react86.useEffect)(() => {
|
|
28683
28715
|
let securityTitle = "";
|
|
28684
28716
|
switch (true) {
|
|
28685
28717
|
case showKeyshareReshare:
|
|
@@ -28703,7 +28735,7 @@ function SecurityMenuContent() {
|
|
|
28703
28735
|
return () => {
|
|
28704
28736
|
};
|
|
28705
28737
|
}, [t, showConnectedApps, showAssetsPolicies, isPolicyFormOpen, showKeyshareReshare, isPolicyNew]);
|
|
28706
|
-
(0,
|
|
28738
|
+
(0, import_react86.useEffect)(
|
|
28707
28739
|
() => () => {
|
|
28708
28740
|
usePolicyForm.getState().close();
|
|
28709
28741
|
useSecurityStore.setState(
|
|
@@ -28823,13 +28855,13 @@ function SecurityMenu() {
|
|
|
28823
28855
|
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(SecurityMenuContent, {})
|
|
28824
28856
|
] });
|
|
28825
28857
|
}
|
|
28826
|
-
var import_lucide_react72,
|
|
28858
|
+
var import_lucide_react72, import_react86, import_jsx_runtime114;
|
|
28827
28859
|
var init_SecurityMenu = __esm({
|
|
28828
28860
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
28829
28861
|
init_ProviderContext();
|
|
28830
28862
|
init_i18n();
|
|
28831
28863
|
import_lucide_react72 = require("lucide-react");
|
|
28832
|
-
|
|
28864
|
+
import_react86 = require("react");
|
|
28833
28865
|
init_useLayoutDataStore();
|
|
28834
28866
|
init_cn();
|
|
28835
28867
|
init_Expandable2();
|
|
@@ -29035,8 +29067,8 @@ var init_SenderSelector = __esm({
|
|
|
29035
29067
|
function useAvailableSenders() {
|
|
29036
29068
|
const address = useSession((st) => st.address);
|
|
29037
29069
|
const { profiles } = useLinkedProfiles();
|
|
29038
|
-
const lastCalcedSenders = (0,
|
|
29039
|
-
(0,
|
|
29070
|
+
const lastCalcedSenders = (0, import_react87.useRef)([]);
|
|
29071
|
+
(0, import_react87.useEffect)(() => {
|
|
29040
29072
|
const sendersAccumulator = [
|
|
29041
29073
|
{
|
|
29042
29074
|
type: "embarkai-wallet",
|
|
@@ -29070,13 +29102,13 @@ function useAvailableSenders() {
|
|
|
29070
29102
|
directWalletProfiles: profiles.filter((p) => p.provider === "wallet")
|
|
29071
29103
|
};
|
|
29072
29104
|
}
|
|
29073
|
-
var
|
|
29105
|
+
var import_react87;
|
|
29074
29106
|
var init_useAvailableSenders = __esm({
|
|
29075
29107
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
29076
29108
|
init_SessionContext();
|
|
29077
29109
|
init_tokens();
|
|
29078
29110
|
init_linkedProfiles();
|
|
29079
|
-
|
|
29111
|
+
import_react87 = require("react");
|
|
29080
29112
|
init_wallets();
|
|
29081
29113
|
init_useBridgeStore();
|
|
29082
29114
|
}
|
|
@@ -29491,18 +29523,18 @@ function useHyperlaneHistory() {
|
|
|
29491
29523
|
getNextPageParam: (lastPage) => lastPage.page < lastPage.pageCount ? lastPage.page + 1 : void 0,
|
|
29492
29524
|
queryFn: async ({ pageParam }) => await getHyperlaneBridgeHistory({ page: pageParam, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
29493
29525
|
});
|
|
29494
|
-
const txList = (0,
|
|
29526
|
+
const txList = (0, import_react88.useMemo)(
|
|
29495
29527
|
() => query?.data?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
29496
29528
|
[query?.data]
|
|
29497
29529
|
);
|
|
29498
29530
|
return { query, txList };
|
|
29499
29531
|
}
|
|
29500
|
-
var import_react_query52,
|
|
29532
|
+
var import_react_query52, import_react88, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
29501
29533
|
var init_useHyperlaneHistory = __esm({
|
|
29502
29534
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
29503
29535
|
init_SessionContext();
|
|
29504
29536
|
import_react_query52 = require("@tanstack/react-query");
|
|
29505
|
-
|
|
29537
|
+
import_react88 = require("react");
|
|
29506
29538
|
init_useLayoutDataStore();
|
|
29507
29539
|
init_useFlowSelector();
|
|
29508
29540
|
init_api5();
|
|
@@ -29534,7 +29566,7 @@ function useBridge() {
|
|
|
29534
29566
|
const address = useSession((st) => st.address);
|
|
29535
29567
|
const { data: walletClient } = (0, import_wagmi5.useWalletClient)();
|
|
29536
29568
|
const { mutateAsync: switchChainAsync } = (0, import_wagmi5.useSwitchChain)();
|
|
29537
|
-
const swapDirection = (0,
|
|
29569
|
+
const swapDirection = (0, import_react89.useCallback)(() => {
|
|
29538
29570
|
const {
|
|
29539
29571
|
// bridgeStep,
|
|
29540
29572
|
originChain,
|
|
@@ -29585,7 +29617,7 @@ function useBridge() {
|
|
|
29585
29617
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
29586
29618
|
}
|
|
29587
29619
|
});
|
|
29588
|
-
const handleQuoteEstimation = (0,
|
|
29620
|
+
const handleQuoteEstimation = (0, import_react89.useCallback)((amnt) => {
|
|
29589
29621
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
29590
29622
|
if (!amnt || !Number(amnt)) {
|
|
29591
29623
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -29720,13 +29752,13 @@ function useBridge() {
|
|
|
29720
29752
|
isAssetBridging
|
|
29721
29753
|
};
|
|
29722
29754
|
}
|
|
29723
|
-
var import_react_query53,
|
|
29755
|
+
var import_react_query53, import_react89, import_wagmi5;
|
|
29724
29756
|
var init_useBridge = __esm({
|
|
29725
29757
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
29726
29758
|
init_SessionContext();
|
|
29727
29759
|
init_i18n();
|
|
29728
29760
|
import_react_query53 = require("@tanstack/react-query");
|
|
29729
|
-
|
|
29761
|
+
import_react89 = require("react");
|
|
29730
29762
|
import_wagmi5 = require("wagmi");
|
|
29731
29763
|
init_useLayoutStore();
|
|
29732
29764
|
init_useExternalWalletStore();
|
|
@@ -29757,7 +29789,7 @@ function useHyperlaneRoutes() {
|
|
|
29757
29789
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
29758
29790
|
queryFn: async () => await getHyperlaneWarpRoutes()
|
|
29759
29791
|
});
|
|
29760
|
-
(0,
|
|
29792
|
+
(0, import_react90.useEffect)(() => {
|
|
29761
29793
|
if (!errorWarpRoutes) return;
|
|
29762
29794
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
29763
29795
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -29766,7 +29798,7 @@ function useHyperlaneRoutes() {
|
|
|
29766
29798
|
setOriginChain(null);
|
|
29767
29799
|
setDestinationChain(null);
|
|
29768
29800
|
}, [errorWarpRoutes]);
|
|
29769
|
-
(0,
|
|
29801
|
+
(0, import_react90.useEffect)(() => {
|
|
29770
29802
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
29771
29803
|
let targetHyperRouteToSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
29772
29804
|
if (!targetHyperRouteToSelect) {
|
|
@@ -29791,12 +29823,12 @@ function useHyperlaneRoutes() {
|
|
|
29791
29823
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
29792
29824
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
29793
29825
|
}
|
|
29794
|
-
var import_react_query54,
|
|
29826
|
+
var import_react_query54, import_react90, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
29795
29827
|
var init_useHyperlaneRoutes = __esm({
|
|
29796
29828
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
29797
29829
|
init_SessionContext();
|
|
29798
29830
|
import_react_query54 = require("@tanstack/react-query");
|
|
29799
|
-
|
|
29831
|
+
import_react90 = require("react");
|
|
29800
29832
|
init_useLayoutDataStore();
|
|
29801
29833
|
init_useFlowSelector();
|
|
29802
29834
|
init_api5();
|
|
@@ -29812,7 +29844,7 @@ function useMenuTitle(warpRoutes) {
|
|
|
29812
29844
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
29813
29845
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
29814
29846
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
29815
|
-
(0,
|
|
29847
|
+
(0, import_react91.useEffect)(() => {
|
|
29816
29848
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
29817
29849
|
switch (true) {
|
|
29818
29850
|
case bridgeStep === "sender-selector":
|
|
@@ -29840,11 +29872,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
29840
29872
|
}
|
|
29841
29873
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
29842
29874
|
}
|
|
29843
|
-
var
|
|
29875
|
+
var import_react91;
|
|
29844
29876
|
var init_useMenuTitle = __esm({
|
|
29845
29877
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
29846
29878
|
init_i18n();
|
|
29847
|
-
|
|
29879
|
+
import_react91 = require("react");
|
|
29848
29880
|
init_useFlowSelector();
|
|
29849
29881
|
init_useBridgeStore();
|
|
29850
29882
|
}
|
|
@@ -30094,7 +30126,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
30094
30126
|
};
|
|
30095
30127
|
}
|
|
30096
30128
|
});
|
|
30097
|
-
const refreshRouteTokenBalance = (0,
|
|
30129
|
+
const refreshRouteTokenBalance = (0, import_react92.useCallback)(
|
|
30098
30130
|
(senderWallet) => {
|
|
30099
30131
|
switch (true) {
|
|
30100
30132
|
case senderWallet === "embarkai-wallet":
|
|
@@ -30110,7 +30142,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
30110
30142
|
},
|
|
30111
30143
|
[refreshBalances, qc]
|
|
30112
30144
|
);
|
|
30113
|
-
(0,
|
|
30145
|
+
(0, import_react92.useEffect)(() => {
|
|
30114
30146
|
if (!!isLoadingWarpRoutes || !bridgeSender || !originChain) return;
|
|
30115
30147
|
switch (bridgeSender) {
|
|
30116
30148
|
case "embarkai-wallet":
|
|
@@ -30141,14 +30173,14 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
30141
30173
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
30142
30174
|
};
|
|
30143
30175
|
}
|
|
30144
|
-
var import_core8, import_react_query55,
|
|
30176
|
+
var import_core8, import_react_query55, import_react92, import_viem17, import_wagmi6, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
|
|
30145
30177
|
var init_useBridgeBalance = __esm({
|
|
30146
30178
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
30147
30179
|
init_SessionContext();
|
|
30148
30180
|
init_i18n();
|
|
30149
30181
|
import_core8 = require("@embarkai/core");
|
|
30150
30182
|
import_react_query55 = require("@tanstack/react-query");
|
|
30151
|
-
|
|
30183
|
+
import_react92 = require("react");
|
|
30152
30184
|
import_viem17 = require("viem");
|
|
30153
30185
|
import_wagmi6 = require("wagmi");
|
|
30154
30186
|
init_useBlockscoutAssets2();
|
|
@@ -30277,7 +30309,7 @@ function SelectStep(props) {
|
|
|
30277
30309
|
variant: "outline",
|
|
30278
30310
|
size: "medium",
|
|
30279
30311
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
30280
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
|
|
30312
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(import_react93.Fragment, { children: [
|
|
30281
30313
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(import_lucide_react74.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
30282
30314
|
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
30283
30315
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -30421,13 +30453,13 @@ function SelectStep(props) {
|
|
|
30421
30453
|
)
|
|
30422
30454
|
] });
|
|
30423
30455
|
}
|
|
30424
|
-
var import_lucide_react74,
|
|
30456
|
+
var import_lucide_react74, import_react93, import_jsx_runtime117;
|
|
30425
30457
|
var init_SelectStep = __esm({
|
|
30426
30458
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
30427
30459
|
init_tokens();
|
|
30428
30460
|
init_i18n();
|
|
30429
30461
|
import_lucide_react74 = require("lucide-react");
|
|
30430
|
-
|
|
30462
|
+
import_react93 = require("react");
|
|
30431
30463
|
init_priceFormatter();
|
|
30432
30464
|
init_utils();
|
|
30433
30465
|
init_useExternalWalletStore();
|
|
@@ -30478,7 +30510,7 @@ var init_checkbox = __esm({
|
|
|
30478
30510
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
30479
30511
|
function ConfirmStep(props) {
|
|
30480
30512
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
30481
|
-
const [userConsent, setUserConsent] = (0,
|
|
30513
|
+
const [userConsent, setUserConsent] = (0, import_react94.useState)(false);
|
|
30482
30514
|
const { t } = useT();
|
|
30483
30515
|
const address = useSession((st) => st.address);
|
|
30484
30516
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -30594,13 +30626,13 @@ function ConfirmStep(props) {
|
|
|
30594
30626
|
}
|
|
30595
30627
|
);
|
|
30596
30628
|
}
|
|
30597
|
-
var import_lucide_react76,
|
|
30629
|
+
var import_lucide_react76, import_react94, import_jsx_runtime119, P_CN;
|
|
30598
30630
|
var init_ConfirmStep = __esm({
|
|
30599
30631
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
30600
30632
|
init_SessionContext();
|
|
30601
30633
|
init_i18n();
|
|
30602
30634
|
import_lucide_react76 = require("lucide-react");
|
|
30603
|
-
|
|
30635
|
+
import_react94 = require("react");
|
|
30604
30636
|
init_priceFormatter();
|
|
30605
30637
|
init_utils();
|
|
30606
30638
|
init_Onboarding();
|
|
@@ -30977,7 +31009,7 @@ function SelectAssetRoute(props) {
|
|
|
30977
31009
|
const { hyperlaneWarpRoutes } = props;
|
|
30978
31010
|
const { t } = useT();
|
|
30979
31011
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
30980
|
-
const tokenList = (0,
|
|
31012
|
+
const tokenList = (0, import_react95.useMemo)(() => {
|
|
30981
31013
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
30982
31014
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
30983
31015
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -31054,13 +31086,13 @@ function SelectAssetRoute(props) {
|
|
|
31054
31086
|
] })
|
|
31055
31087
|
] });
|
|
31056
31088
|
}
|
|
31057
|
-
var import_lucide_react78,
|
|
31089
|
+
var import_lucide_react78, import_react95, import_jsx_runtime122;
|
|
31058
31090
|
var init_SelectAssetRoute = __esm({
|
|
31059
31091
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
31060
31092
|
init_tokens();
|
|
31061
31093
|
init_i18n();
|
|
31062
31094
|
import_lucide_react78 = require("lucide-react");
|
|
31063
|
-
|
|
31095
|
+
import_react95 = require("react");
|
|
31064
31096
|
init_button();
|
|
31065
31097
|
init_ResolveChainIcon();
|
|
31066
31098
|
init_useBridgeStore();
|
|
@@ -31087,7 +31119,7 @@ function HyperlaneBridge() {
|
|
|
31087
31119
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
31088
31120
|
const { directWalletProfiles } = useAvailableSenders();
|
|
31089
31121
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
31090
|
-
(0,
|
|
31122
|
+
(0, import_react96.useEffect)(() => {
|
|
31091
31123
|
return () => {
|
|
31092
31124
|
useBridgeStore.getState().resetSelections();
|
|
31093
31125
|
};
|
|
@@ -31120,10 +31152,10 @@ function HyperlaneBridge() {
|
|
|
31120
31152
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(HistoryDetailsStep, {})
|
|
31121
31153
|
] });
|
|
31122
31154
|
}
|
|
31123
|
-
var
|
|
31155
|
+
var import_react96, import_jsx_runtime123;
|
|
31124
31156
|
var init_HyperlaneBridge = __esm({
|
|
31125
31157
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
31126
|
-
|
|
31158
|
+
import_react96 = require("react");
|
|
31127
31159
|
init_SenderSelector();
|
|
31128
31160
|
init_useAvailableSenders();
|
|
31129
31161
|
init_useBridge();
|
|
@@ -31141,7 +31173,7 @@ function BridgeHistorySwitch(props) {
|
|
|
31141
31173
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
31142
31174
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
31143
31175
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
31144
|
-
const lastBridgeStepRef = (0,
|
|
31176
|
+
const lastBridgeStepRef = (0, import_react97.useRef)(null);
|
|
31145
31177
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
31146
31178
|
return null;
|
|
31147
31179
|
}
|
|
@@ -31160,10 +31192,10 @@ function BridgeHistorySwitch(props) {
|
|
|
31160
31192
|
}
|
|
31161
31193
|
);
|
|
31162
31194
|
}
|
|
31163
|
-
var
|
|
31195
|
+
var import_react97, import_jsx_runtime124;
|
|
31164
31196
|
var init_HistorySwitch = __esm({
|
|
31165
31197
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
31166
|
-
|
|
31198
|
+
import_react97 = require("react");
|
|
31167
31199
|
init_switch();
|
|
31168
31200
|
init_useFlowSelector();
|
|
31169
31201
|
init_useBridgeStore();
|
|
@@ -31254,11 +31286,11 @@ function looksLikeNickname(input) {
|
|
|
31254
31286
|
}
|
|
31255
31287
|
function useNicknameResolve(input, options) {
|
|
31256
31288
|
const { enabled = true, chainId } = options;
|
|
31257
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
31258
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
31289
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react98.useState)("");
|
|
31290
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react98.useState)(false);
|
|
31259
31291
|
const normalized = normalizeNickname(input);
|
|
31260
31292
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
31261
|
-
(0,
|
|
31293
|
+
(0, import_react98.useEffect)(() => {
|
|
31262
31294
|
if (!isNicknameInput || !enabled) {
|
|
31263
31295
|
setDebouncedInput("");
|
|
31264
31296
|
setIsDebouncing(false);
|
|
@@ -31284,7 +31316,7 @@ function useNicknameResolve(input, options) {
|
|
|
31284
31316
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
31285
31317
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
31286
31318
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
31287
|
-
const fingerprintVerification = (0,
|
|
31319
|
+
const fingerprintVerification = (0, import_react98.useMemo)(() => {
|
|
31288
31320
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
31289
31321
|
return null;
|
|
31290
31322
|
}
|
|
@@ -31306,11 +31338,11 @@ function useNicknameResolve(input, options) {
|
|
|
31306
31338
|
resolvedAddress
|
|
31307
31339
|
};
|
|
31308
31340
|
}
|
|
31309
|
-
var import_react_query57,
|
|
31341
|
+
var import_react_query57, import_react98, DEBOUNCE_MS2;
|
|
31310
31342
|
var init_useNicknameResolve = __esm({
|
|
31311
31343
|
"src/hooks/useNicknameResolve.ts"() {
|
|
31312
31344
|
import_react_query57 = require("@tanstack/react-query");
|
|
31313
|
-
|
|
31345
|
+
import_react98 = require("react");
|
|
31314
31346
|
init_nickname();
|
|
31315
31347
|
init_profile();
|
|
31316
31348
|
init_nickname_fingerprint();
|
|
@@ -31347,10 +31379,10 @@ function useSendTransaction() {
|
|
|
31347
31379
|
const { t } = useT();
|
|
31348
31380
|
const session = useSession((st) => st.session);
|
|
31349
31381
|
const address = useSession((st) => st.address);
|
|
31350
|
-
const [isLoading, setIsLoading] = (0,
|
|
31351
|
-
const [error, setError] = (0,
|
|
31352
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
31353
|
-
const sendTransaction = (0,
|
|
31382
|
+
const [isLoading, setIsLoading] = (0, import_react99.useState)(false);
|
|
31383
|
+
const [error, setError] = (0, import_react99.useState)(null);
|
|
31384
|
+
const [userOpHash, setUserOpHash] = (0, import_react99.useState)(null);
|
|
31385
|
+
const sendTransaction = (0, import_react99.useCallback)(
|
|
31354
31386
|
async (params) => {
|
|
31355
31387
|
if (!session || !address) {
|
|
31356
31388
|
setError("No active session");
|
|
@@ -31451,7 +31483,7 @@ function useSendTransaction() {
|
|
|
31451
31483
|
},
|
|
31452
31484
|
[session, address, t]
|
|
31453
31485
|
);
|
|
31454
|
-
const reset = (0,
|
|
31486
|
+
const reset = (0, import_react99.useCallback)(() => {
|
|
31455
31487
|
setError(null);
|
|
31456
31488
|
setUserOpHash(null);
|
|
31457
31489
|
setIsLoading(false);
|
|
@@ -31464,10 +31496,10 @@ function useSendTransaction() {
|
|
|
31464
31496
|
reset
|
|
31465
31497
|
};
|
|
31466
31498
|
}
|
|
31467
|
-
var
|
|
31499
|
+
var import_react99, import_viem18, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
31468
31500
|
var init_useSendTransaction = __esm({
|
|
31469
31501
|
"src/hooks/useSendTransaction.ts"() {
|
|
31470
|
-
|
|
31502
|
+
import_react99 = require("react");
|
|
31471
31503
|
import_viem18 = require("viem");
|
|
31472
31504
|
init_SessionContext();
|
|
31473
31505
|
init_useT();
|
|
@@ -31621,7 +31653,7 @@ var init_AssetInputIcon = __esm({
|
|
|
31621
31653
|
|
|
31622
31654
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
31623
31655
|
function NftDisplayCard({ asset }) {
|
|
31624
|
-
const [imageError, setImageError] = (0,
|
|
31656
|
+
const [imageError, setImageError] = (0, import_react100.useState)(false);
|
|
31625
31657
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
31626
31658
|
return /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
31627
31659
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
@@ -31649,11 +31681,11 @@ function NftDisplayCard({ asset }) {
|
|
|
31649
31681
|
] })
|
|
31650
31682
|
] });
|
|
31651
31683
|
}
|
|
31652
|
-
var import_lucide_react80,
|
|
31684
|
+
var import_lucide_react80, import_react100, import_jsx_runtime126;
|
|
31653
31685
|
var init_NftDisplayCard = __esm({
|
|
31654
31686
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
31655
31687
|
import_lucide_react80 = require("lucide-react");
|
|
31656
|
-
|
|
31688
|
+
import_react100 = require("react");
|
|
31657
31689
|
import_jsx_runtime126 = require("react/jsx-runtime");
|
|
31658
31690
|
}
|
|
31659
31691
|
});
|
|
@@ -31773,7 +31805,7 @@ function NicknameData(props) {
|
|
|
31773
31805
|
isWalletNotSetup,
|
|
31774
31806
|
isFrozen
|
|
31775
31807
|
} = resolvedNicknameData;
|
|
31776
|
-
(0,
|
|
31808
|
+
(0, import_react101.useEffect)(() => {
|
|
31777
31809
|
if (isResolving) return;
|
|
31778
31810
|
let errMessage = null;
|
|
31779
31811
|
switch (true) {
|
|
@@ -31828,11 +31860,11 @@ function NicknameData(props) {
|
|
|
31828
31860
|
] })
|
|
31829
31861
|
] });
|
|
31830
31862
|
}
|
|
31831
|
-
var import_lucide_react81,
|
|
31863
|
+
var import_lucide_react81, import_react101, import_jsx_runtime128;
|
|
31832
31864
|
var init_NicknameData = __esm({
|
|
31833
31865
|
"src/internal/components/SendMenu/send/components/NicknameData.tsx"() {
|
|
31834
31866
|
import_lucide_react81 = require("lucide-react");
|
|
31835
|
-
|
|
31867
|
+
import_react101 = require("react");
|
|
31836
31868
|
init_no_image();
|
|
31837
31869
|
init_utils();
|
|
31838
31870
|
init_useFlowSelector();
|
|
@@ -32365,16 +32397,16 @@ function SendMenu() {
|
|
|
32365
32397
|
userOpHash,
|
|
32366
32398
|
reset
|
|
32367
32399
|
} = useSendTransaction();
|
|
32368
|
-
(0,
|
|
32400
|
+
(0, import_react102.useEffect)(() => {
|
|
32369
32401
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
32370
32402
|
}, [isAssetsLoading, isTransactionPending]);
|
|
32371
|
-
(0,
|
|
32403
|
+
(0, import_react102.useEffect)(() => {
|
|
32372
32404
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
32373
32405
|
}, [sendTransactionError]);
|
|
32374
32406
|
const { txStep, recipient, amount, selectedAsset, setSelectedAsset } = useSendStore();
|
|
32375
32407
|
const isNft = isNftAsset3(selectedAsset);
|
|
32376
32408
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
32377
|
-
(0,
|
|
32409
|
+
(0, import_react102.useEffect)(() => {
|
|
32378
32410
|
const shouldDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
32379
32411
|
if (!shouldDefaultAsset) return;
|
|
32380
32412
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -32384,7 +32416,7 @@ function SendMenu() {
|
|
|
32384
32416
|
if (isBalance(erc20)) return setSelectedAsset(erc20);
|
|
32385
32417
|
setSelectedAsset(assets[0]);
|
|
32386
32418
|
}, [assets, selectedAsset]);
|
|
32387
|
-
(0,
|
|
32419
|
+
(0, import_react102.useEffect)(
|
|
32388
32420
|
() => () => {
|
|
32389
32421
|
useSendStore.getState().reset();
|
|
32390
32422
|
reset();
|
|
@@ -32394,7 +32426,7 @@ function SendMenu() {
|
|
|
32394
32426
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
32395
32427
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
32396
32428
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
32397
|
-
const complianceAmount = (0,
|
|
32429
|
+
const complianceAmount = (0, import_react102.useMemo)(() => {
|
|
32398
32430
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
32399
32431
|
try {
|
|
32400
32432
|
return (0, import_viem23.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -32409,7 +32441,7 @@ function SendMenu() {
|
|
|
32409
32441
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
32410
32442
|
chainId: activeChainId
|
|
32411
32443
|
});
|
|
32412
|
-
(0,
|
|
32444
|
+
(0, import_react102.useEffect)(() => {
|
|
32413
32445
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
32414
32446
|
switch (true) {
|
|
32415
32447
|
case txStep === "select-asset":
|
|
@@ -32479,7 +32511,7 @@ function SendMenu() {
|
|
|
32479
32511
|
] })
|
|
32480
32512
|
] });
|
|
32481
32513
|
}
|
|
32482
|
-
var import_lucide_react84,
|
|
32514
|
+
var import_lucide_react84, import_react102, import_viem23, import_jsx_runtime131;
|
|
32483
32515
|
var init_SendMenu = __esm({
|
|
32484
32516
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
32485
32517
|
init_SessionContext();
|
|
@@ -32488,7 +32520,7 @@ var init_SendMenu = __esm({
|
|
|
32488
32520
|
init_useSendTransaction();
|
|
32489
32521
|
init_useT();
|
|
32490
32522
|
import_lucide_react84 = require("lucide-react");
|
|
32491
|
-
|
|
32523
|
+
import_react102 = require("react");
|
|
32492
32524
|
import_viem23 = require("viem");
|
|
32493
32525
|
init_useBlockscoutAssets2();
|
|
32494
32526
|
init_useLayoutDataStore();
|
|
@@ -32514,7 +32546,7 @@ var init_send = __esm({
|
|
|
32514
32546
|
// src/internal/components/SendMenu/useSendMenuParams.ts
|
|
32515
32547
|
function useSendMenuParams() {
|
|
32516
32548
|
const { config } = useProviderConfig();
|
|
32517
|
-
(0,
|
|
32549
|
+
(0, import_react103.useEffect)(() => {
|
|
32518
32550
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
32519
32551
|
if (!pageParams || !(0, import_lodash_es15.keys)(pageParams).length) return;
|
|
32520
32552
|
const { sendFlow, send: send2, bridge } = pageParams || {};
|
|
@@ -32567,12 +32599,12 @@ function useSendMenuParams() {
|
|
|
32567
32599
|
setPageParams(null);
|
|
32568
32600
|
}, []);
|
|
32569
32601
|
}
|
|
32570
|
-
var import_lodash_es15,
|
|
32602
|
+
var import_lodash_es15, import_react103;
|
|
32571
32603
|
var init_useSendMenuParams = __esm({
|
|
32572
32604
|
"src/internal/components/SendMenu/useSendMenuParams.ts"() {
|
|
32573
32605
|
init_ProviderContext();
|
|
32574
32606
|
import_lodash_es15 = require("lodash-es");
|
|
32575
|
-
|
|
32607
|
+
import_react103 = require("react");
|
|
32576
32608
|
init_useLayoutDataStore();
|
|
32577
32609
|
init_useBridgeStore();
|
|
32578
32610
|
init_useSendStore();
|
|
@@ -32640,17 +32672,17 @@ function SendFlowSelector() {
|
|
|
32640
32672
|
const sendStep = useSendStore((st) => st.txStep);
|
|
32641
32673
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
32642
32674
|
useOnboardingTourAvailable(sendStep === "input" && bridgeStep === "select");
|
|
32643
|
-
(0,
|
|
32675
|
+
(0, import_react104.useEffect)(
|
|
32644
32676
|
() => () => {
|
|
32645
32677
|
useFlowSelectorStore.getState().setError(null);
|
|
32646
32678
|
},
|
|
32647
32679
|
[]
|
|
32648
32680
|
);
|
|
32649
|
-
(0,
|
|
32681
|
+
(0, import_react104.useEffect)(() => {
|
|
32650
32682
|
if (!!config?.current?.features?.showAssetBridge) return;
|
|
32651
32683
|
if (selectorFlow === "bridge") useFlowSelectorStore.getState().setFlow("send");
|
|
32652
32684
|
}, [selectorFlow]);
|
|
32653
|
-
const availableFlows = (0,
|
|
32685
|
+
const availableFlows = (0, import_react104.useMemo)(() => {
|
|
32654
32686
|
const selectorFlows = { send: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(SendMenu, {}) };
|
|
32655
32687
|
if (!!config?.current?.features?.showAssetBridge) selectorFlows.bridge = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(HyperlaneBridge, {});
|
|
32656
32688
|
return selectorFlows;
|
|
@@ -32715,13 +32747,13 @@ function SendFlowSelector() {
|
|
|
32715
32747
|
] })
|
|
32716
32748
|
] });
|
|
32717
32749
|
}
|
|
32718
|
-
var import_lucide_react85,
|
|
32750
|
+
var import_lucide_react85, import_react104, import_jsx_runtime132;
|
|
32719
32751
|
var init_SendFlowSelector = __esm({
|
|
32720
32752
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
32721
32753
|
init_ProviderContext();
|
|
32722
32754
|
init_i18n();
|
|
32723
32755
|
import_lucide_react85 = require("lucide-react");
|
|
32724
|
-
|
|
32756
|
+
import_react104 = require("react");
|
|
32725
32757
|
init_useLayoutDataStore();
|
|
32726
32758
|
init_utils();
|
|
32727
32759
|
init_Expandable2();
|
|
@@ -32772,7 +32804,7 @@ function enableProMode() {
|
|
|
32772
32804
|
return false;
|
|
32773
32805
|
}
|
|
32774
32806
|
}
|
|
32775
|
-
function
|
|
32807
|
+
function subscribe2(callback) {
|
|
32776
32808
|
const handler = () => callback();
|
|
32777
32809
|
window.addEventListener(EVENT_NAME, handler);
|
|
32778
32810
|
return () => window.removeEventListener(EVENT_NAME, handler);
|
|
@@ -32784,12 +32816,12 @@ function getServerSnapshot() {
|
|
|
32784
32816
|
return false;
|
|
32785
32817
|
}
|
|
32786
32818
|
function useProMode() {
|
|
32787
|
-
return (0,
|
|
32819
|
+
return (0, import_react105.useSyncExternalStore)(subscribe2, getSnapshot, getServerSnapshot);
|
|
32788
32820
|
}
|
|
32789
|
-
var
|
|
32821
|
+
var import_react105, STORAGE_KEY, EVENT_NAME;
|
|
32790
32822
|
var init_pro_mode = __esm({
|
|
32791
32823
|
"src/internal/lib/pro-mode.ts"() {
|
|
32792
|
-
|
|
32824
|
+
import_react105 = require("react");
|
|
32793
32825
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
32794
32826
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
32795
32827
|
}
|
|
@@ -33581,7 +33613,7 @@ function TransactionsMenu() {
|
|
|
33581
33613
|
const { t } = useT();
|
|
33582
33614
|
useOnboardingTourAvailable(true);
|
|
33583
33615
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
33584
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
33616
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react106.useState)({});
|
|
33585
33617
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
33586
33618
|
const {
|
|
33587
33619
|
data: txHistoryGroups = [],
|
|
@@ -33594,7 +33626,7 @@ function TransactionsMenu() {
|
|
|
33594
33626
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
33595
33627
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
33596
33628
|
});
|
|
33597
|
-
const refreshTxHistory = (0,
|
|
33629
|
+
const refreshTxHistory = (0, import_react106.useCallback)(
|
|
33598
33630
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
33599
33631
|
[qc, chainConfig.id, address]
|
|
33600
33632
|
);
|
|
@@ -33633,14 +33665,14 @@ function TransactionsMenu() {
|
|
|
33633
33665
|
)) })
|
|
33634
33666
|
] });
|
|
33635
33667
|
}
|
|
33636
|
-
var import_react_query60, import_lucide_react87,
|
|
33668
|
+
var import_react_query60, import_lucide_react87, import_react106, import_jsx_runtime134;
|
|
33637
33669
|
var init_TransactionsMenu = __esm({
|
|
33638
33670
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
33639
33671
|
init_SessionContext();
|
|
33640
33672
|
init_i18n();
|
|
33641
33673
|
import_react_query60 = require("@tanstack/react-query");
|
|
33642
33674
|
import_lucide_react87 = require("lucide-react");
|
|
33643
|
-
|
|
33675
|
+
import_react106 = require("react");
|
|
33644
33676
|
init_useLayoutDataStore();
|
|
33645
33677
|
init_Expandable2();
|
|
33646
33678
|
init_Onboarding();
|
|
@@ -33678,10 +33710,10 @@ var init_TransactionsMenu2 = __esm({
|
|
|
33678
33710
|
});
|
|
33679
33711
|
|
|
33680
33712
|
// src/internal/components/ui/pie-chart.tsx
|
|
33681
|
-
var
|
|
33713
|
+
var import_react107, import_jsx_runtime135, PIE_CHART_COLORS, VIEWBOX, CENTER, RADIUS, polar, PieChart;
|
|
33682
33714
|
var init_pie_chart = __esm({
|
|
33683
33715
|
"src/internal/components/ui/pie-chart.tsx"() {
|
|
33684
|
-
|
|
33716
|
+
import_react107 = require("react");
|
|
33685
33717
|
import_jsx_runtime135 = require("react/jsx-runtime");
|
|
33686
33718
|
PIE_CHART_COLORS = [
|
|
33687
33719
|
"#6366f1",
|
|
@@ -33702,7 +33734,7 @@ var init_pie_chart = __esm({
|
|
|
33702
33734
|
x: CENTER + RADIUS * Math.cos(angle),
|
|
33703
33735
|
y: CENTER + RADIUS * Math.sin(angle)
|
|
33704
33736
|
});
|
|
33705
|
-
PieChart = (0,
|
|
33737
|
+
PieChart = (0, import_react107.forwardRef)((props, ref) => {
|
|
33706
33738
|
const { data, size = 32, gap = 0.75, title, ...svgProps } = props;
|
|
33707
33739
|
const slices = data.map((slice, index) => ({
|
|
33708
33740
|
...slice,
|
|
@@ -33808,14 +33840,14 @@ function SettingsMenu() {
|
|
|
33808
33840
|
queryKey: [PROFILE_QUERY_KEYS.nicknameInfo, address],
|
|
33809
33841
|
queryFn: getNicknameInfo
|
|
33810
33842
|
});
|
|
33811
|
-
const sortedNotifications = (0,
|
|
33843
|
+
const sortedNotifications = (0, import_react108.useMemo)(() => {
|
|
33812
33844
|
return settingsNotifications.slice().sort((a, b) => {
|
|
33813
33845
|
if (a.mandatory && !b.mandatory) return -1;
|
|
33814
33846
|
if (!a.mandatory && b.mandatory) return 1;
|
|
33815
33847
|
return 0;
|
|
33816
33848
|
});
|
|
33817
33849
|
}, [settingsNotifications]);
|
|
33818
|
-
const pieSlices = (0,
|
|
33850
|
+
const pieSlices = (0, import_react108.useMemo)(() => {
|
|
33819
33851
|
if (sortedNotifications?.length === 0) return [{ value: 1, color: "var(--ui-kit-bg-success)" }];
|
|
33820
33852
|
return sortedNotifications.map((notification, _, nArr) => ({
|
|
33821
33853
|
value: 1 / nArr.length,
|
|
@@ -33883,7 +33915,7 @@ function SettingsMenu() {
|
|
|
33883
33915
|
)) })
|
|
33884
33916
|
] });
|
|
33885
33917
|
}
|
|
33886
|
-
var import_react_query61, import_lucide_react89,
|
|
33918
|
+
var import_react_query61, import_lucide_react89, import_react108, import_jsx_runtime136;
|
|
33887
33919
|
var init_SettingsMenu = __esm({
|
|
33888
33920
|
"src/internal/components/SettingsMenu/SettingsMenu.tsx"() {
|
|
33889
33921
|
init_ProviderContext();
|
|
@@ -33891,7 +33923,7 @@ var init_SettingsMenu = __esm({
|
|
|
33891
33923
|
init_i18n();
|
|
33892
33924
|
import_react_query61 = require("@tanstack/react-query");
|
|
33893
33925
|
import_lucide_react89 = require("lucide-react");
|
|
33894
|
-
|
|
33926
|
+
import_react108 = require("react");
|
|
33895
33927
|
init_nickname();
|
|
33896
33928
|
init_profile();
|
|
33897
33929
|
init_useLayoutDataStore();
|
|
@@ -34111,9 +34143,9 @@ function Chip({ selected, onClick, children }) {
|
|
|
34111
34143
|
}
|
|
34112
34144
|
function SecurityActivityFilter({ value, onChange }) {
|
|
34113
34145
|
const { t } = useT();
|
|
34114
|
-
const [isOpen, setIsOpen] = (0,
|
|
34115
|
-
const [draft, setDraft] = (0,
|
|
34116
|
-
(0,
|
|
34146
|
+
const [isOpen, setIsOpen] = (0, import_react109.useState)(false);
|
|
34147
|
+
const [draft, setDraft] = (0, import_react109.useState)(value);
|
|
34148
|
+
(0, import_react109.useEffect)(() => setDraft(value), [value]);
|
|
34117
34149
|
const activeCount = countActiveActivityFilters(value);
|
|
34118
34150
|
const error = validateActivityFilters(draft);
|
|
34119
34151
|
const toggleType = (type) => setDraft((prev) => ({
|
|
@@ -34214,13 +34246,13 @@ function SecurityActivityFilter({ value, onChange }) {
|
|
|
34214
34246
|
] })
|
|
34215
34247
|
] });
|
|
34216
34248
|
}
|
|
34217
|
-
var import_lucide_react90,
|
|
34249
|
+
var import_lucide_react90, import_react109, import_jsx_runtime137;
|
|
34218
34250
|
var init_SecurityActivityFilter = __esm({
|
|
34219
34251
|
"src/internal/components/UserSecurityActivityMenu/SecurityActivityFilter.tsx"() {
|
|
34220
34252
|
init_utils();
|
|
34221
34253
|
init_i18n();
|
|
34222
34254
|
import_lucide_react90 = require("lucide-react");
|
|
34223
|
-
|
|
34255
|
+
import_react109 = require("react");
|
|
34224
34256
|
init_badge();
|
|
34225
34257
|
init_button();
|
|
34226
34258
|
init_highlight();
|
|
@@ -34345,14 +34377,14 @@ var init_useUserSecurityActivity = __esm({
|
|
|
34345
34377
|
function UserSecurityActivityMenu() {
|
|
34346
34378
|
const { t } = useT();
|
|
34347
34379
|
useOnboardingTourAvailable(true);
|
|
34348
|
-
const [filters, setFilters] = (0,
|
|
34349
|
-
const payload = (0,
|
|
34380
|
+
const [filters, setFilters] = (0, import_react110.useState)(DEFAULT_ACTIVITY_FILTERS);
|
|
34381
|
+
const payload = (0, import_react110.useMemo)(() => buildActivityPayload(filters), [filters]);
|
|
34350
34382
|
const hasActiveFilters = countActiveActivityFilters(filters) > 0;
|
|
34351
34383
|
const { data, isLoading, isError, error, hasNextPage, isFetchingNextPage, fetchNextPage } = useUserSecurityActivity(payload);
|
|
34352
|
-
const activities = (0,
|
|
34353
|
-
const sentinelRef = (0,
|
|
34384
|
+
const activities = (0, import_react110.useMemo)(() => data?.pages.flatMap((page) => page.events) ?? [], [data]);
|
|
34385
|
+
const sentinelRef = (0, import_react110.useRef)(null);
|
|
34354
34386
|
const canLoadMore = !!hasNextPage && !isFetchingNextPage && !isError;
|
|
34355
|
-
(0,
|
|
34387
|
+
(0, import_react110.useEffect)(() => {
|
|
34356
34388
|
const sentinel = sentinelRef.current;
|
|
34357
34389
|
if (!sentinel || !canLoadMore) return;
|
|
34358
34390
|
const observer = new IntersectionObserver(
|
|
@@ -34389,12 +34421,12 @@ function UserSecurityActivityMenu() {
|
|
|
34389
34421
|
] })
|
|
34390
34422
|
] });
|
|
34391
34423
|
}
|
|
34392
|
-
var import_lucide_react92,
|
|
34424
|
+
var import_lucide_react92, import_react110, import_jsx_runtime139;
|
|
34393
34425
|
var init_UserSecurityActivityMenu = __esm({
|
|
34394
34426
|
"src/internal/components/UserSecurityActivityMenu/UserSecurityActivityMenu.tsx"() {
|
|
34395
34427
|
init_i18n();
|
|
34396
34428
|
import_lucide_react92 = require("lucide-react");
|
|
34397
|
-
|
|
34429
|
+
import_react110 = require("react");
|
|
34398
34430
|
init_useLayoutDataStore();
|
|
34399
34431
|
init_Expandable2();
|
|
34400
34432
|
init_Onboarding();
|
|
@@ -34615,12 +34647,12 @@ var init_PageMap = __esm({
|
|
|
34615
34647
|
// src/internal/hooks/usePageMapper.tsx
|
|
34616
34648
|
function usePageMapper() {
|
|
34617
34649
|
const page = useLayoutDataStore((st) => st.page);
|
|
34618
|
-
const closeTimeoutRef = (0,
|
|
34619
|
-
const cancelPendingClose = (0,
|
|
34650
|
+
const closeTimeoutRef = (0, import_react111.useRef)(null);
|
|
34651
|
+
const cancelPendingClose = (0, import_react111.useCallback)(() => {
|
|
34620
34652
|
if (closeTimeoutRef.current) clearTimeout(closeTimeoutRef.current);
|
|
34621
34653
|
closeTimeoutRef.current = null;
|
|
34622
34654
|
}, []);
|
|
34623
|
-
const closeDialog = (0,
|
|
34655
|
+
const closeDialog = (0, import_react111.useCallback)(() => {
|
|
34624
34656
|
cancelPendingClose();
|
|
34625
34657
|
if (!useLayoutStore.getState().isDialogOpen) {
|
|
34626
34658
|
useLayoutStore.setState({ dialogContent: null, isDialogAnimating: false, isDialogForced: false });
|
|
@@ -34638,7 +34670,7 @@ function usePageMapper() {
|
|
|
34638
34670
|
});
|
|
34639
34671
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
34640
34672
|
}, [cancelPendingClose]);
|
|
34641
|
-
const openDialog = (0,
|
|
34673
|
+
const openDialog = (0, import_react111.useCallback)((pageItem) => {
|
|
34642
34674
|
cancelPendingClose();
|
|
34643
34675
|
useLayoutStore.setState({
|
|
34644
34676
|
dialogContent: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(pageItem.component, {}),
|
|
@@ -34646,8 +34678,8 @@ function usePageMapper() {
|
|
|
34646
34678
|
isDialogAnimating: false
|
|
34647
34679
|
});
|
|
34648
34680
|
}, [cancelPendingClose]);
|
|
34649
|
-
(0,
|
|
34650
|
-
(0,
|
|
34681
|
+
(0, import_react111.useEffect)(() => cancelPendingClose, [cancelPendingClose]);
|
|
34682
|
+
(0, import_react111.useEffect)(() => {
|
|
34651
34683
|
if (page === null) return closeDialog();
|
|
34652
34684
|
const pageItem = PAGE_MAP[page];
|
|
34653
34685
|
if (!pageItem) {
|
|
@@ -34658,10 +34690,10 @@ function usePageMapper() {
|
|
|
34658
34690
|
openDialog(pageItem);
|
|
34659
34691
|
}, [page, closeDialog, openDialog]);
|
|
34660
34692
|
}
|
|
34661
|
-
var
|
|
34693
|
+
var import_react111, import_jsx_runtime140, CLEAR_DIALOG_TIMEOUT;
|
|
34662
34694
|
var init_usePageMapper = __esm({
|
|
34663
34695
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
34664
|
-
|
|
34696
|
+
import_react111 = require("react");
|
|
34665
34697
|
init_PageMap();
|
|
34666
34698
|
init_constants();
|
|
34667
34699
|
init_useLayoutDataStore();
|
|
@@ -34690,8 +34722,8 @@ function useSettingsNotifications() {
|
|
|
34690
34722
|
});
|
|
34691
34723
|
const isNotificationsLoading = isSessionLoading || //
|
|
34692
34724
|
isSecurityStatusLoading || isUserProfileLoading || isProvidersLoading || isKeyshareReshareLoading;
|
|
34693
|
-
(0,
|
|
34694
|
-
(0,
|
|
34725
|
+
(0, import_react112.useEffect)(() => useLayoutDataStore.setState({ isNotificationsLoading }), [isNotificationsLoading]);
|
|
34726
|
+
(0, import_react112.useEffect)(() => {
|
|
34695
34727
|
if (isNotificationsLoading || !keyshareReshare) return;
|
|
34696
34728
|
useLayoutDataStore.getState().setSettingsNotifications({
|
|
34697
34729
|
id: "keyshare-reshare-required",
|
|
@@ -34702,7 +34734,7 @@ function useSettingsNotifications() {
|
|
|
34702
34734
|
message: t("passport:securityMenu.keyshareReshare.notification")
|
|
34703
34735
|
});
|
|
34704
34736
|
}, [t, isNotificationsLoading, keyshareReshare]);
|
|
34705
|
-
(0,
|
|
34737
|
+
(0, import_react112.useEffect)(() => {
|
|
34706
34738
|
if (isNotificationsLoading || !backupWarning?.enabled || !securityStatus) return;
|
|
34707
34739
|
const isProtectedBackupMissing = !securityStatus?.level || securityStatus?.level === "basic";
|
|
34708
34740
|
useLayoutDataStore.getState().setSettingsNotifications({
|
|
@@ -34714,7 +34746,7 @@ function useSettingsNotifications() {
|
|
|
34714
34746
|
message: t("passport:securityMenu.securityLevel.basic.description")
|
|
34715
34747
|
});
|
|
34716
34748
|
}, [t, isNotificationsLoading, backupWarning, securityStatus]);
|
|
34717
|
-
(0,
|
|
34749
|
+
(0, import_react112.useEffect)(() => {
|
|
34718
34750
|
if (isNotificationsLoading || !isKYCconfigured || !kycNotCompletedWarning?.enabled) return;
|
|
34719
34751
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
34720
34752
|
useLayoutDataStore.getState().setSettingsNotifications({
|
|
@@ -34727,7 +34759,7 @@ function useSettingsNotifications() {
|
|
|
34727
34759
|
});
|
|
34728
34760
|
}, [t, isNotificationsLoading, isKYCconfigured, kycNotCompletedWarning, userProfile]);
|
|
34729
34761
|
const hasEmail = providers.map((p) => p.provider).includes("email");
|
|
34730
|
-
(0,
|
|
34762
|
+
(0, import_react112.useEffect)(() => {
|
|
34731
34763
|
if (isNotificationsLoading || !emailNotConnectedWarning?.enabled) return;
|
|
34732
34764
|
useLayoutDataStore.getState().setSettingsNotifications({
|
|
34733
34765
|
id: "email-not-connected",
|
|
@@ -34739,14 +34771,14 @@ function useSettingsNotifications() {
|
|
|
34739
34771
|
});
|
|
34740
34772
|
}, [t, isNotificationsLoading, hasEmail]);
|
|
34741
34773
|
}
|
|
34742
|
-
var import_react_query63,
|
|
34774
|
+
var import_react_query63, import_react112;
|
|
34743
34775
|
var init_useSettingsNotifications = __esm({
|
|
34744
34776
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
34745
34777
|
init_ProviderContext();
|
|
34746
34778
|
init_SessionContext();
|
|
34747
34779
|
init_i18n();
|
|
34748
34780
|
import_react_query63 = require("@tanstack/react-query");
|
|
34749
|
-
|
|
34781
|
+
import_react112 = require("react");
|
|
34750
34782
|
init_common();
|
|
34751
34783
|
init_ManageWalletMenu();
|
|
34752
34784
|
init_useKeyshareReshareCheck();
|
|
@@ -34848,7 +34880,7 @@ var init_package = __esm({
|
|
|
34848
34880
|
"package.json"() {
|
|
34849
34881
|
package_default = {
|
|
34850
34882
|
name: "@embarkai/ui-kit",
|
|
34851
|
-
version: "0.6.
|
|
34883
|
+
version: "0.6.13",
|
|
34852
34884
|
description: "React UI components and hooks for embarkAI authentication and Account Abstraction",
|
|
34853
34885
|
type: "module",
|
|
34854
34886
|
main: "./dist/index.cjs",
|
|
@@ -34985,7 +35017,7 @@ function Footer() {
|
|
|
34985
35017
|
return { disconnectedUserId: userId, disconnectAddress };
|
|
34986
35018
|
},
|
|
34987
35019
|
onSuccess: async ({ disconnectAddress, disconnectedUserId }) => {
|
|
34988
|
-
|
|
35020
|
+
qc.removeQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
|
|
34989
35021
|
if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
|
|
34990
35022
|
const { setError, setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
|
|
34991
35023
|
setSession(null);
|
|
@@ -35198,11 +35230,11 @@ function Header() {
|
|
|
35198
35230
|
const embarkPage = useLayoutDataStore((st) => st.page);
|
|
35199
35231
|
const isOnboardingTourAvailable = useOnboardingStore((st) => st.isTourAvailable);
|
|
35200
35232
|
const proMode = useProMode();
|
|
35201
|
-
const [proToast, setProToast] = (0,
|
|
35202
|
-
const [copied, setCopied] = (0,
|
|
35203
|
-
const clickCountRef = (0,
|
|
35204
|
-
const clickTimerRef = (0,
|
|
35205
|
-
const handleAvatarClick = (0,
|
|
35233
|
+
const [proToast, setProToast] = (0, import_react113.useState)(false);
|
|
35234
|
+
const [copied, setCopied] = (0, import_react113.useState)(false);
|
|
35235
|
+
const clickCountRef = (0, import_react113.useRef)(0);
|
|
35236
|
+
const clickTimerRef = (0, import_react113.useRef)(null);
|
|
35237
|
+
const handleAvatarClick = (0, import_react113.useCallback)(() => {
|
|
35206
35238
|
clickCountRef.current += 1;
|
|
35207
35239
|
if (clickTimerRef.current) {
|
|
35208
35240
|
clearTimeout(clickTimerRef.current);
|
|
@@ -35305,7 +35337,7 @@ function Header() {
|
|
|
35305
35337
|
}
|
|
35306
35338
|
);
|
|
35307
35339
|
}
|
|
35308
|
-
var import_lucide_react94,
|
|
35340
|
+
var import_lucide_react94, import_react113, import_jsx_runtime144;
|
|
35309
35341
|
var init_Header = __esm({
|
|
35310
35342
|
"src/internal/components/Header/Header.tsx"() {
|
|
35311
35343
|
init_lumia2();
|
|
@@ -35313,7 +35345,7 @@ var init_Header = __esm({
|
|
|
35313
35345
|
init_ProviderContext();
|
|
35314
35346
|
init_SessionContext();
|
|
35315
35347
|
import_lucide_react94 = require("lucide-react");
|
|
35316
|
-
|
|
35348
|
+
import_react113 = require("react");
|
|
35317
35349
|
init_icons();
|
|
35318
35350
|
init_useLayoutDataStore();
|
|
35319
35351
|
init_useUserProfile();
|
|
@@ -35346,7 +35378,7 @@ function useDecideContentStyles() {
|
|
|
35346
35378
|
style: (0, import_lodash_es16.merge)({}, mobileStyles)
|
|
35347
35379
|
};
|
|
35348
35380
|
}
|
|
35349
|
-
var DialogPrimitive, import_lodash_es16, import_lucide_react95,
|
|
35381
|
+
var DialogPrimitive, import_lodash_es16, import_lucide_react95, import_react114, import_jsx_runtime145, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
35350
35382
|
var init_dialog = __esm({
|
|
35351
35383
|
"src/internal/components/ui/dialog.tsx"() {
|
|
35352
35384
|
init_utils();
|
|
@@ -35355,14 +35387,14 @@ var init_dialog = __esm({
|
|
|
35355
35387
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
35356
35388
|
import_lodash_es16 = require("lodash-es");
|
|
35357
35389
|
import_lucide_react95 = require("lucide-react");
|
|
35358
|
-
|
|
35390
|
+
import_react114 = require("react");
|
|
35359
35391
|
init_useLayoutDataStore();
|
|
35360
35392
|
init_useLayoutStore();
|
|
35361
35393
|
init_button();
|
|
35362
35394
|
import_jsx_runtime145 = require("react/jsx-runtime");
|
|
35363
35395
|
Dialog = DialogPrimitive.Root;
|
|
35364
35396
|
DialogPortal = DialogPrimitive.Portal;
|
|
35365
|
-
DialogOverlay = (0,
|
|
35397
|
+
DialogOverlay = (0, import_react114.forwardRef)(
|
|
35366
35398
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
35367
35399
|
DialogPrimitive.Overlay,
|
|
35368
35400
|
{
|
|
@@ -35384,7 +35416,7 @@ var init_dialog = __esm({
|
|
|
35384
35416
|
border: "1px solid var(--ui-kit-bd)",
|
|
35385
35417
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
35386
35418
|
};
|
|
35387
|
-
DialogContent = (0,
|
|
35419
|
+
DialogContent = (0, import_react114.forwardRef)(
|
|
35388
35420
|
({ className, children, colorMode, ...props }, ref) => {
|
|
35389
35421
|
const { t, i18n } = useT();
|
|
35390
35422
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -35509,7 +35541,7 @@ var init_dialog = __esm({
|
|
|
35509
35541
|
DialogHeader.displayName = "DialogHeader";
|
|
35510
35542
|
DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("div", { className: cn2("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
|
|
35511
35543
|
DialogFooter.displayName = "DialogFooter";
|
|
35512
|
-
DialogTitle = (0,
|
|
35544
|
+
DialogTitle = (0, import_react114.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
35513
35545
|
DialogPrimitive.Title,
|
|
35514
35546
|
{
|
|
35515
35547
|
ref,
|
|
@@ -35518,7 +35550,7 @@ var init_dialog = __esm({
|
|
|
35518
35550
|
}
|
|
35519
35551
|
));
|
|
35520
35552
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
35521
|
-
DialogDescription = (0,
|
|
35553
|
+
DialogDescription = (0, import_react114.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(DialogPrimitive.Description, { ref, className: cn2("text-sm text-muted-foreground", className), ...props }));
|
|
35522
35554
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
35523
35555
|
}
|
|
35524
35556
|
});
|
|
@@ -35540,7 +35572,7 @@ function Dialog2() {
|
|
|
35540
35572
|
const { colorMode, maxScrollHeight, isDialogOpen, dialogContent, isDialogForced, isBackupRequired } = useLayoutStore();
|
|
35541
35573
|
const page = useLayoutDataStore((st) => st.page);
|
|
35542
35574
|
const transitionPageHeight = useLayoutDataStore((st) => st.transitionPageHeight);
|
|
35543
|
-
(0,
|
|
35575
|
+
(0, import_react116.useEffect)(() => useLayoutStore.setState({ isSettings: !!session }), [session]);
|
|
35544
35576
|
usePageMapper();
|
|
35545
35577
|
useAutoConnect();
|
|
35546
35578
|
useBackupStatusChanges();
|
|
@@ -35571,8 +35603,8 @@ function Dialog2() {
|
|
|
35571
35603
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(DialogTitle, { children: "embarkAI" }) }),
|
|
35572
35604
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(DialogDescription, { className: "sr-only", children: "embarkAI wallet" }),
|
|
35573
35605
|
!isHeaderHidden && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(Header, {}),
|
|
35574
|
-
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
35575
|
-
|
|
35606
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(import_react115.AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
35607
|
+
import_react115.motion.div,
|
|
35576
35608
|
{
|
|
35577
35609
|
style: { overflow: "hidden" },
|
|
35578
35610
|
initial: { opacity: 0, height: transitionPageHeight },
|
|
@@ -35601,13 +35633,13 @@ function Dialog2() {
|
|
|
35601
35633
|
}
|
|
35602
35634
|
);
|
|
35603
35635
|
}
|
|
35604
|
-
var
|
|
35636
|
+
var import_react115, import_react116, import_jsx_runtime147;
|
|
35605
35637
|
var init_Dialog = __esm({
|
|
35606
35638
|
"src/internal/components/Dialog/Dialog.tsx"() {
|
|
35607
35639
|
init_ProviderContext();
|
|
35608
35640
|
init_SessionContext();
|
|
35609
|
-
|
|
35610
|
-
|
|
35641
|
+
import_react115 = require("motion/react");
|
|
35642
|
+
import_react116 = require("react");
|
|
35611
35643
|
init_constants();
|
|
35612
35644
|
init_useAllowExternalModalsScroll();
|
|
35613
35645
|
init_useAutoConnect();
|
|
@@ -35642,12 +35674,12 @@ function DirectWalletHandler() {
|
|
|
35642
35674
|
const externalConnectorName = useExternalWalletStore((st) => st.connectorName);
|
|
35643
35675
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
35644
35676
|
const { address, isConnected, chainId, connector } = (0, import_wagmi8.useConnection)();
|
|
35645
|
-
(0,
|
|
35677
|
+
(0, import_react117.useEffect)(() => {
|
|
35646
35678
|
const { setConfigMode, setActiveMode } = useExternalWalletStore.getState();
|
|
35647
35679
|
setConfigMode(walletMode);
|
|
35648
35680
|
if (walletMode !== "both") setActiveMode(walletMode);
|
|
35649
35681
|
}, [walletMode]);
|
|
35650
|
-
(0,
|
|
35682
|
+
(0, import_react117.useEffect)(() => {
|
|
35651
35683
|
if ((!!externalAddress || isExternalConnected) && !isConnected) {
|
|
35652
35684
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
35653
35685
|
return;
|
|
@@ -35669,10 +35701,10 @@ function DirectWalletHandler() {
|
|
|
35669
35701
|
]);
|
|
35670
35702
|
return null;
|
|
35671
35703
|
}
|
|
35672
|
-
var
|
|
35704
|
+
var import_react117, import_wagmi8;
|
|
35673
35705
|
var init_DirectWalletHandler = __esm({
|
|
35674
35706
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
35675
|
-
|
|
35707
|
+
import_react117 = require("react");
|
|
35676
35708
|
import_wagmi8 = require("wagmi");
|
|
35677
35709
|
init_ProviderContext();
|
|
35678
35710
|
init_useExternalWalletStore();
|
|
@@ -35680,14 +35712,14 @@ var init_DirectWalletHandler = __esm({
|
|
|
35680
35712
|
});
|
|
35681
35713
|
|
|
35682
35714
|
// src/internal/components/TssManager.tsx
|
|
35683
|
-
var
|
|
35715
|
+
var import_react118, TssManagerWithRef;
|
|
35684
35716
|
var init_TssManager = __esm({
|
|
35685
35717
|
"src/internal/components/TssManager.tsx"() {
|
|
35686
35718
|
init_SessionContext();
|
|
35687
|
-
|
|
35719
|
+
import_react118 = __toESM(require("react"), 1);
|
|
35688
35720
|
init_auth();
|
|
35689
35721
|
init_clients();
|
|
35690
|
-
TssManagerWithRef =
|
|
35722
|
+
TssManagerWithRef = import_react118.default.forwardRef((props, ref) => {
|
|
35691
35723
|
const { mpcPin } = props;
|
|
35692
35724
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
35693
35725
|
const publicClient = useSession((st) => st.publicClient);
|
|
@@ -35695,14 +35727,14 @@ var init_TssManager = __esm({
|
|
|
35695
35727
|
const setStatus = useSession((st) => st.setStatus);
|
|
35696
35728
|
const setSession = useSession((st) => st.setSession);
|
|
35697
35729
|
const setAddress = useSession((st) => st.setAddress);
|
|
35698
|
-
const onSessionCreated = (0,
|
|
35730
|
+
const onSessionCreated = (0, import_react118.useCallback)(
|
|
35699
35731
|
(session, address) => {
|
|
35700
35732
|
setSession(session);
|
|
35701
35733
|
setAddress(address);
|
|
35702
35734
|
},
|
|
35703
35735
|
[setSession, setAddress]
|
|
35704
35736
|
);
|
|
35705
|
-
const createSessionWithKeyshare =
|
|
35737
|
+
const createSessionWithKeyshare = import_react118.default.useCallback(
|
|
35706
35738
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
35707
35739
|
setStatus("checking key management setup...");
|
|
35708
35740
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -35727,7 +35759,7 @@ var init_TssManager = __esm({
|
|
|
35727
35759
|
},
|
|
35728
35760
|
[setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
|
|
35729
35761
|
);
|
|
35730
|
-
|
|
35762
|
+
import_react118.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
35731
35763
|
return null;
|
|
35732
35764
|
});
|
|
35733
35765
|
}
|
|
@@ -35759,7 +35791,7 @@ function waitForStoreHydration() {
|
|
|
35759
35791
|
}
|
|
35760
35792
|
function SessionProvider({ children }) {
|
|
35761
35793
|
const config = useProviderConfig().config;
|
|
35762
|
-
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
35794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(import_react119.Fragment, {
|
|
35763
35795
|
/** dApp's router might have its own error boundaries setup via imported @embarkai/ui-kitErrorBoundary */
|
|
35764
35796
|
children: [
|
|
35765
35797
|
children,
|
|
@@ -35780,11 +35812,11 @@ function SessionProvider({ children }) {
|
|
|
35780
35812
|
]
|
|
35781
35813
|
});
|
|
35782
35814
|
}
|
|
35783
|
-
var import_read25,
|
|
35815
|
+
var import_read25, import_react119, import_zustand20, import_middleware4, import_jsx_runtime148, useSession, requireActiveChainId;
|
|
35784
35816
|
var init_SessionContext = __esm({
|
|
35785
35817
|
"src/context/SessionContext.tsx"() {
|
|
35786
35818
|
import_read25 = require("@embarkai/core/read");
|
|
35787
|
-
|
|
35819
|
+
import_react119 = require("react");
|
|
35788
35820
|
import_zustand20 = require("zustand");
|
|
35789
35821
|
import_middleware4 = require("zustand/middleware");
|
|
35790
35822
|
init_ErrorBoundary2();
|
|
@@ -35895,9 +35927,9 @@ __export(iframe_manager_exports, {
|
|
|
35895
35927
|
withSessionToken: () => withSessionToken
|
|
35896
35928
|
});
|
|
35897
35929
|
function legacyAccessTokenForIframe() {
|
|
35898
|
-
const kind =
|
|
35930
|
+
const kind = import_auth30.jwtTokenManager.getSessionKind();
|
|
35899
35931
|
if (!kind || kind === "dapp") return void 0;
|
|
35900
|
-
return
|
|
35932
|
+
return import_auth30.jwtTokenManager.getAccessToken() ?? void 0;
|
|
35901
35933
|
}
|
|
35902
35934
|
function withSessionToken(type, data) {
|
|
35903
35935
|
if (SESSION_FREE_MESSAGES.has(type)) return data;
|
|
@@ -35931,10 +35963,10 @@ function destroyIframeManager() {
|
|
|
35931
35963
|
iframeManagerInstance = null;
|
|
35932
35964
|
}
|
|
35933
35965
|
}
|
|
35934
|
-
var
|
|
35966
|
+
var import_auth30, IframeManager, iframeManagerInstance;
|
|
35935
35967
|
var init_iframe_manager = __esm({
|
|
35936
35968
|
"src/internal/lib/iframe-manager.ts"() {
|
|
35937
|
-
|
|
35969
|
+
import_auth30 = require("@embarkai/core/auth");
|
|
35938
35970
|
init_errors();
|
|
35939
35971
|
init_session_messages();
|
|
35940
35972
|
init_sdk_version();
|
|
@@ -36053,7 +36085,7 @@ var init_iframe_manager = __esm({
|
|
|
36053
36085
|
this.destroy();
|
|
36054
36086
|
throw error;
|
|
36055
36087
|
}
|
|
36056
|
-
(0,
|
|
36088
|
+
(0, import_auth30.setDappSessionRecovery)(async (userId) => {
|
|
36057
36089
|
const pair = await this.getDappTokens();
|
|
36058
36090
|
return pair && pair.userId === userId ? pair : null;
|
|
36059
36091
|
});
|
|
@@ -37337,7 +37369,7 @@ var init_iframe_manager = __esm({
|
|
|
37337
37369
|
*/
|
|
37338
37370
|
destroy() {
|
|
37339
37371
|
this.log("[IframeManager] Destroying iframe...");
|
|
37340
|
-
(0,
|
|
37372
|
+
(0, import_auth30.setDappSessionRecovery)(null);
|
|
37341
37373
|
this.stopHeartbeat();
|
|
37342
37374
|
this.pendingRequests.forEach((pending) => {
|
|
37343
37375
|
pending.reject(new Error("Iframe manager destroyed"));
|
|
@@ -37410,17 +37442,17 @@ function clearLegacyWagmiStorage() {
|
|
|
37410
37442
|
function Provider2(props) {
|
|
37411
37443
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
37412
37444
|
const queryClient = (0, import_react_query65.useQueryClient)();
|
|
37413
|
-
const callbacksRef = (0,
|
|
37414
|
-
(0,
|
|
37415
|
-
const config = (0,
|
|
37445
|
+
const callbacksRef = (0, import_react120.useRef)(callbacks);
|
|
37446
|
+
(0, import_react120.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
37447
|
+
const config = (0, import_react120.useRef)(
|
|
37416
37448
|
(() => {
|
|
37417
37449
|
const merged = (0, import_lodash_es17.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig);
|
|
37418
37450
|
merged.services = resolveServices(merged.services);
|
|
37419
37451
|
return merged;
|
|
37420
37452
|
})()
|
|
37421
37453
|
);
|
|
37422
|
-
const wagmiConfig3 = (0,
|
|
37423
|
-
const updateConfig = (0,
|
|
37454
|
+
const wagmiConfig3 = (0, import_react120.useRef)((0, import_core9.getWagmiConfig)(config.current?.wallet?.walletConnectId || null));
|
|
37455
|
+
const updateConfig = (0, import_react120.useCallback)((updates) => {
|
|
37424
37456
|
const prev = config.current;
|
|
37425
37457
|
const next = { ...prev };
|
|
37426
37458
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -37449,12 +37481,12 @@ function Provider2(props) {
|
|
|
37449
37481
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
37450
37482
|
config.current = next;
|
|
37451
37483
|
}, []);
|
|
37452
|
-
const updateCallbacks = (0,
|
|
37484
|
+
const updateCallbacks = (0, import_react120.useCallback)((updates) => {
|
|
37453
37485
|
const prev = callbacksRef.current;
|
|
37454
37486
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
37455
37487
|
callbacksRef.current = next;
|
|
37456
37488
|
}, []);
|
|
37457
|
-
(0,
|
|
37489
|
+
(0, import_react120.useEffect)(() => {
|
|
37458
37490
|
if (typeof window === "undefined" || !projectId) return;
|
|
37459
37491
|
const mergedConfig = (0, import_lodash_es17.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
37460
37492
|
mergedConfig.services = resolveServices(mergedConfig.services);
|
|
@@ -37475,7 +37507,7 @@ function Provider2(props) {
|
|
|
37475
37507
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
37476
37508
|
}
|
|
37477
37509
|
}, [projectId, initialConfig]);
|
|
37478
|
-
(0,
|
|
37510
|
+
(0, import_react120.useEffect)(() => {
|
|
37479
37511
|
if (typeof window === "undefined" || !projectId) return;
|
|
37480
37512
|
try {
|
|
37481
37513
|
(0, import_error_tracking4.initSdkErrorTracking)();
|
|
@@ -37504,7 +37536,7 @@ function Provider2(props) {
|
|
|
37504
37536
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
37505
37537
|
}
|
|
37506
37538
|
}, [projectId]);
|
|
37507
|
-
(0,
|
|
37539
|
+
(0, import_react120.useEffect)(() => {
|
|
37508
37540
|
if (!projectId) return;
|
|
37509
37541
|
try {
|
|
37510
37542
|
getIframeManager().setQueryClient(queryClient);
|
|
@@ -37513,7 +37545,7 @@ function Provider2(props) {
|
|
|
37513
37545
|
console.warn("[PROVIDER] No iframe manager available yet to set query client");
|
|
37514
37546
|
}
|
|
37515
37547
|
}, [queryClient, projectId]);
|
|
37516
|
-
const contextValue = (0,
|
|
37548
|
+
const contextValue = (0, import_react120.useMemo)(
|
|
37517
37549
|
() => ({
|
|
37518
37550
|
config,
|
|
37519
37551
|
updateConfig,
|
|
@@ -37526,23 +37558,23 @@ function Provider2(props) {
|
|
|
37526
37558
|
);
|
|
37527
37559
|
return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(import_wagmi9.WagmiProvider, { config: wagmiConfig3.current, children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(SessionProvider, { children }) }) });
|
|
37528
37560
|
}
|
|
37529
|
-
var import_core9, import_error_tracking4, import_react_query65, import_lodash_es17,
|
|
37561
|
+
var import_core9, import_error_tracking4, import_react_query65, import_lodash_es17, import_react120, import_wagmi9, import_jsx_runtime149, UIContext, useProviderConfig;
|
|
37530
37562
|
var init_ProviderContext = __esm({
|
|
37531
37563
|
"src/context/ProviderContext.tsx"() {
|
|
37532
37564
|
import_core9 = require("@embarkai/core");
|
|
37533
37565
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
37534
37566
|
import_react_query65 = require("@tanstack/react-query");
|
|
37535
37567
|
import_lodash_es17 = require("lodash-es");
|
|
37536
|
-
|
|
37568
|
+
import_react120 = require("react");
|
|
37537
37569
|
import_wagmi9 = require("wagmi");
|
|
37538
37570
|
init_initial();
|
|
37539
37571
|
init_iframe_manager();
|
|
37540
37572
|
init_SessionContext();
|
|
37541
37573
|
init_utils14();
|
|
37542
37574
|
import_jsx_runtime149 = require("react/jsx-runtime");
|
|
37543
|
-
UIContext = (0,
|
|
37575
|
+
UIContext = (0, import_react120.createContext)(void 0);
|
|
37544
37576
|
useProviderConfig = () => {
|
|
37545
|
-
const ctx = (0,
|
|
37577
|
+
const ctx = (0, import_react120.useContext)(UIContext);
|
|
37546
37578
|
if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
|
|
37547
37579
|
return ctx;
|
|
37548
37580
|
};
|
|
@@ -37666,7 +37698,7 @@ init_ErrorBoundary2();
|
|
|
37666
37698
|
// src/components/ConnectWalletButton.tsx
|
|
37667
37699
|
init_embarkAI2();
|
|
37668
37700
|
var import_lucide_react96 = require("lucide-react");
|
|
37669
|
-
var
|
|
37701
|
+
var import_react121 = require("react");
|
|
37670
37702
|
init_SessionContext();
|
|
37671
37703
|
init_BalanceView2();
|
|
37672
37704
|
init_button();
|
|
@@ -37685,7 +37717,7 @@ function getFormattedStatus(label, status, showStatus) {
|
|
|
37685
37717
|
function NotificationsIndicator() {
|
|
37686
37718
|
const settingsNotifications = useLayoutDataStore((st) => st.settingsNotifications);
|
|
37687
37719
|
const isNotificationsLoading = useLayoutDataStore((st) => st.isNotificationsLoading);
|
|
37688
|
-
const pieSlices = (0,
|
|
37720
|
+
const pieSlices = (0, import_react121.useMemo)(() => {
|
|
37689
37721
|
if (settingsNotifications?.length === 0) return [{ value: 1, color: "var(--ui-kit-bg-success)" }];
|
|
37690
37722
|
return settingsNotifications.map((notification, _, nArr) => ({
|
|
37691
37723
|
value: 1 / nArr.length,
|
|
@@ -37741,7 +37773,7 @@ function ConnectWalletButton(props) {
|
|
|
37741
37773
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
37742
37774
|
const { address, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
37743
37775
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
37744
|
-
(0,
|
|
37776
|
+
(0, import_react121.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
37745
37777
|
const { data: profile, isLoading: isProfileLoading } = useUserProfile();
|
|
37746
37778
|
const proMode = useProMode();
|
|
37747
37779
|
const displayName = profile?.nicknameDisplay || profile?.displayName;
|
|
@@ -38298,14 +38330,14 @@ var Hash = ({
|
|
|
38298
38330
|
};
|
|
38299
38331
|
|
|
38300
38332
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
38301
|
-
var
|
|
38333
|
+
var import_react122 = require("react");
|
|
38302
38334
|
init_base();
|
|
38303
38335
|
var import_jsx_runtime156 = require("react/jsx-runtime");
|
|
38304
38336
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
38305
|
-
const [transactions, setTransactions] = (0,
|
|
38306
|
-
const [loading, setLoading] = (0,
|
|
38307
|
-
const [error, setError] = (0,
|
|
38308
|
-
(0,
|
|
38337
|
+
const [transactions, setTransactions] = (0, import_react122.useState)([]);
|
|
38338
|
+
const [loading, setLoading] = (0, import_react122.useState)(true);
|
|
38339
|
+
const [error, setError] = (0, import_react122.useState)(null);
|
|
38340
|
+
(0, import_react122.useEffect)(() => {
|
|
38309
38341
|
const fetchTransactions2 = async () => {
|
|
38310
38342
|
try {
|
|
38311
38343
|
setLoading(true);
|
|
@@ -38596,13 +38628,13 @@ function useUserOpStatus(options = {}) {
|
|
|
38596
38628
|
init_useErc3643Compliance();
|
|
38597
38629
|
|
|
38598
38630
|
// src/hooks/useWalletMode.ts
|
|
38599
|
-
var
|
|
38631
|
+
var import_react123 = require("react");
|
|
38600
38632
|
init_useExternalWalletStore();
|
|
38601
38633
|
function useWalletMode() {
|
|
38602
38634
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
38603
38635
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
38604
38636
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
38605
|
-
const switchMode = (0,
|
|
38637
|
+
const switchMode = (0, import_react123.useCallback)(
|
|
38606
38638
|
(mode) => {
|
|
38607
38639
|
if (configMode !== "both") return;
|
|
38608
38640
|
setActiveMode(mode);
|
|
@@ -38620,7 +38652,7 @@ function useWalletMode() {
|
|
|
38620
38652
|
// src/hooks/useDirectWallet.ts
|
|
38621
38653
|
init_useOpenPage();
|
|
38622
38654
|
init_useSafeDisconnect();
|
|
38623
|
-
var
|
|
38655
|
+
var import_react124 = require("react");
|
|
38624
38656
|
init_useExternalWalletStore();
|
|
38625
38657
|
function useDirectWallet() {
|
|
38626
38658
|
const address = useExternalWalletStore((st) => st.externalAddress);
|
|
@@ -38629,10 +38661,10 @@ function useDirectWallet() {
|
|
|
38629
38661
|
const connectorName = useExternalWalletStore((st) => st.connectorName);
|
|
38630
38662
|
const { open: openEmbarkAI } = useOpenPage();
|
|
38631
38663
|
const { mutate: wagmiDisconnect } = useSafeDisconnect();
|
|
38632
|
-
const connect = (0,
|
|
38664
|
+
const connect = (0, import_react124.useCallback)((connectFlowType = "connect") => {
|
|
38633
38665
|
openEmbarkAI("connect-external-wallet" /* CONNECT_EXTERNAL_WALLET */, { connectFlowType });
|
|
38634
38666
|
}, []);
|
|
38635
|
-
const disconnect = (0,
|
|
38667
|
+
const disconnect = (0, import_react124.useCallback)(() => {
|
|
38636
38668
|
wagmiDisconnect();
|
|
38637
38669
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
38638
38670
|
}, [wagmiDisconnect]);
|
|
@@ -38648,7 +38680,7 @@ function useDirectWallet() {
|
|
|
38648
38680
|
}
|
|
38649
38681
|
|
|
38650
38682
|
// src/hooks/useSendDirectTransaction.ts
|
|
38651
|
-
var
|
|
38683
|
+
var import_react125 = require("react");
|
|
38652
38684
|
var import_viem24 = require("viem");
|
|
38653
38685
|
var import_wagmi10 = require("wagmi");
|
|
38654
38686
|
|
|
@@ -38671,10 +38703,10 @@ function useSendDirectTransaction() {
|
|
|
38671
38703
|
const { connector } = (0, import_wagmi10.useConnection)();
|
|
38672
38704
|
const { sendTransactionAsync: sendWagmiTransactionAsync } = (0, import_wagmi10.useSendTransaction)();
|
|
38673
38705
|
const { switchChainAsync } = (0, import_wagmi10.useSwitchChain)();
|
|
38674
|
-
const [isPending, setIsPending] = (0,
|
|
38675
|
-
const [error, setError] = (0,
|
|
38676
|
-
const [txHash, setTxHash] = (0,
|
|
38677
|
-
const sendTransactionAsync = (0,
|
|
38706
|
+
const [isPending, setIsPending] = (0, import_react125.useState)(false);
|
|
38707
|
+
const [error, setError] = (0, import_react125.useState)(null);
|
|
38708
|
+
const [txHash, setTxHash] = (0, import_react125.useState)(null);
|
|
38709
|
+
const sendTransactionAsync = (0, import_react125.useCallback)(
|
|
38678
38710
|
async (params) => {
|
|
38679
38711
|
if (!isConnected || !connector) {
|
|
38680
38712
|
const message = "No external wallet connected";
|
|
@@ -38711,7 +38743,7 @@ function useSendDirectTransaction() {
|
|
|
38711
38743
|
},
|
|
38712
38744
|
[isConnected, connector, sendWagmiTransactionAsync, switchChainAsync]
|
|
38713
38745
|
);
|
|
38714
|
-
const sendTransaction = (0,
|
|
38746
|
+
const sendTransaction = (0, import_react125.useCallback)(
|
|
38715
38747
|
async (params) => {
|
|
38716
38748
|
try {
|
|
38717
38749
|
return await sendTransactionAsync(params);
|
|
@@ -38721,7 +38753,7 @@ function useSendDirectTransaction() {
|
|
|
38721
38753
|
},
|
|
38722
38754
|
[sendTransactionAsync]
|
|
38723
38755
|
);
|
|
38724
|
-
const reset = (0,
|
|
38756
|
+
const reset = (0, import_react125.useCallback)(() => {
|
|
38725
38757
|
setError(null);
|
|
38726
38758
|
setTxHash(null);
|
|
38727
38759
|
setIsPending(false);
|
|
@@ -38730,7 +38762,7 @@ function useSendDirectTransaction() {
|
|
|
38730
38762
|
}
|
|
38731
38763
|
|
|
38732
38764
|
// src/hooks/useTransferToLinkedWallet.ts
|
|
38733
|
-
var
|
|
38765
|
+
var import_react126 = require("react");
|
|
38734
38766
|
var import_viem25 = require("viem");
|
|
38735
38767
|
init_SessionContext();
|
|
38736
38768
|
init_account2();
|
|
@@ -38749,14 +38781,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
38749
38781
|
function useTransferToLinkedWallet() {
|
|
38750
38782
|
const session = useSession((st) => st.session);
|
|
38751
38783
|
const { profiles } = useLinkedProfiles();
|
|
38752
|
-
const [isPending, setIsPending] = (0,
|
|
38753
|
-
const [error, setError] = (0,
|
|
38754
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
38755
|
-
const linkedWallets = (0,
|
|
38784
|
+
const [isPending, setIsPending] = (0, import_react126.useState)(false);
|
|
38785
|
+
const [error, setError] = (0, import_react126.useState)(null);
|
|
38786
|
+
const [userOpHash, setUserOpHash] = (0, import_react126.useState)(null);
|
|
38787
|
+
const linkedWallets = (0, import_react126.useMemo)(
|
|
38756
38788
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
38757
38789
|
[profiles]
|
|
38758
38790
|
);
|
|
38759
|
-
const transfer = (0,
|
|
38791
|
+
const transfer = (0, import_react126.useCallback)(
|
|
38760
38792
|
async (params) => {
|
|
38761
38793
|
if (!session) {
|
|
38762
38794
|
setError("No active session");
|
|
@@ -38807,7 +38839,7 @@ function useTransferToLinkedWallet() {
|
|
|
38807
38839
|
},
|
|
38808
38840
|
[session, linkedWallets]
|
|
38809
38841
|
);
|
|
38810
|
-
const reset = (0,
|
|
38842
|
+
const reset = (0, import_react126.useCallback)(() => {
|
|
38811
38843
|
setError(null);
|
|
38812
38844
|
setUserOpHash(null);
|
|
38813
38845
|
setIsPending(false);
|
|
@@ -38831,8 +38863,8 @@ function useNativeWalletSignature() {
|
|
|
38831
38863
|
|
|
38832
38864
|
// src/hooks/useLogout.ts
|
|
38833
38865
|
init_useSafeDisconnect();
|
|
38834
|
-
var
|
|
38835
|
-
var
|
|
38866
|
+
var import_auth31 = require("@embarkai/core/auth");
|
|
38867
|
+
var import_react127 = require("react");
|
|
38836
38868
|
init_ProviderContext();
|
|
38837
38869
|
init_auth();
|
|
38838
38870
|
init_SessionContext();
|
|
@@ -38851,13 +38883,13 @@ function useLogout() {
|
|
|
38851
38883
|
}
|
|
38852
38884
|
}
|
|
38853
38885
|
});
|
|
38854
|
-
const logout2 = (0,
|
|
38886
|
+
const logout2 = (0, import_react127.useCallback)(async () => {
|
|
38855
38887
|
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
38856
38888
|
const prevAddress = address;
|
|
38857
38889
|
let userId = null;
|
|
38858
38890
|
setIsLoading(true);
|
|
38859
38891
|
try {
|
|
38860
|
-
userId =
|
|
38892
|
+
userId = import_auth31.jwtTokenManager.getUserId() || null;
|
|
38861
38893
|
} catch (error) {
|
|
38862
38894
|
console.warn("[useLogout] Could not get userId:", error);
|
|
38863
38895
|
}
|
|
@@ -38971,7 +39003,7 @@ function useTransactions() {
|
|
|
38971
39003
|
|
|
38972
39004
|
// src/modules/assets.ts
|
|
38973
39005
|
init_SessionContext();
|
|
38974
|
-
var
|
|
39006
|
+
var import_react128 = __toESM(require("react"), 1);
|
|
38975
39007
|
var import_viem27 = require("viem");
|
|
38976
39008
|
var import_wagmi13 = require("wagmi");
|
|
38977
39009
|
var COMMON_TOKENS = [
|
|
@@ -39126,7 +39158,7 @@ function useTokenBalance2(tokenAddress, userAddress) {
|
|
|
39126
39158
|
}
|
|
39127
39159
|
});
|
|
39128
39160
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
39129
|
-
const formattedBalance =
|
|
39161
|
+
const formattedBalance = import_react128.default.useMemo(() => {
|
|
39130
39162
|
if (!balance || !tokenInfo) return "0";
|
|
39131
39163
|
return (0, import_viem27.formatUnits)(balance, tokenInfo.decimals);
|
|
39132
39164
|
}, [balance, tokenInfo]);
|