@dexterai/connect 0.29.1 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -0
- package/dist/{chunk-CZL7NGVV.js → chunk-4FTJB7FT.js} +509 -28
- package/dist/{chunk-LHYU2EZQ.js → chunk-WHGR5FUY.js} +141 -8
- package/dist/{chunk-2BTS6DCR.js → chunk-Z6YHGWG3.js} +1 -1
- package/dist/{connectionContract-CR478cfF.d.ts → connectionContract-BzV_pjOI.d.ts} +13 -2
- package/dist/{enroll-DrgEW0X8.d.ts → enroll-BmD1y8KH.d.ts} +33 -2
- package/dist/hosted.d.ts +9 -2
- package/dist/hosted.js +10 -4
- package/dist/index.d.ts +15 -5
- package/dist/index.js +7 -3
- package/dist/react.d.ts +76 -6
- package/dist/react.js +589 -45
- 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-Z6YHGWG3.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-4FTJB7FT.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();
|
|
@@ -396,7 +396,7 @@ function useDexterConnection(config) {
|
|
|
396
396
|
const result = await connectDexterIdentity({
|
|
397
397
|
...passkey,
|
|
398
398
|
...apiBase ? { apiBase } : {},
|
|
399
|
-
...
|
|
399
|
+
...fetch2 ? { bindingFetch: fetch2 } : {},
|
|
400
400
|
installAccountSession: async (session) => {
|
|
401
401
|
dexterIdentity.allowAccountSession(session.accessToken);
|
|
402
402
|
await installAccountSession(session);
|
|
@@ -432,7 +432,7 @@ function useDexterConnection(config) {
|
|
|
432
432
|
}, [
|
|
433
433
|
dexterIdentity,
|
|
434
434
|
apiBase,
|
|
435
|
-
|
|
435
|
+
fetch2,
|
|
436
436
|
installAccountSession,
|
|
437
437
|
clearAccountSession,
|
|
438
438
|
passkey,
|
|
@@ -707,8 +707,11 @@ function CreateWalletPanel(props) {
|
|
|
707
707
|
transport,
|
|
708
708
|
showName = true,
|
|
709
709
|
agentDelegation = "deferred",
|
|
710
|
-
className
|
|
710
|
+
className,
|
|
711
|
+
terminology = "wallet",
|
|
712
|
+
withMark = true
|
|
711
713
|
} = props;
|
|
714
|
+
const account = terminology === "account";
|
|
712
715
|
useEffect5(ensureConsentStyles, []);
|
|
713
716
|
useEffect5(ensureDexterButtonStyles, []);
|
|
714
717
|
const nameInputId = useId2();
|
|
@@ -727,7 +730,7 @@ function CreateWalletPanel(props) {
|
|
|
727
730
|
const ownerOnly = agentDelegation === "deferred";
|
|
728
731
|
const policy = resolvedTransport === "inline" && !ownerOnly ? authoredPolicy(value ?? "") : null;
|
|
729
732
|
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.";
|
|
733
|
+
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
734
|
const handleCreate = async () => {
|
|
732
735
|
if (running) return;
|
|
733
736
|
if (resolvedTransport === "unknown" || !hosted && !ownerOnly && !policy) return;
|
|
@@ -736,7 +739,7 @@ function CreateWalletPanel(props) {
|
|
|
736
739
|
setPhase(null);
|
|
737
740
|
try {
|
|
738
741
|
const result = await createWallet({
|
|
739
|
-
name: hosted ? void 0 : name.trim() || "Dexter Wallet",
|
|
742
|
+
name: hosted ? void 0 : name.trim() || (account ? "Dexter account" : "Dexter Wallet"),
|
|
740
743
|
spendPolicy: hosted ? void 0 : policy ?? void 0,
|
|
741
744
|
agentDelegation,
|
|
742
745
|
apiBase,
|
|
@@ -755,14 +758,14 @@ function CreateWalletPanel(props) {
|
|
|
755
758
|
};
|
|
756
759
|
return /* @__PURE__ */ jsxs2("div", { className: cx("dx-cwp", className), children: [
|
|
757
760
|
!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" }),
|
|
761
|
+
/* @__PURE__ */ jsx2("label", { className: "dx-cwp__label", htmlFor: nameInputId, children: account ? "Account name" : "Name your wallet" }),
|
|
759
762
|
/* @__PURE__ */ jsx2(
|
|
760
763
|
"input",
|
|
761
764
|
{
|
|
762
765
|
id: nameInputId,
|
|
763
766
|
className: "dx-cwp__name",
|
|
764
767
|
maxLength: 40,
|
|
765
|
-
placeholder: "Dexter Wallet",
|
|
768
|
+
placeholder: account ? "Dexter account" : "Dexter Wallet",
|
|
766
769
|
value: name,
|
|
767
770
|
disabled: running,
|
|
768
771
|
autoComplete: "off",
|
|
@@ -770,7 +773,7 @@ function CreateWalletPanel(props) {
|
|
|
770
773
|
}
|
|
771
774
|
)
|
|
772
775
|
] }),
|
|
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: [
|
|
776
|
+
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
777
|
/* @__PURE__ */ jsxs2("div", { className: "dx-cwp__field", children: [
|
|
775
778
|
/* @__PURE__ */ jsx2("span", { className: "dx-cwp__label", children: "What agents may spend automatically, per 30 days" }),
|
|
776
779
|
/* @__PURE__ */ jsx2(AllowanceChips, { value, onChange: setValue, disabled: running })
|
|
@@ -783,20 +786,558 @@ function CreateWalletPanel(props) {
|
|
|
783
786
|
DexterButton,
|
|
784
787
|
{
|
|
785
788
|
block: true,
|
|
789
|
+
withMark,
|
|
786
790
|
className: "dx-cwp__cta",
|
|
787
791
|
loading: running,
|
|
788
792
|
loadingLabel: phase ? ceremonyPhaseLabel(phase) : "Creating\u2026",
|
|
789
793
|
disabled: !canContinue || resolvedTransport === "unknown",
|
|
790
794
|
onClick: handleCreate,
|
|
791
|
-
children: error ? "Retry" : hosted ? "Continue to Dexter Wallet" : "Create your Dexter Wallet"
|
|
795
|
+
children: error ? "Retry" : hosted ? account ? "Continue to Dexter" : "Continue to Dexter Wallet" : account ? "Create account" : "Create your Dexter Wallet"
|
|
792
796
|
}
|
|
793
797
|
)
|
|
794
798
|
] });
|
|
795
799
|
}
|
|
796
800
|
|
|
797
|
-
// src/
|
|
798
|
-
import {
|
|
801
|
+
// src/DexterAccountControl.tsx
|
|
802
|
+
import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
|
|
803
|
+
import { useEffect as useEffect7, useId as useId5, useLayoutEffect, useRef as useRef4, useState as useState7 } from "react";
|
|
804
|
+
|
|
805
|
+
// src/accountBrand.tsx
|
|
806
|
+
import { useId as useId3 } from "react";
|
|
799
807
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
808
|
+
function AccountMark() {
|
|
809
|
+
const clipId = useId3();
|
|
810
|
+
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: [
|
|
811
|
+
/* @__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" }) }),
|
|
812
|
+
/* @__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("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" }) }),
|
|
814
|
+
/* @__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" }) }),
|
|
815
|
+
/* @__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" }) })
|
|
816
|
+
] }) }) });
|
|
817
|
+
}
|
|
818
|
+
function AccountFace() {
|
|
819
|
+
return /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 300 300", "aria-hidden": "true", children: /* @__PURE__ */ jsxs3("g", { children: [
|
|
820
|
+
/* @__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" }),
|
|
821
|
+
/* @__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" }),
|
|
822
|
+
/* @__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" })
|
|
823
|
+
] }) });
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// 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
|
+
|
|
829
|
+
// src/accountNavigation.tsx
|
|
830
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
831
|
+
var DEFAULT_ACCOUNT_NAVIGATION = Object.freeze({
|
|
832
|
+
money: { href: "https://dexter.cash/wallet?section=money", label: "Money" },
|
|
833
|
+
send: { href: "https://dexter.cash/wallet/withdraw", label: "Send" },
|
|
834
|
+
receive: { href: "https://dexter.cash/wallet/deposit", label: "Receive" },
|
|
835
|
+
activity: { href: "https://dexter.cash/wallet?section=activity", label: "Activity" },
|
|
836
|
+
agents: { href: "https://dexter.cash/wallet?section=agents", label: "Apps and agents" },
|
|
837
|
+
profile: { href: "https://dexter.cash/profile", label: "Profile" },
|
|
838
|
+
support: { href: "https://dexter.cash/support", label: "Support" },
|
|
839
|
+
settings: { href: "https://dexter.cash/wallet?section=you", label: "Account settings" }
|
|
840
|
+
});
|
|
841
|
+
function AccountLink(props) {
|
|
842
|
+
return /* @__PURE__ */ jsx4("a", { ...props });
|
|
843
|
+
}
|
|
844
|
+
function resolveAccountNavigation(navigation, wallet) {
|
|
845
|
+
const links = { ...DEFAULT_ACCOUNT_NAVIGATION, ...navigation };
|
|
846
|
+
if (!wallet?.userHandle) return links;
|
|
847
|
+
for (const key of Object.keys(links)) {
|
|
848
|
+
const item = links[key];
|
|
849
|
+
if (!item || !item.href.startsWith("https://dexter.cash/")) continue;
|
|
850
|
+
const url = new URL(item.href);
|
|
851
|
+
if (url.origin !== "https://dexter.cash" || !(url.pathname === "/profile" || url.pathname === "/wallet" || url.pathname.startsWith("/wallet/"))) continue;
|
|
852
|
+
url.searchParams.set("dexter_account", wallet.userHandle);
|
|
853
|
+
links[key] = { ...item, href: url.toString() };
|
|
854
|
+
}
|
|
855
|
+
return links;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// src/DexterAccountSummary.tsx
|
|
859
|
+
import { useId as useId4 } from "react";
|
|
860
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
861
|
+
function DexterAccountSummary({
|
|
862
|
+
amount,
|
|
863
|
+
loading,
|
|
864
|
+
partial = false,
|
|
865
|
+
refresh,
|
|
866
|
+
navigation,
|
|
867
|
+
LinkComponent = AccountLink,
|
|
868
|
+
onNavigate,
|
|
869
|
+
styleNonce
|
|
870
|
+
}) {
|
|
871
|
+
const id = useId4();
|
|
872
|
+
const links = { ...DEFAULT_ACCOUNT_NAVIGATION, ...navigation };
|
|
873
|
+
const content = /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
874
|
+
/* @__PURE__ */ jsx5(
|
|
875
|
+
"span",
|
|
876
|
+
{
|
|
877
|
+
className: "dx-account-amount",
|
|
878
|
+
id: `${id}-amount`,
|
|
879
|
+
style: { "--amount-length": amount?.length ?? 6 },
|
|
880
|
+
children: amount ?? /* @__PURE__ */ jsx5("span", { className: "dx-account-balanceState", role: "status", children: loading ? "Loading balance..." : "Balance unavailable" })
|
|
881
|
+
}
|
|
882
|
+
),
|
|
883
|
+
/* @__PURE__ */ jsx5("span", { id: `${id}-label`, className: "dx-account-balanceLabel", children: partial ? "Priced assets" : "Portfolio value" })
|
|
884
|
+
] });
|
|
885
|
+
return /* @__PURE__ */ jsxs4("div", { className: "dx-account-summary", children: [
|
|
886
|
+
/* @__PURE__ */ jsx5("style", { nonce: styleNonce, children: ACCOUNT_CONTROL_CSS }),
|
|
887
|
+
/* @__PURE__ */ jsxs4("div", { className: "dx-account-balanceRow", children: [
|
|
888
|
+
links.money ? /* @__PURE__ */ jsx5(
|
|
889
|
+
LinkComponent,
|
|
890
|
+
{
|
|
891
|
+
href: links.money.href,
|
|
892
|
+
className: "dx-account-balance",
|
|
893
|
+
onClick: onNavigate,
|
|
894
|
+
"aria-label": links.money.label ?? "Money",
|
|
895
|
+
"aria-describedby": `${id}-amount ${id}-label`,
|
|
896
|
+
children: content
|
|
897
|
+
}
|
|
898
|
+
) : /* @__PURE__ */ jsx5("div", { className: "dx-account-balance", children: content }),
|
|
899
|
+
!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: [
|
|
900
|
+
/* @__PURE__ */ jsx5("path", { d: "M20 7v5h-5M4 17v-5h5" }),
|
|
901
|
+
/* @__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" })
|
|
902
|
+
] }) })
|
|
903
|
+
] }),
|
|
904
|
+
(links.send || links.receive) && /* @__PURE__ */ jsxs4("div", { className: "dx-account-moneyActions", children: [
|
|
905
|
+
links.send && /* @__PURE__ */ jsxs4(LinkComponent, { href: links.send.href, onClick: onNavigate, children: [
|
|
906
|
+
/* @__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" }) }),
|
|
907
|
+
links.send.label ?? "Send"
|
|
908
|
+
] }),
|
|
909
|
+
links.receive && /* @__PURE__ */ jsxs4(LinkComponent, { href: links.receive.href, onClick: onNavigate, children: [
|
|
910
|
+
/* @__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" }) }),
|
|
911
|
+
links.receive.label ?? "Receive"
|
|
912
|
+
] })
|
|
913
|
+
] })
|
|
914
|
+
] });
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// src/useAccountPortfolio.ts
|
|
918
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
919
|
+
|
|
920
|
+
// src/accountPortfolio.ts
|
|
921
|
+
var PORTFOLIO_URL = "https://api.dexter.cash/api/passkey-vault-anon/portfolio";
|
|
922
|
+
var REQUEST_TIMEOUT_MS = 12e3;
|
|
923
|
+
var MAX_RESPONSE_BYTES = 256 * 1024;
|
|
924
|
+
var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
925
|
+
function record(value) {
|
|
926
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
927
|
+
}
|
|
928
|
+
function decimal(value) {
|
|
929
|
+
return typeof value === "string" && value.length <= 384 && /^(0|[1-9][0-9]*)(?:\.[0-9]+)?$/.test(value) && (!value.includes(".") || !value.endsWith("0"));
|
|
930
|
+
}
|
|
931
|
+
function count(value) {
|
|
932
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
933
|
+
}
|
|
934
|
+
function publicKey(value) {
|
|
935
|
+
if (typeof value !== "string" || value.length < 32 || value.length > 44) return false;
|
|
936
|
+
let decoded = 0n;
|
|
937
|
+
for (const char of value) {
|
|
938
|
+
const digit = BASE58_ALPHABET.indexOf(char);
|
|
939
|
+
if (digit < 0) return false;
|
|
940
|
+
decoded = decoded * 58n + BigInt(digit);
|
|
941
|
+
}
|
|
942
|
+
const leadingZeroes = value.match(/^1*/)?.[0].length ?? 0;
|
|
943
|
+
const payloadBytes = decoded === 0n ? 0 : Math.ceil(decoded.toString(16).length / 2);
|
|
944
|
+
return leadingZeroes + payloadBytes === 32;
|
|
945
|
+
}
|
|
946
|
+
function observedAt(value) {
|
|
947
|
+
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));
|
|
948
|
+
}
|
|
949
|
+
function unavailable() {
|
|
950
|
+
return new Error("Account portfolio is unavailable.");
|
|
951
|
+
}
|
|
952
|
+
function roundUsd(value, places) {
|
|
953
|
+
const [whole, fraction = ""] = value.split(".");
|
|
954
|
+
const scale = 10n ** BigInt(places);
|
|
955
|
+
const kept = fraction.slice(0, places).padEnd(places, "0");
|
|
956
|
+
const units = BigInt(whole) * scale + BigInt(kept) + ((fraction[places] ?? "0") >= "5" ? 1n : 0n);
|
|
957
|
+
return `${units / scale}.${(units % scale).toString().padStart(places, "0")}`;
|
|
958
|
+
}
|
|
959
|
+
function formatUsd(value) {
|
|
960
|
+
const [whole, fraction = ""] = value.split(".");
|
|
961
|
+
const firstNonZero = fraction.search(/[1-9]/);
|
|
962
|
+
if (whole === "0" && firstNonZero >= 2) {
|
|
963
|
+
const rounded = roundUsd(value, firstNonZero + 2);
|
|
964
|
+
if (rounded.split(".")[1].search(/[1-9]/) >= 2) {
|
|
965
|
+
return `$${rounded.replace(/0+$/, "")}`;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
const [roundedWhole, cents] = roundUsd(value, 2).split(".");
|
|
969
|
+
return `$${roundedWhole.replace(/\B(?=(\d{3})+(?!\d))/g, ",")}.${cents}`;
|
|
970
|
+
}
|
|
971
|
+
function parsePortfolio(body, wallet) {
|
|
972
|
+
if (!record(body) || body.ok !== true || !record(body.portfolio)) throw unavailable();
|
|
973
|
+
const p = body.portfolio;
|
|
974
|
+
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();
|
|
975
|
+
if (wallet.vaultPda && p.vaultPda !== wallet.vaultPda || wallet.receiveAddress && p.walletAddress !== wallet.receiveAddress) throw unavailable();
|
|
976
|
+
const complete = p.holdingsComplete && p.unpricedHoldings === 0 && p.omittedHoldings === 0 && p.portfolioValueUsd !== null;
|
|
977
|
+
if (p.pricedHoldings === 0 && p.pricedValueUsd !== "0" || complete && p.portfolioValueUsd !== p.pricedValueUsd) throw unavailable();
|
|
978
|
+
const value = complete ? p.portfolioValueUsd : p.pricedHoldings > 0 ? p.pricedValueUsd : null;
|
|
979
|
+
return { amount: value === null ? null : formatUsd(value), partial: !complete };
|
|
980
|
+
}
|
|
981
|
+
async function readBody(response) {
|
|
982
|
+
const declaredSize = response.headers.get("content-length");
|
|
983
|
+
if (declaredSize && Number(declaredSize) > MAX_RESPONSE_BYTES) throw unavailable();
|
|
984
|
+
if (!response.body) throw unavailable();
|
|
985
|
+
const reader = response.body.getReader();
|
|
986
|
+
const decoder = new TextDecoder();
|
|
987
|
+
let bytes = 0;
|
|
988
|
+
let text = "";
|
|
989
|
+
try {
|
|
990
|
+
while (true) {
|
|
991
|
+
const { value, done } = await reader.read();
|
|
992
|
+
if (done) break;
|
|
993
|
+
bytes += value.byteLength;
|
|
994
|
+
if (bytes > MAX_RESPONSE_BYTES) throw unavailable();
|
|
995
|
+
text += decoder.decode(value, { stream: true });
|
|
996
|
+
}
|
|
997
|
+
text += decoder.decode();
|
|
998
|
+
return JSON.parse(text);
|
|
999
|
+
} finally {
|
|
1000
|
+
await reader.cancel().catch(() => void 0);
|
|
1001
|
+
reader.releaseLock();
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
async function fetchAccountPortfolio(wallet, options = {}) {
|
|
1005
|
+
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();
|
|
1006
|
+
if (options.signal?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
1007
|
+
const controller = new AbortController();
|
|
1008
|
+
let rejectBoundary;
|
|
1009
|
+
const boundary = new Promise((_, reject) => {
|
|
1010
|
+
rejectBoundary = reject;
|
|
1011
|
+
});
|
|
1012
|
+
const abort = () => {
|
|
1013
|
+
controller.abort();
|
|
1014
|
+
rejectBoundary(new DOMException("Aborted", "AbortError"));
|
|
1015
|
+
};
|
|
1016
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
1017
|
+
const timeout = setTimeout(() => {
|
|
1018
|
+
controller.abort();
|
|
1019
|
+
rejectBoundary(new DOMException("Timed out", "TimeoutError"));
|
|
1020
|
+
}, REQUEST_TIMEOUT_MS);
|
|
1021
|
+
try {
|
|
1022
|
+
const response = await Promise.race([
|
|
1023
|
+
(options.fetch ?? fetch)(`${PORTFOLIO_URL}?user_handle=${encodeURIComponent(wallet.userHandle)}`, {
|
|
1024
|
+
cache: "no-store",
|
|
1025
|
+
credentials: "omit",
|
|
1026
|
+
signal: controller.signal
|
|
1027
|
+
}),
|
|
1028
|
+
boundary
|
|
1029
|
+
]);
|
|
1030
|
+
if (!response.ok) throw unavailable();
|
|
1031
|
+
const body = await Promise.race([readBody(response), boundary]);
|
|
1032
|
+
return parsePortfolio(body, wallet);
|
|
1033
|
+
} finally {
|
|
1034
|
+
clearTimeout(timeout);
|
|
1035
|
+
options.signal?.removeEventListener("abort", abort);
|
|
1036
|
+
controller.abort();
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
// src/useAccountPortfolio.ts
|
|
1041
|
+
function useAccountPortfolio(wallet) {
|
|
1042
|
+
const key = wallet === null ? null : JSON.stringify([
|
|
1043
|
+
wallet.userHandle,
|
|
1044
|
+
wallet.vaultPda,
|
|
1045
|
+
wallet.receiveAddress,
|
|
1046
|
+
wallet.network
|
|
1047
|
+
]);
|
|
1048
|
+
const currentKey = useRef3(key);
|
|
1049
|
+
const currentWallet = useRef3(wallet);
|
|
1050
|
+
currentKey.current = key;
|
|
1051
|
+
currentWallet.current = wallet;
|
|
1052
|
+
const generation = useRef3(0);
|
|
1053
|
+
const inFlight = useRef3(null);
|
|
1054
|
+
const [state, setState] = useState6({
|
|
1055
|
+
key,
|
|
1056
|
+
amount: null,
|
|
1057
|
+
partial: false,
|
|
1058
|
+
loading: key !== null
|
|
1059
|
+
});
|
|
1060
|
+
const refresh = useCallback3(() => {
|
|
1061
|
+
if (currentKey.current !== key) return Promise.resolve();
|
|
1062
|
+
const selectedWallet = currentWallet.current;
|
|
1063
|
+
if (key === null || selectedWallet === null) return Promise.resolve();
|
|
1064
|
+
if (inFlight.current?.key === key) return inFlight.current.promise;
|
|
1065
|
+
inFlight.current?.controller.abort();
|
|
1066
|
+
const request = ++generation.current;
|
|
1067
|
+
const controller = new AbortController();
|
|
1068
|
+
setState({ key, amount: null, partial: false, loading: true });
|
|
1069
|
+
const promise = (async () => {
|
|
1070
|
+
try {
|
|
1071
|
+
const portfolio = await fetchAccountPortfolio(selectedWallet, { signal: controller.signal });
|
|
1072
|
+
if (!controller.signal.aborted && currentKey.current === key && generation.current === request) {
|
|
1073
|
+
setState({ key, ...portfolio, loading: false });
|
|
1074
|
+
}
|
|
1075
|
+
} catch {
|
|
1076
|
+
if (!controller.signal.aborted && currentKey.current === key && generation.current === request) {
|
|
1077
|
+
setState({ key, amount: null, partial: false, loading: false });
|
|
1078
|
+
}
|
|
1079
|
+
} finally {
|
|
1080
|
+
if (inFlight.current?.controller === controller) inFlight.current = null;
|
|
1081
|
+
}
|
|
1082
|
+
})();
|
|
1083
|
+
inFlight.current = { key, controller, promise };
|
|
1084
|
+
return promise;
|
|
1085
|
+
}, [key]);
|
|
1086
|
+
useEffect6(() => {
|
|
1087
|
+
void refresh();
|
|
1088
|
+
return () => {
|
|
1089
|
+
generation.current += 1;
|
|
1090
|
+
inFlight.current?.controller.abort();
|
|
1091
|
+
inFlight.current = null;
|
|
1092
|
+
};
|
|
1093
|
+
}, [refresh]);
|
|
1094
|
+
const visible = state.key === key && key !== null ? state : { amount: null, partial: false, loading: key !== null };
|
|
1095
|
+
return { amount: visible.amount, partial: visible.partial, loading: visible.loading, refresh };
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
// src/DexterAccountControl.tsx
|
|
1099
|
+
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1100
|
+
function DexterAccountControl({
|
|
1101
|
+
connection: dexter,
|
|
1102
|
+
open: controlledOpen,
|
|
1103
|
+
onOpenChange,
|
|
1104
|
+
profile,
|
|
1105
|
+
navigation,
|
|
1106
|
+
items = [],
|
|
1107
|
+
LinkComponent = AccountLink,
|
|
1108
|
+
renderSummary,
|
|
1109
|
+
formatError = accountConnectionError,
|
|
1110
|
+
className = "",
|
|
1111
|
+
triggerClassName = "",
|
|
1112
|
+
styleNonce
|
|
1113
|
+
}) {
|
|
1114
|
+
const [ownOpen, setOwnOpen] = useState7(false);
|
|
1115
|
+
const open = controlledOpen ?? ownOpen;
|
|
1116
|
+
const setOpen = (next) => {
|
|
1117
|
+
if (controlledOpen === void 0) setOwnOpen(next);
|
|
1118
|
+
onOpenChange?.(next);
|
|
1119
|
+
};
|
|
1120
|
+
const [ready, setReady] = useState7(false);
|
|
1121
|
+
const [pending, setPending] = useState7(null);
|
|
1122
|
+
const [error, setError] = useState7("");
|
|
1123
|
+
const [createOpen, setCreateOpen] = useState7(false);
|
|
1124
|
+
const [manageOpen, setManageOpen] = useState7(false);
|
|
1125
|
+
const [panelShift, setPanelShift] = useState7(0);
|
|
1126
|
+
const pendingAction = useRef4(false);
|
|
1127
|
+
const control = useRef4(null);
|
|
1128
|
+
const trigger = useRef4(null);
|
|
1129
|
+
const panel = useRef4(null);
|
|
1130
|
+
const isOpen = useRef4(open);
|
|
1131
|
+
isOpen.current = open;
|
|
1132
|
+
const changeOpen = useRef4(setOpen);
|
|
1133
|
+
changeOpen.current = setOpen;
|
|
1134
|
+
const reduced = useReducedMotion();
|
|
1135
|
+
const id = useId5();
|
|
1136
|
+
const permissions = dexter.model.permissions;
|
|
1137
|
+
const checking = !ready || dexter.model.stage === "checking";
|
|
1138
|
+
const busy = checking || pending !== null || dexter.operation !== "idle";
|
|
1139
|
+
const hasIdentity = ready && (dexter.identity.hasWallet || dexter.identity.hasAccount);
|
|
1140
|
+
const email = permissions.accountContentVisible ? profile?.email?.trim() ?? "" : "";
|
|
1141
|
+
const name = permissions.accountContentVisible ? profile?.name?.trim() ?? "" : "";
|
|
1142
|
+
const title = permissions.walletIdentityVisible ? dexter.identity.walletLabel?.trim() || "Your Dexter account" : name || email.split("@")[0] || "Your Dexter account";
|
|
1143
|
+
const canCreate = !checking && dexter.model.stage === "connect";
|
|
1144
|
+
const canOpenWallet = dexter.model.stage === "ready" && permissions.walletDataVisible;
|
|
1145
|
+
const needsConnection = ["connect", "repair", "offline", "error"].includes(dexter.model.stage);
|
|
1146
|
+
const links = resolveAccountNavigation(navigation, dexter.activeWallet);
|
|
1147
|
+
const close = () => changeOpen.current(false);
|
|
1148
|
+
useEffect7(() => setReady(true), []);
|
|
1149
|
+
useLayoutEffect(() => {
|
|
1150
|
+
if (!open) return;
|
|
1151
|
+
const position = () => {
|
|
1152
|
+
if (!control.current || !panel.current) return;
|
|
1153
|
+
const width = panel.current.offsetWidth;
|
|
1154
|
+
const normalLeft = control.current.getBoundingClientRect().right - width;
|
|
1155
|
+
const left = Math.max(16, Math.min(normalLeft, window.innerWidth - width - 16));
|
|
1156
|
+
setPanelShift(left - normalLeft);
|
|
1157
|
+
};
|
|
1158
|
+
position();
|
|
1159
|
+
window.addEventListener("resize", position);
|
|
1160
|
+
return () => window.removeEventListener("resize", position);
|
|
1161
|
+
}, [open]);
|
|
1162
|
+
useEffect7(() => {
|
|
1163
|
+
if (!open) {
|
|
1164
|
+
setError("");
|
|
1165
|
+
setCreateOpen(false);
|
|
1166
|
+
setManageOpen(false);
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
const outside = (event) => {
|
|
1170
|
+
if (event.target instanceof Node && !control.current?.contains(event.target)) changeOpen.current(false);
|
|
1171
|
+
};
|
|
1172
|
+
const key = (event) => {
|
|
1173
|
+
if (event.key !== "Escape") return;
|
|
1174
|
+
changeOpen.current(false);
|
|
1175
|
+
trigger.current?.focus();
|
|
1176
|
+
};
|
|
1177
|
+
const focus = (event) => {
|
|
1178
|
+
if (event.target instanceof Node && !control.current?.contains(event.target)) changeOpen.current(false);
|
|
1179
|
+
};
|
|
1180
|
+
window.addEventListener("pointerdown", outside);
|
|
1181
|
+
window.addEventListener("keydown", key);
|
|
1182
|
+
window.addEventListener("focusin", focus);
|
|
1183
|
+
return () => {
|
|
1184
|
+
window.removeEventListener("pointerdown", outside);
|
|
1185
|
+
window.removeEventListener("keydown", key);
|
|
1186
|
+
window.removeEventListener("focusin", focus);
|
|
1187
|
+
};
|
|
1188
|
+
}, [open]);
|
|
1189
|
+
const run = async (action) => {
|
|
1190
|
+
if (busy || pendingAction.current) return;
|
|
1191
|
+
pendingAction.current = true;
|
|
1192
|
+
setPending(action);
|
|
1193
|
+
setError("");
|
|
1194
|
+
try {
|
|
1195
|
+
if (action === "connect") await dexter.connect();
|
|
1196
|
+
if (action === "switch") await dexter.useAnotherDexterWallet();
|
|
1197
|
+
if (action === "retry") await dexter.retry();
|
|
1198
|
+
if (action === "disconnect") {
|
|
1199
|
+
await dexter.disconnectDexter();
|
|
1200
|
+
close();
|
|
1201
|
+
}
|
|
1202
|
+
} catch (caught) {
|
|
1203
|
+
setError(action === "disconnect" ? "Dexter could not finish that action. Try again." : formatError(caught instanceof ConnectError ? caught.code : dexter.error?.code));
|
|
1204
|
+
} finally {
|
|
1205
|
+
pendingAction.current = false;
|
|
1206
|
+
setPending(null);
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
return /* @__PURE__ */ jsxs5("div", { className: `dx-account-control ${className}`, ref: control, children: [
|
|
1210
|
+
/* @__PURE__ */ jsx6("style", { nonce: styleNonce, children: ACCOUNT_CONTROL_CSS }),
|
|
1211
|
+
/* @__PURE__ */ jsx6(
|
|
1212
|
+
"button",
|
|
1213
|
+
{
|
|
1214
|
+
className: `dx-account-trigger ${triggerClassName}`,
|
|
1215
|
+
ref: trigger,
|
|
1216
|
+
type: "button",
|
|
1217
|
+
"aria-label": open ? "Close Dexter account" : "Open Dexter account",
|
|
1218
|
+
"aria-expanded": open,
|
|
1219
|
+
"aria-controls": `${id}-menu`,
|
|
1220
|
+
"aria-haspopup": "dialog",
|
|
1221
|
+
onClick: () => setOpen(!open),
|
|
1222
|
+
children: /* @__PURE__ */ jsx6(AccountMark, {})
|
|
1223
|
+
}
|
|
1224
|
+
),
|
|
1225
|
+
/* @__PURE__ */ jsx6(AnimatePresence, { children: open && /* @__PURE__ */ jsxs5(
|
|
1226
|
+
motion.section,
|
|
1227
|
+
{
|
|
1228
|
+
id: `${id}-menu`,
|
|
1229
|
+
role: "dialog",
|
|
1230
|
+
"aria-labelledby": `${id}-title`,
|
|
1231
|
+
className: "dx-account-panel",
|
|
1232
|
+
ref: panel,
|
|
1233
|
+
style: { right: -panelShift },
|
|
1234
|
+
initial: { opacity: 0, y: reduced ? 0 : -6, scale: reduced ? 1 : 0.985 },
|
|
1235
|
+
animate: { opacity: 1, y: 0, scale: 1 },
|
|
1236
|
+
exit: { opacity: 0, y: reduced ? 0 : -4 },
|
|
1237
|
+
transition: { duration: reduced ? 0 : 0.2, ease: [0.25, 0.65, 0.3, 1] },
|
|
1238
|
+
onAnimationComplete: () => {
|
|
1239
|
+
if (isOpen.current && document.activeElement === trigger.current) panel.current?.querySelector("button:not(:disabled), a[href]")?.focus();
|
|
1240
|
+
},
|
|
1241
|
+
children: [
|
|
1242
|
+
/* @__PURE__ */ jsxs5("div", { className: "dx-account-identity", children: [
|
|
1243
|
+
/* @__PURE__ */ jsx6(AccountFace, {}),
|
|
1244
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
1245
|
+
/* @__PURE__ */ jsx6("h3", { id: `${id}-title`, children: title }),
|
|
1246
|
+
(checking || email) && /* @__PURE__ */ jsx6("p", { children: checking ? "Opening your account..." : email })
|
|
1247
|
+
] })
|
|
1248
|
+
] }),
|
|
1249
|
+
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
|
+
/* @__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) })
|
|
1252
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1253
|
+
needsConnection && /* @__PURE__ */ jsxs5("div", { className: "dx-account-entry", children: [
|
|
1254
|
+
dexter.model.stage === "repair" && /* @__PURE__ */ jsx6("p", { className: "dx-account-explanation", children: "Reconnect your passkey to continue." }),
|
|
1255
|
+
/* @__PURE__ */ jsx6(
|
|
1256
|
+
"button",
|
|
1257
|
+
{
|
|
1258
|
+
type: "button",
|
|
1259
|
+
className: "dx-account-primary",
|
|
1260
|
+
disabled: busy,
|
|
1261
|
+
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"
|
|
1263
|
+
}
|
|
1264
|
+
),
|
|
1265
|
+
canCreate && /* @__PURE__ */ jsx6("button", { type: "button", className: "dx-account-create", onClick: () => setCreateOpen(true), disabled: busy, children: "Create account" })
|
|
1266
|
+
] }),
|
|
1267
|
+
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
|
+
(canOpenWallet || permissions.accountContentVisible) && /* @__PURE__ */ jsxs5("nav", { className: "dx-account-destinations", "aria-label": "Your account", children: [
|
|
1269
|
+
canOpenWallet && ["activity", "agents"].map((key) => {
|
|
1270
|
+
const item = links[key];
|
|
1271
|
+
return item && /* @__PURE__ */ jsxs5(LinkComponent, { href: item.href, onClick: close, children: [
|
|
1272
|
+
/* @__PURE__ */ jsx6(AccountIcon, { kind: key }),
|
|
1273
|
+
/* @__PURE__ */ jsx6("span", { children: item.label ?? (key === "activity" ? "Activity" : "Apps and agents") })
|
|
1274
|
+
] }, key);
|
|
1275
|
+
}),
|
|
1276
|
+
items.filter((item) => item.requires === "wallet" ? canOpenWallet : permissions.accountContentVisible).map((item) => /* @__PURE__ */ jsxs5(LinkComponent, { href: item.href, onClick: close, children: [
|
|
1277
|
+
item.icon,
|
|
1278
|
+
/* @__PURE__ */ jsx6("span", { children: item.label }),
|
|
1279
|
+
item.hint && /* @__PURE__ */ jsx6("span", { className: "dx-account-destinationHint", children: item.hint })
|
|
1280
|
+
] }, item.id))
|
|
1281
|
+
] }),
|
|
1282
|
+
hasIdentity && /* @__PURE__ */ jsxs5("div", { className: "dx-account-connection", children: [
|
|
1283
|
+
/* @__PURE__ */ jsxs5("div", { className: "dx-account-accountFooter", children: [
|
|
1284
|
+
/* @__PURE__ */ jsxs5("div", { className: "dx-account-accountLinks", children: [
|
|
1285
|
+
permissions.accountContentVisible && links.profile && /* @__PURE__ */ jsx6(LinkComponent, { href: links.profile.href, onClick: close, children: links.profile.label ?? "Profile" }),
|
|
1286
|
+
links.support && /* @__PURE__ */ jsx6(LinkComponent, { href: links.support.href, onClick: close, children: links.support.label ?? "Support" })
|
|
1287
|
+
] }),
|
|
1288
|
+
/* @__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" }) })
|
|
1289
|
+
] }),
|
|
1290
|
+
manageOpen && /* @__PURE__ */ jsxs5(
|
|
1291
|
+
motion.div,
|
|
1292
|
+
{
|
|
1293
|
+
id: `${id}-settings`,
|
|
1294
|
+
className: "dx-account-connectionActions",
|
|
1295
|
+
initial: reduced ? false : { opacity: 0, y: -4 },
|
|
1296
|
+
animate: { opacity: 1, y: 0 },
|
|
1297
|
+
transition: { duration: reduced ? 0 : 0.16 },
|
|
1298
|
+
children: [
|
|
1299
|
+
canOpenWallet && links.settings && /* @__PURE__ */ jsx6(LinkComponent, { href: links.settings.href, onClick: close, children: links.settings.label ?? "Account settings" }),
|
|
1300
|
+
dexter.model.stage === "ready" && /* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void run("switch"), disabled: busy, children: "Switch account" }),
|
|
1301
|
+
/* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void run("disconnect"), disabled: busy, children: pending === "disconnect" ? "Disconnecting..." : "Disconnect Dexter" })
|
|
1302
|
+
]
|
|
1303
|
+
}
|
|
1304
|
+
)
|
|
1305
|
+
] })
|
|
1306
|
+
] }) }),
|
|
1307
|
+
error && /* @__PURE__ */ jsx6("p", { className: "dx-account-error", role: "alert", children: error })
|
|
1308
|
+
]
|
|
1309
|
+
}
|
|
1310
|
+
) })
|
|
1311
|
+
] });
|
|
1312
|
+
}
|
|
1313
|
+
function DefaultSummary({ connection, ...props }) {
|
|
1314
|
+
const balance = useAccountPortfolio(connection.activeWallet);
|
|
1315
|
+
return /* @__PURE__ */ jsx6(DexterAccountSummary, { ...balance, ...props });
|
|
1316
|
+
}
|
|
1317
|
+
function AccountIcon({ kind }) {
|
|
1318
|
+
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: [
|
|
1319
|
+
/* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "8.5" }),
|
|
1320
|
+
/* @__PURE__ */ jsx6("path", { d: "M12 7v5l3 2" })
|
|
1321
|
+
] }) : kind === "agents" ? /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1322
|
+
/* @__PURE__ */ jsx6("rect", { x: "3", y: "3", width: "7", height: "7", rx: "2" }),
|
|
1323
|
+
/* @__PURE__ */ jsx6("rect", { x: "14", y: "14", width: "7", height: "7", rx: "2" }),
|
|
1324
|
+
/* @__PURE__ */ jsx6("path", { d: "M14 6h4v5M6 14v4h5" })
|
|
1325
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1326
|
+
/* @__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" }),
|
|
1327
|
+
/* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "3" })
|
|
1328
|
+
] }) });
|
|
1329
|
+
}
|
|
1330
|
+
function accountConnectionError(code) {
|
|
1331
|
+
if (code === "credential_not_found") return "No Dexter account found for this passkey on this device.";
|
|
1332
|
+
if (code === "vault_not_found") return "This passkey is not linked to a Dexter account yet.";
|
|
1333
|
+
if (code === "verification_failed") return "Passkey verification failed. Try again.";
|
|
1334
|
+
if (code === "missing_credential") return "No passkey was selected.";
|
|
1335
|
+
return "Something went wrong signing in with your passkey.";
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
// src/AppInstallButtons.tsx
|
|
1339
|
+
import { useEffect as useEffect8, useId as useId6, useState as useState8 } from "react";
|
|
1340
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
800
1341
|
var STYLE_ID2 = "dexter-connect-appinstall-styles";
|
|
801
1342
|
var APPINSTALL_CSS = `
|
|
802
1343
|
.dx-appinstall{ display:flex; flex-wrap:wrap; gap:10px; }
|
|
@@ -921,7 +1462,7 @@ async function copyText(text) {
|
|
|
921
1462
|
}
|
|
922
1463
|
}
|
|
923
1464
|
function useCopyStatus() {
|
|
924
|
-
const [status, setStatus] =
|
|
1465
|
+
const [status, setStatus] = useState8("idle");
|
|
925
1466
|
return [status, (next) => setStatus(next)];
|
|
926
1467
|
}
|
|
927
1468
|
function appCx(block) {
|
|
@@ -937,8 +1478,8 @@ function AppInstallButtons(props) {
|
|
|
937
1478
|
className,
|
|
938
1479
|
onAction
|
|
939
1480
|
} = props;
|
|
940
|
-
|
|
941
|
-
const statusId =
|
|
1481
|
+
useEffect8(ensureAppInstallStyles, []);
|
|
1482
|
+
const statusId = useId6();
|
|
942
1483
|
const hermesCommand = hermesInstallCommand(serverName, mcpUrl);
|
|
943
1484
|
const claudeCommand = claudeCodeInstallCommand(serverName, mcpUrl);
|
|
944
1485
|
const [hermesStatus, markHermes] = useCopyStatus();
|
|
@@ -946,7 +1487,7 @@ function AppInstallButtons(props) {
|
|
|
946
1487
|
const hermesErrorId = `${statusId}-hermes-error`;
|
|
947
1488
|
const claudeErrorId = `${statusId}-claude-error`;
|
|
948
1489
|
const buttons = {
|
|
949
|
-
claude: /* @__PURE__ */
|
|
1490
|
+
claude: /* @__PURE__ */ jsxs6(
|
|
950
1491
|
"a",
|
|
951
1492
|
{
|
|
952
1493
|
className: appCx(block),
|
|
@@ -955,13 +1496,13 @@ function AppInstallButtons(props) {
|
|
|
955
1496
|
rel: "noopener noreferrer",
|
|
956
1497
|
onClick: () => onAction?.("claude", "deeplink"),
|
|
957
1498
|
children: [
|
|
958
|
-
/* @__PURE__ */
|
|
1499
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: CLAUDE_MARK, alt: "", "aria-hidden": true }),
|
|
959
1500
|
"Open in Claude"
|
|
960
1501
|
]
|
|
961
1502
|
},
|
|
962
1503
|
"claude"
|
|
963
1504
|
),
|
|
964
|
-
chatgpt: /* @__PURE__ */
|
|
1505
|
+
chatgpt: /* @__PURE__ */ jsxs6(
|
|
965
1506
|
"a",
|
|
966
1507
|
{
|
|
967
1508
|
className: appCx(block),
|
|
@@ -970,39 +1511,39 @@ function AppInstallButtons(props) {
|
|
|
970
1511
|
rel: "noopener noreferrer",
|
|
971
1512
|
onClick: () => onAction?.("chatgpt", "deeplink"),
|
|
972
1513
|
children: [
|
|
973
|
-
/* @__PURE__ */
|
|
1514
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: CHATGPT_MARK, alt: "", "aria-hidden": true }),
|
|
974
1515
|
"Open ChatGPT plugins"
|
|
975
1516
|
]
|
|
976
1517
|
},
|
|
977
1518
|
"chatgpt"
|
|
978
1519
|
),
|
|
979
|
-
cursor: /* @__PURE__ */
|
|
1520
|
+
cursor: /* @__PURE__ */ jsxs6(
|
|
980
1521
|
"a",
|
|
981
1522
|
{
|
|
982
1523
|
className: appCx(block),
|
|
983
1524
|
href: cursorInstallUrl(serverName, mcpUrl),
|
|
984
1525
|
onClick: () => onAction?.("cursor", "deeplink"),
|
|
985
1526
|
children: [
|
|
986
|
-
/* @__PURE__ */
|
|
1527
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: CURSOR_MARK, alt: "", "aria-hidden": true }),
|
|
987
1528
|
"Add to Cursor"
|
|
988
1529
|
]
|
|
989
1530
|
},
|
|
990
1531
|
"cursor"
|
|
991
1532
|
),
|
|
992
|
-
vscode: /* @__PURE__ */
|
|
1533
|
+
vscode: /* @__PURE__ */ jsxs6(
|
|
993
1534
|
"a",
|
|
994
1535
|
{
|
|
995
1536
|
className: appCx(block),
|
|
996
1537
|
href: vscodeInstallUrl(serverName, mcpUrl),
|
|
997
1538
|
onClick: () => onAction?.("vscode", "deeplink"),
|
|
998
1539
|
children: [
|
|
999
|
-
/* @__PURE__ */
|
|
1540
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: VSCODE_MARK, alt: "", "aria-hidden": true }),
|
|
1000
1541
|
"Add to VS Code"
|
|
1001
1542
|
]
|
|
1002
1543
|
},
|
|
1003
1544
|
"vscode"
|
|
1004
1545
|
),
|
|
1005
|
-
hermes: /* @__PURE__ */
|
|
1546
|
+
hermes: /* @__PURE__ */ jsxs6(
|
|
1006
1547
|
"button",
|
|
1007
1548
|
{
|
|
1008
1549
|
type: "button",
|
|
@@ -1020,13 +1561,13 @@ function AppInstallButtons(props) {
|
|
|
1020
1561
|
}
|
|
1021
1562
|
},
|
|
1022
1563
|
children: [
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
hermesStatus === "copied" ? /* @__PURE__ */
|
|
1564
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: HERMES_MARK, alt: "", "aria-hidden": true }),
|
|
1565
|
+
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
1566
|
]
|
|
1026
1567
|
},
|
|
1027
1568
|
"hermes"
|
|
1028
1569
|
),
|
|
1029
|
-
"claude-code": /* @__PURE__ */
|
|
1570
|
+
"claude-code": /* @__PURE__ */ jsxs6(
|
|
1030
1571
|
"button",
|
|
1031
1572
|
{
|
|
1032
1573
|
type: "button",
|
|
@@ -1044,14 +1585,14 @@ function AppInstallButtons(props) {
|
|
|
1044
1585
|
}
|
|
1045
1586
|
},
|
|
1046
1587
|
children: [
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
claudeStatus === "copied" ? /* @__PURE__ */
|
|
1588
|
+
/* @__PURE__ */ jsx7("img", { className: "dx-appbtn__logo", src: CLAUDE_MARK, alt: "", "aria-hidden": true }),
|
|
1589
|
+
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
1590
|
]
|
|
1050
1591
|
},
|
|
1051
1592
|
"claude-code"
|
|
1052
1593
|
)
|
|
1053
1594
|
};
|
|
1054
|
-
return /* @__PURE__ */
|
|
1595
|
+
return /* @__PURE__ */ jsxs6(
|
|
1055
1596
|
"div",
|
|
1056
1597
|
{
|
|
1057
1598
|
className: ["dx-appinstall", block ? "dx-appinstall--block" : "", className ?? ""].filter(Boolean).join(" "),
|
|
@@ -1059,13 +1600,13 @@ function AppInstallButtons(props) {
|
|
|
1059
1600
|
"aria-label": `Add ${displayName} to an agent app`,
|
|
1060
1601
|
children: [
|
|
1061
1602
|
apps.map((app) => buttons[app] ?? null),
|
|
1062
|
-
/* @__PURE__ */
|
|
1603
|
+
/* @__PURE__ */ jsx7("span", { className: "dx-appinstall__sr-only", "aria-live": "polite", "aria-atomic": "true", children: [
|
|
1063
1604
|
hermesStatus === "copied" ? "Hermes OAuth setup command copied." : "",
|
|
1064
1605
|
claudeStatus === "copied" ? "Claude Code setup command copied." : ""
|
|
1065
1606
|
].filter(Boolean).join(" ") }),
|
|
1066
|
-
hermesStatus === "copied" ? /* @__PURE__ */
|
|
1067
|
-
/* @__PURE__ */
|
|
1068
|
-
/* @__PURE__ */
|
|
1607
|
+
hermesStatus === "copied" ? /* @__PURE__ */ jsxs6("div", { className: "dx-appinstall__notice", children: [
|
|
1608
|
+
/* @__PURE__ */ jsx7("p", { children: "Run the command in your terminal. It adds the hosted MCP with OAuth." }),
|
|
1609
|
+
/* @__PURE__ */ jsx7(
|
|
1069
1610
|
"a",
|
|
1070
1611
|
{
|
|
1071
1612
|
className: "dx-appinstall__open",
|
|
@@ -1076,9 +1617,9 @@ function AppInstallButtons(props) {
|
|
|
1076
1617
|
}
|
|
1077
1618
|
)
|
|
1078
1619
|
] }) : null,
|
|
1079
|
-
hermesStatus === "failed" ? /* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
/* @__PURE__ */
|
|
1620
|
+
hermesStatus === "failed" ? /* @__PURE__ */ jsxs6("div", { id: hermesErrorId, className: "dx-appinstall__error", role: "alert", children: [
|
|
1621
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: `${hermesErrorId}-command`, children: "Couldn't copy. Select this Hermes command and run it in your terminal." }),
|
|
1622
|
+
/* @__PURE__ */ jsx7(
|
|
1082
1623
|
"input",
|
|
1083
1624
|
{
|
|
1084
1625
|
id: `${hermesErrorId}-command`,
|
|
@@ -1089,14 +1630,14 @@ function AppInstallButtons(props) {
|
|
|
1089
1630
|
}
|
|
1090
1631
|
)
|
|
1091
1632
|
] }) : null,
|
|
1092
|
-
claudeStatus === "copied" ? /* @__PURE__ */
|
|
1633
|
+
claudeStatus === "copied" ? /* @__PURE__ */ jsx7("div", { className: "dx-appinstall__notice", children: /* @__PURE__ */ jsxs6("p", { children: [
|
|
1093
1634
|
"Run the command in your terminal. If sign-in is required, finish it from Claude Code's ",
|
|
1094
|
-
/* @__PURE__ */
|
|
1635
|
+
/* @__PURE__ */ jsx7("code", { children: "/mcp" }),
|
|
1095
1636
|
" menu."
|
|
1096
1637
|
] }) }) : null,
|
|
1097
|
-
claudeStatus === "failed" ? /* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1638
|
+
claudeStatus === "failed" ? /* @__PURE__ */ jsxs6("div", { id: claudeErrorId, className: "dx-appinstall__error", role: "alert", children: [
|
|
1639
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: `${claudeErrorId}-command`, children: "Couldn't copy. Select this Claude Code command and run it in your terminal." }),
|
|
1640
|
+
/* @__PURE__ */ jsx7(
|
|
1100
1641
|
"input",
|
|
1101
1642
|
{
|
|
1102
1643
|
id: `${claudeErrorId}-command`,
|
|
@@ -1115,6 +1656,9 @@ export {
|
|
|
1115
1656
|
AllowanceChips,
|
|
1116
1657
|
AppInstallButtons,
|
|
1117
1658
|
CreateWalletPanel,
|
|
1659
|
+
DEFAULT_ACCOUNT_NAVIGATION,
|
|
1660
|
+
DexterAccountControl,
|
|
1661
|
+
DexterAccountSummary,
|
|
1118
1662
|
DexterButton,
|
|
1119
1663
|
DexterMark,
|
|
1120
1664
|
REMOVE_DEXTER_FROM_DEVICE_CONFIRMATION,
|