@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/dist/vue.mjs CHANGED
@@ -72,7 +72,7 @@ function typeMapForStatus(status) {
72
72
  }
73
73
 
74
74
  // src/_version.ts
75
- var SDK_VERSION = "1.8.0";
75
+ var SDK_VERSION = "1.9.1";
76
76
  var SDK_NAME = "@cross-deck/web";
77
77
 
78
78
  // src/http.ts
@@ -1373,6 +1373,16 @@ function hasDocument() {
1373
1373
  return typeof globalThis.document !== "undefined";
1374
1374
  }
1375
1375
 
1376
+ // src/read-cost-bridge.ts
1377
+ var BUCKETS_BRIDGE_KEY = "__crossdeckBucketsBridge__";
1378
+ function bridgeReadCost(ctx) {
1379
+ try {
1380
+ const setter = globalThis[BUCKETS_BRIDGE_KEY];
1381
+ if (typeof setter === "function") setter(ctx);
1382
+ } catch {
1383
+ }
1384
+ }
1385
+
1376
1386
  // src/device-info.ts
1377
1387
  function isBrowser() {
1378
1388
  return typeof globalThis.window !== "undefined" && typeof globalThis.document !== "undefined" && typeof globalThis.navigator !== "undefined";
@@ -4862,6 +4872,7 @@ var CrossdeckClient = class {
4862
4872
  message: "identify(userId) requires a non-empty userId."
4863
4873
  });
4864
4874
  }
4875
+ bridgeReadCost({ actor: userId });
4865
4876
  if (!s.consent.analytics) {
4866
4877
  s.debug.emit(
4867
4878
  "sdk.consent_denied",
@@ -5514,6 +5525,7 @@ var CrossdeckClient = class {
5514
5525
  }
5515
5526
  this.state.autoTracker?.uninstall();
5516
5527
  this.state.identity.reset();
5528
+ bridgeReadCost({ actor: void 0 });
5517
5529
  this.state.entitlements.clearAll();
5518
5530
  this.state.events.reset();
5519
5531
  this.state.superProps.clear();
@@ -5604,6 +5616,23 @@ var CrossdeckClient = class {
5604
5616
  const s = this.requireStarted();
5605
5617
  return s.identity.crossdeckCustomerId ?? s.developerUserId ?? s.identity.anonymousId;
5606
5618
  }
5619
+ /**
5620
+ * The device-scoped anonymous id the SDK minted on first boot and persists
5621
+ * across launches (stable until reset()). Public accessor so a server-to-
5622
+ * server flow or a block/suspension gate can pass the device identity to
5623
+ * POST /v1/resolve without reaching into private storage.
5624
+ *
5625
+ * Returns `null` BEFORE init() — there is no anon id yet, and a gate that
5626
+ * fires during early app boot should get a clean falsy, not a throw. (This is
5627
+ * deliberately softer than getCheckoutReference(), which requires init.)
5628
+ *
5629
+ * Note: /v1/resolve also accepts a VERIFIED identity (userId + idToken)
5630
+ * without an anonymousId, and that path is higher-trust — prefer it where the
5631
+ * user is authenticated.
5632
+ */
5633
+ getAnonymousId() {
5634
+ return this.state ? this.state.identity.anonymousId : null;
5635
+ }
5607
5636
  // ---------- private helpers ----------
5608
5637
  requireStarted() {
5609
5638
  if (!this.state) {