@oursprivacy/platform-sdk 1.15.1 → 1.17.0

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/client.d.mts +5 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +5 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/destinations.d.mts +5 -5
  12. package/resources/destinations.d.mts.map +1 -1
  13. package/resources/destinations.d.ts +5 -5
  14. package/resources/destinations.d.ts.map +1 -1
  15. package/resources/experiment-settings.d.mts +35 -21
  16. package/resources/experiment-settings.d.mts.map +1 -1
  17. package/resources/experiment-settings.d.ts +35 -21
  18. package/resources/experiment-settings.d.ts.map +1 -1
  19. package/resources/experiment-variants.d.mts +28 -7
  20. package/resources/experiment-variants.d.mts.map +1 -1
  21. package/resources/experiment-variants.d.ts +28 -7
  22. package/resources/experiment-variants.d.ts.map +1 -1
  23. package/resources/experiments.d.mts +160 -17
  24. package/resources/experiments.d.mts.map +1 -1
  25. package/resources/experiments.d.ts +160 -17
  26. package/resources/experiments.d.ts.map +1 -1
  27. package/resources/experiments.js +25 -2
  28. package/resources/experiments.js.map +1 -1
  29. package/resources/experiments.mjs +25 -2
  30. package/resources/experiments.mjs.map +1 -1
  31. package/resources/heatmap-pages.d.mts +193 -0
  32. package/resources/heatmap-pages.d.mts.map +1 -0
  33. package/resources/heatmap-pages.d.ts +193 -0
  34. package/resources/heatmap-pages.d.ts.map +1 -0
  35. package/resources/heatmap-pages.js +41 -0
  36. package/resources/heatmap-pages.js.map +1 -0
  37. package/resources/heatmap-pages.mjs +37 -0
  38. package/resources/heatmap-pages.mjs.map +1 -0
  39. package/resources/index.d.mts +2 -1
  40. package/resources/index.d.mts.map +1 -1
  41. package/resources/index.d.ts +2 -1
  42. package/resources/index.d.ts.map +1 -1
  43. package/resources/index.js +3 -1
  44. package/resources/index.js.map +1 -1
  45. package/resources/index.mjs +1 -0
  46. package/resources/index.mjs.map +1 -1
  47. package/resources/sources.d.mts +6 -8
  48. package/resources/sources.d.mts.map +1 -1
  49. package/resources/sources.d.ts +6 -8
  50. package/resources/sources.d.ts.map +1 -1
  51. package/resources/versions.d.mts +24 -8
  52. package/resources/versions.d.mts.map +1 -1
  53. package/resources/versions.d.ts +24 -8
  54. package/resources/versions.d.ts.map +1 -1
  55. package/resources/versions.js +24 -8
  56. package/resources/versions.js.map +1 -1
  57. package/resources/versions.mjs +24 -8
  58. package/resources/versions.mjs.map +1 -1
  59. package/src/client.ts +23 -0
  60. package/src/resources/destinations.ts +5 -0
  61. package/src/resources/experiment-settings.ts +35 -21
  62. package/src/resources/experiment-variants.ts +28 -7
  63. package/src/resources/experiments.ts +182 -16
  64. package/src/resources/heatmap-pages.ts +259 -0
  65. package/src/resources/index.ts +10 -0
  66. package/src/resources/sources.ts +6 -8
  67. package/src/resources/versions.ts +24 -8
  68. package/src/version.ts +1 -1
  69. package/version.d.mts +1 -1
  70. package/version.d.ts +1 -1
  71. package/version.js +1 -1
  72. package/version.mjs +1 -1
