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(vercel): move gmgn.js before wildcard in functions config

nirholasf61ce47cabc9
diff --git a/pages/home.html b/pages/home.html
index 8a2a39885..d2901618d 100644
--- a/pages/home.html
+++ b/pages/home.html
@@ -250,6 +250,93 @@
</div>
</section>
+ <!-- ── How it works ── -->
+ <section class="h-journey" aria-label="How it works">
+ <div class="h-journey-inner">
+ <div class="h-journey-header h-reveal">
+ <p class="h-section-label">How it works</p>
+ <h2 class="h-journey-title">From selfie to<br /><em>earning agent</em> in four steps.</h2>
+ </div>
+ <ol class="h-journey-steps">
+ <li class="h-journey-step h-reveal">
+ <a href="/create" class="h-journey-card">
+ <div class="h-jc-num">01</div>
+ <div class="h-jc-icon" aria-hidden="true">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
+ <circle cx="12" cy="8" r="4"/>
+ <path d="M4 20c0-4 3.6-7 8-7s8 3 8 7"/>
+ <path d="M16 3.5a4 4 0 010 9"/>
+ </svg>
+ </div>
+ <div class="h-jc-body">
+ <h3>Create your avatar</h3>
+ <p>Snap a selfie or upload a GLB. three.ws renders a full-body 3D agent in the browser — no software to install.</p>
+ </div>
+ <span class="h-jc-cta">Start creating →</span>
+ </a>
+ </li>
+ <li class="h-journey-step h-reveal">
+ <a href="/dashboard-next/agents" class="h-journey-card">
+ <div class="h-jc-num">02</div>
+ <div class="h-jc-icon" aria-hidden="true">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
+ <rect x="5" y="2" width="14" height="14" rx="3"/>
+ <circle cx="9" cy="8" r="1.2"/>
+ <circle cx="15" cy="8" r="1.2"/>
+ <path d="M9 11.5h6M2 19l3-3h14l3 3v2a1 1 0 01-1 1H3a1 1 0 01-1-1v-2z"/>
+ </svg>
+ </div>
+ <div class="h-jc-body">
+ <h3>Build your agent</h3>
+ <p>Give your avatar a name, on-chain identity, and AI brain. Connect Claude, GPT, or your own model over MCP or A2A — no rewrites required.</p>
+ </div>
+ <span class="h-jc-cta">Configure agent →</span>
+ </a>
+ </li>
+ <li class="h-journey-step h-reveal">
+ <a href="/dashboard-next/widgets" class="h-journey-card">
+ <div class="h-jc-num">03</div>
+ <div class="h-jc-icon" aria-hidden="true">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
+ <rect x="2" y="3" width="9" height="9" rx="1.5"/>
+ <rect x="13" y="3" width="9" height="9" rx="1.5"/>
+ <rect x="2" y="14" width="9" height="9" rx="1.5"/>
+ <rect x="13" y="14" width="9" height="9" rx="1.5"/>
+ </svg>
+ </div>
+ <div class="h-jc-body">
+ <h3>Embed anywhere</h3>
+ <p>Drop a single <code>&lt;threews-avatar&gt;</code> tag on any site. Chat widget, floating button, full-screen — five widget types, one line of HTML.</p>
+ </div>
+ <span class="h-jc-cta">Create widget →</span>
+ </a>
+ </li>
+ <li class="h-journey-step h-reveal">
+ <a href="/dashboard-next/monetize" class="h-journey-card">
+ <div class="h-jc-num">04</div>
+ <div class="h-jc-icon" aria-hidden="true">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
+ <circle cx="12" cy="12" r="8.5"/>
+ <path d="M12 7v10M9 9.5h4.5a2.5 2.5 0 010 5H10a2.5 2.5 0 000 5H14"/>
+ </svg>
+ </div>
+ <div class="h-jc-body">
+ <h3>Start earning</h3>
+ <p>Charge per message, set a subscription, or accept tips in USDC. Your agent earns while you sleep — withdrawals land in your Solana wallet.</p>
+ </div>
+ <span class="h-jc-cta">Set up monetization →</span>
+ </a>
+ </li>
+ </ol>
+ <div class="h-journey-footer h-reveal">
+ <a href="/create" class="h-btn-primary">
+ <span>Build your agent now</span>
+ <span class="arrow">→</span>
+ </a>
+ </div>
+ </div>
+ </section>
+
<!-- ── Act 2: Pick & Animate ── -->
<section class="h-act h-act--animate" data-act="2" id="pick-animate">
<div class="h-act-warp h-act-warp--amber" aria-hidden="true"></div>
diff --git a/public/home-polish.css b/public/home-polish.css
index e5c6c78d7..12edb2c85 100644
--- a/public/home-polish.css
+++ b/public/home-polish.css
@@ -349,6 +349,177 @@
#deploy-act,
.h-bento-section,
.h-dev-section,
-.h-cta-section {
+.h-cta-section,
+.h-journey {
scroll-margin-top: 88px;
}
+
+/* ── How it works — journey section ─────────────────────────────────────── */
+
+.h-journey {
+ position: relative;
+ padding: clamp(64px, 8vw, 100px) 24px;
+ background: linear-gradient(180deg, rgba(8, 8, 14, 0) 0%, rgba(16, 14, 28, 0.6) 50%, rgba(8, 8, 14, 0) 100%);
+}
+
+.h-journey-inner {
+ max-width: 1140px;
+ margin: 0 auto;
+}
+
+.h-journey-header {
+ text-align: center;
+ margin-bottom: clamp(40px, 5vw, 64px);
+}
+
+.h-journey-title {
+ font-family: 'Space Grotesk', 'Inter', sans-serif;
+ font-size: clamp(2rem, 3.8vw, 3.2rem);
+ font-weight: 700;
+ color: #fff;
+ line-height: 1.1;
+ letter-spacing: -0.03em;
+ margin: 0;
+ text-wrap: balance;
+}
+
+.h-journey-title em {
+ font-style: normal;
+ background: linear-gradient(135deg, #ffb940 0%, #ff7a3d 100%);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+}
+
+.h-journey-steps {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ display: grid;
+ grid-template-columns: repeat(4, minmax(0, 1fr));
+ gap: 16px;
+}
+
+@media (max-width: 900px) {
+ .h-journey-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+}
+
+@media (max-width: 540px) {
+ .h-journey-steps { grid-template-columns: 1fr; }
+}
+
+.h-journey-card {
+ display: flex;
+ flex-direction: column;
+ gap: 14px;
+ padding: 24px 22px;
+ border-radius: 16px;
+ background: rgba(255, 255, 255, 0.03);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ backdrop-filter: blur(8px);
+ -webkit-backdrop-filter: blur(8px);
+ text-decoration: none;
+ color: inherit;
+ transition:
+ border-color 0.22s ease,
+ background 0.22s ease,
+ transform 0.22s ease,
+ box-shadow 0.22s ease;
+ position: relative;
+ overflow: hidden;
+}
+
+.h-journey-card::before {
+ content: '';
+ position: absolute;
+ inset: 0;
+ background: radial-gradient(circle at 30% 20%, rgba(255, 175, 60, 0.06) 0%, transparent 70%);
+ opacity: 0;
+ transition: opacity 0.3s ease;
+ pointer-events: none;
+}
+
+.h-journey-card:hover {
+ border-color: rgba(255, 175, 60, 0.3);
+ background: rgba(255, 255, 255, 0.055);
+ transform: translateY(-4px);
+ box-shadow: 0 20px 48px -16px rgba(255, 143, 60, 0.18);
+}
+
+.h-journey-card:hover::before { opacity: 1; }
+
+.h-jc-num {
+ font-family: 'Space Grotesk', 'Inter', sans-serif;
+ font-size: 11px;
+ font-weight: 700;
+ letter-spacing: 0.14em;
+ color: rgba(255, 175, 60, 0.7);
+ text-transform: uppercase;
+}
+
+.h-jc-icon {
+ width: 44px;
+ height: 44px;
+ border-radius: 12px;
+ background: rgba(255, 175, 60, 0.1);
+ border: 1px solid rgba(255, 175, 60, 0.18);
+ display: grid;
+ place-items: center;
+ color: rgba(255, 175, 60, 0.9);
+ flex-shrink: 0;
+ transition: background 0.2s ease, border-color 0.2s ease;
+}
+
+.h-journey-card:hover .h-jc-icon {
+ background: rgba(255, 175, 60, 0.16);
+ border-color: rgba(255, 175, 60, 0.35);
+}
+
+.h-jc-body {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+}
+
+.h-jc-body h3 {
+ font-family: 'Space Grotesk', 'Inter', sans-serif;
+ font-size: 16px;
+ font-weight: 600;
+ color: #fff;
+ margin: 0;
+ letter-spacing: -0.01em;
+}
+
+.h-jc-body p {
+ font-size: 13.5px;
+ line-height: 1.55;
+ color: rgba(255, 255, 255, 0.5);
+ margin: 0;
+}
+
+.h-jc-body code {
+ font-family: 'Space Mono', 'Fira Code', monospace;
+ font-size: 12px;
+ background: rgba(255, 255, 255, 0.07);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 4px;
+ padding: 1px 5px;
+ color: rgba(255, 175, 60, 0.85);
+}
+
+.h-jc-cta {
+ font-size: 13px;
+ font-weight: 600;
+ color: rgba(255, 175, 60, 0.7);
+ margin-top: auto;
+ transition: color 0.18s ease;
+}
+
+.h-journey-card:hover .h-jc-cta { color: rgba(255, 175, 60, 1); }
+
+.h-journey-footer {
+ display: flex;
+ justify-content: center;
+ margin-top: clamp(40px, 5vw, 56px);
+}
diff --git a/src/dashboard-next/pages/account.js b/src/dashboard-next/pages/account.js
index 21cd6ce66..5dcde2e40 100644
--- a/src/dashboard-next/pages/account.js
+++ b/src/dashboard-next/pages/account.js
@@ -127,6 +127,19 @@ async function copyToClipboard(text) {
<div data-slot="wallets"><div class="dn-skeleton" style="height:120px"></div></div>
</section>
+ <section class="dn-panel" data-section="vanity">
+ <div style="display:flex;justify-content:space-between;align-items:start;gap:16px;margin-bottom:14px;flex-wrap:wrap">
+ <div>
+ <div class="dn-panel-title">Vanity wallets</div>
+ <div class="dn-panel-sub" style="margin:0">Generate wallet addresses with a custom prefix — Solana vanity keypair or Ethereum CREATE2 contract address.</div>
+ </div>
+ </div>
+ <div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px">
+ <a class="dn-btn" href="/vanity-wallet" target="_blank" rel="noopener" style="justify-content:center">Solana vanity ✦ ↗</a>
+ <a class="dn-btn" href="/eth-vanity" target="_blank" rel="noopener" style="justify-content:center">ETH vanity (CREATE2) ✦ ↗</a>
+ </div>
+ </section>
+
<section class="dn-panel" data-section="sns">
<div style="display:flex;justify-content:space-between;align-items:start;gap:16px;margin-bottom:14px;flex-wrap:wrap">
<div>
@@ -159,6 +172,16 @@ async function copyToClipboard(text) {
</div>
<div data-slot="actions"><div class="dn-skeleton" style="height:200px"></div></div>
</section>
+
+ <section class="dn-panel" data-section="quick-links">
+ <div class="dn-panel-title" style="margin-bottom:12px">More settings</div>
+ <div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px">
+ <a class="dn-btn" href="/dashboard-next/settings" style="justify-content:center">Sessions &amp; notifications →</a>
+ <a class="dn-btn" href="/dashboard-next/settings" style="justify-content:center">Storage &amp; LLM usage →</a>
+ <a class="dn-btn" href="/dashboard-next/settings" style="justify-content:center">Preferences →</a>
+ <a class="dn-btn" href="/onchain" target="_blank" rel="noopener" style="justify-content:center">ERC-8004 registry ↗</a>
+ </div>
+ </section>
</div>
`;
diff --git a/src/dashboard-next/pages/home.js b/src/dashboard-next/pages/home.js
index 2dfd5d176..f55fe983e 100644
--- a/src/dashboard-next/pages/home.js
+++ b/src/dashboard-next/pages/home.js
@@ -10,6 +10,7 @@ import { requireUser, get, esc, relTime, ApiError } from '../api.js';
const POLL_MS = 30_000;
const DAYS_WINDOW = 7;
const REL_TIME_TICK_MS = 60_000;
+const ONBOARDING_DISMISSED_KEY = 'twx_onboarding_dismissed';
const STATE = {
pollHandle: null,
@@ -22,10 +23,15 @@ const STATE = {
const me = await requireUser();
const greeting = me.display_name || me.username || (me.email ? me.email.split('@')[0] : 'creator');
+ const isNew = !me.created_at || (Date.now() - new Date(me.created_at).getTime()) < 30 * 86400_000;
+ const dismissed = localStorage.getItem(ONBOARDING_DISMISSED_KEY) === '1';
+
main.innerHTML = `
<h1 class="dn-h1">Welcome back, ${esc(greeting)}.</h1>
<p class="dn-h1-sub">Your live avatars, revenue, widget reach, and the latest visitor activity.</p>
+ ${!dismissed ? `<section data-slot="onboarding" class="dnx-onboarding-wrap"></section>` : ''}
+
<div class="dnx-grid">
<div class="dnx-col-main">
<section data-slot="hero" class="dnx-hero"></section>
@@ -40,6 +46,7 @@ const STATE = {
renderSkeletons(main);
const slots = {
+ onboarding: main.querySelector('[data-slot="onboarding"]'),
hero: main.querySelector('[data-slot="hero"]'),
kpis: main.querySelector('[data-slot="kpis"]'),
quick: main.querySelector('[data-slot="quick"]'),
@@ -48,16 +55,22 @@ const STATE = {
renderQuickActions(slots.quick);
- const [avatarsRes, widgetsRes] = await Promise.allSettled([
+ const [avatarsRes, widgetsRes, agentsRes] = await Promise.allSettled([
get('/api/avatars?limit=50'),
get('/api/widgets'),
+ get('/api/agents?limit=1'),
]);
const avatars = avatarsRes.status === 'fulfilled' ? (avatarsRes.value?.avatars ?? []) : [];
const widgets = widgetsRes.status === 'fulfilled' ? (widgetsRes.value?.widgets ?? []) : [];
+ const agents = agentsRes.status === 'fulfilled' ? (agentsRes.value?.agents ?? []) : [];
renderHero(slots.hero, avatars, avatarsRes.status === 'rejected' ? avatarsRes.reason : null);
+ if (slots.onboarding) {
+ renderOnboarding(slots.onboarding, { avatars, agents, widgets });
+ }
+
const refresh = async () => {
await Promise.all([
refreshKpis(slots.kpis, { avatars, widgets }),
@@ -358,6 +371,91 @@ function repaintRelTimes(host) {
const ICON_CHAT = '<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 4h10v7H6l-3 2.5V4z"/></svg>';
const ICON_COIN = '<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="5.5"/><path d="M8 5v6M6 7h3.2a1.2 1.2 0 010 2.4H7a1.2 1.2 0 000 2.4h3.2"/></svg>';
+// ── Onboarding checklist ──────────────────────────────────────────────────
+
+function renderOnboarding(host, { avatars, agents, widgets }) {
+ const steps = [
+ {
+ id: 'avatar',
+ label: 'Create your first avatar',
+ sub: 'Snap a selfie — your 3D agent is ready in under 60 seconds.',
+ href: '/create',
+ cta: 'Create avatar',
+ done: avatars.length > 0,
+ },
+ {
+ id: 'agent',
+ label: 'Build an agent identity',
+ sub: 'Give your avatar a name, personality, and on-chain address.',
+ href: '/dashboard-next/agents',
+ cta: 'Set up agent',
+ done: agents.length > 0,
+ },
+ {
+ id: 'widget',
+ label: 'Embed a chat widget',
+ sub: 'Drop your agent onto any website with a single HTML tag.',
+ href: '/dashboard-next/widgets',
+ cta: 'Create widget',
+ done: widgets.length > 0,
+ },
+ {
+ id: 'monetize',
+ label: 'Start earning',
+ sub: 'Charge per message, set a subscription, or let fans tip.',
+ href: '/dashboard-next/monetize',
+ cta: 'Set up monetization',
+ done: false,
+ },
+ ];
+
+ const doneCount = steps.filter((s) => s.done).length;
+ if (doneCount === steps.length) {
+ host.remove();
+ return;
+ }
+
+ const pct = Math.round((doneCount / steps.length) * 100);
+
+ host.innerHTML = `
+ <div class="dn-panel dnx-ob" id="dnx-onboarding">
+ <div class="dnx-ob-head">
+ <div>
+ <div class="dn-panel-title" style="margin:0 0 2px">Getting started</div>
+ <div class="dn-panel-sub" style="margin:0">${doneCount} of ${steps.length} steps complete</div>
+ </div>
+ <button class="dnx-ob-dismiss" aria-label="Dismiss getting started" title="Dismiss">
+ <svg viewBox="0 0 12 12" width="10" height="10" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M1 1l10 10M11 1L1 11"/></svg>
+ </button>
+ </div>
+ <div class="dnx-ob-bar" role="progressbar" aria-valuenow="${pct}" aria-valuemin="0" aria-valuemax="100">
+ <div class="dnx-ob-fill" style="width:${pct}%"></div>
+ </div>
+ <ol class="dnx-ob-steps">
+ ${steps.map((s, i) => `
+ <li class="dnx-ob-step ${s.done ? 'is-done' : ''}">
+ <span class="dnx-ob-num" aria-hidden="true">
+ ${s.done
+ ? `<svg viewBox="0 0 14 14" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 7l3.5 3.5L12 3"/></svg>`
+ : `${i + 1}`}
+ </span>
+ <div class="dnx-ob-text">
+ <span class="dnx-ob-label">${esc(s.label)}</span>
+ <span class="dnx-ob-sub">${esc(s.sub)}</span>
+ </div>
+ ${!s.done ? `<a class="dn-btn dnx-ob-btn" href="${s.href}">${esc(s.cta)} →</a>` : ''}
+ </li>
+ `).join('')}
+ </ol>
+ </div>
+ `;
+
+ host.querySelector('.dnx-ob-dismiss').addEventListener('click', () => {
+ localStorage.setItem(ONBOARDING_DISMISSED_KEY, '1');
+ host.remove();
+ });
+}
+
// ── Quick actions ─────────────────────────────────────────────────────────
function renderQuickActions(host) {
@@ -609,6 +707,65 @@ function injectStyles() {
.dnx-activity-icon { color: var(--nxt-ink-fade); display: inline-grid; place-items: center; }
.dnx-activity-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dnx-activity-time { color: var(--nxt-ink-fade); font-size: 12px; font-variant-numeric: tabular-nums; }
+
+ /* ── Onboarding checklist ── */
+ .dnx-onboarding-wrap { margin-bottom: 4px; }
+ .dnx-ob { padding: 18px 20px; }
+ .dnx-ob-head {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ margin-bottom: 12px;
+ }
+ .dnx-ob-dismiss {
+ background: none; border: none; cursor: pointer;
+ color: var(--nxt-ink-fade); padding: 4px; border-radius: 6px;
+ display: grid; place-items: center; flex-shrink: 0;
+ transition: color 0.12s ease, background 0.12s ease;
+ }
+ .dnx-ob-dismiss:hover { color: var(--nxt-ink); background: rgba(255,255,255,0.06); }
+ .dnx-ob-bar {
+ height: 4px; border-radius: 4px;
+ background: var(--nxt-stroke);
+ margin-bottom: 16px; overflow: hidden;
+ }
+ .dnx-ob-fill {
+ height: 100%; border-radius: 4px;
+ background: var(--nxt-accent);
+ transition: width 0.4s ease;
+ }
+ .dnx-ob-steps {
+ list-style: none; padding: 0; margin: 0;
+ display: flex; flex-direction: column; gap: 2px;
+ }
+ .dnx-ob-step {
+ display: flex; align-items: center; gap: 12px;
+ padding: 9px 8px; border-radius: 8px;
+ transition: background 0.12s ease;
+ }
+ .dnx-ob-step:hover { background: rgba(255,255,255,0.04); }
+ .dnx-ob-step.is-done { opacity: 0.5; }
+ .dnx-ob-num {
+ width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
+ display: grid; place-items: center;
+ font-size: 11px; font-weight: 600;
+ background: var(--nxt-accent-soft);
+ color: var(--nxt-accent-strong);
+ border: 1px solid rgba(154,124,255,0.2);
+ }
+ .dnx-ob-step.is-done .dnx-ob-num {
+ background: rgba(52,199,89,0.12);
+ color: #34c759;
+ border-color: rgba(52,199,89,0.25);
+ }
+ .dnx-ob-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
+ .dnx-ob-label { font-size: 13.5px; font-weight: 500; color: var(--nxt-ink); }
+ .dnx-ob-sub { font-size: 12px; color: var(--nxt-ink-fade); }
+ .dnx-ob-btn { flex-shrink: 0; font-size: 12px; padding: 5px 10px; white-space: nowrap; }
+ @media (max-width: 600px) {
+ .dnx-ob-step { flex-wrap: wrap; }
+ .dnx-ob-btn { margin-left: 36px; }
+ }
`;
const tag = document.createElement('style');
tag.id = 'dnx-home-styles';
diff --git a/src/dashboard-next/pages/monetize.js b/src/dashboard-next/pages/monetize.js
index 0bb860220..b468543cb 100644
--- a/src/dashboard-next/pages/monetize.js
+++ b/src/dashboard-next/pages/monetize.js
@@ -5,7 +5,7 @@
// from real /api/* endpoints — no mocks.
import { mountShell } from '../shell.js';
-import { requireUser, get, post, esc, relTime, formatUsdc, ApiError } from '../api.js';
+import { requireUser, get, post, put, del, esc, relTime, formatUsdc, ApiError } from '../api.js';
const USDC_MINTS = {
solana: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
@@ -100,11 +100,10 @@ async function loadAndRender(host, me) {
host.appendChild(renderHero({ available, revenue, creatorPlans, subscribedTo, pendingRoyaltyAtomics }));
host.appendChild(renderRevenueChart({ initial: revenue, defaultRange: '30d' }));
host.appendChild(renderPaymentsPanel(payments));
+ host.appendChild(renderSubscriptionPlans({ creatorPlans, me }));
host.appendChild(renderWithdrawals({ withdrawals, wallets, available, host, me }));
host.appendChild(renderPlanUsage(summary));
-
- const tokensPanel = renderTokensPanel(agents);
- if (tokensPanel) host.appendChild(tokensPanel);
+ host.appendChild(renderTokensPanel(agents));
}
async function safe(fn) {
@@ -821,13 +820,36 @@ function renderTokensPanel(agents) {
const m = a?.meta?.pumpfun || a?.meta?.token;
return Boolean(m?.mint || m?.address || m?.ca);
});
- if (!launched.length) return null;
const panel = document.createElement('div');
panel.className = 'dn-panel';
+
+ if (!launched.length) {
+ 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">Token earnings</div>
+ <div class="dn-panel-sub" style="margin:2px 0 0">Royalties from Pump.fun tokens your agents launched.</div>
+ </div>
+ <a class="dn-btn" href="/dashboard-next/tokens">Token dashboard →</a>
+ </div>
+ <div class="dn-empty">
+ <h3>No tokens launched</h3>
+ <p>Launch a Pump.fun token from any agent to earn royalties on every trade.</p>
+ <a class="dn-btn primary" href="/dashboard-next/agents">Go to Agents →</a>
+ </div>
+ `;
+ return panel;
+ }
+
panel.innerHTML = `
- <div class="dn-panel-title">Token earnings</div>
- <div class="dn-panel-sub" style="margin:2px 0 12px">Agents you've launched on Pump.fun.</div>
+ <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">Token earnings</div>
+ <div class="dn-panel-sub" style="margin:2px 0 0">Royalties from Pump.fun tokens your agents launched.</div>
+ </div>
+ <a class="dn-btn" href="/dashboard-next/tokens">Full token dashboard →</a>
+ </div>
<div style="overflow-x:auto">
<table style="width:100%;border-collapse:collapse;font-size:13px;min-width:520px">
<thead>
@@ -865,6 +887,262 @@ function renderTokensPanel(agents) {
return panel;
}
+// ── Subscription plans (creator) ───────────────────────────────────────────
+
+function renderSubscriptionPlans({ creatorPlans, me }) {
+ const panel = document.createElement('div');
+ panel.className = 'dn-panel';
+
+ let plans = [...creatorPlans];
+
+ function paint() {
+ 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">Subscription plans</div>
+ <div class="dn-panel-sub" style="margin:2px 0 0">Plans you offer — users can subscribe to unlock premium access to your agents.</div>
+ </div>
+ <button class="dn-btn primary" data-action="create-plan">+ New plan</button>
+ </div>
+ <div data-slot="plans-list"></div>
+ `;
+
+ const listHost = panel.querySelector('[data-slot="plans-list"]');
+
+ if (!plans.length) {
+ listHost.innerHTML = `
+ <div class="dn-empty">
+ <h3>No subscription plans</h3>
+ <p>Create a plan to let users subscribe to your agents and unlock premium skills.</p>
+ </div>`;
+ } else {
+ listHost.innerHTML = `
+ <div style="overflow-x:auto">
+ <table style="width:100%;border-collapse:collapse;font-size:13px;min-width:560px">
+ <thead>
+ <tr style="text-align:left;color:var(--nxt-ink-fade);border-bottom:1px solid var(--nxt-stroke)">
+ <th style="padding:8px 10px;font-weight:500">Plan</th>
+ <th style="padding:8px 10px;font-weight:500;text-align:right">Price</th>
+ <th style="padding:8px 10px;font-weight:500">Interval</th>
+ <th style="padding:8px 10px;font-weight:500">Status</th>
+ <th style="padding:8px 10px;font-weight:500"></th>
+ </tr>
+ </thead>
+ <tbody>
+ ${plans.map((p) => `
+ <tr style="border-bottom:1px solid var(--nxt-stroke)">
+ <td style="padding:10px">
+ <div style="font-weight:600">${esc(p.name || 'Unnamed plan')}</div>
+ ${p.description ? `<div style="font-size:12px;color:var(--nxt-ink-dim)">${esc(p.description.slice(0, 80))}</div>` : ''}
+ </td>
+ <td style="padding:10px;text-align:right;font-variant-numeric:tabular-nums">
+ $${esc(Number(p.price_usd || 0).toFixed(2))}
+ </td>
+ <td style="padding:10px;color:var(--nxt-ink-dim)">${esc(p.interval || 'monthly')}</td>
+ <td style="padding:10px">
+ ${p.active
+ ? `<span class="dn-tag success">Active</span>`
+ : `<span class="dn-tag">Inactive</span>`
+ }
+ </td>
+ <td style="padding:10px;text-align:right">
+ <div style="display:inline-flex;gap:6px">
+ <button class="dn-btn" data-action="edit-plan" data-id="${esc(p.id)}" style="padding:5px 10px;font-size:12px">Edit</button>
+ <button class="dn-btn danger" data-action="delete-plan" data-id="${esc(p.id)}" style="padding:5px 10px;font-size:12px">Delete</button>
+ </div>
+ </td>
+ </tr>
+ `).join('')}
+ </tbody>
+ </table>
+ </div>
+ `;
+ }
+
+ panel.querySelector('[data-action="create-plan"]').addEventListener('click', () => {
+ openPlanModal(null, (saved) => {
+ plans.unshift(saved);
+ paint();
+ });
+ });
+
+ panel.querySelectorAll('[data-action="edit-plan"]').forEach((btn) => {
+ btn.addEventListener('click', () => {
+ const plan = plans.find((p) => p.id === btn.dataset.id);
+ if (!plan) return;
+ openPlanModal(plan, (updated) => {
+ const idx = plans.findIndex((p) => p.id === updated.id);
+ if (idx >= 0) plans[idx] = updated;
+ paint();
+ });
+ });
+ });
+
+ panel.querySelectorAll('[data-action="delete-plan"]').forEach((btn) => {
+ btn.addEventListener('click', async () => {
+ const id = btn.dataset.id;
+ const plan = plans.find((p) => p.id === id);
+ if (!confirm(`Delete plan "${plan?.name || id}"?`)) return;
+ btn.disabled = true;
+ btn.textContent = 'Deleting…';
+ try {
+ await del(`/api/subscriptions/plans/${encodeURIComponent(id)}`);
+ plans = plans.filter((p) => p.id !== id);
+ paint();
+ toastMonetize('Plan deleted');
+ } catch (err) {
+ toastMonetize(err?.message || 'Delete failed');
+ btn.disabled = false;
+ btn.textContent = 'Delete';
+ }
+ });
+ });
+ }
+
+ paint();
+ return panel;
+}
+
+function openPlanModal(existing, onSaved) {
+ const overlay = document.createElement('div');
+ overlay.style.cssText = `
+ position:fixed;inset:0;z-index:1000;
+ background:rgba(8,9,14,0.72);backdrop-filter:blur(6px);
+ display:grid;place-items:center;padding:20px;
+ `;
+ overlay.innerHTML = `
+ <div role="dialog" aria-modal="true" style="
+ width:min(460px,100%);
+ background:linear-gradient(180deg,rgba(22,24,32,0.97),rgba(16,17,24,0.97));
+ border:1px solid var(--nxt-stroke-strong);border-radius:14px;padding:24px;
+ box-shadow:0 20px 60px rgba(0,0,0,0.6);
+ ">
+ <div style="font-size:16px;font-weight:600;margin-bottom:18px">${existing ? 'Edit plan' : 'Create plan'}</div>
+
+ <label style="display:flex;flex-direction:column;gap:6px;margin-bottom:12px">
+ <span style="font-size:12.5px;color:var(--nxt-ink-dim)">Plan name</span>
+ <input data-slot="name" type="text" maxlength="80" value="${esc(existing?.name || '')}"
+ placeholder="e.g. Pro access, VIP, Founder…"
+ style="padding:9px 12px;border-radius:8px;border:1px solid var(--nxt-stroke);background:rgba(255,255,255,0.04);color:var(--nxt-ink);font:inherit;font-size:13px" />
+ </label>
+
+ <label style="display:flex;flex-direction:column;gap:6px;margin-bottom:12px">
+ <span style="font-size:12.5px;color:var(--nxt-ink-dim)">Description (optional)</span>
+ <textarea data-slot="description" maxlength="300" rows="2"
+ placeholder="What does this plan unlock?"
+ style="padding:9px 12px;border-radius:8px;border:1px solid var(--nxt-stroke);background:rgba(255,255,255,0.04);color:var(--nxt-ink);font:inherit;font-size:13px;resize:vertical">${esc(existing?.description || '')}</textarea>
+ </label>
+
+ <div style="display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:12px">
+ <label style="display:flex;flex-direction:column;gap:6px">
+ <span style="font-size:12.5px;color:var(--nxt-ink-dim)">Price (USD)</span>
+ <input data-slot="price" type="number" min="0.5" step="0.01" value="${esc(String(existing?.price_usd || ''))}"
+ placeholder="9.99"
+ style="padding:9px 12px;border-radius:8px;border:1px solid var(--nxt-stroke);background:rgba(255,255,255,0.04);color:var(--nxt-ink);font:inherit;font-size:13px" />
+ </label>
+ <label style="display:flex;flex-direction:column;gap:6px">
+ <span style="font-size:12.5px;color:var(--nxt-ink-dim)">Interval</span>
+ <select data-slot="interval"
+ style="padding:9px 12px;border-radius:8px;border:1px solid var(--nxt-stroke);background:rgba(255,255,255,0.04);color:var(--nxt-ink);font:inherit;font-size:13px">
+ <option value="monthly"${(!existing || existing.interval === 'monthly') ? ' selected' : ''}>Monthly</option>
+ <option value="weekly"${existing?.interval === 'weekly' ? ' selected' : ''}>Weekly</option>
+ <option value="yearly"${existing?.interval === 'yearly' ? ' selected' : ''}>Yearly</option>
+ </select>
+ </label>
+ </div>
+
+ <label style="display:flex;align-items:center;gap:10px;margin-bottom:18px;cursor:pointer">
+ <input data-slot="active" type="checkbox" ${(!existing || existing.active) ? 'checked' : ''}
+ style="width:16px;height:16px;cursor:pointer;accent-color:var(--nxt-accent)" />
+ <span style="font-size:13px;color:var(--nxt-ink)">Plan is active (visible to subscribers)</span>
+ </label>
+
+ <div data-slot="error" style="font-size:12.5px;color:var(--nxt-danger);min-height:18px;margin-bottom:10px"></div>
+
+ <div style="display:flex;gap:8px;justify-content:flex-end">
+ <button class="dn-btn ghost" data-action="cancel">Cancel</button>
+ <button class="dn-btn primary" data-action="submit">${existing ? 'Save changes' : 'Create plan'}</button>
+ </div>
+ </div>
+ `;
+
+ document.body.appendChild(overlay);
+ const nameEl = overlay.querySelector('[data-slot="name"]');
+ const descEl = overlay.querySelector('[data-slot="description"]');
+ const priceEl = overlay.querySelector('[data-slot="price"]');
+ const intervalEl = overlay.querySelector('[data-slot="interval"]');
+ const activeEl = overlay.querySelector('[data-slot="active"]');
+ const errorEl = overlay.querySelector('[data-slot="error"]');
+ const submitBtn = overlay.querySelector('[data-action="submit"]');
+ nameEl.focus();
+
+ const close = () => overlay.remove();
+ overlay.querySelector('[data-action="cancel"]').addEventListener('click', close);
+ overlay.addEventListener('click', (e) => { if (e.target === overlay) close(); });
+ document.addEventListener('keydown', function onKey(e) {
+ if (e.key === 'Escape') { close(); document.removeEventListener('keydown', onKey); }
+ });
+
+ submitBtn.addEventListener('click', async () => {
+ const name = nameEl.value.trim();
+ const price = parseFloat(priceEl.value);
+ if (!name) { errorEl.textContent = 'Plan name is required.'; return; }
+ if (!Number.isFinite(price) || price < 0.5) { errorEl.textContent = 'Price must be at least $0.50.'; return; }
+ errorEl.textContent = '';
+ submitBtn.disabled = true;
+ submitBtn.textContent = existing ? 'Saving…' : 'Creating…';
+ const body = {
+ name,
+ description: descEl.value.trim() || undefined,
+ price_usd: price,
+ interval: intervalEl.value,
+ active: activeEl.checked,
+ };
+ try {
+ let saved;
+ if (existing) {
+ const r = await put(`/api/subscriptions/plans/${encodeURIComponent(existing.id)}`, body);
+ saved = r?.plan || { ...existing, ...body };
+ } else {
+ const r = await post('/api/subscriptions/plans', body);
+ saved = r?.plan || body;
+ }
+ toastMonetize(existing ? 'Plan updated' : 'Plan created');
+ close();
+ onSaved(saved);
+ } catch (err) {
+ errorEl.textContent = err?.body?.error || err?.message || 'Save failed';
+ submitBtn.disabled = false;
+ submitBtn.textContent = existing ? 'Save changes' : 'Create plan';
+ }
+ });
+}
+
+function toastMonetize(msg) {
+ let el = document.getElementById('dn-monetize-toast');
+ if (!el) {
+ el = document.createElement('div');
+ el.id = 'dn-monetize-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);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);
+}
+
// ── Skeleton ───────────────────────────────────────────────────────────────
function renderSkeleton(host) {
diff --git a/vercel.json b/vercel.json
index 2114ec468..fd3238cd1 100644
--- a/vercel.json
+++ b/vercel.json
@@ -31,13 +31,13 @@
"includeFiles": "node_modules/@zauthx402/sdk/dist/**,node_modules/@bonfida/spl-name-service/dist/cjs/node_modules/**,node_modules/@bonfida/spl-name-service/dist/esm/node_modules/**,examples/skills/pump-fun-strategy/**,data/archives/**,data/rss/**,data/_generated/**",
"maxDuration": 300
},
- "api/**/*.js": {
- "includeFiles": "node_modules/@zauthx402/sdk/dist/**,node_modules/@bonfida/spl-name-service/dist/cjs/node_modules/**,node_modules/@bonfida/spl-name-service/dist/esm/node_modules/**,examples/skills/pump-fun-strategy/**,data/archives/**,data/rss/**,data/_generated/**",
- "maxDuration": 30
- },
"api/agents/gmgn.js": {
"includeFiles": "node_modules/@zauthx402/sdk/dist/**,node_modules/@bonfida/spl-name-service/dist/cjs/node_modules/**,node_modules/@bonfida/spl-name-service/dist/esm/node_modules/**,examples/skills/pump-fun-strategy/**,data/archives/**,data/rss/**,data/_generated/**",
"maxDuration": 120
+ },
+ "api/**/*.js": {
+ "includeFiles": "node_modules/@zauthx402/sdk/dist/**,node_modules/@bonfida/spl-name-service/dist/cjs/node_modules/**,node_modules/@bonfida/spl-name-service/dist/esm/node_modules/**,examples/skills/pump-fun-strategy/**,data/archives/**,data/rss/**,data/_generated/**",
+ "maxDuration": 30
}
},
"routes": [