Skip to content

Commit 8621077

Browse files
refactor(audience): move ImmutableWebSDK into sdk package
Move sdk.ts, sdk.test.ts, config constants, and WebSDKConfig into @imtbl/audience-sdk. Flatten WebSDKConfig (no longer extends a base). All imports now local — no cross-package dependency on @imtbl/audience-web-sdk. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 175d2b9 commit 8621077

5 files changed

Lines changed: 1166 additions & 7 deletions

File tree

packages/audience/sdk/src/config.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,19 @@
22
// Backend endpoints and base URLs come from @imtbl/audience-core.
33

44
export const LIBRARY_NAME = '@imtbl/audience-sdk';
5-
// Replaced at build time by esbuild replace plugin
5+
/** Replaced at build time by esbuild replace plugin. */
66
export const LIBRARY_VERSION = '__SDK_VERSION__';
7+
8+
/** Log prefix for console messages from this package. */
9+
export const LOG_PREFIX = '[audience-sdk]';
10+
11+
/** Default consent source when consentSource is not provided in config. */
12+
export const DEFAULT_CONSENT_SOURCE = 'WebSDK';
13+
14+
// --- Auto-tracked event names ---
15+
// These are fired by the SDK lifecycle, not by studio code.
16+
17+
/** Fired on init (or consent upgrade from none) when no active session cookie exists. */
18+
export const SESSION_START = 'session_start';
19+
/** Fired on explicit shutdown(). Not fired on tab close or consent revocation. */
20+
export const SESSION_END = 'session_end';

packages/audience/sdk/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
export type { AudienceSDKConfig } from './types';
1+
export { ImmutableWebSDK } from './sdk';
2+
export type { WebSDKConfig } from './types';
23
export { DebugLogger } from './debug';
4+
export type { Environment, ConsentLevel, UserTraits } from '@imtbl/audience-core';

0 commit comments

Comments
 (0)