@adzenai/core 1.1.1 → 1.2.1
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 +3 -0
- package/dist/index.d.cts +76 -1
- package/dist/index.d.ts +76 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -33,6 +33,9 @@ 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 |
|
|
37
|
+
| `InlineAdCreative` | Inline creative fields (`headline`, `cta_text`, `destination_url`, `format`, `label`, optional `advertiser_name`) |
|
|
38
|
+
| `InlineAdEventPayload` | `InlineAdEvent` plus `message_id` and `content_offset`, the character position in the message the ad is anchored to |
|
|
36
39
|
|
|
37
40
|
Static-channel types are also exported: `DecisionRequest`, `Decision`, `Creative`, `SlotSpec`, `BannerCreative`, `NativeCreative`, and more.
|
|
38
41
|
|
package/dist/index.d.cts
CHANGED
|
@@ -31,6 +31,81 @@ interface ProcessResponse {
|
|
|
31
31
|
message_id: string;
|
|
32
32
|
ads: ProcessResponseAd[];
|
|
33
33
|
}
|
|
34
|
+
interface InlineAdCreative {
|
|
35
|
+
headline: string;
|
|
36
|
+
cta_text: string;
|
|
37
|
+
destination_url: string;
|
|
38
|
+
format: string;
|
|
39
|
+
label: string;
|
|
40
|
+
/**
|
|
41
|
+
* Not part of the documented `adzen_inline` payload yet. When absent,
|
|
42
|
+
* `InlineAd` falls back to `headline` for the advertiser text.
|
|
43
|
+
*/
|
|
44
|
+
advertiser_name?: string;
|
|
45
|
+
}
|
|
46
|
+
interface InlineAdEvent {
|
|
47
|
+
version: number;
|
|
48
|
+
ad_id: number;
|
|
49
|
+
position: string;
|
|
50
|
+
creative: InlineAdCreative;
|
|
51
|
+
tracking: {
|
|
52
|
+
impression_url: string | null;
|
|
53
|
+
click_slug: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Payload of the `adzen_inline_ad` custom event emitted by the streaming
|
|
58
|
+
* middleware. Carries the anchor needed to render the ad in the message body.
|
|
59
|
+
*/
|
|
60
|
+
interface InlineAdEventPayload extends InlineAdEvent {
|
|
61
|
+
message_id: string;
|
|
62
|
+
/**
|
|
63
|
+
* Characters of assistant message content that had been streamed when the
|
|
64
|
+
* ad arrived, so the ad renders at that point in the text rather than at
|
|
65
|
+
* the end of the message.
|
|
66
|
+
*/
|
|
67
|
+
content_offset: number;
|
|
68
|
+
}
|
|
69
|
+
interface PlacementRecord {
|
|
70
|
+
ad_id: number;
|
|
71
|
+
headline: string;
|
|
72
|
+
cta_text: string;
|
|
73
|
+
destination_url: string;
|
|
74
|
+
placement: string;
|
|
75
|
+
tracking: {
|
|
76
|
+
impression_url: string | null;
|
|
77
|
+
click_slug: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
interface PlacementsResponse {
|
|
81
|
+
placements: PlacementRecord[];
|
|
82
|
+
}
|
|
83
|
+
interface AdzenStreamStartEvent {
|
|
84
|
+
type: "adzen_stream_start";
|
|
85
|
+
conversation_id: string;
|
|
86
|
+
message_id: string;
|
|
87
|
+
placement_endpoint: string;
|
|
88
|
+
}
|
|
89
|
+
interface AdzenStreamEndEvent {
|
|
90
|
+
type: "adzen_stream_end";
|
|
91
|
+
conversation_id: string;
|
|
92
|
+
message_id: string;
|
|
93
|
+
ads_served: number;
|
|
94
|
+
}
|
|
95
|
+
interface AdzenStreamErrorEvent {
|
|
96
|
+
type: "adzen_error";
|
|
97
|
+
code: string;
|
|
98
|
+
message: string;
|
|
99
|
+
}
|
|
100
|
+
interface AdzenStreamInlineEvent {
|
|
101
|
+
type: "adzen_inline";
|
|
102
|
+
data: InlineAdEvent;
|
|
103
|
+
}
|
|
104
|
+
interface AdzenStreamContentEvent {
|
|
105
|
+
type: "content";
|
|
106
|
+
data: string;
|
|
107
|
+
}
|
|
108
|
+
type AdzenStreamEvent = AdzenStreamStartEvent | AdzenStreamEndEvent | AdzenStreamErrorEvent | AdzenStreamInlineEvent | AdzenStreamContentEvent;
|
|
34
109
|
type AdzenEnv = "prod" | "stg" | "dev";
|
|
35
110
|
type AdzenFormat = "banner" | "native" | "sticky" | "in-feed";
|
|
36
111
|
type SlotPosition = "atf" | "btf";
|
|
@@ -192,4 +267,4 @@ interface ViewabilityOptions {
|
|
|
192
267
|
}
|
|
193
268
|
declare function observeViewability(options: ViewabilityOptions): () => void;
|
|
194
269
|
|
|
195
|
-
export { type AbContext, type AdzenApi, type AdzenBaseConfig, type AdzenConsent, type AdzenDefaults, type AdzenEnv, type AdzenError, type AdzenFormat, type AdzenPlacement, type AdzenQueueItem, type AdzenStaticConfig, type BannerCreative, type Beacons, type Creative, type Decision, type DecisionRequest, type DecisionResponse, type NativeCreative, type PageContext, 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 };
|
|
270
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,81 @@ interface ProcessResponse {
|
|
|
31
31
|
message_id: string;
|
|
32
32
|
ads: ProcessResponseAd[];
|
|
33
33
|
}
|
|
34
|
+
interface InlineAdCreative {
|
|
35
|
+
headline: string;
|
|
36
|
+
cta_text: string;
|
|
37
|
+
destination_url: string;
|
|
38
|
+
format: string;
|
|
39
|
+
label: string;
|
|
40
|
+
/**
|
|
41
|
+
* Not part of the documented `adzen_inline` payload yet. When absent,
|
|
42
|
+
* `InlineAd` falls back to `headline` for the advertiser text.
|
|
43
|
+
*/
|
|
44
|
+
advertiser_name?: string;
|
|
45
|
+
}
|
|
46
|
+
interface InlineAdEvent {
|
|
47
|
+
version: number;
|
|
48
|
+
ad_id: number;
|
|
49
|
+
position: string;
|
|
50
|
+
creative: InlineAdCreative;
|
|
51
|
+
tracking: {
|
|
52
|
+
impression_url: string | null;
|
|
53
|
+
click_slug: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Payload of the `adzen_inline_ad` custom event emitted by the streaming
|
|
58
|
+
* middleware. Carries the anchor needed to render the ad in the message body.
|
|
59
|
+
*/
|
|
60
|
+
interface InlineAdEventPayload extends InlineAdEvent {
|
|
61
|
+
message_id: string;
|
|
62
|
+
/**
|
|
63
|
+
* Characters of assistant message content that had been streamed when the
|
|
64
|
+
* ad arrived, so the ad renders at that point in the text rather than at
|
|
65
|
+
* the end of the message.
|
|
66
|
+
*/
|
|
67
|
+
content_offset: number;
|
|
68
|
+
}
|
|
69
|
+
interface PlacementRecord {
|
|
70
|
+
ad_id: number;
|
|
71
|
+
headline: string;
|
|
72
|
+
cta_text: string;
|
|
73
|
+
destination_url: string;
|
|
74
|
+
placement: string;
|
|
75
|
+
tracking: {
|
|
76
|
+
impression_url: string | null;
|
|
77
|
+
click_slug: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
interface PlacementsResponse {
|
|
81
|
+
placements: PlacementRecord[];
|
|
82
|
+
}
|
|
83
|
+
interface AdzenStreamStartEvent {
|
|
84
|
+
type: "adzen_stream_start";
|
|
85
|
+
conversation_id: string;
|
|
86
|
+
message_id: string;
|
|
87
|
+
placement_endpoint: string;
|
|
88
|
+
}
|
|
89
|
+
interface AdzenStreamEndEvent {
|
|
90
|
+
type: "adzen_stream_end";
|
|
91
|
+
conversation_id: string;
|
|
92
|
+
message_id: string;
|
|
93
|
+
ads_served: number;
|
|
94
|
+
}
|
|
95
|
+
interface AdzenStreamErrorEvent {
|
|
96
|
+
type: "adzen_error";
|
|
97
|
+
code: string;
|
|
98
|
+
message: string;
|
|
99
|
+
}
|
|
100
|
+
interface AdzenStreamInlineEvent {
|
|
101
|
+
type: "adzen_inline";
|
|
102
|
+
data: InlineAdEvent;
|
|
103
|
+
}
|
|
104
|
+
interface AdzenStreamContentEvent {
|
|
105
|
+
type: "content";
|
|
106
|
+
data: string;
|
|
107
|
+
}
|
|
108
|
+
type AdzenStreamEvent = AdzenStreamStartEvent | AdzenStreamEndEvent | AdzenStreamErrorEvent | AdzenStreamInlineEvent | AdzenStreamContentEvent;
|
|
34
109
|
type AdzenEnv = "prod" | "stg" | "dev";
|
|
35
110
|
type AdzenFormat = "banner" | "native" | "sticky" | "in-feed";
|
|
36
111
|
type SlotPosition = "atf" | "btf";
|
|
@@ -192,4 +267,4 @@ interface ViewabilityOptions {
|
|
|
192
267
|
}
|
|
193
268
|
declare function observeViewability(options: ViewabilityOptions): () => void;
|
|
194
269
|
|
|
195
|
-
export { type AbContext, type AdzenApi, type AdzenBaseConfig, type AdzenConsent, type AdzenDefaults, type AdzenEnv, type AdzenError, type AdzenFormat, type AdzenPlacement, type AdzenQueueItem, type AdzenStaticConfig, type BannerCreative, type Beacons, type Creative, type Decision, type DecisionRequest, type DecisionResponse, type NativeCreative, type PageContext, 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 };
|
|
270
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adzenai/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
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
|
-
},
|
|
33
28
|
"scripts": {
|
|
34
29
|
"build": "tsup",
|
|
35
30
|
"test": "vitest run",
|
|
36
31
|
"clean": "rm -rf dist",
|
|
37
32
|
"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
|
+
}
|