@seams/wallet 0.10.2 → 0.11.0
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/README.md +3 -3
- package/THIRD_PARTY_NOTICES.md +33 -1812
- package/dist/.build-inputs.sha256 +1 -1
- package/dist/esm/SeamsWeb/operations/recovery/walletRecoveryCodeBackup.js +100 -0
- package/dist/esm/SeamsWeb/walletIframe/host/ui/auth-menu/AuthMenuSurface.js +127 -71
- package/dist/esm/core/signingEngine/uiConfirm/ui/preact/RecoveryCodeBackupSurface.js +558 -0
- package/dist/esm/core/signingEngine/uiConfirm/ui/preact/mountRecoveryCodeBackupSurface.js +82 -0
- package/dist/esm/core/types/sdkSentEvents.js +9 -0
- package/dist/esm/react/components/AccountMenuButton/AccountMenuButtonMock.js +189 -0
- package/dist/esm/react/components/AccountMenuButton/AccountMenuButtonView.js +137 -0
- package/dist/esm/react/components/AccountMenuButton/AccountMenuDeviceDetails.js +39 -0
- package/dist/esm/react/components/AccountMenuButton/AccountMenuDialog.js +39 -13
- package/dist/esm/react/components/AccountMenuButton/AccountMenuMockScreens.js +247 -0
- package/dist/esm/react/components/AccountMenuButton/AccountMenuScreen.js +41 -0
- package/dist/esm/react/components/AccountMenuButton/AuthenticationMethodRow.js +79 -0
- package/dist/esm/react/components/AccountMenuButton/AuthenticationMethodsModal.js +168 -174
- package/dist/esm/react/components/AccountMenuButton/AuthenticationMethodsView.js +19 -0
- package/dist/esm/react/components/AccountMenuButton/ExportKeysScreen.js +30 -0
- package/dist/esm/react/components/AccountMenuButton/LinkedDevicesModal.css +148 -87
- package/dist/esm/react/components/AccountMenuButton/LinkedDevicesModal.js +26 -5
- package/dist/esm/react/components/AccountMenuButton/MenuItem.js +28 -13
- package/dist/esm/react/components/AccountMenuButton/ProfileDropdown.css +73 -69
- package/dist/esm/react/components/AccountMenuButton/ProfileDropdown.js +56 -68
- package/dist/esm/react/components/AccountMenuButton/RecoveryCodeAcknowledgement.js +27 -0
- package/dist/esm/react/components/AccountMenuButton/RecoveryCodeActions.js +53 -0
- package/dist/esm/react/components/AccountMenuButton/TransactionSettingsSection.css +3 -1
- package/dist/esm/react/components/AccountMenuButton/TransactionSettingsSection.js +2 -8
- package/dist/esm/react/components/AccountMenuButton/UserAccountButton.css +1 -1
- package/dist/esm/react/components/AccountMenuButton/UserAccountButton.js +6 -3
- package/dist/esm/react/components/AccountMenuButton/WalletRegionSection.js +4 -4
- package/dist/esm/react/components/AccountMenuButton/Web3AuthProfileButton.css +443 -12
- package/dist/esm/react/components/AccountMenuButton/hooks/useProfileState.js +1 -1
- package/dist/esm/react/components/AccountMenuButton/icons/LayersIcon.js +8 -0
- package/dist/esm/react/components/AccountMenuButton/icons/LockKeyholeIcon.js +22 -0
- package/dist/esm/react/components/AccountMenuButton/icons/PlusIcon.js +8 -0
- package/dist/esm/react/components/AccountMenuButton/icons/SunIcon.js +2 -2
- package/dist/esm/react/components/AccountMenuButton/icons/TouchIcon.css +0 -8
- package/dist/esm/react/components/AccountMenuButton/index.js +135 -115
- package/dist/esm/react/components/QRCodeScanner.js +64 -40
- package/dist/esm/react/components/QRCodeScannerCamera.js +16 -0
- package/dist/esm/react/components/ShowQRCode.js +2 -2
- package/dist/esm/react/externalEvm.js +2 -2
- package/dist/esm/react/index.js +2 -1
- package/dist/esm/react/styles/styles.css +520 -91
- package/dist/esm/react/transactionReview/TransactionReviewHost.js +3 -3
- package/dist/esm/sdk/{adapters-DYPu0nK9.js → adapters-CGvNLOfZ.js} +1 -1
- package/dist/{public/sdk/display-DjoWrSgE.js → esm/sdk/display-DTbGoX4e.js} +1 -1
- package/dist/{public/sdk/exportKeypairOperation-DYCzCbqL.js → esm/sdk/exportKeypairOperation-BHXMSA3v.js} +1 -1
- package/dist/{public/sdk/host-D5b19B_h.js → esm/sdk/host-Bqmmy8Ts.js} +1 -1
- package/dist/esm/sdk/{localOnly-KvZeKkH5.js → localOnly-CUVRoMy2.js} +1 -1
- package/dist/esm/sdk/{mountRecoveryCodeBackupSurface-BA2ttbTM.js → mountRecoveryCodeBackupSurface-D1G-iCPI.js} +2 -2
- package/dist/esm/sdk/{pendingWalletRecoveryCodeBackup-BkIrbd6Q.js → pendingWalletRecoveryCodeBackup-CMCOUuA-.js} +1 -1
- package/dist/esm/sdk/{recovery-entrypoint-DoXswV9I.js → recovery-entrypoint-QxTiyx-o.js} +1 -1
- package/dist/esm/sdk/{registration-BFHEYmgh.js → registration-Drtkzrlc.js} +1 -1
- package/dist/esm/sdk/registration-eyzHqLHi.js +1 -0
- package/dist/esm/sdk/{requireStepUpAuth-C67sluoC.js → requireStepUpAuth-FqZSU021.js} +1 -1
- package/dist/esm/sdk/router_ab_ed25519_yao_client_bg.wasm +0 -0
- package/dist/esm/sdk/runtime-auth-CbveTM2_.js +1 -0
- package/dist/esm/sdk/{runtime-device-link-pf-a_-3u.js → runtime-device-link-CHsqrEQ9.js} +1 -1
- package/dist/esm/sdk/{runtime-ecdsa-tempo-Ddnuti6f.js → runtime-ecdsa-tempo-MgmnU9g-.js} +1 -1
- package/dist/esm/sdk/{runtime-email-otp-BAG8ZC1J.js → runtime-email-otp-Cj96n102.js} +1 -1
- package/dist/esm/sdk/{runtime-export-DxL99xfn.js → runtime-export-mcwZRxKk.js} +1 -1
- package/dist/esm/sdk/{runtime-near-BrWP4IxC.js → runtime-near-BMdTtu7D.js} +1 -1
- package/dist/esm/sdk/{runtime-preferences-BjVdHYL0.js → runtime-preferences-CBlhE8bX.js} +1 -1
- package/dist/esm/sdk/{runtime-recovery-codes-Dn-NccpU.js → runtime-recovery-codes-B1gixZsp.js} +1 -1
- package/dist/esm/sdk/{runtime-recovery-BNd_GX5q.js → runtime-recovery-mJp3MLeG.js} +1 -1
- package/dist/esm/sdk/sdkSentEvents-Dl8fOL50.js +1 -0
- package/dist/esm/sdk/shared-8Qe7Nxgg.js +6 -0
- package/dist/{public/sdk/signEvmFamily-DjD3tn8e.js → esm/sdk/signEvmFamily-M0trbeZe.js} +1 -1
- package/dist/esm/sdk/{signEvmFamilyWithUiConfirmForTempo-CwRFbaLM.js → signEvmFamilyWithUiConfirmForTempo-Bo25SwuV.js} +1 -1
- package/dist/esm/sdk/{signEvmWithUiConfirm-BHG0dwVG.js → signEvmWithUiConfirm-CFcqJRj3.js} +1 -1
- package/dist/{public/sdk/signNear-D0tlQXb9.js → esm/sdk/signNear-DGUQZ44s.js} +1 -1
- package/dist/esm/sdk/{signingFlow-Mym5j6aw.js → signingFlow-DZvV4AgG.js} +1 -1
- package/dist/esm/sdk/{transaction-activity-Cb2JyYKv.js → transaction-activity-xfeHKJoq.js} +1 -1
- package/dist/esm/sdk/wallet-iframe-host-ecdsa.js +1 -1
- package/dist/esm/sdk/wallet-iframe-host-full.js +1 -1
- package/dist/esm/sdk/wallet-iframe-host-near.js +1 -1
- package/dist/esm/sdk/wallet-iframe-host-runtime.js +1 -1
- package/dist/esm/sdk/wallet-ui.css +1 -1
- package/dist/{public/sdk/walletCustodyEcdsaContinuity-B8aO2NFb.js → esm/sdk/walletCustodyEcdsaContinuity-_IKoCUBO.js} +1 -1
- package/dist/{public/sdk/walletRecoveryCommit-C3EgMjo-.js → esm/sdk/walletRecoveryCommit-DDPa1rAJ.js} +1 -1
- package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
- package/dist/esm/wasm/router_ab_ecdsa_client/pkg/router_ab_ecdsa_client_bg.wasm +0 -0
- package/dist/esm/wasm/router_ab_ed25519_yao_client/pkg/router_ab_ed25519_yao_client_bg.wasm +0 -0
- package/dist/public/headers.manifest.json +1 -1
- package/dist/public/sdk/{adapters-DYPu0nK9.js → adapters-CGvNLOfZ.js} +1 -1
- package/dist/{esm/sdk/display-DjoWrSgE.js → public/sdk/display-DTbGoX4e.js} +1 -1
- package/dist/{esm/sdk/exportKeypairOperation-DYCzCbqL.js → public/sdk/exportKeypairOperation-BHXMSA3v.js} +1 -1
- package/dist/{esm/sdk/host-D5b19B_h.js → public/sdk/host-Bqmmy8Ts.js} +1 -1
- package/dist/public/sdk/{localOnly-KvZeKkH5.js → localOnly-CUVRoMy2.js} +1 -1
- package/dist/public/sdk/{mountRecoveryCodeBackupSurface-BA2ttbTM.js → mountRecoveryCodeBackupSurface-D1G-iCPI.js} +2 -2
- package/dist/public/sdk/{pendingWalletRecoveryCodeBackup-BkIrbd6Q.js → pendingWalletRecoveryCodeBackup-CMCOUuA-.js} +1 -1
- package/dist/public/sdk/{recovery-entrypoint-DoXswV9I.js → recovery-entrypoint-QxTiyx-o.js} +1 -1
- package/dist/public/sdk/{registration-BFHEYmgh.js → registration-Drtkzrlc.js} +1 -1
- package/dist/public/sdk/registration-eyzHqLHi.js +1 -0
- package/dist/public/sdk/{requireStepUpAuth-C67sluoC.js → requireStepUpAuth-FqZSU021.js} +1 -1
- package/dist/public/sdk/router_ab_ed25519_yao_client_bg.wasm +0 -0
- package/dist/public/sdk/runtime-auth-CbveTM2_.js +1 -0
- package/dist/public/sdk/{runtime-device-link-pf-a_-3u.js → runtime-device-link-CHsqrEQ9.js} +1 -1
- package/dist/public/sdk/{runtime-ecdsa-tempo-Ddnuti6f.js → runtime-ecdsa-tempo-MgmnU9g-.js} +1 -1
- package/dist/public/sdk/{runtime-email-otp-BAG8ZC1J.js → runtime-email-otp-Cj96n102.js} +1 -1
- package/dist/public/sdk/{runtime-export-DxL99xfn.js → runtime-export-mcwZRxKk.js} +1 -1
- package/dist/public/sdk/{runtime-near-BrWP4IxC.js → runtime-near-BMdTtu7D.js} +1 -1
- package/dist/public/sdk/{runtime-preferences-BjVdHYL0.js → runtime-preferences-CBlhE8bX.js} +1 -1
- package/dist/public/sdk/{runtime-recovery-codes-Dn-NccpU.js → runtime-recovery-codes-B1gixZsp.js} +1 -1
- package/dist/public/sdk/{runtime-recovery-BNd_GX5q.js → runtime-recovery-mJp3MLeG.js} +1 -1
- package/dist/public/sdk/sdkSentEvents-Dl8fOL50.js +1 -0
- package/dist/public/sdk/shared-8Qe7Nxgg.js +6 -0
- package/dist/{esm/sdk/signEvmFamily-DjD3tn8e.js → public/sdk/signEvmFamily-M0trbeZe.js} +1 -1
- package/dist/public/sdk/{signEvmFamilyWithUiConfirmForTempo-CwRFbaLM.js → signEvmFamilyWithUiConfirmForTempo-Bo25SwuV.js} +1 -1
- package/dist/public/sdk/{signEvmWithUiConfirm-BHG0dwVG.js → signEvmWithUiConfirm-CFcqJRj3.js} +1 -1
- package/dist/{esm/sdk/signNear-D0tlQXb9.js → public/sdk/signNear-DGUQZ44s.js} +1 -1
- package/dist/public/sdk/{signingFlow-Mym5j6aw.js → signingFlow-DZvV4AgG.js} +1 -1
- package/dist/public/sdk/{transaction-activity-Cb2JyYKv.js → transaction-activity-xfeHKJoq.js} +1 -1
- package/dist/public/sdk/wallet-iframe-host-ecdsa.js +1 -1
- package/dist/public/sdk/wallet-iframe-host-full.js +1 -1
- package/dist/public/sdk/wallet-iframe-host-near.js +1 -1
- package/dist/public/sdk/wallet-iframe-host-runtime.js +1 -1
- package/dist/public/sdk/wallet-ui.css +1 -1
- package/dist/{esm/sdk/walletCustodyEcdsaContinuity-B8aO2NFb.js → public/sdk/walletCustodyEcdsaContinuity-_IKoCUBO.js} +1 -1
- package/dist/{esm/sdk/walletRecoveryCommit-C3EgMjo-.js → public/sdk/walletRecoveryCommit-DDPa1rAJ.js} +1 -1
- package/dist/public/sdk/workers/email_otp_runtime_bg.wasm +0 -0
- package/dist/public/sdk/workers/evm_crypto_bg.wasm +0 -0
- package/dist/public/sdk/workers/router_ab_ecdsa_client_bg.wasm +0 -0
- package/dist/public/sdk/workers/router_ab_ed25519_yao_client_bg.wasm +0 -0
- package/dist/public/sdk/workers/shamir3pass_runtime_bg.wasm +0 -0
- package/dist/public/sdk/workers/tempo_signer_bg.wasm +0 -0
- package/dist/public/sdk/workers/wallet_custody_ceremony_bg.wasm +0 -0
- package/dist/public/sdk/workers/wasm_signer_worker_bg.wasm +0 -0
- package/dist/public/wallet-assets.manifest.json +62 -62
- package/dist/public/wallet-service/index.html +4 -4
- package/dist/types/wallet/src/SeamsWeb/walletIframe/host/auth-menu/domain.d.ts +4 -0
- package/dist/types/wallet/src/SeamsWeb/walletIframe/host/auth-menu/session.d.ts +4 -2
- package/dist/types/wallet/src/core/types/sdkSentEvents.d.ts +4 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/AccountMenuButtonMock.d.ts +17 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/AccountMenuButtonView.d.ts +17 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/AccountMenuDeviceDetails.d.ts +13 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/AccountMenuDialog.d.ts +1 -1
- package/dist/types/wallet/src/react/components/AccountMenuButton/AccountMenuMockScreens.d.ts +43 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/AccountMenuScreen.d.ts +9 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/AuthenticationMethodRow.d.ts +14 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/AuthenticationMethodsModal.d.ts +1 -1
- package/dist/types/wallet/src/react/components/AccountMenuButton/AuthenticationMethodsView.d.ts +8 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/ExportKeysScreen.d.ts +7 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/LinkedDevicesModal.d.ts +1 -1
- package/dist/types/wallet/src/react/components/AccountMenuButton/ProfileDropdown.d.ts +2 -14
- package/dist/types/wallet/src/react/components/AccountMenuButton/RecoveryCodeAcknowledgement.d.ts +5 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/RecoveryCodeActions.d.ts +5 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/icons/LayersIcon.d.ts +2 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/icons/LockKeyholeIcon.d.ts +2 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/icons/PlusIcon.d.ts +2 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/index.d.ts +2 -0
- package/dist/types/wallet/src/react/components/AccountMenuButton/types.d.ts +1 -14
- package/dist/types/wallet/src/react/components/QRCodeScanner.d.ts +1 -0
- package/dist/types/wallet/src/react/components/QRCodeScannerCamera.d.ts +5 -0
- package/dist/types/wallet/src/react/index.d.ts +2 -1
- package/dist/workers/email_otp_runtime_bg.wasm +0 -0
- package/dist/workers/evm_crypto_bg.wasm +0 -0
- package/dist/workers/router_ab_ecdsa_client_bg.wasm +0 -0
- package/dist/workers/router_ab_ed25519_yao_client_bg.wasm +0 -0
- package/dist/workers/shamir3pass_runtime_bg.wasm +0 -0
- package/dist/workers/tempo_signer_bg.wasm +0 -0
- package/dist/workers/wallet_custody_ceremony_bg.wasm +0 -0
- package/dist/workers/wasm_signer_worker_bg.wasm +0 -0
- package/package.json +1 -1
- package/dist/esm/sdk/registration-Cx_f58rb.js +0 -1
- package/dist/esm/sdk/runtime-auth-CKUleRYA.js +0 -1
- package/dist/esm/sdk/sdkSentEvents-DiQ3YVlj.js +0 -1
- package/dist/esm/sdk/shared-CSfgTVcf.js +0 -6
- package/dist/public/sdk/registration-Cx_f58rb.js +0 -1
- package/dist/public/sdk/runtime-auth-CKUleRYA.js +0 -1
- package/dist/public/sdk/sdkSentEvents-DiQ3YVlj.js +0 -1
- package/dist/public/sdk/shared-CSfgTVcf.js +0 -6
|
@@ -12,24 +12,28 @@ import { GlobeIcon } from "./icons/GlobeIcon.js";
|
|
|
12
12
|
import { SlidersIcon } from "./icons/SlidersIcon.js";
|
|
13
13
|
import { RecoveryCodesIcon } from "./icons/RecoveryCodesIcon.js";
|
|
14
14
|
import SpinnerIcon from "./icons/SpinnerIcon.js";
|
|
15
|
+
import { AccountMenuScreen } from "./AccountMenuScreen.js";
|
|
15
16
|
import TouchIcon from "./icons/TouchIcon.js";
|
|
16
|
-
import {
|
|
17
|
-
import { TransactionSettingsSection } from "./TransactionSettingsSection.js";
|
|
18
|
-
import { AccountsSection } from "./AccountsSection.js";
|
|
19
|
-
import { ExportKeysSection } from "./ExportKeysSection.js";
|
|
20
|
-
import { PROFILE_MENU_ITEM_IDS } from "./types.js";
|
|
21
|
-
import { ProfileDropdown } from "./ProfileDropdown.js";
|
|
17
|
+
import { AccountMenuButtonView } from "./AccountMenuButtonView.js";
|
|
22
18
|
import { useProfileState } from "./hooks/useProfileState.js";
|
|
19
|
+
import { PROFILE_MENU_ITEM_IDS } from "./types.js";
|
|
23
20
|
import QRCodeScanner from "../QRCodeScanner.js";
|
|
24
21
|
import LinkedDevicesModal from "./LinkedDevicesModal.js";
|
|
25
22
|
import AuthenticationMethodsModal from "./AuthenticationMethodsModal.js";
|
|
26
23
|
import { WalletSettingsHeader, WalletSettingsLayout } from "./WalletSettingsLayout.js";
|
|
24
|
+
import { AccountsSection } from "./AccountsSection.js";
|
|
25
|
+
import { ExportKeysSection } from "./ExportKeysSection.js";
|
|
26
|
+
import { ExportKeysScreen } from "./ExportKeysScreen.js";
|
|
27
|
+
import { TransactionSettingsSection } from "./TransactionSettingsSection.js";
|
|
27
28
|
import HostedSeamsAuthMenu from "../HostedSeamsAuthMenu/shell.js";
|
|
29
|
+
import { AccountMenuButtonMock } from "./AccountMenuButtonMock.js";
|
|
28
30
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
29
|
-
import { Fragment
|
|
30
|
-
import { createPortal } from "react-dom";
|
|
31
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
31
32
|
import "./Web3AuthProfileButton.css";
|
|
32
33
|
//#region src/react/components/AccountMenuButton/index.tsx
|
|
34
|
+
function resetNavigation(isOpen, setScreen) {
|
|
35
|
+
if (!isOpen) setScreen("overview");
|
|
36
|
+
}
|
|
33
37
|
function remainOnSettingsPage() {}
|
|
34
38
|
function showSettingsError(setError, error) {
|
|
35
39
|
setError(error.message);
|
|
@@ -79,15 +83,6 @@ async function resolveNearAccountIdForExport(input) {
|
|
|
79
83
|
if (state?.status === "near_failed_retryable") throw new Error(`NEAR signer provisioning must be retried (${state.errorCode}).`);
|
|
80
84
|
throw new Error("Ed25519 export requires an active NEAR signer.");
|
|
81
85
|
}
|
|
82
|
-
function resolveDefaultPortalTarget(explicit, buttonRoot) {
|
|
83
|
-
if (explicit) return explicit;
|
|
84
|
-
try {
|
|
85
|
-
const root = buttonRoot?.getRootNode?.();
|
|
86
|
-
if (root && typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot) return root;
|
|
87
|
-
} catch {}
|
|
88
|
-
if (typeof document === "undefined") return null;
|
|
89
|
-
return document.body;
|
|
90
|
-
}
|
|
91
86
|
/**
|
|
92
87
|
* Account Menu Button Component
|
|
93
88
|
* Provides user settings, account management, and the device-link scanner shell.
|
|
@@ -119,7 +114,7 @@ function resolveDefaultPortalTarget(explicit, buttonRoot) {
|
|
|
119
114
|
* }
|
|
120
115
|
* ```
|
|
121
116
|
*/
|
|
122
|
-
const AccountMenuButtonInner = ({ presentation, nearAccountId: nearAccountIdProp, nearExplorerBaseUrl = "https://nearblocks.io", username: usernameProp, hideUsername = false, onLock, onExportKeyError, onExportKeyEvent, deviceLinkingScannerParams, toggleColors, style, className,
|
|
117
|
+
const AccountMenuButtonInner = ({ presentation, nearAccountId: nearAccountIdProp, nearExplorerBaseUrl = "https://nearblocks.io", username: usernameProp, hideUsername = false, onLock, onExportKeyError, onExportKeyEvent, deviceLinkingScannerParams, toggleColors, style, className, isMenuOpen, onMenuOpenChange, highlightedMenuItem }) => {
|
|
123
118
|
const { accountInputState, loginState, seams, lock } = useSeams();
|
|
124
119
|
const recovery = useMemo(() => seams.recovery, [seams]);
|
|
125
120
|
const accountName = usernameProp || nearAccountIdProp?.split(".")?.[0] || loginState.nearAccountId?.split(".")?.[0] || "User";
|
|
@@ -130,19 +125,16 @@ const AccountMenuButtonInner = ({ presentation, nearAccountId: nearAccountIdProp
|
|
|
130
125
|
const canExportNearKey = Boolean(nearAccountId);
|
|
131
126
|
const canExportEvmKeys = Boolean(loginState.thresholdEcdsaEthereumAddress);
|
|
132
127
|
const [showQRScanner, setShowQRScanner] = useState(false);
|
|
133
|
-
const [
|
|
134
|
-
const [showAuthenticationMethods, setShowAuthenticationMethods] = useState(false);
|
|
128
|
+
const [screen, setScreen] = useState("overview");
|
|
135
129
|
const [recoveryCodesOpen, setRecoveryCodesOpen] = useState(false);
|
|
136
|
-
const [exportKeysOpen, setExportKeysOpen] = useState(false);
|
|
137
130
|
const [exportLoadingChain, setExportLoadingChain] = useState(null);
|
|
138
|
-
const [transactionSettingsOpen, setTransactionSettingsOpen] = useState(false);
|
|
139
|
-
const [accountsOpen, setAccountsOpen] = useState(false);
|
|
140
131
|
const [currentConfirmConfig, setCurrentConfirmConfig] = useState(null);
|
|
141
132
|
const [settingsError, setSettingsError] = useState(null);
|
|
142
133
|
const { isOpen, refs, handleToggle, handleClose } = useProfileState({
|
|
143
134
|
open: typeof isMenuOpen === "boolean" ? isMenuOpen : void 0,
|
|
144
135
|
onOpenChange: onMenuOpenChange
|
|
145
136
|
});
|
|
137
|
+
useEffect(resetNavigation.bind(null, isOpen, setScreen), [isOpen]);
|
|
146
138
|
const { theme } = useTheme();
|
|
147
139
|
const accountMenuCapabilities = accountMenuCapabilitiesForLoginState(loginState);
|
|
148
140
|
const canShowRecoveryCodes = accountMenuCapabilities.kind === "owner" && Boolean(walletId);
|
|
@@ -152,10 +144,7 @@ const AccountMenuButtonInner = ({ presentation, nearAccountId: nearAccountIdProp
|
|
|
152
144
|
handleClose();
|
|
153
145
|
}, [handleClose]);
|
|
154
146
|
useEffect(() => {
|
|
155
|
-
if (!canManageLinkedDevices)
|
|
156
|
-
setShowLinkedDevices(false);
|
|
157
|
-
setShowAuthenticationMethods(false);
|
|
158
|
-
}
|
|
147
|
+
if (!canManageLinkedDevices) setScreen("overview");
|
|
159
148
|
}, [canManageLinkedDevices]);
|
|
160
149
|
useEffect(() => {
|
|
161
150
|
if (!seams) return;
|
|
@@ -317,29 +306,25 @@ const AccountMenuButtonInner = ({ presentation, nearAccountId: nearAccountIdProp
|
|
|
317
306
|
label: "Accounts",
|
|
318
307
|
description: "View accounts on block explorers",
|
|
319
308
|
disabled: !loginState.isLoggedIn,
|
|
320
|
-
onClick: (
|
|
309
|
+
onClick: setScreen.bind(null, "accounts"),
|
|
321
310
|
keepOpenOnClick: true
|
|
322
311
|
});
|
|
323
312
|
if (accountMenuCapabilities.kind !== "signed_out") items.push({
|
|
324
313
|
id: PROFILE_MENU_ITEM_IDS.EXPORT_KEYS,
|
|
325
314
|
icon: exportLoadingChain ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(KeyIcon, {}),
|
|
326
|
-
label: "Export
|
|
315
|
+
label: "Export keys",
|
|
327
316
|
description: accountMenuCapabilities.canExportKeys ? "Export wallet signing keys" : "Owner key export is not available on this device yet",
|
|
328
317
|
disabled: !accountMenuCapabilities.canExportKeys,
|
|
329
|
-
onClick: ()
|
|
330
|
-
setExportKeysOpen((v) => !v);
|
|
331
|
-
},
|
|
318
|
+
onClick: setScreen.bind(null, "export-keys"),
|
|
332
319
|
keepOpenOnClick: true
|
|
333
320
|
});
|
|
334
321
|
if (canShowRecoveryCodes) items.push({
|
|
335
322
|
id: PROFILE_MENU_ITEM_IDS.RECOVERY_CODES,
|
|
336
323
|
icon: recoveryCodesOpen ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : /* @__PURE__ */ jsx(RecoveryCodesIcon, {}),
|
|
337
|
-
label: "Recovery
|
|
324
|
+
label: "Recovery codes",
|
|
338
325
|
description: "Back up wallet recovery codes",
|
|
339
326
|
disabled: recoveryCodesOpen,
|
|
340
|
-
onClick: ()
|
|
341
|
-
startRecoveryCodesFlow();
|
|
342
|
-
},
|
|
327
|
+
onClick: setScreen.bind(null, "recovery-codes"),
|
|
343
328
|
keepOpenOnClick: true
|
|
344
329
|
});
|
|
345
330
|
if (accountMenuCapabilities.kind !== "signed_out") {
|
|
@@ -347,28 +332,26 @@ const AccountMenuButtonInner = ({ presentation, nearAccountId: nearAccountIdProp
|
|
|
347
332
|
items.push({
|
|
348
333
|
id: PROFILE_MENU_ITEM_IDS.AUTHENTICATION_METHODS,
|
|
349
334
|
icon: /* @__PURE__ */ jsx(TouchIcon, {}),
|
|
350
|
-
label: "Authentication
|
|
335
|
+
label: "Authentication methods",
|
|
351
336
|
description: "Add or remove ways to unlock this device",
|
|
352
337
|
disabled: !canManageLinkedDevices,
|
|
353
|
-
onClick: (
|
|
338
|
+
onClick: setScreen.bind(null, "authentication-methods"),
|
|
354
339
|
keepOpenOnClick: true
|
|
355
340
|
}, {
|
|
356
341
|
id: PROFILE_MENU_ITEM_IDS.SCAN_LINK_DEVICE,
|
|
357
342
|
icon: /* @__PURE__ */ jsx(ScanIcon, {}),
|
|
358
|
-
label: "Scan and
|
|
343
|
+
label: "Scan and link device",
|
|
359
344
|
description: "Scan QR to link a device",
|
|
360
345
|
disabled: !canManageLinkedDevices,
|
|
361
|
-
onClick: ()
|
|
362
|
-
setShowQRScanner(true);
|
|
363
|
-
},
|
|
346
|
+
onClick: setScreen.bind(null, "scan-link-device"),
|
|
364
347
|
keepOpenOnClick: true
|
|
365
348
|
}, {
|
|
366
349
|
id: PROFILE_MENU_ITEM_IDS.LINKED_DEVICES,
|
|
367
350
|
icon: /* @__PURE__ */ jsx(LinkIcon, {}),
|
|
368
|
-
label: "Linked
|
|
351
|
+
label: "Linked devices",
|
|
369
352
|
description: "See devices using this wallet",
|
|
370
353
|
disabled: !canManageLinkedDevices,
|
|
371
|
-
onClick: (
|
|
354
|
+
onClick: setScreen.bind(null, "linked-devices"),
|
|
372
355
|
keepOpenOnClick: true
|
|
373
356
|
});
|
|
374
357
|
}
|
|
@@ -382,10 +365,10 @@ const AccountMenuButtonInner = ({ presentation, nearAccountId: nearAccountIdProp
|
|
|
382
365
|
items.push({
|
|
383
366
|
id: PROFILE_MENU_ITEM_IDS.TRANSACTION_SETTINGS,
|
|
384
367
|
icon: /* @__PURE__ */ jsx(SlidersIcon, {}),
|
|
385
|
-
label: "Transaction
|
|
368
|
+
label: "Transaction settings",
|
|
386
369
|
description: "Customize confirmation behavior",
|
|
387
370
|
disabled: !loginState.isLoggedIn,
|
|
388
|
-
onClick: (
|
|
371
|
+
onClick: setScreen.bind(null, "transaction-settings"),
|
|
389
372
|
keepOpenOnClick: true
|
|
390
373
|
});
|
|
391
374
|
return items;
|
|
@@ -429,9 +412,82 @@ const AccountMenuButtonInner = ({ presentation, nearAccountId: nearAccountIdProp
|
|
|
429
412
|
onLock?.();
|
|
430
413
|
handleClose();
|
|
431
414
|
};
|
|
432
|
-
const
|
|
433
|
-
const
|
|
434
|
-
|
|
415
|
+
const backToMenu = setScreen.bind(null, "overview");
|
|
416
|
+
const screens = {
|
|
417
|
+
overview: null,
|
|
418
|
+
"transaction-settings": /* @__PURE__ */ jsx(AccountMenuScreen, {
|
|
419
|
+
title: "Transaction settings",
|
|
420
|
+
onBack: backToMenu,
|
|
421
|
+
children: currentConfirmConfig ? /* @__PURE__ */ jsx(TransactionSettingsSection, {
|
|
422
|
+
currentConfirmConfig,
|
|
423
|
+
onSetUiMode: handleSetUiMode,
|
|
424
|
+
onToggleSkipClick: handleToggleSkipClick,
|
|
425
|
+
onSetDelay: handleSetDelay,
|
|
426
|
+
isOpen: true,
|
|
427
|
+
theme
|
|
428
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
429
|
+
role: "status",
|
|
430
|
+
children: "Loading transaction settings…"
|
|
431
|
+
})
|
|
432
|
+
}),
|
|
433
|
+
accounts: /* @__PURE__ */ jsxs(AccountMenuScreen, {
|
|
434
|
+
title: "Accounts",
|
|
435
|
+
onBack: backToMenu,
|
|
436
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
437
|
+
className: "seams-account-description",
|
|
438
|
+
children: "Your addresses across networks."
|
|
439
|
+
}), /* @__PURE__ */ jsx(AccountsSection, { rows: accountsRows })]
|
|
440
|
+
}),
|
|
441
|
+
"export-keys": /* @__PURE__ */ jsx(ExportKeysScreen, {
|
|
442
|
+
onBack: backToMenu,
|
|
443
|
+
loadingChain: exportLoadingChain,
|
|
444
|
+
canExportNearKey,
|
|
445
|
+
canExportEvmKeys,
|
|
446
|
+
onSelectChain: startExportKeyFlow
|
|
447
|
+
}),
|
|
448
|
+
"recovery-codes": /* @__PURE__ */ jsxs(AccountMenuScreen, {
|
|
449
|
+
title: "Recovery codes",
|
|
450
|
+
onBack: backToMenu,
|
|
451
|
+
children: [
|
|
452
|
+
/* @__PURE__ */ jsx("p", {
|
|
453
|
+
className: "seams-account-description",
|
|
454
|
+
children: "Keep a recovery code somewhere safe. Use it to restore access to your wallet."
|
|
455
|
+
}),
|
|
456
|
+
/* @__PURE__ */ jsx("div", {
|
|
457
|
+
className: "seams-account-inset",
|
|
458
|
+
children: "Only you should have this code. Anyone with it can start recovering your wallet."
|
|
459
|
+
}),
|
|
460
|
+
/* @__PURE__ */ jsx("button", {
|
|
461
|
+
type: "button",
|
|
462
|
+
className: "seams-account-action primary",
|
|
463
|
+
disabled: recoveryCodesOpen,
|
|
464
|
+
onClick: startRecoveryCodesFlow,
|
|
465
|
+
children: recoveryCodesOpen ? "Opening recovery codes…" : "View recovery codes"
|
|
466
|
+
})
|
|
467
|
+
]
|
|
468
|
+
}),
|
|
469
|
+
"authentication-methods": /* @__PURE__ */ jsx(AuthenticationMethodsModal, {
|
|
470
|
+
walletId: walletId ?? null,
|
|
471
|
+
isOpen: true,
|
|
472
|
+
presentation: "embedded",
|
|
473
|
+
onClose: backToMenu
|
|
474
|
+
}),
|
|
475
|
+
"linked-devices": /* @__PURE__ */ jsx(LinkedDevicesModal, {
|
|
476
|
+
walletId: walletId ?? null,
|
|
477
|
+
isOpen: true,
|
|
478
|
+
presentation: "embedded",
|
|
479
|
+
onClose: backToMenu
|
|
480
|
+
}),
|
|
481
|
+
"scan-link-device": /* @__PURE__ */ jsx(QRCodeScanner, {
|
|
482
|
+
presentation: "embedded",
|
|
483
|
+
isOpen: true,
|
|
484
|
+
onQRCodeScanned: backToMenu,
|
|
485
|
+
onClose: backToMenu,
|
|
486
|
+
onError: deviceLinkingScannerParams?.onError,
|
|
487
|
+
onEvent: deviceLinkingScannerParams?.onEvent
|
|
488
|
+
})
|
|
489
|
+
};
|
|
490
|
+
if (presentation === "page" && loginState.isLoggedIn && walletId) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(WalletSettingsLayout, {
|
|
435
491
|
walletId: toWalletId(walletId),
|
|
436
492
|
placement: seams.placement,
|
|
437
493
|
menuItems: MENU_ITEMS,
|
|
@@ -493,72 +549,36 @@ const AccountMenuButtonInner = ({ presentation, nearAccountId: nearAccountIdProp
|
|
|
493
549
|
onClose: setShowQRScanner.bind(null, false),
|
|
494
550
|
onError: closeSettingsScanner.bind(null, setShowQRScanner, setSettingsError)
|
|
495
551
|
})] });
|
|
496
|
-
return /* @__PURE__ */
|
|
497
|
-
|
|
498
|
-
|
|
552
|
+
return /* @__PURE__ */ jsx(AccountMenuButtonView, {
|
|
553
|
+
buttonRef: refs.buttonRef,
|
|
554
|
+
dropdownRef: refs.dropdownRef,
|
|
555
|
+
className,
|
|
499
556
|
style,
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
accountsOpen,
|
|
526
|
-
exportKeysOpen,
|
|
527
|
-
exportLoadingChain,
|
|
528
|
-
canExportNearKey,
|
|
529
|
-
canExportEvmKeys,
|
|
530
|
-
onExportChain: startExportKeyFlow,
|
|
531
|
-
walletId,
|
|
532
|
-
nearAccountId,
|
|
533
|
-
theme,
|
|
534
|
-
highlightedMenuItemId
|
|
535
|
-
}),
|
|
536
|
-
canPortal && createPortal(/* @__PURE__ */ jsx(QRCodeScanner, {
|
|
537
|
-
isOpen: showQRScanner,
|
|
538
|
-
onQRCodeScanned: handleQrCodeScanned,
|
|
539
|
-
onError: (error) => {
|
|
540
|
-
deviceLinkingScannerParams?.onError?.(error);
|
|
541
|
-
setShowQRScanner(false);
|
|
542
|
-
handleClose();
|
|
543
|
-
},
|
|
544
|
-
onClose: () => {
|
|
545
|
-
deviceLinkingScannerParams?.onClose?.();
|
|
546
|
-
setShowQRScanner(false);
|
|
547
|
-
handleClose();
|
|
548
|
-
},
|
|
549
|
-
onEvent: (event) => deviceLinkingScannerParams?.onEvent?.(event)
|
|
550
|
-
}, "profile-qr-scanner"), portalHost),
|
|
551
|
-
canPortal && createPortal(/* @__PURE__ */ jsx(AuthenticationMethodsModal, {
|
|
552
|
-
walletId: walletId ?? null,
|
|
553
|
-
isOpen: showAuthenticationMethods,
|
|
554
|
-
onClose: () => setShowAuthenticationMethods(false)
|
|
555
|
-
}), portalHost),
|
|
556
|
-
canPortal && createPortal(/* @__PURE__ */ jsx(LinkedDevicesModal, {
|
|
557
|
-
walletId: walletId ?? null,
|
|
558
|
-
isOpen: showLinkedDevices,
|
|
559
|
-
onClose: () => setShowLinkedDevices(false)
|
|
560
|
-
}), portalHost)
|
|
561
|
-
]
|
|
557
|
+
trigger: {
|
|
558
|
+
label: loginState.isLoggedIn ? "Settings" : "Logged out",
|
|
559
|
+
username: accountName,
|
|
560
|
+
hideUsername,
|
|
561
|
+
fullAccountId: walletId || void 0,
|
|
562
|
+
emailAddress: emailAddress || void 0,
|
|
563
|
+
isOpen,
|
|
564
|
+
onClick: handleToggle,
|
|
565
|
+
theme
|
|
566
|
+
},
|
|
567
|
+
dropdown: {
|
|
568
|
+
isOpen,
|
|
569
|
+
menuItems: MENU_ITEMS,
|
|
570
|
+
onLock: handleLock,
|
|
571
|
+
onClose: handleClose,
|
|
572
|
+
menuItemsRef: refs.menuItemsRef,
|
|
573
|
+
toggleColors,
|
|
574
|
+
theme,
|
|
575
|
+
highlightedMenuItemId
|
|
576
|
+
},
|
|
577
|
+
children: screen === "overview" ? null : /* @__PURE__ */ jsxs(Fragment, { children: [screens[screen], settingsError ? /* @__PURE__ */ jsx("p", {
|
|
578
|
+
className: "seams-account-error",
|
|
579
|
+
role: "alert",
|
|
580
|
+
children: settingsError
|
|
581
|
+
}) : null] })
|
|
562
582
|
});
|
|
563
583
|
};
|
|
564
584
|
const AccountMenuButton = (props) => {
|
|
@@ -601,6 +621,6 @@ function WalletSettingsPage(props) {
|
|
|
601
621
|
});
|
|
602
622
|
}
|
|
603
623
|
//#endregion
|
|
604
|
-
export { AccountMenuButton, ProfileSettingsButton, WalletSettingsPage };
|
|
624
|
+
export { AccountMenuButton, AccountMenuButtonMock, ProfileSettingsButton, WalletSettingsPage };
|
|
605
625
|
|
|
606
626
|
//# sourceMappingURL=index.js.map
|
|
@@ -4,6 +4,8 @@ import { useSeams } from "../context/index.js";
|
|
|
4
4
|
import { Theme, useTheme } from "./theme/ThemeProvider.js";
|
|
5
5
|
import { useDeviceLinking } from "../hooks/useDeviceLinking.js";
|
|
6
6
|
import { QRScanMode, useQRCamera } from "../hooks/useQRCamera.js";
|
|
7
|
+
import { AccountMenuScreen } from "./AccountMenuButton/AccountMenuScreen.js";
|
|
8
|
+
import { QRCodeScannerCamera } from "./QRCodeScannerCamera.js";
|
|
7
9
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
8
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
11
|
//#region src/react/components/QRCodeScanner.tsx
|
|
@@ -26,7 +28,22 @@ function restorableFocusElement() {
|
|
|
26
28
|
if (activeElement.closest("[aria-hidden=\"true\"]")) return null;
|
|
27
29
|
return activeElement;
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
function ScannerFrame({ presentation, onClose, theme, tokens, children }) {
|
|
32
|
+
if (presentation === "embedded") return /* @__PURE__ */ jsxs(AccountMenuScreen, {
|
|
33
|
+
title: "Link a device",
|
|
34
|
+
onBack: onClose,
|
|
35
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
36
|
+
className: "seams-account-description",
|
|
37
|
+
children: "Open your wallet on the other device, then scan its pairing code."
|
|
38
|
+
}), children]
|
|
39
|
+
});
|
|
40
|
+
return /* @__PURE__ */ jsx(Theme, {
|
|
41
|
+
theme,
|
|
42
|
+
tokens,
|
|
43
|
+
children
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = true, cameraId, className, style, showCamera = true, presentation = "modal" }) => {
|
|
30
47
|
const { theme, tokens } = useTheme();
|
|
31
48
|
const { cancelLinking } = useSeams();
|
|
32
49
|
const scopedTokens = React.useMemo(() => theme === "dark" ? { dark: tokens } : { light: tokens }, [theme, tokens]);
|
|
@@ -176,7 +193,7 @@ const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = tr
|
|
|
176
193
|
focusIntentRef.current = null;
|
|
177
194
|
switch (intent) {
|
|
178
195
|
case "scanner":
|
|
179
|
-
focusElement(closeButtonRef.current);
|
|
196
|
+
if (presentation === "modal") focusElement(closeButtonRef.current);
|
|
180
197
|
break;
|
|
181
198
|
case "email":
|
|
182
199
|
focusFirstElement(scannerPanelRef.current);
|
|
@@ -193,7 +210,8 @@ const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = tr
|
|
|
193
210
|
emailOtpSelection?.kind,
|
|
194
211
|
isOpen,
|
|
195
212
|
qrCamera.error,
|
|
196
|
-
scannerState.kind
|
|
213
|
+
scannerState.kind,
|
|
214
|
+
presentation
|
|
197
215
|
]);
|
|
198
216
|
useEffect(() => {
|
|
199
217
|
return () => {
|
|
@@ -206,6 +224,8 @@ const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = tr
|
|
|
206
224
|
cancellationRequestedRef.current = true;
|
|
207
225
|
cancelLinking().catch(() => void 0);
|
|
208
226
|
}, [cancelLinking, scannerState.kind]);
|
|
227
|
+
const cancelActiveLinkRef = useRef(cancelActiveLink);
|
|
228
|
+
cancelActiveLinkRef.current = cancelActiveLink;
|
|
209
229
|
const handleClose = useCallback(() => {
|
|
210
230
|
stopScanning();
|
|
211
231
|
cancelActiveLink();
|
|
@@ -244,15 +264,19 @@ const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = tr
|
|
|
244
264
|
const handleBackdropClick = useCallback((event) => {
|
|
245
265
|
event.stopPropagation();
|
|
246
266
|
stopPropagationNative(event);
|
|
247
|
-
if (event.target === event.currentTarget) handleClose();
|
|
248
|
-
}, [
|
|
267
|
+
if (presentation === "modal" && event.target === event.currentTarget) handleClose();
|
|
268
|
+
}, [
|
|
269
|
+
handleClose,
|
|
270
|
+
stopPropagationNative,
|
|
271
|
+
presentation
|
|
272
|
+
]);
|
|
249
273
|
const stopEventPropagation = useCallback((event) => {
|
|
250
274
|
event.stopPropagation();
|
|
251
275
|
stopPropagationNative(event);
|
|
252
276
|
}, [stopPropagationNative]);
|
|
253
277
|
const isFocusTrapActive = scannerState.kind === "scanning" || emailOtpSelection !== null || qrCamera.error !== null;
|
|
254
278
|
const handleModalKeyDown = useCallback((event) => {
|
|
255
|
-
if (event.key !== "Tab" || !isFocusTrapActive) return;
|
|
279
|
+
if (presentation === "embedded" || event.key !== "Tab" || !isFocusTrapActive) return;
|
|
256
280
|
const elements = focusableElements(event.currentTarget);
|
|
257
281
|
if (elements.length === 0) {
|
|
258
282
|
event.preventDefault();
|
|
@@ -268,11 +292,12 @@ const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = tr
|
|
|
268
292
|
event.preventDefault();
|
|
269
293
|
focusElement(elements[0]);
|
|
270
294
|
}
|
|
271
|
-
}, [isFocusTrapActive]);
|
|
295
|
+
}, [isFocusTrapActive, presentation]);
|
|
272
296
|
useEffect(() => {
|
|
273
297
|
return () => {
|
|
274
298
|
rejectPendingEmailOtpSelection(/* @__PURE__ */ new Error("Device linking was cancelled"));
|
|
275
299
|
stopScanning();
|
|
300
|
+
cancelActiveLinkRef.current();
|
|
276
301
|
};
|
|
277
302
|
}, [rejectPendingEmailOtpSelection, stopScanning]);
|
|
278
303
|
useEffect(() => {
|
|
@@ -285,7 +310,7 @@ const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = tr
|
|
|
285
310
|
]);
|
|
286
311
|
useEffect(() => {
|
|
287
312
|
const handleKeyDown = (event) => {
|
|
288
|
-
if (event.key === "Escape" && isOpen) handleClose();
|
|
313
|
+
if (event.key === "Escape" && isOpen && !event.defaultPrevented) handleClose();
|
|
289
314
|
};
|
|
290
315
|
if (isOpen) document.addEventListener("keydown", handleKeyDown);
|
|
291
316
|
return () => {
|
|
@@ -293,14 +318,17 @@ const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = tr
|
|
|
293
318
|
};
|
|
294
319
|
}, [isOpen, handleClose]);
|
|
295
320
|
if (!isOpen) return null;
|
|
296
|
-
if (qrCamera.error) return /* @__PURE__ */ jsx(
|
|
321
|
+
if (qrCamera.error) return /* @__PURE__ */ jsx(ScannerFrame, {
|
|
322
|
+
presentation,
|
|
323
|
+
onClose: handleClose,
|
|
297
324
|
theme,
|
|
298
325
|
tokens: scopedTokens,
|
|
299
326
|
children: /* @__PURE__ */ jsx("div", {
|
|
300
327
|
className: `qr-scanner-modal qr-scanner-modal--error ${className || ""}`,
|
|
328
|
+
"data-presentation": presentation,
|
|
301
329
|
style,
|
|
302
|
-
role: "dialog",
|
|
303
|
-
"aria-modal": "true
|
|
330
|
+
role: presentation === "modal" ? "dialog" : "region",
|
|
331
|
+
"aria-modal": presentation === "modal" ? true : void 0,
|
|
304
332
|
"aria-labelledby": "qr-scanner-error-title",
|
|
305
333
|
onKeyDown: handleModalKeyDown,
|
|
306
334
|
onClick: handleBackdropClick,
|
|
@@ -334,14 +362,17 @@ const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = tr
|
|
|
334
362
|
})
|
|
335
363
|
})
|
|
336
364
|
});
|
|
337
|
-
if (emailOtpSelection) return /* @__PURE__ */ jsx(
|
|
365
|
+
if (emailOtpSelection) return /* @__PURE__ */ jsx(ScannerFrame, {
|
|
366
|
+
presentation,
|
|
367
|
+
onClose: handleClose,
|
|
338
368
|
theme,
|
|
339
369
|
tokens: scopedTokens,
|
|
340
370
|
children: /* @__PURE__ */ jsxs("div", {
|
|
341
371
|
className: `qr-scanner-modal ${className || ""}`,
|
|
372
|
+
"data-presentation": presentation,
|
|
342
373
|
style,
|
|
343
|
-
role: "dialog",
|
|
344
|
-
"aria-modal": "true
|
|
374
|
+
role: presentation === "modal" ? "dialog" : "region",
|
|
375
|
+
"aria-modal": presentation === "modal" ? true : void 0,
|
|
345
376
|
"aria-labelledby": "qr-scanner-email-selection-title",
|
|
346
377
|
onKeyDown: handleModalKeyDown,
|
|
347
378
|
onClick: handleBackdropClick,
|
|
@@ -410,14 +441,17 @@ const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = tr
|
|
|
410
441
|
})]
|
|
411
442
|
})
|
|
412
443
|
});
|
|
413
|
-
return /* @__PURE__ */ jsx(
|
|
444
|
+
return /* @__PURE__ */ jsx(ScannerFrame, {
|
|
445
|
+
presentation,
|
|
446
|
+
onClose: handleClose,
|
|
414
447
|
theme,
|
|
415
448
|
tokens: scopedTokens,
|
|
416
449
|
children: /* @__PURE__ */ jsxs("div", {
|
|
417
450
|
className: `qr-scanner-modal${scannerState.kind === "linking" ? " qr-scanner-modal--linking" : ""} ${className || ""}`,
|
|
451
|
+
"data-presentation": presentation,
|
|
418
452
|
style,
|
|
419
|
-
role: isFocusTrapActive ? "dialog" : "region",
|
|
420
|
-
"aria-modal": isFocusTrapActive ? true : void 0,
|
|
453
|
+
role: presentation === "modal" && isFocusTrapActive ? "dialog" : "region",
|
|
454
|
+
"aria-modal": presentation === "modal" && isFocusTrapActive ? true : void 0,
|
|
421
455
|
"aria-labelledby": "qr-scanner-title",
|
|
422
456
|
onKeyDown: handleModalKeyDown,
|
|
423
457
|
onClick: handleBackdropClick,
|
|
@@ -502,29 +536,19 @@ const QRCodeScanner = ({ onQRCodeScanned, onError, onClose, onEvent, isOpen = tr
|
|
|
502
536
|
}) : showCamera && (qrCamera.scanMode === QRScanMode.CAMERA || qrCamera.scanMode === QRScanMode.AUTO) && /* @__PURE__ */ jsxs("div", {
|
|
503
537
|
className: "qr-scanner-camera-section",
|
|
504
538
|
children: [
|
|
505
|
-
/* @__PURE__ */ jsxs("
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
/* @__PURE__ */ jsx("canvas", {
|
|
519
|
-
ref: qrCamera.canvasRef,
|
|
520
|
-
className: "qr-scanner-canvas"
|
|
521
|
-
}),
|
|
522
|
-
/* @__PURE__ */ jsx("div", {
|
|
523
|
-
className: "qr-scanner-overlay",
|
|
524
|
-
children: /* @__PURE__ */ jsx("div", { className: "qr-scanner-box" })
|
|
525
|
-
})
|
|
526
|
-
]
|
|
527
|
-
}),
|
|
539
|
+
/* @__PURE__ */ jsxs(QRCodeScannerCamera, { children: [/* @__PURE__ */ jsx("video", {
|
|
540
|
+
ref: qrCamera.videoRef,
|
|
541
|
+
className: `qr-scanner-video${isVideoReady ? " is-ready" : ""}`,
|
|
542
|
+
style: { transform: qrCamera.isFrontCamera ? "scaleX(-1)" : "none" },
|
|
543
|
+
playsInline: true,
|
|
544
|
+
autoPlay: true,
|
|
545
|
+
muted: true,
|
|
546
|
+
onCanPlay: () => setIsVideoReady(true),
|
|
547
|
+
onLoadedData: () => setIsVideoReady(true)
|
|
548
|
+
}), /* @__PURE__ */ jsx("canvas", {
|
|
549
|
+
ref: qrCamera.canvasRef,
|
|
550
|
+
className: "qr-scanner-canvas"
|
|
551
|
+
})] }),
|
|
528
552
|
/* @__PURE__ */ jsxs("div", {
|
|
529
553
|
className: "qr-scanner-instructions",
|
|
530
554
|
children: [/* @__PURE__ */ jsx("p", { children: "Position the QR code within the frame" }), qrCamera.isScanning && /* @__PURE__ */ jsx("p", {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/react/components/QRCodeScannerCamera.tsx
|
|
4
|
+
function QRCodeScannerCamera({ children }) {
|
|
5
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
6
|
+
className: "qr-scanner-camera-container",
|
|
7
|
+
children: [children, /* @__PURE__ */ jsx("div", {
|
|
8
|
+
className: "qr-scanner-overlay",
|
|
9
|
+
children: /* @__PURE__ */ jsx("div", { className: "qr-scanner-box" })
|
|
10
|
+
})]
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { QRCodeScannerCamera };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=QRCodeScannerCamera.js.map
|
|
@@ -4,7 +4,7 @@ import { isLinkedDeviceTargetEmailAddressV1, normalizeLinkedDeviceTargetEmailAdd
|
|
|
4
4
|
import { useSeams } from "../context/index.js";
|
|
5
5
|
import FingerprintIcon from "./FingerprintIcon.js";
|
|
6
6
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
7
|
-
import { Fragment
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import "./ShowQRCode.css";
|
|
9
9
|
//#region src/react/components/ShowQRCode.tsx
|
|
10
10
|
const DEFAULT_TARGET_FACTOR = { kind: "passkey_prf" };
|
|
@@ -709,7 +709,7 @@ function EmailOtpActivation({ activation, onError }) {
|
|
|
709
709
|
role: "alert",
|
|
710
710
|
children: state.message
|
|
711
711
|
}),
|
|
712
|
-
state.kind === "unavailable" && /* @__PURE__ */ jsxs(Fragment
|
|
712
|
+
state.kind === "unavailable" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
713
713
|
className: "seams-otp-error",
|
|
714
714
|
role: "alert",
|
|
715
715
|
children: state.message
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, useEffect, useSyncExternalStore } from "react";
|
|
2
|
-
import { Fragment
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
//#region src/react/externalEvm.tsx
|
|
4
4
|
/** Subscribe to a host-owned controller and mount its browser discovery lifecycle. */
|
|
5
5
|
function useExternalEvm(controller) {
|
|
@@ -82,7 +82,7 @@ var WalletPicker = class extends Component {
|
|
|
82
82
|
})]
|
|
83
83
|
}),
|
|
84
84
|
wallets.length === 0 && /* @__PURE__ */ jsx("p", { children: "Install MetaMask, Rabby, or Phantom, then reload this page." }),
|
|
85
|
-
connection.kind === "connected" && /* @__PURE__ */ jsxs(Fragment
|
|
85
|
+
connection.kind === "connected" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
86
86
|
/* @__PURE__ */ jsxs("p", { children: ["Connected to ", connection.wallet.name] }),
|
|
87
87
|
/* @__PURE__ */ jsxs("label", { children: [
|
|
88
88
|
"Account",
|
package/dist/esm/react/index.js
CHANGED
|
@@ -28,9 +28,10 @@ import SunIcon from "./components/AccountMenuButton/icons/SunIcon.js";
|
|
|
28
28
|
import MoonIcon from "./components/AccountMenuButton/icons/MoonIcon.js";
|
|
29
29
|
import { SeamsAuthMenuMock } from "./components/HostedSeamsAuthMenu/SeamsAuthMenuMock.js";
|
|
30
30
|
import HostedSeamsAuthMenu from "./components/HostedSeamsAuthMenu/shell.js";
|
|
31
|
+
import { AccountMenuButtonMock } from "./components/AccountMenuButton/AccountMenuButtonMock.js";
|
|
31
32
|
import { AccountMenuButton, ProfileSettingsButton, WalletSettingsPage } from "./components/AccountMenuButton/index.js";
|
|
32
33
|
import { ShowQRCode } from "./components/ShowQRCode.js";
|
|
33
34
|
import { VoiceAssistantCard } from "./components/VoiceAssistantCard.js";
|
|
34
35
|
import QRCodeIcon from "./components/QRCodeIcon.js";
|
|
35
36
|
import { VoiceBeam } from "voice-glow";
|
|
36
|
-
export { AccountMenuButton, AccountSyncEventPhase, ActionType, DARK_TOKENS, ExternalEvmController, ExternalEvmWalletPicker, HostedSeamsAuthMenu, KeyExportEventPhase, LIGHT_TOKENS, LinkDeviceEventPhase, MoonIcon, PASSKEY_MANAGER_DEFAULT_CONFIGS, PROFILE_MENU_ITEM_IDS, ProfileSettingsButton, QRCodeIcon, QRCodeScanner, QRScanMode, RegistrationEventPhase, SHAPE_PRESETS, SHAPE_ROUNDED, SHAPE_SQUARE, SeamsAuthMenuMock, SeamsContextProvider, SeamsWeb, SeamsWebProvider, ShowQRCode, SigningEventPhase, SunIcon, Theme, TouchIcon, TransactionReviewError, TransactionReviewHost, TxExecutionStatus, UnlockEventPhase, VoiceAssistantCard, VoiceBeam, WALLET_FLOW_EVENT_MESSAGES, WALLET_FLOW_EVENT_STEPS, WALLET_FLOW_EVENT_VERSION, WalletSettingsPage, addKey, configuredThresholdEcdsaChainTargets, createAccount, createAccountSyncFlowEvent, createKeyExportFlowEvent, createLinkDeviceFlowEvent, createRegistrationFlowEvent, createSigningFlowEvent, createUnlockFlowEvent, createWalletFlowEvent, defineSeamsConfig, deleteAccount, deleteKey, deployContract, functionCall, isWalletFlowEvent, logWalletEvents, nearAccountRefFromAccountId, seamsTestnetConfig, stake, thresholdEcdsaChainTargetFromChainFamily, thresholdEcdsaChainTargetFromConfig, thresholdEcdsaChainTargetFromConfiguredRequest, thresholdEcdsaChainTargetFromRequest, thresholdEcdsaChainTargetKey, thresholdEcdsaChainTargetsEqual, toWalletId, transfer, useAccountInput, useDeviceLinking, useExternalEvm, useNearClient, useQRCamera, useSeams, useTheme, useWallet, useWalletAuth, useWalletDevices, walletIdFromWalletProfile, walletSessionRefFromSession };
|
|
37
|
+
export { AccountMenuButton, AccountMenuButtonMock, AccountSyncEventPhase, ActionType, DARK_TOKENS, ExternalEvmController, ExternalEvmWalletPicker, HostedSeamsAuthMenu, KeyExportEventPhase, LIGHT_TOKENS, LinkDeviceEventPhase, MoonIcon, PASSKEY_MANAGER_DEFAULT_CONFIGS, PROFILE_MENU_ITEM_IDS, ProfileSettingsButton, QRCodeIcon, QRCodeScanner, QRScanMode, RegistrationEventPhase, SHAPE_PRESETS, SHAPE_ROUNDED, SHAPE_SQUARE, SeamsAuthMenuMock, SeamsContextProvider, SeamsWeb, SeamsWebProvider, ShowQRCode, SigningEventPhase, SunIcon, Theme, TouchIcon, TransactionReviewError, TransactionReviewHost, TxExecutionStatus, UnlockEventPhase, VoiceAssistantCard, VoiceBeam, WALLET_FLOW_EVENT_MESSAGES, WALLET_FLOW_EVENT_STEPS, WALLET_FLOW_EVENT_VERSION, WalletSettingsPage, addKey, configuredThresholdEcdsaChainTargets, createAccount, createAccountSyncFlowEvent, createKeyExportFlowEvent, createLinkDeviceFlowEvent, createRegistrationFlowEvent, createSigningFlowEvent, createUnlockFlowEvent, createWalletFlowEvent, defineSeamsConfig, deleteAccount, deleteKey, deployContract, functionCall, isWalletFlowEvent, logWalletEvents, nearAccountRefFromAccountId, seamsTestnetConfig, stake, thresholdEcdsaChainTargetFromChainFamily, thresholdEcdsaChainTargetFromConfig, thresholdEcdsaChainTargetFromConfiguredRequest, thresholdEcdsaChainTargetFromRequest, thresholdEcdsaChainTargetKey, thresholdEcdsaChainTargetsEqual, toWalletId, transfer, useAccountInput, useDeviceLinking, useExternalEvm, useNearClient, useQRCamera, useSeams, useTheme, useWallet, useWalletAuth, useWalletDevices, walletIdFromWalletProfile, walletSessionRefFromSession };
|