@thead-vantage/react 2.1.3 → 2.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thead-vantage/react",
3
- "version": "2.1.3",
3
+ "version": "2.2.0",
4
4
  "description": "React components and utilities for TheAd Vantage ad platform integration",
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -43,6 +43,13 @@ export function AdBanner({
43
43
  userSegment,
44
44
  });
45
45
 
46
+ console.log('[AdBanner] Processed response:', {
47
+ success: response.success,
48
+ hasAd: !!response.ad,
49
+ devMode: response.dev_mode,
50
+ message: response.message,
51
+ });
52
+
46
53
  if (response.success && response.ad) {
47
54
  setAd(response.ad);
48
55
  setDevMode(response.dev_mode || false);
@@ -50,6 +57,12 @@ export function AdBanner({
50
57
  // Track impression (will be skipped in dev mode)
51
58
  trackImpression(response.ad.id);
52
59
  } else {
60
+ console.warn('[AdBanner] No ad available:', {
61
+ success: response.success,
62
+ hasAd: !!response.ad,
63
+ message: response.message,
64
+ _dev_note: response._dev_note,
65
+ });
53
66
  setError('No ads available');
54
67
  }
55
68
  } catch (err) {
package/src/lib/ads.ts CHANGED
@@ -137,6 +137,16 @@ export async function fetchAdBanner(params: FetchAdBannerParams): Promise<AdBann
137
137
 
138
138
  const data: AdsResponse = await response.json();
139
139
 
140
+ // Debug logging to see what we're getting from the API
141
+ console.log('[AdBanner] API Response:', {
142
+ success: data.success,
143
+ hasAd: !!data.ad,
144
+ hasAds: !!(data.ads && Array.isArray(data.ads)),
145
+ adsLength: Array.isArray(data.ads) ? data.ads.length : 0,
146
+ message: data.message,
147
+ dataKeys: Object.keys(data),
148
+ });
149
+
140
150
  // Type guard to check if an object is Ad type (for arrays that might contain either)
141
151
  const isAd = (obj: unknown): obj is Ad => {
142
152
  if (typeof obj !== 'object' || obj === null) return false;