@embarkai/ui-kit 0.4.111 → 0.4.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +549 -519
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +187 -157
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6046,6 +6046,32 @@ var init_ChainSync2 = __esm({
|
|
|
6046
6046
|
}
|
|
6047
6047
|
});
|
|
6048
6048
|
|
|
6049
|
+
// src/internal/hooks/useAllowExternalModalsScroll.ts
|
|
6050
|
+
function isFromExternalModal(event) {
|
|
6051
|
+
return event.composedPath().some((node) => node instanceof Element && EXTERNAL_MODAL_TAGS.has(node.tagName));
|
|
6052
|
+
}
|
|
6053
|
+
function stopExternalModalScrollEvent(event) {
|
|
6054
|
+
if (isFromExternalModal(event)) event.stopPropagation();
|
|
6055
|
+
}
|
|
6056
|
+
function useAllowExternalModalsScroll(enabled) {
|
|
6057
|
+
(0, import_react7.useEffect)(() => {
|
|
6058
|
+
if (!enabled || typeof document === "undefined") return;
|
|
6059
|
+
const body = document.body;
|
|
6060
|
+
SCROLL_EVENTS.forEach((type) => body.addEventListener(type, stopExternalModalScrollEvent, { passive: true }));
|
|
6061
|
+
return () => {
|
|
6062
|
+
SCROLL_EVENTS.forEach((type) => body.removeEventListener(type, stopExternalModalScrollEvent));
|
|
6063
|
+
};
|
|
6064
|
+
}, [enabled]);
|
|
6065
|
+
}
|
|
6066
|
+
var import_react7, EXTERNAL_MODAL_TAGS, SCROLL_EVENTS;
|
|
6067
|
+
var init_useAllowExternalModalsScroll = __esm({
|
|
6068
|
+
"src/internal/hooks/useAllowExternalModalsScroll.ts"() {
|
|
6069
|
+
import_react7 = require("react");
|
|
6070
|
+
EXTERNAL_MODAL_TAGS = /* @__PURE__ */ new Set(["W3M-MODAL", "APPKIT-MODAL", "WCM-MODAL"]);
|
|
6071
|
+
SCROLL_EVENTS = ["wheel", "touchmove"];
|
|
6072
|
+
}
|
|
6073
|
+
});
|
|
6074
|
+
|
|
6049
6075
|
// src/internal/clients/account/register-smart-account-address.ts
|
|
6050
6076
|
async function registerSmartAccountAddress(chainId, smartAccountAddress, factoryAddress) {
|
|
6051
6077
|
const accessToken = import_auth25.jwtTokenManager.getAccessToken();
|
|
@@ -6998,7 +7024,7 @@ function useAutoConnect() {
|
|
|
6998
7024
|
setIsIframeReady,
|
|
6999
7025
|
setIsLoading
|
|
7000
7026
|
} = useSession();
|
|
7001
|
-
const createSessionWithKeyshare = (0,
|
|
7027
|
+
const createSessionWithKeyshare = (0, import_react8.useCallback)(
|
|
7002
7028
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
7003
7029
|
try {
|
|
7004
7030
|
try {
|
|
@@ -7036,8 +7062,8 @@ function useAutoConnect() {
|
|
|
7036
7062
|
},
|
|
7037
7063
|
[usePaymaster, setStatus, activeChainId]
|
|
7038
7064
|
);
|
|
7039
|
-
const autoConnectAttemptedRef = (0,
|
|
7040
|
-
(0,
|
|
7065
|
+
const autoConnectAttemptedRef = (0, import_react8.useRef)(false);
|
|
7066
|
+
(0, import_react8.useEffect)(() => {
|
|
7041
7067
|
if (!hasHydrated) return;
|
|
7042
7068
|
if (autoConnectAttemptedRef.current) return;
|
|
7043
7069
|
setIsLoading(true);
|
|
@@ -7167,12 +7193,12 @@ function useAutoConnect() {
|
|
|
7167
7193
|
}, [hasHydrated]);
|
|
7168
7194
|
return null;
|
|
7169
7195
|
}
|
|
7170
|
-
var
|
|
7196
|
+
var import_react8;
|
|
7171
7197
|
var init_useAutoConnect = __esm({
|
|
7172
7198
|
"src/internal/hooks/useAutoConnect.ts"() {
|
|
7173
7199
|
init_ProviderContext();
|
|
7174
7200
|
init_SessionContext();
|
|
7175
|
-
|
|
7201
|
+
import_react8 = require("react");
|
|
7176
7202
|
init_useLayoutDataStore();
|
|
7177
7203
|
}
|
|
7178
7204
|
});
|
|
@@ -7184,7 +7210,7 @@ function useOpenPage() {
|
|
|
7184
7210
|
const setPageParams = useLayoutDataStore((st) => st.setPageParams);
|
|
7185
7211
|
const setPostAuthNavigation = useLayoutDataStore((st) => st.setPostAuthNavigation);
|
|
7186
7212
|
const address = useSession((st) => st.address);
|
|
7187
|
-
const open = (0,
|
|
7213
|
+
const open = (0, import_react9.useCallback)(
|
|
7188
7214
|
(passportPage, params) => {
|
|
7189
7215
|
if (!address) {
|
|
7190
7216
|
if (passportPage !== "auth" /* AUTH */) {
|
|
@@ -7198,7 +7224,7 @@ function useOpenPage() {
|
|
|
7198
7224
|
},
|
|
7199
7225
|
[setPage, setPageParams, setPostAuthNavigation, address]
|
|
7200
7226
|
);
|
|
7201
|
-
const close = (0,
|
|
7227
|
+
const close = (0, import_react9.useCallback)(() => {
|
|
7202
7228
|
setPageParams(null);
|
|
7203
7229
|
setPostAuthNavigation(null);
|
|
7204
7230
|
setPage(null);
|
|
@@ -7206,8 +7232,8 @@ function useOpenPage() {
|
|
|
7206
7232
|
return { open, close, isOpen: page !== null };
|
|
7207
7233
|
}
|
|
7208
7234
|
function usePageParams() {
|
|
7209
|
-
const currentParams = (0,
|
|
7210
|
-
(0,
|
|
7235
|
+
const currentParams = (0, import_react9.useRef)({});
|
|
7236
|
+
(0, import_react9.useEffect)(() => {
|
|
7211
7237
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
7212
7238
|
if (!pageParams) return;
|
|
7213
7239
|
currentParams.current = pageParams;
|
|
@@ -7215,10 +7241,10 @@ function usePageParams() {
|
|
|
7215
7241
|
}, []);
|
|
7216
7242
|
return currentParams;
|
|
7217
7243
|
}
|
|
7218
|
-
var
|
|
7244
|
+
var import_react9;
|
|
7219
7245
|
var init_useOpenPage = __esm({
|
|
7220
7246
|
"src/hooks/useOpenPage.ts"() {
|
|
7221
|
-
|
|
7247
|
+
import_react9 = require("react");
|
|
7222
7248
|
init_SessionContext();
|
|
7223
7249
|
init_useLayoutDataStore();
|
|
7224
7250
|
}
|
|
@@ -7227,10 +7253,10 @@ var init_useOpenPage = __esm({
|
|
|
7227
7253
|
// src/internal/hooks/useBackupStatusChanges.ts
|
|
7228
7254
|
function useBackupStatusChanges() {
|
|
7229
7255
|
const { open: openPage } = useOpenPage();
|
|
7230
|
-
const requestSeqRef = (0,
|
|
7231
|
-
const openPageRef = (0,
|
|
7256
|
+
const requestSeqRef = (0, import_react10.useRef)(0);
|
|
7257
|
+
const openPageRef = (0, import_react10.useRef)(openPage);
|
|
7232
7258
|
openPageRef.current = openPage;
|
|
7233
|
-
(0,
|
|
7259
|
+
(0, import_react10.useEffect)(() => {
|
|
7234
7260
|
async function handleBackupStatusChanged(event) {
|
|
7235
7261
|
const detail = event?.detail;
|
|
7236
7262
|
console.log("[BACKUP STATUS] changed:", detail);
|
|
@@ -7262,12 +7288,12 @@ function useBackupStatusChanges() {
|
|
|
7262
7288
|
};
|
|
7263
7289
|
}, []);
|
|
7264
7290
|
}
|
|
7265
|
-
var
|
|
7291
|
+
var import_react10;
|
|
7266
7292
|
var init_useBackupStatusChanges = __esm({
|
|
7267
7293
|
"src/internal/hooks/useBackupStatusChanges.ts"() {
|
|
7268
7294
|
init_SessionContext();
|
|
7269
7295
|
init_useOpenPage();
|
|
7270
|
-
|
|
7296
|
+
import_react10 = require("react");
|
|
7271
7297
|
init_vaultClient();
|
|
7272
7298
|
}
|
|
7273
7299
|
});
|
|
@@ -7277,7 +7303,7 @@ function useDetectMaxScrollHeight() {
|
|
|
7277
7303
|
const page = useLayoutDataStore((state) => state.page);
|
|
7278
7304
|
const setIsMobileView = useLayoutStore((state) => state.setIsMobileView);
|
|
7279
7305
|
const setMaxScrollHeight = useLayoutStore((state) => state.setMaxScrollHeight);
|
|
7280
|
-
const onResize = (0,
|
|
7306
|
+
const onResize = (0, import_react11.useCallback)(
|
|
7281
7307
|
(0, import_lodash_es2.debounce)(({ width, height }) => {
|
|
7282
7308
|
const headerHeight = page === "auth" /* AUTH */ || page === "keyshare-restore" /* KEYSHARE_RESTORE */ ? 0 : 116;
|
|
7283
7309
|
const limContentHeight = height * 0.92 - headerHeight - 57;
|
|
@@ -7286,18 +7312,18 @@ function useDetectMaxScrollHeight() {
|
|
|
7286
7312
|
}, DEBOUNCE_DELAY),
|
|
7287
7313
|
[page, setMaxScrollHeight, setIsMobileView]
|
|
7288
7314
|
);
|
|
7289
|
-
(0,
|
|
7315
|
+
(0, import_react11.useEffect)(() => {
|
|
7290
7316
|
const obs = new ResizeObserver(([entry]) => onResize(entry.contentRect));
|
|
7291
7317
|
const doc = window.document.getElementsByTagName("html")[0];
|
|
7292
7318
|
if (doc) obs.observe(doc);
|
|
7293
7319
|
return () => obs.disconnect();
|
|
7294
7320
|
}, [onResize]);
|
|
7295
7321
|
}
|
|
7296
|
-
var import_lodash_es2,
|
|
7322
|
+
var import_lodash_es2, import_react11, DEBOUNCE_DELAY;
|
|
7297
7323
|
var init_useDetectMaxScrollHeight = __esm({
|
|
7298
7324
|
"src/internal/hooks/useDetectMaxScrollHeight.ts"() {
|
|
7299
7325
|
import_lodash_es2 = require("lodash-es");
|
|
7300
|
-
|
|
7326
|
+
import_react11 = require("react");
|
|
7301
7327
|
init_constants();
|
|
7302
7328
|
init_useLayoutDataStore();
|
|
7303
7329
|
init_useLayoutStore();
|
|
@@ -7309,7 +7335,7 @@ var init_useDetectMaxScrollHeight = __esm({
|
|
|
7309
7335
|
function useListenIframeAuthEvents() {
|
|
7310
7336
|
const setPage = useLayoutDataStore((state) => state.setPage);
|
|
7311
7337
|
const setIsIframeReady = useSession((state) => state.setIsIframeReady);
|
|
7312
|
-
const handleIframeMessage = (0,
|
|
7338
|
+
const handleIframeMessage = (0, import_react12.useCallback)(
|
|
7313
7339
|
(event) => {
|
|
7314
7340
|
const type = event.data?.type?.startsWith?.("LUMIA_PASSPORT_") ? event.data.type.replace("LUMIA_PASSPORT_", "IFRAME_MSG_") : event.data?.type;
|
|
7315
7341
|
if (type === "IFRAME_MSG_IFRAME_READY") {
|
|
@@ -7325,36 +7351,36 @@ function useListenIframeAuthEvents() {
|
|
|
7325
7351
|
},
|
|
7326
7352
|
[setPage, setIsIframeReady]
|
|
7327
7353
|
);
|
|
7328
|
-
(0,
|
|
7354
|
+
(0, import_react12.useEffect)(() => {
|
|
7329
7355
|
window.addEventListener("message", handleIframeMessage);
|
|
7330
7356
|
return () => window.removeEventListener("message", handleIframeMessage);
|
|
7331
7357
|
}, [handleIframeMessage]);
|
|
7332
7358
|
}
|
|
7333
|
-
var
|
|
7359
|
+
var import_react12;
|
|
7334
7360
|
var init_useListenIframeAuthEvents = __esm({
|
|
7335
7361
|
"src/internal/hooks/useListenIframeAuthEvents.ts"() {
|
|
7336
7362
|
init_SessionContext();
|
|
7337
|
-
|
|
7363
|
+
import_react12 = require("react");
|
|
7338
7364
|
init_useLayoutDataStore();
|
|
7339
7365
|
}
|
|
7340
7366
|
});
|
|
7341
7367
|
|
|
7342
7368
|
// src/internal/components/Expandable/hooks/useExpandable.ts
|
|
7343
|
-
var
|
|
7369
|
+
var import_react13, DEFERRED_DELAY, useExpandable;
|
|
7344
7370
|
var init_useExpandable = __esm({
|
|
7345
7371
|
"src/internal/components/Expandable/hooks/useExpandable.ts"() {
|
|
7346
|
-
|
|
7372
|
+
import_react13 = require("react");
|
|
7347
7373
|
DEFERRED_DELAY = 100;
|
|
7348
7374
|
useExpandable = (props) => {
|
|
7349
7375
|
const { isExpanded = false, initHeight = 0, minHeight = 0 } = props;
|
|
7350
|
-
const expandableRef = (0,
|
|
7351
|
-
const contentRef = (0,
|
|
7352
|
-
(0,
|
|
7376
|
+
const expandableRef = (0, import_react13.useRef)(null);
|
|
7377
|
+
const contentRef = (0, import_react13.useRef)(null);
|
|
7378
|
+
(0, import_react13.useEffect)(() => {
|
|
7353
7379
|
if (!expandableRef.current) return;
|
|
7354
7380
|
expandableRef.current.style.setProperty("--ui-kit-expandable-h", `${initHeight}px )`);
|
|
7355
7381
|
}, []);
|
|
7356
|
-
const expandableHeightTimerRef = (0,
|
|
7357
|
-
const setExpandableHeight = (0,
|
|
7382
|
+
const expandableHeightTimerRef = (0, import_react13.useRef)(null);
|
|
7383
|
+
const setExpandableHeight = (0, import_react13.useCallback)((minHeight2, isExpanded2) => {
|
|
7358
7384
|
if (expandableHeightTimerRef.current) clearTimeout(expandableHeightTimerRef.current);
|
|
7359
7385
|
expandableHeightTimerRef.current = setTimeout(() => {
|
|
7360
7386
|
if (!contentRef.current || !expandableRef.current) return;
|
|
@@ -7365,7 +7391,7 @@ var init_useExpandable = __esm({
|
|
|
7365
7391
|
expandableHeightTimerRef.current = null;
|
|
7366
7392
|
}, DEFERRED_DELAY);
|
|
7367
7393
|
}, []);
|
|
7368
|
-
(0,
|
|
7394
|
+
(0, import_react13.useEffect)(() => {
|
|
7369
7395
|
if (!contentRef.current || !expandableRef.current) return;
|
|
7370
7396
|
const resizeObs = new ResizeObserver(() => setExpandableHeight(minHeight, isExpanded));
|
|
7371
7397
|
const domMutationObs = new MutationObserver(() => setExpandableHeight(minHeight, isExpanded));
|
|
@@ -7385,17 +7411,17 @@ var init_useExpandable = __esm({
|
|
|
7385
7411
|
});
|
|
7386
7412
|
|
|
7387
7413
|
// src/internal/components/Expandable/Expandable.tsx
|
|
7388
|
-
var
|
|
7414
|
+
var import_react14, import_jsx_runtime6, Expandable;
|
|
7389
7415
|
var init_Expandable = __esm({
|
|
7390
7416
|
"src/internal/components/Expandable/Expandable.tsx"() {
|
|
7391
7417
|
init_utils();
|
|
7392
|
-
|
|
7418
|
+
import_react14 = require("react");
|
|
7393
7419
|
init_useExpandable();
|
|
7394
7420
|
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
7395
|
-
Expandable = (0,
|
|
7421
|
+
Expandable = (0, import_react14.forwardRef)((props, ref) => {
|
|
7396
7422
|
const { children, className, contentClassName, minHeight, divProps } = props;
|
|
7397
7423
|
const { expandableRef, contentRef } = useExpandable(props);
|
|
7398
|
-
(0,
|
|
7424
|
+
(0, import_react14.useImperativeHandle)(ref, () => expandableRef.current);
|
|
7399
7425
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
7400
7426
|
"div",
|
|
7401
7427
|
{
|
|
@@ -9634,18 +9660,18 @@ var init_useActivityLog = __esm({
|
|
|
9634
9660
|
|
|
9635
9661
|
// src/internal/components/ActivityLogMenu/useActivityLogMenuParams.ts
|
|
9636
9662
|
function useActivityLogMenuParams() {
|
|
9637
|
-
(0,
|
|
9663
|
+
(0, import_react15.useEffect)(() => {
|
|
9638
9664
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
9639
9665
|
if (!pageParams || !(0, import_lodash_es5.keys)(pageParams).length) return;
|
|
9640
9666
|
setTimeout(() => useActivityLogFilters.setState(pageParams), 0);
|
|
9641
9667
|
setPageParams(null);
|
|
9642
9668
|
}, []);
|
|
9643
9669
|
}
|
|
9644
|
-
var import_lodash_es5,
|
|
9670
|
+
var import_lodash_es5, import_react15;
|
|
9645
9671
|
var init_useActivityLogMenuParams = __esm({
|
|
9646
9672
|
"src/internal/components/ActivityLogMenu/useActivityLogMenuParams.ts"() {
|
|
9647
9673
|
import_lodash_es5 = require("lodash-es");
|
|
9648
|
-
|
|
9674
|
+
import_react15 = require("react");
|
|
9649
9675
|
init_useLayoutDataStore();
|
|
9650
9676
|
init_useActivityLogFilters();
|
|
9651
9677
|
}
|
|
@@ -9703,10 +9729,10 @@ var init_ActivityLogMenu2 = __esm({
|
|
|
9703
9729
|
});
|
|
9704
9730
|
|
|
9705
9731
|
// src/internal/components/ui/highlight.tsx
|
|
9706
|
-
var
|
|
9732
|
+
var import_react16, import_jsx_runtime10, CARD_STYLES, Highlight;
|
|
9707
9733
|
var init_highlight = __esm({
|
|
9708
9734
|
"src/internal/components/ui/highlight.tsx"() {
|
|
9709
|
-
|
|
9735
|
+
import_react16 = require("react");
|
|
9710
9736
|
init_utils();
|
|
9711
9737
|
import_jsx_runtime10 = require("react/jsx-runtime");
|
|
9712
9738
|
CARD_STYLES = {
|
|
@@ -9715,7 +9741,7 @@ var init_highlight = __esm({
|
|
|
9715
9741
|
warning: "text-[var(--ui-kit-warning)] bg-[var(--ui-kit-bg-warning)]",
|
|
9716
9742
|
error: "text-[var(--ui-kit-error)] bg-[var(--ui-kit-bg-error)]"
|
|
9717
9743
|
};
|
|
9718
|
-
Highlight = (0,
|
|
9744
|
+
Highlight = (0, import_react16.forwardRef)((props, ref) => {
|
|
9719
9745
|
const { type = "info", children, className, ...rest } = props;
|
|
9720
9746
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
9721
9747
|
"div",
|
|
@@ -9941,7 +9967,7 @@ function PassKeyStep(props) {
|
|
|
9941
9967
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
9942
9968
|
const autoCloseOnSuccess = !recoveryUserId;
|
|
9943
9969
|
const { passkeyStatus, setStep, setPasskeyStatus, setAlert, setEmail, setFailedType } = useAuthStore();
|
|
9944
|
-
const onPasskeyRegister = (0,
|
|
9970
|
+
const onPasskeyRegister = (0, import_react17.useCallback)(async () => {
|
|
9945
9971
|
setAlert(null);
|
|
9946
9972
|
setPasskeyStatus("registering passkey...");
|
|
9947
9973
|
setIsLoading(true);
|
|
@@ -10000,7 +10026,7 @@ function PassKeyStep(props) {
|
|
|
10000
10026
|
setIsLoading(false);
|
|
10001
10027
|
}
|
|
10002
10028
|
}, [onAuthSuccess, setPage]);
|
|
10003
|
-
const onPasskeyAuth = (0,
|
|
10029
|
+
const onPasskeyAuth = (0, import_react17.useCallback)(async () => {
|
|
10004
10030
|
setAlert(null);
|
|
10005
10031
|
setPasskeyStatus("checking available passkeys...");
|
|
10006
10032
|
setIsLoading(true);
|
|
@@ -10118,14 +10144,14 @@ function PassKeyStep(props) {
|
|
|
10118
10144
|
] })
|
|
10119
10145
|
] });
|
|
10120
10146
|
}
|
|
10121
|
-
var import_lucide_react7,
|
|
10147
|
+
var import_lucide_react7, import_react17, import_jsx_runtime18;
|
|
10122
10148
|
var init_PassKeyStep = __esm({
|
|
10123
10149
|
"src/internal/components/AuthMenu/PassKeyStep.tsx"() {
|
|
10124
10150
|
init_ProviderContext();
|
|
10125
10151
|
init_SessionContext();
|
|
10126
10152
|
init_i18n();
|
|
10127
10153
|
import_lucide_react7 = require("lucide-react");
|
|
10128
|
-
|
|
10154
|
+
import_react17 = require("react");
|
|
10129
10155
|
init_icons();
|
|
10130
10156
|
init_auth();
|
|
10131
10157
|
init_useLayoutDataStore();
|
|
@@ -10137,16 +10163,16 @@ var init_PassKeyStep = __esm({
|
|
|
10137
10163
|
});
|
|
10138
10164
|
|
|
10139
10165
|
// src/internal/components/ui/input.tsx
|
|
10140
|
-
var
|
|
10166
|
+
var import_react18, import_jsx_runtime19, Input;
|
|
10141
10167
|
var init_input = __esm({
|
|
10142
10168
|
"src/internal/components/ui/input.tsx"() {
|
|
10143
|
-
|
|
10169
|
+
import_react18 = __toESM(require("react"), 1);
|
|
10144
10170
|
init_utils();
|
|
10145
10171
|
import_jsx_runtime19 = require("react/jsx-runtime");
|
|
10146
|
-
Input =
|
|
10172
|
+
Input = import_react18.default.forwardRef((props, ref) => {
|
|
10147
10173
|
const { className, disabled, error, Icon: Icon2, element, inputClassName, ...inputProps } = props;
|
|
10148
|
-
const internalRef = (0,
|
|
10149
|
-
(0,
|
|
10174
|
+
const internalRef = (0, import_react18.useRef)(null);
|
|
10175
|
+
(0, import_react18.useImperativeHandle)(ref, () => internalRef.current);
|
|
10150
10176
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: cn2("w-full min-w-0 flex flex-col gap-1", className), children: [
|
|
10151
10177
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
10152
10178
|
"div",
|
|
@@ -10216,9 +10242,9 @@ var init_emailChallenge = __esm({
|
|
|
10216
10242
|
function Email() {
|
|
10217
10243
|
const { callbacksRef } = useProviderConfig();
|
|
10218
10244
|
const { t } = useT();
|
|
10219
|
-
const focusRef = (0,
|
|
10220
|
-
const inputRef = (0,
|
|
10221
|
-
const buttonRef = (0,
|
|
10245
|
+
const focusRef = (0, import_react19.useRef)(null);
|
|
10246
|
+
const inputRef = (0, import_react19.useRef)(null);
|
|
10247
|
+
const buttonRef = (0, import_react19.useRef)(null);
|
|
10222
10248
|
const isLoading = useSession((st) => st.isLoading);
|
|
10223
10249
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
10224
10250
|
const isMobileView = useLayoutStore((st) => st.isMobileView);
|
|
@@ -10282,7 +10308,7 @@ function Email() {
|
|
|
10282
10308
|
}
|
|
10283
10309
|
onSendVerificationCode(email);
|
|
10284
10310
|
};
|
|
10285
|
-
(0,
|
|
10311
|
+
(0, import_react19.useEffect)(() => {
|
|
10286
10312
|
if (!focusRef.current || !isMobileView) return;
|
|
10287
10313
|
focusRef.current?.focus();
|
|
10288
10314
|
setTimeout(() => {
|
|
@@ -10344,7 +10370,7 @@ function Email() {
|
|
|
10344
10370
|
)
|
|
10345
10371
|
] });
|
|
10346
10372
|
}
|
|
10347
|
-
var import_react_query5, import_lucide_react8,
|
|
10373
|
+
var import_react_query5, import_lucide_react8, import_react19, import_jsx_runtime20;
|
|
10348
10374
|
var init_Email = __esm({
|
|
10349
10375
|
"src/internal/components/AuthMenu/SignInStep/Email.tsx"() {
|
|
10350
10376
|
init_initial();
|
|
@@ -10353,7 +10379,7 @@ var init_Email = __esm({
|
|
|
10353
10379
|
init_i18n();
|
|
10354
10380
|
import_react_query5 = require("@tanstack/react-query");
|
|
10355
10381
|
import_lucide_react8 = require("lucide-react");
|
|
10356
|
-
|
|
10382
|
+
import_react19 = require("react");
|
|
10357
10383
|
init_useLayoutStore();
|
|
10358
10384
|
init_projectId();
|
|
10359
10385
|
init_button();
|
|
@@ -10518,7 +10544,7 @@ function Social(props) {
|
|
|
10518
10544
|
const { t } = useT();
|
|
10519
10545
|
const isLoading = useSession((st) => st.isLoading);
|
|
10520
10546
|
const setIsLoading = useSession((st) => st.setIsLoading);
|
|
10521
|
-
const onSocialAuth = (0,
|
|
10547
|
+
const onSocialAuth = (0, import_react20.useCallback)(
|
|
10522
10548
|
async (providerId) => {
|
|
10523
10549
|
const { setStep, setEmail, setFailedType, setAlert, setPasskeyStatus } = useAuthStore.getState();
|
|
10524
10550
|
const normalizedProviderId = providerId.toLowerCase();
|
|
@@ -10790,7 +10816,7 @@ function Social(props) {
|
|
|
10790
10816
|
}
|
|
10791
10817
|
);
|
|
10792
10818
|
}
|
|
10793
|
-
var
|
|
10819
|
+
var import_react20, import_jsx_runtime21, SUPPORTED_PROVIDERS, SOCIAL_ICONS, fetchTokensFromRefreshEndpoint, enrichLoginResponseWithTokens;
|
|
10794
10820
|
var init_Social = __esm({
|
|
10795
10821
|
"src/internal/components/AuthMenu/SignInStep/Social.tsx"() {
|
|
10796
10822
|
init_assets();
|
|
@@ -10799,7 +10825,7 @@ var init_Social = __esm({
|
|
|
10799
10825
|
init_SessionContext();
|
|
10800
10826
|
init_i18n();
|
|
10801
10827
|
init_useLayoutDataStore();
|
|
10802
|
-
|
|
10828
|
+
import_react20 = require("react");
|
|
10803
10829
|
init_auth();
|
|
10804
10830
|
init_constants();
|
|
10805
10831
|
init_utils();
|
|
@@ -10964,7 +10990,7 @@ function SignInStep(props) {
|
|
|
10964
10990
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react9.UserCircle, { className: "w-6 h-6" }),
|
|
10965
10991
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-bold text-xl leading-6", children: t("passport:auth.signin") })
|
|
10966
10992
|
] }),
|
|
10967
|
-
enabledSigninMethods.map((kind, idx) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10993
|
+
enabledSigninMethods.map((kind, idx) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react21.Fragment, { children: [
|
|
10968
10994
|
idx > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center h-4", children: [
|
|
10969
10995
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { borderTop: "1px solid var(--ui-kit-bd)" }, className: "flex-1" }),
|
|
10970
10996
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-[10px] px-2 flex-none leading-4", children: t("passport:auth.orSeparator") }),
|
|
@@ -10988,13 +11014,13 @@ function SignInStep(props) {
|
|
|
10988
11014
|
] })
|
|
10989
11015
|
] });
|
|
10990
11016
|
}
|
|
10991
|
-
var import_lucide_react9,
|
|
11017
|
+
var import_lucide_react9, import_react21, import_jsx_runtime23, TERMS_OF_SERVICE_URL;
|
|
10992
11018
|
var init_SignInStep = __esm({
|
|
10993
11019
|
"src/internal/components/AuthMenu/SignInStep/SignInStep.tsx"() {
|
|
10994
11020
|
init_ProviderContext();
|
|
10995
11021
|
init_i18n();
|
|
10996
11022
|
import_lucide_react9 = require("lucide-react");
|
|
10997
|
-
|
|
11023
|
+
import_react21 = require("react");
|
|
10998
11024
|
init_button();
|
|
10999
11025
|
init_Email();
|
|
11000
11026
|
init_Social();
|
|
@@ -11025,14 +11051,14 @@ var init_constants5 = __esm({
|
|
|
11025
11051
|
function useAuthMenuHandlers() {
|
|
11026
11052
|
const { config, callbacksRef } = useProviderConfig();
|
|
11027
11053
|
const qc = (0, import_react_query6.useQueryClient)();
|
|
11028
|
-
const pendingLoginResponseRef = (0,
|
|
11029
|
-
const [telegramCleanup, setTelegramCleanup] = (0,
|
|
11054
|
+
const pendingLoginResponseRef = (0, import_react22.useRef)(null);
|
|
11055
|
+
const [telegramCleanup, setTelegramCleanup] = (0, import_react22.useState)(null);
|
|
11030
11056
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
11031
11057
|
const publicClient = useSession((st) => st.publicClient);
|
|
11032
11058
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
11033
11059
|
const setStep = useAuthStore((st) => st.setStep);
|
|
11034
11060
|
const setAlert = useAuthStore((st) => st.setAlert);
|
|
11035
|
-
const createSessionWithKeyshare = (0,
|
|
11061
|
+
const createSessionWithKeyshare = (0, import_react22.useCallback)(
|
|
11036
11062
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
11037
11063
|
const { setStatus } = useSession.getState();
|
|
11038
11064
|
try {
|
|
@@ -11074,7 +11100,7 @@ function useAuthMenuHandlers() {
|
|
|
11074
11100
|
},
|
|
11075
11101
|
[usePaymaster, activeChainId]
|
|
11076
11102
|
);
|
|
11077
|
-
const onAuthSuccess = (0,
|
|
11103
|
+
const onAuthSuccess = (0, import_react22.useCallback)(async () => {
|
|
11078
11104
|
const {
|
|
11079
11105
|
//
|
|
11080
11106
|
setSession,
|
|
@@ -11182,7 +11208,7 @@ function useAuthMenuHandlers() {
|
|
|
11182
11208
|
setStep("signin");
|
|
11183
11209
|
}
|
|
11184
11210
|
}, [qc, setStep, setAlert, createSessionWithKeyshare]);
|
|
11185
|
-
const goBackToSignIn = (0,
|
|
11211
|
+
const goBackToSignIn = (0, import_react22.useCallback)(() => {
|
|
11186
11212
|
setStep("signin");
|
|
11187
11213
|
setAlert(null);
|
|
11188
11214
|
if (telegramCleanup) {
|
|
@@ -11196,13 +11222,13 @@ function useAuthMenuHandlers() {
|
|
|
11196
11222
|
goBackToSignIn
|
|
11197
11223
|
};
|
|
11198
11224
|
}
|
|
11199
|
-
var import_react_query6,
|
|
11225
|
+
var import_react_query6, import_react22;
|
|
11200
11226
|
var init_useAuthMenuHanders = __esm({
|
|
11201
11227
|
"src/internal/components/AuthMenu/useAuthMenuHanders.ts"() {
|
|
11202
11228
|
init_ProviderContext();
|
|
11203
11229
|
init_SessionContext();
|
|
11204
11230
|
import_react_query6 = require("@tanstack/react-query");
|
|
11205
|
-
|
|
11231
|
+
import_react22 = require("react");
|
|
11206
11232
|
init_auth();
|
|
11207
11233
|
init_useLayoutDataStore();
|
|
11208
11234
|
init_useLayoutStore();
|
|
@@ -11212,11 +11238,11 @@ var init_useAuthMenuHanders = __esm({
|
|
|
11212
11238
|
});
|
|
11213
11239
|
|
|
11214
11240
|
// src/internal/components/AuthMenu/VerifyStep/VerificationCodeInput.tsx
|
|
11215
|
-
var
|
|
11241
|
+
var import_react23, import_jsx_runtime24, getRemainingSeconds, VerificationCodeInput;
|
|
11216
11242
|
var init_VerificationCodeInput = __esm({
|
|
11217
11243
|
"src/internal/components/AuthMenu/VerifyStep/VerificationCodeInput.tsx"() {
|
|
11218
11244
|
init_i18n();
|
|
11219
|
-
|
|
11245
|
+
import_react23 = require("react");
|
|
11220
11246
|
init_utils();
|
|
11221
11247
|
init_button();
|
|
11222
11248
|
init_useAuthStore();
|
|
@@ -11226,8 +11252,8 @@ var init_VerificationCodeInput = __esm({
|
|
|
11226
11252
|
const { onVerifyCode, onResendCode, isLoading, expiresAt } = props;
|
|
11227
11253
|
const { t } = useT();
|
|
11228
11254
|
const setAlert = useAuthStore((st) => st.setAlert);
|
|
11229
|
-
const [timeLeft, setTimeLeft] = (0,
|
|
11230
|
-
(0,
|
|
11255
|
+
const [timeLeft, setTimeLeft] = (0, import_react23.useState)(() => getRemainingSeconds(expiresAt));
|
|
11256
|
+
(0, import_react23.useEffect)(() => {
|
|
11231
11257
|
let intervalId;
|
|
11232
11258
|
const syncTimeLeft = () => {
|
|
11233
11259
|
const remaining = getRemainingSeconds(expiresAt);
|
|
@@ -11248,10 +11274,10 @@ var init_VerificationCodeInput = __esm({
|
|
|
11248
11274
|
document.removeEventListener("visibilitychange", syncTimeLeft);
|
|
11249
11275
|
};
|
|
11250
11276
|
}, [expiresAt]);
|
|
11251
|
-
const lastSubmittedRef = (0,
|
|
11252
|
-
const inputsRef = (0,
|
|
11253
|
-
const [digits, setDigits] = (0,
|
|
11254
|
-
(0,
|
|
11277
|
+
const lastSubmittedRef = (0, import_react23.useRef)(null);
|
|
11278
|
+
const inputsRef = (0, import_react23.useRef)([]);
|
|
11279
|
+
const [digits, setDigits] = (0, import_react23.useState)(["", "", "", "", "", ""]);
|
|
11280
|
+
(0, import_react23.useEffect)(() => {
|
|
11255
11281
|
const code = digits.join("");
|
|
11256
11282
|
if (code.length === 6 && digits.every((d) => d !== "") && !isLoading) {
|
|
11257
11283
|
if (lastSubmittedRef.current !== code) {
|
|
@@ -11260,7 +11286,7 @@ var init_VerificationCodeInput = __esm({
|
|
|
11260
11286
|
}
|
|
11261
11287
|
}
|
|
11262
11288
|
}, [digits, isLoading, onVerifyCode]);
|
|
11263
|
-
(0,
|
|
11289
|
+
(0, import_react23.useEffect)(() => {
|
|
11264
11290
|
const t2 = setTimeout(() => {
|
|
11265
11291
|
inputsRef.current[0]?.focus();
|
|
11266
11292
|
}, 0);
|
|
@@ -11385,7 +11411,7 @@ function VerifyStep(props) {
|
|
|
11385
11411
|
setEmailChallenge,
|
|
11386
11412
|
setAlert
|
|
11387
11413
|
} = useAuthStore();
|
|
11388
|
-
const [resendCount, setResendCount] = (0,
|
|
11414
|
+
const [resendCount, setResendCount] = (0, import_react24.useState)(0);
|
|
11389
11415
|
const { mutate: onVerifyCode, isPending: isCodeVerifying } = (0, import_react_query7.useMutation)({
|
|
11390
11416
|
mutationFn: async (code) => {
|
|
11391
11417
|
setIsLoading(true);
|
|
@@ -11537,7 +11563,7 @@ function VerifyStep(props) {
|
|
|
11537
11563
|
)
|
|
11538
11564
|
] });
|
|
11539
11565
|
}
|
|
11540
|
-
var import_react_query7, import_lucide_react10,
|
|
11566
|
+
var import_react_query7, import_lucide_react10, import_react24, import_jsx_runtime25;
|
|
11541
11567
|
var init_VerifyStep = __esm({
|
|
11542
11568
|
"src/internal/components/AuthMenu/VerifyStep/VerifyStep.tsx"() {
|
|
11543
11569
|
init_initial();
|
|
@@ -11546,7 +11572,7 @@ var init_VerifyStep = __esm({
|
|
|
11546
11572
|
init_i18n();
|
|
11547
11573
|
import_react_query7 = require("@tanstack/react-query");
|
|
11548
11574
|
import_lucide_react10 = require("lucide-react");
|
|
11549
|
-
|
|
11575
|
+
import_react24 = require("react");
|
|
11550
11576
|
init_icons();
|
|
11551
11577
|
init_projectId();
|
|
11552
11578
|
init_button();
|
|
@@ -11565,13 +11591,13 @@ var init_VerifyStep2 = __esm({
|
|
|
11565
11591
|
});
|
|
11566
11592
|
|
|
11567
11593
|
// src/internal/components/AuthMenu/AuthMenu.tsx
|
|
11568
|
-
var import_lucide_react11,
|
|
11594
|
+
var import_lucide_react11, import_react25, import_jsx_runtime26, AuthMenu;
|
|
11569
11595
|
var init_AuthMenu = __esm({
|
|
11570
11596
|
"src/internal/components/AuthMenu/AuthMenu.tsx"() {
|
|
11571
11597
|
init_SessionContext();
|
|
11572
11598
|
init_useT();
|
|
11573
11599
|
import_lucide_react11 = require("lucide-react");
|
|
11574
|
-
|
|
11600
|
+
import_react25 = require("react");
|
|
11575
11601
|
init_auth();
|
|
11576
11602
|
init_constants();
|
|
11577
11603
|
init_useLayoutDataStore();
|
|
@@ -11593,7 +11619,7 @@ var init_AuthMenu = __esm({
|
|
|
11593
11619
|
const step = useAuthStore((st) => st.step);
|
|
11594
11620
|
const alert2 = useAuthStore((st) => st.alert);
|
|
11595
11621
|
const { pendingLoginResponseRef, onAuthSuccess, goBackToSignIn } = useAuthMenuHandlers();
|
|
11596
|
-
(0,
|
|
11622
|
+
(0, import_react25.useEffect)(() => {
|
|
11597
11623
|
if (!pendingWalletLogin) return;
|
|
11598
11624
|
const loginResponse = pendingWalletLogin;
|
|
11599
11625
|
useLayoutDataStore.getState().setPendingWalletLogin(null);
|
|
@@ -11603,7 +11629,7 @@ var init_AuthMenu = __esm({
|
|
|
11603
11629
|
onAuthSuccess();
|
|
11604
11630
|
});
|
|
11605
11631
|
}, [pendingWalletLogin]);
|
|
11606
|
-
(0,
|
|
11632
|
+
(0, import_react25.useEffect)(() => {
|
|
11607
11633
|
useLayoutDataStore.getState().setTransitionPageHeight(DEFAULT_AUTH_MENU_HEIGHT);
|
|
11608
11634
|
return () => {
|
|
11609
11635
|
const { setStep, setPasskeyStatus, setEmail, setEmailChallenge, setAlert } = useAuthStore.getState();
|
|
@@ -11620,7 +11646,7 @@ var init_AuthMenu = __esm({
|
|
|
11620
11646
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-sm text-[var(--ui-kit-fg-muted)]", children: "Initializing wallet..." })
|
|
11621
11647
|
] });
|
|
11622
11648
|
}
|
|
11623
|
-
const stepContent = (0,
|
|
11649
|
+
const stepContent = (0, import_react25.useMemo)(
|
|
11624
11650
|
() => ({
|
|
11625
11651
|
"loading": /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LoadingStep, {}),
|
|
11626
11652
|
"failed": /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AuthFailedStep, {}),
|
|
@@ -11817,7 +11843,7 @@ function getTooltipYPos(params) {
|
|
|
11817
11843
|
function OnboardingOverlay() {
|
|
11818
11844
|
const { t } = useT();
|
|
11819
11845
|
const page = useLayoutDataStore((st) => st.page);
|
|
11820
|
-
(0,
|
|
11846
|
+
(0, import_react26.useEffect)(() => {
|
|
11821
11847
|
setTimeout(() => {
|
|
11822
11848
|
if (!page) {
|
|
11823
11849
|
useOnboardingStore.getState().setMountIntoNode(document.body);
|
|
@@ -11835,7 +11861,7 @@ function OnboardingOverlay() {
|
|
|
11835
11861
|
const isMobileView = useLayoutStore((st) => st.isMobileView);
|
|
11836
11862
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
11837
11863
|
const { elRect, mountIntoNode } = useOnboardingStore();
|
|
11838
|
-
const [continueCountdown, setContinueCountdown] = (0,
|
|
11864
|
+
const [continueCountdown, setContinueCountdown] = (0, import_react26.useState)(null);
|
|
11839
11865
|
const {
|
|
11840
11866
|
actions: tourStepActions = [],
|
|
11841
11867
|
waitSecs = null,
|
|
@@ -11843,7 +11869,7 @@ function OnboardingOverlay() {
|
|
|
11843
11869
|
description,
|
|
11844
11870
|
forced = false
|
|
11845
11871
|
} = onboarder.getCurrentStep() || {};
|
|
11846
|
-
const position = (0,
|
|
11872
|
+
const position = (0, import_react26.useMemo)(() => {
|
|
11847
11873
|
const posParams = {
|
|
11848
11874
|
x: elRect.x,
|
|
11849
11875
|
y: elRect.y,
|
|
@@ -11853,7 +11879,7 @@ function OnboardingOverlay() {
|
|
|
11853
11879
|
};
|
|
11854
11880
|
return { ...getTooltipXPos(posParams), ...getTooltipYPos(posParams) };
|
|
11855
11881
|
}, [elRect, isMobileView]);
|
|
11856
|
-
(0,
|
|
11882
|
+
(0, import_react26.useEffect)(() => {
|
|
11857
11883
|
if (!waitSecs) return;
|
|
11858
11884
|
setContinueCountdown(waitSecs);
|
|
11859
11885
|
const countdownInterval = setInterval(() => {
|
|
@@ -11995,12 +12021,12 @@ function OnboardingOverlay() {
|
|
|
11995
12021
|
mountIntoNode
|
|
11996
12022
|
);
|
|
11997
12023
|
}
|
|
11998
|
-
var import_lucide_react12,
|
|
12024
|
+
var import_lucide_react12, import_react26, import_react_dom2, import_jsx_runtime27, EXPAND, TOOLTIP_MIN_WIDTH, TOP_POS_OFFSET;
|
|
11999
12025
|
var init_OnboardingOverlay = __esm({
|
|
12000
12026
|
"src/internal/components/Onboarding/OnboardingOverlay.tsx"() {
|
|
12001
12027
|
init_i18n();
|
|
12002
12028
|
import_lucide_react12 = require("lucide-react");
|
|
12003
|
-
|
|
12029
|
+
import_react26 = require("react");
|
|
12004
12030
|
import_react_dom2 = require("react-dom");
|
|
12005
12031
|
init_useLayoutDataStore();
|
|
12006
12032
|
init_useLayoutStore();
|
|
@@ -12017,15 +12043,15 @@ var init_OnboardingOverlay = __esm({
|
|
|
12017
12043
|
|
|
12018
12044
|
// src/internal/components/Onboarding/useOnboardingTouirAvailable.ts
|
|
12019
12045
|
function useOnboardingTourAvailable(isAvailable) {
|
|
12020
|
-
(0,
|
|
12046
|
+
(0, import_react27.useEffect)(() => {
|
|
12021
12047
|
useOnboardingStore.getState().setIsTourAvailable(isAvailable);
|
|
12022
12048
|
return () => useOnboardingStore.getState().setIsTourAvailable(false);
|
|
12023
12049
|
}, [isAvailable]);
|
|
12024
12050
|
}
|
|
12025
|
-
var
|
|
12051
|
+
var import_react27;
|
|
12026
12052
|
var init_useOnboardingTouirAvailable = __esm({
|
|
12027
12053
|
"src/internal/components/Onboarding/useOnboardingTouirAvailable.ts"() {
|
|
12028
|
-
|
|
12054
|
+
import_react27 = require("react");
|
|
12029
12055
|
init_useOnboardingStore();
|
|
12030
12056
|
}
|
|
12031
12057
|
});
|
|
@@ -12041,17 +12067,17 @@ var init_Onboarding = __esm({
|
|
|
12041
12067
|
});
|
|
12042
12068
|
|
|
12043
12069
|
// src/internal/components/ui/switch.tsx
|
|
12044
|
-
var
|
|
12070
|
+
var import_react28, import_jsx_runtime28, Switch;
|
|
12045
12071
|
var init_switch = __esm({
|
|
12046
12072
|
"src/internal/components/ui/switch.tsx"() {
|
|
12047
|
-
|
|
12073
|
+
import_react28 = require("react");
|
|
12048
12074
|
init_useLayoutStore();
|
|
12049
12075
|
init_utils();
|
|
12050
12076
|
import_jsx_runtime28 = require("react/jsx-runtime");
|
|
12051
|
-
Switch = (0,
|
|
12077
|
+
Switch = (0, import_react28.forwardRef)((props, ref) => {
|
|
12052
12078
|
const { className, labels, ...inputProps } = props;
|
|
12053
12079
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
12054
|
-
const [labelW, setLabelW] = (0,
|
|
12080
|
+
const [labelW, setLabelW] = (0, import_react28.useState)(0);
|
|
12055
12081
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
12056
12082
|
"div",
|
|
12057
12083
|
{
|
|
@@ -12592,7 +12618,7 @@ var init_priceFormatter = __esm({
|
|
|
12592
12618
|
|
|
12593
12619
|
// src/internal/components/BuyMenu/useBuyMenuStore.ts
|
|
12594
12620
|
function useBuyMenuParams() {
|
|
12595
|
-
(0,
|
|
12621
|
+
(0, import_react29.useEffect)(() => {
|
|
12596
12622
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
12597
12623
|
if (!pageParams || !(0, import_lodash_es7.keys)(pageParams).length) return;
|
|
12598
12624
|
const { amount, crypto: crypto2, onRampWidgetRedirected } = pageParams || {};
|
|
@@ -12608,11 +12634,11 @@ function useBuyMenuParams() {
|
|
|
12608
12634
|
setPageParams(null);
|
|
12609
12635
|
}, []);
|
|
12610
12636
|
}
|
|
12611
|
-
var import_lodash_es7,
|
|
12637
|
+
var import_lodash_es7, import_react29, import_zustand7, import_middleware2, DEFAULT_MENU_SWITCHES, DEFAULT_AMOUNT, DEFAULT_PROVIDER, useBuyMenuStore;
|
|
12612
12638
|
var init_useBuyMenuStore = __esm({
|
|
12613
12639
|
"src/internal/components/BuyMenu/useBuyMenuStore.ts"() {
|
|
12614
12640
|
import_lodash_es7 = require("lodash-es");
|
|
12615
|
-
|
|
12641
|
+
import_react29 = require("react");
|
|
12616
12642
|
import_zustand7 = require("zustand");
|
|
12617
12643
|
import_middleware2 = require("zustand/middleware");
|
|
12618
12644
|
init_useLayoutDataStore();
|
|
@@ -12731,13 +12757,13 @@ function CryptoSelector(props) {
|
|
|
12731
12757
|
const { coins } = props;
|
|
12732
12758
|
const { t } = useT();
|
|
12733
12759
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
12734
|
-
const [searchValue, setSearchValue] = (0,
|
|
12735
|
-
const [target, setTarget] = (0,
|
|
12736
|
-
const setSearchDebounced = (0,
|
|
12760
|
+
const [searchValue, setSearchValue] = (0, import_react30.useState)("");
|
|
12761
|
+
const [target, setTarget] = (0, import_react30.useState)("");
|
|
12762
|
+
const setSearchDebounced = (0, import_react30.useCallback)(
|
|
12737
12763
|
(0, import_lodash_es8.debounce)((value) => setTarget(value), 1e3),
|
|
12738
12764
|
[]
|
|
12739
12765
|
);
|
|
12740
|
-
const filteredCoins = (0,
|
|
12766
|
+
const filteredCoins = (0, import_react30.useMemo)(() => {
|
|
12741
12767
|
const sorted = [...coins].sort((a, b) => {
|
|
12742
12768
|
const aIdx = POPULAR_CRYPTOS.indexOf(a.symbol.toUpperCase());
|
|
12743
12769
|
const bIdx = POPULAR_CRYPTOS.indexOf(b.symbol.toUpperCase());
|
|
@@ -12843,7 +12869,7 @@ function CryptoSelectorTrigger(props) {
|
|
|
12843
12869
|
}
|
|
12844
12870
|
);
|
|
12845
12871
|
}
|
|
12846
|
-
var import_lodash_es8, import_lucide_react13,
|
|
12872
|
+
var import_lodash_es8, import_lucide_react13, import_react30, import_jsx_runtime41, POPULAR_CRYPTOS;
|
|
12847
12873
|
var init_CryptoSelector = __esm({
|
|
12848
12874
|
"src/internal/components/BuyMenu/components/CryptoSelector.tsx"() {
|
|
12849
12875
|
init_tokens();
|
|
@@ -12852,7 +12878,7 @@ var init_CryptoSelector = __esm({
|
|
|
12852
12878
|
init_i18n();
|
|
12853
12879
|
import_lodash_es8 = require("lodash-es");
|
|
12854
12880
|
import_lucide_react13 = require("lucide-react");
|
|
12855
|
-
|
|
12881
|
+
import_react30 = require("react");
|
|
12856
12882
|
init_priceFormatter();
|
|
12857
12883
|
init_button();
|
|
12858
12884
|
init_highlight();
|
|
@@ -12954,13 +12980,13 @@ function FiatSelector(props) {
|
|
|
12954
12980
|
const { fiats } = props;
|
|
12955
12981
|
const { t, i18n } = useT();
|
|
12956
12982
|
const locale = i18n.resolvedLanguage || "en";
|
|
12957
|
-
const [searchValue, setSearchValue] = (0,
|
|
12958
|
-
const [target, setTarget] = (0,
|
|
12959
|
-
const setSearchDebounced = (0,
|
|
12983
|
+
const [searchValue, setSearchValue] = (0, import_react31.useState)("");
|
|
12984
|
+
const [target, setTarget] = (0, import_react31.useState)("");
|
|
12985
|
+
const setSearchDebounced = (0, import_react31.useCallback)(
|
|
12960
12986
|
(0, import_lodash_es9.debounce)((value) => setTarget(value), 1e3),
|
|
12961
12987
|
[]
|
|
12962
12988
|
);
|
|
12963
|
-
const filteredFiats = (0,
|
|
12989
|
+
const filteredFiats = (0, import_react31.useMemo)(() => {
|
|
12964
12990
|
const sorted = [...fiats].sort((a, b) => {
|
|
12965
12991
|
const aIdx = POPULAR_FIATS.indexOf(a.ticker.toUpperCase());
|
|
12966
12992
|
const bIdx = POPULAR_FIATS.indexOf(b.ticker.toUpperCase());
|
|
@@ -13025,13 +13051,13 @@ function FiatSelectorTrigger(props) {
|
|
|
13025
13051
|
}
|
|
13026
13052
|
);
|
|
13027
13053
|
}
|
|
13028
|
-
var import_lodash_es9, import_lucide_react14,
|
|
13054
|
+
var import_lodash_es9, import_lucide_react14, import_react31, import_jsx_runtime43, POPULAR_FIATS;
|
|
13029
13055
|
var init_FiatSelector = __esm({
|
|
13030
13056
|
"src/internal/components/BuyMenu/components/FiatSelector.tsx"() {
|
|
13031
13057
|
init_i18n();
|
|
13032
13058
|
import_lodash_es9 = require("lodash-es");
|
|
13033
13059
|
import_lucide_react14 = require("lucide-react");
|
|
13034
|
-
|
|
13060
|
+
import_react31 = require("react");
|
|
13035
13061
|
init_button();
|
|
13036
13062
|
init_highlight();
|
|
13037
13063
|
init_input();
|
|
@@ -13723,7 +13749,7 @@ function BinanceTxHistory() {
|
|
|
13723
13749
|
txStatuses: SHOW_STATUSES
|
|
13724
13750
|
})
|
|
13725
13751
|
});
|
|
13726
|
-
const txList = (0,
|
|
13752
|
+
const txList = (0, import_react32.useMemo)(
|
|
13727
13753
|
() => historyData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
13728
13754
|
[historyData]
|
|
13729
13755
|
);
|
|
@@ -13748,7 +13774,7 @@ function BinanceTxHistory() {
|
|
|
13748
13774
|
)
|
|
13749
13775
|
] });
|
|
13750
13776
|
}
|
|
13751
|
-
var import_react_query9, import_dayjs2, import_lucide_react17,
|
|
13777
|
+
var import_react_query9, import_dayjs2, import_lucide_react17, import_react32, import_jsx_runtime46, TRANSACTIONS_PAGESIZE, SHOW_STATUSES;
|
|
13752
13778
|
var init_BinanceTxHistory = __esm({
|
|
13753
13779
|
"src/internal/components/BuyMenu/binance/BinanceTxHistory.tsx"() {
|
|
13754
13780
|
init_tokens();
|
|
@@ -13758,7 +13784,7 @@ var init_BinanceTxHistory = __esm({
|
|
|
13758
13784
|
import_react_query9 = require("@tanstack/react-query");
|
|
13759
13785
|
import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
13760
13786
|
import_lucide_react17 = require("lucide-react");
|
|
13761
|
-
|
|
13787
|
+
import_react32 = require("react");
|
|
13762
13788
|
init_priceFormatter();
|
|
13763
13789
|
init_badge();
|
|
13764
13790
|
init_button();
|
|
@@ -13775,8 +13801,8 @@ var init_BinanceTxHistory = __esm({
|
|
|
13775
13801
|
// src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts
|
|
13776
13802
|
function useBinanceSseTxTracing(walletAddress) {
|
|
13777
13803
|
const qc = (0, import_react_query10.useQueryClient)();
|
|
13778
|
-
const debounceRef = (0,
|
|
13779
|
-
(0,
|
|
13804
|
+
const debounceRef = (0, import_react33.useRef)(null);
|
|
13805
|
+
(0, import_react33.useEffect)(() => {
|
|
13780
13806
|
if (!walletAddress) return;
|
|
13781
13807
|
const iframeManager = getIframeManager();
|
|
13782
13808
|
if (!iframeManager) return;
|
|
@@ -13798,11 +13824,11 @@ function useBinanceSseTxTracing(walletAddress) {
|
|
|
13798
13824
|
};
|
|
13799
13825
|
}, [walletAddress, qc]);
|
|
13800
13826
|
}
|
|
13801
|
-
var import_react_query10,
|
|
13827
|
+
var import_react_query10, import_react33;
|
|
13802
13828
|
var init_useBinanceSseTracing = __esm({
|
|
13803
13829
|
"src/internal/components/BuyMenu/binance/useBinanceSseTracing.ts"() {
|
|
13804
13830
|
import_react_query10 = require("@tanstack/react-query");
|
|
13805
|
-
|
|
13831
|
+
import_react33 = require("react");
|
|
13806
13832
|
init_iframe_manager();
|
|
13807
13833
|
init_queryKeys();
|
|
13808
13834
|
init_api2();
|
|
@@ -13870,7 +13896,7 @@ function Binance() {
|
|
|
13870
13896
|
});
|
|
13871
13897
|
const paymentModes = paymentModesData?.data?.paymentMethods || [];
|
|
13872
13898
|
const selectedPaymentMode = paymentModes?.find((el) => getPayMethodID(el) === paymentMode) || null;
|
|
13873
|
-
(0,
|
|
13899
|
+
(0, import_react34.useEffect)(() => {
|
|
13874
13900
|
useBuyMenuStore.getState().setMinAmount(Number(selectedPaymentMode?.fiatMinLimit || "0"));
|
|
13875
13901
|
}, [selectedPaymentMode]);
|
|
13876
13902
|
const { mutate: estimateQuote, isPending: isQuoteEstimating } = (0, import_react_query11.useMutation)({
|
|
@@ -13898,22 +13924,22 @@ function Binance() {
|
|
|
13898
13924
|
}
|
|
13899
13925
|
});
|
|
13900
13926
|
const availableFiats = (tradingPairsData?.data?.fiatCurrencies || []).map((ticker) => ({ ticker }));
|
|
13901
|
-
(0,
|
|
13927
|
+
(0, import_react34.useEffect)(() => {
|
|
13902
13928
|
if (!!selectedFiat || !availableFiats?.length) return;
|
|
13903
13929
|
const targetFiat = availableFiats.find((item) => PREFERRED_FIATS.includes(item.ticker)) || availableFiats[0];
|
|
13904
13930
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
13905
13931
|
}, [availableFiats, selectedFiat]);
|
|
13906
|
-
(0,
|
|
13932
|
+
(0, import_react34.useEffect)(() => {
|
|
13907
13933
|
if (!!selectedCrypto || !networkAvailableCryptoList?.length) return;
|
|
13908
13934
|
const targetCrypto = networkAvailableCryptoList.find((item) => PREFERRED_CRYPTOS.includes(item.cryptoCurrency)) || networkAvailableCryptoList[0];
|
|
13909
13935
|
useBuyMenuStore.getState().setSelectedCrypto(targetCrypto.cryptoCurrency);
|
|
13910
13936
|
}, [networkAvailableCryptoList, selectedCrypto]);
|
|
13911
|
-
(0,
|
|
13937
|
+
(0, import_react34.useEffect)(() => {
|
|
13912
13938
|
if (!!paymentMode || !paymentModes.length) return;
|
|
13913
13939
|
const targetPaymentMode = paymentModes.find((item) => item.payMethodCode === PREFERRED_PAYMENT_METHOD) || paymentModes[0];
|
|
13914
13940
|
useBinanceStore.getState().setPaymentMode(getPayMethodID(targetPaymentMode));
|
|
13915
13941
|
}, [paymentModes]);
|
|
13916
|
-
(0,
|
|
13942
|
+
(0, import_react34.useEffect)(() => {
|
|
13917
13943
|
return () => {
|
|
13918
13944
|
useBinanceStore.getState().setPaymentMode(null);
|
|
13919
13945
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.binanceTradingPairs] });
|
|
@@ -14042,7 +14068,7 @@ function Binance() {
|
|
|
14042
14068
|
}
|
|
14043
14069
|
);
|
|
14044
14070
|
}
|
|
14045
|
-
var import_react_query11, import_lucide_react18,
|
|
14071
|
+
var import_react_query11, import_lucide_react18, import_react34, import_jsx_runtime47, PREFERRED_PAYMENT_METHOD, PREFERRED_FIATS, PREFERRED_CRYPTOS;
|
|
14046
14072
|
var init_Binance = __esm({
|
|
14047
14073
|
"src/internal/components/BuyMenu/binance/Binance.tsx"() {
|
|
14048
14074
|
init_utils();
|
|
@@ -14050,7 +14076,7 @@ var init_Binance = __esm({
|
|
|
14050
14076
|
init_i18n();
|
|
14051
14077
|
import_react_query11 = require("@tanstack/react-query");
|
|
14052
14078
|
import_lucide_react18 = require("lucide-react");
|
|
14053
|
-
|
|
14079
|
+
import_react34 = require("react");
|
|
14054
14080
|
init_Onboarding();
|
|
14055
14081
|
init_button();
|
|
14056
14082
|
init_highlight();
|
|
@@ -14325,7 +14351,7 @@ function FinchPayTxHistoryItem(props) {
|
|
|
14325
14351
|
function FinchPayTxHistory() {
|
|
14326
14352
|
const { t } = useT();
|
|
14327
14353
|
const walletAddress = useSession((st) => st.address);
|
|
14328
|
-
const [cursor, setCursor] = (0,
|
|
14354
|
+
const [cursor, setCursor] = (0, import_react35.useState)(1);
|
|
14329
14355
|
const {
|
|
14330
14356
|
data: txData,
|
|
14331
14357
|
isLoading: isTxDataLoading,
|
|
@@ -14347,7 +14373,7 @@ function FinchPayTxHistory() {
|
|
|
14347
14373
|
const pageCount = loadedPages[loadedPages.length - 1]?.pageCount || 1;
|
|
14348
14374
|
const txList = loadedPages.map((p) => p.data)[cursor - 1] || [];
|
|
14349
14375
|
console.log("[FINCHPAY] txList", txData);
|
|
14350
|
-
const handleNextPage = (0,
|
|
14376
|
+
const handleNextPage = (0, import_react35.useCallback)(
|
|
14351
14377
|
async (curCursor, curPageParams) => {
|
|
14352
14378
|
const maxLoadedPage = Math.max(...curPageParams);
|
|
14353
14379
|
if (curCursor !== maxLoadedPage) {
|
|
@@ -14402,7 +14428,7 @@ function FinchPayTxHistory() {
|
|
|
14402
14428
|
] })
|
|
14403
14429
|
] });
|
|
14404
14430
|
}
|
|
14405
|
-
var import_react_query13, import_dayjs3, import_lucide_react20,
|
|
14431
|
+
var import_react_query13, import_dayjs3, import_lucide_react20, import_react35, import_jsx_runtime49, TRANSACTIONS_PAGESIZE2;
|
|
14406
14432
|
var init_FinchPayTxHistory = __esm({
|
|
14407
14433
|
"src/internal/components/BuyMenu/finchpay/FinchPayTxHistory.tsx"() {
|
|
14408
14434
|
init_utils();
|
|
@@ -14411,7 +14437,7 @@ var init_FinchPayTxHistory = __esm({
|
|
|
14411
14437
|
import_react_query13 = require("@tanstack/react-query");
|
|
14412
14438
|
import_dayjs3 = __toESM(require("dayjs"), 1);
|
|
14413
14439
|
import_lucide_react20 = require("lucide-react");
|
|
14414
|
-
|
|
14440
|
+
import_react35 = require("react");
|
|
14415
14441
|
init_priceFormatter();
|
|
14416
14442
|
init_badge();
|
|
14417
14443
|
init_button();
|
|
@@ -14438,8 +14464,8 @@ var init_networks = __esm({
|
|
|
14438
14464
|
// src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts
|
|
14439
14465
|
function useFinchpaySseTxTracing(walletAddress) {
|
|
14440
14466
|
const qc = (0, import_react_query14.useQueryClient)();
|
|
14441
|
-
const debounceRef = (0,
|
|
14442
|
-
(0,
|
|
14467
|
+
const debounceRef = (0, import_react36.useRef)(null);
|
|
14468
|
+
(0, import_react36.useEffect)(() => {
|
|
14443
14469
|
if (!walletAddress) return;
|
|
14444
14470
|
const iframeManager = getIframeManager();
|
|
14445
14471
|
if (!iframeManager) return;
|
|
@@ -14461,11 +14487,11 @@ function useFinchpaySseTxTracing(walletAddress) {
|
|
|
14461
14487
|
};
|
|
14462
14488
|
}, [walletAddress, qc]);
|
|
14463
14489
|
}
|
|
14464
|
-
var import_react_query14,
|
|
14490
|
+
var import_react_query14, import_react36;
|
|
14465
14491
|
var init_useFinchpaySseTxTracing = __esm({
|
|
14466
14492
|
"src/internal/components/BuyMenu/finchpay/useFinchpaySseTxTracing.ts"() {
|
|
14467
14493
|
import_react_query14 = require("@tanstack/react-query");
|
|
14468
|
-
|
|
14494
|
+
import_react36 = require("react");
|
|
14469
14495
|
init_iframe_manager();
|
|
14470
14496
|
init_queryKeys();
|
|
14471
14497
|
init_api3();
|
|
@@ -14563,7 +14589,7 @@ function FinchPay() {
|
|
|
14563
14589
|
})
|
|
14564
14590
|
});
|
|
14565
14591
|
const minimum = Number(limitsData?.min_amount || "0");
|
|
14566
|
-
(0,
|
|
14592
|
+
(0, import_react37.useEffect)(() => {
|
|
14567
14593
|
if (minimum <= 0) return;
|
|
14568
14594
|
useBuyMenuStore.getState().setMinAmount(minimum);
|
|
14569
14595
|
}, [minimum]);
|
|
@@ -14591,23 +14617,23 @@ function FinchPay() {
|
|
|
14591
14617
|
// defaults to CARD estimation, widgetUrl
|
|
14592
14618
|
})
|
|
14593
14619
|
});
|
|
14594
|
-
(0,
|
|
14620
|
+
(0, import_react37.useEffect)(() => {
|
|
14595
14621
|
const { error: errorTitle, message: errorMessage } = handleErrors([currenciesError, limitsError, estimateError]);
|
|
14596
14622
|
if (!errorTitle && !errorMessage) return;
|
|
14597
14623
|
console.error(`[BuyModal][Binance] ${errorTitle}: ${errorMessage}`);
|
|
14598
14624
|
useBuyMenuStore.getState().setError(errorMessage);
|
|
14599
14625
|
}, [currenciesError, limitsError, estimateError]);
|
|
14600
|
-
(0,
|
|
14626
|
+
(0, import_react37.useEffect)(() => {
|
|
14601
14627
|
if (!!selectedFiat || currenciesData.fiats.length === 0) return;
|
|
14602
14628
|
const fallbackFiat = currenciesData.fiats[0];
|
|
14603
14629
|
const targetFiat = currenciesData.fiats.find((f) => f.ticker.toUpperCase() === "USD") || fallbackFiat;
|
|
14604
14630
|
useBuyMenuStore.getState().setSelectedFiat(targetFiat.ticker);
|
|
14605
14631
|
}, [currenciesData, selectedFiat]);
|
|
14606
|
-
(0,
|
|
14632
|
+
(0, import_react37.useEffect)(() => {
|
|
14607
14633
|
if (!!selectedCrypto || currenciesData.currentNetworkCoins.length === 0) return;
|
|
14608
14634
|
useBuyMenuStore.getState().setSelectedCrypto(currenciesData.currentNetworkCoins[0].ticker);
|
|
14609
14635
|
}, [currenciesData, selectedCrypto]);
|
|
14610
|
-
(0,
|
|
14636
|
+
(0, import_react37.useEffect)(() => {
|
|
14611
14637
|
return () => {
|
|
14612
14638
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayCurrencies] });
|
|
14613
14639
|
qc.resetQueries({ queryKey: [QUERY_KEYS2.finchPayLimits] });
|
|
@@ -14729,7 +14755,7 @@ function FinchPay() {
|
|
|
14729
14755
|
)
|
|
14730
14756
|
] });
|
|
14731
14757
|
}
|
|
14732
|
-
var import_react_query15, import_lucide_react21,
|
|
14758
|
+
var import_react_query15, import_lucide_react21, import_react37, import_jsx_runtime50;
|
|
14733
14759
|
var init_FinchPay = __esm({
|
|
14734
14760
|
"src/internal/components/BuyMenu/finchpay/FinchPay.tsx"() {
|
|
14735
14761
|
init_priceFormatter();
|
|
@@ -14738,7 +14764,7 @@ var init_FinchPay = __esm({
|
|
|
14738
14764
|
init_i18n();
|
|
14739
14765
|
import_react_query15 = require("@tanstack/react-query");
|
|
14740
14766
|
import_lucide_react21 = require("lucide-react");
|
|
14741
|
-
|
|
14767
|
+
import_react37 = require("react");
|
|
14742
14768
|
init_button();
|
|
14743
14769
|
init_highlight();
|
|
14744
14770
|
init_input();
|
|
@@ -14867,20 +14893,20 @@ var init_ProviderSelector = __esm({
|
|
|
14867
14893
|
});
|
|
14868
14894
|
|
|
14869
14895
|
// src/internal/components/BuyMenu/useHandleInputAmount.ts
|
|
14870
|
-
var
|
|
14896
|
+
var import_react38, ON_INPUT_QUERY_DELAY, useHandleInputAmount;
|
|
14871
14897
|
var init_useHandleInputAmount = __esm({
|
|
14872
14898
|
"src/internal/components/BuyMenu/useHandleInputAmount.ts"() {
|
|
14873
|
-
|
|
14899
|
+
import_react38 = require("react");
|
|
14874
14900
|
init_contants();
|
|
14875
14901
|
init_useBuyMenuStore();
|
|
14876
14902
|
ON_INPUT_QUERY_DELAY = 1500;
|
|
14877
14903
|
useHandleInputAmount = () => {
|
|
14878
|
-
const lastRampProviderRef = (0,
|
|
14904
|
+
const lastRampProviderRef = (0, import_react38.useRef)(DEFAULT_PROVIDER2);
|
|
14879
14905
|
const rampProvider = useBuyMenuStore((st) => st.rampProvider);
|
|
14880
14906
|
const srcInputAmount = useBuyMenuStore((st) => st.srcInputAmount);
|
|
14881
14907
|
const minAmount = useBuyMenuStore((st) => st.minAmount);
|
|
14882
|
-
const queryAmountTimer = (0,
|
|
14883
|
-
(0,
|
|
14908
|
+
const queryAmountTimer = (0, import_react38.useRef)(null);
|
|
14909
|
+
(0, import_react38.useEffect)(() => {
|
|
14884
14910
|
if (queryAmountTimer.current) clearTimeout(queryAmountTimer.current);
|
|
14885
14911
|
queryAmountTimer.current = setTimeout(() => {
|
|
14886
14912
|
const checkedValue = Math.ceil(Math.max(Number(srcInputAmount), Number(minAmount)));
|
|
@@ -14888,7 +14914,7 @@ var init_useHandleInputAmount = __esm({
|
|
|
14888
14914
|
useBuyMenuStore.getState().setSrcQueryAmount(checkedValue);
|
|
14889
14915
|
}, ON_INPUT_QUERY_DELAY);
|
|
14890
14916
|
}, [minAmount, srcInputAmount]);
|
|
14891
|
-
(0,
|
|
14917
|
+
(0, import_react38.useEffect)(() => {
|
|
14892
14918
|
if (lastRampProviderRef.current === rampProvider) return;
|
|
14893
14919
|
const {
|
|
14894
14920
|
setIsProviderSummary,
|
|
@@ -15382,10 +15408,10 @@ function ChainsMenu() {
|
|
|
15382
15408
|
const { t } = useT();
|
|
15383
15409
|
const config = useProviderConfig().config;
|
|
15384
15410
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
15385
|
-
const [isTestnets, setIsTestnets] = (0,
|
|
15386
|
-
const [nextChainId, setNextChainId] = (0,
|
|
15411
|
+
const [isTestnets, setIsTestnets] = (0, import_react39.useState)(false);
|
|
15412
|
+
const [nextChainId, setNextChainId] = (0, import_react39.useState)(null);
|
|
15387
15413
|
useOnboardingTourAvailable(true);
|
|
15388
|
-
const visibleNetworks = (0,
|
|
15414
|
+
const visibleNetworks = (0, import_react39.useMemo)(() => {
|
|
15389
15415
|
return NETWORK_OPTIONS.filter(
|
|
15390
15416
|
(option) => option.isActive && (isTestnets ? true : import_read15.SUPPORTED_MAINNETS.includes(option.chainId))
|
|
15391
15417
|
);
|
|
@@ -15452,7 +15478,7 @@ function ChainsMenu() {
|
|
|
15452
15478
|
)) })
|
|
15453
15479
|
] });
|
|
15454
15480
|
}
|
|
15455
|
-
var import_core3, import_read15, import_react_query16, import_lucide_react24,
|
|
15481
|
+
var import_core3, import_read15, import_react_query16, import_lucide_react24, import_react39, import_jsx_runtime60;
|
|
15456
15482
|
var init_ChainsMenu = __esm({
|
|
15457
15483
|
"src/internal/components/ChainsMenu/ChainsMenu.tsx"() {
|
|
15458
15484
|
init_networks3();
|
|
@@ -15463,7 +15489,7 @@ var init_ChainsMenu = __esm({
|
|
|
15463
15489
|
import_read15 = require("@embarkai/core/read");
|
|
15464
15490
|
import_react_query16 = require("@tanstack/react-query");
|
|
15465
15491
|
import_lucide_react24 = require("lucide-react");
|
|
15466
|
-
|
|
15492
|
+
import_react39 = require("react");
|
|
15467
15493
|
init_resolve_paymaster();
|
|
15468
15494
|
init_useLayoutDataStore();
|
|
15469
15495
|
init_Expandable2();
|
|
@@ -15840,16 +15866,16 @@ function useLinkedProfiles() {
|
|
|
15840
15866
|
}
|
|
15841
15867
|
});
|
|
15842
15868
|
const { profiles = [], avatar = null } = data || {};
|
|
15843
|
-
const refresh = (0,
|
|
15869
|
+
const refresh = (0, import_react40.useCallback)(async () => {
|
|
15844
15870
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15845
15871
|
}, [qc, address]);
|
|
15846
15872
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
15847
15873
|
}
|
|
15848
|
-
var import_react_query17,
|
|
15874
|
+
var import_react_query17, import_react40, LINKED_PROFILES_QUERY_KEY;
|
|
15849
15875
|
var init_linkedProfiles = __esm({
|
|
15850
15876
|
"src/modules/linkedProfiles.ts"() {
|
|
15851
15877
|
import_react_query17 = require("@tanstack/react-query");
|
|
15852
|
-
|
|
15878
|
+
import_react40 = require("react");
|
|
15853
15879
|
init_SessionContext();
|
|
15854
15880
|
init_auth();
|
|
15855
15881
|
init_common();
|
|
@@ -16587,7 +16613,7 @@ function useLinkSocial() {
|
|
|
16587
16613
|
} = useProviderConfig();
|
|
16588
16614
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16589
16615
|
const { providerType, linkIsLoading, setProviderType, setAlert, setLinkIsLoading } = useManageWalletStore();
|
|
16590
|
-
const handleLinkSocialProvider =
|
|
16616
|
+
const handleLinkSocialProvider = import_react41.default.useCallback(
|
|
16591
16617
|
async (providerIdRaw) => {
|
|
16592
16618
|
const providerKey = providerIdRaw.toLowerCase();
|
|
16593
16619
|
const normalizedKey = providerKey === "twitter" ? "x" : providerKey;
|
|
@@ -16645,8 +16671,8 @@ function useLinkSocial() {
|
|
|
16645
16671
|
},
|
|
16646
16672
|
[config.social?.providers]
|
|
16647
16673
|
);
|
|
16648
|
-
const [socialLinkStarted, setSocialLinkStarted] =
|
|
16649
|
-
(0,
|
|
16674
|
+
const [socialLinkStarted, setSocialLinkStarted] = import_react41.default.useState(false);
|
|
16675
|
+
(0, import_react41.useEffect)(() => {
|
|
16650
16676
|
const key = providerType?.toLowerCase();
|
|
16651
16677
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted });
|
|
16652
16678
|
if (key && key !== "telegram" && key !== "email" && key !== "passkey" && key !== "wallet") {
|
|
@@ -16660,7 +16686,7 @@ function useLinkSocial() {
|
|
|
16660
16686
|
}
|
|
16661
16687
|
}, [providerType, linkIsLoading, socialLinkStarted, handleLinkSocialProvider]);
|
|
16662
16688
|
}
|
|
16663
|
-
var import_react_query22,
|
|
16689
|
+
var import_react_query22, import_react41;
|
|
16664
16690
|
var init_useLinkSocial = __esm({
|
|
16665
16691
|
"src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts"() {
|
|
16666
16692
|
init_useLayoutDataStore();
|
|
@@ -16668,7 +16694,7 @@ var init_useLinkSocial = __esm({
|
|
|
16668
16694
|
init_SessionContext();
|
|
16669
16695
|
init_linkedProfiles();
|
|
16670
16696
|
import_react_query22 = require("@tanstack/react-query");
|
|
16671
|
-
|
|
16697
|
+
import_react41 = __toESM(require("react"), 1);
|
|
16672
16698
|
init_auth();
|
|
16673
16699
|
init_telegramBrowser();
|
|
16674
16700
|
init_useProvidersList();
|
|
@@ -16736,7 +16762,7 @@ function useLinkTelegram() {
|
|
|
16736
16762
|
const address = useSession((st) => st.address);
|
|
16737
16763
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16738
16764
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16739
|
-
const handleLinkTelegram = (0,
|
|
16765
|
+
const handleLinkTelegram = (0, import_react42.useCallback)(async () => {
|
|
16740
16766
|
try {
|
|
16741
16767
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16742
16768
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16783,8 +16809,8 @@ function useLinkTelegram() {
|
|
|
16783
16809
|
setLinkIsLoading(false);
|
|
16784
16810
|
}
|
|
16785
16811
|
}, [config.social?.providers]);
|
|
16786
|
-
const [telegramLinkStarted, setTelegramLinkStarted] = (0,
|
|
16787
|
-
(0,
|
|
16812
|
+
const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react42.useState)(false);
|
|
16813
|
+
(0, import_react42.useEffect)(() => {
|
|
16788
16814
|
console.log("[useLinkTelegram] Effect triggered:", { providerType, linkIsLoading, telegramLinkStarted });
|
|
16789
16815
|
if (providerType === "telegram" && !linkIsLoading && !telegramLinkStarted) {
|
|
16790
16816
|
console.log("[useLinkTelegram] Starting Telegram link flow");
|
|
@@ -16792,20 +16818,20 @@ function useLinkTelegram() {
|
|
|
16792
16818
|
handleLinkTelegram();
|
|
16793
16819
|
}
|
|
16794
16820
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted]);
|
|
16795
|
-
(0,
|
|
16821
|
+
(0, import_react42.useEffect)(() => {
|
|
16796
16822
|
if (providerType !== "telegram") {
|
|
16797
16823
|
setTelegramLinkStarted(false);
|
|
16798
16824
|
}
|
|
16799
16825
|
}, [providerType]);
|
|
16800
16826
|
}
|
|
16801
|
-
var import_react_query23,
|
|
16827
|
+
var import_react_query23, import_react42;
|
|
16802
16828
|
var init_useLinkTelegram = __esm({
|
|
16803
16829
|
"src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts"() {
|
|
16804
16830
|
init_ProviderContext();
|
|
16805
16831
|
init_SessionContext();
|
|
16806
16832
|
init_linkedProfiles();
|
|
16807
16833
|
import_react_query23 = require("@tanstack/react-query");
|
|
16808
|
-
|
|
16834
|
+
import_react42 = require("react");
|
|
16809
16835
|
init_telegram2();
|
|
16810
16836
|
init_useLayoutDataStore();
|
|
16811
16837
|
init_telegramBrowser();
|
|
@@ -17005,7 +17031,7 @@ function ManageWalletMenu() {
|
|
|
17005
17031
|
} = useManageWalletStore();
|
|
17006
17032
|
const configuredProviders = getConfiguredProviders(config.current);
|
|
17007
17033
|
const { data: providers = [], isLoading: isProvidersLoading, error: providersError } = useProvidersList();
|
|
17008
|
-
const renderProviders = (0,
|
|
17034
|
+
const renderProviders = (0, import_react43.useMemo)(() => {
|
|
17009
17035
|
const normalizeProviderName = (name) => {
|
|
17010
17036
|
if (name === "x") return "twitter";
|
|
17011
17037
|
return name;
|
|
@@ -17130,7 +17156,7 @@ function ManageWalletMenu() {
|
|
|
17130
17156
|
] })
|
|
17131
17157
|
] });
|
|
17132
17158
|
}
|
|
17133
|
-
var import_lodash_es11, import_lucide_react31,
|
|
17159
|
+
var import_lodash_es11, import_lucide_react31, import_react43, import_jsx_runtime72, POSSIBLE_PROVIDERS, MULTI_PROVIDERS;
|
|
17134
17160
|
var init_ManageWallet = __esm({
|
|
17135
17161
|
"src/internal/components/ManageWalletMenu/ManageWallet.tsx"() {
|
|
17136
17162
|
init_useLayoutDataStore();
|
|
@@ -17139,7 +17165,7 @@ var init_ManageWallet = __esm({
|
|
|
17139
17165
|
init_i18n();
|
|
17140
17166
|
import_lodash_es11 = require("lodash-es");
|
|
17141
17167
|
import_lucide_react31 = require("lucide-react");
|
|
17142
|
-
|
|
17168
|
+
import_react43 = require("react");
|
|
17143
17169
|
init_constants();
|
|
17144
17170
|
init_telegramBrowser();
|
|
17145
17171
|
init_Expandable2();
|
|
@@ -17177,7 +17203,7 @@ function UnlinkProviderMenu() {
|
|
|
17177
17203
|
const { t } = useT();
|
|
17178
17204
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
17179
17205
|
const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
|
|
17180
|
-
const [confirmInput, setConfirmInput] = (0,
|
|
17206
|
+
const [confirmInput, setConfirmInput] = (0, import_react44.useState)("");
|
|
17181
17207
|
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0, import_react_query24.useMutation)({
|
|
17182
17208
|
mutationFn: async () => {
|
|
17183
17209
|
if (!confirmUnlink) {
|
|
@@ -17259,7 +17285,7 @@ function UnlinkProviderMenu() {
|
|
|
17259
17285
|
] })
|
|
17260
17286
|
] });
|
|
17261
17287
|
}
|
|
17262
|
-
var import_react_query24, import_lucide_react32,
|
|
17288
|
+
var import_react_query24, import_lucide_react32, import_react44, import_wagmi2, import_jsx_runtime73;
|
|
17263
17289
|
var init_UnlinkProviderMenu = __esm({
|
|
17264
17290
|
"src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
|
|
17265
17291
|
init_useLayoutDataStore();
|
|
@@ -17269,7 +17295,7 @@ var init_UnlinkProviderMenu = __esm({
|
|
|
17269
17295
|
init_linkedProfiles();
|
|
17270
17296
|
import_react_query24 = require("@tanstack/react-query");
|
|
17271
17297
|
import_lucide_react32 = require("lucide-react");
|
|
17272
|
-
|
|
17298
|
+
import_react44 = require("react");
|
|
17273
17299
|
import_wagmi2 = require("wagmi");
|
|
17274
17300
|
init_auth();
|
|
17275
17301
|
init_useExternalWalletStore();
|
|
@@ -17310,8 +17336,8 @@ var init_ManageWalletMenu = __esm({
|
|
|
17310
17336
|
|
|
17311
17337
|
// src/internal/components/ConnectExternalWalletMenu/useConnectExternalWalletMenuParams.ts
|
|
17312
17338
|
function useConnectExternalWalletMenuParams() {
|
|
17313
|
-
const paramsRef = (0,
|
|
17314
|
-
(0,
|
|
17339
|
+
const paramsRef = (0, import_react45.useRef)(null);
|
|
17340
|
+
(0, import_react45.useEffect)(() => {
|
|
17315
17341
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
17316
17342
|
if (!pageParams || !(0, import_lodash_es12.keys)(pageParams).length) return;
|
|
17317
17343
|
paramsRef.current = pageParams;
|
|
@@ -17319,11 +17345,11 @@ function useConnectExternalWalletMenuParams() {
|
|
|
17319
17345
|
}, []);
|
|
17320
17346
|
return paramsRef;
|
|
17321
17347
|
}
|
|
17322
|
-
var import_lodash_es12,
|
|
17348
|
+
var import_lodash_es12, import_react45;
|
|
17323
17349
|
var init_useConnectExternalWalletMenuParams = __esm({
|
|
17324
17350
|
"src/internal/components/ConnectExternalWalletMenu/useConnectExternalWalletMenuParams.ts"() {
|
|
17325
17351
|
import_lodash_es12 = require("lodash-es");
|
|
17326
|
-
|
|
17352
|
+
import_react45 = require("react");
|
|
17327
17353
|
init_useLayoutDataStore();
|
|
17328
17354
|
}
|
|
17329
17355
|
});
|
|
@@ -17334,18 +17360,18 @@ function hasInjectedWallet() {
|
|
|
17334
17360
|
return mipdStore.getProviders().length > 0 || !!window.ethereum;
|
|
17335
17361
|
}
|
|
17336
17362
|
function useHasInjectedWallet() {
|
|
17337
|
-
return (0,
|
|
17363
|
+
return (0, import_react46.useSyncExternalStore)(
|
|
17338
17364
|
(onStoreChange) => mipdStore?.subscribe(onStoreChange) ?? (() => {
|
|
17339
17365
|
}),
|
|
17340
17366
|
hasInjectedWallet,
|
|
17341
17367
|
() => false
|
|
17342
17368
|
);
|
|
17343
17369
|
}
|
|
17344
|
-
var import_mipd,
|
|
17370
|
+
var import_mipd, import_react46, mipdStore;
|
|
17345
17371
|
var init_useHasInjectedWallet = __esm({
|
|
17346
17372
|
"src/internal/components/ConnectExternalWalletMenu/useHasInjectedWallet.ts"() {
|
|
17347
17373
|
import_mipd = require("mipd");
|
|
17348
|
-
|
|
17374
|
+
import_react46 = require("react");
|
|
17349
17375
|
mipdStore = typeof window !== "undefined" ? (0, import_mipd.createStore)() : void 0;
|
|
17350
17376
|
}
|
|
17351
17377
|
});
|
|
@@ -17373,7 +17399,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17373
17399
|
const { mutateAsync: signMessageAsync } = (0, import_wagmi3.useSignMessage)();
|
|
17374
17400
|
const { mutateAsync: switchChainAsync } = (0, import_wagmi3.useSwitchChain)();
|
|
17375
17401
|
const { mutateAsync: switchConnectionAsync } = (0, import_wagmi3.useSwitchConnection)();
|
|
17376
|
-
const [isPreparingConnect, setIsPreparingConnect] = (0,
|
|
17402
|
+
const [isPreparingConnect, setIsPreparingConnect] = (0, import_react47.useState)(false);
|
|
17377
17403
|
const signOnSupportedChain = async (params) => {
|
|
17378
17404
|
const { connector, account, message } = params;
|
|
17379
17405
|
const signOnce = async (viaFallback = false) => {
|
|
@@ -17399,7 +17425,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17399
17425
|
queryKey: [PROVIDERS_QUERY_KEY, embarkAiAddress],
|
|
17400
17426
|
queryFn: async () => getLinkedProviders()
|
|
17401
17427
|
});
|
|
17402
|
-
const [connectError, setConnectError] = (0,
|
|
17428
|
+
const [connectError, setConnectError] = (0, import_react47.useState)(null);
|
|
17403
17429
|
const { mutateAsync: onLinkingComplete } = (0, import_react_query25.useMutation)({
|
|
17404
17430
|
mutationFn: async (success) => {
|
|
17405
17431
|
useManageWalletStore.getState().setProviderType(null);
|
|
@@ -17553,7 +17579,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17553
17579
|
}, 100);
|
|
17554
17580
|
await dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17555
17581
|
}
|
|
17556
|
-
const visibleConnectors = (0,
|
|
17582
|
+
const visibleConnectors = (0, import_react47.useMemo)(() => {
|
|
17557
17583
|
const seen = /* @__PURE__ */ new Set();
|
|
17558
17584
|
const unique = connectors.filter((connector) => {
|
|
17559
17585
|
const skipConnector = seen.has(connector.uid);
|
|
@@ -17571,7 +17597,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17571
17597
|
(connector) => allowed.includes(connector.id.toLowerCase()) || allowed.includes(connector.name.toLowerCase())
|
|
17572
17598
|
);
|
|
17573
17599
|
}, [connectors, allowedWallets, hasInjectedWallet2]);
|
|
17574
|
-
const getInstructionSteps = (0,
|
|
17600
|
+
const getInstructionSteps = (0, import_react47.useCallback)(() => {
|
|
17575
17601
|
const connectFlowType = getConnectFlowType({
|
|
17576
17602
|
isEmbarkAI: !!embarkAiAddress,
|
|
17577
17603
|
connectFlow: menuParams.current?.connectFlowType || "auth"
|
|
@@ -17679,7 +17705,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17679
17705
|
] })
|
|
17680
17706
|
] });
|
|
17681
17707
|
}
|
|
17682
|
-
var import_react_query25, import_lucide_react33,
|
|
17708
|
+
var import_react_query25, import_lucide_react33, import_react47, import_wagmi3, import_chains, import_jsx_runtime74, SIGN_FALLBACK_CHAIN_ID;
|
|
17683
17709
|
var init_ConnectExternalWalletMenu = __esm({
|
|
17684
17710
|
"src/internal/components/ConnectExternalWalletMenu/ConnectExternalWalletMenu.tsx"() {
|
|
17685
17711
|
init_ProviderContext();
|
|
@@ -17691,7 +17717,7 @@ var init_ConnectExternalWalletMenu = __esm({
|
|
|
17691
17717
|
init_linkedProfiles();
|
|
17692
17718
|
import_react_query25 = require("@tanstack/react-query");
|
|
17693
17719
|
import_lucide_react33 = require("lucide-react");
|
|
17694
|
-
|
|
17720
|
+
import_react47 = require("react");
|
|
17695
17721
|
import_wagmi3 = require("wagmi");
|
|
17696
17722
|
import_chains = require("wagmi/chains");
|
|
17697
17723
|
init_common();
|
|
@@ -17720,12 +17746,12 @@ function useExternalWalletConnnect(options) {
|
|
|
17720
17746
|
const connections = (0, import_wagmi4.useConnections)();
|
|
17721
17747
|
const { mutate: connect, mutateAsync: connectAsync, ...restUseConnect } = (0, import_wagmi4.useConnect)();
|
|
17722
17748
|
const { mutateAsync: disconnectAsync } = (0, import_wagmi4.useDisconnect)();
|
|
17723
|
-
const disconnectExternalWallet = (0,
|
|
17749
|
+
const disconnectExternalWallet = (0, import_react48.useCallback)(async () => {
|
|
17724
17750
|
await disconnectAsync();
|
|
17725
17751
|
const { externalAddress, clearExternalWallet } = useExternalWalletStore.getState();
|
|
17726
17752
|
if (!!externalAddress) clearExternalWallet();
|
|
17727
17753
|
}, [disconnectAsync]);
|
|
17728
|
-
const connectExternalWallet = (0,
|
|
17754
|
+
const connectExternalWallet = (0, import_react48.useCallback)(
|
|
17729
17755
|
async (walletConnectorType) => {
|
|
17730
17756
|
const connector = connectors.find((c) => c.id === walletConnectorType);
|
|
17731
17757
|
if (!connector) {
|
|
@@ -17779,12 +17805,12 @@ function useExternalWalletConnnect(options) {
|
|
|
17779
17805
|
...(0, import_lodash_es13.omit)(restUseConnect, ["mutate", "mutateAsync"])
|
|
17780
17806
|
};
|
|
17781
17807
|
}
|
|
17782
|
-
var import_lodash_es13,
|
|
17808
|
+
var import_lodash_es13, import_react48, import_wagmi4;
|
|
17783
17809
|
var init_useExternalWalletConnect = __esm({
|
|
17784
17810
|
"src/internal/components/ConnectExternalWalletMenu/useExternalWalletConnect.ts"() {
|
|
17785
17811
|
init_ProviderContext();
|
|
17786
17812
|
import_lodash_es13 = require("lodash-es");
|
|
17787
|
-
|
|
17813
|
+
import_react48 = require("react");
|
|
17788
17814
|
import_wagmi4 = require("wagmi");
|
|
17789
17815
|
init_useLayoutStore();
|
|
17790
17816
|
init_connect_errors();
|
|
@@ -17877,8 +17903,8 @@ function getErrorMessage(err) {
|
|
|
17877
17903
|
function DeviceLinkScreen() {
|
|
17878
17904
|
const setPage = useLayoutDataStore((s) => s.setPage);
|
|
17879
17905
|
const { mutate: link, isPending } = useLinkDevice();
|
|
17880
|
-
const [code, setCode] = (0,
|
|
17881
|
-
const [error, setError] = (0,
|
|
17906
|
+
const [code, setCode] = (0, import_react49.useState)("");
|
|
17907
|
+
const [error, setError] = (0, import_react49.useState)(null);
|
|
17882
17908
|
const isValid = code.length === 6 && VALID_CHARS.test(code);
|
|
17883
17909
|
function handleCodeChange(value) {
|
|
17884
17910
|
const upper = value.toUpperCase().slice(0, 6);
|
|
@@ -17920,11 +17946,11 @@ function DeviceLinkScreen() {
|
|
|
17920
17946
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Button, { variant: "default", size: "large", className: "w-full", disabled: !isValid || isPending, onClick: handleLink, children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_lucide_react34.Loader2, { className: "w-4 h-4 animate-spin" }) : "Link" })
|
|
17921
17947
|
] });
|
|
17922
17948
|
}
|
|
17923
|
-
var import_lucide_react34,
|
|
17949
|
+
var import_lucide_react34, import_react49, import_jsx_runtime75, VALID_CHARS;
|
|
17924
17950
|
var init_DeviceLinkScreen = __esm({
|
|
17925
17951
|
"src/internal/components/DevicesMenu/DeviceLinkScreen.tsx"() {
|
|
17926
17952
|
import_lucide_react34 = require("lucide-react");
|
|
17927
|
-
|
|
17953
|
+
import_react49 = require("react");
|
|
17928
17954
|
init_devices();
|
|
17929
17955
|
init_useLayoutDataStore();
|
|
17930
17956
|
init_Expandable2();
|
|
@@ -18463,19 +18489,19 @@ function DeviceManageScreen() {
|
|
|
18463
18489
|
const userId = session?.mpcUserId || "";
|
|
18464
18490
|
const deviceId = pageParams?.deviceId;
|
|
18465
18491
|
const deviceName = pageParams?.deviceName;
|
|
18466
|
-
const guardianRef = (0,
|
|
18467
|
-
const [screen, setScreen] = (0,
|
|
18468
|
-
const [actionState, setActionState] = (0,
|
|
18469
|
-
const [password, setPassword] = (0,
|
|
18470
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
18471
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
18472
|
-
const [waitingConfirm, setWaitingConfirm] = (0,
|
|
18473
|
-
(0,
|
|
18492
|
+
const guardianRef = (0, import_react50.useRef)(null);
|
|
18493
|
+
const [screen, setScreen] = (0, import_react50.useState)({ step: "connecting" });
|
|
18494
|
+
const [actionState, setActionState] = (0, import_react50.useState)(null);
|
|
18495
|
+
const [password, setPassword] = (0, import_react50.useState)("");
|
|
18496
|
+
const [statusMessage, setStatusMessage] = (0, import_react50.useState)(null);
|
|
18497
|
+
const [errorMessage, setErrorMessage] = (0, import_react50.useState)(null);
|
|
18498
|
+
const [waitingConfirm, setWaitingConfirm] = (0, import_react50.useState)(false);
|
|
18499
|
+
(0, import_react50.useEffect)(() => {
|
|
18474
18500
|
if (!statusMessage) return;
|
|
18475
18501
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
18476
18502
|
return () => clearTimeout(t);
|
|
18477
18503
|
}, [statusMessage]);
|
|
18478
|
-
(0,
|
|
18504
|
+
(0, import_react50.useEffect)(() => {
|
|
18479
18505
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
18480
18506
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
18481
18507
|
return;
|
|
@@ -18507,7 +18533,7 @@ function DeviceManageScreen() {
|
|
|
18507
18533
|
guardianRef.current?.close();
|
|
18508
18534
|
};
|
|
18509
18535
|
}, [deviceId]);
|
|
18510
|
-
const refreshList = (0,
|
|
18536
|
+
const refreshList = (0, import_react50.useCallback)(async () => {
|
|
18511
18537
|
const guardian = guardianRef.current;
|
|
18512
18538
|
if (!guardian || screen.step !== "connected") return;
|
|
18513
18539
|
try {
|
|
@@ -18516,7 +18542,7 @@ function DeviceManageScreen() {
|
|
|
18516
18542
|
} catch {
|
|
18517
18543
|
}
|
|
18518
18544
|
}, [screen]);
|
|
18519
|
-
const handleBackup = (0,
|
|
18545
|
+
const handleBackup = (0, import_react50.useCallback)(async () => {
|
|
18520
18546
|
const guardian = guardianRef.current;
|
|
18521
18547
|
const iframe6 = getIframeManager();
|
|
18522
18548
|
if (!guardian || !iframe6 || !userId) return;
|
|
@@ -18540,7 +18566,7 @@ function DeviceManageScreen() {
|
|
|
18540
18566
|
setActionState(null);
|
|
18541
18567
|
}
|
|
18542
18568
|
}, [password, userId, refreshList]);
|
|
18543
|
-
const handleOverwrite = (0,
|
|
18569
|
+
const handleOverwrite = (0, import_react50.useCallback)(async () => {
|
|
18544
18570
|
const guardian = guardianRef.current;
|
|
18545
18571
|
const iframe6 = getIframeManager();
|
|
18546
18572
|
if (!guardian || !iframe6 || !userId) return;
|
|
@@ -18560,7 +18586,7 @@ function DeviceManageScreen() {
|
|
|
18560
18586
|
setActionState(null);
|
|
18561
18587
|
}
|
|
18562
18588
|
}, [password, userId, refreshList]);
|
|
18563
|
-
const handleDelete = (0,
|
|
18589
|
+
const handleDelete = (0, import_react50.useCallback)(
|
|
18564
18590
|
async (keyshareId) => {
|
|
18565
18591
|
const guardian = guardianRef.current;
|
|
18566
18592
|
if (!guardian) return;
|
|
@@ -18747,12 +18773,12 @@ function DeviceManageScreen() {
|
|
|
18747
18773
|
] })
|
|
18748
18774
|
] });
|
|
18749
18775
|
}
|
|
18750
|
-
var import_lucide_react35,
|
|
18776
|
+
var import_lucide_react35, import_react50, import_jsx_runtime76;
|
|
18751
18777
|
var init_DeviceManageScreen = __esm({
|
|
18752
18778
|
"src/internal/components/DevicesMenu/DeviceManageScreen.tsx"() {
|
|
18753
18779
|
init_SessionContext();
|
|
18754
18780
|
import_lucide_react35 = require("lucide-react");
|
|
18755
|
-
|
|
18781
|
+
import_react50 = require("react");
|
|
18756
18782
|
init_guardian_backup();
|
|
18757
18783
|
init_useLayoutDataStore();
|
|
18758
18784
|
init_iframe_manager();
|
|
@@ -18771,11 +18797,11 @@ function DeviceRestoreScreen() {
|
|
|
18771
18797
|
const keyshareId = pageParams?.keyshareId;
|
|
18772
18798
|
const deviceId = pageParams?.deviceId;
|
|
18773
18799
|
const deviceName = pageParams?.deviceName;
|
|
18774
|
-
const [password, setPassword] = (0,
|
|
18775
|
-
const [isWorking, setIsWorking] = (0,
|
|
18776
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
18777
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
18778
|
-
const handleRestore = (0,
|
|
18800
|
+
const [password, setPassword] = (0, import_react51.useState)("");
|
|
18801
|
+
const [isWorking, setIsWorking] = (0, import_react51.useState)(false);
|
|
18802
|
+
const [statusMessage, setStatusMessage] = (0, import_react51.useState)(null);
|
|
18803
|
+
const [errorMessage, setErrorMessage] = (0, import_react51.useState)(null);
|
|
18804
|
+
const handleRestore = (0, import_react51.useCallback)(async () => {
|
|
18779
18805
|
if (!password || !keyshareId || !userId) return;
|
|
18780
18806
|
const iframe6 = getIframeManager();
|
|
18781
18807
|
if (!iframe6) {
|
|
@@ -18855,12 +18881,12 @@ function DeviceRestoreScreen() {
|
|
|
18855
18881
|
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "text-sm text-[var(--ui-kit-bg-error)] p-2 text-center", children: errorMessage })
|
|
18856
18882
|
] });
|
|
18857
18883
|
}
|
|
18858
|
-
var import_lucide_react36,
|
|
18884
|
+
var import_lucide_react36, import_react51, import_jsx_runtime77;
|
|
18859
18885
|
var init_DeviceRestoreScreen = __esm({
|
|
18860
18886
|
"src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx"() {
|
|
18861
18887
|
init_SessionContext();
|
|
18862
18888
|
import_lucide_react36 = require("lucide-react");
|
|
18863
|
-
|
|
18889
|
+
import_react51 = require("react");
|
|
18864
18890
|
init_guardian_backup();
|
|
18865
18891
|
init_useLayoutDataStore();
|
|
18866
18892
|
init_iframe_manager();
|
|
@@ -18880,8 +18906,8 @@ function truncateAddress(address) {
|
|
|
18880
18906
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
18881
18907
|
}
|
|
18882
18908
|
function DeviceRow({ device }) {
|
|
18883
|
-
const [confirmingUnlink, setConfirmingUnlink] = (0,
|
|
18884
|
-
const [unlinkError, setUnlinkError] = (0,
|
|
18909
|
+
const [confirmingUnlink, setConfirmingUnlink] = (0, import_react52.useState)(false);
|
|
18910
|
+
const [unlinkError, setUnlinkError] = (0, import_react52.useState)(null);
|
|
18885
18911
|
const { mutate: unlink, isPending } = useUnlinkDevice();
|
|
18886
18912
|
if (confirmingUnlink) {
|
|
18887
18913
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex flex-col gap-2 p-3 rounded-lg bg-[var(--ui-kit-bg)]", children: [
|
|
@@ -18982,11 +19008,11 @@ function DevicesMenu() {
|
|
|
18982
19008
|
] })
|
|
18983
19009
|
] });
|
|
18984
19010
|
}
|
|
18985
|
-
var import_lucide_react37,
|
|
19011
|
+
var import_lucide_react37, import_react52, import_jsx_runtime78;
|
|
18986
19012
|
var init_DevicesMenu = __esm({
|
|
18987
19013
|
"src/internal/components/DevicesMenu/DevicesMenu.tsx"() {
|
|
18988
19014
|
import_lucide_react37 = require("lucide-react");
|
|
18989
|
-
|
|
19015
|
+
import_react52 = require("react");
|
|
18990
19016
|
init_devices();
|
|
18991
19017
|
init_guardian_backup();
|
|
18992
19018
|
init_useLayoutDataStore();
|
|
@@ -19046,7 +19072,7 @@ function useOnRestoreSuccess() {
|
|
|
19046
19072
|
setStatus
|
|
19047
19073
|
} = useSession();
|
|
19048
19074
|
const { setError, setSuccess } = useRestoreStore();
|
|
19049
|
-
const createSessionWithKeyshare = (0,
|
|
19075
|
+
const createSessionWithKeyshare = (0, import_react53.useCallback)(
|
|
19050
19076
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
19051
19077
|
try {
|
|
19052
19078
|
try {
|
|
@@ -19087,7 +19113,7 @@ function useOnRestoreSuccess() {
|
|
|
19087
19113
|
},
|
|
19088
19114
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
19089
19115
|
);
|
|
19090
|
-
const onRestoreSuccess = (0,
|
|
19116
|
+
const onRestoreSuccess = (0, import_react53.useCallback)(async () => {
|
|
19091
19117
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
19092
19118
|
const verify = await verifyToken2();
|
|
19093
19119
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -19153,12 +19179,12 @@ function useOnRestoreSuccess() {
|
|
|
19153
19179
|
]);
|
|
19154
19180
|
return { onRestoreSuccess };
|
|
19155
19181
|
}
|
|
19156
|
-
var
|
|
19182
|
+
var import_react53;
|
|
19157
19183
|
var init_useOnRestoreSuccess = __esm({
|
|
19158
19184
|
"src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts"() {
|
|
19159
19185
|
init_ProviderContext();
|
|
19160
19186
|
init_SessionContext();
|
|
19161
|
-
|
|
19187
|
+
import_react53 = require("react");
|
|
19162
19188
|
init_useLayoutDataStore();
|
|
19163
19189
|
init_useLayoutStore();
|
|
19164
19190
|
init_useRestoreStore();
|
|
@@ -19421,7 +19447,7 @@ function useCreateBackup() {
|
|
|
19421
19447
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
19422
19448
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
19423
19449
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
19424
|
-
(0,
|
|
19450
|
+
(0, import_react54.useEffect)(() => {
|
|
19425
19451
|
if (!hasServerVault) {
|
|
19426
19452
|
useRestoreStore.getState().setMethod("server");
|
|
19427
19453
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -19429,7 +19455,7 @@ function useCreateBackup() {
|
|
|
19429
19455
|
}, [hasServerVault]);
|
|
19430
19456
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
19431
19457
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
19432
|
-
const onBackupSuccess = (0,
|
|
19458
|
+
const onBackupSuccess = (0, import_react54.useCallback)((method) => {
|
|
19433
19459
|
console.log(`[EMBARKAI BACKUP] ${method} backup created successfully`);
|
|
19434
19460
|
if (method !== "server") return;
|
|
19435
19461
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
@@ -19602,12 +19628,12 @@ function useCreateBackup() {
|
|
|
19602
19628
|
createPasskey
|
|
19603
19629
|
};
|
|
19604
19630
|
}
|
|
19605
|
-
var import_react_query27,
|
|
19631
|
+
var import_react_query27, import_react54;
|
|
19606
19632
|
var init_useCreateBackup = __esm({
|
|
19607
19633
|
"src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts"() {
|
|
19608
19634
|
init_SessionContext();
|
|
19609
19635
|
import_react_query27 = require("@tanstack/react-query");
|
|
19610
|
-
|
|
19636
|
+
import_react54 = require("react");
|
|
19611
19637
|
init_auth();
|
|
19612
19638
|
init_useLayoutDataStore();
|
|
19613
19639
|
init_useLayoutStore();
|
|
@@ -19744,7 +19770,7 @@ function useValidateFileBackup() {
|
|
|
19744
19770
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
19745
19771
|
const setError = useRestoreStore((st) => st.setError);
|
|
19746
19772
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
19747
|
-
(0,
|
|
19773
|
+
(0, import_react55.useEffect)(() => {
|
|
19748
19774
|
if (!restoreFile) {
|
|
19749
19775
|
return;
|
|
19750
19776
|
}
|
|
@@ -19765,10 +19791,10 @@ function useValidateFileBackup() {
|
|
|
19765
19791
|
reader.readAsText(restoreFile);
|
|
19766
19792
|
}, [restoreFile]);
|
|
19767
19793
|
}
|
|
19768
|
-
var
|
|
19794
|
+
var import_react55;
|
|
19769
19795
|
var init_useValidateFileBackup = __esm({
|
|
19770
19796
|
"src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts"() {
|
|
19771
|
-
|
|
19797
|
+
import_react55 = require("react");
|
|
19772
19798
|
init_useRestoreStore();
|
|
19773
19799
|
}
|
|
19774
19800
|
});
|
|
@@ -19796,7 +19822,7 @@ function MethodSelector(props) {
|
|
|
19796
19822
|
setError,
|
|
19797
19823
|
setSuccess
|
|
19798
19824
|
} = useRestoreStore();
|
|
19799
|
-
const recoveryRenderMethods = (0,
|
|
19825
|
+
const recoveryRenderMethods = (0, import_react56.useMemo)(() => {
|
|
19800
19826
|
const methodsWithBackupData = getRecoveryRenderMethods(mode).map((mt) => {
|
|
19801
19827
|
let data = null;
|
|
19802
19828
|
switch (true) {
|
|
@@ -19811,7 +19837,7 @@ function MethodSelector(props) {
|
|
|
19811
19837
|
return methodsWithBackupData;
|
|
19812
19838
|
}, [mode, serverRecoveryStatus]);
|
|
19813
19839
|
if (!!selectedRecoveryMethod) return null;
|
|
19814
|
-
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
19840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react56.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
19815
19841
|
"div",
|
|
19816
19842
|
{
|
|
19817
19843
|
style: { gridTemplateColumns: `repeat(${recoveryRenderMethods.length}, minmax(0, 1fr))` },
|
|
@@ -19845,12 +19871,12 @@ function MethodSelector(props) {
|
|
|
19845
19871
|
}
|
|
19846
19872
|
) });
|
|
19847
19873
|
}
|
|
19848
|
-
var import_lucide_react38,
|
|
19874
|
+
var import_lucide_react38, import_react56, import_jsx_runtime79, getRecoveryRenderMethods;
|
|
19849
19875
|
var init_MethodSelector = __esm({
|
|
19850
19876
|
"src/internal/components/KeyshareRestoreMenu/components/MethodSelector.tsx"() {
|
|
19851
19877
|
init_useT();
|
|
19852
19878
|
import_lucide_react38 = require("lucide-react");
|
|
19853
|
-
|
|
19879
|
+
import_react56 = require("react");
|
|
19854
19880
|
init_icons();
|
|
19855
19881
|
init_guardian_backup();
|
|
19856
19882
|
init_button();
|
|
@@ -19986,7 +20012,7 @@ function PasswordPasskey(props) {
|
|
|
19986
20012
|
onCreatePasskey
|
|
19987
20013
|
} = props;
|
|
19988
20014
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
19989
|
-
const actionRef = (0,
|
|
20015
|
+
const actionRef = (0, import_react57.useRef)(null);
|
|
19990
20016
|
const {
|
|
19991
20017
|
showPassword,
|
|
19992
20018
|
restorePassword,
|
|
@@ -20000,7 +20026,7 @@ function PasswordPasskey(props) {
|
|
|
20000
20026
|
} = useRestoreStore();
|
|
20001
20027
|
const { config } = useProviderConfig();
|
|
20002
20028
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
20003
|
-
(0,
|
|
20029
|
+
(0, import_react57.useEffect)(() => {
|
|
20004
20030
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
20005
20031
|
}, [isPasskeyEnabled, usePasskey]);
|
|
20006
20032
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
@@ -20164,7 +20190,7 @@ function PasswordPasskey(props) {
|
|
|
20164
20190
|
] })
|
|
20165
20191
|
] });
|
|
20166
20192
|
}
|
|
20167
|
-
var import_lucide_react39,
|
|
20193
|
+
var import_lucide_react39, import_react57, import_jsx_runtime80;
|
|
20168
20194
|
var init_PasswordPasskey = __esm({
|
|
20169
20195
|
"src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx"() {
|
|
20170
20196
|
init_ProviderContext();
|
|
@@ -20172,7 +20198,7 @@ var init_PasswordPasskey = __esm({
|
|
|
20172
20198
|
init_i18n();
|
|
20173
20199
|
init_utils();
|
|
20174
20200
|
import_lucide_react39 = require("lucide-react");
|
|
20175
|
-
|
|
20201
|
+
import_react57 = require("react");
|
|
20176
20202
|
init_icons();
|
|
20177
20203
|
init_Onboarding();
|
|
20178
20204
|
init_button();
|
|
@@ -20349,7 +20375,7 @@ function Server(props) {
|
|
|
20349
20375
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
20350
20376
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
20351
20377
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
20352
|
-
(0,
|
|
20378
|
+
(0, import_react58.useEffect)(() => {
|
|
20353
20379
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
20354
20380
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
20355
20381
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -20392,7 +20418,7 @@ function Server(props) {
|
|
|
20392
20418
|
)
|
|
20393
20419
|
] });
|
|
20394
20420
|
}
|
|
20395
|
-
var import_react_query29, import_dayjs4, import_lucide_react42,
|
|
20421
|
+
var import_react_query29, import_dayjs4, import_lucide_react42, import_react58, import_jsx_runtime83;
|
|
20396
20422
|
var init_Server = __esm({
|
|
20397
20423
|
"src/internal/components/KeyshareRestoreMenu/methods/Server.tsx"() {
|
|
20398
20424
|
init_SessionContext();
|
|
@@ -20401,7 +20427,7 @@ var init_Server = __esm({
|
|
|
20401
20427
|
import_react_query29 = require("@tanstack/react-query");
|
|
20402
20428
|
import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
20403
20429
|
import_lucide_react42 = require("lucide-react");
|
|
20404
|
-
|
|
20430
|
+
import_react58 = require("react");
|
|
20405
20431
|
init_Onboarding();
|
|
20406
20432
|
init_highlight();
|
|
20407
20433
|
init_PasswordPasskey();
|
|
@@ -20565,7 +20591,7 @@ function Cloud2(props) {
|
|
|
20565
20591
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
20566
20592
|
}
|
|
20567
20593
|
});
|
|
20568
|
-
(0,
|
|
20594
|
+
(0, import_react59.useEffect)(() => {
|
|
20569
20595
|
if (isCloudProvidersLoading) return;
|
|
20570
20596
|
if (!!cloudProvidersError) {
|
|
20571
20597
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -20629,13 +20655,13 @@ function Cloud2(props) {
|
|
|
20629
20655
|
)
|
|
20630
20656
|
] });
|
|
20631
20657
|
}
|
|
20632
|
-
var import_react_query30, import_lucide_react44,
|
|
20658
|
+
var import_react_query30, import_lucide_react44, import_react59, import_jsx_runtime85;
|
|
20633
20659
|
var init_Cloud = __esm({
|
|
20634
20660
|
"src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx"() {
|
|
20635
20661
|
init_SessionContext();
|
|
20636
20662
|
import_react_query30 = require("@tanstack/react-query");
|
|
20637
20663
|
import_lucide_react44 = require("lucide-react");
|
|
20638
|
-
|
|
20664
|
+
import_react59 = require("react");
|
|
20639
20665
|
init_button();
|
|
20640
20666
|
init_select();
|
|
20641
20667
|
init_PasswordPasskey();
|
|
@@ -20652,8 +20678,8 @@ function Guardian(props) {
|
|
|
20652
20678
|
const session = useSession((st) => st.session);
|
|
20653
20679
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
20654
20680
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
20655
|
-
const [isWorking, setIsWorking] = (0,
|
|
20656
|
-
const [step, setStep] = (0,
|
|
20681
|
+
const [isWorking, setIsWorking] = (0, import_react60.useState)(false);
|
|
20682
|
+
const [step, setStep] = (0, import_react60.useState)("idle");
|
|
20657
20683
|
const handleGuardianBackup = async () => {
|
|
20658
20684
|
if (!restorePassword) {
|
|
20659
20685
|
setError("Please enter a password");
|
|
@@ -20782,11 +20808,11 @@ function Guardian(props) {
|
|
|
20782
20808
|
] })
|
|
20783
20809
|
] });
|
|
20784
20810
|
}
|
|
20785
|
-
var
|
|
20811
|
+
var import_react60, import_lucide_react45, import_jsx_runtime86;
|
|
20786
20812
|
var init_Guardian = __esm({
|
|
20787
20813
|
"src/internal/components/KeyshareRestoreMenu/methods/Guardian.tsx"() {
|
|
20788
20814
|
init_SessionContext();
|
|
20789
|
-
|
|
20815
|
+
import_react60 = require("react");
|
|
20790
20816
|
import_lucide_react45 = require("lucide-react");
|
|
20791
20817
|
init_iframe_manager();
|
|
20792
20818
|
init_guardian_backup();
|
|
@@ -20809,7 +20835,7 @@ var init_methods = __esm({
|
|
|
20809
20835
|
});
|
|
20810
20836
|
|
|
20811
20837
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
20812
|
-
var import_react_query31, import_lucide_react46,
|
|
20838
|
+
var import_react_query31, import_lucide_react46, import_react61, import_wagmi5, import_jsx_runtime87, RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
20813
20839
|
var init_KeyshareRestoreMenu = __esm({
|
|
20814
20840
|
"src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
|
|
20815
20841
|
init_ProviderContext();
|
|
@@ -20817,7 +20843,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20817
20843
|
init_i18n();
|
|
20818
20844
|
import_react_query31 = require("@tanstack/react-query");
|
|
20819
20845
|
import_lucide_react46 = require("lucide-react");
|
|
20820
|
-
|
|
20846
|
+
import_react61 = require("react");
|
|
20821
20847
|
import_wagmi5 = require("wagmi");
|
|
20822
20848
|
init_useLayoutDataStore();
|
|
20823
20849
|
init_useLayoutStore();
|
|
@@ -20847,7 +20873,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20847
20873
|
const error = useRestoreStore((st) => st.error);
|
|
20848
20874
|
const success = useRestoreStore((st) => st.success);
|
|
20849
20875
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
20850
|
-
(0,
|
|
20876
|
+
(0, import_react61.useEffect)(() => {
|
|
20851
20877
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
20852
20878
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
20853
20879
|
setIsDialogForced(true);
|
|
@@ -20886,7 +20912,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20886
20912
|
queryFn: async () => await getShareRecoveryStats()
|
|
20887
20913
|
});
|
|
20888
20914
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
20889
|
-
(0,
|
|
20915
|
+
(0, import_react61.useEffect)(() => {
|
|
20890
20916
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
20891
20917
|
}, [hasServerBackup]);
|
|
20892
20918
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query31.useMutation)({
|
|
@@ -21033,7 +21059,7 @@ function KeyshareBackupMenu() {
|
|
|
21033
21059
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
21034
21060
|
const error = useRestoreStore((st) => st.error);
|
|
21035
21061
|
const success = useRestoreStore((st) => st.success);
|
|
21036
|
-
(0,
|
|
21062
|
+
(0, import_react62.useEffect)(() => {
|
|
21037
21063
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
21038
21064
|
return () => {
|
|
21039
21065
|
setSuccess(null);
|
|
@@ -21053,7 +21079,7 @@ function KeyshareBackupMenu() {
|
|
|
21053
21079
|
});
|
|
21054
21080
|
useOnboardingTourAvailable(!isRecoveryLoading && currentBackupMethod === "server" && !usePasskey);
|
|
21055
21081
|
const hasRecoveryData2 = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
21056
|
-
(0,
|
|
21082
|
+
(0, import_react62.useEffect)(() => {
|
|
21057
21083
|
if (!!hasRecoveryData2) useRestoreStore.getState().setMethod("server");
|
|
21058
21084
|
}, [hasRecoveryData2]);
|
|
21059
21085
|
const {
|
|
@@ -21172,14 +21198,14 @@ function KeyshareBackupMenu() {
|
|
|
21172
21198
|
] })
|
|
21173
21199
|
] });
|
|
21174
21200
|
}
|
|
21175
|
-
var import_react_query32, import_lucide_react47,
|
|
21201
|
+
var import_react_query32, import_lucide_react47, import_react62, import_jsx_runtime88, COMPONENTS;
|
|
21176
21202
|
var init_KeyshareBackupMenu = __esm({
|
|
21177
21203
|
"src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx"() {
|
|
21178
21204
|
init_SessionContext();
|
|
21179
21205
|
init_i18n();
|
|
21180
21206
|
import_react_query32 = require("@tanstack/react-query");
|
|
21181
21207
|
import_lucide_react47 = require("lucide-react");
|
|
21182
|
-
|
|
21208
|
+
import_react62 = require("react");
|
|
21183
21209
|
init_useLayoutDataStore();
|
|
21184
21210
|
init_vaultClient();
|
|
21185
21211
|
init_Expandable2();
|
|
@@ -21307,13 +21333,13 @@ var init_SumsubIframeManager = __esm({
|
|
|
21307
21333
|
function useSumsubIframe({ iframeUrl }) {
|
|
21308
21334
|
const config = useProviderConfig().config;
|
|
21309
21335
|
const { colorMode } = useColorMode();
|
|
21310
|
-
const iframeRef = (0,
|
|
21311
|
-
const [isLoading, setIsLoading] = (0,
|
|
21312
|
-
const [error, setError] = (0,
|
|
21313
|
-
const [height, setHeight] = (0,
|
|
21314
|
-
const [status, setStatus] = (0,
|
|
21336
|
+
const iframeRef = (0, import_react63.useRef)(null);
|
|
21337
|
+
const [isLoading, setIsLoading] = (0, import_react63.useState)(true);
|
|
21338
|
+
const [error, setError] = (0, import_react63.useState)(null);
|
|
21339
|
+
const [height, setHeight] = (0, import_react63.useState)(0);
|
|
21340
|
+
const [status, setStatus] = (0, import_react63.useState)("");
|
|
21315
21341
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
21316
|
-
(0,
|
|
21342
|
+
(0, import_react63.useEffect)(() => {
|
|
21317
21343
|
setError(null);
|
|
21318
21344
|
setIsLoading(true);
|
|
21319
21345
|
setStatus("Preparing verification...");
|
|
@@ -21354,12 +21380,12 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
21354
21380
|
status
|
|
21355
21381
|
};
|
|
21356
21382
|
}
|
|
21357
|
-
var
|
|
21383
|
+
var import_react63;
|
|
21358
21384
|
var init_useSumsubIframe = __esm({
|
|
21359
21385
|
"src/internal/components/KYC/useSumsubIframe.ts"() {
|
|
21360
21386
|
init_ProviderContext();
|
|
21361
21387
|
init_useColorMode();
|
|
21362
|
-
|
|
21388
|
+
import_react63 = require("react");
|
|
21363
21389
|
init_sumsub();
|
|
21364
21390
|
init_SumsubIframeManager();
|
|
21365
21391
|
}
|
|
@@ -21567,11 +21593,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
21567
21593
|
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
21568
21594
|
const resolvedChainId = chainId ?? activeChainId;
|
|
21569
21595
|
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
21570
|
-
const chainConfig = (0,
|
|
21596
|
+
const chainConfig = (0, import_react64.useMemo)(() => {
|
|
21571
21597
|
if (shouldUseActiveClient) return activeChainConfig;
|
|
21572
21598
|
return (0, import_read16.getChainConfig)(chainId);
|
|
21573
21599
|
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
21574
|
-
const publicClient = (0,
|
|
21600
|
+
const publicClient = (0, import_react64.useMemo)(() => {
|
|
21575
21601
|
if (shouldUseActiveClient) return activePublicClient;
|
|
21576
21602
|
if (!chainId) return activePublicClient;
|
|
21577
21603
|
try {
|
|
@@ -21588,12 +21614,12 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
21588
21614
|
resolvedChainId
|
|
21589
21615
|
};
|
|
21590
21616
|
}
|
|
21591
|
-
var import_read16,
|
|
21617
|
+
var import_read16, import_react64, publicClientByChainId;
|
|
21592
21618
|
var init_useResolvedPublicClient = __esm({
|
|
21593
21619
|
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
21594
21620
|
init_SessionContext();
|
|
21595
21621
|
import_read16 = require("@embarkai/core/read");
|
|
21596
|
-
|
|
21622
|
+
import_react64 = require("react");
|
|
21597
21623
|
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
21598
21624
|
}
|
|
21599
21625
|
});
|
|
@@ -21657,7 +21683,7 @@ var init_useNativeBalance = __esm({
|
|
|
21657
21683
|
function useWatchTokens(options) {
|
|
21658
21684
|
const { address, chainId, enabled, publicClient } = options;
|
|
21659
21685
|
const { config } = useProviderConfig();
|
|
21660
|
-
const watchTokens = (0,
|
|
21686
|
+
const watchTokens = (0, import_react65.useMemo)(() => {
|
|
21661
21687
|
const allWatchTokens = config.current.watchTokens;
|
|
21662
21688
|
const tokensForChain = chainId ? allWatchTokens?.[chainId] || [] : [];
|
|
21663
21689
|
return tokensForChain;
|
|
@@ -21725,12 +21751,12 @@ function useWatchTokens(options) {
|
|
|
21725
21751
|
}
|
|
21726
21752
|
});
|
|
21727
21753
|
}
|
|
21728
|
-
var import_react_query35,
|
|
21754
|
+
var import_react_query35, import_react65, import_viem8;
|
|
21729
21755
|
var init_useWatchTokens = __esm({
|
|
21730
21756
|
"src/internal/hooks/useBlockscoutAssets/useWatchTokens.ts"() {
|
|
21731
21757
|
init_ProviderContext();
|
|
21732
21758
|
import_react_query35 = require("@tanstack/react-query");
|
|
21733
|
-
|
|
21759
|
+
import_react65 = require("react");
|
|
21734
21760
|
import_viem8 = require("viem");
|
|
21735
21761
|
init_constants6();
|
|
21736
21762
|
}
|
|
@@ -21879,11 +21905,11 @@ function useBlockscoutAssets(options) {
|
|
|
21879
21905
|
tokenBalancesQueryKey: customTokenBalancesQueryKey
|
|
21880
21906
|
} = useProviderConfig().config?.current?.portfolio || {};
|
|
21881
21907
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
21882
|
-
const blockscoutClient = (0,
|
|
21908
|
+
const blockscoutClient = (0, import_react66.useMemo)(
|
|
21883
21909
|
() => blockscoutApiUrl ? (0, import_core4.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
21884
21910
|
[blockscoutApiUrl]
|
|
21885
21911
|
);
|
|
21886
|
-
const lastRefreshRef = (0,
|
|
21912
|
+
const lastRefreshRef = (0, import_react66.useRef)(0);
|
|
21887
21913
|
const {
|
|
21888
21914
|
data: watchTokenAssets = [],
|
|
21889
21915
|
isLoading: watchTokensLoading,
|
|
@@ -21955,7 +21981,7 @@ function useBlockscoutAssets(options) {
|
|
|
21955
21981
|
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, blockscoutApiUrl, address],
|
|
21956
21982
|
queryFn: () => blockscoutClient.getNfts(address)
|
|
21957
21983
|
});
|
|
21958
|
-
const erc20TokenAddresses = (0,
|
|
21984
|
+
const erc20TokenAddresses = (0, import_react66.useMemo)(() => {
|
|
21959
21985
|
if (!blockscoutItems) return [];
|
|
21960
21986
|
return blockscoutItems.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
21961
21987
|
}, [blockscoutItems]);
|
|
@@ -22000,7 +22026,7 @@ function useBlockscoutAssets(options) {
|
|
|
22000
22026
|
// 1 minute
|
|
22001
22027
|
// gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
22002
22028
|
});
|
|
22003
|
-
const assets = (0,
|
|
22029
|
+
const assets = (0, import_react66.useMemo)(() => {
|
|
22004
22030
|
const result = [];
|
|
22005
22031
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
22006
22032
|
if (nativeBalanceData) {
|
|
@@ -22094,7 +22120,7 @@ function useBlockscoutAssets(options) {
|
|
|
22094
22120
|
watchTokenAssets,
|
|
22095
22121
|
chainConfig
|
|
22096
22122
|
]);
|
|
22097
|
-
const nativeBalance = (0,
|
|
22123
|
+
const nativeBalance = (0, import_react66.useMemo)(() => {
|
|
22098
22124
|
if (!nativeBalanceData) return null;
|
|
22099
22125
|
return {
|
|
22100
22126
|
value: nativeBalanceData.value,
|
|
@@ -22102,11 +22128,11 @@ function useBlockscoutAssets(options) {
|
|
|
22102
22128
|
symbol: nativeBalanceData.symbol
|
|
22103
22129
|
};
|
|
22104
22130
|
}, [nativeBalanceData]);
|
|
22105
|
-
const error = (0,
|
|
22131
|
+
const error = (0, import_react66.useMemo)(() => {
|
|
22106
22132
|
if (!blockscoutError) return null;
|
|
22107
22133
|
return createError(blockscoutError);
|
|
22108
22134
|
}, [blockscoutError]);
|
|
22109
|
-
const refreshBalances = (0,
|
|
22135
|
+
const refreshBalances = (0, import_react66.useCallback)(async () => {
|
|
22110
22136
|
const now = Date.now();
|
|
22111
22137
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
22112
22138
|
return;
|
|
@@ -22122,7 +22148,7 @@ function useBlockscoutAssets(options) {
|
|
|
22122
22148
|
qc.invalidateQueries({ queryKey: [WATCH_TOKENS_QUERY_KEY] })
|
|
22123
22149
|
]);
|
|
22124
22150
|
}, [qc, customTokenBalancesQueryKey]);
|
|
22125
|
-
const getTokenBalance = (0,
|
|
22151
|
+
const getTokenBalance = (0, import_react66.useCallback)(
|
|
22126
22152
|
(tokenAddress) => {
|
|
22127
22153
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
22128
22154
|
},
|
|
@@ -22141,13 +22167,13 @@ function useBlockscoutAssets(options) {
|
|
|
22141
22167
|
lastUpdated: dataUpdatedAt || null
|
|
22142
22168
|
};
|
|
22143
22169
|
}
|
|
22144
|
-
var import_core4, import_react_query36,
|
|
22170
|
+
var import_core4, import_react_query36, import_react66;
|
|
22145
22171
|
var init_useBlockscoutAssets = __esm({
|
|
22146
22172
|
"src/internal/hooks/useBlockscoutAssets/useBlockscoutAssets.ts"() {
|
|
22147
22173
|
init_ProviderContext();
|
|
22148
22174
|
import_core4 = require("@embarkai/core");
|
|
22149
22175
|
import_react_query36 = require("@tanstack/react-query");
|
|
22150
|
-
|
|
22176
|
+
import_react66 = require("react");
|
|
22151
22177
|
init_initial();
|
|
22152
22178
|
init_constants();
|
|
22153
22179
|
init_useResolvedPublicClient();
|
|
@@ -22267,9 +22293,9 @@ function SecurityTokenBadge() {
|
|
|
22267
22293
|
}
|
|
22268
22294
|
function PortfolioItemImage(props) {
|
|
22269
22295
|
const { asset } = props;
|
|
22270
|
-
const [logoError, setLogoError] = (0,
|
|
22271
|
-
const [nftImageError, setNftImageError] = (0,
|
|
22272
|
-
const resolvedImage = (0,
|
|
22296
|
+
const [logoError, setLogoError] = (0, import_react67.useState)(false);
|
|
22297
|
+
const [nftImageError, setNftImageError] = (0, import_react67.useState)(false);
|
|
22298
|
+
const resolvedImage = (0, import_react67.useMemo)(() => {
|
|
22273
22299
|
const isNft = isNftAsset(asset);
|
|
22274
22300
|
const nftImage = getNftImage(asset);
|
|
22275
22301
|
const isSecurity = isSecurityToken(asset);
|
|
@@ -22424,13 +22450,13 @@ function PortfolioItem(props) {
|
|
|
22424
22450
|
}
|
|
22425
22451
|
);
|
|
22426
22452
|
}
|
|
22427
|
-
var import_react_query37, import_lucide_react51,
|
|
22453
|
+
var import_react_query37, import_lucide_react51, import_react67, import_viem11, import_jsx_runtime94, PORTFOLIO_ASSET_RATE_QUERY_KEY;
|
|
22428
22454
|
var init_PortfolioItem = __esm({
|
|
22429
22455
|
"src/internal/components/PortfolioMenu/PortfolioItem.tsx"() {
|
|
22430
22456
|
init_ProviderContext();
|
|
22431
22457
|
import_react_query37 = require("@tanstack/react-query");
|
|
22432
22458
|
import_lucide_react51 = require("lucide-react");
|
|
22433
|
-
|
|
22459
|
+
import_react67 = require("react");
|
|
22434
22460
|
import_viem11 = require("viem");
|
|
22435
22461
|
init_tokens();
|
|
22436
22462
|
init_base3();
|
|
@@ -22462,7 +22488,7 @@ function PortfolioMenu() {
|
|
|
22462
22488
|
enabled: !!address
|
|
22463
22489
|
});
|
|
22464
22490
|
const shownProjectAssets = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
22465
|
-
const refreshAllAssetsBalances = (0,
|
|
22491
|
+
const refreshAllAssetsBalances = (0, import_react68.useCallback)(() => {
|
|
22466
22492
|
Promise.all(shownProjectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
22467
22493
|
refreshBlockscoutBalances();
|
|
22468
22494
|
}, [qc, shownProjectAssets, refreshBlockscoutBalances]);
|
|
@@ -22508,7 +22534,7 @@ function PortfolioMenu() {
|
|
|
22508
22534
|
blockscoutError && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Highlight, { type: "error", children: blockscoutError?.message })
|
|
22509
22535
|
] });
|
|
22510
22536
|
}
|
|
22511
|
-
var import_react_query38, import_lucide_react52,
|
|
22537
|
+
var import_react_query38, import_lucide_react52, import_react68, import_jsx_runtime95;
|
|
22512
22538
|
var init_PortfolioMenu = __esm({
|
|
22513
22539
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
22514
22540
|
init_ProviderContext();
|
|
@@ -22516,7 +22542,7 @@ var init_PortfolioMenu = __esm({
|
|
|
22516
22542
|
init_i18n();
|
|
22517
22543
|
import_react_query38 = require("@tanstack/react-query");
|
|
22518
22544
|
import_lucide_react52 = require("lucide-react");
|
|
22519
|
-
|
|
22545
|
+
import_react68 = require("react");
|
|
22520
22546
|
init_useBlockscoutAssets2();
|
|
22521
22547
|
init_useLayoutDataStore();
|
|
22522
22548
|
init_Expandable2();
|
|
@@ -22827,7 +22853,7 @@ var init_useNicknameStore = __esm({
|
|
|
22827
22853
|
function useNicknameAvailability(currentNickname) {
|
|
22828
22854
|
const { t } = useT();
|
|
22829
22855
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
22830
|
-
(0,
|
|
22856
|
+
(0, import_react69.useEffect)(() => {
|
|
22831
22857
|
if (!currentNickname) return;
|
|
22832
22858
|
useNicknameStore.getState().setNicknameValue(currentNickname);
|
|
22833
22859
|
}, [currentNickname]);
|
|
@@ -22848,8 +22874,8 @@ function useNicknameAvailability(currentNickname) {
|
|
|
22848
22874
|
useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
|
|
22849
22875
|
}
|
|
22850
22876
|
});
|
|
22851
|
-
const debouncedCheckAvailability = (0,
|
|
22852
|
-
(0,
|
|
22877
|
+
const debouncedCheckAvailability = (0, import_react69.useCallback)((0, import_lodash_es14.debounce)(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
|
|
22878
|
+
(0, import_react69.useEffect)(() => {
|
|
22853
22879
|
if (!currentNickname) return;
|
|
22854
22880
|
const normalizedInputValue = normalizeNickname(nicknameValue);
|
|
22855
22881
|
const { valid: isNicknameValid } = validateNickname(nicknameValue);
|
|
@@ -22863,13 +22889,13 @@ function useNicknameAvailability(currentNickname) {
|
|
|
22863
22889
|
}, [nicknameValue, currentNickname, debouncedCheckAvailability]);
|
|
22864
22890
|
return { isCheckingAvailability };
|
|
22865
22891
|
}
|
|
22866
|
-
var import_react_query39, import_lodash_es14,
|
|
22892
|
+
var import_react_query39, import_lodash_es14, import_react69, DEBOUNCE_MS;
|
|
22867
22893
|
var init_useNicknameAvailability = __esm({
|
|
22868
22894
|
"src/internal/components/NicknameMenu/useNicknameAvailability.ts"() {
|
|
22869
22895
|
init_i18n();
|
|
22870
22896
|
import_react_query39 = require("@tanstack/react-query");
|
|
22871
22897
|
import_lodash_es14 = require("lodash-es");
|
|
22872
|
-
|
|
22898
|
+
import_react69 = require("react");
|
|
22873
22899
|
init_nickname();
|
|
22874
22900
|
init_nickname_errors();
|
|
22875
22901
|
init_nickname_validation();
|
|
@@ -22890,9 +22916,9 @@ function NicknameEditForm(props) {
|
|
|
22890
22916
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
22891
22917
|
const nicknameAvailability = useNicknameStore((st) => st.availability);
|
|
22892
22918
|
const { isCheckingAvailability } = useNicknameAvailability(nicknameInfo ? nicknameInfo.handle : "");
|
|
22893
|
-
const [isNicknameCopied, setIsNicknameCopied] = (0,
|
|
22894
|
-
const exitTimerRef = (0,
|
|
22895
|
-
(0,
|
|
22919
|
+
const [isNicknameCopied, setIsNicknameCopied] = (0, import_react70.useState)(false);
|
|
22920
|
+
const exitTimerRef = (0, import_react70.useRef)(null);
|
|
22921
|
+
(0, import_react70.useEffect)(() => () => {
|
|
22896
22922
|
if (exitTimerRef.current) clearTimeout(exitTimerRef.current);
|
|
22897
22923
|
}, []);
|
|
22898
22924
|
const { mutate: changeNickname2, isPending: isNicknameChanging } = (0, import_react_query40.useMutation)({
|
|
@@ -22926,7 +22952,7 @@ function NicknameEditForm(props) {
|
|
|
22926
22952
|
);
|
|
22927
22953
|
}
|
|
22928
22954
|
});
|
|
22929
|
-
const handleNicknameInputChange = (0,
|
|
22955
|
+
const handleNicknameInputChange = (0, import_react70.useCallback)(
|
|
22930
22956
|
(e) => {
|
|
22931
22957
|
const { error, setError, setNicknameValue } = useNicknameStore.getState();
|
|
22932
22958
|
const nextInputValue = e.target.value;
|
|
@@ -22940,7 +22966,7 @@ function NicknameEditForm(props) {
|
|
|
22940
22966
|
},
|
|
22941
22967
|
[t]
|
|
22942
22968
|
);
|
|
22943
|
-
const handleSubmit = (0,
|
|
22969
|
+
const handleSubmit = (0, import_react70.useCallback)(
|
|
22944
22970
|
(e) => {
|
|
22945
22971
|
const { nicknameValue: nicknameValue2, setError } = useNicknameStore.getState();
|
|
22946
22972
|
if (!canChange) {
|
|
@@ -23032,7 +23058,7 @@ function NicknameEditForm(props) {
|
|
|
23032
23058
|
!!canChange && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "w-full flex items-center leadding-4 text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:nicknameMenu.hint") })
|
|
23033
23059
|
] });
|
|
23034
23060
|
}
|
|
23035
|
-
var import_react_query40, import_lucide_react55,
|
|
23061
|
+
var import_react_query40, import_lucide_react55, import_react70, import_jsx_runtime98;
|
|
23036
23062
|
var init_NicknameEditForm = __esm({
|
|
23037
23063
|
"src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
|
|
23038
23064
|
init_ProviderContext();
|
|
@@ -23040,7 +23066,7 @@ var init_NicknameEditForm = __esm({
|
|
|
23040
23066
|
init_i18n();
|
|
23041
23067
|
import_react_query40 = require("@tanstack/react-query");
|
|
23042
23068
|
import_lucide_react55 = require("lucide-react");
|
|
23043
|
-
|
|
23069
|
+
import_react70 = require("react");
|
|
23044
23070
|
init_icons();
|
|
23045
23071
|
init_nickname();
|
|
23046
23072
|
init_profile();
|
|
@@ -23076,7 +23102,7 @@ function NicknameMenu() {
|
|
|
23076
23102
|
queryFn: async () => await getNicknameInfo()
|
|
23077
23103
|
});
|
|
23078
23104
|
const resolvedError = nicknameError || nicknameInfoError?.message || null;
|
|
23079
|
-
(0,
|
|
23105
|
+
(0, import_react71.useEffect)(() => () => useNicknameStore.getState().reset(), []);
|
|
23080
23106
|
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
23081
23107
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)] ", children: [
|
|
23082
23108
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
@@ -23143,7 +23169,7 @@ function NicknameMenu() {
|
|
|
23143
23169
|
!!resolvedError?.length && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Highlight, { type: "error", children: resolvedError })
|
|
23144
23170
|
] });
|
|
23145
23171
|
}
|
|
23146
|
-
var import_react_query41, import_dayjs5, import_lucide_react56,
|
|
23172
|
+
var import_react_query41, import_dayjs5, import_lucide_react56, import_react71, import_jsx_runtime99;
|
|
23147
23173
|
var init_NicknameMenu = __esm({
|
|
23148
23174
|
"src/internal/components/NicknameMenu/NicknameMenu.tsx"() {
|
|
23149
23175
|
init_SessionContext();
|
|
@@ -23152,7 +23178,7 @@ var init_NicknameMenu = __esm({
|
|
|
23152
23178
|
import_react_query41 = require("@tanstack/react-query");
|
|
23153
23179
|
import_dayjs5 = __toESM(require("dayjs"), 1);
|
|
23154
23180
|
import_lucide_react56 = require("lucide-react");
|
|
23155
|
-
|
|
23181
|
+
import_react71 = require("react");
|
|
23156
23182
|
init_nickname();
|
|
23157
23183
|
init_profile();
|
|
23158
23184
|
init_useLayoutDataStore();
|
|
@@ -23282,12 +23308,12 @@ function ReceiveMenu() {
|
|
|
23282
23308
|
queryKey: [QUERY_KEYS.nicknameInfo, address],
|
|
23283
23309
|
queryFn: async () => await getNicknameInfo()
|
|
23284
23310
|
});
|
|
23285
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
23286
|
-
const [isAddressCopied, setAddressCopied] = (0,
|
|
23287
|
-
const [isNicknameCopied, setNicknameCopied] = (0,
|
|
23288
|
-
const [fingerprintCopied, setFingerprintCopied] = (0,
|
|
23311
|
+
const [qrCodeUrl, setQrCodeUrl] = (0, import_react72.useState)("");
|
|
23312
|
+
const [isAddressCopied, setAddressCopied] = (0, import_react72.useState)(false);
|
|
23313
|
+
const [isNicknameCopied, setNicknameCopied] = (0, import_react72.useState)(false);
|
|
23314
|
+
const [fingerprintCopied, setFingerprintCopied] = (0, import_react72.useState)(false);
|
|
23289
23315
|
useOnboardingTourAvailable(true);
|
|
23290
|
-
const fingerprint = (0,
|
|
23316
|
+
const fingerprint = (0, import_react72.useMemo)(() => {
|
|
23291
23317
|
if (!session?.ownerAddress) return null;
|
|
23292
23318
|
try {
|
|
23293
23319
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -23295,7 +23321,7 @@ function ReceiveMenu() {
|
|
|
23295
23321
|
return null;
|
|
23296
23322
|
}
|
|
23297
23323
|
}, [session?.ownerAddress]);
|
|
23298
|
-
(0,
|
|
23324
|
+
(0, import_react72.useEffect)(() => {
|
|
23299
23325
|
if (!address) return;
|
|
23300
23326
|
import_qrcode.default.toDataURL(address, {
|
|
23301
23327
|
width: 200,
|
|
@@ -23394,7 +23420,7 @@ function ReceiveMenu() {
|
|
|
23394
23420
|
] })
|
|
23395
23421
|
] });
|
|
23396
23422
|
}
|
|
23397
|
-
var import_react_query42, import_lucide_react57, import_qrcode,
|
|
23423
|
+
var import_react_query42, import_lucide_react57, import_qrcode, import_react72, import_jsx_runtime100;
|
|
23398
23424
|
var init_ReceiveMenu = __esm({
|
|
23399
23425
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
23400
23426
|
init_SessionContext();
|
|
@@ -23402,7 +23428,7 @@ var init_ReceiveMenu = __esm({
|
|
|
23402
23428
|
import_react_query42 = require("@tanstack/react-query");
|
|
23403
23429
|
import_lucide_react57 = require("lucide-react");
|
|
23404
23430
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
23405
|
-
|
|
23431
|
+
import_react72 = require("react");
|
|
23406
23432
|
init_nickname();
|
|
23407
23433
|
init_profile();
|
|
23408
23434
|
init_useLayoutDataStore();
|
|
@@ -23782,14 +23808,14 @@ var init_ConnectedApps2 = __esm({
|
|
|
23782
23808
|
});
|
|
23783
23809
|
|
|
23784
23810
|
// src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx
|
|
23785
|
-
var import_lucide_react60,
|
|
23811
|
+
var import_lucide_react60, import_react73, import_jsx_runtime103, KeyshareStatus;
|
|
23786
23812
|
var init_KeyshareStatus = __esm({
|
|
23787
23813
|
"src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx"() {
|
|
23788
23814
|
import_lucide_react60 = require("lucide-react");
|
|
23789
|
-
|
|
23815
|
+
import_react73 = require("react");
|
|
23790
23816
|
init_utils();
|
|
23791
23817
|
import_jsx_runtime103 = require("react/jsx-runtime");
|
|
23792
|
-
KeyshareStatus = (0,
|
|
23818
|
+
KeyshareStatus = (0, import_react73.forwardRef)((props, ref) => {
|
|
23793
23819
|
const { isLoading, content, icon: Icon2, children } = props;
|
|
23794
23820
|
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react60.Loader, { className: "w-4 h-4 animate-spin" });
|
|
23795
23821
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { ref, className: "group relative w-full h-full", children: [
|
|
@@ -24116,10 +24142,10 @@ function updateLimits(patch) {
|
|
|
24116
24142
|
usePolicyForm.setState((st) => ({ ...st, limits: { ...st?.limits, ...patch } }));
|
|
24117
24143
|
}
|
|
24118
24144
|
function useWatchFormData() {
|
|
24119
|
-
const [showFormErrors, setShowFormErrors] = (0,
|
|
24145
|
+
const [showFormErrors, setShowFormErrors] = (0, import_react74.useState)(false);
|
|
24120
24146
|
const formData = usePolicyForm();
|
|
24121
24147
|
const formState = usePolicyFormValidation();
|
|
24122
|
-
(0,
|
|
24148
|
+
(0, import_react74.useEffect)(() => {
|
|
24123
24149
|
if (!formData) return;
|
|
24124
24150
|
setShowFormErrors(false);
|
|
24125
24151
|
const errors = {};
|
|
@@ -24146,7 +24172,7 @@ function useWatchFormData() {
|
|
|
24146
24172
|
}
|
|
24147
24173
|
usePolicyFormValidation.setState(errors, true);
|
|
24148
24174
|
}, [formData]);
|
|
24149
|
-
(0,
|
|
24175
|
+
(0, import_react74.useEffect)(() => () => usePolicyFormValidation.setState({}, true), []);
|
|
24150
24176
|
const formErrorItem = Object.entries(formState).find(([_, value]) => value?.error);
|
|
24151
24177
|
const formErrorMessage = formErrorItem ? `${formErrorItem[0].toUpperCase()}: ${formErrorItem[1]?.error}` : "";
|
|
24152
24178
|
return {
|
|
@@ -24157,10 +24183,10 @@ function useWatchFormData() {
|
|
|
24157
24183
|
setShowFormErrors
|
|
24158
24184
|
};
|
|
24159
24185
|
}
|
|
24160
|
-
var
|
|
24186
|
+
var import_react74, import_zustand14, usePolicyForm, usePolicyFormValidation;
|
|
24161
24187
|
var init_usePolicyForm = __esm({
|
|
24162
24188
|
"src/internal/components/SecurityMenu/UserPolicies/usePolicyForm.ts"() {
|
|
24163
|
-
|
|
24189
|
+
import_react74 = require("react");
|
|
24164
24190
|
import_zustand14 = require("zustand");
|
|
24165
24191
|
init_utils10();
|
|
24166
24192
|
usePolicyForm = (0, import_zustand14.create)(() => null);
|
|
@@ -24191,10 +24217,10 @@ var init_useUserAssetsPolicies = __esm({
|
|
|
24191
24217
|
// src/internal/components/SecurityMenu/UserPolicies/PolicyForm.tsx
|
|
24192
24218
|
function AddressListEditor(props) {
|
|
24193
24219
|
const { label, assets = [], addresses, onChange } = props;
|
|
24194
|
-
const [isAssetSelector, setIsAssetSelector] = (0,
|
|
24195
|
-
const [customAddress, setCustomAddress] = (0,
|
|
24196
|
-
const [customAddressError, setCustomAddressError] = (0,
|
|
24197
|
-
const handleAddress = (0,
|
|
24220
|
+
const [isAssetSelector, setIsAssetSelector] = (0, import_react75.useState)(false);
|
|
24221
|
+
const [customAddress, setCustomAddress] = (0, import_react75.useState)("");
|
|
24222
|
+
const [customAddressError, setCustomAddressError] = (0, import_react75.useState)(null);
|
|
24223
|
+
const handleAddress = (0, import_react75.useCallback)(
|
|
24198
24224
|
(addressToAdd) => {
|
|
24199
24225
|
if (!isValidAddress(addressToAdd)) {
|
|
24200
24226
|
setCustomAddressError("Bad address");
|
|
@@ -24421,14 +24447,14 @@ function PolicyForm() {
|
|
|
24421
24447
|
showFormErrors && formErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Highlight, { type: "error", children: formErrorMessage })
|
|
24422
24448
|
] });
|
|
24423
24449
|
}
|
|
24424
|
-
var import_react_query47, import_lucide_react63,
|
|
24450
|
+
var import_react_query47, import_lucide_react63, import_react75, import_jsx_runtime106;
|
|
24425
24451
|
var init_PolicyForm = __esm({
|
|
24426
24452
|
"src/internal/components/SecurityMenu/UserPolicies/PolicyForm.tsx"() {
|
|
24427
24453
|
init_SessionContext();
|
|
24428
24454
|
init_useT();
|
|
24429
24455
|
import_react_query47 = require("@tanstack/react-query");
|
|
24430
24456
|
import_lucide_react63 = require("lucide-react");
|
|
24431
|
-
|
|
24457
|
+
import_react75 = require("react");
|
|
24432
24458
|
init_button();
|
|
24433
24459
|
init_highlight();
|
|
24434
24460
|
init_input();
|
|
@@ -24510,7 +24536,7 @@ function UserPolicies() {
|
|
|
24510
24536
|
const config = useProviderConfig().config;
|
|
24511
24537
|
const mpcUserId = useSession((st) => st.session?.mpcUserId);
|
|
24512
24538
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
24513
|
-
const [isConfirmingDelete, setIsConfirmingDelete] = (0,
|
|
24539
|
+
const [isConfirmingDelete, setIsConfirmingDelete] = (0, import_react76.useState)(false);
|
|
24514
24540
|
const { data: policyView, isLoading: isPolicyLoading } = useUserAssetsPolicies(activeChainId);
|
|
24515
24541
|
const { mutate: cancelPending, isPending: isCancellingPending } = (0, import_react_query48.useMutation)({
|
|
24516
24542
|
mutationFn: async () => {
|
|
@@ -24623,7 +24649,7 @@ function UserPolicies() {
|
|
|
24623
24649
|
] })
|
|
24624
24650
|
] });
|
|
24625
24651
|
}
|
|
24626
|
-
var import_react_query48, import_clsx3, import_lucide_react64,
|
|
24652
|
+
var import_react_query48, import_clsx3, import_lucide_react64, import_react76, import_jsx_runtime107;
|
|
24627
24653
|
var init_UserPolicies = __esm({
|
|
24628
24654
|
"src/internal/components/SecurityMenu/UserPolicies/UserPolicies.tsx"() {
|
|
24629
24655
|
init_ProviderContext();
|
|
@@ -24632,7 +24658,7 @@ var init_UserPolicies = __esm({
|
|
|
24632
24658
|
import_react_query48 = require("@tanstack/react-query");
|
|
24633
24659
|
import_clsx3 = __toESM(require("clsx"), 1);
|
|
24634
24660
|
import_lucide_react64 = require("lucide-react");
|
|
24635
|
-
|
|
24661
|
+
import_react76 = require("react");
|
|
24636
24662
|
init_button();
|
|
24637
24663
|
init_highlight();
|
|
24638
24664
|
init_api4();
|
|
@@ -24657,7 +24683,7 @@ var init_UserPolicies2 = __esm({
|
|
|
24657
24683
|
|
|
24658
24684
|
// src/internal/components/SecurityMenu/useSecurityMenuParams.ts
|
|
24659
24685
|
function useSecurityMenuParams() {
|
|
24660
|
-
(0,
|
|
24686
|
+
(0, import_react77.useEffect)(() => {
|
|
24661
24687
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
24662
24688
|
if (!pageParams || !(0, import_lodash_es15.keys)(pageParams).length) return;
|
|
24663
24689
|
const { submenu } = pageParams;
|
|
@@ -24681,11 +24707,11 @@ function useSecurityMenuParams() {
|
|
|
24681
24707
|
setPageParams(null);
|
|
24682
24708
|
}, []);
|
|
24683
24709
|
}
|
|
24684
|
-
var import_lodash_es15,
|
|
24710
|
+
var import_lodash_es15, import_react77;
|
|
24685
24711
|
var init_useSecurityMenuParams = __esm({
|
|
24686
24712
|
"src/internal/components/SecurityMenu/useSecurityMenuParams.ts"() {
|
|
24687
24713
|
import_lodash_es15 = require("lodash-es");
|
|
24688
|
-
|
|
24714
|
+
import_react77 = require("react");
|
|
24689
24715
|
init_useLayoutDataStore();
|
|
24690
24716
|
init_UserPolicies2();
|
|
24691
24717
|
init_useSecurityStore();
|
|
@@ -24700,7 +24726,7 @@ function SecurityMenuContent() {
|
|
|
24700
24726
|
const { appToUntrust, showConnectedApps, showAssetsPolicies } = useSecurityStore();
|
|
24701
24727
|
const policyForm = usePolicyForm();
|
|
24702
24728
|
useOnboardingTourAvailable(!showConnectedApps && !showAssetsPolicies);
|
|
24703
|
-
(0,
|
|
24729
|
+
(0, import_react78.useEffect)(() => {
|
|
24704
24730
|
let securityTitle = "";
|
|
24705
24731
|
switch (true) {
|
|
24706
24732
|
case showConnectedApps:
|
|
@@ -24721,7 +24747,7 @@ function SecurityMenuContent() {
|
|
|
24721
24747
|
return () => {
|
|
24722
24748
|
};
|
|
24723
24749
|
}, [t, showConnectedApps, showAssetsPolicies, policyForm]);
|
|
24724
|
-
(0,
|
|
24750
|
+
(0, import_react78.useEffect)(
|
|
24725
24751
|
() => () => {
|
|
24726
24752
|
usePolicyForm.setState(null, true);
|
|
24727
24753
|
useSecurityStore.setState(
|
|
@@ -24815,13 +24841,13 @@ function SecurityMenu() {
|
|
|
24815
24841
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SecurityMenuContent, {})
|
|
24816
24842
|
] });
|
|
24817
24843
|
}
|
|
24818
|
-
var import_lucide_react65,
|
|
24844
|
+
var import_lucide_react65, import_react78, import_jsx_runtime108;
|
|
24819
24845
|
var init_SecurityMenu = __esm({
|
|
24820
24846
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
24821
24847
|
init_ProviderContext();
|
|
24822
24848
|
init_i18n();
|
|
24823
24849
|
import_lucide_react65 = require("lucide-react");
|
|
24824
|
-
|
|
24850
|
+
import_react78 = require("react");
|
|
24825
24851
|
init_useLayoutDataStore();
|
|
24826
24852
|
init_Expandable2();
|
|
24827
24853
|
init_Onboarding();
|
|
@@ -25025,8 +25051,8 @@ var init_SenderSelector = __esm({
|
|
|
25025
25051
|
function useAvailableSenders() {
|
|
25026
25052
|
const address = useSession((st) => st.address);
|
|
25027
25053
|
const { profiles } = useLinkedProfiles();
|
|
25028
|
-
const lastCalcedSenders = (0,
|
|
25029
|
-
(0,
|
|
25054
|
+
const lastCalcedSenders = (0, import_react79.useRef)([]);
|
|
25055
|
+
(0, import_react79.useEffect)(() => {
|
|
25030
25056
|
const sendersAccumulator = [
|
|
25031
25057
|
{
|
|
25032
25058
|
type: "embarkai-wallet",
|
|
@@ -25060,13 +25086,13 @@ function useAvailableSenders() {
|
|
|
25060
25086
|
directWalletProfiles: profiles.filter((p) => p.provider === "wallet")
|
|
25061
25087
|
};
|
|
25062
25088
|
}
|
|
25063
|
-
var
|
|
25089
|
+
var import_react79;
|
|
25064
25090
|
var init_useAvailableSenders = __esm({
|
|
25065
25091
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
25066
25092
|
init_SessionContext();
|
|
25067
25093
|
init_tokens();
|
|
25068
25094
|
init_linkedProfiles();
|
|
25069
|
-
|
|
25095
|
+
import_react79 = require("react");
|
|
25070
25096
|
init_wallets();
|
|
25071
25097
|
init_useBridgeStore();
|
|
25072
25098
|
}
|
|
@@ -25481,18 +25507,18 @@ function useHyperlaneHistory() {
|
|
|
25481
25507
|
getNextPageParam: (lastPage) => lastPage.page < lastPage.pageCount ? lastPage.page + 1 : void 0,
|
|
25482
25508
|
queryFn: async ({ pageParam }) => await getHyperlaneBridgeHistory({ page: pageParam, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
25483
25509
|
});
|
|
25484
|
-
const txList = (0,
|
|
25510
|
+
const txList = (0, import_react80.useMemo)(
|
|
25485
25511
|
() => query?.data?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
25486
25512
|
[query?.data]
|
|
25487
25513
|
);
|
|
25488
25514
|
return { query, txList };
|
|
25489
25515
|
}
|
|
25490
|
-
var import_react_query49,
|
|
25516
|
+
var import_react_query49, import_react80, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
25491
25517
|
var init_useHyperlaneHistory = __esm({
|
|
25492
25518
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
25493
25519
|
init_SessionContext();
|
|
25494
25520
|
import_react_query49 = require("@tanstack/react-query");
|
|
25495
|
-
|
|
25521
|
+
import_react80 = require("react");
|
|
25496
25522
|
init_useLayoutDataStore();
|
|
25497
25523
|
init_useFlowSelector();
|
|
25498
25524
|
init_api5();
|
|
@@ -25524,7 +25550,7 @@ function useBridge() {
|
|
|
25524
25550
|
const address = useSession((st) => st.address);
|
|
25525
25551
|
const { data: walletClient } = (0, import_wagmi6.useWalletClient)();
|
|
25526
25552
|
const { mutateAsync: switchChainAsync } = (0, import_wagmi6.useSwitchChain)();
|
|
25527
|
-
const swapDirection = (0,
|
|
25553
|
+
const swapDirection = (0, import_react81.useCallback)(() => {
|
|
25528
25554
|
const {
|
|
25529
25555
|
// bridgeStep,
|
|
25530
25556
|
originChain,
|
|
@@ -25575,7 +25601,7 @@ function useBridge() {
|
|
|
25575
25601
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
25576
25602
|
}
|
|
25577
25603
|
});
|
|
25578
|
-
const handleQuoteEstimation = (0,
|
|
25604
|
+
const handleQuoteEstimation = (0, import_react81.useCallback)((amnt) => {
|
|
25579
25605
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
25580
25606
|
if (!amnt || !Number(amnt)) {
|
|
25581
25607
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -25710,13 +25736,13 @@ function useBridge() {
|
|
|
25710
25736
|
isAssetBridging
|
|
25711
25737
|
};
|
|
25712
25738
|
}
|
|
25713
|
-
var import_react_query50,
|
|
25739
|
+
var import_react_query50, import_react81, import_wagmi6;
|
|
25714
25740
|
var init_useBridge = __esm({
|
|
25715
25741
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
25716
25742
|
init_SessionContext();
|
|
25717
25743
|
init_i18n();
|
|
25718
25744
|
import_react_query50 = require("@tanstack/react-query");
|
|
25719
|
-
|
|
25745
|
+
import_react81 = require("react");
|
|
25720
25746
|
import_wagmi6 = require("wagmi");
|
|
25721
25747
|
init_useLayoutStore();
|
|
25722
25748
|
init_useExternalWalletStore();
|
|
@@ -25747,7 +25773,7 @@ function useHyperlaneRoutes() {
|
|
|
25747
25773
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
25748
25774
|
queryFn: async () => await getHyperlaneWarpRoutes()
|
|
25749
25775
|
});
|
|
25750
|
-
(0,
|
|
25776
|
+
(0, import_react82.useEffect)(() => {
|
|
25751
25777
|
if (!errorWarpRoutes) return;
|
|
25752
25778
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
25753
25779
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -25756,7 +25782,7 @@ function useHyperlaneRoutes() {
|
|
|
25756
25782
|
setOriginChain(null);
|
|
25757
25783
|
setDestinationChain(null);
|
|
25758
25784
|
}, [errorWarpRoutes]);
|
|
25759
|
-
(0,
|
|
25785
|
+
(0, import_react82.useEffect)(() => {
|
|
25760
25786
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
25761
25787
|
let targetHyperRouteToSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
25762
25788
|
if (!targetHyperRouteToSelect) {
|
|
@@ -25781,12 +25807,12 @@ function useHyperlaneRoutes() {
|
|
|
25781
25807
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
25782
25808
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
25783
25809
|
}
|
|
25784
|
-
var import_react_query51,
|
|
25810
|
+
var import_react_query51, import_react82, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
25785
25811
|
var init_useHyperlaneRoutes = __esm({
|
|
25786
25812
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
25787
25813
|
init_SessionContext();
|
|
25788
25814
|
import_react_query51 = require("@tanstack/react-query");
|
|
25789
|
-
|
|
25815
|
+
import_react82 = require("react");
|
|
25790
25816
|
init_useLayoutDataStore();
|
|
25791
25817
|
init_useFlowSelector();
|
|
25792
25818
|
init_api5();
|
|
@@ -25802,7 +25828,7 @@ function useMenuTitle(warpRoutes) {
|
|
|
25802
25828
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
25803
25829
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
25804
25830
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
25805
|
-
(0,
|
|
25831
|
+
(0, import_react83.useEffect)(() => {
|
|
25806
25832
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
25807
25833
|
switch (true) {
|
|
25808
25834
|
case bridgeStep === "sender-selector":
|
|
@@ -25830,11 +25856,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
25830
25856
|
}
|
|
25831
25857
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
25832
25858
|
}
|
|
25833
|
-
var
|
|
25859
|
+
var import_react83;
|
|
25834
25860
|
var init_useMenuTitle = __esm({
|
|
25835
25861
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
25836
25862
|
init_i18n();
|
|
25837
|
-
|
|
25863
|
+
import_react83 = require("react");
|
|
25838
25864
|
init_useFlowSelector();
|
|
25839
25865
|
init_useBridgeStore();
|
|
25840
25866
|
}
|
|
@@ -26084,7 +26110,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26084
26110
|
};
|
|
26085
26111
|
}
|
|
26086
26112
|
});
|
|
26087
|
-
const refreshRouteTokenBalance = (0,
|
|
26113
|
+
const refreshRouteTokenBalance = (0, import_react84.useCallback)(
|
|
26088
26114
|
(senderWallet) => {
|
|
26089
26115
|
switch (true) {
|
|
26090
26116
|
case senderWallet === "embarkai-wallet":
|
|
@@ -26100,7 +26126,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26100
26126
|
},
|
|
26101
26127
|
[refreshBalances, qc]
|
|
26102
26128
|
);
|
|
26103
|
-
(0,
|
|
26129
|
+
(0, import_react84.useEffect)(() => {
|
|
26104
26130
|
if (!!isLoadingWarpRoutes || !bridgeSender || !originChain) return;
|
|
26105
26131
|
switch (bridgeSender) {
|
|
26106
26132
|
case "embarkai-wallet":
|
|
@@ -26131,14 +26157,14 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26131
26157
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
26132
26158
|
};
|
|
26133
26159
|
}
|
|
26134
|
-
var import_core8, import_react_query52,
|
|
26160
|
+
var import_core8, import_react_query52, import_react84, import_viem15, import_wagmi7, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
|
|
26135
26161
|
var init_useBridgeBalance = __esm({
|
|
26136
26162
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
26137
26163
|
init_SessionContext();
|
|
26138
26164
|
init_i18n();
|
|
26139
26165
|
import_core8 = require("@embarkai/core");
|
|
26140
26166
|
import_react_query52 = require("@tanstack/react-query");
|
|
26141
|
-
|
|
26167
|
+
import_react84 = require("react");
|
|
26142
26168
|
import_viem15 = require("viem");
|
|
26143
26169
|
import_wagmi7 = require("wagmi");
|
|
26144
26170
|
init_useBlockscoutAssets2();
|
|
@@ -26267,7 +26293,7 @@ function SelectStep(props) {
|
|
|
26267
26293
|
variant: "outline",
|
|
26268
26294
|
size: "medium",
|
|
26269
26295
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
26270
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
|
|
26296
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(import_react85.Fragment, { children: [
|
|
26271
26297
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_lucide_react67.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
26272
26298
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
26273
26299
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -26411,13 +26437,13 @@ function SelectStep(props) {
|
|
|
26411
26437
|
)
|
|
26412
26438
|
] });
|
|
26413
26439
|
}
|
|
26414
|
-
var import_lucide_react67,
|
|
26440
|
+
var import_lucide_react67, import_react85, import_jsx_runtime111;
|
|
26415
26441
|
var init_SelectStep = __esm({
|
|
26416
26442
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
26417
26443
|
init_tokens();
|
|
26418
26444
|
init_i18n();
|
|
26419
26445
|
import_lucide_react67 = require("lucide-react");
|
|
26420
|
-
|
|
26446
|
+
import_react85 = require("react");
|
|
26421
26447
|
init_priceFormatter();
|
|
26422
26448
|
init_utils();
|
|
26423
26449
|
init_useExternalWalletStore();
|
|
@@ -26468,7 +26494,7 @@ var init_checkbox = __esm({
|
|
|
26468
26494
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
26469
26495
|
function ConfirmStep(props) {
|
|
26470
26496
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
26471
|
-
const [userConsent, setUserConsent] = (0,
|
|
26497
|
+
const [userConsent, setUserConsent] = (0, import_react86.useState)(false);
|
|
26472
26498
|
const { t } = useT();
|
|
26473
26499
|
const address = useSession((st) => st.address);
|
|
26474
26500
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -26584,13 +26610,13 @@ function ConfirmStep(props) {
|
|
|
26584
26610
|
}
|
|
26585
26611
|
);
|
|
26586
26612
|
}
|
|
26587
|
-
var import_lucide_react69,
|
|
26613
|
+
var import_lucide_react69, import_react86, import_jsx_runtime113, P_CN;
|
|
26588
26614
|
var init_ConfirmStep = __esm({
|
|
26589
26615
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
26590
26616
|
init_SessionContext();
|
|
26591
26617
|
init_i18n();
|
|
26592
26618
|
import_lucide_react69 = require("lucide-react");
|
|
26593
|
-
|
|
26619
|
+
import_react86 = require("react");
|
|
26594
26620
|
init_priceFormatter();
|
|
26595
26621
|
init_utils();
|
|
26596
26622
|
init_Onboarding();
|
|
@@ -26967,7 +26993,7 @@ function SelectAssetRoute(props) {
|
|
|
26967
26993
|
const { hyperlaneWarpRoutes } = props;
|
|
26968
26994
|
const { t } = useT();
|
|
26969
26995
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
26970
|
-
const tokenList = (0,
|
|
26996
|
+
const tokenList = (0, import_react87.useMemo)(() => {
|
|
26971
26997
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
26972
26998
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
26973
26999
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -27044,13 +27070,13 @@ function SelectAssetRoute(props) {
|
|
|
27044
27070
|
] })
|
|
27045
27071
|
] });
|
|
27046
27072
|
}
|
|
27047
|
-
var import_lucide_react71,
|
|
27073
|
+
var import_lucide_react71, import_react87, import_jsx_runtime116;
|
|
27048
27074
|
var init_SelectAssetRoute = __esm({
|
|
27049
27075
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
27050
27076
|
init_tokens();
|
|
27051
27077
|
init_i18n();
|
|
27052
27078
|
import_lucide_react71 = require("lucide-react");
|
|
27053
|
-
|
|
27079
|
+
import_react87 = require("react");
|
|
27054
27080
|
init_button();
|
|
27055
27081
|
init_ResolveChainIcon();
|
|
27056
27082
|
init_useBridgeStore();
|
|
@@ -27077,7 +27103,7 @@ function HyperlaneBridge() {
|
|
|
27077
27103
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
27078
27104
|
const { directWalletProfiles } = useAvailableSenders();
|
|
27079
27105
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
27080
|
-
(0,
|
|
27106
|
+
(0, import_react88.useEffect)(() => {
|
|
27081
27107
|
return () => {
|
|
27082
27108
|
useBridgeStore.getState().resetSelections();
|
|
27083
27109
|
};
|
|
@@ -27110,10 +27136,10 @@ function HyperlaneBridge() {
|
|
|
27110
27136
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(HistoryDetailsStep, {})
|
|
27111
27137
|
] });
|
|
27112
27138
|
}
|
|
27113
|
-
var
|
|
27139
|
+
var import_react88, import_jsx_runtime117;
|
|
27114
27140
|
var init_HyperlaneBridge = __esm({
|
|
27115
27141
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
27116
|
-
|
|
27142
|
+
import_react88 = require("react");
|
|
27117
27143
|
init_SenderSelector();
|
|
27118
27144
|
init_useAvailableSenders();
|
|
27119
27145
|
init_useBridge();
|
|
@@ -27131,7 +27157,7 @@ function BridgeHistorySwitch(props) {
|
|
|
27131
27157
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
27132
27158
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
27133
27159
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
27134
|
-
const lastBridgeStepRef = (0,
|
|
27160
|
+
const lastBridgeStepRef = (0, import_react89.useRef)(null);
|
|
27135
27161
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
27136
27162
|
return null;
|
|
27137
27163
|
}
|
|
@@ -27150,10 +27176,10 @@ function BridgeHistorySwitch(props) {
|
|
|
27150
27176
|
}
|
|
27151
27177
|
);
|
|
27152
27178
|
}
|
|
27153
|
-
var
|
|
27179
|
+
var import_react89, import_jsx_runtime118;
|
|
27154
27180
|
var init_HistorySwitch = __esm({
|
|
27155
27181
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
27156
|
-
|
|
27182
|
+
import_react89 = require("react");
|
|
27157
27183
|
init_switch();
|
|
27158
27184
|
init_useFlowSelector();
|
|
27159
27185
|
init_useBridgeStore();
|
|
@@ -27244,11 +27270,11 @@ function looksLikeNickname(input) {
|
|
|
27244
27270
|
}
|
|
27245
27271
|
function useNicknameResolve(input, options) {
|
|
27246
27272
|
const { enabled = true, chainId } = options;
|
|
27247
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
27248
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
27273
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react90.useState)("");
|
|
27274
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react90.useState)(false);
|
|
27249
27275
|
const normalized = normalizeNickname(input);
|
|
27250
27276
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
27251
|
-
(0,
|
|
27277
|
+
(0, import_react90.useEffect)(() => {
|
|
27252
27278
|
if (!isNicknameInput || !enabled) {
|
|
27253
27279
|
setDebouncedInput("");
|
|
27254
27280
|
setIsDebouncing(false);
|
|
@@ -27274,7 +27300,7 @@ function useNicknameResolve(input, options) {
|
|
|
27274
27300
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
27275
27301
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
27276
27302
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
27277
|
-
const fingerprintVerification = (0,
|
|
27303
|
+
const fingerprintVerification = (0, import_react90.useMemo)(() => {
|
|
27278
27304
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
27279
27305
|
return null;
|
|
27280
27306
|
}
|
|
@@ -27296,11 +27322,11 @@ function useNicknameResolve(input, options) {
|
|
|
27296
27322
|
resolvedAddress
|
|
27297
27323
|
};
|
|
27298
27324
|
}
|
|
27299
|
-
var import_react_query54,
|
|
27325
|
+
var import_react_query54, import_react90, DEBOUNCE_MS2;
|
|
27300
27326
|
var init_useNicknameResolve = __esm({
|
|
27301
27327
|
"src/hooks/useNicknameResolve.ts"() {
|
|
27302
27328
|
import_react_query54 = require("@tanstack/react-query");
|
|
27303
|
-
|
|
27329
|
+
import_react90 = require("react");
|
|
27304
27330
|
init_nickname();
|
|
27305
27331
|
init_profile();
|
|
27306
27332
|
init_nickname_fingerprint();
|
|
@@ -27313,10 +27339,10 @@ var init_useNicknameResolve = __esm({
|
|
|
27313
27339
|
function useSendTransaction() {
|
|
27314
27340
|
const session = useSession((st) => st.session);
|
|
27315
27341
|
const address = useSession((st) => st.address);
|
|
27316
|
-
const [isLoading, setIsLoading] = (0,
|
|
27317
|
-
const [error, setError] = (0,
|
|
27318
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
27319
|
-
const sendTransaction = (0,
|
|
27342
|
+
const [isLoading, setIsLoading] = (0, import_react91.useState)(false);
|
|
27343
|
+
const [error, setError] = (0, import_react91.useState)(null);
|
|
27344
|
+
const [userOpHash, setUserOpHash] = (0, import_react91.useState)(null);
|
|
27345
|
+
const sendTransaction = (0, import_react91.useCallback)(
|
|
27320
27346
|
async (params) => {
|
|
27321
27347
|
if (!session || !address) {
|
|
27322
27348
|
setError("No active session");
|
|
@@ -27413,7 +27439,7 @@ function useSendTransaction() {
|
|
|
27413
27439
|
},
|
|
27414
27440
|
[session, address]
|
|
27415
27441
|
);
|
|
27416
|
-
const reset = (0,
|
|
27442
|
+
const reset = (0, import_react91.useCallback)(() => {
|
|
27417
27443
|
setError(null);
|
|
27418
27444
|
setUserOpHash(null);
|
|
27419
27445
|
setIsLoading(false);
|
|
@@ -27426,10 +27452,10 @@ function useSendTransaction() {
|
|
|
27426
27452
|
reset
|
|
27427
27453
|
};
|
|
27428
27454
|
}
|
|
27429
|
-
var
|
|
27455
|
+
var import_react91, import_viem16, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
27430
27456
|
var init_useSendTransaction = __esm({
|
|
27431
27457
|
"src/hooks/useSendTransaction.ts"() {
|
|
27432
|
-
|
|
27458
|
+
import_react91 = require("react");
|
|
27433
27459
|
import_viem16 = require("viem");
|
|
27434
27460
|
init_SessionContext();
|
|
27435
27461
|
init_account2();
|
|
@@ -27580,7 +27606,7 @@ var init_AssetInputIcon = __esm({
|
|
|
27580
27606
|
|
|
27581
27607
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
27582
27608
|
function NftDisplayCard({ asset }) {
|
|
27583
|
-
const [imageError, setImageError] = (0,
|
|
27609
|
+
const [imageError, setImageError] = (0, import_react92.useState)(false);
|
|
27584
27610
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
27585
27611
|
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
27586
27612
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
@@ -27608,11 +27634,11 @@ function NftDisplayCard({ asset }) {
|
|
|
27608
27634
|
] })
|
|
27609
27635
|
] });
|
|
27610
27636
|
}
|
|
27611
|
-
var import_lucide_react73,
|
|
27637
|
+
var import_lucide_react73, import_react92, import_jsx_runtime120;
|
|
27612
27638
|
var init_NftDisplayCard = __esm({
|
|
27613
27639
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
27614
27640
|
import_lucide_react73 = require("lucide-react");
|
|
27615
|
-
|
|
27641
|
+
import_react92 = require("react");
|
|
27616
27642
|
import_jsx_runtime120 = require("react/jsx-runtime");
|
|
27617
27643
|
}
|
|
27618
27644
|
});
|
|
@@ -27732,7 +27758,7 @@ function NicknameData(props) {
|
|
|
27732
27758
|
isWalletNotSetup,
|
|
27733
27759
|
isFrozen
|
|
27734
27760
|
} = resolvedNicknameData;
|
|
27735
|
-
(0,
|
|
27761
|
+
(0, import_react93.useEffect)(() => {
|
|
27736
27762
|
if (isResolving) return;
|
|
27737
27763
|
let errMessage = null;
|
|
27738
27764
|
switch (true) {
|
|
@@ -27787,11 +27813,11 @@ function NicknameData(props) {
|
|
|
27787
27813
|
] })
|
|
27788
27814
|
] });
|
|
27789
27815
|
}
|
|
27790
|
-
var import_lucide_react74,
|
|
27816
|
+
var import_lucide_react74, import_react93, import_jsx_runtime122;
|
|
27791
27817
|
var init_NicknameData = __esm({
|
|
27792
27818
|
"src/internal/components/SendMenu/send/components/NicknameData.tsx"() {
|
|
27793
27819
|
import_lucide_react74 = require("lucide-react");
|
|
27794
|
-
|
|
27820
|
+
import_react93 = require("react");
|
|
27795
27821
|
init_no_image();
|
|
27796
27822
|
init_utils();
|
|
27797
27823
|
init_useFlowSelector();
|
|
@@ -28324,16 +28350,16 @@ function SendMenu() {
|
|
|
28324
28350
|
userOpHash,
|
|
28325
28351
|
reset
|
|
28326
28352
|
} = useSendTransaction();
|
|
28327
|
-
(0,
|
|
28353
|
+
(0, import_react94.useEffect)(() => {
|
|
28328
28354
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
28329
28355
|
}, [isAssetsLoading, isTransactionPending]);
|
|
28330
|
-
(0,
|
|
28356
|
+
(0, import_react94.useEffect)(() => {
|
|
28331
28357
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
28332
28358
|
}, [sendTransactionError]);
|
|
28333
28359
|
const { txStep, recipient, amount, selectedAsset, setSelectedAsset } = useSendStore();
|
|
28334
28360
|
const isNft = isNftAsset3(selectedAsset);
|
|
28335
28361
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
28336
|
-
(0,
|
|
28362
|
+
(0, import_react94.useEffect)(() => {
|
|
28337
28363
|
const shouldDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
28338
28364
|
if (!shouldDefaultAsset) return;
|
|
28339
28365
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -28343,7 +28369,7 @@ function SendMenu() {
|
|
|
28343
28369
|
if (isBalance(erc20)) return setSelectedAsset(erc20);
|
|
28344
28370
|
setSelectedAsset(assets[0]);
|
|
28345
28371
|
}, [assets, selectedAsset]);
|
|
28346
|
-
(0,
|
|
28372
|
+
(0, import_react94.useEffect)(
|
|
28347
28373
|
() => () => {
|
|
28348
28374
|
useSendStore.getState().reset();
|
|
28349
28375
|
reset();
|
|
@@ -28353,7 +28379,7 @@ function SendMenu() {
|
|
|
28353
28379
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
28354
28380
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
28355
28381
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
28356
|
-
const complianceAmount = (0,
|
|
28382
|
+
const complianceAmount = (0, import_react94.useMemo)(() => {
|
|
28357
28383
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
28358
28384
|
try {
|
|
28359
28385
|
return (0, import_viem21.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -28368,7 +28394,7 @@ function SendMenu() {
|
|
|
28368
28394
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
28369
28395
|
chainId: activeChainId
|
|
28370
28396
|
});
|
|
28371
|
-
(0,
|
|
28397
|
+
(0, import_react94.useEffect)(() => {
|
|
28372
28398
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
28373
28399
|
switch (true) {
|
|
28374
28400
|
case txStep === "select-asset":
|
|
@@ -28438,7 +28464,7 @@ function SendMenu() {
|
|
|
28438
28464
|
] })
|
|
28439
28465
|
] });
|
|
28440
28466
|
}
|
|
28441
|
-
var import_lucide_react77,
|
|
28467
|
+
var import_lucide_react77, import_react94, import_viem21, import_jsx_runtime125;
|
|
28442
28468
|
var init_SendMenu = __esm({
|
|
28443
28469
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
28444
28470
|
init_SessionContext();
|
|
@@ -28447,7 +28473,7 @@ var init_SendMenu = __esm({
|
|
|
28447
28473
|
init_useSendTransaction();
|
|
28448
28474
|
init_useT();
|
|
28449
28475
|
import_lucide_react77 = require("lucide-react");
|
|
28450
|
-
|
|
28476
|
+
import_react94 = require("react");
|
|
28451
28477
|
import_viem21 = require("viem");
|
|
28452
28478
|
init_useBlockscoutAssets2();
|
|
28453
28479
|
init_useLayoutDataStore();
|
|
@@ -28473,7 +28499,7 @@ var init_send = __esm({
|
|
|
28473
28499
|
// src/internal/components/SendMenu/useSendMenuParams.ts
|
|
28474
28500
|
function useSendMenuParams() {
|
|
28475
28501
|
const { config } = useProviderConfig();
|
|
28476
|
-
(0,
|
|
28502
|
+
(0, import_react95.useEffect)(() => {
|
|
28477
28503
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
28478
28504
|
if (!pageParams || !(0, import_lodash_es16.keys)(pageParams).length) return;
|
|
28479
28505
|
const { sendFlow, send, bridge } = pageParams || {};
|
|
@@ -28526,12 +28552,12 @@ function useSendMenuParams() {
|
|
|
28526
28552
|
setPageParams(null);
|
|
28527
28553
|
}, []);
|
|
28528
28554
|
}
|
|
28529
|
-
var import_lodash_es16,
|
|
28555
|
+
var import_lodash_es16, import_react95;
|
|
28530
28556
|
var init_useSendMenuParams = __esm({
|
|
28531
28557
|
"src/internal/components/SendMenu/useSendMenuParams.ts"() {
|
|
28532
28558
|
init_ProviderContext();
|
|
28533
28559
|
import_lodash_es16 = require("lodash-es");
|
|
28534
|
-
|
|
28560
|
+
import_react95 = require("react");
|
|
28535
28561
|
init_useLayoutDataStore();
|
|
28536
28562
|
init_useBridgeStore();
|
|
28537
28563
|
init_useSendStore();
|
|
@@ -28599,17 +28625,17 @@ function SendFlowSelector() {
|
|
|
28599
28625
|
const sendStep = useSendStore((st) => st.txStep);
|
|
28600
28626
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
28601
28627
|
useOnboardingTourAvailable(sendStep === "input" && bridgeStep === "select");
|
|
28602
|
-
(0,
|
|
28628
|
+
(0, import_react96.useEffect)(
|
|
28603
28629
|
() => () => {
|
|
28604
28630
|
useFlowSelectorStore.getState().setError(null);
|
|
28605
28631
|
},
|
|
28606
28632
|
[]
|
|
28607
28633
|
);
|
|
28608
|
-
(0,
|
|
28634
|
+
(0, import_react96.useEffect)(() => {
|
|
28609
28635
|
if (!!config?.current?.features?.showAssetBridge) return;
|
|
28610
28636
|
if (selectorFlow === "bridge") useFlowSelectorStore.getState().setFlow("send");
|
|
28611
28637
|
}, [selectorFlow]);
|
|
28612
|
-
const availableFlows = (0,
|
|
28638
|
+
const availableFlows = (0, import_react96.useMemo)(() => {
|
|
28613
28639
|
const selectorFlows = { send: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(SendMenu, {}) };
|
|
28614
28640
|
if (!!config?.current?.features?.showAssetBridge) selectorFlows.bridge = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(HyperlaneBridge, {});
|
|
28615
28641
|
return selectorFlows;
|
|
@@ -28674,13 +28700,13 @@ function SendFlowSelector() {
|
|
|
28674
28700
|
] })
|
|
28675
28701
|
] });
|
|
28676
28702
|
}
|
|
28677
|
-
var import_lucide_react78,
|
|
28703
|
+
var import_lucide_react78, import_react96, import_jsx_runtime126;
|
|
28678
28704
|
var init_SendFlowSelector = __esm({
|
|
28679
28705
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
28680
28706
|
init_ProviderContext();
|
|
28681
28707
|
init_i18n();
|
|
28682
28708
|
import_lucide_react78 = require("lucide-react");
|
|
28683
|
-
|
|
28709
|
+
import_react96 = require("react");
|
|
28684
28710
|
init_useLayoutDataStore();
|
|
28685
28711
|
init_utils();
|
|
28686
28712
|
init_Expandable2();
|
|
@@ -28743,12 +28769,12 @@ function getServerSnapshot() {
|
|
|
28743
28769
|
return false;
|
|
28744
28770
|
}
|
|
28745
28771
|
function useProMode() {
|
|
28746
|
-
return (0,
|
|
28772
|
+
return (0, import_react97.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
28747
28773
|
}
|
|
28748
|
-
var
|
|
28774
|
+
var import_react97, STORAGE_KEY, EVENT_NAME;
|
|
28749
28775
|
var init_pro_mode = __esm({
|
|
28750
28776
|
"src/internal/lib/pro-mode.ts"() {
|
|
28751
|
-
|
|
28777
|
+
import_react97 = require("react");
|
|
28752
28778
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
28753
28779
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
28754
28780
|
}
|
|
@@ -29554,7 +29580,7 @@ function TransactionsMenu() {
|
|
|
29554
29580
|
const { t } = useT();
|
|
29555
29581
|
useOnboardingTourAvailable(true);
|
|
29556
29582
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
29557
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
29583
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react98.useState)({});
|
|
29558
29584
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
29559
29585
|
const {
|
|
29560
29586
|
data: txHistoryGroups = [],
|
|
@@ -29567,7 +29593,7 @@ function TransactionsMenu() {
|
|
|
29567
29593
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
29568
29594
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
29569
29595
|
});
|
|
29570
|
-
const refreshTxHistory = (0,
|
|
29596
|
+
const refreshTxHistory = (0, import_react98.useCallback)(
|
|
29571
29597
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
29572
29598
|
[qc, chainConfig.id, address]
|
|
29573
29599
|
);
|
|
@@ -29606,14 +29632,14 @@ function TransactionsMenu() {
|
|
|
29606
29632
|
)) })
|
|
29607
29633
|
] });
|
|
29608
29634
|
}
|
|
29609
|
-
var import_react_query57, import_lucide_react80,
|
|
29635
|
+
var import_react_query57, import_lucide_react80, import_react98, import_jsx_runtime128;
|
|
29610
29636
|
var init_TransactionsMenu = __esm({
|
|
29611
29637
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
29612
29638
|
init_SessionContext();
|
|
29613
29639
|
init_i18n();
|
|
29614
29640
|
import_react_query57 = require("@tanstack/react-query");
|
|
29615
29641
|
import_lucide_react80 = require("lucide-react");
|
|
29616
|
-
|
|
29642
|
+
import_react98 = require("react");
|
|
29617
29643
|
init_useLayoutDataStore();
|
|
29618
29644
|
init_Expandable2();
|
|
29619
29645
|
init_Onboarding();
|
|
@@ -29953,7 +29979,7 @@ var init_PageMap = __esm({
|
|
|
29953
29979
|
// src/internal/hooks/usePageMapper.tsx
|
|
29954
29980
|
function usePageMapper() {
|
|
29955
29981
|
const page = useLayoutDataStore((st) => st.page);
|
|
29956
|
-
const closeDialog = (0,
|
|
29982
|
+
const closeDialog = (0, import_react99.useCallback)(() => {
|
|
29957
29983
|
useLayoutStore.setState({ isDialogAnimating: true });
|
|
29958
29984
|
setTimeout(() => {
|
|
29959
29985
|
useLayoutStore.setState({
|
|
@@ -29965,14 +29991,14 @@ function usePageMapper() {
|
|
|
29965
29991
|
});
|
|
29966
29992
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
29967
29993
|
}, []);
|
|
29968
|
-
const openDialog = (0,
|
|
29994
|
+
const openDialog = (0, import_react99.useCallback)((pageItem) => {
|
|
29969
29995
|
useLayoutStore.setState({
|
|
29970
29996
|
dialogContent: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(pageItem.component, {}),
|
|
29971
29997
|
isDialogOpen: true
|
|
29972
29998
|
// isDialogAnimating: true
|
|
29973
29999
|
});
|
|
29974
30000
|
}, []);
|
|
29975
|
-
(0,
|
|
30001
|
+
(0, import_react99.useEffect)(() => {
|
|
29976
30002
|
if (page === null) return closeDialog();
|
|
29977
30003
|
const pageItem = PAGE_MAP[page];
|
|
29978
30004
|
if (!pageItem) {
|
|
@@ -29983,10 +30009,10 @@ function usePageMapper() {
|
|
|
29983
30009
|
openDialog(pageItem);
|
|
29984
30010
|
}, [page, closeDialog, openDialog]);
|
|
29985
30011
|
}
|
|
29986
|
-
var
|
|
30012
|
+
var import_react99, import_jsx_runtime130, CLEAR_DIALOG_TIMEOUT;
|
|
29987
30013
|
var init_usePageMapper = __esm({
|
|
29988
30014
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
29989
|
-
|
|
30015
|
+
import_react99 = require("react");
|
|
29990
30016
|
init_PageMap();
|
|
29991
30017
|
init_constants();
|
|
29992
30018
|
init_useLayoutDataStore();
|
|
@@ -30002,24 +30028,24 @@ function useSettingsNotifications() {
|
|
|
30002
30028
|
const providers = import_auth25.jwtTokenManager.getProviders();
|
|
30003
30029
|
const hasEmail = providers.includes("email");
|
|
30004
30030
|
const { data: userProfile = null } = useUserProfile();
|
|
30005
|
-
(0,
|
|
30031
|
+
(0, import_react100.useEffect)(() => {
|
|
30006
30032
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
30007
30033
|
setSettingsNotifications({
|
|
30008
30034
|
...COMPLETE_KYC_PROGRESS,
|
|
30009
30035
|
status: isKYCVerified ? "resolved" : "active"
|
|
30010
30036
|
});
|
|
30011
30037
|
}, [userProfile, setSettingsNotifications]);
|
|
30012
|
-
(0,
|
|
30038
|
+
(0, import_react100.useEffect)(() => {
|
|
30013
30039
|
setSettingsNotifications({
|
|
30014
30040
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
30015
30041
|
status: hasEmail ? "resolved" : "active"
|
|
30016
30042
|
});
|
|
30017
30043
|
}, [hasEmail, setSettingsNotifications]);
|
|
30018
30044
|
}
|
|
30019
|
-
var
|
|
30045
|
+
var import_react100, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
30020
30046
|
var init_useSettingsNotifications = __esm({
|
|
30021
30047
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
30022
|
-
|
|
30048
|
+
import_react100 = require("react");
|
|
30023
30049
|
init_auth();
|
|
30024
30050
|
init_useLayoutDataStore();
|
|
30025
30051
|
init_useUserProfile();
|
|
@@ -30042,7 +30068,7 @@ var init_package = __esm({
|
|
|
30042
30068
|
"package.json"() {
|
|
30043
30069
|
package_default = {
|
|
30044
30070
|
name: "@embarkai/ui-kit",
|
|
30045
|
-
version: "0.4.
|
|
30071
|
+
version: "0.4.113",
|
|
30046
30072
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
30047
30073
|
type: "module",
|
|
30048
30074
|
main: "./dist/index.cjs",
|
|
@@ -30377,11 +30403,11 @@ function Header() {
|
|
|
30377
30403
|
const embarkPage = useLayoutDataStore((st) => st.page);
|
|
30378
30404
|
const isOnboardingTourAvailable = useOnboardingStore((st) => st.isTourAvailable);
|
|
30379
30405
|
const proMode = useProMode();
|
|
30380
|
-
const [proToast, setProToast] = (0,
|
|
30381
|
-
const [copied, setCopied] = (0,
|
|
30382
|
-
const clickCountRef = (0,
|
|
30383
|
-
const clickTimerRef = (0,
|
|
30384
|
-
const handleAvatarClick = (0,
|
|
30406
|
+
const [proToast, setProToast] = (0, import_react101.useState)(false);
|
|
30407
|
+
const [copied, setCopied] = (0, import_react101.useState)(false);
|
|
30408
|
+
const clickCountRef = (0, import_react101.useRef)(0);
|
|
30409
|
+
const clickTimerRef = (0, import_react101.useRef)(null);
|
|
30410
|
+
const handleAvatarClick = (0, import_react101.useCallback)(() => {
|
|
30385
30411
|
clickCountRef.current += 1;
|
|
30386
30412
|
if (clickTimerRef.current) {
|
|
30387
30413
|
clearTimeout(clickTimerRef.current);
|
|
@@ -30487,7 +30513,7 @@ function Header() {
|
|
|
30487
30513
|
}
|
|
30488
30514
|
);
|
|
30489
30515
|
}
|
|
30490
|
-
var import_lucide_react84,
|
|
30516
|
+
var import_lucide_react84, import_react101, import_jsx_runtime132;
|
|
30491
30517
|
var init_Header = __esm({
|
|
30492
30518
|
"src/internal/components/Header/Header.tsx"() {
|
|
30493
30519
|
init_lumia2();
|
|
@@ -30495,7 +30521,7 @@ var init_Header = __esm({
|
|
|
30495
30521
|
init_ProviderContext();
|
|
30496
30522
|
init_SessionContext();
|
|
30497
30523
|
import_lucide_react84 = require("lucide-react");
|
|
30498
|
-
|
|
30524
|
+
import_react101 = require("react");
|
|
30499
30525
|
init_icons();
|
|
30500
30526
|
init_auth();
|
|
30501
30527
|
init_useLayoutDataStore();
|
|
@@ -30530,7 +30556,7 @@ function useDecideContentStyles() {
|
|
|
30530
30556
|
style: (0, import_lodash_es17.merge)({}, mobileStyles)
|
|
30531
30557
|
};
|
|
30532
30558
|
}
|
|
30533
|
-
var DialogPrimitive, import_lodash_es17, import_lucide_react85,
|
|
30559
|
+
var DialogPrimitive, import_lodash_es17, import_lucide_react85, import_react102, import_jsx_runtime133, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
30534
30560
|
var init_dialog = __esm({
|
|
30535
30561
|
"src/internal/components/ui/dialog.tsx"() {
|
|
30536
30562
|
init_utils();
|
|
@@ -30539,34 +30565,36 @@ var init_dialog = __esm({
|
|
|
30539
30565
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
30540
30566
|
import_lodash_es17 = require("lodash-es");
|
|
30541
30567
|
import_lucide_react85 = require("lucide-react");
|
|
30542
|
-
|
|
30568
|
+
import_react102 = require("react");
|
|
30543
30569
|
init_useLayoutDataStore();
|
|
30544
30570
|
init_useLayoutStore();
|
|
30545
30571
|
init_button();
|
|
30546
30572
|
import_jsx_runtime133 = require("react/jsx-runtime");
|
|
30547
30573
|
Dialog = DialogPrimitive.Root;
|
|
30548
30574
|
DialogPortal = DialogPrimitive.Portal;
|
|
30549
|
-
DialogOverlay = (0,
|
|
30550
|
-
|
|
30551
|
-
|
|
30552
|
-
|
|
30553
|
-
|
|
30554
|
-
|
|
30555
|
-
|
|
30556
|
-
|
|
30557
|
-
|
|
30558
|
-
|
|
30559
|
-
|
|
30560
|
-
|
|
30561
|
-
|
|
30562
|
-
|
|
30563
|
-
|
|
30575
|
+
DialogOverlay = (0, import_react102.forwardRef)(
|
|
30576
|
+
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30577
|
+
DialogPrimitive.Overlay,
|
|
30578
|
+
{
|
|
30579
|
+
ref,
|
|
30580
|
+
style: { backdropFilter: "blur(var(--ui-kit-backdrop-blur))" },
|
|
30581
|
+
className: cn2(
|
|
30582
|
+
"w-[100dvw] h-[100dvh]",
|
|
30583
|
+
"fixed inset-0 z-[9998] bg-[var(--ui-kit-overlay)]",
|
|
30584
|
+
closing ? "animate-dialog-out" : "animate-dialog-in",
|
|
30585
|
+
className
|
|
30586
|
+
),
|
|
30587
|
+
...props
|
|
30588
|
+
}
|
|
30589
|
+
)
|
|
30590
|
+
);
|
|
30591
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
30564
30592
|
CONTENT_BG_SETUP = {
|
|
30565
30593
|
backgroundColor: "var(--ui-kit-bg)",
|
|
30566
30594
|
border: "1px solid var(--ui-kit-bd)",
|
|
30567
30595
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
30568
30596
|
};
|
|
30569
|
-
DialogContent = (0,
|
|
30597
|
+
DialogContent = (0, import_react102.forwardRef)(
|
|
30570
30598
|
({ className, children, colorMode, ...props }, ref) => {
|
|
30571
30599
|
const { t, i18n } = useT();
|
|
30572
30600
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -30677,7 +30705,7 @@ var init_dialog = __esm({
|
|
|
30677
30705
|
DialogHeader.displayName = "DialogHeader";
|
|
30678
30706
|
DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: cn2("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
|
|
30679
30707
|
DialogFooter.displayName = "DialogFooter";
|
|
30680
|
-
DialogTitle = (0,
|
|
30708
|
+
DialogTitle = (0, import_react102.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30681
30709
|
DialogPrimitive.Title,
|
|
30682
30710
|
{
|
|
30683
30711
|
ref,
|
|
@@ -30686,7 +30714,7 @@ var init_dialog = __esm({
|
|
|
30686
30714
|
}
|
|
30687
30715
|
));
|
|
30688
30716
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
30689
|
-
DialogDescription = (0,
|
|
30717
|
+
DialogDescription = (0, import_react102.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DialogPrimitive.Description, { ref, className: cn2("text-sm text-muted-foreground", className), ...props }));
|
|
30690
30718
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
30691
30719
|
}
|
|
30692
30720
|
});
|
|
@@ -30709,19 +30737,19 @@ function Dialog2() {
|
|
|
30709
30737
|
const { colorMode, maxScrollHeight, isDialogOpen, dialogContent, isDialogForced } = useLayoutStore();
|
|
30710
30738
|
const page = useLayoutDataStore((st) => st.page);
|
|
30711
30739
|
const transitionPageHeight = useLayoutDataStore((st) => st.transitionPageHeight);
|
|
30712
|
-
(0,
|
|
30740
|
+
(0, import_react104.useEffect)(() => useLayoutStore.setState({ isSettings: !!session }), [session]);
|
|
30713
30741
|
usePageMapper();
|
|
30714
30742
|
useAutoConnect();
|
|
30715
30743
|
useBackupStatusChanges();
|
|
30716
30744
|
useDetectMaxScrollHeight();
|
|
30717
30745
|
useSettingsNotifications();
|
|
30718
30746
|
useListenIframeAuthEvents();
|
|
30747
|
+
useAllowExternalModalsScroll(isDialogOpen);
|
|
30719
30748
|
const isHeaderHidden = !session || page === "keysare-backup" /* KEYSARE_BACKUP */ && !hasServerVault;
|
|
30720
30749
|
return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
30721
30750
|
Dialog,
|
|
30722
30751
|
{
|
|
30723
30752
|
open: isDialogOpen,
|
|
30724
|
-
modal: false,
|
|
30725
30753
|
onOpenChange: (open) => {
|
|
30726
30754
|
if (isDialogForced) return;
|
|
30727
30755
|
if (!open) {
|
|
@@ -30740,8 +30768,8 @@ function Dialog2() {
|
|
|
30740
30768
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DialogTitle, { children: "embarkAI" }) }),
|
|
30741
30769
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DialogDescription, { className: "sr-only", children: "embarkAI wallet" }),
|
|
30742
30770
|
!isHeaderHidden && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Header, {}),
|
|
30743
|
-
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
30744
|
-
|
|
30771
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_react103.AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
30772
|
+
import_react103.motion.div,
|
|
30745
30773
|
{
|
|
30746
30774
|
style: { overflow: "hidden" },
|
|
30747
30775
|
initial: { opacity: 0, height: transitionPageHeight },
|
|
@@ -30770,14 +30798,15 @@ function Dialog2() {
|
|
|
30770
30798
|
}
|
|
30771
30799
|
);
|
|
30772
30800
|
}
|
|
30773
|
-
var
|
|
30801
|
+
var import_react103, import_react104, import_jsx_runtime135;
|
|
30774
30802
|
var init_Dialog = __esm({
|
|
30775
30803
|
"src/internal/components/Dialog/Dialog.tsx"() {
|
|
30776
30804
|
init_ProviderContext();
|
|
30777
30805
|
init_SessionContext();
|
|
30778
|
-
|
|
30779
|
-
|
|
30806
|
+
import_react103 = require("motion/react");
|
|
30807
|
+
import_react104 = require("react");
|
|
30780
30808
|
init_constants();
|
|
30809
|
+
init_useAllowExternalModalsScroll();
|
|
30781
30810
|
init_useAutoConnect();
|
|
30782
30811
|
init_useBackupStatusChanges();
|
|
30783
30812
|
init_useDetectMaxScrollHeight();
|
|
@@ -30808,12 +30837,12 @@ function DirectWalletHandler() {
|
|
|
30808
30837
|
const externalAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
30809
30838
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
30810
30839
|
const { address, isConnected, chain, connector } = (0, import_wagmi10.useConnection)();
|
|
30811
|
-
(0,
|
|
30840
|
+
(0, import_react105.useEffect)(() => {
|
|
30812
30841
|
const { setConfigMode, setActiveMode } = useExternalWalletStore.getState();
|
|
30813
30842
|
setConfigMode(walletMode);
|
|
30814
30843
|
if (walletMode !== "both") setActiveMode(walletMode);
|
|
30815
30844
|
}, [walletMode]);
|
|
30816
|
-
(0,
|
|
30845
|
+
(0, import_react105.useEffect)(() => {
|
|
30817
30846
|
if ((!!externalAddress || isExternalConnected) && !isConnected) {
|
|
30818
30847
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
30819
30848
|
return;
|
|
@@ -30828,10 +30857,10 @@ function DirectWalletHandler() {
|
|
|
30828
30857
|
}, [isConnected, address, isExternalConnected, externalAddress, connector, chain]);
|
|
30829
30858
|
return null;
|
|
30830
30859
|
}
|
|
30831
|
-
var
|
|
30860
|
+
var import_react105, import_wagmi10;
|
|
30832
30861
|
var init_DirectWalletHandler = __esm({
|
|
30833
30862
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
30834
|
-
|
|
30863
|
+
import_react105 = require("react");
|
|
30835
30864
|
import_wagmi10 = require("wagmi");
|
|
30836
30865
|
init_ProviderContext();
|
|
30837
30866
|
init_useExternalWalletStore();
|
|
@@ -30839,14 +30868,14 @@ var init_DirectWalletHandler = __esm({
|
|
|
30839
30868
|
});
|
|
30840
30869
|
|
|
30841
30870
|
// src/internal/components/TssManager.tsx
|
|
30842
|
-
var
|
|
30871
|
+
var import_react106, TssManagerWithRef;
|
|
30843
30872
|
var init_TssManager = __esm({
|
|
30844
30873
|
"src/internal/components/TssManager.tsx"() {
|
|
30845
30874
|
init_SessionContext();
|
|
30846
|
-
|
|
30875
|
+
import_react106 = __toESM(require("react"), 1);
|
|
30847
30876
|
init_auth();
|
|
30848
30877
|
init_clients();
|
|
30849
|
-
TssManagerWithRef =
|
|
30878
|
+
TssManagerWithRef = import_react106.default.forwardRef((props, ref) => {
|
|
30850
30879
|
const { mpcPin } = props;
|
|
30851
30880
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
30852
30881
|
const publicClient = useSession((st) => st.publicClient);
|
|
@@ -30854,14 +30883,14 @@ var init_TssManager = __esm({
|
|
|
30854
30883
|
const setStatus = useSession((st) => st.setStatus);
|
|
30855
30884
|
const setSession = useSession((st) => st.setSession);
|
|
30856
30885
|
const setAddress = useSession((st) => st.setAddress);
|
|
30857
|
-
const onSessionCreated = (0,
|
|
30886
|
+
const onSessionCreated = (0, import_react106.useCallback)(
|
|
30858
30887
|
(session, address) => {
|
|
30859
30888
|
setSession(session);
|
|
30860
30889
|
setAddress(address);
|
|
30861
30890
|
},
|
|
30862
30891
|
[setSession, setAddress]
|
|
30863
30892
|
);
|
|
30864
|
-
const createSessionWithKeyshare =
|
|
30893
|
+
const createSessionWithKeyshare = import_react106.default.useCallback(
|
|
30865
30894
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
30866
30895
|
setStatus("checking key management setup...");
|
|
30867
30896
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -30886,7 +30915,7 @@ var init_TssManager = __esm({
|
|
|
30886
30915
|
},
|
|
30887
30916
|
[setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
|
|
30888
30917
|
);
|
|
30889
|
-
|
|
30918
|
+
import_react106.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
30890
30919
|
return null;
|
|
30891
30920
|
});
|
|
30892
30921
|
}
|
|
@@ -30910,7 +30939,7 @@ function waitForStoreHydration() {
|
|
|
30910
30939
|
}
|
|
30911
30940
|
function SessionProvider({ children }) {
|
|
30912
30941
|
const config = useProviderConfig().config;
|
|
30913
|
-
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
|
|
30942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_react107.Fragment, {
|
|
30914
30943
|
/** dApp's router might have its own error boundaries setup via imported @embarkai/ui-kitErrorBoundary */
|
|
30915
30944
|
children: [
|
|
30916
30945
|
children,
|
|
@@ -30930,11 +30959,11 @@ function SessionProvider({ children }) {
|
|
|
30930
30959
|
]
|
|
30931
30960
|
});
|
|
30932
30961
|
}
|
|
30933
|
-
var import_read22,
|
|
30962
|
+
var import_read22, import_react107, import_zustand19, import_middleware5, import_jsx_runtime136, useSession, requireActiveChainId;
|
|
30934
30963
|
var init_SessionContext = __esm({
|
|
30935
30964
|
"src/context/SessionContext.tsx"() {
|
|
30936
30965
|
import_read22 = require("@embarkai/core/read");
|
|
30937
|
-
|
|
30966
|
+
import_react107 = require("react");
|
|
30938
30967
|
import_zustand19 = require("zustand");
|
|
30939
30968
|
import_middleware5 = require("zustand/middleware");
|
|
30940
30969
|
init_ErrorBoundary2();
|
|
@@ -33389,11 +33418,11 @@ function clearLegacyWagmiStorage() {
|
|
|
33389
33418
|
}
|
|
33390
33419
|
function Provider(props) {
|
|
33391
33420
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
33392
|
-
const callbacksRef = (0,
|
|
33393
|
-
(0,
|
|
33394
|
-
const config = (0,
|
|
33395
|
-
const wagmiConfig3 = (0,
|
|
33396
|
-
const updateConfig = (0,
|
|
33421
|
+
const callbacksRef = (0, import_react108.useRef)(callbacks);
|
|
33422
|
+
(0, import_react108.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
33423
|
+
const config = (0, import_react108.useRef)((0, import_lodash_es18.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
33424
|
+
const wagmiConfig3 = (0, import_react108.useRef)((0, import_core9.getWagmiConfig)(config.current?.wallet?.walletConnectId || null));
|
|
33425
|
+
const updateConfig = (0, import_react108.useCallback)((updates) => {
|
|
33397
33426
|
const prev = config.current;
|
|
33398
33427
|
const next = { ...prev };
|
|
33399
33428
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -33427,12 +33456,12 @@ function Provider(props) {
|
|
|
33427
33456
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
33428
33457
|
config.current = next;
|
|
33429
33458
|
}, []);
|
|
33430
|
-
const updateCallbacks = (0,
|
|
33459
|
+
const updateCallbacks = (0, import_react108.useCallback)((updates) => {
|
|
33431
33460
|
const prev = callbacksRef.current;
|
|
33432
33461
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
33433
33462
|
callbacksRef.current = next;
|
|
33434
33463
|
}, []);
|
|
33435
|
-
(0,
|
|
33464
|
+
(0, import_react108.useEffect)(() => {
|
|
33436
33465
|
if (typeof window === "undefined" || !projectId) return;
|
|
33437
33466
|
const mergedConfig = (0, import_lodash_es18.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
33438
33467
|
updateConfig(mergedConfig);
|
|
@@ -33452,7 +33481,7 @@ function Provider(props) {
|
|
|
33452
33481
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
33453
33482
|
}
|
|
33454
33483
|
}, [projectId, initialConfig]);
|
|
33455
|
-
(0,
|
|
33484
|
+
(0, import_react108.useEffect)(() => {
|
|
33456
33485
|
if (typeof window === "undefined" || !projectId) return;
|
|
33457
33486
|
try {
|
|
33458
33487
|
(0, import_error_tracking4.initSdkErrorTracking)();
|
|
@@ -33481,7 +33510,7 @@ function Provider(props) {
|
|
|
33481
33510
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
33482
33511
|
}
|
|
33483
33512
|
}, [projectId]);
|
|
33484
|
-
const contextValue = (0,
|
|
33513
|
+
const contextValue = (0, import_react108.useMemo)(
|
|
33485
33514
|
() => ({
|
|
33486
33515
|
config,
|
|
33487
33516
|
updateConfig,
|
|
@@ -33494,22 +33523,22 @@ function Provider(props) {
|
|
|
33494
33523
|
);
|
|
33495
33524
|
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_wagmi11.WagmiProvider, { config: wagmiConfig3.current, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(SessionProvider, { children }) }) });
|
|
33496
33525
|
}
|
|
33497
|
-
var import_core9, import_error_tracking4, import_lodash_es18,
|
|
33526
|
+
var import_core9, import_error_tracking4, import_lodash_es18, import_react108, import_wagmi11, import_jsx_runtime137, UIContext, useProviderConfig;
|
|
33498
33527
|
var init_ProviderContext = __esm({
|
|
33499
33528
|
"src/context/ProviderContext.tsx"() {
|
|
33500
33529
|
import_core9 = require("@embarkai/core");
|
|
33501
33530
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
33502
33531
|
import_lodash_es18 = require("lodash-es");
|
|
33503
|
-
|
|
33532
|
+
import_react108 = require("react");
|
|
33504
33533
|
import_wagmi11 = require("wagmi");
|
|
33505
33534
|
init_initial();
|
|
33506
33535
|
init_iframe_manager();
|
|
33507
33536
|
init_SessionContext();
|
|
33508
33537
|
init_utils14();
|
|
33509
33538
|
import_jsx_runtime137 = require("react/jsx-runtime");
|
|
33510
|
-
UIContext = (0,
|
|
33539
|
+
UIContext = (0, import_react108.createContext)(void 0);
|
|
33511
33540
|
useProviderConfig = () => {
|
|
33512
|
-
const ctx = (0,
|
|
33541
|
+
const ctx = (0, import_react108.useContext)(UIContext);
|
|
33513
33542
|
if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
|
|
33514
33543
|
return ctx;
|
|
33515
33544
|
};
|
|
@@ -33632,7 +33661,7 @@ init_ErrorBoundary2();
|
|
|
33632
33661
|
init_lumia2();
|
|
33633
33662
|
init_embarkAI2();
|
|
33634
33663
|
var import_lucide_react86 = require("lucide-react");
|
|
33635
|
-
var
|
|
33664
|
+
var import_react109 = require("react");
|
|
33636
33665
|
init_SessionContext();
|
|
33637
33666
|
init_auth();
|
|
33638
33667
|
init_BalanceView2();
|
|
@@ -33665,10 +33694,10 @@ function ConnectWalletButton(props) {
|
|
|
33665
33694
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
33666
33695
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
33667
33696
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
33668
|
-
(0,
|
|
33697
|
+
(0, import_react109.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
33669
33698
|
const { data: profile, isLoading: isProfileLoading } = useUserProfile();
|
|
33670
33699
|
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth25.jwtTokenManager.getDisplayName();
|
|
33671
|
-
const indicators = (0,
|
|
33700
|
+
const indicators = (0, import_react109.useMemo)(() => {
|
|
33672
33701
|
const userId = session?.mpcUserId;
|
|
33673
33702
|
if (!userId) return { server: false, local: false, backup: false };
|
|
33674
33703
|
const server = import_auth25.jwtTokenManager.getHasKeyshare() ?? false;
|
|
@@ -34307,14 +34336,14 @@ var Hash = ({
|
|
|
34307
34336
|
};
|
|
34308
34337
|
|
|
34309
34338
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
34310
|
-
var
|
|
34339
|
+
var import_react110 = require("react");
|
|
34311
34340
|
init_base3();
|
|
34312
34341
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
34313
34342
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
34314
|
-
const [transactions, setTransactions] = (0,
|
|
34315
|
-
const [loading, setLoading] = (0,
|
|
34316
|
-
const [error, setError] = (0,
|
|
34317
|
-
(0,
|
|
34343
|
+
const [transactions, setTransactions] = (0, import_react110.useState)([]);
|
|
34344
|
+
const [loading, setLoading] = (0, import_react110.useState)(true);
|
|
34345
|
+
const [error, setError] = (0, import_react110.useState)(null);
|
|
34346
|
+
(0, import_react110.useEffect)(() => {
|
|
34318
34347
|
const fetchTransactions2 = async () => {
|
|
34319
34348
|
try {
|
|
34320
34349
|
setLoading(true);
|
|
@@ -34605,13 +34634,13 @@ function useUserOpStatus(options = {}) {
|
|
|
34605
34634
|
init_useErc3643Compliance();
|
|
34606
34635
|
|
|
34607
34636
|
// src/hooks/useWalletMode.ts
|
|
34608
|
-
var
|
|
34637
|
+
var import_react111 = require("react");
|
|
34609
34638
|
init_useExternalWalletStore();
|
|
34610
34639
|
function useWalletMode() {
|
|
34611
34640
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
34612
34641
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
34613
34642
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
34614
|
-
const switchMode = (0,
|
|
34643
|
+
const switchMode = (0, import_react111.useCallback)(
|
|
34615
34644
|
(mode) => {
|
|
34616
34645
|
if (configMode !== "both") return;
|
|
34617
34646
|
setActiveMode(mode);
|
|
@@ -34628,7 +34657,7 @@ function useWalletMode() {
|
|
|
34628
34657
|
|
|
34629
34658
|
// src/hooks/useDirectWallet.ts
|
|
34630
34659
|
init_useOpenPage();
|
|
34631
|
-
var
|
|
34660
|
+
var import_react112 = require("react");
|
|
34632
34661
|
var import_wagmi12 = require("wagmi");
|
|
34633
34662
|
init_useExternalWalletStore();
|
|
34634
34663
|
function useDirectWallet() {
|
|
@@ -34638,10 +34667,10 @@ function useDirectWallet() {
|
|
|
34638
34667
|
const connectorName = useExternalWalletStore((st) => st.connectorName);
|
|
34639
34668
|
const { open: openEmbarkAI } = useOpenPage();
|
|
34640
34669
|
const { mutate: wagmiDisconnect } = (0, import_wagmi12.useDisconnect)();
|
|
34641
|
-
const connect = (0,
|
|
34670
|
+
const connect = (0, import_react112.useCallback)((connectFlowType = "connect") => {
|
|
34642
34671
|
openEmbarkAI("connect-external-wallet" /* CONNECT_EXTERNAL_WALLET */, { connectFlowType });
|
|
34643
34672
|
}, []);
|
|
34644
|
-
const disconnect = (0,
|
|
34673
|
+
const disconnect = (0, import_react112.useCallback)(() => {
|
|
34645
34674
|
wagmiDisconnect();
|
|
34646
34675
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
34647
34676
|
}, [wagmiDisconnect]);
|
|
@@ -34657,7 +34686,7 @@ function useDirectWallet() {
|
|
|
34657
34686
|
}
|
|
34658
34687
|
|
|
34659
34688
|
// src/hooks/useSendDirectTransaction.ts
|
|
34660
|
-
var
|
|
34689
|
+
var import_react113 = require("react");
|
|
34661
34690
|
var import_viem23 = require("viem");
|
|
34662
34691
|
var import_wagmi13 = require("wagmi");
|
|
34663
34692
|
init_useExternalWalletStore();
|
|
@@ -34666,10 +34695,10 @@ function useSendDirectTransaction() {
|
|
|
34666
34695
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
34667
34696
|
const { sendTransactionAsync } = (0, import_wagmi13.useSendTransaction)();
|
|
34668
34697
|
const { switchChainAsync } = (0, import_wagmi13.useSwitchChain)();
|
|
34669
|
-
const [isPending, setIsPending] = (0,
|
|
34670
|
-
const [error, setError] = (0,
|
|
34671
|
-
const [txHash, setTxHash] = (0,
|
|
34672
|
-
const sendTransaction = (0,
|
|
34698
|
+
const [isPending, setIsPending] = (0, import_react113.useState)(false);
|
|
34699
|
+
const [error, setError] = (0, import_react113.useState)(null);
|
|
34700
|
+
const [txHash, setTxHash] = (0, import_react113.useState)(null);
|
|
34701
|
+
const sendTransaction = (0, import_react113.useCallback)(
|
|
34673
34702
|
async (params) => {
|
|
34674
34703
|
if (!isConnected) {
|
|
34675
34704
|
setError("No external wallet connected");
|
|
@@ -34689,7 +34718,8 @@ function useSendDirectTransaction() {
|
|
|
34689
34718
|
const hash = await sendTransactionAsync({
|
|
34690
34719
|
to: params.to,
|
|
34691
34720
|
value: (0, import_viem23.parseEther)(params.value),
|
|
34692
|
-
data: params.data
|
|
34721
|
+
data: params.data,
|
|
34722
|
+
gas: params.gas
|
|
34693
34723
|
});
|
|
34694
34724
|
setTxHash(hash);
|
|
34695
34725
|
return hash;
|
|
@@ -34703,7 +34733,7 @@ function useSendDirectTransaction() {
|
|
|
34703
34733
|
},
|
|
34704
34734
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
34705
34735
|
);
|
|
34706
|
-
const reset = (0,
|
|
34736
|
+
const reset = (0, import_react113.useCallback)(() => {
|
|
34707
34737
|
setError(null);
|
|
34708
34738
|
setTxHash(null);
|
|
34709
34739
|
setIsPending(false);
|
|
@@ -34712,7 +34742,7 @@ function useSendDirectTransaction() {
|
|
|
34712
34742
|
}
|
|
34713
34743
|
|
|
34714
34744
|
// src/hooks/useTransferToLinkedWallet.ts
|
|
34715
|
-
var
|
|
34745
|
+
var import_react114 = require("react");
|
|
34716
34746
|
var import_viem24 = require("viem");
|
|
34717
34747
|
init_SessionContext();
|
|
34718
34748
|
init_account2();
|
|
@@ -34731,14 +34761,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
34731
34761
|
function useTransferToLinkedWallet() {
|
|
34732
34762
|
const session = useSession((st) => st.session);
|
|
34733
34763
|
const { profiles } = useLinkedProfiles();
|
|
34734
|
-
const [isPending, setIsPending] = (0,
|
|
34735
|
-
const [error, setError] = (0,
|
|
34736
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
34737
|
-
const linkedWallets = (0,
|
|
34764
|
+
const [isPending, setIsPending] = (0, import_react114.useState)(false);
|
|
34765
|
+
const [error, setError] = (0, import_react114.useState)(null);
|
|
34766
|
+
const [userOpHash, setUserOpHash] = (0, import_react114.useState)(null);
|
|
34767
|
+
const linkedWallets = (0, import_react114.useMemo)(
|
|
34738
34768
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
34739
34769
|
[profiles]
|
|
34740
34770
|
);
|
|
34741
|
-
const transfer = (0,
|
|
34771
|
+
const transfer = (0, import_react114.useCallback)(
|
|
34742
34772
|
async (params) => {
|
|
34743
34773
|
if (!session) {
|
|
34744
34774
|
setError("No active session");
|
|
@@ -34789,7 +34819,7 @@ function useTransferToLinkedWallet() {
|
|
|
34789
34819
|
},
|
|
34790
34820
|
[session, linkedWallets]
|
|
34791
34821
|
);
|
|
34792
|
-
const reset = (0,
|
|
34822
|
+
const reset = (0, import_react114.useCallback)(() => {
|
|
34793
34823
|
setError(null);
|
|
34794
34824
|
setUserOpHash(null);
|
|
34795
34825
|
setIsPending(false);
|
|
@@ -34813,7 +34843,7 @@ function useNativeWalletSignature() {
|
|
|
34813
34843
|
|
|
34814
34844
|
// src/hooks/useLogout.ts
|
|
34815
34845
|
var import_auth27 = require("@embarkai/core/auth");
|
|
34816
|
-
var
|
|
34846
|
+
var import_react115 = require("react");
|
|
34817
34847
|
var import_wagmi15 = require("wagmi");
|
|
34818
34848
|
init_ProviderContext();
|
|
34819
34849
|
init_SessionContext();
|
|
@@ -34832,7 +34862,7 @@ function useLogout() {
|
|
|
34832
34862
|
}
|
|
34833
34863
|
}
|
|
34834
34864
|
});
|
|
34835
|
-
const logout2 = (0,
|
|
34865
|
+
const logout2 = (0, import_react115.useCallback)(async () => {
|
|
34836
34866
|
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
34837
34867
|
const prevAddress = address;
|
|
34838
34868
|
let userId = null;
|
|
@@ -34951,7 +34981,7 @@ function useTransactions() {
|
|
|
34951
34981
|
|
|
34952
34982
|
// src/modules/assets.ts
|
|
34953
34983
|
init_SessionContext();
|
|
34954
|
-
var
|
|
34984
|
+
var import_react116 = __toESM(require("react"), 1);
|
|
34955
34985
|
var import_viem26 = require("viem");
|
|
34956
34986
|
var import_wagmi17 = require("wagmi");
|
|
34957
34987
|
var COMMON_TOKENS = [
|
|
@@ -35106,7 +35136,7 @@ function useTokenBalance2(tokenAddress, userAddress) {
|
|
|
35106
35136
|
}
|
|
35107
35137
|
});
|
|
35108
35138
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
35109
|
-
const formattedBalance =
|
|
35139
|
+
const formattedBalance = import_react116.default.useMemo(() => {
|
|
35110
35140
|
if (!balance || !tokenInfo) return "0";
|
|
35111
35141
|
return (0, import_viem26.formatUnits)(balance, tokenInfo.decimals);
|
|
35112
35142
|
}, [balance, tokenInfo]);
|