@lumiapassport/ui-kit 1.14.4 → 1.14.5
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 +723 -720
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +566 -563
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4336,7 +4336,7 @@ import {
|
|
|
4336
4336
|
} from "react";
|
|
4337
4337
|
|
|
4338
4338
|
// src/context/LumiaPassportSessionContext.tsx
|
|
4339
|
-
import { Fragment as
|
|
4339
|
+
import { Fragment as Fragment19 } from "react";
|
|
4340
4340
|
import { create as create6 } from "zustand";
|
|
4341
4341
|
|
|
4342
4342
|
// src/internal/components/BalanceFeedProvider/BalanceFeedProvider.tsx
|
|
@@ -4352,7 +4352,7 @@ import { create } from "zustand";
|
|
|
4352
4352
|
init_assets();
|
|
4353
4353
|
import { Key as Key2, Mail as Mail2, Wallet2 as Wallet22 } from "lucide-react";
|
|
4354
4354
|
var LOCAL_COLOR_MODE_KEY = "lumia-passport-theme";
|
|
4355
|
-
var DEFAULT_AUTH_MENU_HEIGHT =
|
|
4355
|
+
var DEFAULT_AUTH_MENU_HEIGHT = 337;
|
|
4356
4356
|
var DEFAULT_MAIN_MENU_HEIGHT = 90;
|
|
4357
4357
|
var DEFAULT_SETTINGS_MENU_HEIGHT = 346;
|
|
4358
4358
|
var MAX_CONTENT_HEIGHT = 640;
|
|
@@ -4369,23 +4369,23 @@ var PROVIDERS_META2 = {
|
|
|
4369
4369
|
};
|
|
4370
4370
|
|
|
4371
4371
|
// src/internal/hooks/useLayoutDataStore.ts
|
|
4372
|
-
var PageKey = /* @__PURE__ */ ((
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
return
|
|
4372
|
+
var PageKey = /* @__PURE__ */ ((PageKey4) => {
|
|
4373
|
+
PageKey4["AUTH"] = "auth";
|
|
4374
|
+
PageKey4["TERMS_OF_SERVICE"] = "terms-of-service";
|
|
4375
|
+
PageKey4["MAIN_MENU"] = "main-menu";
|
|
4376
|
+
PageKey4["SETTINGS"] = "settings";
|
|
4377
|
+
PageKey4["SEND"] = "send";
|
|
4378
|
+
PageKey4["RECEIVE"] = "receive";
|
|
4379
|
+
PageKey4["BUY"] = "buy";
|
|
4380
|
+
PageKey4["KYC"] = "kyc";
|
|
4381
|
+
PageKey4["TRANSACTIONS"] = "transactions";
|
|
4382
|
+
PageKey4["ASSETS"] = "assets";
|
|
4383
|
+
PageKey4["MANAGE_WALLET"] = "manage-wallet";
|
|
4384
|
+
PageKey4["UNLINK_PROVIDER"] = "unlink-provider";
|
|
4385
|
+
PageKey4["SECURITY"] = "security";
|
|
4386
|
+
PageKey4["KEYSARE_BACKUP"] = "keysare-backup";
|
|
4387
|
+
PageKey4["KEYSHARE_RESTORE"] = "keyshare-restore";
|
|
4388
|
+
return PageKey4;
|
|
4389
4389
|
})(PageKey || {});
|
|
4390
4390
|
var useLayoutDataStore = create((set) => ({
|
|
4391
4391
|
page: null,
|
|
@@ -4397,6 +4397,7 @@ var useLayoutDataStore = create((set) => ({
|
|
|
4397
4397
|
balance: { decimals: 18, formatted: "0.0", symbol: "LUMIA", value: BigInt(0) },
|
|
4398
4398
|
mainPageHeight: DEFAULT_MAIN_MENU_HEIGHT,
|
|
4399
4399
|
settingsNotifications: [],
|
|
4400
|
+
isWalletLinking: false,
|
|
4400
4401
|
setPage: (page) => set({ page }),
|
|
4401
4402
|
setPageParams: (pageOptions) => set({ pageParams: pageOptions }),
|
|
4402
4403
|
setCryptoRate: (lumiaRate) => set({ cryptoRate: lumiaRate }),
|
|
@@ -4414,7 +4415,8 @@ var useLayoutDataStore = create((set) => ({
|
|
|
4414
4415
|
}
|
|
4415
4416
|
const filtered = prev.settingsNotifications.filter((n) => n.id !== notification.id);
|
|
4416
4417
|
return { settingsNotifications: filtered };
|
|
4417
|
-
})
|
|
4418
|
+
}),
|
|
4419
|
+
setIsWalletLinking: (isWalletLinking) => set({ isWalletLinking })
|
|
4418
4420
|
}));
|
|
4419
4421
|
|
|
4420
4422
|
// src/internal/components/BalanceFeedProvider/BalanceFeedProvider.tsx
|
|
@@ -4510,7 +4512,7 @@ import { useEffect as useEffect31 } from "react";
|
|
|
4510
4512
|
// package.json
|
|
4511
4513
|
var package_default = {
|
|
4512
4514
|
name: "@lumiapassport/ui-kit",
|
|
4513
|
-
version: "1.14.
|
|
4515
|
+
version: "1.14.5",
|
|
4514
4516
|
description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
|
|
4515
4517
|
type: "module",
|
|
4516
4518
|
main: "./dist/index.cjs",
|
|
@@ -4743,6 +4745,15 @@ Button.displayName = "Button";
|
|
|
4743
4745
|
|
|
4744
4746
|
// src/internal/components/Footer/Footer.tsx
|
|
4745
4747
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4748
|
+
function Version({ className }) {
|
|
4749
|
+
return /* @__PURE__ */ jsx4(
|
|
4750
|
+
"span",
|
|
4751
|
+
{
|
|
4752
|
+
className: cn("font-mono text-[10px] text-[var(--l-pass-fg-muted)]", className),
|
|
4753
|
+
children: `v${package_default.version}`
|
|
4754
|
+
}
|
|
4755
|
+
);
|
|
4756
|
+
}
|
|
4746
4757
|
function Footer() {
|
|
4747
4758
|
const qc = useQueryClient();
|
|
4748
4759
|
const { callbacks } = useLumiaPassportConfig();
|
|
@@ -4781,7 +4792,7 @@ function Footer() {
|
|
|
4781
4792
|
"div",
|
|
4782
4793
|
{
|
|
4783
4794
|
style: { borderTop: "1px solid var(--l-pass-bd)" },
|
|
4784
|
-
className:
|
|
4795
|
+
className: "w-full flex flex-col items-center p-[var(--l-pass-pd)] pb-5",
|
|
4785
4796
|
children: [
|
|
4786
4797
|
/* @__PURE__ */ jsxs3("div", { className: "w-full flex items-center justify-between", children: [
|
|
4787
4798
|
/* @__PURE__ */ jsxs3(
|
|
@@ -4823,9 +4834,9 @@ function Footer() {
|
|
|
4823
4834
|
isDisconnecting ? /* @__PURE__ */ jsx4(Loader, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsx4(LogOut, { className: "w-4 h-4" })
|
|
4824
4835
|
]
|
|
4825
4836
|
}
|
|
4826
|
-
) : /* @__PURE__ */ jsx4(
|
|
4837
|
+
) : /* @__PURE__ */ jsx4(Version, {})
|
|
4827
4838
|
] }),
|
|
4828
|
-
!!address && /* @__PURE__ */ jsx4(
|
|
4839
|
+
!!address && /* @__PURE__ */ jsx4(Version, { className: "block w-fit mt-1" })
|
|
4829
4840
|
]
|
|
4830
4841
|
}
|
|
4831
4842
|
);
|
|
@@ -5478,8 +5489,34 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
5478
5489
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
5479
5490
|
var VisuallyHidden = ({ children }) => /* @__PURE__ */ jsx13("span", { className: "sr-only absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0", children });
|
|
5480
5491
|
|
|
5492
|
+
// src/internal/hooks/useListenIframeAuthEvents.ts
|
|
5493
|
+
import { useCallback, useEffect as useEffect3 } from "react";
|
|
5494
|
+
function useListenIframeAuthEvents() {
|
|
5495
|
+
const setPage = useLayoutDataStore((state) => state.setPage);
|
|
5496
|
+
const setIsIframeReady = useLumiaPassportSession((state) => state.setIsIframeReady);
|
|
5497
|
+
const handleIframeMessage = useCallback(
|
|
5498
|
+
(event) => {
|
|
5499
|
+
if (event.data?.type === "LUMIA_PASSPORT_IFRAME_READY") {
|
|
5500
|
+
console.log("[ IFRAME MESSAGE CACTHED ] Iframe is ready");
|
|
5501
|
+
setIsIframeReady(true);
|
|
5502
|
+
} else if (event.data?.type === "LUMIA_PASSPORT_SHOW_IFRAME") {
|
|
5503
|
+
console.log("[ IFRAME MESSAGE CACTHED ] Consent screen shown - hiding auth modal");
|
|
5504
|
+
} else if (event.data?.type === "LUMIA_PASSPORT_HIDE_IFRAME") {
|
|
5505
|
+
console.log("[ IFRAME MESSAGE CACTHED ] Consent screen hidden");
|
|
5506
|
+
} else if (event.data?.type === "KEYSHARE_RECOVERY_NEEDED") {
|
|
5507
|
+
console.log("[ IFRAME MESSAGE CACTHED] recovery neede");
|
|
5508
|
+
}
|
|
5509
|
+
},
|
|
5510
|
+
[setPage, setIsIframeReady]
|
|
5511
|
+
);
|
|
5512
|
+
useEffect3(() => {
|
|
5513
|
+
window.addEventListener("message", handleIframeMessage);
|
|
5514
|
+
return () => window.removeEventListener("message", handleIframeMessage);
|
|
5515
|
+
}, [handleIframeMessage]);
|
|
5516
|
+
}
|
|
5517
|
+
|
|
5481
5518
|
// src/internal/hooks/useAutoConnect.ts
|
|
5482
|
-
import { useCallback, useEffect as
|
|
5519
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef2 } from "react";
|
|
5483
5520
|
function useAutoConnect() {
|
|
5484
5521
|
const {
|
|
5485
5522
|
config: { current: config },
|
|
@@ -5499,7 +5536,7 @@ function useAutoConnect() {
|
|
|
5499
5536
|
setIsIframeReady,
|
|
5500
5537
|
setIsLoading
|
|
5501
5538
|
} = useLumiaPassportSession();
|
|
5502
|
-
const createSessionWithKeyshare =
|
|
5539
|
+
const createSessionWithKeyshare = useCallback2(
|
|
5503
5540
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
5504
5541
|
try {
|
|
5505
5542
|
try {
|
|
@@ -5534,7 +5571,7 @@ function useAutoConnect() {
|
|
|
5534
5571
|
[usePaymaster, setStatus, callbacks]
|
|
5535
5572
|
);
|
|
5536
5573
|
const autoConnectAttemptedRef = useRef2(false);
|
|
5537
|
-
|
|
5574
|
+
useEffect4(() => {
|
|
5538
5575
|
if (autoConnectAttemptedRef.current) return;
|
|
5539
5576
|
setIsLoading(true);
|
|
5540
5577
|
const tryAutoConnect = async (attempt) => {
|
|
@@ -5656,14 +5693,13 @@ function useAutoConnect() {
|
|
|
5656
5693
|
|
|
5657
5694
|
// src/internal/hooks/useBackupStatusChanges.ts
|
|
5658
5695
|
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
5659
|
-
import { useEffect as
|
|
5696
|
+
import { useEffect as useEffect5 } from "react";
|
|
5660
5697
|
init_vaultClient();
|
|
5661
5698
|
function useBackupStatusChanges() {
|
|
5662
5699
|
const setHasServerVault = useLumiaPassportSession((st) => st.setHasServerVault);
|
|
5663
5700
|
const { mutate: handleBackupStatusChanged } = useMutation2({
|
|
5664
5701
|
mutationFn: async (event) => {
|
|
5665
5702
|
const customEvent = event;
|
|
5666
|
-
console.log("[BACKUP STATUS] changed:", customEvent.detail);
|
|
5667
5703
|
return await getShareRecoveryStats();
|
|
5668
5704
|
},
|
|
5669
5705
|
onSuccess: (stats) => {
|
|
@@ -5680,7 +5716,7 @@ function useBackupStatusChanges() {
|
|
|
5680
5716
|
console.warn("[BACKUP STATUS] Failed to fetch initial vault status:", error);
|
|
5681
5717
|
}
|
|
5682
5718
|
});
|
|
5683
|
-
|
|
5719
|
+
useEffect5(() => {
|
|
5684
5720
|
window.addEventListener("lumia-passport-backup-status-changed", handleBackupStatusChanged);
|
|
5685
5721
|
return () => {
|
|
5686
5722
|
window.removeEventListener("lumia-passport-backup-status-changed", handleBackupStatusChanged);
|
|
@@ -5689,7 +5725,7 @@ function useBackupStatusChanges() {
|
|
|
5689
5725
|
}
|
|
5690
5726
|
|
|
5691
5727
|
// src/internal/hooks/useBackupWarning.ts
|
|
5692
|
-
import { useEffect as
|
|
5728
|
+
import { useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
5693
5729
|
var WARNING_TIMEOUT_MS = 24e3;
|
|
5694
5730
|
function useBackupWarning() {
|
|
5695
5731
|
const config = useLumiaPassportConfig().config;
|
|
@@ -5698,7 +5734,7 @@ function useBackupWarning() {
|
|
|
5698
5734
|
const page = useLayoutDataStore((st) => st.page);
|
|
5699
5735
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
5700
5736
|
const timeoutRef = useRef3(null);
|
|
5701
|
-
|
|
5737
|
+
useEffect6(() => {
|
|
5702
5738
|
if (timeoutRef.current) {
|
|
5703
5739
|
clearTimeout(timeoutRef.current);
|
|
5704
5740
|
timeoutRef.current = null;
|
|
@@ -5720,7 +5756,7 @@ function useBackupWarning() {
|
|
|
5720
5756
|
|
|
5721
5757
|
// src/internal/hooks/useCheckVaultStatus.ts
|
|
5722
5758
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
5723
|
-
import { useEffect as
|
|
5759
|
+
import { useEffect as useEffect7 } from "react";
|
|
5724
5760
|
init_vaultClient();
|
|
5725
5761
|
function useCheckVaultStatus() {
|
|
5726
5762
|
const address = useLumiaPassportSession((st) => st.address);
|
|
@@ -5739,7 +5775,7 @@ function useCheckVaultStatus() {
|
|
|
5739
5775
|
setHasServerVault(false);
|
|
5740
5776
|
}
|
|
5741
5777
|
});
|
|
5742
|
-
|
|
5778
|
+
useEffect7(() => {
|
|
5743
5779
|
if (!address) return setHasServerVault(false);
|
|
5744
5780
|
checkVaultStatus();
|
|
5745
5781
|
}, [address, checkVaultStatus]);
|
|
@@ -5747,12 +5783,12 @@ function useCheckVaultStatus() {
|
|
|
5747
5783
|
|
|
5748
5784
|
// src/internal/hooks/useDetectMaxScrollHeight.ts
|
|
5749
5785
|
import { debounce } from "lodash-es";
|
|
5750
|
-
import { useCallback as
|
|
5786
|
+
import { useCallback as useCallback3, useEffect as useEffect8 } from "react";
|
|
5751
5787
|
var DEBOUNCE_DELAY = 50;
|
|
5752
5788
|
function useDetectMaxScrollHeight() {
|
|
5753
5789
|
const setIsMobileView = useLayoutStore((state) => state.setIsMobileView);
|
|
5754
5790
|
const setMaxScrollHeight = useLayoutStore((state) => state.setMaxScrollHeight);
|
|
5755
|
-
const onResize =
|
|
5791
|
+
const onResize = useCallback3(
|
|
5756
5792
|
debounce(({ width, height }) => {
|
|
5757
5793
|
const limContentHeight = height * 0.92 - 116 - 72;
|
|
5758
5794
|
setIsMobileView(width < height && (width < 475 || limContentHeight <= MAX_CONTENT_HEIGHT));
|
|
@@ -5760,7 +5796,7 @@ function useDetectMaxScrollHeight() {
|
|
|
5760
5796
|
}, DEBOUNCE_DELAY),
|
|
5761
5797
|
[setMaxScrollHeight, setIsMobileView]
|
|
5762
5798
|
);
|
|
5763
|
-
|
|
5799
|
+
useEffect8(() => {
|
|
5764
5800
|
const obs = new ResizeObserver(([entry]) => onResize(entry.contentRect));
|
|
5765
5801
|
const doc = window.document.getElementsByTagName("html")[0];
|
|
5766
5802
|
if (doc) obs.observe(doc);
|
|
@@ -5773,9 +5809,34 @@ import { useCallback as useCallback16, useEffect as useEffect28 } from "react";
|
|
|
5773
5809
|
|
|
5774
5810
|
// src/internal/components/AuthMenu/AuthMenu.tsx
|
|
5775
5811
|
import { AnimatePresence, motion } from "framer-motion";
|
|
5776
|
-
import { Loader as Loader5 } from "lucide-react";
|
|
5812
|
+
import { AlertTriangle as AlertTriangle2, Loader as Loader5 } from "lucide-react";
|
|
5777
5813
|
import { useEffect as useEffect11, useMemo } from "react";
|
|
5778
5814
|
|
|
5815
|
+
// src/internal/components/ui/highlight.tsx
|
|
5816
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
5817
|
+
var CARD_STYLES = {
|
|
5818
|
+
info: "text-[var(--l-pass-info)] bg-[var(--l-pass-bg-info)]",
|
|
5819
|
+
success: "text-[var(--l-pass-success)] bg-[var(--l-pass-bg-success)]",
|
|
5820
|
+
warning: "text-[var(--l-pass-warning)] bg-[var(--l-pass-bg-warning)]",
|
|
5821
|
+
error: "text-[var(--l-pass-error)] bg-[var(--l-pass-bg-error)]"
|
|
5822
|
+
};
|
|
5823
|
+
function Highlight(props) {
|
|
5824
|
+
const { type = "info", children, className } = props;
|
|
5825
|
+
return /* @__PURE__ */ jsx14(
|
|
5826
|
+
"div",
|
|
5827
|
+
{
|
|
5828
|
+
className: cn(
|
|
5829
|
+
"w-full text-xs rounded-[var(--l-pass-el-bdrs)] p-[var(--l-pass-pd)]",
|
|
5830
|
+
"whitespace-pre-line",
|
|
5831
|
+
type === "error" ? "break-all" : "break-normal",
|
|
5832
|
+
CARD_STYLES[type],
|
|
5833
|
+
className
|
|
5834
|
+
),
|
|
5835
|
+
children
|
|
5836
|
+
}
|
|
5837
|
+
);
|
|
5838
|
+
}
|
|
5839
|
+
|
|
5779
5840
|
// src/internal/components/AuthMenu/AuthFailedStep.tsx
|
|
5780
5841
|
import { AlertTriangle, Cross } from "lucide-react";
|
|
5781
5842
|
|
|
@@ -5788,68 +5849,58 @@ var useAuthStore = create3((set) => ({
|
|
|
5788
5849
|
expiresIn: null,
|
|
5789
5850
|
codeSendError: null,
|
|
5790
5851
|
passkeyStatus: "idle",
|
|
5791
|
-
passkeyError: null,
|
|
5792
|
-
failedMessage: null,
|
|
5793
5852
|
failedType: "general",
|
|
5794
|
-
verificationError: null,
|
|
5795
5853
|
setStep: (step) => set({ step }),
|
|
5796
|
-
setAlert: (alert2) => set({ alert: alert2 }),
|
|
5797
5854
|
setEmail: (email) => set({ email }),
|
|
5798
5855
|
setExpiresIn: (expiresIn) => set({ expiresIn }),
|
|
5799
|
-
setCodeSendError: (error) => set({ codeSendError: error }),
|
|
5800
5856
|
setPasskeyStatus: (status) => set({ passkeyStatus: status }),
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
setFailedType: (type) => set({ failedType: type }),
|
|
5804
|
-
setVerificationError: (error) => set({ verificationError: error })
|
|
5857
|
+
setAlert: (alert2) => set({ alert: alert2 }),
|
|
5858
|
+
setFailedType: (type) => set({ failedType: type })
|
|
5805
5859
|
}));
|
|
5806
5860
|
|
|
5807
5861
|
// src/internal/components/AuthMenu/AuthFailedStep.tsx
|
|
5808
|
-
import { jsx as
|
|
5862
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5809
5863
|
function AuthFailedStep() {
|
|
5810
5864
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
5811
|
-
const {
|
|
5865
|
+
const { failedType, setStep, setFailedType, setAlert } = useAuthStore();
|
|
5812
5866
|
const isCritical = failedType === "critical" || failedType === "config";
|
|
5813
5867
|
return /* @__PURE__ */ jsxs12("div", { className: "w-full flex flex-col text-center gap-4 p-4", children: [
|
|
5814
|
-
/* @__PURE__ */
|
|
5868
|
+
/* @__PURE__ */ jsx15(
|
|
5815
5869
|
"div",
|
|
5816
5870
|
{
|
|
5817
5871
|
className: cn(
|
|
5818
5872
|
"w-full flex flex-col p-2 gap-2 rounded-[var(--l-pass-el-bdrs)]",
|
|
5819
5873
|
isCritical ? "text-[var(--l-pass-error)] bg-[var(--l-pass-bg-error)]" : "text-[var(--l-pass-warning)] bg-[var(--l-pass-bg-warning)]"
|
|
5820
5874
|
),
|
|
5821
|
-
children: [
|
|
5822
|
-
/* @__PURE__ */
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
] }),
|
|
5826
|
-
failedMessage && /* @__PURE__ */ jsx14("span", { className: "text-center block text-sm whitespace-pre-line leading-relaxed", children: failedMessage })
|
|
5827
|
-
]
|
|
5875
|
+
children: /* @__PURE__ */ jsxs12("div", { className: "w-full flex items-center justify-center gap-2", children: [
|
|
5876
|
+
isCritical ? /* @__PURE__ */ jsx15(AlertTriangle, { className: "w-5 h-5 text-[var(--l-pass-error)]" }) : /* @__PURE__ */ jsx15(Cross, { className: "w-5 h-5 text-[var(--l-pass-warning)]" }),
|
|
5877
|
+
/* @__PURE__ */ jsx15("span", { className: "text-center block text-xl font-bold", children: failedType === "config" ? "Configuration Error" : failedType === "critical" ? "Critical Error" : "Failed" })
|
|
5878
|
+
] })
|
|
5828
5879
|
}
|
|
5829
5880
|
),
|
|
5830
5881
|
failedType === "config" && /* @__PURE__ */ jsxs12("div", { className: "p-2 rounded-[var(--l-pass-el-bdrs)] bg-[var(--l-pass-bg-info)]", children: [
|
|
5831
|
-
/* @__PURE__ */
|
|
5882
|
+
/* @__PURE__ */ jsx15("div", { className: "text-sm font-medium text-[var(--l-pass-info)] mb-2", children: "To fix this issue:" }),
|
|
5832
5883
|
/* @__PURE__ */ jsxs12("ul", { className: "text-xs text-[var(--l-pass-info)] text-left space-y-1 list-disc list-inside", children: [
|
|
5833
|
-
/* @__PURE__ */
|
|
5834
|
-
/* @__PURE__ */
|
|
5835
|
-
/* @__PURE__ */
|
|
5884
|
+
/* @__PURE__ */ jsx15("li", { children: "Contact your project administrator" }),
|
|
5885
|
+
/* @__PURE__ */ jsx15("li", { children: "Verify projectId is correctly configured" }),
|
|
5886
|
+
/* @__PURE__ */ jsx15("li", { children: "Check project metadata on the server" })
|
|
5836
5887
|
] })
|
|
5837
5888
|
] }),
|
|
5838
5889
|
failedType === "critical" && /* @__PURE__ */ jsxs12("div", { className: "p-2 rounded-[var(--l-pass-el-bdrs)] bg-[var(--l-pass-bg-error)] border", children: [
|
|
5839
|
-
/* @__PURE__ */
|
|
5890
|
+
/* @__PURE__ */ jsx15("div", { className: "text-sm font-semibold text-[var(--l-pass-error)] mb-2", children: "What to do next:" }),
|
|
5840
5891
|
/* @__PURE__ */ jsxs12("ul", { className: "text-xs text-[var(--l-pass-error)] text-left space-y-1 list-disc list-inside", children: [
|
|
5841
|
-
/* @__PURE__ */
|
|
5842
|
-
/* @__PURE__ */
|
|
5843
|
-
/* @__PURE__ */
|
|
5892
|
+
/* @__PURE__ */ jsx15("li", { children: "Contact support immediately" }),
|
|
5893
|
+
/* @__PURE__ */ jsx15("li", { children: "Provide your projectId and error details" }),
|
|
5894
|
+
/* @__PURE__ */ jsx15("li", { children: "You may need to create a new account" })
|
|
5844
5895
|
] })
|
|
5845
5896
|
] }),
|
|
5846
|
-
/* @__PURE__ */
|
|
5897
|
+
/* @__PURE__ */ jsx15("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx15(
|
|
5847
5898
|
Button,
|
|
5848
5899
|
{
|
|
5849
5900
|
size: "large",
|
|
5850
5901
|
onClick: () => {
|
|
5851
5902
|
setStep("signin");
|
|
5852
|
-
|
|
5903
|
+
setAlert(null);
|
|
5853
5904
|
setFailedType("general");
|
|
5854
5905
|
setIsLoading(false);
|
|
5855
5906
|
},
|
|
@@ -5868,7 +5919,7 @@ init_profile();
|
|
|
5868
5919
|
|
|
5869
5920
|
// src/internal/components/ui/input.tsx
|
|
5870
5921
|
import React2, { useImperativeHandle, useRef as useRef4 } from "react";
|
|
5871
|
-
import { jsx as
|
|
5922
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5872
5923
|
var Input = React2.forwardRef((props, ref) => {
|
|
5873
5924
|
const { className, disabled, error, Icon, element, ...inputProps } = props;
|
|
5874
5925
|
const internalRef = useRef4(null);
|
|
@@ -5890,8 +5941,8 @@ var Input = React2.forwardRef((props, ref) => {
|
|
|
5890
5941
|
internalRef.current?.focus();
|
|
5891
5942
|
},
|
|
5892
5943
|
children: [
|
|
5893
|
-
Icon && /* @__PURE__ */
|
|
5894
|
-
/* @__PURE__ */
|
|
5944
|
+
Icon && /* @__PURE__ */ jsx16("div", { className: "flex flex-none items-center justify-center w-6 h-6 p-1", children: /* @__PURE__ */ jsx16(Icon, { width: 16, height: 16, className: "text-[var(--l-pass-fg)]" }) }),
|
|
5945
|
+
/* @__PURE__ */ jsx16(
|
|
5895
5946
|
"input",
|
|
5896
5947
|
{
|
|
5897
5948
|
ref: internalRef,
|
|
@@ -5910,13 +5961,13 @@ var Input = React2.forwardRef((props, ref) => {
|
|
|
5910
5961
|
]
|
|
5911
5962
|
}
|
|
5912
5963
|
),
|
|
5913
|
-
!!error?.length && /* @__PURE__ */
|
|
5964
|
+
!!error?.length && /* @__PURE__ */ jsx16("span", { className: "block text-[var(--l-pass-error)]", children: error })
|
|
5914
5965
|
] });
|
|
5915
5966
|
});
|
|
5916
5967
|
Input.displayName = "Input";
|
|
5917
5968
|
|
|
5918
5969
|
// src/internal/components/AuthMenu/DisaplayNameStep/DisplayNameInput.tsx
|
|
5919
|
-
import { jsx as
|
|
5970
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5920
5971
|
var DisplayNameInput = ({ onComplete, onSkip }) => {
|
|
5921
5972
|
const [displayName, setDisplayName] = useState4("");
|
|
5922
5973
|
const [isLoading, setIsLoading] = useState4(false);
|
|
@@ -5946,12 +5997,12 @@ var DisplayNameInput = ({ onComplete, onSkip }) => {
|
|
|
5946
5997
|
};
|
|
5947
5998
|
return /* @__PURE__ */ jsxs14("div", { className: "w-full p-[var(--l-pass-pd)] flex flex-col gap-[var(--l-pass-gap)]", children: [
|
|
5948
5999
|
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-center gap-2 px-5 pt-3 pb-6", children: [
|
|
5949
|
-
/* @__PURE__ */
|
|
5950
|
-
/* @__PURE__ */
|
|
6000
|
+
/* @__PURE__ */ jsx17(LumiaLogo, { size: 24, className: "w-6 h-6" }),
|
|
6001
|
+
/* @__PURE__ */ jsx17("span", { className: "font-bold text-xl leading-6", children: "What's your name?" })
|
|
5951
6002
|
] }),
|
|
5952
|
-
/* @__PURE__ */
|
|
6003
|
+
/* @__PURE__ */ jsx17("span", { className: "block w-full text-xs text-center", children: "This helps personalize your experience" }),
|
|
5953
6004
|
/* @__PURE__ */ jsxs14("form", { onSubmit: handleSubmit, className: "w-full flex flex-col gap-[var(--l-pass-pd)]", children: [
|
|
5954
|
-
/* @__PURE__ */
|
|
6005
|
+
/* @__PURE__ */ jsx17(
|
|
5955
6006
|
Input,
|
|
5956
6007
|
{
|
|
5957
6008
|
Icon: User,
|
|
@@ -5969,7 +6020,7 @@ var DisplayNameInput = ({ onComplete, onSkip }) => {
|
|
|
5969
6020
|
}
|
|
5970
6021
|
),
|
|
5971
6022
|
/* @__PURE__ */ jsxs14("div", { className: "w-full flex gap-[var(--l-pass-gap)]", children: [
|
|
5972
|
-
/* @__PURE__ */
|
|
6023
|
+
/* @__PURE__ */ jsx17(
|
|
5973
6024
|
Button,
|
|
5974
6025
|
{
|
|
5975
6026
|
type: "submit",
|
|
@@ -5979,7 +6030,7 @@ var DisplayNameInput = ({ onComplete, onSkip }) => {
|
|
|
5979
6030
|
children: isLoading ? "Saving..." : "Continue"
|
|
5980
6031
|
}
|
|
5981
6032
|
),
|
|
5982
|
-
/* @__PURE__ */
|
|
6033
|
+
/* @__PURE__ */ jsx17(
|
|
5983
6034
|
Button,
|
|
5984
6035
|
{
|
|
5985
6036
|
className: "flex-1 text-[var(--l-pass-fg-muted)]",
|
|
@@ -5997,17 +6048,16 @@ var DisplayNameInput = ({ onComplete, onSkip }) => {
|
|
|
5997
6048
|
};
|
|
5998
6049
|
|
|
5999
6050
|
// src/internal/components/AuthMenu/DisaplayNameStep/DisplayNameStep.tsx
|
|
6000
|
-
import { jsx as
|
|
6051
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
6001
6052
|
function DisplayNameStep(props) {
|
|
6002
6053
|
const { onAuthSuccess } = props;
|
|
6003
6054
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
6004
|
-
const {
|
|
6055
|
+
const { setStep, setEmail, setPasskeyStatus, setAlert } = useAuthStore();
|
|
6005
6056
|
const onSkip = async () => {
|
|
6006
6057
|
setPage(null);
|
|
6007
6058
|
setStep("signin");
|
|
6008
6059
|
setEmail("");
|
|
6009
|
-
|
|
6010
|
-
setPasskeyError("");
|
|
6060
|
+
setAlert(null);
|
|
6011
6061
|
setPasskeyStatus("idle");
|
|
6012
6062
|
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
6013
6063
|
if (onAuthSuccess) await onAuthSuccess();
|
|
@@ -6016,21 +6066,20 @@ function DisplayNameStep(props) {
|
|
|
6016
6066
|
setPage(null);
|
|
6017
6067
|
setStep("signin");
|
|
6018
6068
|
setEmail("");
|
|
6019
|
-
|
|
6020
|
-
setPasskeyError("");
|
|
6069
|
+
setAlert(null);
|
|
6021
6070
|
setPasskeyStatus("idle");
|
|
6022
6071
|
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
6023
6072
|
if (onAuthSuccess) await onAuthSuccess();
|
|
6024
6073
|
};
|
|
6025
|
-
return /* @__PURE__ */
|
|
6074
|
+
return /* @__PURE__ */ jsx18(DisplayNameInput, { onComplete, onSkip });
|
|
6026
6075
|
}
|
|
6027
6076
|
|
|
6028
6077
|
// src/internal/components/AuthMenu/PassKeyStep.tsx
|
|
6029
6078
|
import { ArrowLeft as ArrowLeft3, Key as Key3 } from "lucide-react";
|
|
6030
|
-
import { useCallback as
|
|
6079
|
+
import { useCallback as useCallback5 } from "react";
|
|
6031
6080
|
|
|
6032
6081
|
// src/internal/assets/PasskeyAddIcon.tsx
|
|
6033
|
-
import { jsx as
|
|
6082
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6034
6083
|
function PasskeyAddIcon(props) {
|
|
6035
6084
|
const { width = "24", height = "24", className = "w-6 h-6", ...rest } = props;
|
|
6036
6085
|
return /* @__PURE__ */ jsxs15(
|
|
@@ -6046,11 +6095,11 @@ function PasskeyAddIcon(props) {
|
|
|
6046
6095
|
strokeLinejoin: "round",
|
|
6047
6096
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6048
6097
|
children: [
|
|
6049
|
-
/* @__PURE__ */
|
|
6050
|
-
/* @__PURE__ */
|
|
6051
|
-
/* @__PURE__ */
|
|
6052
|
-
/* @__PURE__ */
|
|
6053
|
-
/* @__PURE__ */
|
|
6098
|
+
/* @__PURE__ */ jsx19("path", { d: "m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4" }),
|
|
6099
|
+
/* @__PURE__ */ jsx19("path", { d: "m21 2-9.6 9.6" }),
|
|
6100
|
+
/* @__PURE__ */ jsx19("circle", { cx: "7.5", cy: "15.5", r: "5.5" }),
|
|
6101
|
+
/* @__PURE__ */ jsx19("path", { d: "M18 15v6" }),
|
|
6102
|
+
/* @__PURE__ */ jsx19("path", { d: "M21 18h-6" })
|
|
6054
6103
|
]
|
|
6055
6104
|
}
|
|
6056
6105
|
);
|
|
@@ -6060,16 +6109,16 @@ function PasskeyAddIcon(props) {
|
|
|
6060
6109
|
init_auth();
|
|
6061
6110
|
|
|
6062
6111
|
// src/internal/components/Expandable/hooks/useExpandable.ts
|
|
6063
|
-
import { useCallback as
|
|
6112
|
+
import { useCallback as useCallback4, useEffect as useEffect9, useRef as useRef5 } from "react";
|
|
6064
6113
|
var useExpandable = (props) => {
|
|
6065
6114
|
const { isExpanded = false, children, initHeight = 0, minHeight = 0 } = props;
|
|
6066
6115
|
const expandableRef = useRef5(null);
|
|
6067
6116
|
const contentRef = useRef5(null);
|
|
6068
|
-
|
|
6117
|
+
useEffect9(() => {
|
|
6069
6118
|
if (!expandableRef.current) return;
|
|
6070
6119
|
expandableRef.current.style.setProperty("--ifo-basic-expandable-h", `${initHeight}px )`);
|
|
6071
6120
|
}, []);
|
|
6072
|
-
const setExpandableHeight =
|
|
6121
|
+
const setExpandableHeight = useCallback4(
|
|
6073
6122
|
(isExpnd) => {
|
|
6074
6123
|
if (!contentRef.current || !expandableRef.current) return;
|
|
6075
6124
|
expandableRef.current.style.setProperty(
|
|
@@ -6080,7 +6129,7 @@ var useExpandable = (props) => {
|
|
|
6080
6129
|
// ON_RESIZE_DELEAY),
|
|
6081
6130
|
[minHeight]
|
|
6082
6131
|
);
|
|
6083
|
-
|
|
6132
|
+
useEffect9(() => {
|
|
6084
6133
|
if (!contentRef.current || !expandableRef.current) return;
|
|
6085
6134
|
const obs = new ResizeObserver(() => setExpandableHeight(isExpanded));
|
|
6086
6135
|
obs.observe(expandableRef.current);
|
|
@@ -6093,24 +6142,24 @@ var useExpandable = (props) => {
|
|
|
6093
6142
|
};
|
|
6094
6143
|
|
|
6095
6144
|
// src/internal/components/Expandable/Expandable.tsx
|
|
6096
|
-
import { jsx as
|
|
6145
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
6097
6146
|
function Expandable(props) {
|
|
6098
6147
|
const { children, className, contentClassName, minHeight, divProps } = props;
|
|
6099
6148
|
const { expandableRef, contentRef } = useExpandable(props);
|
|
6100
|
-
return /* @__PURE__ */
|
|
6149
|
+
return /* @__PURE__ */ jsx20(
|
|
6101
6150
|
"div",
|
|
6102
6151
|
{
|
|
6103
6152
|
...divProps,
|
|
6104
6153
|
ref: expandableRef,
|
|
6105
6154
|
className: cn("w-full overflow-y-hidden", className),
|
|
6106
6155
|
style: { height: "var(--ifo-basic-expandable-h)", transition: "height 375ms ease" },
|
|
6107
|
-
children: /* @__PURE__ */
|
|
6156
|
+
children: /* @__PURE__ */ jsx20("div", { className: cn("w-full", contentClassName), ref: contentRef, style: minHeight ? { minHeight } : void 0, children })
|
|
6108
6157
|
}
|
|
6109
6158
|
);
|
|
6110
6159
|
}
|
|
6111
6160
|
|
|
6112
6161
|
// src/internal/components/AuthMenu/PassKeyStep.tsx
|
|
6113
|
-
import { Fragment as Fragment2, jsx as
|
|
6162
|
+
import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6114
6163
|
function normalizeWebAuthnError(err) {
|
|
6115
6164
|
const raw = err?.message || String(err || "");
|
|
6116
6165
|
const lower = raw.toLowerCase();
|
|
@@ -6132,20 +6181,9 @@ function PassKeyStep(props) {
|
|
|
6132
6181
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
6133
6182
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
6134
6183
|
const autoCloseOnSuccess = !recoveryUserId;
|
|
6135
|
-
const {
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
setStep,
|
|
6139
|
-
setPasskeyError,
|
|
6140
|
-
setPasskeyStatus,
|
|
6141
|
-
setAlert,
|
|
6142
|
-
setEmail,
|
|
6143
|
-
setVerificationError,
|
|
6144
|
-
setFailedMessage,
|
|
6145
|
-
setFailedType
|
|
6146
|
-
} = useAuthStore();
|
|
6147
|
-
const onPasskeyRegister = useCallback4(async () => {
|
|
6148
|
-
setPasskeyError("");
|
|
6184
|
+
const { passkeyStatus, setStep, setPasskeyStatus, setAlert, setEmail, setFailedType } = useAuthStore();
|
|
6185
|
+
const onPasskeyRegister = useCallback5(async () => {
|
|
6186
|
+
setAlert(null);
|
|
6149
6187
|
setPasskeyStatus("registering passkey...");
|
|
6150
6188
|
setIsLoading(true);
|
|
6151
6189
|
try {
|
|
@@ -6172,8 +6210,7 @@ function PassKeyStep(props) {
|
|
|
6172
6210
|
if (onAuthSuccess) await onAuthSuccess();
|
|
6173
6211
|
setStep("signin");
|
|
6174
6212
|
setEmail("");
|
|
6175
|
-
|
|
6176
|
-
setPasskeyError("");
|
|
6213
|
+
setAlert(null);
|
|
6177
6214
|
setPasskeyStatus("idle");
|
|
6178
6215
|
} else {
|
|
6179
6216
|
setPasskeyStatus("Passkey registered successfully!");
|
|
@@ -6195,7 +6232,10 @@ function PassKeyStep(props) {
|
|
|
6195
6232
|
message: "This passkey is already registered for your account. No need to register again!"
|
|
6196
6233
|
});
|
|
6197
6234
|
} else if (!normalized.benignCancel) {
|
|
6198
|
-
|
|
6235
|
+
setAlert({
|
|
6236
|
+
title: "Passkey Error",
|
|
6237
|
+
message: errorMessage
|
|
6238
|
+
});
|
|
6199
6239
|
}
|
|
6200
6240
|
if (!normalized.benignCancel) {
|
|
6201
6241
|
try {
|
|
@@ -6211,8 +6251,8 @@ function PassKeyStep(props) {
|
|
|
6211
6251
|
setIsLoading(false);
|
|
6212
6252
|
}
|
|
6213
6253
|
}, [onAuthSuccess, setPage, callbacks]);
|
|
6214
|
-
const onPasskeyAuth =
|
|
6215
|
-
|
|
6254
|
+
const onPasskeyAuth = useCallback5(async () => {
|
|
6255
|
+
setAlert(null);
|
|
6216
6256
|
setPasskeyStatus("checking available passkeys...");
|
|
6217
6257
|
setIsLoading(true);
|
|
6218
6258
|
try {
|
|
@@ -6228,9 +6268,10 @@ function PassKeyStep(props) {
|
|
|
6228
6268
|
pendingLoginResponseRef.current = result.loginResponse;
|
|
6229
6269
|
const hasKeyshare = result.loginResponse.hasKeyshare ?? false;
|
|
6230
6270
|
if (!hasKeyshare && result.loginResponse.isNewUser === void 0) {
|
|
6231
|
-
|
|
6232
|
-
"
|
|
6233
|
-
|
|
6271
|
+
setAlert({
|
|
6272
|
+
title: "Configuration Error",
|
|
6273
|
+
message: "The backend could not determine user status. This indicates you probably already have used the passkey and did not create required backups.\n Unfortunately, your wallet cannot be recovered. You need to create account using a different passkey."
|
|
6274
|
+
});
|
|
6234
6275
|
setFailedType("config");
|
|
6235
6276
|
setStep("failed");
|
|
6236
6277
|
setPasskeyStatus("idle");
|
|
@@ -6238,9 +6279,10 @@ function PassKeyStep(props) {
|
|
|
6238
6279
|
return;
|
|
6239
6280
|
}
|
|
6240
6281
|
if (!hasKeyshare && result.loginResponse.isNewUser === false) {
|
|
6241
|
-
|
|
6242
|
-
"
|
|
6243
|
-
|
|
6282
|
+
setAlert({
|
|
6283
|
+
title: "Data has been lost",
|
|
6284
|
+
message: "Your account data has been lost on the server.\nThis should never happen and indicates a serious system failure.\n\nUnfortunately, your wallet cannot be recovered.\nYou will need to create a new account.\n\nPlease contact support immediately with this error."
|
|
6285
|
+
});
|
|
6244
6286
|
setFailedType("critical");
|
|
6245
6287
|
setStep("failed");
|
|
6246
6288
|
setPasskeyStatus("idle");
|
|
@@ -6261,7 +6303,10 @@ function PassKeyStep(props) {
|
|
|
6261
6303
|
if (onAuthSuccess) await onAuthSuccess();
|
|
6262
6304
|
} catch (authError) {
|
|
6263
6305
|
if (authError?.message?.includes("User denied authorization")) {
|
|
6264
|
-
|
|
6306
|
+
setAlert({
|
|
6307
|
+
title: "Authorization Cancelled",
|
|
6308
|
+
message: authError?.message || "You have cancelled the authorization process."
|
|
6309
|
+
});
|
|
6265
6310
|
setStep("failed");
|
|
6266
6311
|
setPasskeyStatus("idle");
|
|
6267
6312
|
return;
|
|
@@ -6271,8 +6316,7 @@ function PassKeyStep(props) {
|
|
|
6271
6316
|
if (autoCloseOnSuccess) {
|
|
6272
6317
|
setStep("signin");
|
|
6273
6318
|
setEmail("");
|
|
6274
|
-
|
|
6275
|
-
setPasskeyError("");
|
|
6319
|
+
setAlert(null);
|
|
6276
6320
|
setPasskeyStatus("idle");
|
|
6277
6321
|
setPage(null);
|
|
6278
6322
|
}
|
|
@@ -6280,7 +6324,10 @@ function PassKeyStep(props) {
|
|
|
6280
6324
|
const normalized = normalizeWebAuthnError(e);
|
|
6281
6325
|
const errorMessage = normalized.message || "Authentication failed";
|
|
6282
6326
|
if (!normalized.benignCancel) {
|
|
6283
|
-
|
|
6327
|
+
setAlert({
|
|
6328
|
+
title: "Passkey Error",
|
|
6329
|
+
message: errorMessage
|
|
6330
|
+
});
|
|
6284
6331
|
try {
|
|
6285
6332
|
callbacks?.onLumiaPassportError?.({
|
|
6286
6333
|
error: e instanceof Error ? e : new Error(errorMessage),
|
|
@@ -6297,8 +6344,8 @@ function PassKeyStep(props) {
|
|
|
6297
6344
|
}, [onAuthSuccess, setPage, callbacks]);
|
|
6298
6345
|
return /* @__PURE__ */ jsxs16(Expandable, { isExpanded: true, contentClassName: "w-full p-[var(--l-pass-pd)] flex flex-col gap-[var(--l-pass-gap)]", children: [
|
|
6299
6346
|
/* @__PURE__ */ jsxs16("div", { className: "relative flex items-center justify-center gap-2 px-5 pt-3 pb-6", children: [
|
|
6300
|
-
/* @__PURE__ */
|
|
6301
|
-
/* @__PURE__ */
|
|
6347
|
+
/* @__PURE__ */ jsx21(Key3, { className: "w-6 h-6" }),
|
|
6348
|
+
/* @__PURE__ */ jsx21("span", { className: "font-bold text-xl leading-6", children: "Passkey" }),
|
|
6302
6349
|
/* @__PURE__ */ jsxs16(
|
|
6303
6350
|
Button,
|
|
6304
6351
|
{
|
|
@@ -6309,25 +6356,24 @@ function PassKeyStep(props) {
|
|
|
6309
6356
|
className: "absolute left-0 top-0 w-5 h-5",
|
|
6310
6357
|
onClick: () => setStep("signin"),
|
|
6311
6358
|
children: [
|
|
6312
|
-
/* @__PURE__ */
|
|
6313
|
-
/* @__PURE__ */
|
|
6359
|
+
/* @__PURE__ */ jsx21(ArrowLeft3, { className: "h-4 w-4" }),
|
|
6360
|
+
/* @__PURE__ */ jsx21("span", { className: "sr-only", children: "Back to SignIn" })
|
|
6314
6361
|
]
|
|
6315
6362
|
}
|
|
6316
6363
|
)
|
|
6317
6364
|
] }),
|
|
6318
6365
|
/* @__PURE__ */ jsxs16(Button, { variant: "default", size: "large", className: "w-full", onClick: onPasskeyAuth, disabled: isLoading, children: [
|
|
6319
|
-
/* @__PURE__ */
|
|
6366
|
+
/* @__PURE__ */ jsx21(Key3, { className: "w-4 h-4" }),
|
|
6320
6367
|
"Sign in with existing Passkey"
|
|
6321
6368
|
] }),
|
|
6322
6369
|
config.passkey.showCreateButton && /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
6323
|
-
/* @__PURE__ */
|
|
6370
|
+
/* @__PURE__ */ jsx21("span", { className: "block w-full text-center text-sm text-[var(--l-pass-fg-muted)]", children: "Don't have a passkey?" }),
|
|
6324
6371
|
/* @__PURE__ */ jsxs16(Button, { variant: "outline", size: "large", className: "w-full", onClick: onPasskeyRegister, disabled: isLoading, children: [
|
|
6325
|
-
/* @__PURE__ */
|
|
6372
|
+
/* @__PURE__ */ jsx21(PasskeyAddIcon, { className: "w-4 h-4" }),
|
|
6326
6373
|
"Create Passkey"
|
|
6327
6374
|
] })
|
|
6328
6375
|
] }),
|
|
6329
|
-
|
|
6330
|
-
!passkeyError && passkeyStatus !== "idle" && /* @__PURE__ */ jsx20("div", { className: "w-full p-[var(--l-pass-pd)] rounded-[var(--l-pass-el-bdrs)] bg-[var(--l-pass-bg-success)]", children: /* @__PURE__ */ jsx20("span", { className: "w-full block text-sm text-[var(--l-pass-success)] break-words whitespace-pre-wrap text-center", children: passkeyStatus }) })
|
|
6376
|
+
passkeyStatus !== "idle" && /* @__PURE__ */ jsx21("div", { className: "w-full p-[var(--l-pass-pd)] rounded-[var(--l-pass-el-bdrs)] bg-[var(--l-pass-bg-success)]", children: /* @__PURE__ */ jsx21("span", { className: "w-full block text-sm text-[var(--l-pass-success)] break-words whitespace-pre-wrap text-center", children: passkeyStatus }) })
|
|
6331
6377
|
] });
|
|
6332
6378
|
}
|
|
6333
6379
|
|
|
@@ -6341,40 +6387,13 @@ init_projectId();
|
|
|
6341
6387
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
6342
6388
|
import { ChevronRight, Loader as Loader3, Mail as Mail3 } from "lucide-react";
|
|
6343
6389
|
import { useRef as useRef6 } from "react";
|
|
6344
|
-
|
|
6345
|
-
// src/internal/components/ui/highlight.tsx
|
|
6346
|
-
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
6347
|
-
var CARD_STYLES = {
|
|
6348
|
-
info: "text-[var(--l-pass-info)] bg-[var(--l-pass-bg-info)]",
|
|
6349
|
-
success: "text-[var(--l-pass-success)] bg-[var(--l-pass-bg-success)]",
|
|
6350
|
-
warning: "text-[var(--l-pass-warning)] bg-[var(--l-pass-bg-warning)]",
|
|
6351
|
-
error: "text-[var(--l-pass-error)] bg-[var(--l-pass-bg-error)]"
|
|
6352
|
-
};
|
|
6353
|
-
function Highlight(props) {
|
|
6354
|
-
const { type = "info", children, className } = props;
|
|
6355
|
-
return /* @__PURE__ */ jsx21(
|
|
6356
|
-
"div",
|
|
6357
|
-
{
|
|
6358
|
-
className: cn(
|
|
6359
|
-
"w-full text-xs rounded-[var(--l-pass-el-bdrs)] p-[var(--l-pass-pd)]",
|
|
6360
|
-
"whitespace-pre-line",
|
|
6361
|
-
type === "error" ? "break-all" : "break-normal",
|
|
6362
|
-
CARD_STYLES[type],
|
|
6363
|
-
className
|
|
6364
|
-
),
|
|
6365
|
-
children
|
|
6366
|
-
}
|
|
6367
|
-
);
|
|
6368
|
-
}
|
|
6369
|
-
|
|
6370
|
-
// src/internal/components/AuthMenu/SignInStep/Email.tsx
|
|
6371
6390
|
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6372
6391
|
function Email() {
|
|
6373
6392
|
const { config, callbacks } = useLumiaPassportConfig();
|
|
6374
6393
|
const buttonRef = useRef6(null);
|
|
6375
6394
|
const isLoading = useLumiaPassportSession((st) => st.isLoading);
|
|
6376
6395
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
6377
|
-
const { email,
|
|
6396
|
+
const { email, alert: alert2, setEmail, setExpiresIn, setStep, setAlert } = useAuthStore();
|
|
6378
6397
|
const { mutate: onSendVerificationCode } = useMutation4({
|
|
6379
6398
|
mutationFn: async (mail) => {
|
|
6380
6399
|
const isEmailValid = mail.length !== 0 && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(mail);
|
|
@@ -6382,7 +6401,7 @@ function Email() {
|
|
|
6382
6401
|
throw new Error("Invalid email format, please correct and try again.");
|
|
6383
6402
|
}
|
|
6384
6403
|
setIsLoading(true);
|
|
6385
|
-
|
|
6404
|
+
setAlert(null);
|
|
6386
6405
|
const apiUrl = addProjectIdToUrl(`${getServiceUrls().tssUrl}/api/auth/email/send-code`);
|
|
6387
6406
|
return await fetch(apiUrl, {
|
|
6388
6407
|
method: "POST",
|
|
@@ -6399,83 +6418,75 @@ function Email() {
|
|
|
6399
6418
|
} else {
|
|
6400
6419
|
if (response.status === 429) {
|
|
6401
6420
|
const retryAfter = data.retryAfter || 60;
|
|
6402
|
-
|
|
6421
|
+
setAlert({
|
|
6422
|
+
title: "Code already sent recently (Too Many Requests)",
|
|
6423
|
+
message: `Please wait ${retryAfter} seconds before requesting another.`
|
|
6424
|
+
});
|
|
6403
6425
|
} else if (response.status === 400) {
|
|
6404
|
-
|
|
6426
|
+
setAlert({
|
|
6427
|
+
title: "Failed to send verification code",
|
|
6428
|
+
message: data.message || "Unknown error occurred"
|
|
6429
|
+
});
|
|
6405
6430
|
} else {
|
|
6406
|
-
|
|
6431
|
+
setAlert({
|
|
6432
|
+
title: "Failed to send verification code",
|
|
6433
|
+
message: data.message || "Unknown error occurred"
|
|
6434
|
+
});
|
|
6407
6435
|
}
|
|
6408
6436
|
}
|
|
6409
6437
|
setIsLoading(false);
|
|
6410
6438
|
},
|
|
6411
6439
|
onError: (error) => {
|
|
6412
6440
|
callbacks?.onLumiaPassportError?.({ error, message: error?.message || "" });
|
|
6413
|
-
|
|
6441
|
+
setAlert({
|
|
6442
|
+
title: "Failed to send verification code",
|
|
6443
|
+
message: error?.message || "Unknown error occurred"
|
|
6444
|
+
});
|
|
6414
6445
|
setIsLoading(false);
|
|
6415
6446
|
}
|
|
6416
6447
|
});
|
|
6417
|
-
return /* @__PURE__ */
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
setEmail(e.target.value);
|
|
6442
|
-
}
|
|
6443
|
-
}
|
|
6444
|
-
),
|
|
6445
|
-
/* @__PURE__ */ jsx22(
|
|
6446
|
-
Button,
|
|
6447
|
-
{
|
|
6448
|
-
ref: buttonRef,
|
|
6449
|
-
className: "w-12 h-12 flex-none",
|
|
6450
|
-
variant: "default",
|
|
6451
|
-
size: "large",
|
|
6452
|
-
disabled: !email || isLoading,
|
|
6453
|
-
onClick: () => onSendVerificationCode(email),
|
|
6454
|
-
children: isLoading ? /* @__PURE__ */ jsx22(Loader3, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsx22(ChevronRight, { className: "w-4 h-4" })
|
|
6448
|
+
return /* @__PURE__ */ jsx22("div", { className: "w-full flex flex-col gap-[var(--l-pass-gap)]", children: /* @__PURE__ */ jsxs17(
|
|
6449
|
+
"div",
|
|
6450
|
+
{
|
|
6451
|
+
className: "w-full flex gap-[10px] items-center",
|
|
6452
|
+
onKeyDown: (e) => {
|
|
6453
|
+
if (e.key === "Enter" && !isLoading && email) {
|
|
6454
|
+
buttonRef.current?.click();
|
|
6455
|
+
}
|
|
6456
|
+
},
|
|
6457
|
+
children: [
|
|
6458
|
+
/* @__PURE__ */ jsx22(
|
|
6459
|
+
Input,
|
|
6460
|
+
{
|
|
6461
|
+
name: "signin-email",
|
|
6462
|
+
Icon: Mail3,
|
|
6463
|
+
type: "email",
|
|
6464
|
+
autoComplete: "off",
|
|
6465
|
+
placeholder: config.current?.email?.placeholder || "Enter your email",
|
|
6466
|
+
value: email,
|
|
6467
|
+
disabled: isLoading,
|
|
6468
|
+
className: "flex-1 w-full",
|
|
6469
|
+
onChange: (e) => {
|
|
6470
|
+
if (alert2) setAlert(null);
|
|
6471
|
+
setEmail(e.target.value);
|
|
6455
6472
|
}
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
/* @__PURE__ */ jsx23(AlertTriangle2, { className: "w-5 h-5 text-[var(--l-pass-error)]" }),
|
|
6474
|
-
/* @__PURE__ */ jsxs18("div", { className: "w-full flex-1", children: [
|
|
6475
|
-
/* @__PURE__ */ jsx23("span", { className: "block w-full font-bold", children: title }),
|
|
6476
|
-
/* @__PURE__ */ jsx23("span", { className: "block w-full whitespace-pre-line", children: message })
|
|
6477
|
-
] })
|
|
6478
|
-
] });
|
|
6473
|
+
}
|
|
6474
|
+
),
|
|
6475
|
+
/* @__PURE__ */ jsx22(
|
|
6476
|
+
Button,
|
|
6477
|
+
{
|
|
6478
|
+
ref: buttonRef,
|
|
6479
|
+
className: "w-12 h-12 flex-none",
|
|
6480
|
+
variant: "default",
|
|
6481
|
+
size: "large",
|
|
6482
|
+
disabled: !email || isLoading,
|
|
6483
|
+
onClick: () => onSendVerificationCode(email),
|
|
6484
|
+
children: isLoading ? /* @__PURE__ */ jsx22(Loader3, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsx22(ChevronRight, { className: "w-4 h-4" })
|
|
6485
|
+
}
|
|
6486
|
+
)
|
|
6487
|
+
]
|
|
6488
|
+
}
|
|
6489
|
+
) });
|
|
6479
6490
|
}
|
|
6480
6491
|
|
|
6481
6492
|
// src/internal/components/AuthMenu/SignInStep/Social.tsx
|
|
@@ -6484,28 +6495,26 @@ init_lumiaPassport();
|
|
|
6484
6495
|
init_auth();
|
|
6485
6496
|
init_projectId();
|
|
6486
6497
|
import { Key as Key4 } from "lucide-react";
|
|
6487
|
-
import { useCallback as
|
|
6498
|
+
import { useCallback as useCallback6 } from "react";
|
|
6488
6499
|
|
|
6489
6500
|
// src/internal/components/AuthMenu/SignInStep/utils.ts
|
|
6490
|
-
var POSSIBLE_SIGNIN_METHODS = [
|
|
6491
|
-
"email",
|
|
6492
|
-
"passkey",
|
|
6493
|
-
"social"
|
|
6494
|
-
// 'wallet'
|
|
6495
|
-
];
|
|
6501
|
+
var POSSIBLE_SIGNIN_METHODS = ["email", "passkey", "social", "wallet"];
|
|
6496
6502
|
function getSignInEnabledMethods(params) {
|
|
6497
6503
|
const { order, config, exclude } = params;
|
|
6498
6504
|
const enabled = new Array(POSSIBLE_SIGNIN_METHODS.length).fill(null);
|
|
6505
|
+
const unordered = new Array(POSSIBLE_SIGNIN_METHODS.length).fill(null);
|
|
6499
6506
|
POSSIBLE_SIGNIN_METHODS.forEach((sign) => {
|
|
6500
6507
|
const orderedIdx = order.indexOf(sign);
|
|
6501
6508
|
if (orderedIdx < 0) {
|
|
6502
|
-
|
|
6503
|
-
enabled.push(unordered);
|
|
6509
|
+
unordered.push(config[sign]?.enabled ? sign : null);
|
|
6504
6510
|
} else {
|
|
6505
6511
|
enabled[orderedIdx] = config[sign]?.enabled ? sign : null;
|
|
6506
6512
|
}
|
|
6507
6513
|
});
|
|
6508
|
-
return
|
|
6514
|
+
return [
|
|
6515
|
+
...enabled.filter(Boolean).filter((s) => !exclude.includes(s)),
|
|
6516
|
+
...unordered.filter(Boolean).filter((s) => !exclude.includes(s))
|
|
6517
|
+
];
|
|
6509
6518
|
}
|
|
6510
6519
|
async function normalizeSocialLoginResponse(rawLoginResponse, providerKey, userData) {
|
|
6511
6520
|
if (!rawLoginResponse) {
|
|
@@ -6545,7 +6554,7 @@ async function normalizeSocialLoginResponse(rawLoginResponse, providerKey, userD
|
|
|
6545
6554
|
}
|
|
6546
6555
|
|
|
6547
6556
|
// src/internal/components/AuthMenu/SignInStep/Social.tsx
|
|
6548
|
-
import { jsx as
|
|
6557
|
+
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6549
6558
|
var SUPPORTED_PROVIDERS = ["telegram", "x", "twitter"];
|
|
6550
6559
|
var SOCIAL_ICONS = {
|
|
6551
6560
|
google: GoogleIcon,
|
|
@@ -6653,18 +6662,8 @@ function Social(props) {
|
|
|
6653
6662
|
const { config, callbacks } = useLumiaPassportConfig();
|
|
6654
6663
|
const isLoading = useLumiaPassportSession((st) => st.isLoading);
|
|
6655
6664
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
6656
|
-
const {
|
|
6657
|
-
|
|
6658
|
-
setStep,
|
|
6659
|
-
setEmail,
|
|
6660
|
-
setVerificationError,
|
|
6661
|
-
setFailedType,
|
|
6662
|
-
setAlert,
|
|
6663
|
-
setFailedMessage,
|
|
6664
|
-
setPasskeyError,
|
|
6665
|
-
setPasskeyStatus
|
|
6666
|
-
} = useAuthStore();
|
|
6667
|
-
const onSocialAuth = useCallback5(
|
|
6665
|
+
const { alert: alert2, setStep, setEmail, setFailedType, setAlert, setPasskeyStatus } = useAuthStore();
|
|
6666
|
+
const onSocialAuth = useCallback6(
|
|
6668
6667
|
async (providerId) => {
|
|
6669
6668
|
const normalizedProviderId = providerId.toLowerCase();
|
|
6670
6669
|
const provider = config.current?.social?.providers?.find(
|
|
@@ -6718,9 +6717,10 @@ function Social(props) {
|
|
|
6718
6717
|
loginResponse2.hasKeyshare = false;
|
|
6719
6718
|
loginResponse2.isNewUser = false;
|
|
6720
6719
|
} else {
|
|
6721
|
-
|
|
6722
|
-
"
|
|
6723
|
-
|
|
6720
|
+
setAlert({
|
|
6721
|
+
title: "Configuration Error",
|
|
6722
|
+
message: "The backend could not determine user status. This indicates that your projectId is not properly configured or the project metadata is missing.\n\nPlease contact support with your projectId to resolve this issue."
|
|
6723
|
+
});
|
|
6724
6724
|
setFailedType("config");
|
|
6725
6725
|
setStep("failed");
|
|
6726
6726
|
setIsLoading(false);
|
|
@@ -6729,9 +6729,10 @@ function Social(props) {
|
|
|
6729
6729
|
}
|
|
6730
6730
|
}
|
|
6731
6731
|
if (loginResponse2.hasKeyshare === false && loginResponse2.isNewUser === false && providerKey !== "x") {
|
|
6732
|
-
|
|
6733
|
-
"
|
|
6734
|
-
|
|
6732
|
+
setAlert({
|
|
6733
|
+
title: "Account Data Lost",
|
|
6734
|
+
message: "Your account data has been lost on the server. This should never happen and indicates a serious system failure.\n\nUnfortunately, your wallet cannot be recovered. You will need to create a new account.\n\nPlease contact support immediately with this error."
|
|
6735
|
+
});
|
|
6735
6736
|
setFailedType("critical");
|
|
6736
6737
|
setStep("failed");
|
|
6737
6738
|
setIsLoading(false);
|
|
@@ -6781,16 +6782,14 @@ function Social(props) {
|
|
|
6781
6782
|
onAuthSuccess?.();
|
|
6782
6783
|
setStep("signin");
|
|
6783
6784
|
setEmail("");
|
|
6784
|
-
|
|
6785
|
-
setPasskeyError("");
|
|
6785
|
+
setAlert(null);
|
|
6786
6786
|
setPasskeyStatus("idle");
|
|
6787
6787
|
setIsLoading(false);
|
|
6788
6788
|
} else {
|
|
6789
6789
|
onAuthSuccess?.();
|
|
6790
6790
|
setStep("signin");
|
|
6791
6791
|
setEmail("");
|
|
6792
|
-
|
|
6793
|
-
setPasskeyError("");
|
|
6792
|
+
setAlert(null);
|
|
6794
6793
|
setPasskeyStatus("idle");
|
|
6795
6794
|
setIsLoading(false);
|
|
6796
6795
|
}
|
|
@@ -6880,13 +6879,13 @@ function Social(props) {
|
|
|
6880
6879
|
);
|
|
6881
6880
|
const isPasskey = config.current?.passkey?.enabled;
|
|
6882
6881
|
const gridCols = (config.current?.social?.gridColumns || 1) + (isPasskey ? 1 : 0);
|
|
6883
|
-
return /* @__PURE__ */
|
|
6882
|
+
return /* @__PURE__ */ jsxs18(
|
|
6884
6883
|
"div",
|
|
6885
6884
|
{
|
|
6886
6885
|
className: "grid gap-[var(--l-pass-gap)]",
|
|
6887
6886
|
style: { gridTemplateColumns: `repeat(${gridCols}, minmax(0, 1fr))` },
|
|
6888
6887
|
children: [
|
|
6889
|
-
isPasskey && /* @__PURE__ */
|
|
6888
|
+
isPasskey && /* @__PURE__ */ jsx23(
|
|
6890
6889
|
Button,
|
|
6891
6890
|
{
|
|
6892
6891
|
variant: "outline",
|
|
@@ -6898,7 +6897,7 @@ function Social(props) {
|
|
|
6898
6897
|
},
|
|
6899
6898
|
disabled: isLoading,
|
|
6900
6899
|
title: "Passkey",
|
|
6901
|
-
children: /* @__PURE__ */
|
|
6900
|
+
children: /* @__PURE__ */ jsx23(Key4, { className: "w-5 h-5" })
|
|
6902
6901
|
}
|
|
6903
6902
|
),
|
|
6904
6903
|
config.current?.social?.providers.filter((provider) => provider.enabled).map((provider) => {
|
|
@@ -6906,7 +6905,7 @@ function Social(props) {
|
|
|
6906
6905
|
const isSupported = SUPPORTED_PROVIDERS.includes(providerId);
|
|
6907
6906
|
const IconComponent = config.current?.ui?.useExternalIcons ? provider.icon : SOCIAL_ICONS[providerId];
|
|
6908
6907
|
const handleClick = isSupported ? () => onSocialAuth(providerId) : () => setAlert({ title: "Coming Soon", message: `${provider.name} authentication is coming soon!` });
|
|
6909
|
-
return /* @__PURE__ */
|
|
6908
|
+
return /* @__PURE__ */ jsx23(
|
|
6910
6909
|
Button,
|
|
6911
6910
|
{
|
|
6912
6911
|
variant: "outline",
|
|
@@ -6918,7 +6917,7 @@ function Social(props) {
|
|
|
6918
6917
|
},
|
|
6919
6918
|
disabled: isLoading,
|
|
6920
6919
|
title: provider.comingSoon ? `${provider.name} (Coming Soon)` : provider.name,
|
|
6921
|
-
children: IconComponent ? /* @__PURE__ */
|
|
6920
|
+
children: IconComponent ? /* @__PURE__ */ jsx23(IconComponent, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx23("span", { className: "text-lg font-bold", children: provider.name.slice(0, 1).toUpperCase() })
|
|
6922
6921
|
},
|
|
6923
6922
|
provider.id
|
|
6924
6923
|
);
|
|
@@ -6928,12 +6927,35 @@ function Social(props) {
|
|
|
6928
6927
|
);
|
|
6929
6928
|
}
|
|
6930
6929
|
|
|
6930
|
+
// src/internal/components/AuthMenu/SignInStep/Wallet.tsx
|
|
6931
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6932
|
+
function Wallet() {
|
|
6933
|
+
const setAlert = useAuthStore((st) => st.setAlert);
|
|
6934
|
+
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
6935
|
+
const Icon = PROVIDERS_META2.wallet.icon;
|
|
6936
|
+
return /* @__PURE__ */ jsxs19(
|
|
6937
|
+
Button,
|
|
6938
|
+
{
|
|
6939
|
+
size: "large",
|
|
6940
|
+
variant: "outline",
|
|
6941
|
+
className: "w-full",
|
|
6942
|
+
onClick: () => {
|
|
6943
|
+
setAlert(null);
|
|
6944
|
+
setIsWalletLinking(true);
|
|
6945
|
+
},
|
|
6946
|
+
children: [
|
|
6947
|
+
/* @__PURE__ */ jsx24(Icon, { className: "w-5 h-5" }),
|
|
6948
|
+
"Wallet"
|
|
6949
|
+
]
|
|
6950
|
+
}
|
|
6951
|
+
);
|
|
6952
|
+
}
|
|
6953
|
+
|
|
6931
6954
|
// src/internal/components/AuthMenu/SignInStep/SignInStep.tsx
|
|
6932
6955
|
import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6933
6956
|
function SignInStep(props) {
|
|
6934
6957
|
const { pendingLoginResponseRef, onAuthSuccess, checkDisplayNameRequired } = props;
|
|
6935
6958
|
const { config } = useLumiaPassportConfig();
|
|
6936
|
-
const alert2 = useAuthStore((st) => st.alert);
|
|
6937
6959
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
6938
6960
|
const enabledWoPasskey = getSignInEnabledMethods({
|
|
6939
6961
|
config: config.current,
|
|
@@ -6949,24 +6971,22 @@ function SignInStep(props) {
|
|
|
6949
6971
|
onAuthSuccess,
|
|
6950
6972
|
checkDisplayNameRequired
|
|
6951
6973
|
}
|
|
6952
|
-
)
|
|
6974
|
+
),
|
|
6975
|
+
wallet: /* @__PURE__ */ jsx25(Wallet, {})
|
|
6953
6976
|
};
|
|
6954
6977
|
return /* @__PURE__ */ jsxs20("div", { className: "w-full p-[var(--l-pass-pd)] flex flex-col gap-[var(--l-pass-gap)]", children: [
|
|
6955
6978
|
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-center gap-2 px-5 pt-3 pb-6", children: [
|
|
6956
6979
|
/* @__PURE__ */ jsx25(UserCircle, { className: "w-6 h-6" }),
|
|
6957
6980
|
/* @__PURE__ */ jsx25("span", { className: "font-bold text-xl leading-6", children: "Sign In" })
|
|
6958
6981
|
] }),
|
|
6959
|
-
/* @__PURE__ */
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
] }, `fragment-${idx}`)),
|
|
6968
|
-
!!alert2 && /* @__PURE__ */ jsx25(ErrorAlert, { title: alert2.title, message: alert2.message })
|
|
6969
|
-
] }),
|
|
6982
|
+
/* @__PURE__ */ jsx25("div", { className: "w-full flex flex-col gap-[var(--l-pass-gap)]", children: enabledWoPasskey.map((kind, idx) => /* @__PURE__ */ jsxs20(Fragment3, { children: [
|
|
6983
|
+
idx > 0 && /* @__PURE__ */ jsxs20("div", { className: "flex items-center", children: [
|
|
6984
|
+
/* @__PURE__ */ jsx25("div", { style: { borderTop: "1px solid var(--l-pass-bd)" }, className: "flex-1" }),
|
|
6985
|
+
/* @__PURE__ */ jsx25("div", { className: "flex-none px-2 text-xs leading-4", children: "Or" }),
|
|
6986
|
+
/* @__PURE__ */ jsx25("div", { style: { borderTop: "1px solid var(--l-pass-bd)" }, className: "flex-1" })
|
|
6987
|
+
] }, `auth-method-${kind}-${idx}`),
|
|
6988
|
+
signInMethods[kind]
|
|
6989
|
+
] }, `fragment-${idx}`)) }),
|
|
6970
6990
|
/* @__PURE__ */ jsxs20("div", { className: "w-full flex items-center gap-2 justify-center", children: [
|
|
6971
6991
|
/* @__PURE__ */ jsx25("span", { className: "text-[10px] font-medium", children: "By signing in, you agree to the" }),
|
|
6972
6992
|
/* @__PURE__ */ jsx25(
|
|
@@ -6986,7 +7006,7 @@ function SignInStep(props) {
|
|
|
6986
7006
|
// src/internal/components/AuthMenu/useAuthMenuHanders.ts
|
|
6987
7007
|
init_auth();
|
|
6988
7008
|
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
6989
|
-
import { useCallback as
|
|
7009
|
+
import { useCallback as useCallback7, useRef as useRef7, useState as useState5 } from "react";
|
|
6990
7010
|
function useAuthMenuHandlers() {
|
|
6991
7011
|
const { config, callbacks } = useLumiaPassportConfig();
|
|
6992
7012
|
const qc = useQueryClient2();
|
|
@@ -6994,8 +7014,9 @@ function useAuthMenuHandlers() {
|
|
|
6994
7014
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
6995
7015
|
const [telegramCleanup, setTelegramCleanup] = useState5(null);
|
|
6996
7016
|
const { usePaymaster, setError, setStatus, setSession, setAddress, setRecoveryUserId, setHasServerVault } = useLumiaPassportSession();
|
|
6997
|
-
const
|
|
6998
|
-
const
|
|
7017
|
+
const setStep = useAuthStore((st) => st.setStep);
|
|
7018
|
+
const setAlert = useAuthStore((st) => st.setAlert);
|
|
7019
|
+
const createSessionWithKeyshare = useCallback7(
|
|
6999
7020
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
7000
7021
|
try {
|
|
7001
7022
|
try {
|
|
@@ -7029,7 +7050,7 @@ function useAuthMenuHandlers() {
|
|
|
7029
7050
|
},
|
|
7030
7051
|
[setStatus, callbacks, usePaymaster]
|
|
7031
7052
|
);
|
|
7032
|
-
const onAuthSuccess =
|
|
7053
|
+
const onAuthSuccess = useCallback7(async () => {
|
|
7033
7054
|
const loginResponse = pendingLoginResponseRef.current;
|
|
7034
7055
|
if (!loginResponse || !loginResponse.userId) {
|
|
7035
7056
|
setError("Authentication failed - no login data available");
|
|
@@ -7057,7 +7078,7 @@ function useAuthMenuHandlers() {
|
|
|
7057
7078
|
jwt?.isNewUser
|
|
7058
7079
|
);
|
|
7059
7080
|
setError(null);
|
|
7060
|
-
|
|
7081
|
+
setAlert(null);
|
|
7061
7082
|
setSession(sess);
|
|
7062
7083
|
setAddress(addr);
|
|
7063
7084
|
setStatus("ready");
|
|
@@ -7095,7 +7116,10 @@ function useAuthMenuHandlers() {
|
|
|
7095
7116
|
await jwtTokenManager2.clearTokens();
|
|
7096
7117
|
setStatus("error");
|
|
7097
7118
|
setError(error?.message || String(error));
|
|
7098
|
-
|
|
7119
|
+
setAlert({
|
|
7120
|
+
title: "Authorization cancelled",
|
|
7121
|
+
message: error?.message || String(error) || "An unknown error occurred during authentication."
|
|
7122
|
+
});
|
|
7099
7123
|
setStep("failed");
|
|
7100
7124
|
}
|
|
7101
7125
|
}
|
|
@@ -7107,12 +7131,13 @@ function useAuthMenuHandlers() {
|
|
|
7107
7131
|
setError,
|
|
7108
7132
|
setStatus,
|
|
7109
7133
|
setSession,
|
|
7134
|
+
setAlert,
|
|
7110
7135
|
setAddress,
|
|
7111
7136
|
setRecoveryUserId,
|
|
7112
7137
|
setHasServerVault,
|
|
7113
7138
|
createSessionWithKeyshare
|
|
7114
7139
|
]);
|
|
7115
|
-
const checkDisplayNameRequired =
|
|
7140
|
+
const checkDisplayNameRequired = useCallback7(async (loginResponse) => {
|
|
7116
7141
|
if (!config.current?.features?.displayNameNeeded) {
|
|
7117
7142
|
return false;
|
|
7118
7143
|
}
|
|
@@ -7136,15 +7161,14 @@ function useAuthMenuHandlers() {
|
|
|
7136
7161
|
return false;
|
|
7137
7162
|
}
|
|
7138
7163
|
}, []);
|
|
7139
|
-
const goBackToSignIn =
|
|
7164
|
+
const goBackToSignIn = useCallback7(() => {
|
|
7140
7165
|
setStep("signin");
|
|
7141
|
-
|
|
7142
|
-
setCodeSendError("");
|
|
7166
|
+
setAlert(null);
|
|
7143
7167
|
if (telegramCleanup) {
|
|
7144
7168
|
telegramCleanup();
|
|
7145
7169
|
setTelegramCleanup(null);
|
|
7146
7170
|
}
|
|
7147
|
-
}, [setStep,
|
|
7171
|
+
}, [setStep, setAlert, telegramCleanup]);
|
|
7148
7172
|
return {
|
|
7149
7173
|
pendingLoginResponseRef,
|
|
7150
7174
|
onAuthSuccess,
|
|
@@ -7153,35 +7177,6 @@ function useAuthMenuHandlers() {
|
|
|
7153
7177
|
};
|
|
7154
7178
|
}
|
|
7155
7179
|
|
|
7156
|
-
// src/internal/components/AuthMenu/useListenIframeAuthEvents.ts
|
|
7157
|
-
import { useCallback as useCallback7, useEffect as useEffect9 } from "react";
|
|
7158
|
-
function useListenIframeAuthEvents() {
|
|
7159
|
-
const setPage = useLayoutDataStore((state) => state.setPage);
|
|
7160
|
-
const setIsIframeReady = useLumiaPassportSession((state) => state.setIsIframeReady);
|
|
7161
|
-
const handleIframeMessage = useCallback7(
|
|
7162
|
-
(event) => {
|
|
7163
|
-
console.log("[AuthMenu] Received iframe message:", event.data);
|
|
7164
|
-
if (event.data?.type === "LUMIA_PASSPORT_IFRAME_READY") {
|
|
7165
|
-
console.log("[AuthMenu] Iframe is ready");
|
|
7166
|
-
setIsIframeReady(true);
|
|
7167
|
-
} else if (event.data?.type === "LUMIA_PASSPORT_SHOW_IFRAME") {
|
|
7168
|
-
console.log("[AuthMenu] Consent screen shown - hiding auth modal");
|
|
7169
|
-
setPage(null);
|
|
7170
|
-
} else if (event.data?.type === "LUMIA_PASSPORT_HIDE_IFRAME") {
|
|
7171
|
-
console.log("[AuthMenu] Consent screen hidden");
|
|
7172
|
-
} else if (event.data?.type === "KEYSHARE_RECOVERY_NEEDED") {
|
|
7173
|
-
console.log("[AuthMenu] recovery neede");
|
|
7174
|
-
setPage("keyshare-restore" /* KEYSHARE_RESTORE */);
|
|
7175
|
-
}
|
|
7176
|
-
},
|
|
7177
|
-
[setPage, setIsIframeReady]
|
|
7178
|
-
);
|
|
7179
|
-
useEffect9(() => {
|
|
7180
|
-
window.addEventListener("message", handleIframeMessage);
|
|
7181
|
-
return () => window.removeEventListener("message", handleIframeMessage);
|
|
7182
|
-
}, [handleIframeMessage]);
|
|
7183
|
-
}
|
|
7184
|
-
|
|
7185
7180
|
// src/internal/components/AuthMenu/VerifyStep/VerifyStep.tsx
|
|
7186
7181
|
init_lumiaPassport();
|
|
7187
7182
|
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
@@ -7208,8 +7203,8 @@ init_projectId();
|
|
|
7208
7203
|
import { useEffect as useEffect10, useRef as useRef8, useState as useState6 } from "react";
|
|
7209
7204
|
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7210
7205
|
var VerificationCodeInput = (props) => {
|
|
7211
|
-
const { onVerifyCode, onResendCode, isLoading, expiresIn
|
|
7212
|
-
const
|
|
7206
|
+
const { onVerifyCode, onResendCode, isLoading, expiresIn } = props;
|
|
7207
|
+
const setAlert = useAuthStore((st) => st.setAlert);
|
|
7213
7208
|
const [timeLeft, setTimeLeft] = useState6(expiresIn);
|
|
7214
7209
|
useEffect10(() => setTimeLeft(expiresIn), [expiresIn]);
|
|
7215
7210
|
useEffect10(() => {
|
|
@@ -7305,7 +7300,6 @@ var VerificationCodeInput = (props) => {
|
|
|
7305
7300
|
},
|
|
7306
7301
|
i
|
|
7307
7302
|
)) }),
|
|
7308
|
-
error && /* @__PURE__ */ jsx27("div", { className: "w-full bg-[var(--l-pass-bg-error)] p-[var(--l-pass-pd)] rounded-[var(--l-pass-el-bdrs)]", children: /* @__PURE__ */ jsx27("span", { className: "w-full block text-sm text-[var(--l-pass-error)] break-words whitespace-pre-wrap text-center", children: error }) }),
|
|
7309
7303
|
/* @__PURE__ */ jsxs21("div", { className: "text-xs", children: [
|
|
7310
7304
|
"Code expires in ",
|
|
7311
7305
|
mm,
|
|
@@ -7323,8 +7317,8 @@ var VerificationCodeInput = (props) => {
|
|
|
7323
7317
|
className: "text-xs h-fit px-0 leading-4 text-[var(--l-pass-fg-muted)] underline underline-offset-4",
|
|
7324
7318
|
onClick: () => {
|
|
7325
7319
|
if (!timeLeft) return onResendCode();
|
|
7326
|
-
|
|
7327
|
-
setTimeout(() =>
|
|
7320
|
+
setAlert({ title: "Please wait", message: "Please wait until the current code expires to resend." });
|
|
7321
|
+
setTimeout(() => setAlert(null), 3e3);
|
|
7328
7322
|
},
|
|
7329
7323
|
children: "Resend"
|
|
7330
7324
|
}
|
|
@@ -7345,18 +7339,16 @@ function VerifyStep(props) {
|
|
|
7345
7339
|
const {
|
|
7346
7340
|
email,
|
|
7347
7341
|
expiresIn,
|
|
7348
|
-
verificationError,
|
|
7349
|
-
setVerificationError,
|
|
7350
|
-
setFailedMessage,
|
|
7351
7342
|
setFailedType,
|
|
7352
7343
|
setStep,
|
|
7353
7344
|
setEmail,
|
|
7354
|
-
setExpiresIn
|
|
7345
|
+
setExpiresIn,
|
|
7346
|
+
setAlert
|
|
7355
7347
|
} = useAuthStore();
|
|
7356
7348
|
const { mutate: onVerifyCode, isPending: isCodeVerifying } = useMutation5({
|
|
7357
7349
|
mutationFn: async (code) => {
|
|
7358
7350
|
setIsLoading(true);
|
|
7359
|
-
|
|
7351
|
+
setAlert(null);
|
|
7360
7352
|
const { loginWithEmail: loginWithEmail2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
7361
7353
|
const loginResponse = await loginWithEmail2(email, code, { skipTokenSave: true });
|
|
7362
7354
|
pendingLoginResponseRef.current = loginResponse;
|
|
@@ -7364,9 +7356,10 @@ function VerifyStep(props) {
|
|
|
7364
7356
|
},
|
|
7365
7357
|
onSuccess: async (loginResponse) => {
|
|
7366
7358
|
if (!loginResponse.hasKeyshare && loginResponse.isNewUser === void 0) {
|
|
7367
|
-
|
|
7368
|
-
"
|
|
7369
|
-
|
|
7359
|
+
setAlert({
|
|
7360
|
+
title: "Configuration Error",
|
|
7361
|
+
message: "The backend could not determine user status. This indicates that your projectId is not properly configured or the project metadata is missing.\n\nPlease contact support with your projectId to resolve this issue."
|
|
7362
|
+
});
|
|
7370
7363
|
setFailedType("config");
|
|
7371
7364
|
setStep("failed");
|
|
7372
7365
|
pendingLoginResponseRef.current = null;
|
|
@@ -7374,9 +7367,10 @@ function VerifyStep(props) {
|
|
|
7374
7367
|
return;
|
|
7375
7368
|
}
|
|
7376
7369
|
if (!loginResponse.hasKeyshare && loginResponse.isNewUser === false) {
|
|
7377
|
-
|
|
7378
|
-
"
|
|
7379
|
-
|
|
7370
|
+
setAlert({
|
|
7371
|
+
title: "Account Data Lost",
|
|
7372
|
+
message: "Your account data has been lost on the server. This should never happen and indicates a serious system failure.\n\nUnfortunately, your wallet cannot be recovered. You will need to create a new account.\n\nPlease contact support immediately with this error."
|
|
7373
|
+
});
|
|
7380
7374
|
setFailedType("critical");
|
|
7381
7375
|
setStep("failed");
|
|
7382
7376
|
pendingLoginResponseRef.current = null;
|
|
@@ -7402,7 +7396,7 @@ function VerifyStep(props) {
|
|
|
7402
7396
|
if (!recoveryUserId && !needsRecovery) {
|
|
7403
7397
|
setStep("signin");
|
|
7404
7398
|
setEmail("");
|
|
7405
|
-
|
|
7399
|
+
setAlert(null);
|
|
7406
7400
|
setPage(null);
|
|
7407
7401
|
}
|
|
7408
7402
|
setIsLoading(false);
|
|
@@ -7418,7 +7412,10 @@ function VerifyStep(props) {
|
|
|
7418
7412
|
} else {
|
|
7419
7413
|
errorMessage = error.message || "Verification failed. Please try again.";
|
|
7420
7414
|
}
|
|
7421
|
-
|
|
7415
|
+
setAlert({
|
|
7416
|
+
title: "Verification failed",
|
|
7417
|
+
message: errorMessage
|
|
7418
|
+
});
|
|
7422
7419
|
callbacks?.onLumiaPassportError?.({
|
|
7423
7420
|
error: error instanceof Error ? error : new Error(errorMessage),
|
|
7424
7421
|
message: errorMessage
|
|
@@ -7428,7 +7425,7 @@ function VerifyStep(props) {
|
|
|
7428
7425
|
});
|
|
7429
7426
|
const { mutate: onResendCode, isPending: isCodeResending } = useMutation5({
|
|
7430
7427
|
mutationFn: async () => {
|
|
7431
|
-
|
|
7428
|
+
setAlert(null);
|
|
7432
7429
|
setIsLoading(true);
|
|
7433
7430
|
const response = await fetch(addProjectIdToUrl(`${getServiceUrls().tssUrl}/api/auth/email/send-code`), {
|
|
7434
7431
|
method: "POST",
|
|
@@ -7444,17 +7441,24 @@ function VerifyStep(props) {
|
|
|
7444
7441
|
setExpiresIn(data.expiresIn || 300);
|
|
7445
7442
|
}
|
|
7446
7443
|
if (!response.ok && response.status === 429) {
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7444
|
+
setAlert({
|
|
7445
|
+
title: "Code already sent recently (Too Many Requests)",
|
|
7446
|
+
message: `Please wait ${data.retryAfter || 60} seconds before requesting another.`
|
|
7447
|
+
});
|
|
7450
7448
|
}
|
|
7451
7449
|
if (!response.ok && response.status !== 429) {
|
|
7452
|
-
|
|
7450
|
+
setAlert({
|
|
7451
|
+
title: "Failed to resend verification code",
|
|
7452
|
+
message: data.message || "Unknown error occurred"
|
|
7453
|
+
});
|
|
7453
7454
|
}
|
|
7454
7455
|
setIsLoading(false);
|
|
7455
7456
|
},
|
|
7456
7457
|
onError: (err) => {
|
|
7457
|
-
|
|
7458
|
+
setAlert({
|
|
7459
|
+
title: "Failed to resend verification code",
|
|
7460
|
+
message: err.message || "Unknown error occurred"
|
|
7461
|
+
});
|
|
7458
7462
|
setIsLoading(false);
|
|
7459
7463
|
}
|
|
7460
7464
|
});
|
|
@@ -7491,8 +7495,7 @@ function VerifyStep(props) {
|
|
|
7491
7495
|
onVerifyCode,
|
|
7492
7496
|
onResendCode,
|
|
7493
7497
|
isLoading,
|
|
7494
|
-
expiresIn
|
|
7495
|
-
error: verificationError
|
|
7498
|
+
expiresIn
|
|
7496
7499
|
}
|
|
7497
7500
|
)
|
|
7498
7501
|
] });
|
|
@@ -7502,31 +7505,17 @@ function VerifyStep(props) {
|
|
|
7502
7505
|
import { jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7503
7506
|
var AuthMenu = () => {
|
|
7504
7507
|
const isIframeReady = useLumiaPassportSession((st) => st.isIframeReady);
|
|
7505
|
-
const page = useLayoutDataStore((st) => st.page);
|
|
7506
7508
|
const setMainPageHeight = useLayoutDataStore((st) => st.setMainPageHeight);
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
step,
|
|
7510
|
-
setStep,
|
|
7511
|
-
setPasskeyError,
|
|
7512
|
-
setPasskeyStatus,
|
|
7513
|
-
setEmail,
|
|
7514
|
-
setVerificationError,
|
|
7515
|
-
setFailedMessage,
|
|
7516
|
-
setCodeSendError
|
|
7517
|
-
} = useAuthStore();
|
|
7509
|
+
const { step, alert: alert2, setStep, setPasskeyStatus, setEmail, setAlert } = useAuthStore();
|
|
7510
|
+
useEffect11(() => setMainPageHeight(DEFAULT_AUTH_MENU_HEIGHT), []);
|
|
7518
7511
|
useEffect11(() => {
|
|
7519
|
-
|
|
7512
|
+
return () => {
|
|
7520
7513
|
setStep("signin");
|
|
7521
7514
|
setEmail("");
|
|
7522
|
-
setVerificationError("");
|
|
7523
|
-
setCodeSendError("");
|
|
7524
|
-
setPasskeyError("");
|
|
7525
7515
|
setPasskeyStatus("idle");
|
|
7526
|
-
|
|
7527
|
-
}
|
|
7528
|
-
}, [
|
|
7529
|
-
useListenIframeAuthEvents();
|
|
7516
|
+
setAlert(null);
|
|
7517
|
+
};
|
|
7518
|
+
}, []);
|
|
7530
7519
|
const { pendingLoginResponseRef, onAuthSuccess, goBackToSignIn, checkDisplayNameRequired } = useAuthMenuHandlers();
|
|
7531
7520
|
if (!isIframeReady) {
|
|
7532
7521
|
return /* @__PURE__ */ jsxs23("div", { className: "w-full p-8 flex flex-col justify-center items-center gap-[var(--l-pass-gap)]", children: [
|
|
@@ -7566,21 +7555,28 @@ var AuthMenu = () => {
|
|
|
7566
7555
|
}),
|
|
7567
7556
|
[onAuthSuccess, goBackToSignIn, checkDisplayNameRequired]
|
|
7568
7557
|
);
|
|
7569
|
-
return (
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
{
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7558
|
+
return /* @__PURE__ */ jsx29("div", { className: "w-full", children: /* @__PURE__ */ jsx29(AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ jsxs23(
|
|
7559
|
+
motion.div,
|
|
7560
|
+
{
|
|
7561
|
+
initial: { opacity: 0, height: DEFAULT_AUTH_MENU_HEIGHT },
|
|
7562
|
+
animate: { opacity: 1, height: "auto" },
|
|
7563
|
+
exit: { opacity: 0, height: DEFAULT_AUTH_MENU_HEIGHT },
|
|
7564
|
+
style: { overflow: "hidden" },
|
|
7565
|
+
transition: Y_ANIMATION_SETUP,
|
|
7566
|
+
children: [
|
|
7567
|
+
stepContent[step],
|
|
7568
|
+
!!alert2 && // <Expandable isExpanded contentClassName="px-[var(--l-pass-pd)]">
|
|
7569
|
+
/* @__PURE__ */ jsxs23(Highlight, { type: "error", className: "w-full flex gap-[var(--l-pass-gap)]", children: [
|
|
7570
|
+
/* @__PURE__ */ jsx29(AlertTriangle2, { className: "w-5 h-5 text-[var(--l-pass-error)]" }),
|
|
7571
|
+
/* @__PURE__ */ jsxs23("span", { className: "block w-full flex flex-col gap-1 flex-1", children: [
|
|
7572
|
+
/* @__PURE__ */ jsx29("span", { className: "block font-bold leading-5", children: alert2.title }),
|
|
7573
|
+
/* @__PURE__ */ jsx29("span", { className: "block whitespace-pre-line", children: alert2.message })
|
|
7574
|
+
] })
|
|
7575
|
+
] })
|
|
7576
|
+
]
|
|
7577
|
+
},
|
|
7578
|
+
step
|
|
7579
|
+
) }) });
|
|
7584
7580
|
};
|
|
7585
7581
|
|
|
7586
7582
|
// src/internal/components/BuyMenu/ByuMenu.tsx
|
|
@@ -9431,29 +9427,21 @@ import { ChevronRight as ChevronRight3, Loader as Loader12, Mail as Mail4 } from
|
|
|
9431
9427
|
// src/internal/components/ManageWalletMenu/hooks/useStore.ts
|
|
9432
9428
|
import { create as create5 } from "zustand";
|
|
9433
9429
|
var useManageWalletStore = create5((set) => ({
|
|
9430
|
+
alert: null,
|
|
9434
9431
|
emailStep: "input",
|
|
9435
9432
|
email: "",
|
|
9436
9433
|
emailCode: "",
|
|
9437
|
-
emailCodeSentError: "",
|
|
9438
9434
|
emailCodeExpiresIn: 0,
|
|
9439
|
-
isWalletLinking: false,
|
|
9440
9435
|
linkIsLoading: false,
|
|
9441
|
-
linkError: "",
|
|
9442
|
-
verificationError: "",
|
|
9443
9436
|
providerType: null,
|
|
9444
9437
|
confirmUnlink: null,
|
|
9438
|
+
setAlert: (alert2) => set({ alert: alert2 }),
|
|
9445
9439
|
setEmailStep: (emailStep) => set({ emailStep }),
|
|
9446
9440
|
setEmail: (email) => set({ email }),
|
|
9447
9441
|
setEmailCode: (emailCode) => set({ emailCode }),
|
|
9448
|
-
setEmailCodeSentError: (emailCodeSentError) => set({ emailCodeSentError }),
|
|
9449
9442
|
setEmailCodeExpiresIn: (emailCodeExpiresIn) => set({ emailCodeExpiresIn }),
|
|
9450
|
-
setIsWalletLinking: (isWalletLinking) => set({ isWalletLinking }),
|
|
9451
9443
|
setLinkIsLoading: (linkIsLoading) => set({ linkIsLoading }),
|
|
9452
|
-
|
|
9453
|
-
setVerificationError: (verificationError) => set({ verificationError }),
|
|
9454
|
-
setProviderType: (providerType) => {
|
|
9455
|
-
set({ providerType });
|
|
9456
|
-
},
|
|
9444
|
+
setProviderType: (providerType) => set({ providerType }),
|
|
9457
9445
|
setConfirmUnlink: (confirmUnlink) => set({ confirmUnlink })
|
|
9458
9446
|
}));
|
|
9459
9447
|
|
|
@@ -9466,12 +9454,12 @@ function EmailForm() {
|
|
|
9466
9454
|
} = useLumiaPassportConfig();
|
|
9467
9455
|
const isLoading = useLumiaPassportSession((st) => st.isLoading);
|
|
9468
9456
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
9469
|
-
const { email, setEmail,
|
|
9457
|
+
const { email, setEmail, setAlert, setEmailCodeExpiresIn, setEmailStep } = useManageWalletStore();
|
|
9470
9458
|
const { mutate: onSendVerificationCode } = useMutation11({
|
|
9471
9459
|
mutationFn: async () => {
|
|
9472
9460
|
if (!email) return;
|
|
9473
9461
|
setIsLoading(true);
|
|
9474
|
-
|
|
9462
|
+
setAlert(null);
|
|
9475
9463
|
try {
|
|
9476
9464
|
const response = await fetch(addProjectIdToUrl(`${getServiceUrls().tssUrl}/api/auth/email/send-code`), {
|
|
9477
9465
|
method: "POST",
|
|
@@ -9491,18 +9479,28 @@ function EmailForm() {
|
|
|
9491
9479
|
} else {
|
|
9492
9480
|
if (response.status === 429) {
|
|
9493
9481
|
const retryAfter = data.retryAfter || 60;
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9482
|
+
setAlert({
|
|
9483
|
+
title: "Too Many Requests",
|
|
9484
|
+
message: `Code already sent recently. Please wait ${retryAfter} seconds before requesting another.`
|
|
9485
|
+
});
|
|
9497
9486
|
} else if (response.status === 400) {
|
|
9498
|
-
|
|
9487
|
+
setAlert({
|
|
9488
|
+
title: "Invalid Email",
|
|
9489
|
+
message: data.message || "Invalid email address"
|
|
9490
|
+
});
|
|
9499
9491
|
} else {
|
|
9500
|
-
|
|
9492
|
+
setAlert({
|
|
9493
|
+
title: "Error",
|
|
9494
|
+
message: data.message || "Failed to send verification code"
|
|
9495
|
+
});
|
|
9501
9496
|
}
|
|
9502
9497
|
}
|
|
9503
9498
|
} catch (error) {
|
|
9504
9499
|
const errorMessage = "Network error. Please check your connection.";
|
|
9505
|
-
|
|
9500
|
+
setAlert({
|
|
9501
|
+
title: "Network Error",
|
|
9502
|
+
message: errorMessage
|
|
9503
|
+
});
|
|
9506
9504
|
try {
|
|
9507
9505
|
callbacks?.onLumiaPassportError?.({
|
|
9508
9506
|
error: error instanceof Error ? error : new Error(errorMessage),
|
|
@@ -9547,19 +9545,21 @@ function EmailForm() {
|
|
|
9547
9545
|
init_email();
|
|
9548
9546
|
import { useMutation as useMutation12 } from "@tanstack/react-query";
|
|
9549
9547
|
function useSendVerificationCode() {
|
|
9550
|
-
const
|
|
9548
|
+
const setAlert = useManageWalletStore((st) => st.setAlert);
|
|
9549
|
+
const setLinkIsLoading = useManageWalletStore((st) => st.setLinkIsLoading);
|
|
9550
|
+
const setEmailCodeExpiresIn = useManageWalletStore((st) => st.setEmailCodeExpiresIn);
|
|
9551
9551
|
return useMutation12({
|
|
9552
9552
|
mutationFn: async (email) => {
|
|
9553
9553
|
if (!email) {
|
|
9554
9554
|
throw new Error("Email is required");
|
|
9555
9555
|
}
|
|
9556
|
-
|
|
9556
|
+
setAlert(null);
|
|
9557
9557
|
setLinkIsLoading(true);
|
|
9558
9558
|
await sendEmailLinkCode(email);
|
|
9559
9559
|
},
|
|
9560
9560
|
onError: (error) => {
|
|
9561
9561
|
console.error("Failed to send verification code", error.message);
|
|
9562
|
-
|
|
9562
|
+
setAlert({ title: "Error", message: error?.message || "Failed to send verification code" });
|
|
9563
9563
|
setLinkIsLoading(false);
|
|
9564
9564
|
},
|
|
9565
9565
|
onSuccess: () => {
|
|
@@ -9578,28 +9578,17 @@ function useVerifyCode() {
|
|
|
9578
9578
|
const qc = useQueryClient10();
|
|
9579
9579
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9580
9580
|
const setIsLoading = useLumiaPassportSession((st) => st.setIsLoading);
|
|
9581
|
-
const {
|
|
9582
|
-
email,
|
|
9583
|
-
emailCode,
|
|
9584
|
-
setEmail,
|
|
9585
|
-
setEmailStep,
|
|
9586
|
-
setEmailCode,
|
|
9587
|
-
setProviderType,
|
|
9588
|
-
setLinkIsLoading,
|
|
9589
|
-
setVerificationError,
|
|
9590
|
-
setEmailCodeSentError
|
|
9591
|
-
} = useManageWalletStore();
|
|
9581
|
+
const { email, emailCode, setEmail, setEmailStep, setEmailCode, setProviderType, setLinkIsLoading, setAlert } = useManageWalletStore();
|
|
9592
9582
|
return useMutation13({
|
|
9593
9583
|
mutationFn: async (codeToVerify) => {
|
|
9594
9584
|
const code = codeToVerify ?? emailCode;
|
|
9595
9585
|
if (!code) {
|
|
9596
|
-
|
|
9586
|
+
setAlert({ title: "Error", message: "Please enter the verification code" });
|
|
9597
9587
|
return;
|
|
9598
9588
|
}
|
|
9599
9589
|
setIsLoading(true);
|
|
9600
9590
|
setLinkIsLoading(true);
|
|
9601
|
-
|
|
9602
|
-
setEmailCodeSentError("");
|
|
9591
|
+
setAlert(null);
|
|
9603
9592
|
return await verifyEmailLinkCode(email, code);
|
|
9604
9593
|
},
|
|
9605
9594
|
onSuccess: async () => {
|
|
@@ -9608,8 +9597,7 @@ function useVerifyCode() {
|
|
|
9608
9597
|
setProviderType(null);
|
|
9609
9598
|
setEmail("");
|
|
9610
9599
|
setEmailCode("");
|
|
9611
|
-
|
|
9612
|
-
setEmailCodeSentError("");
|
|
9600
|
+
setAlert(null);
|
|
9613
9601
|
setEmailStep("input");
|
|
9614
9602
|
try {
|
|
9615
9603
|
callbacks?.onLumiaPassportUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, address]) });
|
|
@@ -9619,7 +9607,7 @@ function useVerifyCode() {
|
|
|
9619
9607
|
setLinkIsLoading(false);
|
|
9620
9608
|
},
|
|
9621
9609
|
onError: (error) => {
|
|
9622
|
-
|
|
9610
|
+
setAlert({ title: "Error", message: error?.message || "Failed to verify and link email" });
|
|
9623
9611
|
setIsLoading(false);
|
|
9624
9612
|
setLinkIsLoading(false);
|
|
9625
9613
|
}
|
|
@@ -9640,7 +9628,7 @@ function normalizePasskeyLinkError(msg) {
|
|
|
9640
9628
|
}
|
|
9641
9629
|
function AddProvider() {
|
|
9642
9630
|
const qc = useQueryClient11();
|
|
9643
|
-
const
|
|
9631
|
+
const callbacks = useLumiaPassportConfig().callbacks;
|
|
9644
9632
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9645
9633
|
const {
|
|
9646
9634
|
linkIsLoading,
|
|
@@ -9648,8 +9636,8 @@ function AddProvider() {
|
|
|
9648
9636
|
email,
|
|
9649
9637
|
emailStep,
|
|
9650
9638
|
emailCodeExpiresIn,
|
|
9639
|
+
setAlert,
|
|
9651
9640
|
setProviderType,
|
|
9652
|
-
setLinkError,
|
|
9653
9641
|
setLinkIsLoading
|
|
9654
9642
|
} = useManageWalletStore();
|
|
9655
9643
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
@@ -9689,7 +9677,7 @@ function AddProvider() {
|
|
|
9689
9677
|
size: "medium",
|
|
9690
9678
|
disabled: isLoading,
|
|
9691
9679
|
onClick: async () => {
|
|
9692
|
-
|
|
9680
|
+
setAlert(null);
|
|
9693
9681
|
setLinkIsLoading(true);
|
|
9694
9682
|
try {
|
|
9695
9683
|
await linkPasskeyWithWebAuthn({
|
|
@@ -9711,7 +9699,7 @@ function AddProvider() {
|
|
|
9711
9699
|
setProviderType(null);
|
|
9712
9700
|
} catch (e) {
|
|
9713
9701
|
const msg = e?.message || "Failed to link passkey";
|
|
9714
|
-
|
|
9702
|
+
setAlert({ title: "Error", message: normalizePasskeyLinkError(msg) });
|
|
9715
9703
|
} finally {
|
|
9716
9704
|
setLinkIsLoading(false);
|
|
9717
9705
|
}
|
|
@@ -9730,7 +9718,7 @@ function AddProvider() {
|
|
|
9730
9718
|
size: "medium",
|
|
9731
9719
|
disabled: isLoading,
|
|
9732
9720
|
onClick: async () => {
|
|
9733
|
-
|
|
9721
|
+
setAlert(null);
|
|
9734
9722
|
setLinkIsLoading(true);
|
|
9735
9723
|
try {
|
|
9736
9724
|
await linkPasskeyWithWebAuthn({
|
|
@@ -9752,7 +9740,7 @@ function AddProvider() {
|
|
|
9752
9740
|
setProviderType(null);
|
|
9753
9741
|
} catch (e) {
|
|
9754
9742
|
const msg = e?.message || "Failed to link passkey";
|
|
9755
|
-
|
|
9743
|
+
setAlert({ title: "Error", message: normalizePasskeyLinkError(msg) });
|
|
9756
9744
|
} finally {
|
|
9757
9745
|
setLinkIsLoading(false);
|
|
9758
9746
|
}
|
|
@@ -9810,14 +9798,15 @@ function useLinkSocial() {
|
|
|
9810
9798
|
callbacks
|
|
9811
9799
|
} = useLumiaPassportConfig();
|
|
9812
9800
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
9813
|
-
const
|
|
9801
|
+
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
9802
|
+
const { providerType, linkIsLoading, setProviderType, setAlert, setLinkIsLoading } = useManageWalletStore();
|
|
9814
9803
|
const handleLinkSocialProvider = React7.useCallback(
|
|
9815
9804
|
async (providerIdRaw) => {
|
|
9816
9805
|
const providerKey = providerIdRaw.toLowerCase();
|
|
9817
9806
|
const normalizedKey = providerKey === "twitter" ? "x" : providerKey;
|
|
9818
9807
|
try {
|
|
9819
9808
|
setLinkIsLoading(true);
|
|
9820
|
-
|
|
9809
|
+
setAlert(null);
|
|
9821
9810
|
const socialProvider = config.social?.providers?.find(
|
|
9822
9811
|
(p) => (p.id || "").toLowerCase() === normalizedKey && p.enabled
|
|
9823
9812
|
);
|
|
@@ -9855,7 +9844,7 @@ function useLinkSocial() {
|
|
|
9855
9844
|
} catch (e) {
|
|
9856
9845
|
console.error(`[ManageWallet] Failed to link ${providerIdRaw}:`, e);
|
|
9857
9846
|
const message = e?.message || `Failed to link ${providerIdRaw}`;
|
|
9858
|
-
|
|
9847
|
+
setAlert({ title: "Error", message });
|
|
9859
9848
|
setProviderType(null);
|
|
9860
9849
|
} finally {
|
|
9861
9850
|
setLinkIsLoading(false);
|
|
@@ -9884,9 +9873,9 @@ function useLinkSocial() {
|
|
|
9884
9873
|
}
|
|
9885
9874
|
|
|
9886
9875
|
// src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts
|
|
9876
|
+
init_telegram2();
|
|
9887
9877
|
import { useQueryClient as useQueryClient13 } from "@tanstack/react-query";
|
|
9888
9878
|
import { useCallback as useCallback11, useEffect as useEffect23, useState as useState8 } from "react";
|
|
9889
|
-
init_telegram2();
|
|
9890
9879
|
function useLinkTelegram() {
|
|
9891
9880
|
const {
|
|
9892
9881
|
config: { current: config },
|
|
@@ -9894,12 +9883,13 @@ function useLinkTelegram() {
|
|
|
9894
9883
|
} = useLumiaPassportConfig();
|
|
9895
9884
|
const qc = useQueryClient13();
|
|
9896
9885
|
const address = useLumiaPassportSession((st) => st.address);
|
|
9897
|
-
const
|
|
9886
|
+
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
9887
|
+
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
9898
9888
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
9899
9889
|
const handleLinkTelegram = useCallback11(async () => {
|
|
9900
9890
|
try {
|
|
9901
9891
|
setLinkIsLoading(true);
|
|
9902
|
-
|
|
9892
|
+
setAlert(null);
|
|
9903
9893
|
const telegramProvider = config.social?.providers?.find(
|
|
9904
9894
|
(p) => (p.id || "").toLowerCase() === "telegram" && p.enabled
|
|
9905
9895
|
);
|
|
@@ -9932,7 +9922,7 @@ function useLinkTelegram() {
|
|
|
9932
9922
|
setProviderType(null);
|
|
9933
9923
|
} catch (e) {
|
|
9934
9924
|
console.error("[ManageWallet] Failed to link Telegram:", e);
|
|
9935
|
-
|
|
9925
|
+
setAlert({ title: "Error", message: e?.message || "Failed to link Telegram" });
|
|
9936
9926
|
setProviderType(null);
|
|
9937
9927
|
} finally {
|
|
9938
9928
|
setLinkIsLoading(false);
|
|
@@ -9940,7 +9930,12 @@ function useLinkTelegram() {
|
|
|
9940
9930
|
}, [config.social?.providers, callbacks]);
|
|
9941
9931
|
const [telegramLinkStarted, setTelegramLinkStarted] = useState8(false);
|
|
9942
9932
|
useEffect23(() => {
|
|
9943
|
-
console.log("[useLinkTelegram] Effect triggered:", {
|
|
9933
|
+
console.log("[useLinkTelegram] Effect triggered:", {
|
|
9934
|
+
providerType,
|
|
9935
|
+
linkIsLoading,
|
|
9936
|
+
telegramLinkStarted,
|
|
9937
|
+
isWalletLinking
|
|
9938
|
+
});
|
|
9944
9939
|
if (isWalletLinking) {
|
|
9945
9940
|
console.log("[useLinkTelegram] Skipping - wallet linking in progress");
|
|
9946
9941
|
return;
|
|
@@ -10008,7 +10003,7 @@ function ProviderCard(props) {
|
|
|
10008
10003
|
}
|
|
10009
10004
|
|
|
10010
10005
|
// src/internal/components/ManageWalletMenu/ManageWallet.tsx
|
|
10011
|
-
import { jsx as jsx50, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
10006
|
+
import { Fragment as Fragment14, jsx as jsx50, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
10012
10007
|
var POSSIBLE_PROVIDERS = [
|
|
10013
10008
|
"email",
|
|
10014
10009
|
// 'google',
|
|
@@ -10041,22 +10036,18 @@ function ManageWalletMenu() {
|
|
|
10041
10036
|
config: { current: config }
|
|
10042
10037
|
} = useLumiaPassportConfig();
|
|
10043
10038
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
10039
|
+
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
10040
|
+
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
10044
10041
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
10045
10042
|
const {
|
|
10043
|
+
alert: alert2,
|
|
10046
10044
|
providerType,
|
|
10047
|
-
|
|
10048
|
-
linkError,
|
|
10049
|
-
verificationError,
|
|
10050
|
-
emailCodeSentError,
|
|
10045
|
+
setAlert,
|
|
10051
10046
|
setProviderType,
|
|
10052
10047
|
setEmail,
|
|
10053
10048
|
setEmailStep,
|
|
10054
|
-
setEmailCodeSentError,
|
|
10055
10049
|
setEmailCodeExpiresIn,
|
|
10056
|
-
setEmailCode
|
|
10057
|
-
setLinkError,
|
|
10058
|
-
setVerificationError,
|
|
10059
|
-
setIsWalletLinking
|
|
10050
|
+
setEmailCode
|
|
10060
10051
|
} = useManageWalletStore();
|
|
10061
10052
|
const configuredProviders = getConfiguredProviders(config);
|
|
10062
10053
|
const { data: providers = [], isLoading: isProvidersLoading, error: providersError } = useProvidersList();
|
|
@@ -10082,17 +10073,16 @@ function ManageWalletMenu() {
|
|
|
10082
10073
|
disabled: isWalletLinking,
|
|
10083
10074
|
onClick: () => {
|
|
10084
10075
|
if (isWalletLinking) return;
|
|
10076
|
+
setAlert(null);
|
|
10085
10077
|
switch (provider) {
|
|
10086
10078
|
case "email":
|
|
10087
10079
|
setEmail("");
|
|
10088
10080
|
setEmailCode("");
|
|
10089
|
-
setEmailCodeSentError("");
|
|
10090
10081
|
setEmailCodeExpiresIn(0);
|
|
10091
10082
|
setEmailStep("input");
|
|
10092
10083
|
setProviderType(provider);
|
|
10093
10084
|
break;
|
|
10094
10085
|
case "twitter":
|
|
10095
|
-
console.log("[ManageWallet] Twitter button clicked!");
|
|
10096
10086
|
setProviderType("twitter");
|
|
10097
10087
|
break;
|
|
10098
10088
|
case "wallet":
|
|
@@ -10120,7 +10110,7 @@ function ManageWalletMenu() {
|
|
|
10120
10110
|
useLinkSocial();
|
|
10121
10111
|
const showCurrentProviders = !isProvidersLoading && !providersError && (providerType !== "email" && providerType !== "passkey" || providerType === null);
|
|
10122
10112
|
const showExtraProvidersUi = !isProvidersLoading && !providersError && (providerType === "email" || providerType === "passkey");
|
|
10123
|
-
const
|
|
10113
|
+
const combinedAlertMessage = alert2?.message || providersError?.message || null;
|
|
10124
10114
|
return /* @__PURE__ */ jsxs41(
|
|
10125
10115
|
"div",
|
|
10126
10116
|
{
|
|
@@ -10138,15 +10128,13 @@ function ManageWalletMenu() {
|
|
|
10138
10128
|
size: "icon",
|
|
10139
10129
|
title: "Back",
|
|
10140
10130
|
onClick: () => {
|
|
10131
|
+
setAlert(null);
|
|
10141
10132
|
if (providerType === "email") {
|
|
10142
10133
|
setEmail("");
|
|
10143
10134
|
setEmailCode("");
|
|
10144
10135
|
setEmailStep("input");
|
|
10145
|
-
setEmailCodeSentError("");
|
|
10146
10136
|
setEmailCodeExpiresIn(0);
|
|
10147
|
-
setVerificationError("");
|
|
10148
10137
|
}
|
|
10149
|
-
setLinkError("");
|
|
10150
10138
|
if (!providerType) setPage("settings" /* SETTINGS */);
|
|
10151
10139
|
setProviderType(null);
|
|
10152
10140
|
},
|
|
@@ -10155,16 +10143,19 @@ function ManageWalletMenu() {
|
|
|
10155
10143
|
),
|
|
10156
10144
|
/* @__PURE__ */ jsx50("span", { className: "text-xl font-semibold", children: "Profiles" })
|
|
10157
10145
|
] }),
|
|
10158
|
-
/* @__PURE__ */
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
/* @__PURE__ */
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10146
|
+
isProvidersLoading && /* @__PURE__ */ jsx50("div", { className: "flex items-center justify-center p-4 text-[var(--l-pass-fg-muted)]", children: /* @__PURE__ */ jsx50(Loader13, { className: "w-5 h-5 animate-spin" }) }),
|
|
10147
|
+
/* @__PURE__ */ jsx50(EmailNotConnectedWarning, {}),
|
|
10148
|
+
showCurrentProviders && renderProviders.map((node) => node),
|
|
10149
|
+
showExtraProvidersUi && /* @__PURE__ */ jsx50(AddProvider, {}),
|
|
10150
|
+
combinedAlertMessage && /* @__PURE__ */ jsxs41(Highlight, { type: "error", className: "flex gap-[var(--l-pass-gap)]", children: [
|
|
10151
|
+
/* @__PURE__ */ jsx50(AlertTriangle3, { className: "w-4 h-4 shrink-0" }),
|
|
10152
|
+
/* @__PURE__ */ jsxs41("span", { className: "break-words whitespace-pre-wrap", children: [
|
|
10153
|
+
alert2?.title && /* @__PURE__ */ jsxs41(Fragment14, { children: [
|
|
10154
|
+
/* @__PURE__ */ jsx50("strong", { children: alert2.title }),
|
|
10155
|
+
/* @__PURE__ */ jsx50("br", {})
|
|
10156
|
+
] }),
|
|
10157
|
+
combinedAlertMessage
|
|
10158
|
+
] })
|
|
10168
10159
|
] })
|
|
10169
10160
|
]
|
|
10170
10161
|
}
|
|
@@ -10182,7 +10173,7 @@ function UnlinkProviderMenu() {
|
|
|
10182
10173
|
const address = useLumiaPassportSession((st) => st.address);
|
|
10183
10174
|
const { callbacks } = useLumiaPassportConfig();
|
|
10184
10175
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
10185
|
-
const { confirmUnlink, setConfirmUnlink,
|
|
10176
|
+
const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
|
|
10186
10177
|
const [confirmInput, setConfirmInput] = useState9("");
|
|
10187
10178
|
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = useMutation14({
|
|
10188
10179
|
mutationFn: async () => {
|
|
@@ -10204,7 +10195,7 @@ function UnlinkProviderMenu() {
|
|
|
10204
10195
|
}
|
|
10205
10196
|
},
|
|
10206
10197
|
onError: (error) => {
|
|
10207
|
-
|
|
10198
|
+
setAlert({ title: "Error", message: error?.message || "Failed to unlink provider" });
|
|
10208
10199
|
setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
10209
10200
|
}
|
|
10210
10201
|
});
|
|
@@ -10426,21 +10417,21 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
10426
10417
|
init_base();
|
|
10427
10418
|
import { useQuery as useQuery11, useQueryClient as useQueryClient15 } from "@tanstack/react-query";
|
|
10428
10419
|
import { Loader as Loader15 } from "lucide-react";
|
|
10429
|
-
import { Fragment as
|
|
10420
|
+
import { Fragment as Fragment15, jsx as jsx52, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
10430
10421
|
var price16 = Intl.NumberFormat("en-US", { minimumFractionDigits: 16, maximumFractionDigits: 16 });
|
|
10431
10422
|
function formatValue(price) {
|
|
10432
|
-
if (!price) return /* @__PURE__ */ jsx52(
|
|
10423
|
+
if (!price) return /* @__PURE__ */ jsx52(Fragment15, { children: `0.00` });
|
|
10433
10424
|
if (price < 0.01) {
|
|
10434
10425
|
const strigified = price16.format(price);
|
|
10435
10426
|
const absValue = parseInt(strigified.replace(/^0\./, "")).toString().slice(0, 2);
|
|
10436
10427
|
const zeroQnt = strigified.replace(/^0\./, "").split("").findIndex((el) => +el > 0);
|
|
10437
|
-
return /* @__PURE__ */ jsxs43(
|
|
10428
|
+
return /* @__PURE__ */ jsxs43(Fragment15, { children: [
|
|
10438
10429
|
`0.0`,
|
|
10439
10430
|
/* @__PURE__ */ jsx52("sub", { className: "text-[10px]", children: zeroQnt }),
|
|
10440
10431
|
absValue
|
|
10441
10432
|
] });
|
|
10442
10433
|
}
|
|
10443
|
-
return /* @__PURE__ */ jsx52(
|
|
10434
|
+
return /* @__PURE__ */ jsx52(Fragment15, { children: price.toFixed(2) });
|
|
10444
10435
|
}
|
|
10445
10436
|
function openInExplorer(address) {
|
|
10446
10437
|
window.open(`${LUMIA_EXPLORER_URL}/address/${address}`, "_blank");
|
|
@@ -10873,7 +10864,7 @@ function SecurityMenu() {
|
|
|
10873
10864
|
}
|
|
10874
10865
|
|
|
10875
10866
|
// src/internal/components/SendRecieveMenu/SendLumiaMenu.tsx
|
|
10876
|
-
import { AlertCircle as AlertCircle4, ArrowLeft as ArrowLeft13, CheckCircle2 as CheckCircle24, Loader as Loader18, Wallet } from "lucide-react";
|
|
10867
|
+
import { AlertCircle as AlertCircle4, ArrowLeft as ArrowLeft13, CheckCircle2 as CheckCircle24, Loader as Loader18, Wallet as Wallet3 } from "lucide-react";
|
|
10877
10868
|
import { useEffect as useEffect25, useState as useState12 } from "react";
|
|
10878
10869
|
import { isAddress as isAddress2 } from "viem";
|
|
10879
10870
|
import { useBalance as useBalance3 } from "wagmi";
|
|
@@ -10944,7 +10935,7 @@ function useSendTransaction() {
|
|
|
10944
10935
|
|
|
10945
10936
|
// src/internal/components/SendRecieveMenu/SendLumiaMenu.tsx
|
|
10946
10937
|
init_base();
|
|
10947
|
-
import { Fragment as
|
|
10938
|
+
import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
10948
10939
|
function SendLumiaMenu() {
|
|
10949
10940
|
const page = useLayoutDataStore((st) => st.page);
|
|
10950
10941
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
@@ -11022,13 +11013,13 @@ function SendLumiaMenu() {
|
|
|
11022
11013
|
txStep === "input" && /* @__PURE__ */ jsx55(Button, { variant: "ghost", size: "icon", title: "Back", onClick: () => setPage("main-menu" /* MAIN_MENU */), children: /* @__PURE__ */ jsx55(ArrowLeft13, { className: "h-4 w-4" }) }),
|
|
11023
11014
|
/* @__PURE__ */ jsx55("span", { className: "text-xl font-semibold", children: "Send LUMIA" })
|
|
11024
11015
|
] }),
|
|
11025
|
-
txStep === "input" && /* @__PURE__ */ jsxs46(
|
|
11016
|
+
txStep === "input" && /* @__PURE__ */ jsxs46(Fragment16, { children: [
|
|
11026
11017
|
/* @__PURE__ */ jsxs46("div", { className: "w-full flex flex-col gap-2", children: [
|
|
11027
11018
|
/* @__PURE__ */ jsx55("span", { className: "block text-sm font-medium mb-2 text-[var(--l-pass-fg-muted)]", children: "Recipient Address" }),
|
|
11028
11019
|
/* @__PURE__ */ jsx55(
|
|
11029
11020
|
Input,
|
|
11030
11021
|
{
|
|
11031
|
-
Icon:
|
|
11022
|
+
Icon: Wallet3,
|
|
11032
11023
|
type: "text",
|
|
11033
11024
|
value: recipient,
|
|
11034
11025
|
onChange: (e) => setRecipient(e.target.value),
|
|
@@ -11076,7 +11067,7 @@ function SendLumiaMenu() {
|
|
|
11076
11067
|
] }),
|
|
11077
11068
|
/* @__PURE__ */ jsx55(Button, { onClick: handleSend, disabled: isLoading, className: "w-full", size: "large", children: "Continue" })
|
|
11078
11069
|
] }),
|
|
11079
|
-
txStep === "confirm" && /* @__PURE__ */ jsxs46(
|
|
11070
|
+
txStep === "confirm" && /* @__PURE__ */ jsxs46(Fragment16, { children: [
|
|
11080
11071
|
/* @__PURE__ */ jsxs46("div", { className: "bg-gray-50 rounded-lg p-4", children: [
|
|
11081
11072
|
/* @__PURE__ */ jsx55("h3", { className: "font-medium mb-3", children: "Transaction Details" }),
|
|
11082
11073
|
/* @__PURE__ */ jsxs46("div", { className: "space-y-2 text-sm", children: [
|
|
@@ -11112,7 +11103,7 @@ function SendLumiaMenu() {
|
|
|
11112
11103
|
/* @__PURE__ */ jsx55("span", { className: "block text-sm mt-1", children: "Please wait while we process your transaction" })
|
|
11113
11104
|
] })
|
|
11114
11105
|
] }),
|
|
11115
|
-
txStep === "success" && userOpHash && /* @__PURE__ */ jsxs46(
|
|
11106
|
+
txStep === "success" && userOpHash && /* @__PURE__ */ jsxs46(Fragment16, { children: [
|
|
11116
11107
|
/* @__PURE__ */ jsxs46("div", { className: "text-center py-4", children: [
|
|
11117
11108
|
/* @__PURE__ */ jsx55(CheckCircle24, { className: "h-12 w-12 text-[var(--l-pass-success)] mx-auto mb-3" }),
|
|
11118
11109
|
/* @__PURE__ */ jsx55("p", { className: "font-medium", children: "Transaction Sent!" }),
|
|
@@ -11128,7 +11119,7 @@ init_clients();
|
|
|
11128
11119
|
import { ArrowLeft as ArrowLeft14, CheckCircle2 as CheckCircle25, Copy as Copy2, Loader as Loader19 } from "lucide-react";
|
|
11129
11120
|
import QRCode from "qrcode";
|
|
11130
11121
|
import { useCallback as useCallback14, useEffect as useEffect26, useState as useState13 } from "react";
|
|
11131
|
-
import { Fragment as
|
|
11122
|
+
import { Fragment as Fragment17, jsx as jsx56, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
11132
11123
|
function ReceiveLumiaMenu() {
|
|
11133
11124
|
const address = useLumiaPassportSession((st) => st.address);
|
|
11134
11125
|
const page = useLayoutDataStore((st) => st.page);
|
|
@@ -11180,10 +11171,10 @@ function ReceiveLumiaMenu() {
|
|
|
11180
11171
|
/* @__PURE__ */ jsx56("div", { className: "flex items-center justify-center p-[var(--l-pass-pd)]", style: { minHeight: "216px" }, children: qrCodeUrl ? /* @__PURE__ */ jsx56("img", { src: qrCodeUrl, alt: "Wallet QR Code", className: "w-48 h-48" }) : /* @__PURE__ */ jsx56(Loader19, { className: "w-5 h-5 animate-spin text-[var(--l-pass-fg-muted)]" }) }),
|
|
11181
11172
|
/* @__PURE__ */ jsxs47(Highlight, { type: "info", children: [
|
|
11182
11173
|
/* @__PURE__ */ jsx56("span", { className: "block w-full text-center font-mono text-[10px] break-all mb-2", children: address }),
|
|
11183
|
-
/* @__PURE__ */ jsx56(Button, { onClick: handleCopy, className: "w-full", size: "medium", children: copied ? /* @__PURE__ */ jsxs47(
|
|
11174
|
+
/* @__PURE__ */ jsx56(Button, { onClick: handleCopy, className: "w-full", size: "medium", children: copied ? /* @__PURE__ */ jsxs47(Fragment17, { children: [
|
|
11184
11175
|
/* @__PURE__ */ jsx56(CheckCircle25, { className: "h-4 w-4" }),
|
|
11185
11176
|
/* @__PURE__ */ jsx56("span", { children: "Copied!" })
|
|
11186
|
-
] }) : /* @__PURE__ */ jsxs47(
|
|
11177
|
+
] }) : /* @__PURE__ */ jsxs47(Fragment17, { children: [
|
|
11187
11178
|
/* @__PURE__ */ jsx56(Copy2, { className: "h-4 w-4" }),
|
|
11188
11179
|
/* @__PURE__ */ jsx56("span", { children: "Copy Address" })
|
|
11189
11180
|
] }) })
|
|
@@ -11640,7 +11631,7 @@ var formatTimestamp = (timestampMs) => {
|
|
|
11640
11631
|
};
|
|
11641
11632
|
|
|
11642
11633
|
// src/internal/components/TransactionsMenu/TransactionsGroup.tsx
|
|
11643
|
-
import { Fragment as
|
|
11634
|
+
import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
11644
11635
|
function InternalTransaction({ internal, assetSymbol, assetDecimals }) {
|
|
11645
11636
|
const internalSymbol = internal.assetSymbol || assetSymbol;
|
|
11646
11637
|
const internalDecimals = internal.decimals ?? assetDecimals;
|
|
@@ -11717,7 +11708,7 @@ function TransactionsGroup(props) {
|
|
|
11717
11708
|
)
|
|
11718
11709
|
] })
|
|
11719
11710
|
] }),
|
|
11720
|
-
internalsToRender.length > 0 && /* @__PURE__ */ jsxs51(
|
|
11711
|
+
internalsToRender.length > 0 && /* @__PURE__ */ jsxs51(Fragment18, { children: [
|
|
11721
11712
|
/* @__PURE__ */ jsxs51("div", { className: "w-full flex items-center", children: [
|
|
11722
11713
|
/* @__PURE__ */ jsx61("div", { style: { borderTop: "1px solid var(--l-pass-bd)" }, className: "flex-1" }),
|
|
11723
11714
|
/* @__PURE__ */ jsx61("div", { className: "flex-none font-bold px-2 text-xs leading-4 text-[var(--l-pass-fg-muted)]", children: "Internals" }),
|
|
@@ -12056,6 +12047,7 @@ function LumiaPassportDialog() {
|
|
|
12056
12047
|
useBackupStatusChanges();
|
|
12057
12048
|
useDetectMaxScrollHeight();
|
|
12058
12049
|
useSettingsNotifications();
|
|
12050
|
+
useListenIframeAuthEvents();
|
|
12059
12051
|
useBackupWarning();
|
|
12060
12052
|
useWalletStatus();
|
|
12061
12053
|
return /* @__PURE__ */ jsx64(
|
|
@@ -12133,48 +12125,52 @@ var TssManagerWithRef = React10.forwardRef((props, ref) => {
|
|
|
12133
12125
|
// src/internal/components/WalletConnectHandler.tsx
|
|
12134
12126
|
init_wallet();
|
|
12135
12127
|
import { useConnectModal } from "@rainbow-me/rainbowkit";
|
|
12136
|
-
import { useQueryClient as useQueryClient19 } from "@tanstack/react-query";
|
|
12128
|
+
import { useMutation as useMutation15, useQueryClient as useQueryClient19 } from "@tanstack/react-query";
|
|
12137
12129
|
import React11, { useCallback as useCallback18, useEffect as useEffect32 } from "react";
|
|
12138
12130
|
import { useAccount, useDisconnect, useSignMessage } from "wagmi";
|
|
12139
12131
|
function WalletConnectHandler() {
|
|
12140
12132
|
const qc = useQueryClient19();
|
|
12141
|
-
const
|
|
12142
|
-
const
|
|
12133
|
+
const callbacks = useLumiaPassportConfig().callbacks;
|
|
12134
|
+
const passportWalletAddress = useLumiaPassportSession((st) => st.address);
|
|
12143
12135
|
const { address: walletAddress, isConnected, chain, connector } = useAccount();
|
|
12136
|
+
const { openConnectModal, connectModalOpen } = useConnectModal();
|
|
12144
12137
|
const { disconnect } = useDisconnect();
|
|
12145
12138
|
const { signMessageAsync } = useSignMessage();
|
|
12139
|
+
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
12146
12140
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
12147
|
-
const
|
|
12148
|
-
const
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
}, []);
|
|
12141
|
+
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
12142
|
+
const setAuthError = useAuthStore((st) => st.setAlert);
|
|
12143
|
+
const setManageWalletLinkError = useManageWalletStore((st) => st.setLinkError);
|
|
12144
|
+
const setLinkIsLoading = useManageWalletStore((st) => st.setLinkIsLoading);
|
|
12145
|
+
const setProviderType = useManageWalletStore((st) => st.setProviderType);
|
|
12153
12146
|
const onLinkingComplete = useCallback18(
|
|
12154
12147
|
async (success) => {
|
|
12155
|
-
console.log("[WalletConnectHandler] onLinkingComplete called:", { success, userAddress });
|
|
12156
12148
|
setIsWalletLinking(false);
|
|
12149
|
+
if (!success && !passportWalletAddress) {
|
|
12150
|
+
setProviderType(null);
|
|
12151
|
+
setPage("auth" /* AUTH */);
|
|
12152
|
+
return;
|
|
12153
|
+
}
|
|
12154
|
+
if (!success && passportWalletAddress) {
|
|
12155
|
+
setProviderType(null);
|
|
12156
|
+
setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
12157
|
+
return;
|
|
12158
|
+
}
|
|
12157
12159
|
setProviderType(null);
|
|
12158
12160
|
setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
try {
|
|
12168
|
-
callbacks?.onLumiaPassportUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, userAddress]) });
|
|
12169
|
-
} catch {
|
|
12170
|
-
}
|
|
12161
|
+
await qc.invalidateQueries({ queryKey: [PROVIDERS_QUERY_KEY, passportWalletAddress], refetchType: "active" });
|
|
12162
|
+
await qc.invalidateQueries({
|
|
12163
|
+
queryKey: [LINKED_PROFILES_QUERY_KEY, passportWalletAddress],
|
|
12164
|
+
refetchType: "active"
|
|
12165
|
+
});
|
|
12166
|
+
try {
|
|
12167
|
+
callbacks?.onLumiaPassportUpdate?.({ providers: qc.getQueryData([PROVIDERS_QUERY_KEY, passportWalletAddress]) });
|
|
12168
|
+
} catch {
|
|
12171
12169
|
}
|
|
12172
12170
|
},
|
|
12173
|
-
[qc,
|
|
12171
|
+
[qc, passportWalletAddress, callbacks, setProviderType, setPage, setIsWalletLinking]
|
|
12174
12172
|
);
|
|
12175
|
-
const { openConnectModal, connectModalOpen } = useConnectModal();
|
|
12176
12173
|
const [hasStartedLinking, setHasStartedLinking] = React11.useState(false);
|
|
12177
|
-
const timeoutRef = React11.useRef();
|
|
12178
12174
|
useEffect32(() => {
|
|
12179
12175
|
if (isWalletLinking && !hasStartedLinking) {
|
|
12180
12176
|
setHasStartedLinking(true);
|
|
@@ -12182,94 +12178,101 @@ function WalletConnectHandler() {
|
|
|
12182
12178
|
if (isConnected) {
|
|
12183
12179
|
disconnect();
|
|
12184
12180
|
setTimeout(() => {
|
|
12185
|
-
if (openConnectModal) {
|
|
12186
|
-
setPage(null);
|
|
12187
|
-
openConnectModal();
|
|
12188
|
-
}
|
|
12189
|
-
}, 500);
|
|
12190
|
-
} else {
|
|
12191
|
-
if (openConnectModal) {
|
|
12192
12181
|
setPage(null);
|
|
12193
12182
|
openConnectModal();
|
|
12194
|
-
}
|
|
12183
|
+
}, 500);
|
|
12184
|
+
} else {
|
|
12185
|
+
setPage(null);
|
|
12186
|
+
openConnectModal();
|
|
12195
12187
|
}
|
|
12196
12188
|
}
|
|
12197
12189
|
if (!isWalletLinking && hasStartedLinking) {
|
|
12198
12190
|
setHasStartedLinking(false);
|
|
12199
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12200
12191
|
if (isConnected) disconnect();
|
|
12201
12192
|
}
|
|
12202
12193
|
}, [isWalletLinking, hasStartedLinking, isConnected, openConnectModal, disconnect, setPage, setProviderType]);
|
|
12203
12194
|
useEffect32(() => {
|
|
12204
|
-
console.log("[WalletConnectHandler] Modal state check:", {
|
|
12205
|
-
hasStartedLinking,
|
|
12206
|
-
connectModalOpen,
|
|
12207
|
-
isConnected,
|
|
12208
|
-
isWalletLinking
|
|
12209
|
-
});
|
|
12210
12195
|
if (hasStartedLinking && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
12211
|
-
console.log("[WalletConnectHandler] Modal closed without connecting
|
|
12196
|
+
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
12212
12197
|
onLinkingComplete(false);
|
|
12213
12198
|
setHasStartedLinking(false);
|
|
12214
12199
|
}
|
|
12215
12200
|
}, [connectModalOpen, hasStartedLinking, isConnected, isWalletLinking]);
|
|
12216
|
-
|
|
12217
|
-
|
|
12218
|
-
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
|
|
12222
|
-
|
|
12223
|
-
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
|
|
12228
|
-
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
try {
|
|
12201
|
+
const { mutate: handleWalletSign, isPending: isWalletSigning } = useMutation15({
|
|
12202
|
+
mutationFn: async (payload) => {
|
|
12203
|
+
const { chainId, signingWalletAddress } = payload;
|
|
12204
|
+
if (!signingWalletAddress || !chainId) {
|
|
12205
|
+
disconnect();
|
|
12206
|
+
if (passportWalletAddress) {
|
|
12207
|
+
setManageWalletLinkError("Wallet error! No wallet available");
|
|
12208
|
+
} else {
|
|
12209
|
+
setAuthError({ title: "Wallet error", message: "No wallet available" });
|
|
12210
|
+
}
|
|
12211
|
+
setIsWalletLinking(false);
|
|
12212
|
+
setHasStartedLinking(false);
|
|
12213
|
+
onLinkingComplete(false);
|
|
12214
|
+
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
12215
|
+
return;
|
|
12216
|
+
}
|
|
12233
12217
|
setLinkIsLoading(true);
|
|
12234
|
-
const message = createSignatureMessage(
|
|
12235
|
-
const signature = await signMessageAsync({ message });
|
|
12218
|
+
const message = createSignatureMessage(signingWalletAddress);
|
|
12219
|
+
const signature = await signMessageAsync({ message, account: signingWalletAddress });
|
|
12236
12220
|
if (!signature) {
|
|
12237
12221
|
throw new Error("Failed to get signature");
|
|
12238
12222
|
}
|
|
12239
12223
|
const walletName = connector?.name || "Unknown Wallet";
|
|
12240
12224
|
const walletType = connector?.id || "unknown";
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
});
|
|
12246
|
-
await linkWallet({
|
|
12247
|
-
address: walletAddress,
|
|
12225
|
+
return await linkWallet({
|
|
12226
|
+
// chainId: chain.id,
|
|
12227
|
+
chainId,
|
|
12228
|
+
address: signingWalletAddress,
|
|
12248
12229
|
signature,
|
|
12249
12230
|
message,
|
|
12250
|
-
chainId: chain.id,
|
|
12251
12231
|
walletName,
|
|
12252
12232
|
walletType
|
|
12253
12233
|
});
|
|
12234
|
+
},
|
|
12235
|
+
onSuccess: () => {
|
|
12254
12236
|
disconnect();
|
|
12237
|
+
setHasStartedLinking(false);
|
|
12255
12238
|
onLinkingComplete(true);
|
|
12239
|
+
setLinkIsLoading(false);
|
|
12240
|
+
},
|
|
12241
|
+
onError: (err) => {
|
|
12242
|
+
disconnect();
|
|
12243
|
+
setIsWalletLinking(false);
|
|
12244
|
+
onLinkingComplete(false);
|
|
12256
12245
|
setHasStartedLinking(false);
|
|
12257
|
-
|
|
12246
|
+
setLinkIsLoading(false);
|
|
12258
12247
|
const errorMsg = err?.message || "Failed to link wallet";
|
|
12259
12248
|
if (errorMsg.includes("User rejected") || errorMsg.includes("User denied")) {
|
|
12260
|
-
|
|
12249
|
+
if (passportWalletAddress) {
|
|
12250
|
+
setManageWalletLinkError("Signature request was cancelled");
|
|
12251
|
+
} else {
|
|
12252
|
+
setAuthError({ title: "Signature error", message: "Signature request was cancelled" });
|
|
12253
|
+
}
|
|
12261
12254
|
} else if (errorMsg.includes("already linked")) {
|
|
12262
|
-
|
|
12255
|
+
if (passportWalletAddress) {
|
|
12256
|
+
setManageWalletLinkError("This wallet is already linked to another account");
|
|
12257
|
+
} else {
|
|
12258
|
+
setAuthError({ title: "Wallet error", message: "This wallet is already linked to another account" });
|
|
12259
|
+
}
|
|
12263
12260
|
} else {
|
|
12264
|
-
|
|
12261
|
+
if (passportWalletAddress) {
|
|
12262
|
+
setManageWalletLinkError(errorMsg);
|
|
12263
|
+
} else {
|
|
12264
|
+
setAuthError({ title: "Error", message: errorMsg });
|
|
12265
|
+
}
|
|
12265
12266
|
}
|
|
12266
|
-
|
|
12267
|
-
onLinkingComplete(false);
|
|
12268
|
-
setHasStartedLinking(false);
|
|
12269
|
-
} finally {
|
|
12270
|
-
setLinkIsLoading(false);
|
|
12267
|
+
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
12271
12268
|
}
|
|
12272
|
-
};
|
|
12269
|
+
});
|
|
12270
|
+
useEffect32(() => {
|
|
12271
|
+
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking) {
|
|
12272
|
+
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
12273
|
+
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
12274
|
+
}
|
|
12275
|
+
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking]);
|
|
12273
12276
|
return null;
|
|
12274
12277
|
}
|
|
12275
12278
|
|
|
@@ -12300,7 +12303,7 @@ var useLumiaPassportSession = create6((set) => ({
|
|
|
12300
12303
|
}));
|
|
12301
12304
|
function LumiaPassportSessionProvider({ children }) {
|
|
12302
12305
|
const config = useLumiaPassportConfig().config;
|
|
12303
|
-
return /* @__PURE__ */ jsxs54(
|
|
12306
|
+
return /* @__PURE__ */ jsxs54(Fragment19, { children: [
|
|
12304
12307
|
children,
|
|
12305
12308
|
config.current?.wallet?.enabled && /* @__PURE__ */ jsx65(WalletConnectHandler, {}),
|
|
12306
12309
|
/* @__PURE__ */ jsx65(BalanceFeedProvider, {}),
|
|
@@ -12452,7 +12455,7 @@ var useLumiaPassportConfig = () => {
|
|
|
12452
12455
|
import { Cloud as Cloud4, Laptop as Laptop2, Loader as Loader21, Shield as Shield2 } from "lucide-react";
|
|
12453
12456
|
import { useEffect as useEffect34, useMemo as useMemo5 } from "react";
|
|
12454
12457
|
init_auth();
|
|
12455
|
-
import { Fragment as
|
|
12458
|
+
import { Fragment as Fragment20, jsx as jsx68, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
12456
12459
|
function getFormattedStatus(label, status, showStatus) {
|
|
12457
12460
|
const isStatus = showStatus && status && status !== "idle" && status !== "ready";
|
|
12458
12461
|
if (!isStatus) return label;
|
|
@@ -12484,7 +12487,7 @@ function ConnectWalletButton(props) {
|
|
|
12484
12487
|
const isConnecting = connectButtonLabel !== label || isLoading;
|
|
12485
12488
|
return /* @__PURE__ */ jsx68("div", { "data-lumia-passport-mode": colorMode, className: cn("lumia-scope w-fit h-fit", className), children: !address ? (
|
|
12486
12489
|
/** external Buttons can be provided */
|
|
12487
|
-
/* @__PURE__ */ jsx68(
|
|
12490
|
+
/* @__PURE__ */ jsx68(Fragment20, { children: ConnectButton ? /* @__PURE__ */ jsxs55(
|
|
12488
12491
|
ConnectButton,
|
|
12489
12492
|
{
|
|
12490
12493
|
type: "button",
|
|
@@ -12952,7 +12955,7 @@ var rainbowTheme = {
|
|
|
12952
12955
|
|
|
12953
12956
|
// src/context/RainbowKitContext.tsx
|
|
12954
12957
|
import "@rainbow-me/rainbowkit/styles.css";
|
|
12955
|
-
import { Fragment as
|
|
12958
|
+
import { Fragment as Fragment21, jsx as jsx70 } from "react/jsx-runtime";
|
|
12956
12959
|
function LumiaRainbowKitProvider({ children }) {
|
|
12957
12960
|
const config = useLumiaPassportConfig().config;
|
|
12958
12961
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
@@ -12971,7 +12974,7 @@ function LumiaRainbowKitProvider({ children }) {
|
|
|
12971
12974
|
},
|
|
12972
12975
|
[colorMode]
|
|
12973
12976
|
);
|
|
12974
|
-
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ jsx70(
|
|
12977
|
+
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ jsx70(Fragment21, { children });
|
|
12975
12978
|
return /* @__PURE__ */ jsx70(WagmiProvider2, { config: rainbowConfig2, children: /* @__PURE__ */ jsx70(RainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
12976
12979
|
}
|
|
12977
12980
|
|