@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/index.d.mts CHANGED
@@ -798,6 +798,21 @@ declare class CrossdeckClient {
798
798
  * and not a per-device anon id.
799
799
  */
800
800
  getCheckoutReference(): string;
801
+ /**
802
+ * The device-scoped anonymous id the SDK minted on first boot and persists
803
+ * across launches (stable until reset()). Public accessor so a server-to-
804
+ * server flow or a block/suspension gate can pass the device identity to
805
+ * POST /v1/resolve without reaching into private storage.
806
+ *
807
+ * Returns `null` BEFORE init() — there is no anon id yet, and a gate that
808
+ * fires during early app boot should get a clean falsy, not a throw. (This is
809
+ * deliberately softer than getCheckoutReference(), which requires init.)
810
+ *
811
+ * Note: /v1/resolve also accepts a VERIFIED identity (userId + idToken)
812
+ * without an anonymousId, and that path is higher-trust — prefer it where the
813
+ * user is authenticated.
814
+ */
815
+ getAnonymousId(): string | null;
801
816
  private requireStarted;
802
817
  /**
803
818
  * Build the identity query for /v1/entitlements. Priority:
@@ -946,7 +961,7 @@ declare class MemoryStorage implements KeyValueStorage {
946
961
  *
947
962
  * Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
948
963
  */
949
- declare const SDK_VERSION = "1.8.0";
964
+ declare const SDK_VERSION = "1.9.1";
950
965
  declare const SDK_NAME = "@cross-deck/web";
951
966
 
952
967
  /**
package/dist/index.d.ts CHANGED
@@ -798,6 +798,21 @@ declare class CrossdeckClient {
798
798
  * and not a per-device anon id.
799
799
  */
800
800
  getCheckoutReference(): string;
801
+ /**
802
+ * The device-scoped anonymous id the SDK minted on first boot and persists
803
+ * across launches (stable until reset()). Public accessor so a server-to-
804
+ * server flow or a block/suspension gate can pass the device identity to
805
+ * POST /v1/resolve without reaching into private storage.
806
+ *
807
+ * Returns `null` BEFORE init() — there is no anon id yet, and a gate that
808
+ * fires during early app boot should get a clean falsy, not a throw. (This is
809
+ * deliberately softer than getCheckoutReference(), which requires init.)
810
+ *
811
+ * Note: /v1/resolve also accepts a VERIFIED identity (userId + idToken)
812
+ * without an anonymousId, and that path is higher-trust — prefer it where the
813
+ * user is authenticated.
814
+ */
815
+ getAnonymousId(): string | null;
801
816
  private requireStarted;
802
817
  /**
803
818
  * Build the identity query for /v1/entitlements. Priority:
@@ -946,7 +961,7 @@ declare class MemoryStorage implements KeyValueStorage {
946
961
  *
947
962
  * Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
948
963
  */
949
- declare const SDK_VERSION = "1.8.0";
964
+ declare const SDK_VERSION = "1.9.1";
950
965
  declare const SDK_NAME = "@cross-deck/web";
951
966
 
952
967
  /**
package/dist/index.mjs CHANGED
@@ -69,7 +69,7 @@ function typeMapForStatus(status) {
69
69
  }
70
70
 
71
71
  // src/_version.ts
72
- var SDK_VERSION = "1.8.0";
72
+ var SDK_VERSION = "1.9.1";
73
73
  var SDK_NAME = "@cross-deck/web";
74
74
 
75
75
  // src/http.ts
@@ -1370,6 +1370,16 @@ function hasDocument() {
1370
1370
  return typeof globalThis.document !== "undefined";
1371
1371
  }
1372
1372
 
1373
+ // src/read-cost-bridge.ts
1374
+ var BUCKETS_BRIDGE_KEY = "__crossdeckBucketsBridge__";
1375
+ function bridgeReadCost(ctx) {
1376
+ try {
1377
+ const setter = globalThis[BUCKETS_BRIDGE_KEY];
1378
+ if (typeof setter === "function") setter(ctx);
1379
+ } catch {
1380
+ }
1381
+ }
1382
+
1373
1383
  // src/device-info.ts
1374
1384
  function isBrowser() {
1375
1385
  return typeof globalThis.window !== "undefined" && typeof globalThis.document !== "undefined" && typeof globalThis.navigator !== "undefined";
@@ -4859,6 +4869,7 @@ var CrossdeckClient = class {
4859
4869
  message: "identify(userId) requires a non-empty userId."
4860
4870
  });
4861
4871
  }
4872
+ bridgeReadCost({ actor: userId });
4862
4873
  if (!s.consent.analytics) {
4863
4874
  s.debug.emit(
4864
4875
  "sdk.consent_denied",
@@ -5511,6 +5522,7 @@ var CrossdeckClient = class {
5511
5522
  }
5512
5523
  this.state.autoTracker?.uninstall();
5513
5524
  this.state.identity.reset();
5525
+ bridgeReadCost({ actor: void 0 });
5514
5526
  this.state.entitlements.clearAll();
5515
5527
  this.state.events.reset();
5516
5528
  this.state.superProps.clear();
@@ -5601,6 +5613,23 @@ var CrossdeckClient = class {
5601
5613
  const s = this.requireStarted();
5602
5614
  return s.identity.crossdeckCustomerId ?? s.developerUserId ?? s.identity.anonymousId;
5603
5615
  }
5616
+ /**
5617
+ * The device-scoped anonymous id the SDK minted on first boot and persists
5618
+ * across launches (stable until reset()). Public accessor so a server-to-
5619
+ * server flow or a block/suspension gate can pass the device identity to
5620
+ * POST /v1/resolve without reaching into private storage.
5621
+ *
5622
+ * Returns `null` BEFORE init() — there is no anon id yet, and a gate that
5623
+ * fires during early app boot should get a clean falsy, not a throw. (This is
5624
+ * deliberately softer than getCheckoutReference(), which requires init.)
5625
+ *
5626
+ * Note: /v1/resolve also accepts a VERIFIED identity (userId + idToken)
5627
+ * without an anonymousId, and that path is higher-trust — prefer it where the
5628
+ * user is authenticated.
5629
+ */
5630
+ getAnonymousId() {
5631
+ return this.state ? this.state.identity.anonymousId : null;
5632
+ }
5604
5633
  // ---------- private helpers ----------
5605
5634
  requireStarted() {
5606
5635
  if (!this.state) {