@gravity-ai/react 1.0.0 → 1.1.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 (2) hide show
  1. package/README.md +9 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -23,10 +23,15 @@ function ChatMessage({ messages }) {
23
23
  const [ad, setAd] = useState(null);
24
24
 
25
25
  useEffect(() => {
26
- client.contextualAd({
26
+ client.getAd({
27
27
  messages,
28
28
  sessionId: 'session-123',
29
+ numAds: 1,
30
+ ui: {
31
+ placements: [{ placement: 'below_response' }]
32
+ },
29
33
  userId: 'user-456',
34
+ testAd: true, // Use for testing (no impressions or clicks)
30
35
  }).then(res => setAd(res?.ads[0] || null));
31
36
  }, [messages]);
32
37
 
@@ -64,7 +69,7 @@ import { AdBanner } from '@gravity-ai/react';
64
69
 
65
70
  | Prop | Type | Default | Description |
66
71
  |------|------|---------|-------------|
67
- | `ad` | `AdResponse \| null` | required | A single ad object (e.g., `response.ads[0]`) |
72
+ | `ad` | `Ad \| null` | required | A single ad object (e.g., `response.ads[0]`) |
68
73
  | `theme` | `'light' \| 'dark' \| 'minimal' \| 'branded'` | `'light'` | Visual theme preset |
69
74
  | `size` | `'small' \| 'medium' \| 'large' \| 'responsive'` | `'medium'` | Size preset |
70
75
  | `className` | `string` | - | Custom class name for container |
@@ -100,7 +105,7 @@ import { AdText } from '@gravity-ai/react';
100
105
 
101
106
  | Prop | Type | Default | Description |
102
107
  |------|------|---------|-------------|
103
- | `ad` | `AdResponse \| null` | required | A single ad object (e.g., `response.ads[0]`) |
108
+ | `ad` | `Ad \| null` | required | A single ad object (e.g., `response.ads[0]`) |
104
109
  | `className` | `string` | - | Custom class name |
105
110
  | `style` | `CSSProperties` | - | Custom inline styles |
106
111
  | `fallback` | `ReactNode` | `null` | Content when ad is null |
@@ -161,7 +166,7 @@ function CustomAdComponent({ ad }) {
161
166
  Full TypeScript support with exported types:
162
167
 
163
168
  ```tsx
164
- import type { AdResponse, AdBannerProps, AdTheme, AdSize } from '@gravity-ai/react';
169
+ import type { Ad, AdBannerProps, AdTheme, AdSize } from '@gravity-ai/react';
165
170
  ```
166
171
 
167
172
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ai/react",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "React components for rendering Gravity AI advertisements",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",