railyard/apps/insights-edge/wrangler.jsonc
caelum0x 378832c645 feat(insights-edge): add Console cross-sell banner to the private dashboard
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>
2026-11-11 04:00:07 +03:00

55 lines
3.7 KiB
JSON

{
// Railyard Insights edge collector (RYP-D3), our Cloudflare account.
// Secrets (`wrangler secret put`): VISITOR_SALT_SECRET, INGEST_TOKEN, RAGO_API_KEY,
// STATS_TOKEN (GET /api/stats, POST /api/report), RALLY_TX_KEY (Scribase Mail key for the weekly report),
// FAULTLINE_DSN (GlitchTip project DSN; `$agent_failure` events forward {agent, model, error} there --
// never a prompt or a key, src/agent-failure.mjs -- unset means the forward is skipped, not an error).
// Paid plan (2026-10-14, test mode until all three are set + RAILYARD_DODO_LIVE=1 for the live host):
// DODO_API_KEY, DODO_PRODUCT_ID (one Insights "Pro" product), DODO_WEBHOOK_SECRET (POST /api/billing/webhook).
"$schema": "node_modules/wrangler/config-schema.json",
"name": "railyard-insights-edge",
"main": "src/index.mjs",
"compatibility_date": "2026-09-20",
"workers_dev": false,
"routes": [{ "pattern": "insights.ereboslab.com", "custom_domain": true }],
"durable_objects": { "bindings": [{ "name": "ORG_COLLECTOR", "class_name": "OrgCollector" }] },
"migrations": [{ "tag": "v1", "new_sqlite_classes": ["OrgCollector"] }],
// The $0 event store (2026-10-08): every stored event is written here at each 2 s flush.
// Also holds replay_sessions metadata (2026-10-15, src/replay/store.mjs) — same DB, new table.
"d1_databases": [{ "binding": "DB", "database_name": "railyard-insights", "database_id": "6b0d8ae9-4156-40e3-8f0c-875f39cfbd3c" }],
// Session replay (2026-10-15): recorded rrweb events, one object per chunk, keyed
// `<siteKey>/<sessionId>/<seq>.json`. Create once with `wrangler r2 bucket create railyard-insights-replay`.
"r2_buckets": [{ "binding": "REPLAY", "bucket_name": "railyard-insights-replay" }],
// Weekly funnel report, Mondays 07:00 UTC, through Scribase Mail.
// NB (found 2026-10-26): Cloudflare Cron Triggers number weekdays 1=Sunday..7=Saturday
// (Quartz-style), NOT the POSIX 0=Sunday..6=Saturday most cron docs assume. "0 7 * * 1"
// therefore actually fired every SUNDAY 07:00 UTC in production for weeks (confirmed via
// the real delivered digest emails: 2026-10-11, -18, -25 all landed Sunday 07:00-07:01
// UTC, not Monday). Using the three-letter abbreviation instead, as Cloudflare's own docs
// recommend, to avoid this ambiguity ever recurring.
"triggers": { "crons": ["0 7 * * MON"] },
// Namespace RAILYARD_SITES, created 2026-09-30 (`wrangler kv namespace create RAILYARD_SITES`).
"kv_namespaces": [{ "binding": "SITES", "id": "323121abfdc64ff6ab90927620d3dbb2" }],
"vars": {
// Empty until RYP-D2 is deployed at the Wave E gate: events are counted and capped but not forwarded.
"INGEST_URL": "",
"RAGO_URL": "",
// QY1.2: the product analytics service base URL. Live since 2026-10-29 (pa.ereboslab.com
// deployed, railyard.apps rows added for every first-party site's own ry_site_* key under
// org ereboslab) -- every stored first-party event now also lands in product analytics.
"PRODUCT_ANALYTICS_URL": "https://pa.ereboslab.com",
"RALLY_TX_URL": "https://api.scribase.com/api/rally/v1/transactional/send",
"REPORT_TO": "subasiarhan3@gmail.com",
"REPORT_PRODUCT": "menivor",
"REPORT_FROM_LOCAL": "no-reply",
// Self-serve sign-up (2026-10-12): the landing page's own site entry (site:ry_insights_landing in SITES).
"LANDING_SITE_KEY": "ry_insights_landing",
"SIGNUP_DAILY_CAP": "300",
// Console cross-sell banner on the private dashboard (RYP-X2, 2026-11-11): deep-links a
// signed-up Insights customer into Console's own sign-in with first-touch attribution,
// same `/auth/start?src=&email=` contract apps/insights's ConsoleCrossSellBanner (RYP-X1)
// already uses. Empty disables the banner (e.g. in tests that don't care about it).
"CONSOLE_URL": "https://railyard.ereboslab.com"
}
}