@gravity-ai/api 1.1.7 → 1.1.9
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/dist/index.d.mts +154 -3
- package/dist/index.d.ts +154 -3
- package/dist/index.js +574 -2
- package/dist/index.mjs +569 -2
- package/dist/opentui.d.mts +1 -1
- package/dist/opentui.d.ts +1 -1
- package/dist/{types-DIfiZ2zL.d.mts → types-C_krF5uC.d.mts} +157 -2
- package/dist/{types-DIfiZ2zL.d.ts → types-C_krF5uC.d.ts} +157 -2
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ type Gender = 'male' | 'female' | 'other';
|
|
|
12
12
|
* Placement positions for ad rendering
|
|
13
13
|
* @description Specifies where ads should appear relative to the AI response
|
|
14
14
|
*/
|
|
15
|
-
type Placement = 'above_response' | 'below_response' | 'inline_response' | 'left_response' | 'right_response';
|
|
15
|
+
type Placement = 'above_response' | 'below_response' | 'inline_response' | 'left_response' | 'right_response' | 'search_result' | 'center_page' | 'top_page' | 'bottom_page' | 'left_page' | 'right_page';
|
|
16
16
|
/**
|
|
17
17
|
* Individual ad placement specification
|
|
18
18
|
* @description Defines a single ad slot with its position and optional tracking ID
|
|
@@ -29,6 +29,12 @@ interface PlacementObject {
|
|
|
29
29
|
placement: Placement;
|
|
30
30
|
/** Tracking ID for this specific ad slot (required) */
|
|
31
31
|
placement_id: string;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum character length for generated ad text in this slot.
|
|
34
|
+
* Overrides the placement-level display config baseline set in the dashboard.
|
|
35
|
+
* Minimum 50, maximum 5000.
|
|
36
|
+
*/
|
|
37
|
+
max_ad_text_chars?: number;
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* Represents a single message in a conversation
|
|
@@ -122,6 +128,14 @@ interface AdParams {
|
|
|
122
128
|
relevancy?: number | null;
|
|
123
129
|
/** Returns a test ad when true (no billing, for integration testing) */
|
|
124
130
|
testAd?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether the ads will be painted by a spec-capable renderer. Defaults to
|
|
133
|
+
* `true`; pass `false` if you render ad fields with your own markup so the
|
|
134
|
+
* server never serves a `renderer_spec` layout you won't display.
|
|
135
|
+
*/
|
|
136
|
+
supportsSpec?: boolean;
|
|
137
|
+
/** Spec capability profile. Default: `"web1"`. */
|
|
138
|
+
specCapabilities?: string;
|
|
125
139
|
/**
|
|
126
140
|
* Additional custom fields for publisher-specific targeting
|
|
127
141
|
* @description Any additional key-value pairs will be passed to the API
|
|
@@ -144,6 +158,103 @@ interface AdParams {
|
|
|
144
158
|
* };
|
|
145
159
|
* ```
|
|
146
160
|
*/
|
|
161
|
+
/**
|
|
162
|
+
* A single field in a lead-form ad unit.
|
|
163
|
+
* Mirrors the engine's `LeadFormField` Pydantic model.
|
|
164
|
+
*/
|
|
165
|
+
interface LeadFormField {
|
|
166
|
+
/** Field key (submitted as-is to /api/v1/lead). */
|
|
167
|
+
name: string;
|
|
168
|
+
/** Human-readable label shown above the input. */
|
|
169
|
+
label: string;
|
|
170
|
+
/** HTML input type. */
|
|
171
|
+
type?: 'email' | 'text' | 'tel' | 'url' | 'number' | 'textarea' | 'checkbox' | 'select';
|
|
172
|
+
required?: boolean;
|
|
173
|
+
placeholder?: string;
|
|
174
|
+
/** Options for `select` / `checkbox` group fields. */
|
|
175
|
+
options?: string[];
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Per-field opt-ins for SDK-side identity pre-fill.
|
|
179
|
+
*/
|
|
180
|
+
interface LeadFormPrefill {
|
|
181
|
+
email?: boolean;
|
|
182
|
+
phone?: boolean;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Lead-form envelope attached to an {@link Ad} when the campaign uses the
|
|
186
|
+
* `lead_form` renderer. Present on the ad response only when the campaign
|
|
187
|
+
* is configured as a lead-form ad unit.
|
|
188
|
+
*/
|
|
189
|
+
interface LeadFormConfig {
|
|
190
|
+
/** Ordered list of form fields to render. */
|
|
191
|
+
fields: LeadFormField[];
|
|
192
|
+
/** Form headline. Falls back to {@link Ad.title}. */
|
|
193
|
+
headline?: string;
|
|
194
|
+
/** Short form sub-headline. Falls back to {@link Ad.adText}. */
|
|
195
|
+
description?: string;
|
|
196
|
+
/** Submit button label. Falls back to {@link Ad.cta}. */
|
|
197
|
+
cta_text?: string;
|
|
198
|
+
/** Message shown after a successful submission. */
|
|
199
|
+
success_message?: string;
|
|
200
|
+
/** Fine-print privacy text rendered beneath the form. */
|
|
201
|
+
privacy_text?: string;
|
|
202
|
+
/** If set, a required consent checkbox is rendered with this label. */
|
|
203
|
+
consent_text?: string;
|
|
204
|
+
/** Optional URL to redirect the user to after a successful submission. */
|
|
205
|
+
success_redirect_url?: string;
|
|
206
|
+
/**
|
|
207
|
+
* How the SDK should present the form. SDK default is
|
|
208
|
+
* `modal-bottom-right` — the trigger remains in the publisher's slot and
|
|
209
|
+
* the form opens as a floating card pinned to the bottom-right.
|
|
210
|
+
* `inline` — full form rendered in-place inside the publisher slot.
|
|
211
|
+
* `modal-center` — full-screen overlay, form centered.
|
|
212
|
+
* `modal-bottom-right` — floating card pinned to the bottom-right.
|
|
213
|
+
*/
|
|
214
|
+
display?: 'inline' | 'modal-center' | 'modal-bottom-right';
|
|
215
|
+
/** Per-field SDK identity pre-fill opt-ins. Optional. */
|
|
216
|
+
prefill?: LeadFormPrefill;
|
|
217
|
+
/** Endpoint the SDK POSTs the filled form to. */
|
|
218
|
+
submit_url: string;
|
|
219
|
+
}
|
|
220
|
+
/** A field on the ad payload that a renderer-spec node can bind to. */
|
|
221
|
+
type RendererSpecAdField = 'adText' | 'title' | 'cta' | 'brandName' | 'url' | 'favicon';
|
|
222
|
+
type RendererSpecNodeType = 'box' | 'text' | 'image' | 'link';
|
|
223
|
+
/**
|
|
224
|
+
* A single node in a server-delivered renderer spec. Pure data — nodes map
|
|
225
|
+
* to a fixed whitelist of HTML tags; SpecRenderer-capable SDKs
|
|
226
|
+
* (e.g. @gravity-ai/ui) interpret the tree into DOM.
|
|
227
|
+
*/
|
|
228
|
+
interface RendererSpecNode {
|
|
229
|
+
type: RendererSpecNodeType;
|
|
230
|
+
/** Inline CSS. Values may reference theme tokens, e.g. "hsl(var(--primary))". */
|
|
231
|
+
style?: Record<string, string | number | boolean>;
|
|
232
|
+
/** Child nodes (box/link). */
|
|
233
|
+
children?: RendererSpecNode[];
|
|
234
|
+
/** Bind this node's content to an ad field (text content / image src / link href). */
|
|
235
|
+
bind?: RendererSpecAdField;
|
|
236
|
+
/** Static/template text for `text` nodes. Supports `{field}` placeholders. */
|
|
237
|
+
text?: string;
|
|
238
|
+
/** Static image src for `image` nodes (overridden by `bind`). */
|
|
239
|
+
src?: string;
|
|
240
|
+
/** Static href for `link` nodes (defaults to the ad's click/landing URL). */
|
|
241
|
+
href?: string;
|
|
242
|
+
/** Only render this node (and its subtree) when this ad field is non-empty. */
|
|
243
|
+
showIf?: RendererSpecAdField;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Server-delivered ad-unit layout — a declarative JSON tree the engine
|
|
247
|
+
* attaches per placement. Present only when the placement has a configured
|
|
248
|
+
* design and the request opted in; absent = the SDK uses its built-in look.
|
|
249
|
+
*/
|
|
250
|
+
interface RendererSpec {
|
|
251
|
+
/** Spec format version. Current: 1. */
|
|
252
|
+
version: 1;
|
|
253
|
+
/** Optional human label for the unit. */
|
|
254
|
+
name?: string;
|
|
255
|
+
/** Root node of the layout tree. */
|
|
256
|
+
root: RendererSpecNode;
|
|
257
|
+
}
|
|
147
258
|
interface Ad {
|
|
148
259
|
/** The advertisement copy text */
|
|
149
260
|
adText: string;
|
|
@@ -173,6 +284,20 @@ interface Ad {
|
|
|
173
284
|
composition_mode?: string;
|
|
174
285
|
/** Full composition envelope for SDK rendering */
|
|
175
286
|
composition?: Record<string, unknown>;
|
|
287
|
+
/**
|
|
288
|
+
* Server-delivered ad-unit layout painted by a SpecRenderer-capable SDK
|
|
289
|
+
* (e.g. @gravity-ai/ui). May arrive as the object or a JSON string.
|
|
290
|
+
*/
|
|
291
|
+
renderer_spec?: RendererSpec | string;
|
|
292
|
+
/** Campaign identifier. Present on every ad response from the engine. */
|
|
293
|
+
campaignId?: string;
|
|
294
|
+
/**
|
|
295
|
+
* Lead-form envelope. Present only when the served campaign is configured
|
|
296
|
+
* as a `lead_form` ad unit. When set, render the configured form using the
|
|
297
|
+
* {@link LeadFormConfig} fields and POST the filled values to
|
|
298
|
+
* `leadForm.submit_url`.
|
|
299
|
+
*/
|
|
300
|
+
leadForm?: LeadFormConfig;
|
|
176
301
|
}
|
|
177
302
|
/**
|
|
178
303
|
* Error response structure from the Gravity API
|
|
@@ -206,6 +331,17 @@ interface GravityContextOverrides {
|
|
|
206
331
|
} & Record<string, unknown>;
|
|
207
332
|
/** Device field overrides (timezone, locale, etc.) */
|
|
208
333
|
device?: Record<string, unknown>;
|
|
334
|
+
/**
|
|
335
|
+
* Explicit consent signal. When omitted in a browser, the SDK reads the
|
|
336
|
+
* page's IAB CMP APIs (`__tcfapi` / `__uspapi`) and attaches the settled
|
|
337
|
+
* decision automatically. Pass this to override, or in server-side
|
|
338
|
+
* runtimes where no CMP is readable.
|
|
339
|
+
*/
|
|
340
|
+
consent?: {
|
|
341
|
+
gdprApplies?: boolean;
|
|
342
|
+
tcfString?: string;
|
|
343
|
+
usPrivacy?: string;
|
|
344
|
+
};
|
|
209
345
|
}
|
|
210
346
|
/** The context object returned by `gravityContext()` and sent in the request body. */
|
|
211
347
|
interface GravityContext {
|
|
@@ -214,6 +350,16 @@ interface GravityContext {
|
|
|
214
350
|
id: string;
|
|
215
351
|
} & Record<string, unknown>;
|
|
216
352
|
device: Record<string, unknown>;
|
|
353
|
+
/**
|
|
354
|
+
* End-user privacy/consent signal. Auto-detected from the page's CMP
|
|
355
|
+
* (`window.__tcfapi` / `window.__uspapi`) in browsers; callers can
|
|
356
|
+
* override via `GravityContextOverrides.consent`.
|
|
357
|
+
*/
|
|
358
|
+
consent?: {
|
|
359
|
+
gdprApplies?: boolean;
|
|
360
|
+
tcfString?: string;
|
|
361
|
+
usPrivacy?: string;
|
|
362
|
+
};
|
|
217
363
|
}
|
|
218
364
|
/** Options for `gravityAds()`. */
|
|
219
365
|
interface GravityAdsOptions {
|
|
@@ -232,6 +378,15 @@ interface GravityAdsOptions {
|
|
|
232
378
|
production?: boolean;
|
|
233
379
|
/** Topics to exclude from ad matching. */
|
|
234
380
|
excludedTopics?: string[];
|
|
381
|
+
/**
|
|
382
|
+
* Whether the ads will be painted by a spec-capable renderer (e.g. the
|
|
383
|
+
* `@gravity-ai/react` / `@gravity-ai/ui` SpecRenderer). Defaults to `true`.
|
|
384
|
+
* Pass `false` if you render ad fields with your own markup so the server
|
|
385
|
+
* never serves (or attributes) a `renderer_spec` layout you won't display.
|
|
386
|
+
*/
|
|
387
|
+
supportsSpec?: boolean;
|
|
388
|
+
/** Spec capability profile sent when `supportsSpec` is on. Default: `"web1"`. */
|
|
389
|
+
specCapabilities?: string;
|
|
235
390
|
}
|
|
236
391
|
/** Result returned by `gravityAds()`. Never throws. */
|
|
237
392
|
interface GravityAdsResult {
|
|
@@ -265,4 +420,4 @@ interface IncomingAdRequest {
|
|
|
265
420
|
ip?: string;
|
|
266
421
|
}
|
|
267
422
|
|
|
268
|
-
export type { AdParams as A, DeviceObject as D, GravityAdsOptions as G, IncomingAdRequest as I, MessageObject as M, PlacementObject as P, Role as R, UserObject as U, GravityAdsResult as a, GravityContextOverrides as b, GravityContext as c, Ad as d,
|
|
423
|
+
export type { AdParams as A, DeviceObject as D, GravityAdsOptions as G, IncomingAdRequest as I, LeadFormField as L, MessageObject as M, PlacementObject as P, Role as R, UserObject as U, GravityAdsResult as a, GravityContextOverrides as b, GravityContext as c, Ad as d, LeadFormPrefill as e, LeadFormConfig as f, ApiErrorResponse as g, Placement as h, Gender as i };
|
|
@@ -12,7 +12,7 @@ type Gender = 'male' | 'female' | 'other';
|
|
|
12
12
|
* Placement positions for ad rendering
|
|
13
13
|
* @description Specifies where ads should appear relative to the AI response
|
|
14
14
|
*/
|
|
15
|
-
type Placement = 'above_response' | 'below_response' | 'inline_response' | 'left_response' | 'right_response';
|
|
15
|
+
type Placement = 'above_response' | 'below_response' | 'inline_response' | 'left_response' | 'right_response' | 'search_result' | 'center_page' | 'top_page' | 'bottom_page' | 'left_page' | 'right_page';
|
|
16
16
|
/**
|
|
17
17
|
* Individual ad placement specification
|
|
18
18
|
* @description Defines a single ad slot with its position and optional tracking ID
|
|
@@ -29,6 +29,12 @@ interface PlacementObject {
|
|
|
29
29
|
placement: Placement;
|
|
30
30
|
/** Tracking ID for this specific ad slot (required) */
|
|
31
31
|
placement_id: string;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum character length for generated ad text in this slot.
|
|
34
|
+
* Overrides the placement-level display config baseline set in the dashboard.
|
|
35
|
+
* Minimum 50, maximum 5000.
|
|
36
|
+
*/
|
|
37
|
+
max_ad_text_chars?: number;
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* Represents a single message in a conversation
|
|
@@ -122,6 +128,14 @@ interface AdParams {
|
|
|
122
128
|
relevancy?: number | null;
|
|
123
129
|
/** Returns a test ad when true (no billing, for integration testing) */
|
|
124
130
|
testAd?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether the ads will be painted by a spec-capable renderer. Defaults to
|
|
133
|
+
* `true`; pass `false` if you render ad fields with your own markup so the
|
|
134
|
+
* server never serves a `renderer_spec` layout you won't display.
|
|
135
|
+
*/
|
|
136
|
+
supportsSpec?: boolean;
|
|
137
|
+
/** Spec capability profile. Default: `"web1"`. */
|
|
138
|
+
specCapabilities?: string;
|
|
125
139
|
/**
|
|
126
140
|
* Additional custom fields for publisher-specific targeting
|
|
127
141
|
* @description Any additional key-value pairs will be passed to the API
|
|
@@ -144,6 +158,103 @@ interface AdParams {
|
|
|
144
158
|
* };
|
|
145
159
|
* ```
|
|
146
160
|
*/
|
|
161
|
+
/**
|
|
162
|
+
* A single field in a lead-form ad unit.
|
|
163
|
+
* Mirrors the engine's `LeadFormField` Pydantic model.
|
|
164
|
+
*/
|
|
165
|
+
interface LeadFormField {
|
|
166
|
+
/** Field key (submitted as-is to /api/v1/lead). */
|
|
167
|
+
name: string;
|
|
168
|
+
/** Human-readable label shown above the input. */
|
|
169
|
+
label: string;
|
|
170
|
+
/** HTML input type. */
|
|
171
|
+
type?: 'email' | 'text' | 'tel' | 'url' | 'number' | 'textarea' | 'checkbox' | 'select';
|
|
172
|
+
required?: boolean;
|
|
173
|
+
placeholder?: string;
|
|
174
|
+
/** Options for `select` / `checkbox` group fields. */
|
|
175
|
+
options?: string[];
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Per-field opt-ins for SDK-side identity pre-fill.
|
|
179
|
+
*/
|
|
180
|
+
interface LeadFormPrefill {
|
|
181
|
+
email?: boolean;
|
|
182
|
+
phone?: boolean;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Lead-form envelope attached to an {@link Ad} when the campaign uses the
|
|
186
|
+
* `lead_form` renderer. Present on the ad response only when the campaign
|
|
187
|
+
* is configured as a lead-form ad unit.
|
|
188
|
+
*/
|
|
189
|
+
interface LeadFormConfig {
|
|
190
|
+
/** Ordered list of form fields to render. */
|
|
191
|
+
fields: LeadFormField[];
|
|
192
|
+
/** Form headline. Falls back to {@link Ad.title}. */
|
|
193
|
+
headline?: string;
|
|
194
|
+
/** Short form sub-headline. Falls back to {@link Ad.adText}. */
|
|
195
|
+
description?: string;
|
|
196
|
+
/** Submit button label. Falls back to {@link Ad.cta}. */
|
|
197
|
+
cta_text?: string;
|
|
198
|
+
/** Message shown after a successful submission. */
|
|
199
|
+
success_message?: string;
|
|
200
|
+
/** Fine-print privacy text rendered beneath the form. */
|
|
201
|
+
privacy_text?: string;
|
|
202
|
+
/** If set, a required consent checkbox is rendered with this label. */
|
|
203
|
+
consent_text?: string;
|
|
204
|
+
/** Optional URL to redirect the user to after a successful submission. */
|
|
205
|
+
success_redirect_url?: string;
|
|
206
|
+
/**
|
|
207
|
+
* How the SDK should present the form. SDK default is
|
|
208
|
+
* `modal-bottom-right` — the trigger remains in the publisher's slot and
|
|
209
|
+
* the form opens as a floating card pinned to the bottom-right.
|
|
210
|
+
* `inline` — full form rendered in-place inside the publisher slot.
|
|
211
|
+
* `modal-center` — full-screen overlay, form centered.
|
|
212
|
+
* `modal-bottom-right` — floating card pinned to the bottom-right.
|
|
213
|
+
*/
|
|
214
|
+
display?: 'inline' | 'modal-center' | 'modal-bottom-right';
|
|
215
|
+
/** Per-field SDK identity pre-fill opt-ins. Optional. */
|
|
216
|
+
prefill?: LeadFormPrefill;
|
|
217
|
+
/** Endpoint the SDK POSTs the filled form to. */
|
|
218
|
+
submit_url: string;
|
|
219
|
+
}
|
|
220
|
+
/** A field on the ad payload that a renderer-spec node can bind to. */
|
|
221
|
+
type RendererSpecAdField = 'adText' | 'title' | 'cta' | 'brandName' | 'url' | 'favicon';
|
|
222
|
+
type RendererSpecNodeType = 'box' | 'text' | 'image' | 'link';
|
|
223
|
+
/**
|
|
224
|
+
* A single node in a server-delivered renderer spec. Pure data — nodes map
|
|
225
|
+
* to a fixed whitelist of HTML tags; SpecRenderer-capable SDKs
|
|
226
|
+
* (e.g. @gravity-ai/ui) interpret the tree into DOM.
|
|
227
|
+
*/
|
|
228
|
+
interface RendererSpecNode {
|
|
229
|
+
type: RendererSpecNodeType;
|
|
230
|
+
/** Inline CSS. Values may reference theme tokens, e.g. "hsl(var(--primary))". */
|
|
231
|
+
style?: Record<string, string | number | boolean>;
|
|
232
|
+
/** Child nodes (box/link). */
|
|
233
|
+
children?: RendererSpecNode[];
|
|
234
|
+
/** Bind this node's content to an ad field (text content / image src / link href). */
|
|
235
|
+
bind?: RendererSpecAdField;
|
|
236
|
+
/** Static/template text for `text` nodes. Supports `{field}` placeholders. */
|
|
237
|
+
text?: string;
|
|
238
|
+
/** Static image src for `image` nodes (overridden by `bind`). */
|
|
239
|
+
src?: string;
|
|
240
|
+
/** Static href for `link` nodes (defaults to the ad's click/landing URL). */
|
|
241
|
+
href?: string;
|
|
242
|
+
/** Only render this node (and its subtree) when this ad field is non-empty. */
|
|
243
|
+
showIf?: RendererSpecAdField;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Server-delivered ad-unit layout — a declarative JSON tree the engine
|
|
247
|
+
* attaches per placement. Present only when the placement has a configured
|
|
248
|
+
* design and the request opted in; absent = the SDK uses its built-in look.
|
|
249
|
+
*/
|
|
250
|
+
interface RendererSpec {
|
|
251
|
+
/** Spec format version. Current: 1. */
|
|
252
|
+
version: 1;
|
|
253
|
+
/** Optional human label for the unit. */
|
|
254
|
+
name?: string;
|
|
255
|
+
/** Root node of the layout tree. */
|
|
256
|
+
root: RendererSpecNode;
|
|
257
|
+
}
|
|
147
258
|
interface Ad {
|
|
148
259
|
/** The advertisement copy text */
|
|
149
260
|
adText: string;
|
|
@@ -173,6 +284,20 @@ interface Ad {
|
|
|
173
284
|
composition_mode?: string;
|
|
174
285
|
/** Full composition envelope for SDK rendering */
|
|
175
286
|
composition?: Record<string, unknown>;
|
|
287
|
+
/**
|
|
288
|
+
* Server-delivered ad-unit layout painted by a SpecRenderer-capable SDK
|
|
289
|
+
* (e.g. @gravity-ai/ui). May arrive as the object or a JSON string.
|
|
290
|
+
*/
|
|
291
|
+
renderer_spec?: RendererSpec | string;
|
|
292
|
+
/** Campaign identifier. Present on every ad response from the engine. */
|
|
293
|
+
campaignId?: string;
|
|
294
|
+
/**
|
|
295
|
+
* Lead-form envelope. Present only when the served campaign is configured
|
|
296
|
+
* as a `lead_form` ad unit. When set, render the configured form using the
|
|
297
|
+
* {@link LeadFormConfig} fields and POST the filled values to
|
|
298
|
+
* `leadForm.submit_url`.
|
|
299
|
+
*/
|
|
300
|
+
leadForm?: LeadFormConfig;
|
|
176
301
|
}
|
|
177
302
|
/**
|
|
178
303
|
* Error response structure from the Gravity API
|
|
@@ -206,6 +331,17 @@ interface GravityContextOverrides {
|
|
|
206
331
|
} & Record<string, unknown>;
|
|
207
332
|
/** Device field overrides (timezone, locale, etc.) */
|
|
208
333
|
device?: Record<string, unknown>;
|
|
334
|
+
/**
|
|
335
|
+
* Explicit consent signal. When omitted in a browser, the SDK reads the
|
|
336
|
+
* page's IAB CMP APIs (`__tcfapi` / `__uspapi`) and attaches the settled
|
|
337
|
+
* decision automatically. Pass this to override, or in server-side
|
|
338
|
+
* runtimes where no CMP is readable.
|
|
339
|
+
*/
|
|
340
|
+
consent?: {
|
|
341
|
+
gdprApplies?: boolean;
|
|
342
|
+
tcfString?: string;
|
|
343
|
+
usPrivacy?: string;
|
|
344
|
+
};
|
|
209
345
|
}
|
|
210
346
|
/** The context object returned by `gravityContext()` and sent in the request body. */
|
|
211
347
|
interface GravityContext {
|
|
@@ -214,6 +350,16 @@ interface GravityContext {
|
|
|
214
350
|
id: string;
|
|
215
351
|
} & Record<string, unknown>;
|
|
216
352
|
device: Record<string, unknown>;
|
|
353
|
+
/**
|
|
354
|
+
* End-user privacy/consent signal. Auto-detected from the page's CMP
|
|
355
|
+
* (`window.__tcfapi` / `window.__uspapi`) in browsers; callers can
|
|
356
|
+
* override via `GravityContextOverrides.consent`.
|
|
357
|
+
*/
|
|
358
|
+
consent?: {
|
|
359
|
+
gdprApplies?: boolean;
|
|
360
|
+
tcfString?: string;
|
|
361
|
+
usPrivacy?: string;
|
|
362
|
+
};
|
|
217
363
|
}
|
|
218
364
|
/** Options for `gravityAds()`. */
|
|
219
365
|
interface GravityAdsOptions {
|
|
@@ -232,6 +378,15 @@ interface GravityAdsOptions {
|
|
|
232
378
|
production?: boolean;
|
|
233
379
|
/** Topics to exclude from ad matching. */
|
|
234
380
|
excludedTopics?: string[];
|
|
381
|
+
/**
|
|
382
|
+
* Whether the ads will be painted by a spec-capable renderer (e.g. the
|
|
383
|
+
* `@gravity-ai/react` / `@gravity-ai/ui` SpecRenderer). Defaults to `true`.
|
|
384
|
+
* Pass `false` if you render ad fields with your own markup so the server
|
|
385
|
+
* never serves (or attributes) a `renderer_spec` layout you won't display.
|
|
386
|
+
*/
|
|
387
|
+
supportsSpec?: boolean;
|
|
388
|
+
/** Spec capability profile sent when `supportsSpec` is on. Default: `"web1"`. */
|
|
389
|
+
specCapabilities?: string;
|
|
235
390
|
}
|
|
236
391
|
/** Result returned by `gravityAds()`. Never throws. */
|
|
237
392
|
interface GravityAdsResult {
|
|
@@ -265,4 +420,4 @@ interface IncomingAdRequest {
|
|
|
265
420
|
ip?: string;
|
|
266
421
|
}
|
|
267
422
|
|
|
268
|
-
export type { AdParams as A, DeviceObject as D, GravityAdsOptions as G, IncomingAdRequest as I, MessageObject as M, PlacementObject as P, Role as R, UserObject as U, GravityAdsResult as a, GravityContextOverrides as b, GravityContext as c, Ad as d,
|
|
423
|
+
export type { AdParams as A, DeviceObject as D, GravityAdsOptions as G, IncomingAdRequest as I, LeadFormField as L, MessageObject as M, PlacementObject as P, Role as R, UserObject as U, GravityAdsResult as a, GravityContextOverrides as b, GravityContext as c, Ad as d, LeadFormPrefill as e, LeadFormConfig as f, ApiErrorResponse as g, Placement as h, Gender as i };
|