@moveris/shared 3.8.6 → 3.9.0

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/README.md CHANGED
@@ -56,6 +56,8 @@ const client = new LivenessClient(config: LivenessClientConfig);
56
56
  | `enableRetry` | `boolean` | `true` | Enable automatic retry with exponential backoff |
57
57
  | `customFetch` | `typeof fetch` | `fetch` | Custom fetch implementation (for React Native) |
58
58
  | `deviceIntelligenceOverrides` | `DeviceIntelligenceOverrides` | - | Static overrides merged into every `device_intelligence` payload (e.g. `{ vpn_detected: true }`) |
59
+ | `consumer` | `ConsumerContext` | - | Consumer app context — traces which app and environment submitted each transaction |
60
+ | `trackClientTime` | `boolean` | `false` | When true, fires a fire-and-forget PATCH after each verdict to record end-to-end client duration |
59
61
 
60
62
  #### Methods
61
63
 
@@ -152,6 +154,17 @@ const result = await client.hybrid50(frames, { fps: 30 });
152
154
  const result = await client.hybrid150(frames, { fps: 30 });
153
155
  ```
154
156
 
157
+ ##### `postClientTime(sessionId, clientTime)`
158
+
159
+ Fire-and-forget PATCH to record end-to-end client duration for a completed verification session. No-op when `trackClientTime` is `false`. Swallows all errors silently.
160
+
161
+ ```typescript
162
+ // Called automatically by useLiveness / CognitoCheckWidget after the verdict.
163
+ // Approach B consumers can call it manually after onComplete resolves:
164
+ const elapsed = Math.round(performance.now() - startTime);
165
+ void client.postClientTime(result.sessionId, elapsed);
166
+ ```
167
+
155
168
  ##### `updateDeviceIntelligenceOverrides(overrides)`
156
169
 
157
170
  Merge additional fields into the cached device intelligence payload. Call this after construction to inject data only available at runtime (e.g. camera specs, VPN detection results). Merges shallowly — later calls are merged on top of earlier ones.
@@ -254,6 +267,27 @@ Deprecated models (v1 — sunset 2026-09-01):
254
267
  | `'mixed-150'` | 150 | — |
255
268
  | `'mixed-250'` | 250 | — |
256
269
 
270
+ #### ConsumerContext
271
+
272
+ Consumer app context attached to every verification request for transaction tracing.
273
+
274
+ ```typescript
275
+ interface ConsumerContext {
276
+ url: string; // The consumer app's URL
277
+ env: 'development' | 'staging' | 'production'; // Consumer app environment
278
+ }
279
+ ```
280
+
281
+ Pass it at client construction — it is included in every subsequent request automatically:
282
+
283
+ ```typescript
284
+ const client = new LivenessClient({
285
+ apiKey: 'mv_your_api_key',
286
+ consumer: { url: 'https://app.example.com', env: 'production' },
287
+ trackClientTime: true, // optional — fires postClientTime after each verdict
288
+ });
289
+ ```
290
+
257
291
  #### FrameSource
258
292
 
259
293
  Source of the captured frames.
@@ -308,6 +342,7 @@ interface LivenessResult {
308
342
  processingMs: number; // Server processing time
309
343
  framesProcessed: number; // Number of frames analyzed
310
344
  deprecation?: DeprecationInfo; // Present when X-Moveris-Model-Resolved header is returned
345
+ clientTime?: number; // End-to-end client duration in ms (start() to verdict received)
311
346
  }
312
347
  ```
313
348
 
