@smileid/usesmileid 12.2.1-SNAPSHOT.44 → 12.3.1-SNAPSHOT.49

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +20 -14
  3. package/dist/camera/camera_defaults.d.ts +0 -2
  4. package/dist/camera/camera_defaults.js +1 -1
  5. package/dist/core/exception/flow_exceptions.d.ts +12 -0
  6. package/dist/core/exception/flow_exceptions.js +1 -1
  7. package/dist/core/exception/index.d.ts +2 -1
  8. package/dist/core/exception/index.js +1 -1
  9. package/dist/core/exception/invalid_partner_screen_exception.d.ts +10 -0
  10. package/dist/core/exception/invalid_partner_screen_exception.js +1 -0
  11. package/dist/core/exception/use_smile_id_error_code.d.ts +1 -0
  12. package/dist/core/exception/use_smile_id_error_code.js +1 -1
  13. package/dist/core/models/params.d.ts +8 -6
  14. package/dist/data/api/connection_warmer.d.ts +27 -0
  15. package/dist/data/api/connection_warmer.js +1 -0
  16. package/dist/data/api/interceptors/smile_auth_interceptor.js +1 -1
  17. package/dist/data/api/smile_id_api.d.ts +3 -0
  18. package/dist/data/api/smile_id_api.js +1 -1
  19. package/dist/data/model/token_payload.d.ts +5 -7
  20. package/dist/data/model/token_payload.js +1 -1
  21. package/dist/data/model/user_details_payload.d.ts +6 -4
  22. package/dist/index.d.ts +3 -2
  23. package/dist/index.js +1 -1
  24. package/dist/metadata/metadata_configuration_mappers.js +1 -1
  25. package/dist/metadata/use_smile_id_metadata_factory.js +1 -1
  26. package/dist/presentation/components/helpers/document_interior_crop.d.ts +13 -2
  27. package/dist/presentation/components/helpers/document_interior_crop.js +1 -1
  28. package/dist/presentation/components/use_smile_id_captured_document_image.d.ts +8 -4
  29. package/dist/presentation/components/use_smile_id_captured_document_image.js +1 -1
  30. package/dist/presentation/flow/analytics/use_smile_id_analytics_event.d.ts +3 -0
  31. package/dist/presentation/flow/analytics/use_smile_id_analytics_event.js +1 -1
  32. package/dist/presentation/flow/analytics/use_smile_id_analytics_event_kind.d.ts +5 -0
  33. package/dist/presentation/flow/analytics/use_smile_id_analytics_event_kind.js +1 -1
  34. package/dist/presentation/flow/dsl/builder/partner_value_format.d.ts +22 -0
  35. package/dist/presentation/flow/dsl/builder/partner_value_format.js +1 -0
  36. package/dist/presentation/flow/dsl/builder/screens_builder.d.ts +49 -0
  37. package/dist/presentation/flow/dsl/builder/screens_builder.js +1 -1
  38. package/dist/presentation/flow/dsl/use_smile_id_flow_builder.d.ts +0 -9
  39. package/dist/presentation/flow/dsl/use_smile_id_flow_builder.js +1 -1
  40. package/dist/presentation/flow/flow_navigation_engine.d.ts +12 -0
  41. package/dist/presentation/flow/flow_navigation_engine.js +1 -0
  42. package/dist/presentation/flow/flow_navigation_graph.d.ts +32 -0
  43. package/dist/presentation/flow/flow_navigation_graph.js +1 -0
  44. package/dist/presentation/flow/flow_navigation_manager.d.ts +57 -6
  45. package/dist/presentation/flow/flow_navigation_manager.js +1 -1
  46. package/dist/presentation/flow/flow_navigation_manager_analytics.d.ts +9 -1
  47. package/dist/presentation/flow/flow_navigation_manager_analytics.js +1 -1
  48. package/dist/presentation/flow/flow_navigation_manager_job_request.js +1 -1
  49. package/dist/presentation/flow/flow_navigation_manager_routing.d.ts +26 -1
  50. package/dist/presentation/flow/flow_navigation_manager_routing.js +1 -1
  51. package/dist/presentation/flow/graph/screen_renderer.js +1 -1
  52. package/dist/presentation/flow/screen/helpers/failure_message.js +1 -1
  53. package/dist/presentation/flow/screen/orchestrated_partner_screen.d.ts +10 -0
  54. package/dist/presentation/flow/screen/orchestrated_partner_screen.js +1 -0
  55. package/dist/presentation/flow/use_smile_id_flow.js +1 -1
  56. package/dist/presentation/flow/validation/flow_validator.d.ts +0 -19
  57. package/dist/presentation/flow/validation/flow_validator.js +1 -1
  58. package/dist/presentation/flow/validation/job_type_validator.js +1 -1
  59. package/dist/presentation/flow/validation/partner_screen_validation.d.ts +10 -0
  60. package/dist/presentation/flow/validation/partner_screen_validation.js +1 -0
  61. package/dist/presentation/screen/use_smile_id_capture_screen.js +1 -1
  62. package/package.json +8 -6
  63. package/dist/presentation/flow/validation/user_details_validator.d.ts +0 -8
  64. package/dist/presentation/flow/validation/user_details_validator.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  Full release notes: [Smile ID docs](https://docs.usesmileid.com/developer-resources/sdks/mobile/release-notes/react-native-expo).
2
2
 
3
+ ## 12.3.0
4
+
5
+ See the repository CHANGELOG for the 12.3.0 release notes.
6
+
7
+
3
8
  ## 12.2.0
4
9
 
5
10
  See the repository CHANGELOG for the 12.2.0 release notes.
package/README.md CHANGED
@@ -32,7 +32,7 @@ Sizes are measured on every push to `main` and updated automatically by CI.
32
32
  - Xcode (latest stable) — iOS 16.4 deployment target (set by Expo SDK 56's modules; the Smile ID iOS SDK itself supports iOS 15)
33
33
  - Android Gradle Plugin 8.11.1+ — `compileSdk` 36 or newer (React Native's default; nothing to set) and `minSdk` 24, matching the native Smile ID SDK and the kamera engine. The ML Kit config plugins set the Kotlin and KSP versions the AARs were compiled with. The 12.0.0–12.0.2 AARs required compileSdk 37 and `minSdk` 26 instead; on those releases, install platform 37 before Gradle runs (on EAS, an `eas-build-pre-install` script: `yes | sdkmanager --licenses >/dev/null; sdkmanager "platforms;android-37.0"`).
34
34
 
35
- `12.2.0` is built and verified against Expo SDK 57 and React Native 0.86. The floors above are the supported minimum and keep working.
35
+ `12.3.0` is built and verified against Expo SDK 57 and React Native 0.86. The floors above are the supported minimum and keep working.
36
36
 
37
37
  ## Installation
38
38
 
@@ -53,7 +53,7 @@ npx expo install expo-brightness expo-file-system expo-font expo-haptics \
53
53
  expo-image-manipulator expo-image-picker expo-keep-awake expo-screen-orientation
54
54
  ```
55
55
 
56
- (Use `@smileid/usesmileid_huawei_{face,document}` instead of mlkit on no-GMS Android targets.)
56
+ (For Android phones without Google Play services, add `@smileid/usesmileid_huawei_{face,document}` and pick per phone, or ship a build per store whose AppGallery flavor uses them instead of the ML Kit packages: see the repository README's Huawei section.)
57
57
 
58
58
  Everything above except the `@smileid/*` packages is a **required peer dependency**, and must be installed in your app directly: React Native autolinking only links native modules declared in the app's own `package.json`, not a library's transitive ones. `expo`, `expo-modules-core`, `react` and `react-native` are omitted because they ship with your app.
59
59
 
@@ -78,7 +78,7 @@ The provider packages each have native code (Android AAR / iOS SPM), and the ML
78
78
  }
79
79
  ```
80
80
 
81
- Autolinking finds the native modules through `expo-module.config.json` on its own, but it cannot change settings the root Gradle project and the Podfile own — without these plugins the build does not compile. The Android plugins pin the Kotlin the AARs were compiled with (2.3.20) and the `androidx.core` version that resolves under Expo's Android Gradle Plugin; Expo's own KSP lookup carries no entry for that Kotlin, so pass `kspVersion` as shown. The Huawei providers ship no config plugin — apply those root Gradle settings yourself on a no-GMS target. For bare React Native, run `npx pod-install` after adding the packages and let Gradle resolve the AARs on the next Android build.
81
+ Autolinking finds the native modules through `expo-module.config.json` on its own, but it cannot change settings the root Gradle project and the Podfile own — without these plugins the build does not compile. The Android plugins pin the Kotlin the AARs were compiled with (2.3.20) and the `androidx.core` version that resolves under Expo's Android Gradle Plugin; Expo's own KSP lookup carries no entry for that Kotlin, so pass `kspVersion` as shown. The Huawei packages' config plugin settles `android:allowBackup` and, with `storeFlavors`, writes a flavor per store. For bare React Native, run `npx pod-install` after adding the packages and let Gradle resolve the AARs on the next Android build.
82
82
 
83
83
  ---
84
84
 
@@ -124,11 +124,17 @@ export default function VerificationScreen() {
124
124
  b.onResult = (result) => {
125
125
  switch (result.status) {
126
126
  case "success":
127
- console.log("Captured:", result.value);
127
+ console.log("Submitted job", result.value.jobId);
128
128
  break;
129
129
  case "failure":
130
130
  console.error("Error:", result.error);
131
131
  break;
132
+ case "cancelled":
133
+ console.log("The user left the flow");
134
+ break;
135
+ case "captured":
136
+ console.log("Captured", result.job.jobType);
137
+ break;
132
138
  }
133
139
  };
134
140
  }}
@@ -446,13 +452,13 @@ function ExitButton() {
446
452
 
447
453
  The hook returns the active `FlowNavigationManager`:
448
454
 
449
- | Member | Behaviour |
450
- | ------------------- | --------------------------------------------------------------------------------------------------------------------------- |
451
- | `navigateToNext()` | Advance to the next screen. From the last step, calls `onResult({ status: 'success', ... })`. |
452
- | `navigateBack()` | Pop the active screen. From the first step, calls `onResult({ status: 'failure', error: ... })` with `cancelled` semantics. |
453
- | `navigateToStart()` | Reset the path to the first screen — a flow restart after a terminal failure. |
454
- | `exit(reason?)` | Exit immediately — useful for "abort" buttons. Defaults to `cancelled`. |
455
- | `captured` | Snapshot of artifacts collected so far (`selfiePath`, `livenessPaths`, `frontDocumentPath`, etc). |
455
+ | Member | Behaviour |
456
+ | ------------------- | ------------------------------------------------------------------------------------------------- |
457
+ | `navigateToNext()` | Advance to the next screen. From the last step, calls `onResult({ status: 'success', ... })`. |
458
+ | `navigateBack()` | Pop the active screen. From the first step, calls `onResult({ status: 'cancelled' })`. |
459
+ | `navigateToStart()` | Reset the path to the first screen — a flow restart after a terminal failure. |
460
+ | `exit(reason?)` | Exit immediately — useful for "abort" buttons. Defaults to `cancelled`. |
461
+ | `captured` | Snapshot of artifacts collected so far (`selfiePath`, `livenessPaths`, `frontDocumentPath`, etc). |
456
462
 
457
463
  Calling `useFlowNavigation()` outside `<UseSmileIDBuilder>` throws — the misuse is loud at first render rather than silently no-op-ing.
458
464
 
@@ -469,7 +475,7 @@ Calling `useFlowNavigation()` outside `<UseSmileIDBuilder>` throws — the misus
469
475
 
470
476
  ## Job-specific parameters
471
477
 
472
- Each job type that needs identity fields reads them from a top-level builder property. The shared `user_details` part (`b.userDetails`) is required by every KYC and document job; `country` is the ISO 3166-1 alpha-2 code.
478
+ Each job type that needs identity fields reads them from a top-level builder property. The shared `user_details` part (`b.userDetails`) is optional: the SDK checks none of its fields, and the API reports any a job needs. `country` is the ISO 3166-1 alpha-2 code.
473
479
 
474
480
  | Job type | Builder property | Required fields | Notes |
475
481
  | --------------------------------------- | --------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -507,7 +513,7 @@ b.userDetails = {
507
513
 
508
514
  `DocumentSide` (exported from `@smileid/usesmileid`) gains `Visa` (`"visa"`) for the residency visa page, so an exhaustive `switch` over it needs the new case.
509
515
 
510
- `user_details` requires non-blank `givenNames` and `lastName` plus at least one of `email` / `phoneNumber`. Pre-flight any payload with `b.validateDocumentVerificationParams(...)`, `b.validateEnhancedDocumentVerificationParams(...)`, or `b.validateUserDetails(...)` before assigning.
516
+ Pre-flight any payload with `b.validateDocumentVerificationParams(...)` or `b.validateEnhancedDocumentVerificationParams(...)` before assigning.
511
517
 
512
518
  ---
513
519
 
@@ -557,7 +563,7 @@ A `"captured"` result carries a `CapturedJob`:
557
563
 
558
564
  To forward the job, send the job type's `/v3` request with `headers`, the images as their usual form parts, and the three package fields. The package holds everything else the SDK would have sent (the consent record, the metadata and the request signature), encrypted with AES-256-GCM for Smile ID. Forward it as is: the server rejects a package that was changed. Forward the image files byte-for-byte too: they carry an integrity seal that re-encoding invalidates. A document imported from the gallery or taken with the manual shutter is kept in the app's cache, which the OS may clear under storage pressure, so forward such a job promptly.
559
565
 
560
- Send each file under the form part the SDK would have used: `selfieImage` as `selfie_image`, `livenessImages` as `liveness_images` in the list's order, `frontDocument` as `document`, `backDocument` as `document_back` and `visaDocument` as `visa`. The request signature in the package covers the images by part name and order, so the server rejects a job sent any other way. Forward the job soon after the flow ends: the package carries the access token and the request timestamp from the capture, which the server checks and which can't be refreshed without capturing again.
566
+ Send each file under the form part the SDK would have used: `selfieImage` as `selfie_image`, `livenessImages` as `liveness_images` in the list's order, `frontDocument` as `document`, `backDocument` as `document_back` and `visaDocument` as `visa`. The request signature in the package covers the images by part name and order, so the server rejects a job sent any other way. Forward the job before its access token expires: `headers` carries the token from the capture, and the server rejects the job once that token has expired.
561
567
 
562
568
  On iOS the system can move the app's data container between launches, for example across an app update, so don't save these absolute URIs. To forward a job in a later launch, save each path relative to the container and rebuild it then.
563
569
 
@@ -16,8 +16,6 @@ export declare const CameraDefaults: {
16
16
  readonly width: 1280;
17
17
  readonly height: 720;
18
18
  };
19
- /** How long a streaming capture waits for its first analyzed frame before reporting the camera unavailable. */
20
- readonly firstFrameTimeoutMs: 10000;
21
19
  /** Longest-edge ceiling (px) for an imported document image; downscale-only. */
22
20
  readonly documentMaxDimension: 1600;
23
21
  /** JPEG quality (0–1) for imported document images. */
@@ -1 +1 @@
1
- "use strict";export const CameraDefaults={focusRunningDurationMs:600,focusSettledDurationMs:500,analysisTargetFps:30,analysisTargetResolution:{width:640,height:480},documentAnalysisResolution:{width:1280,height:720},firstFrameTimeoutMs:1e4,documentMaxDimension:1600,documentJpegQuality:.85,minGalleryDocumentDimensionPx:600,selfieJpegTargetWidth:480,selfieJpegTargetHeight:640};
1
+ "use strict";export const CameraDefaults={focusRunningDurationMs:600,focusSettledDurationMs:500,analysisTargetFps:30,analysisTargetResolution:{width:640,height:480},documentAnalysisResolution:{width:1280,height:720},documentMaxDimension:1600,documentJpegQuality:.85,minGalleryDocumentDimensionPx:600,selfieJpegTargetWidth:480,selfieJpegTargetHeight:640};
@@ -26,3 +26,15 @@ export declare class ProcessingCancelledException extends UseSmileIDGeneralExcep
26
26
  cause?: unknown;
27
27
  });
28
28
  }
