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