Skip to content

docs(web): add the Web SDK section - #263

Merged
DreamingInBinary merged 16 commits into
mainfrom
jordan/sw-5720-web-sdk-docs
Aug 14, 2026
Merged

docs(web): add the Web SDK section#263
DreamingInBinary merged 16 commits into
mainfrom
jordan/sw-5720-web-sdk-docs

Conversation

@DreamingInBinary

@DreamingInBinary DreamingInBinary commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Adds documentation for the Superwall Web SDK, written against 0.2.5, the version on npm. Closes SW-5720.

Requested by Jake in the 2026-08-10 roadmap call, alongside KMP and MMP docs: "nothing gets launched till it's documented, even the beta." Every page carries a beta warning.

The Web SDK section

13 new pages under content/docs/web/, registered in the SDKs nav after Unity with a Globe icon:

  • Quickstart: install, configure, present your first paywall, user management, feature gating, tracking subscription state
  • React: provider, hooks
  • Guides: server-side gating, purchases, events

Notes for reviewers:

  • Server-side gating is documented as first-class, not an appendix. Browser subscription state is editable from DevTools, and @superwall/verify's own source says the gate "MUST run on the server." The index and Feature gating pages both warn toward that guide.
  • The install page explains app provisioning. Web App applications cannot be created from the dashboard or the API (the dashboard's "Web" option creates a Web Checkout app; the API marks the webapp platform read-only). During the beta, Superwall provisions them. Verified in paywall-next.
  • Style: no em dashes, no expositional prose, plain statements of behavior only.

Also on this branch

  • Discount Codes (web-checkout): rewrote the setup steps after user-testing showed the old "bind the input to a state variable" instruction described a step that does not exist. The real flow: add an input, add a button, give it the Apply Discount action, pick the input under Element via the code-icon variable picker. One real screenshot replaces both placeholders. Also adds the Apply Discount vs Redeem Purchase note and a cross-link to the Web SDK's programmatic API.
  • Superwall AI (dashboard): documents sharing a conversation via public link, with screenshot.
  • Branch is merged up to main, so it carries the Rename Redeem Discount to Apply Discount #262 Apply Discount rename consistently.

Verification

Three clean-context reviewers audited every falsifiable claim against SDK source, split by area, with each finding independently re-verified before applying. That caught ~24 defects in the first draft, including:

  • feature() also runs on skipped placements (placementNotFound, noAudienceMatch, holdout). A typo'd placement name grants the feature. The draft implied the opposite.
  • userHas(userId, spec): the reversed form typechecks and denies every entitled user.
  • verifyEntitlements throws by design: the original sample had no try/catch, so a forged token crashed the route instead of returning 402.
  • Entitlement is two different types: @superwall/core uses id, @superwall/verify uses identifier. The draft conflated them in four places.
  • register does not await configuration: it throws PaywallNotAvailableError("no_config"). The SDK README claimed otherwise and was corrected to match the code.

Findings went to @ianrumac, who fixed most of them in 0.2.5. The docs were then re-verified against 0.2.5 and the obsolete caveats removed. Still true and documented as such: preloadAll/preloadFor do nothing and are being removed from the API.

bun run build:cf (614 pages prerendered, no broken links) and bun test (64 pass, 0 fail) both green.

🤖 Generated with Claude Code

DreamingInBinary and others added 5 commits August 11, 2026 15:04
New Web SDK docs covering install, configure, placements, identity, feature
gating, subscription state, the React provider and hooks, server-side
entitlement gating, purchases, and events. Registers the section in the SDKs
nav after Unity.

Written against Superwall-Web HEAD (0.2.4). npm is still at 0.2.1, so this
documents unreleased behavior by design and should not merge until the
packages are published. Every page carries a beta warning per the standup ask.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Lets the preview tooling start `bun run dev` on port 3000 without a manual
setup step. Dev-only; no effect on the built site.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Three clean-context reviewers audited all 13 pages against Superwall-Web
0.2.4; every finding was independently re-verified before applying.

Corrections of note:
- feature() also runs on skipped placements (placementNotFound,
  noAudienceMatch, holdout), so a typo'd placement name grants the feature.
  The page implied the opposite.
- Entitlement's field is `id`, not `identifier`. @superwall/verify defines a
  separate type of the same name that does use `identifier`; the two were
  conflated in four places.
- userHas takes (userId, spec). The reversed form typechecks and denies
  every entitled user.
- verifyEntitlements throws by design; the sample now catches VerifyError.
- useCustomPaywall returns { register, paywall }; SuperwallCustomPaywall
  does not exist. Replaced with SuperwallPaywall, which does.
- onCustomPaywallAction takes a bare string and is never invoked by the SDK;
  custom actions arrive as the custom_placement event.
- register does not await configuration — await sw.ready first. A failed
  config fetch resolves ready and only shows in configurationStatus.
- preloadAll/preloadFor, customerInfo, refreshCustomerInfo, and
  entitlements.inactive/all are unimplemented in the beta and now say so.

Also documents the userId extractor as the trust boundary, allowAnonymous,
the 60s cache TTL, and register's overrides/paywall/presenter arguments.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Ian shipped fixes for most of what the audit surfaced, so several of the
beta caveats added in the last commit are no longer true. Re-verified
against Superwall-Web 0.2.5 (edaf79a), which is now published to npm.

Now working, caveats removed:
- customerInfo / getCustomerInfo / refreshCustomerInfo are implemented
- entitlements.inactive and .all are populated for real
- onCustomPaywallAction is wired to the legacy custom action

Still true, kept:
- register does not await configuration; the README was corrected to match
  the code rather than the other way around
- the entitlements token refreshes on a ten-minute poll

Changed:
- preloadAll / preloadFor are being removed from the API, not implemented
- @superwall/verify's helpers now check per-entitlement expiresAt, so the
  gating guide recommends them over iterating the array

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0.2.5 did not only fix bugs, it added public API the pages did not cover.

- identify() now honors IdentityOptions. Documents
  restorePaywallAssignments, which re-runs experiment assignment for the
  identified user so they do not get a paywall chosen from their anonymous
  identity's stale assignments.
- Adds the new customPaywallAction event to the event table.
- browser/auto is implemented now (it was an empty module); documents it as
  the opt-in for bundlers that cannot ship dynamic chunks.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Aug 13, 2026

Copy link
Copy Markdown

SW-5720

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
superwall-docs 158f061 Commit Preview URL

Branch Preview URL
Aug 14 2026, 07:19 PM

DreamingInBinary and others added 11 commits August 13, 2026 13:01
Uses the pixel-grid Globe icon. Web SDK was the only section rendering
without a mark in the top nav.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds the share blurb to the Chats section with a screenshot of the share
control. Image resized to 2000px wide per repo convention.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Salvages the two pieces of the parked SW-5608 branch that the merged
discount-codes page (#254) did not cover: the Redeem Discount vs Redeem
Purchase note, and a pointer to the Web SDK's programmatic
redeemDiscount(). The rest of that branch is superseded — its WEBAPP-only
claims predate the STRIPE gate fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…shots

SVG placeholders carrying the final filenames, placed at the steps the real
captures belong to. Swapped for JPEGs when the screenshots arrive; the SVGs
are deleted at that point per the docs workflow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Style pass over the Web SDK section and the discount-codes page. Every em
dash replaced with a period, comma, or colon. Rhetorical framing cut in
favor of plain statements of behavior. No factual content changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…wall

The Web SDK runs against the Web App application type. The dashboard's
add-app Web option creates a STRIPE (Web Checkout) application instead
(createApplicationInTx.ts maps web to STRIPE), and the public API marks the
webapp platform "read-only - cannot be created via API". The install page
now says to ask Superwall for one during the beta, instead of pointing
readers at a dashboard flow that hands them the wrong key.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…k-docs

# Conflicts:
#	content/docs/web-checkout/web-checkout-discount-codes.mdx
Renames the remaining Redeem Discount references the merge did not cover:
the purchases guide note, both placeholder SVGs, and the frame alt text.
Also drops the stale dev-environment capture caveat from the placeholders,
since the editor action reached production on 2026-08-13.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…reenshot

The old steps told readers to bind the input to a state variable. No such
step exists in the editor: an Input's value is exposed automatically under
Element in the variable picker, and the Apply Discount action's code field
has a picker button that inserts the reference. The steps now describe that
flow: add an input, add a button, give it Apply Discount, pick the input.

One screenshot now covers the whole setup (paywall, action, picker open on
Element), replacing both placeholder SVGs. Converted to JPEG at 2000px.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@DreamingInBinary
DreamingInBinary merged commit 0411144 into main Aug 14, 2026
2 checks passed
@DreamingInBinary
DreamingInBinary deleted the jordan/sw-5720-web-sdk-docs branch August 14, 2026 19:29
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