@cross-deck/web 1.5.7 → 1.6.2

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
@@ -194,6 +194,21 @@ interface Contract {
194
194
  readonly firstRegisteredIn: string;
195
195
  /** The SDK release this snapshot was bundled with, stamped at build time. */
196
196
  readonly bundledIn: string;
197
+ /**
198
+ * Whether THIS SDK self-verifies this contract at runtime (a verifier is
199
+ * registered in the SDK's `STATIC_VERIFIERS` harness, emitting
200
+ * `crossdeck.contract_failed` live), vs. proven by CI tests only.
201
+ *
202
+ * DERIVED at bundle time from the verifier registry — never hand-set —
203
+ * so the registry can never disagree with what actually runs. Runtime
204
+ * status is a property of (contract × SDK): the same contract can be
205
+ * `true` here (web) and `false` in another SDK that lacks the harness.
206
+ *
207
+ * `true` → surfaces in the console as "watch it pass live".
208
+ * `false` → "CI-proven every release" (still enforced, just not a
209
+ * live toggle on this platform).
210
+ */
211
+ readonly runtimeVerified: boolean;
197
212
  }
198
213
  /**
199
214
  * Typed entry point to the bank-grade contracts bundled with this
@@ -232,9 +247,9 @@ declare const CrossdeckContracts: {
232
247
  /** Filter by lifecycle status. */
233
248
  readonly withStatus: (status: ContractStatus) => readonly Contract[];
234
249
  /** Semver of the SDK release these contracts were bundled with. */
235
- readonly sdkVersion: "1.5.7";
250
+ readonly sdkVersion: "1.6.2";
236
251
  /** Fully-qualified bundle identifier — e.g. `@cross-deck/web@1.4.2`. */
237
- readonly bundledIn: "@cross-deck/web@1.5.7";
252
+ readonly bundledIn: "@cross-deck/web@1.6.2";
238
253
  /**
239
254
  * Resolve a failing test back to the contract it exercises.
240
255
  * Used by test-framework hooks (Vitest `afterEach`, XCTest
@@ -634,6 +649,12 @@ declare class CrossdeckClient {
634
649
  * true even before the session's first network round-trip. Returns
635
650
  * false only for a genuinely new install that has never completed a
636
651
  * getEntitlements(), or for an entitlement past its own validUntil.
652
+ *
653
+ * Throws `not_initialized` (CrossdeckError, type
654
+ * `configuration_error`) if called before `Crossdeck.init()`. The
655
+ * `useEntitlement` React hook and the Vue composable both swallow
656
+ * this and return `false`; bare callers must guard for it (or call
657
+ * after `init()` resolves).
637
658
  */
638
659
  isEntitled(key: string): boolean;
639
660
  /** Snapshot of the local entitlement cache. */
