@kush_hemant/react-api-monitor 1.0.24 → 1.0.26
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.js +20 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -142,11 +142,31 @@ function monitorAxios() {
|
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
// src/network/beaconMonitor.js
|
|
146
|
+
function monitorBeacon() {
|
|
147
|
+
const originalBeacon = navigator.sendBeacon;
|
|
148
|
+
navigator.sendBeacon = function(url, data) {
|
|
149
|
+
if (LOG_ENDPOINT2 && url.includes(LOG_ENDPOINT2)) {
|
|
150
|
+
return originalBeacon.call(this, url, data);
|
|
151
|
+
}
|
|
152
|
+
sendLog2({
|
|
153
|
+
type: "api_call",
|
|
154
|
+
transport: "beacon",
|
|
155
|
+
url,
|
|
156
|
+
method: "POST",
|
|
157
|
+
requestBody: data,
|
|
158
|
+
...getMetadata2()
|
|
159
|
+
});
|
|
160
|
+
return originalBeacon.call(this, url, data);
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
145
164
|
// src/network/auto.js
|
|
146
165
|
function startNetworkMonitoring() {
|
|
147
166
|
monitorFetch();
|
|
148
167
|
monitorXHR();
|
|
149
168
|
monitorAxios();
|
|
169
|
+
monitorBeacon();
|
|
150
170
|
}
|
|
151
171
|
|
|
152
172
|
// src/index.js
|