@cross-deck/web 1.10.3 → 1.11.2

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,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "generatedAt": "2026-07-22T12:36:32.783Z",
3
+ "generatedAt": "2026-07-23T09:07:15.132Z",
4
4
  "sdk": "@cross-deck/web",
5
5
  "codes": [
6
6
  {
package/dist/index.cjs CHANGED
@@ -104,7 +104,7 @@ function typeMapForStatus(status) {
104
104
  }
105
105
 
106
106
  // src/_version.ts
107
- var SDK_VERSION = "1.10.3";
107
+ var SDK_VERSION = "1.11.2";
108
108
  var SDK_NAME = "@cross-deck/web";
109
109
 
110
110
  // src/http.ts
@@ -1332,6 +1332,7 @@ var CookieStorage = class {
1332
1332
  this.maxAgeSec = options?.maxAgeSec ?? 63072e3;
1333
1333
  this.secure = options?.secure ?? defaultSecure();
1334
1334
  this.sameSite = options?.sameSite ?? "Lax";
1335
+ this.domain = options?.domain || void 0;
1335
1336
  }
1336
1337
  getItem(key) {
1337
1338
  if (!hasDocument()) return null;
@@ -1358,6 +1359,7 @@ var CookieStorage = class {
1358
1359
  `Max-Age=${this.maxAgeSec}`,
1359
1360
  `SameSite=${this.sameSite}`
1360
1361
  ];
1362
+ if (this.domain) parts.push(`Domain=${this.domain}`);
1361
1363
  if (this.secure) parts.push("Secure");
1362
1364
  try {
1363
1365
  doc.cookie = parts.join("; ");
@@ -1373,6 +1375,7 @@ var CookieStorage = class {
1373
1375
  "Max-Age=0",
1374
1376
  `SameSite=${this.sameSite}`
1375
1377
  ];
1378
+ if (this.domain) parts.push(`Domain=${this.domain}`);
1376
1379
  if (this.secure) parts.push("Secure");
1377
1380
  try {
1378
1381
  doc.cookie = parts.join("; ");
@@ -1380,6 +1383,34 @@ var CookieStorage = class {
1380
1383
  }
1381
1384
  }
1382
1385
  };
1386
+ function resolveCookieDomain(config) {
1387
+ if (config === void 0 || config === "none" || config === "") return void 0;
1388
+ if (config !== "auto") {
1389
+ const d = config.trim().toLowerCase();
1390
+ return d.startsWith(".") ? d : `.${d}`;
1391
+ }
1392
+ if (!hasDocument()) return void 0;
1393
+ const doc = globalThis.document;
1394
+ const loc = globalThis.location;
1395
+ const host = (loc?.hostname ?? "").toLowerCase();
1396
+ if (!host || host === "localhost" || /^\d{1,3}(\.\d{1,3}){3}$/.test(host) || host.indexOf(".") === -1) {
1397
+ return void 0;
1398
+ }
1399
+ const labels = host.split(".");
1400
+ for (let i = labels.length - 2; i >= 0; i--) {
1401
+ const candidate = "." + labels.slice(i).join(".");
1402
+ const testKey = "__cd_domain_probe";
1403
+ try {
1404
+ doc.cookie = `${testKey}=1; Domain=${candidate}; Path=/; SameSite=Lax`;
1405
+ const accepted = doc.cookie.indexOf(`${testKey}=1`) !== -1;
1406
+ doc.cookie = `${testKey}=; Domain=${candidate}; Path=/; Max-Age=0; SameSite=Lax`;
1407
+ if (accepted) return candidate;
1408
+ } catch {
1409
+ return void 0;
1410
+ }
1411
+ }
1412
+ return void 0;
1413
+ }
1383
1414
  function detectDefaultStorage() {
1384
1415
  try {
1385
1416
  const ls = globalThis.localStorage;
@@ -2712,7 +2743,7 @@ var BreadcrumbBuffer = class {
2712
2743
 
2713
2744
  // src/_diagnostic-telemetry.ts
2714
2745
  var DIAGNOSTIC_TELEMETRY_ENDPOINT = "https://api.cross-deck.com/v1/events";
2715
- var DIAGNOSTIC_TELEMETRY_PUBLISHABLE_KEY = "cd_pub_live_9490e7aa029c432abf";
2746
+ var DIAGNOSTIC_TELEMETRY_PUBLISHABLE_KEY = "cd_pub_live_eea2f84dbb834a45b7";
2716
2747
  function isDiagnosticTelemetryEnabled() {
2717
2748
  return !DIAGNOSTIC_TELEMETRY_PUBLISHABLE_KEY.startsWith(
2718
2749
  "cd_pub_RELIABILITY_PLACEHOLDER"
@@ -4659,7 +4690,7 @@ var CrossdeckClient = class {
4659
4690
  const effectiveStorage = persistIdentity ? storage : new MemoryStorage();
4660
4691
  const useCookieRedundancy = persistIdentity && !options.storage && // honour caller's adapter choice
4661
4692
  typeof globalThis.document !== "undefined";
4662
- const cookieStore = useCookieRedundancy ? new CookieStorage() : void 0;
4693
+ const cookieStore = useCookieRedundancy ? new CookieStorage({ domain: resolveCookieDomain(options.cookieDomain ?? "auto") }) : void 0;
4663
4694
  const identity = new IdentityStore(effectiveStorage, opts.storagePrefix, cookieStore);
4664
4695
  const entitlements = new EntitlementCache(
4665
4696
  effectiveStorage,
@@ -5609,7 +5640,7 @@ var CrossdeckClient = class {
5609
5640
  }
5610
5641
  }
5611
5642
  this.state.autoTracker?.uninstall();
5612
- this.state.identity.reset();
5643
+ if (this.state.developerUserId) this.state.identity.reset();
5613
5644
  bridgeReadCost({ actor: void 0 });
5614
5645
  this.state.entitlements.clearAll();
5615
5646
  this.state.events.reset();