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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(tour-builder): Sperax preset — a ready-made 3D guided tour of USDs
fudjia5b67fb635e5b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2cb9a62c8..86845819d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -63,6 +63,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **The free crypto API goes deeper: CoinGecko, DefiLlama, and two new DeFi price feeds** — The unified /api/v1/x crypto API grew from 4 to 12 endpoints across CoinGecko and DefiLlama, all free with zero setup. CoinGecko now answers a full per-coin snapshot (price, ATH/ATL, supply, multi-window change), trending coins and hot categories, token price by contract address, the global market snapshot, and OHLC candles — not just spot price and ranked markets. DefiLlama adds every chain ranked by TVL, one protocol's full profile with 30 days of TVL history, and 90 days of historical chain TVL. Two new providers ride DefiLlama's sibling APIs: llama-prices for any chain:address token (covers long-tail tokens CoinGecko and Jupiter don't index) and llama-stablecoins for every tracked stablecoin's peg, price, and circulating supply. (`/docs/api-reference`) `[feature]`- **The free crypto API is now callable as an MCP tool** — Two new MCP tools on the three.ws server: crypto_data calls any endpoint of the free Crypto Data API (DEX pairs, CoinGecko/DefiLlama market data, Jupiter Solana prices and swap quotes, Solana RPC reads) directly from an MCP client, generated live from the same registry that powers GET /api/v1/x/*; token_snapshot fans out to whichever of those providers are registered to build a one-call market snapshot for any Solana token mint, degrading gracefully around any provider that's absent or down. (`/docs/mcp`) `[feature]`- **The three.ws crypto API now has a real free tier** — Any unauthenticated call to the unified /api/v1/x API (CoinGecko, DefiLlama, Jupiter Solana prices/quotes/search) now gets real data with zero setup, up to a per-endpoint quota — no wallet, no key, no signup. curl https://three.ws/api/v1/x/coingecko/price?ids=solana just works. Every response carries rate-limit headers so an agent can see exactly how much free budget is left; once it's used up, the same URL falls through to pay-per-call USDC (x402) or a three.ws API key instead of dead-ending. (`/docs/api-reference`) `[feature]`+- **The Tour Builder gains templates — starting with a ready-made 3D guided tour of Sperax, our first DeFi partner deployment** — The Tour Builder now ships Templates: ready-made tours you load into the editor as a starting point instead of hand-picking every stop. The first one is an 8-stop guided walk of Sperax's USDs auto-yield stablecoin — what USDs is, how the auto-yield actually works, minting and redeeming, where the yield comes from, staking SPA for veSPA, farms, and getting started — with real selectors verified against Sperax's live site and narration checked against its published protocol docs. Loading a template swaps the editor's stops, avatar, and chapters in one click; editing, previewing, and exporting work exactly like a hand-built tour, and a banner explains that a partner template's true preview is the exported snippet on the partner's own site. @three-ws/tour's selector-fallback behavior (primary → secondary → page heading/CTA → narrate with no spotlight, never a hard failure) now has dedicated test coverage. (`/tour-builder`) `[feature]`- **three.ws now speaks BNB Chain's payment protocol (MPP), both ways** — Our paid endpoints now accept payments over MPP — BNB Chain's Machine Payments Protocol — in addition to the x402 payments we already take on Solana and Base. Because MPP is x402 v2 under the hood, the same signed-stablecoin credential works; agents from the BNB ecosystem can now pay us on BNB Chain, settling through the Binance OnchainPay facilitator, while every existing Solana/Base payment path is untouched. The $THREE Town Oracle is the first endpoint to accept both. Our own agents can pay any MPP-protected endpoint too, with a hard per-call spending cap that refuses an over-quote before any money moves. `[feature, sdk]`- **Token-gated 3D embeds — holder-only interactive scenes** — Turn an avatar or on-chain agent you own into a holder-only interactive 3D embed. Visitors must prove a real, server-verified on-chain balance — a signed wallet challenge plus a live Solana RPC read, never a number the browser reports — before the live scene renders; below the bar they see a designed locked teaser with a connect-wallet button. Defaults to gating on $THREE, but accepts any SPL token at runtime for other communities. New create_gated_embed MCP tool, plus a REST API and a paste-anywhere <three-d> embed snippet. (`/docs/token-gated-3d-embeds`) `[feature]`- **Trending, bonding curve, launches, and whales join pump.fun search under the versioned API** — GET /api/v1/pump/search shipped alone at first — now it has the rest of the family: GET /api/v1/pump/trending (momentum-ranked hot tokens), /curve (bonding-curve % to graduation, SOL in the curve, tokens remaining), /launches (every coin launched through three.ws, joined with the launching agent), and /whales (which wallets moved how much SOL, facts only — no invented bullish/bearish signal). All five are free, keyless, and discoverable via GET /api/v1. None of them fork an upstream implementation: trending/curve/whales share their engines with the free Crypto Data API's pump.fun endpoints, launches shares its query with the /launches page. (`/docs/api-reference`) `[feature]`diff --git a/STRUCTURE.md b/STRUCTURE.mdindex 429f18b50..96046b41f 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -19,7 +19,7 @@ bottom.| React avatar creator | [avatar-sdk/](avatar-sdk) `→ /react` `/creator` | Published as `@three-ws/avatar` | Same package, React subpath || Talking page guide | [page-agent-sdk/](page-agent-sdk) | Published as `@three-ws/page-agent` | Drop-in rigged 3D agent that narrates any page + visitor avatar picker. `<page-agent>` web component. Rigged-only catalog. `preset="…"` resolves one of 5 personas (greeting/role/suggested-prompt chips/tool allowlist) — see [page-agent-sdk/README.md#persona-presets](page-agent-sdk/README.md#persona-presets). See [page-agent-sdk/PUBLISHING.md](page-agent-sdk/PUBLISHING.md) || Guided site tour | [tour-sdk/](tour-sdk) | Published as `@three-ws/tour` | 3D guide walks a live site, spotlights sections, narrates each. One-tag CDN build + free roam |-| Tour Builder (no-code playground) | [pages/tour-builder.html](pages/tour-builder.html) `→ /tour-builder` | Live | Point-and-click editor over a demo storefront: pick avatar, add stops, preview the real tour, export curriculum + Shopify snippets. Logic: [public/tour-builder/builder.js](public/tour-builder/builder.js) |+| Tour Builder (no-code playground) | [pages/tour-builder.html](pages/tour-builder.html) `→ /tour-builder` | Live | Point-and-click editor over a demo storefront: pick avatar, add stops, preview the real tour, export curriculum + Shopify snippets. Also ships **Templates** — ready-made tours (Sperax's DeFi protocol tour is the first) that load straight into the editor. Logic: [public/tour-builder/builder.js](public/tour-builder/builder.js), presets: [public/tour-builder/presets/](public/tour-builder/presets). Sperax template doc: [docs/tutorials/sperax-tour.md](docs/tutorials/sperax-tour.md) || Avatar builder (full app) | [character-studio/](character-studio) | Fork of [m3-org/CharacterStudio](https://github.com/M3-org/CharacterStudio), MIT, see [character-studio/LICENSE](character-studio/LICENSE) | Web-first character creator || Scene Studio (3D scene editor) | [src/scene-studio/](src/scene-studio) `→ /scene` | Vendored [mrdoob/three.js](https://github.com/mrdoob/three.js) r184 editor, MIT, see [src/scene-studio/vendor/README.md](src/scene-studio/vendor/README.md) | Import GLBs, compose scenes, edit materials/lights, export || Diorama (text → 3D world) | [src/diorama/](src/diorama) `→ /diorama` | In-repo · backend [api/diorama.js](api/diorama.js) | One sentence → an explorable 3D diorama: Claude composes the scene, each object is forged to a real GLB, assembled live, saved to a public gallery + shareable permalink |diff --git a/data/changelog.json b/data/changelog.jsonindex 0d093932b..91a79efab 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,15 @@{"$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-07-08",+ "title": "The Tour Builder gains templates — starting with a ready-made 3D guided tour of Sperax, our first DeFi partner deployment",+ "summary": "The Tour Builder now ships Templates: ready-made tours you load into the editor as a starting point instead of hand-picking every stop. The first one is an 8-stop guided walk of Sperax's USDs auto-yield stablecoin — what USDs is, how the auto-yield actually works, minting and redeeming, where the yield comes from, staking SPA for veSPA, farms, and getting started — with real selectors verified against Sperax's live site and narration checked against its published protocol docs. Loading a template swaps the editor's stops, avatar, and chapters in one click; editing, previewing, and exporting work exactly like a hand-built tour, and a banner explains that a partner template's true preview is the exported snippet on the partner's own site. @three-ws/tour's selector-fallback behavior (primary → secondary → page heading/CTA → narrate with no spotlight, never a hard failure) now has dedicated test coverage.",+ "tags": [+ "feature"+ ],+ "link": "/tour-builder"+ },{"date": "2026-07-08","title": "A live public gallery for every minted 3D asset — and a fix that had been silently 500ing the launch directory",diff --git a/docs/tutorials/sperax-tour.md b/docs/tutorials/sperax-tour.mdnew file mode 100644index 000000000..a21d893ab--- /dev/null+++ b/docs/tutorials/sperax-tour.md@@ -0,0 +1,164 @@+# The Sperax Tour Template — a Ready-Made 3D Guide for a DeFi Protocol++The [Tour Builder](/tour-builder) ships **templates** — ready-made tours you load into the editor as a starting point instead of picking every stop by hand. The first one is **Sperax — DeFi protocol tour**: an 8-stop guided walk of [usds.sperax.io](https://usds.sperax.io), Sperax's USDs auto-yield stablecoin site, built for three.ws's first DeFi partner deployment.++This page shows what the template covers, how to load and adjust it, and the exact snippet it exports — the same one Sperax (or anyone forking the idea for their own DeFi site) would drop onto their own pages.++---++## What the template covers++Loading the template gives you 8 stops across 3 chapters, written in plain language with no unexplained jargon:++| # | Chapter | Stop | What the guide says |+| - | --- | --- | --- |+| 1 | Sperax at a glance | What Sperax is | Sperax has been building on Arbitrum since 2019 — audited, DAO-governed. |+| 2 | How USDs works | USDs: yield with zero extra steps | USDs pays you for holding it — no staking, no claiming, the balance just grows. |+| 3 | Sperax at a glance | Why holders choose USDs | Effortless income, security-first design, instant withdrawals. |+| 4 | How USDs works | Minting & redeeming | Deposit USDC/USDT/USDC.e to mint USDs; redeem back for your collateral of choice anytime. |+| 5 | How USDs works | Where the yield comes from | Collateral works in audited protocols like Aave, Compound, and Stargate; ~70% of the yield flows back to holders. |+| 6 | SPA, farms & getting started | Stake SPA for veSPA | Lock SPA for veSPA — voting power plus a share of fees and yield. |+| 7 | SPA, farms & getting started | Farms — extra yield on LP tokens | Stake LP tokens in a Sperax Farm for up to 100% APR. |+| 8 | SPA, farms & getting started | Get started | Hit Launch App, connect a wallet, mint your first USDs. |++Every fact above was checked against a live source before it was written — see [Selector & fact provenance](#selector--fact-provenance) below.++## Loading it++1. Open the **[Tour Builder](/tour-builder)**.+2. Click **🧩 Browse templates** at the top of the editor panel.+3. Pick **Sperax — DeFi protocol tour**. The 8 stops above load straight into the editor — same title, avatar, and chapters as the table.+4. Edit like any hand-built tour: rewrite a line, star a stop into the Quick track, reorder, or re-pick a target by clicking a section of the (unrelated) demo storefront — the picker still works, it just replaces that one stop's selector chain with whatever you clicked.++A banner appears while the template is active:++> This template targets usds.sperax.io's real DOM. Preview here shows the guide walking, spotlighting, and narrating on our demo store — the mechanics are identical, but the actual sections only exist on Sperax's site. Export the snippet and drop it into usds.sperax.io to see the real thing.++**Preview** in the builder always runs against the builder's own demo storefront (a Shopify-style sandbox), so it can't show the guide standing next to Sperax's real hero or FAQ — but it proves the walking, spotlighting, narration, chapter map, and playback controls are wired correctly, because it's the identical engine. The true preview is the exported snippet running on the real site, which is why **Get the code** is the next step, not an afterthought.++## Getting the code++Click **⬇ Get the code**. Because a partner template targets a real, already-built site instead of a fresh Shopify theme, the walkthrough is two steps instead of three:++**1. Host the curriculum.** Download `curriculum.json` and put it anywhere on your own domain — a CDN bucket, your `/public` folder, your CMS's file storage — then copy its URL.++**2. Drop the tag on the page.** Paste the generated `<script>` tag right before `</body>`, swapping the placeholder URL for the one from step 1:++```html+<script src="https://unpkg.com/@three-ws/[email protected]/dist/tour.global.js"+ data-tour+ data-curriculum="https://cdn.sperax.io/tour/curriculum.json"+ defer></script>+```++Add a start button anywhere on the page:++```html+<button data-tour-start class="button">✨ Sperax — DeFi protocol tour</button>+```++Both snippets above are the builder's real generated output for the unmodified template — not hand-written examples.++### The exported curriculum++This is the actual `curriculum.json` the builder produces for the unmodified template (downloaded from a live export, not retyped):++```json+{+ "title": "Sperax — DeFi protocol tour",+ "tracks": [+ { "id": "full", "title": "Full tour" },+ { "id": "quick", "title": "Quick tour" }+ ],+ "sections": [+ { "id": "overview", "title": "Sperax at a glance", "intro": "Welcome — I’m here to walk you through Sperax and USDs, its auto-yield stablecoin that’s been live on Arbitrum since 2019." },+ { "id": "usds", "title": "How USDs works", "intro": "USDs isn’t a slideshow — it’s a real yield engine. Let’s see how minting, redeeming, and the yield itself actually work." },+ { "id": "spa", "title": "SPA, farms & getting started", "intro": "Beyond USDs there’s SPA — Sperax’s governance token — plus Farms for extra yield. Let’s finish with how to get started." }+ ],+ "stops": [+ {+ "path": "/", "section": "overview", "title": "What Sperax is",+ "narration": "Sperax has been building on Arbitrum since 2019 — through every market cycle, fully audited, and governed by its own DAO. USDs, its auto-yield stablecoin, is where the story starts.",+ "highlight": true,+ "targets": ["[data-framer-name=\"Hero section\"]", "header"]+ },+ {+ "path": "/", "section": "usds", "title": "USDs: yield with zero extra steps",+ "narration": "USDs is a stablecoin that pays you just for holding it. No staking, no claiming, no dashboards — the yield shows up as a bigger wallet balance automatically, roughly once a day.",+ "highlight": true,+ "targets": ["[data-framer-name=\"Native Yield with Zero Extra Steps\"]", "[data-framer-name=\"Stablecoin with built-in Auto-Yield on Arbitrum\"]"]+ },+ {+ "path": "/", "section": "overview", "title": "Why holders choose USDs",+ "narration": "Three things holders keep coming back for: effortless income that compounds on its own, security-first engineering, and instant withdrawals — your USDs are never locked up.",+ "highlight": false,+ "targets": ["[data-framer-name=\"Why Choose USDs?\"]", "[data-framer-name=\"Discover the benefits of USDs\"]"]+ },+ {+ "path": "/", "section": "usds", "title": "Minting & redeeming",+ "narration": "Deposit USDC, USDT, or USDC.e and mint USDs against it, roughly one-for-one. Ready to exit? Redeem USDs back for the collateral of your choice — no lockups, no waiting.",+ "highlight": true,+ "targets": ["[data-framer-name=\"Deposit USDT, USDC.e & USDC collaterals to get USDs in your wallet\"]", "[data-framer-name=\"Mint USDs Using Other Tokens in Your Wallet\"]"]+ },+ {+ "path": "/", "section": "usds", "title": "Where the yield comes from",+ "narration": "Your collateral doesn’t sit idle — it’s deployed across audited lending and liquidity protocols like Aave, Compound, and Stargate. About 70% of what it earns flows back to USDs holders automatically; the rest funds SPA buybacks.",+ "highlight": false,+ "targets": ["[data-framer-name=\"Smart Yield Made Simple\"]", "[data-framer-name=\"Historical Revenue Growth\"]"]+ },+ {+ "path": "/", "section": "spa", "title": "Stake SPA for veSPA",+ "narration": "Lock SPA, Sperax’s governance token, to receive veSPA — non-transferable voting power that also earns you a cut of protocol fees and yield. Lock longer, get more veSPA and a bigger share.",+ "highlight": true,+ "targets": ["[data-framer-name=\"Launch App\"]", "a[href=\"https://app.sperax.io/\"]"]+ },+ {+ "path": "/", "section": "spa", "title": "Farms — extra yield on LP tokens",+ "narration": "Prefer more upside? Provide liquidity and stake your LP tokens in a Sperax Farm — some pools pay up to 100% APR. Sperax Farms even lets other DAOs launch their own farms with zero code.",+ "highlight": false,+ "targets": ["[data-framer-name=\"Provide Liquidity\"]", "[data-framer-name=\"Stake your liquidity pool tokens in our designated farms to earn upto 100% APR.\"]"]+ },+ {+ "path": "/", "section": "spa", "title": "Get started",+ "narration": "That’s the loop — deposit, hold, earn, exit whenever you want. Hit Launch App to connect your wallet and mint your first USDs.",+ "highlight": true,+ "targets": ["[data-framer-name=\"Launch App\"]", "a[href=\"https://app.sperax.io/\"]"]+ }+ ]+}+```++## Adjusting the selectors++Every stop's `targets` array is a **fallback chain** — the first visible match wins:++1. **Primary** — the selector most likely to still be correct.+2. **Secondary** — a nearby, independently-verified element, used if the primary was renamed or removed (a re-theme, an A/B test).+3. If both miss, `@three-ws/tour` itself falls back to any element marked `[data-tour-target]`, then the page's `h1` or primary call-to-action, and finally narrates with **no spotlight at all** rather than failing the stop. A missing selector never breaks the tour.++The primary/secondary selectors here target `data-framer-name` attributes — usds.sperax.io is built with [Framer](https://framer.com), which stamps each layer's designer-given name onto the rendered DOM (e.g. `data-framer-name="Why Choose USDs?"`). Those names are set by hand in the Framer canvas and are far more stable across republishes than Framer's auto-generated CSS class hashes, which rotate on every publish — that's why they're used here instead of classes.++**To re-pin a stop to a different element** once you have the real page open in a browser:++1. Right-click the element → **Inspect**.+2. Look for a `data-framer-name` attribute (or add `data-tour-target` directly to the element in your CMS/component if you control the markup — it always takes priority).+3. Replace the stop's `targets` array with `["[data-framer-name=\"Your Value\"]", "<a fallback selector>"]`, or paste the new selector into the Tour Builder's stop editor by clicking **Re-pick** (works against any page you can open in the builder's own tab, or hand-edit the downloaded `curriculum.json`).++## Selector & fact provenance++Every selector and every number in the narration above traces back to a live source fetched on 2026-07-08:++- **usds.sperax.io** (HTTP 200) — the real marketing site; every `data-framer-name` selector chain above was confirmed present in its fetched DOM.+- **docs.sperax.io** — `master.md`, `master/auto-yield.md`, `staking-protocol.md`, `sperax-farms-protocol.md`, `buyback-contract.md`, `governance.md`, `getting-started-on-our-dapp/minting-and-redeeming-usds.md` — sourced the 2019 founding date, the 70/30 auto-yield/buyback split, the named yield strategies (Aave, Compound, Stargate), and the veSPA/staking mechanics.+- **app.sperax.io** (the connected-wallet dashboard where minting, redeeming, and staking actually execute) returned an HTTP 403 Cloudflare JS challenge and could not be fetched from the environment this template was built in. The "Stake SPA for veSPA" and "Get started" stops therefore target the verified `Launch App` button on usds.sperax.io rather than a guessed dashboard element — re-pin those two once you have authenticated access to the real staking and mint/redeem pages, using the re-pinning steps above. The narration for both is already accurate against the docs sources listed.++## How @three-ws/tour handles a missing selector++This is covered by an automated test — [`tour-sdk/test/director.test.mjs`](https://github.com/nirholas/three.ws/blob/main/tour-sdk/test/director.test.mjs) — which pins the fallback chain: primary selector → secondary selector → the page's own heading/CTA → no spotlight, narrate anyway. A stop never hard-fails a tour.++## Where to go next++- **[Tour Builder](/tour-builder)** — load the template and try it yourself.+- **[3D Store Guide for Shopify](/tutorials/shopify-store-guide)** — the original no-code walkthrough this template pattern builds on.+- **[Advanced store guide](/tutorials/shopify-store-guide-advanced)** — hand-write a curriculum from scratch, multi-page tours, real spoken voices, the JavaScript API.+- **[`@three-ws/tour` on npm](https://www.npmjs.com/package/@three-ws/tour)** — the open-source engine both templates run on.diff --git a/public/changelog.json b/public/changelog.jsonindex 4ed3b0022..aa72cb27a 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-08T06:41:32.906Z",+ "generated_at": "2026-07-08T06:52:39.666Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -596,6 +596,16 @@"feature"]},+ {+ "date": "2026-07-08",+ "type": "update",+ "title": "The Tour Builder gains templates — starting with a ready-made 3D guided tour of Sperax, our first DeFi partner deployment",+ "summary": "The Tour Builder now ships Templates: ready-made tours you load into the editor as a starting point instead of hand-picking every stop. The first one is an 8-stop guided walk of Sperax's USDs auto-yield stablecoin — what USDs is, how the auto-yield actually works, minting and redeeming, where the yield comes from, staking SPA for veSPA, farms, and getting started — with real selectors verified against Sperax's live site and narration checked against its published protocol docs. Loading a template swaps the editor's stops, avatar, and chapters in one click; editing, previewing, and exporting work exactly like a hand-built tour, and a banner explains that a partner template's true preview is the exported snippet on the partner's own site. @three-ws/tour's selector-fallback behavior (primary → secondary → page heading/CTA → narrate with no spotlight, never a hard failure) now has dedicated test coverage.",+ "link": "/tour-builder",+ "tags": [+ "feature"+ ]+ },{"date": "2026-07-08","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 7445bfa01..56bd9f26a 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -462,6 +462,14 @@<category>feature</category><description>Any unauthenticated call to the unified /api/v1/x API (CoinGecko, DefiLlama, Jupiter Solana prices/quotes/search) now gets real data with zero setup, up to a per-endpoint quota — no wallet, no key, no signup. curl https://three.ws/api/v1/x/coingecko/price?ids=solana just works. Every response carries rate-limit headers so an agent can see exactly how much free budget is left; once it's used up, the same URL falls through to pay-per-call USDC (x402) or a three.ws API key instead of dead-ending.</description></item>+ <item>+ <title>The Tour Builder gains templates — starting with a ready-made 3D guided tour of Sperax, our first DeFi partner deployment</title>+ <link>https://three.ws/tour-builder</link>+ <guid isPermaLink="false">2026-07-08:The Tour Builder gains templates — starting with a ready-made 3D guided tour of Sperax, our first DeFi partner deployment</guid>+ <pubDate>Wed, 08 Jul 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>The Tour Builder now ships Templates: ready-made tours you load into the editor as a starting point instead of hand-picking every stop. The first one is an 8-stop guided walk of Sperax's USDs auto-yield stablecoin — what USDs is, how the auto-yield actually works, minting and redeeming, where the yield comes from, staking SPA for veSPA, farms, and getting started — with real selectors verified against Sperax's live site and narration checked against its published protocol docs. Loading a template swaps the editor's stops, avatar, and chapters in one click; editing, previewing, and exporting work exactly like a hand-built tour, and a banner explains that a partner template's true preview is the exported snippet on the partner's own site. @three-ws/tour's selector-fallback behavior (primary → secondary → page heading/CTA → narrate with no spotlight, never a hard failure) now has dedicated test coverage.</description>+ </item><item><title>three.ws now speaks BNB Chain's payment protocol (MPP), both ways</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex b089e33eb..2f255d70b 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-08T06:41:32.878Z",+ "generated_at": "2026-07-08T06:52:39.625Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/tour-sdk/test/director.test.mjs b/tour-sdk/test/director.test.mjsnew file mode 100644index 000000000..e3f6f330f--- /dev/null+++ b/tour-sdk/test/director.test.mjs@@ -0,0 +1,114 @@+// Target resolution — the graceful-fallback chain a curriculum's `targets`+// selectors rely on: primary → secondary → the built-in page heading/CTA+// fallback → null. Pinned here because a partner preset (e.g. the Sperax+// template in the Tour Builder) ships selector chains authored against a real+// third-party site, where a stop's primary or even secondary selector can+// legitimately miss (a re-theme, an A/B test, a selector typo) — a stop must+// never hard-fail when that happens; it should just skip the spotlight and+// keep narrating.++import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest';+import { JSDOM } from 'jsdom';+import { TourDirector } from '../src/director.js';++let dom;++beforeAll(() => {+ dom = new JSDOM('<!doctype html><body></body>', { url: 'https://example.test/' });+ global.window = dom.window;+ global.document = dom.window.document;+ global.localStorage = dom.window.localStorage;+ global.sessionStorage = dom.window.sessionStorage;+ global.getComputedStyle = dom.window.getComputedStyle.bind(dom.window);+ global.matchMedia = () => ({ matches: false });+ dom.window.matchMedia = global.matchMedia;+});++afterAll(() => {+ delete global.window;+ delete global.document;+ delete global.localStorage;+ delete global.sessionStorage;+ delete global.getComputedStyle;+ delete global.matchMedia;+});++beforeEach(() => {+ document.body.innerHTML = '';+});++// jsdom never runs real layout, so every element's getBoundingClientRect() is+// zero-sized by default (and isVisible() in director.js requires width/height+// >= 4). Stamp a visible rect on the elements a test wants "on screen" — the+// selector-fallback logic under test, not layout.+function makeVisible(el) {+ el.getBoundingClientRect = () => ({ width: 100, height: 40, top: 0, left: 0, right: 100, bottom: 40 });+ // jsdom's getComputedStyle() returns '' (not the browser's initial "1") for+ // opacity when nothing set it explicitly, and isVisible() in director.js+ // requires Number(opacity) > 0.05 — so pin it explicitly for anything this+ // test wants treated as on-screen.+ el.style.opacity = '1';+ return el;+}++function director() {+ return new TourDirector({ curriculum: { stops: [] } });+}++describe('TourDirector._resolveTarget', () => {+ it('resolves the primary selector when it matches a visible element', () => {+ document.body.innerHTML = '<div id="secondary"></div><div id="primary"></div>';+ makeVisible(document.getElementById('primary'));+ makeVisible(document.getElementById('secondary'));+ const el = director()._resolveTarget({ targets: ['#primary', '#secondary'] });+ expect(el.id).toBe('primary');+ });++ it('falls through to the secondary selector when the primary is absent', () => {+ document.body.innerHTML = '<div id="secondary"></div>';+ makeVisible(document.getElementById('secondary'));+ const el = director()._resolveTarget({ targets: ['#missing-primary', '#secondary'] });+ expect(el.id).toBe('secondary');+ });++ it('falls through to the page heading when neither stop selector matches', () => {+ document.body.innerHTML = '<h1>Fallback heading</h1>';+ makeVisible(document.querySelector('h1'));+ const el = director()._resolveTarget({ targets: ['#nope-primary', '#nope-secondary'] });+ expect(el.tagName).toBe('H1');+ });++ it('never throws, and returns null, when nothing on the page matches at all', () => {+ // No heading, no CTA, no [data-tour-target] — the true "hard miss" case a+ // partner preset's selector chain can hit on a page it wasn't tested+ // against (a re-theme, an A/B test, a renamed section).+ document.body.innerHTML = '<p>No headings, no CTAs, no matching selectors here.</p>';+ const d = director();+ const stop = { targets: ['#nope-primary', '#nope-secondary'] };+ expect(() => d._resolveTarget(stop)).not.toThrow();+ expect(d._resolveTarget(stop)).toBeNull();+ });++ it('skips an invalid selector in the chain instead of throwing', () => {+ document.body.innerHTML = '<div id="ok"></div>';+ makeVisible(document.getElementById('ok'));+ const el = director()._resolveTarget({ targets: [':::not-a-selector', '#ok'] });+ expect(el.id).toBe('ok');+ });++ it('ignores a matching but invisible (zero-size) element and keeps looking', () => {+ // Unmocked rect stays zero-size — isVisible() must reject it, not crash.+ document.body.innerHTML = '<div id="hidden-match"></div><div id="visible-fallback"></div>';+ makeVisible(document.getElementById('visible-fallback'));+ const el = director()._resolveTarget({ targets: ['#hidden-match', '#visible-fallback'] });+ expect(el.id).toBe('visible-fallback');+ });++ it('honours a page-authored [data-tour-target] ahead of the generic heading/CTA fallback', () => {+ document.body.innerHTML = '<h1>Heading</h1><div data-tour-target id="marked"></div>';+ makeVisible(document.querySelector('h1'));+ makeVisible(document.getElementById('marked'));+ const el = director()._resolveTarget({ targets: ['#nope'] });+ expect(el.id).toBe('marked');+ });+});