feat(audience): fix core and add @imtbl/audience-web-sdk#2823
Closed
ImmutableJeffrey wants to merge 4 commits into
Closed
feat(audience): fix core and add @imtbl/audience-web-sdk#2823ImmutableJeffrey wants to merge 4 commits into
ImmutableJeffrey wants to merge 4 commits into
Conversation
Bug fixes: - Fix generateId fallback to UUID v4 format (backend requires UUID) - Replace sendBeacon with fetch+keepalive (sendBeacon can't set auth header) - Cap batch size at 100 messages per flush (backend maxItems limit) New capabilities: - Export getCookie/setCookie/deleteCookie; add domain param for cross-subdomain - Parameterize collectContext(library, version) for multi-surface support - Add queue.purge(), transform(), flushUnload(), onFlush, staleFilter - Add queue storagePrefix option for per-surface localStorage isolation - Add transport keepalive option - Add ConsentLevel, ConsentStatus, SESSION_COOKIE, CONSENT_COOKIE shared types - Add validation module (isTimestampValid, isAliasValid, truncate) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…kies - Package scaffold: package.json, tsconfig, eslint, jest config - Add to pnpm-workspace.yaml - WebSDKConfig type, library name/version constants - Context wrapper (passes web SDK name to core's collectContext) - Cookie helpers: session ID (30min rolling), consent cookie (1yr) - ConsentManager: 3-tier consent, DNT/GPC detection, server sync - Debug logger for dev mode Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ifecycle - SDK class: init, track, page, identify, alias, setConsent, reset, shutdown - Auto-tracked session_start on new session, session_end on shutdown - Consent-aware: none=inert, anonymous=no PII, full=all events - Consent downgrade purges identify/alias, strips userId - Uses core's MessageQueue with httpTransport and __imtbl_web_ storage prefix - 45 tests covering all methods and consent transitions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Attribution: UTM params, click IDs (gclid/fbclid/ttclid/msclkid/dclid/li_fat_id), ?ref= referral code, referrer, landing page — cached per session - CDN IIFE entry point (window.ImmutableWebSDK), self-contained bundle - Interactive demo page for end-to-end testing - README with install, API reference, consent, cookies, CDN usage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes core bugs and adds the web SDK, built on core with no duplicated primitives. Scoped to v1 per Event Reference.
Review commit-by-commit — each commit is a reviewable unit:
What's NOT in this PR (by design)
@imtbl/audienceSDK changesOpen questions
api.sandbox.immutable.comreturn 400 with empty body. Is the audience service deployed to sandbox? Is the publishable key enrolled?Test plan
cd packages/audience/core && pnpm test+cd packages/audience/web && pnpm testpnpm buildin eachcd packages/audience/web && pnpm demo→ http://localhost:3456/web/demo/index.html🤖 Generated with Claude Code