@thead-vantage/react 2.13.0 → 2.14.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/package.json +1 -1
  2. package/src/lib/ads.ts +8 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thead-vantage/react",
3
- "version": "2.13.0",
3
+ "version": "2.14.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",
package/src/lib/ads.ts CHANGED
@@ -418,9 +418,11 @@ export async function trackImpression(adId: string): Promise<void> {
418
418
  console.log(`[DEV] Impression tracking skipped for ad: ${adId}`);
419
419
  }
420
420
  } catch (error) {
421
- // Handle CORS errors silently (tracking failures shouldn't break the app)
421
+ // Handle CORS errors gracefully (tracking failures shouldn't break the app)
422
422
  if (error instanceof TypeError && (error.message.includes('CORS') || error.message.includes('Failed to fetch'))) {
423
- console.warn(`[AdBanner] CORS error tracking impression for ad: ${adId}. The tracking endpoint needs CORS headers configured.`);
423
+ // This is expected until the server configures CORS for /api/ads/track endpoint
424
+ // The ad still displays correctly, tracking just won't work until server-side CORS is fixed
425
+ console.debug(`[AdBanner] Tracking impression failed (CORS): The /api/ads/track endpoint needs CORS headers configured on the server. Ad still displayed successfully.`);
424
426
  } else {
425
427
  console.error('Error tracking impression:', error);
426
428
  }
@@ -486,9 +488,11 @@ export async function trackClick(adId: string): Promise<void> {
486
488
  console.log(`[DEV] Click tracking skipped for ad: ${adId}`);
487
489
  }
488
490
  } catch (error) {
489
- // Handle CORS errors silently (tracking failures shouldn't break the app)
491
+ // Handle CORS errors gracefully (tracking failures shouldn't break the app)
490
492
  if (error instanceof TypeError && (error.message.includes('CORS') || error.message.includes('Failed to fetch'))) {
491
- console.warn(`[AdBanner] CORS error tracking click for ad: ${adId}. The tracking endpoint needs CORS headers configured.`);
493
+ // This is expected until the server configures CORS for /api/ads/track endpoint
494
+ // The ad still works correctly, click tracking just won't work until server-side CORS is fixed
495
+ console.debug(`[AdBanner] Tracking click failed (CORS): The /api/ads/track endpoint needs CORS headers configured on the server. Ad still works correctly.`);
492
496
  } else {
493
497
  console.error('Error tracking click:', error);
494
498
  }