@adzenai/core 1.2.1 → 1.2.3

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,9 +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 |
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
- | `InlineAdEventPayload` | `InlineAdEvent` plus `message_id` and `content_offset`, the character position in the message the ad is anchored to |
38
+ | `InlineAdEventPayload` | `InlineAdEvent` (including `paragraph_index`) plus `message_id` and `content_offset`, the character position in the message the ad is anchored to |
39
39
 
40
40
  Static-channel types are also exported: `DecisionRequest`, `Decision`, `Creative`, `SlotSpec`, `BannerCreative`, `NativeCreative`, and more.
41
41
 
package/dist/index.d.cts CHANGED
@@ -46,6 +46,13 @@ interface InlineAdCreative {
46
46
  interface InlineAdEvent {
47
47
  version: number;
48
48
  ad_id: number;
49
+ /**
50
+ * 1-based index of the paragraph the ad was placed after. Combined with
51
+ * `ad_id` it forms the placement instance key, so a creative served more
52
+ * than once in a response (spaced repeats) keeps every showing instead of
53
+ * being deduped to the first.
54
+ */
55
+ paragraph_index: number;
49
56
  position: string;
50
57
  creative: InlineAdCreative;
51
58
  tracking: {
@@ -68,6 +75,11 @@ interface InlineAdEventPayload extends InlineAdEvent {
68
75
  }
69
76
  interface PlacementRecord {
70
77
  ad_id: number;
78
+ /**
79
+ * Placement anchor, matching `InlineAdEvent.paragraph_index`. Optional so the
80
+ * sidecar/polling path can adopt the same `(ad_id, paragraph_index)` key.
81
+ */
82
+ paragraph_index?: number;
71
83
  headline: string;
72
84
  cta_text: string;
73
85
  destination_url: string;
package/dist/index.d.ts CHANGED
@@ -46,6 +46,13 @@ interface InlineAdCreative {
46
46
  interface InlineAdEvent {
47
47
  version: number;
48
48
  ad_id: number;
49
+ /**
50
+ * 1-based index of the paragraph the ad was placed after. Combined with
51
+ * `ad_id` it forms the placement instance key, so a creative served more
52
+ * than once in a response (spaced repeats) keeps every showing instead of
53
+ * being deduped to the first.
54
+ */
55
+ paragraph_index: number;
49
56
  position: string;
50
57
  creative: InlineAdCreative;
51
58
  tracking: {
@@ -68,6 +75,11 @@ interface InlineAdEventPayload extends InlineAdEvent {
68
75
  }
69
76
  interface PlacementRecord {
70
77
  ad_id: number;
78
+ /**
79
+ * Placement anchor, matching `InlineAdEvent.paragraph_index`. Optional so the
80
+ * sidecar/polling path can adopt the same `(ad_id, paragraph_index)` key.
81
+ */
82
+ paragraph_index?: number;
71
83
  headline: string;
72
84
  cta_text: string;
73
85
  destination_url: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adzenai/core",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
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
+ }