@cross-deck/web 1.5.1 → 1.5.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/crossdeck.umd.min.js +2 -2
- package/dist/crossdeck.umd.min.js.map +1 -1
- package/dist/error-codes.json +1 -106
- package/dist/index.cjs +22 -940
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +4 -177
- package/dist/index.d.ts +4 -177
- package/dist/index.mjs +22 -939
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +22 -404
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.mjs +22 -404
- package/dist/react.mjs.map +1 -1
- package/dist/{types-Bu3jbmdq.d.mts → types-BzoKor4z.d.mts} +0 -4
- package/dist/{types-Bu3jbmdq.d.ts → types-BzoKor4z.d.ts} +0 -4
- package/dist/vue.cjs +22 -404
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.mjs +22 -404
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/contracts 2.json +0 -378
- package/dist/contracts.json +0 -378
- package/dist/crossdeck.umd.min 2.js +0 -3
- package/dist/crossdeck.umd.min.js 2.map +0 -1
- package/dist/error-codes 2.json +0 -196
- package/dist/index 2.cjs +0 -4778
- package/dist/index 2.mjs +0 -4742
- package/dist/index.cjs 2.map +0 -1
- package/dist/index.d 2.mts +0 -938
- package/dist/index.d 2.ts +0 -938
- package/dist/index.mjs 2.map +0 -1
- package/dist/react 2.cjs +0 -4220
- package/dist/react 2.mjs +0 -4193
- package/dist/react.cjs 2.map +0 -1
- package/dist/react.d 2.mts +0 -91
- package/dist/react.d 2.ts +0 -91
- package/dist/react.mjs 2.map +0 -1
- package/dist/types-Bu3jbmdq.d 2.mts +0 -314
- package/dist/types-Bu3jbmdq.d 2.ts +0 -314
- package/dist/vue 2.cjs +0 -4185
- package/dist/vue 2.mjs +0 -4159
- package/dist/vue.cjs 2.map +0 -1
- package/dist/vue.d 2.mts +0 -37
- package/dist/vue.d 2.ts +0 -37
- package/dist/vue.mjs 2.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PublicEntitlement, C as CrossdeckOptions, I as IdentifyOptions, A as AliasResult, G as GroupTraits, E as EventProperties, a as PurchaseResult, H as HeartbeatResponse, D as Diagnostics, K as KeyValueStorage } from './types-
|
|
2
|
-
export { b as AuditRail, c as AutoTrackOptions, d as EntitlementsListResponse, e as Environment, f as Platform } from './types-
|
|
1
|
+
import { P as PublicEntitlement, C as CrossdeckOptions, I as IdentifyOptions, A as AliasResult, G as GroupTraits, E as EventProperties, a as PurchaseResult, H as HeartbeatResponse, D as Diagnostics, K as KeyValueStorage } from './types-BzoKor4z.mjs';
|
|
2
|
+
export { b as AuditRail, c as AutoTrackOptions, d as EntitlementsListResponse, e as Environment, f as Platform } from './types-BzoKor4z.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Durable last-known-good cache of the customer's entitlements.
|
|
@@ -128,167 +128,6 @@ interface Breadcrumb {
|
|
|
128
128
|
data?: Record<string, unknown>;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
/**
|
|
132
|
-
* Public, typed accessor for the bank-grade behavioural contracts
|
|
133
|
-
* this SDK ships. The full architecture — schema, distribution,
|
|
134
|
-
* audit loop, pillar taxonomy — lives in `contracts/README.md`
|
|
135
|
-
* at the monorepo root.
|
|
136
|
-
*
|
|
137
|
-
* Why a typed surface (vs. plain JSON access): contract IDs and
|
|
138
|
-
* pillar names are part of Crossdeck's public commitment to
|
|
139
|
-
* customers. Reading them through `CrossdeckContracts` means the
|
|
140
|
-
* compiler catches drift the moment a contract is renamed or
|
|
141
|
-
* retired. Tools that consume contracts at runtime (dashboards,
|
|
142
|
-
* AI assistants, customer integration tests) get the exact same
|
|
143
|
-
* shape every SDK ships, with no parsing layer to drift.
|
|
144
|
-
*
|
|
145
|
-
* --- BINARY STABILITY ---
|
|
146
|
-
* `Contract` is treated as an evolving — but back-compat — wire
|
|
147
|
-
* shape. Fields may be added in any minor release. Existing
|
|
148
|
-
* fields will not be removed or repurposed except in a major
|
|
149
|
-
* version bump, even if all known contracts stop using them.
|
|
150
|
-
* Customers can rely on `id`, `pillar`, `status`, `appliesTo`,
|
|
151
|
-
* `codeRef`, `testRef`, `registeredAt`, `firstRegisteredIn`,
|
|
152
|
-
* and `bundledIn` being present on every contract in every
|
|
153
|
-
* future minor/patch release of this SDK.
|
|
154
|
-
*/
|
|
155
|
-
/**
|
|
156
|
-
* Which bank-grade pillar a contract belongs to. The taxonomy is
|
|
157
|
-
* deliberately small — every contract maps to exactly one. New
|
|
158
|
-
* pillars require a Crossdeck major-version bump.
|
|
159
|
-
*/
|
|
160
|
-
type ContractPillar = "revenue" | "entitlements" | "analytics" | "webhooks" | "errors" | "lifecycle" | "identity";
|
|
161
|
-
/**
|
|
162
|
-
* Lifecycle stage of a contract.
|
|
163
|
-
* - `enforced`: live in this SDK and exercised by `testRef`.
|
|
164
|
-
* - `proposed`: registered for an upcoming release; `testRef`
|
|
165
|
-
* may point to a not-yet-existing file.
|
|
166
|
-
* - `retired`: kept for history only; the behaviour no longer
|
|
167
|
-
* ships. Filtered out of `CrossdeckContracts.all()` by default.
|
|
168
|
-
*/
|
|
169
|
-
type ContractStatus = "enforced" | "proposed" | "retired";
|
|
170
|
-
/** Which SDKs (and/or `backend`) a contract is binding on. */
|
|
171
|
-
type ContractAppliesTo = "web" | "node" | "react-native" | "swift" | "android" | "backend";
|
|
172
|
-
/**
|
|
173
|
-
* Pointer to the test that exercises a contract clause. The
|
|
174
|
-
* `name` is matched verbatim against the file's text by
|
|
175
|
-
* `scripts/contract-audit.mjs`, so a rename without updating
|
|
176
|
-
* the contract aborts CI.
|
|
177
|
-
*/
|
|
178
|
-
interface ContractTestRef {
|
|
179
|
-
readonly file: string;
|
|
180
|
-
readonly name: string;
|
|
181
|
-
}
|
|
182
|
-
/** One bank-grade behavioural guarantee — see `contracts/README.md`. */
|
|
183
|
-
interface Contract {
|
|
184
|
-
readonly id: string;
|
|
185
|
-
readonly pillar: ContractPillar;
|
|
186
|
-
readonly status: ContractStatus;
|
|
187
|
-
readonly claim: string;
|
|
188
|
-
readonly appliesTo: readonly ContractAppliesTo[];
|
|
189
|
-
readonly codeRef: readonly string[];
|
|
190
|
-
readonly testRef: readonly ContractTestRef[];
|
|
191
|
-
/** ISO-8601 date the contract was first registered. */
|
|
192
|
-
readonly registeredAt: string;
|
|
193
|
-
/** The release note / phase the contract first appeared in. Immutable. */
|
|
194
|
-
readonly firstRegisteredIn: string;
|
|
195
|
-
/** The SDK release this snapshot was bundled with, stamped at build time. */
|
|
196
|
-
readonly bundledIn: string;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Typed entry point to the bank-grade contracts bundled with this
|
|
200
|
-
* SDK release. Stable, side-effect-free, tree-shakeable.
|
|
201
|
-
*
|
|
202
|
-
* @example Audit at app boot
|
|
203
|
-
* ```ts
|
|
204
|
-
* import { CrossdeckContracts } from "@cross-deck/web";
|
|
205
|
-
*
|
|
206
|
-
* for (const c of CrossdeckContracts.all()) {
|
|
207
|
-
* console.log(`[crossdeck] ${c.id} (${c.pillar})`);
|
|
208
|
-
* }
|
|
209
|
-
* ```
|
|
210
|
-
*
|
|
211
|
-
* @example Assert a specific clause is in force
|
|
212
|
-
* ```ts
|
|
213
|
-
* const isolation = CrossdeckContracts.byId("per-user-cache-isolation");
|
|
214
|
-
* if (!isolation || isolation.status !== "enforced") {
|
|
215
|
-
* throw new Error("entitlement isolation contract is not enforced — refusing to start");
|
|
216
|
-
* }
|
|
217
|
-
* ```
|
|
218
|
-
*/
|
|
219
|
-
declare const CrossdeckContracts: {
|
|
220
|
-
/** Every contract that applies to this SDK and is currently enforced. */
|
|
221
|
-
readonly all: () => readonly Contract[];
|
|
222
|
-
/**
|
|
223
|
-
* Every contract bundled with this SDK release, including
|
|
224
|
-
* `proposed` and `retired` entries. Use `all()` for the
|
|
225
|
-
* enforced-only view.
|
|
226
|
-
*/
|
|
227
|
-
readonly allIncludingHistorical: () => readonly Contract[];
|
|
228
|
-
/** Look up a contract by its stable `id`. */
|
|
229
|
-
readonly byId: (id: string) => Contract | undefined;
|
|
230
|
-
/** Every enforced contract within a pillar. */
|
|
231
|
-
readonly byPillar: (pillar: ContractPillar) => readonly Contract[];
|
|
232
|
-
/** Filter by lifecycle status. */
|
|
233
|
-
readonly withStatus: (status: ContractStatus) => readonly Contract[];
|
|
234
|
-
/** Semver of the SDK release these contracts were bundled with. */
|
|
235
|
-
readonly sdkVersion: "1.5.0";
|
|
236
|
-
/** Fully-qualified bundle identifier — e.g. `@cross-deck/web@1.4.2`. */
|
|
237
|
-
readonly bundledIn: "@cross-deck/web@1.5.0";
|
|
238
|
-
/**
|
|
239
|
-
* Resolve a failing test back to the contract it exercises.
|
|
240
|
-
* Used by test-framework hooks (Vitest `afterEach`, XCTest
|
|
241
|
-
* observation, JUnit `TestWatcher`) to find the contract id of
|
|
242
|
-
* a failed contract test so `reportContractFailure(...)` can
|
|
243
|
-
* stamp the right `contract_id` on the emitted event.
|
|
244
|
-
*
|
|
245
|
-
* Match is on `testRef.name` (case-sensitive, exact). Returns
|
|
246
|
-
* the first contract whose `testRef` list contains a matching
|
|
247
|
-
* entry, regardless of pillar or status.
|
|
248
|
-
*/
|
|
249
|
-
readonly findByTestName: (name: string) => Contract | undefined;
|
|
250
|
-
};
|
|
251
|
-
/**
|
|
252
|
-
* Input to {@link Crossdeck.reportContractFailure}. Lets a test
|
|
253
|
-
* harness / dogfood app / customer integration report a contract
|
|
254
|
-
* violation back to Crossdeck through the standard `track()` API
|
|
255
|
-
* with a typed property bag — no new ingest endpoint, no bespoke
|
|
256
|
-
* code, just a `crossdeck.contract_failed` custom event.
|
|
257
|
-
*
|
|
258
|
-
* `sdk_version` and `sdk_platform` are auto-stamped by the SDK so
|
|
259
|
-
* every emitted event carries them correctly without the caller
|
|
260
|
-
* needing to read them out of `CrossdeckContracts.sdkVersion`.
|
|
261
|
-
*/
|
|
262
|
-
interface ContractFailureInput {
|
|
263
|
-
/** Stable contract id (`per-user-cache-isolation` etc.). */
|
|
264
|
-
contractId: string;
|
|
265
|
-
/** Human-readable failure reason — the assertion message. */
|
|
266
|
-
failureReason: string;
|
|
267
|
-
/**
|
|
268
|
-
* Where the failure was observed:
|
|
269
|
-
* - `ci` — the SDK's own test suite on CI
|
|
270
|
-
* - `dogfood` — Crossdeck's internal dogfood project
|
|
271
|
-
* - `customer-app` — a customer's app verifying contracts
|
|
272
|
-
*/
|
|
273
|
-
runContext: "ci" | "dogfood" | "customer-app";
|
|
274
|
-
/**
|
|
275
|
-
* Stable identifier for this verification run. CI: `GITHUB_RUN_ID`
|
|
276
|
-
* or equivalent. Dogfood: per-launch UUID. Customer app: any
|
|
277
|
-
* stable handle the customer chooses to group fires by run.
|
|
278
|
-
*/
|
|
279
|
-
runId: string;
|
|
280
|
-
/**
|
|
281
|
-
* Optional pointer back to the failing test, for triage. The SDK
|
|
282
|
-
* sends both `test_file` and `test_name` on the wire when set.
|
|
283
|
-
*/
|
|
284
|
-
testRef?: {
|
|
285
|
-
file: string;
|
|
286
|
-
name: string;
|
|
287
|
-
};
|
|
288
|
-
/** Optional extra properties merged into the event payload. */
|
|
289
|
-
extra?: Record<string, unknown>;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
131
|
/**
|
|
293
132
|
* Stack-trace parser — normalises Chrome / Firefox / Safari / Edge
|
|
294
133
|
* stack strings into a common frame shape.
|
|
@@ -639,18 +478,6 @@ declare class CrossdeckClient {
|
|
|
639
478
|
* trip happens in the background. To flush before the page unloads,
|
|
640
479
|
* call flush().
|
|
641
480
|
*/
|
|
642
|
-
/**
|
|
643
|
-
* Emit `crossdeck.contract_failed` with the canonical property
|
|
644
|
-
* shape (`contract_id`, `sdk_version`, `sdk_platform`,
|
|
645
|
-
* `failure_reason`, `run_context`, `run_id`). Goes through the
|
|
646
|
-
* standard track() pipeline — same consent gate, same queue,
|
|
647
|
-
* same ingest, no new endpoint.
|
|
648
|
-
*
|
|
649
|
-
* Wire the call from a test hook, dogfood failure path, or
|
|
650
|
-
* customer contract-verification harness; see
|
|
651
|
-
* `contracts/README.md` for the per-test-framework hook recipes.
|
|
652
|
-
*/
|
|
653
|
-
reportContractFailure(input: ContractFailureInput): void;
|
|
654
481
|
track(name: string, properties?: EventProperties): void;
|
|
655
482
|
/**
|
|
656
483
|
* Force-flush queued events. Useful to call from page-unload handlers.
|
|
@@ -851,7 +678,7 @@ declare class MemoryStorage implements KeyValueStorage {
|
|
|
851
678
|
*
|
|
852
679
|
* Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
|
|
853
680
|
*/
|
|
854
|
-
declare const SDK_VERSION = "1.
|
|
681
|
+
declare const SDK_VERSION = "1.3.0";
|
|
855
682
|
declare const SDK_NAME = "@cross-deck/web";
|
|
856
683
|
|
|
857
684
|
/**
|
|
@@ -935,4 +762,4 @@ interface DeviceInfo {
|
|
|
935
762
|
appVersion?: string;
|
|
936
763
|
}
|
|
937
764
|
|
|
938
|
-
export { AliasResult, type Breadcrumb, type BreadcrumbCategory, type BreadcrumbLevel, CROSSDECK_ERROR_CODES, type CapturedError, type ConsentState,
|
|
765
|
+
export { AliasResult, type Breadcrumb, type BreadcrumbCategory, type BreadcrumbLevel, CROSSDECK_ERROR_CODES, type CapturedError, type ConsentState, Crossdeck, CrossdeckClient, CrossdeckError, type CrossdeckErrorPayload, type CrossdeckErrorType, CrossdeckOptions, DEFAULT_BASE_URL, type DeviceInfo, Diagnostics, type ErrorCodeEntry, type ErrorLevel, EventProperties, GroupTraits, HeartbeatResponse, IdentifyOptions, KeyValueStorage, MemoryStorage, PublicEntitlement, PurchaseResult, SDK_NAME, SDK_VERSION, type StackFrame, getErrorCode };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PublicEntitlement, C as CrossdeckOptions, I as IdentifyOptions, A as AliasResult, G as GroupTraits, E as EventProperties, a as PurchaseResult, H as HeartbeatResponse, D as Diagnostics, K as KeyValueStorage } from './types-
|
|
2
|
-
export { b as AuditRail, c as AutoTrackOptions, d as EntitlementsListResponse, e as Environment, f as Platform } from './types-
|
|
1
|
+
import { P as PublicEntitlement, C as CrossdeckOptions, I as IdentifyOptions, A as AliasResult, G as GroupTraits, E as EventProperties, a as PurchaseResult, H as HeartbeatResponse, D as Diagnostics, K as KeyValueStorage } from './types-BzoKor4z.js';
|
|
2
|
+
export { b as AuditRail, c as AutoTrackOptions, d as EntitlementsListResponse, e as Environment, f as Platform } from './types-BzoKor4z.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Durable last-known-good cache of the customer's entitlements.
|
|
@@ -128,167 +128,6 @@ interface Breadcrumb {
|
|
|
128
128
|
data?: Record<string, unknown>;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
/**
|
|
132
|
-
* Public, typed accessor for the bank-grade behavioural contracts
|
|
133
|
-
* this SDK ships. The full architecture — schema, distribution,
|
|
134
|
-
* audit loop, pillar taxonomy — lives in `contracts/README.md`
|
|
135
|
-
* at the monorepo root.
|
|
136
|
-
*
|
|
137
|
-
* Why a typed surface (vs. plain JSON access): contract IDs and
|
|
138
|
-
* pillar names are part of Crossdeck's public commitment to
|
|
139
|
-
* customers. Reading them through `CrossdeckContracts` means the
|
|
140
|
-
* compiler catches drift the moment a contract is renamed or
|
|
141
|
-
* retired. Tools that consume contracts at runtime (dashboards,
|
|
142
|
-
* AI assistants, customer integration tests) get the exact same
|
|
143
|
-
* shape every SDK ships, with no parsing layer to drift.
|
|
144
|
-
*
|
|
145
|
-
* --- BINARY STABILITY ---
|
|
146
|
-
* `Contract` is treated as an evolving — but back-compat — wire
|
|
147
|
-
* shape. Fields may be added in any minor release. Existing
|
|
148
|
-
* fields will not be removed or repurposed except in a major
|
|
149
|
-
* version bump, even if all known contracts stop using them.
|
|
150
|
-
* Customers can rely on `id`, `pillar`, `status`, `appliesTo`,
|
|
151
|
-
* `codeRef`, `testRef`, `registeredAt`, `firstRegisteredIn`,
|
|
152
|
-
* and `bundledIn` being present on every contract in every
|
|
153
|
-
* future minor/patch release of this SDK.
|
|
154
|
-
*/
|
|
155
|
-
/**
|
|
156
|
-
* Which bank-grade pillar a contract belongs to. The taxonomy is
|
|
157
|
-
* deliberately small — every contract maps to exactly one. New
|
|
158
|
-
* pillars require a Crossdeck major-version bump.
|
|
159
|
-
*/
|
|
160
|
-
type ContractPillar = "revenue" | "entitlements" | "analytics" | "webhooks" | "errors" | "lifecycle" | "identity";
|
|
161
|
-
/**
|
|
162
|
-
* Lifecycle stage of a contract.
|
|
163
|
-
* - `enforced`: live in this SDK and exercised by `testRef`.
|
|
164
|
-
* - `proposed`: registered for an upcoming release; `testRef`
|
|
165
|
-
* may point to a not-yet-existing file.
|
|
166
|
-
* - `retired`: kept for history only; the behaviour no longer
|
|
167
|
-
* ships. Filtered out of `CrossdeckContracts.all()` by default.
|
|
168
|
-
*/
|
|
169
|
-
type ContractStatus = "enforced" | "proposed" | "retired";
|
|
170
|
-
/** Which SDKs (and/or `backend`) a contract is binding on. */
|
|
171
|
-
type ContractAppliesTo = "web" | "node" | "react-native" | "swift" | "android" | "backend";
|
|
172
|
-
/**
|
|
173
|
-
* Pointer to the test that exercises a contract clause. The
|
|
174
|
-
* `name` is matched verbatim against the file's text by
|
|
175
|
-
* `scripts/contract-audit.mjs`, so a rename without updating
|
|
176
|
-
* the contract aborts CI.
|
|
177
|
-
*/
|
|
178
|
-
interface ContractTestRef {
|
|
179
|
-
readonly file: string;
|
|
180
|
-
readonly name: string;
|
|
181
|
-
}
|
|
182
|
-
/** One bank-grade behavioural guarantee — see `contracts/README.md`. */
|
|
183
|
-
interface Contract {
|
|
184
|
-
readonly id: string;
|
|
185
|
-
readonly pillar: ContractPillar;
|
|
186
|
-
readonly status: ContractStatus;
|
|
187
|
-
readonly claim: string;
|
|
188
|
-
readonly appliesTo: readonly ContractAppliesTo[];
|
|
189
|
-
readonly codeRef: readonly string[];
|
|
190
|
-
readonly testRef: readonly ContractTestRef[];
|
|
191
|
-
/** ISO-8601 date the contract was first registered. */
|
|
192
|
-
readonly registeredAt: string;
|
|
193
|
-
/** The release note / phase the contract first appeared in. Immutable. */
|
|
194
|
-
readonly firstRegisteredIn: string;
|
|
195
|
-
/** The SDK release this snapshot was bundled with, stamped at build time. */
|
|
196
|
-
readonly bundledIn: string;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Typed entry point to the bank-grade contracts bundled with this
|
|
200
|
-
* SDK release. Stable, side-effect-free, tree-shakeable.
|
|
201
|
-
*
|
|
202
|
-
* @example Audit at app boot
|
|
203
|
-
* ```ts
|
|
204
|
-
* import { CrossdeckContracts } from "@cross-deck/web";
|
|
205
|
-
*
|
|
206
|
-
* for (const c of CrossdeckContracts.all()) {
|
|
207
|
-
* console.log(`[crossdeck] ${c.id} (${c.pillar})`);
|
|
208
|
-
* }
|
|
209
|
-
* ```
|
|
210
|
-
*
|
|
211
|
-
* @example Assert a specific clause is in force
|
|
212
|
-
* ```ts
|
|
213
|
-
* const isolation = CrossdeckContracts.byId("per-user-cache-isolation");
|
|
214
|
-
* if (!isolation || isolation.status !== "enforced") {
|
|
215
|
-
* throw new Error("entitlement isolation contract is not enforced — refusing to start");
|
|
216
|
-
* }
|
|
217
|
-
* ```
|
|
218
|
-
*/
|
|
219
|
-
declare const CrossdeckContracts: {
|
|
220
|
-
/** Every contract that applies to this SDK and is currently enforced. */
|
|
221
|
-
readonly all: () => readonly Contract[];
|
|
222
|
-
/**
|
|
223
|
-
* Every contract bundled with this SDK release, including
|
|
224
|
-
* `proposed` and `retired` entries. Use `all()` for the
|
|
225
|
-
* enforced-only view.
|
|
226
|
-
*/
|
|
227
|
-
readonly allIncludingHistorical: () => readonly Contract[];
|
|
228
|
-
/** Look up a contract by its stable `id`. */
|
|
229
|
-
readonly byId: (id: string) => Contract | undefined;
|
|
230
|
-
/** Every enforced contract within a pillar. */
|
|
231
|
-
readonly byPillar: (pillar: ContractPillar) => readonly Contract[];
|
|
232
|
-
/** Filter by lifecycle status. */
|
|
233
|
-
readonly withStatus: (status: ContractStatus) => readonly Contract[];
|
|
234
|
-
/** Semver of the SDK release these contracts were bundled with. */
|
|
235
|
-
readonly sdkVersion: "1.5.0";
|
|
236
|
-
/** Fully-qualified bundle identifier — e.g. `@cross-deck/web@1.4.2`. */
|
|
237
|
-
readonly bundledIn: "@cross-deck/web@1.5.0";
|
|
238
|
-
/**
|
|
239
|
-
* Resolve a failing test back to the contract it exercises.
|
|
240
|
-
* Used by test-framework hooks (Vitest `afterEach`, XCTest
|
|
241
|
-
* observation, JUnit `TestWatcher`) to find the contract id of
|
|
242
|
-
* a failed contract test so `reportContractFailure(...)` can
|
|
243
|
-
* stamp the right `contract_id` on the emitted event.
|
|
244
|
-
*
|
|
245
|
-
* Match is on `testRef.name` (case-sensitive, exact). Returns
|
|
246
|
-
* the first contract whose `testRef` list contains a matching
|
|
247
|
-
* entry, regardless of pillar or status.
|
|
248
|
-
*/
|
|
249
|
-
readonly findByTestName: (name: string) => Contract | undefined;
|
|
250
|
-
};
|
|
251
|
-
/**
|
|
252
|
-
* Input to {@link Crossdeck.reportContractFailure}. Lets a test
|
|
253
|
-
* harness / dogfood app / customer integration report a contract
|
|
254
|
-
* violation back to Crossdeck through the standard `track()` API
|
|
255
|
-
* with a typed property bag — no new ingest endpoint, no bespoke
|
|
256
|
-
* code, just a `crossdeck.contract_failed` custom event.
|
|
257
|
-
*
|
|
258
|
-
* `sdk_version` and `sdk_platform` are auto-stamped by the SDK so
|
|
259
|
-
* every emitted event carries them correctly without the caller
|
|
260
|
-
* needing to read them out of `CrossdeckContracts.sdkVersion`.
|
|
261
|
-
*/
|
|
262
|
-
interface ContractFailureInput {
|
|
263
|
-
/** Stable contract id (`per-user-cache-isolation` etc.). */
|
|
264
|
-
contractId: string;
|
|
265
|
-
/** Human-readable failure reason — the assertion message. */
|
|
266
|
-
failureReason: string;
|
|
267
|
-
/**
|
|
268
|
-
* Where the failure was observed:
|
|
269
|
-
* - `ci` — the SDK's own test suite on CI
|
|
270
|
-
* - `dogfood` — Crossdeck's internal dogfood project
|
|
271
|
-
* - `customer-app` — a customer's app verifying contracts
|
|
272
|
-
*/
|
|
273
|
-
runContext: "ci" | "dogfood" | "customer-app";
|
|
274
|
-
/**
|
|
275
|
-
* Stable identifier for this verification run. CI: `GITHUB_RUN_ID`
|
|
276
|
-
* or equivalent. Dogfood: per-launch UUID. Customer app: any
|
|
277
|
-
* stable handle the customer chooses to group fires by run.
|
|
278
|
-
*/
|
|
279
|
-
runId: string;
|
|
280
|
-
/**
|
|
281
|
-
* Optional pointer back to the failing test, for triage. The SDK
|
|
282
|
-
* sends both `test_file` and `test_name` on the wire when set.
|
|
283
|
-
*/
|
|
284
|
-
testRef?: {
|
|
285
|
-
file: string;
|
|
286
|
-
name: string;
|
|
287
|
-
};
|
|
288
|
-
/** Optional extra properties merged into the event payload. */
|
|
289
|
-
extra?: Record<string, unknown>;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
131
|
/**
|
|
293
132
|
* Stack-trace parser — normalises Chrome / Firefox / Safari / Edge
|
|
294
133
|
* stack strings into a common frame shape.
|
|
@@ -639,18 +478,6 @@ declare class CrossdeckClient {
|
|
|
639
478
|
* trip happens in the background. To flush before the page unloads,
|
|
640
479
|
* call flush().
|
|
641
480
|
*/
|
|
642
|
-
/**
|
|
643
|
-
* Emit `crossdeck.contract_failed` with the canonical property
|
|
644
|
-
* shape (`contract_id`, `sdk_version`, `sdk_platform`,
|
|
645
|
-
* `failure_reason`, `run_context`, `run_id`). Goes through the
|
|
646
|
-
* standard track() pipeline — same consent gate, same queue,
|
|
647
|
-
* same ingest, no new endpoint.
|
|
648
|
-
*
|
|
649
|
-
* Wire the call from a test hook, dogfood failure path, or
|
|
650
|
-
* customer contract-verification harness; see
|
|
651
|
-
* `contracts/README.md` for the per-test-framework hook recipes.
|
|
652
|
-
*/
|
|
653
|
-
reportContractFailure(input: ContractFailureInput): void;
|
|
654
481
|
track(name: string, properties?: EventProperties): void;
|
|
655
482
|
/**
|
|
656
483
|
* Force-flush queued events. Useful to call from page-unload handlers.
|
|
@@ -851,7 +678,7 @@ declare class MemoryStorage implements KeyValueStorage {
|
|
|
851
678
|
*
|
|
852
679
|
* Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
|
|
853
680
|
*/
|
|
854
|
-
declare const SDK_VERSION = "1.
|
|
681
|
+
declare const SDK_VERSION = "1.3.0";
|
|
855
682
|
declare const SDK_NAME = "@cross-deck/web";
|
|
856
683
|
|
|
857
684
|
/**
|
|
@@ -935,4 +762,4 @@ interface DeviceInfo {
|
|
|
935
762
|
appVersion?: string;
|
|
936
763
|
}
|
|
937
764
|
|
|
938
|
-
export { AliasResult, type Breadcrumb, type BreadcrumbCategory, type BreadcrumbLevel, CROSSDECK_ERROR_CODES, type CapturedError, type ConsentState,
|
|
765
|
+
export { AliasResult, type Breadcrumb, type BreadcrumbCategory, type BreadcrumbLevel, CROSSDECK_ERROR_CODES, type CapturedError, type ConsentState, Crossdeck, CrossdeckClient, CrossdeckError, type CrossdeckErrorPayload, type CrossdeckErrorType, CrossdeckOptions, DEFAULT_BASE_URL, type DeviceInfo, Diagnostics, type ErrorCodeEntry, type ErrorLevel, EventProperties, GroupTraits, HeartbeatResponse, IdentifyOptions, KeyValueStorage, MemoryStorage, PublicEntitlement, PurchaseResult, SDK_NAME, SDK_VERSION, type StackFrame, getErrorCode };
|