Skip to content

Landing page: accurate claims, working developer snippets, optional live demo - #17

Merged
TahubCS merged 5 commits into
mainfrom
feat/landing-page-accuracy
Oct 17, 2026
Merged

TahubCS merged 5 commits into
mainfrom
feat/landing-page-accuracy

Conversation

@TahubCS

@TahubCS TahubCS commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Replaces #16 (same commits, renamed branch).

Summary

The landing page described a product Supo isn't yet:

  • invented metrics (80% / 94% resolution / 99.9% uptime SLA)
  • placeholder testimonials
  • paid tiers with no billing
  • API examples for an api.supo.ai/v1/chat endpoint and Node/Python/PHP SDKs that don't exist
  • 15 dead # links

This PR replaces all of it with real content, adds an optional live demo, and fixes a widget origin bug the demo exposed. Each commit passes lint, typecheck and tests on its own.

1. Accurate landing content

  • Removed: TestimonialsSection, plus ClosingCTA and ProductShowcaseSection, which nothing rendered.
  • Hero: describes what Supo does. The KPI mock is replaced by an example conversation (a cited answer, then a handoff using the widget's real handoff reply). The badge now says "Now in open alpha".
  • Features: retrieval with citations (not "trained on your knowledge base"), the real handoff triggers (handoff/policy.ts), and widget chat plus email instead of "social media".
  • Pricing: one free alpha plan. Every listed feature exists in the codebase.
  • Developers section (renamed from APIPlayground): snippets for the published @supoapp/widget@alpha (checked against the npm package's types), the script embed, and POST /api/v1/knowledge/search.
  • Navbar and footer: links go to real sections and to docs/API.md, CHANGELOG.md and SECURITY.md in this repository.

2. Optional live demo widget

  • When NEXT_PUBLIC_SUPO_DEMO_PRODUCT_ID is set, the home page loads that product's widget through /widget.js, the same embed customers use.
  • mountDemoWidget() (src/lib/demo-widget.ts) handles the lifecycle:
    • It loads one bundle under React StrictMode.
    • On unmount it destroys the widget and clears its globals, so the launcher doesn't follow visitors into the app after client-side navigation.
    • It tears down an instance whose script finishes loading after unmount.

3. Same-origin requests and the widget allow-list

  • The bug: browsers send no Origin on same-origin GETs. Once a product had an allow-list, the widget's config, message-poll and realtime-token requests from Supo's own pages got a 403. The widget then silently fell back to defaults, and agent replies didn't arrive without Ably.
  • The fix: Sec-Fetch-Site: same-origin, which browsers set and pages cannot, now counts as a request from this deployment (isSameOriginRequest in widget-cors.ts). Cross-site requests are still checked against the allow-list.

4. Docs

  • A README Mermaid diagram of indexing and answering, checked with the Mermaid renderer.
  • Demo setup steps and the changelog entry.

Testing

  • Unit tests:

    • demo-widget.test.ts runs under happy-dom, pinned to a release from September. Each guard was removed in turn, and the matching test failed each time.
    • widget-cors.test.ts covers isSameOriginRequest.
  • Browser (Chromium, next dev):

    • Exactly one widget and one widget.js request.

    • The widget is removed on navigation to /sign-in and remounts on back.

    • With the variable unset: no widget and no request.

    • The allow-list 403 was reproduced before the fix. After it:

      Request Status
      Same-origin config 200
      Cross-site Origin 403
      No Origin and no metadata 403
      Allow-listed Origin 200
  • Layout: light and dark renders with no horizontal overflow at 390px wide.

  • CI-equivalent run: lint, both typechecks, 201 tests with the database, production build, and migrations on a fresh database (the second run is a no-op).

Enabling the demo after merge

  1. Create a product (for example "Supo") and add its knowledge sources.
  2. Optionally restrict it under Widget → Allowed websites. Supo's own pages keep working either way.
  3. Set NEXT_PUBLIC_SUPO_DEMO_PRODUCT_ID and redeploy. It is read at build time because / is static.

…tent

The landing page described a product Supo isn't yet: invented metrics,
placeholder testimonials, paid tiers with no billing, and API examples for
an endpoint and SDKs that don't exist.

- Remove TestimonialsSection, plus ClosingCTA and ProductShowcaseSection,
  which nothing rendered.
- Hero: replace the 80% / 94% / 99.9% uptime SLA figures and the KPI mock
  with what Supo does, and an example conversation that shows a cited
  answer and a handoff using the widget's real handoff reply.
- Features: describe retrieval with citations, the real handoff triggers
  and the actual channels (widget chat and email).
- Pricing: one free alpha plan listing features that ship today.
- Rename APIPlayground to DeveloperSection, with snippets that work
  against the published @supoapp/widget package, the script embed and
  /api/v1/knowledge/search.
- Navbar and footer: replace dead "#" links with real sections and the
  repository's API reference, changelog and security policy
  (src/lib/site.ts).
With NEXT_PUBLIC_SUPO_DEMO_PRODUCT_ID set, the home page loads that
product's widget through /widget.js, the same script embed customers use.

mountDemoWidget() owns the lifecycle so it can be tested without React:
- The script insert is deferred one tick, so React StrictMode's
  mount/unmount/remount loads the bundle once.
- On unmount it destroys the widget and clears window.Supo and
  window.SupoSettings, so the launcher doesn't follow a visitor into the
  app after a client-side navigation.
- A script that finishes loading after unmount tears down the instance it
  created.

Tests run under happy-dom (new dev dependency). Each guard was checked by
removing it and confirming its test fails. Also verified in Chromium
against `next dev`: one widget, one bundle request, removed on navigation
to /sign-in, remounted on back, and nothing loaded with the variable unset.
- README: a Mermaid diagram of indexing and answering, matching
  retrieve.ts, the chat route's handoff decision and missing-knowledge
  gaps. Checked with the Mermaid renderer.
- README: document NEXT_PUBLIC_SUPO_DEMO_PRODUCT_ID and the steps to enable
  the landing-page demo.
- CHANGELOG: landing page changes.
Browsers send no Origin header on same-origin GETs, and isOriginAllowed
rejects origin-less requests once a product has an allow-list. On Supo's
own pages, such as the landing-page demo, the widget's config, message
polling and realtime-token requests got a 403. The widget then silently
fell back to defaults, and agent replies didn't arrive without Ably.

Treat Sec-Fetch-Site: same-origin as a request from this deployment.
Browsers set it and pages cannot. Cross-site requests are still checked
against the allow-list.

Reproduced in Chromium against `next dev` (config 403 with an allow-list),
then verified: config 200 from the landing page, cross-site Origin 403,
request without Origin or metadata 403, allow-listed Origin 200.
@vercel

vercel Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
supo Ready Ready Preview Oct 17, 2026 10:43pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d79d6903-ba02-4cdd-81b8-52aa6b339961
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T22:38:03.822965Z 3fc442f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3fc442f81b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/demo-widget.ts Resolved
If a visitor left the home page while widget.js was still loading and came
back, the second script could finish first. The stale first script then ran,
overwrote window.Supo, and its teardown destroyed its own widget and deleted
the global. The live widget was left without a handle, so it followed the
visitor into the app on the next navigation.

Each mount now records the widget its own script created. The load event
fires right after the script runs, while window.Supo is still that
script's. Teardown destroys only that widget, and clears the global only if
the global still points at it.

Covered by a new unit test and reproduced in Chromium with the first
widget.js response delayed: one widget was left behind after navigating
away with the old code, none with this change.
@TahubCS
TahubCS merged commit 9bb7531 into main Oct 17, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — ea6966bd Deployed Oct 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant