@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.
package/dist/react.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { C as CrossdeckOptions } from './types-B9sxUuKh.mjs';
2
+ import { C as CrossdeckOptions } from './types-iqtsOTGy.mjs';
3
3
 
4
4
  /**
5
5
  * @cross-deck/web/react — React hooks for the Crossdeck SDK.
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { C as CrossdeckOptions } from './types-B9sxUuKh.js';
2
+ import { C as CrossdeckOptions } from './types-iqtsOTGy.js';
3
3
 
4
4
  /**
5
5
  * @cross-deck/web/react — React hooks for the Crossdeck SDK.
package/dist/react.mjs CHANGED
@@ -72,7 +72,7 @@ function typeMapForStatus(status) {
72
72
  }
73
73
 
74
74
  // src/_version.ts
75
- var SDK_VERSION = "1.10.2";
75
+ var SDK_VERSION = "1.11.1";
76
76
  var SDK_NAME = "@cross-deck/web";
77
77
 
78
78
  // src/http.ts
@@ -1300,6 +1300,7 @@ var CookieStorage = class {
1300
1300
  this.maxAgeSec = options?.maxAgeSec ?? 63072e3;
1301
1301
  this.secure = options?.secure ?? defaultSecure();
1302
1302
  this.sameSite = options?.sameSite ?? "Lax";
1303
+ this.domain = options?.domain || void 0;
1303
1304
  }
1304
1305
  getItem(key) {
1305
1306
  if (!hasDocument()) return null;
@@ -1326,6 +1327,7 @@ var CookieStorage = class {
1326
1327
  `Max-Age=${this.maxAgeSec}`,
1327
1328
  `SameSite=${this.sameSite}`
1328
1329
  ];
1330
+ if (this.domain) parts.push(`Domain=${this.domain}`);
1329
1331
  if (this.secure) parts.push("Secure");
1330
1332
  try {
1331
1333
  doc.cookie = parts.join("; ");
@@ -1341,6 +1343,7 @@ var CookieStorage = class {
1341
1343
  "Max-Age=0",
1342
1344
  `SameSite=${this.sameSite}`
1343
1345
  ];
1346
+ if (this.domain) parts.push(`Domain=${this.domain}`);
1344
1347
  if (this.secure) parts.push("Secure");
1345
1348
  try {
1346
1349
  doc.cookie = parts.join("; ");
@@ -1348,6 +1351,34 @@ var CookieStorage = class {
1348
1351
  }
1349
1352
  }
1350
1353
  };
1354
+ function resolveCookieDomain(config) {
1355
+ if (config === void 0 || config === "none" || config === "") return void 0;
1356
+ if (config !== "auto") {
1357
+ const d = config.trim().toLowerCase();
1358
+ return d.startsWith(".") ? d : `.${d}`;
1359
+ }
1360
+ if (!hasDocument()) return void 0;
1361
+ const doc = globalThis.document;
1362
+ const loc = globalThis.location;
1363
+ const host = (loc?.hostname ?? "").toLowerCase();
1364
+ if (!host || host === "localhost" || /^\d{1,3}(\.\d{1,3}){3}$/.test(host) || host.indexOf(".") === -1) {
1365
+ return void 0;
1366
+ }
1367
+ const labels = host.split(".");
1368
+ for (let i = labels.length - 2; i >= 0; i--) {
1369
+ const candidate = "." + labels.slice(i).join(".");
1370
+ const testKey = "__cd_domain_probe";
1371
+ try {
1372
+ doc.cookie = `${testKey}=1; Domain=${candidate}; Path=/; SameSite=Lax`;
1373
+ const accepted = doc.cookie.indexOf(`${testKey}=1`) !== -1;
1374
+ doc.cookie = `${testKey}=; Domain=${candidate}; Path=/; Max-Age=0; SameSite=Lax`;
1375
+ if (accepted) return candidate;
1376
+ } catch {
1377
+ return void 0;
1378
+ }
1379
+ }
1380
+ return void 0;
1381
+ }
1351
1382
  function detectDefaultStorage() {
1352
1383
  try {
1353
1384
  const ls = globalThis.localStorage;
@@ -3811,7 +3842,18 @@ function isInAppFrame(filename) {
3811
3842
  if (/\/crossdeck\.umd\.min\.js$/.test(filename)) return false;
3812
3843
  return true;
3813
3844
  }
3845
+ var BROWSER_INJECTED_GLOBAL = /(__firefox__|__gCrWeb|zaloJSV2)/;
3846
+ function injectedGlobalName(message) {
3847
+ const m = BROWSER_INJECTED_GLOBAL.exec(message ?? "");
3848
+ return m ? m[1] : null;
3849
+ }
3850
+ function demoteVendorInjectedFrames(frames, message) {
3851
+ if (!injectedGlobalName(message)) return frames;
3852
+ return frames.map((f) => f.in_app ? { ...f, in_app: false } : f);
3853
+ }
3814
3854
  function fingerprintError(message, frames, location2) {
3855
+ const injected = injectedGlobalName(message);
3856
+ if (injected) return djb2Hex(`injected-global:${injected}`);
3815
3857
  const inAppFrames = frames.filter((f) => f.in_app).slice(0, 3);
3816
3858
  const parts = [
3817
3859
  (message || "").slice(0, 200),
@@ -4168,7 +4210,7 @@ var ErrorTracker = class {
4168
4210
  const payload = coerceErrorPayload(err);
4169
4211
  const message = (payload.message || event.message || "Unknown error").slice(0, 1024);
4170
4212
  const stack = err instanceof Error ? err.stack ?? null : null;
4171
- const frames = parseStack(stack);
4213
+ const frames = demoteVendorInjectedFrames(parseStack(stack), message);
4172
4214
  const errorType = payload.errorType ?? null;
4173
4215
  const context = payload.extras ? { ...this.opts.getContext(), __error_extras: payload.extras } : this.opts.getContext();
4174
4216
  return {
@@ -4200,7 +4242,7 @@ var ErrorTracker = class {
4200
4242
  const payload = coerceErrorPayload(err);
4201
4243
  const message = (payload.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 {
@@ -4616,7 +4658,7 @@ var CrossdeckClient = class {
4616
4658
  const effectiveStorage = persistIdentity ? storage : new MemoryStorage();
4617
4659
  const useCookieRedundancy = persistIdentity && !options.storage && // honour caller's adapter choice
4618
4660
  typeof globalThis.document !== "undefined";
4619
- const cookieStore = useCookieRedundancy ? new CookieStorage() : void 0;
4661
+ const cookieStore = useCookieRedundancy ? new CookieStorage({ domain: resolveCookieDomain(options.cookieDomain ?? "auto") }) : void 0;
4620
4662
  const identity = new IdentityStore(effectiveStorage, opts.storagePrefix, cookieStore);
4621
4663
  const entitlements = new EntitlementCache(
4622
4664
  effectiveStorage,