@cross-deck/web 1.10.2 → 1.11.1

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-22T08:22:09.095Z",
3
+ "generatedAt": "2026-07-23T05:41:37.690Z",
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.2";
107
+ var SDK_VERSION = "1.11.1";
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;
@@ -3843,7 +3874,18 @@ function isInAppFrame(filename) {
3843
3874
  if (/\/crossdeck\.umd\.min\.js$/.test(filename)) return false;
3844
3875
  return true;
3845
3876
  }
3877
+ var BROWSER_INJECTED_GLOBAL = /(__firefox__|__gCrWeb|zaloJSV2)/;
3878
+ function injectedGlobalName(message) {
3879
+ const m = BROWSER_INJECTED_GLOBAL.exec(message ?? "");
3880
+ return m ? m[1] : null;
3881
+ }
3882
+ function demoteVendorInjectedFrames(frames, message) {
3883
+ if (!injectedGlobalName(message)) return frames;
3884
+ return frames.map((f) => f.in_app ? { ...f, in_app: false } : f);
3885
+ }
3846
3886
  function fingerprintError(message, frames, location2) {
3887
+ const injected = injectedGlobalName(message);
3888
+ if (injected) return djb2Hex(`injected-global:${injected}`);
3847
3889
  const inAppFrames = frames.filter((f) => f.in_app).slice(0, 3);
3848
3890
  const parts = [
3849
3891
  (message || "").slice(0, 200),
@@ -4200,7 +4242,7 @@ var ErrorTracker = class {
4200
4242
  const payload = coerceErrorPayload(err);
4201
4243
  const message = (payload.message || event.message || "Unknown error").slice(0, 1024);
4202
4244
  const stack = err instanceof Error ? err.stack ?? null : null;
4203
- const frames = parseStack(stack);
4245
+ const frames = demoteVendorInjectedFrames(parseStack(stack), message);
4204
4246
  const errorType = payload.errorType ?? null;
4205
4247
  const context = payload.extras ? { ...this.opts.getContext(), __error_extras: payload.extras } : this.opts.getContext();
4206
4248
  return {
@@ -4232,7 +4274,7 @@ var ErrorTracker = class {
4232
4274
  const payload = coerceErrorPayload(err);
4233
4275
  const message = (payload.message || "Unknown error").slice(0, 1024);
4234
4276
  const stack = err instanceof Error ? err.stack ?? null : null;
4235
- const frames = parseStack(stack);
4277
+ const frames = demoteVendorInjectedFrames(parseStack(stack), message);
4236
4278
  const errorType = payload.errorType ?? null;
4237
4279
  const context = payload.extras ? { ...this.opts.getContext(), __error_extras: payload.extras } : this.opts.getContext();
4238
4280
  return {
@@ -4648,7 +4690,7 @@ var CrossdeckClient = class {
4648
4690
  const effectiveStorage = persistIdentity ? storage : new MemoryStorage();
4649
4691
  const useCookieRedundancy = persistIdentity && !options.storage && // honour caller's adapter choice
4650
4692
  typeof globalThis.document !== "undefined";
4651
- const cookieStore = useCookieRedundancy ? new CookieStorage() : void 0;
4693
+ const cookieStore = useCookieRedundancy ? new CookieStorage({ domain: resolveCookieDomain(options.cookieDomain ?? "auto") }) : void 0;
4652
4694
  const identity = new IdentityStore(effectiveStorage, opts.storagePrefix, cookieStore);
4653
4695
  const entitlements = new EntitlementCache(
4654
4696
  effectiveStorage,