@affiliateo/web 1.6.0 → 1.6.1

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/dist/provider.js +14 -11
  2. package/package.json +1 -1
package/dist/provider.js CHANGED
@@ -85,17 +85,20 @@ export function AffiliateoProvider({ campaignId, apiUrl, children, }) {
85
85
  screen_width: window.innerWidth,
86
86
  };
87
87
  const data = JSON.stringify(payload);
88
- if (navigator.sendBeacon) {
89
- navigator.sendBeacon(`${apiBase}/api/v1/web/event`, new Blob([data], { type: 'application/json' }));
90
- }
91
- else {
92
- fetch(`${apiBase}/api/v1/web/event`, {
93
- method: 'POST',
94
- headers: { 'Content-Type': 'application/json' },
95
- body: data,
96
- keepalive: true,
97
- }).catch(() => { });
98
- }
88
+ // Always use fetch so we can see responses in DevTools Network tab
89
+ fetch(`${apiBase}/api/v1/web/event`, {
90
+ method: 'POST',
91
+ headers: { 'Content-Type': 'application/json' },
92
+ body: data,
93
+ keepalive: true,
94
+ }).then(async (r) => {
95
+ if (!r.ok) {
96
+ const text = await r.text().catch(() => '');
97
+ console.error(`[Affiliateo] Event failed (${r.status}):`, text);
98
+ }
99
+ }).catch((err) => {
100
+ console.error('[Affiliateo] Event send error:', err);
101
+ });
99
102
  }
100
103
  // Send pageview on mount (first load or page navigation)
101
104
  if (!sentRef.current) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@affiliateo/web",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Affiliateo web SDK — affiliate attribution and session tracking for web apps",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",