@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.
package/dist/react.cjs CHANGED
@@ -98,7 +98,7 @@ function typeMapForStatus(status) {
98
98
  }
99
99
 
100
100
  // src/_version.ts
101
- var SDK_VERSION = "1.10.3";
101
+ var SDK_VERSION = "1.11.2";
102
102
  var SDK_NAME = "@cross-deck/web";
103
103
 
104
104
  // src/http.ts
@@ -1326,6 +1326,7 @@ var CookieStorage = class {
1326
1326
  this.maxAgeSec = options?.maxAgeSec ?? 63072e3;
1327
1327
  this.secure = options?.secure ?? defaultSecure();
1328
1328
  this.sameSite = options?.sameSite ?? "Lax";
1329
+ this.domain = options?.domain || void 0;
1329
1330
  }
1330
1331
  getItem(key) {
1331
1332
  if (!hasDocument()) return null;
@@ -1352,6 +1353,7 @@ var CookieStorage = class {
1352
1353
  `Max-Age=${this.maxAgeSec}`,
1353
1354
  `SameSite=${this.sameSite}`
1354
1355
  ];
1356
+ if (this.domain) parts.push(`Domain=${this.domain}`);
1355
1357
  if (this.secure) parts.push("Secure");
1356
1358
  try {
1357
1359
  doc.cookie = parts.join("; ");
@@ -1367,6 +1369,7 @@ var CookieStorage = class {
1367
1369
  "Max-Age=0",
1368
1370
  `SameSite=${this.sameSite}`
1369
1371
  ];
1372
+ if (this.domain) parts.push(`Domain=${this.domain}`);
1370
1373
  if (this.secure) parts.push("Secure");
1371
1374
  try {
1372
1375
  doc.cookie = parts.join("; ");
@@ -1374,6 +1377,34 @@ var CookieStorage = class {
1374
1377
  }
1375
1378
  }
1376
1379
  };
1380
+ function resolveCookieDomain(config) {
1381
+ if (config === void 0 || config === "none" || config === "") return void 0;
1382
+ if (config !== "auto") {
1383
+ const d = config.trim().toLowerCase();
1384
+ return d.startsWith(".") ? d : `.${d}`;
1385
+ }
1386
+ if (!hasDocument()) return void 0;
1387
+ const doc = globalThis.document;
1388
+ const loc = globalThis.location;
1389
+ const host = (loc?.hostname ?? "").toLowerCase();
1390
+ if (!host || host === "localhost" || /^\d{1,3}(\.\d{1,3}){3}$/.test(host) || host.indexOf(".") === -1) {
1391
+ return void 0;
1392
+ }
1393
+ const labels = host.split(".");
1394
+ for (let i = labels.length - 2; i >= 0; i--) {
1395
+ const candidate = "." + labels.slice(i).join(".");
1396
+ const testKey = "__cd_domain_probe";
1397
+ try {
1398
+ doc.cookie = `${testKey}=1; Domain=${candidate}; Path=/; SameSite=Lax`;
1399
+ const accepted = doc.cookie.indexOf(`${testKey}=1`) !== -1;
1400
+ doc.cookie = `${testKey}=; Domain=${candidate}; Path=/; Max-Age=0; SameSite=Lax`;
1401
+ if (accepted) return candidate;
1402
+ } catch {
1403
+ return void 0;
1404
+ }
1405
+ }
1406
+ return void 0;
1407
+ }
1377
1408
  function detectDefaultStorage() {
1378
1409
  try {
1379
1410
  const ls = globalThis.localStorage;
@@ -2706,7 +2737,7 @@ var BreadcrumbBuffer = class {
2706
2737
 
2707
2738
  // src/_diagnostic-telemetry.ts
2708
2739
  var DIAGNOSTIC_TELEMETRY_ENDPOINT = "https://api.cross-deck.com/v1/events";
2709
- var DIAGNOSTIC_TELEMETRY_PUBLISHABLE_KEY = "cd_pub_live_9490e7aa029c432abf";
2740
+ var DIAGNOSTIC_TELEMETRY_PUBLISHABLE_KEY = "cd_pub_live_eea2f84dbb834a45b7";
2710
2741
  function isDiagnosticTelemetryEnabled() {
2711
2742
  return !DIAGNOSTIC_TELEMETRY_PUBLISHABLE_KEY.startsWith(
2712
2743
  "cd_pub_RELIABILITY_PLACEHOLDER"
@@ -4653,7 +4684,7 @@ var CrossdeckClient = class {
4653
4684
  const effectiveStorage = persistIdentity ? storage : new MemoryStorage();
4654
4685
  const useCookieRedundancy = persistIdentity && !options.storage && // honour caller's adapter choice
4655
4686
  typeof globalThis.document !== "undefined";
4656
- const cookieStore = useCookieRedundancy ? new CookieStorage() : void 0;
4687
+ const cookieStore = useCookieRedundancy ? new CookieStorage({ domain: resolveCookieDomain(options.cookieDomain ?? "auto") }) : void 0;
4657
4688
  const identity = new IdentityStore(effectiveStorage, opts.storagePrefix, cookieStore);
4658
4689
  const entitlements = new EntitlementCache(
4659
4690
  effectiveStorage,
@@ -5603,7 +5634,7 @@ var CrossdeckClient = class {
5603
5634
  }
5604
5635
  }
5605
5636
  this.state.autoTracker?.uninstall();
5606
- this.state.identity.reset();
5637
+ if (this.state.developerUserId) this.state.identity.reset();
5607
5638
  bridgeReadCost({ actor: void 0 });
5608
5639
  this.state.entitlements.clearAll();
5609
5640
  this.state.events.reset();