@cross-deck/web 1.10.3 → 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/CHANGELOG.md +28 -0
- package/README.md +3 -1
- package/dist/crossdeck.umd.min.js +2 -2
- package/dist/crossdeck.umd.min.js.map +1 -1
- package/dist/error-codes.json +1 -1
- package/dist/index.cjs +33 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +33 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +33 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.mjs +33 -2
- package/dist/react.mjs.map +1 -1
- package/dist/{types-B9sxUuKh.d.mts → types-iqtsOTGy.d.mts} +14 -0
- package/dist/{types-B9sxUuKh.d.ts → types-iqtsOTGy.d.ts} +14 -0
- package/dist/vue.cjs +33 -2
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.mjs +33 -2
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -106,6 +106,20 @@ interface CrossdeckOptions {
|
|
|
106
106
|
storage?: KeyValueStorage;
|
|
107
107
|
/** Storage key prefix for the SDK's persisted state. Default "crossdeck:". */
|
|
108
108
|
storagePrefix?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Cross-subdomain identity. The anonymous-ID cookie is scoped to this domain so
|
|
111
|
+
* a visitor is ONE person across every subdomain — your marketing site
|
|
112
|
+
* (`example.com`) and your app (`app.example.com`) share one identity, so
|
|
113
|
+
* first-touch source, journey, and conversion stitch into one timeline.
|
|
114
|
+
*
|
|
115
|
+
* - `"auto"` (default) — the registrable domain (eTLD+1), detected safely.
|
|
116
|
+
* - a domain string (`".example.com"` / `"example.com"`) — set it explicitly.
|
|
117
|
+
* - `"none"` — host-only (each subdomain is its own identity; pre-1.11 behaviour).
|
|
118
|
+
*
|
|
119
|
+
* No effect in Node/native — cookies + subdomains are browser-only. Cross-*device*
|
|
120
|
+
* / cross-platform identity is resolved server-side by email/userId, not here.
|
|
121
|
+
*/
|
|
122
|
+
cookieDomain?: string;
|
|
109
123
|
/**
|
|
110
124
|
* Send a heartbeat to /v1/sdk/heartbeat on start(). Default true.
|
|
111
125
|
* Disable for high-frequency boot scenarios where the heartbeat is
|
|
@@ -106,6 +106,20 @@ interface CrossdeckOptions {
|
|
|
106
106
|
storage?: KeyValueStorage;
|
|
107
107
|
/** Storage key prefix for the SDK's persisted state. Default "crossdeck:". */
|
|
108
108
|
storagePrefix?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Cross-subdomain identity. The anonymous-ID cookie is scoped to this domain so
|
|
111
|
+
* a visitor is ONE person across every subdomain — your marketing site
|
|
112
|
+
* (`example.com`) and your app (`app.example.com`) share one identity, so
|
|
113
|
+
* first-touch source, journey, and conversion stitch into one timeline.
|
|
114
|
+
*
|
|
115
|
+
* - `"auto"` (default) — the registrable domain (eTLD+1), detected safely.
|
|
116
|
+
* - a domain string (`".example.com"` / `"example.com"`) — set it explicitly.
|
|
117
|
+
* - `"none"` — host-only (each subdomain is its own identity; pre-1.11 behaviour).
|
|
118
|
+
*
|
|
119
|
+
* No effect in Node/native — cookies + subdomains are browser-only. Cross-*device*
|
|
120
|
+
* / cross-platform identity is resolved server-side by email/userId, not here.
|
|
121
|
+
*/
|
|
122
|
+
cookieDomain?: string;
|
|
109
123
|
/**
|
|
110
124
|
* Send a heartbeat to /v1/sdk/heartbeat on start(). Default true.
|
|
111
125
|
* Disable for high-frequency boot scenarios where the heartbeat is
|
package/dist/vue.cjs
CHANGED
|
@@ -97,7 +97,7 @@ function typeMapForStatus(status) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// src/_version.ts
|
|
100
|
-
var SDK_VERSION = "1.
|
|
100
|
+
var SDK_VERSION = "1.11.1";
|
|
101
101
|
var SDK_NAME = "@cross-deck/web";
|
|
102
102
|
|
|
103
103
|
// src/http.ts
|
|
@@ -1325,6 +1325,7 @@ var CookieStorage = class {
|
|
|
1325
1325
|
this.maxAgeSec = options?.maxAgeSec ?? 63072e3;
|
|
1326
1326
|
this.secure = options?.secure ?? defaultSecure();
|
|
1327
1327
|
this.sameSite = options?.sameSite ?? "Lax";
|
|
1328
|
+
this.domain = options?.domain || void 0;
|
|
1328
1329
|
}
|
|
1329
1330
|
getItem(key) {
|
|
1330
1331
|
if (!hasDocument()) return null;
|
|
@@ -1351,6 +1352,7 @@ var CookieStorage = class {
|
|
|
1351
1352
|
`Max-Age=${this.maxAgeSec}`,
|
|
1352
1353
|
`SameSite=${this.sameSite}`
|
|
1353
1354
|
];
|
|
1355
|
+
if (this.domain) parts.push(`Domain=${this.domain}`);
|
|
1354
1356
|
if (this.secure) parts.push("Secure");
|
|
1355
1357
|
try {
|
|
1356
1358
|
doc.cookie = parts.join("; ");
|
|
@@ -1366,6 +1368,7 @@ var CookieStorage = class {
|
|
|
1366
1368
|
"Max-Age=0",
|
|
1367
1369
|
`SameSite=${this.sameSite}`
|
|
1368
1370
|
];
|
|
1371
|
+
if (this.domain) parts.push(`Domain=${this.domain}`);
|
|
1369
1372
|
if (this.secure) parts.push("Secure");
|
|
1370
1373
|
try {
|
|
1371
1374
|
doc.cookie = parts.join("; ");
|
|
@@ -1373,6 +1376,34 @@ var CookieStorage = class {
|
|
|
1373
1376
|
}
|
|
1374
1377
|
}
|
|
1375
1378
|
};
|
|
1379
|
+
function resolveCookieDomain(config) {
|
|
1380
|
+
if (config === void 0 || config === "none" || config === "") return void 0;
|
|
1381
|
+
if (config !== "auto") {
|
|
1382
|
+
const d = config.trim().toLowerCase();
|
|
1383
|
+
return d.startsWith(".") ? d : `.${d}`;
|
|
1384
|
+
}
|
|
1385
|
+
if (!hasDocument()) return void 0;
|
|
1386
|
+
const doc = globalThis.document;
|
|
1387
|
+
const loc = globalThis.location;
|
|
1388
|
+
const host = (loc?.hostname ?? "").toLowerCase();
|
|
1389
|
+
if (!host || host === "localhost" || /^\d{1,3}(\.\d{1,3}){3}$/.test(host) || host.indexOf(".") === -1) {
|
|
1390
|
+
return void 0;
|
|
1391
|
+
}
|
|
1392
|
+
const labels = host.split(".");
|
|
1393
|
+
for (let i = labels.length - 2; i >= 0; i--) {
|
|
1394
|
+
const candidate = "." + labels.slice(i).join(".");
|
|
1395
|
+
const testKey = "__cd_domain_probe";
|
|
1396
|
+
try {
|
|
1397
|
+
doc.cookie = `${testKey}=1; Domain=${candidate}; Path=/; SameSite=Lax`;
|
|
1398
|
+
const accepted = doc.cookie.indexOf(`${testKey}=1`) !== -1;
|
|
1399
|
+
doc.cookie = `${testKey}=; Domain=${candidate}; Path=/; Max-Age=0; SameSite=Lax`;
|
|
1400
|
+
if (accepted) return candidate;
|
|
1401
|
+
} catch {
|
|
1402
|
+
return void 0;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
return void 0;
|
|
1406
|
+
}
|
|
1376
1407
|
function detectDefaultStorage() {
|
|
1377
1408
|
try {
|
|
1378
1409
|
const ls = globalThis.localStorage;
|
|
@@ -4652,7 +4683,7 @@ var CrossdeckClient = class {
|
|
|
4652
4683
|
const effectiveStorage = persistIdentity ? storage : new MemoryStorage();
|
|
4653
4684
|
const useCookieRedundancy = persistIdentity && !options.storage && // honour caller's adapter choice
|
|
4654
4685
|
typeof globalThis.document !== "undefined";
|
|
4655
|
-
const cookieStore = useCookieRedundancy ? new CookieStorage() : void 0;
|
|
4686
|
+
const cookieStore = useCookieRedundancy ? new CookieStorage({ domain: resolveCookieDomain(options.cookieDomain ?? "auto") }) : void 0;
|
|
4656
4687
|
const identity = new IdentityStore(effectiveStorage, opts.storagePrefix, cookieStore);
|
|
4657
4688
|
const entitlements = new EntitlementCache(
|
|
4658
4689
|
effectiveStorage,
|