@adzenai/core 1.2.3 → 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 +2 -1
- package/dist/index.d.cts +33 -2
- package/dist/index.d.ts +33 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,9 +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`, optional absolute `content_offset`); reserves a paragraph's render position 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
|
@@ -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: {
|
|
@@ -113,11 +122,33 @@ interface AdzenStreamInlineEvent {
|
|
|
113
122
|
type: "adzen_inline";
|
|
114
123
|
data: InlineAdEvent;
|
|
115
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Wire payload of the `adzen_ad_anchor` SSE event. Emitted the instant a
|
|
127
|
+
* paragraph closes (before matching runs), it reserves the render slot for the
|
|
128
|
+
* `adzen_inline` event that may follow for the same `paragraph_index`, so the
|
|
129
|
+
* ad lands at the paragraph boundary rather than wherever the live cursor has
|
|
130
|
+
* advanced to by the time the (match-latency-delayed) ad arrives.
|
|
131
|
+
*/
|
|
132
|
+
interface AdAnchorEvent {
|
|
133
|
+
version: number;
|
|
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;
|
|
142
|
+
}
|
|
143
|
+
interface AdzenStreamAnchorEvent {
|
|
144
|
+
type: "adzen_ad_anchor";
|
|
145
|
+
data: AdAnchorEvent;
|
|
146
|
+
}
|
|
116
147
|
interface AdzenStreamContentEvent {
|
|
117
148
|
type: "content";
|
|
118
149
|
data: string;
|
|
119
150
|
}
|
|
120
|
-
type AdzenStreamEvent = AdzenStreamStartEvent | AdzenStreamEndEvent | AdzenStreamErrorEvent | AdzenStreamInlineEvent | AdzenStreamContentEvent;
|
|
151
|
+
type AdzenStreamEvent = AdzenStreamStartEvent | AdzenStreamEndEvent | AdzenStreamErrorEvent | AdzenStreamInlineEvent | AdzenStreamAnchorEvent | AdzenStreamContentEvent;
|
|
121
152
|
type AdzenEnv = "prod" | "stg" | "dev";
|
|
122
153
|
type AdzenFormat = "banner" | "native" | "sticky" | "in-feed";
|
|
123
154
|
type SlotPosition = "atf" | "btf";
|
|
@@ -279,4 +310,4 @@ interface ViewabilityOptions {
|
|
|
279
310
|
}
|
|
280
311
|
declare function observeViewability(options: ViewabilityOptions): () => void;
|
|
281
312
|
|
|
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 };
|
|
313
|
+
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
|
@@ -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: {
|
|
@@ -113,11 +122,33 @@ interface AdzenStreamInlineEvent {
|
|
|
113
122
|
type: "adzen_inline";
|
|
114
123
|
data: InlineAdEvent;
|
|
115
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Wire payload of the `adzen_ad_anchor` SSE event. Emitted the instant a
|
|
127
|
+
* paragraph closes (before matching runs), it reserves the render slot for the
|
|
128
|
+
* `adzen_inline` event that may follow for the same `paragraph_index`, so the
|
|
129
|
+
* ad lands at the paragraph boundary rather than wherever the live cursor has
|
|
130
|
+
* advanced to by the time the (match-latency-delayed) ad arrives.
|
|
131
|
+
*/
|
|
132
|
+
interface AdAnchorEvent {
|
|
133
|
+
version: number;
|
|
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;
|
|
142
|
+
}
|
|
143
|
+
interface AdzenStreamAnchorEvent {
|
|
144
|
+
type: "adzen_ad_anchor";
|
|
145
|
+
data: AdAnchorEvent;
|
|
146
|
+
}
|
|
116
147
|
interface AdzenStreamContentEvent {
|
|
117
148
|
type: "content";
|
|
118
149
|
data: string;
|
|
119
150
|
}
|
|
120
|
-
type AdzenStreamEvent = AdzenStreamStartEvent | AdzenStreamEndEvent | AdzenStreamErrorEvent | AdzenStreamInlineEvent | AdzenStreamContentEvent;
|
|
151
|
+
type AdzenStreamEvent = AdzenStreamStartEvent | AdzenStreamEndEvent | AdzenStreamErrorEvent | AdzenStreamInlineEvent | AdzenStreamAnchorEvent | AdzenStreamContentEvent;
|
|
121
152
|
type AdzenEnv = "prod" | "stg" | "dev";
|
|
122
153
|
type AdzenFormat = "banner" | "native" | "sticky" | "in-feed";
|
|
123
154
|
type SlotPosition = "atf" | "btf";
|
|
@@ -279,4 +310,4 @@ interface ViewabilityOptions {
|
|
|
279
310
|
}
|
|
280
311
|
declare function observeViewability(options: ViewabilityOptions): () => void;
|
|
281
312
|
|
|
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 };
|
|
313
|
+
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 };
|