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