Skip to content

fix(widget): default apiBaseUrl to the production origin - #18

Merged
TahubCS merged 2 commits into
mainfrom
fix/widget-api-base-url
Oct 17, 2026
Merged

TahubCS merged 2 commits into
mainfrom
fix/widget-api-base-url

Conversation

@TahubCS

@TahubCS TahubCS commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Default apiBaseUrl: when apiBaseUrl is omitted, @supoapp/widget now calls https://supo.muhammadtahubkhatri.dev (PRODUCTION_ORIGIN). The old default, https://app.supo.com, isn't a Supo server, so every request failed.
  • No more document.currentScript guessing in npm entry points: resolveApiBaseUrl no longer reads it. When initSupo ran at the top level of a classic-script bundle (webpack, Next.js chunks), that was the host site's own script, so requests went to the customer's site.
  • widget.js script embed: it now records the origin it was loaded from at load time (legacy-global.ts). Precedence is the same as before: explicit apiBaseUrl, then script origin, then the default.
  • Tests: new unit tests in packages/widget/src/runtime/__tests__/config.test.ts. A new check in trusted-origins.test.ts keeps the SDK default equal to PRODUCTION_ORIGIN.
  • Version and docs: @supoapp/widget bumped to 0.1.0-alpha.11, with entries in both changelogs. The README and docs page now describe the default. public/widget.js is rebuilt.
  • The snippets in WidgetConfigurator.tsx are unchanged: they pass apiBaseUrl explicitly, and its "Local dev" note already describes this behaviour.

Publishing to npm is a separate manual step: bun run --cwd packages/widget release:alpha.

Testing

  • bun run typecheck:sdk
  • bun run test (159 passed, 42 DB integration tests skipped without TEST_DATABASE_URL)
  • bun run typecheck
  • bun run lint
  • bun run build:legacy-widget

Generated by Claude Code

When apiBaseUrl was omitted, the SDK fell back to https://app.supo.com, which
is not a Supo server. It now falls back to https://supo.muhammadtahubkhatri.dev
(PRODUCTION_ORIGIN), and a test keeps the two in sync.

resolveApiBaseUrl no longer reads document.currentScript. For npm usage that
can be the host page's own classic-script bundle, which sent requests to the
customer's site. The widget.js embed now captures its loader origin itself.

Bumps @supoapp/widget to 0.1.0-alpha.11 (not published).
@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:47pm 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: 7f4513b5-4c11-4b6b-8149-83e670f8072a
  • 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:43:54.399063Z dd1637f 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.

@TahubCS
TahubCS merged commit 2a72220 into main Oct 17, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 0d43f89d 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