@embarkai/ui-kit 0.4.108 → 0.4.110
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 +539 -510
- package/dist/index.js +176 -147
- 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();
|
|
@@ -15718,10 +15744,11 @@ function someInErrorChain(error, predicate) {
|
|
|
15718
15744
|
}
|
|
15719
15745
|
return false;
|
|
15720
15746
|
}
|
|
15721
|
-
function dropFailedConnectorSession(error, connector, wagmiConfig3) {
|
|
15747
|
+
async function dropFailedConnectorSession(error, connector, wagmiConfig3) {
|
|
15748
|
+
if (connector.type !== "walletConnect") return;
|
|
15722
15749
|
if (isRequestPendingError(error) || isUserRejectedError(error)) return;
|
|
15723
15750
|
if (wagmiConfig3.state.connections.has(connector.uid)) return;
|
|
15724
|
-
connector.disconnect().catch(() => {
|
|
15751
|
+
await connector.disconnect().catch(() => {
|
|
15725
15752
|
});
|
|
15726
15753
|
}
|
|
15727
15754
|
var REQUEST_PENDING_ERROR_CODE, USER_REJECTED_ERROR_CODE, isRequestPendingError, isUserRejectedError, isUnsupportedChainError;
|
|
@@ -15839,16 +15866,16 @@ function useLinkedProfiles() {
|
|
|
15839
15866
|
}
|
|
15840
15867
|
});
|
|
15841
15868
|
const { profiles = [], avatar = null } = data || {};
|
|
15842
|
-
const refresh = (0,
|
|
15869
|
+
const refresh = (0, import_react40.useCallback)(async () => {
|
|
15843
15870
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15844
15871
|
}, [qc, address]);
|
|
15845
15872
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
15846
15873
|
}
|
|
15847
|
-
var import_react_query17,
|
|
15874
|
+
var import_react_query17, import_react40, LINKED_PROFILES_QUERY_KEY;
|
|
15848
15875
|
var init_linkedProfiles = __esm({
|
|
15849
15876
|
"src/modules/linkedProfiles.ts"() {
|
|
15850
15877
|
import_react_query17 = require("@tanstack/react-query");
|
|
15851
|
-
|
|
15878
|
+
import_react40 = require("react");
|
|
15852
15879
|
init_SessionContext();
|
|
15853
15880
|
init_auth();
|
|
15854
15881
|
init_common();
|
|
@@ -16586,7 +16613,7 @@ function useLinkSocial() {
|
|
|
16586
16613
|
} = useProviderConfig();
|
|
16587
16614
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16588
16615
|
const { providerType, linkIsLoading, setProviderType, setAlert, setLinkIsLoading } = useManageWalletStore();
|
|
16589
|
-
const handleLinkSocialProvider =
|
|
16616
|
+
const handleLinkSocialProvider = import_react41.default.useCallback(
|
|
16590
16617
|
async (providerIdRaw) => {
|
|
16591
16618
|
const providerKey = providerIdRaw.toLowerCase();
|
|
16592
16619
|
const normalizedKey = providerKey === "twitter" ? "x" : providerKey;
|
|
@@ -16644,8 +16671,8 @@ function useLinkSocial() {
|
|
|
16644
16671
|
},
|
|
16645
16672
|
[config.social?.providers]
|
|
16646
16673
|
);
|
|
16647
|
-
const [socialLinkStarted, setSocialLinkStarted] =
|
|
16648
|
-
(0,
|
|
16674
|
+
const [socialLinkStarted, setSocialLinkStarted] = import_react41.default.useState(false);
|
|
16675
|
+
(0, import_react41.useEffect)(() => {
|
|
16649
16676
|
const key = providerType?.toLowerCase();
|
|
16650
16677
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted });
|
|
16651
16678
|
if (key && key !== "telegram" && key !== "email" && key !== "passkey" && key !== "wallet") {
|
|
@@ -16659,7 +16686,7 @@ function useLinkSocial() {
|
|
|
16659
16686
|
}
|
|
16660
16687
|
}, [providerType, linkIsLoading, socialLinkStarted, handleLinkSocialProvider]);
|
|
16661
16688
|
}
|
|
16662
|
-
var import_react_query22,
|
|
16689
|
+
var import_react_query22, import_react41;
|
|
16663
16690
|
var init_useLinkSocial = __esm({
|
|
16664
16691
|
"src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts"() {
|
|
16665
16692
|
init_useLayoutDataStore();
|
|
@@ -16667,7 +16694,7 @@ var init_useLinkSocial = __esm({
|
|
|
16667
16694
|
init_SessionContext();
|
|
16668
16695
|
init_linkedProfiles();
|
|
16669
16696
|
import_react_query22 = require("@tanstack/react-query");
|
|
16670
|
-
|
|
16697
|
+
import_react41 = __toESM(require("react"), 1);
|
|
16671
16698
|
init_auth();
|
|
16672
16699
|
init_telegramBrowser();
|
|
16673
16700
|
init_useProvidersList();
|
|
@@ -16735,7 +16762,7 @@ function useLinkTelegram() {
|
|
|
16735
16762
|
const address = useSession((st) => st.address);
|
|
16736
16763
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16737
16764
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16738
|
-
const handleLinkTelegram = (0,
|
|
16765
|
+
const handleLinkTelegram = (0, import_react42.useCallback)(async () => {
|
|
16739
16766
|
try {
|
|
16740
16767
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16741
16768
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16782,8 +16809,8 @@ function useLinkTelegram() {
|
|
|
16782
16809
|
setLinkIsLoading(false);
|
|
16783
16810
|
}
|
|
16784
16811
|
}, [config.social?.providers]);
|
|
16785
|
-
const [telegramLinkStarted, setTelegramLinkStarted] = (0,
|
|
16786
|
-
(0,
|
|
16812
|
+
const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react42.useState)(false);
|
|
16813
|
+
(0, import_react42.useEffect)(() => {
|
|
16787
16814
|
console.log("[useLinkTelegram] Effect triggered:", { providerType, linkIsLoading, telegramLinkStarted });
|
|
16788
16815
|
if (providerType === "telegram" && !linkIsLoading && !telegramLinkStarted) {
|
|
16789
16816
|
console.log("[useLinkTelegram] Starting Telegram link flow");
|
|
@@ -16791,20 +16818,20 @@ function useLinkTelegram() {
|
|
|
16791
16818
|
handleLinkTelegram();
|
|
16792
16819
|
}
|
|
16793
16820
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted]);
|
|
16794
|
-
(0,
|
|
16821
|
+
(0, import_react42.useEffect)(() => {
|
|
16795
16822
|
if (providerType !== "telegram") {
|
|
16796
16823
|
setTelegramLinkStarted(false);
|
|
16797
16824
|
}
|
|
16798
16825
|
}, [providerType]);
|
|
16799
16826
|
}
|
|
16800
|
-
var import_react_query23,
|
|
16827
|
+
var import_react_query23, import_react42;
|
|
16801
16828
|
var init_useLinkTelegram = __esm({
|
|
16802
16829
|
"src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts"() {
|
|
16803
16830
|
init_ProviderContext();
|
|
16804
16831
|
init_SessionContext();
|
|
16805
16832
|
init_linkedProfiles();
|
|
16806
16833
|
import_react_query23 = require("@tanstack/react-query");
|
|
16807
|
-
|
|
16834
|
+
import_react42 = require("react");
|
|
16808
16835
|
init_telegram2();
|
|
16809
16836
|
init_useLayoutDataStore();
|
|
16810
16837
|
init_telegramBrowser();
|
|
@@ -17004,7 +17031,7 @@ function ManageWalletMenu() {
|
|
|
17004
17031
|
} = useManageWalletStore();
|
|
17005
17032
|
const configuredProviders = getConfiguredProviders(config.current);
|
|
17006
17033
|
const { data: providers = [], isLoading: isProvidersLoading, error: providersError } = useProvidersList();
|
|
17007
|
-
const renderProviders = (0,
|
|
17034
|
+
const renderProviders = (0, import_react43.useMemo)(() => {
|
|
17008
17035
|
const normalizeProviderName = (name) => {
|
|
17009
17036
|
if (name === "x") return "twitter";
|
|
17010
17037
|
return name;
|
|
@@ -17129,7 +17156,7 @@ function ManageWalletMenu() {
|
|
|
17129
17156
|
] })
|
|
17130
17157
|
] });
|
|
17131
17158
|
}
|
|
17132
|
-
var import_lodash_es11, import_lucide_react31,
|
|
17159
|
+
var import_lodash_es11, import_lucide_react31, import_react43, import_jsx_runtime72, POSSIBLE_PROVIDERS, MULTI_PROVIDERS;
|
|
17133
17160
|
var init_ManageWallet = __esm({
|
|
17134
17161
|
"src/internal/components/ManageWalletMenu/ManageWallet.tsx"() {
|
|
17135
17162
|
init_useLayoutDataStore();
|
|
@@ -17138,7 +17165,7 @@ var init_ManageWallet = __esm({
|
|
|
17138
17165
|
init_i18n();
|
|
17139
17166
|
import_lodash_es11 = require("lodash-es");
|
|
17140
17167
|
import_lucide_react31 = require("lucide-react");
|
|
17141
|
-
|
|
17168
|
+
import_react43 = require("react");
|
|
17142
17169
|
init_constants();
|
|
17143
17170
|
init_telegramBrowser();
|
|
17144
17171
|
init_Expandable2();
|
|
@@ -17176,7 +17203,7 @@ function UnlinkProviderMenu() {
|
|
|
17176
17203
|
const { t } = useT();
|
|
17177
17204
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
17178
17205
|
const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
|
|
17179
|
-
const [confirmInput, setConfirmInput] = (0,
|
|
17206
|
+
const [confirmInput, setConfirmInput] = (0, import_react44.useState)("");
|
|
17180
17207
|
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0, import_react_query24.useMutation)({
|
|
17181
17208
|
mutationFn: async () => {
|
|
17182
17209
|
if (!confirmUnlink) {
|
|
@@ -17258,7 +17285,7 @@ function UnlinkProviderMenu() {
|
|
|
17258
17285
|
] })
|
|
17259
17286
|
] });
|
|
17260
17287
|
}
|
|
17261
|
-
var import_react_query24, import_lucide_react32,
|
|
17288
|
+
var import_react_query24, import_lucide_react32, import_react44, import_wagmi2, import_jsx_runtime73;
|
|
17262
17289
|
var init_UnlinkProviderMenu = __esm({
|
|
17263
17290
|
"src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
|
|
17264
17291
|
init_useLayoutDataStore();
|
|
@@ -17268,7 +17295,7 @@ var init_UnlinkProviderMenu = __esm({
|
|
|
17268
17295
|
init_linkedProfiles();
|
|
17269
17296
|
import_react_query24 = require("@tanstack/react-query");
|
|
17270
17297
|
import_lucide_react32 = require("lucide-react");
|
|
17271
|
-
|
|
17298
|
+
import_react44 = require("react");
|
|
17272
17299
|
import_wagmi2 = require("wagmi");
|
|
17273
17300
|
init_auth();
|
|
17274
17301
|
init_useExternalWalletStore();
|
|
@@ -17309,8 +17336,8 @@ var init_ManageWalletMenu = __esm({
|
|
|
17309
17336
|
|
|
17310
17337
|
// src/internal/components/ConnectExternalWalletMenu/useConnectExternalWalletMenuParams.ts
|
|
17311
17338
|
function useConnectExternalWalletMenuParams() {
|
|
17312
|
-
const paramsRef = (0,
|
|
17313
|
-
(0,
|
|
17339
|
+
const paramsRef = (0, import_react45.useRef)(null);
|
|
17340
|
+
(0, import_react45.useEffect)(() => {
|
|
17314
17341
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
17315
17342
|
if (!pageParams || !(0, import_lodash_es12.keys)(pageParams).length) return;
|
|
17316
17343
|
paramsRef.current = pageParams;
|
|
@@ -17318,11 +17345,11 @@ function useConnectExternalWalletMenuParams() {
|
|
|
17318
17345
|
}, []);
|
|
17319
17346
|
return paramsRef;
|
|
17320
17347
|
}
|
|
17321
|
-
var import_lodash_es12,
|
|
17348
|
+
var import_lodash_es12, import_react45;
|
|
17322
17349
|
var init_useConnectExternalWalletMenuParams = __esm({
|
|
17323
17350
|
"src/internal/components/ConnectExternalWalletMenu/useConnectExternalWalletMenuParams.ts"() {
|
|
17324
17351
|
import_lodash_es12 = require("lodash-es");
|
|
17325
|
-
|
|
17352
|
+
import_react45 = require("react");
|
|
17326
17353
|
init_useLayoutDataStore();
|
|
17327
17354
|
}
|
|
17328
17355
|
});
|
|
@@ -17333,18 +17360,18 @@ function hasInjectedWallet() {
|
|
|
17333
17360
|
return mipdStore.getProviders().length > 0 || !!window.ethereum;
|
|
17334
17361
|
}
|
|
17335
17362
|
function useHasInjectedWallet() {
|
|
17336
|
-
return (0,
|
|
17363
|
+
return (0, import_react46.useSyncExternalStore)(
|
|
17337
17364
|
(onStoreChange) => mipdStore?.subscribe(onStoreChange) ?? (() => {
|
|
17338
17365
|
}),
|
|
17339
17366
|
hasInjectedWallet,
|
|
17340
17367
|
() => false
|
|
17341
17368
|
);
|
|
17342
17369
|
}
|
|
17343
|
-
var import_mipd,
|
|
17370
|
+
var import_mipd, import_react46, mipdStore;
|
|
17344
17371
|
var init_useHasInjectedWallet = __esm({
|
|
17345
17372
|
"src/internal/components/ConnectExternalWalletMenu/useHasInjectedWallet.ts"() {
|
|
17346
17373
|
import_mipd = require("mipd");
|
|
17347
|
-
|
|
17374
|
+
import_react46 = require("react");
|
|
17348
17375
|
mipdStore = typeof window !== "undefined" ? (0, import_mipd.createStore)() : void 0;
|
|
17349
17376
|
}
|
|
17350
17377
|
});
|
|
@@ -17372,7 +17399,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17372
17399
|
const { mutateAsync: signMessageAsync } = (0, import_wagmi3.useSignMessage)();
|
|
17373
17400
|
const { mutateAsync: switchChainAsync } = (0, import_wagmi3.useSwitchChain)();
|
|
17374
17401
|
const { mutateAsync: switchConnectionAsync } = (0, import_wagmi3.useSwitchConnection)();
|
|
17375
|
-
const [isPreparingConnect, setIsPreparingConnect] = (0,
|
|
17402
|
+
const [isPreparingConnect, setIsPreparingConnect] = (0, import_react47.useState)(false);
|
|
17376
17403
|
const signOnSupportedChain = async (params) => {
|
|
17377
17404
|
const { connector, account, message } = params;
|
|
17378
17405
|
const signOnce = async (viaFallback = false) => {
|
|
@@ -17398,7 +17425,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17398
17425
|
queryKey: [PROVIDERS_QUERY_KEY, embarkAiAddress],
|
|
17399
17426
|
queryFn: async () => getLinkedProviders()
|
|
17400
17427
|
});
|
|
17401
|
-
const [connectError, setConnectError] = (0,
|
|
17428
|
+
const [connectError, setConnectError] = (0, import_react47.useState)(null);
|
|
17402
17429
|
const { mutateAsync: onLinkingComplete } = (0, import_react_query25.useMutation)({
|
|
17403
17430
|
mutationFn: async (success) => {
|
|
17404
17431
|
useManageWalletStore.getState().setProviderType(null);
|
|
@@ -17519,7 +17546,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17519
17546
|
onError: (error, { connector }) => reportConnectError(error, connector)
|
|
17520
17547
|
}
|
|
17521
17548
|
});
|
|
17522
|
-
function reportConnectError(error, connector) {
|
|
17549
|
+
async function reportConnectError(error, connector) {
|
|
17523
17550
|
const connectFlowType = getConnectFlowType({
|
|
17524
17551
|
isEmbarkAI: !!embarkAiAddress,
|
|
17525
17552
|
connectFlow: menuParams.current?.connectFlowType || "auth"
|
|
@@ -17528,7 +17555,6 @@ function ConnectExternalWalletMenu() {
|
|
|
17528
17555
|
if (!isRequestPending && connectFlowType !== "connect" && wagmiConfig3.state.connections.has(connector.uid)) {
|
|
17529
17556
|
disconnect({ connector });
|
|
17530
17557
|
}
|
|
17531
|
-
dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17532
17558
|
const errorMessage = isRequestPending ? (
|
|
17533
17559
|
// @ts-expect-error i18n typing
|
|
17534
17560
|
t("passport:connectMenu.requestPending", { wallet: connector.name })
|
|
@@ -17551,8 +17577,9 @@ function ConnectExternalWalletMenu() {
|
|
|
17551
17577
|
}
|
|
17552
17578
|
useLayoutStore.getState().setIsDialogForced(false);
|
|
17553
17579
|
}, 100);
|
|
17580
|
+
await dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17554
17581
|
}
|
|
17555
|
-
const visibleConnectors = (0,
|
|
17582
|
+
const visibleConnectors = (0, import_react47.useMemo)(() => {
|
|
17556
17583
|
const seen = /* @__PURE__ */ new Set();
|
|
17557
17584
|
const unique = connectors.filter((connector) => {
|
|
17558
17585
|
const skipConnector = seen.has(connector.uid);
|
|
@@ -17570,7 +17597,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17570
17597
|
(connector) => allowed.includes(connector.id.toLowerCase()) || allowed.includes(connector.name.toLowerCase())
|
|
17571
17598
|
);
|
|
17572
17599
|
}, [connectors, allowedWallets, hasInjectedWallet2]);
|
|
17573
|
-
const getInstructionSteps = (0,
|
|
17600
|
+
const getInstructionSteps = (0, import_react47.useCallback)(() => {
|
|
17574
17601
|
const connectFlowType = getConnectFlowType({
|
|
17575
17602
|
isEmbarkAI: !!embarkAiAddress,
|
|
17576
17603
|
connectFlow: menuParams.current?.connectFlowType || "auth"
|
|
@@ -17629,7 +17656,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17629
17656
|
await disconnectAsync({ connector: connectedConnector });
|
|
17630
17657
|
}
|
|
17631
17658
|
} catch (error) {
|
|
17632
|
-
reportConnectError(error, connector);
|
|
17659
|
+
await reportConnectError(error, connector);
|
|
17633
17660
|
return;
|
|
17634
17661
|
} finally {
|
|
17635
17662
|
setIsPreparingConnect(false);
|
|
@@ -17685,7 +17712,7 @@ function ConnectExternalWalletMenu() {
|
|
|
17685
17712
|
] })
|
|
17686
17713
|
] });
|
|
17687
17714
|
}
|
|
17688
|
-
var import_react_query25, import_lucide_react33,
|
|
17715
|
+
var import_react_query25, import_lucide_react33, import_react47, import_wagmi3, import_chains, import_jsx_runtime74, SIGN_FALLBACK_CHAIN_ID;
|
|
17689
17716
|
var init_ConnectExternalWalletMenu = __esm({
|
|
17690
17717
|
"src/internal/components/ConnectExternalWalletMenu/ConnectExternalWalletMenu.tsx"() {
|
|
17691
17718
|
init_ProviderContext();
|
|
@@ -17697,7 +17724,7 @@ var init_ConnectExternalWalletMenu = __esm({
|
|
|
17697
17724
|
init_linkedProfiles();
|
|
17698
17725
|
import_react_query25 = require("@tanstack/react-query");
|
|
17699
17726
|
import_lucide_react33 = require("lucide-react");
|
|
17700
|
-
|
|
17727
|
+
import_react47 = require("react");
|
|
17701
17728
|
import_wagmi3 = require("wagmi");
|
|
17702
17729
|
import_chains = require("wagmi/chains");
|
|
17703
17730
|
init_common();
|
|
@@ -17737,8 +17764,8 @@ function useExternalWalletConnnect(options) {
|
|
|
17737
17764
|
onSuccess?.({ connected: true, address: signingWalletAddress });
|
|
17738
17765
|
useLayoutStore.getState().setIsDialogForced(false);
|
|
17739
17766
|
},
|
|
17740
|
-
onError: (error, { connector }) => {
|
|
17741
|
-
dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17767
|
+
onError: async (error, { connector }) => {
|
|
17768
|
+
await dropFailedConnectorSession(error, connector, wagmiConfig3);
|
|
17742
17769
|
onError?.({
|
|
17743
17770
|
connected: false,
|
|
17744
17771
|
connector: connector?.name || "Unknown Wallet",
|
|
@@ -17748,7 +17775,7 @@ function useExternalWalletConnnect(options) {
|
|
|
17748
17775
|
}
|
|
17749
17776
|
}
|
|
17750
17777
|
});
|
|
17751
|
-
const disconnectExternalWallet = (0,
|
|
17778
|
+
const disconnectExternalWallet = (0, import_react48.useCallback)(() => {
|
|
17752
17779
|
try {
|
|
17753
17780
|
disconnect();
|
|
17754
17781
|
} catch {
|
|
@@ -17756,7 +17783,7 @@ function useExternalWalletConnnect(options) {
|
|
|
17756
17783
|
}
|
|
17757
17784
|
useExternalWalletStore.getState().clearExternalWallet();
|
|
17758
17785
|
}, [disconnect]);
|
|
17759
|
-
const connectExternalWallet = (0,
|
|
17786
|
+
const connectExternalWallet = (0, import_react48.useCallback)(
|
|
17760
17787
|
async (walletConnectorType) => {
|
|
17761
17788
|
disconnectExternalWallet();
|
|
17762
17789
|
const connector = connectors.find((c) => c.id === walletConnectorType);
|
|
@@ -17779,11 +17806,11 @@ function useExternalWalletConnnect(options) {
|
|
|
17779
17806
|
...restUseConnect
|
|
17780
17807
|
};
|
|
17781
17808
|
}
|
|
17782
|
-
var
|
|
17809
|
+
var import_react48, import_wagmi4;
|
|
17783
17810
|
var init_useExternalWalletConnect = __esm({
|
|
17784
17811
|
"src/internal/components/ConnectExternalWalletMenu/useExternalWalletConnect.ts"() {
|
|
17785
17812
|
init_ProviderContext();
|
|
17786
|
-
|
|
17813
|
+
import_react48 = require("react");
|
|
17787
17814
|
import_wagmi4 = require("wagmi");
|
|
17788
17815
|
init_useLayoutStore();
|
|
17789
17816
|
init_connect_errors();
|
|
@@ -17876,8 +17903,8 @@ function getErrorMessage(err) {
|
|
|
17876
17903
|
function DeviceLinkScreen() {
|
|
17877
17904
|
const setPage = useLayoutDataStore((s) => s.setPage);
|
|
17878
17905
|
const { mutate: link, isPending } = useLinkDevice();
|
|
17879
|
-
const [code, setCode] = (0,
|
|
17880
|
-
const [error, setError] = (0,
|
|
17906
|
+
const [code, setCode] = (0, import_react49.useState)("");
|
|
17907
|
+
const [error, setError] = (0, import_react49.useState)(null);
|
|
17881
17908
|
const isValid = code.length === 6 && VALID_CHARS.test(code);
|
|
17882
17909
|
function handleCodeChange(value) {
|
|
17883
17910
|
const upper = value.toUpperCase().slice(0, 6);
|
|
@@ -17919,11 +17946,11 @@ function DeviceLinkScreen() {
|
|
|
17919
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" })
|
|
17920
17947
|
] });
|
|
17921
17948
|
}
|
|
17922
|
-
var import_lucide_react34,
|
|
17949
|
+
var import_lucide_react34, import_react49, import_jsx_runtime75, VALID_CHARS;
|
|
17923
17950
|
var init_DeviceLinkScreen = __esm({
|
|
17924
17951
|
"src/internal/components/DevicesMenu/DeviceLinkScreen.tsx"() {
|
|
17925
17952
|
import_lucide_react34 = require("lucide-react");
|
|
17926
|
-
|
|
17953
|
+
import_react49 = require("react");
|
|
17927
17954
|
init_devices();
|
|
17928
17955
|
init_useLayoutDataStore();
|
|
17929
17956
|
init_Expandable2();
|
|
@@ -18462,19 +18489,19 @@ function DeviceManageScreen() {
|
|
|
18462
18489
|
const userId = session?.mpcUserId || "";
|
|
18463
18490
|
const deviceId = pageParams?.deviceId;
|
|
18464
18491
|
const deviceName = pageParams?.deviceName;
|
|
18465
|
-
const guardianRef = (0,
|
|
18466
|
-
const [screen, setScreen] = (0,
|
|
18467
|
-
const [actionState, setActionState] = (0,
|
|
18468
|
-
const [password, setPassword] = (0,
|
|
18469
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
18470
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
18471
|
-
const [waitingConfirm, setWaitingConfirm] = (0,
|
|
18472
|
-
(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)(() => {
|
|
18473
18500
|
if (!statusMessage) return;
|
|
18474
18501
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
18475
18502
|
return () => clearTimeout(t);
|
|
18476
18503
|
}, [statusMessage]);
|
|
18477
|
-
(0,
|
|
18504
|
+
(0, import_react50.useEffect)(() => {
|
|
18478
18505
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
18479
18506
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
18480
18507
|
return;
|
|
@@ -18506,7 +18533,7 @@ function DeviceManageScreen() {
|
|
|
18506
18533
|
guardianRef.current?.close();
|
|
18507
18534
|
};
|
|
18508
18535
|
}, [deviceId]);
|
|
18509
|
-
const refreshList = (0,
|
|
18536
|
+
const refreshList = (0, import_react50.useCallback)(async () => {
|
|
18510
18537
|
const guardian = guardianRef.current;
|
|
18511
18538
|
if (!guardian || screen.step !== "connected") return;
|
|
18512
18539
|
try {
|
|
@@ -18515,7 +18542,7 @@ function DeviceManageScreen() {
|
|
|
18515
18542
|
} catch {
|
|
18516
18543
|
}
|
|
18517
18544
|
}, [screen]);
|
|
18518
|
-
const handleBackup = (0,
|
|
18545
|
+
const handleBackup = (0, import_react50.useCallback)(async () => {
|
|
18519
18546
|
const guardian = guardianRef.current;
|
|
18520
18547
|
const iframe6 = getIframeManager();
|
|
18521
18548
|
if (!guardian || !iframe6 || !userId) return;
|
|
@@ -18539,7 +18566,7 @@ function DeviceManageScreen() {
|
|
|
18539
18566
|
setActionState(null);
|
|
18540
18567
|
}
|
|
18541
18568
|
}, [password, userId, refreshList]);
|
|
18542
|
-
const handleOverwrite = (0,
|
|
18569
|
+
const handleOverwrite = (0, import_react50.useCallback)(async () => {
|
|
18543
18570
|
const guardian = guardianRef.current;
|
|
18544
18571
|
const iframe6 = getIframeManager();
|
|
18545
18572
|
if (!guardian || !iframe6 || !userId) return;
|
|
@@ -18559,7 +18586,7 @@ function DeviceManageScreen() {
|
|
|
18559
18586
|
setActionState(null);
|
|
18560
18587
|
}
|
|
18561
18588
|
}, [password, userId, refreshList]);
|
|
18562
|
-
const handleDelete = (0,
|
|
18589
|
+
const handleDelete = (0, import_react50.useCallback)(
|
|
18563
18590
|
async (keyshareId) => {
|
|
18564
18591
|
const guardian = guardianRef.current;
|
|
18565
18592
|
if (!guardian) return;
|
|
@@ -18746,12 +18773,12 @@ function DeviceManageScreen() {
|
|
|
18746
18773
|
] })
|
|
18747
18774
|
] });
|
|
18748
18775
|
}
|
|
18749
|
-
var import_lucide_react35,
|
|
18776
|
+
var import_lucide_react35, import_react50, import_jsx_runtime76;
|
|
18750
18777
|
var init_DeviceManageScreen = __esm({
|
|
18751
18778
|
"src/internal/components/DevicesMenu/DeviceManageScreen.tsx"() {
|
|
18752
18779
|
init_SessionContext();
|
|
18753
18780
|
import_lucide_react35 = require("lucide-react");
|
|
18754
|
-
|
|
18781
|
+
import_react50 = require("react");
|
|
18755
18782
|
init_guardian_backup();
|
|
18756
18783
|
init_useLayoutDataStore();
|
|
18757
18784
|
init_iframe_manager();
|
|
@@ -18770,11 +18797,11 @@ function DeviceRestoreScreen() {
|
|
|
18770
18797
|
const keyshareId = pageParams?.keyshareId;
|
|
18771
18798
|
const deviceId = pageParams?.deviceId;
|
|
18772
18799
|
const deviceName = pageParams?.deviceName;
|
|
18773
|
-
const [password, setPassword] = (0,
|
|
18774
|
-
const [isWorking, setIsWorking] = (0,
|
|
18775
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
18776
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
18777
|
-
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 () => {
|
|
18778
18805
|
if (!password || !keyshareId || !userId) return;
|
|
18779
18806
|
const iframe6 = getIframeManager();
|
|
18780
18807
|
if (!iframe6) {
|
|
@@ -18854,12 +18881,12 @@ function DeviceRestoreScreen() {
|
|
|
18854
18881
|
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "text-sm text-[var(--ui-kit-bg-error)] p-2 text-center", children: errorMessage })
|
|
18855
18882
|
] });
|
|
18856
18883
|
}
|
|
18857
|
-
var import_lucide_react36,
|
|
18884
|
+
var import_lucide_react36, import_react51, import_jsx_runtime77;
|
|
18858
18885
|
var init_DeviceRestoreScreen = __esm({
|
|
18859
18886
|
"src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx"() {
|
|
18860
18887
|
init_SessionContext();
|
|
18861
18888
|
import_lucide_react36 = require("lucide-react");
|
|
18862
|
-
|
|
18889
|
+
import_react51 = require("react");
|
|
18863
18890
|
init_guardian_backup();
|
|
18864
18891
|
init_useLayoutDataStore();
|
|
18865
18892
|
init_iframe_manager();
|
|
@@ -18879,8 +18906,8 @@ function truncateAddress(address) {
|
|
|
18879
18906
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
18880
18907
|
}
|
|
18881
18908
|
function DeviceRow({ device }) {
|
|
18882
|
-
const [confirmingUnlink, setConfirmingUnlink] = (0,
|
|
18883
|
-
const [unlinkError, setUnlinkError] = (0,
|
|
18909
|
+
const [confirmingUnlink, setConfirmingUnlink] = (0, import_react52.useState)(false);
|
|
18910
|
+
const [unlinkError, setUnlinkError] = (0, import_react52.useState)(null);
|
|
18884
18911
|
const { mutate: unlink, isPending } = useUnlinkDevice();
|
|
18885
18912
|
if (confirmingUnlink) {
|
|
18886
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: [
|
|
@@ -18981,11 +19008,11 @@ function DevicesMenu() {
|
|
|
18981
19008
|
] })
|
|
18982
19009
|
] });
|
|
18983
19010
|
}
|
|
18984
|
-
var import_lucide_react37,
|
|
19011
|
+
var import_lucide_react37, import_react52, import_jsx_runtime78;
|
|
18985
19012
|
var init_DevicesMenu = __esm({
|
|
18986
19013
|
"src/internal/components/DevicesMenu/DevicesMenu.tsx"() {
|
|
18987
19014
|
import_lucide_react37 = require("lucide-react");
|
|
18988
|
-
|
|
19015
|
+
import_react52 = require("react");
|
|
18989
19016
|
init_devices();
|
|
18990
19017
|
init_guardian_backup();
|
|
18991
19018
|
init_useLayoutDataStore();
|
|
@@ -19045,7 +19072,7 @@ function useOnRestoreSuccess() {
|
|
|
19045
19072
|
setStatus
|
|
19046
19073
|
} = useSession();
|
|
19047
19074
|
const { setError, setSuccess } = useRestoreStore();
|
|
19048
|
-
const createSessionWithKeyshare = (0,
|
|
19075
|
+
const createSessionWithKeyshare = (0, import_react53.useCallback)(
|
|
19049
19076
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
19050
19077
|
try {
|
|
19051
19078
|
try {
|
|
@@ -19086,7 +19113,7 @@ function useOnRestoreSuccess() {
|
|
|
19086
19113
|
},
|
|
19087
19114
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
19088
19115
|
);
|
|
19089
|
-
const onRestoreSuccess = (0,
|
|
19116
|
+
const onRestoreSuccess = (0, import_react53.useCallback)(async () => {
|
|
19090
19117
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
19091
19118
|
const verify = await verifyToken2();
|
|
19092
19119
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -19152,12 +19179,12 @@ function useOnRestoreSuccess() {
|
|
|
19152
19179
|
]);
|
|
19153
19180
|
return { onRestoreSuccess };
|
|
19154
19181
|
}
|
|
19155
|
-
var
|
|
19182
|
+
var import_react53;
|
|
19156
19183
|
var init_useOnRestoreSuccess = __esm({
|
|
19157
19184
|
"src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts"() {
|
|
19158
19185
|
init_ProviderContext();
|
|
19159
19186
|
init_SessionContext();
|
|
19160
|
-
|
|
19187
|
+
import_react53 = require("react");
|
|
19161
19188
|
init_useLayoutDataStore();
|
|
19162
19189
|
init_useLayoutStore();
|
|
19163
19190
|
init_useRestoreStore();
|
|
@@ -19420,7 +19447,7 @@ function useCreateBackup() {
|
|
|
19420
19447
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
19421
19448
|
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
19422
19449
|
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
19423
|
-
(0,
|
|
19450
|
+
(0, import_react54.useEffect)(() => {
|
|
19424
19451
|
if (!hasServerVault) {
|
|
19425
19452
|
useRestoreStore.getState().setMethod("server");
|
|
19426
19453
|
useLayoutStore.getState().setIsDialogForced(true);
|
|
@@ -19428,7 +19455,7 @@ function useCreateBackup() {
|
|
|
19428
19455
|
}, [hasServerVault]);
|
|
19429
19456
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
19430
19457
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
19431
|
-
const onBackupSuccess = (0,
|
|
19458
|
+
const onBackupSuccess = (0, import_react54.useCallback)((method) => {
|
|
19432
19459
|
console.log(`[EMBARKAI BACKUP] ${method} backup created successfully`);
|
|
19433
19460
|
if (method !== "server") return;
|
|
19434
19461
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
@@ -19601,12 +19628,12 @@ function useCreateBackup() {
|
|
|
19601
19628
|
createPasskey
|
|
19602
19629
|
};
|
|
19603
19630
|
}
|
|
19604
|
-
var import_react_query27,
|
|
19631
|
+
var import_react_query27, import_react54;
|
|
19605
19632
|
var init_useCreateBackup = __esm({
|
|
19606
19633
|
"src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts"() {
|
|
19607
19634
|
init_SessionContext();
|
|
19608
19635
|
import_react_query27 = require("@tanstack/react-query");
|
|
19609
|
-
|
|
19636
|
+
import_react54 = require("react");
|
|
19610
19637
|
init_auth();
|
|
19611
19638
|
init_useLayoutDataStore();
|
|
19612
19639
|
init_useLayoutStore();
|
|
@@ -19743,7 +19770,7 @@ function useValidateFileBackup() {
|
|
|
19743
19770
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
19744
19771
|
const setError = useRestoreStore((st) => st.setError);
|
|
19745
19772
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
19746
|
-
(0,
|
|
19773
|
+
(0, import_react55.useEffect)(() => {
|
|
19747
19774
|
if (!restoreFile) {
|
|
19748
19775
|
return;
|
|
19749
19776
|
}
|
|
@@ -19764,10 +19791,10 @@ function useValidateFileBackup() {
|
|
|
19764
19791
|
reader.readAsText(restoreFile);
|
|
19765
19792
|
}, [restoreFile]);
|
|
19766
19793
|
}
|
|
19767
|
-
var
|
|
19794
|
+
var import_react55;
|
|
19768
19795
|
var init_useValidateFileBackup = __esm({
|
|
19769
19796
|
"src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts"() {
|
|
19770
|
-
|
|
19797
|
+
import_react55 = require("react");
|
|
19771
19798
|
init_useRestoreStore();
|
|
19772
19799
|
}
|
|
19773
19800
|
});
|
|
@@ -19795,7 +19822,7 @@ function MethodSelector(props) {
|
|
|
19795
19822
|
setError,
|
|
19796
19823
|
setSuccess
|
|
19797
19824
|
} = useRestoreStore();
|
|
19798
|
-
const recoveryRenderMethods = (0,
|
|
19825
|
+
const recoveryRenderMethods = (0, import_react56.useMemo)(() => {
|
|
19799
19826
|
const methodsWithBackupData = getRecoveryRenderMethods(mode).map((mt) => {
|
|
19800
19827
|
let data = null;
|
|
19801
19828
|
switch (true) {
|
|
@@ -19810,7 +19837,7 @@ function MethodSelector(props) {
|
|
|
19810
19837
|
return methodsWithBackupData;
|
|
19811
19838
|
}, [mode, serverRecoveryStatus]);
|
|
19812
19839
|
if (!!selectedRecoveryMethod) return null;
|
|
19813
|
-
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)(
|
|
19814
19841
|
"div",
|
|
19815
19842
|
{
|
|
19816
19843
|
style: { gridTemplateColumns: `repeat(${recoveryRenderMethods.length}, minmax(0, 1fr))` },
|
|
@@ -19844,12 +19871,12 @@ function MethodSelector(props) {
|
|
|
19844
19871
|
}
|
|
19845
19872
|
) });
|
|
19846
19873
|
}
|
|
19847
|
-
var import_lucide_react38,
|
|
19874
|
+
var import_lucide_react38, import_react56, import_jsx_runtime79, getRecoveryRenderMethods;
|
|
19848
19875
|
var init_MethodSelector = __esm({
|
|
19849
19876
|
"src/internal/components/KeyshareRestoreMenu/components/MethodSelector.tsx"() {
|
|
19850
19877
|
init_useT();
|
|
19851
19878
|
import_lucide_react38 = require("lucide-react");
|
|
19852
|
-
|
|
19879
|
+
import_react56 = require("react");
|
|
19853
19880
|
init_icons();
|
|
19854
19881
|
init_guardian_backup();
|
|
19855
19882
|
init_button();
|
|
@@ -19985,7 +20012,7 @@ function PasswordPasskey(props) {
|
|
|
19985
20012
|
onCreatePasskey
|
|
19986
20013
|
} = props;
|
|
19987
20014
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
19988
|
-
const actionRef = (0,
|
|
20015
|
+
const actionRef = (0, import_react57.useRef)(null);
|
|
19989
20016
|
const {
|
|
19990
20017
|
showPassword,
|
|
19991
20018
|
restorePassword,
|
|
@@ -19999,7 +20026,7 @@ function PasswordPasskey(props) {
|
|
|
19999
20026
|
} = useRestoreStore();
|
|
20000
20027
|
const { config } = useProviderConfig();
|
|
20001
20028
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
20002
|
-
(0,
|
|
20029
|
+
(0, import_react57.useEffect)(() => {
|
|
20003
20030
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
20004
20031
|
}, [isPasskeyEnabled, usePasskey]);
|
|
20005
20032
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
@@ -20163,7 +20190,7 @@ function PasswordPasskey(props) {
|
|
|
20163
20190
|
] })
|
|
20164
20191
|
] });
|
|
20165
20192
|
}
|
|
20166
|
-
var import_lucide_react39,
|
|
20193
|
+
var import_lucide_react39, import_react57, import_jsx_runtime80;
|
|
20167
20194
|
var init_PasswordPasskey = __esm({
|
|
20168
20195
|
"src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx"() {
|
|
20169
20196
|
init_ProviderContext();
|
|
@@ -20171,7 +20198,7 @@ var init_PasswordPasskey = __esm({
|
|
|
20171
20198
|
init_i18n();
|
|
20172
20199
|
init_utils();
|
|
20173
20200
|
import_lucide_react39 = require("lucide-react");
|
|
20174
|
-
|
|
20201
|
+
import_react57 = require("react");
|
|
20175
20202
|
init_icons();
|
|
20176
20203
|
init_Onboarding();
|
|
20177
20204
|
init_button();
|
|
@@ -20348,7 +20375,7 @@ function Server(props) {
|
|
|
20348
20375
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
20349
20376
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
20350
20377
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
20351
|
-
(0,
|
|
20378
|
+
(0, import_react58.useEffect)(() => {
|
|
20352
20379
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
20353
20380
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
20354
20381
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -20391,7 +20418,7 @@ function Server(props) {
|
|
|
20391
20418
|
)
|
|
20392
20419
|
] });
|
|
20393
20420
|
}
|
|
20394
|
-
var import_react_query29, import_dayjs4, import_lucide_react42,
|
|
20421
|
+
var import_react_query29, import_dayjs4, import_lucide_react42, import_react58, import_jsx_runtime83;
|
|
20395
20422
|
var init_Server = __esm({
|
|
20396
20423
|
"src/internal/components/KeyshareRestoreMenu/methods/Server.tsx"() {
|
|
20397
20424
|
init_SessionContext();
|
|
@@ -20400,7 +20427,7 @@ var init_Server = __esm({
|
|
|
20400
20427
|
import_react_query29 = require("@tanstack/react-query");
|
|
20401
20428
|
import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
20402
20429
|
import_lucide_react42 = require("lucide-react");
|
|
20403
|
-
|
|
20430
|
+
import_react58 = require("react");
|
|
20404
20431
|
init_Onboarding();
|
|
20405
20432
|
init_highlight();
|
|
20406
20433
|
init_PasswordPasskey();
|
|
@@ -20564,7 +20591,7 @@ function Cloud2(props) {
|
|
|
20564
20591
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
20565
20592
|
}
|
|
20566
20593
|
});
|
|
20567
|
-
(0,
|
|
20594
|
+
(0, import_react59.useEffect)(() => {
|
|
20568
20595
|
if (isCloudProvidersLoading) return;
|
|
20569
20596
|
if (!!cloudProvidersError) {
|
|
20570
20597
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -20628,13 +20655,13 @@ function Cloud2(props) {
|
|
|
20628
20655
|
)
|
|
20629
20656
|
] });
|
|
20630
20657
|
}
|
|
20631
|
-
var import_react_query30, import_lucide_react44,
|
|
20658
|
+
var import_react_query30, import_lucide_react44, import_react59, import_jsx_runtime85;
|
|
20632
20659
|
var init_Cloud = __esm({
|
|
20633
20660
|
"src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx"() {
|
|
20634
20661
|
init_SessionContext();
|
|
20635
20662
|
import_react_query30 = require("@tanstack/react-query");
|
|
20636
20663
|
import_lucide_react44 = require("lucide-react");
|
|
20637
|
-
|
|
20664
|
+
import_react59 = require("react");
|
|
20638
20665
|
init_button();
|
|
20639
20666
|
init_select();
|
|
20640
20667
|
init_PasswordPasskey();
|
|
@@ -20651,8 +20678,8 @@ function Guardian(props) {
|
|
|
20651
20678
|
const session = useSession((st) => st.session);
|
|
20652
20679
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
20653
20680
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
20654
|
-
const [isWorking, setIsWorking] = (0,
|
|
20655
|
-
const [step, setStep] = (0,
|
|
20681
|
+
const [isWorking, setIsWorking] = (0, import_react60.useState)(false);
|
|
20682
|
+
const [step, setStep] = (0, import_react60.useState)("idle");
|
|
20656
20683
|
const handleGuardianBackup = async () => {
|
|
20657
20684
|
if (!restorePassword) {
|
|
20658
20685
|
setError("Please enter a password");
|
|
@@ -20781,11 +20808,11 @@ function Guardian(props) {
|
|
|
20781
20808
|
] })
|
|
20782
20809
|
] });
|
|
20783
20810
|
}
|
|
20784
|
-
var
|
|
20811
|
+
var import_react60, import_lucide_react45, import_jsx_runtime86;
|
|
20785
20812
|
var init_Guardian = __esm({
|
|
20786
20813
|
"src/internal/components/KeyshareRestoreMenu/methods/Guardian.tsx"() {
|
|
20787
20814
|
init_SessionContext();
|
|
20788
|
-
|
|
20815
|
+
import_react60 = require("react");
|
|
20789
20816
|
import_lucide_react45 = require("lucide-react");
|
|
20790
20817
|
init_iframe_manager();
|
|
20791
20818
|
init_guardian_backup();
|
|
@@ -20808,7 +20835,7 @@ var init_methods = __esm({
|
|
|
20808
20835
|
});
|
|
20809
20836
|
|
|
20810
20837
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
20811
|
-
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;
|
|
20812
20839
|
var init_KeyshareRestoreMenu = __esm({
|
|
20813
20840
|
"src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
|
|
20814
20841
|
init_ProviderContext();
|
|
@@ -20816,7 +20843,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20816
20843
|
init_i18n();
|
|
20817
20844
|
import_react_query31 = require("@tanstack/react-query");
|
|
20818
20845
|
import_lucide_react46 = require("lucide-react");
|
|
20819
|
-
|
|
20846
|
+
import_react61 = require("react");
|
|
20820
20847
|
import_wagmi5 = require("wagmi");
|
|
20821
20848
|
init_useLayoutDataStore();
|
|
20822
20849
|
init_useLayoutStore();
|
|
@@ -20846,7 +20873,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20846
20873
|
const error = useRestoreStore((st) => st.error);
|
|
20847
20874
|
const success = useRestoreStore((st) => st.success);
|
|
20848
20875
|
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
20849
|
-
(0,
|
|
20876
|
+
(0, import_react61.useEffect)(() => {
|
|
20850
20877
|
const { setIsDialogForced } = useLayoutStore.getState();
|
|
20851
20878
|
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
20852
20879
|
setIsDialogForced(true);
|
|
@@ -20885,7 +20912,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
20885
20912
|
queryFn: async () => await getShareRecoveryStats()
|
|
20886
20913
|
});
|
|
20887
20914
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
20888
|
-
(0,
|
|
20915
|
+
(0, import_react61.useEffect)(() => {
|
|
20889
20916
|
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
20890
20917
|
}, [hasServerBackup]);
|
|
20891
20918
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query31.useMutation)({
|
|
@@ -21032,7 +21059,7 @@ function KeyshareBackupMenu() {
|
|
|
21032
21059
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
21033
21060
|
const error = useRestoreStore((st) => st.error);
|
|
21034
21061
|
const success = useRestoreStore((st) => st.success);
|
|
21035
|
-
(0,
|
|
21062
|
+
(0, import_react62.useEffect)(() => {
|
|
21036
21063
|
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
21037
21064
|
return () => {
|
|
21038
21065
|
setSuccess(null);
|
|
@@ -21052,7 +21079,7 @@ function KeyshareBackupMenu() {
|
|
|
21052
21079
|
});
|
|
21053
21080
|
useOnboardingTourAvailable(!isRecoveryLoading && currentBackupMethod === "server" && !usePasskey);
|
|
21054
21081
|
const hasRecoveryData2 = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
21055
|
-
(0,
|
|
21082
|
+
(0, import_react62.useEffect)(() => {
|
|
21056
21083
|
if (!!hasRecoveryData2) useRestoreStore.getState().setMethod("server");
|
|
21057
21084
|
}, [hasRecoveryData2]);
|
|
21058
21085
|
const {
|
|
@@ -21171,14 +21198,14 @@ function KeyshareBackupMenu() {
|
|
|
21171
21198
|
] })
|
|
21172
21199
|
] });
|
|
21173
21200
|
}
|
|
21174
|
-
var import_react_query32, import_lucide_react47,
|
|
21201
|
+
var import_react_query32, import_lucide_react47, import_react62, import_jsx_runtime88, COMPONENTS;
|
|
21175
21202
|
var init_KeyshareBackupMenu = __esm({
|
|
21176
21203
|
"src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx"() {
|
|
21177
21204
|
init_SessionContext();
|
|
21178
21205
|
init_i18n();
|
|
21179
21206
|
import_react_query32 = require("@tanstack/react-query");
|
|
21180
21207
|
import_lucide_react47 = require("lucide-react");
|
|
21181
|
-
|
|
21208
|
+
import_react62 = require("react");
|
|
21182
21209
|
init_useLayoutDataStore();
|
|
21183
21210
|
init_vaultClient();
|
|
21184
21211
|
init_Expandable2();
|
|
@@ -21306,13 +21333,13 @@ var init_SumsubIframeManager = __esm({
|
|
|
21306
21333
|
function useSumsubIframe({ iframeUrl }) {
|
|
21307
21334
|
const config = useProviderConfig().config;
|
|
21308
21335
|
const { colorMode } = useColorMode();
|
|
21309
|
-
const iframeRef = (0,
|
|
21310
|
-
const [isLoading, setIsLoading] = (0,
|
|
21311
|
-
const [error, setError] = (0,
|
|
21312
|
-
const [height, setHeight] = (0,
|
|
21313
|
-
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)("");
|
|
21314
21341
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
21315
|
-
(0,
|
|
21342
|
+
(0, import_react63.useEffect)(() => {
|
|
21316
21343
|
setError(null);
|
|
21317
21344
|
setIsLoading(true);
|
|
21318
21345
|
setStatus("Preparing verification...");
|
|
@@ -21353,12 +21380,12 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
21353
21380
|
status
|
|
21354
21381
|
};
|
|
21355
21382
|
}
|
|
21356
|
-
var
|
|
21383
|
+
var import_react63;
|
|
21357
21384
|
var init_useSumsubIframe = __esm({
|
|
21358
21385
|
"src/internal/components/KYC/useSumsubIframe.ts"() {
|
|
21359
21386
|
init_ProviderContext();
|
|
21360
21387
|
init_useColorMode();
|
|
21361
|
-
|
|
21388
|
+
import_react63 = require("react");
|
|
21362
21389
|
init_sumsub();
|
|
21363
21390
|
init_SumsubIframeManager();
|
|
21364
21391
|
}
|
|
@@ -21566,11 +21593,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
21566
21593
|
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
21567
21594
|
const resolvedChainId = chainId ?? activeChainId;
|
|
21568
21595
|
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
21569
|
-
const chainConfig = (0,
|
|
21596
|
+
const chainConfig = (0, import_react64.useMemo)(() => {
|
|
21570
21597
|
if (shouldUseActiveClient) return activeChainConfig;
|
|
21571
21598
|
return (0, import_read16.getChainConfig)(chainId);
|
|
21572
21599
|
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
21573
|
-
const publicClient = (0,
|
|
21600
|
+
const publicClient = (0, import_react64.useMemo)(() => {
|
|
21574
21601
|
if (shouldUseActiveClient) return activePublicClient;
|
|
21575
21602
|
if (!chainId) return activePublicClient;
|
|
21576
21603
|
try {
|
|
@@ -21587,12 +21614,12 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
21587
21614
|
resolvedChainId
|
|
21588
21615
|
};
|
|
21589
21616
|
}
|
|
21590
|
-
var import_read16,
|
|
21617
|
+
var import_read16, import_react64, publicClientByChainId;
|
|
21591
21618
|
var init_useResolvedPublicClient = __esm({
|
|
21592
21619
|
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
21593
21620
|
init_SessionContext();
|
|
21594
21621
|
import_read16 = require("@embarkai/core/read");
|
|
21595
|
-
|
|
21622
|
+
import_react64 = require("react");
|
|
21596
21623
|
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
21597
21624
|
}
|
|
21598
21625
|
});
|
|
@@ -21656,7 +21683,7 @@ var init_useNativeBalance = __esm({
|
|
|
21656
21683
|
function useWatchTokens(options) {
|
|
21657
21684
|
const { address, chainId, enabled, publicClient } = options;
|
|
21658
21685
|
const { config } = useProviderConfig();
|
|
21659
|
-
const watchTokens = (0,
|
|
21686
|
+
const watchTokens = (0, import_react65.useMemo)(() => {
|
|
21660
21687
|
const allWatchTokens = config.current.watchTokens;
|
|
21661
21688
|
const tokensForChain = chainId ? allWatchTokens?.[chainId] || [] : [];
|
|
21662
21689
|
return tokensForChain;
|
|
@@ -21724,12 +21751,12 @@ function useWatchTokens(options) {
|
|
|
21724
21751
|
}
|
|
21725
21752
|
});
|
|
21726
21753
|
}
|
|
21727
|
-
var import_react_query35,
|
|
21754
|
+
var import_react_query35, import_react65, import_viem8;
|
|
21728
21755
|
var init_useWatchTokens = __esm({
|
|
21729
21756
|
"src/internal/hooks/useBlockscoutAssets/useWatchTokens.ts"() {
|
|
21730
21757
|
init_ProviderContext();
|
|
21731
21758
|
import_react_query35 = require("@tanstack/react-query");
|
|
21732
|
-
|
|
21759
|
+
import_react65 = require("react");
|
|
21733
21760
|
import_viem8 = require("viem");
|
|
21734
21761
|
init_constants6();
|
|
21735
21762
|
}
|
|
@@ -21878,11 +21905,11 @@ function useBlockscoutAssets(options) {
|
|
|
21878
21905
|
tokenBalancesQueryKey: customTokenBalancesQueryKey
|
|
21879
21906
|
} = useProviderConfig().config?.current?.portfolio || {};
|
|
21880
21907
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
21881
|
-
const blockscoutClient = (0,
|
|
21908
|
+
const blockscoutClient = (0, import_react66.useMemo)(
|
|
21882
21909
|
() => blockscoutApiUrl ? (0, import_core4.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
21883
21910
|
[blockscoutApiUrl]
|
|
21884
21911
|
);
|
|
21885
|
-
const lastRefreshRef = (0,
|
|
21912
|
+
const lastRefreshRef = (0, import_react66.useRef)(0);
|
|
21886
21913
|
const {
|
|
21887
21914
|
data: watchTokenAssets = [],
|
|
21888
21915
|
isLoading: watchTokensLoading,
|
|
@@ -21954,7 +21981,7 @@ function useBlockscoutAssets(options) {
|
|
|
21954
21981
|
queryKey: [BLOCKSCOUT_QUERY_KEY, "nfts", resolvedChainId, blockscoutApiUrl, address],
|
|
21955
21982
|
queryFn: () => blockscoutClient.getNfts(address)
|
|
21956
21983
|
});
|
|
21957
|
-
const erc20TokenAddresses = (0,
|
|
21984
|
+
const erc20TokenAddresses = (0, import_react66.useMemo)(() => {
|
|
21958
21985
|
if (!blockscoutItems) return [];
|
|
21959
21986
|
return blockscoutItems.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
21960
21987
|
}, [blockscoutItems]);
|
|
@@ -21999,7 +22026,7 @@ function useBlockscoutAssets(options) {
|
|
|
21999
22026
|
// 1 minute
|
|
22000
22027
|
// gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
22001
22028
|
});
|
|
22002
|
-
const assets = (0,
|
|
22029
|
+
const assets = (0, import_react66.useMemo)(() => {
|
|
22003
22030
|
const result = [];
|
|
22004
22031
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
22005
22032
|
if (nativeBalanceData) {
|
|
@@ -22093,7 +22120,7 @@ function useBlockscoutAssets(options) {
|
|
|
22093
22120
|
watchTokenAssets,
|
|
22094
22121
|
chainConfig
|
|
22095
22122
|
]);
|
|
22096
|
-
const nativeBalance = (0,
|
|
22123
|
+
const nativeBalance = (0, import_react66.useMemo)(() => {
|
|
22097
22124
|
if (!nativeBalanceData) return null;
|
|
22098
22125
|
return {
|
|
22099
22126
|
value: nativeBalanceData.value,
|
|
@@ -22101,11 +22128,11 @@ function useBlockscoutAssets(options) {
|
|
|
22101
22128
|
symbol: nativeBalanceData.symbol
|
|
22102
22129
|
};
|
|
22103
22130
|
}, [nativeBalanceData]);
|
|
22104
|
-
const error = (0,
|
|
22131
|
+
const error = (0, import_react66.useMemo)(() => {
|
|
22105
22132
|
if (!blockscoutError) return null;
|
|
22106
22133
|
return createError(blockscoutError);
|
|
22107
22134
|
}, [blockscoutError]);
|
|
22108
|
-
const refreshBalances = (0,
|
|
22135
|
+
const refreshBalances = (0, import_react66.useCallback)(async () => {
|
|
22109
22136
|
const now = Date.now();
|
|
22110
22137
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
22111
22138
|
return;
|
|
@@ -22121,7 +22148,7 @@ function useBlockscoutAssets(options) {
|
|
|
22121
22148
|
qc.invalidateQueries({ queryKey: [WATCH_TOKENS_QUERY_KEY] })
|
|
22122
22149
|
]);
|
|
22123
22150
|
}, [qc, customTokenBalancesQueryKey]);
|
|
22124
|
-
const getTokenBalance = (0,
|
|
22151
|
+
const getTokenBalance = (0, import_react66.useCallback)(
|
|
22125
22152
|
(tokenAddress) => {
|
|
22126
22153
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
22127
22154
|
},
|
|
@@ -22140,13 +22167,13 @@ function useBlockscoutAssets(options) {
|
|
|
22140
22167
|
lastUpdated: dataUpdatedAt || null
|
|
22141
22168
|
};
|
|
22142
22169
|
}
|
|
22143
|
-
var import_core4, import_react_query36,
|
|
22170
|
+
var import_core4, import_react_query36, import_react66;
|
|
22144
22171
|
var init_useBlockscoutAssets = __esm({
|
|
22145
22172
|
"src/internal/hooks/useBlockscoutAssets/useBlockscoutAssets.ts"() {
|
|
22146
22173
|
init_ProviderContext();
|
|
22147
22174
|
import_core4 = require("@embarkai/core");
|
|
22148
22175
|
import_react_query36 = require("@tanstack/react-query");
|
|
22149
|
-
|
|
22176
|
+
import_react66 = require("react");
|
|
22150
22177
|
init_initial();
|
|
22151
22178
|
init_constants();
|
|
22152
22179
|
init_useResolvedPublicClient();
|
|
@@ -22266,9 +22293,9 @@ function SecurityTokenBadge() {
|
|
|
22266
22293
|
}
|
|
22267
22294
|
function PortfolioItemImage(props) {
|
|
22268
22295
|
const { asset } = props;
|
|
22269
|
-
const [logoError, setLogoError] = (0,
|
|
22270
|
-
const [nftImageError, setNftImageError] = (0,
|
|
22271
|
-
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)(() => {
|
|
22272
22299
|
const isNft = isNftAsset(asset);
|
|
22273
22300
|
const nftImage = getNftImage(asset);
|
|
22274
22301
|
const isSecurity = isSecurityToken(asset);
|
|
@@ -22423,13 +22450,13 @@ function PortfolioItem(props) {
|
|
|
22423
22450
|
}
|
|
22424
22451
|
);
|
|
22425
22452
|
}
|
|
22426
|
-
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;
|
|
22427
22454
|
var init_PortfolioItem = __esm({
|
|
22428
22455
|
"src/internal/components/PortfolioMenu/PortfolioItem.tsx"() {
|
|
22429
22456
|
init_ProviderContext();
|
|
22430
22457
|
import_react_query37 = require("@tanstack/react-query");
|
|
22431
22458
|
import_lucide_react51 = require("lucide-react");
|
|
22432
|
-
|
|
22459
|
+
import_react67 = require("react");
|
|
22433
22460
|
import_viem11 = require("viem");
|
|
22434
22461
|
init_tokens();
|
|
22435
22462
|
init_base3();
|
|
@@ -22461,7 +22488,7 @@ function PortfolioMenu() {
|
|
|
22461
22488
|
enabled: !!address
|
|
22462
22489
|
});
|
|
22463
22490
|
const shownProjectAssets = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
22464
|
-
const refreshAllAssetsBalances = (0,
|
|
22491
|
+
const refreshAllAssetsBalances = (0, import_react68.useCallback)(() => {
|
|
22465
22492
|
Promise.all(shownProjectAssets.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
22466
22493
|
refreshBlockscoutBalances();
|
|
22467
22494
|
}, [qc, shownProjectAssets, refreshBlockscoutBalances]);
|
|
@@ -22507,7 +22534,7 @@ function PortfolioMenu() {
|
|
|
22507
22534
|
blockscoutError && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Highlight, { type: "error", children: blockscoutError?.message })
|
|
22508
22535
|
] });
|
|
22509
22536
|
}
|
|
22510
|
-
var import_react_query38, import_lucide_react52,
|
|
22537
|
+
var import_react_query38, import_lucide_react52, import_react68, import_jsx_runtime95;
|
|
22511
22538
|
var init_PortfolioMenu = __esm({
|
|
22512
22539
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
22513
22540
|
init_ProviderContext();
|
|
@@ -22515,7 +22542,7 @@ var init_PortfolioMenu = __esm({
|
|
|
22515
22542
|
init_i18n();
|
|
22516
22543
|
import_react_query38 = require("@tanstack/react-query");
|
|
22517
22544
|
import_lucide_react52 = require("lucide-react");
|
|
22518
|
-
|
|
22545
|
+
import_react68 = require("react");
|
|
22519
22546
|
init_useBlockscoutAssets2();
|
|
22520
22547
|
init_useLayoutDataStore();
|
|
22521
22548
|
init_Expandable2();
|
|
@@ -22826,7 +22853,7 @@ var init_useNicknameStore = __esm({
|
|
|
22826
22853
|
function useNicknameAvailability(currentNickname) {
|
|
22827
22854
|
const { t } = useT();
|
|
22828
22855
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
22829
|
-
(0,
|
|
22856
|
+
(0, import_react69.useEffect)(() => {
|
|
22830
22857
|
if (!currentNickname) return;
|
|
22831
22858
|
useNicknameStore.getState().setNicknameValue(currentNickname);
|
|
22832
22859
|
}, [currentNickname]);
|
|
@@ -22847,8 +22874,8 @@ function useNicknameAvailability(currentNickname) {
|
|
|
22847
22874
|
useNicknameStore.getState().setError(error?.message || "Failed to check nickname availability");
|
|
22848
22875
|
}
|
|
22849
22876
|
});
|
|
22850
|
-
const debouncedCheckAvailability = (0,
|
|
22851
|
-
(0,
|
|
22877
|
+
const debouncedCheckAvailability = (0, import_react69.useCallback)((0, import_lodash_es13.debounce)(checkAvailability, DEBOUNCE_MS), [checkAvailability]);
|
|
22878
|
+
(0, import_react69.useEffect)(() => {
|
|
22852
22879
|
if (!currentNickname) return;
|
|
22853
22880
|
const normalizedInputValue = normalizeNickname(nicknameValue);
|
|
22854
22881
|
const { valid: isNicknameValid } = validateNickname(nicknameValue);
|
|
@@ -22862,13 +22889,13 @@ function useNicknameAvailability(currentNickname) {
|
|
|
22862
22889
|
}, [nicknameValue, currentNickname, debouncedCheckAvailability]);
|
|
22863
22890
|
return { isCheckingAvailability };
|
|
22864
22891
|
}
|
|
22865
|
-
var import_react_query39, import_lodash_es13,
|
|
22892
|
+
var import_react_query39, import_lodash_es13, import_react69, DEBOUNCE_MS;
|
|
22866
22893
|
var init_useNicknameAvailability = __esm({
|
|
22867
22894
|
"src/internal/components/NicknameMenu/useNicknameAvailability.ts"() {
|
|
22868
22895
|
init_i18n();
|
|
22869
22896
|
import_react_query39 = require("@tanstack/react-query");
|
|
22870
22897
|
import_lodash_es13 = require("lodash-es");
|
|
22871
|
-
|
|
22898
|
+
import_react69 = require("react");
|
|
22872
22899
|
init_nickname();
|
|
22873
22900
|
init_nickname_errors();
|
|
22874
22901
|
init_nickname_validation();
|
|
@@ -22889,9 +22916,9 @@ function NicknameEditForm(props) {
|
|
|
22889
22916
|
const nicknameValue = useNicknameStore((st) => st.nicknameValue);
|
|
22890
22917
|
const nicknameAvailability = useNicknameStore((st) => st.availability);
|
|
22891
22918
|
const { isCheckingAvailability } = useNicknameAvailability(nicknameInfo ? nicknameInfo.handle : "");
|
|
22892
|
-
const [isNicknameCopied, setIsNicknameCopied] = (0,
|
|
22893
|
-
const exitTimerRef = (0,
|
|
22894
|
-
(0,
|
|
22919
|
+
const [isNicknameCopied, setIsNicknameCopied] = (0, import_react70.useState)(false);
|
|
22920
|
+
const exitTimerRef = (0, import_react70.useRef)(null);
|
|
22921
|
+
(0, import_react70.useEffect)(() => () => {
|
|
22895
22922
|
if (exitTimerRef.current) clearTimeout(exitTimerRef.current);
|
|
22896
22923
|
}, []);
|
|
22897
22924
|
const { mutate: changeNickname2, isPending: isNicknameChanging } = (0, import_react_query40.useMutation)({
|
|
@@ -22925,7 +22952,7 @@ function NicknameEditForm(props) {
|
|
|
22925
22952
|
);
|
|
22926
22953
|
}
|
|
22927
22954
|
});
|
|
22928
|
-
const handleNicknameInputChange = (0,
|
|
22955
|
+
const handleNicknameInputChange = (0, import_react70.useCallback)(
|
|
22929
22956
|
(e) => {
|
|
22930
22957
|
const { error, setError, setNicknameValue } = useNicknameStore.getState();
|
|
22931
22958
|
const nextInputValue = e.target.value;
|
|
@@ -22939,7 +22966,7 @@ function NicknameEditForm(props) {
|
|
|
22939
22966
|
},
|
|
22940
22967
|
[t]
|
|
22941
22968
|
);
|
|
22942
|
-
const handleSubmit = (0,
|
|
22969
|
+
const handleSubmit = (0, import_react70.useCallback)(
|
|
22943
22970
|
(e) => {
|
|
22944
22971
|
const { nicknameValue: nicknameValue2, setError } = useNicknameStore.getState();
|
|
22945
22972
|
if (!canChange) {
|
|
@@ -23031,7 +23058,7 @@ function NicknameEditForm(props) {
|
|
|
23031
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") })
|
|
23032
23059
|
] });
|
|
23033
23060
|
}
|
|
23034
|
-
var import_react_query40, import_lucide_react55,
|
|
23061
|
+
var import_react_query40, import_lucide_react55, import_react70, import_jsx_runtime98;
|
|
23035
23062
|
var init_NicknameEditForm = __esm({
|
|
23036
23063
|
"src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
|
|
23037
23064
|
init_ProviderContext();
|
|
@@ -23039,7 +23066,7 @@ var init_NicknameEditForm = __esm({
|
|
|
23039
23066
|
init_i18n();
|
|
23040
23067
|
import_react_query40 = require("@tanstack/react-query");
|
|
23041
23068
|
import_lucide_react55 = require("lucide-react");
|
|
23042
|
-
|
|
23069
|
+
import_react70 = require("react");
|
|
23043
23070
|
init_icons();
|
|
23044
23071
|
init_nickname();
|
|
23045
23072
|
init_profile();
|
|
@@ -23075,7 +23102,7 @@ function NicknameMenu() {
|
|
|
23075
23102
|
queryFn: async () => await getNicknameInfo()
|
|
23076
23103
|
});
|
|
23077
23104
|
const resolvedError = nicknameError || nicknameInfoError?.message || null;
|
|
23078
|
-
(0,
|
|
23105
|
+
(0, import_react71.useEffect)(() => () => useNicknameStore.getState().reset(), []);
|
|
23079
23106
|
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Expandable, { isExpanded: true, contentClassName: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
23080
23107
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex items-center gap-[var(--ui-kit-gap)] ", children: [
|
|
23081
23108
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
@@ -23142,7 +23169,7 @@ function NicknameMenu() {
|
|
|
23142
23169
|
!!resolvedError?.length && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Highlight, { type: "error", children: resolvedError })
|
|
23143
23170
|
] });
|
|
23144
23171
|
}
|
|
23145
|
-
var import_react_query41, import_dayjs5, import_lucide_react56,
|
|
23172
|
+
var import_react_query41, import_dayjs5, import_lucide_react56, import_react71, import_jsx_runtime99;
|
|
23146
23173
|
var init_NicknameMenu = __esm({
|
|
23147
23174
|
"src/internal/components/NicknameMenu/NicknameMenu.tsx"() {
|
|
23148
23175
|
init_SessionContext();
|
|
@@ -23151,7 +23178,7 @@ var init_NicknameMenu = __esm({
|
|
|
23151
23178
|
import_react_query41 = require("@tanstack/react-query");
|
|
23152
23179
|
import_dayjs5 = __toESM(require("dayjs"), 1);
|
|
23153
23180
|
import_lucide_react56 = require("lucide-react");
|
|
23154
|
-
|
|
23181
|
+
import_react71 = require("react");
|
|
23155
23182
|
init_nickname();
|
|
23156
23183
|
init_profile();
|
|
23157
23184
|
init_useLayoutDataStore();
|
|
@@ -23281,12 +23308,12 @@ function ReceiveMenu() {
|
|
|
23281
23308
|
queryKey: [QUERY_KEYS.nicknameInfo, address],
|
|
23282
23309
|
queryFn: async () => await getNicknameInfo()
|
|
23283
23310
|
});
|
|
23284
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
23285
|
-
const [isAddressCopied, setAddressCopied] = (0,
|
|
23286
|
-
const [isNicknameCopied, setNicknameCopied] = (0,
|
|
23287
|
-
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);
|
|
23288
23315
|
useOnboardingTourAvailable(true);
|
|
23289
|
-
const fingerprint = (0,
|
|
23316
|
+
const fingerprint = (0, import_react72.useMemo)(() => {
|
|
23290
23317
|
if (!session?.ownerAddress) return null;
|
|
23291
23318
|
try {
|
|
23292
23319
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -23294,7 +23321,7 @@ function ReceiveMenu() {
|
|
|
23294
23321
|
return null;
|
|
23295
23322
|
}
|
|
23296
23323
|
}, [session?.ownerAddress]);
|
|
23297
|
-
(0,
|
|
23324
|
+
(0, import_react72.useEffect)(() => {
|
|
23298
23325
|
if (!address) return;
|
|
23299
23326
|
import_qrcode.default.toDataURL(address, {
|
|
23300
23327
|
width: 200,
|
|
@@ -23393,7 +23420,7 @@ function ReceiveMenu() {
|
|
|
23393
23420
|
] })
|
|
23394
23421
|
] });
|
|
23395
23422
|
}
|
|
23396
|
-
var import_react_query42, import_lucide_react57, import_qrcode,
|
|
23423
|
+
var import_react_query42, import_lucide_react57, import_qrcode, import_react72, import_jsx_runtime100;
|
|
23397
23424
|
var init_ReceiveMenu = __esm({
|
|
23398
23425
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
23399
23426
|
init_SessionContext();
|
|
@@ -23401,7 +23428,7 @@ var init_ReceiveMenu = __esm({
|
|
|
23401
23428
|
import_react_query42 = require("@tanstack/react-query");
|
|
23402
23429
|
import_lucide_react57 = require("lucide-react");
|
|
23403
23430
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
23404
|
-
|
|
23431
|
+
import_react72 = require("react");
|
|
23405
23432
|
init_nickname();
|
|
23406
23433
|
init_profile();
|
|
23407
23434
|
init_useLayoutDataStore();
|
|
@@ -23781,14 +23808,14 @@ var init_ConnectedApps2 = __esm({
|
|
|
23781
23808
|
});
|
|
23782
23809
|
|
|
23783
23810
|
// src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx
|
|
23784
|
-
var import_lucide_react60,
|
|
23811
|
+
var import_lucide_react60, import_react73, import_jsx_runtime103, KeyshareStatus;
|
|
23785
23812
|
var init_KeyshareStatus = __esm({
|
|
23786
23813
|
"src/internal/components/SecurityMenu/Keyshare/KeyshareStatus.tsx"() {
|
|
23787
23814
|
import_lucide_react60 = require("lucide-react");
|
|
23788
|
-
|
|
23815
|
+
import_react73 = require("react");
|
|
23789
23816
|
init_utils();
|
|
23790
23817
|
import_jsx_runtime103 = require("react/jsx-runtime");
|
|
23791
|
-
KeyshareStatus = (0,
|
|
23818
|
+
KeyshareStatus = (0, import_react73.forwardRef)((props, ref) => {
|
|
23792
23819
|
const { isLoading, content, icon: Icon2, children } = props;
|
|
23793
23820
|
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react60.Loader, { className: "w-4 h-4 animate-spin" });
|
|
23794
23821
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { ref, className: "group relative w-full h-full", children: [
|
|
@@ -24115,10 +24142,10 @@ function updateLimits(patch) {
|
|
|
24115
24142
|
usePolicyForm.setState((st) => ({ ...st, limits: { ...st?.limits, ...patch } }));
|
|
24116
24143
|
}
|
|
24117
24144
|
function useWatchFormData() {
|
|
24118
|
-
const [showFormErrors, setShowFormErrors] = (0,
|
|
24145
|
+
const [showFormErrors, setShowFormErrors] = (0, import_react74.useState)(false);
|
|
24119
24146
|
const formData = usePolicyForm();
|
|
24120
24147
|
const formState = usePolicyFormValidation();
|
|
24121
|
-
(0,
|
|
24148
|
+
(0, import_react74.useEffect)(() => {
|
|
24122
24149
|
if (!formData) return;
|
|
24123
24150
|
setShowFormErrors(false);
|
|
24124
24151
|
const errors = {};
|
|
@@ -24145,7 +24172,7 @@ function useWatchFormData() {
|
|
|
24145
24172
|
}
|
|
24146
24173
|
usePolicyFormValidation.setState(errors, true);
|
|
24147
24174
|
}, [formData]);
|
|
24148
|
-
(0,
|
|
24175
|
+
(0, import_react74.useEffect)(() => () => usePolicyFormValidation.setState({}, true), []);
|
|
24149
24176
|
const formErrorItem = Object.entries(formState).find(([_, value]) => value?.error);
|
|
24150
24177
|
const formErrorMessage = formErrorItem ? `${formErrorItem[0].toUpperCase()}: ${formErrorItem[1]?.error}` : "";
|
|
24151
24178
|
return {
|
|
@@ -24156,10 +24183,10 @@ function useWatchFormData() {
|
|
|
24156
24183
|
setShowFormErrors
|
|
24157
24184
|
};
|
|
24158
24185
|
}
|
|
24159
|
-
var
|
|
24186
|
+
var import_react74, import_zustand14, usePolicyForm, usePolicyFormValidation;
|
|
24160
24187
|
var init_usePolicyForm = __esm({
|
|
24161
24188
|
"src/internal/components/SecurityMenu/UserPolicies/usePolicyForm.ts"() {
|
|
24162
|
-
|
|
24189
|
+
import_react74 = require("react");
|
|
24163
24190
|
import_zustand14 = require("zustand");
|
|
24164
24191
|
init_utils10();
|
|
24165
24192
|
usePolicyForm = (0, import_zustand14.create)(() => null);
|
|
@@ -24190,10 +24217,10 @@ var init_useUserAssetsPolicies = __esm({
|
|
|
24190
24217
|
// src/internal/components/SecurityMenu/UserPolicies/PolicyForm.tsx
|
|
24191
24218
|
function AddressListEditor(props) {
|
|
24192
24219
|
const { label, assets = [], addresses, onChange } = props;
|
|
24193
|
-
const [isAssetSelector, setIsAssetSelector] = (0,
|
|
24194
|
-
const [customAddress, setCustomAddress] = (0,
|
|
24195
|
-
const [customAddressError, setCustomAddressError] = (0,
|
|
24196
|
-
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)(
|
|
24197
24224
|
(addressToAdd) => {
|
|
24198
24225
|
if (!isValidAddress(addressToAdd)) {
|
|
24199
24226
|
setCustomAddressError("Bad address");
|
|
@@ -24420,14 +24447,14 @@ function PolicyForm() {
|
|
|
24420
24447
|
showFormErrors && formErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Highlight, { type: "error", children: formErrorMessage })
|
|
24421
24448
|
] });
|
|
24422
24449
|
}
|
|
24423
|
-
var import_react_query47, import_lucide_react63,
|
|
24450
|
+
var import_react_query47, import_lucide_react63, import_react75, import_jsx_runtime106;
|
|
24424
24451
|
var init_PolicyForm = __esm({
|
|
24425
24452
|
"src/internal/components/SecurityMenu/UserPolicies/PolicyForm.tsx"() {
|
|
24426
24453
|
init_SessionContext();
|
|
24427
24454
|
init_useT();
|
|
24428
24455
|
import_react_query47 = require("@tanstack/react-query");
|
|
24429
24456
|
import_lucide_react63 = require("lucide-react");
|
|
24430
|
-
|
|
24457
|
+
import_react75 = require("react");
|
|
24431
24458
|
init_button();
|
|
24432
24459
|
init_highlight();
|
|
24433
24460
|
init_input();
|
|
@@ -24509,7 +24536,7 @@ function UserPolicies() {
|
|
|
24509
24536
|
const config = useProviderConfig().config;
|
|
24510
24537
|
const mpcUserId = useSession((st) => st.session?.mpcUserId);
|
|
24511
24538
|
const activeChainId = useSession((st) => st.activeChainId);
|
|
24512
|
-
const [isConfirmingDelete, setIsConfirmingDelete] = (0,
|
|
24539
|
+
const [isConfirmingDelete, setIsConfirmingDelete] = (0, import_react76.useState)(false);
|
|
24513
24540
|
const { data: policyView, isLoading: isPolicyLoading } = useUserAssetsPolicies(activeChainId);
|
|
24514
24541
|
const { mutate: cancelPending, isPending: isCancellingPending } = (0, import_react_query48.useMutation)({
|
|
24515
24542
|
mutationFn: async () => {
|
|
@@ -24622,7 +24649,7 @@ function UserPolicies() {
|
|
|
24622
24649
|
] })
|
|
24623
24650
|
] });
|
|
24624
24651
|
}
|
|
24625
|
-
var import_react_query48, import_clsx3, import_lucide_react64,
|
|
24652
|
+
var import_react_query48, import_clsx3, import_lucide_react64, import_react76, import_jsx_runtime107;
|
|
24626
24653
|
var init_UserPolicies = __esm({
|
|
24627
24654
|
"src/internal/components/SecurityMenu/UserPolicies/UserPolicies.tsx"() {
|
|
24628
24655
|
init_ProviderContext();
|
|
@@ -24631,7 +24658,7 @@ var init_UserPolicies = __esm({
|
|
|
24631
24658
|
import_react_query48 = require("@tanstack/react-query");
|
|
24632
24659
|
import_clsx3 = __toESM(require("clsx"), 1);
|
|
24633
24660
|
import_lucide_react64 = require("lucide-react");
|
|
24634
|
-
|
|
24661
|
+
import_react76 = require("react");
|
|
24635
24662
|
init_button();
|
|
24636
24663
|
init_highlight();
|
|
24637
24664
|
init_api4();
|
|
@@ -24656,7 +24683,7 @@ var init_UserPolicies2 = __esm({
|
|
|
24656
24683
|
|
|
24657
24684
|
// src/internal/components/SecurityMenu/useSecurityMenuParams.ts
|
|
24658
24685
|
function useSecurityMenuParams() {
|
|
24659
|
-
(0,
|
|
24686
|
+
(0, import_react77.useEffect)(() => {
|
|
24660
24687
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
24661
24688
|
if (!pageParams || !(0, import_lodash_es14.keys)(pageParams).length) return;
|
|
24662
24689
|
const { submenu } = pageParams;
|
|
@@ -24680,11 +24707,11 @@ function useSecurityMenuParams() {
|
|
|
24680
24707
|
setPageParams(null);
|
|
24681
24708
|
}, []);
|
|
24682
24709
|
}
|
|
24683
|
-
var import_lodash_es14,
|
|
24710
|
+
var import_lodash_es14, import_react77;
|
|
24684
24711
|
var init_useSecurityMenuParams = __esm({
|
|
24685
24712
|
"src/internal/components/SecurityMenu/useSecurityMenuParams.ts"() {
|
|
24686
24713
|
import_lodash_es14 = require("lodash-es");
|
|
24687
|
-
|
|
24714
|
+
import_react77 = require("react");
|
|
24688
24715
|
init_useLayoutDataStore();
|
|
24689
24716
|
init_UserPolicies2();
|
|
24690
24717
|
init_useSecurityStore();
|
|
@@ -24699,7 +24726,7 @@ function SecurityMenuContent() {
|
|
|
24699
24726
|
const { appToUntrust, showConnectedApps, showAssetsPolicies } = useSecurityStore();
|
|
24700
24727
|
const policyForm = usePolicyForm();
|
|
24701
24728
|
useOnboardingTourAvailable(!showConnectedApps && !showAssetsPolicies);
|
|
24702
|
-
(0,
|
|
24729
|
+
(0, import_react78.useEffect)(() => {
|
|
24703
24730
|
let securityTitle = "";
|
|
24704
24731
|
switch (true) {
|
|
24705
24732
|
case showConnectedApps:
|
|
@@ -24720,7 +24747,7 @@ function SecurityMenuContent() {
|
|
|
24720
24747
|
return () => {
|
|
24721
24748
|
};
|
|
24722
24749
|
}, [t, showConnectedApps, showAssetsPolicies, policyForm]);
|
|
24723
|
-
(0,
|
|
24750
|
+
(0, import_react78.useEffect)(
|
|
24724
24751
|
() => () => {
|
|
24725
24752
|
usePolicyForm.setState(null, true);
|
|
24726
24753
|
useSecurityStore.setState(
|
|
@@ -24814,13 +24841,13 @@ function SecurityMenu() {
|
|
|
24814
24841
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SecurityMenuContent, {})
|
|
24815
24842
|
] });
|
|
24816
24843
|
}
|
|
24817
|
-
var import_lucide_react65,
|
|
24844
|
+
var import_lucide_react65, import_react78, import_jsx_runtime108;
|
|
24818
24845
|
var init_SecurityMenu = __esm({
|
|
24819
24846
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
24820
24847
|
init_ProviderContext();
|
|
24821
24848
|
init_i18n();
|
|
24822
24849
|
import_lucide_react65 = require("lucide-react");
|
|
24823
|
-
|
|
24850
|
+
import_react78 = require("react");
|
|
24824
24851
|
init_useLayoutDataStore();
|
|
24825
24852
|
init_Expandable2();
|
|
24826
24853
|
init_Onboarding();
|
|
@@ -25024,8 +25051,8 @@ var init_SenderSelector = __esm({
|
|
|
25024
25051
|
function useAvailableSenders() {
|
|
25025
25052
|
const address = useSession((st) => st.address);
|
|
25026
25053
|
const { profiles } = useLinkedProfiles();
|
|
25027
|
-
const lastCalcedSenders = (0,
|
|
25028
|
-
(0,
|
|
25054
|
+
const lastCalcedSenders = (0, import_react79.useRef)([]);
|
|
25055
|
+
(0, import_react79.useEffect)(() => {
|
|
25029
25056
|
const sendersAccumulator = [
|
|
25030
25057
|
{
|
|
25031
25058
|
type: "embarkai-wallet",
|
|
@@ -25059,13 +25086,13 @@ function useAvailableSenders() {
|
|
|
25059
25086
|
directWalletProfiles: profiles.filter((p) => p.provider === "wallet")
|
|
25060
25087
|
};
|
|
25061
25088
|
}
|
|
25062
|
-
var
|
|
25089
|
+
var import_react79;
|
|
25063
25090
|
var init_useAvailableSenders = __esm({
|
|
25064
25091
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
25065
25092
|
init_SessionContext();
|
|
25066
25093
|
init_tokens();
|
|
25067
25094
|
init_linkedProfiles();
|
|
25068
|
-
|
|
25095
|
+
import_react79 = require("react");
|
|
25069
25096
|
init_wallets();
|
|
25070
25097
|
init_useBridgeStore();
|
|
25071
25098
|
}
|
|
@@ -25480,18 +25507,18 @@ function useHyperlaneHistory() {
|
|
|
25480
25507
|
getNextPageParam: (lastPage) => lastPage.page < lastPage.pageCount ? lastPage.page + 1 : void 0,
|
|
25481
25508
|
queryFn: async ({ pageParam }) => await getHyperlaneBridgeHistory({ page: pageParam, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
25482
25509
|
});
|
|
25483
|
-
const txList = (0,
|
|
25510
|
+
const txList = (0, import_react80.useMemo)(
|
|
25484
25511
|
() => query?.data?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
25485
25512
|
[query?.data]
|
|
25486
25513
|
);
|
|
25487
25514
|
return { query, txList };
|
|
25488
25515
|
}
|
|
25489
|
-
var import_react_query49,
|
|
25516
|
+
var import_react_query49, import_react80, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
25490
25517
|
var init_useHyperlaneHistory = __esm({
|
|
25491
25518
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
25492
25519
|
init_SessionContext();
|
|
25493
25520
|
import_react_query49 = require("@tanstack/react-query");
|
|
25494
|
-
|
|
25521
|
+
import_react80 = require("react");
|
|
25495
25522
|
init_useLayoutDataStore();
|
|
25496
25523
|
init_useFlowSelector();
|
|
25497
25524
|
init_api5();
|
|
@@ -25523,7 +25550,7 @@ function useBridge() {
|
|
|
25523
25550
|
const address = useSession((st) => st.address);
|
|
25524
25551
|
const { data: walletClient } = (0, import_wagmi6.useWalletClient)();
|
|
25525
25552
|
const { mutateAsync: switchChainAsync } = (0, import_wagmi6.useSwitchChain)();
|
|
25526
|
-
const swapDirection = (0,
|
|
25553
|
+
const swapDirection = (0, import_react81.useCallback)(() => {
|
|
25527
25554
|
const {
|
|
25528
25555
|
// bridgeStep,
|
|
25529
25556
|
originChain,
|
|
@@ -25574,7 +25601,7 @@ function useBridge() {
|
|
|
25574
25601
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
25575
25602
|
}
|
|
25576
25603
|
});
|
|
25577
|
-
const handleQuoteEstimation = (0,
|
|
25604
|
+
const handleQuoteEstimation = (0, import_react81.useCallback)((amnt) => {
|
|
25578
25605
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
25579
25606
|
if (!amnt || !Number(amnt)) {
|
|
25580
25607
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -25709,13 +25736,13 @@ function useBridge() {
|
|
|
25709
25736
|
isAssetBridging
|
|
25710
25737
|
};
|
|
25711
25738
|
}
|
|
25712
|
-
var import_react_query50,
|
|
25739
|
+
var import_react_query50, import_react81, import_wagmi6;
|
|
25713
25740
|
var init_useBridge = __esm({
|
|
25714
25741
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
25715
25742
|
init_SessionContext();
|
|
25716
25743
|
init_i18n();
|
|
25717
25744
|
import_react_query50 = require("@tanstack/react-query");
|
|
25718
|
-
|
|
25745
|
+
import_react81 = require("react");
|
|
25719
25746
|
import_wagmi6 = require("wagmi");
|
|
25720
25747
|
init_useLayoutStore();
|
|
25721
25748
|
init_useExternalWalletStore();
|
|
@@ -25746,7 +25773,7 @@ function useHyperlaneRoutes() {
|
|
|
25746
25773
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
25747
25774
|
queryFn: async () => await getHyperlaneWarpRoutes()
|
|
25748
25775
|
});
|
|
25749
|
-
(0,
|
|
25776
|
+
(0, import_react82.useEffect)(() => {
|
|
25750
25777
|
if (!errorWarpRoutes) return;
|
|
25751
25778
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
25752
25779
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -25755,7 +25782,7 @@ function useHyperlaneRoutes() {
|
|
|
25755
25782
|
setOriginChain(null);
|
|
25756
25783
|
setDestinationChain(null);
|
|
25757
25784
|
}, [errorWarpRoutes]);
|
|
25758
|
-
(0,
|
|
25785
|
+
(0, import_react82.useEffect)(() => {
|
|
25759
25786
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
25760
25787
|
let targetHyperRouteToSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
25761
25788
|
if (!targetHyperRouteToSelect) {
|
|
@@ -25780,12 +25807,12 @@ function useHyperlaneRoutes() {
|
|
|
25780
25807
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
25781
25808
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
25782
25809
|
}
|
|
25783
|
-
var import_react_query51,
|
|
25810
|
+
var import_react_query51, import_react82, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
25784
25811
|
var init_useHyperlaneRoutes = __esm({
|
|
25785
25812
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
25786
25813
|
init_SessionContext();
|
|
25787
25814
|
import_react_query51 = require("@tanstack/react-query");
|
|
25788
|
-
|
|
25815
|
+
import_react82 = require("react");
|
|
25789
25816
|
init_useLayoutDataStore();
|
|
25790
25817
|
init_useFlowSelector();
|
|
25791
25818
|
init_api5();
|
|
@@ -25801,7 +25828,7 @@ function useMenuTitle(warpRoutes) {
|
|
|
25801
25828
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
25802
25829
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
25803
25830
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
25804
|
-
(0,
|
|
25831
|
+
(0, import_react83.useEffect)(() => {
|
|
25805
25832
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
25806
25833
|
switch (true) {
|
|
25807
25834
|
case bridgeStep === "sender-selector":
|
|
@@ -25829,11 +25856,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
25829
25856
|
}
|
|
25830
25857
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
25831
25858
|
}
|
|
25832
|
-
var
|
|
25859
|
+
var import_react83;
|
|
25833
25860
|
var init_useMenuTitle = __esm({
|
|
25834
25861
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
25835
25862
|
init_i18n();
|
|
25836
|
-
|
|
25863
|
+
import_react83 = require("react");
|
|
25837
25864
|
init_useFlowSelector();
|
|
25838
25865
|
init_useBridgeStore();
|
|
25839
25866
|
}
|
|
@@ -26083,7 +26110,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26083
26110
|
};
|
|
26084
26111
|
}
|
|
26085
26112
|
});
|
|
26086
|
-
const refreshRouteTokenBalance = (0,
|
|
26113
|
+
const refreshRouteTokenBalance = (0, import_react84.useCallback)(
|
|
26087
26114
|
(senderWallet) => {
|
|
26088
26115
|
switch (true) {
|
|
26089
26116
|
case senderWallet === "embarkai-wallet":
|
|
@@ -26099,7 +26126,7 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26099
26126
|
},
|
|
26100
26127
|
[refreshBalances, qc]
|
|
26101
26128
|
);
|
|
26102
|
-
(0,
|
|
26129
|
+
(0, import_react84.useEffect)(() => {
|
|
26103
26130
|
if (!!isLoadingWarpRoutes || !bridgeSender || !originChain) return;
|
|
26104
26131
|
switch (bridgeSender) {
|
|
26105
26132
|
case "embarkai-wallet":
|
|
@@ -26130,14 +26157,14 @@ function useBridgeBalance(isLoadingWarpRoutes, hyperlaneWarpRoutes) {
|
|
|
26130
26157
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
26131
26158
|
};
|
|
26132
26159
|
}
|
|
26133
|
-
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;
|
|
26134
26161
|
var init_useBridgeBalance = __esm({
|
|
26135
26162
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
26136
26163
|
init_SessionContext();
|
|
26137
26164
|
init_i18n();
|
|
26138
26165
|
import_core8 = require("@embarkai/core");
|
|
26139
26166
|
import_react_query52 = require("@tanstack/react-query");
|
|
26140
|
-
|
|
26167
|
+
import_react84 = require("react");
|
|
26141
26168
|
import_viem15 = require("viem");
|
|
26142
26169
|
import_wagmi7 = require("wagmi");
|
|
26143
26170
|
init_useBlockscoutAssets2();
|
|
@@ -26266,7 +26293,7 @@ function SelectStep(props) {
|
|
|
26266
26293
|
variant: "outline",
|
|
26267
26294
|
size: "medium",
|
|
26268
26295
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
26269
|
-
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: [
|
|
26270
26297
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_lucide_react67.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
26271
26298
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
26272
26299
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -26410,13 +26437,13 @@ function SelectStep(props) {
|
|
|
26410
26437
|
)
|
|
26411
26438
|
] });
|
|
26412
26439
|
}
|
|
26413
|
-
var import_lucide_react67,
|
|
26440
|
+
var import_lucide_react67, import_react85, import_jsx_runtime111;
|
|
26414
26441
|
var init_SelectStep = __esm({
|
|
26415
26442
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
26416
26443
|
init_tokens();
|
|
26417
26444
|
init_i18n();
|
|
26418
26445
|
import_lucide_react67 = require("lucide-react");
|
|
26419
|
-
|
|
26446
|
+
import_react85 = require("react");
|
|
26420
26447
|
init_priceFormatter();
|
|
26421
26448
|
init_utils();
|
|
26422
26449
|
init_useExternalWalletStore();
|
|
@@ -26467,7 +26494,7 @@ var init_checkbox = __esm({
|
|
|
26467
26494
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
26468
26495
|
function ConfirmStep(props) {
|
|
26469
26496
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
26470
|
-
const [userConsent, setUserConsent] = (0,
|
|
26497
|
+
const [userConsent, setUserConsent] = (0, import_react86.useState)(false);
|
|
26471
26498
|
const { t } = useT();
|
|
26472
26499
|
const address = useSession((st) => st.address);
|
|
26473
26500
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -26583,13 +26610,13 @@ function ConfirmStep(props) {
|
|
|
26583
26610
|
}
|
|
26584
26611
|
);
|
|
26585
26612
|
}
|
|
26586
|
-
var import_lucide_react69,
|
|
26613
|
+
var import_lucide_react69, import_react86, import_jsx_runtime113, P_CN;
|
|
26587
26614
|
var init_ConfirmStep = __esm({
|
|
26588
26615
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
26589
26616
|
init_SessionContext();
|
|
26590
26617
|
init_i18n();
|
|
26591
26618
|
import_lucide_react69 = require("lucide-react");
|
|
26592
|
-
|
|
26619
|
+
import_react86 = require("react");
|
|
26593
26620
|
init_priceFormatter();
|
|
26594
26621
|
init_utils();
|
|
26595
26622
|
init_Onboarding();
|
|
@@ -26966,7 +26993,7 @@ function SelectAssetRoute(props) {
|
|
|
26966
26993
|
const { hyperlaneWarpRoutes } = props;
|
|
26967
26994
|
const { t } = useT();
|
|
26968
26995
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
26969
|
-
const tokenList = (0,
|
|
26996
|
+
const tokenList = (0, import_react87.useMemo)(() => {
|
|
26970
26997
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
26971
26998
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
26972
26999
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -27043,13 +27070,13 @@ function SelectAssetRoute(props) {
|
|
|
27043
27070
|
] })
|
|
27044
27071
|
] });
|
|
27045
27072
|
}
|
|
27046
|
-
var import_lucide_react71,
|
|
27073
|
+
var import_lucide_react71, import_react87, import_jsx_runtime116;
|
|
27047
27074
|
var init_SelectAssetRoute = __esm({
|
|
27048
27075
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
27049
27076
|
init_tokens();
|
|
27050
27077
|
init_i18n();
|
|
27051
27078
|
import_lucide_react71 = require("lucide-react");
|
|
27052
|
-
|
|
27079
|
+
import_react87 = require("react");
|
|
27053
27080
|
init_button();
|
|
27054
27081
|
init_ResolveChainIcon();
|
|
27055
27082
|
init_useBridgeStore();
|
|
@@ -27076,7 +27103,7 @@ function HyperlaneBridge() {
|
|
|
27076
27103
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
27077
27104
|
const { directWalletProfiles } = useAvailableSenders();
|
|
27078
27105
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
27079
|
-
(0,
|
|
27106
|
+
(0, import_react88.useEffect)(() => {
|
|
27080
27107
|
return () => {
|
|
27081
27108
|
useBridgeStore.getState().resetSelections();
|
|
27082
27109
|
};
|
|
@@ -27109,10 +27136,10 @@ function HyperlaneBridge() {
|
|
|
27109
27136
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(HistoryDetailsStep, {})
|
|
27110
27137
|
] });
|
|
27111
27138
|
}
|
|
27112
|
-
var
|
|
27139
|
+
var import_react88, import_jsx_runtime117;
|
|
27113
27140
|
var init_HyperlaneBridge = __esm({
|
|
27114
27141
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
27115
|
-
|
|
27142
|
+
import_react88 = require("react");
|
|
27116
27143
|
init_SenderSelector();
|
|
27117
27144
|
init_useAvailableSenders();
|
|
27118
27145
|
init_useBridge();
|
|
@@ -27130,7 +27157,7 @@ function BridgeHistorySwitch(props) {
|
|
|
27130
27157
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
27131
27158
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
27132
27159
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
27133
|
-
const lastBridgeStepRef = (0,
|
|
27160
|
+
const lastBridgeStepRef = (0, import_react89.useRef)(null);
|
|
27134
27161
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
27135
27162
|
return null;
|
|
27136
27163
|
}
|
|
@@ -27149,10 +27176,10 @@ function BridgeHistorySwitch(props) {
|
|
|
27149
27176
|
}
|
|
27150
27177
|
);
|
|
27151
27178
|
}
|
|
27152
|
-
var
|
|
27179
|
+
var import_react89, import_jsx_runtime118;
|
|
27153
27180
|
var init_HistorySwitch = __esm({
|
|
27154
27181
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
27155
|
-
|
|
27182
|
+
import_react89 = require("react");
|
|
27156
27183
|
init_switch();
|
|
27157
27184
|
init_useFlowSelector();
|
|
27158
27185
|
init_useBridgeStore();
|
|
@@ -27243,11 +27270,11 @@ function looksLikeNickname(input) {
|
|
|
27243
27270
|
}
|
|
27244
27271
|
function useNicknameResolve(input, options) {
|
|
27245
27272
|
const { enabled = true, chainId } = options;
|
|
27246
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
27247
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
27273
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react90.useState)("");
|
|
27274
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react90.useState)(false);
|
|
27248
27275
|
const normalized = normalizeNickname(input);
|
|
27249
27276
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
27250
|
-
(0,
|
|
27277
|
+
(0, import_react90.useEffect)(() => {
|
|
27251
27278
|
if (!isNicknameInput || !enabled) {
|
|
27252
27279
|
setDebouncedInput("");
|
|
27253
27280
|
setIsDebouncing(false);
|
|
@@ -27273,7 +27300,7 @@ function useNicknameResolve(input, options) {
|
|
|
27273
27300
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
27274
27301
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
27275
27302
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
27276
|
-
const fingerprintVerification = (0,
|
|
27303
|
+
const fingerprintVerification = (0, import_react90.useMemo)(() => {
|
|
27277
27304
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
27278
27305
|
return null;
|
|
27279
27306
|
}
|
|
@@ -27295,11 +27322,11 @@ function useNicknameResolve(input, options) {
|
|
|
27295
27322
|
resolvedAddress
|
|
27296
27323
|
};
|
|
27297
27324
|
}
|
|
27298
|
-
var import_react_query54,
|
|
27325
|
+
var import_react_query54, import_react90, DEBOUNCE_MS2;
|
|
27299
27326
|
var init_useNicknameResolve = __esm({
|
|
27300
27327
|
"src/hooks/useNicknameResolve.ts"() {
|
|
27301
27328
|
import_react_query54 = require("@tanstack/react-query");
|
|
27302
|
-
|
|
27329
|
+
import_react90 = require("react");
|
|
27303
27330
|
init_nickname();
|
|
27304
27331
|
init_profile();
|
|
27305
27332
|
init_nickname_fingerprint();
|
|
@@ -27312,10 +27339,10 @@ var init_useNicknameResolve = __esm({
|
|
|
27312
27339
|
function useSendTransaction() {
|
|
27313
27340
|
const session = useSession((st) => st.session);
|
|
27314
27341
|
const address = useSession((st) => st.address);
|
|
27315
|
-
const [isLoading, setIsLoading] = (0,
|
|
27316
|
-
const [error, setError] = (0,
|
|
27317
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
27318
|
-
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)(
|
|
27319
27346
|
async (params) => {
|
|
27320
27347
|
if (!session || !address) {
|
|
27321
27348
|
setError("No active session");
|
|
@@ -27412,7 +27439,7 @@ function useSendTransaction() {
|
|
|
27412
27439
|
},
|
|
27413
27440
|
[session, address]
|
|
27414
27441
|
);
|
|
27415
|
-
const reset = (0,
|
|
27442
|
+
const reset = (0, import_react91.useCallback)(() => {
|
|
27416
27443
|
setError(null);
|
|
27417
27444
|
setUserOpHash(null);
|
|
27418
27445
|
setIsLoading(false);
|
|
@@ -27425,10 +27452,10 @@ function useSendTransaction() {
|
|
|
27425
27452
|
reset
|
|
27426
27453
|
};
|
|
27427
27454
|
}
|
|
27428
|
-
var
|
|
27455
|
+
var import_react91, import_viem16, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
27429
27456
|
var init_useSendTransaction = __esm({
|
|
27430
27457
|
"src/hooks/useSendTransaction.ts"() {
|
|
27431
|
-
|
|
27458
|
+
import_react91 = require("react");
|
|
27432
27459
|
import_viem16 = require("viem");
|
|
27433
27460
|
init_SessionContext();
|
|
27434
27461
|
init_account2();
|
|
@@ -27579,7 +27606,7 @@ var init_AssetInputIcon = __esm({
|
|
|
27579
27606
|
|
|
27580
27607
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
27581
27608
|
function NftDisplayCard({ asset }) {
|
|
27582
|
-
const [imageError, setImageError] = (0,
|
|
27609
|
+
const [imageError, setImageError] = (0, import_react92.useState)(false);
|
|
27583
27610
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
27584
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: [
|
|
27585
27612
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
@@ -27607,11 +27634,11 @@ function NftDisplayCard({ asset }) {
|
|
|
27607
27634
|
] })
|
|
27608
27635
|
] });
|
|
27609
27636
|
}
|
|
27610
|
-
var import_lucide_react73,
|
|
27637
|
+
var import_lucide_react73, import_react92, import_jsx_runtime120;
|
|
27611
27638
|
var init_NftDisplayCard = __esm({
|
|
27612
27639
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
27613
27640
|
import_lucide_react73 = require("lucide-react");
|
|
27614
|
-
|
|
27641
|
+
import_react92 = require("react");
|
|
27615
27642
|
import_jsx_runtime120 = require("react/jsx-runtime");
|
|
27616
27643
|
}
|
|
27617
27644
|
});
|
|
@@ -27731,7 +27758,7 @@ function NicknameData(props) {
|
|
|
27731
27758
|
isWalletNotSetup,
|
|
27732
27759
|
isFrozen
|
|
27733
27760
|
} = resolvedNicknameData;
|
|
27734
|
-
(0,
|
|
27761
|
+
(0, import_react93.useEffect)(() => {
|
|
27735
27762
|
if (isResolving) return;
|
|
27736
27763
|
let errMessage = null;
|
|
27737
27764
|
switch (true) {
|
|
@@ -27786,11 +27813,11 @@ function NicknameData(props) {
|
|
|
27786
27813
|
] })
|
|
27787
27814
|
] });
|
|
27788
27815
|
}
|
|
27789
|
-
var import_lucide_react74,
|
|
27816
|
+
var import_lucide_react74, import_react93, import_jsx_runtime122;
|
|
27790
27817
|
var init_NicknameData = __esm({
|
|
27791
27818
|
"src/internal/components/SendMenu/send/components/NicknameData.tsx"() {
|
|
27792
27819
|
import_lucide_react74 = require("lucide-react");
|
|
27793
|
-
|
|
27820
|
+
import_react93 = require("react");
|
|
27794
27821
|
init_no_image();
|
|
27795
27822
|
init_utils();
|
|
27796
27823
|
init_useFlowSelector();
|
|
@@ -28323,16 +28350,16 @@ function SendMenu() {
|
|
|
28323
28350
|
userOpHash,
|
|
28324
28351
|
reset
|
|
28325
28352
|
} = useSendTransaction();
|
|
28326
|
-
(0,
|
|
28353
|
+
(0, import_react94.useEffect)(() => {
|
|
28327
28354
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
28328
28355
|
}, [isAssetsLoading, isTransactionPending]);
|
|
28329
|
-
(0,
|
|
28356
|
+
(0, import_react94.useEffect)(() => {
|
|
28330
28357
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
28331
28358
|
}, [sendTransactionError]);
|
|
28332
28359
|
const { txStep, recipient, amount, selectedAsset, setSelectedAsset } = useSendStore();
|
|
28333
28360
|
const isNft = isNftAsset3(selectedAsset);
|
|
28334
28361
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
28335
|
-
(0,
|
|
28362
|
+
(0, import_react94.useEffect)(() => {
|
|
28336
28363
|
const shouldDefaultAsset = assets.length > 0 && !selectedAsset;
|
|
28337
28364
|
if (!shouldDefaultAsset) return;
|
|
28338
28365
|
const chainNativeCurrency = useSession.getState().chainConfig?.nativeCurrency;
|
|
@@ -28342,7 +28369,7 @@ function SendMenu() {
|
|
|
28342
28369
|
if (isBalance(erc20)) return setSelectedAsset(erc20);
|
|
28343
28370
|
setSelectedAsset(assets[0]);
|
|
28344
28371
|
}, [assets, selectedAsset]);
|
|
28345
|
-
(0,
|
|
28372
|
+
(0, import_react94.useEffect)(
|
|
28346
28373
|
() => () => {
|
|
28347
28374
|
useSendStore.getState().reset();
|
|
28348
28375
|
reset();
|
|
@@ -28352,7 +28379,7 @@ function SendMenu() {
|
|
|
28352
28379
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
28353
28380
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
28354
28381
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
28355
|
-
const complianceAmount = (0,
|
|
28382
|
+
const complianceAmount = (0, import_react94.useMemo)(() => {
|
|
28356
28383
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
28357
28384
|
try {
|
|
28358
28385
|
return (0, import_viem21.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -28367,7 +28394,7 @@ function SendMenu() {
|
|
|
28367
28394
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
28368
28395
|
chainId: activeChainId
|
|
28369
28396
|
});
|
|
28370
|
-
(0,
|
|
28397
|
+
(0, import_react94.useEffect)(() => {
|
|
28371
28398
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
28372
28399
|
switch (true) {
|
|
28373
28400
|
case txStep === "select-asset":
|
|
@@ -28437,7 +28464,7 @@ function SendMenu() {
|
|
|
28437
28464
|
] })
|
|
28438
28465
|
] });
|
|
28439
28466
|
}
|
|
28440
|
-
var import_lucide_react77,
|
|
28467
|
+
var import_lucide_react77, import_react94, import_viem21, import_jsx_runtime125;
|
|
28441
28468
|
var init_SendMenu = __esm({
|
|
28442
28469
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
28443
28470
|
init_SessionContext();
|
|
@@ -28446,7 +28473,7 @@ var init_SendMenu = __esm({
|
|
|
28446
28473
|
init_useSendTransaction();
|
|
28447
28474
|
init_useT();
|
|
28448
28475
|
import_lucide_react77 = require("lucide-react");
|
|
28449
|
-
|
|
28476
|
+
import_react94 = require("react");
|
|
28450
28477
|
import_viem21 = require("viem");
|
|
28451
28478
|
init_useBlockscoutAssets2();
|
|
28452
28479
|
init_useLayoutDataStore();
|
|
@@ -28472,7 +28499,7 @@ var init_send = __esm({
|
|
|
28472
28499
|
// src/internal/components/SendMenu/useSendMenuParams.ts
|
|
28473
28500
|
function useSendMenuParams() {
|
|
28474
28501
|
const { config } = useProviderConfig();
|
|
28475
|
-
(0,
|
|
28502
|
+
(0, import_react95.useEffect)(() => {
|
|
28476
28503
|
const { pageParams, setPageParams } = useLayoutDataStore.getState();
|
|
28477
28504
|
if (!pageParams || !(0, import_lodash_es15.keys)(pageParams).length) return;
|
|
28478
28505
|
const { sendFlow, send, bridge } = pageParams || {};
|
|
@@ -28525,12 +28552,12 @@ function useSendMenuParams() {
|
|
|
28525
28552
|
setPageParams(null);
|
|
28526
28553
|
}, []);
|
|
28527
28554
|
}
|
|
28528
|
-
var import_lodash_es15,
|
|
28555
|
+
var import_lodash_es15, import_react95;
|
|
28529
28556
|
var init_useSendMenuParams = __esm({
|
|
28530
28557
|
"src/internal/components/SendMenu/useSendMenuParams.ts"() {
|
|
28531
28558
|
init_ProviderContext();
|
|
28532
28559
|
import_lodash_es15 = require("lodash-es");
|
|
28533
|
-
|
|
28560
|
+
import_react95 = require("react");
|
|
28534
28561
|
init_useLayoutDataStore();
|
|
28535
28562
|
init_useBridgeStore();
|
|
28536
28563
|
init_useSendStore();
|
|
@@ -28598,17 +28625,17 @@ function SendFlowSelector() {
|
|
|
28598
28625
|
const sendStep = useSendStore((st) => st.txStep);
|
|
28599
28626
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
28600
28627
|
useOnboardingTourAvailable(sendStep === "input" && bridgeStep === "select");
|
|
28601
|
-
(0,
|
|
28628
|
+
(0, import_react96.useEffect)(
|
|
28602
28629
|
() => () => {
|
|
28603
28630
|
useFlowSelectorStore.getState().setError(null);
|
|
28604
28631
|
},
|
|
28605
28632
|
[]
|
|
28606
28633
|
);
|
|
28607
|
-
(0,
|
|
28634
|
+
(0, import_react96.useEffect)(() => {
|
|
28608
28635
|
if (!!config?.current?.features?.showAssetBridge) return;
|
|
28609
28636
|
if (selectorFlow === "bridge") useFlowSelectorStore.getState().setFlow("send");
|
|
28610
28637
|
}, [selectorFlow]);
|
|
28611
|
-
const availableFlows = (0,
|
|
28638
|
+
const availableFlows = (0, import_react96.useMemo)(() => {
|
|
28612
28639
|
const selectorFlows = { send: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(SendMenu, {}) };
|
|
28613
28640
|
if (!!config?.current?.features?.showAssetBridge) selectorFlows.bridge = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(HyperlaneBridge, {});
|
|
28614
28641
|
return selectorFlows;
|
|
@@ -28673,13 +28700,13 @@ function SendFlowSelector() {
|
|
|
28673
28700
|
] })
|
|
28674
28701
|
] });
|
|
28675
28702
|
}
|
|
28676
|
-
var import_lucide_react78,
|
|
28703
|
+
var import_lucide_react78, import_react96, import_jsx_runtime126;
|
|
28677
28704
|
var init_SendFlowSelector = __esm({
|
|
28678
28705
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
28679
28706
|
init_ProviderContext();
|
|
28680
28707
|
init_i18n();
|
|
28681
28708
|
import_lucide_react78 = require("lucide-react");
|
|
28682
|
-
|
|
28709
|
+
import_react96 = require("react");
|
|
28683
28710
|
init_useLayoutDataStore();
|
|
28684
28711
|
init_utils();
|
|
28685
28712
|
init_Expandable2();
|
|
@@ -28742,12 +28769,12 @@ function getServerSnapshot() {
|
|
|
28742
28769
|
return false;
|
|
28743
28770
|
}
|
|
28744
28771
|
function useProMode() {
|
|
28745
|
-
return (0,
|
|
28772
|
+
return (0, import_react97.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
28746
28773
|
}
|
|
28747
|
-
var
|
|
28774
|
+
var import_react97, STORAGE_KEY, EVENT_NAME;
|
|
28748
28775
|
var init_pro_mode = __esm({
|
|
28749
28776
|
"src/internal/lib/pro-mode.ts"() {
|
|
28750
|
-
|
|
28777
|
+
import_react97 = require("react");
|
|
28751
28778
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
28752
28779
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
28753
28780
|
}
|
|
@@ -29553,7 +29580,7 @@ function TransactionsMenu() {
|
|
|
29553
29580
|
const { t } = useT();
|
|
29554
29581
|
useOnboardingTourAvailable(true);
|
|
29555
29582
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
29556
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
29583
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react98.useState)({});
|
|
29557
29584
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
29558
29585
|
const {
|
|
29559
29586
|
data: txHistoryGroups = [],
|
|
@@ -29566,7 +29593,7 @@ function TransactionsMenu() {
|
|
|
29566
29593
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
29567
29594
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
29568
29595
|
});
|
|
29569
|
-
const refreshTxHistory = (0,
|
|
29596
|
+
const refreshTxHistory = (0, import_react98.useCallback)(
|
|
29570
29597
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
29571
29598
|
[qc, chainConfig.id, address]
|
|
29572
29599
|
);
|
|
@@ -29605,14 +29632,14 @@ function TransactionsMenu() {
|
|
|
29605
29632
|
)) })
|
|
29606
29633
|
] });
|
|
29607
29634
|
}
|
|
29608
|
-
var import_react_query57, import_lucide_react80,
|
|
29635
|
+
var import_react_query57, import_lucide_react80, import_react98, import_jsx_runtime128;
|
|
29609
29636
|
var init_TransactionsMenu = __esm({
|
|
29610
29637
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
29611
29638
|
init_SessionContext();
|
|
29612
29639
|
init_i18n();
|
|
29613
29640
|
import_react_query57 = require("@tanstack/react-query");
|
|
29614
29641
|
import_lucide_react80 = require("lucide-react");
|
|
29615
|
-
|
|
29642
|
+
import_react98 = require("react");
|
|
29616
29643
|
init_useLayoutDataStore();
|
|
29617
29644
|
init_Expandable2();
|
|
29618
29645
|
init_Onboarding();
|
|
@@ -29952,7 +29979,7 @@ var init_PageMap = __esm({
|
|
|
29952
29979
|
// src/internal/hooks/usePageMapper.tsx
|
|
29953
29980
|
function usePageMapper() {
|
|
29954
29981
|
const page = useLayoutDataStore((st) => st.page);
|
|
29955
|
-
const closeDialog = (0,
|
|
29982
|
+
const closeDialog = (0, import_react99.useCallback)(() => {
|
|
29956
29983
|
useLayoutStore.setState({ isDialogAnimating: true });
|
|
29957
29984
|
setTimeout(() => {
|
|
29958
29985
|
useLayoutStore.setState({
|
|
@@ -29964,14 +29991,14 @@ function usePageMapper() {
|
|
|
29964
29991
|
});
|
|
29965
29992
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
29966
29993
|
}, []);
|
|
29967
|
-
const openDialog = (0,
|
|
29994
|
+
const openDialog = (0, import_react99.useCallback)((pageItem) => {
|
|
29968
29995
|
useLayoutStore.setState({
|
|
29969
29996
|
dialogContent: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(pageItem.component, {}),
|
|
29970
29997
|
isDialogOpen: true
|
|
29971
29998
|
// isDialogAnimating: true
|
|
29972
29999
|
});
|
|
29973
30000
|
}, []);
|
|
29974
|
-
(0,
|
|
30001
|
+
(0, import_react99.useEffect)(() => {
|
|
29975
30002
|
if (page === null) return closeDialog();
|
|
29976
30003
|
const pageItem = PAGE_MAP[page];
|
|
29977
30004
|
if (!pageItem) {
|
|
@@ -29982,10 +30009,10 @@ function usePageMapper() {
|
|
|
29982
30009
|
openDialog(pageItem);
|
|
29983
30010
|
}, [page, closeDialog, openDialog]);
|
|
29984
30011
|
}
|
|
29985
|
-
var
|
|
30012
|
+
var import_react99, import_jsx_runtime130, CLEAR_DIALOG_TIMEOUT;
|
|
29986
30013
|
var init_usePageMapper = __esm({
|
|
29987
30014
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
29988
|
-
|
|
30015
|
+
import_react99 = require("react");
|
|
29989
30016
|
init_PageMap();
|
|
29990
30017
|
init_constants();
|
|
29991
30018
|
init_useLayoutDataStore();
|
|
@@ -30001,24 +30028,24 @@ function useSettingsNotifications() {
|
|
|
30001
30028
|
const providers = import_auth25.jwtTokenManager.getProviders();
|
|
30002
30029
|
const hasEmail = providers.includes("email");
|
|
30003
30030
|
const { data: userProfile = null } = useUserProfile();
|
|
30004
|
-
(0,
|
|
30031
|
+
(0, import_react100.useEffect)(() => {
|
|
30005
30032
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
30006
30033
|
setSettingsNotifications({
|
|
30007
30034
|
...COMPLETE_KYC_PROGRESS,
|
|
30008
30035
|
status: isKYCVerified ? "resolved" : "active"
|
|
30009
30036
|
});
|
|
30010
30037
|
}, [userProfile, setSettingsNotifications]);
|
|
30011
|
-
(0,
|
|
30038
|
+
(0, import_react100.useEffect)(() => {
|
|
30012
30039
|
setSettingsNotifications({
|
|
30013
30040
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
30014
30041
|
status: hasEmail ? "resolved" : "active"
|
|
30015
30042
|
});
|
|
30016
30043
|
}, [hasEmail, setSettingsNotifications]);
|
|
30017
30044
|
}
|
|
30018
|
-
var
|
|
30045
|
+
var import_react100, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
30019
30046
|
var init_useSettingsNotifications = __esm({
|
|
30020
30047
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
30021
|
-
|
|
30048
|
+
import_react100 = require("react");
|
|
30022
30049
|
init_auth();
|
|
30023
30050
|
init_useLayoutDataStore();
|
|
30024
30051
|
init_useUserProfile();
|
|
@@ -30041,7 +30068,7 @@ var init_package = __esm({
|
|
|
30041
30068
|
"package.json"() {
|
|
30042
30069
|
package_default = {
|
|
30043
30070
|
name: "@embarkai/ui-kit",
|
|
30044
|
-
version: "0.4.
|
|
30071
|
+
version: "0.4.110",
|
|
30045
30072
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
30046
30073
|
type: "module",
|
|
30047
30074
|
main: "./dist/index.cjs",
|
|
@@ -30376,11 +30403,11 @@ function Header() {
|
|
|
30376
30403
|
const embarkPage = useLayoutDataStore((st) => st.page);
|
|
30377
30404
|
const isOnboardingTourAvailable = useOnboardingStore((st) => st.isTourAvailable);
|
|
30378
30405
|
const proMode = useProMode();
|
|
30379
|
-
const [proToast, setProToast] = (0,
|
|
30380
|
-
const [copied, setCopied] = (0,
|
|
30381
|
-
const clickCountRef = (0,
|
|
30382
|
-
const clickTimerRef = (0,
|
|
30383
|
-
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)(() => {
|
|
30384
30411
|
clickCountRef.current += 1;
|
|
30385
30412
|
if (clickTimerRef.current) {
|
|
30386
30413
|
clearTimeout(clickTimerRef.current);
|
|
@@ -30486,7 +30513,7 @@ function Header() {
|
|
|
30486
30513
|
}
|
|
30487
30514
|
);
|
|
30488
30515
|
}
|
|
30489
|
-
var import_lucide_react84,
|
|
30516
|
+
var import_lucide_react84, import_react101, import_jsx_runtime132;
|
|
30490
30517
|
var init_Header = __esm({
|
|
30491
30518
|
"src/internal/components/Header/Header.tsx"() {
|
|
30492
30519
|
init_lumia2();
|
|
@@ -30494,7 +30521,7 @@ var init_Header = __esm({
|
|
|
30494
30521
|
init_ProviderContext();
|
|
30495
30522
|
init_SessionContext();
|
|
30496
30523
|
import_lucide_react84 = require("lucide-react");
|
|
30497
|
-
|
|
30524
|
+
import_react101 = require("react");
|
|
30498
30525
|
init_icons();
|
|
30499
30526
|
init_auth();
|
|
30500
30527
|
init_useLayoutDataStore();
|
|
@@ -30529,7 +30556,7 @@ function useDecideContentStyles() {
|
|
|
30529
30556
|
style: (0, import_lodash_es16.merge)({}, mobileStyles)
|
|
30530
30557
|
};
|
|
30531
30558
|
}
|
|
30532
|
-
var DialogPrimitive, import_lodash_es16, import_lucide_react85,
|
|
30559
|
+
var DialogPrimitive, import_lodash_es16, import_lucide_react85, import_react102, import_jsx_runtime133, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
30533
30560
|
var init_dialog = __esm({
|
|
30534
30561
|
"src/internal/components/ui/dialog.tsx"() {
|
|
30535
30562
|
init_utils();
|
|
@@ -30538,14 +30565,14 @@ var init_dialog = __esm({
|
|
|
30538
30565
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
30539
30566
|
import_lodash_es16 = require("lodash-es");
|
|
30540
30567
|
import_lucide_react85 = require("lucide-react");
|
|
30541
|
-
|
|
30568
|
+
import_react102 = require("react");
|
|
30542
30569
|
init_useLayoutDataStore();
|
|
30543
30570
|
init_useLayoutStore();
|
|
30544
30571
|
init_button();
|
|
30545
30572
|
import_jsx_runtime133 = require("react/jsx-runtime");
|
|
30546
30573
|
Dialog = DialogPrimitive.Root;
|
|
30547
30574
|
DialogPortal = DialogPrimitive.Portal;
|
|
30548
|
-
DialogOverlay = (0,
|
|
30575
|
+
DialogOverlay = (0, import_react102.forwardRef)(
|
|
30549
30576
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30550
30577
|
DialogPrimitive.Overlay,
|
|
30551
30578
|
{
|
|
@@ -30567,7 +30594,7 @@ var init_dialog = __esm({
|
|
|
30567
30594
|
border: "1px solid var(--ui-kit-bd)",
|
|
30568
30595
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
30569
30596
|
};
|
|
30570
|
-
DialogContent = (0,
|
|
30597
|
+
DialogContent = (0, import_react102.forwardRef)(
|
|
30571
30598
|
({ className, children, colorMode, ...props }, ref) => {
|
|
30572
30599
|
const { t, i18n } = useT();
|
|
30573
30600
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -30678,7 +30705,7 @@ var init_dialog = __esm({
|
|
|
30678
30705
|
DialogHeader.displayName = "DialogHeader";
|
|
30679
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 });
|
|
30680
30707
|
DialogFooter.displayName = "DialogFooter";
|
|
30681
|
-
DialogTitle = (0,
|
|
30708
|
+
DialogTitle = (0, import_react102.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
30682
30709
|
DialogPrimitive.Title,
|
|
30683
30710
|
{
|
|
30684
30711
|
ref,
|
|
@@ -30687,7 +30714,7 @@ var init_dialog = __esm({
|
|
|
30687
30714
|
}
|
|
30688
30715
|
));
|
|
30689
30716
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
30690
|
-
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 }));
|
|
30691
30718
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
30692
30719
|
}
|
|
30693
30720
|
});
|
|
@@ -30710,13 +30737,14 @@ function Dialog2() {
|
|
|
30710
30737
|
const { colorMode, maxScrollHeight, isDialogOpen, dialogContent, isDialogForced } = useLayoutStore();
|
|
30711
30738
|
const page = useLayoutDataStore((st) => st.page);
|
|
30712
30739
|
const transitionPageHeight = useLayoutDataStore((st) => st.transitionPageHeight);
|
|
30713
|
-
(0,
|
|
30740
|
+
(0, import_react104.useEffect)(() => useLayoutStore.setState({ isSettings: !!session }), [session]);
|
|
30714
30741
|
usePageMapper();
|
|
30715
30742
|
useAutoConnect();
|
|
30716
30743
|
useBackupStatusChanges();
|
|
30717
30744
|
useDetectMaxScrollHeight();
|
|
30718
30745
|
useSettingsNotifications();
|
|
30719
30746
|
useListenIframeAuthEvents();
|
|
30747
|
+
useAllowExternalModalsScroll(isDialogOpen);
|
|
30720
30748
|
const isHeaderHidden = !session || page === "keysare-backup" /* KEYSARE_BACKUP */ && !hasServerVault;
|
|
30721
30749
|
return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
30722
30750
|
Dialog,
|
|
@@ -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_es17.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_es17.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_es17,
|
|
33526
|
+
var import_core9, import_error_tracking4, import_lodash_es17, 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_es17 = 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");
|
|
@@ -34703,7 +34732,7 @@ function useSendDirectTransaction() {
|
|
|
34703
34732
|
},
|
|
34704
34733
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
34705
34734
|
);
|
|
34706
|
-
const reset = (0,
|
|
34735
|
+
const reset = (0, import_react113.useCallback)(() => {
|
|
34707
34736
|
setError(null);
|
|
34708
34737
|
setTxHash(null);
|
|
34709
34738
|
setIsPending(false);
|
|
@@ -34712,7 +34741,7 @@ function useSendDirectTransaction() {
|
|
|
34712
34741
|
}
|
|
34713
34742
|
|
|
34714
34743
|
// src/hooks/useTransferToLinkedWallet.ts
|
|
34715
|
-
var
|
|
34744
|
+
var import_react114 = require("react");
|
|
34716
34745
|
var import_viem24 = require("viem");
|
|
34717
34746
|
init_SessionContext();
|
|
34718
34747
|
init_account2();
|
|
@@ -34731,14 +34760,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
34731
34760
|
function useTransferToLinkedWallet() {
|
|
34732
34761
|
const session = useSession((st) => st.session);
|
|
34733
34762
|
const { profiles } = useLinkedProfiles();
|
|
34734
|
-
const [isPending, setIsPending] = (0,
|
|
34735
|
-
const [error, setError] = (0,
|
|
34736
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
34737
|
-
const linkedWallets = (0,
|
|
34763
|
+
const [isPending, setIsPending] = (0, import_react114.useState)(false);
|
|
34764
|
+
const [error, setError] = (0, import_react114.useState)(null);
|
|
34765
|
+
const [userOpHash, setUserOpHash] = (0, import_react114.useState)(null);
|
|
34766
|
+
const linkedWallets = (0, import_react114.useMemo)(
|
|
34738
34767
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
34739
34768
|
[profiles]
|
|
34740
34769
|
);
|
|
34741
|
-
const transfer = (0,
|
|
34770
|
+
const transfer = (0, import_react114.useCallback)(
|
|
34742
34771
|
async (params) => {
|
|
34743
34772
|
if (!session) {
|
|
34744
34773
|
setError("No active session");
|
|
@@ -34789,7 +34818,7 @@ function useTransferToLinkedWallet() {
|
|
|
34789
34818
|
},
|
|
34790
34819
|
[session, linkedWallets]
|
|
34791
34820
|
);
|
|
34792
|
-
const reset = (0,
|
|
34821
|
+
const reset = (0, import_react114.useCallback)(() => {
|
|
34793
34822
|
setError(null);
|
|
34794
34823
|
setUserOpHash(null);
|
|
34795
34824
|
setIsPending(false);
|
|
@@ -34813,7 +34842,7 @@ function useNativeWalletSignature() {
|
|
|
34813
34842
|
|
|
34814
34843
|
// src/hooks/useLogout.ts
|
|
34815
34844
|
var import_auth27 = require("@embarkai/core/auth");
|
|
34816
|
-
var
|
|
34845
|
+
var import_react115 = require("react");
|
|
34817
34846
|
var import_wagmi15 = require("wagmi");
|
|
34818
34847
|
init_ProviderContext();
|
|
34819
34848
|
init_SessionContext();
|
|
@@ -34832,7 +34861,7 @@ function useLogout() {
|
|
|
34832
34861
|
}
|
|
34833
34862
|
}
|
|
34834
34863
|
});
|
|
34835
|
-
const logout2 = (0,
|
|
34864
|
+
const logout2 = (0, import_react115.useCallback)(async () => {
|
|
34836
34865
|
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
34837
34866
|
const prevAddress = address;
|
|
34838
34867
|
let userId = null;
|
|
@@ -34951,7 +34980,7 @@ function useTransactions() {
|
|
|
34951
34980
|
|
|
34952
34981
|
// src/modules/assets.ts
|
|
34953
34982
|
init_SessionContext();
|
|
34954
|
-
var
|
|
34983
|
+
var import_react116 = __toESM(require("react"), 1);
|
|
34955
34984
|
var import_viem26 = require("viem");
|
|
34956
34985
|
var import_wagmi17 = require("wagmi");
|
|
34957
34986
|
var COMMON_TOKENS = [
|
|
@@ -35106,7 +35135,7 @@ function useTokenBalance2(tokenAddress, userAddress) {
|
|
|
35106
35135
|
}
|
|
35107
35136
|
});
|
|
35108
35137
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
35109
|
-
const formattedBalance =
|
|
35138
|
+
const formattedBalance = import_react116.default.useMemo(() => {
|
|
35110
35139
|
if (!balance || !tokenInfo) return "0";
|
|
35111
35140
|
return (0, import_viem26.formatUnits)(balance, tokenInfo.decimals);
|
|
35112
35141
|
}, [balance, tokenInfo]);
|