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.

fix(three): show the $THREE tier ladder to every visitor instead of an error card

nirholas9037654f6b12
diff --git a/api/three/[action].js b/api/three/[action].js
index 78a288829..557bbe439 100644
--- a/api/three/[action].js
+++ b/api/three/[action].js
@@ -3,7 +3,8 @@
//
// GET /api/three/catalog — public price list (display)
// POST /api/three/charge — issue a $THREE quote, or settle a paid one (auth)
-// GET /api/three/tier — the signed-in holder's $THREE tier + perks (auth)
+// GET /api/three/tier : the caller's $THREE tier + perks + the public ladder
+// (session, ?wallet=, or the anonymous Member floor)
// POST /api/three/tier-pass — mint a signed tier pass for world gating (auth)
// GET /api/three/earnings — creator's settled $THREE earnings ledger (auth)
// GET /api/three/name-quote?name=… — rarity + $THREE floor price for a name
@@ -214,10 +215,27 @@ async function handleTier(req, res) {
// Authed path: the signed-in user's linked wallet (also carries the discount).
const user = await getSessionUser(req, res);
- if (!user) return error(res, 401, 'unauthorized', 'sign in or pass ?wallet= to read a tier');
+ if (!user) {
+ // No identity at all. The ladder itself is public information and the /three
+ // page draws it for every first-time visitor, so answer with the Member floor
+ // (nothing held, Bronze next) instead of a 401 that renders as an outage.
+ // Not CDN-cacheable: the same URL answers signed-in sessions with their own tier.
+ const rl = await limits.tokenPriceIp(clientIp(req));
+ if (!rl.success) return rateLimited(res, rl);
+ const floor = TIERS[0];
+ return json(res, 200, {
+ signed_in: false,
+ wallet_linked: false,
+ ...tierPayload({ tier: floor, usd: 0, amount: 0, priceUsd: null, next: nextTier(floor), source: 'public' }),
+ });
+ }
const resolved = await resolveUserTier(user);
- return json(res, 200, tierPayload({ ...resolved, source: 'session' }));
+ return json(res, 200, {
+ signed_in: true,
+ wallet_linked: Boolean(user.wallet_address),
+ ...tierPayload({ ...resolved, source: 'session' }),
+ });
}
// ── POST /api/three/tier-pass ─────────────────────────────────────────────────────
diff --git a/data/changelog.json b/data/changelog.json
index 4ee0581d3..8003ecfbb 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -25391,6 +25391,15 @@
"improvement"
],
"link": "/tour"
+ },
+ {
+ "date": "2026-09-01",
+ "title": "$THREE tiers page: the ladder now loads for everyone, signed in or not",
+ "summary": "Opening /three without a wallet connected or an account signed in showed an error card instead of the tiers, because the tier lookup refused anonymous requests. The page now shows every tier, its perks, and the exact $THREE threshold to any visitor, with a connect-wallet or sign-in prompt to see your own position. Signed-in accounts without a linked wallet get a clear prompt to connect one, and if the ladder genuinely fails to load the page keeps its heading and offers a retry.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/three"
}
]
}
diff --git a/pages/three.html b/pages/three.html
index 883ed5dc3..98a3ba446 100644
--- a/pages/three.html
+++ b/pages/three.html
@@ -6,7 +6,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title data-i18n="three.meta_title">$THREE tiers · Hold-to-access perks · three.ws</title>
- <meta name="description" content="Hold $THREE to unlock platform-wide perks — fee discounts on compute, higher free quotas, private and branded worlds. See every tier, what it unlocks, and how much $THREE you hold to reach it. $THREE is the only coin on three.ws." data-i18n-attr="content:three.meta_description"/>
+ <meta name="description" content="Hold $THREE to unlock platform-wide perks: fee discounts on compute, higher free quotas, and private and branded worlds. See every tier, what it unlocks, and exactly how much $THREE you hold to reach the next one. $THREE is the only coin on three.ws." data-i18n-attr="content:three.meta_description"/>
<meta property="og:title" content="$THREE tiers · Hold-to-access on three.ws" data-i18n-attr="content:three.meta_og_title"/>
<meta property="og:description" content="Hold $THREE to unlock fee discounts, higher free quotas, and private worlds. The same tiers, the same upgrade path, everywhere." data-i18n-attr="content:three.meta_og_description"/>
<meta property="og:type" content="website" />
@@ -32,7 +32,7 @@
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
<meta property="og:locale" content="en_US">
- <meta property="og:image:alt" content="$THREE Tiers · Hold-to-Access — three.ws">
+ <meta property="og:image:alt" content="$THREE Tiers · Hold-to-Access - three.ws">
<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"$THREE Tiers · Hold-to-Access","description":"Hold $THREE to unlock platform-wide perks - fee discounts on compute, higher free quotas, and private and branded worlds. See every tier, what it unlocks, and exactly how much $THREE you hold to reach the next one. The same tiering and the same upgrade path, everywhere.","url":"https://three.ws/three","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=crypto&t=%24THREE+Tiers+%C2%B7+Hold-to-Access&d=Hold+%24THREE+to+unlock+platform-wide+perks+-+fee+discounts+on+compute%2C+higher+free+quotas%2C+and+private+and+branded+worlds.+See+every+tier%2C+what+it+unlocks%2C+and+e&p=%2Fthree"}]}</script>
</head>
<body>
diff --git a/prompts/swarm-100/route-three.md b/prompts/swarm-100/route-three.md
deleted file mode 100644
index 689720e74..000000000
--- a/prompts/swarm-100/route-three.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# Route audit: /three ($THREE Tiers · Hold-to-Access)
-
-How to run: paste this file's repo path into a fresh Claude Code chat in this
-repository and say "run this work order". This file is fully self-contained:
-it depends on no other prompt file anywhere. If neighboring files in
-prompts/swarm-100/ are gone, that work is done; if present, ignore them.
-Every claim below rots; step 0 re-measures, and what you measure wins.
-
-## Operating clause (binding)
-
-- Read CLAUDE.md first. Its rules override everything, including this file.
-- Finish 100% in this session. Never end the turn with a question, an option
- list, or an unexecuted plan. A judgment call goes in one line of the final
- report; it never becomes a question that halts work.
-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real
- funds or any irreversible on-chain write, git push or a production deploy,
- committing content that references a crypto project other than $THREE, and
- destroying unrecoverable data.
-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no
- commented-out code. Real APIs and real integrations only.
-- The em-dash and en-dash characters are banned in everything you write.
-- Concurrent agents share this worktree: stage explicit paths only (never a
- bare add-everything), and commit finished work promptly.
-- Before committing, run: npm run check:rules -- --paths <files you touched>.
- It must exit 0.
-
-## Step 0: re-derive the current state
-
-1. This route's declared entry (path, description, added date):
-
- node -e "const p=require('./data/pages.json');for(const s of p.sections)for(const g of s.pages)if(g.path==='/three')console.log(JSON.stringify(g,null,2))"
-
-2. Find the serving implementation: grep "/three" in vercel.json (the live
- route table server/index.mjs boots from), then list matching files in
- pages/ and src/. STRUCTURE.md maps every surface to its directory if the
- grep is ambiguous.
-3. Production right now:
-
- curl -so /dev/null -w '%{http_code}\n' https://three.ws/three
-
-4. Start (or reuse) the local dev server: npm run dev (vite, port 3000).
-
-## Task: audit this one route end to end, then fix everything found
-
-Route: /three ("$THREE Tiers · Hold-to-Access", section "crypto").
-Declared purpose: Hold $THREE to unlock platform-wide perks: fee discounts on compute, higher free quotas, and private and branded worlds. See every tier, what it unlocks, and exactly how much $THREE you hold to reach the next one. The same tiering and the same upgrade path, everywhere.
-
-Drive the page in a real headless browser. Playwright is already a dev
-dependency; keep your probe script in the session scratchpad, never in the
-repo.
-
-1. Load http://localhost:3000/three. Record the HTTP status, every console
- error and warning, and every failed network request.
-2. Exercise it like a first-time user: click the primary actions, run the
- primary flow if one exists, follow the page's internal links. Every button
- must do something real; every link must resolve. If the page renders data,
- prove in the network log that it came from a live endpoint, not a baked-in
- fallback array.
-3. States: verify populated, empty, loading, and error states are designed and
- reachable. Block the page's primary fetch in Playwright and confirm an
- actionable error state appears, not a blank void or a raw exception.
-4. Responsive: render at 320, 768, and 1440 px. No horizontal page scroll, no
- overlapping or clipped controls.
-5. Accessibility basics: one h1; interactive elements are real buttons or
- links with visible focus states; images carry alt text; form fields have
- labels.
-6. Head: a specific title tag and meta description that match the declared
- purpose above.
-7. Fix every defect at its root in the page's real source files and re-run the
- probe until clean. Defects in shared modules are in scope when this route
- exercises them.
-
-## Definition of done
-
-- [ ] Local load of /three: HTTP 200, zero console errors, zero unhandled
- failed requests (a third-party outage must land in a designed fallback,
- not a broken page).
-- [ ] No dead interactive element on the page: no stub href="#", no button
- without a handler, no link to a missing path.
-- [ ] Empty, loading, error, and populated states verified.
-- [ ] 320 / 768 / 1440 px renders verified clean.
-- [ ] Title and meta description present and specific.
-- [ ] npm test passes; npm run check:rules -- --paths <touched files> exits 0.
-- [ ] Production status from step 0 recorded in the report; if production
- needs a deploy to pick up a fix, the report says so (deploys stay
- owner-gated).
-
-## Never blocked
-
-| Blocker | Resolution (act, do not ask) |
-|---|---|
-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |
-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |
-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |
-| Playwright browser missing | npx playwright install chromium |
-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |
-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |
-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |
-
-## Close out (required)
-
-1. Verify every Definition of done line with the actual command output in
- front of you. Never claim a line you did not verify.
-2. Commit with explicit paths and a subject that describes the diff (house
- style: type(scope): what changed and why a reader cares).
-3. Delete this prompt file in that same commit:
-
- git rm prompts/swarm-100/route-three.md
-
- The shrinking directory is this campaign's only progress ledger; there is
- no progress log to update.
-4. Final report: what step 0 measured, what changed (file list), evidence per
- Definition of done line, and any one-line judgment calls. No trailing
- questions, no unexecuted plans.
-
-If a line genuinely cannot pass inside this session (an external party must
-respond, or an owner-gated action is the final step), finish everything else,
-leave this file in place, and state exactly which line remains and who owns
-it. Never delete this file on a partial.
diff --git a/public/locales/en.json b/public/locales/en.json
index 48b86601c..3d2bd68fd 100644
--- a/public/locales/en.json
+++ b/public/locales/en.json
@@ -18824,7 +18824,7 @@
"waiting_on_the_next_move": "Waiting on the next move"
},
"three": {
- "meta_description": "Hold $THREE to unlock platform-wide perks — fee discounts on compute, higher free quotas, private and branded worlds. See every tier, what it unlocks, and how much $THREE you hold to reach it. $THREE is the only coin on three.ws.",
+ "meta_description": "Hold $THREE to unlock platform-wide perks: fee discounts on compute, higher free quotas, and private and branded worlds. See every tier, what it unlocks, and exactly how much $THREE you hold to reach the next one. $THREE is the only coin on three.ws.",
"meta_og_description": "Hold $THREE to unlock fee discounts, higher free quotas, and private worlds. The same tiers, the same upgrade path, everywhere.",
"meta_og_title": "$THREE tiers · Hold-to-access on three.ws",
"meta_title": "$THREE tiers · Hold-to-access perks · three.ws",
diff --git a/src/three-tier-page.js b/src/three-tier-page.js
index 5e42dc367..601857eb1 100644
--- a/src/three-tier-page.js
+++ b/src/three-tier-page.js
@@ -1,22 +1,25 @@
// The canonical $THREE holder-value surface (/three).
//
// One page that renders the whole hold-to-access ladder: every tier, its perks,
-// the live fee discount + free-quota multiplier, and — for the connected
-// wallet / signed-in holder — the current tier highlighted with the exact
-// $-to-next-tier delta and a real "Hold more $THREE" action. Every locked state
-// across the platform routes here (the nav tier chip, the in-place lock panels),
-// so this is the single upgrade path the token's promise rests on.
+// the live fee discount + free-quota multiplier, and, for the connected wallet or
+// signed-in holder, the current tier highlighted with the exact $-to-next-tier
+// delta and a real "Hold more $THREE" action. Every locked state across the
+// platform routes here (the nav tier chip, the in-place lock panels), so this is
+// the single upgrade path the token's promise rests on.
//
// Truth comes from the server, never the client:
-// • GET /api/three/tier → { tier, held_usd, next:{usd_to_go}, ladder:[…] }
-// • GET /api/three/access → per-feature { enforced, eligible, required, … }
+// GET /api/three/tier -> { signed_in, wallet_linked, tier, held_usd, next:{usd_to_go}, ladder:[...] }
+// GET /api/three/access -> per-feature { enforced, eligible, required, ... }
// Both accept ?wallet= so an account-less visitor who has connected Phantom sees
-// their real on-chain tier. Both degrade to the Member floor on any hiccup, so a
-// price/RPC outage shows the ladder and the upgrade path — never a dead screen.
+// their real on-chain tier. With no wallet and no session, /tier still answers the
+// public ladder at the Member floor, so a first-time visitor sees every tier and
+// its threshold; the hero then asks them to connect or sign in for their own spot.
+// Both degrade to the Member floor on any price/RPC hiccup, so an outage shows the
+// ladder and the upgrade path rather than a dead screen.
//
// All five states are designed: a skeleton ladder while loading, a connect/sign-in
-// prompt when there's no wallet in hand, an actionable error with retry, the
-// populated ladder, and graceful overflow at $10M+ holdings.
+// prompt when there's no wallet in hand, an actionable error with retry that keeps
+// the page heading, the populated ladder, and graceful overflow at $10M+ holdings.
import { getConnectedWalletAddress, getConnectedWallet, connectWallet } from './wallet.js';
import { openSwapModal } from './swap-jupiter.js';
@@ -90,26 +93,31 @@ async function loadState() {
// ── render ──────────────────────────────────────────────────────────────────
+// Who we are showing a tier for. 'wallet' means a Solana wallet is in hand (connected
+// on this page or linked to the session) and its real on-chain tier is highlighted;
+// 'signed_in' is an account with no wallet yet; 'anonymous' is a plain visitor.
+function resolveIdentity({ tier, access, wallet }) {
+ const linked = Boolean(wallet) || Boolean(tier?.wallet_linked ?? access?.wallet_linked);
+ if (linked) return 'wallet';
+ const signedIn = Boolean(tier?.signed_in ?? access?.signed_in);
+ return signedIn ? 'signed_in' : 'anonymous';
+}
+
function render(root, state) {
- const { tier, access, wallet } = state;
+ const { tier, access } = state;
if (!tier || !Array.isArray(tier.ladder) || tier.ladder.length === 0) {
- // No ladder at all → a real (rare) outage. Offer a retry; the ladder is the
- // page, so there's nothing useful to show without it.
- root.innerHTML = errorStateHTML({
- title: "Couldn't load the $THREE tiers",
- body: 'The tier ladder is resolved live on-chain. Check your connection and try again.',
- });
- const retry = root.querySelector('[data-sk-retry]');
- if (retry) retry.addEventListener('click', () => boot(root));
+ // No ladder at all: a real (rare) outage, since the server answers the public
+ // ladder even to anonymous callers. Keep the heading, offer a retry.
+ renderFailure(root, 'The tier ladder is resolved live on-chain. Check your connection and try again.');
return;
}
const ladder = tier.ladder;
const heldUsd = Number(tier.held_usd) || 0;
- const signedOut = !wallet && !(access?.wallet_linked);
- // With no wallet in hand we don't claim a tier — show the neutral ladder + a
+ const identity = resolveIdentity(state);
+ // With no wallet in hand we don't claim a tier: show the neutral ladder and a
// connect prompt rather than presumptuously marking Member as "You're here".
- const currentLevel = signedOut ? -1 : Number(tier.tier?.level) || 0;
+ const currentLevel = identity === 'wallet' ? Number(tier.tier?.level) || 0 : -1;
// Group the gated features by the tier level that unlocks them, so each ladder
// card lists the concrete things it turns on (with Live vs Planned honesty).
@@ -121,7 +129,7 @@ function render(root, state) {
}
root.innerHTML =
- renderHero({ tier, heldUsd, currentLevel, signedOut }) +
+ renderHero({ tier, heldUsd, currentLevel, identity }) +
`<ol class="tt-ladder" role="list" aria-label="$THREE holder tiers">` +
ladder.map((t) => renderTier(t, { currentLevel, heldUsd, featuresByLevel })).join('') +
`</ol>` +
@@ -131,18 +139,23 @@ function render(root, state) {
enableRovingFocus(root);
}
-function renderHero({ tier, heldUsd, currentLevel, signedOut }) {
+function renderHero({ tier, heldUsd, currentLevel, identity }) {
const cur = tier.tier || { id: 'member', label: 'Member' };
const next = tier.next; // { id, label, min_usd, usd_to_go } | null
const isHolder = currentLevel >= 1;
let statusLine;
let cta;
- if (signedOut) {
+ if (identity === 'anonymous') {
statusLine = `Connect your wallet or sign in to see your tier and what you've unlocked.`;
cta =
`<button type="button" class="tt-btn tt-btn--primary" data-tt-connect>Connect wallet</button>` +
`<a class="tt-btn tt-btn--ghost" href="${SIGN_IN_URL}">Sign in</a>`;
+ } else if (identity === 'signed_in') {
+ statusLine = `You're signed in, but no Solana wallet is linked yet. Connect one and your tier resolves live from the $THREE it holds.`;
+ cta =
+ `<button type="button" class="tt-btn tt-btn--primary" data-tt-connect>Connect wallet</button>` +
+ `<a class="tt-btn tt-btn--ghost" href="${PRICE_URL}">Price &amp; chart</a>`;
} else if (next) {
const toGo = Number(next.usd_to_go) || Math.max(0, (Number(next.min_usd) || 0) - heldUsd);
statusLine = isHolder
@@ -152,24 +165,33 @@ function renderHero({ tier, heldUsd, currentLevel, signedOut }) {
`<button type="button" class="tt-btn tt-btn--primary" data-tt-buy>Hold more $THREE</button>` +
`<a class="tt-btn tt-btn--ghost" href="${PRICE_URL}">Price &amp; chart</a>`;
} else {
- // Top of the ladder — nothing left to upgrade to.
- statusLine = `You're <strong>${esc(cur.label)}</strong>, holding ${fmtCompactUsd(heldUsd)} of $THREE — the top tier. Every holder perk is unlocked.`;
+ // Top of the ladder : nothing left to upgrade to.
+ statusLine = `You're <strong>${esc(cur.label)}</strong>, holding ${fmtCompactUsd(heldUsd)} of $THREE: the top tier. Every holder perk is unlocked.`;
cta =
`<button type="button" class="tt-btn tt-btn--primary" data-tt-buy>Add to your bag</button>` +
`<a class="tt-btn tt-btn--ghost" href="${PRICE_URL}">Price &amp; chart</a>`;
}
- const chip = !signedOut && currentLevel >= 1
+ const chip = identity === 'wallet' && currentLevel >= 1
? `<span class="tt-hero-chip ${tone(cur.id)}"><span aria-hidden="true">◆</span> ${esc(cur.label)}</span>`
: '';
+ return heroShell(
+ `<p class="tt-lede">${statusLine}</p>` +
+ `<div class="tt-hero-actions">${cta}</div>` +
+ `<p class="tt-hero-foot">Holding (not spending) $THREE is the status lever: fee discounts on compute, higher free quotas, and private worlds. $THREE is the only coin on three.ws. Draft &amp; Standard generation stay free, forever.</p>`,
+ chip,
+ );
+}
+
+// The eyebrow + h1 every state shares (loading, failure, populated), so the page
+// always has exactly one heading and a reader always knows where they are.
+function heroShell(body = '', chip = '') {
return (
`<header class="tt-hero">` +
`<p class="tt-eyebrow">$THREE · Hold-to-access</p>` +
`<h1 class="tt-h1">Hold $THREE. Unlock more.${chip}</h1>` +
- `<p class="tt-lede">${statusLine}</p>` +
- `<div class="tt-hero-actions">${cta}</div>` +
- `<p class="tt-hero-foot">Holding (not spending) $THREE is the status lever — fee discounts on compute, higher free quotas, and private worlds. $THREE is the only coin on three.ws. Draft &amp; Standard generation stay free, forever.</p>` +
+ body +
`</header>`
);
}
@@ -203,7 +225,7 @@ function renderTier(t, { currentLevel, heldUsd, featuresByLevel }) {
: `<span class="tt-status tt-status--togo">${fmtUsd(toGo, toGo < 1 ? 2 : 0)} to go</span>`;
const perks = (t.perks || [])
- .map((p) => `<li class="tt-perk"><span class="tt-perk-tick" aria-hidden="true">✦</span>${esc(p)}</li>`)
+ .map((p) => `<li class="tt-perk"><span class="tt-perk-tick" aria-hidden="true">✦</span><span class="tt-perk-text">${esc(p)}</span></li>`)
.join('');
// Concrete gated features that unlock at this tier, with Live/Planned honesty
@@ -222,7 +244,7 @@ function renderTier(t, { currentLevel, heldUsd, featuresByLevel }) {
return (
`<li class="tt-tier ${tone(t.id)}${isCurrent ? ' tt-tier--current' : ''}${isCleared ? ' tt-tier--cleared' : ''}" ` +
`tabindex="-1" aria-current="${isCurrent ? 'true' : 'false'}" ` +
- `aria-label="${esc(t.label)} tier — ${esc(threshold)}${isCurrent ? ', your current tier' : ''}">` +
+ `aria-label="${esc(t.label)} tier, ${esc(threshold)}${isCurrent ? ', your current tier' : ''}">` +
`<div class="tt-tier-head">` +
`<span class="tt-tier-mark" aria-hidden="true">◆</span>` +
`<div class="tt-tier-id"><span class="tt-tier-name">${esc(t.label)}</span>` +
@@ -239,7 +261,7 @@ function renderTier(t, { currentLevel, heldUsd, featuresByLevel }) {
function renderFooter() {
return (
`<footer class="tt-page-foot">` +
- `<p>Your tier is resolved live from the USD value of $THREE your wallet holds — nothing is stored, nothing is spent. Sell and your tier adjusts; the lever rewards holding.</p>` +
+ `<p>Your tier is resolved live from the USD value of $THREE your wallet holds: nothing is stored, nothing is spent. Sell and your tier adjusts; the lever rewards holding.</p>` +
`<p class="tt-mint">Contract: <a href="https://solscan.io/token/${THREE_MINT}" target="_blank" rel="noopener">${THREE_MINT}</a></p>` +
`</footer>`
);
@@ -348,13 +370,21 @@ function renderLoading(root) {
`<span class="tt-sk tt-sk--line"></span><span class="tt-sk tt-sk--line tt-sk--short"></span>` +
`</li>`;
root.innerHTML =
- `<header class="tt-hero"><p class="tt-eyebrow">$THREE · Hold-to-access</p>` +
- `<h1 class="tt-h1">Hold $THREE. Unlock more.</h1>` +
- `<span class="tt-sk tt-sk--lede"></span></header>` +
+ heroShell(`<span class="tt-sk tt-sk--lede"></span>`) +
`<ol class="tt-ladder" role="list" aria-busy="true">${card().repeat(5)}</ol>` +
`<span class="tt-sr" role="status">Loading your $THREE tier…</span>`;
}
+// The failure state keeps the page heading above the error card, so the h1 and
+// the page's identity survive an outage, and Retry re-runs the whole boot.
+function renderFailure(root, body) {
+ root.innerHTML =
+ heroShell() +
+ errorStateHTML({ title: "Couldn't load the $THREE tiers", body });
+ const retry = root.querySelector('[data-sk-retry]');
+ if (retry) retry.addEventListener('click', () => boot(root));
+}
+
async function boot(root) {
injectStyles();
renderLoading(root);
@@ -362,12 +392,7 @@ async function boot(root) {
const state = await loadState();
render(root, state);
} catch {
- root.innerHTML = errorStateHTML({
- title: "Couldn't load the $THREE tiers",
- body: 'Something went wrong resolving your tier. Try again.',
- });
- const retry = root.querySelector('[data-sk-retry]');
- if (retry) retry.addEventListener('click', () => boot(root));
+ renderFailure(root, 'Something went wrong resolving your tier. Try again.');
}
}
@@ -390,7 +415,7 @@ function mount() {
}
boot(root);
- // A wallet connect/disconnect/switch changes whose tier we're showing — re-resolve.
+ // A wallet connect/disconnect/switch changes whose tier we're showing, so re-resolve.
if (typeof window !== 'undefined') {
let last = null;
try {
@@ -478,6 +503,7 @@ function injectStyles() {
.tt-perks{list-style:none;margin:13px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:7px 16px;}
.tt-perk{display:flex;gap:8px;align-items:flex-start;font-size:13px;line-height:1.45;color:#c7c7d0;}
+ .tt-perk-text{flex:1;min-width:0;}
.tt-perk-tick{flex-shrink:0;color:#6ee7a8;font-size:11px;line-height:1.5;}
.tt-gold .tt-perk-tick{color:#f5c451;}
.tt-silver .tt-perk-tick{color:#cfd6e4;}
diff --git a/tests/three-tier-public.test.js b/tests/three-tier-public.test.js
index 47c8f0432..f847da0b1 100644
--- a/tests/three-tier-public.test.js
+++ b/tests/three-tier-public.test.js
@@ -74,6 +74,21 @@ beforeAll(async () => {
({ verifyTierPass } = await import('../api/_lib/three-tier.js'));
});
+describe('GET /api/three/tier (no session, no wallet)', () => {
+ it('answers the public ladder at the Member floor instead of a 401, so /three renders for every visitor', async () => {
+ const res = mockRes();
+ await handler(mockReq({ url: '/api/three/tier' }), res);
+ expect(res.statusCode).toBe(200);
+ expect(res.json.signed_in).toBe(false);
+ expect(res.json.wallet_linked).toBe(false);
+ expect(res.json.source).toBe('public');
+ expect(res.json.tier.id).toBe('member');
+ expect(res.json.held_usd).toBe(0);
+ expect(res.json.next).toMatchObject({ id: 'bronze', min_usd: 25, usd_to_go: 25 });
+ expect(res.json.ladder.map((t) => t.id)).toEqual(['member', 'bronze', 'silver', 'gold', 'genesis']);
+ });
+});
+
describe('GET /api/three/tier?wallet=', () => {
it('resolves Member for a zero-balance wallet, no account needed', async () => {
getBalances.mockResolvedValue({ tokens: [] });