Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat: walk dashboard page, x402 payment modal updates, changelog

nirholas13ddf9addfe1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b8961ee9a..3840e86a9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Creator royalty payouts protected against double-settlement** — Royalty payouts to skill authors now claim each pending amount atomically before sending funds on-chain, so two overlapping settlement runs can never pay the same balance twice. Creators are paid exactly once for what they've earned. `[fix]`
- **Discovery now shows only real creator avatars** — The Explore / discovery feed previously padded itself with a set of built-in sample avatars and counted them in the totals. The feed and its counts now reflect only real avatars created by the community — no filler. (`/explore`) `[improvement]`
- **Drop agents on your real floor with AR precision** — On Android phones that support AR, placing an agent in your room is now pinpoint: point at the floor, a reticle locks onto the real ground, and you tap to drop the agent exactly where you're looking — feet on the actual floor, not floating at a guess. It anchors into the same shared room as the rest of your agents, so everyone who opens IRL at that spot — including iPhones — sees it in the same place, and you can re-tap “Refine on floor” on one of your agents to sharpen just its spot without nudging the others. iPhones and phones without AR keep the aim-and-distance flow they already had, with no extra buttons and nothing that doesn't work — every device gets the best placement it can do. (`/irl`) `[feature]`
+- **Every avatar now animates — VRoid, Daz, Blender and more walk out of the box** — Bring any humanoid avatar and it just moves. The animation engine now recognizes every common character skeleton — VRoid/VRM, VRM 1.0, Daz/Genesis, MakeHuman, Blender, Unreal, Mixamo and simple game rigs — and retargets the idle and walk onto it, legs and all. No more characters frozen in a stiff T-pose because their bones were named differently. Anything that genuinely can't be animated (a non-humanoid prop with no skeleton) gracefully wears the default body instead of locking up. No allowlist, no per-avatar setup. `[improvement]`
- **Every IRL moment now has a designed, honest state** — IRL asks for the three most sensitive permissions a web app can — camera, motion, and location — and we made every moment around them feel deliberate instead of uncertain. While your phone is still finding your GPS fix, the top bar shows a clear "Finding your location…" shimmer so the wait never looks like an empty, nobody-here screen. If discovery ever has to slow down to catch its breath, you get a calm "catching up…" note that quietly recovers on its own — never a scary error. The live-presence indicator stays honest too: when it drops, nearby discovery keeps working and nothing implies otherwise. Every control is now reachable by keyboard with a visible focus ring, screen readers announce each state change once, and all of it respects reduced-motion settings. (`/irl`) `[improvement]`
- **Every page now shares with its own social card** — Share any three.ws page on X, Discord, Slack, iMessage, or LinkedIn and the link now previews with a branded card built for that exact page — its title, its one-line description, and a colour that matches the section it belongs to — instead of one generic image for the whole site. The cards render as real PNGs so they show up everywhere (not just the apps that handle SVG), and they're generated on the fly from the same page catalog that feeds the sitemap, so the preview always matches what's actually on the page. We also tightened the behind-the-scenes SEO on every page: cleaner canonical links, richer structured data with breadcrumbs, and crawler hints that let search engines show large image previews. `[improvement, infra]`
- **Filter the avatar gallery by rigged vs static** — Every public avatar is now classified by whether it carries a skeleton — rigged models can play the animation library straight away, while static ones are geometry only until you auto-rig them. The gallery shows a green "Rigged" or grey "Not rigged" badge in the corner of each card, adds a Rig filter so you can show just the animation-ready avatars, and a "Rigged first" sort. Deep links keep your filter, so you can share a view of only the rigged avatars. (`/gallery`) `[feature]`
@@ -67,6 +68,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Smoother switch between camera AR and Place on floor** — On phones that can anchor an agent to your real floor, flipping between plain Camera AR and the Place on floor flow is now seamless. Before, tapping the two in quick succession could fight over the camera and leave you on a black screen with the camera light stuck on; now each switch waits for the previous one to finish releasing the camera, so it never double-grabs it. Leaving a floor session drops you straight back into the live camera view you came from — passthrough resumes instantly instead of flashing a dark frame — and taps on the screen behind the floor-anchor panel no longer slip through to open the wrong thing. If a floor session can't start, the scene keeps running and you get the calm "use Pin here instead" card rather than a frozen view. (`/irl`) `[fix]`
- **Switching avatars in the Club never freezes you in a T-pose** — The Club's avatar switcher lists public gallery rigs alongside the built-in ones, and not every gallery model is a humanoid our dance and walk clips can drive. Picking one of those used to leave your character frozen stiff, arms out, sliding around without moving her legs. Now the Club checks that a chosen avatar can actually be animated before committing to it — if it can't, it instantly rolls back to the one you were already walking as and tells you why, so your character keeps idling and walking with her legs moving no matter what you pick. (`/club`) `[fix]`
- **Tapping an agent in AR now lands every time** — Inspecting an agent in IRL AR is a tap — and we made that tap far harder to miss. There's now a finger-sized catch zone around each agent's floating name, so a tap that lands just beside a small or distant agent still opens its card instead of doing nothing. When several agents overlap on screen, your tap resolves to the one in front of you, and it never selects an agent that's behind you or off-screen. We also kept agents from vanishing when you bring your phone right up to one to look closely. Inspecting works whether the agent is centered, near the edge of the frame, close, or far. (`/irl`) `[improvement]`
+- **The $THREE token page is now the single home for the coin** — We retired the separate economy explainer and consolidated everything about $THREE onto one page: live price, the bonding-curve chart, streaming trades, and one-click buy. Every place that pointed you to "learn about $THREE" or "get $THREE" — the holder badges, the Forge high-quality unlock prompts, and the holder gates across the app — now takes you straight to the token page where you can act. Old /three links redirect there automatically. (`/three-token`) `[improvement]`
- **The Club runs cooler — capped frame rate and adaptive quality** — Walking into the Club no longer spins your laptop's fans up. The walk-through now draws at a steady 60 fps instead of chasing high-refresh displays (which did up to 2.4× the GPU work for no visible gain), caps how many pixels it renders on retina screens, and pauses rendering entirely when the tab is in the background. If frames still run slow on a struggling machine, it automatically steps quality down a notch so the scene keeps moving smoothly instead of grinding. Big drop in heat and battery use, same neon-lit walk. (`/club`) `[fix, improvement]`
- **The Pole Club alley is easier to see** — The walk up to the Pole Club was lit so tightly that only a thin strip of pavement under your feet was visible while the walls fell away to black. The alley now carries a soft warm fill light that travels with you and a wider key, plus a gentle lift to the ambient glow — so the stretch you're actually walking through stays legible the whole way to the door, without losing the moody neon look. (`/club`) `[improvement]`
- **Token Oracle follow / unfollow is working again** — Subscribing an agent to a token's oracle alerts — and unsubscribing — was silently failing for everyone; only the status check worked. Both now go through correctly, so you can opt an agent into (and out of) score-based alerts as intended. `[fix]`
diff --git a/data/changelog.json b/data/changelog.json
index 58fca7f9f..8a389be2d 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,23 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-19",
+ "title": "The $THREE token page is now the single home for the coin",
+ "summary": "We retired the separate economy explainer and consolidated everything about $THREE onto one page: live price, the bonding-curve chart, streaming trades, and one-click buy. Every place that pointed you to \"learn about $THREE\" or \"get $THREE\" — the holder badges, the Forge high-quality unlock prompts, and the holder gates across the app — now takes you straight to the token page where you can act. Old /three links redirect there automatically.",
+ "tags": [
+ "improvement"
+ ],
+ "link": "/three-token"
+ },
+ {
+ "date": "2026-06-19",
+ "title": "Every avatar now animates — VRoid, Daz, Blender and more walk out of the box",
+ "summary": "Bring any humanoid avatar and it just moves. The animation engine now recognizes every common character skeleton — VRoid/VRM, VRM 1.0, Daz/Genesis, MakeHuman, Blender, Unreal, Mixamo and simple game rigs — and retargets the idle and walk onto it, legs and all. No more characters frozen in a stiff T-pose because their bones were named differently. Anything that genuinely can't be animated (a non-humanoid prop with no skeleton) gracefully wears the default body instead of locking up. No allowlist, no per-avatar setup.",
+ "tags": [
+ "improvement"
+ ]
+ },
{
"date": "2026-06-19",
"title": "Pick who walks your pages — diverse avatar roster + Walk SDK",
diff --git a/package-lock.json b/package-lock.json
index 1f7d8acb1..1b4044e5b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,6 +13,7 @@
"agent-payments-sdk",
"agent-ui-sdk",
"avatar-sdk",
+ "page-agent-sdk",
"character-studio",
"mcp-bridge",
"mcp-server",
@@ -25,7 +26,8 @@
"packages/ibm-watsonx-mcp",
"packages/ibm-x402-mcp",
"packages/three-token-mcp",
- "packages/threews-avatar-mcp"
+ "packages/threews-avatar-mcp",
+ "walk-sdk"
],
"dependencies": {
"@0xsplits/splits-sdk": "^6.5.0",
@@ -22936,6 +22938,10 @@
"resolved": "multiplayer",
"link": true
},
+ "node_modules/@three-ws/page-agent": {
+ "resolved": "page-agent-sdk",
+ "link": true
+ },
"node_modules/@three-ws/pumpfun-mcp": {
"resolved": "packages/pumpfun-mcp",
"link": true
@@ -22952,6 +22958,10 @@
"resolved": "packages/viewer-presets",
"link": true
},
+ "node_modules/@three-ws/walk": {
+ "resolved": "walk-sdk",
+ "link": true
+ },
"node_modules/@tootallnate/quickjs-emscripten": {
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz",
@@ -54601,6 +54611,22 @@
}
}
},
+ "page-agent-sdk": {
+ "name": "@three-ws/page-agent",
+ "version": "0.1.0",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "three": ">=0.150.0"
+ },
+ "peerDependenciesMeta": {
+ "three": {
+ "optional": false
+ }
+ }
+ },
"solana-agent-sdk": {
"name": "@three-ws/solana-agent",
"version": "0.2.0",
@@ -54651,6 +54677,17 @@
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"dev": true,
"license": "MIT"
+ },
+ "walk-sdk": {
+ "name": "@three-ws/walk",
+ "version": "0.1.0",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "three": ">=0.150.0"
+ }
}
}
}
diff --git a/pages/dashboard-next/walk.html b/pages/dashboard-next/walk.html
new file mode 100644
index 000000000..d3bb68906
--- /dev/null
+++ b/pages/dashboard-next/walk.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Walk Companion · Dashboard · three.ws</title>
+ <meta name="robots" content="noindex" />
+ <link rel="icon" href="/favicon.ico" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/dashboard-next/shell.css" />
+ </head>
+ <body>
+ <script type="module" src="/src/dashboard-next/pages/walk.js"></script>
+ </body>
+</html>
diff --git a/pages/forge.html b/pages/forge.html
index 03bd5fe10..2053e8ac9 100644
--- a/pages/forge.html
+++ b/pages/forge.html
@@ -2659,7 +2659,7 @@
</div>
<p class="fq-holder-note" id="fq-holder-note" data-state="locked">
<span class="fq-holder-ico" aria-hidden="true">◆</span> High quality is a
- <a href="/three">$THREE holder</a> feature — hold to unlock, or pay per generation.
+ <a href="/three-token">$THREE holder</a> feature — hold to unlock, or pay per generation.
</p>
<div class="fq-row">
<span class="fq-label" id="engine-label">Engine</span>
diff --git a/public/changelog.json b/public/changelog.json
index 8a9730aa6..8bd4c5f1f 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-19T22:26:05.813Z",
+ "generated_at": "2026-06-19T22:31:16.134Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -178,6 +178,16 @@
"feature"
]
},
+ {
+ "date": "2026-06-19",
+ "type": "update",
+ "title": "Every avatar now animates — VRoid, Daz, Blender and more walk out of the box",
+ "summary": "Bring any humanoid avatar and it just moves. The animation engine now recognizes every common character skeleton — VRoid/VRM, VRM 1.0, Daz/Genesis, MakeHuman, Blender, Unreal, Mixamo and simple game rigs — and retargets the idle and walk onto it, legs and all. No more characters frozen in a stiff T-pose because their bones were named differently. Anything that genuinely can't be animated (a non-humanoid prop with no skeleton) gracefully wears the default body instead of locking up. No allowlist, no per-avatar setup.",
+ "link": null,
+ "tags": [
+ "improvement"
+ ]
+ },
{
"date": "2026-06-19",
"type": "update",
@@ -631,6 +641,16 @@
"improvement"
]
},
+ {
+ "date": "2026-06-19",
+ "type": "update",
+ "title": "The $THREE token page is now the single home for the coin",
+ "summary": "We retired the separate economy explainer and consolidated everything about $THREE onto one page: live price, the bonding-curve chart, streaming trades, and one-click buy. Every place that pointed you to \"learn about $THREE\" or \"get $THREE\" — the holder badges, the Forge high-quality unlock prompts, and the holder gates across the app — now takes you straight to the token page where you can act. Old /three links redirect there automatically.",
+ "link": "/three-token",
+ "tags": [
+ "improvement"
+ ]
+ },
{
"date": "2026-06-19",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 29e0c028a..cbfe80079 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -142,6 +142,14 @@
<category>feature</category>
<description>On Android phones that support AR, placing an agent in your room is now pinpoint: point at the floor, a reticle locks onto the real ground, and you tap to drop the agent exactly where you're looking — feet on the actual floor, not floating at a guess. It anchors into the same shared room as the rest of your agents, so everyone who opens IRL at that spot — including iPhones — sees it in the same place, and you can re-tap “Refine on floor” on one of your agents to sharpen just its spot without nudging the others. iPhones and phones without AR keep the aim-and-distance flow they already had, with no extra buttons and nothing that doesn't work — every device gets the best placement it can do.</description>
</item>
+ <item>
+ <title>Every avatar now animates — VRoid, Daz, Blender and more walk out of the box</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-06-19:Every avatar now animates — VRoid, Daz, Blender and more walk out of the box</guid>
+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>Bring any humanoid avatar and it just moves. The animation engine now recognizes every common character skeleton — VRoid/VRM, VRM 1.0, Daz/Genesis, MakeHuman, Blender, Unreal, Mixamo and simple game rigs — and retargets the idle and walk onto it, legs and all. No more characters frozen in a stiff T-pose because their bones were named differently. Anything that genuinely can't be animated (a non-humanoid prop with no skeleton) gracefully wears the default body instead of locking up. No allowlist, no per-avatar setup.</description>
+ </item>
<item>
<title>Every IRL moment now has a designed, honest state</title>
<link>https://three.ws/irl</link>
@@ -494,6 +502,14 @@
<category>improvement</category>
<description>Inspecting an agent in IRL AR is a tap — and we made that tap far harder to miss. There's now a finger-sized catch zone around each agent's floating name, so a tap that lands just beside a small or distant agent still opens its card instead of doing nothing. When several agents overlap on screen, your tap resolves to the one in front of you, and it never selects an agent that's behind you or off-screen. We also kept agents from vanishing when you bring your phone right up to one to look closely. Inspecting works whether the agent is centered, near the edge of the frame, close, or far.</description>
</item>
+ <item>
+ <title>The $THREE token page is now the single home for the coin</title>
+ <link>https://three.ws/three-token</link>
+ <guid isPermaLink="false">2026-06-19:The $THREE token page is now the single home for the coin</guid>
+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>We retired the separate economy explainer and consolidated everything about $THREE onto one page: live price, the bonding-curve chart, streaming trades, and one-click buy. Every place that pointed you to &quot;learn about $THREE&quot; or &quot;get $THREE&quot; — the holder badges, the Forge high-quality unlock prompts, and the holder gates across the app — now takes you straight to the token page where you can act. Old /three links redirect there automatically.</description>
+ </item>
<item>
<title>The Club runs cooler — capped frame rate and adaptive quality</title>
<link>https://three.ws/club</link>
diff --git a/public/features.json b/public/features.json
index 7e5d2844e..43b26ddf9 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-19T22:26:05.756Z",
+ "generated_at": "2026-06-19T22:31:16.096Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/dashboard-next/nav.js b/src/dashboard-next/nav.js
index 0b20bc388..e68bd8cb5 100644
--- a/src/dashboard-next/nav.js
+++ b/src/dashboard-next/nav.js
@@ -25,6 +25,7 @@ export const NAV = [
// ── Distribute ──────────────────────────────────────────────────────
{ path: '/dashboard/widgets', label: 'Widgets', icon: 'widget', group: 'Distribute', tags: ['embed', 'iframe', '<threews-avatar>', 'transcripts', 'knowledge'] },
+ { path: '/dashboard/walk', label: 'Walk Companion', icon: 'walk', group: 'Distribute', tags: ['walk', 'companion', 'mascot', 'avatar', 'sdk', '@three-ws/walk', 'playground', 'greeting', 'picker', 'embed'] },
{ path: '/dashboard/api', label: 'API & Embed', icon: 'code', group: 'Distribute', tags: ['keys', 'token', 'mcp', 'snippets', 'embed-policy'] },
{ path: '/dashboard/developers', label: 'Developer Hub', icon: 'devhub', group: 'Distribute', tags: ['render', 'webhooks', 'sdk', 'unity', 'unreal', 'integration', 'api', 'partner'] },
{ path: '/marketplace', label: 'Marketplace', icon: 'market', group: 'Distribute', tags: ['browse', 'buy', 'sell', 'agents', 'avatars', 'directory'], external: true },
@@ -72,6 +73,7 @@ export const ICONS = {
agent: '<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="2" width="10" height="10" rx="2"/><circle cx="8" cy="6.5" r="1"/><circle cx="12" cy="6.5" r="1"/><path d="M8 9h4M3 14l2-2h10l2 2v3a1 1 0 01-1 1H4a1 1 0 01-1-1v-3z"/></svg>',
library: '<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4h4v12H4zM12 4h4v12h-4z"/><path d="M6 7h0M14 7h0"/></svg>',
widget: '<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="6" height="6" rx="1.2"/><rect x="11" y="3" width="6" height="6" rx="1.2"/><rect x="3" y="11" width="6" height="6" rx="1.2"/><rect x="11" y="11" width="6" height="6" rx="1.2"/></svg>',
+ walk: '<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="3.6" r="1.6"/><path d="M11 6.2l-2.6 2 .9 3.3M11 6.2l2.2 1.4.6 2.6M9.3 11.5L7 17M12 10.2l1.4 2L15 16"/></svg>',
code: '<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M7 5l-4 5 4 5M13 5l4 5-4 5"/></svg>',
coin: '<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="6.5"/><path d="M10 6v8M7.5 8h4a1.5 1.5 0 010 3H8.5a1.5 1.5 0 000 3h4"/></svg>',
token: '<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M10 2l2.5 5 5.5.8-4 3.9.9 5.5L10 14.7l-4.9 2.5.9-5.5L2 7.8l5.5-.8L10 2z"/></svg>',
diff --git a/src/dashboard-next/pages/walk.js b/src/dashboard-next/pages/walk.js
new file mode 100644
index 000000000..ede3e9014
--- /dev/null
+++ b/src/dashboard-next/pages/walk.js
@@ -0,0 +1,606 @@
+// dashboard-next — Walk Companion settings.
+//
+// A dedicated editor for the @three-ws/walk SDK (walk-sdk/README.md): the
+// walking 3D avatar companion + full-page playground that ships across
+// three.ws. Everything configurable through `createWalkCompanion(options)` is
+// surfaced here, persisted, and applied live.
+//
+// Persistence is two-layered, mirroring how the SDK actually reads state:
+// • localStorage — the companion reads `walk:companion:enabled` and
+// `walk:companion:avatar` directly, so writing them takes effect on the
+// next page load (and immediately, via window.__walkCompanion).
+// • /api/dashboard/prefs (PATCH) — durable per-user backup under prefs.walk
+// so the configuration follows the user across browsers/devices.
+//
+// The page also renders a live install snippet so a developer can lift the
+// exact `createWalkCompanion({...})` call for their own site, and drives the
+// live companion on this very page for an instant preview.
+
+import { mountShell } from '../shell.js';
+import { requireUser, get, patch, esc, ApiError } from '../api.js';
+import {
+ WALK_AVATARS,
+ DEFAULT_AVATAR_ID,
+ resolveAvatarUrl,
+} from '../../../walk-sdk/src/roster.js';
+import { DEFAULT_EXCLUDED_PREFIXES } from '../../../walk-sdk/src/config.js';
+
+const MONO = `'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace`;
+
+// localStorage keys the live companion reads (storagePrefix defaults to 'walk').
+const LS = {
+ enabled: 'walk:companion:enabled',
+ avatar: 'walk:companion:avatar',
+};
+
+// The shape we persist (a subset of createWalkCompanion options + the live
+// toggle). Defaults match walk-sdk/src/config.js → resolveConfig exactly.
+const DEFAULTS = {
+ enabled: true,
+ defaultAvatarId: DEFAULT_AVATAR_ID,
+ enablePicker: true,
+ greeting: '',
+ assetBase: '',
+ apiBase: '',
+ manifestUrl: '/animations/manifest.json',
+ docsUrl: '/avatar-studio',
+ excludedRoutes: DEFAULT_EXCLUDED_PREFIXES.join('\n'),
+};
+
+let state = { ...DEFAULTS };
+
+// ── boot ────────────────────────────────────────────────────────────────────
+
+(async function boot() {
+ try {
+ const main = await mountShell();
+ await requireUser();
+
+ main.innerHTML = `
+ <h1 class="dn-h1">Walk Companion</h1>
+ <p class="dn-h1-sub">Configure the <code style="font-family:${MONO};font-size:12.5px;color:var(--nxt-ink)">@three-ws/walk</code> avatar that walks and talks across your pages.</p>
+ <div data-slot="content" style="display:flex;flex-direction:column;gap:16px">
+ ${Array.from({ length: 4 }).map(() => `<div class="dn-skeleton" style="height:140px;border-radius:12px"></div>`).join('')}
+ </div>
+ `;
+
+ const host = main.querySelector('[data-slot="content"]');
+
+ const prefsResp = await safeGet('/api/dashboard/prefs');
+ hydrateState(prefsResp?.prefs || prefsResp || {});
+
+ host.innerHTML = '';
+ host.appendChild(renderStatus());
+ host.appendChild(renderCompanion());
+ host.appendChild(renderRoster());
+ host.appendChild(renderGreeting());
+ host.appendChild(renderDelivery());
+ host.appendChild(renderExcluded());
+ host.appendChild(renderSnippet());
+ host.appendChild(renderActions());
+ host.appendChild(renderAbout());
+
+ refreshDerived();
+ } catch (err) {
+ if (err instanceof ApiError && err.status === 401) {
+ location.href = `/login?return=${encodeURIComponent(location.pathname)}`;
+ } else {
+ throw err;
+ }
+ }
+})();
+
+async function safeGet(url) {
+ try { return await get(url); }
+ catch { return null; }
+}
+
+// Merge server prefs and local overrides into `state`. localStorage wins for
+// the two keys the live companion actually owns, so the page reflects reality.
+function hydrateState(prefs) {
+ const saved = prefs && typeof prefs.walk === 'object' && prefs.walk ? prefs.walk : {};
+ state = { ...DEFAULTS, ...saved };
+
+ const lsEnabled = localStorage.getItem(LS.enabled);
+ if (lsEnabled === '1') state.enabled = true;
+ else if (lsEnabled === '0') state.enabled = false;
+
+ const lsAvatar = localStorage.getItem(LS.avatar);
+ if (lsAvatar) state.defaultAvatarId = lsAvatar;
+}
+
+// ── status ───────────────────────────────────────────────────────────────────
+
+function renderStatus() {
+ const panel = document.createElement('div');
+ panel.className = 'dn-panel';
+ panel.dataset.slot = 'status';
+ panel.innerHTML = statusInner();
+ return panel;
+}
+
+function statusInner() {
+ const av = WALK_AVATARS.find((a) => a.id === state.defaultAvatarId);
+ const avatarLabel = av ? `${av.emoji || ''} ${av.name}`.trim() : state.defaultAvatarId;
+ return `
+ <div style="display:flex;align-items:center;gap:16px;flex-wrap:wrap">
+ <div style="width:46px;height:46px;border-radius:12px;display:grid;place-items:center;font-size:24px;flex-shrink:0;background:${av?.accent ? hexSoft(av.accent) : 'var(--nxt-accent-soft)'};border:1px solid var(--nxt-stroke)">
+ ${av?.emoji ? esc(av.emoji) : '🚶'}
+ </div>
+ <div style="flex:1;min-width:200px">
+ <div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
+ <span class="dn-panel-title">Companion is ${state.enabled ? '<span style="color:var(--nxt-success)">on</span>' : '<span style="color:var(--nxt-ink-fade)">off</span>'}</span>
+ <span class="dn-tag ${state.enabled ? 'success' : ''}">${state.enabled ? 'Live' : 'Hidden'}</span>
+ </div>
+ <div class="dn-panel-sub" style="margin:3px 0 0">
+ Walking as <strong style="color:var(--nxt-ink)">${esc(avatarLabel)}</strong>${state.enablePicker ? ' · visitors can swap avatars' : ' · avatar locked'}.
+ </div>
+ </div>
+ <div style="display:flex;gap:8px;flex-wrap:wrap">
+ <button class="dn-btn" data-action="preview" type="button">${state.enabled ? 'Show here' : 'Preview here'}</button>
+ <a class="dn-btn" href="/walk" target="_blank" rel="noopener" style="text-decoration:none">Open playground ↗</a>
+ </div>
+ </div>
+ `;
+}
+
+function bindStatus(panel) {
+ panel.querySelector('[data-action="preview"]')?.addEventListener('click', () => {
+ applyLive();
+ toast(state.enabled ? 'Companion mounted on this page' : 'Companion enabled for preview');
+ if (!state.enabled) { state.enabled = true; refreshDerived(); }
+ });
+}
+
+// ── companion (core toggles) ──────────────────────────────────────────────────
+
+function renderCompanion() {
+ const panel = document.createElement('div');
+ panel.className = 'dn-panel';
+ panel.innerHTML = `
+ <div style="margin-bottom:14px">
+ <div class="dn-panel-title">Companion</div>
+ <div class="dn-panel-sub" style="margin:2px 0 0">Whether the corner mascot mounts, and whether visitors may choose their own.</div>
+ </div>
+ <div style="display:flex;flex-direction:column;gap:14px">
+ ${toggleRow('enabled', 'Enable companion', 'Mount the walking avatar in the corner of your pages. Off hides it everywhere.', state.enabled)}
+ ${toggleRow('enablePicker', 'Show avatar picker', 'Let visitors open the roster and pick who walks with them.', state.enablePicker)}
+ </div>
+ `;
+ panel.querySelectorAll('[data-toggle]').forEach((input) => {
+ input.addEventListener('change', () => {
+ state[input.dataset.toggle] = input.checked;
+ refreshDerived();
+ if (input.dataset.toggle === 'enabled') applyLive();
+ });
+ });
+ return panel;
+}
+
+// ── roster (default avatar picker) ────────────────────────────────────────────
+
+function renderRoster() {
+ const panel = document.createElement('div');
+ panel.className = 'dn-panel';
+ panel.innerHTML = `
+ <div style="margin-bottom:14px">
+ <div class="dn-panel-title">Default avatar</div>
+ <div class="dn-panel-sub" style="margin:2px 0 0">Loaded for first-time visitors and whenever none is stored. ${WALK_AVATARS.length} in the roster.</div>
+ </div>
+ <div data-slot="roster-grid" style="display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px"></div>
+ `;
+ const grid = panel.querySelector('[data-slot="roster-grid"]');
+ grid.innerHTML = WALK_AVATARS.map((a) => avatarCard(a)).join('');
+
+ grid.querySelectorAll('[data-avatar]').forEach((card) => {
+ card.addEventListener('click', () => {
+ state.defaultAvatarId = card.dataset.avatar;
+ grid.querySelectorAll('[data-avatar]').forEach((c) => {
+ c.setAttribute('aria-pressed', String(c.dataset.avatar === state.defaultAvatarId));
+ });
+ refreshDerived();
+ applyLive();
+ });
+ });
+ return panel;
+}
+
+function avatarCard(a) {
+ const selected = a.id === state.defaultAvatarId;
+ const thumb = a.thumb ? resolveAvatarUrl({ ...a, asset: a.thumb }, {}) : '';
+ return `
+ <button class="dn-walk-card" data-avatar="${esc(a.id)}" type="button" aria-pressed="${selected}"
+ style="position:relative;display:flex;flex-direction:column;align-items:center;gap:8px;padding:14px 10px 12px;border-radius:12px;cursor:pointer;text-align:center;
+ background:rgba(255,255,255,0.02);border:1px solid ${selected ? 'var(--nxt-accent)' : 'var(--nxt-stroke)'};transition:border-color .15s,transform .15s,background .15s">
+ <div style="width:54px;height:54px;border-radius:12px;display:grid;place-items:center;overflow:hidden;font-size:30px;background:${a.accent ? hexSoft(a.accent) : 'rgba(255,255,255,0.04)'}">
+ ${thumb ? `<img src="${esc(thumb)}" alt="" loading="lazy" style="width:100%;height:100%;object-fit:cover" onerror="this.replaceWith(document.createTextNode('${esc(a.emoji || '🚶')}'))" />` : esc(a.emoji || '🚶')}
+ </div>
+ <div style="font-size:13px;font-weight:600;color:var(--nxt-ink);line-height:1.1">${esc(a.name)}</div>
+ <div style="font-size:11px;color:var(--nxt-ink-fade)">${esc(a.category || '')}</div>
+ ${selected ? `<span style="position:absolute;top:8px;right:8px;width:16px;height:16px;border-radius:50%;background:var(--nxt-accent);display:grid;place-items:center"><svg viewBox="0 0 12 12" width="9" height="9" fill="none" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 6.5l2.5 2.5 4.5-5"/></svg></span>` : ''}
+ </button>
+ `;
+}
+
+// ── greeting ──────────────────────────────────────────────────────────────────
+
+function renderGreeting() {
+ const panel = document.createElement('div');
+ panel.className = 'dn-panel';
+ panel.innerHTML = `
+ <div style="margin-bottom:14px">
+ <div class="dn-panel-title">Page greeting</div>
+ <div class="dn-panel-sub" style="margin:2px 0 0">A line the companion speaks when a visitor lands. Leave blank for the built-in per-page greeting. Use <code style="font-family:${MONO};font-size:12px">{path}</code> to insert the current path.</div>
+ </div>
+ ${textField('greeting', state.greeting, 'Welcome to {path} 👋')}
+ `;
+ bindTextFields(panel);
+ return panel;
+}
+
+// ── asset delivery (advanced) ─────────────────────────────────────────────────
+
+function renderDelivery() {
+ const panel = document.createElement('div');
+ panel.className = 'dn-panel';
+ panel.innerHTML = `
+ <div style="margin-bottom:14px">
+ <div class="dn-panel-title">Asset delivery</div>
+ <div class="dn-panel-sub" style="margin:2px 0 0">Where the avatar GLBs, animation manifest, and "make your own" link resolve. Defaults serve from this origin — override to point at a CDN.</div>
+ </div>
+ <div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px">
+ ${labeledField('assetBase', 'Asset base', state.assetBase, 'https://cdn.example.com', 'Prepended to static GLB paths.')}
+ ${labeledField('apiBase', 'API base', state.apiBase, 'https://api.example.com', 'Prepended to the /api/avatars/<id>/glb proxy.')}
+ ${labeledField('manifestUrl', 'Manifest URL', state.manifestUrl, '/animations/manifest.json', 'Shared animation manifest for retargeted rigs.')}
+ ${labeledField('docsUrl', 'Docs / build link', state.docsUrl, '/avatar-studio', '"Make your own" link in the picker footer.')}
+ </div>
+ `;
+ bindTextFields(panel);
+ return panel;
+}
+
+// ── excluded routes ───────────────────────────────────────────────────────────
+
+function renderExcluded() {
+ const panel = document.createElement('div');
+ panel.className = 'dn-panel';
+ panel.innerHTML = `
+ <div style="display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:14px">
+ <div>
+ <div class="dn-panel-title">Excluded routes</div>
+ <div class="dn-panel-sub" style="margin:2px 0 0">Path prefixes where the companion never mounts — typically full-screen 3D pages. One per line.</div>
+ </div>
+ <button class="dn-btn ghost" data-action="reset-routes" type="button" style="font-size:12px">Reset to defaults</button>
+ </div>
+ <textarea data-text="excludedRoutes" rows="6" spellcheck="false"
+ style="width:100%;box-sizing:border-box;resize:vertical;font-family:${MONO};font-size:12.5px;line-height:1.6;padding:12px 14px;border-radius:10px;color:var(--nxt-ink);background:rgba(0,0,0,0.25);border:1px solid var(--nxt-stroke)"
+ placeholder="/embed&#10;/play&#10;/club">${esc(state.excludedRoutes)}</textarea>
+ `;
+ bindTextFields(panel);
+ panel.querySelector('[data-action="reset-routes"]').addEventListener('click', () => {
+ state.excludedRoutes = DEFAULT_EXCLUDED_PREFIXES.join('\n');
+ panel.querySelector('[data-text="excludedRoutes"]').value = state.excludedRoutes;
+ refreshDerived();
+ toast('Excluded routes reset');
+ });
+ return panel;
+}
+
+// ── install snippet ───────────────────────────────────────────────────────────
+
+function renderSnippet() {
+ const panel = document.createElement('div');
+ panel.className = 'dn-panel';
+ panel.dataset.slot = 'snippet';
+ panel.innerHTML = `
+ <div style="display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:14px">
+ <div>
+ <div class="dn-panel-title">Install snippet</div>
+ <div class="dn-panel-sub" style="margin:2px 0 0">Drop this into any site to ship the companion with your settings. Updates live as you edit above.</div>
+ </div>
+ <button class="dn-btn" data-action="copy-snippet" type="button">
+ <svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="5" y="5" width="9" height="9" rx="1.5"/><path d="M3 11V3a1 1 0 011-1h7"/></svg>
+ Copy
+ </button>
+ </div>
+ <pre data-slot="snippet-code" style="margin:0;overflow-x:auto;padding:16px;border-radius:10px;background:rgba(0,0,0,0.32);border:1px solid var(--nxt-stroke);font-family:${MONO};font-size:12.5px;line-height:1.6;color:var(--nxt-ink)"></pre>
+ `;
+ panel.querySelector('[data-slot="snippet-code"]').textContent = buildSnippet();
+ panel.querySelector('[data-action="copy-snippet"]').addEventListener('click', async (e) => {
+ const btn = e.currentTarget;
+ try {
+ await navigator.clipboard.writeText(buildSnippet());
+ toast('Snippet copied');
+ const original = btn.innerHTML;
+ btn.innerHTML = 'Copied ✓';
+ setTimeout(() => { btn.innerHTML = original; }, 1400);
+ } catch {
+ toast('Copy failed — select and copy manually');
+ }
+ });
+ return panel;
+}
+
+// Build the exact createWalkCompanion(...) call for the current settings,
+// emitting only non-default options so the snippet stays tight.
+function buildSnippet() {
+ const opts = [];
+ if (state.defaultAvatarId !== DEFAULTS.defaultAvatarId) opts.push(` defaultAvatarId: ${q(state.defaultAvatarId)},`);
+ if (!state.enablePicker) opts.push(' enablePicker: false,');
+ if (state.assetBase) opts.push(` assetBase: ${q(state.assetBase)},`);
+ if (state.apiBase) opts.push(` apiBase: ${q(state.apiBase)},`);
+ if (state.manifestUrl && state.manifestUrl !== DEFAULTS.manifestUrl) opts.push(` manifestUrl: ${q(state.manifestUrl)},`);
+ if (state.docsUrl) opts.push(` docsUrl: ${q(state.docsUrl)},`);
+ if (state.greeting.trim()) {
+ const tmpl = state.greeting.replace(/`/g, '\\`').replace(/\$\{/g, '\\${').replace(/\{path\}/g, '${path}');
+ opts.push(` greeting: (path) => \`${tmpl}\`,`);
+ }
+ const routes = state.excludedRoutes.split('\n').map((r) => r.trim()).filter(Boolean);
+ const routesDefault = arraysEqual(routes, DEFAULT_EXCLUDED_PREFIXES);
+ if (routes.length && !routesDefault) {
+ opts.push(` excludedRoutes: [${routes.map(q).join(', ')}],`);
+ }
+
+ const optsBlock = opts.length ? `{\n${opts.join('\n')}\n}` : '';
+ const call = `const walk = createWalkCompanion(${optsBlock});\nwalk.bootstrap();`;
+ const disabledNote = state.enabled ? '' : `\n\n// Companion is currently disabled in your dashboard —\n// call walk.bootstrap() to mount it, or walk.disable() to keep it hidden.`;
+
+ return `npm install @three-ws/walk three\n\nimport { createWalkCompanion } from '@three-ws/walk';\n\n${call}${disabledNote}`;
+}
+
+// ── actions (save / reset) ────────────────────────────────────────────────────
+
+function renderActions() {
+ const panel = document.createElement('div');
+ panel.className = 'dn-panel';
+ panel.style.cssText = 'position:sticky;bottom:16px;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;backdrop-filter:blur(12px)';
+ panel.innerHTML = `
+ <div style="font-size:12.5px;color:var(--nxt-ink-fade)">
+ Saved to your account and applied to the live companion across three.ws.
+ </div>
+ <div style="display:flex;gap:10px;flex-wrap:wrap">
+ <button class="dn-btn" data-action="reset-all" type="button">Reset all</button>
+ <button class="dn-btn primary" data-action="save" type="button">Save settings</button>
+ </div>
+ `;
+
+ panel.querySelector('[data-action="save"]').addEventListener('click', async (e) => {
+ syncFromInputs();
+ const btn = e.currentTarget;
+ btn.disabled = true;
+ btn.textContent = 'Saving…';
+ try {
+ await patch('/api/dashboard/prefs', { prefs: { walk: serialize() } });
+ applyLive();
+ toast('Walk Companion settings saved');
+ } catch (err) {
+ // localStorage still applies even if the durable backup fails — never
+ // leave the user with a silent no-op.
+ applyLive();
+ toast(err?.message ? `Saved locally — ${err.message}` : 'Saved locally (sync unavailable)');
+ } finally {
+ btn.disabled = false;
+ btn.textContent = 'Save settings';
+ }
+ });
+
+ panel.querySelector('[data-action="reset-all"]').addEventListener('click', () => {
+ if (!confirm('Reset all Walk Companion settings to their defaults?')) return;
+ state = { ...DEFAULTS };
+ rerenderInputs();
+ refreshDerived();
+ toast('Reset to defaults — Save to persist');
+ });
+
+ return panel;
+}
+
+// ── about ─────────────────────────────────────────────────────────────────────
+
+function renderAbout() {
+ const panel = document.createElement('div');
+ panel.className = 'dn-panel';
+ panel.innerHTML = `
+ <div style="margin-bottom:12px">
+ <div class="dn-panel-title">About the Walk SDK</div>
+ <div class="dn-panel-sub" style="margin:2px 0 0">The companion + playground engine ships as a standalone, Apache-2.0 package.</div>
+ </div>
+ <div style="display:grid;grid-template-columns:auto 1fr;gap:8px 16px;font-size:13px;margin-bottom:16px">
+ <span style="color:var(--nxt-ink-fade)">Package</span>
+ <span style="font-family:${MONO};font-size:12px;color:var(--nxt-ink)">@three-ws/walk</span>
+ <span style="color:var(--nxt-ink-fade)">Peer dep</span>
+ <span style="font-family:${MONO};font-size:12px;color:var(--nxt-ink)">three &gt;= 0.150</span>
+ <span style="color:var(--nxt-ink-fade)">Roster</span>
+ <span style="color:var(--nxt-ink)">${WALK_AVATARS.length} avatars · embedded &amp; retargeted rigs</span>
+ </div>
+ <div style="display:flex;gap:10px;flex-wrap:wrap">
+ <a class="dn-btn" href="/walk" target="_blank" rel="noopener" style="text-decoration:none">Try the playground ↗</a>
+ <a class="dn-btn" href="/features/walk" style="text-decoration:none">Feature page</a>
+ <a class="dn-btn" href="/dashboard/avatars" style="text-decoration:none">Build a custom avatar</a>
+ </div>
+ `;
+ return panel;
+}
+
+// ── live application ──────────────────────────────────────────────────────────
+
+// Push the relevant settings into localStorage (which the companion reads) and,
+// when the live companion is present on this page, drive it directly so the
+// preview is instant.
+function applyLive() {
+ localStorage.setItem(LS.enabled, state.enabled ? '1' : '0');
+ localStorage.setItem(LS.avatar, state.defaultAvatarId);
+
+ const walk = window.__walkCompanion;
+ if (!walk) return;
+ try {
+ if (state.enabled) {
+ if (!walk.isEnabled?.()) walk.enable();
+ walk.setAvatar?.(state.defaultAvatarId);
+ } else if (walk.isEnabled?.()) {
+ walk.disable();
+ }
+ } catch { /* companion not interactive on this surface — localStorage still applies */ }
+}
+
+// ── persistence helpers ───────────────────────────────────────────────────────
+
+function serialize() {
+ return {
+ enabled: state.enabled,
+ defaultAvatarId: state.defaultAvatarId,
+ enablePicker: state.enablePicker,
+ greeting: state.greeting.trim(),
+ assetBase: state.assetBase.trim(),
+ apiBase: state.apiBase.trim(),
+ manifestUrl: state.manifestUrl.trim(),
+ docsUrl: state.docsUrl.trim(),
+ excludedRoutes: state.excludedRoutes.split('\n').map((r) => r.trim()).filter(Boolean).join('\n'),
+ };
+}
+
+// Pull current input values into state (text fields update on input, but this
+// guarantees a clean read before save).
+function syncFromInputs() {
+ document.querySelectorAll('[data-text]').forEach((el) => {
+ state[el.dataset.text] = el.value;
+ });
+ document.querySelectorAll('[data-toggle]').forEach((el) => {
+ state[el.dataset.toggle] = el.checked;
+ });
+}
+
+// After a programmatic state change (reset), re-render the input-bearing panels
+// in place without a full reload.
+function rerenderInputs() {
+ const content = document.querySelector('[data-slot="content"]');
+ if (!content) return;
+ document.querySelectorAll('[data-text]').forEach((el) => {
+ el.value = state[el.dataset.text] ?? '';
+ });
+ document.querySelectorAll('[data-toggle]').forEach((el) => {
+ el.checked = !!state[el.dataset.toggle];
+ });
+ const grid = content.querySelector('[data-slot="roster-grid"]');
+ if (grid) {
+ grid.querySelectorAll('[data-avatar]').forEach((c) => {
+ const sel = c.dataset.avatar === state.defaultAvatarId;
+ c.setAttribute('aria-pressed', String(sel));
+ c.style.borderColor = sel ? 'var(--nxt-accent)' : 'var(--nxt-stroke)';
+ });
+ }
+}
+
+// Refresh everything derived from state: status header, roster selection
+// borders, and the live snippet.
+function refreshDerived() {
+ const statusPanel = document.querySelector('[data-slot="status"]');
+ if (statusPanel) {
+ statusPanel.innerHTML = statusInner();
+ bindStatus(statusPanel);
+ }
+ const grid = document.querySelector('[data-slot="roster-grid"]');
+ if (grid) {
+ grid.querySelectorAll('[data-avatar]').forEach((c) => {
+ const sel = c.dataset.avatar === state.defaultAvatarId;
+ c.style.borderColor = sel ? 'var(--nxt-accent)' : 'var(--nxt-stroke)';
+ const existing = c.querySelector('span[style*="position:absolute"]');
+ if (sel && !existing) {
+ const badge = document.createElement('span');
+ badge.style.cssText = 'position:absolute;top:8px;right:8px;width:16px;height:16px;border-radius:50%;background:var(--nxt-accent);display:grid;place-items:center';
+ badge.innerHTML = '<svg viewBox="0 0 12 12" width="9" height="9" fill="none" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 6.5l2.5 2.5 4.5-5"/></svg>';
+ c.appendChild(badge);
+ } else if (!sel && existing) {
+ existing.remove();
+ }
+ });
+ }
+ const code = document.querySelector('[data-slot="snippet-code"]');
+ if (code) code.textContent = buildSnippet();
+}
+
+// ── small UI builders ─────────────────────────────────────────────────────────
+
+function toggleRow(key, label, description, checked) {
+ return `
+ <label style="display:flex;align-items:center;justify-content:space-between;gap:16px;cursor:pointer">
+ <div>
+ <div style="font-size:13.5px;color:var(--nxt-ink);font-weight:500">${esc(label)}</div>
+ <div style="font-size:12.5px;color:var(--nxt-ink-dim);margin-top:2px">${esc(description)}</div>
+ </div>
+ <input type="checkbox" data-toggle="${esc(key)}" ${checked ? 'checked' : ''}
+ style="width:18px;height:18px;cursor:pointer;accent-color:var(--nxt-accent);flex-shrink:0" />
+ </label>
+ `;
+}
+
+function textField(key, value, placeholder) {
+ return `
+ <input type="text" data-text="${esc(key)}" value="${esc(value)}" placeholder="${esc(placeholder)}" spellcheck="false"
+ style="width:100%;box-sizing:border-box;font-size:13.5px;padding:10px 14px;border-radius:10px;color:var(--nxt-ink);background:rgba(0,0,0,0.25);border:1px solid var(--nxt-stroke)" />
+ `;
+}
+
+function labeledField(key, label, value, placeholder, hint) {
+ return `
+ <div>
+ <label style="display:block;font-size:12.5px;font-weight:600;color:var(--nxt-ink);margin-bottom:6px">${esc(label)}</label>
+ ${textField(key, value, placeholder)}
+ <div style="font-size:11.5px;color:var(--nxt-ink-fade);margin-top:5px">${esc(hint)}</div>
+ </div>
+ `;
+}
+
+function bindTextFields(panel) {
+ panel.querySelectorAll('[data-text]').forEach((input) => {
+ input.addEventListener('input', () => {
+ state[input.dataset.text] = input.value;
+ refreshDerived();
+ });
+ // Mirror the dashboard input focus affordance used elsewhere.
+ input.addEventListener('focus', () => { input.style.borderColor = 'var(--nxt-accent)'; });
+ input.addEventListener('blur', () => { input.style.borderColor = 'var(--nxt-stroke)'; });
+ });
+}
+
+// ── utilities ─────────────────────────────────────────────────────────────────
+
+function q(s) { return `'${String(s).replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`; }
+
+function arraysEqual(a, b) {
+ return a.length === b.length && a.every((v, i) => v === b[i]);
+}
+
+// Translate a hex accent into a faint translucent fill for chips/thumbs.
+function hexSoft(hex) {
+ const m = /^#?([0-9a-f]{6})$/i.exec(hex || '');
+ if (!m) return 'rgba(255,255,255,0.04)';
+ const n = parseInt(m[1], 16);
+ return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, 0.16)`;
+}
+
+function toast(msg) {
+ let el = document.getElementById('dn-toast');
+ if (!el) {
+ el = document.createElement('div');
+ el.id = 'dn-toast';
+ el.style.cssText = `
+ position:fixed;left:50%;bottom:32px;transform:translateX(-50%) translateY(20px);
+ background:rgba(20,21,28,0.95);border:1px solid var(--nxt-stroke-strong);
+ color:var(--nxt-ink);padding:9px 16px;border-radius:999px;font-size:13px;
+ z-index:9999;opacity:0;transition:opacity .18s,transform .18s;
+ backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);
+ box-shadow:0 8px 24px rgba(0,0,0,0.4);pointer-events:none;`;
+ document.body.appendChild(el);
+ }
+ el.textContent = msg;
+ requestAnimationFrame(() => {
+ el.style.opacity = '1';
+ el.style.transform = 'translateX(-50%) translateY(0)';
+ });
+ clearTimeout(el._t);
+ el._t = setTimeout(() => {
+ el.style.opacity = '0';
+ el.style.transform = 'translateX(-50%) translateY(20px)';
+ }, 1800);
+}
diff --git a/tests/three-gate.test.js b/tests/three-gate.test.js
index 8f816eca6..769a3e974 100644
--- a/tests/three-gate.test.js
+++ b/tests/three-gate.test.js
@@ -255,7 +255,7 @@ describe('<three-gate> — lifecycle & states', () => {
// pay-per-use line + perks link.
expect(card.textContent).toMatch(/or pay\s*\$0\.50\s*per use/);
- expect(root.querySelector('a.tg-perks').getAttribute('href')).toBe('/three');
+ expect(root.querySelector('a.tg-perks').getAttribute('href')).toBe('/three-token');
// Child stays inert behind the lock.
expect(el.querySelector('#premium').inert).toBe(true);
diff --git a/tests/three-lock.test.js b/tests/three-lock.test.js
index 56d9fe902..be859d62c 100644
--- a/tests/three-lock.test.js
+++ b/tests/three-lock.test.js
@@ -64,8 +64,8 @@ describe('lockStateFromAccess', () => {
it('merges extra handlers/urls through', () => {
const onUseFree = () => {};
- const s = lockStateFromAccess(INELIGIBLE, { getThreeUrl: '/three', onUseFree });
- expect(s.getThreeUrl).toBe('/three');
+ const s = lockStateFromAccess(INELIGIBLE, { getThreeUrl: '/three-token', onUseFree });
+ expect(s.getThreeUrl).toBe('/three-token');
expect(s.onUseFree).toBe(onUseFree);
});
});
@@ -99,7 +99,7 @@ describe('renderLock — states', () => {
it('locked (insufficient_tier) shows required tier, held line, progress + Get $THREE', () => {
const el = host();
- renderLock(el, lockStateFromAccess(INELIGIBLE, { getThreeUrl: '/three' }));
+ renderLock(el, lockStateFromAccess(INELIGIBLE, { getThreeUrl: '/three-token' }));
const card = el.querySelector('.tl-card--lock');
expect(card).toBeTruthy();
expect(card.getAttribute('role')).toBe('group');
@@ -107,7 +107,7 @@ describe('renderLock — states', () => {
expect(card.textContent).toMatch(/You hold\s*Member/);
const get = el.querySelector('[data-tl-get]');
expect(get.tagName).toBe('A');
- expect(get.getAttribute('href')).toBe('/three');
+ expect(get.getAttribute('href')).toBe('/three-token');
expect(el.querySelector('.tl-prog')).toBeTruthy();
});
diff --git a/vercel.json b/vercel.json
index 7ab1bfbd0..c57306b7f 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1246,6 +1246,10 @@
"src": "/dashboard/widgets/?",
"dest": "/dashboard-next/widgets.html"
},
+ {
+ "src": "/dashboard/walk/?",
+ "dest": "/dashboard-next/walk.html"
+ },
{
"src": "/dashboard/api/?",
"dest": "/dashboard-next/api.html"
diff --git a/x402-payment-modal/examples/plain-html/index.html b/x402-payment-modal/examples/plain-html/index.html
index 9c228f583..4da560e54 100644
--- a/x402-payment-modal/examples/plain-html/index.html
+++ b/x402-payment-modal/examples/plain-html/index.html
@@ -217,15 +217,12 @@
outcome.textContent = `Paid ✓ (${detail.payment?.network ?? 'settled'})${payer}${tx}`;
});
+ // detail.error is a string. Note: dismissing the modal does NOT fire this
+ // event — the auto-binder swallows the cancellation — so anything here is a
+ // genuine failure.
document.addEventListener('x402:error', (event) => {
- const error = event.detail?.error;
- if (error && error.code === 'cancelled') {
- outcome.className = '';
- outcome.textContent = 'Payment cancelled.';
- return;
- }
outcome.className = 'err';
- outcome.textContent = `Payment failed: ${error?.message ?? String(error)}`;
+ outcome.textContent = `Payment failed: ${event.detail?.error ?? 'unknown error'}`;
});
</script>
</body>
diff --git a/x402-payment-modal/src/index.js b/x402-payment-modal/src/index.js
index 33ab08124..4256bffa5 100644
--- a/x402-payment-modal/src/index.js
+++ b/x402-payment-modal/src/index.js
@@ -18,7 +18,7 @@
//
// You can also call programmatically:
//
-// import { pay, configure } from '@three-ws/x402-modal';
+// import { pay, configure } from '@three-ws/x402-payment-modal';
// const out = await pay({
// endpoint: '/api/paid/summarize',
// body: { text: 'hello' },