Skip to content

feat(audience): add transport, queue, and context collection to core#2813

Merged
nattb8 merged 2 commits intomainfrom
feat/sdk-34-core-transport-queue-context
Apr 2, 2026
Merged

feat(audience): add transport, queue, and context collection to core#2813
nattb8 merged 2 commits intomainfrom
feat/sdk-34-core-transport-queue-context

Conversation

@nattb8
Copy link
Copy Markdown
Contributor

@nattb8 nattb8 commented Apr 1, 2026

What this adds

The transport, batched queue, and context collection modules that complete @imtbl/audience-core. These sit on top of the types/utils/config/storage/cookie from SDK-33 and give the web SDK (SDK-30) and pixel everything they need to send events.

  • transport.ts — HTTP POST to the audience API with x-immutable-publishable-key header. Returns boolean success for v1 (the audience service returns { success, accepted, rejected } but rejected messages indicate SDK bugs, not transient errors — revisit if debugging needs arise).

  • queue.ts — Batched message queue with localStorage durability. Flushes on a timer or when the queue reaches flushSize, whichever comes first. Failed flushes retry on the next cycle. Persisted messages survive page navigations and are restored on construction. Concurrent flush guard prevents races.

  • context.ts — Collects device fingerprint signals that match the audience service EventContext schema: userAgent, locale, timezone, screen resolution, page URL/path/referrer/title. IP is collected server-side by the audience service, not by the SDK.

  • Updated index.ts exports for all new modules.

Out of scope

  • UTM parameter extraction (SDK-37, pixel/web SDK concern)
  • keepalive fetch for page unload (SDK-38, web SDK concern)
  • Device fingerprint hashing (SDK-39, server-side concern)

Linear: https://linear.app/imtbl/issue/SDK-34

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nattb8 nattb8 requested a review from a team as a code owner April 1, 2026 23:21
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 1, 2026

View your CI Pipeline Execution ↗ for commit 96b29ec

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

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

bkbooth
bkbooth previously approved these changes Apr 2, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nattb8 nattb8 requested a review from a team as a code owner April 2, 2026 00:54
@nattb8 nattb8 requested a review from bkbooth April 2, 2026 00:59
@nattb8 nattb8 enabled auto-merge April 2, 2026 02:41
@nattb8 nattb8 added this pull request to the merge queue Apr 2, 2026
Merged via the queue into main with commit 20626d9 Apr 2, 2026
7 checks passed
@nattb8 nattb8 deleted the feat/sdk-34-core-transport-queue-context branch April 2, 2026 03:12
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.

3 participants