@@ -643,8 +664,21 @@ declare class CrossdeckClient {
643
664
  *
644
665
  * The listener is invoked AFTER the cache mutates — once after a
645
666
  * 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.
667
+ * delivers fresh entitlements, once on `reset()` to fire the empty-
668
+ * cache state for logout flows, AND once on `identify()` after the
669
+ * per-user cache slot rotates and re-hydrates from device storage.
670
+ *
671
+ * IMPORTANT — the `identify()` fire is a TRAP if you treat it as
672
+ * authoritative network state. `identify()` does NOT fetch entitlements;
673
+ * it switches the per-user cache slot and rehydrates from device
674
+ * storage (which is empty for a brand-new install, and last-known-good
675
+ * — possibly stale — for a returning user). A listener that gates a
676
+ * paywall on the first fire after an identity switch will read
677
+ * `false` for a paying customer on a fresh device and let them past
678
+ * the gate as free. The network-truth fire is the one that follows
679
+ * the next `getEntitlements()` resolution. Either call
680
+ * `getEntitlements()` explicitly after `identify()`, or have your
681
+ * gating code tolerate the empty-then-populated transition.
648
682
  *
649
683
  * It is NOT invoked synchronously on subscribe. Callers that need
650
684
  * the current state should read it via `isEntitled()` / `listEntitlements()`
@@ -748,6 +782,22 @@ declare class CrossdeckClient {
748
782
  * `entitlements`. Pre-start values are sensible empties.
749
783
  */
750
784
  diagnostics(): Diagnostics;
785
+ /**
786
+ * The stable reference to hand Stripe at checkout so the resulting
787
+ * purchase attributes to THIS person. Stamp it on the Checkout Session
788
+ * as `metadata.crossdeck_ref` (see docs/connect-stripe) — the platform
789
+ * webhook reads it back, validates it, and attaches the subscription to
790
+ * the right customer instead of stranding it on an anonymous record.
791
+ *
792
+ * Returns the strongest identifier the SDK currently holds, in the same
793
+ * precedence the server resolves by:
794
+ * crossdeckCustomerId (cdcust_…) > developerUserId > anonymousId
795
+ * anonymousId is always present, so this always returns a usable,
796
+ * non-empty reference — even before identify(). Identify the user as
797
+ * early as you can, though, so the reference is their stable identity
798
+ * and not a per-device anon id.
799
+ */
800
+ getCheckoutReference(): string;
751
801
  private requireStarted;
752
802
  /**
753
803
  * Build the identity query for /v1/entitlements. Priority:
@@ -886,7 +936,7 @@ declare class MemoryStorage implements KeyValueStorage {
886
936
  *
887
937
  * Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
888
938
  */
889
- declare const SDK_VERSION = "1.5.7";
939
+ declare const SDK_VERSION = "1.6.2";
890
940
  declare const SDK_NAME = "@cross-deck/web";
891
941
 
892
942
  /**
package/dist/index.d.ts CHANGED
@@ -194,6 +194,21 @@ interface Contract {
194
194
  readonly firstRegisteredIn: string;
195
195
  /** The SDK release this snapshot was bundled with, stamped at build time. */
196
196
  readonly bundledIn: string;
197
+ /**
198
+ * Whether THIS SDK self-verifies this contract at runtime (a verifier is
199
+ * registered in the SDK's `STATIC_VERIFIERS` harness, emitting
200
+ * `crossdeck.contract_failed` live), vs. proven by CI tests only.
201
+ *
202
+ * DERIVED at bundle time from the verifier registry — never hand-set —
203
+ * so the registry can never disagree with what actually runs. Runtime
204
+ * status is a property of (contract × SDK): the same contract can be
205
+ * `true` here (web) and `false` in another SDK that lacks the harness.
206
+ *
207
+ * `true` → surfaces in the console as "watch it pass live".
208
+ * `false` → "CI-proven every release" (still enforced, just not a
209
+ * live toggle on this platform).
210
+ */
211
+ readonly runtimeVerified: boolean;
197
212
  }
198
213
  /**
199
214
  * Typed entry point to the bank-grade contracts bundled with this
@@ -232,9 +247,9 @@ declare const CrossdeckContracts: {
232
247
  /** Filter by lifecycle status. */
233
248
  readonly withStatus: (status: ContractStatus) => readonly Contract[];
234
249
  /** Semver of the SDK release these contracts were bundled with. */
235
- readonly sdkVersion: "1.5.7";
250
+ readonly sdkVersion: "1.6.2";
236
251
  /** Fully-qualified bundle identifier — e.g. `@cross-deck/web@1.4.2`. */
237
- readonly bundledIn: "@cross-deck/web@1.5.7";
252
+ readonly bundledIn: "@cross-deck/web@1.6.2";
238
253
  /**
239
254
  * Resolve a failing test back to the contract it exercises.
240
255
  * Used by test-framework hooks (Vitest `afterEach`, XCTest
@@ -634,6 +649,12 @@ declare class CrossdeckClient {
634
649
  * true even before the session's first network round-trip. Returns
635
650
  * false only for a genuinely new install that has never completed a
636
651
  * getEntitlements(), or for an entitlement past its own validUntil.
652
+ *
653
+ * Throws `not_initialized` (CrossdeckError, type
654
+ * `configuration_error`) if called before `Crossdeck.init()`. The
655
+ * `useEntitlement` React hook and the Vue composable both swallow
656
+ * this and return `false`; bare callers must guard for it (or call
657
+ * after `init()` resolves).
637
658
  */
638
659
  isEntitled(key: string): boolean;
639
660
  /** Snapshot of the local entitlement cache. */
@@ -643,8 +664,21 @@ declare class CrossdeckClient {
643
664
  *
644
665
  * The listener is invoked AFTER the cache mutates — once after a
645
666
  * 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.
667
+ * delivers fresh entitlements, once on `reset()` to fire the empty-
668
+ * cache state for logout flows, AND once on `identify()` after the
669
+ * per-user cache slot rotates and re-hydrates from device storage.
670
+ *
671
+ * IMPORTANT — the `identify()` fire is a TRAP if you treat it as
672
+ * authoritative network state. `identify()` does NOT fetch entitlements;
673
+ * it switches the per-user cache slot and rehydrates from device
674
+ * storage (which is empty for a brand-new install, and last-known-good
675
+ * — possibly stale — for a returning user). A listener that gates a
676
+ * paywall on the first fire after an identity switch will read
677
+ * `false` for a paying customer on a fresh device and let them past
678
+ * the gate as free. The network-truth fire is the one that follows
679
+ * the next `getEntitlements()` resolution. Either call
680
+ * `getEntitlements()` explicitly after `identify()`, or have your
681
+ * gating code tolerate the empty-then-populated transition.
648
682
  *
649
683
  * It is NOT invoked synchronously on subscribe. Callers that need
650
684
  * the current state should read it via `isEntitled()` / `listEntitlements()`
@@ -748,6 +782,22 @@ declare class CrossdeckClient {
748
782
  * `entitlements`. Pre-start values are sensible empties.
749
783
  */
750
784
  diagnostics(): Diagnostics;
785
+ /**
786
+ * The stable reference to hand Stripe at checkout so the resulting
787
+ * purchase attributes to THIS person. Stamp it on the Checkout Session
788
+ * as `metadata.crossdeck_ref` (see docs/connect-stripe) — the platform
789
+ * webhook reads it back, validates it, and attaches the subscription to
790
+ * the right customer instead of stranding it on an anonymous record.
791
+ *
792
+ * Returns the strongest identifier the SDK currently holds, in the same
793
+ * precedence the server resolves by:
794
+ * crossdeckCustomerId (cdcust_…) > developerUserId > anonymousId
795
+ * anonymousId is always present, so this always returns a usable,
796
+ * non-empty reference — even before identify(). Identify the user as
797
+ * early as you can, though, so the reference is their stable identity
798
+ * and not a per-device anon id.
799
+ */
800
+ getCheckoutReference(): string;
751
801
  private requireStarted;
752
802
  /**
753
803
  * Build the identity query for /v1/entitlements. Priority:
@@ -886,7 +936,7 @@ declare class MemoryStorage implements KeyValueStorage {
886
936
  *
887
937
  * Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
888
938
  */
889
- declare const SDK_VERSION = "1.5.7";
939
+ declare const SDK_VERSION = "1.6.2";
890
940
  declare const SDK_NAME = "@cross-deck/web";
891
941
 
892
942
  /**