@dexterai/connect 0.31.0 → 0.31.2
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 +8 -1
- package/dist/{chunk-WHGR5FUY.js → chunk-GIEQOIYI.js} +1 -1
- package/dist/{chunk-4FTJB7FT.js → chunk-IPEINLMT.js} +21 -1
- package/dist/{chunk-Z6YHGWG3.js → chunk-UQE76AJW.js} +1 -1
- package/dist/{connectionContract-BzV_pjOI.d.ts → connectionContract-BgecDiDk.d.ts} +1 -1
- package/dist/{enroll-BmD1y8KH.d.ts → enroll-Cqou8Pbi.d.ts} +2 -0
- package/dist/hosted.d.ts +2 -1
- package/dist/hosted.js +3 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/react.d.ts +11 -7
- package/dist/react.js +89 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,8 +85,15 @@ accounts clears the previous balance immediately. Wallet holdings are bound to
|
|
|
85
85
|
`receiveAddress`, the asset address. `walletAddress` identifies the Swig control
|
|
86
86
|
account and must not be used to match a portfolio.
|
|
87
87
|
|
|
88
|
+
The account name opens its wallet. A compact control beneath it copies the
|
|
89
|
+
selected receive address and confirms success after the clipboard accepts it.
|
|
90
|
+
Both remain available when an app supplies its own `renderSummary`.
|
|
91
|
+
|
|
88
92
|
Destinations open Dexter by default and carry the selected account. Dexter asks
|
|
89
|
-
for
|
|
93
|
+
for confirmation if a different account is active there. `connection.connect({ userHandle })`
|
|
94
|
+
targets that account's saved credential when available and checks the returned account
|
|
95
|
+
before changing sessions. A device without that saved credential uses its passkey picker.
|
|
96
|
+
Set `navigation` to use local app routes,
|
|
90
97
|
or set an entry to `false` to hide it. `items` adds app-specific destinations with
|
|
91
98
|
`requires: 'account'` or `requires: 'wallet'`; only verified access exposes them.
|
|
92
99
|
The destination itself must enforce its own authorization.
|
|
@@ -4,6 +4,11 @@ import {
|
|
|
4
4
|
} from "./chunk-EMCGL64H.js";
|
|
5
5
|
|
|
6
6
|
// src/types.ts
|
|
7
|
+
function resolveTargetUserHandle(value) {
|
|
8
|
+
if (value === void 0) return void 0;
|
|
9
|
+
if (typeof value === "string" && /^[A-Za-z0-9_-]{22}$/.test(value)) return value;
|
|
10
|
+
throw new ConnectError("invalid_target_account");
|
|
11
|
+
}
|
|
7
12
|
function resolveWalletStoreMode(mode) {
|
|
8
13
|
if (mode === void 0 || mode === "commit") return "commit";
|
|
9
14
|
if (mode === "provisional") return "provisional";
|
|
@@ -697,6 +702,9 @@ function setActiveWallet(wallet) {
|
|
|
697
702
|
function setActiveHandle(handle, label, credentialId) {
|
|
698
703
|
activateWallet({ handle, label, credentialId });
|
|
699
704
|
}
|
|
705
|
+
function getCredentialId(handle) {
|
|
706
|
+
return readRoster().find((wallet) => wallet.handle === handle)?.credentialId;
|
|
707
|
+
}
|
|
700
708
|
function disconnectActiveWallet() {
|
|
701
709
|
if (!hasStorage()) return false;
|
|
702
710
|
const previousActiveWallet = getActiveWallet();
|
|
@@ -1024,6 +1032,7 @@ function openCeremonyPopup(op, config = {}) {
|
|
|
1024
1032
|
const agentDelegation = createsWallet ? resolveAgentDelegationMode(config.agentDelegation) : void 0;
|
|
1025
1033
|
const params = new URLSearchParams({ v: "1", op, requestId, origin: openerOrigin });
|
|
1026
1034
|
if (config.name) params.set("name", config.name);
|
|
1035
|
+
if (config.targetUserHandle) params.set("targetUserHandle", config.targetUserHandle);
|
|
1027
1036
|
if (config.preferImmediate) params.set("preferImmediate", "1");
|
|
1028
1037
|
if (walletStore === "provisional") params.set("walletStore", "provisional");
|
|
1029
1038
|
if (agentDelegation) params.set("agentDelegation", agentDelegation);
|
|
@@ -1616,13 +1625,16 @@ primeImmediateSupport();
|
|
|
1616
1625
|
async function passkeyLogin(config = {}, onPhase) {
|
|
1617
1626
|
const apiBase = resolveDexterApiBase(config.apiBase);
|
|
1618
1627
|
const walletStore = resolveWalletStoreMode(config.walletStore);
|
|
1628
|
+
const targetUserHandle = resolveTargetUserHandle(config.targetUserHandle);
|
|
1619
1629
|
if (shouldUsePopup(config.transport)) {
|
|
1620
1630
|
const result2 = normalizeSignInResult(
|
|
1621
1631
|
await openCeremonyPopup("signin", {
|
|
1622
1632
|
connectHost: config.connectHost,
|
|
1633
|
+
...targetUserHandle ? { targetUserHandle } : {},
|
|
1623
1634
|
...walletStore === "provisional" ? { walletStore } : {}
|
|
1624
1635
|
})
|
|
1625
1636
|
);
|
|
1637
|
+
assertTargetAccount(result2, targetUserHandle);
|
|
1626
1638
|
if (walletStore === "commit") {
|
|
1627
1639
|
activateConnectVault(result2.vault, result2.walletIdentityProof);
|
|
1628
1640
|
}
|
|
@@ -1633,21 +1645,29 @@ async function passkeyLogin(config = {}, onPhase) {
|
|
|
1633
1645
|
}
|
|
1634
1646
|
onPhase?.("challenge");
|
|
1635
1647
|
const options = await fetchLoginChallenge(apiBase);
|
|
1648
|
+
const credentialId = targetUserHandle ? getCredentialId(targetUserHandle) : void 0;
|
|
1649
|
+
const targetedOptions = credentialId ? { ...options, allowCredentials: [{ id: credentialId, type: "public-key" }] } : options;
|
|
1636
1650
|
onPhase?.("passkey");
|
|
1637
1651
|
let response;
|
|
1638
1652
|
try {
|
|
1639
|
-
response = await startAuthentication2({ optionsJSON:
|
|
1653
|
+
response = await startAuthentication2({ optionsJSON: targetedOptions });
|
|
1640
1654
|
} catch (err) {
|
|
1641
1655
|
throw new ConnectError("webauthn_failed", err instanceof Error ? err.message : String(err));
|
|
1642
1656
|
}
|
|
1643
1657
|
onPhase?.("verifying");
|
|
1644
1658
|
const result = await submitLogin(apiBase, response);
|
|
1659
|
+
assertTargetAccount(result, targetUserHandle);
|
|
1645
1660
|
if (walletStore === "commit") {
|
|
1646
1661
|
activateConnectVault(result.vault, result.walletIdentityProof);
|
|
1647
1662
|
}
|
|
1648
1663
|
clearPendingCreation(result.vault.credentialId);
|
|
1649
1664
|
return result;
|
|
1650
1665
|
}
|
|
1666
|
+
function assertTargetAccount(result, expected) {
|
|
1667
|
+
if (expected && result.vault.userHandle !== expected) {
|
|
1668
|
+
throw new ConnectError("target_account_mismatch", "The selected passkey belongs to a different account.");
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1651
1671
|
async function continueWithDexter(config = {}, onPhase) {
|
|
1652
1672
|
const walletStore = resolveWalletStoreMode(config.walletStore);
|
|
1653
1673
|
const agentDelegation = resolveAgentDelegationMode(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PasskeyLoginTokens, r as PasskeyLoginConfig, a as CeremonyPhase, S as SignInResult } from './enroll-
|
|
1
|
+
import { P as PasskeyLoginTokens, r as PasskeyLoginConfig, a as CeremonyPhase, S as SignInResult } from './enroll-Cqou8Pbi.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Framework-neutral Wallet/account relationship controller.
|
|
@@ -170,6 +170,8 @@ interface RecoverWalletConfig extends DexterConnectConfig {
|
|
|
170
170
|
}
|
|
171
171
|
/** Configuration for `passkeyLogin`. */
|
|
172
172
|
interface PasskeyLoginConfig extends DexterConnectConfig {
|
|
173
|
+
/** Target a known account; use its saved credential and verify the returned identity. */
|
|
174
|
+
targetUserHandle?: string;
|
|
173
175
|
/**
|
|
174
176
|
* Wallet-store behavior after a successful passkey ceremony. Defaults to
|
|
175
177
|
* `commit` for backward compatibility. Use `provisional` when the returned
|
package/dist/hosted.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SignInResult, C as CreateWalletResult, W as WalletStoreMode, a as CeremonyPhase, b as SpendPolicy, R as RecoverOutcome } from './enroll-
|
|
1
|
+
import { S as SignInResult, C as CreateWalletResult, W as WalletStoreMode, a as CeremonyPhase, b as SpendPolicy, R as RecoverOutcome } from './enroll-Cqou8Pbi.js';
|
|
2
2
|
import { AuthenticationResponseJSON } from '@simplewebauthn/browser';
|
|
3
3
|
|
|
4
4
|
type ContinueResult = ({
|
|
@@ -33,6 +33,7 @@ interface HostedCeremonyBase {
|
|
|
33
33
|
}
|
|
34
34
|
interface HostedSignInCeremony extends HostedCeremonyBase {
|
|
35
35
|
operation: 'signin';
|
|
36
|
+
targetUserHandle?: string;
|
|
36
37
|
}
|
|
37
38
|
type HostedDelegationChoice = {
|
|
38
39
|
agentDelegation: 'configure-now';
|
package/dist/hosted.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
recoverWallet,
|
|
3
3
|
runHostedMissingVaultRecoveryProof
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GIEQOIYI.js";
|
|
5
5
|
import {
|
|
6
6
|
ConnectError,
|
|
7
7
|
DEXTER_API_BASE,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
passkeyLogin,
|
|
11
11
|
resolveAgentDelegationMode,
|
|
12
12
|
resolveWalletStoreMode
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IPEINLMT.js";
|
|
14
14
|
import "./chunk-EMCGL64H.js";
|
|
15
15
|
|
|
16
16
|
// src/hosted.ts
|
|
@@ -26,6 +26,7 @@ async function runHostedCeremony(request) {
|
|
|
26
26
|
{
|
|
27
27
|
apiBase: DEXTER_API_BASE,
|
|
28
28
|
transport: "inline",
|
|
29
|
+
...request.targetUserHandle !== void 0 ? { targetUserHandle: request.targetUserHandle } : {},
|
|
29
30
|
...persistence
|
|
30
31
|
},
|
|
31
32
|
request.onPhase
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { M as MissingVaultRecoveryConfig, c as MissingVaultRecoveryResult, d as ConnectVault, e as RecoverWalletConfig, R as RecoverOutcome, f as WalletIdentityProof, a as CeremonyPhase } from './enroll-
|
|
2
|
-
export { A as AgentDelegationMode, g as CeremonyOperation, h as ConnectError, i as CreateWalletConfig, C as CreateWalletResult, D as DexterConnectConfig, H as HostedSignRequestPayload, j as HostedSignResult, k as HostedSignVaultIdentity, l as MissingVaultRecoveryAccount, m as MissingVaultRecoveryVault, P as PasskeyLoginTokens, n as RecoverVault, o as SESSION_TTL_30D, S as SignInResult, b as SpendPolicy, p as authoredPolicy, q as createWallet, u as usdToAtomic } from './enroll-
|
|
1
|
+
import { M as MissingVaultRecoveryConfig, c as MissingVaultRecoveryResult, d as ConnectVault, e as RecoverWalletConfig, R as RecoverOutcome, f as WalletIdentityProof, a as CeremonyPhase } from './enroll-Cqou8Pbi.js';
|
|
2
|
+
export { A as AgentDelegationMode, g as CeremonyOperation, h as ConnectError, i as CreateWalletConfig, C as CreateWalletResult, D as DexterConnectConfig, H as HostedSignRequestPayload, j as HostedSignResult, k as HostedSignVaultIdentity, l as MissingVaultRecoveryAccount, m as MissingVaultRecoveryVault, P as PasskeyLoginTokens, n as RecoverVault, o as SESSION_TTL_30D, S as SignInResult, b as SpendPolicy, p as authoredPolicy, q as createWallet, u as usdToAtomic } from './enroll-Cqou8Pbi.js';
|
|
3
3
|
import { PasskeySignerWithPublicKey } from '@dexterai/vault/signers';
|
|
4
|
-
import { A as ActiveWalletBindingIdentity, W as WalletBindingCandidate, a as WalletAccountRelationSnapshot, B as BindingFetch, b as WalletAccountBindingClient } from './connectionContract-
|
|
5
|
-
export { c as AccountBindingCandidate, d as AccountSessionClearer, e as AccountSessionInstaller, f as BindingResolutionResult, C as ConnectDexterIdentityConfig, D as DexterConnectionCapability, g as DexterConnectionIntent, h as DexterConnectionPermissions, i as DexterControlModel, j as DexterControlPrimaryAction, k as DexterControlStage, l as DisconnectDexterIdentityConfig, R as RelationCandidates, m as RelationCheckReason, n as RelationRuntime, o as ResolveWalletAccountBindingInput, p as ResolvedWalletAccountRelation, S as ServerRelationVerificationRequest, q as ServerRelationVerificationResult, r as ServerRelationVerifier, s as WALLET_ACCOUNT_BINDING_PATH, t as WalletAccountBindingClientConfig, u as WalletAccountRelation, v as WalletAccountRelationController, w as WalletAccountRelationControllerOptions, x as WalletIdentityFetchInput, y as accountBindingCandidate, z as connectDexterIdentity, E as createDexterControlModel, F as createWalletAccountBindingClient, G as disconnectDexterIdentity, H as fetchWithWalletIdentity, I as walletBindingCandidate } from './connectionContract-
|
|
4
|
+
import { A as ActiveWalletBindingIdentity, W as WalletBindingCandidate, a as WalletAccountRelationSnapshot, B as BindingFetch, b as WalletAccountBindingClient } from './connectionContract-BgecDiDk.js';
|
|
5
|
+
export { c as AccountBindingCandidate, d as AccountSessionClearer, e as AccountSessionInstaller, f as BindingResolutionResult, C as ConnectDexterIdentityConfig, D as DexterConnectionCapability, g as DexterConnectionIntent, h as DexterConnectionPermissions, i as DexterControlModel, j as DexterControlPrimaryAction, k as DexterControlStage, l as DisconnectDexterIdentityConfig, R as RelationCandidates, m as RelationCheckReason, n as RelationRuntime, o as ResolveWalletAccountBindingInput, p as ResolvedWalletAccountRelation, S as ServerRelationVerificationRequest, q as ServerRelationVerificationResult, r as ServerRelationVerifier, s as WALLET_ACCOUNT_BINDING_PATH, t as WalletAccountBindingClientConfig, u as WalletAccountRelation, v as WalletAccountRelationController, w as WalletAccountRelationControllerOptions, x as WalletIdentityFetchInput, y as accountBindingCandidate, z as connectDexterIdentity, E as createDexterControlModel, F as createWalletAccountBindingClient, G as disconnectDexterIdentity, H as fetchWithWalletIdentity, I as walletBindingCandidate } from './connectionContract-BgecDiDk.js';
|
|
6
6
|
import { PublicKeyCredentialRequestOptionsJSON, AuthenticationResponseJSON } from '@simplewebauthn/browser';
|
|
7
7
|
|
|
8
8
|
/**
|
package/dist/index.js
CHANGED
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
prunePasskey,
|
|
10
10
|
renamePasskey,
|
|
11
11
|
syncAcceptedPasskeys
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UQE76AJW.js";
|
|
13
13
|
import {
|
|
14
14
|
recoverMissingVaultForAccount,
|
|
15
15
|
recoverWallet
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GIEQOIYI.js";
|
|
17
17
|
import {
|
|
18
18
|
ConnectError,
|
|
19
19
|
SESSION_TTL_30D,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
usdToAtomic,
|
|
35
35
|
walletBindingCandidate,
|
|
36
36
|
walletProofSessionStore
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-IPEINLMT.js";
|
|
38
38
|
import {
|
|
39
39
|
base64ToBytes,
|
|
40
40
|
base64urlToBytes,
|
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as ConnectError, S as SignInResult, r as PasskeyLoginConfig, C as CreateWalletResult, A as AgentDelegationMode } from './enroll-
|
|
2
|
-
export { d as ConnectVault, R as RecoverOutcome, n as RecoverVault, f as WalletIdentityProof } from './enroll-
|
|
3
|
-
import { i as DexterControlModel, a as WalletAccountRelationSnapshot, g as DexterConnectionIntent, e as AccountSessionInstaller, d as AccountSessionClearer, B as BindingFetch } from './connectionContract-
|
|
4
|
-
export { D as DexterConnectionCapability, h as DexterConnectionPermissions, j as DexterControlPrimaryAction, k as DexterControlStage } from './connectionContract-
|
|
1
|
+
import { h as ConnectError, S as SignInResult, r as PasskeyLoginConfig, C as CreateWalletResult, A as AgentDelegationMode } from './enroll-Cqou8Pbi.js';
|
|
2
|
+
export { d as ConnectVault, R as RecoverOutcome, n as RecoverVault, f as WalletIdentityProof } from './enroll-Cqou8Pbi.js';
|
|
3
|
+
import { i as DexterControlModel, a as WalletAccountRelationSnapshot, g as DexterConnectionIntent, e as AccountSessionInstaller, d as AccountSessionClearer, B as BindingFetch } from './connectionContract-BgecDiDk.js';
|
|
4
|
+
export { D as DexterConnectionCapability, h as DexterConnectionPermissions, j as DexterControlPrimaryAction, k as DexterControlStage } from './connectionContract-BgecDiDk.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ButtonHTMLAttributes, ReactNode, ReactElement, ComponentType, AnchorHTMLAttributes } from 'react';
|
|
7
7
|
|
|
@@ -78,6 +78,10 @@ interface UseDexterConnectionConfig {
|
|
|
78
78
|
readonly fetch?: BindingFetch;
|
|
79
79
|
readonly passkey?: Omit<PasskeyLoginConfig, 'apiBase' | 'walletStore'>;
|
|
80
80
|
}
|
|
81
|
+
interface DexterConnectionTarget {
|
|
82
|
+
/** Connect this account, targeting its saved passkey when available. */
|
|
83
|
+
readonly userHandle: string;
|
|
84
|
+
}
|
|
81
85
|
interface UseDexterConnection {
|
|
82
86
|
readonly model: DexterControlModel;
|
|
83
87
|
readonly identity: DexterIdentityView;
|
|
@@ -85,8 +89,8 @@ interface UseDexterConnection {
|
|
|
85
89
|
readonly operation: DexterConnectionOperation;
|
|
86
90
|
readonly activeWallet: DexterWalletView | null;
|
|
87
91
|
readonly error: ConnectError | null;
|
|
88
|
-
connect(): Promise<SignInResult>;
|
|
89
|
-
useAnotherDexterWallet(): Promise<SignInResult>;
|
|
92
|
+
connect(target?: DexterConnectionTarget): Promise<SignInResult>;
|
|
93
|
+
useAnotherDexterWallet(target?: DexterConnectionTarget): Promise<SignInResult>;
|
|
90
94
|
disconnectDexter(): Promise<boolean>;
|
|
91
95
|
removeFromThisDevice(confirmation: RemoveDexterFromDeviceConfirmation): Promise<RemoveDexterFromDeviceResult>;
|
|
92
96
|
retry(): Promise<void>;
|
|
@@ -228,4 +232,4 @@ declare function hermesOpenUrl(name: string): string;
|
|
|
228
232
|
declare function claudeCodeInstallCommand(name: string, mcpUrl: string): string;
|
|
229
233
|
declare function AppInstallButtons(props: AppInstallButtonsProps): ReactElement;
|
|
230
234
|
|
|
231
|
-
export { type AccountDestination, type AccountLinkComponent, type AccountMenuItem, type AccountNavigation, AllowanceChips, type AllowanceChipsProps, AppInstallButtons, type AppInstallButtonsProps, CreateWalletPanel, type CreateWalletPanelProps, CreateWalletResult, DEFAULT_ACCOUNT_NAVIGATION, DexterAccountControl, type DexterAccountControlProps, type DexterAccountSession, DexterAccountSummary, type DexterAccountSummaryProps, DexterButton, type DexterButtonProps, DexterConnectionIntent, type DexterConnectionOperation, DexterControlModel, type DexterIdentityView, DexterMark, type DexterWalletView, type InstallApp, REMOVE_DEXTER_FROM_DEVICE_CONFIRMATION, type RemoveDexterFromDeviceConfirmation, type RemoveDexterFromDeviceResult, SignInResult, type UseDexterConnection, type UseDexterConnectionConfig, WalletAccountRelationSnapshot, chatgptPluginsUrl, claudeCodeInstallCommand, claudeWebConnectorUrl, cursorInstallUrl, hermesInstallCommand, hermesOpenUrl, useDexterConnection, vscodeInstallUrl };
|
|
235
|
+
export { type AccountDestination, type AccountLinkComponent, type AccountMenuItem, type AccountNavigation, AllowanceChips, type AllowanceChipsProps, AppInstallButtons, type AppInstallButtonsProps, CreateWalletPanel, type CreateWalletPanelProps, CreateWalletResult, DEFAULT_ACCOUNT_NAVIGATION, DexterAccountControl, type DexterAccountControlProps, type DexterAccountSession, DexterAccountSummary, type DexterAccountSummaryProps, DexterButton, type DexterButtonProps, DexterConnectionIntent, type DexterConnectionOperation, type DexterConnectionTarget, DexterControlModel, type DexterIdentityView, DexterMark, type DexterWalletView, type InstallApp, REMOVE_DEXTER_FROM_DEVICE_CONFIRMATION, type RemoveDexterFromDeviceConfirmation, type RemoveDexterFromDeviceResult, SignInResult, type UseDexterConnection, type UseDexterConnectionConfig, WalletAccountRelationSnapshot, chatgptPluginsUrl, claudeCodeInstallCommand, claudeWebConnectorUrl, cursorInstallUrl, hermesInstallCommand, hermesOpenUrl, useDexterConnection, vscodeInstallUrl };
|
package/dist/react.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
passkeySignalSupport,
|
|
8
8
|
prunePasskey,
|
|
9
9
|
renamePasskey
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UQE76AJW.js";
|
|
11
11
|
import {
|
|
12
12
|
ConnectError,
|
|
13
13
|
authoredPolicy,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
subscribe,
|
|
25
25
|
switchWallet,
|
|
26
26
|
walletProofSessionStore
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-IPEINLMT.js";
|
|
28
28
|
import {
|
|
29
29
|
DexterButton,
|
|
30
30
|
DexterMark,
|
|
@@ -387,7 +387,7 @@ function useDexterConnection(config) {
|
|
|
387
387
|
network: active.network ?? null
|
|
388
388
|
};
|
|
389
389
|
}, [model.permissions.walletIdentityVisible, wallet.activeWallet]);
|
|
390
|
-
const connect = useCallback2(async () => {
|
|
390
|
+
const connect = useCallback2(async (target) => {
|
|
391
391
|
beginAction("connecting");
|
|
392
392
|
setError(null);
|
|
393
393
|
setTargetHandle(null);
|
|
@@ -395,6 +395,7 @@ function useDexterConnection(config) {
|
|
|
395
395
|
try {
|
|
396
396
|
const result = await connectDexterIdentity({
|
|
397
397
|
...passkey,
|
|
398
|
+
...target ? { targetUserHandle: target.userHandle } : {},
|
|
398
399
|
...apiBase ? { apiBase } : {},
|
|
399
400
|
...fetch2 ? { bindingFetch: fetch2 } : {},
|
|
400
401
|
installAccountSession: async (session) => {
|
|
@@ -824,7 +825,7 @@ function AccountFace() {
|
|
|
824
825
|
}
|
|
825
826
|
|
|
826
827
|
// src/accountControlStyles.ts
|
|
827
|
-
var ACCOUNT_CONTROL_CSS = ".dx-account-control,.dx-account-panel,.dx-account-panel *{box-sizing:border-box}\n.dx-account-control{position:relative;display:inline-block}\n.dx-account-trigger{display:grid;place-items:center;width:48px;height:48px;padding:0;background:transparent;border:0;border-radius:0;box-shadow:none;cursor:pointer;transition:opacity 160ms,transform 100ms}\n.dx-account-trigger>svg{display:block;width:40px;height:32px;object-fit:contain}\n.dx-account-trigger:hover{opacity:.75}\n.dx-account-trigger:active{transform:scale(.94)}\n.dx-account-trigger:focus-visible,.dx-account-panel a:focus-visible,.dx-account-panel button:focus-visible{outline:2px solid #22272a;outline-offset:3px}\n.dx-account-panel{position:absolute;right:0;top:calc(100% + 12px);width:min(376px,calc(100vw - 40px));max-height:calc(100dvh - 100px);overflow-y:auto;overscroll-behavior:contain;z-index:30;padding:24px;background:#fff;color:#22272a;border:1px solid #e4e7e8;border-radius:18px;box-shadow:0 20px 60px -16px #22272a30;transform-origin:top right;font-family:var(--dx-account-font,inherit)}\n.dx-account-panel a,.dx-account-panel button{font-family:inherit;font-weight:500;text-decoration:none;letter-spacing:0;cursor:pointer}\n.dx-account-panel button:disabled{cursor:wait;opacity:.55}\n.dx-account-identity{display:flex;align-items:center;gap:12px;margin-bottom:14px;min-width:0}\n.dx-account-identity>svg{width:32px;height:36px;object-fit:contain;flex-shrink:0}\n.dx-account-identity>div{min-width:0;flex:1}\n.dx-account-identity h3{margin:0;font-size:18px!important;line-height:1.3;font-weight:700;letter-spacing:-.025em;overflow-wrap:anywhere}\n.dx-account-identity p{margin:5px 0 0!important;font-size:13px!important;line-height:1.5;color:#596269;overflow-wrap:anywhere}\n.dx-account-primary{width:100%;min-height:48px;display:flex;align-items:center;justify-content:center;gap:10px;padding:12px 16px;font-size:15px;line-height:22px;text-align:center;color:#1c211e;background:#f2671a;border:1px solid #de5b13;border-radius:12px;box-shadow:inset 0 1px 0 #ffffff29,0 1px 2px #52220814;transition:background-color 160ms,transform 100ms}\n.dx-account-primary:hover{background:#fa782f}\n.dx-account-primary:active{transform:scale(.985)}\n.dx-account-create,.dx-account-back{width:100%;min-height:44px;padding:10px 4px;background:transparent;border:0;border-radius:8px;color:#424b51;font-size:14px}\n.dx-account-create{margin-top:6px}\n.dx-account-back{text-align:left;margin-bottom:12px}\n.dx-account-create:hover,.dx-account-back:hover{background:#f5f6f6}\n.dx-account-summary{margin-bottom:18px}\n.dx-account-balanceRow{display:flex;align-items:center;gap:4px;margin:22px 0 18px}\n.dx-account-balance{display:grid;gap:5px;min-width:0;flex:1}\n.dx-account-amount{display:block;width:100%;max-width:100%;overflow-x:auto;white-space:nowrap;font-size:clamp(18px,calc(460px / var(--amount-length)),44px);font-weight:700;line-height:1.1;letter-spacing:-.045em;font-variant-numeric:tabular-nums;color:#22272a}\n.dx-account-balanceLabel{font-size:12px;line-height:1.5;color:#596269}\n.dx-account-balanceState{font-size:18px;letter-spacing:-.02em;font-weight:500;line-height:1.5}\n.dx-account-refresh{display:grid;place-items:center;flex-shrink:0;width:40px;height:40px;margin-right:-8px;padding:0;background:transparent;border:0;border-radius:8px;color:#788086}\n.dx-account-refresh:hover{color:#22272a;background:#f5f6f6}\n.dx-account-moneyActions{display:grid;grid-template-columns:1fr 1fr;gap:12px}\n.dx-account-moneyActions a{display:flex;align-items:center;justify-content:center;gap:9px;min-height:44px;min-width:0;border:0;border-radius:8px;background:transparent;color:#22272a;font-size:14px;line-height:20px;font-weight:500;transition:transform 100ms}\n.dx-account-moneyActions svg{box-sizing:border-box;width:36px;height:36px;padding:9px;flex-shrink:0;background:#f2f4f4;color:#e95e13;border-radius:50%;transition:background-color 150ms,color 150ms}\n.dx-account-moneyActions a:hover svg{background:#e7ebeb;color:#d84f08}\n.dx-account-moneyActions a:active{transform:scale(.97)}\n.dx-account-destinations{display:grid;gap:2px;margin-top:8px}\n.dx-account-destinations a{display:flex;align-items:center;justify-content:flex-start;gap:12px;min-height:44px;margin:0 -10px;padding:10px;border-radius:8px;font-size:14px;line-height:1.4;color:#22272a;transition:background-color 140ms}\n.dx-account-destinations svg{flex-shrink:0;color:#596269}\n.dx-account-destinationHint{margin-left:auto;font-size:11px;font-weight:400;color:#596269}\n.dx-account-destinations a:hover,.dx-account-connectionActions>button:hover,.dx-account-connectionActions>a:hover,.dx-account-manage:hover{background:#f5f6f6}\n.dx-account-connection{margin-top:14px}\n.dx-account-accountFooter{display:flex;align-items:center;justify-content:space-between;gap:12px}\n.dx-account-accountLinks{display:flex;gap:4px;margin-left:-10px}\n.dx-account-accountLinks a{display:flex;align-items:center;min-height:40px;padding:10px;font-size:13px;color:#596269;border-radius:8px}\n.dx-account-accountLinks a:hover{background:#f5f6f6;color:#22272a}\n.dx-account-manage{display:grid;place-items:center;width:40px;height:40px;margin-right:-8px;padding:0;background:transparent;border:0;border-radius:8px;color:#596269}\n.dx-account-manage[aria-expanded=true]{color:#e95e13}\n.dx-account-connectionActions{display:grid;gap:2px;padding-top:6px}\n.dx-account-connectionActions>button,.dx-account-connectionActions>a{display:flex;align-items:center;min-height:44px;width:100%;padding:10px;background:transparent;border:0;font-size:14px;line-height:1.4;color:#424b51;text-align:left;border-radius:8px}\n.dx-account-explanation,.dx-account-status,.dx-account-error{margin:8px 0 16px!important;font-size:13px!important;line-height:1.55;color:#596269;text-align:left}\n.dx-account-error{color:#a9342c;margin-bottom:0!important}\n/* Setup remains the SDK component, styled to match the shared account panel. */\n.dx-account-creation{--dx-radius:12px;--dx-ember:#f2671a;--dx-fg:#22272a}\n.dx-account-creation .dx-cwp__label{font-size:13px;font-weight:500;text-transform:none;letter-spacing:0;opacity:1;color:#424b51}\n.dx-account-creation .dx-cwp__name{font-family:inherit;font-size:16px;background:#fff;color:#22272a;border-color:#d8dddf}\n.dx-account-creation .dx-btn{min-height:48px;padding:12px 14px;background:#f2671a;color:#1c211e;border:1px solid #de5b13;border-radius:12px;font-size:14px;font-weight:500;line-height:22px;text-transform:none;letter-spacing:0;box-shadow:inset 0 1px 0 #ffffff29,0 1px 2px #52220814;filter:none}\n.dx-account-creation .dx-btn:hover{background:#fa782f;box-shadow:inset 0 1px 0 #ffffff29,0 1px 2px #52220814;filter:none}\n.dx-account-creation .dx-cwp__hosted,.dx-account-creation .dx-cwp__status{font-size:13px;line-height:1.5;color:#596269;opacity:1}\n@media(max-width:360px){.dx-account-panel{padding:20px}.dx-account-identity{gap:10px}}\n@media(prefers-reduced-motion:reduce){.dx-account-trigger,.dx-account-panel,.dx-account-primary,.dx-account-moneyActions a,.dx-account-moneyActions svg{transition:none;transform:none}}\n.dx-account-balance{text-decoration:none}\n.dx-account-linkIcon{width:20px;height:20px;flex-shrink:0}\n";
|
|
828
|
+
var ACCOUNT_CONTROL_CSS = ".dx-account-control,.dx-account-panel,.dx-account-panel *{box-sizing:border-box}\n.dx-account-control{position:relative;display:inline-block}\n.dx-account-trigger{display:grid;place-items:center;width:48px;height:48px;padding:0;background:transparent;border:0;border-radius:0;box-shadow:none;cursor:pointer;transition:opacity 160ms,transform 100ms}\n.dx-account-trigger>svg{display:block;width:40px;height:32px;object-fit:contain}\n.dx-account-trigger:hover{opacity:.75}\n.dx-account-trigger:active{transform:scale(.94)}\n.dx-account-trigger:focus-visible,.dx-account-panel a:focus-visible,.dx-account-panel button:focus-visible{outline:2px solid #22272a;outline-offset:3px}\n.dx-account-panel{position:absolute;right:0;top:calc(100% + 12px);width:min(376px,calc(100vw - 40px));max-height:calc(100dvh - 100px);overflow-y:auto;overscroll-behavior:contain;z-index:30;padding:24px;background:#fff;color:#22272a;border:1px solid #e4e7e8;border-radius:18px;box-shadow:0 20px 60px -16px #22272a30;transform-origin:top right;font-family:var(--dx-account-font,inherit)}\n.dx-account-panel a,.dx-account-panel button{font-family:inherit;font-weight:500;text-decoration:none;letter-spacing:0;cursor:pointer}\n.dx-account-panel button:disabled{cursor:wait;opacity:.55}\n.dx-account-identity{display:flex;align-items:center;gap:12px;margin-bottom:14px;min-width:0}\n.dx-account-identity>svg{width:32px;height:36px;object-fit:contain;flex-shrink:0}\n.dx-account-identity>div{min-width:0;flex:1}\n.dx-account-identity h3{font-family:inherit;margin:0;font-size:18px!important;line-height:1.3;font-weight:700;letter-spacing:-.025em;overflow-wrap:anywhere}\n.dx-account-identity h3 a{color:inherit;font-weight:inherit;letter-spacing:inherit}.dx-account-identity h3 a:hover{text-decoration:underline;text-underline-offset:3px}\n.dx-account-address{display:flex;align-items:center;flex-wrap:wrap;gap:0 8px;margin-top:2px;min-width:0}\n.dx-account-panel .dx-account-copy{display:inline-flex;align-items:center;gap:6px;min-height:32px;padding:4px 0;background:transparent;border:0;border-radius:4px;font-size:12px;line-height:20px;color:#596269;white-space:nowrap;font-variant-numeric:tabular-nums}.dx-account-panel .dx-account-copy:hover{color:#22272a}.dx-account-copy svg{flex-shrink:0}.dx-account-copyFeedback{font-size:11px;line-height:1.4;color:#596269}\n.dx-account-identity p{margin:5px 0 0!important;font-size:13px!important;line-height:1.5;color:#596269;overflow-wrap:anywhere}\n.dx-account-primary{width:100%;min-height:48px;display:flex;align-items:center;justify-content:center;gap:10px;padding:12px 16px;font-size:15px;line-height:22px;text-align:center;color:#1c211e;background:#f2671a;border:1px solid #de5b13;border-radius:12px;box-shadow:inset 0 1px 0 #ffffff29,0 1px 2px #52220814;transition:background-color 160ms,transform 100ms}\n.dx-account-primary:hover{background:#fa782f}\n.dx-account-primary:active{transform:scale(.985)}\n.dx-account-create,.dx-account-back{width:100%;min-height:44px;padding:10px 4px;background:transparent;border:0;border-radius:8px;color:#424b51;font-size:14px}\n.dx-account-create{margin-top:6px}\n.dx-account-back{text-align:left;margin-bottom:12px}\n.dx-account-create:hover,.dx-account-back:hover{background:#f5f6f6}\n.dx-account-summary{margin-bottom:18px}\n.dx-account-balanceRow{display:flex;align-items:center;gap:4px;margin:22px 0 18px}\n.dx-account-balance{display:grid;gap:5px;min-width:0;flex:1}\n.dx-account-amount{display:block;width:100%;max-width:100%;overflow-x:auto;white-space:nowrap;font-size:clamp(18px,calc(460px / var(--amount-length)),44px);font-weight:700;line-height:1.1;letter-spacing:-.045em;font-variant-numeric:tabular-nums;color:#22272a}\n.dx-account-balanceLabel{font-size:12px;line-height:1.5;color:#596269}\n.dx-account-balanceState{font-size:18px;letter-spacing:-.02em;font-weight:500;line-height:1.5}\n.dx-account-refresh{display:grid;place-items:center;flex-shrink:0;width:40px;height:40px;margin-right:-8px;padding:0;background:transparent;border:0;border-radius:8px;color:#788086}\n.dx-account-refresh:hover{color:#22272a;background:#f5f6f6}\n.dx-account-moneyActions{display:grid;grid-template-columns:1fr 1fr;gap:12px}\n.dx-account-moneyActions a{display:flex;align-items:center;justify-content:center;gap:9px;min-height:44px;min-width:0;border:0;border-radius:8px;background:transparent;color:#22272a;font-size:14px;line-height:20px;font-weight:500;transition:transform 100ms}\n.dx-account-moneyActions svg{box-sizing:border-box;width:36px;height:36px;padding:9px;flex-shrink:0;background:#f2f4f4;color:#e95e13;border-radius:50%;transition:background-color 150ms,color 150ms}\n.dx-account-moneyActions a:hover svg{background:#e7ebeb;color:#d84f08}\n.dx-account-moneyActions a:active{transform:scale(.97)}\n.dx-account-destinations{display:grid;gap:2px;margin-top:8px}\n.dx-account-destinations a{display:flex;align-items:center;justify-content:flex-start;gap:12px;min-height:44px;margin:0 -10px;padding:10px;border-radius:8px;font-size:14px;line-height:1.4;color:#22272a;transition:background-color 140ms}\n.dx-account-destinations svg{flex-shrink:0;color:#596269}\n.dx-account-destinationHint{margin-left:auto;font-size:11px;font-weight:400;color:#596269}\n.dx-account-destinations a:hover,.dx-account-connectionActions>button:hover,.dx-account-connectionActions>a:hover,.dx-account-manage:hover{background:#f5f6f6}\n.dx-account-connection{margin-top:14px}\n.dx-account-accountFooter{display:flex;align-items:center;justify-content:space-between;gap:12px}\n.dx-account-accountLinks{display:flex;gap:4px;margin-left:-10px}\n.dx-account-accountLinks a{display:flex;align-items:center;min-height:40px;padding:10px;font-size:13px;color:#596269;border-radius:8px}\n.dx-account-accountLinks a:hover{background:#f5f6f6;color:#22272a}\n.dx-account-manage{display:grid;place-items:center;width:40px;height:40px;margin-right:-8px;padding:0;background:transparent;border:0;border-radius:8px;color:#596269}\n.dx-account-manage[aria-expanded=true]{color:#e95e13}\n.dx-account-connectionActions{display:grid;gap:2px;padding-top:6px}\n.dx-account-connectionActions>button,.dx-account-connectionActions>a{display:flex;align-items:center;min-height:44px;width:100%;padding:10px;background:transparent;border:0;font-size:14px;line-height:1.4;color:#424b51;text-align:left;border-radius:8px}\n.dx-account-explanation,.dx-account-status,.dx-account-error{margin:8px 0 16px!important;font-size:13px!important;line-height:1.55;color:#596269;text-align:left}\n.dx-account-error{color:#a9342c;margin-bottom:0!important}\n/* Setup remains the SDK component, styled to match the shared account panel. */\n.dx-account-creation{--dx-radius:12px;--dx-ember:#f2671a;--dx-fg:#22272a}\n.dx-account-creation .dx-cwp__label{font-size:13px;font-weight:500;text-transform:none;letter-spacing:0;opacity:1;color:#424b51}\n.dx-account-creation .dx-cwp__name{font-family:inherit;font-size:16px;background:#fff;color:#22272a;border-color:#d8dddf}\n.dx-account-creation .dx-btn{min-height:48px;padding:12px 14px;background:#f2671a;color:#1c211e;border:1px solid #de5b13;border-radius:12px;font-size:14px;font-weight:500;line-height:22px;text-transform:none;letter-spacing:0;box-shadow:inset 0 1px 0 #ffffff29,0 1px 2px #52220814;filter:none}\n.dx-account-creation .dx-btn:hover{background:#fa782f;box-shadow:inset 0 1px 0 #ffffff29,0 1px 2px #52220814;filter:none}\n.dx-account-creation .dx-cwp__hosted,.dx-account-creation .dx-cwp__status{font-size:13px;line-height:1.5;color:#596269;opacity:1}\n@media(max-width:360px){.dx-account-panel{padding:20px}.dx-account-identity{gap:10px}}\n@media(prefers-reduced-motion:reduce){.dx-account-trigger,.dx-account-panel,.dx-account-primary,.dx-account-moneyActions a,.dx-account-moneyActions svg{transition:none;transform:none}}\n.dx-account-balance{text-decoration:none}\n.dx-account-linkIcon{width:20px;height:20px;flex-shrink:0}\n";
|
|
828
829
|
|
|
829
830
|
// src/accountNavigation.tsx
|
|
830
831
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
@@ -1121,6 +1122,7 @@ function DexterAccountControl({
|
|
|
1121
1122
|
const [pending, setPending] = useState7(null);
|
|
1122
1123
|
const [error, setError] = useState7("");
|
|
1123
1124
|
const [createOpen, setCreateOpen] = useState7(false);
|
|
1125
|
+
const [createdHandle, setCreatedHandle] = useState7(null);
|
|
1124
1126
|
const [manageOpen, setManageOpen] = useState7(false);
|
|
1125
1127
|
const [panelShift, setPanelShift] = useState7(0);
|
|
1126
1128
|
const pendingAction = useRef4(false);
|
|
@@ -1142,10 +1144,17 @@ function DexterAccountControl({
|
|
|
1142
1144
|
const title = permissions.walletIdentityVisible ? dexter.identity.walletLabel?.trim() || "Your Dexter account" : name || email.split("@")[0] || "Your Dexter account";
|
|
1143
1145
|
const canCreate = !checking && dexter.model.stage === "connect";
|
|
1144
1146
|
const canOpenWallet = dexter.model.stage === "ready" && permissions.walletDataVisible;
|
|
1147
|
+
const finishCreation = Boolean(createdHandle && !permissions.accountContentVisible);
|
|
1145
1148
|
const needsConnection = ["connect", "repair", "offline", "error"].includes(dexter.model.stage);
|
|
1146
1149
|
const links = resolveAccountNavigation(navigation, dexter.activeWallet);
|
|
1150
|
+
const headerWallet = canOpenWallet && !busy && dexter.activeWallet?.userHandle ? dexter.activeWallet : null;
|
|
1147
1151
|
const close = () => changeOpen.current(false);
|
|
1148
1152
|
useEffect7(() => setReady(true), []);
|
|
1153
|
+
useEffect7(() => {
|
|
1154
|
+
if (permissions.accountContentVisible || dexter.activeWallet?.userHandle && dexter.activeWallet.userHandle !== createdHandle) {
|
|
1155
|
+
setCreatedHandle(null);
|
|
1156
|
+
}
|
|
1157
|
+
}, [createdHandle, dexter.activeWallet?.userHandle, permissions.accountContentVisible]);
|
|
1149
1158
|
useLayoutEffect(() => {
|
|
1150
1159
|
if (!open) return;
|
|
1151
1160
|
const position = () => {
|
|
@@ -1192,11 +1201,20 @@ function DexterAccountControl({
|
|
|
1192
1201
|
setPending(action);
|
|
1193
1202
|
setError("");
|
|
1194
1203
|
try {
|
|
1195
|
-
if (action === "connect")
|
|
1196
|
-
|
|
1204
|
+
if (action === "connect") {
|
|
1205
|
+
const target = createdHandle ?? (canOpenWallet && !permissions.accountContentVisible ? dexter.activeWallet?.userHandle : void 0);
|
|
1206
|
+
if (target) await dexter.connect({ userHandle: target });
|
|
1207
|
+
else await dexter.connect();
|
|
1208
|
+
setCreatedHandle(null);
|
|
1209
|
+
}
|
|
1210
|
+
if (action === "switch") {
|
|
1211
|
+
await dexter.useAnotherDexterWallet();
|
|
1212
|
+
setCreatedHandle(null);
|
|
1213
|
+
}
|
|
1197
1214
|
if (action === "retry") await dexter.retry();
|
|
1198
1215
|
if (action === "disconnect") {
|
|
1199
1216
|
await dexter.disconnectDexter();
|
|
1217
|
+
setCreatedHandle(null);
|
|
1200
1218
|
close();
|
|
1201
1219
|
}
|
|
1202
1220
|
} catch (caught) {
|
|
@@ -1242,15 +1260,25 @@ function DexterAccountControl({
|
|
|
1242
1260
|
/* @__PURE__ */ jsxs5("div", { className: "dx-account-identity", children: [
|
|
1243
1261
|
/* @__PURE__ */ jsx6(AccountFace, {}),
|
|
1244
1262
|
/* @__PURE__ */ jsxs5("div", { children: [
|
|
1245
|
-
/* @__PURE__ */ jsx6("h3", { id: `${id}-title`, children: title }),
|
|
1246
|
-
(checking || email) && /* @__PURE__ */ jsx6("p", { children: checking ? "Opening your account..." : email })
|
|
1263
|
+
/* @__PURE__ */ jsx6("h3", { id: `${id}-title`, children: headerWallet && links.money ? /* @__PURE__ */ jsx6(LinkComponent, { href: links.money.href, onClick: close, title: "Open wallet", children: title }) : title }),
|
|
1264
|
+
(checking || email) && /* @__PURE__ */ jsx6("p", { children: checking ? "Opening your account..." : email }),
|
|
1265
|
+
headerWallet?.receiveAddress && /* @__PURE__ */ jsx6(
|
|
1266
|
+
ReceiveAddressCopy,
|
|
1267
|
+
{
|
|
1268
|
+
address: headerWallet.receiveAddress
|
|
1269
|
+
},
|
|
1270
|
+
`${headerWallet.userHandle}:${headerWallet.vaultPda}:${headerWallet.receiveAddress}`
|
|
1271
|
+
)
|
|
1247
1272
|
] })
|
|
1248
1273
|
] }),
|
|
1249
1274
|
checking ? /* @__PURE__ */ jsx6("p", { className: "dx-account-status", role: "status", children: "Checking your connection..." }) : /* @__PURE__ */ jsx6(Fragment3, { children: canCreate && createOpen ? /* @__PURE__ */ jsxs5("div", { className: "dx-account-creation", children: [
|
|
1250
1275
|
/* @__PURE__ */ jsx6("button", { type: "button", className: "dx-account-back", onClick: () => setCreateOpen(false), children: "Back to sign in" }),
|
|
1251
|
-
/* @__PURE__ */ jsx6(CreateWalletPanel, { agentDelegation: "deferred", terminology: "account", withMark: false, onCreated: () =>
|
|
1276
|
+
/* @__PURE__ */ jsx6(CreateWalletPanel, { agentDelegation: "deferred", terminology: "account", withMark: false, onCreated: (result) => {
|
|
1277
|
+
setCreatedHandle(result.handle);
|
|
1278
|
+
setCreateOpen(false);
|
|
1279
|
+
} })
|
|
1252
1280
|
] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1253
|
-
needsConnection && /* @__PURE__ */ jsxs5("div", { className: "dx-account-entry", children: [
|
|
1281
|
+
(needsConnection || finishCreation) && /* @__PURE__ */ jsxs5("div", { className: "dx-account-entry", children: [
|
|
1254
1282
|
dexter.model.stage === "repair" && /* @__PURE__ */ jsx6("p", { className: "dx-account-explanation", children: "Reconnect your passkey to continue." }),
|
|
1255
1283
|
/* @__PURE__ */ jsx6(
|
|
1256
1284
|
"button",
|
|
@@ -1259,10 +1287,10 @@ function DexterAccountControl({
|
|
|
1259
1287
|
className: "dx-account-primary",
|
|
1260
1288
|
disabled: busy,
|
|
1261
1289
|
onClick: () => void run(dexter.model.primaryAction === "retry" ? "retry" : "connect"),
|
|
1262
|
-
children: busy ? "Opening passkey..." : dexter.model.stage === "repair" ? "Reconnect Dexter" : dexter.model.stage === "error" || dexter.model.stage === "offline" ? "Try again" : "Sign in with Dexter"
|
|
1290
|
+
children: busy ? "Opening passkey..." : finishCreation ? "Finish signing in" : dexter.model.stage === "repair" ? "Reconnect Dexter" : dexter.model.stage === "error" || dexter.model.stage === "offline" ? "Try again" : "Sign in with Dexter"
|
|
1263
1291
|
}
|
|
1264
1292
|
),
|
|
1265
|
-
canCreate && /* @__PURE__ */ jsx6("button", { type: "button", className: "dx-account-create", onClick: () => setCreateOpen(true), disabled: busy, children: "Create account" })
|
|
1293
|
+
canCreate && !finishCreation && /* @__PURE__ */ jsx6("button", { type: "button", className: "dx-account-create", onClick: () => setCreateOpen(true), disabled: busy, children: "Create account" })
|
|
1266
1294
|
] }),
|
|
1267
1295
|
canOpenWallet && /* @__PURE__ */ jsx6("div", { children: renderSummary ? renderSummary(close) : /* @__PURE__ */ jsx6(DefaultSummary, { connection: dexter, navigation: links, LinkComponent, onNavigate: close, styleNonce }) }, `${dexter.activeWallet?.userHandle ?? "account"}:${dexter.activeWallet?.vaultPda ?? ""}`),
|
|
1268
1296
|
(canOpenWallet || permissions.accountContentVisible) && /* @__PURE__ */ jsxs5("nav", { className: "dx-account-destinations", "aria-label": "Your account", children: [
|
|
@@ -1297,6 +1325,7 @@ function DexterAccountControl({
|
|
|
1297
1325
|
transition: { duration: reduced ? 0 : 0.16 },
|
|
1298
1326
|
children: [
|
|
1299
1327
|
canOpenWallet && links.settings && /* @__PURE__ */ jsx6(LinkComponent, { href: links.settings.href, onClick: close, children: links.settings.label ?? "Account settings" }),
|
|
1328
|
+
canOpenWallet && !permissions.accountContentVisible && /* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void run("connect"), disabled: busy, children: "Sign in to this app" }),
|
|
1300
1329
|
dexter.model.stage === "ready" && /* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void run("switch"), disabled: busy, children: "Switch account" }),
|
|
1301
1330
|
/* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void run("disconnect"), disabled: busy, children: pending === "disconnect" ? "Disconnecting..." : "Disconnect Dexter" })
|
|
1302
1331
|
]
|
|
@@ -1310,6 +1339,54 @@ function DexterAccountControl({
|
|
|
1310
1339
|
) })
|
|
1311
1340
|
] });
|
|
1312
1341
|
}
|
|
1342
|
+
function ReceiveAddressCopy({ address }) {
|
|
1343
|
+
const [status, setStatus] = useState7("idle");
|
|
1344
|
+
const mounted = useRef4(false);
|
|
1345
|
+
const pending = useRef4(false);
|
|
1346
|
+
useEffect7(() => {
|
|
1347
|
+
mounted.current = true;
|
|
1348
|
+
return () => {
|
|
1349
|
+
mounted.current = false;
|
|
1350
|
+
};
|
|
1351
|
+
}, []);
|
|
1352
|
+
const copy = async () => {
|
|
1353
|
+
if (pending.current) return;
|
|
1354
|
+
pending.current = true;
|
|
1355
|
+
setStatus("copying");
|
|
1356
|
+
try {
|
|
1357
|
+
if (!navigator.clipboard?.writeText) throw new Error("Clipboard unavailable");
|
|
1358
|
+
await navigator.clipboard.writeText(address);
|
|
1359
|
+
if (mounted.current) setStatus("copied");
|
|
1360
|
+
} catch {
|
|
1361
|
+
if (mounted.current) setStatus("error");
|
|
1362
|
+
} finally {
|
|
1363
|
+
pending.current = false;
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
const compact = address.length > 12 ? `${address.slice(0, 4)}\u2026${address.slice(-4)}` : address;
|
|
1367
|
+
return /* @__PURE__ */ jsxs5("div", { className: "dx-account-address", children: [
|
|
1368
|
+
/* @__PURE__ */ jsxs5(
|
|
1369
|
+
"button",
|
|
1370
|
+
{
|
|
1371
|
+
type: "button",
|
|
1372
|
+
className: "dx-account-copy",
|
|
1373
|
+
"aria-label": "Copy receive address",
|
|
1374
|
+
title: address,
|
|
1375
|
+
disabled: status === "copying",
|
|
1376
|
+
"aria-busy": status === "copying",
|
|
1377
|
+
onClick: () => void copy(),
|
|
1378
|
+
children: [
|
|
1379
|
+
/* @__PURE__ */ jsx6("span", { children: compact }),
|
|
1380
|
+
/* @__PURE__ */ jsx6("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: status === "copied" ? /* @__PURE__ */ jsx6("path", { d: "m5 12 4 4L19 6" }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1381
|
+
/* @__PURE__ */ jsx6("rect", { x: "8", y: "8", width: "12", height: "12", rx: "2" }),
|
|
1382
|
+
/* @__PURE__ */ jsx6("path", { d: "M15 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h3" })
|
|
1383
|
+
] }) })
|
|
1384
|
+
]
|
|
1385
|
+
}
|
|
1386
|
+
),
|
|
1387
|
+
/* @__PURE__ */ jsx6("span", { className: "dx-account-copyFeedback", role: "status", "aria-live": "polite", children: status === "copied" ? "Copied" : status === "error" ? "Copy failed. Try again." : "" })
|
|
1388
|
+
] });
|
|
1389
|
+
}
|
|
1313
1390
|
function DefaultSummary({ connection, ...props }) {
|
|
1314
1391
|
const balance = useAccountPortfolio(connection.activeWallet);
|
|
1315
1392
|
return /* @__PURE__ */ jsx6(DexterAccountSummary, { ...balance, ...props });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexterai/connect",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.2",
|
|
4
4
|
"description": "Connect apps and agents to a self-custodial Dexter Wallet with passkey identity, governed authority, hosted signing, and verifiable sessions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|