@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.
- package/dist/provider.js +14 -11
- 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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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) {
|