@encorekit/web-sdk 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@encorekit/web-sdk",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "type": "module",
5
5
  "description": "Encore SDK for web applications - display targeted offers and manage user entitlements",
6
6
  "main": "./dist/cjs/index.cjs",
@@ -8,8 +8,8 @@
8
8
  import type { AnalyticsEvent, EventEnvelope } from './models';
9
9
  /**
10
10
  * Wrap an event in the analytics wire envelope, injecting the shared web metadata
11
- * (platform, sdk_version, app_bundle_id). `eventId` defaults to a fresh UUID;
12
- * callers needing idempotent retries pass a stable id.
11
+ * (platform, agent_type, device_os, sdk_version, app_bundle_id). `eventId` defaults to a
12
+ * fresh UUID; callers needing idempotent retries pass a stable id.
13
13
  */
14
14
  export declare function buildEnvelope(event: AnalyticsEvent, eventId?: string): EventEnvelope;
15
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/analytics/transport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAiD9D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,GAAE,MAAuB,GAAG,aAAa,CAcpG;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAChC,OAAO,CAAC,QAAQ,CAAC,CAWnB"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/analytics/transport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAkD9D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,GAAE,MAAuB,GAAG,aAAa,CAqBpG;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAChC,OAAO,CAAC,QAAQ,CAAC,CAWnB"}
@@ -1,3 +1,3 @@
1
1
  /** SDK version — single source of truth (also kept in sync with package.json via scripts/update-version.sh) */
2
- export declare const SDK_VERSION = "2.1.1";
2
+ export declare const SDK_VERSION = "2.1.2";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Device OS Detection
3
+ *
4
+ * The end user's device OS, reported on every analytics event. Named
5
+ * `device_os`, never `platform`: `platform` here is always the literal `web`,
6
+ * the SDK's own runtime, and cannot answer iOS vs Android.
7
+ *
8
+ * Vocabulary is the backend click classifier's, plus the two values only a page
9
+ * can resolve, so one warehouse query reads both lanes. See
10
+ * `docs/architecture/platform-divergence/web.md` #5.
11
+ */
12
+ /** What kind of thing made the request. Always stamped, mirrors the backend. */
13
+ export declare const AgentType: {
14
+ readonly Browser: "browser";
15
+ readonly Bot: "bot";
16
+ readonly HttpClient: "http_client";
17
+ readonly Unknown: "unknown";
18
+ };
19
+ export type AgentType = (typeof AgentType)[keyof typeof AgentType];
20
+ /** The end user's OS. ONLY operating systems: null when there is none to name. */
21
+ export declare const DeviceOs: {
22
+ /** iPhone or iPod touch. */
23
+ readonly Ios: "ios";
24
+ readonly Android: "android";
25
+ /** An iPad, separated from a Mac by touch points. Never emitted server-side. */
26
+ readonly IpadOs: "ipados";
27
+ /** A Mac, separated from an iPad by touch points. Never emitted server-side. */
28
+ readonly MacOs: "macos";
29
+ /** An Apple desktop-class UA we could NOT split, matching the backend's bucket. */
30
+ readonly MacOsOrIpadOs: "macos_or_ipados";
31
+ readonly Windows: "windows";
32
+ /** Parsed, none of the above (Linux desktop, ChromeOS). */
33
+ readonly Other: "other";
34
+ };
35
+ export type DeviceOs = (typeof DeviceOs)[keyof typeof DeviceOs];
36
+ export interface AgentClassification {
37
+ agentType: AgentType;
38
+ /** Non-null if and only if `agentType` is `browser`. */
39
+ deviceOs: DeviceOs | null;
40
+ }
41
+ /** Memoized: the user agent cannot change for the life of the page. */
42
+ export declare function detectAgent(): AgentClassification;
43
+ /** Test seam only: clears the memo so a stubbed navigator is re-read. */
44
+ export declare function resetDeviceOsCache(): void;
45
+ //# sourceMappingURL=deviceOs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceOs.d.ts","sourceRoot":"","sources":["../../src/utils/deviceOs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,eAAO,MAAM,SAAS;;;;;CAKZ,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,kFAAkF;AAClF,eAAO,MAAM,QAAQ;IACnB,4BAA4B;;;IAG5B,gFAAgF;;IAEhF,gFAAgF;;IAEhF,mFAAmF;;;IAGnF,2DAA2D;;CAEnD,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAoFhE,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,wDAAwD;IACxD,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC3B;AA6DD,uEAAuE;AACvE,wBAAgB,WAAW,IAAI,mBAAmB,CAGjD;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}