@@ -856,6 +891,7 @@ import type {
856
891
  Verdict,
857
892
  CapturedFrame,
858
893
  CropData,
894
+ ConsumerContext,
859
895
  LivenessClientConfig,
860
896
  DetectionResult,
861
897
  DetectionSummary,
package/dist/index.d.mts CHANGED
@@ -26,6 +26,10 @@ type DeviceIntelligenceOverrides = {
26
26
  };
27
27
 
28
28
  type Verdict = 'live' | 'fake' | 'inconclusive';
29
+ interface ConsumerContext {
30
+ url: string;
31
+ env: 'development' | 'staging' | 'production';
32
+ }
29
33
  interface ModelEntry {
30
34
  id: string;
31
35
  label: string;
@@ -68,6 +72,9 @@ interface FastCheckRequest {
68
72
  frame_count?: number;
69
73
  warnings?: string[];
70
74
  device_intelligence?: DeviceIntelligence;
75
+ metadata?: {
76
+ consumer?: ConsumerContext;
77
+ } | null;
71
78
  }
72
79
  interface FastCheckCropsRequest {
73
80
  session_id: string;
@@ -76,6 +83,9 @@ interface FastCheckCropsRequest {
76
83
  crops: CropData[];
77
84
  frame_count?: number;
78
85
  device_intelligence?: DeviceIntelligence;
86
+ metadata?: {
87
+ consumer?: ConsumerContext;
88
+ } | null;
79
89
  }
80
90
  interface VerifyRequest {
81
91
  session_id: string;
@@ -108,6 +118,9 @@ interface FastCheckStreamRequest {
108
118
  frame_count?: number;
109
119
  warnings?: string[];
110
120
  device_intelligence?: DeviceIntelligence;
121
+ metadata?: {
122
+ consumer?: ConsumerContext;
123
+ } | null;
111
124
  }
112
125
  interface FastCheckResponse {
113
126
  verdict: Verdict | null;
@@ -208,6 +221,7 @@ interface LivenessResult {
208
221
  framesProcessed: number;
209
222
  warnings?: string[];
210
223
  deprecation?: DeprecationInfo;
224
+ clientTime?: number;
211
225
  }
212
226
  type LivenessState = 'idle' | 'capturing' | 'uploading' | 'processing' | 'complete' | 'error';
213
227
  interface LivenessConfig {
@@ -567,6 +581,8 @@ interface LivenessClientConfig {
567
581
  enableRetry?: boolean;
568
582
  customFetch?: typeof fetch;
569
583
  deviceIntelligenceOverrides?: DeviceIntelligenceOverrides;
584
+ consumer?: ConsumerContext;
585
+ trackClientTime?: boolean;
570
586
  }
571
587
  declare class LivenessApiError extends Error {
572
588
  readonly code: string;
@@ -587,6 +603,8 @@ declare class LivenessClient {
587
603
  private readonly timeout;
588
604
  private readonly enableRetry;
589
605
  private readonly fetchFn;
606
+ private readonly consumer;
607
+ private readonly trackClientTime;
590
608
  private diCollected;
591
609
  private diCollecting;
592
610
  private diOverrides;
@@ -607,6 +625,7 @@ declare class LivenessClient {
607
625
  health(): Promise<HealthResponse>;
608
626
  getModels(): Promise<ModelEntry[]>;
609
627
  queueStats(): Promise<QueueStatsResponse>;
628
+ postClientTime(sessionId: string, clientTime: number): Promise<void>;
610
629
  fastCheck(frames: CapturedFrame[], options?: {
611
630
  sessionId?: string;
612
631
  model?: FastCheckModel;
@@ -728,6 +747,7 @@ declare const API_PATHS: {
728
747
  readonly hybrid150: "/api/v1/hybrid-150";
729
748
  readonly jobResult: "/api/v1/result";
730
749
  readonly queueStats: "/api/v1/queue/stats";
750
+ readonly sessions: "/api/v1/sessions";
731
751
  };
732
752
  declare const RETRY_CONFIG: {
733
753
  readonly maxAttempts: 3;
@@ -942,4 +962,4 @@ declare function collectDeviceIntelligence(opts?: {
942
962
  platformVersion?: string;
943
963
  }): Promise<DeviceIntelligence | null>;
944
964
 
945
- export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_ERROR_CODES, API_PATHS, AUTH_CONFIG, type ApiErrorCode, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, CAMERA_ANGLE_HIGH_RATIO, CAMERA_ANGLE_LOW_RATIO, type CameraAngleResult, type CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, DEFAULT_ENDPOINT, DEFAULT_FACE_DETECTION_TIERS, DEFAULT_GAZE_THRESHOLDS, DEFAULT_HAND_OCCLUSION_CONFIG, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STABILIZER_CONFIG, DEFAULT_STATUS_MESSAGES, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceRollResult, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FastCheckStreamRequest, type FastCheckStreamResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, type GazeThresholds, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HandOcclusionConfig, type HeadPose, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_IDEAL_FACE_RATIO, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelVersion, type ModelsResponse, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, OVAL_REGION_DESKTOP, OVAL_REGION_MOBILE, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, SHARED_SDK_PLATFORM, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, VALID_FRAME_COUNTS, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
965
+ export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_ERROR_CODES, API_PATHS, AUTH_CONFIG, type ApiErrorCode, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, CAMERA_ANGLE_HIGH_RATIO, CAMERA_ANGLE_LOW_RATIO, type CameraAngleResult, type CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type ConsumerContext, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, DEFAULT_ENDPOINT, DEFAULT_FACE_DETECTION_TIERS, DEFAULT_GAZE_THRESHOLDS, DEFAULT_HAND_OCCLUSION_CONFIG, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STABILIZER_CONFIG, DEFAULT_STATUS_MESSAGES, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceRollResult, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FastCheckStreamRequest, type FastCheckStreamResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, type GazeThresholds, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HandOcclusionConfig, type HeadPose, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_IDEAL_FACE_RATIO, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelVersion, type ModelsResponse, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, OVAL_REGION_DESKTOP, OVAL_REGION_MOBILE, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, SHARED_SDK_PLATFORM, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, VALID_FRAME_COUNTS, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
package/dist/index.d.ts CHANGED
@@ -26,6 +26,10 @@ type DeviceIntelligenceOverrides = {
26
26
  };
27
27
 
28
28
  type Verdict = 'live' | 'fake' | 'inconclusive';
29
+ interface ConsumerContext {
30
+ url: string;
31
+ env: 'development' | 'staging' | 'production';
32
+ }
29
33
  interface ModelEntry {
30
34
  id: string;
31
35
  label: string;
@@ -68,6 +72,9 @@ interface FastCheckRequest {
68
72
  frame_count?: number;
69
73
  warnings?: string[];
70
74
  device_intelligence?: DeviceIntelligence;
75
+ metadata?: {
76
+ consumer?: ConsumerContext;
77
+ } | null;
71
78
  }
72
79
  interface FastCheckCropsRequest {
73
80
  session_id: string;
@@ -76,6 +83,9 @@ interface FastCheckCropsRequest {
76
83
  crops: CropData[];
77
84
  frame_count?: number;
78
85
  device_intelligence?: DeviceIntelligence;
86
+ metadata?: {
87
+ consumer?: ConsumerContext;
88
+ } | null;
79
89
  }
80
90
  interface VerifyRequest {
81
91
  session_id: string;
@@ -108,6 +118,9 @@ interface FastCheckStreamRequest {
108
118
  frame_count?: number;
109
119
  warnings?: string[];
110
120
  device_intelligence?: DeviceIntelligence;
121
+ metadata?: {
122
+ consumer?: ConsumerContext;
123
+ } | null;
111
124
  }
112
125
  interface FastCheckResponse {
113
126
  verdict: Verdict | null;
@@ -208,6 +221,7 @@ interface LivenessResult {
208
221
  framesProcessed: number;
209
222
  warnings?: string[];
210
223
  deprecation?: DeprecationInfo;
224
+ clientTime?: number;
211
225
  }
212
226
  type LivenessState = 'idle' | 'capturing' | 'uploading' | 'processing' | 'complete' | 'error';
213
227
  interface LivenessConfig {
@@ -567,6 +581,8 @@ interface LivenessClientConfig {
567
581
  enableRetry?: boolean;
568
582
  customFetch?: typeof fetch;
569
583
  deviceIntelligenceOverrides?: DeviceIntelligenceOverrides;
584
+ consumer?: ConsumerContext;
585
+ trackClientTime?: boolean;
570
586
  }
571
587
  declare class LivenessApiError extends Error {
572
588
  readonly code: string;
@@ -587,6 +603,8 @@ declare class LivenessClient {
587
603
  private readonly timeout;
588
604
  private readonly enableRetry;
589
605
  private readonly fetchFn;
606
+ private readonly consumer;
607
+ private readonly trackClientTime;
590
608
  private diCollected;
591
609
  private diCollecting;
592
610
  private diOverrides;
@@ -607,6 +625,7 @@ declare class LivenessClient {
607
625
  health(): Promise<HealthResponse>;
608
626
  getModels(): Promise<ModelEntry[]>;
609
627
  queueStats(): Promise<QueueStatsResponse>;
628
+ postClientTime(sessionId: string, clientTime: number): Promise<void>;
610
629
  fastCheck(frames: CapturedFrame[], options?: {
611
630
  sessionId?: string;
612
631
  model?: FastCheckModel;
@@ -728,6 +747,7 @@ declare const API_PATHS: {
728
747
  readonly hybrid150: "/api/v1/hybrid-150";
729
748
  readonly jobResult: "/api/v1/result";
730
749
  readonly queueStats: "/api/v1/queue/stats";
750
+ readonly sessions: "/api/v1/sessions";
731
751
  };
732
752
  declare const RETRY_CONFIG: {
733
753
  readonly maxAttempts: 3;
@@ -942,4 +962,4 @@ declare function collectDeviceIntelligence(opts?: {
942
962
  platformVersion?: string;
943
963
  }): Promise<DeviceIntelligence | null>;
944
964
 
945
- export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_ERROR_CODES, API_PATHS, AUTH_CONFIG, type ApiErrorCode, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, CAMERA_ANGLE_HIGH_RATIO, CAMERA_ANGLE_LOW_RATIO, type CameraAngleResult, type CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, DEFAULT_ENDPOINT, DEFAULT_FACE_DETECTION_TIERS, DEFAULT_GAZE_THRESHOLDS, DEFAULT_HAND_OCCLUSION_CONFIG, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STABILIZER_CONFIG, DEFAULT_STATUS_MESSAGES, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceRollResult, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FastCheckStreamRequest, type FastCheckStreamResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, type GazeThresholds, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HandOcclusionConfig, type HeadPose, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_IDEAL_FACE_RATIO, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelVersion, type ModelsResponse, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, OVAL_REGION_DESKTOP, OVAL_REGION_MOBILE, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, SHARED_SDK_PLATFORM, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, VALID_FRAME_COUNTS, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
965
+ export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_ERROR_CODES, API_PATHS, AUTH_CONFIG, type ApiErrorCode, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, CAMERA_ANGLE_HIGH_RATIO, CAMERA_ANGLE_LOW_RATIO, type CameraAngleResult, type CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type ConsumerContext, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, DEFAULT_ENDPOINT, DEFAULT_FACE_DETECTION_TIERS, DEFAULT_GAZE_THRESHOLDS, DEFAULT_HAND_OCCLUSION_CONFIG, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STABILIZER_CONFIG, DEFAULT_STATUS_MESSAGES, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceRollResult, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FastCheckStreamRequest, type FastCheckStreamResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, type GazeThresholds, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HandOcclusionConfig, type HeadPose, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_IDEAL_FACE_RATIO, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelVersion, type ModelsResponse, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, OVAL_REGION_DESKTOP, OVAL_REGION_MOBILE, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, SHARED_SDK_PLATFORM, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, VALID_FRAME_COUNTS, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
package/dist/index.js CHANGED
@@ -158,7 +158,8 @@ var API_PATHS = {
158
158
  hybrid50: "/api/v1/hybrid-50",
159
159
  hybrid150: "/api/v1/hybrid-150",
160
160
  jobResult: "/api/v1/result",
161
- queueStats: "/api/v1/queue/stats"
161
+ queueStats: "/api/v1/queue/stats",
162
+ sessions: "/api/v1/sessions"
162
163
  };
163
164
  var RETRY_CONFIG = {
164
165
  maxAttempts: 3,
@@ -238,7 +239,7 @@ async function sleep(ms) {
238
239
  }
239
240
 
240
241
  // package.json
241
- var version = "3.8.6";
242
+ var version = "3.9.0";
242
243
 
243
244
  // src/utils/deviceIntelligence.ts
244
245
  var IPINFO_URL = "https://ipinfo.io/json";
@@ -386,6 +387,8 @@ var LivenessClient = class _LivenessClient {
386
387
  this.enableRetry = config.enableRetry ?? true;
387
388
  this.fetchFn = config.customFetch ?? (typeof window !== "undefined" ? fetch.bind(window) : fetch);
388
389
  this.diOverrides = { ...config.deviceIntelligenceOverrides };
390
+ this.consumer = config.consumer;
391
+ this.trackClientTime = config.trackClientTime ?? false;
389
392
  }
390
393
  /**
391
394
  * Merge additional device intelligence overrides into the existing set.
@@ -634,6 +637,25 @@ var LivenessClient = class _LivenessClient {
634
637
  async queueStats() {
635
638
  return this.request(API_PATHS.queueStats);
636
639
  }
640
+ /**
641
+ * Post end-to-end client duration for a completed verification session.
642
+ * Fire-and-forget — swallows all errors, no retry.
643
+ * No-op when `trackClientTime` is false (default).
644
+ */
645
+ async postClientTime(sessionId, clientTime) {
646
+ if (!this.trackClientTime) return;
647
+ try {
648
+ await this.fetchFn(`${this.baseUrl}${API_PATHS.sessions}/${sessionId}/client-time`, {
649
+ method: "PATCH",
650
+ headers: {
651
+ "Content-Type": "application/json",
652
+ [AUTH_CONFIG.apiKeyHeader]: this.apiKey
653
+ },
654
+ body: JSON.stringify({ client_time: clientTime })
655
+ });
656
+ } catch {
657
+ }
658
+ }
637
659
  // ===========================================================================
638
660
  // Fast Check Endpoints
639
661
  // ===========================================================================
@@ -654,7 +676,8 @@ var LivenessClient = class _LivenessClient {
654
676
  frames: toFrameData(frames),
655
677
  ...options.frameCount != null ? { frame_count: options.frameCount } : {},
656
678
  ...options.warnings?.length ? { warnings: options.warnings } : {},
657
- ...di ? { device_intelligence: di } : {}
679
+ ...di ? { device_intelligence: di } : {},
680
+ ...this.consumer ? { metadata: { consumer: this.consumer } } : {}
658
681
  };
659
682
  const { data: response, headers } = await this.requestWithRetryRaw(
660
683
  API_PATHS.fastCheck,
@@ -691,7 +714,8 @@ var LivenessClient = class _LivenessClient {
691
714
  ...options.frameCount != null ? { frame_count: options.frameCount } : {},
692
715
  ...options.warnings?.length ? { warnings: options.warnings } : {},
693
716
  ...options.bgSegmentation !== void 0 ? { bg_segmentation: options.bgSegmentation } : {},
694
- ...di ? { device_intelligence: di } : {}
717
+ ...di ? { device_intelligence: di } : {},
718
+ ...this.consumer ? { metadata: { consumer: this.consumer } } : {}
695
719
  };
696
720
  const { data: response, headers } = await this.requestWithRetryRaw(
697
721
  API_PATHS.fastCheckCrops,
@@ -755,7 +779,8 @@ var LivenessClient = class _LivenessClient {
755
779
  frame: frameData,
756
780
  ...options.frameCount != null ? { frame_count: options.frameCount } : {},
757
781
  ...options.warnings?.length ? { warnings: options.warnings } : {},
758
- ...di ? { device_intelligence: di } : {}
782
+ ...di ? { device_intelligence: di } : {},
783
+ ...this.consumer ? { metadata: { consumer: this.consumer } } : {}
759
784
  };
760
785
  return this.requestWithRetry(API_PATHS.fastCheckStream, {
761
786
  method: "POST",
package/dist/index.mjs CHANGED
@@ -16,7 +16,8 @@ var API_PATHS = {
16
16
  hybrid50: "/api/v1/hybrid-50",
17
17
  hybrid150: "/api/v1/hybrid-150",
18
18
  jobResult: "/api/v1/result",
19
- queueStats: "/api/v1/queue/stats"
19
+ queueStats: "/api/v1/queue/stats",
20
+ sessions: "/api/v1/sessions"
20
21
  };
21
22
  var RETRY_CONFIG = {
22
23
  maxAttempts: 3,
@@ -96,7 +97,7 @@ async function sleep(ms) {
96
97
  }
97
98
 
98
99
  // package.json
99
- var version = "3.8.6";
100
+ var version = "3.9.0";
100
101
 
101
102
  // src/utils/deviceIntelligence.ts
102
103
  var IPINFO_URL = "https://ipinfo.io/json";
@@ -244,6 +245,8 @@ var LivenessClient = class _LivenessClient {
244
245
  this.enableRetry = config.enableRetry ?? true;
245
246
  this.fetchFn = config.customFetch ?? (typeof window !== "undefined" ? fetch.bind(window) : fetch);
246
247
  this.diOverrides = { ...config.deviceIntelligenceOverrides };
248
+ this.consumer = config.consumer;
249
+ this.trackClientTime = config.trackClientTime ?? false;
247
250
  }
248
251
  /**
249
252
  * Merge additional device intelligence overrides into the existing set.
@@ -492,6 +495,25 @@ var LivenessClient = class _LivenessClient {
492
495
  async queueStats() {
493
496
  return this.request(API_PATHS.queueStats);
494
497
  }
498
+ /**
499
+ * Post end-to-end client duration for a completed verification session.
500
+ * Fire-and-forget — swallows all errors, no retry.
501
+ * No-op when `trackClientTime` is false (default).
502
+ */
503
+ async postClientTime(sessionId, clientTime) {
504
+ if (!this.trackClientTime) return;
505
+ try {
506
+ await this.fetchFn(`${this.baseUrl}${API_PATHS.sessions}/${sessionId}/client-time`, {
507
+ method: "PATCH",
508
+ headers: {
509
+ "Content-Type": "application/json",
510
+ [AUTH_CONFIG.apiKeyHeader]: this.apiKey
511
+ },
512
+ body: JSON.stringify({ client_time: clientTime })
513
+ });
514
+ } catch {
515
+ }
516
+ }
495
517
  // ===========================================================================
496
518
  // Fast Check Endpoints
497
519
  // ===========================================================================
@@ -512,7 +534,8 @@ var LivenessClient = class _LivenessClient {
512
534
  frames: toFrameData(frames),
513
535
  ...options.frameCount != null ? { frame_count: options.frameCount } : {},
514
536
  ...options.warnings?.length ? { warnings: options.warnings } : {},
515
- ...di ? { device_intelligence: di } : {}
537
+ ...di ? { device_intelligence: di } : {},
538
+ ...this.consumer ? { metadata: { consumer: this.consumer } } : {}
516
539
  };
517
540
  const { data: response, headers } = await this.requestWithRetryRaw(
518
541
  API_PATHS.fastCheck,
@@ -549,7 +572,8 @@ var LivenessClient = class _LivenessClient {
549
572
  ...options.frameCount != null ? { frame_count: options.frameCount } : {},
550
573
  ...options.warnings?.length ? { warnings: options.warnings } : {},
551
574
  ...options.bgSegmentation !== void 0 ? { bg_segmentation: options.bgSegmentation } : {},
552
- ...di ? { device_intelligence: di } : {}
575
+ ...di ? { device_intelligence: di } : {},
576
+ ...this.consumer ? { metadata: { consumer: this.consumer } } : {}
553
577
  };
554
578
  const { data: response, headers } = await this.requestWithRetryRaw(
555
579
  API_PATHS.fastCheckCrops,
@@ -613,7 +637,8 @@ var LivenessClient = class _LivenessClient {
613
637
  frame: frameData,
614
638
  ...options.frameCount != null ? { frame_count: options.frameCount } : {},
615
639
  ...options.warnings?.length ? { warnings: options.warnings } : {},
616
- ...di ? { device_intelligence: di } : {}
640
+ ...di ? { device_intelligence: di } : {},
641
+ ...this.consumer ? { metadata: { consumer: this.consumer } } : {}
617
642
  };
618
643
  return this.requestWithRetry(API_PATHS.fastCheckStream, {
619
644
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moveris/shared",
3
- "version": "3.8.6",
3
+ "version": "3.9.0",
4
4
  "description": "Core business logic for Moveris Live SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",