29
+ /**
30
+ * The flow's navigation failed: njia refused to start the flow's engine, or a
31
+ * call to it failed. Surfaced through `onResult.failure` with
32
+ * `GENERAL_INVALID_STATE` and njia's error as its `cause`, as the native SDKs
33
+ * surface it through their general exception.
34
+ */
35
+ export declare class NavigationFailedException extends UseSmileIDGeneralException {
36
+ readonly errorCode: "GENERAL_INVALID_STATE";
37
+ constructor(args: {
38
+ cause: unknown;
39
+ });
40
+ }
@@ -1 +1 @@
1
- "use strict";import{UseSmileIDErrorCode as s}from"./use_smile_id_error_code";import{UseSmileIDGeneralException as r}from"./use_smile_id_general_exception";export class ConsentDeniedException extends r{errorCode=s.General.OperationFailed;constructor(e){super({message:"User denied consent",suggestedFix:"The user declined the consent notice; no further action is required.",errorDetails:{timestamp:e.timestamp}})}}export class ProcessingCancelledException extends r{errorCode=s.General.OperationFailed;constructor(e={}){super({message:"Processing was cancelled",suggestedFix:"The user exited the processing screen before submission completed.",...e.cause!==void 0?{cause:e.cause}:{}})}}
1
+ "use strict";import{UseSmileIDErrorCode as s}from"./use_smile_id_error_code";import{UseSmileIDGeneralException as r}from"./use_smile_id_general_exception";export class ConsentDeniedException extends r{errorCode=s.General.OperationFailed;constructor(e){super({message:"User denied consent",suggestedFix:"The user declined the consent notice; no further action is required.",errorDetails:{timestamp:e.timestamp}})}}export class ProcessingCancelledException extends r{errorCode=s.General.OperationFailed;constructor(e={}){super({message:"Processing was cancelled",suggestedFix:"The user exited the processing screen before submission completed.",...e.cause!==void 0?{cause:e.cause}:{}})}}export class NavigationFailedException extends r{errorCode=s.General.InvalidState;constructor(e){super({message:`The flow's navigation failed: ${e.cause instanceof Error?e.cause.message:String(e.cause)}`,suggestedFix:"Contact Smile ID support if the issue persists.",cause:e.cause})}}
@@ -20,9 +20,10 @@ export { UseSmileIDNetworkException } from "./use_smile_id_network_exception";
20
20
  export { UseSmileIDAttestationException } from "./use_smile_id_attestation_exception";
21
21
  export { UseSmileIDGeneralException } from "./use_smile_id_general_exception";
22
22
  export { BuilderValidationException } from "./builder_validation_exception";
23
- export { ConsentDeniedException, ProcessingCancelledException, } from "./flow_exceptions";
23
+ export { ConsentDeniedException, NavigationFailedException, ProcessingCancelledException, } from "./flow_exceptions";
24
24
  export { EmptyScreensBlockException } from "./empty_screens_block_exception";
25
25
  export { InvalidScreenOrderException } from "./invalid_screen_order_exception";
26
+ export { InvalidPartnerScreenException } from "./invalid_partner_screen_exception";
26
27
  export { MissingCaptureForPreviewException } from "./missing_capture_for_preview_exception";
27
28
  export { DuplicateScreenTypeException } from "./duplicate_screen_type_exception";
28
29
  export { AgentModeWithEnhancedLivenessException } from "./agent_mode_with_enhanced_liveness_exception";
@@ -1 +1 @@
1
- "use strict";export{IssueSeverity}from"./issue_severity";export{UseSmileIDErrorCode,isNetworkErrorCode,isRetryableErrorCode}from"./use_smile_id_error_code";export{UseSmileIDException}from"./use_smile_id_exception";export{UseSmileIDValidationException}from"./use_smile_id_validation_exception";export{UseSmileIDBuilderException}from"./use_smile_id_builder_exception";export{UseSmileIDCameraException}from"./use_smile_id_camera_exception";export{UseSmileIDCameraSurfaceException}from"./use_smile_id_camera_surface_exception";export{UseSmileIDNetworkException}from"./use_smile_id_network_exception";export{UseSmileIDAttestationException}from"./use_smile_id_attestation_exception";export{UseSmileIDGeneralException}from"./use_smile_id_general_exception";export{BuilderValidationException}from"./builder_validation_exception";export{ConsentDeniedException,ProcessingCancelledException}from"./flow_exceptions";export{EmptyScreensBlockException}from"./empty_screens_block_exception";export{InvalidScreenOrderException}from"./invalid_screen_order_exception";export{MissingCaptureForPreviewException}from"./missing_capture_for_preview_exception";export{DuplicateScreenTypeException}from"./duplicate_screen_type_exception";export{AgentModeWithEnhancedLivenessException}from"./agent_mode_with_enhanced_liveness_exception";export{InvalidSelfieCaptureConfigException}from"./invalid_selfie_capture_config_exception";export{InvalidDocumentCaptureConfigException}from"./invalid_document_capture_config_exception";export{InvalidMissingCaptureTypeException}from"./invalid_missing_capture_type_exception";export{InvalidConsentConfigException}from"./invalid_consent_config_exception";export{InvalidConsentInformationException}from"./invalid_consent_information_exception";export{MissingMLConfigurationBlockException}from"./missing_ml_configuration_block_exception";export{MissingNetworkConfigurationBlockException}from"./missing_network_configuration_block_exception";export{MissingPartnerConfigException}from"./missing_partner_config_exception";export{LivenessFrameCountException}from"./liveness_frame_count_exception";export{MissingJobTypeException}from"./missing_job_type_exception";export{MissingRequiredFieldException}from"./missing_required_field_exception";export{InvalidJobTypeScreenConfigException}from"./invalid_job_type_screen_config_exception";export{UnusedJobParamsException}from"./unused_job_params_exception";export{InvalidFieldValueException}from"./invalid_field_value_exception";export{NetworkServerException,NetworkTransportException,NetworkTimeoutException,NetworkResponseParseException,NetworkRequestBuildException,NetworkUnknownException,mapAxiosError}from"./use_smile_id_network_exception";
1
+ "use strict";export{IssueSeverity}from"./issue_severity";export{UseSmileIDErrorCode,isNetworkErrorCode,isRetryableErrorCode}from"./use_smile_id_error_code";export{UseSmileIDException}from"./use_smile_id_exception";export{UseSmileIDValidationException}from"./use_smile_id_validation_exception";export{UseSmileIDBuilderException}from"./use_smile_id_builder_exception";export{UseSmileIDCameraException}from"./use_smile_id_camera_exception";export{UseSmileIDCameraSurfaceException}from"./use_smile_id_camera_surface_exception";export{UseSmileIDNetworkException}from"./use_smile_id_network_exception";export{UseSmileIDAttestationException}from"./use_smile_id_attestation_exception";export{UseSmileIDGeneralException}from"./use_smile_id_general_exception";export{BuilderValidationException}from"./builder_validation_exception";export{ConsentDeniedException,NavigationFailedException,ProcessingCancelledException}from"./flow_exceptions";export{EmptyScreensBlockException}from"./empty_screens_block_exception";export{InvalidScreenOrderException}from"./invalid_screen_order_exception";export{InvalidPartnerScreenException}from"./invalid_partner_screen_exception";export{MissingCaptureForPreviewException}from"./missing_capture_for_preview_exception";export{DuplicateScreenTypeException}from"./duplicate_screen_type_exception";export{AgentModeWithEnhancedLivenessException}from"./agent_mode_with_enhanced_liveness_exception";export{InvalidSelfieCaptureConfigException}from"./invalid_selfie_capture_config_exception";export{InvalidDocumentCaptureConfigException}from"./invalid_document_capture_config_exception";export{InvalidMissingCaptureTypeException}from"./invalid_missing_capture_type_exception";export{InvalidConsentConfigException}from"./invalid_consent_config_exception";export{InvalidConsentInformationException}from"./invalid_consent_information_exception";export{MissingMLConfigurationBlockException}from"./missing_ml_configuration_block_exception";export{MissingNetworkConfigurationBlockException}from"./missing_network_configuration_block_exception";export{MissingPartnerConfigException}from"./missing_partner_config_exception";export{LivenessFrameCountException}from"./liveness_frame_count_exception";export{MissingJobTypeException}from"./missing_job_type_exception";export{MissingRequiredFieldException}from"./missing_required_field_exception";export{InvalidJobTypeScreenConfigException}from"./invalid_job_type_screen_config_exception";export{UnusedJobParamsException}from"./unused_job_params_exception";export{InvalidFieldValueException}from"./invalid_field_value_exception";export{NetworkServerException,NetworkTransportException,NetworkTimeoutException,NetworkResponseParseException,NetworkRequestBuildException,NetworkUnknownException,mapAxiosError}from"./use_smile_id_network_exception";
@@ -0,0 +1,10 @@
1
+ import { UseSmileIDBuilderException } from "./use_smile_id_builder_exception";
2
+ /**
3
+ * A partner screen (`screens.partner(id, render)`) has a blank or repeated
4
+ * id, or sits between a capture and its preview, which the flow keeps
5
+ * together so the preview's Retake reaches the capture.
6
+ */
7
+ export declare class InvalidPartnerScreenException extends UseSmileIDBuilderException {
8
+ readonly errorCode: "BUILDER_INVALID_PARTNER_SCREEN";
9
+ constructor(reason: string);
10
+ }
@@ -0,0 +1 @@
1
+ "use strict";import{IssueSeverity as r}from"./issue_severity";import{UseSmileIDBuilderException as i}from"./use_smile_id_builder_exception";import{UseSmileIDErrorCode as t}from"./use_smile_id_error_code";export class InvalidPartnerScreenException extends i{errorCode=t.Builder.InvalidPartnerScreen;constructor(e){super({message:`Invalid partner screen: ${e}`,severity:r.error,suggestedFix:"Give each partner screen its own non-blank id, and place it before a capture or after its preview.",errorDetails:{reason:e}})}}
@@ -35,6 +35,7 @@ export declare const UseSmileIDErrorCode: {
35
35
  readonly InvalidConsentInformation: "BUILDER_INVALID_CONSENT_INFORMATION";
36
36
  readonly InvalidJobTypeScreenConfig: "BUILDER_INVALID_JOB_TYPE_SCREEN_CONFIG";
37
37
  readonly UnusedJobParams: "BUILDER_UNUSED_JOB_PARAMS";
38
+ readonly InvalidPartnerScreen: "BUILDER_INVALID_PARTNER_SCREEN";
38
39
  };
39
40
  /** Camera / capture surface. */
