@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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PublicEntitlement, C as CrossdeckOptions, I as IdentifyOptions, A as AliasResult, G as GroupTraits, E as EventProperties, a as PurchaseResult, H as HeartbeatResponse, D as Diagnostics, K as KeyValueStorage } from './types-B9sxUuKh.mjs';
2
- export { b as AuditRail, c as AutoTrackOptions, d as EntitlementsListResponse, e as Environment, f as Platform } from './types-B9sxUuKh.mjs';
1
+ import { P as PublicEntitlement, C as CrossdeckOptions, I as IdentifyOptions, A as AliasResult, G as GroupTraits, E as EventProperties, a as PurchaseResult, H as HeartbeatResponse, D as Diagnostics, K as KeyValueStorage } from './types-iqtsOTGy.mjs';
2
+ export { b as AuditRail, c as AutoTrackOptions, d as EntitlementsListResponse, e as Environment, f as Platform } from './types-iqtsOTGy.mjs';
3
3
 
4
4
  /**
5
5
  * Durable last-known-good cache of the customer's entitlements.
@@ -969,7 +969,7 @@ declare class MemoryStorage implements KeyValueStorage {
969
969
  *
970
970
  * Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
971
971
  */
972
- declare const SDK_VERSION = "1.10.2";
972
+ declare const SDK_VERSION = "1.11.1";
973
973
  declare const SDK_NAME = "@cross-deck/web";
974
974
 
975
975
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PublicEntitlement, C as CrossdeckOptions, I as IdentifyOptions, A as AliasResult, G as GroupTraits, E as EventProperties, a as PurchaseResult, H as HeartbeatResponse, D as Diagnostics, K as KeyValueStorage } from './types-B9sxUuKh.js';
2
- export { b as AuditRail, c as AutoTrackOptions, d as EntitlementsListResponse, e as Environment, f as Platform } from './types-B9sxUuKh.js';
1
+ import { P as PublicEntitlement, C as CrossdeckOptions, I as IdentifyOptions, A as AliasResult, G as GroupTraits, E as EventProperties, a as PurchaseResult, H as HeartbeatResponse, D as Diagnostics, K as KeyValueStorage } from './types-iqtsOTGy.js';
2
+ export { b as AuditRail, c as AutoTrackOptions, d as EntitlementsListResponse, e as Environment, f as Platform } from './types-iqtsOTGy.js';
3
3
 
4
4
  /**
5
5
  * Durable last-known-good cache of the customer's entitlements.
@@ -969,7 +969,7 @@ declare class MemoryStorage implements KeyValueStorage {
969
969
  *
970
970
  * Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
971
971
  */
972
- declare const SDK_VERSION = "1.10.2";
972
+ declare const SDK_VERSION = "1.11.1";
973
973
  declare const SDK_NAME = "@cross-deck/web";
974
974
 
