Skip to content

fix(pixel): support environment in snippet generator for non-prod endpoints#2849

Merged
bkbooth merged 2 commits intomainfrom
claude/agitated-beaver
Apr 13, 2026
Merged

fix(pixel): support environment in snippet generator for non-prod endpoints#2849
bkbooth merged 2 commits intomainfrom
claude/agitated-beaver

Conversation

@bkbooth
Copy link
Copy Markdown
Contributor

@bkbooth bkbooth commented Apr 13, 2026

Summary

  • Adds environment option to SnippetOptions so internally-generated pixel snippets can target dev/sandbox endpoints instead of always defaulting to production
  • The Pixel.init() environment param already worked correctly — the gap was that generateSnippet() didn't pass it through

Resolves SDK-102

Note: The game page integration (immutable/play#5162) will also need to pass environment in its pixel init call.

Test plan

  • All 78 pixel unit tests pass (4 new snippet environment tests)
  • Build succeeds — type-only import adds zero bytes to IIFE bundle
  • Verify game page passes environment: 'dev' and events reach api.dev.immutable.com

🤖 Generated with Claude Code

…points

The pixel init already accepted an environment param but the snippet
generator did not expose it, causing internal pages (e.g. game page) to
always hit the production API even when running in dev/sandbox.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bkbooth bkbooth requested a review from a team as a code owner April 13, 2026 01:56
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 13, 2026

View your CI Pipeline Execution ↗ for commit 76ce8f1

Command Status Duration Result
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 1s View ↗
nx affected -t build,lint,test ✅ Succeeded 8s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-13 02:17:56 UTC

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

✅ Pixel Bundle Size — @imtbl/pixel

Metric Size Delta vs main
Gzipped 5412 bytes (5.28 KB) 0 bytes
Raw (minified) 14673 bytes 0 bytes

Budget: 10.00 KB gzipped (warn at 8.00 KB)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bkbooth bkbooth enabled auto-merge April 13, 2026 02:08
@bkbooth bkbooth added this pull request to the merge queue Apr 13, 2026
Merged via the queue into main with commit fc9f900 Apr 13, 2026
10 checks passed
@bkbooth bkbooth deleted the claude/agitated-beaver branch April 13, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants