@cross-deck/react-native 1.0.0 → 1.5.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/CHANGELOG.md +97 -0
- package/README.md +67 -0
- package/dist/contracts.json +493 -0
- package/dist/index.cjs +1051 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +177 -2
- package/dist/index.d.ts +177 -2
- package/dist/index.mjs +1057 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -58,6 +58,10 @@ interface PurchaseResult {
|
|
|
58
58
|
crossdeckCustomerId: string;
|
|
59
59
|
env: Environment;
|
|
60
60
|
entitlements: PublicEntitlement[];
|
|
61
|
+
/** True when the response came from the backend's idempotency
|
|
62
|
+
* cache instead of fresh processing. Backend also returns
|
|
63
|
+
* `Idempotent-Replayed: true` as a response header (v1.4.0). */
|
|
64
|
+
idempotent_replay?: boolean;
|
|
61
65
|
}
|
|
62
66
|
interface HeartbeatResponse {
|
|
63
67
|
object: "heartbeat";
|
|
@@ -140,6 +144,37 @@ interface CrossdeckOptions {
|
|
|
140
144
|
* validators don't reject.
|
|
141
145
|
*/
|
|
142
146
|
platform?: Platform;
|
|
147
|
+
/**
|
|
148
|
+
* iOS Bundle ID (e.g. `com.acme.app`). REQUIRED for iOS builds.
|
|
149
|
+
* Sent as `X-Crossdeck-Bundle-Id` on every request so the backend
|
|
150
|
+
* can enforce the bank-grade identity lock against the bundleId
|
|
151
|
+
* stored on the iOS app key. Without it, every iOS request is
|
|
152
|
+
* rejected with 403 / bundle_id_not_allowed.
|
|
153
|
+
*
|
|
154
|
+
* Source the value from your native shell:
|
|
155
|
+
* * Expo: `import { applicationId } from "expo-application"`
|
|
156
|
+
* * Bare RN: `react-native-device-info.getBundleId()` or
|
|
157
|
+
* `NativeModules.PlatformConstants.bundleId`.
|
|
158
|
+
*
|
|
159
|
+
* Safe to set on Android too — the backend ignores it for non-iOS
|
|
160
|
+
* platforms, so a single config object works for both runtimes.
|
|
161
|
+
*/
|
|
162
|
+
bundleId?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Android applicationId / package name (e.g. `com.acme.app`).
|
|
165
|
+
* REQUIRED for Android builds. Sent as `X-Crossdeck-Package-Name`
|
|
166
|
+
* on every request so the backend can enforce the bank-grade
|
|
167
|
+
* identity lock against the packageName stored on the Android
|
|
168
|
+
* app key. Without it, every Android request is rejected with
|
|
169
|
+
* 403 / package_name_not_allowed.
|
|
170
|
+
*
|
|
171
|
+
* Source from:
|
|
172
|
+
* * Expo: `import { applicationId } from "expo-application"`
|
|
173
|
+
* (same field on Android)
|
|
174
|
+
* * Bare RN: `NativeModules.PlatformConstants.packageName` /
|
|
175
|
+
* `react-native-device-info.getBundleId()`.
|
|
176
|
+
*/
|
|
177
|
+
packageName?: string;
|
|
143
178
|
/**
|
|
144
179
|
* Per-request timeout in ms. Default 15000. A captive portal or
|
|
145
180
|
* hung connection would otherwise inherit the runtime's default
|
|
@@ -392,6 +427,108 @@ interface Breadcrumb {
|
|
|
392
427
|
data?: Record<string, unknown>;
|
|
393
428
|
}
|
|
394
429
|
|
|
430
|
+
/**
|
|
431
|
+
* Public, typed accessor for the bank-grade behavioural contracts
|
|
432
|
+
* this SDK ships. The full architecture — schema, distribution,
|
|
433
|
+
* audit loop, pillar taxonomy — lives in `contracts/README.md`
|
|
434
|
+
* at the monorepo root.
|
|
435
|
+
*
|
|
436
|
+
* Why a typed surface (vs. plain JSON access): contract IDs and
|
|
437
|
+
* pillar names are part of Crossdeck's public commitment to
|
|
438
|
+
* customers. Reading them through `CrossdeckContracts` means the
|
|
439
|
+
* compiler catches drift the moment a contract is renamed or
|
|
440
|
+
* retired. Tools that consume contracts at runtime (dashboards,
|
|
441
|
+
* AI assistants, customer integration tests) get the exact same
|
|
442
|
+
* shape every SDK ships, with no parsing layer to drift.
|
|
443
|
+
*
|
|
444
|
+
* --- BINARY STABILITY ---
|
|
445
|
+
* `Contract` is treated as an evolving — but back-compat — wire
|
|
446
|
+
* shape. Fields may be added in any minor release. Existing
|
|
447
|
+
* fields will not be removed or repurposed except in a major
|
|
448
|
+
* version bump, even if all known contracts stop using them.
|
|
449
|
+
* Customers can rely on `id`, `pillar`, `status`, `appliesTo`,
|
|
450
|
+
* `codeRef`, `testRef`, `registeredAt`, `firstRegisteredIn`,
|
|
451
|
+
* and `bundledIn` being present on every contract in every
|
|
452
|
+
* future minor/patch release of this SDK.
|
|
453
|
+
*/
|
|
454
|
+
type ContractPillar = "revenue" | "entitlements" | "analytics" | "webhooks" | "errors" | "lifecycle" | "identity";
|
|
455
|
+
type ContractStatus = "enforced" | "proposed" | "retired";
|
|
456
|
+
type ContractAppliesTo = "web" | "node" | "react-native" | "swift" | "android" | "backend";
|
|
457
|
+
interface ContractTestRef {
|
|
458
|
+
readonly file: string;
|
|
459
|
+
readonly name: string;
|
|
460
|
+
}
|
|
461
|
+
interface Contract {
|
|
462
|
+
readonly id: string;
|
|
463
|
+
readonly pillar: ContractPillar;
|
|
464
|
+
readonly status: ContractStatus;
|
|
465
|
+
readonly claim: string;
|
|
466
|
+
readonly appliesTo: readonly ContractAppliesTo[];
|
|
467
|
+
readonly codeRef: readonly string[];
|
|
468
|
+
readonly testRef: readonly ContractTestRef[];
|
|
469
|
+
readonly registeredAt: string;
|
|
470
|
+
readonly firstRegisteredIn: string;
|
|
471
|
+
readonly bundledIn: string;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Typed entry point to the bank-grade contracts bundled with this
|
|
475
|
+
* SDK release. Stable, side-effect-free, tree-shakeable.
|
|
476
|
+
*
|
|
477
|
+
* @example Audit at app boot
|
|
478
|
+
* ```ts
|
|
479
|
+
* import { CrossdeckContracts } from "@cross-deck/react-native";
|
|
480
|
+
*
|
|
481
|
+
* for (const c of CrossdeckContracts.all()) {
|
|
482
|
+
* console.log(`[crossdeck] ${c.id} (${c.pillar})`);
|
|
483
|
+
* }
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
declare const CrossdeckContracts: {
|
|
487
|
+
readonly all: () => readonly Contract[];
|
|
488
|
+
readonly allIncludingHistorical: () => readonly Contract[];
|
|
489
|
+
readonly byId: (id: string) => Contract | undefined;
|
|
490
|
+
readonly byPillar: (pillar: ContractPillar) => readonly Contract[];
|
|
491
|
+
readonly withStatus: (status: ContractStatus) => readonly Contract[];
|
|
492
|
+
readonly sdkVersion: "1.5.1";
|
|
493
|
+
readonly bundledIn: "@cross-deck/react-native@1.5.1";
|
|
494
|
+
/**
|
|
495
|
+
* Resolve a failing test back to the contract it exercises.
|
|
496
|
+
* Used by test-framework hooks to find the contract id of a
|
|
497
|
+
* failed contract test so `reportContractFailure(...)` can stamp
|
|
498
|
+
* the right `contract_id` on the emitted event.
|
|
499
|
+
*/
|
|
500
|
+
readonly findByTestName: (name: string) => Contract | undefined;
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* Input to {@link Crossdeck.reportContractFailure}.
|
|
504
|
+
*
|
|
505
|
+
* SCHEMA-LOCK: this interface's field set is exhaustively named. No
|
|
506
|
+
* free-form `extra: Record<string, unknown>` — the schema-lock
|
|
507
|
+
* contract at
|
|
508
|
+
* `contracts/diagnostics/contract-failed-payload-schema-lock.json`
|
|
509
|
+
* forbids unbounded fields.
|
|
510
|
+
*/
|
|
511
|
+
interface ContractFailureInput {
|
|
512
|
+
contractId: string;
|
|
513
|
+
/**
|
|
514
|
+
* Short categorical-ish label — the SDK convention is to keep
|
|
515
|
+
* this under 128 chars and stable across runs. Never an
|
|
516
|
+
* end-user-supplied string.
|
|
517
|
+
*/
|
|
518
|
+
failureReason: string;
|
|
519
|
+
runContext: "ci" | "dogfood" | "customer-app";
|
|
520
|
+
runId: string;
|
|
521
|
+
testRef?: {
|
|
522
|
+
file: string;
|
|
523
|
+
name: string;
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* Optional coarse device class, e.g. "ios-phone", "android-tablet".
|
|
527
|
+
* A categorical bucket, not a device identifier.
|
|
528
|
+
*/
|
|
529
|
+
deviceClass?: string;
|
|
530
|
+
}
|
|
531
|
+
|
|
395
532
|
/**
|
|
396
533
|
* Stack-trace parser — normalises Hermes / JSC / V8 stack strings
|
|
397
534
|
* into a common frame shape.
|
|
@@ -642,6 +779,17 @@ declare class CrossdeckClient {
|
|
|
642
779
|
* stamped. Common-case `track()` after hydration runs entirely
|
|
643
780
|
* synchronously.
|
|
644
781
|
*/
|
|
782
|
+
/**
|
|
783
|
+
* Emit `crossdeck.contract_failed` to the Crossdeck reliability
|
|
784
|
+
* endpoint — single-fire, one-way, never visible in the customer's
|
|
785
|
+
* dashboard. Goes over a dedicated HTTP path with the reliability
|
|
786
|
+
* publishable key embedded at build time; the customer's track()
|
|
787
|
+
* pipeline never carries `crossdeck.*` events. This is the
|
|
788
|
+
* independent-controller flow described in Privacy Policy §6
|
|
789
|
+
* ("Flow B"). The wire shape is fixed by the schema-lock contract
|
|
790
|
+
* at `contracts/diagnostics/contract-failed-payload-schema-lock.json`.
|
|
791
|
+
*/
|
|
792
|
+
reportContractFailure(input: ContractFailureInput): void;
|
|
645
793
|
track(name: string, properties?: EventProperties): void;
|
|
646
794
|
/**
|
|
647
795
|
* The body of `track()` — everything after the synchronous
|
|
@@ -665,6 +813,33 @@ declare class CrossdeckClient {
|
|
|
665
813
|
purchaseToken?: string;
|
|
666
814
|
appAccountToken?: string;
|
|
667
815
|
}): Promise<PurchaseResult>;
|
|
816
|
+
/**
|
|
817
|
+
* v1.4.0 Phase 3.4 — set the active session id. RN doesn't own
|
|
818
|
+
* session lifecycle (that's the host's AppState + nav library);
|
|
819
|
+
* the host calls `setSessionId()` from its AppState change
|
|
820
|
+
* listener so every subsequent `track()` event carries the
|
|
821
|
+
* `sessionId` property — matches the web SDK's session-anchored
|
|
822
|
+
* funnel queries.
|
|
823
|
+
*
|
|
824
|
+
* ```ts
|
|
825
|
+
* import { AppState } from "react-native";
|
|
826
|
+
*
|
|
827
|
+
* let sessionId = uuid();
|
|
828
|
+
* AppState.addEventListener("change", (next) => {
|
|
829
|
+
* if (next === "active") {
|
|
830
|
+
* // New session if backgrounded > 30 min.
|
|
831
|
+
* sessionId = uuid();
|
|
832
|
+
* Crossdeck.setSessionId(sessionId);
|
|
833
|
+
* } else if (next === "background") {
|
|
834
|
+
* void Crossdeck.flush();
|
|
835
|
+
* }
|
|
836
|
+
* });
|
|
837
|
+
* Crossdeck.setSessionId(sessionId);
|
|
838
|
+
* ```
|
|
839
|
+
*
|
|
840
|
+
* Pass `null` to clear (between sessions, on logout, etc).
|
|
841
|
+
*/
|
|
842
|
+
setSessionId(sessionId: string | null): void;
|
|
668
843
|
/** Toggle verbose diagnostic logging. */
|
|
669
844
|
setDebugMode(enabled: boolean): void;
|
|
670
845
|
/**
|
|
@@ -837,7 +1012,7 @@ declare class AsyncStorageAdapter implements KeyValueStorage {
|
|
|
837
1012
|
*
|
|
838
1013
|
* Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
|
|
839
1014
|
*/
|
|
840
|
-
declare const SDK_VERSION = "1.
|
|
1015
|
+
declare const SDK_VERSION = "1.5.1";
|
|
841
1016
|
declare const SDK_NAME = "@cross-deck/react-native";
|
|
842
1017
|
|
|
843
1018
|
/**
|
|
@@ -900,4 +1075,4 @@ interface DeviceInfo {
|
|
|
900
1075
|
appVersion?: string;
|
|
901
1076
|
}
|
|
902
1077
|
|
|
903
|
-
export { type AliasResult, AsyncStorageAdapter, type AuditRail, type Breadcrumb, type BreadcrumbCategory, type BreadcrumbLevel, type CapturedError, type ConsentState, Crossdeck, CrossdeckClient, CrossdeckError, type CrossdeckErrorPayload, type CrossdeckErrorType, type CrossdeckOptions, DEFAULT_BASE_URL, type DeviceInfo, type Diagnostics, type EntitlementsListResponse, type EntitlementsListener, type Environment, type ErrorLevel, type EventProperties, type GroupTraits, type HeartbeatResponse, type IdentifyOptions, type KeyValueStorage, MemoryStorage, type Platform, type PublicEntitlement, type PurchaseResult, SDK_NAME, SDK_VERSION, type StackFrame, parseRetryAfterHeader, scrubPii, scrubPiiFromProperties };
|
|
1078
|
+
export { type AliasResult, AsyncStorageAdapter, type AuditRail, type Breadcrumb, type BreadcrumbCategory, type BreadcrumbLevel, type CapturedError, type ConsentState, type Contract, type ContractAppliesTo, type ContractFailureInput, type ContractPillar, type ContractStatus, type ContractTestRef, Crossdeck, CrossdeckClient, CrossdeckContracts, CrossdeckError, type CrossdeckErrorPayload, type CrossdeckErrorType, type CrossdeckOptions, DEFAULT_BASE_URL, type DeviceInfo, type Diagnostics, type EntitlementsListResponse, type EntitlementsListener, type Environment, type ErrorLevel, type EventProperties, type GroupTraits, type HeartbeatResponse, type IdentifyOptions, type KeyValueStorage, MemoryStorage, type Platform, type PublicEntitlement, type PurchaseResult, SDK_NAME, SDK_VERSION, type StackFrame, parseRetryAfterHeader, scrubPii, scrubPiiFromProperties };
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,10 @@ interface PurchaseResult {
|
|
|
58
58
|
crossdeckCustomerId: string;
|
|
59
59
|
env: Environment;
|
|
60
60
|
entitlements: PublicEntitlement[];
|
|
61
|
+
/** True when the response came from the backend's idempotency
|
|
62
|
+
* cache instead of fresh processing. Backend also returns
|
|
63
|
+
* `Idempotent-Replayed: true` as a response header (v1.4.0). */
|
|
64
|
+
idempotent_replay?: boolean;
|
|
61
65
|
}
|
|
62
66
|
interface HeartbeatResponse {
|
|
63
67
|
object: "heartbeat";
|
|
@@ -140,6 +144,37 @@ interface CrossdeckOptions {
|
|
|
140
144
|
* validators don't reject.
|
|
141
145
|
*/
|
|
142
146
|
platform?: Platform;
|
|
147
|
+
/**
|
|
148
|
+
* iOS Bundle ID (e.g. `com.acme.app`). REQUIRED for iOS builds.
|
|
149
|
+
* Sent as `X-Crossdeck-Bundle-Id` on every request so the backend
|
|
150
|
+
* can enforce the bank-grade identity lock against the bundleId
|
|
151
|
+
* stored on the iOS app key. Without it, every iOS request is
|
|
152
|
+
* rejected with 403 / bundle_id_not_allowed.
|
|
153
|
+
*
|
|
154
|
+
* Source the value from your native shell:
|
|
155
|
+
* * Expo: `import { applicationId } from "expo-application"`
|
|
156
|
+
* * Bare RN: `react-native-device-info.getBundleId()` or
|
|
157
|
+
* `NativeModules.PlatformConstants.bundleId`.
|
|
158
|
+
*
|
|
159
|
+
* Safe to set on Android too — the backend ignores it for non-iOS
|
|
160
|
+
* platforms, so a single config object works for both runtimes.
|
|
161
|
+
*/
|
|
162
|
+
bundleId?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Android applicationId / package name (e.g. `com.acme.app`).
|
|
165
|
+
* REQUIRED for Android builds. Sent as `X-Crossdeck-Package-Name`
|
|
166
|
+
* on every request so the backend can enforce the bank-grade
|
|
167
|
+
* identity lock against the packageName stored on the Android
|
|
168
|
+
* app key. Without it, every Android request is rejected with
|
|
169
|
+
* 403 / package_name_not_allowed.
|
|
170
|
+
*
|
|
171
|
+
* Source from:
|
|
172
|
+
* * Expo: `import { applicationId } from "expo-application"`
|
|
173
|
+
* (same field on Android)
|
|
174
|
+
* * Bare RN: `NativeModules.PlatformConstants.packageName` /
|
|
175
|
+
* `react-native-device-info.getBundleId()`.
|
|
176
|
+
*/
|
|
177
|
+
packageName?: string;
|
|
143
178
|
/**
|
|
144
179
|
* Per-request timeout in ms. Default 15000. A captive portal or
|
|
145
180
|
* hung connection would otherwise inherit the runtime's default
|
|
@@ -392,6 +427,108 @@ interface Breadcrumb {
|
|
|
392
427
|
data?: Record<string, unknown>;
|
|
393
428
|
}
|
|
394
429
|
|
|
430
|
+
/**
|
|
431
|
+
* Public, typed accessor for the bank-grade behavioural contracts
|
|
432
|
+
* this SDK ships. The full architecture — schema, distribution,
|
|
433
|
+
* audit loop, pillar taxonomy — lives in `contracts/README.md`
|
|
434
|
+
* at the monorepo root.
|
|
435
|
+
*
|
|
436
|
+
* Why a typed surface (vs. plain JSON access): contract IDs and
|
|
437
|
+
* pillar names are part of Crossdeck's public commitment to
|
|
438
|
+
* customers. Reading them through `CrossdeckContracts` means the
|
|
439
|
+
* compiler catches drift the moment a contract is renamed or
|
|
440
|
+
* retired. Tools that consume contracts at runtime (dashboards,
|
|
441
|
+
* AI assistants, customer integration tests) get the exact same
|
|
442
|
+
* shape every SDK ships, with no parsing layer to drift.
|
|
443
|
+
*
|
|
444
|
+
* --- BINARY STABILITY ---
|
|
445
|
+
* `Contract` is treated as an evolving — but back-compat — wire
|
|
446
|
+
* shape. Fields may be added in any minor release. Existing
|
|
447
|
+
* fields will not be removed or repurposed except in a major
|
|
448
|
+
* version bump, even if all known contracts stop using them.
|
|
449
|
+
* Customers can rely on `id`, `pillar`, `status`, `appliesTo`,
|
|
450
|
+
* `codeRef`, `testRef`, `registeredAt`, `firstRegisteredIn`,
|
|
451
|
+
* and `bundledIn` being present on every contract in every
|
|
452
|
+
* future minor/patch release of this SDK.
|
|
453
|
+
*/
|
|
454
|
+
type ContractPillar = "revenue" | "entitlements" | "analytics" | "webhooks" | "errors" | "lifecycle" | "identity";
|
|
455
|
+
type ContractStatus = "enforced" | "proposed" | "retired";
|
|
456
|
+
type ContractAppliesTo = "web" | "node" | "react-native" | "swift" | "android" | "backend";
|
|
457
|
+
interface ContractTestRef {
|
|
458
|
+
readonly file: string;
|
|
459
|
+
readonly name: string;
|
|
460
|
+
}
|
|
461
|
+
interface Contract {
|
|
462
|
+
readonly id: string;
|
|
463
|
+
readonly pillar: ContractPillar;
|
|
464
|
+
readonly status: ContractStatus;
|
|
465
|
+
readonly claim: string;
|
|
466
|
+
readonly appliesTo: readonly ContractAppliesTo[];
|
|
467
|
+
readonly codeRef: readonly string[];
|
|
468
|
+
readonly testRef: readonly ContractTestRef[];
|
|
469
|
+
readonly registeredAt: string;
|
|
470
|
+
readonly firstRegisteredIn: string;
|
|
471
|
+
readonly bundledIn: string;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Typed entry point to the bank-grade contracts bundled with this
|
|
475
|
+
* SDK release. Stable, side-effect-free, tree-shakeable.
|
|
476
|
+
*
|
|
477
|
+
* @example Audit at app boot
|
|
478
|
+
* ```ts
|
|
479
|
+
* import { CrossdeckContracts } from "@cross-deck/react-native";
|
|
480
|
+
*
|
|
481
|
+
* for (const c of CrossdeckContracts.all()) {
|
|
482
|
+
* console.log(`[crossdeck] ${c.id} (${c.pillar})`);
|
|
483
|
+
* }
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
declare const CrossdeckContracts: {
|
|
487
|
+
readonly all: () => readonly Contract[];
|
|
488
|
+
readonly allIncludingHistorical: () => readonly Contract[];
|
|
489
|
+
readonly byId: (id: string) => Contract | undefined;
|
|
490
|
+
readonly byPillar: (pillar: ContractPillar) => readonly Contract[];
|
|
491
|
+
readonly withStatus: (status: ContractStatus) => readonly Contract[];
|
|
492
|
+
readonly sdkVersion: "1.5.1";
|
|
493
|
+
readonly bundledIn: "@cross-deck/react-native@1.5.1";
|
|
494
|
+
/**
|
|
495
|
+
* Resolve a failing test back to the contract it exercises.
|
|
496
|
+
* Used by test-framework hooks to find the contract id of a
|
|
497
|
+
* failed contract test so `reportContractFailure(...)` can stamp
|
|
498
|
+
* the right `contract_id` on the emitted event.
|
|
499
|
+
*/
|
|
500
|
+
readonly findByTestName: (name: string) => Contract | undefined;
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* Input to {@link Crossdeck.reportContractFailure}.
|
|
504
|
+
*
|
|
505
|
+
* SCHEMA-LOCK: this interface's field set is exhaustively named. No
|
|
506
|
+
* free-form `extra: Record<string, unknown>` — the schema-lock
|
|
507
|
+
* contract at
|
|
508
|
+
* `contracts/diagnostics/contract-failed-payload-schema-lock.json`
|
|
509
|
+
* forbids unbounded fields.
|
|
510
|
+
*/
|
|
511
|
+
interface ContractFailureInput {
|
|
512
|
+
contractId: string;
|
|
513
|
+
/**
|
|
514
|
+
* Short categorical-ish label — the SDK convention is to keep
|
|
515
|
+
* this under 128 chars and stable across runs. Never an
|
|
516
|
+
* end-user-supplied string.
|
|
517
|
+
*/
|
|
518
|
+
failureReason: string;
|
|
519
|
+
runContext: "ci" | "dogfood" | "customer-app";
|
|
520
|
+
runId: string;
|
|
521
|
+
testRef?: {
|
|
522
|
+
file: string;
|
|
523
|
+
name: string;
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* Optional coarse device class, e.g. "ios-phone", "android-tablet".
|
|
527
|
+
* A categorical bucket, not a device identifier.
|
|
528
|
+
*/
|
|
529
|
+
deviceClass?: string;
|
|
530
|
+
}
|
|
531
|
+
|
|
395
532
|
/**
|
|
396
533
|
* Stack-trace parser — normalises Hermes / JSC / V8 stack strings
|
|
397
534
|
* into a common frame shape.
|
|
@@ -642,6 +779,17 @@ declare class CrossdeckClient {
|
|
|
642
779
|
* stamped. Common-case `track()` after hydration runs entirely
|
|
643
780
|
* synchronously.
|
|
644
781
|
*/
|
|
782
|
+
/**
|
|
783
|
+
* Emit `crossdeck.contract_failed` to the Crossdeck reliability
|
|
784
|
+
* endpoint — single-fire, one-way, never visible in the customer's
|
|
785
|
+
* dashboard. Goes over a dedicated HTTP path with the reliability
|
|
786
|
+
* publishable key embedded at build time; the customer's track()
|
|
787
|
+
* pipeline never carries `crossdeck.*` events. This is the
|
|
788
|
+
* independent-controller flow described in Privacy Policy §6
|
|
789
|
+
* ("Flow B"). The wire shape is fixed by the schema-lock contract
|
|
790
|
+
* at `contracts/diagnostics/contract-failed-payload-schema-lock.json`.
|
|
791
|
+
*/
|
|
792
|
+
reportContractFailure(input: ContractFailureInput): void;
|
|
645
793
|
track(name: string, properties?: EventProperties): void;
|
|
646
794
|
/**
|
|
647
795
|
* The body of `track()` — everything after the synchronous
|
|
@@ -665,6 +813,33 @@ declare class CrossdeckClient {
|
|
|
665
813
|
purchaseToken?: string;
|
|
666
814
|
appAccountToken?: string;
|
|
667
815
|
}): Promise<PurchaseResult>;
|
|
816
|
+
/**
|
|
817
|
+
* v1.4.0 Phase 3.4 — set the active session id. RN doesn't own
|
|
818
|
+
* session lifecycle (that's the host's AppState + nav library);
|
|
819
|
+
* the host calls `setSessionId()` from its AppState change
|
|
820
|
+
* listener so every subsequent `track()` event carries the
|
|
821
|
+
* `sessionId` property — matches the web SDK's session-anchored
|
|
822
|
+
* funnel queries.
|
|
823
|
+
*
|
|
824
|
+
* ```ts
|
|
825
|
+
* import { AppState } from "react-native";
|
|
826
|
+
*
|
|
827
|
+
* let sessionId = uuid();
|
|
828
|
+
* AppState.addEventListener("change", (next) => {
|
|
829
|
+
* if (next === "active") {
|
|
830
|
+
* // New session if backgrounded > 30 min.
|
|
831
|
+
* sessionId = uuid();
|
|
832
|
+
* Crossdeck.setSessionId(sessionId);
|
|
833
|
+
* } else if (next === "background") {
|
|
834
|
+
* void Crossdeck.flush();
|
|
835
|
+
* }
|
|
836
|
+
* });
|
|
837
|
+
* Crossdeck.setSessionId(sessionId);
|
|
838
|
+
* ```
|
|
839
|
+
*
|
|
840
|
+
* Pass `null` to clear (between sessions, on logout, etc).
|
|
841
|
+
*/
|
|
842
|
+
setSessionId(sessionId: string | null): void;
|
|
668
843
|
/** Toggle verbose diagnostic logging. */
|
|
669
844
|
setDebugMode(enabled: boolean): void;
|
|
670
845
|
/**
|
|
@@ -837,7 +1012,7 @@ declare class AsyncStorageAdapter implements KeyValueStorage {
|
|
|
837
1012
|
*
|
|
838
1013
|
* Do NOT edit by hand — `node scripts/sync-sdk-versions.mjs`.
|
|
839
1014
|
*/
|
|
840
|
-
declare const SDK_VERSION = "1.
|
|
1015
|
+
declare const SDK_VERSION = "1.5.1";
|
|
841
1016
|
declare const SDK_NAME = "@cross-deck/react-native";
|
|
842
1017
|
|
|
843
1018
|
/**
|
|
@@ -900,4 +1075,4 @@ interface DeviceInfo {
|
|
|
900
1075
|
appVersion?: string;
|
|
901
1076
|
}
|
|
902
1077
|
|
|
903
|
-
export { type AliasResult, AsyncStorageAdapter, type AuditRail, type Breadcrumb, type BreadcrumbCategory, type BreadcrumbLevel, type CapturedError, type ConsentState, Crossdeck, CrossdeckClient, CrossdeckError, type CrossdeckErrorPayload, type CrossdeckErrorType, type CrossdeckOptions, DEFAULT_BASE_URL, type DeviceInfo, type Diagnostics, type EntitlementsListResponse, type EntitlementsListener, type Environment, type ErrorLevel, type EventProperties, type GroupTraits, type HeartbeatResponse, type IdentifyOptions, type KeyValueStorage, MemoryStorage, type Platform, type PublicEntitlement, type PurchaseResult, SDK_NAME, SDK_VERSION, type StackFrame, parseRetryAfterHeader, scrubPii, scrubPiiFromProperties };
|
|
1078
|
+
export { type AliasResult, AsyncStorageAdapter, type AuditRail, type Breadcrumb, type BreadcrumbCategory, type BreadcrumbLevel, type CapturedError, type ConsentState, type Contract, type ContractAppliesTo, type ContractFailureInput, type ContractPillar, type ContractStatus, type ContractTestRef, Crossdeck, CrossdeckClient, CrossdeckContracts, CrossdeckError, type CrossdeckErrorPayload, type CrossdeckErrorType, type CrossdeckOptions, DEFAULT_BASE_URL, type DeviceInfo, type Diagnostics, type EntitlementsListResponse, type EntitlementsListener, type Environment, type ErrorLevel, type EventProperties, type GroupTraits, type HeartbeatResponse, type IdentifyOptions, type KeyValueStorage, MemoryStorage, type Platform, type PublicEntitlement, type PurchaseResult, SDK_NAME, SDK_VERSION, type StackFrame, parseRetryAfterHeader, scrubPii, scrubPiiFromProperties };
|