975
975
  /**
package/dist/index.mjs CHANGED
@@ -69,7 +69,7 @@ function typeMapForStatus(status) {
69
69
  }
70
70
 
71
71
  // src/_version.ts
72
- var SDK_VERSION = "1.10.2";
72
+ var SDK_VERSION = "1.11.1";
73
73
  var SDK_NAME = "@cross-deck/web";
74
74
 
75
75
  // src/http.ts
@@ -1297,6 +1297,7 @@ var CookieStorage = class {
1297
1297
  this.maxAgeSec = options?.maxAgeSec ?? 63072e3;
1298
1298
  this.secure = options?.secure ?? defaultSecure();
1299
1299
  this.sameSite = options?.sameSite ?? "Lax";
1300
+ this.domain = options?.domain || void 0;
1300
1301
  }
1301
1302
  getItem(key) {
1302
1303
  if (!hasDocument()) return null;
@@ -1323,6 +1324,7 @@ var CookieStorage = class {
1323
1324
  `Max-Age=${this.maxAgeSec}`,
1324
1325
  `SameSite=${this.sameSite}`
1325
1326
  ];
1327
+ if (this.domain) parts.push(`Domain=${this.domain}`);
1326
1328
  if (this.secure) parts.push("Secure");
1327
1329
  try {
1328
1330
  doc.cookie = parts.join("; ");
@@ -1338,6 +1340,7 @@ var CookieStorage = class {
1338
1340
  "Max-Age=0",
1339
1341
  `SameSite=${this.sameSite}`
1340
1342
  ];
1343
+ if (this.domain) parts.push(`Domain=${this.domain}`);
1341
1344
  if (this.secure) parts.push("Secure");
1342
1345
  try {
1343
1346
  doc.cookie = parts.join("; ");
@@ -1345,6 +1348,34 @@ var CookieStorage = class {
1345
1348
  }
1346
1349
  }
1347
1350
  };
1351
+ function resolveCookieDomain(config) {
1352
+ if (config === void 0 || config === "none" || config === "") return void 0;
1353
+ if (config !== "auto") {
1354
+ const d = config.trim().toLowerCase();
1355
+ return d.startsWith(".") ? d : `.${d}`;
1356
+ }
1357
+ if (!hasDocument()) return void 0;
1358
+ const doc = globalThis.document;
1359
+ const loc = globalThis.location;
1360
+ const host = (loc?.hostname ?? "").toLowerCase();
1361
+ if (!host || host === "localhost" || /^\d{1,3}(\.\d{1,3}){3}$/.test(host) || host.indexOf(".") === -1) {
1362
+ return void 0;
1363
+ }
1364
+ const labels = host.split(".");
1365
+ for (let i = labels.length - 2; i >= 0; i--) {
1366
+ const candidate = "." + labels.slice(i).join(".");
1367
+ const testKey = "__cd_domain_probe";
1368
+ try {
1369
+ doc.cookie = `${testKey}=1; Domain=${candidate}; Path=/; SameSite=Lax`;
1370
+ const accepted = doc.cookie.indexOf(`${testKey}=1`) !== -1;
1371
+ doc.cookie = `${testKey}=; Domain=${candidate}; Path=/; Max-Age=0; SameSite=Lax`;
1372
+ if (accepted) return candidate;
1373
+ } catch {
1374
+ return void 0;
1375
+ }
1376
+ }
1377
+ return void 0;
1378
+ }
1348
1379
  function detectDefaultStorage() {
1349
1380
  try {
1350
1381
  const ls = globalThis.localStorage;
@@ -3808,7 +3839,18 @@ function isInAppFrame(filename) {
3808
3839
  if (/\/crossdeck\.umd\.min\.js$/.test(filename)) return false;
3809
3840
  return true;
3810
3841
  }
3842
+ var BROWSER_INJECTED_GLOBAL = /(__firefox__|__gCrWeb|zaloJSV2)/;
3843
+ function injectedGlobalName(message) {
3844
+ const m = BROWSER_INJECTED_GLOBAL.exec(message ?? "");
3845
+ return m ? m[1] : null;
3846
+ }
3847
+ function demoteVendorInjectedFrames(frames, message) {
3848
+ if (!injectedGlobalName(message)) return frames;
3849
+ return frames.map((f) => f.in_app ? { ...f, in_app: false } : f);
3850
+ }
3811
3851
  function fingerprintError(message, frames, location2) {
3852
+ const injected = injectedGlobalName(message);
3853
+ if (injected) return djb2Hex(`injected-global:${injected}`);
3812
3854
  const inAppFrames = frames.filter((f) => f.in_app).slice(0, 3);
3813
3855
  const parts = [
3814
3856
  (message || "").slice(0, 200),
@@ -4165,7 +4207,7 @@ var ErrorTracker = class {
4165
4207
  const payload = coerceErrorPayload(err);
4166
4208
  const message = (payload.message || event.message || "Unknown error").slice(0, 1024);
4167
4209
  const stack = err instanceof Error ? err.stack ?? null : null;
4168
- const frames = parseStack(stack);
4210
+ const frames = demoteVendorInjectedFrames(parseStack(stack), message);
4169
4211
  const errorType = payload.errorType ?? null;
4170
4212
  const context = payload.extras ? { ...this.opts.getContext(), __error_extras: payload.extras } : this.opts.getContext();
4171
4213
  return {
@@ -4197,7 +4239,7 @@ var ErrorTracker = class {
4197
4239
  const payload = coerceErrorPayload(err);
4198
4240
  const message = (payload.message || "Unknown error").slice(0, 1024);
4199
4241
  const stack = err instanceof Error ? err.stack ?? null : null;
4200
- const frames = parseStack(stack);
4242
+ const frames = demoteVendorInjectedFrames(parseStack(stack), message);
4201
4243
  const errorType = payload.errorType ?? null;
4202
4244
  const context = payload.extras ? { ...this.opts.getContext(), __error_extras: payload.extras } : this.opts.getContext();
4203
4245
  return {
@@ -4613,7 +4655,7 @@ var CrossdeckClient = class {
4613
4655
  const effectiveStorage = persistIdentity ? storage : new MemoryStorage();
4614
4656
  const useCookieRedundancy = persistIdentity && !options.storage && // honour caller's adapter choice
4615
4657
  typeof globalThis.document !== "undefined";
4616
- const cookieStore = useCookieRedundancy ? new CookieStorage() : void 0;
4658
+ const cookieStore = useCookieRedundancy ? new CookieStorage({ domain: resolveCookieDomain(options.cookieDomain ?? "auto") }) : void 0;
4617
4659
  const identity = new IdentityStore(effectiveStorage, opts.storagePrefix, cookieStore);
4618
4660
  const entitlements = new EntitlementCache(
4619
4661
  effectiveStorage,