@dexterai/connect 0.31.0 → 0.31.1

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 CHANGED
@@ -86,7 +86,10 @@ accounts clears the previous balance immediately. Wallet holdings are bound to
86
86
  account and must not be used to match a portfolio.
87
87
 
88
88
  Destinations open Dexter by default and carry the selected account. Dexter asks
89
- for that account's passkey if a different account is active there. Set `navigation` to use local app routes,
89
+ for confirmation if a different account is active there. `connection.connect({ userHandle })`
90
+ targets that account's saved credential when available and checks the returned account
91
+ before changing sessions. A device without that saved credential uses its passkey picker.
92
+ Set `navigation` to use local app routes,
90
93
  or set an entry to `false` to hide it. `items` adds app-specific destinations with
91
94
  `requires: 'account'` or `requires: 'wallet'`; only verified access exposes them.
92
95
  The destination itself must enforce its own authorization.
@@ -18,7 +18,7 @@ import {
18
18
  resolveWalletStoreMode,
19
19
  shouldUsePopup,
20
20
  validateMissingVaultRecoveryAssertion
21
- } from "./chunk-4FTJB7FT.js";
21
+ } from "./chunk-IPEINLMT.js";
22
22
 
23
23
  // src/missingVaultRecovery.ts
24
24
  import {
@@ -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: options });
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(
@@ -10,7 +10,7 @@ import {
10
10
  subscribe,
11
11
  walletBindingCandidate,
12
12
  walletProofSessionStore
13
- } from "./chunk-4FTJB7FT.js";
13
+ } from "./chunk-IPEINLMT.js";
14
14
 
15
15
  // src/relationController.ts
16
16
  function provisionalRelation(walletPresent, accountPresent) {
@@ -1,4 +1,4 @@
1
- import { P as PasskeyLoginTokens, r as PasskeyLoginConfig, a as CeremonyPhase, S as SignInResult } from './enroll-BmD1y8KH.js';
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-BmD1y8KH.js';
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-WHGR5FUY.js";
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-4FTJB7FT.js";
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-BmD1y8KH.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-BmD1y8KH.js';
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-BzV_pjOI.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-BzV_pjOI.js';
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-Z6YHGWG3.js";
12
+ } from "./chunk-UQE76AJW.js";
13
13
  import {
14
14
  recoverMissingVaultForAccount,
15
15
  recoverWallet
16
- } from "./chunk-WHGR5FUY.js";
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-4FTJB7FT.js";
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-BmD1y8KH.js';
2
- export { d as ConnectVault, R as RecoverOutcome, n as RecoverVault, f as WalletIdentityProof } from './enroll-BmD1y8KH.js';
3
- import { i as DexterControlModel, a as WalletAccountRelationSnapshot, g as DexterConnectionIntent, e as AccountSessionInstaller, d as AccountSessionClearer, B as BindingFetch } from './connectionContract-BzV_pjOI.js';
4
- export { D as DexterConnectionCapability, h as DexterConnectionPermissions, j as DexterControlPrimaryAction, k as DexterControlStage } from './connectionContract-BzV_pjOI.js';
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-Z6YHGWG3.js";
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-4FTJB7FT.js";
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 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,16 @@ 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);
1147
1150
  const close = () => changeOpen.current(false);
1148
1151
  useEffect7(() => setReady(true), []);
1152
+ useEffect7(() => {
1153
+ if (permissions.accountContentVisible || dexter.activeWallet?.userHandle && dexter.activeWallet.userHandle !== createdHandle) {
1154
+ setCreatedHandle(null);
1155
+ }
1156
+ }, [createdHandle, dexter.activeWallet?.userHandle, permissions.accountContentVisible]);
1149
1157
  useLayoutEffect(() => {
1150
1158
  if (!open) return;
1151
1159
  const position = () => {
@@ -1192,11 +1200,20 @@ function DexterAccountControl({
1192
1200
  setPending(action);
1193
1201
  setError("");
1194
1202
  try {
1195
- if (action === "connect") await dexter.connect();
1196
- if (action === "switch") await dexter.useAnotherDexterWallet();
1203
+ if (action === "connect") {
1204
+ const target = createdHandle ?? (canOpenWallet && !permissions.accountContentVisible ? dexter.activeWallet?.userHandle : void 0);
1205
+ if (target) await dexter.connect({ userHandle: target });
1206
+ else await dexter.connect();
1207
+ setCreatedHandle(null);
1208
+ }
1209
+ if (action === "switch") {
1210
+ await dexter.useAnotherDexterWallet();
1211
+ setCreatedHandle(null);
1212
+ }
1197
1213
  if (action === "retry") await dexter.retry();
1198
1214
  if (action === "disconnect") {
1199
1215
  await dexter.disconnectDexter();
1216
+ setCreatedHandle(null);
1200
1217
  close();
1201
1218
  }
1202
1219
  } catch (caught) {
@@ -1248,9 +1265,12 @@ function DexterAccountControl({
1248
1265
  ] }),
1249
1266
  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
1267
  /* @__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: () => setCreateOpen(false) })
1268
+ /* @__PURE__ */ jsx6(CreateWalletPanel, { agentDelegation: "deferred", terminology: "account", withMark: false, onCreated: (result) => {
1269
+ setCreatedHandle(result.handle);
1270
+ setCreateOpen(false);
1271
+ } })
1252
1272
  ] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
1253
- needsConnection && /* @__PURE__ */ jsxs5("div", { className: "dx-account-entry", children: [
1273
+ (needsConnection || finishCreation) && /* @__PURE__ */ jsxs5("div", { className: "dx-account-entry", children: [
1254
1274
  dexter.model.stage === "repair" && /* @__PURE__ */ jsx6("p", { className: "dx-account-explanation", children: "Reconnect your passkey to continue." }),
1255
1275
  /* @__PURE__ */ jsx6(
1256
1276
  "button",
@@ -1259,10 +1279,10 @@ function DexterAccountControl({
1259
1279
  className: "dx-account-primary",
1260
1280
  disabled: busy,
1261
1281
  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"
1282
+ 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
1283
  }
1264
1284
  ),
1265
- canCreate && /* @__PURE__ */ jsx6("button", { type: "button", className: "dx-account-create", onClick: () => setCreateOpen(true), disabled: busy, children: "Create account" })
1285
+ canCreate && !finishCreation && /* @__PURE__ */ jsx6("button", { type: "button", className: "dx-account-create", onClick: () => setCreateOpen(true), disabled: busy, children: "Create account" })
1266
1286
  ] }),
1267
1287
  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
1288
  (canOpenWallet || permissions.accountContentVisible) && /* @__PURE__ */ jsxs5("nav", { className: "dx-account-destinations", "aria-label": "Your account", children: [
@@ -1297,6 +1317,7 @@ function DexterAccountControl({
1297
1317
  transition: { duration: reduced ? 0 : 0.16 },
1298
1318
  children: [
1299
1319
  canOpenWallet && links.settings && /* @__PURE__ */ jsx6(LinkComponent, { href: links.settings.href, onClick: close, children: links.settings.label ?? "Account settings" }),
1320
+ canOpenWallet && !permissions.accountContentVisible && /* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void run("connect"), disabled: busy, children: "Sign in to this app" }),
1300
1321
  dexter.model.stage === "ready" && /* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void run("switch"), disabled: busy, children: "Switch account" }),
1301
1322
  /* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void run("disconnect"), disabled: busy, children: pending === "disconnect" ? "Disconnecting..." : "Disconnect Dexter" })
1302
1323
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexterai/connect",
3
- "version": "0.31.0",
3
+ "version": "0.31.1",
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": {