Insights (insights-edge, the real live surface at insights.ereboslab.com) had no path from a signed-up site owner into Railyard Console, even though apps/insights already shipped an equivalent banner (RYP-X1) on a different, unconfirmed-live app. Every real Insights customer revisits their dashboard on a recurring basis to check numbers -- the closest thing this product has to a retention touchpoint -- so it was the highest-value unbuilt conversion surface in the repo (PLAN-2026-10-23-DEEP.md's own "backlog item 1"). Adds a dismiss-free, single-line banner (dashboardPage) deep-linking into Console's /auth/start?src=insights-edge&email=<signup email>, prefilled from the site's own sign-up record, same first-touch-attribution contract the sibling apps/insights banner already uses. Gated behind a new CONSOLE_URL var (defaults to the live Console host; empty disables it). Verified: 90/90 existing insights-edge tests still pass, 2 new tests cover the banner present-with-email and absent-when-unconfigured, plus a direct local run against the real worker in Miniflare confirming the rendered anchor HTML. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
40 lines
2.0 KiB
JavaScript
40 lines
2.0 KiB
JavaScript
// Console cross-sell banner on the private dashboard (RYP-X2, 2026-11-11):
|
|
// insights-edge is the actually-live Insights surface (insights.ereboslab.com)
|
|
// and had no Console cross-sell at all before this -- apps/insights's own
|
|
// equivalent banner (RYP-X1) lives on a different, unconfirmed-live app.
|
|
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
import { startCollector } from "./harness.mjs";
|
|
|
|
const sites = {};
|
|
const baseBindings = { RALLY_TX_URL: "https://mail.test/send", RALLY_TX_KEY: "smail_test", REPORT_TO: "owner@example.com" };
|
|
const mailOk = () => 202;
|
|
|
|
const signup = (c, body, ip = "198.51.100.11") =>
|
|
fetch(`${c.base}/api/sites`, { method: "POST", headers: { "content-type": "application/json", "cf-connecting-ip": ip }, body: JSON.stringify(body) });
|
|
|
|
test("the dashboard offers a Console cross-sell link, prefilled with the sign-up email, when CONSOLE_URL is configured", async () => {
|
|
const c = await startCollector({ d1: true, sites, bindings: { ...baseBindings, CONSOLE_URL: "https://railyard.ereboslab.com" }, respond: mailOk });
|
|
try {
|
|
const s = await (await signup(c, { email: "founder@shop.example", domain: "shop.example" })).json();
|
|
const token = s.dashboard_url.split("/d/")[1];
|
|
const html = await (await fetch(`${c.base}/d/${token}`)).text();
|
|
assert.match(html, /Open Railyard Console/);
|
|
assert.match(html, /href="https:\/\/railyard\.ereboslab\.com\/auth\/start\?src=insights-edge&email=founder%40shop\.example"/);
|
|
} finally {
|
|
await c.close();
|
|
}
|
|
});
|
|
|
|
test("the dashboard has no Console cross-sell link when CONSOLE_URL is unset", async () => {
|
|
const c = await startCollector({ d1: true, sites, bindings: baseBindings, respond: mailOk });
|
|
try {
|
|
const s = await (await signup(c, { email: "founder@shop.example", domain: "shop.example" })).json();
|
|
const token = s.dashboard_url.split("/d/")[1];
|
|
const html = await (await fetch(`${c.base}/d/${token}`)).text();
|
|
assert.doesNotMatch(html, /Open Railyard Console/);
|
|
} finally {
|
|
await c.close();
|
|
}
|
|
});
|