@cross-deck/web 1.8.0 → 1.9.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 +18 -0
- package/README.md +12 -6
- 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 +30 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.mjs +30 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +30 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +30 -1
- package/dist/react.mjs.map +1 -1
- package/dist/vue.cjs +30 -1
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.mjs +30 -1
- package/dist/vue.mjs.map +1 -1
- package/package.json +2 -2
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.
|
|
101
|
+
var SDK_VERSION = "1.9.1";
|
|
102
102
|
var SDK_NAME = "@cross-deck/web";
|
|
103
103
|
|
|
104
104
|
// src/http.ts
|
|
@@ -1399,6 +1399,16 @@ function hasDocument() {
|
|
|
1399
1399
|
return typeof globalThis.document !== "undefined";
|
|
1400
1400
|
}
|
|
1401
1401
|
|
|
1402
|
+
// src/read-cost-bridge.ts
|
|
1403
|
+
var BUCKETS_BRIDGE_KEY = "__crossdeckBucketsBridge__";
|
|
1404
|
+
function bridgeReadCost(ctx) {
|
|
1405
|
+
try {
|
|
1406
|
+
const setter = globalThis[BUCKETS_BRIDGE_KEY];
|
|
1407
|
+
if (typeof setter === "function") setter(ctx);
|
|
1408
|
+
} catch {
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1402
1412
|
// src/device-info.ts
|
|
1403
1413
|
function isBrowser() {
|
|
1404
1414
|
return typeof globalThis.window !== "undefined" && typeof globalThis.document !== "undefined" && typeof globalThis.navigator !== "undefined";
|
|
@@ -4888,6 +4898,7 @@ var CrossdeckClient = class {
|
|
|
4888
4898
|
message: "identify(userId) requires a non-empty userId."
|
|
4889
4899
|
});
|
|
4890
4900
|
}
|
|
4901
|
+
bridgeReadCost({ actor: userId });
|
|
4891
4902
|
if (!s.consent.analytics) {
|
|
4892
4903
|
s.debug.emit(
|
|
4893
4904
|
"sdk.consent_denied",
|
|
@@ -5540,6 +5551,7 @@ var CrossdeckClient = class {
|
|
|
5540
5551
|
}
|
|
5541
5552
|
this.state.autoTracker?.uninstall();
|
|
5542
5553
|
this.state.identity.reset();
|
|
5554
|
+
bridgeReadCost({ actor: void 0 });
|
|
5543
5555
|
this.state.entitlements.clearAll();
|
|
5544
5556
|
this.state.events.reset();
|
|
5545
5557
|
this.state.superProps.clear();
|
|
@@ -5630,6 +5642,23 @@ var CrossdeckClient = class {
|
|
|
5630
5642
|
const s = this.requireStarted();
|
|
5631
5643
|
return s.identity.crossdeckCustomerId ?? s.developerUserId ?? s.identity.anonymousId;
|
|
5632
5644
|
}
|
|
5645
|
+
/**
|
|
5646
|
+
* The device-scoped anonymous id the SDK minted on first boot and persists
|
|
5647
|
+
* across launches (stable until reset()). Public accessor so a server-to-
|
|
5648
|
+
* server flow or a block/suspension gate can pass the device identity to
|
|
5649
|
+
* POST /v1/resolve without reaching into private storage.
|
|
5650
|
+
*
|
|
5651
|
+
* Returns `null` BEFORE init() — there is no anon id yet, and a gate that
|
|
5652
|
+
* fires during early app boot should get a clean falsy, not a throw. (This is
|
|
5653
|
+
* deliberately softer than getCheckoutReference(), which requires init.)
|
|
5654
|
+
*
|
|
5655
|
+
* Note: /v1/resolve also accepts a VERIFIED identity (userId + idToken)
|
|
5656
|
+
* without an anonymousId, and that path is higher-trust — prefer it where the
|
|
5657
|
+
* user is authenticated.
|
|
5658
|
+
*/
|
|
5659
|
+
getAnonymousId() {
|
|
5660
|
+
return this.state ? this.state.identity.anonymousId : null;
|
|
5661
|
+
}
|
|
5633
5662
|
// ---------- private helpers ----------
|
|
5634
5663
|
requireStarted() {
|
|
5635
5664
|
if (!this.state) {
|