@dexterai/connect 0.31.1 → 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 CHANGED
@@ -85,6 +85,10 @@ 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
93
  for confirmation if a different account is active there. `connection.connect({ userHandle })`
90
94
  targets that account's saved credential when available and checks the returned account
package/dist/react.js CHANGED
@@ -825,7 +825,7 @@ function AccountFace() {
825
825
  }
826
826
 
827
827
  // src/accountControlStyles.ts
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
+ 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";
829
829
 
830
830
  // src/accountNavigation.tsx
831
831
  import { jsx as jsx4 } from "react/jsx-runtime";
@@ -1147,6 +1147,7 @@ function DexterAccountControl({
1147
1147
  const finishCreation = Boolean(createdHandle && !permissions.accountContentVisible);
1148
1148
  const needsConnection = ["connect", "repair", "offline", "error"].includes(dexter.model.stage);
1149
1149
  const links = resolveAccountNavigation(navigation, dexter.activeWallet);
1150
+ const headerWallet = canOpenWallet && !busy && dexter.activeWallet?.userHandle ? dexter.activeWallet : null;
1150
1151
  const close = () => changeOpen.current(false);
1151
1152
  useEffect7(() => setReady(true), []);
1152
1153
  useEffect7(() => {
@@ -1259,8 +1260,15 @@ function DexterAccountControl({
1259
1260
  /* @__PURE__ */ jsxs5("div", { className: "dx-account-identity", children: [
1260
1261
  /* @__PURE__ */ jsx6(AccountFace, {}),
1261
1262
  /* @__PURE__ */ jsxs5("div", { children: [
1262
- /* @__PURE__ */ jsx6("h3", { id: `${id}-title`, children: title }),
1263
- (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
+ )
1264
1272
  ] })
1265
1273
  ] }),
1266
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: [
@@ -1331,6 +1339,54 @@ function DexterAccountControl({
1331
1339
  ) })
1332
1340
  ] });
1333
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
+ }
1334
1390
  function DefaultSummary({ connection, ...props }) {
1335
1391
  const balance = useAccountPortfolio(connection.activeWallet);
1336
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.1",
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": {