@cross-deck/web 1.5.2 → 1.5.3

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.
@@ -42,6 +42,10 @@ interface PurchaseResult {
42
42
  crossdeckCustomerId: string;
43
43
  env: Environment;
44
44
  entitlements: PublicEntitlement[];
45
+ /** True when the response came from the backend's idempotency
46
+ * cache instead of fresh processing. Backend also returns
47
+ * `Idempotent-Replayed: true` as a response header (v1.4.0). */
48
+ idempotent_replay?: boolean;
45
49
  }
46
50
  interface HeartbeatResponse {
47
51
  object: "heartbeat";
@@ -156,6 +160,77 @@ interface CrossdeckOptions {
156
160
  * raw strings.
157
161
  */
158
162
  scrubPii?: boolean;
163
+ /**
164
+ * Run the contract self-verification suite at SDK boot. Defaults
165
+ * to `true` in development (`process.env.NODE_ENV !== "production"`),
166
+ * `false` in production. Pass `true` explicitly to opt-in for
167
+ * production (e.g. during a staging soak); pass `false` to silence
168
+ * the boot self-test in development.
169
+ *
170
+ * What this is: the boot self-test runs every applicable runtime
171
+ * verifier against an isolated test context — `EntitlementCache`,
172
+ * `deriveIdempotencyKeyForPurchase`, `crossdeckErrorFromResponse`,
173
+ * etc. are exercised against synthetic state. The customer's real
174
+ * SDK state is never mutated. The output proves at runtime that
175
+ * the platform's structural guarantees — per-user cache isolation,
176
+ * idempotency-key determinism, error-envelope shape, payload
177
+ * schema-lock — actually hold, not just in Crossdeck's CI.
178
+ * See `docs/contracts/index.html` for the full ledger.
179
+ *
180
+ * Boot-time PASS results print to the console iff
181
+ * `logVerifierResults` is `true`. Boot-time FAIL results ALWAYS
182
+ * print at WARN and fire `reportContractFailure(...)` to
183
+ * Crossdeck's reliability channel (with `verification_phase: "boot"`)
184
+ * — silencing a boot failure would defeat the purpose, since a
185
+ * structural break at boot means the SDK is broken before the
186
+ * customer's first user even taps. To stop the failure reporting,
187
+ * use `disableContractAssertions: true`. To stop the console
188
+ * passes, use `logVerifierResults: false`. The flags are
189
+ * independent.
190
+ */
191
+ verifyContractsAtBoot?: boolean;
192
+ /**
193
+ * Whether to print PASS results from the contract verifier layer
194
+ * to the console (`[crossdeck.identify] ✓ per-user-cache-isolation
195
+ * — slot rotated …`). Defaults to `true` in development, `false`
196
+ * in production.
197
+ *
198
+ * Cosmetic flag — controls console output only. Failure reporting
199
+ * to Crossdeck's reliability channel is NOT affected by this flag;
200
+ * a contract violation always prints at WARN and always fires
201
+ * `reportContractFailure(...)` regardless. To stop the reliability
202
+ * reporting, use `disableContractAssertions: true` instead.
203
+ *
204
+ * Pass `true` in a staging or QA build to verify the SDK is
205
+ * honouring its own contracts as your engineer exercises the app
206
+ * — every `identify()`, `track()`, `syncPurchases()` will stream
207
+ * a verifier line through the browser devtools console.
208
+ */
209
+ logVerifierResults?: boolean;
210
+ /**
211
+ * Disable the entire contract verifier + failure-reporting layer.
212
+ * Default `false`.
213
+ *
214
+ * When `false` (default): verifiers run on every hot-path SDK
215
+ * operation (identify / track / syncPurchases / isEntitled / error
216
+ * parse). PASS results are silent unless `logVerifierResults` is
217
+ * `true`. FAIL results always print at WARN AND fire
218
+ * `reportContractFailure(...)` to Crossdeck's reliability endpoint
219
+ * over a single-fire one-way path. This is the independent-
220
+ * controller flow described in Privacy Policy §6 ("Flow B"); the
221
+ * payload is schema-locked to contain no end-user identifiers.
222
+ *
223
+ * When `true`: every verifier is disabled. The runtime continues
224
+ * to behave correctly — verifiers are observers, not assertions
225
+ * — but the verification + reporting layer is silent end-to-end.
226
+ * No console output, no telemetry, no reliability-channel writes.
227
+ *
228
+ * Use this only if your sovereignty posture forbids any outbound
229
+ * diagnostic telemetry to third-party controllers. This is NOT
230
+ * the right tool for silencing the console — for that, set
231
+ * `logVerifierResults: false` and leave this flag untouched.
232
+ */
233
+ disableContractAssertions?: boolean;
159
234
  }
160
235
  /** Auto-tracking flags. See CrossdeckOptions.autoTrack. */
161
236
  interface AutoTrackOptions {
@@ -42,6 +42,10 @@ interface PurchaseResult {
42
42
  crossdeckCustomerId: string;
43
43
  env: Environment;
44
44
  entitlements: PublicEntitlement[];
45
+ /** True when the response came from the backend's idempotency
46
+ * cache instead of fresh processing. Backend also returns
47
+ * `Idempotent-Replayed: true` as a response header (v1.4.0). */
48
+ idempotent_replay?: boolean;
45
49
  }
46
50
  interface HeartbeatResponse {
47
51
  object: "heartbeat";
@@ -156,6 +160,77 @@ interface CrossdeckOptions {
156
160
  * raw strings.
157
161
  */
158
162
  scrubPii?: boolean;
163
+ /**
164
+ * Run the contract self-verification suite at SDK boot. Defaults
165
+ * to `true` in development (`process.env.NODE_ENV !== "production"`),
166
+ * `false` in production. Pass `true` explicitly to opt-in for
167
+ * production (e.g. during a staging soak); pass `false` to silence
168
+ * the boot self-test in development.
169
+ *
170
+ * What this is: the boot self-test runs every applicable runtime
171
+ * verifier against an isolated test context — `EntitlementCache`,
172
+ * `deriveIdempotencyKeyForPurchase`, `crossdeckErrorFromResponse`,
173
+ * etc. are exercised against synthetic state. The customer's real
174
+ * SDK state is never mutated. The output proves at runtime that
175
+ * the platform's structural guarantees — per-user cache isolation,
176
+ * idempotency-key determinism, error-envelope shape, payload
177
+ * schema-lock — actually hold, not just in Crossdeck's CI.
178
+ * See `docs/contracts/index.html` for the full ledger.
179
+ *
180
+ * Boot-time PASS results print to the console iff
181
+ * `logVerifierResults` is `true`. Boot-time FAIL results ALWAYS
182
+ * print at WARN and fire `reportContractFailure(...)` to
183
+ * Crossdeck's reliability channel (with `verification_phase: "boot"`)
184
+ * — silencing a boot failure would defeat the purpose, since a
185
+ * structural break at boot means the SDK is broken before the
186
+ * customer's first user even taps. To stop the failure reporting,
187
+ * use `disableContractAssertions: true`. To stop the console
188
+ * passes, use `logVerifierResults: false`. The flags are
189
+ * independent.
190
+ */
191
+ verifyContractsAtBoot?: boolean;
192
+ /**
193
+ * Whether to print PASS results from the contract verifier layer
194
+ * to the console (`[crossdeck.identify] ✓ per-user-cache-isolation
195
+ * — slot rotated …`). Defaults to `true` in development, `false`
196
+ * in production.
197
+ *
198
+ * Cosmetic flag — controls console output only. Failure reporting
199
+ * to Crossdeck's reliability channel is NOT affected by this flag;
200
+ * a contract violation always prints at WARN and always fires
201
+ * `reportContractFailure(...)` regardless. To stop the reliability
202
+ * reporting, use `disableContractAssertions: true` instead.
203
+ *
204
+ * Pass `true` in a staging or QA build to verify the SDK is
205
+ * honouring its own contracts as your engineer exercises the app
206
+ * — every `identify()`, `track()`, `syncPurchases()` will stream
207
+ * a verifier line through the browser devtools console.
208
+ */
209
+ logVerifierResults?: boolean;
210
+ /**
211
+ * Disable the entire contract verifier + failure-reporting layer.
212
+ * Default `false`.
213
+ *
214
+ * When `false` (default): verifiers run on every hot-path SDK
215
+ * operation (identify / track / syncPurchases / isEntitled / error
216
+ * parse). PASS results are silent unless `logVerifierResults` is
217
+ * `true`. FAIL results always print at WARN AND fire
218
+ * `reportContractFailure(...)` to Crossdeck's reliability endpoint
219
+ * over a single-fire one-way path. This is the independent-
220
+ * controller flow described in Privacy Policy §6 ("Flow B"); the
221
+ * payload is schema-locked to contain no end-user identifiers.
222
+ *
223
+ * When `true`: every verifier is disabled. The runtime continues
224
+ * to behave correctly — verifiers are observers, not assertions
225
+ * — but the verification + reporting layer is silent end-to-end.
226
+ * No console output, no telemetry, no reliability-channel writes.
227
+ *
228
+ * Use this only if your sovereignty posture forbids any outbound
229
+ * diagnostic telemetry to third-party controllers. This is NOT
230
+ * the right tool for silencing the console — for that, set
231
+ * `logVerifierResults: false` and leave this flag untouched.
232
+ */
233
+ disableContractAssertions?: boolean;
159
234
  }
160
235
  /** Auto-tracking flags. See CrossdeckOptions.autoTrack. */
161
236
  interface AutoTrackOptions {