40
41
  readonly Camera: {
@@ -1 +1 @@
1
- "use strict";export const UseSmileIDErrorCode={Builder:{ValidationError:"BUILDER_VALIDATION_ERROR",InvalidConfiguration:"BUILDER_INVALID_CONFIG",MissingRequiredField:"BUILDER_MISSING_FIELD",InvalidConsentConfig:"BUILDER_INVALID_CONSENT_CONFIG",MissingCaptureType:"BUILDER_MISSING_CAPTURE_TYPE",EmptyScreensBlock:"BUILDER_EMPTY_SCREENS",MissingScreenConfiguration:"BUILDER_MISSING_SCREEN_CONFIG",DuplicateScreenType:"BUILDER_DUPLICATE_SCREEN",InvalidSelfieCaptureConfig:"BUILDER_INVALID_SELFIE_CONFIG",AgentModeWithEnhancedLiveness:"BUILDER_AGENT_MODE_WITH_ENHANCED_LIVENESS",InvalidDocumentCaptureConfig:"BUILDER_INVALID_DOCUMENT_CONFIG",MissingMLConfiguration:"BUILDER_MISSING_ML_CONFIG",MissingNetworkConfiguration:"BUILDER_MISSING_NETWORK_CONFIG",MissingJobType:"BUILDER_MISSING_JOB_TYPE",MissingCaptureForPreview:"BUILDER_MISSING_CAPTURE_FOR_PREVIEW",InvalidScreenOrder:"BUILDER_INVALID_SCREEN_ORDER",ConfigurationBlockFailed:"BUILDER_CONFIG_BLOCK_FAILED",InvalidConsentInformation:"BUILDER_INVALID_CONSENT_INFORMATION",InvalidJobTypeScreenConfig:"BUILDER_INVALID_JOB_TYPE_SCREEN_CONFIG",UnusedJobParams:"BUILDER_UNUSED_JOB_PARAMS"},Camera:{InitializationFailed:"CAMERA_INIT_FAILED",PermissionDenied:"CAMERA_PERMISSION_DENIED",CaptureFailed:"CAMERA_CAPTURE_FAILED",UseCaseNotSupported:"CAMERA_USE_CASE_NOT_SUPPORTED",VideoCaptureDisabled:"CAMERA_VIDEO_DISABLED",Unknown:"CAMERA_UNKNOWN_ERROR"},Network:{ConnectionFailed:"NETWORK_CONNECTION_FAILED",Timeout:"NETWORK_TIMEOUT",RequestFailed:"NETWORK_REQUEST_FAILED",ResponseParseError:"NETWORK_PARSE_ERROR",Unauthorized:"NETWORK_UNAUTHORIZED",Forbidden:"NETWORK_FORBIDDEN",NotFound:"NETWORK_NOT_FOUND",RateLimit:"NETWORK_RATE_LIMIT",ServerError:"NETWORK_SERVER_ERROR",CallbackUrlRequired:"NETWORK_CALLBACK_URL_REQUIRED"},Validation:{InvalidInput:"VALIDATION_INVALID_INPUT",InvalidState:"VALIDATION_INVALID_STATE",ConstraintViolation:"VALIDATION_CONSTRAINT_VIOLATION"},General:{Unknown:"GENERAL_UNKNOWN_ERROR",InvalidState:"GENERAL_INVALID_STATE",OperationFailed:"GENERAL_OPERATION_FAILED"}};const I=new Set([UseSmileIDErrorCode.Camera.CaptureFailed,UseSmileIDErrorCode.Network.ConnectionFailed,UseSmileIDErrorCode.Network.Timeout,UseSmileIDErrorCode.Network.RateLimit,UseSmileIDErrorCode.Network.ServerError]),e=new Set(Object.values(UseSmileIDErrorCode.Network));export function isRetryableErrorCode(E){return I.has(E)}export function isNetworkErrorCode(E){return e.has(E)}
1
+ "use strict";export const UseSmileIDErrorCode={Builder:{ValidationError:"BUILDER_VALIDATION_ERROR",InvalidConfiguration:"BUILDER_INVALID_CONFIG",MissingRequiredField:"BUILDER_MISSING_FIELD",InvalidConsentConfig:"BUILDER_INVALID_CONSENT_CONFIG",MissingCaptureType:"BUILDER_MISSING_CAPTURE_TYPE",EmptyScreensBlock:"BUILDER_EMPTY_SCREENS",MissingScreenConfiguration:"BUILDER_MISSING_SCREEN_CONFIG",DuplicateScreenType:"BUILDER_DUPLICATE_SCREEN",InvalidSelfieCaptureConfig:"BUILDER_INVALID_SELFIE_CONFIG",AgentModeWithEnhancedLiveness:"BUILDER_AGENT_MODE_WITH_ENHANCED_LIVENESS",InvalidDocumentCaptureConfig:"BUILDER_INVALID_DOCUMENT_CONFIG",MissingMLConfiguration:"BUILDER_MISSING_ML_CONFIG",MissingNetworkConfiguration:"BUILDER_MISSING_NETWORK_CONFIG",MissingJobType:"BUILDER_MISSING_JOB_TYPE",MissingCaptureForPreview:"BUILDER_MISSING_CAPTURE_FOR_PREVIEW",InvalidScreenOrder:"BUILDER_INVALID_SCREEN_ORDER",ConfigurationBlockFailed:"BUILDER_CONFIG_BLOCK_FAILED",InvalidConsentInformation:"BUILDER_INVALID_CONSENT_INFORMATION",InvalidJobTypeScreenConfig:"BUILDER_INVALID_JOB_TYPE_SCREEN_CONFIG",UnusedJobParams:"BUILDER_UNUSED_JOB_PARAMS",InvalidPartnerScreen:"BUILDER_INVALID_PARTNER_SCREEN"},Camera:{InitializationFailed:"CAMERA_INIT_FAILED",PermissionDenied:"CAMERA_PERMISSION_DENIED",CaptureFailed:"CAMERA_CAPTURE_FAILED",UseCaseNotSupported:"CAMERA_USE_CASE_NOT_SUPPORTED",VideoCaptureDisabled:"CAMERA_VIDEO_DISABLED",Unknown:"CAMERA_UNKNOWN_ERROR"},Network:{ConnectionFailed:"NETWORK_CONNECTION_FAILED",Timeout:"NETWORK_TIMEOUT",RequestFailed:"NETWORK_REQUEST_FAILED",ResponseParseError:"NETWORK_PARSE_ERROR",Unauthorized:"NETWORK_UNAUTHORIZED",Forbidden:"NETWORK_FORBIDDEN",NotFound:"NETWORK_NOT_FOUND",RateLimit:"NETWORK_RATE_LIMIT",ServerError:"NETWORK_SERVER_ERROR",CallbackUrlRequired:"NETWORK_CALLBACK_URL_REQUIRED"},Validation:{InvalidInput:"VALIDATION_INVALID_INPUT",InvalidState:"VALIDATION_INVALID_STATE",ConstraintViolation:"VALIDATION_CONSTRAINT_VIOLATION"},General:{Unknown:"GENERAL_UNKNOWN_ERROR",InvalidState:"GENERAL_INVALID_STATE",OperationFailed:"GENERAL_OPERATION_FAILED"}};const I=new Set([UseSmileIDErrorCode.Camera.CaptureFailed,UseSmileIDErrorCode.Network.ConnectionFailed,UseSmileIDErrorCode.Network.Timeout,UseSmileIDErrorCode.Network.RateLimit,UseSmileIDErrorCode.Network.ServerError]),e=new Set(Object.values(UseSmileIDErrorCode.Network));export function isRetryableErrorCode(E){return I.has(E)}export function isNetworkErrorCode(E){return e.has(E)}
@@ -16,17 +16,19 @@ export type ConsentInformation = {
16
16
  };
17
17
  /**
18
18
  * Subject's personal details, sent as the `user_details` JSON part.
19
- * Requires non-blank `givenNames` and `lastName`, plus at least one of
20
- * `email` or `phoneNumber`.
19
+ * The SDK checks none of these fields: it submits them as given, empty
20
+ * included, and the API rejects a job that lacks one it needs, naming the
21
+ * field. Which fields a job needs is the API's call, per partner and
22
+ * product: `GET /v3/services/config` lists them.
21
23
  */
22
24
  export type UserDetails = {
23
- /** Subject's given / first names. Required, non-blank. */
25
+ /** Subject's given / first names. */
24
26
  readonly givenNames: string;
25
- /** Subject's family / last name. Required, non-blank. */
27
+ /** Subject's family / last name. */
26
28
  readonly lastName: string;
27
- /** Optional email address. */
29
+ /** Email address. */
28
30
  readonly email?: string;
29
- /** Optional phone number in international format (leading `+`). */
31
+ /** Phone number in international format (leading `+`). */
30
32
  readonly phoneNumber?: string;
31
33
  };
32
34
  /**
@@ -0,0 +1,27 @@
1
+ import { type AxiosInstance } from "axios";
2
+ /** A submission path, so the preflight goes to the host and stage the submission does. */
3
+ export declare const PREFLIGHT_PATH = "/v3/registration";
4
+ /**
5
+ * Opens the connection a flow's submission will use while the user is still
6
+ * on the first screens, so the submission doesn't wait on the processing
7
+ * screen for DNS, TCP and TLS as well as the upload.
8
+ *
9
+ * `warmUp` sends one CORS preflight, `OPTIONS /v3/registration`, to the API
10
+ * host. API Gateway answers preflights itself, with no Lambda behind it. The
11
+ * preflight goes through a bare axios instance with the submission client's
12
+ * base URL and adapter, and none of its interceptors: it carries no token,
13
+ * signature, integrity claim or partner header, and the partner's own
14
+ * interceptors never see it. React Native sends every request through one
15
+ * native client (OkHttp on Android, an `NSURLSession` on iOS), so the
16
+ * connection lands in the pool the submission draws from.
17
+ */
18
+ export declare class ConnectionWarmer {
19
+ private readonly _client;
20
+ private _started;
21
+ constructor(submissionClient: AxiosInstance);
22
+ /**
23
+ * Sends the preflight once; later calls do nothing. A failure is ignored:
24
+ * the submission then connects as it would have.
25
+ */
26
+ warmUp(): void;
27
+ }
@@ -0,0 +1 @@
1
+ "use strict";import n from"axios";export const PREFLIGHT_PATH="/v3/registration";export class ConnectionWarmer{_client;_started=!1;constructor(i){const{baseURL:t,timeout:e,adapter:r}=i.defaults;this._client=n.create({...t!==void 0&&{baseURL:t},...e!==void 0&&{timeout:e},...r!==void 0&&{adapter:r}})}warmUp(){this._started||(this._started=!0,this._client.request({url:PREFLIGHT_PATH,method:"options"}).catch(()=>{}))}}
@@ -1 +1 @@
1
- "use strict";import{sourceSdkIdentifier as t}from"@smileid/usesmileid_bridge";import{currentRequestTimestamp as s}from"../../security/request_timestamp";const n="12.2.0";export class SmileAuthInterceptor{_partnerConfig;_tokenHolder;constructor(e){this._partnerConfig=e.partnerConfig,this._tokenHolder=e.tokenHolder}attach(e){return{request:e.interceptors.request.use(async r=>this._onRequest(r))}}async _onRequest(e){return e.headers.set("smileid-token",this._tokenHolder.current),e.headers.set("smileid-source-sdk",t()),e.headers.set("smileid-source-sdk-version",n),e.headers.set("smileid-partner-id",this._partnerConfig.partnerId),e.headers.set("smileid-request-timestamp",s()),e}}
1
+ "use strict";import{sourceSdkIdentifier as t}from"@smileid/usesmileid_bridge";import{currentRequestTimestamp as s}from"../../security/request_timestamp";const n="12.3.0";export class SmileAuthInterceptor{_partnerConfig;_tokenHolder;constructor(e){this._partnerConfig=e.partnerConfig,this._tokenHolder=e.tokenHolder}attach(e){return{request:e.interceptors.request.use(async r=>this._onRequest(r))}}async _onRequest(e){return e.headers.set("smileid-token",this._tokenHolder.current),e.headers.set("smileid-source-sdk",t()),e.headers.set("smileid-source-sdk-version",n),e.headers.set("smileid-partner-id",this._partnerConfig.partnerId),e.headers.set("smileid-request-timestamp",s()),e}}
@@ -24,6 +24,9 @@ export declare class SmileIDAPI {
24
24
  private readonly _client;
25
25
  private readonly _partnerConfig;
26
26
  constructor(client: AxiosInstance, partnerConfig: PartnerConfig);
27
+ private _connectionWarmer;
28
+ /** Opens the connection the submission will use, once per client; see `ConnectionWarmer`. */
29
+ warmUpConnection(): void;
27
30
  /**
28
31
  * v3 smart-selfie enrollment.
29
32
  *
@@ -1 +1 @@
1
- "use strict";import u from"axios";import{SmileIDUrls as d}from"../smile_id_urls";import{userDetailsPayloadToWire as g}from"../model/user_details_payload";import{SmileAuthInterceptor as h}from"./interceptors/smile_auth_interceptor";import{attachLoggingInterceptor as y}from"./interceptors/logging_interceptor";import{REQUEST_MAC_OPT_IN_KEY as b}from"./interceptors/smile_request_mac_interceptor";import{ATTESTATION_OPT_IN_KEY as D}from"./interceptors/smile_integrity_interceptor";import{NetworkResponseParseException as m}from"../../core/exception";import{LivenessFrameCountException as S}from"../../core/exception";const l=d.production,_=d.sandbox,C={[b]:!0,[D]:!0};export class SmileIDAPI{_client;_partnerConfig;constructor(t,n){this._client=t,this._partnerConfig=n}async smartSelfieEnrollment(t){const n=this._buildSelfieFormData(t);return r(n,t),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/registration",n)}async smartSelfieAuthentication(t){const n=this._buildSelfieFormData(t);return i(n,"user_id",t.userId),r(n,t),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/authentication",n)}async enhancedKyc(t){const n=new FormData;return this._appendIdFields(n,t.params),r(n,t),t.params.bankCode&&i(n,"bank_code",t.params.bankCode),t.params.mobileOperator&&i(n,"operator",t.params.mobileOperator),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/enhanced_kyc",n)}async biometricKyc(t){const n=t.params.useEnrolledImage,e=this._buildSelfieFormData(t);return this._appendIdFields(e,t.params),r(e,t),n&&i(e,"use_enrolled_image","true"),this._appendPartnerConfigParts(e),this._appendConsentAndMetadata(e,t.consent,t.metadata),this._postMultipart("/v3/biometric_kyc",e)}async documentVerification(t){return this._postDocumentVerification(t,"/v3/document_verification")}async enhancedDocumentVerification(t){return this._postDocumentVerification(t,"/v3/enhanced_document_verification")}async residencyDocumentVerification(t){return this._postDocumentVerification(t,"/v3/residency_document_verification")}async _postDocumentVerification(t,n){const e=this._buildSelfieFormData(t);return s(e,"document",t.frontDocument),"backDocument"in t&&t.backDocument&&s(e,"document_back",t.backDocument),"visaDocument"in t&&s(e,"visa",t.visaDocument),t.country&&i(e,"country",t.country),t.idType&&i(e,"id_type",t.idType),r(e,t),this._appendPartnerConfigParts(e),this._appendConsentAndMetadata(e,t.consent,t.metadata),this._postMultipart(n,e)}_buildSelfieFormData(t){SmileIDAPI._validateLivenessCount(t.livenessImages,t.expectedLivenessImageCount);const n=new FormData;s(n,"selfie_image",t.selfieImage);for(const e of t.livenessImages)s(n,"liveness_images",e);return n}static _validateLivenessCount(t,n){if(t.length!==n)throw new S({expected:n,actual:t.length})}_appendIdFields(t,n){n.idType&&i(t,"id_type",n.idType),n.idNumber&&i(t,"id_number",n.idNumber),n.country&&i(t,"country",n.country)}_appendPartnerConfigParts(t){const n=this._partnerConfig.callbackUrl;n&&i(t,"callback_url",n);const e=this._partnerConfig.partnerParams;e&&Object.keys(e).length>0&&c(t,"partner_params",e)}_appendConsentAndMetadata(t,n,e){n!==void 0&&c(t,"consent",{granted:n.granted,granted_at:n.grantedAt,notice_language:n.noticeLanguage,notice_privacy_policy_url:n.noticePrivacyPolicyUrl}),c(t,"metadata",e.toEntries())}async _postMultipart(t,n){const e=await this._client.post(t,n,{headers:{"Content-Type":"multipart/form-data"},...C});return P(e.data)}}function P(a){if(a==null||typeof a!="object"||Array.isArray(a))throw new m({message:"SmileIDAPI: server returned an empty or non-object response body."});const t=a,n=(p,f)=>{if(typeof p!="string")throw new m({message:`SmileIDAPI: response is missing the required string field '${f}'.`});return p},e={jobId:n(t.job_id??t.jobId,"job_id"),userId:n(t.user_id??t.userId,"user_id"),status:n(t.status,"status"),message:n(t.message,"message")},o=t.created_at??t.createdAt;return typeof o=="string"&&o.length>0?{...e,createdAt:o}:e}function r(a,t){const n=t.userDetails;if(n===void 0)return;const e=g(n);Object.keys(e).length!==0&&c(a,"user_details",e)}function i(a,t,n){a.append(t,n)}function c(a,t,n){const e=JSON.stringify(n);a.append(t,e)}function s(a,t,n){const e=n.split("/").pop()??`${t}.jpg`;a.append(t,{uri:n,name:e,type:"image/jpeg"})}export function buildAxiosClient(a){const e=a.config?.partnerConfig?.useSandbox??!0?_:l,o=a.timeouts?.call??120;return u.create({baseURL:e,timeout:o*1e3})}export{h as SmileAuthInterceptor,y as attachLoggingInterceptor,l as PROD_BASE_URL,_ as SANDBOX_BASE_URL};
1
+ "use strict";import u from"axios";import{SmileIDUrls as d}from"../smile_id_urls";import{userDetailsPayloadToWire as g}from"../model/user_details_payload";import{SmileAuthInterceptor as h}from"./interceptors/smile_auth_interceptor";import{attachLoggingInterceptor as y}from"./interceptors/logging_interceptor";import{REQUEST_MAC_OPT_IN_KEY as b}from"./interceptors/smile_request_mac_interceptor";import{ATTESTATION_OPT_IN_KEY as D}from"./interceptors/smile_integrity_interceptor";import{NetworkResponseParseException as m}from"../../core/exception";import{LivenessFrameCountException as C}from"../../core/exception";import{ConnectionWarmer as S}from"./connection_warmer";const l=d.production,_=d.sandbox,P={[b]:!0,[D]:!0};export class SmileIDAPI{_client;_partnerConfig;constructor(t,n){this._client=t,this._partnerConfig=n}_connectionWarmer;warmUpConnection(){(this._connectionWarmer??=new S(this._client)).warmUp()}async smartSelfieEnrollment(t){const n=this._buildSelfieFormData(t);return r(n,t),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/registration",n)}async smartSelfieAuthentication(t){const n=this._buildSelfieFormData(t);return i(n,"user_id",t.userId),r(n,t),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/authentication",n)}async enhancedKyc(t){const n=new FormData;return this._appendIdFields(n,t.params),r(n,t),t.params.bankCode&&i(n,"bank_code",t.params.bankCode),t.params.mobileOperator&&i(n,"operator",t.params.mobileOperator),this._appendPartnerConfigParts(n),this._appendConsentAndMetadata(n,t.consent,t.metadata),this._postMultipart("/v3/enhanced_kyc",n)}async biometricKyc(t){const n=t.params.useEnrolledImage,e=this._buildSelfieFormData(t);return this._appendIdFields(e,t.params),r(e,t),n&&i(e,"use_enrolled_image","true"),this._appendPartnerConfigParts(e),this._appendConsentAndMetadata(e,t.consent,t.metadata),this._postMultipart("/v3/biometric_kyc",e)}async documentVerification(t){return this._postDocumentVerification(t,"/v3/document_verification")}async enhancedDocumentVerification(t){return this._postDocumentVerification(t,"/v3/enhanced_document_verification")}async residencyDocumentVerification(t){return this._postDocumentVerification(t,"/v3/residency_document_verification")}async _postDocumentVerification(t,n){const e=this._buildSelfieFormData(t);return s(e,"document",t.frontDocument),"backDocument"in t&&t.backDocument&&s(e,"document_back",t.backDocument),"visaDocument"in t&&s(e,"visa",t.visaDocument),t.country&&i(e,"country",t.country),t.idType&&i(e,"id_type",t.idType),r(e,t),this._appendPartnerConfigParts(e),this._appendConsentAndMetadata(e,t.consent,t.metadata),this._postMultipart(n,e)}_buildSelfieFormData(t){SmileIDAPI._validateLivenessCount(t.livenessImages,t.expectedLivenessImageCount);const n=new FormData;s(n,"selfie_image",t.selfieImage);for(const e of t.livenessImages)s(n,"liveness_images",e);return n}static _validateLivenessCount(t,n){if(t.length!==n)throw new C({expected:n,actual:t.length})}_appendIdFields(t,n){n.idType&&i(t,"id_type",n.idType),n.idNumber&&i(t,"id_number",n.idNumber),n.country&&i(t,"country",n.country)}_appendPartnerConfigParts(t){const n=this._partnerConfig.callbackUrl;n&&i(t,"callback_url",n);const e=this._partnerConfig.partnerParams;e&&Object.keys(e).length>0&&c(t,"partner_params",e)}_appendConsentAndMetadata(t,n,e){n!==void 0&&c(t,"consent",{granted:n.granted,granted_at:n.grantedAt,notice_language:n.noticeLanguage,notice_privacy_policy_url:n.noticePrivacyPolicyUrl}),c(t,"metadata",e.toEntries())}async _postMultipart(t,n){const e=await this._client.post(t,n,{headers:{"Content-Type":"multipart/form-data"},...P});return I(e.data)}}function I(a){if(a==null||typeof a!="object"||Array.isArray(a))throw new m({message:"SmileIDAPI: server returned an empty or non-object response body."});const t=a,n=(p,f)=>{if(typeof p!="string")throw new m({message:`SmileIDAPI: response is missing the required string field '${f}'.`});return p},e={jobId:n(t.job_id??t.jobId,"job_id"),userId:n(t.user_id??t.userId,"user_id"),status:n(t.status,"status"),message:n(t.message,"message")},o=t.created_at??t.createdAt;return typeof o=="string"&&o.length>0?{...e,createdAt:o}:e}function r(a,t){const n=t.userDetails;n!==void 0&&c(a,"user_details",g(n))}function i(a,t,n){a.append(t,n)}function c(a,t,n){const e=JSON.stringify(n);a.append(t,e)}function s(a,t,n){const e=n.split("/").pop()??`${t}.jpg`;a.append(t,{uri:n,name:e,type:"image/jpeg"})}export function buildAxiosClient(a){const e=a.config?.partnerConfig?.useSandbox??!0?_:l,o=a.timeouts?.call??120;return u.create({baseURL:e,timeout:o*1e3})}export{h as SmileAuthInterceptor,y as attachLoggingInterceptor,l as PROD_BASE_URL,_ as SANDBOX_BASE_URL};
@@ -69,6 +69,11 @@ export type TokenBoundIdField = "country" | "idType" | "idNumber";
69
69
  * (a bound field is never sent) read, so the two cannot disagree.
70
70
  */
71
71
  export declare function isIdFieldBoundByToken(payload: TokenPayload | undefined, field: TokenBoundIdField): boolean;
72
+ /**
73
+ * Whether the token binds any user detail, which the server then injects
74
+ * into `user_details`.
75
+ */
76
+ export declare function bindsUserDetails(payload: TokenPayload | undefined): boolean;
72
77
  /**
73
78
  * Token consent is COMPLETE when `granted` is `true` and every other
74
79
  * subfield is non-blank. A complete binding — granted with every
@@ -84,10 +89,3 @@ export declare function isTokenConsentComplete(consent: TokenConsent | undefined
84
89
  * what the token must add.
85
90
  */
86
91
  export declare function tokenConsentMissingSubfields(consent: TokenConsent): readonly string[];
87
- /**
88
- * Whether the token binds every user-detail field the SDK would
89
- * otherwise require from the builder: `given_names` AND `last_name`
90
- * AND at least one of `email` / `phone_number`. Only then may
91
- * `builder.userDetails` be omitted entirely.
92
- */
93
- export declare function bindsRequiredUserDetails(payload: TokenPayload | undefined): boolean;
@@ -1 +1 @@
1
- "use strict";import{z as t}from"zod";const a=t.object({granted:t.literal(!0).optional().catch(void 0),granted_at:t.string().optional().catch(void 0),notice_language:t.string().optional().catch(void 0),notice_privacy_policy_url:t.string().optional().catch(void 0)});export const tokenPayloadSchema=t.object({given_names:t.string().optional().catch(void 0),last_name:t.string().optional().catch(void 0),email:t.string().optional().catch(void 0),phone_number:t.string().optional().catch(void 0),country:t.string().optional().catch(void 0),id_type:t.string().optional().catch(void 0),id_number:t.string().optional().catch(void 0),consent:a.optional().catch(void 0)});export function parseTokenPayload(n){if(n===null||typeof n!="object"||Array.isArray(n))return;const e=tokenPayloadSchema.safeParse(n);if(!e.success)return;const i=e.data,u=s(i.consent);return{hasGivenNames:r(i.given_names),hasLastName:r(i.last_name),hasEmail:r(i.email),hasPhoneNumber:r(i.phone_number),...u!==void 0?{consent:u}:{},hasCountry:r(i.country),hasIdType:r(i.id_type),hasIdNumber:r(i.id_number)}}export function isIdFieldBoundByToken(n,e){switch(e){case"country":return n?.hasCountry===!0;case"idType":return n?.hasIdType===!0;case"idNumber":return n?.hasIdNumber===!0}}export function isTokenConsentComplete(n){return n!==void 0&&tokenConsentMissingSubfields(n).length===0}export function tokenConsentMissingSubfields(n){const e=[];return n.granted!==!0&&e.push("granted"),o(n.grantedAt)||e.push("granted_at"),o(n.noticeLanguage)||e.push("notice_language"),o(n.noticePrivacyPolicyUrl)||e.push("notice_privacy_policy_url"),e}export function bindsRequiredUserDetails(n){return n===void 0?!1:n.hasGivenNames&&n.hasLastName&&(n.hasEmail||n.hasPhoneNumber)}function s(n){if(n===void 0)return;const e={...n.granted===!0?{granted:!0}:{},...n.granted_at!==void 0?{grantedAt:n.granted_at}:{},...n.notice_language!==void 0?{noticeLanguage:n.notice_language}:{},...n.notice_privacy_policy_url!==void 0?{noticePrivacyPolicyUrl:n.notice_privacy_policy_url}:{}};return Object.keys(e).length>0?e:void 0}function r(n){return n!==void 0&&n.length>0}function o(n){return n!==void 0&&n.trim().length>0}
1
+ "use strict";import{z as t}from"zod";const a=t.object({granted:t.literal(!0).optional().catch(void 0),granted_at:t.string().optional().catch(void 0),notice_language:t.string().optional().catch(void 0),notice_privacy_policy_url:t.string().optional().catch(void 0)});export const tokenPayloadSchema=t.object({given_names:t.string().optional().catch(void 0),last_name:t.string().optional().catch(void 0),email:t.string().optional().catch(void 0),phone_number:t.string().optional().catch(void 0),country:t.string().optional().catch(void 0),id_type:t.string().optional().catch(void 0),id_number:t.string().optional().catch(void 0),consent:a.optional().catch(void 0)});export function parseTokenPayload(n){if(n===null||typeof n!="object"||Array.isArray(n))return;const e=tokenPayloadSchema.safeParse(n);if(!e.success)return;const i=e.data,u=s(i.consent);return{hasGivenNames:r(i.given_names),hasLastName:r(i.last_name),hasEmail:r(i.email),hasPhoneNumber:r(i.phone_number),...u!==void 0?{consent:u}:{},hasCountry:r(i.country),hasIdType:r(i.id_type),hasIdNumber:r(i.id_number)}}export function isIdFieldBoundByToken(n,e){switch(e){case"country":return n?.hasCountry===!0;case"idType":return n?.hasIdType===!0;case"idNumber":return n?.hasIdNumber===!0}}export function bindsUserDetails(n){return n?.hasGivenNames===!0||n?.hasLastName===!0||n?.hasEmail===!0||n?.hasPhoneNumber===!0}export function isTokenConsentComplete(n){return n!==void 0&&tokenConsentMissingSubfields(n).length===0}export function tokenConsentMissingSubfields(n){const e=[];return n.granted!==!0&&e.push("granted"),o(n.grantedAt)||e.push("granted_at"),o(n.noticeLanguage)||e.push("notice_language"),o(n.noticePrivacyPolicyUrl)||e.push("notice_privacy_policy_url"),e}function s(n){if(n===void 0)return;const e={...n.granted===!0?{granted:!0}:{},...n.granted_at!==void 0?{grantedAt:n.granted_at}:{},...n.notice_language!==void 0?{noticeLanguage:n.notice_language}:{},...n.notice_privacy_policy_url!==void 0?{noticePrivacyPolicyUrl:n.notice_privacy_policy_url}:{}};return Object.keys(e).length>0?e:void 0}function r(n){return n!==void 0&&n.length>0}function o(n){return n!==void 0&&n.trim().length>0}
@@ -8,7 +8,9 @@ import type { TokenPayload } from "./token_payload";
8
8
  * fields the token does **not** already bind. Token-bound fields are dropped
9
9
  * at assembly (`userDetailsPayloadFrom`): the server injects the bound values
10
10
  * and they take precedence over anything the client sends. When nothing
11
- * remains, assembly omits the part entirely (`isUserDetailsPayloadEmpty`).
11
+ * remains, assembly omits the part under a token that binds user details,
12
+ * and otherwise sends `{}` so the API can name the field a job needs
13
+ * (`isUserDetailsPayloadEmpty`).
12
14
  *
13
15
  * Type and helper names are a deliberate cross-SDK shared contract and
14
16
  * intentionally omit the `UseSmileID` prefix (like `TokenPayload`).
@@ -26,9 +28,9 @@ export type UserDetailsPayload = {
26
28
  */
27
29
  export declare function userDetailsPayloadFrom(userDetails: UserDetails, droppingFieldsBoundBy: TokenPayload | undefined): UserDetailsPayload;
28
30
  /**
29
- * True when `userDetailsPayloadToWire` would produce an empty object — the
30
- * caller omits the part instead of sending `{}`. Blank contacts count as
31
- * empty, mirroring the wire encoding that trims and drops them.
31
+ * True when `userDetailsPayloadToWire` would produce an empty object. Blank
32
+ * fields count as empty, mirroring the wire encoding that trims and drops
33
+ * them.
32
34
  */
33
35
  export declare function isUserDetailsPayloadEmpty(payload: UserDetailsPayload): boolean;
34
36
  /**
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export { UseSmileIDBuilder } from "./presentation/flow/dsl/use_smile_id_builder"
10
10
  export { UseSmileIDFlowBuilder } from "./presentation/flow/dsl/use_smile_id_flow_builder";
11
11
  export type { FlowBuildResult, FlowBuildResultInvalid, FlowBuildResultSuccess, } from "./presentation/flow/dsl/flow_build_result";
12
12
  export { ValidationState, type ValidationIssue, type ValidationStateInvalid, } from "./presentation/flow/validation/validation_state";
13
- export { AgentModeWithEnhancedLivenessException, BuilderValidationException, isNetworkErrorCode, isRetryableErrorCode, ConsentDeniedException, DuplicateScreenTypeException, EmptyScreensBlockException, InvalidConsentConfigException, InvalidConsentInformationException, InvalidDocumentCaptureConfigException, InvalidFieldValueException, InvalidJobTypeScreenConfigException, InvalidMissingCaptureTypeException, InvalidScreenOrderException, InvalidSelfieCaptureConfigException, LivenessFrameCountException, IssueSeverity, MissingCaptureForPreviewException, MissingJobTypeException, MissingMLConfigurationBlockException, MissingNetworkConfigurationBlockException, MissingPartnerConfigException, MissingRequiredFieldException, ProcessingCancelledException, UseSmileIDAttestationException, UseSmileIDBuilderException, UseSmileIDCameraException, UseSmileIDCameraSurfaceException, UseSmileIDErrorCode, UseSmileIDException, UseSmileIDGeneralException, UnusedJobParamsException, UseSmileIDNetworkException, type UseSmileIDNetworkErrorCode, UseSmileIDValidationException, } from "./core/exception";
13
+ export { AgentModeWithEnhancedLivenessException, BuilderValidationException, isNetworkErrorCode, isRetryableErrorCode, ConsentDeniedException, DuplicateScreenTypeException, EmptyScreensBlockException, InvalidConsentConfigException, InvalidConsentInformationException, InvalidDocumentCaptureConfigException, InvalidFieldValueException, InvalidJobTypeScreenConfigException, InvalidMissingCaptureTypeException, InvalidScreenOrderException, InvalidPartnerScreenException, InvalidSelfieCaptureConfigException, LivenessFrameCountException, IssueSeverity, MissingCaptureForPreviewException, MissingJobTypeException, MissingMLConfigurationBlockException, MissingNetworkConfigurationBlockException, MissingPartnerConfigException, MissingRequiredFieldException, NavigationFailedException, ProcessingCancelledException, UseSmileIDAttestationException, UseSmileIDBuilderException, UseSmileIDCameraException, UseSmileIDCameraSurfaceException, UseSmileIDErrorCode, UseSmileIDException, UseSmileIDGeneralException, UnusedJobParamsException, UseSmileIDNetworkException, type UseSmileIDNetworkErrorCode, UseSmileIDValidationException, } from "./core/exception";
14
14
  export { UseSmileIDConfigBuilder } from "./presentation/flow/dsl/builder/config_builder";
15
15
  export { ThemeConfigBuilder, type AdaptiveColor, type ThemeConfiguration, } from "./presentation/flow/dsl/builder/theme_builder";
16
16
  export { UseSmileIDNetworkBuilder } from "./data/dsl/use_smile_id_network_builder";
@@ -20,7 +20,8 @@ export { CacheConfigBuilder } from "./data/dsl/builder/cache_config_builder";
20
20
  export { RetryConfigBuilder, RetryStrategy, } from "./data/dsl/builder/retry_config_builder";
21
21
  export { InterceptorConfigBuilder, LoggingInterceptorBuilder, } from "./data/dsl/builder/interceptor_config_builder";
22
22
  export { AnalyzerRegistryBuilder, DocumentAnalyzerScope, FaceAnalyzerScope, UseSmileIDMLBuilder, } from "./presentation/flow/dsl/builder/ml_builder";
23
- export { CaptureConfigBuilder, CaptureType, ConsentConfigBuilder, DocumentCaptureConfigBuilder, InstructionsConfigBuilder, PreviewConfigBuilder, ProcessingConfigBuilder, ScreensBuilder, SelfieCaptureConfigBuilder, type ButtonSlot, type ScreenSpec, type ScreensConfig, } from "./presentation/flow/dsl/builder/screens_builder";
23
+ export { CaptureConfigBuilder, CaptureType, ConsentConfigBuilder, DocumentCaptureConfigBuilder, InstructionsConfigBuilder, PreviewConfigBuilder, ProcessingConfigBuilder, ScreensBuilder, SelfieCaptureConfigBuilder, type ButtonSlot, type PartnerScreenConfig, type PartnerStepScope, type ScreenSpec, type ScreensConfig, } from "./presentation/flow/dsl/builder/screens_builder";
24
+ export { PartnerValueFormat } from "./presentation/flow/dsl/builder/partner_value_format";
24
25
  export type { FlowConfiguration } from "./presentation/flow/config/flow_configuration";
25
26
  export { FlowNavigationManager, type CapturedArtifacts, type FlowExitHandler, type FlowExitReason, } from "./presentation/flow/flow_navigation_manager";
26
27
  export { FlowNavigationProvider, useFlowNavigation, type FlowNavigationProviderProps, } from "./presentation/flow/flow_navigation_context";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";export{UseSmileIDBuilder}from"./presentation/flow/dsl/use_smile_id_builder";export{UseSmileIDFlowBuilder}from"./presentation/flow/dsl/use_smile_id_flow_builder";export{ValidationState}from"./presentation/flow/validation/validation_state";export{AgentModeWithEnhancedLivenessException,BuilderValidationException,isNetworkErrorCode,isRetryableErrorCode,ConsentDeniedException,DuplicateScreenTypeException,EmptyScreensBlockException,InvalidConsentConfigException,InvalidConsentInformationException,InvalidDocumentCaptureConfigException,InvalidFieldValueException,InvalidJobTypeScreenConfigException,InvalidMissingCaptureTypeException,InvalidScreenOrderException,InvalidSelfieCaptureConfigException,LivenessFrameCountException,IssueSeverity,MissingCaptureForPreviewException,MissingJobTypeException,MissingMLConfigurationBlockException,MissingNetworkConfigurationBlockException,MissingPartnerConfigException,MissingRequiredFieldException,ProcessingCancelledException,UseSmileIDAttestationException,UseSmileIDBuilderException,UseSmileIDCameraException,UseSmileIDCameraSurfaceException,UseSmileIDErrorCode,UseSmileIDException,UseSmileIDGeneralException,UnusedJobParamsException,UseSmileIDNetworkException,UseSmileIDValidationException}from"./core/exception";export{UseSmileIDConfigBuilder}from"./presentation/flow/dsl/builder/config_builder";export{ThemeConfigBuilder}from"./presentation/flow/dsl/builder/theme_builder";export{UseSmileIDNetworkBuilder}from"./data/dsl/use_smile_id_network_builder";export{ConfigBuilder,LoggingConfigBuilder,PartnerConfigBuilder}from"./data/dsl/builder/config_builder";export{TimeoutConfigBuilder}from"./data/dsl/builder/timeout_config_builder";export{CacheConfigBuilder}from"./data/dsl/builder/cache_config_builder";export{RetryConfigBuilder,RetryStrategy}from"./data/dsl/builder/retry_config_builder";export{InterceptorConfigBuilder,LoggingInterceptorBuilder}from"./data/dsl/builder/interceptor_config_builder";export{AnalyzerRegistryBuilder,DocumentAnalyzerScope,FaceAnalyzerScope,UseSmileIDMLBuilder}from"./presentation/flow/dsl/builder/ml_builder";export{CaptureConfigBuilder,CaptureType,ConsentConfigBuilder,DocumentCaptureConfigBuilder,InstructionsConfigBuilder,PreviewConfigBuilder,ProcessingConfigBuilder,ScreensBuilder,SelfieCaptureConfigBuilder}from"./presentation/flow/dsl/builder/screens_builder";export{FlowNavigationManager}from"./presentation/flow/flow_navigation_manager";export{FlowNavigationProvider,useFlowNavigation}from"./presentation/flow/flow_navigation_context";export{UseSmileIDOrchestratedScreenHost}from"./presentation/flow/screen/use_smile_id_orchestrated_screen_host";export{OrchestratedInstructionsScreen}from"./presentation/flow/screen/orchestrated_instructions_screen";export{OrchestratedConsentScreen}from"./presentation/flow/screen/orchestrated_consent_screen";export{OrchestratedCaptureScreen}from"./presentation/flow/screen/orchestrated_capture_screen";export{OrchestratedPreviewScreen}from"./presentation/flow/screen/orchestrated_preview_screen";export{OrchestratedProcessingScreen}from"./presentation/flow/screen/orchestrated_processing_screen";export{UseSmileIDCrashReporting}from"@smileid/usesmileid_bridge";export{DocumentSide}from"@smileid/usesmileid_bridge";export{UseSmileIDLocalizations}from"./l10n/use_smile_id_localizations";export{UseSmileIDLocalizationsProvider,useStableLocalizations,useUseSmileIDLocalizations}from"./l10n/use_smile_id_localizations_provider";export{enStrings}from"./l10n/strings_en";export{UseSmileIDKameraCameraSystem}from"./camera/use_smile_id_kamera_camera_system";export{UseSmileIDKameraPreview}from"./camera/use_smile_id_kamera_preview";export{useSmileIDFrameStream}from"./camera/use_smile_id_frame_stream";export{CameraDefaults}from"./camera/camera_defaults";export{CameraLens}from"./camera/camera_lens";export{FocusStates}from"./camera/focus_state";export{getCameraPermissionStatus,requestCameraPermission}from"./camera/camera_permissions";export{JobType,jobTypeFromValue,requiresDocument,requiresSelfie}from"./core/models/job_type";export{FlowStep}from"./core/models/flow_step";export{DocumentType}from"./core/models/document_type";export{DEFAULT_ACTIVATE_MANUAL_AFTER_MS,DocumentCaptureMode}from"./core/models/document_capture_mode";export{cancelled,captured,failure,success}from"./core/models/result";export{GlobalPrivacyControl,GLOBAL_PRIVACY_CONTROL_WIRE_KEY,globalPrivacyControlFromWire}from"./core/models/global_privacy_control";export{LogLevel}from"./core/models/network_config";export{RESIDENCY_ID_TYPE}from"./core/models/params";export{UseSmileIDAnalyticsEventTypes,UseSmileIDAnalyticsParamKeys,UseSmileIDAnalyticsReasons,UseSmileIDAnalyticsScreenNames}from"./presentation/flow/analytics/use_smile_id_analytics_event";export{analyticsEventKind}from"./presentation/flow/analytics/use_smile_id_analytics_event_kind";export{decodeSmileIDToken}from"./data/util/use_smile_id_token_decoder";export{numSamplesOverride}from"./data/model/sdk_config";export{resolveDimensions,resolveJpegQuality}from"./data/model/sdk_config_capture";export{SdkConfigSource}from"./data/model/sdk_config_source";export{defaultDarkTheme,defaultLightTheme,DEFAULT_FONT_FAMILY,DM_SANS_FONT_NAMES,resolveFontFamily,typographyWithFontFamily}from"./presentation/theme/theme";export{UseSmileIDThemeProvider,useUseSmileIDTheme}from"./presentation/theme/theme_context";export{loadUseSmileIDFonts,useUseSmileIDFonts}from"./presentation/theme/use_use_smile_id_fonts";export{UseSmileIDButton}from"./presentation/components/use_smile_id_button";export{UseSmileIDBackButton}from"./presentation/components/use_smile_id_back_button";export{UseSmileIDRoundedCheckbox}from"./presentation/components/use_smile_id_rounded_checkbox";export{UseSmileIDAttribution}from"./presentation/components/use_smile_id_attribution";export{UseSmileIDPartnerIcon}from"./presentation/components/use_smile_id_partner_icon";export{StatusIndicatorState}from"./presentation/components/status_indicator_state";export{UseSmileIDStatusIndicator}from"./presentation/components/use_smile_id_status_indicator";export{UseSmileIDLoadingIndicator}from"./presentation/components/use_smile_id_loading_indicator";export{UseSmileIDExpandableIcon}from"./presentation/components/use_smile_id_expandable_icon";export{UseSmileIDContentCard}from"./presentation/components/use_smile_id_content_card";export{FaceOvalDefaults,computeFaceOvalGeometry}from"./presentation/components/face_oval_defaults";export{UseSmileIDOvalBorderPalette}from"./presentation/components/use_smile_id_oval_border_palette";export{UseSmileIDMotion}from"./presentation/theme/use_smile_id_motion";export{UseSmileIDFaceOverlay}from"./presentation/components/use_smile_id_face_overlay";export{UseSmileIDFaceOvalImage}from"./presentation/components/use_smile_id_face_oval_image";export{UseSmileIDCapturedImageOval}from"./presentation/components/use_smile_id_captured_image_oval";export{UseSmileIDCardSurface}from"./presentation/components/use_smile_id_card_surface";export{computeScaledOvalGeometry}from"./presentation/components/helpers/scaled_oval_geometry";export{UseSmileIDProcessingCenterIndicator}from"./presentation/components/use_smile_id_processing_center_indicator";export{UseSmileIDDocumentOverlay}from"./presentation/components/use_smile_id_document_overlay";export{UseSmileIDInstructionsHero}from"./presentation/components/use_smile_id_instructions_hero";export{UseSmileIDGuidelineThumbnail}from"./presentation/components/use_smile_id_guideline_thumbnail";export{SELFIE_GUIDELINES,SELFIE_HERO_ANIMATION,ESS_HERO_ANIMATION}from"./presentation/flow/model/instructions_defaults";export{UseSmileIDConsentRow}from"./presentation/components/use_smile_id_consent_row";export{UseSmileIDConfirmationButtons}from"./presentation/components/use_smile_id_confirmation_buttons";export{UseSmileIDLoadingContent}from"./presentation/components/use_smile_id_loading_content";export{UseSmileIDSuccessContent}from"./presentation/components/use_smile_id_success_content";export{UseSmileIDFailedContent}from"./presentation/components/use_smile_id_failed_content";export{UseSmileIDLearnMoreContent}from"./presentation/components/use_smile_id_learn_more_content";export{UseSmileIDEnhancedSmartSelfieFullAnimation}from"./presentation/components/use_smile_id_enhanced_smart_selfie_full_animation";export{UseSmileIDEnhancedSmartSelfieDirectionAnimation}from"./presentation/components/use_smile_id_enhanced_smart_selfie_direction_animation";export{EnhancedSmartSelfieAnimationFrames,ENHANCED_SMART_SELFIE_TOTAL_FRAMES,ENHANCED_SMART_SELFIE_FRAME_RATE}from"./presentation/components/helpers/enhanced_smart_selfie_animation_frames";export{UseSmileIDCaptureContent}from"./presentation/components/use_smile_id_capture_content";export{UseSmileIDCaptureInstructionAnimation}from"./presentation/components/use_smile_id_capture_instruction_animation";export{captureInstructionAnimationSpec}from"./presentation/components/helpers/capture_instruction_animation_spec";export{mapCaptureUiState,mapSelfieUiState,mapDocumentUiState,preCaptureUiState,scannedUiState,scannedDocumentUiState,withEnhancedLivenessPolicy}from"./presentation/screen/helpers/capture_ui_state";export{resolveFeedbackCopy,selfieFeedbackKeyFor,documentFeedbackKeyFor}from"./presentation/screen/helpers/capture_screen_helpers";export{UseSmileIDFeedbackDebouncer}from"./presentation/screen/helpers/feedback_debouncer";export{UseSmileIDOverlayState,OVERLAY_STATE_COUNT,isDirectional}from"./presentation/state/use_smile_id_overlay_state";export{HEAD_TURN_DIRECTIONS}from"./core/models/head_turn_direction";export{UseSmileIDCaptureScreen}from"./presentation/screen/use_smile_id_capture_screen";export{UseSmileIDConsentScreen}from"./presentation/screen/use_smile_id_consent_screen";export{UseSmileIDInstructionsScreen}from"./presentation/screen/use_smile_id_instructions_screen";export{UseSmileIDDocumentBackInstructions}from"./presentation/screen/use_smile_id_document_back_instructions";export{UseSmileIDPreviewScreen}from"./presentation/screen/use_smile_id_preview_screen";export{UseSmileIDProcessingScreen}from"./presentation/screen/use_smile_id_processing_screen";export{ForceMaxBrightness}from"./presentation/utils/force_max_brightness";export{UseSmileIDDebug}from"./debug/use_smile_id_debug";export{CapturePerfMark}from"./core/perf/capture_perf_trace";
1
+ "use strict";export{UseSmileIDBuilder}from"./presentation/flow/dsl/use_smile_id_builder";export{UseSmileIDFlowBuilder}from"./presentation/flow/dsl/use_smile_id_flow_builder";export{ValidationState}from"./presentation/flow/validation/validation_state";export{AgentModeWithEnhancedLivenessException,BuilderValidationException,isNetworkErrorCode,isRetryableErrorCode,ConsentDeniedException,DuplicateScreenTypeException,EmptyScreensBlockException,InvalidConsentConfigException,InvalidConsentInformationException,InvalidDocumentCaptureConfigException,InvalidFieldValueException,InvalidJobTypeScreenConfigException,InvalidMissingCaptureTypeException,InvalidScreenOrderException,InvalidPartnerScreenException,InvalidSelfieCaptureConfigException,LivenessFrameCountException,IssueSeverity,MissingCaptureForPreviewException,MissingJobTypeException,MissingMLConfigurationBlockException,MissingNetworkConfigurationBlockException,MissingPartnerConfigException,MissingRequiredFieldException,NavigationFailedException,ProcessingCancelledException,UseSmileIDAttestationException,UseSmileIDBuilderException,UseSmileIDCameraException,UseSmileIDCameraSurfaceException,UseSmileIDErrorCode,UseSmileIDException,UseSmileIDGeneralException,UnusedJobParamsException,UseSmileIDNetworkException,UseSmileIDValidationException}from"./core/exception";export{UseSmileIDConfigBuilder}from"./presentation/flow/dsl/builder/config_builder";export{ThemeConfigBuilder}from"./presentation/flow/dsl/builder/theme_builder";export{UseSmileIDNetworkBuilder}from"./data/dsl/use_smile_id_network_builder";export{ConfigBuilder,LoggingConfigBuilder,PartnerConfigBuilder}from"./data/dsl/builder/config_builder";export{TimeoutConfigBuilder}from"./data/dsl/builder/timeout_config_builder";export{CacheConfigBuilder}from"./data/dsl/builder/cache_config_builder";export{RetryConfigBuilder,RetryStrategy}from"./data/dsl/builder/retry_config_builder";export{InterceptorConfigBuilder,LoggingInterceptorBuilder}from"./data/dsl/builder/interceptor_config_builder";export{AnalyzerRegistryBuilder,DocumentAnalyzerScope,FaceAnalyzerScope,UseSmileIDMLBuilder}from"./presentation/flow/dsl/builder/ml_builder";export{CaptureConfigBuilder,CaptureType,ConsentConfigBuilder,DocumentCaptureConfigBuilder,InstructionsConfigBuilder,PreviewConfigBuilder,ProcessingConfigBuilder,ScreensBuilder,SelfieCaptureConfigBuilder}from"./presentation/flow/dsl/builder/screens_builder";export{PartnerValueFormat}from"./presentation/flow/dsl/builder/partner_value_format";export{FlowNavigationManager}from"./presentation/flow/flow_navigation_manager";export{FlowNavigationProvider,useFlowNavigation}from"./presentation/flow/flow_navigation_context";export{UseSmileIDOrchestratedScreenHost}from"./presentation/flow/screen/use_smile_id_orchestrated_screen_host";export{OrchestratedInstructionsScreen}from"./presentation/flow/screen/orchestrated_instructions_screen";export{OrchestratedConsentScreen}from"./presentation/flow/screen/orchestrated_consent_screen";export{OrchestratedCaptureScreen}from"./presentation/flow/screen/orchestrated_capture_screen";export{OrchestratedPreviewScreen}from"./presentation/flow/screen/orchestrated_preview_screen";export{OrchestratedProcessingScreen}from"./presentation/flow/screen/orchestrated_processing_screen";export{UseSmileIDCrashReporting}from"@smileid/usesmileid_bridge";export{DocumentSide}from"@smileid/usesmileid_bridge";export{UseSmileIDLocalizations}from"./l10n/use_smile_id_localizations";export{UseSmileIDLocalizationsProvider,useStableLocalizations,useUseSmileIDLocalizations}from"./l10n/use_smile_id_localizations_provider";export{enStrings}from"./l10n/strings_en";export{UseSmileIDKameraCameraSystem}from"./camera/use_smile_id_kamera_camera_system";export{UseSmileIDKameraPreview}from"./camera/use_smile_id_kamera_preview";export{useSmileIDFrameStream}from"./camera/use_smile_id_frame_stream";export{CameraDefaults}from"./camera/camera_defaults";export{CameraLens}from"./camera/camera_lens";export{FocusStates}from"./camera/focus_state";export{getCameraPermissionStatus,requestCameraPermission}from"./camera/camera_permissions";export{JobType,jobTypeFromValue,requiresDocument,requiresSelfie}from"./core/models/job_type";export{FlowStep}from"./core/models/flow_step";export{DocumentType}from"./core/models/document_type";export{DEFAULT_ACTIVATE_MANUAL_AFTER_MS,DocumentCaptureMode}from"./core/models/document_capture_mode";export{cancelled,captured,failure,success}from"./core/models/result";export{GlobalPrivacyControl,GLOBAL_PRIVACY_CONTROL_WIRE_KEY,globalPrivacyControlFromWire}from"./core/models/global_privacy_control";export{LogLevel}from"./core/models/network_config";export{RESIDENCY_ID_TYPE}from"./core/models/params";export{UseSmileIDAnalyticsEventTypes,UseSmileIDAnalyticsParamKeys,UseSmileIDAnalyticsReasons,UseSmileIDAnalyticsScreenNames}from"./presentation/flow/analytics/use_smile_id_analytics_event";export{analyticsEventKind}from"./presentation/flow/analytics/use_smile_id_analytics_event_kind";export{decodeSmileIDToken}from"./data/util/use_smile_id_token_decoder";export{numSamplesOverride}from"./data/model/sdk_config";export{resolveDimensions,resolveJpegQuality}from"./data/model/sdk_config_capture";export{SdkConfigSource}from"./data/model/sdk_config_source";export{defaultDarkTheme,defaultLightTheme,DEFAULT_FONT_FAMILY,DM_SANS_FONT_NAMES,resolveFontFamily,typographyWithFontFamily}from"./presentation/theme/theme";export{UseSmileIDThemeProvider,useUseSmileIDTheme}from"./presentation/theme/theme_context";export{loadUseSmileIDFonts,useUseSmileIDFonts}from"./presentation/theme/use_use_smile_id_fonts";export{UseSmileIDButton}from"./presentation/components/use_smile_id_button";export{UseSmileIDBackButton}from"./presentation/components/use_smile_id_back_button";export{UseSmileIDRoundedCheckbox}from"./presentation/components/use_smile_id_rounded_checkbox";export{UseSmileIDAttribution}from"./presentation/components/use_smile_id_attribution";export{UseSmileIDPartnerIcon}from"./presentation/components/use_smile_id_partner_icon";export{StatusIndicatorState}from"./presentation/components/status_indicator_state";export{UseSmileIDStatusIndicator}from"./presentation/components/use_smile_id_status_indicator";export{UseSmileIDLoadingIndicator}from"./presentation/components/use_smile_id_loading_indicator";export{UseSmileIDExpandableIcon}from"./presentation/components/use_smile_id_expandable_icon";export{UseSmileIDContentCard}from"./presentation/components/use_smile_id_content_card";export{FaceOvalDefaults,computeFaceOvalGeometry}from"./presentation/components/face_oval_defaults";export{UseSmileIDOvalBorderPalette}from"./presentation/components/use_smile_id_oval_border_palette";export{UseSmileIDMotion}from"./presentation/theme/use_smile_id_motion";export{UseSmileIDFaceOverlay}from"./presentation/components/use_smile_id_face_overlay";export{UseSmileIDFaceOvalImage}from"./presentation/components/use_smile_id_face_oval_image";export{UseSmileIDCapturedImageOval}from"./presentation/components/use_smile_id_captured_image_oval";export{UseSmileIDCardSurface}from"./presentation/components/use_smile_id_card_surface";export{computeScaledOvalGeometry}from"./presentation/components/helpers/scaled_oval_geometry";export{UseSmileIDProcessingCenterIndicator}from"./presentation/components/use_smile_id_processing_center_indicator";export{UseSmileIDDocumentOverlay}from"./presentation/components/use_smile_id_document_overlay";export{UseSmileIDInstructionsHero}from"./presentation/components/use_smile_id_instructions_hero";export{UseSmileIDGuidelineThumbnail}from"./presentation/components/use_smile_id_guideline_thumbnail";export{SELFIE_GUIDELINES,SELFIE_HERO_ANIMATION,ESS_HERO_ANIMATION}from"./presentation/flow/model/instructions_defaults";export{UseSmileIDConsentRow}from"./presentation/components/use_smile_id_consent_row";export{UseSmileIDConfirmationButtons}from"./presentation/components/use_smile_id_confirmation_buttons";export{UseSmileIDLoadingContent}from"./presentation/components/use_smile_id_loading_content";export{UseSmileIDSuccessContent}from"./presentation/components/use_smile_id_success_content";export{UseSmileIDFailedContent}from"./presentation/components/use_smile_id_failed_content";export{UseSmileIDLearnMoreContent}from"./presentation/components/use_smile_id_learn_more_content";export{UseSmileIDEnhancedSmartSelfieFullAnimation}from"./presentation/components/use_smile_id_enhanced_smart_selfie_full_animation";export{UseSmileIDEnhancedSmartSelfieDirectionAnimation}from"./presentation/components/use_smile_id_enhanced_smart_selfie_direction_animation";export{EnhancedSmartSelfieAnimationFrames,ENHANCED_SMART_SELFIE_TOTAL_FRAMES,ENHANCED_SMART_SELFIE_FRAME_RATE}from"./presentation/components/helpers/enhanced_smart_selfie_animation_frames";export{UseSmileIDCaptureContent}from"./presentation/components/use_smile_id_capture_content";export{UseSmileIDCaptureInstructionAnimation}from"./presentation/components/use_smile_id_capture_instruction_animation";export{captureInstructionAnimationSpec}from"./presentation/components/helpers/capture_instruction_animation_spec";export{mapCaptureUiState,mapSelfieUiState,mapDocumentUiState,preCaptureUiState,scannedUiState,scannedDocumentUiState,withEnhancedLivenessPolicy}from"./presentation/screen/helpers/capture_ui_state";export{resolveFeedbackCopy,selfieFeedbackKeyFor,documentFeedbackKeyFor}from"./presentation/screen/helpers/capture_screen_helpers";export{UseSmileIDFeedbackDebouncer}from"./presentation/screen/helpers/feedback_debouncer";export{UseSmileIDOverlayState,OVERLAY_STATE_COUNT,isDirectional}from"./presentation/state/use_smile_id_overlay_state";export{HEAD_TURN_DIRECTIONS}from"./core/models/head_turn_direction";export{UseSmileIDCaptureScreen}from"./presentation/screen/use_smile_id_capture_screen";export{UseSmileIDConsentScreen}from"./presentation/screen/use_smile_id_consent_screen";export{UseSmileIDInstructionsScreen}from"./presentation/screen/use_smile_id_instructions_screen";export{UseSmileIDDocumentBackInstructions}from"./presentation/screen/use_smile_id_document_back_instructions";export{UseSmileIDPreviewScreen}from"./presentation/screen/use_smile_id_preview_screen";export{UseSmileIDProcessingScreen}from"./presentation/screen/use_smile_id_processing_screen";export{ForceMaxBrightness}from"./presentation/utils/force_max_brightness";export{UseSmileIDDebug}from"./debug/use_smile_id_debug";export{CapturePerfMark}from"./core/perf/capture_perf_trace";
@@ -1 +1 @@
1
- "use strict";import{GlobalPrivacyControl as g}from"../core/models/global_privacy_control";import{AnalyzerFactoryKey as c,DocumentAnalyzerKey as u}from"@smileid/usesmileid_bridge";import{CaptureType as f}from"../core/models/ml_config";import{JobType as y}from"../core/models/job_type";import{autoCaptureWireValue as b}from"../core/models/document_capture_mode";import{flowShowAttribution as w}from"../presentation/flow/config/attribution_resolver";import{builderConfigurationToJson as C}from"./builder_configuration";import{MODEL_DESCRIPTOR_UNKNOWN as _,ModelProvider as r,modelConfigurationToJson as T}from"./model_configuration";export function flowConfigurationToBuilderConfiguration(e){const o=e.screens.steps;let n;const t=[];let d=!1,a=!1,p=!1;for(const i of o)switch(i.kind){case"consent":n=i.config;break;case"instructions":d=!0;break;case"capture":t.push(i.config);break;case"preview":a=!0;break;case"processing":p=!0;break}const l=t.find(i=>i.selfieConfig)?.selfieConfig,s=t.find(i=>i.documentConfig)?.documentConfig,v=l!==void 0||t.some(i=>i.captureType===f.selfie),m=s!==void 0||t.some(i=>i.captureType===f.document);return{consentScreenUsed:n!==void 0,consentIconProvided:n?.partnerIcon!=null,consentIconDimensions:null,consentAttributionShown:n!==void 0&&w(e),instructionsScreenUsed:d,selfiePreviewEnabled:a&&v,documentPreviewEnabled:a&&m,submissionSkipped:!p,allowAgentMode:l?.allowAgentMode??!1,enhancedLivenessEnabled:l?.enableEnhancedLiveness??!1,autoCaptureEnabled:b(s?.captureMode),allowGalleryUpload:s?.allowGalleryUpload??!1,captureBothSides:e.network?.config?.jobType===y.residencyDocumentVerification&&m||(s?.captureBothSides??!1),allowSkipBack:s?.allowSkipBack??!1,globalPrivacyControl:e.config?.globalPrivacyControl??g.OptOut}}export function flowConfigurationToModelConfiguration(e){const o=e.ml?.analyzers.selfieConfig?.analyzerFactoryKey,n=e.ml?.analyzers.document?.key;return{faceModel:h(o),documentModel:k(n)}}export function configurationMetadataEntries(e){const o=[{name:"builder_configuration_object",value:JSON.stringify(C(flowConfigurationToBuilderConfiguration(e)))},{name:"model_configuration_object",value:JSON.stringify(T(flowConfigurationToModelConfiguration(e)))}],n=flowConfigurationToSelfieLivenessTelemetry(e);return n.activeLivenessType!==null&&o.push({name:"active_liveness_type",value:n.activeLivenessType},{name:"active_liveness_version",value:n.activeLivenessVersion},{name:"selfie_image_origin",value:n.selfieImageOrigin}),o}export function flowConfigurationToSelfieLivenessTelemetry(e){let o,n=!1;for(const t of e.screens.steps)t.kind==="capture"&&(o??=t.config.selfieConfig,t.config.captureType===f.selfie&&(n=!0));return!n&&o===void 0?{activeLivenessType:null,activeLivenessVersion:null,selfieImageOrigin:null}:{activeLivenessType:O(o),activeLivenessVersion:"2.0.0",selfieImageOrigin:S(o)}}function O(e){return e?.enableEnhancedLiveness?"head_pose":"smile"}function S(e){return e?.allowAgentMode?"back_camera":"front_camera"}function h(e){switch(e){case c.MLKitFace:return{provider:r.Google,name:"play-services-mlkit-face-detection",version:"17.1.0",bundled:!1};case c.HuaweiFace:return{provider:r.Huawei,name:"ml-computer-vision-face",version:"3.18.1.300",bundled:!1};case c.VisionFace:return{provider:r.Apple,name:"vision_face_detector",version:"system",bundled:!0};default:return _}}function k(e){switch(e){case u.MLKitDocument:return{provider:r.Google,name:"object-detection",version:"17.0.2",bundled:!0};case u.HuaweiDocument:return{provider:r.Huawei,name:"ml-computer-vision-object",version:"3.7.0.301",bundled:!1};case u.VisionDocument:return{provider:r.Apple,name:"vision_document_detector",version:"system",bundled:!0};default:return L}}const L={provider:r.Smile,name:"noop_document_detector",version:"12.2.0",bundled:!0};
1
+ "use strict";import{GlobalPrivacyControl as g}from"../core/models/global_privacy_control";import{AnalyzerFactoryKey as l,DocumentAnalyzerKey as u}from"@smileid/usesmileid_bridge";import{CaptureType as f}from"../core/models/ml_config";import{JobType as y}from"../core/models/job_type";import{autoCaptureWireValue as b}from"../core/models/document_capture_mode";import{flowShowAttribution as w}from"../presentation/flow/config/attribution_resolver";import{builderConfigurationToJson as C}from"./builder_configuration";import{MODEL_DESCRIPTOR_UNKNOWN as _,ModelProvider as r,modelConfigurationToJson as T}from"./model_configuration";export function flowConfigurationToBuilderConfiguration(e){const o=e.screens.steps;let n;const t=[];let d=!1,a=!1,p=!1;for(const i of o)switch(i.kind){case"consent":n=i.config;break;case"instructions":d=!0;break;case"capture":t.push(i.config);break;case"preview":a=!0;break;case"processing":p=!0;break;case"partner":break}const c=t.find(i=>i.selfieConfig)?.selfieConfig,s=t.find(i=>i.documentConfig)?.documentConfig,v=c!==void 0||t.some(i=>i.captureType===f.selfie),m=s!==void 0||t.some(i=>i.captureType===f.document);return{consentScreenUsed:n!==void 0,consentIconProvided:n?.partnerIcon!=null,consentIconDimensions:null,consentAttributionShown:n!==void 0&&w(e),instructionsScreenUsed:d,selfiePreviewEnabled:a&&v,documentPreviewEnabled:a&&m,submissionSkipped:!p,allowAgentMode:c?.allowAgentMode??!1,enhancedLivenessEnabled:c?.enableEnhancedLiveness??!1,autoCaptureEnabled:b(s?.captureMode),allowGalleryUpload:s?.allowGalleryUpload??!1,captureBothSides:e.network?.config?.jobType===y.residencyDocumentVerification&&m||(s?.captureBothSides??!1),allowSkipBack:s?.allowSkipBack??!1,globalPrivacyControl:e.config?.globalPrivacyControl??g.OptOut}}export function flowConfigurationToModelConfiguration(e){const o=e.ml?.analyzers.selfieConfig?.analyzerFactoryKey,n=e.ml?.analyzers.document?.key;return{faceModel:S(o),documentModel:h(n)}}export function configurationMetadataEntries(e){const o=[{name:"builder_configuration_object",value:JSON.stringify(C(flowConfigurationToBuilderConfiguration(e)))},{name:"model_configuration_object",value:JSON.stringify(T(flowConfigurationToModelConfiguration(e)))}],n=flowConfigurationToSelfieLivenessTelemetry(e);return n.activeLivenessType!==null&&o.push({name:"active_liveness_type",value:n.activeLivenessType},{name:"active_liveness_version",value:n.activeLivenessVersion},{name:"selfie_image_origin",value:n.selfieImageOrigin}),o}export function flowConfigurationToSelfieLivenessTelemetry(e){let o,n=!1;for(const t of e.screens.steps)t.kind==="capture"&&(o??=t.config.selfieConfig,t.config.captureType===f.selfie&&(n=!0));return!n&&o===void 0?{activeLivenessType:null,activeLivenessVersion:null,selfieImageOrigin:null}:{activeLivenessType:O(o),activeLivenessVersion:"2.0.0",selfieImageOrigin:k(o)}}function O(e){return e?.enableEnhancedLiveness?"head_pose":"smile"}function k(e){return e?.allowAgentMode?"back_camera":"front_camera"}function S(e){switch(e){case l.MLKitFace:return{provider:r.Google,name:"play-services-mlkit-face-detection",version:"17.1.0",bundled:!1};case l.HuaweiFace:return{provider:r.Huawei,name:"ml-computer-vision-face",version:"3.18.1.300",bundled:!1};case l.VisionFace:return{provider:r.Apple,name:"vision_face_detector",version:"system",bundled:!0};default:return _}}function h(e){switch(e){case u.MLKitDocument:return{provider:r.Google,name:"object-detection",version:"17.0.2",bundled:!0};case u.HuaweiDocument:return{provider:r.Huawei,name:"ml-computer-vision-object",version:"3.7.0.301",bundled:!1};case u.VisionDocument:return{provider:r.Apple,name:"vision_document_detector",version:"system",bundled:!0};default:return L}}const L={provider:r.Smile,name:"noop_document_detector",version:"12.3.0",bundled:!0};
@@ -1 +1 @@
1
- "use strict";import{Dimensions as d,Platform as r}from"react-native";import{Attestation as w,DeviceIntegrityProvider as b,PrivilegesProvider as S}from"@smileid/usesmileid_bridge";import{UseSmileIDMetadata as A}from"./use_smile_id_metadata";import{loadAsyncStorage as D,loadExpoBattery as O,loadExpoCellular as C,loadExpoDevice as l,loadExpoNetwork as M}from"./optional_native_modules";import{resolveGeolocation as U}from"./geolocation";import{resolveDimensions as u}from"../data/model/sdk_config_capture";import{SdkConfigSource as h}from"../data/model/sdk_config_source";import{CameraDefaults as o}from"../camera/camera_defaults";const m="12.2.0",k="12.0.0",N="react-native-expo",p="com.usesmileid.metadata.sdk_launch_count";export class UseSmileIDMetadataFactory{_sessionId;_deviceOs;_deviceModel;_appName;_hostApplication;_systemArchitecture;_memoryInfoMb;_buildBrand;_buildDevice;_buildFingerprint;_buildProduct;_carrierInfo;_batteryStatus;_sdkLaunchCount;_geolocation;_privileges;_deviceIntegrity;_clientIp="";_networkConnection="";_hardwareAttestation;constructor(t={}){this._sessionId=generateSessionId(),this._deviceOs=x(),this._appName=t.appName??"",this._hostApplication=t.hostApplication??"";const e=l();e?(this._deviceModel=resolveDeviceModel(e),this._systemArchitecture=e.supportedCpuArchitectures?.[0]?.trim()??"",this._memoryInfoMb=typeof e.totalMemory=="number"&&e.totalMemory>0?Math.round(e.totalMemory/(1024*1024)):0,this._buildBrand=e.brand?.trim()??"",this._buildDevice=(r.OS==="ios"?e.modelId:e.designName)?.trim()??"",this._buildFingerprint=e.osBuildFingerprint?.trim()??"",this._buildProduct=e.productName?.trim()??""):(this._deviceModel="",this._systemArchitecture="",this._memoryInfoMb=0,this._buildBrand="",this._buildDevice="",this._buildFingerprint="",this._buildProduct=""),this._carrierInfo=C()?.carrier?.trim()??"",this._warmupAsync(),this._warmUpHardwareAttestation()}get sessionId(){return this._sessionId}async warmup(){return this._warmupAsync()}async _warmupAsync(){const t=M();if(!t)return;const e=t.getNetworkStateAsync().then(s=>{this._networkConnection=(s.type??"").toString()}).catch(()=>{}),n=t.getIpAddressAsync?t.getIpAddressAsync().then(s=>{this._clientIp=s??""}).catch(()=>{}):Promise.resolve();await Promise.all([e,n,this._warmUpBatteryStatus(),this._warmUpLaunchCount(),this._warmUpGeolocation(),this._warmUpPrivileges(),this._warmUpDeviceIntegrity()])}async _warmUpGeolocation(){const t=await U();t&&(this._geolocation=t)}async _warmUpPrivileges(){const t=await S.privileges();t.length>0&&(this._privileges=t)}async _warmUpDeviceIntegrity(){this._deviceIntegrity=await b.signals()}async _warmUpLaunchCount(){const t=D();if(t)try{const n=(Number(await t.getItem(p))||0)+1;await t.setItem(p,String(n)),this._sdkLaunchCount=n}catch{}}async _warmUpBatteryStatus(){const t=O();if(t)try{switch(await t.getBatteryStateAsync()){case 1:this._batteryStatus=0;break;case 2:case 3:this._batteryStatus=1;break;default:this._batteryStatus=-1}}catch{}}async _warmUpHardwareAttestation(){try{this._hardwareAttestation=await w.generateHardwareAttestation(this._sessionId)}catch{}}make(t){const e=this._hardwareAttestation,n=r.OS==="android"&&e?{hardwareAttestationSecurityLevel:e.securityLevel,...e.certificateChain&&e.certificateChain.length>0?{attestationCertificateChain:e.certificateChain}:{}}:{},s=r.OS==="ios"&&e?{supportsAppAttest:e.supportsAppAttest}:{},a=u(t?.selfie),_=t!==void 0?h.sdkConfig:h.defaultSource,f=a?.width??o.selfieJpegTargetWidth,g=a?.height??o.selfieJpegTargetHeight,c=u(t?.liveness),y=c?.width??o.selfieJpegTargetWidth,v=c?.height??o.selfieJpegTargetHeight,I={sdkVersion:m,sdk:N,deviceOs:this._deviceOs,deviceModel:this._deviceModel,appName:this._appName,sessionId:this._sessionId,clientIp:this._clientIp,networkConnection:this._networkConnection,carrierInfo:this._carrierInfo,timezone:L(),timezoneOffsetMinutes:E(),locale:B(),screenResolution:H(),memoryInfoMb:this._memoryInfoMb,deviceOrientation:R(),systemArchitecture:this._systemArchitecture,numberOfCameras:0,hostApplication:this._hostApplication,securityPolicyVersion:k,...n,...s,sdkConfigSource:_,imageWidth:f,imageHeight:g,livenessImageWidth:y,livenessImageHeight:v,buildBrand:this._buildBrand,buildDevice:this._buildDevice,buildFingerprint:this._buildFingerprint,buildProduct:this._buildProduct,buildHardware:this._deviceIntegrity?.buildHardware??"",buildSource:this._deviceIntegrity?.buildSource??"",packageName:this._deviceIntegrity?.packageName??"",fingerprint:this._deviceIntegrity?.fingerprint??"",localTimeOfEnrolment:T(),wrapperName:"react_native_expo",wrapperVersion:m,...this._deviceIntegrity?.vpn!==void 0?{vpn:this._deviceIntegrity.vpn}:{},...this._deviceIntegrity?.certificateDigest!==void 0?{certificateDigest:this._deviceIntegrity.certificateDigest}:{},...this._batteryStatus!==void 0?{batteryStatus:this._batteryStatus}:{},...this._sdkLaunchCount!==void 0?{sdkLaunchCount:this._sdkLaunchCount}:{},...this._geolocation!==void 0?{geolocation:this._geolocation}:{},...this._privileges!==void 0?{privileges:this._privileges}:{}};return new A(I)}}export function resolveDeviceModel(i=l()){if(!i)return"";const t=i.brand?.trim()??"",e=i.modelName?.trim()??"";return[t,e].filter(Boolean).join(" ")}function x(){const i=r.OS==="ios"?"iOS":r.OS==="android"?"Android":r.OS,t=P();return t?`${i} ${t}`:i}function P(){if(r.OS==="android"){const i=r.constants?.Release;if(i!=null&&`${i}`!="")return`${i}`}return typeof r.Version<"u"?String(r.Version):""}function T(){try{return new Date().toISOString()}catch{return""}}function L(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??""}catch{return""}}function E(){return-new Date().getTimezoneOffset()}function B(){try{return Intl.DateTimeFormat().resolvedOptions().locale??""}catch{return""}}function H(){try{const{width:i,height:t,scale:e}=d.get("screen");if(!i||!t)return"";const n=Math.round(i*(e||1)),s=Math.round(t*(e||1));return`${n} \xD7 ${s}`}catch{return""}}function R(){try{const{width:i,height:t}=d.get("window");return!i||!t?"":t>=i?"Portrait":"Landscape"}catch{return""}}export function generateSessionId(){const i=globalThis.crypto;if(i&&typeof i.randomUUID=="function")return i.randomUUID();const t=()=>typeof i?.getRandomValues=="function"?i.getRandomValues(new Uint16Array(1))[0]??0:Math.floor(Math.random()*65536),e=()=>t().toString(16).padStart(4,"0");return[e()+e(),e(),"4"+e().slice(1),(parseInt(e(),16)&16383|32768).toString(16),e()+e()+e()].join("-")}
1
+ "use strict";import{Dimensions as d,Platform as r}from"react-native";import{Attestation as w,DeviceIntegrityProvider as b,PrivilegesProvider as S}from"@smileid/usesmileid_bridge";import{UseSmileIDMetadata as A}from"./use_smile_id_metadata";import{loadAsyncStorage as D,loadExpoBattery as O,loadExpoCellular as C,loadExpoDevice as l,loadExpoNetwork as M}from"./optional_native_modules";import{resolveGeolocation as U}from"./geolocation";import{resolveDimensions as u}from"../data/model/sdk_config_capture";import{SdkConfigSource as h}from"../data/model/sdk_config_source";import{CameraDefaults as o}from"../camera/camera_defaults";const m="12.3.0",k="12.0.0",N="react-native-expo",p="com.usesmileid.metadata.sdk_launch_count";export class UseSmileIDMetadataFactory{_sessionId;_deviceOs;_deviceModel;_appName;_hostApplication;_systemArchitecture;_memoryInfoMb;_buildBrand;_buildDevice;_buildFingerprint;_buildProduct;_carrierInfo;_batteryStatus;_sdkLaunchCount;_geolocation;_privileges;_deviceIntegrity;_clientIp="";_networkConnection="";_hardwareAttestation;constructor(t={}){this._sessionId=generateSessionId(),this._deviceOs=x(),this._appName=t.appName??"",this._hostApplication=t.hostApplication??"";const e=l();e?(this._deviceModel=resolveDeviceModel(e),this._systemArchitecture=e.supportedCpuArchitectures?.[0]?.trim()??"",this._memoryInfoMb=typeof e.totalMemory=="number"&&e.totalMemory>0?Math.round(e.totalMemory/(1024*1024)):0,this._buildBrand=e.brand?.trim()??"",this._buildDevice=(r.OS==="ios"?e.modelId:e.designName)?.trim()??"",this._buildFingerprint=e.osBuildFingerprint?.trim()??"",this._buildProduct=e.productName?.trim()??""):(this._deviceModel="",this._systemArchitecture="",this._memoryInfoMb=0,this._buildBrand="",this._buildDevice="",this._buildFingerprint="",this._buildProduct=""),this._carrierInfo=C()?.carrier?.trim()??"",this._warmupAsync(),this._warmUpHardwareAttestation()}get sessionId(){return this._sessionId}async warmup(){return this._warmupAsync()}async _warmupAsync(){const t=M();if(!t)return;const e=t.getNetworkStateAsync().then(s=>{this._networkConnection=(s.type??"").toString()}).catch(()=>{}),n=t.getIpAddressAsync?t.getIpAddressAsync().then(s=>{this._clientIp=s??""}).catch(()=>{}):Promise.resolve();await Promise.all([e,n,this._warmUpBatteryStatus(),this._warmUpLaunchCount(),this._warmUpGeolocation(),this._warmUpPrivileges(),this._warmUpDeviceIntegrity()])}async _warmUpGeolocation(){const t=await U();t&&(this._geolocation=t)}async _warmUpPrivileges(){const t=await S.privileges();t.length>0&&(this._privileges=t)}async _warmUpDeviceIntegrity(){this._deviceIntegrity=await b.signals()}async _warmUpLaunchCount(){const t=D();if(t)try{const n=(Number(await t.getItem(p))||0)+1;await t.setItem(p,String(n)),this._sdkLaunchCount=n}catch{}}async _warmUpBatteryStatus(){const t=O();if(t)try{switch(await t.getBatteryStateAsync()){case 1:this._batteryStatus=0;break;case 2:case 3:this._batteryStatus=1;break;default:this._batteryStatus=-1}}catch{}}async _warmUpHardwareAttestation(){try{this._hardwareAttestation=await w.generateHardwareAttestation(this._sessionId)}catch{}}make(t){const e=this._hardwareAttestation,n=r.OS==="android"&&e?{hardwareAttestationSecurityLevel:e.securityLevel,...e.certificateChain&&e.certificateChain.length>0?{attestationCertificateChain:e.certificateChain}:{}}:{},s=r.OS==="ios"&&e?{supportsAppAttest:e.supportsAppAttest}:{},a=u(t?.selfie),_=t!==void 0?h.sdkConfig:h.defaultSource,f=a?.width??o.selfieJpegTargetWidth,g=a?.height??o.selfieJpegTargetHeight,c=u(t?.liveness),y=c?.width??o.selfieJpegTargetWidth,v=c?.height??o.selfieJpegTargetHeight,I={sdkVersion:m,sdk:N,deviceOs:this._deviceOs,deviceModel:this._deviceModel,appName:this._appName,sessionId:this._sessionId,clientIp:this._clientIp,networkConnection:this._networkConnection,carrierInfo:this._carrierInfo,timezone:L(),timezoneOffsetMinutes:E(),locale:B(),screenResolution:H(),memoryInfoMb:this._memoryInfoMb,deviceOrientation:R(),systemArchitecture:this._systemArchitecture,numberOfCameras:0,hostApplication:this._hostApplication,securityPolicyVersion:k,...n,...s,sdkConfigSource:_,imageWidth:f,imageHeight:g,livenessImageWidth:y,livenessImageHeight:v,buildBrand:this._buildBrand,buildDevice:this._buildDevice,buildFingerprint:this._buildFingerprint,buildProduct:this._buildProduct,buildHardware:this._deviceIntegrity?.buildHardware??"",buildSource:this._deviceIntegrity?.buildSource??"",packageName:this._deviceIntegrity?.packageName??"",fingerprint:this._deviceIntegrity?.fingerprint??"",localTimeOfEnrolment:T(),wrapperName:"react_native_expo",wrapperVersion:m,...this._deviceIntegrity?.vpn!==void 0?{vpn:this._deviceIntegrity.vpn}:{},...this._deviceIntegrity?.certificateDigest!==void 0?{certificateDigest:this._deviceIntegrity.certificateDigest}:{},...this._batteryStatus!==void 0?{batteryStatus:this._batteryStatus}:{},...this._sdkLaunchCount!==void 0?{sdkLaunchCount:this._sdkLaunchCount}:{},...this._geolocation!==void 0?{geolocation:this._geolocation}:{},...this._privileges!==void 0?{privileges:this._privileges}:{}};return new A(I)}}export function resolveDeviceModel(i=l()){if(!i)return"";const t=i.brand?.trim()??"",e=i.modelName?.trim()??"";return[t,e].filter(Boolean).join(" ")}function x(){const i=r.OS==="ios"?"iOS":r.OS==="android"?"Android":r.OS,t=P();return t?`${i} ${t}`:i}function P(){if(r.OS==="android"){const i=r.constants?.Release;if(i!=null&&`${i}`!="")return`${i}`}return typeof r.Version<"u"?String(r.Version):""}function T(){try{return new Date().toISOString()}catch{return""}}function L(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??""}catch{return""}}function E(){return-new Date().getTimezoneOffset()}function B(){try{return Intl.DateTimeFormat().resolvedOptions().locale??""}catch{return""}}function H(){try{const{width:i,height:t,scale:e}=d.get("screen");if(!i||!t)return"";const n=Math.round(i*(e||1)),s=Math.round(t*(e||1));return`${n} \xD7 ${s}`}catch{return""}}function R(){try{const{width:i,height:t}=d.get("window");return!i||!t?"":t>=i?"Portrait":"Landscape"}catch{return""}}export function generateSessionId(){const i=globalThis.crypto;if(i&&typeof i.randomUUID=="function")return i.randomUUID();const t=()=>typeof i?.getRandomValues=="function"?i.getRandomValues(new Uint16Array(1))[0]??0:Math.floor(Math.random()*65536),e=()=>t().toString(16).padStart(4,"0");return[e()+e(),e(),"4"+e().slice(1),(parseInt(e(),16)&16383|32768).toString(16),e()+e()+e()].join("-")}
@@ -20,7 +20,8 @@ export type DocumentImageRect = {
20
20
  * each edge, so showing the outline alone could cut a captured document off; the
21
21
  * screens that show the document fit the outline grown by that slack into their
22
22
  * card instead (`shownSize`). A manual-shutter still or a gallery import is saved
23
- * without a border, so its border fraction is 0 and it is shown whole.
23
+ * without a border, so its border fraction is 0 and it is shown whole, in a card
24
+ * of its own shape (`cardAspectRatio`).
24
25
  */
25
26
  export declare const DocumentInteriorCrop: {
26
27
  /** The full border, as a fraction of the saved document's short side on every edge. */
@@ -39,10 +40,20 @@ export declare const DocumentInteriorCrop: {
39
40
  * edge, and held to the image. The whole image when `borderFraction` is 0.
40
41
  */
41
42
  readonly shownSize: (imageSize: SelfieSize, borderFraction: number) => SelfieSize;
43
+ /**
44
+ * Aspect ratio of the card a document is drawn in: `documentAspectRatio`, the
45
+ * shape of the outline the user framed, for a document saved with a border.
46
+ * One saved with none takes the shape of its `imageSize` once that is known,
47
+ * so the whole image fills the card with nothing beside it; a portrait photo
48
+ * of a passport would otherwise be a strip down the middle of a wide card.
49
+ */
50
+ readonly cardAspectRatio: (imageSize: SelfieSize | null, documentAspectRatio: number, borderFraction: number) => number;
42
51
  /**
43
52
  * Uniform scale at which an `imageSize` document is drawn in a `boxSize` card,
44
53
  * centred: its `shownSize` part fitted to the card, or, with no border, the
45
- * whole image covering it. Returns 1 when either size is degenerate.
54
+ * whole image fitted to it: a gallery import keeps the shape it was picked
55
+ * in, and covering the card with it would cut the document off. Returns 1
56
+ * when either size is degenerate.
46
57
  */
47
58
  readonly cardScale: (imageSize: SelfieSize, boxSize: SelfieSize, borderFraction: number) => number;
48
59
  /**
@@ -1 +1 @@
1
- "use strict";export const DocumentInteriorCrop={fullBorderFraction:.15,guideEdgeSlack:.1,shownSize(t,h){const n=Math.min(Math.max(h,0),DocumentInteriorCrop.fullBorderFraction)*Math.min(t.width,t.height),c=1+2*DocumentInteriorCrop.guideEdgeSlack;return{width:Math.min(t.width,(t.width-2*n)*c),height:Math.min(t.height,(t.height-2*n)*c)}},cardScale(t,h,r){if(t.width<=0||t.height<=0||h.width<=0||h.height<=0)return 1;if(r<=0)return Math.max(h.width/t.width,h.height/t.height);const n=DocumentInteriorCrop.shownSize(t,r);return Math.min(h.width/n.width,h.height/n.height)},imageRect(t,h,r){const n=DocumentInteriorCrop.cardScale(t,h,r),c=t.width*n,d=t.height*n;return{left:(h.width-c)/2,top:(h.height-d)/2,width:c,height:d}}};
1
+ "use strict";export const DocumentInteriorCrop={fullBorderFraction:.15,guideEdgeSlack:.1,shownSize(t,h){const n=Math.min(Math.max(h,0),DocumentInteriorCrop.fullBorderFraction)*Math.min(t.width,t.height),d=1+2*DocumentInteriorCrop.guideEdgeSlack;return{width:Math.min(t.width,(t.width-2*n)*d),height:Math.min(t.height,(t.height-2*n)*d)}},cardAspectRatio(t,h,r){return r>0||t===null||t.width<=0||t.height<=0?h:t.width/t.height},cardScale(t,h,r){if(t.width<=0||t.height<=0||h.width<=0||h.height<=0)return 1;if(r<=0)return Math.min(h.width/t.width,h.height/t.height);const n=DocumentInteriorCrop.shownSize(t,r);return Math.min(h.width/n.width,h.height/n.height)},imageRect(t,h,r){const n=DocumentInteriorCrop.cardScale(t,h,r),d=t.width*n,c=t.height*n;return{left:(h.width-d)/2,top:(h.height-c)/2,width:d,height:c}}};