@dexterai/connect 0.29.1 → 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 +120 -0
- package/dist/{chunk-LHYU2EZQ.js → chunk-GIEQOIYI.js} +141 -8
- package/dist/{chunk-CZL7NGVV.js → chunk-IPEINLMT.js} +529 -28
- package/dist/{chunk-2BTS6DCR.js → chunk-UQE76AJW.js} +1 -1
- package/dist/{connectionContract-CR478cfF.d.ts → connectionContract-BgecDiDk.d.ts} +13 -2
- package/dist/{enroll-DrgEW0X8.d.ts → enroll-Cqou8Pbi.d.ts} +35 -2
- package/dist/hosted.d.ts +10 -2
- package/dist/hosted.js +11 -4
- package/dist/index.d.ts +15 -5
- package/dist/index.js +7 -3
- package/dist/react.d.ts +82 -8
- package/dist/react.js +611 -46
- package/package.json +3 -2
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,
|
|
@@ -288,11 +288,11 @@ function useDexterConnection(config) {
|
|
|
288
288
|
clearAccountSession,
|
|
289
289
|
passkey,
|
|
290
290
|
apiBase,
|
|
291
|
-
fetch
|
|
291
|
+
fetch: fetch2
|
|
292
292
|
} = config;
|
|
293
293
|
const dexterIdentity = useDexterIdentity({
|
|
294
294
|
...apiBase ? { apiBase } : {},
|
|
295
|
-
...
|
|
295
|
+
...fetch2 ? { fetch: fetch2 } : {},
|
|
296
296
|
accountSession
|
|
297
297
|
});
|
|
298
298
|
const wallet = useDexterWallet();
|
|
@@ -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,8 +395,9 @@ 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) => {
|
|
401
402
|
dexterIdentity.allowAccountSession(session.accessToken);
|
|
402
403
|
await installAccountSession(session);
|
|
@@ -432,7 +433,7 @@ function useDexterConnection(config) {
|
|
|
432
433
|
}, [
|
|
433
434
|
dexterIdentity,
|
|
434
435
|
apiBase,
|
|
435
|
-
|
|
436
|
+
fetch2,
|
|
436
437
|
installAccountSession,
|
|
437
438
|
clearAccountSession,
|
|
438
439
|
passkey,
|
|
@@ -707,8 +708,11 @@ function CreateWalletPanel(props) {
|
|
|
707
708
|
transport,
|
|
708
709
|
showName = true,
|
|
709
710
|
agentDelegation = "deferred",
|
|
710
|
-
className
|
|
711
|
+
className,
|
|
712
|
+
terminology = "wallet",
|
|
713
|
+
withMark = true
|
|
711
714
|
} = props;
|
|
715
|
+
const account = terminology === "account";
|
|
712
716
|
useEffect5(ensureConsentStyles, []);
|
|
713
717
|
useEffect5(ensureDexterButtonStyles, []);
|
|
714
718
|
const nameInputId = useId2();
|
|
@@ -727,7 +731,7 @@ function CreateWalletPanel(props) {
|
|
|
727
731
|
const ownerOnly = agentDelegation === "deferred";
|
|
728
732
|
const policy = resolvedTransport === "inline" && !ownerOnly ? authoredPolicy(value ?? "") : null;
|
|
729
733
|
const canContinue = hosted || ownerOnly || Boolean(policy);
|
|
730
|
-
const statusText = running ? phase ? ceremonyPhaseLabel(phase) : "Starting your passkey\u2026" : resolvedTransport === "unknown" ? "Preparing wallet setup\u2026" : hosted ? "Wallet setup continues in Dexter Wallet." : ownerOnly ? "" : policy ? "Ready to create." : "Choose an agent allowance.";
|
|
734
|
+
const statusText = running ? phase ? ceremonyPhaseLabel(phase) : "Starting your passkey\u2026" : resolvedTransport === "unknown" ? account ? "Preparing account setup..." : "Preparing wallet setup\u2026" : hosted ? account ? "Account setup continues in Dexter." : "Wallet setup continues in Dexter Wallet." : ownerOnly ? "" : policy ? "Ready to create." : "Choose an agent allowance.";
|
|
731
735
|
const handleCreate = async () => {
|
|
732
736
|
if (running) return;
|
|
733
737
|
if (resolvedTransport === "unknown" || !hosted && !ownerOnly && !policy) return;
|
|
@@ -736,7 +740,7 @@ function CreateWalletPanel(props) {
|
|
|
736
740
|
setPhase(null);
|
|
737
741
|
try {
|
|
738
742
|
const result = await createWallet({
|
|
739
|
-
name: hosted ? void 0 : name.trim() || "Dexter Wallet",
|
|
743
|
+
name: hosted ? void 0 : name.trim() || (account ? "Dexter account" : "Dexter Wallet"),
|
|
740
744
|
spendPolicy: hosted ? void 0 : policy ?? void 0,
|
|
741
745
|
agentDelegation,
|
|
742
746
|
apiBase,
|
|
@@ -755,14 +759,14 @@ function CreateWalletPanel(props) {
|
|
|
755
759
|
};
|
|
756
760
|
return /* @__PURE__ */ jsxs2("div", { className: cx("dx-cwp", className), children: [
|
|
757
761
|
!hosted && resolvedTransport === "inline" && showName && /* @__PURE__ */ jsxs2("div", { className: "dx-cwp__field", children: [
|
|
758
|
-
/* @__PURE__ */ jsx2("label", { className: "dx-cwp__label", htmlFor: nameInputId, children: "Name your wallet" }),
|
|
762
|
+
/* @__PURE__ */ jsx2("label", { className: "dx-cwp__label", htmlFor: nameInputId, children: account ? "Account name" : "Name your wallet" }),
|
|
759
763
|
/* @__PURE__ */ jsx2(
|
|
760
764
|
"input",
|
|
761
765
|
{
|
|
762
766
|
id: nameInputId,
|
|
763
767
|
className: "dx-cwp__name",
|
|
764
768
|
maxLength: 40,
|
|
765
|
-
placeholder: "Dexter Wallet",
|
|
769
|
+
placeholder: account ? "Dexter account" : "Dexter Wallet",
|
|
766
770
|
value: name,
|
|
767
771
|
disabled: running,
|
|
768
772
|
autoComplete: "off",
|
|
@@ -770,7 +774,7 @@ function CreateWalletPanel(props) {
|
|
|
770
774
|
}
|
|
771
775
|
)
|
|
772
776
|
] }),
|
|
773
|
-
hosted ? /* @__PURE__ */ jsx2("p", { className: "dx-cwp__hosted", children: ownerOnly ? "Finish setup in Dexter Wallet." : "Choose a name and agent allowance in Dexter Wallet." }) : resolvedTransport === "inline" ? !ownerOnly ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
777
|
+
hosted ? /* @__PURE__ */ jsx2("p", { className: "dx-cwp__hosted", children: account ? "Finish setup in Dexter." : ownerOnly ? "Finish setup in Dexter Wallet." : "Choose a name and agent allowance in Dexter Wallet." }) : resolvedTransport === "inline" ? !ownerOnly ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
774
778
|
/* @__PURE__ */ jsxs2("div", { className: "dx-cwp__field", children: [
|
|
775
779
|
/* @__PURE__ */ jsx2("span", { className: "dx-cwp__label", children: "What agents may spend automatically, per 30 days" }),
|
|
776
780
|
/* @__PURE__ */ jsx2(AllowanceChips, { value, onChange: setValue, disabled: running })
|
|
@@ -783,20 +787,578 @@ function CreateWalletPanel(props) {
|
|
|
783
787
|
DexterButton,
|
|
784
788
|
{
|
|
785
789
|
block: true,
|
|
790
|
+
withMark,
|
|
786
791
|
className: "dx-cwp__cta",
|
|
787
792
|
loading: running,
|
|
788
793
|
loadingLabel: phase ? ceremonyPhaseLabel(phase) : "Creating\u2026",
|
|
789
794
|
disabled: !canContinue || resolvedTransport === "unknown",
|
|
790
795
|
onClick: handleCreate,
|
|
791
|
-
children: error ? "Retry" : hosted ? "Continue to Dexter Wallet" : "Create your Dexter Wallet"
|
|
796
|
+
children: error ? "Retry" : hosted ? account ? "Continue to Dexter" : "Continue to Dexter Wallet" : account ? "Create account" : "Create your Dexter Wallet"
|
|
792
797
|
}
|
|
793
798
|
)
|
|
794
799
|
] });
|
|
795
800
|
}
|
|
796
801
|
|
|
797
|
-
// src/
|
|
798
|
-
import {
|
|
802
|
+
// src/DexterAccountControl.tsx
|
|
803
|
+
import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
|
|
804
|
+
import { useEffect as useEffect7, useId as useId5, useLayoutEffect, useRef as useRef4, useState as useState7 } from "react";
|
|
805
|
+
|
|
806
|
+
// src/accountBrand.tsx
|
|
807
|
+
import { useId as useId3 } from "react";
|
|
799
808
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
809
|
+
function AccountMark() {
|
|
810
|
+
const clipId = useId3();
|
|
811
|
+
return /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 375 250", "aria-hidden": "true", children: /* @__PURE__ */ jsx3("g", { transform: "translate(-20,-34)", children: /* @__PURE__ */ jsxs3("g", { transform: "translate(12,15)", children: [
|
|
812
|
+
/* @__PURE__ */ jsx3("g", { opacity: "1.000", transform: "translate(20,150) scale(1.085000,1.038000) translate(-20,-150)", children: /* @__PURE__ */ jsx3("path", { d: "M 88,46 C 160,37 260,37 314,44 C 332,46 340,56 340,72 L 340,216 C 340,232 332,242 314,244 C 260,252 160,252 88,254 C 50,253 24,244 20,210 L 20,90 C 24,56 50,47 88,46 Z", fill: "#FDFAF5", fillOpacity: "1.000", stroke: "#F2681A", strokeWidth: "9", strokeLinejoin: "round" }) }),
|
|
813
|
+
/* @__PURE__ */ jsx3("path", { d: "M 88,46 C 160,37 260,37 314,44 C 332,46 340,56 340,72 L 340,216 C 340,232 332,242 314,244 C 260,252 160,252 88,254 C 50,253 24,244 20,210 L 20,90 C 24,56 50,47 88,46 Z", fill: "#FDFAF5", fillOpacity: "1.000", stroke: "#F2681A", strokeWidth: "9", strokeLinejoin: "round" }),
|
|
814
|
+
/* @__PURE__ */ jsx3("clipPath", { id: clipId, children: /* @__PURE__ */ jsx3("path", { d: "M 88,46 C 160,37 260,37 314,44 C 332,46 340,56 340,72 L 340,216 C 340,232 332,242 314,244 C 260,252 160,252 88,254 C 50,253 24,244 20,210 L 20,90 C 24,56 50,47 88,46 Z" }) }),
|
|
815
|
+
/* @__PURE__ */ jsx3("g", { clipPath: `url(#${clipId})`, opacity: "1.000", children: /* @__PURE__ */ jsx3("path", { fill: "#F2681A", transform: "translate(-13.30,8.4) scale(1.42)", d: "m142.92669,22.61505c0.86324,0.194 1.72648,0.38801 2.61589,0.58789c36.11824,8.20868 68.78991,24.97766 95.38402,50.74539c1.01664,0.98356 2.03328,1.9671 3.08073,2.98047c10.83948,10.66464 10.83948,10.66464 11.04686,14.61978c-2.0583,3.55128 -5.4353,4.17725 -9.16927,5.29556c-0.79453,0.24692 -1.58907,0.49385 -2.40767,0.74825c-28.1259,8.42762 -60.94703,6.3666 -87.13391,-7.16491c-0.85657,-0.48718 -1.71313,-0.97434 -2.59566,-1.47628c-7.37383,-4.05183 -12.58845,-3.35686 -20.59012,-1.54122c-22.76373,3.99921 -48.47173,1.53219 -68.68914,-9.74291c-4.87964,-3.88153 -8.23277,-8.29209 -10.20832,-14.21874c-0.93353,-10.37559 -0.67244,-18.43528 5.83333,-26.83331c19.57482,-23.38104 55.98802,-20.36071 82.83325,-13.99999z" }) }),
|
|
816
|
+
/* @__PURE__ */ jsx3("g", { opacity: "1.000", transform: "translate(240,208) scale(1.00000) translate(-240,-208)", children: /* @__PURE__ */ jsx3("path", { fill: "#F2681A", transform: "translate(96.5,-14.5)", d: "m172.67667,203.08363c7.27323,0.09365 13.23073,1.96539 18.86718,6.65365c2.87863,3.07269 3.85875,5.11784 4.24739,9.31509c-0.12031,1.01062 -0.24062,2.02125 -0.36458,3.0625c-2.55208,0.94792 -2.55208,0.94792 -5.83333,1.16667c-3.28125,-2.84375 -3.28125,-2.84375 -5.83333,-5.83333c-0.35643,0.579 -0.71286,1.15801 -1.08008,1.75456c-7.60197,11.28517 -20.05618,17.73584 -33.04945,21.09112c-20.36149,3.09912 -36.81163,-1.65702 -53.37039,-13.73111c-2.33333,-2.11458 -2.33333,-2.11458 -4.66666,-5.61458c0.41869,-3.45422 0.98768,-4.48767 3.5,-6.99999c4.07251,0.3672 5.9462,2.12995 8.74999,4.95833c9.81467,8.93246 22.53228,11.87016 35.51494,11.694c11.74161,-1.0497 22.38219,-5.85464 31.56832,-13.15233c2.05879,-2.45035 2.05879,-2.45035 3.5,-4.66666c-1.66031,0.07219 -1.66031,0.07219 -3.35416,0.14583c-3.64583,-0.14583 -3.64583,-0.14583 -5.97916,-2.47916c0.7534,-6.17789 1.46481,-7.18518 7.58333,-7.36458z" }) })
|
|
817
|
+
] }) }) });
|
|
818
|
+
}
|
|
819
|
+
function AccountFace() {
|
|
820
|
+
return /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 300 300", "aria-hidden": "true", children: /* @__PURE__ */ jsxs3("g", { children: [
|
|
821
|
+
/* @__PURE__ */ jsx3("path", { fill: "#f2671a", d: "M143.18,22.65c35.41,7.66,68.19,23.6,94.89,48.28,5.22,4.86,11.17,10.45,15.18,16.1,1.38,1.93,1.94,3.6.99,5.23-1.08,1.92-4.22,3.41-6.56,4.17-28.39,9.43-61.55,8.26-88.62-4.69-13.81-7.66-17.02-5.76-31.67-3.48-21.89,2.38-46.67.37-65.06-12.31-6.07-4.99-9.33-12.71-8.8-20.52-.16-9.4,4.25-18.12,11.47-24.06,21.29-17.85,52.64-14.45,78-8.77l.18.04h0Z" }),
|
|
822
|
+
/* @__PURE__ */ jsx3("path", { fill: "#f2671a", d: "M46.08,129.98c1.06-1.03,3.52-1.07,5.29-1.04,48.98-.05,98.1-.06,146.83-.1,17.53.14,35.01-.31,52.49.18,2.13.18,3.89.74,4.73,2.05,1.46,2.38.35,6.09-1.98,7.6-3.66,2.05-8.62,1.33-12.86,1.74-2.85.12-5.45.13-7.02,2.02-.91,1.07-1.28,2.56-1.56,3.95-.57,3.23-1.16,6.52-1.89,9.62-2.81,12.43-8.68,24.65-19.76,31.56-9.49,5.59-20.42,6.86-31.2,5.75-11.88-1.69-22.15-8.81-29.11-18.28-3.51-4.81-4.92-10.5-5.8-16.29-.47-2.56-.51-5.87-1.35-8-1.16-3.38-6.14-2.59-9.25-1.92-4.21.95-4.39,5.7-5.14,9.19-2.25,11.18-6.84,20.68-16.15,27.65-1.31,1.05-2.91,2.03-2.12,3.66,2.5,3.21,6.65,4.49,10.44,5.97,3.26,1.17,6.86,2.41,7.18,6.06.05,8.18-11.97,3.46-16.32,1.85-3.95-1.55-7.4-4.27-10.42-7.26-3.92-4.28-9.66-4.5-15.16-4.45-3.45-.07-6.99-.19-10.45-.82-21.29-4-31.08-21.3-30.9-42.01-.08-4.63.03-9.32.09-13.91.04-1.69.07-3.46,1.28-4.67l.1-.09h0Z" }),
|
|
823
|
+
/* @__PURE__ */ jsx3("path", { fill: "#f2671a", d: "M173.06,203.11c9.24-.06,21.6,4.49,22.85,14.84.3,2.12-.67,4.34-2.92,4.73-1.38.29-2.88-.05-4.09-.75-1.64-.9-2.97-2.86-4.19-3.05-1.33-.2-1.99.81-2.93,1.94-10.27,13.34-28.04,20.92-44.83,20.42-15.41-.33-31.89-5.95-43.53-17.34-3.15-3.39-1.55-9.88,3.61-9.19,1.83.32,3.29,1.45,4.76,2.65,10.49,10.12,24.85,14.04,39.12,13.03,10.55-1.23,20.38-5.47,28.74-11.92,1.11-1.06,4.45-3.63,3.5-5.12-.76-.85-4.31-.47-5.92-2.01-2.25-1.92-1.39-6.22,1.16-7.36,1.36-.65,2.96-.81,4.47-.86h.2,0Z" })
|
|
824
|
+
] }) });
|
|
825
|
+
}
|
|
826
|
+
|
|
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";
|
|
829
|
+
|
|
830
|
+
// src/accountNavigation.tsx
|
|
831
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
832
|
+
var DEFAULT_ACCOUNT_NAVIGATION = Object.freeze({
|
|
833
|
+
money: { href: "https://dexter.cash/wallet?section=money", label: "Money" },
|
|
834
|
+
send: { href: "https://dexter.cash/wallet/withdraw", label: "Send" },
|
|
835
|
+
receive: { href: "https://dexter.cash/wallet/deposit", label: "Receive" },
|
|
836
|
+
activity: { href: "https://dexter.cash/wallet?section=activity", label: "Activity" },
|
|
837
|
+
agents: { href: "https://dexter.cash/wallet?section=agents", label: "Apps and agents" },
|
|
838
|
+
profile: { href: "https://dexter.cash/profile", label: "Profile" },
|
|
839
|
+
support: { href: "https://dexter.cash/support", label: "Support" },
|
|
840
|
+
settings: { href: "https://dexter.cash/wallet?section=you", label: "Account settings" }
|
|
841
|
+
});
|
|
842
|
+
function AccountLink(props) {
|
|
843
|
+
return /* @__PURE__ */ jsx4("a", { ...props });
|
|
844
|
+
}
|
|
845
|
+
function resolveAccountNavigation(navigation, wallet) {
|
|
846
|
+
const links = { ...DEFAULT_ACCOUNT_NAVIGATION, ...navigation };
|
|
847
|
+
if (!wallet?.userHandle) return links;
|
|
848
|
+
for (const key of Object.keys(links)) {
|
|
849
|
+
const item = links[key];
|
|
850
|
+
if (!item || !item.href.startsWith("https://dexter.cash/")) continue;
|
|
851
|
+
const url = new URL(item.href);
|
|
852
|
+
if (url.origin !== "https://dexter.cash" || !(url.pathname === "/profile" || url.pathname === "/wallet" || url.pathname.startsWith("/wallet/"))) continue;
|
|
853
|
+
url.searchParams.set("dexter_account", wallet.userHandle);
|
|
854
|
+
links[key] = { ...item, href: url.toString() };
|
|
855
|
+
}
|
|
856
|
+
return links;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// src/DexterAccountSummary.tsx
|
|
860
|
+
import { useId as useId4 } from "react";
|
|
861
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
862
|
+
function DexterAccountSummary({
|
|
863
|
+
amount,
|
|
864
|
+
loading,
|
|
865
|
+
partial = false,
|
|
866
|
+
refresh,
|
|
867
|
+
navigation,
|
|
868
|
+
LinkComponent = AccountLink,
|
|
869
|
+
onNavigate,
|
|
870
|
+
styleNonce
|
|
871
|
+
}) {
|
|
872
|
+
const id = useId4();
|
|
873
|
+
const links = { ...DEFAULT_ACCOUNT_NAVIGATION, ...navigation };
|
|
874
|
+
const content = /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
875
|
+
/* @__PURE__ */ jsx5(
|
|
876
|
+
"span",
|
|
877
|
+
{
|
|
878
|
+
className: "dx-account-amount",
|
|
879
|
+
id: `${id}-amount`,
|
|
880
|
+
style: { "--amount-length": amount?.length ?? 6 },
|
|
881
|
+
children: amount ?? /* @__PURE__ */ jsx5("span", { className: "dx-account-balanceState", role: "status", children: loading ? "Loading balance..." : "Balance unavailable" })
|
|
882
|
+
}
|
|
883
|
+
),
|
|
884
|
+
/* @__PURE__ */ jsx5("span", { id: `${id}-label`, className: "dx-account-balanceLabel", children: partial ? "Priced assets" : "Portfolio value" })
|
|
885
|
+
] });
|
|
886
|
+
return /* @__PURE__ */ jsxs4("div", { className: "dx-account-summary", children: [
|
|
887
|
+
/* @__PURE__ */ jsx5("style", { nonce: styleNonce, children: ACCOUNT_CONTROL_CSS }),
|
|
888
|
+
/* @__PURE__ */ jsxs4("div", { className: "dx-account-balanceRow", children: [
|
|
889
|
+
links.money ? /* @__PURE__ */ jsx5(
|
|
890
|
+
LinkComponent,
|
|
891
|
+
{
|
|
892
|
+
href: links.money.href,
|
|
893
|
+
className: "dx-account-balance",
|
|
894
|
+
onClick: onNavigate,
|
|
895
|
+
"aria-label": links.money.label ?? "Money",
|
|
896
|
+
"aria-describedby": `${id}-amount ${id}-label`,
|
|
897
|
+
children: content
|
|
898
|
+
}
|
|
899
|
+
) : /* @__PURE__ */ jsx5("div", { className: "dx-account-balance", children: content }),
|
|
900
|
+
!loading && /* @__PURE__ */ jsx5("button", { type: "button", className: "dx-account-refresh", "aria-label": "Refresh balance", onClick: () => void refresh(), children: /* @__PURE__ */ jsxs4("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
901
|
+
/* @__PURE__ */ jsx5("path", { d: "M20 7v5h-5M4 17v-5h5" }),
|
|
902
|
+
/* @__PURE__ */ jsx5("path", { d: "M6.2 7a7 7 0 0 1 11.6-1L20 9M4 15l2.2 3A7 7 0 0 0 17.8 17" })
|
|
903
|
+
] }) })
|
|
904
|
+
] }),
|
|
905
|
+
(links.send || links.receive) && /* @__PURE__ */ jsxs4("div", { className: "dx-account-moneyActions", children: [
|
|
906
|
+
links.send && /* @__PURE__ */ jsxs4(LinkComponent, { href: links.send.href, onClick: onNavigate, children: [
|
|
907
|
+
/* @__PURE__ */ jsx5("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx5("path", { d: "M12 19V5m-5 5 5-5 5 5" }) }),
|
|
908
|
+
links.send.label ?? "Send"
|
|
909
|
+
] }),
|
|
910
|
+
links.receive && /* @__PURE__ */ jsxs4(LinkComponent, { href: links.receive.href, onClick: onNavigate, children: [
|
|
911
|
+
/* @__PURE__ */ jsx5("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx5("path", { d: "M12 5v14m-5-5 5 5 5-5" }) }),
|
|
912
|
+
links.receive.label ?? "Receive"
|
|
913
|
+
] })
|
|
914
|
+
] })
|
|
915
|
+
] });
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// src/useAccountPortfolio.ts
|
|
919
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
920
|
+
|
|
921
|
+
// src/accountPortfolio.ts
|
|
922
|
+
var PORTFOLIO_URL = "https://api.dexter.cash/api/passkey-vault-anon/portfolio";
|
|
923
|
+
var REQUEST_TIMEOUT_MS = 12e3;
|
|
924
|
+
var MAX_RESPONSE_BYTES = 256 * 1024;
|
|
925
|
+
var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
926
|
+
function record(value) {
|
|
927
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
928
|
+
}
|
|
929
|
+
function decimal(value) {
|
|
930
|
+
return typeof value === "string" && value.length <= 384 && /^(0|[1-9][0-9]*)(?:\.[0-9]+)?$/.test(value) && (!value.includes(".") || !value.endsWith("0"));
|
|
931
|
+
}
|
|
932
|
+
function count(value) {
|
|
933
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
934
|
+
}
|
|
935
|
+
function publicKey(value) {
|
|
936
|
+
if (typeof value !== "string" || value.length < 32 || value.length > 44) return false;
|
|
937
|
+
let decoded = 0n;
|
|
938
|
+
for (const char of value) {
|
|
939
|
+
const digit = BASE58_ALPHABET.indexOf(char);
|
|
940
|
+
if (digit < 0) return false;
|
|
941
|
+
decoded = decoded * 58n + BigInt(digit);
|
|
942
|
+
}
|
|
943
|
+
const leadingZeroes = value.match(/^1*/)?.[0].length ?? 0;
|
|
944
|
+
const payloadBytes = decoded === 0n ? 0 : Math.ceil(decoded.toString(16).length / 2);
|
|
945
|
+
return leadingZeroes + payloadBytes === 32;
|
|
946
|
+
}
|
|
947
|
+
function observedAt(value) {
|
|
948
|
+
return typeof value === "string" && value.length <= 40 && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/.test(value) && Number.isFinite(Date.parse(value));
|
|
949
|
+
}
|
|
950
|
+
function unavailable() {
|
|
951
|
+
return new Error("Account portfolio is unavailable.");
|
|
952
|
+
}
|
|
953
|
+
function roundUsd(value, places) {
|
|
954
|
+
const [whole, fraction = ""] = value.split(".");
|
|
955
|
+
const scale = 10n ** BigInt(places);
|
|
956
|
+
const kept = fraction.slice(0, places).padEnd(places, "0");
|
|
957
|
+
const units = BigInt(whole) * scale + BigInt(kept) + ((fraction[places] ?? "0") >= "5" ? 1n : 0n);
|
|
958
|
+
return `${units / scale}.${(units % scale).toString().padStart(places, "0")}`;
|
|
959
|
+
}
|
|
960
|
+
function formatUsd(value) {
|
|
961
|
+
const [whole, fraction = ""] = value.split(".");
|
|
962
|
+
const firstNonZero = fraction.search(/[1-9]/);
|
|
963
|
+
if (whole === "0" && firstNonZero >= 2) {
|
|
964
|
+
const rounded = roundUsd(value, firstNonZero + 2);
|
|
965
|
+
if (rounded.split(".")[1].search(/[1-9]/) >= 2) {
|
|
966
|
+
return `$${rounded.replace(/0+$/, "")}`;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
const [roundedWhole, cents] = roundUsd(value, 2).split(".");
|
|
970
|
+
return `$${roundedWhole.replace(/\B(?=(\d{3})+(?!\d))/g, ",")}.${cents}`;
|
|
971
|
+
}
|
|
972
|
+
function parsePortfolio(body, wallet) {
|
|
973
|
+
if (!record(body) || body.ok !== true || !record(body.portfolio)) throw unavailable();
|
|
974
|
+
const p = body.portfolio;
|
|
975
|
+
if (p.schemaVersion !== 1 || p.network !== "solana-mainnet" || !publicKey(p.walletAddress) || !publicKey(p.vaultPda) || !observedAt(p.observedAt) || typeof p.holdingsComplete !== "boolean" || !count(p.pricedHoldings) || !count(p.unpricedHoldings) || !count(p.omittedHoldings) || !decimal(p.pricedValueUsd) || !(p.portfolioValueUsd === null || decimal(p.portfolioValueUsd))) throw unavailable();
|
|
976
|
+
if (wallet.vaultPda && p.vaultPda !== wallet.vaultPda || wallet.receiveAddress && p.walletAddress !== wallet.receiveAddress) throw unavailable();
|
|
977
|
+
const complete = p.holdingsComplete && p.unpricedHoldings === 0 && p.omittedHoldings === 0 && p.portfolioValueUsd !== null;
|
|
978
|
+
if (p.pricedHoldings === 0 && p.pricedValueUsd !== "0" || complete && p.portfolioValueUsd !== p.pricedValueUsd) throw unavailable();
|
|
979
|
+
const value = complete ? p.portfolioValueUsd : p.pricedHoldings > 0 ? p.pricedValueUsd : null;
|
|
980
|
+
return { amount: value === null ? null : formatUsd(value), partial: !complete };
|
|
981
|
+
}
|
|
982
|
+
async function readBody(response) {
|
|
983
|
+
const declaredSize = response.headers.get("content-length");
|
|
984
|
+
if (declaredSize && Number(declaredSize) > MAX_RESPONSE_BYTES) throw unavailable();
|
|
985
|
+
if (!response.body) throw unavailable();
|
|
986
|
+
const reader = response.body.getReader();
|
|
987
|
+
const decoder = new TextDecoder();
|
|
988
|
+
let bytes = 0;
|
|
989
|
+
let text = "";
|
|
990
|
+
try {
|
|
991
|
+
while (true) {
|
|
992
|
+
const { value, done } = await reader.read();
|
|
993
|
+
if (done) break;
|
|
994
|
+
bytes += value.byteLength;
|
|
995
|
+
if (bytes > MAX_RESPONSE_BYTES) throw unavailable();
|
|
996
|
+
text += decoder.decode(value, { stream: true });
|
|
997
|
+
}
|
|
998
|
+
text += decoder.decode();
|
|
999
|
+
return JSON.parse(text);
|
|
1000
|
+
} finally {
|
|
1001
|
+
await reader.cancel().catch(() => void 0);
|
|
1002
|
+
reader.releaseLock();
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
async function fetchAccountPortfolio(wallet, options = {}) {
|
|
1006
|
+
if (!/^[A-Za-z0-9_-]{22}$/.test(wallet.userHandle) || !wallet.vaultPda || !publicKey(wallet.vaultPda) || wallet.receiveAddress !== null && !publicKey(wallet.receiveAddress) || wallet.network !== null && wallet.network !== "solana-mainnet") throw unavailable();
|
|
1007
|
+
if (options.signal?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
1008
|
+
const controller = new AbortController();
|
|
1009
|
+
let rejectBoundary;
|
|
1010
|
+
const boundary = new Promise((_, reject) => {
|
|
1011
|
+
rejectBoundary = reject;
|
|
1012
|
+
});
|
|
1013
|
+
const abort = () => {
|
|
1014
|
+
controller.abort();
|
|
1015
|
+
rejectBoundary(new DOMException("Aborted", "AbortError"));
|
|
1016
|
+
};
|
|
1017
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
1018
|
+
const timeout = setTimeout(() => {
|
|
1019
|
+
controller.abort();
|
|
1020
|
+
rejectBoundary(new DOMException("Timed out", "TimeoutError"));
|
|
1021
|
+
}, REQUEST_TIMEOUT_MS);
|
|
1022
|
+
try {
|
|
1023
|
+
const response = await Promise.race([
|
|
1024
|
+
(options.fetch ?? fetch)(`${PORTFOLIO_URL}?user_handle=${encodeURIComponent(wallet.userHandle)}`, {
|
|
1025
|
+
cache: "no-store",
|
|
1026
|
+
credentials: "omit",
|
|
1027
|
+
signal: controller.signal
|
|
1028
|
+
}),
|
|
1029
|
+
boundary
|
|
1030
|
+
]);
|
|
1031
|
+
if (!response.ok) throw unavailable();
|
|
1032
|
+
const body = await Promise.race([readBody(response), boundary]);
|
|
1033
|
+
return parsePortfolio(body, wallet);
|
|
1034
|
+
} finally {
|
|
1035
|
+
clearTimeout(timeout);
|
|
1036
|
+
options.signal?.removeEventListener("abort", abort);
|
|
1037
|
+
controller.abort();
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
// src/useAccountPortfolio.ts
|
|
1042
|
+
function useAccountPortfolio(wallet) {
|
|
1043
|
+
const key = wallet === null ? null : JSON.stringify([
|
|
1044
|
+
wallet.userHandle,
|
|
1045
|
+
wallet.vaultPda,
|
|
1046
|
+
wallet.receiveAddress,
|
|
1047
|
+
wallet.network
|
|
1048
|
+
]);
|
|
1049
|
+
const currentKey = useRef3(key);
|
|
1050
|
+
const currentWallet = useRef3(wallet);
|
|
1051
|
+
currentKey.current = key;
|
|
1052
|
+
currentWallet.current = wallet;
|
|
1053
|
+
const generation = useRef3(0);
|
|
1054
|
+
const inFlight = useRef3(null);
|
|
1055
|
+
const [state, setState] = useState6({
|
|
1056
|
+
key,
|
|
1057
|
+
amount: null,
|
|
1058
|
+
partial: false,
|
|
1059
|
+
loading: key !== null
|
|
1060
|
+
});
|
|
1061
|
+
const refresh = useCallback3(() => {
|
|
1062
|
+
if (currentKey.current !== key) return Promise.resolve();
|
|
1063
|
+
const selectedWallet = currentWallet.current;
|
|
1064
|
+
if (key === null || selectedWallet === null) return Promise.resolve();
|
|
1065
|
+
if (inFlight.current?.key === key) return inFlight.current.promise;
|
|
1066
|
+
inFlight.current?.controller.abort();
|
|
1067
|
+
const request = ++generation.current;
|
|
1068
|
+
const controller = new AbortController();
|
|
1069
|
+
setState({ key, amount: null, partial: false, loading: true });
|
|
1070
|
+
const promise = (async () => {
|
|
1071
|
+
try {
|
|
1072
|
+
const portfolio = await fetchAccountPortfolio(selectedWallet, { signal: controller.signal });
|
|
1073
|
+
if (!controller.signal.aborted && currentKey.current === key && generation.current === request) {
|
|
1074
|
+
setState({ key, ...portfolio, loading: false });
|
|
1075
|
+
}
|
|
1076
|
+
} catch {
|
|
1077
|
+
if (!controller.signal.aborted && currentKey.current === key && generation.current === request) {
|
|
1078
|
+
setState({ key, amount: null, partial: false, loading: false });
|
|
1079
|
+
}
|
|
1080
|
+
} finally {
|
|
1081
|
+
if (inFlight.current?.controller === controller) inFlight.current = null;
|
|
1082
|
+
}
|
|
1083
|
+
})();
|
|
1084
|
+
inFlight.current = { key, controller, promise };
|
|
1085
|
+
return promise;
|
|
1086
|
+
}, [key]);
|
|
1087
|
+
useEffect6(() => {
|
|
1088
|
+
void refresh();
|
|
1089
|
+
return () => {
|
|
1090
|
+
generation.current += 1;
|
|
1091
|
+
inFlight.current?.controller.abort();
|
|
1092
|
+
inFlight.current = null;
|
|
1093
|
+
};
|
|
1094
|
+
}, [refresh]);
|
|
1095
|
+
const visible = state.key === key && key !== null ? state : { amount: null, partial: false, loading: key !== null };
|
|
1096
|
+
return { amount: visible.amount, partial: visible.partial, loading: visible.loading, refresh };
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
// src/DexterAccountControl.tsx
|
|
1100
|
+
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1101
|
+
function DexterAccountControl({
|
|
1102
|
+
connection: dexter,
|
|
1103
|
+
open: controlledOpen,
|
|
1104
|
+
onOpenChange,
|
|
1105
|
+
profile,
|
|
1106
|
+
navigation,
|
|
1107
|
+
items = [],
|
|
1108
|
+
LinkComponent = AccountLink,
|
|
1109
|
+
renderSummary,
|
|
1110
|
+
formatError = accountConnectionError,
|
|
1111
|
+
className = "",
|
|
1112
|
+
triggerClassName = "",
|
|
1113
|
+
styleNonce
|
|
1114
|
+
}) {
|
|
1115
|
+
const [ownOpen, setOwnOpen] = useState7(false);
|
|
1116
|
+
const open = controlledOpen ?? ownOpen;
|
|
1117
|
+
const setOpen = (next) => {
|
|
1118
|
+
if (controlledOpen === void 0) setOwnOpen(next);
|
|
1119
|
+
onOpenChange?.(next);
|
|
1120
|
+
};
|
|
1121
|
+
const [ready, setReady] = useState7(false);
|
|
1122
|
+
const [pending, setPending] = useState7(null);
|
|
1123
|
+
const [error, setError] = useState7("");
|
|
1124
|
+
const [createOpen, setCreateOpen] = useState7(false);
|
|
1125
|
+
const [createdHandle, setCreatedHandle] = useState7(null);
|
|
1126
|
+
const [manageOpen, setManageOpen] = useState7(false);
|
|
1127
|
+
const [panelShift, setPanelShift] = useState7(0);
|
|
1128
|
+
const pendingAction = useRef4(false);
|
|
1129
|
+
const control = useRef4(null);
|
|
1130
|
+
const trigger = useRef4(null);
|
|
1131
|
+
const panel = useRef4(null);
|
|
1132
|
+
const isOpen = useRef4(open);
|
|
1133
|
+
isOpen.current = open;
|
|
1134
|
+
const changeOpen = useRef4(setOpen);
|
|
1135
|
+
changeOpen.current = setOpen;
|
|
1136
|
+
const reduced = useReducedMotion();
|
|
1137
|
+
const id = useId5();
|
|
1138
|
+
const permissions = dexter.model.permissions;
|
|
1139
|
+
const checking = !ready || dexter.model.stage === "checking";
|
|
1140
|
+
const busy = checking || pending !== null || dexter.operation !== "idle";
|
|
1141
|
+
const hasIdentity = ready && (dexter.identity.hasWallet || dexter.identity.hasAccount);
|
|
1142
|
+
const email = permissions.accountContentVisible ? profile?.email?.trim() ?? "" : "";
|
|
1143
|
+
const name = permissions.accountContentVisible ? profile?.name?.trim() ?? "" : "";
|
|
1144
|
+
const title = permissions.walletIdentityVisible ? dexter.identity.walletLabel?.trim() || "Your Dexter account" : name || email.split("@")[0] || "Your Dexter account";
|
|
1145
|
+
const canCreate = !checking && dexter.model.stage === "connect";
|
|
1146
|
+
const canOpenWallet = dexter.model.stage === "ready" && permissions.walletDataVisible;
|
|
1147
|
+
const finishCreation = Boolean(createdHandle && !permissions.accountContentVisible);
|
|
1148
|
+
const needsConnection = ["connect", "repair", "offline", "error"].includes(dexter.model.stage);
|
|
1149
|
+
const links = resolveAccountNavigation(navigation, dexter.activeWallet);
|
|
1150
|
+
const close = () => changeOpen.current(false);
|
|
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]);
|
|
1157
|
+
useLayoutEffect(() => {
|
|
1158
|
+
if (!open) return;
|
|
1159
|
+
const position = () => {
|
|
1160
|
+
if (!control.current || !panel.current) return;
|
|
1161
|
+
const width = panel.current.offsetWidth;
|
|
1162
|
+
const normalLeft = control.current.getBoundingClientRect().right - width;
|
|
1163
|
+
const left = Math.max(16, Math.min(normalLeft, window.innerWidth - width - 16));
|
|
1164
|
+
setPanelShift(left - normalLeft);
|
|
1165
|
+
};
|
|
1166
|
+
position();
|
|
1167
|
+
window.addEventListener("resize", position);
|
|
1168
|
+
return () => window.removeEventListener("resize", position);
|
|
1169
|
+
}, [open]);
|
|
1170
|
+
useEffect7(() => {
|
|
1171
|
+
if (!open) {
|
|
1172
|
+
setError("");
|
|
1173
|
+
setCreateOpen(false);
|
|
1174
|
+
setManageOpen(false);
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
const outside = (event) => {
|
|
1178
|
+
if (event.target instanceof Node && !control.current?.contains(event.target)) changeOpen.current(false);
|
|
1179
|
+
};
|
|
1180
|
+
const key = (event) => {
|
|
1181
|
+
if (event.key !== "Escape") return;
|
|
1182
|
+
changeOpen.current(false);
|
|
1183
|
+
trigger.current?.focus();
|
|
1184
|
+
};
|
|
1185
|
+
const focus = (event) => {
|
|
1186
|
+
if (event.target instanceof Node && !control.current?.contains(event.target)) changeOpen.current(false);
|
|
1187
|
+
};
|
|
1188
|
+
window.addEventListener("pointerdown", outside);
|
|
1189
|
+
window.addEventListener("keydown", key);
|
|
1190
|
+
window.addEventListener("focusin", focus);
|
|
1191
|
+
return () => {
|
|
1192
|
+
window.removeEventListener("pointerdown", outside);
|
|
1193
|
+
window.removeEventListener("keydown", key);
|
|
1194
|
+
window.removeEventListener("focusin", focus);
|
|
1195
|
+
};
|
|
1196
|
+
}, [open]);
|
|
1197
|
+
const run = async (action) => {
|
|
1198
|
+
if (busy || pendingAction.current) return;
|
|
1199
|
+
pendingAction.current = true;
|
|
1200
|
+
setPending(action);
|
|
1201
|
+
setError("");
|
|
1202
|
+
try {
|
|
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
|
+
}
|
|
1213
|
+
if (action === "retry") await dexter.retry();
|
|
1214
|
+
if (action === "disconnect") {
|
|
1215
|
+
await dexter.disconnectDexter();
|
|
1216
|
+
setCreatedHandle(null);
|
|
1217
|
+
close();
|
|
1218
|
+
}
|
|
1219
|
+
} catch (caught) {
|
|
1220
|
+
setError(action === "disconnect" ? "Dexter could not finish that action. Try again." : formatError(caught instanceof ConnectError ? caught.code : dexter.error?.code));
|
|
1221
|
+
} finally {
|
|
1222
|
+
pendingAction.current = false;
|
|
1223
|
+
setPending(null);
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
return /* @__PURE__ */ jsxs5("div", { className: `dx-account-control ${className}`, ref: control, children: [
|
|
1227
|
+
/* @__PURE__ */ jsx6("style", { nonce: styleNonce, children: ACCOUNT_CONTROL_CSS }),
|
|
1228
|
+
/* @__PURE__ */ jsx6(
|
|
1229
|
+
"button",
|
|
1230
|
+
{
|
|
1231
|
+
className: `dx-account-trigger ${triggerClassName}`,
|
|
1232
|
+
ref: trigger,
|
|
1233
|
+
type: "button",
|
|
1234
|
+
"aria-label": open ? "Close Dexter account" : "Open Dexter account",
|
|
1235
|
+
"aria-expanded": open,
|
|
1236
|
+
"aria-controls": `${id}-menu`,
|
|
1237
|
+
"aria-haspopup": "dialog",
|
|
1238
|
+
onClick: () => setOpen(!open),
|
|
1239
|
+
children: /* @__PURE__ */ jsx6(AccountMark, {})
|
|
1240
|
+
}
|
|
1241
|
+
),
|
|
1242
|
+
/* @__PURE__ */ jsx6(AnimatePresence, { children: open && /* @__PURE__ */ jsxs5(
|
|
1243
|
+
motion.section,
|
|
1244
|
+
{
|
|
1245
|
+
id: `${id}-menu`,
|
|
1246
|
+
role: "dialog",
|
|
1247
|
+
"aria-labelledby": `${id}-title`,
|
|
1248
|
+
className: "dx-account-panel",
|
|
1249
|
+
ref: panel,
|
|
1250
|
+
style: { right: -panelShift },
|
|
1251
|
+
initial: { opacity: 0, y: reduced ? 0 : -6, scale: reduced ? 1 : 0.985 },
|
|
1252
|
+
animate: { opacity: 1, y: 0, scale: 1 },
|
|
1253
|
+
exit: { opacity: 0, y: reduced ? 0 : -4 },
|
|
1254
|
+
transition: { duration: reduced ? 0 : 0.2, ease: [0.25, 0.65, 0.3, 1] },
|
|
1255
|
+
onAnimationComplete: () => {
|
|
1256
|
+
if (isOpen.current && document.activeElement === trigger.current) panel.current?.querySelector("button:not(:disabled), a[href]")?.focus();
|
|
1257
|
+
},
|
|
1258
|
+
children: [
|
|
1259
|
+
/* @__PURE__ */ jsxs5("div", { className: "dx-account-identity", children: [
|
|
1260
|
+
/* @__PURE__ */ jsx6(AccountFace, {}),
|
|
1261
|
+
/* @__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 })
|
|
1264
|
+
] })
|
|
1265
|
+
] }),
|
|
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: [
|
|
1267
|
+
/* @__PURE__ */ jsx6("button", { type: "button", className: "dx-account-back", onClick: () => setCreateOpen(false), children: "Back to sign in" }),
|
|
1268
|
+
/* @__PURE__ */ jsx6(CreateWalletPanel, { agentDelegation: "deferred", terminology: "account", withMark: false, onCreated: (result) => {
|
|
1269
|
+
setCreatedHandle(result.handle);
|
|
1270
|
+
setCreateOpen(false);
|
|
1271
|
+
} })
|
|
1272
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1273
|
+
(needsConnection || finishCreation) && /* @__PURE__ */ jsxs5("div", { className: "dx-account-entry", children: [
|
|
1274
|
+
dexter.model.stage === "repair" && /* @__PURE__ */ jsx6("p", { className: "dx-account-explanation", children: "Reconnect your passkey to continue." }),
|
|
1275
|
+
/* @__PURE__ */ jsx6(
|
|
1276
|
+
"button",
|
|
1277
|
+
{
|
|
1278
|
+
type: "button",
|
|
1279
|
+
className: "dx-account-primary",
|
|
1280
|
+
disabled: busy,
|
|
1281
|
+
onClick: () => void run(dexter.model.primaryAction === "retry" ? "retry" : "connect"),
|
|
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"
|
|
1283
|
+
}
|
|
1284
|
+
),
|
|
1285
|
+
canCreate && !finishCreation && /* @__PURE__ */ jsx6("button", { type: "button", className: "dx-account-create", onClick: () => setCreateOpen(true), disabled: busy, children: "Create account" })
|
|
1286
|
+
] }),
|
|
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 ?? ""}`),
|
|
1288
|
+
(canOpenWallet || permissions.accountContentVisible) && /* @__PURE__ */ jsxs5("nav", { className: "dx-account-destinations", "aria-label": "Your account", children: [
|
|
1289
|
+
canOpenWallet && ["activity", "agents"].map((key) => {
|
|
1290
|
+
const item = links[key];
|
|
1291
|
+
return item && /* @__PURE__ */ jsxs5(LinkComponent, { href: item.href, onClick: close, children: [
|
|
1292
|
+
/* @__PURE__ */ jsx6(AccountIcon, { kind: key }),
|
|
1293
|
+
/* @__PURE__ */ jsx6("span", { children: item.label ?? (key === "activity" ? "Activity" : "Apps and agents") })
|
|
1294
|
+
] }, key);
|
|
1295
|
+
}),
|
|
1296
|
+
items.filter((item) => item.requires === "wallet" ? canOpenWallet : permissions.accountContentVisible).map((item) => /* @__PURE__ */ jsxs5(LinkComponent, { href: item.href, onClick: close, children: [
|
|
1297
|
+
item.icon,
|
|
1298
|
+
/* @__PURE__ */ jsx6("span", { children: item.label }),
|
|
1299
|
+
item.hint && /* @__PURE__ */ jsx6("span", { className: "dx-account-destinationHint", children: item.hint })
|
|
1300
|
+
] }, item.id))
|
|
1301
|
+
] }),
|
|
1302
|
+
hasIdentity && /* @__PURE__ */ jsxs5("div", { className: "dx-account-connection", children: [
|
|
1303
|
+
/* @__PURE__ */ jsxs5("div", { className: "dx-account-accountFooter", children: [
|
|
1304
|
+
/* @__PURE__ */ jsxs5("div", { className: "dx-account-accountLinks", children: [
|
|
1305
|
+
permissions.accountContentVisible && links.profile && /* @__PURE__ */ jsx6(LinkComponent, { href: links.profile.href, onClick: close, children: links.profile.label ?? "Profile" }),
|
|
1306
|
+
links.support && /* @__PURE__ */ jsx6(LinkComponent, { href: links.support.href, onClick: close, children: links.support.label ?? "Support" })
|
|
1307
|
+
] }),
|
|
1308
|
+
/* @__PURE__ */ jsx6("button", { className: "dx-account-manage", type: "button", "aria-label": "Account settings", "aria-controls": `${id}-settings`, "aria-expanded": manageOpen, onClick: () => setManageOpen(!manageOpen), children: /* @__PURE__ */ jsx6(AccountIcon, { kind: "settings" }) })
|
|
1309
|
+
] }),
|
|
1310
|
+
manageOpen && /* @__PURE__ */ jsxs5(
|
|
1311
|
+
motion.div,
|
|
1312
|
+
{
|
|
1313
|
+
id: `${id}-settings`,
|
|
1314
|
+
className: "dx-account-connectionActions",
|
|
1315
|
+
initial: reduced ? false : { opacity: 0, y: -4 },
|
|
1316
|
+
animate: { opacity: 1, y: 0 },
|
|
1317
|
+
transition: { duration: reduced ? 0 : 0.16 },
|
|
1318
|
+
children: [
|
|
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" }),
|
|
1321
|
+
dexter.model.stage === "ready" && /* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void run("switch"), disabled: busy, children: "Switch account" }),
|
|
1322
|
+
/* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void run("disconnect"), disabled: busy, children: pending === "disconnect" ? "Disconnecting..." : "Disconnect Dexter" })
|
|
1323
|
+
]
|
|
1324
|
+
}
|
|
1325
|
+
)
|
|
1326
|
+
] })
|
|
1327
|
+
] }) }),
|
|
1328
|
+
error && /* @__PURE__ */ jsx6("p", { className: "dx-account-error", role: "alert", children: error })
|
|
1329
|
+
]
|
|
1330
|
+
}
|
|
1331
|
+
) })
|
|
1332
|
+
] });
|
|
1333
|
+
}
|
|
1334
|
+
function DefaultSummary({ connection, ...props }) {
|
|
1335
|
+
const balance = useAccountPortfolio(connection.activeWallet);
|
|
1336
|
+
return /* @__PURE__ */ jsx6(DexterAccountSummary, { ...balance, ...props });
|
|
1337
|
+
}
|
|
1338
|
+
function AccountIcon({ kind }) {
|
|
1339
|
+
return /* @__PURE__ */ jsx6("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: kind === "activity" ? /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1340
|
+
/* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "8.5" }),
|
|
1341
|
+
/* @__PURE__ */ jsx6("path", { d: "M12 7v5l3 2" })
|
|
1342
|
+
] }) : kind === "agents" ? /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1343
|
+
/* @__PURE__ */ jsx6("rect", { x: "3", y: "3", width: "7", height: "7", rx: "2" }),
|
|
1344
|
+
/* @__PURE__ */ jsx6("rect", { x: "14", y: "14", width: "7", height: "7", rx: "2" }),
|
|
1345
|
+
/* @__PURE__ */ jsx6("path", { d: "M14 6h4v5M6 14v4h5" })
|
|
1346
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1347
|
+
/* @__PURE__ */ jsx6("path", { d: "m10 3-.7 2.2-2 .9-2.1-.5-2 3.5 1.5 1.6v2.6l-1.5 1.6 2 3.5 2.1-.5 2 .9L10 21h4l.7-2.2 2-.9 2.1.5 2-3.5-1.5-1.6v-2.6l1.5-1.6-2-3.5-2.1.5-2-.9L14 3z" }),
|
|
1348
|
+
/* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "3" })
|
|
1349
|
+
] }) });
|
|
1350
|
+
}
|
|
1351
|
+
function accountConnectionError(code) {
|
|
1352
|
+
if (code === "credential_not_found") return "No Dexter account found for this passkey on this device.";
|
|
1353
|
+
if (code === "vault_not_found") return "This passkey is not linked to a Dexter account yet.";
|
|
1354
|
+
if (code === "verification_failed") return "Passkey verification failed. Try again.";
|
|
1355
|
+
if (code === "missing_credential") return "No passkey was selected.";
|
|
1356
|
+
return "Something went wrong signing in with your passkey.";
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
// src/AppInstallButtons.tsx
|
|
1360
|
+
import { useEffect as useEffect8, useId as useId6, useState as useState8 } from "react";
|
|
1361
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
800
1362
|
var STYLE_ID2 = "dexter-connect-appinstall-styles";
|
|
801
1363
|
var APPINSTALL_CSS = `
|
|
802
1364
|
.dx-appinstall{ display:flex; flex-wrap:wrap; gap:10px; }
|
|
@@ -921,7 +1483,7 @@ async function copyText(text) {
|
|
|
921
1483
|
}
|
|
922
1484
|
}
|
|
923
1485
|
function useCopyStatus() {
|
|
924
|
-
const [status, setStatus] =
|
|
1486
|
+
const [status, setStatus] = useState8("idle");
|
|
925
1487
|
return [status, (next) => setStatus(next)];
|
|
926
1488
|
}
|
|
927
1489
|
function appCx(block) {
|
|
@@ -937,8 +1499,8 @@ function AppInstallButtons(props) {
|
|
|
937
1499
|
className,
|
|
938
1500
|
onAction
|
|
939
1501
|
} = props;
|
|
940
|
-
|
|
941
|
-
const statusId =
|
|
1502
|
+
useEffect8(ensureAppInstallStyles, []);
|
|
1503
|
+
const statusId = useId6();
|
|
942
1504
|
const hermesCommand = hermesInstallCommand(serverName, mcpUrl);
|
|
943
1505
|
const claudeCommand = claudeCodeInstallCommand(serverName, mcpUrl);
|
|
944
1506
|
const [hermesStatus, markHermes] = useCopyStatus();
|
|
@@ -946,7 +1508,7 @@ function AppInstallButtons(props) {
|
|
|
946
1508
|
const hermesErrorId = `${statusId}-hermes-error`;
|
|
947
1509
|
const claudeErrorId = `${statusId}-claude-error`;
|
|
948
1510
|
const buttons = {
|
|
949
|
-
claude: /* @__PURE__ */
|
|
1511
|
+
claude: /* @__PURE__ */ jsxs6(
|
|
950
1512
|
"a",
|
|
951
1513
|
{
|
|
952
1514
|
className: appCx(block),
|
|
@@ -955,13 +1517,13 @@ function AppInstallButtons(props) {
|
|
|
955
1517
|
rel: "noopener noreferrer",
|
|
956
1518
|
onClick: () => onAction?.("claude", "deeplink"),
|
|
957
1519
|
children: [
|
|
958
|
-
/* @__PURE__ */
|
|
1520
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: CLAUDE_MARK, alt: "", "aria-hidden": true }),
|
|
959
1521
|
"Open in Claude"
|
|
960
1522
|
]
|
|
961
1523
|
},
|
|
962
1524
|
"claude"
|
|
963
1525
|
),
|
|
964
|
-
chatgpt: /* @__PURE__ */
|
|
1526
|
+
chatgpt: /* @__PURE__ */ jsxs6(
|
|
965
1527
|
"a",
|
|
966
1528
|
{
|
|
967
1529
|
className: appCx(block),
|
|
@@ -970,39 +1532,39 @@ function AppInstallButtons(props) {
|
|
|
970
1532
|
rel: "noopener noreferrer",
|
|
971
1533
|
onClick: () => onAction?.("chatgpt", "deeplink"),
|
|
972
1534
|
children: [
|
|
973
|
-
/* @__PURE__ */
|
|
1535
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: CHATGPT_MARK, alt: "", "aria-hidden": true }),
|
|
974
1536
|
"Open ChatGPT plugins"
|
|
975
1537
|
]
|
|
976
1538
|
},
|
|
977
1539
|
"chatgpt"
|
|
978
1540
|
),
|
|
979
|
-
cursor: /* @__PURE__ */
|
|
1541
|
+
cursor: /* @__PURE__ */ jsxs6(
|
|
980
1542
|
"a",
|
|
981
1543
|
{
|
|
982
1544
|
className: appCx(block),
|
|
983
1545
|
href: cursorInstallUrl(serverName, mcpUrl),
|
|
984
1546
|
onClick: () => onAction?.("cursor", "deeplink"),
|
|
985
1547
|
children: [
|
|
986
|
-
/* @__PURE__ */
|
|
1548
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: CURSOR_MARK, alt: "", "aria-hidden": true }),
|
|
987
1549
|
"Add to Cursor"
|
|
988
1550
|
]
|
|
989
1551
|
},
|
|
990
1552
|
"cursor"
|
|
991
1553
|
),
|
|
992
|
-
vscode: /* @__PURE__ */
|
|
1554
|
+
vscode: /* @__PURE__ */ jsxs6(
|
|
993
1555
|
"a",
|
|
994
1556
|
{
|
|
995
1557
|
className: appCx(block),
|
|
996
1558
|
href: vscodeInstallUrl(serverName, mcpUrl),
|
|
997
1559
|
onClick: () => onAction?.("vscode", "deeplink"),
|
|
998
1560
|
children: [
|
|
999
|
-
/* @__PURE__ */
|
|
1561
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: VSCODE_MARK, alt: "", "aria-hidden": true }),
|
|
1000
1562
|
"Add to VS Code"
|
|
1001
1563
|
]
|
|
1002
1564
|
},
|
|
1003
1565
|
"vscode"
|
|
1004
1566
|
),
|
|
1005
|
-
hermes: /* @__PURE__ */
|
|
1567
|
+
hermes: /* @__PURE__ */ jsxs6(
|
|
1006
1568
|
"button",
|
|
1007
1569
|
{
|
|
1008
1570
|
type: "button",
|
|
@@ -1020,13 +1582,13 @@ function AppInstallButtons(props) {
|
|
|
1020
1582
|
}
|
|
1021
1583
|
},
|
|
1022
1584
|
children: [
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
hermesStatus === "copied" ? /* @__PURE__ */
|
|
1585
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: HERMES_MARK, alt: "", "aria-hidden": true }),
|
|
1586
|
+
hermesStatus === "copied" ? /* @__PURE__ */ jsx7("span", { className: "dx-appbtn__copied", children: "Copied. Run it in your terminal" }) : hermesStatus === "copying" ? "Copying OAuth setup\u2026" : hermesStatus === "failed" ? "Try copying for Hermes" : "Copy OAuth setup for Hermes"
|
|
1025
1587
|
]
|
|
1026
1588
|
},
|
|
1027
1589
|
"hermes"
|
|
1028
1590
|
),
|
|
1029
|
-
"claude-code": /* @__PURE__ */
|
|
1591
|
+
"claude-code": /* @__PURE__ */ jsxs6(
|
|
1030
1592
|
"button",
|
|
1031
1593
|
{
|
|
1032
1594
|
type: "button",
|
|
@@ -1044,14 +1606,14 @@ function AppInstallButtons(props) {
|
|
|
1044
1606
|
}
|
|
1045
1607
|
},
|
|
1046
1608
|
children: [
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
claudeStatus === "copied" ? /* @__PURE__ */
|
|
1609
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: CLAUDE_MARK, alt: "", "aria-hidden": true }),
|
|
1610
|
+
claudeStatus === "copied" ? /* @__PURE__ */ jsx7("span", { className: "dx-appbtn__copied", children: "Copied. Run it in your terminal" }) : claudeStatus === "copying" ? "Copying setup\u2026" : claudeStatus === "failed" ? "Try copying for Claude Code" : "Copy for Claude Code"
|
|
1049
1611
|
]
|
|
1050
1612
|
},
|
|
1051
1613
|
"claude-code"
|
|
1052
1614
|
)
|
|
1053
1615
|
};
|
|
1054
|
-
return /* @__PURE__ */
|
|
1616
|
+
return /* @__PURE__ */ jsxs6(
|
|
1055
1617
|
"div",
|
|
1056
1618
|
{
|
|
1057
1619
|
className: ["dx-appinstall", block ? "dx-appinstall--block" : "", className ?? ""].filter(Boolean).join(" "),
|
|
@@ -1059,13 +1621,13 @@ function AppInstallButtons(props) {
|
|
|
1059
1621
|
"aria-label": `Add ${displayName} to an agent app`,
|
|
1060
1622
|
children: [
|
|
1061
1623
|
apps.map((app) => buttons[app] ?? null),
|
|
1062
|
-
/* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ jsx7("span", { className: "dx-appinstall__sr-only", "aria-live": "polite", "aria-atomic": "true", children: [
|
|
1063
1625
|
hermesStatus === "copied" ? "Hermes OAuth setup command copied." : "",
|
|
1064
1626
|
claudeStatus === "copied" ? "Claude Code setup command copied." : ""
|
|
1065
1627
|
].filter(Boolean).join(" ") }),
|
|
1066
|
-
hermesStatus === "copied" ? /* @__PURE__ */
|
|
1067
|
-
/* @__PURE__ */
|
|
1068
|
-
/* @__PURE__ */
|
|
1628
|
+
hermesStatus === "copied" ? /* @__PURE__ */ jsxs6("div", { className: "dx-appinstall__notice", children: [
|
|
1629
|
+
/* @__PURE__ */ jsx7("p", { children: "Run the command in your terminal. It adds the hosted MCP with OAuth." }),
|
|
1630
|
+
/* @__PURE__ */ jsx7(
|
|
1069
1631
|
"a",
|
|
1070
1632
|
{
|
|
1071
1633
|
className: "dx-appinstall__open",
|
|
@@ -1076,9 +1638,9 @@ function AppInstallButtons(props) {
|
|
|
1076
1638
|
}
|
|
1077
1639
|
)
|
|
1078
1640
|
] }) : null,
|
|
1079
|
-
hermesStatus === "failed" ? /* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
/* @__PURE__ */
|
|
1641
|
+
hermesStatus === "failed" ? /* @__PURE__ */ jsxs6("div", { id: hermesErrorId, className: "dx-appinstall__error", role: "alert", children: [
|
|
1642
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: `${hermesErrorId}-command`, children: "Couldn't copy. Select this Hermes command and run it in your terminal." }),
|
|
1643
|
+
/* @__PURE__ */ jsx7(
|
|
1082
1644
|
"input",
|
|
1083
1645
|
{
|
|
1084
1646
|
id: `${hermesErrorId}-command`,
|
|
@@ -1089,14 +1651,14 @@ function AppInstallButtons(props) {
|
|
|
1089
1651
|
}
|
|
1090
1652
|
)
|
|
1091
1653
|
] }) : null,
|
|
1092
|
-
claudeStatus === "copied" ? /* @__PURE__ */
|
|
1654
|
+
claudeStatus === "copied" ? /* @__PURE__ */ jsx7("div", { className: "dx-appinstall__notice", children: /* @__PURE__ */ jsxs6("p", { children: [
|
|
1093
1655
|
"Run the command in your terminal. If sign-in is required, finish it from Claude Code's ",
|
|
1094
|
-
/* @__PURE__ */
|
|
1656
|
+
/* @__PURE__ */ jsx7("code", { children: "/mcp" }),
|
|
1095
1657
|
" menu."
|
|
1096
1658
|
] }) }) : null,
|
|
1097
|
-
claudeStatus === "failed" ? /* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1659
|
+
claudeStatus === "failed" ? /* @__PURE__ */ jsxs6("div", { id: claudeErrorId, className: "dx-appinstall__error", role: "alert", children: [
|
|
1660
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: `${claudeErrorId}-command`, children: "Couldn't copy. Select this Claude Code command and run it in your terminal." }),
|
|
1661
|
+
/* @__PURE__ */ jsx7(
|
|
1100
1662
|
"input",
|
|
1101
1663
|
{
|
|
1102
1664
|
id: `${claudeErrorId}-command`,
|
|
@@ -1115,6 +1677,9 @@ export {
|
|
|
1115
1677
|
AllowanceChips,
|
|
1116
1678
|
AppInstallButtons,
|
|
1117
1679
|
CreateWalletPanel,
|
|
1680
|
+
DEFAULT_ACCOUNT_NAVIGATION,
|
|
1681
|
+
DexterAccountControl,
|
|
1682
|
+
DexterAccountSummary,
|
|
1118
1683
|
DexterButton,
|
|
1119
1684
|
DexterMark,
|
|
1120
1685
|
REMOVE_DEXTER_FROM_DEVICE_CONFIRMATION,
|