cryptique-sdk 1.2.4 → 1.2.5

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/lib/cjs/index.js CHANGED
@@ -5339,57 +5339,16 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
5339
5339
  },
5340
5340
 
5341
5341
  /**
5342
- * NetworkTracker - Tracks network errors (fetch and XMLHttpRequest)
5342
+ * NetworkTracker - Tracks network errors (XHR only)
5343
+ *
5344
+ * NOTE:
5345
+ * We intentionally do NOT wrap window.fetch here, to avoid confusing
5346
+ * browser DevTools attribution for third‑party requests. All SDK
5347
+ * fetch-based calls to backend.cryptique.io are already error-handled
5348
+ * inside APIClient.send(), so fetch wrapping is redundant.
5343
5349
  */
5344
5350
  startNetworkTracking() {
5345
5351
  try {
5346
- // Track fetch errors - only intercept calls to our own backend
5347
- // Use _nativeFetch as the base so the wrapper always delegates to the
5348
- // true browser fetch, regardless of what other libraries have patched.
5349
- window.fetch = function(...args) {
5350
- const startTime = Date.now();
5351
- const url = typeof args[0] === 'string' ? args[0] : (args[0]?.url || '');
5352
-
5353
- // Pass third-party requests through completely untouched — no interception,
5354
- // no involvement of our SDK in their call stack or error handling
5355
- if (!url.includes('backend.cryptique.io')) {
5356
- return _nativeFetch.apply(this, args);
5357
- }
5358
-
5359
- return _nativeFetch.apply(this, args).then(response => {
5360
- // Only track error status codes (4xx, 5xx)
5361
- if (response.status >= 400) {
5362
- const networkErrorData = {
5363
- type: 'api_error',
5364
- url: url,
5365
- method: 'GET',
5366
- status: response.status,
5367
- error: `HTTP ${response.status} Error`,
5368
- duration: Date.now() - startTime,
5369
- path: window.location.pathname
5370
- };
5371
-
5372
- InteractionManager.add('networkEvents', networkErrorData);
5373
- }
5374
-
5375
- return response;
5376
- }).catch(error => {
5377
- // Track actual network errors
5378
- const networkErrorData = {
5379
- type: 'api_error',
5380
- url: url,
5381
- method: 'GET',
5382
- status: 0,
5383
- error: error.message || 'Network Error',
5384
- duration: Date.now() - startTime,
5385
- path: window.location.pathname
5386
- };
5387
-
5388
- InteractionManager.add('networkEvents', networkErrorData);
5389
- throw error;
5390
- });
5391
- };
5392
-
5393
5352
  // Track XMLHttpRequest errors - only intercept calls to our own backend
5394
5353
  const originalXHROpen = XMLHttpRequest.prototype.open;
5395
5354
  const originalXHRSend = XMLHttpRequest.prototype.send;
package/lib/esm/index.js CHANGED
@@ -5337,57 +5337,16 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
5337
5337
  },
5338
5338
 
5339
5339
  /**
5340
- * NetworkTracker - Tracks network errors (fetch and XMLHttpRequest)
5340
+ * NetworkTracker - Tracks network errors (XHR only)
5341
+ *
5342
+ * NOTE:
5343
+ * We intentionally do NOT wrap window.fetch here, to avoid confusing
5344
+ * browser DevTools attribution for third‑party requests. All SDK
5345
+ * fetch-based calls to backend.cryptique.io are already error-handled
5346
+ * inside APIClient.send(), so fetch wrapping is redundant.
5341
5347
  */
5342
5348
  startNetworkTracking() {
5343
5349
  try {
5344
- // Track fetch errors - only intercept calls to our own backend
5345
- // Use _nativeFetch as the base so the wrapper always delegates to the
5346
- // true browser fetch, regardless of what other libraries have patched.
5347
- window.fetch = function(...args) {
5348
- const startTime = Date.now();
5349
- const url = typeof args[0] === 'string' ? args[0] : (args[0]?.url || '');
5350
-
5351
- // Pass third-party requests through completely untouched — no interception,
5352
- // no involvement of our SDK in their call stack or error handling
5353
- if (!url.includes('backend.cryptique.io')) {
5354
- return _nativeFetch.apply(this, args);
5355
- }
5356
-
5357
- return _nativeFetch.apply(this, args).then(response => {
5358
- // Only track error status codes (4xx, 5xx)
5359
- if (response.status >= 400) {
5360
- const networkErrorData = {
5361
- type: 'api_error',
5362
- url: url,
5363
- method: 'GET',
5364
- status: response.status,
5365
- error: `HTTP ${response.status} Error`,
5366
- duration: Date.now() - startTime,
5367
- path: window.location.pathname
5368
- };
5369
-
5370
- InteractionManager.add('networkEvents', networkErrorData);
5371
- }
5372
-
5373
- return response;
5374
- }).catch(error => {
5375
- // Track actual network errors
5376
- const networkErrorData = {
5377
- type: 'api_error',
5378
- url: url,
5379
- method: 'GET',
5380
- status: 0,
5381
- error: error.message || 'Network Error',
5382
- duration: Date.now() - startTime,
5383
- path: window.location.pathname
5384
- };
5385
-
5386
- InteractionManager.add('networkEvents', networkErrorData);
5387
- throw error;
5388
- });
5389
- };
5390
-
5391
5350
  // Track XMLHttpRequest errors - only intercept calls to our own backend
5392
5351
  const originalXHROpen = XMLHttpRequest.prototype.open;
5393
5352
  const originalXHRSend = XMLHttpRequest.prototype.send;
package/lib/umd/index.js CHANGED
@@ -5343,57 +5343,16 @@
5343
5343
  },
5344
5344
 
5345
5345
  /**
5346
- * NetworkTracker - Tracks network errors (fetch and XMLHttpRequest)
5346
+ * NetworkTracker - Tracks network errors (XHR only)
5347
+ *
5348
+ * NOTE:
5349
+ * We intentionally do NOT wrap window.fetch here, to avoid confusing
5350
+ * browser DevTools attribution for third‑party requests. All SDK
5351
+ * fetch-based calls to backend.cryptique.io are already error-handled
5352
+ * inside APIClient.send(), so fetch wrapping is redundant.
5347
5353
  */
5348
5354
  startNetworkTracking() {
5349
5355
  try {
5350
- // Track fetch errors - only intercept calls to our own backend
5351
- // Use _nativeFetch as the base so the wrapper always delegates to the
5352
- // true browser fetch, regardless of what other libraries have patched.
5353
- window.fetch = function(...args) {
5354
- const startTime = Date.now();
5355
- const url = typeof args[0] === 'string' ? args[0] : (args[0]?.url || '');
5356
-
5357
- // Pass third-party requests through completely untouched — no interception,
5358
- // no involvement of our SDK in their call stack or error handling
5359
- if (!url.includes('backend.cryptique.io')) {
5360
- return _nativeFetch.apply(this, args);
5361
- }
5362
-
5363
- return _nativeFetch.apply(this, args).then(response => {
5364
- // Only track error status codes (4xx, 5xx)
5365
- if (response.status >= 400) {
5366
- const networkErrorData = {
5367
- type: 'api_error',
5368
- url: url,
5369
- method: 'GET',
5370
- status: response.status,
5371
- error: `HTTP ${response.status} Error`,
5372
- duration: Date.now() - startTime,
5373
- path: window.location.pathname
5374
- };
5375
-
5376
- InteractionManager.add('networkEvents', networkErrorData);
5377
- }
5378
-
5379
- return response;
5380
- }).catch(error => {
5381
- // Track actual network errors
5382
- const networkErrorData = {
5383
- type: 'api_error',
5384
- url: url,
5385
- method: 'GET',
5386
- status: 0,
5387
- error: error.message || 'Network Error',
5388
- duration: Date.now() - startTime,
5389
- path: window.location.pathname
5390
- };
5391
-
5392
- InteractionManager.add('networkEvents', networkErrorData);
5393
- throw error;
5394
- });
5395
- };
5396
-
5397
5356
  // Track XMLHttpRequest errors - only intercept calls to our own backend
5398
5357
  const originalXHROpen = XMLHttpRequest.prototype.open;
5399
5358
  const originalXHRSend = XMLHttpRequest.prototype.send;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cryptique-sdk",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "type": "module",
5
5
  "description": "Cryptique Analytics SDK - Comprehensive web analytics and user tracking for modern web applications",
6
6
  "main": "lib/cjs/index.js",