@adzenai/core 1.2.4 → 1.2.5

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
@@ -33,10 +33,10 @@ import {
33
33
  | `AdzenDecision` | API response wrapper (`"serve"` or `"no_match"` with optional placement) |
34
34
  | `TrackingInfo` | Render/view/click tracking URLs |
35
35
  | `AdzenBaseConfig` | Shared config interface (`apiKey`, `endpointUrl`, `timeoutMs`) |
36
- | `InlineAdEvent` | In-message creative delivered by an `adzen_inline` SSE event; `paragraph_index` (with `ad_id`) is its placement instance key |
36
+ | `InlineAdEvent` | In-message creative delivered by an `adzen_inline` SSE event; `paragraph_index` (with `ad_id`) is its placement instance key, and an optional absolute `content_offset` is the backend-authoritative render position (UTF-16 index) |
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
+ | `AdAnchorEvent` | Payload of the `adzen_ad_anchor` SSE event (`version`, `paragraph_index`, optional absolute `content_offset`); reserves a paragraph's render position before the matching `adzen_inline` arrives |
40
40
 
41
41
  Static-channel types are also exported: `DecisionRequest`, `Decision`, `Creative`, `SlotSpec`, `BannerCreative`, `NativeCreative`, and more.
42
42
 
package/dist/index.d.cts CHANGED
@@ -53,6 +53,15 @@ interface InlineAdEvent {
53
53
  * being deduped to the first.
54
54
  */
55
55
  paragraph_index: number;
56
+ /**
57
+ * Absolute render position: the ad is inserted at this index in the
58
+ * accumulated assistant text (`text.slice(0, content_offset)` is everything
59
+ * before it). Cumulative for the message and measured in UTF-16 code units —
60
+ * the same unit as JavaScript `String.length`/`.slice`, so no conversion is
61
+ * needed. Optional for back-compat: older servers omit it and the middleware
62
+ * falls back to the anchor reservation or the live stream cursor.
63
+ */
64
+ content_offset?: number;
56
65
  position: string;
57
66
  creative: InlineAdCreative;
58
67
  tracking: {
@@ -123,6 +132,13 @@ interface AdzenStreamInlineEvent {
123
132
  interface AdAnchorEvent {
124
133
  version: number;
125
134
  paragraph_index: number;
135
+ /**
136
+ * Absolute UTF-16 render position for the paragraph this anchor reserves,
137
+ * matching the `content_offset` on the `adzen_inline` that may follow.
138
+ * Optional for back-compat: older servers omit it and the middleware records
139
+ * the live stream cursor instead.
140
+ */
141
+ content_offset?: number;
126
142
  }
127
143
  interface AdzenStreamAnchorEvent {
128
144
  type: "adzen_ad_anchor";
package/dist/index.d.ts CHANGED
@@ -53,6 +53,15 @@ interface InlineAdEvent {
53
53
  * being deduped to the first.
54
54
  */
55
55
  paragraph_index: number;
56
+ /**
57
+ * Absolute render position: the ad is inserted at this index in the
58
+ * accumulated assistant text (`text.slice(0, content_offset)` is everything
59
+ * before it). Cumulative for the message and measured in UTF-16 code units —
60
+ * the same unit as JavaScript `String.length`/`.slice`, so no conversion is
61
+ * needed. Optional for back-compat: older servers omit it and the middleware
62
+ * falls back to the anchor reservation or the live stream cursor.
63
+ */
64
+ content_offset?: number;
56
65
  position: string;
57
66
  creative: InlineAdCreative;
58
67
  tracking: {
@@ -123,6 +132,13 @@ interface AdzenStreamInlineEvent {
123
132
  interface AdAnchorEvent {
124
133
  version: number;
125
134
  paragraph_index: number;
135
+ /**
136
+ * Absolute UTF-16 render position for the paragraph this anchor reserves,
137
+ * matching the `content_offset` on the `adzen_inline` that may follow.
138
+ * Optional for back-compat: older servers omit it and the middleware records
139
+ * the live stream cursor instead.
140
+ */
141
+ content_offset?: number;
126
142
  }
127
143
  interface AdzenStreamAnchorEvent {
128
144
  type: "adzen_ad_anchor";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adzenai/core",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "Core types and utilities for the Adzen AI ad SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",