@gravity-ai/react 1.1.1 → 1.1.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/dist/index.d.mts CHANGED
@@ -4,29 +4,24 @@ import { CSSProperties, ReactNode } from 'react';
4
4
  /**
5
5
  * Ad response from the Gravity API
6
6
  * This mirrors the type from @gravity-ai/api for convenience
7
- * Includes optional v1 fields for backward compatibility
8
7
  */
9
8
  interface AdResponse {
10
9
  /** The advertisement copy text */
11
10
  adText: string;
12
- /** Impression tracking URL */
13
- impUrl?: string;
14
- /** Click-through tracking URL */
15
- clickUrl?: string;
16
- /** Payout amount in USD */
17
- payout?: number;
18
- /** Unique ad identifier (v1) */
19
- adId?: string;
20
- /** Ad title (v1) */
11
+ /** Ad title */
21
12
  title?: string;
22
- /** Brand/advertiser name (v1) */
13
+ /** Call-to-action text (e.g., 'Learn More', 'Shop Now') */
14
+ cta?: string;
15
+ /** Brand/advertiser name */
23
16
  brandName?: string;
24
- /** Brand logo image URL (v1) */
25
- brandImage?: string;
26
- /** Landing page URL (v1) */
17
+ /** Landing page URL */
27
18
  url?: string;
28
- /** Favicon URL (v1) */
19
+ /** Favicon URL */
29
20
  favicon?: string;
21
+ /** Impression tracking URL - fire this when ad is displayed */
22
+ impUrl?: string;
23
+ /** Click-through tracking URL - use this as href for ad clicks */
24
+ clickUrl?: string;
30
25
  }
31
26
  /**
32
27
  * Visual theme presets for the ad banner
@@ -116,7 +111,7 @@ interface AdTextProps {
116
111
  * const [ad, setAd] = useState(null);
117
112
  *
118
113
  * useEffect(() => {
119
- * client.contextualAd({ messages }).then(res => setAd(res?.ads[0] || null));
114
+ * client.getAd({ messages, sessionId, placements }).then(res => setAd(res?.[0] || null));
120
115
  * }, [messages]);
121
116
  *
122
117
  * return (
package/dist/index.d.ts CHANGED
@@ -4,29 +4,24 @@ import { CSSProperties, ReactNode } from 'react';
4
4
  /**
5
5
  * Ad response from the Gravity API
6
6
  * This mirrors the type from @gravity-ai/api for convenience
7
- * Includes optional v1 fields for backward compatibility
8
7
  */
9
8
  interface AdResponse {
10
9
  /** The advertisement copy text */
11
10
  adText: string;
12
- /** Impression tracking URL */
13
- impUrl?: string;
14
- /** Click-through tracking URL */
15
- clickUrl?: string;
16
- /** Payout amount in USD */
17
- payout?: number;
18
- /** Unique ad identifier (v1) */
19
- adId?: string;
20
- /** Ad title (v1) */
11
+ /** Ad title */
21
12
  title?: string;
22
- /** Brand/advertiser name (v1) */
13
+ /** Call-to-action text (e.g., 'Learn More', 'Shop Now') */
14
+ cta?: string;
15
+ /** Brand/advertiser name */
23
16
  brandName?: string;
24
- /** Brand logo image URL (v1) */
25
- brandImage?: string;
26
- /** Landing page URL (v1) */
17
+ /** Landing page URL */
27
18
  url?: string;
28
- /** Favicon URL (v1) */
19
+ /** Favicon URL */
29
20
  favicon?: string;
21
+ /** Impression tracking URL - fire this when ad is displayed */
22
+ impUrl?: string;
23
+ /** Click-through tracking URL - use this as href for ad clicks */
24
+ clickUrl?: string;
30
25
  }
31
26
  /**
32
27
  * Visual theme presets for the ad banner
@@ -116,7 +111,7 @@ interface AdTextProps {
116
111
  * const [ad, setAd] = useState(null);
117
112
  *
118
113
  * useEffect(() => {
119
- * client.contextualAd({ messages }).then(res => setAd(res?.ads[0] || null));
114
+ * client.getAd({ messages, sessionId, placements }).then(res => setAd(res?.[0] || null));
120
115
  * }, [messages]);
121
116
  *
122
117
  * return (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ai/react",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "React components for rendering Gravity AI advertisements",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",