@adzenai/core 1.2.2 → 1.2.4

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/README.md CHANGED
@@ -36,6 +36,7 @@ import {
36
36
  | `InlineAdEvent` | In-message creative delivered by an `adzen_inline` SSE event; `paragraph_index` (with `ad_id`) is its placement instance key |
37
37
  | `InlineAdCreative` | Inline creative fields (`headline`, `cta_text`, `destination_url`, `format`, `label`, optional `advertiser_name`) |
38
38
  | `InlineAdEventPayload` | `InlineAdEvent` (including `paragraph_index`) plus `message_id` and `content_offset`, the character position in the message the ad is anchored to |
39
+ | `AdAnchorEvent` | Payload of the `adzen_ad_anchor` SSE event (`version`, `paragraph_index`); reserves a paragraph's render offset before the matching `adzen_inline` arrives |
39
40
 
40
41
  Static-channel types are also exported: `DecisionRequest`, `Decision`, `Creative`, `SlotSpec`, `BannerCreative`, `NativeCreative`, and more.
41
42
 
package/dist/index.d.cts CHANGED
@@ -113,11 +113,26 @@ interface AdzenStreamInlineEvent {
113
113
  type: "adzen_inline";
114
114
  data: InlineAdEvent;
115
115
  }
116
+ /**
117
+ * Wire payload of the `adzen_ad_anchor` SSE event. Emitted the instant a
118
+ * paragraph closes (before matching runs), it reserves the render slot for the
119
+ * `adzen_inline` event that may follow for the same `paragraph_index`, so the
120
+ * ad lands at the paragraph boundary rather than wherever the live cursor has
121
+ * advanced to by the time the (match-latency-delayed) ad arrives.
122
+ */
123
+ interface AdAnchorEvent {
124
+ version: number;
125
+ paragraph_index: number;
126
+ }
127
+ interface AdzenStreamAnchorEvent {
128
+ type: "adzen_ad_anchor";
129
+ data: AdAnchorEvent;
130
+ }
116
131
  interface AdzenStreamContentEvent {
117
132
  type: "content";
118
133
  data: string;
119
134
  }
120
- type AdzenStreamEvent = AdzenStreamStartEvent | AdzenStreamEndEvent | AdzenStreamErrorEvent | AdzenStreamInlineEvent | AdzenStreamContentEvent;
135
+ type AdzenStreamEvent = AdzenStreamStartEvent | AdzenStreamEndEvent | AdzenStreamErrorEvent | AdzenStreamInlineEvent | AdzenStreamAnchorEvent | AdzenStreamContentEvent;
121
136
  type AdzenEnv = "prod" | "stg" | "dev";
122
137
  type AdzenFormat = "banner" | "native" | "sticky" | "in-feed";
123
138
  type SlotPosition = "atf" | "btf";
@@ -279,4 +294,4 @@ interface ViewabilityOptions {
279
294
  }
280
295
  declare function observeViewability(options: ViewabilityOptions): () => void;
281
296
 
282
- export { type AbContext, type AdzenApi, type AdzenBaseConfig, type AdzenConsent, type AdzenDefaults, type AdzenEnv, type AdzenError, type AdzenFormat, type AdzenPlacement, type AdzenQueueItem, type AdzenStaticConfig, type AdzenStreamContentEvent, type AdzenStreamEndEvent, type AdzenStreamErrorEvent, type AdzenStreamEvent, type AdzenStreamInlineEvent, type AdzenStreamStartEvent, type BannerCreative, type Beacons, type Creative, type Decision, type DecisionRequest, type DecisionResponse, type InlineAdCreative, type InlineAdEvent, type InlineAdEventPayload, type NativeCreative, type PageContext, type PlacementRecord, type PlacementsResponse, type ProcessResponse, type ProcessResponseAd, type ResolvedAdzenStaticConfig, type SlotPosition, type SlotSpec, type StickyCreative, type UserContext, type ViewabilityOptions, type ViewportContext, ensureTid, observeViewability, readTid, registerErrorSink, reportError, safeRun, safeRunAsync, uuidv4 };
297
+ export { type AbContext, type AdAnchorEvent, type AdzenApi, type AdzenBaseConfig, type AdzenConsent, type AdzenDefaults, type AdzenEnv, type AdzenError, type AdzenFormat, type AdzenPlacement, type AdzenQueueItem, type AdzenStaticConfig, type AdzenStreamAnchorEvent, type AdzenStreamContentEvent, type AdzenStreamEndEvent, type AdzenStreamErrorEvent, type AdzenStreamEvent, type AdzenStreamInlineEvent, type AdzenStreamStartEvent, type BannerCreative, type Beacons, type Creative, type Decision, type DecisionRequest, type DecisionResponse, type InlineAdCreative, type InlineAdEvent, type InlineAdEventPayload, type NativeCreative, type PageContext, type PlacementRecord, type PlacementsResponse, type ProcessResponse, type ProcessResponseAd, type ResolvedAdzenStaticConfig, type SlotPosition, type SlotSpec, type StickyCreative, type UserContext, type ViewabilityOptions, type ViewportContext, ensureTid, observeViewability, readTid, registerErrorSink, reportError, safeRun, safeRunAsync, uuidv4 };
package/dist/index.d.ts CHANGED
@@ -113,11 +113,26 @@ interface AdzenStreamInlineEvent {
113
113
  type: "adzen_inline";
114
114
  data: InlineAdEvent;
115
115
  }
116
+ /**
117
+ * Wire payload of the `adzen_ad_anchor` SSE event. Emitted the instant a
118
+ * paragraph closes (before matching runs), it reserves the render slot for the
119
+ * `adzen_inline` event that may follow for the same `paragraph_index`, so the
120
+ * ad lands at the paragraph boundary rather than wherever the live cursor has
121
+ * advanced to by the time the (match-latency-delayed) ad arrives.
122
+ */
123
+ interface AdAnchorEvent {
124
+ version: number;
125
+ paragraph_index: number;
126
+ }
127
+ interface AdzenStreamAnchorEvent {
128
+ type: "adzen_ad_anchor";
129
+ data: AdAnchorEvent;
130
+ }
116
131
  interface AdzenStreamContentEvent {
117
132
  type: "content";
118
133
  data: string;
119
134
  }
120
- type AdzenStreamEvent = AdzenStreamStartEvent | AdzenStreamEndEvent | AdzenStreamErrorEvent | AdzenStreamInlineEvent | AdzenStreamContentEvent;
135
+ type AdzenStreamEvent = AdzenStreamStartEvent | AdzenStreamEndEvent | AdzenStreamErrorEvent | AdzenStreamInlineEvent | AdzenStreamAnchorEvent | AdzenStreamContentEvent;
121
136
  type AdzenEnv = "prod" | "stg" | "dev";
122
137
  type AdzenFormat = "banner" | "native" | "sticky" | "in-feed";
123
138
  type SlotPosition = "atf" | "btf";
@@ -279,4 +294,4 @@ interface ViewabilityOptions {
279
294
  }
280
295
  declare function observeViewability(options: ViewabilityOptions): () => void;
281
296
 
282
- export { type AbContext, type AdzenApi, type AdzenBaseConfig, type AdzenConsent, type AdzenDefaults, type AdzenEnv, type AdzenError, type AdzenFormat, type AdzenPlacement, type AdzenQueueItem, type AdzenStaticConfig, type AdzenStreamContentEvent, type AdzenStreamEndEvent, type AdzenStreamErrorEvent, type AdzenStreamEvent, type AdzenStreamInlineEvent, type AdzenStreamStartEvent, type BannerCreative, type Beacons, type Creative, type Decision, type DecisionRequest, type DecisionResponse, type InlineAdCreative, type InlineAdEvent, type InlineAdEventPayload, type NativeCreative, type PageContext, type PlacementRecord, type PlacementsResponse, type ProcessResponse, type ProcessResponseAd, type ResolvedAdzenStaticConfig, type SlotPosition, type SlotSpec, type StickyCreative, type UserContext, type ViewabilityOptions, type ViewportContext, ensureTid, observeViewability, readTid, registerErrorSink, reportError, safeRun, safeRunAsync, uuidv4 };
297
+ export { type AbContext, type AdAnchorEvent, type AdzenApi, type AdzenBaseConfig, type AdzenConsent, type AdzenDefaults, type AdzenEnv, type AdzenError, type AdzenFormat, type AdzenPlacement, type AdzenQueueItem, type AdzenStaticConfig, type AdzenStreamAnchorEvent, type AdzenStreamContentEvent, type AdzenStreamEndEvent, type AdzenStreamErrorEvent, type AdzenStreamEvent, type AdzenStreamInlineEvent, type AdzenStreamStartEvent, type BannerCreative, type Beacons, type Creative, type Decision, type DecisionRequest, type DecisionResponse, type InlineAdCreative, type InlineAdEvent, type InlineAdEventPayload, type NativeCreative, type PageContext, type PlacementRecord, type PlacementsResponse, type ProcessResponse, type ProcessResponseAd, type ResolvedAdzenStaticConfig, type SlotPosition, type SlotSpec, type StickyCreative, type UserContext, type ViewabilityOptions, type ViewportContext, ensureTid, observeViewability, readTid, registerErrorSink, reportError, safeRun, safeRunAsync, uuidv4 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adzenai/core",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Core types and utilities for the Adzen AI ad SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,15 +25,15 @@
25
25
  "files": [
26
26
  "dist"
27
27
  ],
28
+ "devDependencies": {
29
+ "tsup": "^8.1.0",
30
+ "typescript": "^5.5.0",
31
+ "vitest": "^2.1.0"
32
+ },
28
33
  "scripts": {
29
34
  "build": "tsup",
30
35
  "test": "vitest run",
31
36
  "clean": "rm -rf dist",
32
37
  "typecheck": "tsc --noEmit"
33
- },
34
- "devDependencies": {
35
- "tsup": "^8.1.0",
36
- "typescript": "^5.5.0",
37
- "vitest": "^2.1.0"
38
38
  }
39
- }
39
+ }