@cross-deck/web 1.5.6 → 1.6.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
@@ -232,9 +232,9 @@ declare const CrossdeckContracts: {
232
232
  /** Filter by lifecycle status. */
233
233
  readonly withStatus: (status: ContractStatus) => readonly Contract[];
234
234
  /** Semver of the SDK release these contracts were bundled with. */
235
- readonly sdkVersion: "1.5.3";
235
+ readonly sdkVersion: "1.6.1";
236
236
  /** Fully-qualified bundle identifier — e.g. `@cross-deck/web@1.4.2`. */
237
- readonly bundledIn: "@cross-deck/web@1.5.3";
237
+ readonly bundledIn: "@cross-deck/web@1.6.1";
238
238
  /**
239
239
  * Resolve a failing test back to the contract it exercises.
240
240
  * Used by test-framework hooks (Vitest `afterEach`, XCTest
@@ -634,6 +634,12 @@ declare class CrossdeckClient {
634
634
  * true even before the session's first network round-trip. Returns
635
635
  * false only for a genuinely new install that has never completed a
636
636
  * getEntitlements(), or for an entitlement past its own validUntil.
637
+ *
638
+ * Throws `not_initialized` (CrossdeckError, type
639
+ * `configuration_error`) if called before `Crossdeck.init()`. The
640
+ * `useEntitlement` React hook and the Vue composable both swallow
641
+ * this and return `false`; bare callers must guard for it (or call
642
+ * after `init()` resolves).
637
643
  */
638
644
  isEntitled(key: string): boolean;
639
645
  /** Snapshot of the local entitlement cache. */
@@ -643,8 +649,21 @@ declare class CrossdeckClient {
643
649
  *
644
650
  * The listener is invoked AFTER the cache mutates — once after a
645
651
  * successful `getEntitlements()` warms it, again after `syncPurchases()`
646
- * delivers fresh entitlements, and once on `reset()` to fire the
647
- * empty-cache state for logout flows.
652
+ * delivers fresh entitlements, once on `reset()` to fire the empty-
653
+ * cache state for logout flows, AND once on `identify()` after the
654
+ * per-user cache slot rotates and re-hydrates from device storage.
655
+ *
656
+ * IMPORTANT — the `identify()` fire is a TRAP if you treat it as
657
+ * authoritative network state. `identify()` does NOT fetch entitlements;
658
+ * it switches the per-user cache slot and rehydrates from device
659
+ * storage (which is empty for a brand-new install, and last-known-good
660
+ * — possibly stale — for a returning user). A listener that gates a
661
+ * paywall on the first fire after an identity switch will read
662
+ * `false` for a paying customer on a fresh device and let them past
663
+ * the gate as free. The network-truth fire is the one that follows
664
+ * the next `getEntitlements()` resolution. Either call
665
+ * `getEntitlements()` explicitly after `identify()`, or have your
666
+ * gating code tolerate the empty-then-populated transition.
648
667
  *
649
668
  * It is NOT invoked synchronously on subscribe. Callers that need
650
669
  * the current state should read it via `isEntitled()` / `listEntitlements()`
@@ -748,6 +767,22 @@ declare class CrossdeckClient {
748
767
  * `entitlements`. Pre-start values are sensible empties.
749
768
  */
750
769
  diagnostics(): Diagnostics;
770
+ /**
771
+ * The stable reference to hand Stripe at checkout so the resulting
772
+ * purchase attributes to THIS person. Stamp it on the Checkout Session
773
+ * as `metadata.crossdeck_ref` (see docs/connect-stripe) — the platform
774
+ * webhook reads it back, validates it, and attaches the subscription to
775
+ * the right customer instead of stranding it on an anonymous record.
776
+ *
777
+ * Returns the strongest identifier the SDK currently holds, in the same
778
+ * precedence the server resolves by:
779
+ * crossdeckCustomerId (cdcust_…) > developerUserId > anonymousId
780
+ * anonymousId is always present, so this always returns a usable,
781
+ * non-empty reference — even before identify(). Identify the user as
782
+ * early as you can, though, so the reference is their stable identity
783
+ * and not a per-device anon id.
784
+ */
785
+ getCheckoutReference(): string;
751
786
  private requireStarted;
752
787
  /**
753
788
  * Build the identity query for /v1/entitlements. Priority:
@@ -886,7 +921,7 @@ declare class MemoryStorage implements KeyValueStorage {
886
921
  *
887
922
  * Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
888
923
  */
889
- declare const SDK_VERSION = "1.5.3";
924
+ declare const SDK_VERSION = "1.6.1";
890
925
  declare const SDK_NAME = "@cross-deck/web";
891
926
 
892
927
  /**
package/dist/index.d.ts CHANGED
@@ -232,9 +232,9 @@ declare const CrossdeckContracts: {
232
232
  /** Filter by lifecycle status. */
233
233
  readonly withStatus: (status: ContractStatus) => readonly Contract[];
234
234
  /** Semver of the SDK release these contracts were bundled with. */
235
- readonly sdkVersion: "1.5.3";
235
+ readonly sdkVersion: "1.6.1";
236
236
  /** Fully-qualified bundle identifier — e.g. `@cross-deck/web@1.4.2`. */
237
- readonly bundledIn: "@cross-deck/web@1.5.3";
237
+ readonly bundledIn: "@cross-deck/web@1.6.1";
238
238
  /**
239
239
  * Resolve a failing test back to the contract it exercises.
240
240
  * Used by test-framework hooks (Vitest `afterEach`, XCTest
@@ -634,6 +634,12 @@ declare class CrossdeckClient {
634
634
  * true even before the session's first network round-trip. Returns
635
635
  * false only for a genuinely new install that has never completed a
636
636
  * getEntitlements(), or for an entitlement past its own validUntil.
637
+ *
638
+ * Throws `not_initialized` (CrossdeckError, type
639
+ * `configuration_error`) if called before `Crossdeck.init()`. The
640
+ * `useEntitlement` React hook and the Vue composable both swallow
641
+ * this and return `false`; bare callers must guard for it (or call
642
+ * after `init()` resolves).
637
643
  */
638
644
  isEntitled(key: string): boolean;
639
645
  /** Snapshot of the local entitlement cache. */
@@ -643,8 +649,21 @@ declare class CrossdeckClient {
643
649
  *
644
650
  * The listener is invoked AFTER the cache mutates — once after a
645
651
  * successful `getEntitlements()` warms it, again after `syncPurchases()`
646
- * delivers fresh entitlements, and once on `reset()` to fire the
647
- * empty-cache state for logout flows.
652
+ * delivers fresh entitlements, once on `reset()` to fire the empty-
653
+ * cache state for logout flows, AND once on `identify()` after the
654
+ * per-user cache slot rotates and re-hydrates from device storage.
655
+ *
656
+ * IMPORTANT — the `identify()` fire is a TRAP if you treat it as
657
+ * authoritative network state. `identify()` does NOT fetch entitlements;
658
+ * it switches the per-user cache slot and rehydrates from device
659
+ * storage (which is empty for a brand-new install, and last-known-good
660
+ * — possibly stale — for a returning user). A listener that gates a
661
+ * paywall on the first fire after an identity switch will read
662
+ * `false` for a paying customer on a fresh device and let them past
663
+ * the gate as free. The network-truth fire is the one that follows
664
+ * the next `getEntitlements()` resolution. Either call
665
+ * `getEntitlements()` explicitly after `identify()`, or have your
666
+ * gating code tolerate the empty-then-populated transition.
648
667
  *
649
668
  * It is NOT invoked synchronously on subscribe. Callers that need
650
669
  * the current state should read it via `isEntitled()` / `listEntitlements()`
@@ -748,6 +767,22 @@ declare class CrossdeckClient {
748
767
  * `entitlements`. Pre-start values are sensible empties.
749
768
  */
750
769
  diagnostics(): Diagnostics;
770
+ /**
771
+ * The stable reference to hand Stripe at checkout so the resulting
772
+ * purchase attributes to THIS person. Stamp it on the Checkout Session
773
+ * as `metadata.crossdeck_ref` (see docs/connect-stripe) — the platform
774
+ * webhook reads it back, validates it, and attaches the subscription to
775
+ * the right customer instead of stranding it on an anonymous record.
776
+ *
777
+ * Returns the strongest identifier the SDK currently holds, in the same
778
+ * precedence the server resolves by:
779
+ * crossdeckCustomerId (cdcust_…) > developerUserId > anonymousId
780
+ * anonymousId is always present, so this always returns a usable,
781
+ * non-empty reference — even before identify(). Identify the user as
782
+ * early as you can, though, so the reference is their stable identity
783
+ * and not a per-device anon id.
784
+ */
785
+ getCheckoutReference(): string;
751
786
  private requireStarted;
752
787
  /**
753
788
  * Build the identity query for /v1/entitlements. Priority:
@@ -886,7 +921,7 @@ declare class MemoryStorage implements KeyValueStorage {
886
921
  *
887
922
  * Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
888
923
  */
889
- declare const SDK_VERSION = "1.5.3";
924
+ declare const SDK_VERSION = "1.6.1";
890
925
  declare const SDK_NAME = "@cross-deck/web";
891
926
 
892
927
  /**