@cross-deck/web 1.8.0 → 1.9.0

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-06-11T07:13:22.322Z",
3
+ "generatedAt": "2026-06-24T10:42:10.345Z",
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.8.0";
107
+ var SDK_VERSION = "1.9.0";
108
108
  var SDK_NAME = "@cross-deck/web";
109
109
 
110
110
  // src/http.ts
@@ -1405,6 +1405,16 @@ function hasDocument() {
1405
1405
  return typeof globalThis.document !== "undefined";
1406
1406
  }
1407
1407
 
1408
+ // src/read-cost-bridge.ts
1409
+ var BUCKETS_BRIDGE_KEY = "__crossdeckBucketsBridge__";
1410
+ function bridgeReadCost(ctx) {
1411
+ try {
1412
+ const setter = globalThis[BUCKETS_BRIDGE_KEY];
1413
+ if (typeof setter === "function") setter(ctx);
1414
+ } catch {
1415
+ }
1416
+ }
1417
+
1408
1418
  // src/device-info.ts
1409
1419
  function isBrowser() {
1410
1420
  return typeof globalThis.window !== "undefined" && typeof globalThis.document !== "undefined" && typeof globalThis.navigator !== "undefined";
@@ -4894,6 +4904,7 @@ var CrossdeckClient = class {
4894
4904
  message: "identify(userId) requires a non-empty userId."
4895
4905
  });
4896
4906
  }
4907
+ bridgeReadCost({ actor: userId });
4897
4908
  if (!s.consent.analytics) {
4898
4909
  s.debug.emit(
4899
4910
  "sdk.consent_denied",
@@ -5546,6 +5557,7 @@ var CrossdeckClient = class {
5546
5557
  }
5547
5558
  this.state.autoTracker?.uninstall();
5548
5559
  this.state.identity.reset();
5560
+ bridgeReadCost({ actor: void 0 });
5549
5561
  this.state.entitlements.clearAll();
5550
5562
  this.state.events.reset();
5551
5563
  this.state.superProps.clear();
@@ -5636,6 +5648,23 @@ var CrossdeckClient = class {
5636
5648
  const s = this.requireStarted();
5637
5649
  return s.identity.crossdeckCustomerId ?? s.developerUserId ?? s.identity.anonymousId;
5638
5650
  }
5651
+ /**
5652
+ * The device-scoped anonymous id the SDK minted on first boot and persists
5653
+ * across launches (stable until reset()). Public accessor so a server-to-
5654
+ * server flow or a block/suspension gate can pass the device identity to
5655
+ * POST /v1/resolve without reaching into private storage.
5656
+ *
5657
+ * Returns `null` BEFORE init() — there is no anon id yet, and a gate that
5658
+ * fires during early app boot should get a clean falsy, not a throw. (This is
5659
+ * deliberately softer than getCheckoutReference(), which requires init.)
5660
+ *
5661
+ * Note: /v1/resolve also accepts a VERIFIED identity (userId + idToken)
5662
+ * without an anonymousId, and that path is higher-trust — prefer it where the
5663
+ * user is authenticated.
5664
+ */
5665
+ getAnonymousId() {
5666
+ return this.state ? this.state.identity.anonymousId : null;
5667
+ }
5639
5668
  // ---------- private helpers ----------
5640
5669
  requireStarted() {
5641
5670
  if (!this.state) {