@dexterai/connect 0.25.1 → 0.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,7 @@ var BUTTON_CSS = `
|
|
|
7
7
|
@keyframes dx-pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
|
|
8
8
|
.dx-btn{
|
|
9
9
|
position:relative; display:inline-flex; align-items:center; justify-content:center; gap:10px;
|
|
10
|
-
padding:11px 22px; border:1px solid color-mix(in srgb,var(--dx-ember,#f26c18) 55%,transparent);
|
|
10
|
+
min-height:48px; padding:11px 22px; border:1px solid color-mix(in srgb,var(--dx-ember,#f26c18) 55%,transparent);
|
|
11
11
|
border-radius:var(--dx-radius,0px);
|
|
12
12
|
background:linear-gradient(135deg,var(--dx-ember,#f26c18),var(--dx-ember-2,#ba3a00));
|
|
13
13
|
color:var(--dx-fg,#fff4ea); font:inherit; font-weight:600; font-size:.78rem; letter-spacing:.12em;
|
|
@@ -44,7 +44,7 @@ var BUTTON_CSS = `
|
|
|
44
44
|
.dx-btn--danger:focus-visible{ box-shadow:0 0 0 3px color-mix(in srgb,var(--dx-danger,#b3261e) 38%,transparent); }
|
|
45
45
|
.dx-btn--block{ width:100%; }
|
|
46
46
|
.dx-btn--sm{
|
|
47
|
-
padding:7px 14px; gap:7px; font-size:.66rem; letter-spacing:.1em;
|
|
47
|
+
min-height:40px; padding:7px 14px; gap:7px; font-size:.66rem; letter-spacing:.1em;
|
|
48
48
|
box-shadow:0 8px 16px color-mix(in srgb,var(--dx-ember,#f26c18) 18%,transparent);
|
|
49
49
|
}
|
|
50
50
|
.dx-btn--sm:hover{ box-shadow:0 12px 22px color-mix(in srgb,var(--dx-ember,#f26c18) 26%,transparent); }
|
|
@@ -62,6 +62,11 @@ var BUTTON_CSS = `
|
|
|
62
62
|
.dx-chip__bal{ font-weight:600; opacity:.85; }
|
|
63
63
|
.dx-chip__x{ margin-left:2px; border:none; background:transparent; color:inherit; cursor:pointer; font-size:16px; line-height:1; opacity:.6; }
|
|
64
64
|
.dx-chip__x:hover{ opacity:1; }
|
|
65
|
+
@media (prefers-reduced-motion:reduce){
|
|
66
|
+
.dx-btn{ transition:none; }
|
|
67
|
+
.dx-btn:hover,.dx-btn:active{ transform:none; }
|
|
68
|
+
.dx-btn__spin,.dx-btn__doing{ animation:none; }
|
|
69
|
+
}
|
|
65
70
|
`;
|
|
66
71
|
function ensureDexterButtonStyles() {
|
|
67
72
|
if (typeof document === "undefined") return;
|
package/dist/index.js
CHANGED
package/dist/react.d.ts
CHANGED
|
@@ -230,6 +230,8 @@ interface AllowanceChipsProps {
|
|
|
230
230
|
onChange: (usd: string | null) => void;
|
|
231
231
|
/** Extra className composed after the brand classes. */
|
|
232
232
|
className?: string;
|
|
233
|
+
/** Disable every choice and the custom amount field. */
|
|
234
|
+
disabled?: boolean;
|
|
233
235
|
}
|
|
234
236
|
/** The consent-at-birth allowance chips. */
|
|
235
237
|
declare function AllowanceChips(props: AllowanceChipsProps): ReactElement;
|
package/dist/react.js
CHANGED
|
@@ -16,15 +16,16 @@ import {
|
|
|
16
16
|
renamePasskey,
|
|
17
17
|
resolveIdentity,
|
|
18
18
|
setActiveHandle,
|
|
19
|
+
shouldUsePopup,
|
|
19
20
|
subscribe,
|
|
20
21
|
switchWallet
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-4AJ5BYFW.js";
|
|
22
23
|
import {
|
|
23
24
|
DexterButton,
|
|
24
25
|
DexterMark,
|
|
25
26
|
cx,
|
|
26
27
|
ensureDexterButtonStyles
|
|
27
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-TLCQSAE5.js";
|
|
28
29
|
|
|
29
30
|
// src/useSignInWithDexter.ts
|
|
30
31
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
@@ -471,16 +472,28 @@ function useIdentity({ accountToken }) {
|
|
|
471
472
|
}
|
|
472
473
|
|
|
473
474
|
// src/AllowanceChips.tsx
|
|
474
|
-
import { useEffect as useEffect6, useState as useState4 } from "react";
|
|
475
|
+
import { useEffect as useEffect6, useId, useState as useState4 } from "react";
|
|
475
476
|
|
|
476
477
|
// src/consentStyles.ts
|
|
477
478
|
var STYLE_ID2 = "dexter-connect-consent-styles";
|
|
478
479
|
var CONSENT_CSS = `
|
|
479
480
|
.dx-allow{
|
|
480
|
-
display:flex; flex-wrap:wrap; gap:8px; align-items:center;
|
|
481
|
+
display:flex; flex-wrap:wrap; gap:8px; align-items:center; min-width:0;
|
|
482
|
+
margin:0; padding:0; border:0;
|
|
483
|
+
}
|
|
484
|
+
.dx-sr-only{
|
|
485
|
+
position:absolute; width:1px; height:1px; padding:0; margin:-1px;
|
|
486
|
+
overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
|
|
487
|
+
}
|
|
488
|
+
.dx-allow__option{
|
|
489
|
+
display:inline-flex; min-width:0;
|
|
490
|
+
}
|
|
491
|
+
.dx-allow__radio{
|
|
492
|
+
position:absolute; width:1px; height:1px; margin:-1px; opacity:0;
|
|
493
|
+
pointer-events:none;
|
|
481
494
|
}
|
|
482
495
|
.dx-allow__chip{
|
|
483
|
-
display:inline-flex; align-items:center; justify-content:center; padding:9px 15px;
|
|
496
|
+
display:inline-flex; min-height:44px; align-items:center; justify-content:center; padding:9px 15px;
|
|
484
497
|
font:inherit; font-weight:600; font-size:.78rem; letter-spacing:.12em; text-transform:uppercase;
|
|
485
498
|
font-variant-numeric:tabular-nums; cursor:pointer; background:transparent; color:inherit;
|
|
486
499
|
border:1px solid color-mix(in srgb,var(--dx-ember,#f26c18) 45%,transparent);
|
|
@@ -488,14 +501,17 @@ var CONSENT_CSS = `
|
|
|
488
501
|
transition:filter .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
|
|
489
502
|
}
|
|
490
503
|
.dx-allow__chip:hover{ border-color:color-mix(in srgb,var(--dx-ember,#f26c18) 70%,transparent); filter:brightness(1.05); }
|
|
491
|
-
.dx-
|
|
492
|
-
|
|
504
|
+
.dx-allow__radio:focus-visible + .dx-allow__chip{
|
|
505
|
+
outline:none; box-shadow:0 0 0 3px color-mix(in srgb,var(--dx-ember,#f26c18) 34%,transparent);
|
|
506
|
+
}
|
|
507
|
+
.dx-allow__radio:checked + .dx-allow__chip{
|
|
493
508
|
background:linear-gradient(135deg,var(--dx-ember,#f26c18),var(--dx-ember-2,#ba3a00));
|
|
494
509
|
color:var(--dx-fg,#fff4ea); border-color:color-mix(in srgb,var(--dx-ember,#f26c18) 55%,transparent);
|
|
495
510
|
box-shadow:0 10px 22px color-mix(in srgb,var(--dx-ember,#f26c18) 22%,transparent);
|
|
496
511
|
}
|
|
512
|
+
.dx-allow__radio:disabled + .dx-allow__chip{ cursor:default; opacity:.58; }
|
|
497
513
|
.dx-allow__input{
|
|
498
|
-
flex:1 1 130px; min-width:120px; padding:9px 13px; font:inherit; font-size
|
|
514
|
+
flex:1 1 130px; min-width:120px; min-height:44px; padding:9px 13px; font:inherit; font-size:1rem;
|
|
499
515
|
font-variant-numeric:tabular-nums; color:inherit; background:transparent;
|
|
500
516
|
border:1px solid color-mix(in srgb,var(--dx-ember,#f26c18) 45%,transparent);
|
|
501
517
|
border-radius:var(--dx-radius,0px); -webkit-tap-highlight-color:transparent;
|
|
@@ -513,7 +529,7 @@ var CONSENT_CSS = `
|
|
|
513
529
|
.dx-cwp__field{ display:flex; flex-direction:column; gap:8px; }
|
|
514
530
|
.dx-cwp__label{ font-size:.7rem; font-weight:700; letter-spacing:.14em; text-transform:uppercase; opacity:.62; }
|
|
515
531
|
.dx-cwp__name{
|
|
516
|
-
padding:10px 13px; font:inherit; font-size
|
|
532
|
+
min-height:48px; padding:10px 13px; font:inherit; font-size:1rem; color:inherit; background:transparent;
|
|
517
533
|
border:1px solid color-mix(in srgb,currentColor 22%,transparent); border-radius:var(--dx-radius,0px);
|
|
518
534
|
-webkit-tap-highlight-color:transparent; transition:border-color .16s ease, box-shadow .16s ease;
|
|
519
535
|
}
|
|
@@ -522,8 +538,19 @@ var CONSENT_CSS = `
|
|
|
522
538
|
box-shadow:0 0 0 3px color-mix(in srgb,var(--dx-ember,#f26c18) 26%,transparent);
|
|
523
539
|
}
|
|
524
540
|
.dx-cwp__name::placeholder{ color:currentColor; opacity:.42; }
|
|
541
|
+
.dx-cwp__hosted{ margin:0; font-size:.9rem; line-height:1.55; opacity:.82; }
|
|
525
542
|
.dx-cwp__fine{ font-size:.76rem; line-height:1.5; opacity:.66; }
|
|
526
543
|
.dx-cwp__err{ font-size:.78rem; line-height:1.45; color:var(--dx-danger,#e5552e); }
|
|
544
|
+
.dx-cwp__status{ min-height:1.25rem; margin:0; font-size:.78rem; line-height:1.45; opacity:.72; }
|
|
545
|
+
@media (max-width:380px){
|
|
546
|
+
.dx-allow__option{ flex:1 1 calc(50% - 4px); }
|
|
547
|
+
.dx-allow__chip{ width:100%; }
|
|
548
|
+
.dx-allow__input{ flex-basis:100%; }
|
|
549
|
+
}
|
|
550
|
+
@media (prefers-reduced-motion:reduce){
|
|
551
|
+
.dx-allow__chip,.dx-allow__input,.dx-cwp__name{ transition:none; }
|
|
552
|
+
.dx-allow__chip:hover{ filter:none; }
|
|
553
|
+
}
|
|
527
554
|
`;
|
|
528
555
|
function ensureConsentStyles() {
|
|
529
556
|
if (typeof document === "undefined") return;
|
|
@@ -545,61 +572,64 @@ var PRESETS = [
|
|
|
545
572
|
var PRESET_NUMS = PRESETS.map((p) => p.num);
|
|
546
573
|
var isPreset = (v) => v !== null && PRESET_NUMS.includes(v);
|
|
547
574
|
function AllowanceChips(props) {
|
|
548
|
-
const { value, onChange, className } = props;
|
|
575
|
+
const { value, onChange, className, disabled = false } = props;
|
|
549
576
|
useEffect6(ensureConsentStyles, []);
|
|
550
577
|
const [customOpen, setCustomOpen] = useState4(false);
|
|
578
|
+
const groupName = useId();
|
|
551
579
|
const customActive = customOpen || value !== null && !isPreset(value);
|
|
552
580
|
const selectPreset = (num) => {
|
|
581
|
+
if (disabled) return;
|
|
553
582
|
setCustomOpen(false);
|
|
554
583
|
onChange(num);
|
|
555
584
|
};
|
|
556
585
|
const selectCustom = () => {
|
|
586
|
+
if (disabled) return;
|
|
557
587
|
setCustomOpen(true);
|
|
558
588
|
onChange(isPreset(value) ? null : value);
|
|
559
589
|
};
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
e.preventDefault();
|
|
563
|
-
select();
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
return /* @__PURE__ */ jsxs4("div", { className: cx("dx-allow", className), role: "radiogroup", "aria-label": "Monthly agent allowance", children: [
|
|
590
|
+
return /* @__PURE__ */ jsxs4("fieldset", { className: cx("dx-allow", className), disabled, children: [
|
|
591
|
+
/* @__PURE__ */ jsx4("legend", { className: "dx-sr-only", children: "Monthly agent allowance" }),
|
|
567
592
|
PRESETS.map(({ label, num }) => {
|
|
568
593
|
const checked = !customActive && value === num;
|
|
569
|
-
return /* @__PURE__ */
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
594
|
+
return /* @__PURE__ */ jsxs4("label", { className: "dx-allow__option", children: [
|
|
595
|
+
/* @__PURE__ */ jsx4(
|
|
596
|
+
"input",
|
|
597
|
+
{
|
|
598
|
+
className: "dx-allow__radio",
|
|
599
|
+
type: "radio",
|
|
600
|
+
name: groupName,
|
|
601
|
+
value: num,
|
|
602
|
+
checked,
|
|
603
|
+
onChange: () => selectPreset(num)
|
|
604
|
+
}
|
|
605
|
+
),
|
|
606
|
+
/* @__PURE__ */ jsx4("span", { className: "dx-allow__chip", children: label })
|
|
607
|
+
] }, num);
|
|
582
608
|
}),
|
|
583
|
-
/* @__PURE__ */
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
609
|
+
/* @__PURE__ */ jsxs4("label", { className: "dx-allow__option", children: [
|
|
610
|
+
/* @__PURE__ */ jsx4(
|
|
611
|
+
"input",
|
|
612
|
+
{
|
|
613
|
+
className: "dx-allow__radio",
|
|
614
|
+
type: "radio",
|
|
615
|
+
name: groupName,
|
|
616
|
+
value: "custom",
|
|
617
|
+
checked: customActive,
|
|
618
|
+
onChange: selectCustom
|
|
619
|
+
}
|
|
620
|
+
),
|
|
621
|
+
/* @__PURE__ */ jsx4("span", { className: "dx-allow__chip", children: "Custom" })
|
|
622
|
+
] }),
|
|
595
623
|
customActive && /* @__PURE__ */ jsx4(
|
|
596
624
|
"input",
|
|
597
625
|
{
|
|
598
626
|
className: "dx-allow__input",
|
|
627
|
+
id: `${groupName}-custom`,
|
|
599
628
|
inputMode: "decimal",
|
|
600
629
|
placeholder: "$ amount",
|
|
601
630
|
"aria-label": "Custom monthly allowance in USD",
|
|
602
631
|
value: value ?? "",
|
|
632
|
+
disabled,
|
|
603
633
|
autoFocus: true,
|
|
604
634
|
onChange: (e) => onChange(e.target.value)
|
|
605
635
|
}
|
|
@@ -608,29 +638,38 @@ function AllowanceChips(props) {
|
|
|
608
638
|
}
|
|
609
639
|
|
|
610
640
|
// src/CreateWalletPanel.tsx
|
|
611
|
-
import { useEffect as useEffect7, useState as useState5 } from "react";
|
|
612
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
613
|
-
var FINE_PRINT = "
|
|
641
|
+
import { useEffect as useEffect7, useId as useId2, useState as useState5 } from "react";
|
|
642
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
643
|
+
var FINE_PRINT = "This is the wallet-wide agent allowance. You can revoke it anytime. Starter credit, if available, is separate and never raises this limit.";
|
|
614
644
|
function CreateWalletPanel(props) {
|
|
615
645
|
const { onCreated, onError, apiBase, transport, showName = true, className } = props;
|
|
616
646
|
useEffect7(ensureConsentStyles, []);
|
|
617
647
|
useEffect7(ensureDexterButtonStyles, []);
|
|
648
|
+
const nameInputId = useId2();
|
|
618
649
|
const [name, setName] = useState5("");
|
|
619
650
|
const [value, setValue] = useState5(null);
|
|
620
651
|
const [running, setRunning] = useState5(false);
|
|
621
652
|
const [phase, setPhase] = useState5(null);
|
|
622
653
|
const [error, setError] = useState5(null);
|
|
623
|
-
const
|
|
654
|
+
const [resolvedTransport, setResolvedTransport] = useState5(
|
|
655
|
+
transport === "inline" ? "inline" : transport === "popup" ? "popup" : "unknown"
|
|
656
|
+
);
|
|
657
|
+
useEffect7(() => {
|
|
658
|
+
setResolvedTransport(shouldUsePopup(transport) ? "popup" : "inline");
|
|
659
|
+
}, [transport]);
|
|
660
|
+
const hosted = resolvedTransport === "popup";
|
|
661
|
+
const policy = resolvedTransport === "inline" ? authoredPolicy(value ?? "") : null;
|
|
662
|
+
const canContinue = hosted || Boolean(policy);
|
|
624
663
|
const handleCreate = async () => {
|
|
625
664
|
if (running) return;
|
|
626
|
-
if (!policy) return;
|
|
665
|
+
if (resolvedTransport === "unknown" || !hosted && !policy) return;
|
|
627
666
|
setError(null);
|
|
628
667
|
setRunning(true);
|
|
629
668
|
setPhase(null);
|
|
630
669
|
try {
|
|
631
670
|
const result = await createWallet({
|
|
632
|
-
name: name.trim() || "Dexter Wallet",
|
|
633
|
-
spendPolicy: policy,
|
|
671
|
+
name: hosted ? void 0 : name.trim() || "Dexter Wallet",
|
|
672
|
+
spendPolicy: hosted ? void 0 : policy ?? void 0,
|
|
634
673
|
apiBase,
|
|
635
674
|
transport,
|
|
636
675
|
onPhase: setPhase
|
|
@@ -646,27 +685,31 @@ function CreateWalletPanel(props) {
|
|
|
646
685
|
}
|
|
647
686
|
};
|
|
648
687
|
return /* @__PURE__ */ jsxs5("div", { className: cx("dx-cwp", className), children: [
|
|
649
|
-
showName && /* @__PURE__ */ jsxs5("div", { className: "dx-cwp__field", children: [
|
|
650
|
-
/* @__PURE__ */ jsx5("label", { className: "dx-cwp__label", htmlFor:
|
|
688
|
+
!hosted && resolvedTransport === "inline" && showName && /* @__PURE__ */ jsxs5("div", { className: "dx-cwp__field", children: [
|
|
689
|
+
/* @__PURE__ */ jsx5("label", { className: "dx-cwp__label", htmlFor: nameInputId, children: "Name your wallet" }),
|
|
651
690
|
/* @__PURE__ */ jsx5(
|
|
652
691
|
"input",
|
|
653
692
|
{
|
|
654
|
-
id:
|
|
693
|
+
id: nameInputId,
|
|
655
694
|
className: "dx-cwp__name",
|
|
656
695
|
maxLength: 40,
|
|
657
696
|
placeholder: "Dexter Wallet",
|
|
658
697
|
value: name,
|
|
659
698
|
disabled: running,
|
|
699
|
+
autoComplete: "off",
|
|
660
700
|
onChange: (e) => setName(e.target.value)
|
|
661
701
|
}
|
|
662
702
|
)
|
|
663
703
|
] }),
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
704
|
+
hosted ? /* @__PURE__ */ jsx5("p", { className: "dx-cwp__hosted", children: "Dexter will open its secure wallet window. Choose the wallet name and agent allowance there before your passkey creates anything." }) : resolvedTransport === "inline" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
705
|
+
/* @__PURE__ */ jsxs5("div", { className: "dx-cwp__field", children: [
|
|
706
|
+
/* @__PURE__ */ jsx5("span", { className: "dx-cwp__label", children: "What agents may spend automatically, per 30 days" }),
|
|
707
|
+
/* @__PURE__ */ jsx5(AllowanceChips, { value, onChange: setValue, disabled: running })
|
|
708
|
+
] }),
|
|
709
|
+
/* @__PURE__ */ jsx5("p", { className: "dx-cwp__fine", children: FINE_PRINT })
|
|
710
|
+
] }) : null,
|
|
711
|
+
error && /* @__PURE__ */ jsx5("div", { className: "dx-cwp__err", role: "alert", "aria-live": "assertive", children: error.message || error.code }),
|
|
712
|
+
/* @__PURE__ */ jsx5("p", { className: "dx-cwp__status", role: "status", "aria-live": "polite", children: running ? phase ? ceremonyPhaseLabel(phase) : "Starting your passkey\u2026" : resolvedTransport === "unknown" ? "Preparing secure wallet setup\u2026" : hosted ? "Name, allowance, and passkey confirmation happen in the Dexter window." : policy ? "Allowance selected. Your passkey will create and secure the wallet." : "Choose an allowance to continue." }),
|
|
670
713
|
/* @__PURE__ */ jsx5(
|
|
671
714
|
DexterButton,
|
|
672
715
|
{
|
|
@@ -674,16 +717,16 @@ function CreateWalletPanel(props) {
|
|
|
674
717
|
className: "dx-cwp__cta",
|
|
675
718
|
loading: running,
|
|
676
719
|
loadingLabel: phase ? ceremonyPhaseLabel(phase) : "Creating\u2026",
|
|
677
|
-
disabled: !
|
|
720
|
+
disabled: !canContinue || resolvedTransport === "unknown",
|
|
678
721
|
onClick: handleCreate,
|
|
679
|
-
children: error ? "Retry" : "Create your Dexter Wallet"
|
|
722
|
+
children: error ? "Retry" : hosted ? "Continue to Dexter Wallet" : "Create your Dexter Wallet"
|
|
680
723
|
}
|
|
681
724
|
)
|
|
682
725
|
] });
|
|
683
726
|
}
|
|
684
727
|
|
|
685
728
|
// src/AppInstallButtons.tsx
|
|
686
|
-
import { useEffect as useEffect8, useId, useState as useState6 } from "react";
|
|
729
|
+
import { useEffect as useEffect8, useId as useId3, useState as useState6 } from "react";
|
|
687
730
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
688
731
|
var STYLE_ID3 = "dexter-connect-appinstall-styles";
|
|
689
732
|
var APPINSTALL_CSS = `
|
|
@@ -812,7 +855,7 @@ function AppInstallButtons(props) {
|
|
|
812
855
|
onAction
|
|
813
856
|
} = props;
|
|
814
857
|
useEffect8(ensureAppInstallStyles, []);
|
|
815
|
-
const statusId =
|
|
858
|
+
const statusId = useId3();
|
|
816
859
|
const hermesCommand = hermesInstallCommand(serverName, mcpUrl);
|
|
817
860
|
const claudeCommand = claudeCodeInstallCommand(serverName, mcpUrl);
|
|
818
861
|
const [hermesStatus, markHermes] = useCopyStatus();
|
package/dist/worldid.js
CHANGED