@@ -0,0 +1,259 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
6
+ import { RequestOptions } from '../internal/request-options';
7
+
8
+ export class HeatmapPages extends APIResource {
9
+ /**
10
+ * List pages with heatmap coverage in a date window, ranked for triage. Each
11
+ * entity is identified by `pageKey` (origin + pathname, query string stripped);
12
+ * use that value to drill into `GET /rest/v1/heatmap-pages/summary`. Supports
13
+ * cursor pagination — the underlying store uses offset internally, so cursors are
14
+ * bounded to roughly 10,000 entries deep; if you need pages beyond that, narrow
15
+ * `from`/`to` or add filters rather than paginating further. `from`/`to` are UTC
16
+ * calendar days in `YYYY-MM-DD`; the window must be 60 days or fewer. Requires
17
+ * scope: web-analytics:view
18
+ */
19
+ list(
20
+ query: HeatmapPageListParams,
21
+ options?: RequestOptions,
22
+ ): PagePromise<HeatmapPageListResponsesCursor, HeatmapPageListResponse> {
23
+ return this._client.getAPIList('/rest/v1/heatmap-pages', Cursor<HeatmapPageListResponse>, {
24
+ query,
25
+ ...options,
26
+ });
27
+ }
28
+
29
+ /**
30
+ * Bundled per-page heatmap rollup: click bins, dead clicks, rage clicks, scroll
31
+ * depth, and up to 5 curated in-app replay URLs in a single payload. Designed as a
32
+ * one-call diagnosis surface for an AI assistant or marketer — answers "what is
33
+ * happening on this page?" without fanning out across five endpoints. `pageKey`
34
+ * comes from `GET /rest/v1/heatmap-pages`. The endpoint is identified by query
35
+ * params rather than a path id because heatmap pages are not stored entities; this
36
+ * is a documented derived-read exception. `breakpoint` scopes the bin/scroll
37
+ * aggregations; replays are returned across all breakpoints regardless of
38
+ * `breakpoint` (weighted to cover multiple viewports) so callers can compare
39
+ * devices. Requires scope: web-analytics:view
40
+ */
41
+ summary(query: HeatmapPageSummaryParams, options?: RequestOptions): APIPromise<HeatmapPageSummaryResponse> {
42
+ return this._client.get('/rest/v1/heatmap-pages/summary', { query, ...options });
43
+ }
44
+ }
45
+
46
+ export type HeatmapPageListResponsesCursor = Cursor<HeatmapPageListResponse>;
47
+
48
+ export interface HeatmapPageListResponse {
49
+ breakpoints: Array<HeatmapPageListResponse.Breakpoint>;
50
+
51
+ deadClicks: number;
52
+
53
+ deadRate: number;
54
+
55
+ issueScore: number;
56
+
57
+ /**
58
+ * Stable per-page identifier (origin + pathname, query string stripped). Use this
59
+ * as the `pageKey` argument to `GET /rest/v1/heatmap-pages/summary` and the
60
+ * heatmap MCP tools.
61
+ */
62
+ pageKey: string;
63
+
64
+ rageClicks: number;
65
+
66
+ rageRate: number;
67
+
68
+ totalClicks: number;
69
+ }
70
+
71
+ export namespace HeatmapPageListResponse {
72
+ export interface Breakpoint {
73
+ breakpoint: string;
74
+
75
+ clicks: number;
76
+ }
77
+ }
78
+
79
+ export interface HeatmapPageSummaryResponse {
80
+ /**
81
+ * Aggregated click positions for the requested breakpoint, bucketed into a 64×64
82
+ * grid normalized to the page viewport.
83
+ */
84
+ clickBins: Array<HeatmapPageSummaryResponse.ClickBin>;
85
+
86
+ /**
87
+ * Click positions where no interactive element was hit. `topElement` is the
88
+ * most-frequently-clicked non-interactive ancestor tag at that bucket, if
89
+ * attributable.
90
+ */
91
+ deadClicks: Array<HeatmapPageSummaryResponse.DeadClick>;
92
+
93
+ /**
94
+ * Click positions where repeated clicks were detected within a short window.
95
+ */
96
+ rageClicks: Array<HeatmapPageSummaryResponse.RageClick>;
97
+
98
+ /**
99
+ * Up to 5 curated replay links for this page, ranked by engagement and weighted to
100
+ * cover multiple viewport breakpoints when possible. Each entry is an absolute URL
101
+ * into the OursPrivacy web app — open it to view the recorded session.
102
+ */
103
+ replays: Array<HeatmapPageSummaryResponse.Replay>;
104
+
105
+ /**
106
+ * Distribution of how far visitors scrolled, bucketed in percent of page height.
107
+ * `sessions` is the count of distinct sessions that reached at least that bucket.
108
+ */
109
+ scrollDepth: Array<HeatmapPageSummaryResponse.ScrollDepth>;
110
+ }
111
+
112
+ export namespace HeatmapPageSummaryResponse {
113
+ export interface ClickBin {
114
+ binX: number;
115
+
116
+ binY: number;
117
+
118
+ clicks: number;
119
+ }
120
+
121
+ export interface DeadClick {
122
+ binX: number;
123
+
124
+ binY: number;
125
+
126
+ deadClicks: number;
127
+
128
+ topElement?: string | null;
129
+ }
130
+
131
+ export interface RageClick {
132
+ binX: number;
133
+
134
+ binY: number;
135
+
136
+ rageEvents: number;
137
+
138
+ totalClicks: number;
139
+ }
140
+
141
+ export interface Replay {
142
+ /**
143
+ * Viewport bucket the session was recorded under.
144
+ */
145
+ breakpoint: 'desktop' | 'mobile' | 'tablet';
146
+
147
+ /**
148
+ * Absolute link to view the session replay in the OursPrivacy web app. Opens the
149
+ * replayer pre-scoped to this session, visitor, and date.
150
+ */
151
+ url: string;
152
+ }
153
+
154
+ export interface ScrollDepth {
155
+ bucket: number;
156
+
157
+ sessions: number;
158
+ }
159
+ }
160
+
161
+ export interface HeatmapPageListParams extends CursorParams {
162
+ /**
163
+ * Inclusive lower bound of the heatmap window, as a UTC calendar day in
164
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 60 days or
165
+ * fewer.
166
+ */
167
+ from: string;
168
+
169
+ /**
170
+ * Inclusive upper bound of the heatmap window, as a UTC calendar day in
171
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 60 days or
172
+ * fewer.
173
+ */
174
+ to: string;
175
+
176
+ /**
177
+ * Filter by browser name as captured on events.
178
+ */
179
+ browserName?: string;
180
+
181
+ /**
182
+ * Filter by visitor country (ISO country name or code as stored on events).
183
+ */
184
+ country?: string;
185
+
186
+ /**
187
+ * Filter by visitor region (state/province as stored on events).
188
+ */
189
+ region?: string;
190
+
191
+ /**
192
+ * Case-insensitive substring match against `pageKey`.
193
+ */
194
+ search?: string;
195
+
196
+ /**
197
+ * Sort key. Defaults to `CLICKS` (descending).
198
+ */
199
+ sortBy?: 'CLICKS' | 'DEAD_RATE' | 'ISSUE_SCORE' | 'RAGE_RATE';
200
+
201
+ /**
202
+ * Sort direction. Defaults to `DESC`.
203
+ */
204
+ sortDir?: 'ASC' | 'DESC';
205
+ }
206
+
207
+ export interface HeatmapPageSummaryParams {
208
+ /**
209
+ * Viewport bucket the click, dead-click, rage, and scroll-depth aggregations are
210
+ * computed for. Replays are returned for all breakpoints regardless of this value
211
+ * so callers can compare across devices.
212
+ */
213
+ breakpoint: 'desktop' | 'mobile' | 'tablet';
214
+
215
+ /**
216
+ * Inclusive lower bound of the heatmap window, as a UTC calendar day in
217
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 60 days or
218
+ * fewer.
219
+ */
220
+ from: string;
221
+
222
+ /**
223
+ * Page identifier returned by `GET /rest/v1/heatmap-pages`. Origin + pathname with
224
+ * the query string stripped (e.g. `https://example.com/pricing`).
225
+ */
226
+ pageKey: string;
227
+
228
+ /**
229
+ * Inclusive upper bound of the heatmap window, as a UTC calendar day in
230
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 60 days or
231
+ * fewer.
232
+ */
233
+ to: string;
234
+
235
+ /**
236
+ * Filter by browser name as captured on events.
237
+ */
238
+ browserName?: string;
239
+
240
+ /**
241
+ * Filter by visitor country (ISO country name or code as stored on events).
242
+ */
243
+ country?: string;
244
+
245
+ /**
246
+ * Filter by visitor region (state/province as stored on events).
247
+ */
248
+ region?: string;
249
+ }
250
+
251
+ export declare namespace HeatmapPages {
252
+ export {
253
+ type HeatmapPageListResponse as HeatmapPageListResponse,
254
+ type HeatmapPageSummaryResponse as HeatmapPageSummaryResponse,
255
+ type HeatmapPageListResponsesCursor as HeatmapPageListResponsesCursor,
256
+ type HeatmapPageListParams as HeatmapPageListParams,
257
+ type HeatmapPageSummaryParams as HeatmapPageSummaryParams,
258
+ };
259
+ }
@@ -64,6 +64,7 @@ export {
64
64
  type ExperimentResumeResponse,
65
65
  type ExperimentResultsResponse,
66
66
  type ExperimentResultsTimeSeriesResponse,
67
+ type ExperimentSessionReplaysResponse,
67
68
  type ExperimentListParams,
68
69
  type ExperimentCreateParams,
69
70
  type ExperimentUpdateParams,
@@ -73,6 +74,7 @@ export {
73
74
  type ExperimentResumeParams,
74
75
  type ExperimentResultsParams,
75
76
  type ExperimentResultsTimeSeriesParams,
77
+ type ExperimentSessionReplaysParams,
76
78
  type ExperimentListResponsesCursor,
77
79
  } from './experiments';
78
80
  export {
@@ -87,6 +89,14 @@ export {
87
89
  type GlobalDispatchCenterUpdateParams,
88
90
  type GlobalDispatchCenterListResponsesCursor,
89
91
  } from './global-dispatch-centers';
92
+ export {
93
+ HeatmapPages,
94
+ type HeatmapPageListResponse,
95
+ type HeatmapPageSummaryResponse,
96
+ type HeatmapPageListParams,
97
+ type HeatmapPageSummaryParams,
98
+ type HeatmapPageListResponsesCursor,
99
+ } from './heatmap-pages';
90
100
  export {
91
101
  Mappings,
92
102
  type MappingListResponse,
@@ -112,10 +112,9 @@ export namespace SourceListResponse {
112
112
  selectedAccountId?: string | null;
113
113
 
114
114
  /**
115
- * Optional domain allowlist for source event ingestion. When set, only requests
116
- * from these domains are accepted for this source. This is separate from
117
- * experimentation settings `whitelistDomains`, which gates experiment SDK
118
- * delivery.
115
+ * Limits which domains can send events to the CDP. When set, only requests from
116
+ * these domains are accepted for this source. Separate from experiment settings
117
+ * `whitelistDomains`, which limits which domains can load your experiments.
119
118
  */
120
119
  whitelistDomains?: Array<string> | null;
121
120
 
@@ -223,10 +222,9 @@ export interface SourceRetrieveResponse {
223
222
  selectedAccountId?: string | null;
224
223
 
225
224
  /**
226
- * Optional domain allowlist for source event ingestion. When set, only requests
227
- * from these domains are accepted for this source. This is separate from
228
- * experimentation settings `whitelistDomains`, which gates experiment SDK
229
- * delivery.
225
+ * Limits which domains can send events to the CDP. When set, only requests from
226
+ * these domains are accepted for this source. Separate from experiment settings
227
+ * `whitelistDomains`, which limits which domains can load your experiments.
230
228
  */
231
229
  whitelistDomains?: Array<string> | null;
232
230
 
@@ -20,12 +20,22 @@ export class Versions extends APIResource {
20
20
  }
21
21
 
22
22
  /**
23
- * Publish the current draft (i.e. all unpublished entity changes) as a new
24
- * version. Returns the full Version on success. Returns HTTP 409 with the reason
25
- * in the response `error` field when there are no draft changes to publish, when
26
- * another publish is already in flight, or when the action otherwise conflicts
27
- * with current state. To re-publish an existing version, use POST
28
- * /rest/v1/versions/{id}/publish instead. Requires scope: version:publish
23
+ * Publish the current draft of non-experiment entities (destinations, mappings,
24
+ * experiment settings, governance rules, etc.) as a new version. Newly created or
25
+ * modified DRAFT experiments and experiment variants are NOT shipped here — call
26
+ * `POST /rest/v1/experiments/{id}/start` instead, which atomically publishes the
27
+ * experiment and its variants by default (`publishAfterStart: true`). Returns the
28
+ * full Version on success. Returns HTTP 409 with the reason in the response
29
+ * `error` field when there are no draft changes to publish, when another publish
30
+ * is already in flight, or when the action otherwise conflicts with current state.
31
+ * To re-publish an existing version, use POST /rest/v1/versions/{id}/publish
32
+ * instead.
33
+ *
34
+ * Supports cherry-picking via the `include*` body fields. Each `include*` field is
35
+ * an entity-id allowlist for one collection — omit (or send `[]`) to include every
36
+ * draft change in that collection, or send a non-empty array to whitelist only
37
+ * those ids. Unlisted collections inherit wholesale from the latest published
38
+ * version. Requires scope: version:publish
29
39
  */
30
40
  create(body: VersionCreateParams, options?: RequestOptions): APIPromise<VersionCreateResponse> {
31
41
  return this._client.post('/rest/v1/versions', { body, ...options });
@@ -72,8 +82,14 @@ export class Versions extends APIResource {
72
82
  * Compare two versions of the account configuration. Returns
73
83
  * added/removed/modified entities grouped by collection, plus a total `count`.
74
84
  *
75
- * - `GET /rest/v1/versions/draft/diff` — compare the current draft (all
76
- * unpublished entity changes) against the latest published version. Use this to
85
+ * Draft experiments and experiment variants do NOT appear in any diff — only
86
+ * experiments that are already running (or paused/completed) snapshot into
87
+ * versions. Use the experiment lifecycle endpoints (`/start`, `/stop`, etc.) to
88
+ * ship experiment changes; use these diff endpoints only for non-experiment
89
+ * entities (destinations, mappings, experiment settings, governance rules, etc.).
90
+ *
91
+ * - `GET /rest/v1/versions/draft/diff` — compare the current draft of
92
+ * non-experiment entities against the latest published version. Use this to
77
93
  * preview what would be included in a `POST /rest/v1/versions` call. (`draft` is
78
94
  * a literal path segment — there is no version with that ID; it identifies the
79
95
  * comparison target.)
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.15.1'; // x-release-please-version
1
+ export const VERSION = '1.17.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.15.1";
1
+ export declare const VERSION = "1.17.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.15.1";
1
+ export declare const VERSION = "1.17.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.15.1'; // x-release-please-version
4
+ exports.VERSION = '1.17.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.15.1'; // x-release-please-version
1
+ export const VERSION = '1.17.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map