@datalyr/web 1.7.4 → 1.7.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @datalyr/web v1.7.4
2
+ * @datalyr/web v1.7.5
3
3
  * Datalyr Web SDK - Modern attribution tracking for web applications
4
4
  * (c) 2026 Datalyr Inc.
5
5
  * Released under the MIT License
@@ -2298,16 +2298,22 @@ class EventQueue {
2298
2298
  // so only request it when the body is safely under the cap; oversized batches go via
2299
2299
  // a normal fetch (no cap) and succeed.
2300
2300
  const useKeepalive = new Blob([body]).size <= 60000;
2301
+ // First-party endpoint (the customer's own tracking host, never *.datalyr.com — set
2302
+ // by the script-origin auto-derive): send the cookie cross-subdomain so the edge can
2303
+ // read/refresh the server-set, ITP-durable visitor_id. Legacy datalyr.com endpoints
2304
+ // stay credential-less — unchanged behavior for every existing install.
2305
+ let firstPartyEndpoint = false;
2301
2306
  try {
2302
- const response = yield fetch(currentEndpoint, {
2303
- method: 'POST',
2304
- headers: {
2307
+ firstPartyEndpoint = !/(^|\.)datalyr\.com$/i.test(new URL(currentEndpoint).hostname);
2308
+ }
2309
+ catch (_a) {
2310
+ /* malformed endpoint — leave false */
2311
+ }
2312
+ try {
2313
+ const response = yield fetch(currentEndpoint, Object.assign({ method: 'POST', headers: {
2305
2314
  'Content-Type': 'application/json',
2306
2315
  'X-Batch-Size': events.length.toString()
2307
- },
2308
- body,
2309
- keepalive: useKeepalive
2310
- });
2316
+ }, body, keepalive: useKeepalive }, (firstPartyEndpoint ? { credentials: 'include' } : {})));
2311
2317
  if (!response.ok) {
2312
2318
  // Handle rate limiting
2313
2319
  if (response.status === 429) {