@getyoti/react-native-yoti-face-capture 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
  # ChangeLog
2
+ ## Version 3.0.0
3
+ BREAKING CHANGE: New configuration requirements
4
+
5
+ The configuration has been updated and expects a `faceCenter` representing the expected center of the captured face.
6
+ This parameter is a percentage value (x, y). E.g.: (0,0) - top left; (0.5, 0.5) - center of the screen; (1,1) - bottom right;
7
+
8
+ Please, check [README.md](https://github.com/getyoti/react-native-yoti-face-capture/blob/main/README.md) for more details.
9
+
10
+ ## Version 2.0.1
11
+
12
+ Contains a couple of bug fixes on the iOS side of the SDK:
13
+ - Solves the discrepancy between the required screen units that needs to be used for Android and iOS. Now, both platforms will be expecting pixels when defining the scanning area.
14
+ - Fixes a crash when the component was used inside of a react-navigation react-stack screen.
15
+
2
16
  ## Version 2.0.0
3
17
 
4
18
  BREAKING CHANGE: Low light detection
@@ -8,8 +22,8 @@ Please, check [README.md](https://github.com/getyoti/react-native-yoti-face-capt
8
22
 
9
23
  ## Version 1.1.0
10
24
 
11
- Fix: README.md
25
+ Fix: README.md
12
26
 
13
27
  ## Version 1.0.0
14
28
 
15
- Face capture first release
29
+ Face capture first release
package/README.md CHANGED
@@ -107,11 +107,9 @@ function App(){
107
107
  requiredStableFrames={3}
108
108
  requireValidAngle
109
109
  requireBrightEnvironment
110
- scanningArea={[
111
- 0,
112
- 0,
113
- PixelRatio.getPixelSizeForLayoutSize(windowHeight),
114
- PixelRatio.getPixelSizeForLayoutSize(windowHeight),
110
+ faceCenter={[
111
+ 0.5,
112
+ 0.5
115
113
  ]}
116
114
  onFaceCaptureAnalyzedImage={({nativeEvent: analysis}) => {
117
115
  // analysis.croppedImage
@@ -142,7 +140,7 @@ function App(){
142
140
  * [requiredStableFrames](#requiredStableFrame)
143
141
  * [requireValidAngle](#requireValidAngle)
144
142
  * [requireBrightEnvironment](#requireBrightEnvironment)
145
- * [scanningArea](#scanningArea)
143
+ * [faceCenter](#faceCenter)
146
144
  * [onFaceCaptureStateChanged](#onFaceCaptureStateChanged)
147
145
  * [onFaceCaptureStateFailed](#onFaceCaptureStateFailed)
148
146
  * [onFaceCaptureAnalyzedImage](#onFaceCaptureAnalyzedImage)
@@ -179,14 +177,8 @@ This optional boolean, if true, will require the picture to be taken in a bright
179
177
  * **true (default)** - require bright environment, picture is not taken til the luminosity is good enough
180
178
  * **false** - allow the picture to be taken regardless of luminosity
181
179
 
182
-
183
- #### scanningArea
184
- The scanning area is a Rect representing the region in which the face can only be detected. If the face is outside of this region it, will not be considered a valid face.
185
- The value must be an array of four values to determine the region: `[x, y, width, height]`.
186
- Please note the width and height will be considered as pixel values.
187
- You may convert your conventional height and width with [`getPixelSizeForLayoutSize()`](https://reactnative.dev/docs/pixelratio#getpixelsizeforlayoutsize).
188
-
189
- A default of `[0, 0, 720, 1280]` will be applied for this.
180
+ #### faceCenter
181
+ The face center is a Point representing the expected position of the center of the captured face. If the actual face center is not near this point it will not be considered a valid face. This parameter is a percentage value (x, y). E.g.: (0,0) - represents a top left point; (0.5, 0.5) - represents center of the screen; (1,1) - represents a point in the bottom right of the screen;
190
182
 
191
183
  #### onFaceCaptureStateChanged
192
184
  A function to be invoked when the state of Face Capture changes.
@@ -54,7 +54,7 @@ dependencies {
54
54
  //noinspection GradleDynamicVersion
55
55
  implementation "com.facebook.react:react-native:+" // From node_modules
56
56
  implementation "org.jetbrains.kotlin:kotlin-stdlib:${project.ext.kotlinVersion}"
57
- implementation 'com.yoti.mobile.android:face-capture-bundled:3.0.0'
57
+ implementation 'com.yoti.mobile.android:face-capture-bundled:4.0.0'
58
58
  implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
59
59
  implementation 'androidx.appcompat:appcompat:1.2.0'
60
60
  implementation 'com.google.android.material:material:1.2.1'
@@ -1,10 +1,10 @@
1
1
  package com.yoti.reactnative.facecapture;
2
2
 
3
+ import android.graphics.PointF;
3
4
  import android.util.Base64;
4
5
  import android.view.Choreographer;
5
6
  import android.view.View;
6
7
  import android.widget.LinearLayout;
7
- import android.graphics.Rect;
8
8
 
9
9
  import androidx.lifecycle.LifecycleOwner;
10
10
 
@@ -34,7 +34,7 @@ public class YotiFaceCaptureView extends LinearLayout {
34
34
  private boolean mRequireEyesOpen;
35
35
  private boolean mRequireBrightEnvironment = true;
36
36
  private int mRequiredStableFrames;
37
- private ReadableArray mScanningArea;
37
+ private ReadableArray mFaceCenter;
38
38
  private final CameraStateListener mCameraStateListener = new CameraStateListener() {
39
39
  @Override
40
40
  public void onCameraState(@NotNull CameraState cameraState) {
@@ -121,8 +121,8 @@ public class YotiFaceCaptureView extends LinearLayout {
121
121
  super.requestLayout();
122
122
  }
123
123
 
124
- public void setScanningArea(ReadableArray scanningArea) throws Exception {
125
- mScanningArea = scanningArea;
124
+ public void setFaceCenter(ReadableArray faceCenter) throws Exception {
125
+ mFaceCenter = faceCenter;
126
126
  }
127
127
 
128
128
  public void setImageQuality(String imageQuality) throws Exception {
@@ -166,15 +166,10 @@ public class YotiFaceCaptureView extends LinearLayout {
166
166
  }
167
167
 
168
168
  public void startAnalyzing() {
169
- Rect scanningArea = new Rect(
170
- mScanningArea.getInt(0),
171
- mScanningArea.getInt(1),
172
- mScanningArea.getInt(0) + mScanningArea.getInt(2),
173
- mScanningArea.getInt(1) + mScanningArea.getInt(3)
174
- );
169
+ PointF faceCenter = new PointF((float) mFaceCenter.getDouble(0), (float) mFaceCenter.getDouble(1));
175
170
 
176
171
  FaceCaptureConfiguration configuration = new FaceCaptureConfiguration(
177
- scanningArea,
172
+ faceCenter,
178
173
  mImageQuality,
179
174
  mRequireValidAngle,
180
175
  mRequireEyesOpen,
@@ -40,10 +40,10 @@ public class YotiFaceCaptureViewManager extends SimpleViewManager<YotiFaceCaptur
40
40
  .build();
41
41
  }
42
42
 
43
- @ReactProp(name = "scanningArea")
44
- public void setScanningArea(YotiFaceCaptureView view, ReadableArray scanningArea) throws Exception {
43
+ @ReactProp(name = "faceCenter")
44
+ public void setFaceCenter(YotiFaceCaptureView view, ReadableArray faceCenter) throws Exception {
45
45
  try {
46
- view.setScanningArea(scanningArea);
46
+ view.setFaceCenter(faceCenter);
47
47
  } catch (Exception e) {
48
48
  throw e;
49
49
  }
@@ -6,7 +6,7 @@
6
6
  - (instancetype)initWithFrame:(CGRect)frame
7
7
  {
8
8
  self = [super initWithFrame:frame];
9
- self.rootViewController = RCTPresentedViewController();
9
+ self.rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
10
10
  self.faceCaptureViewController = [FaceCapture faceCaptureViewController];
11
11
  self.faceCaptureViewController.delegate = self;
12
12
  self.faceCaptureViewController.view.backgroundColor = [UIColor clearColor];
@@ -61,14 +61,12 @@
61
61
  [self.faceCaptureConfiguration disableEnvironmentLuminosityValidationOption];
62
62
  }
63
63
 
64
- -(void)setScanningArea:(NSArray *)scanningArea {
65
- CGRect area = CGRectMake(
66
- [(NSNumber *)[scanningArea objectAtIndex:0] floatValue],
67
- [(NSNumber *)[scanningArea objectAtIndex:1] floatValue],
68
- [(NSNumber *)[scanningArea objectAtIndex:2] floatValue],
69
- [(NSNumber *)[scanningArea objectAtIndex:3] floatValue]
64
+ -(void)setFaceCenter:(NSArray *)faceCenter {
65
+ CGPoint point = CGPointMake(
66
+ [(NSNumber *)[faceCenter objectAtIndex:0] floatValue],
67
+ [(NSNumber *)[faceCenter objectAtIndex:1] floatValue]
70
68
  );
71
- [self.faceCaptureConfiguration setScanningArea:area];
69
+ [self.faceCaptureConfiguration setFaceCenter: point];
72
70
  }
73
71
 
74
72
  -(void)setRequiredStableFrames:(NSNumber *)requiredStableFrames {
@@ -21,7 +21,7 @@ RCT_EXPORT_VIEW_PROPERTY(requireValidAngle, BOOL)
21
21
  RCT_EXPORT_VIEW_PROPERTY(requireBrightEnvironment, BOOL)
22
22
  RCT_EXPORT_VIEW_PROPERTY(imageQuality, NSInteger)
23
23
  RCT_EXPORT_VIEW_PROPERTY(requiredStableFrames, NSNumber)
24
- RCT_EXPORT_VIEW_PROPERTY(scanningArea, NSArray)
24
+ RCT_EXPORT_VIEW_PROPERTY(faceCenter, NSArray)
25
25
 
26
26
  - (NSDictionary *)constantsToExport
27
27
  {
@@ -134,7 +134,7 @@ class RNYotiCapture extends _react.default.Component {
134
134
  requireValidAngle = false,
135
135
  requiredStableFrames = 3,
136
136
  imageQuality = _RNYotiCaptureTypes.IMAGE_QUALITY_MEDIUM,
137
- scanningArea = [0, 0, _reactNative.PixelRatio.getPixelSizeForLayoutSize(720), _reactNative.PixelRatio.getPixelSizeForLayoutSize(1280)]
137
+ faceCenter = [0.5, 0.5]
138
138
  } = this.props;
139
139
  return /*#__PURE__*/_react.default.createElement(YotiFaceCaptureView, _extends({}, this.props, {
140
140
  requireEyesOpen: requireEyesOpen,
@@ -142,7 +142,7 @@ class RNYotiCapture extends _react.default.Component {
142
142
  requiredStableFrames: requiredStableFrames,
143
143
  requireBrightEnvironment: requireBrightEnvironment,
144
144
  imageQuality: imageQuality,
145
- scanningArea: scanningArea,
145
+ faceCenter: faceCenter,
146
146
  ref: this._setReference,
147
147
  onCameraStateChange: this.onCameraStateChange.bind(this),
148
148
  onFaceCaptureResult: this.onFaceCaptureResult.bind(this)
@@ -1 +1 @@
1
- {"version":3,"sources":["RNYotiCapture.android.tsx"],"names":["YotiFaceCaptureView","YotiFaceCaptureModule","NativeModules","FACE_CAPTURE_FAILURE_RENAMING","FaceTooBig","EyesClosed","FaceTooSmall","FaceNotStable","NoFaceDetected","FaceNotCentered","FaceNotStraight","EnvironmentTooDark","AnalysisError","MultipleFacesDetected","RNYotiCapture","React","Component","constructor","props","ref","_faceCaptureHandle","startAnalyzing","stopAnalyzing","startCamera","stopCamera","onCameraStateChange","cameraState","state","nativeEvent","onFaceCaptureStateChanged","onFaceCaptureStateFailed","onFaceCaptureResult","faceCaptureResult","cause","nativeCause","croppedImage","croppedFaceBoundingBox","faceBoundingBox","originalImage","onFaceCaptureAnalyzedImage","undefined","onFaceCaptureImageAnalysisFailed","render","requireEyesOpen","requireBrightEnvironment","requireValidAngle","requiredStableFrames","imageQuality","IMAGE_QUALITY_MEDIUM","scanningArea","PixelRatio","getPixelSizeForLayoutSize","_setReference","bind"],"mappings":";;;;;;;AAAA;;AACA;;AAaA;;;;;;;;AAEA,MAAMA,mBAAmB,GACvB,yCAAqD,qBAArD,CADF;AAEA,MAAMC,qBAAqB,GAAGC,2BAAcD,qBAA5C;AA2EA,MAAME,6BAA8C,GAAG;AACrDC,EAAAA,UAAU,EAAE,oCADyC;AAErDC,EAAAA,UAAU,EAAE,qCAFyC;AAGrDC,EAAAA,YAAY,EAAE,sCAHuC;AAIrDC,EAAAA,aAAa,EAAE,uCAJsC;AAKrDC,EAAAA,cAAc,EAAE,wCALqC;AAMrDC,EAAAA,eAAe,EAAE,yCANoC;AAOrDC,EAAAA,eAAe,EAAE,yCAPoC;AAQrDC,EAAAA,kBAAkB,EAAE,4CARiC;AASrDC,EAAAA,aAAa,EAAE,4CATsC;AAUrDC,EAAAA,qBAAqB,EAAE;AAV8B,CAAvD;;AAae,MAAMC,aAAN,SAA4BC,eAAMC,SAAlC,CAA4D;AAGzEC,EAAAA,WAAW,CAACC,KAAD,EAAwB;AACjC,UAAMA,KAAN;;AADiC;;AAAA,2CAKlBC,GAAD,IAAc;AAC5B,UAAIA,GAAJ,EAAS;AACP,aAAKC,kBAAL,GAA0B,iCAAeD,GAAf,CAA1B;AACD,OAFD,MAEO;AACL,aAAKC,kBAAL,GAA0B,IAA1B;AACD;AACF,KAXkC;;AAEjC,SAAKA,kBAAL,GAA0B,IAA1B;AACD;;AAUDC,EAAAA,cAAc,GAAG;AACfpB,IAAAA,qBAAqB,CAACoB,cAAtB,CAAqC,KAAKD,kBAA1C;AACD;;AAEDE,EAAAA,aAAa,GAAG;AACdrB,IAAAA,qBAAqB,CAACqB,aAAtB,CAAoC,KAAKF,kBAAzC;AACD;;AAEDG,EA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E,SAAnD,EAA8D;AAC5D;AACD;;AAED,QAAIP,KAAK,GAAG9B,6BAA6B,CAAC+B,WAAD,CAAzC;;AACA,QAAID,KAAK,KAAKO,SAAd,EAAyB;AACvBP,MAAAA,KAAK,GAAG,4CAAR;AACD;;AAED,SAAKf,KAAL,CAAWuB,gCAAX,CAA4C;AAC1CR,MAAAA,KAD0C;AAE1CK,MAAAA;AAF0C,KAA5C;AAID;;AAEDI,EAAAA,MAAM,GAAG;AACP,UAAM;AACJC,MAAAA,eAAe,GAAG,KADd;AAEJC,MAAAA,wBAAwB,GAAG,IAFvB;AAGJC,MAAAA,iBAAiB,GAAG,KAHhB;AAIJC,MAAAA,oBAAoB,GAAG,CAJnB;AAKJC,MAAAA,YAAY,GAAGC,wCALX;AAMJC,MAAAA,YAAY,GAAG,CACb,CADa,EAEb,CAFa,EAGbC,wBAAWC,yBAAX,CAAqC,GAArC,CAHa,EAIbD,wBAAWC,yBAAX,CAAqC,IAArC,CAJa;AANX,QAYF,KAAKjC,KAZT;AAcA,wBACE,6BAAC,mBAAD,eACM,KAAKA,KADX;AAEE,MAAA,eAAe,EAAEyB,eAFnB;AAGE,MAAA,iBAAiB,EAAEE,iBAHrB;AAIE,MAAA,oBAAoB,EAAEC,oBAJxB;AAKE,MAAA,wBAAwB,EAAEF,wBAL5B;AAME,MAAA,YAAY,EAAEG,YANhB;AAOE,MAAA,YAAY,EAAEE,YAPhB;AAQE,MAAA,GAAG,EAAE,KAAKG,aARZ;AASE,MAAA,mBAAmB,EAAE,KAAK3B,mBAAL,CAAyB4B,IAAzB,CAA8B,IAA9B,CATvB;AAUE,MAAA,mBAAmB,EAAE,KAAKtB,mBAAL,CAAyBsB,IAAzB,CAA8B,IAA9B;AAVvB,OADF;AAcD;;AArIwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n PixelRatio,\n requireNativeComponent,\n NativeModules,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\nconst YotiFaceCaptureView =\n requireNativeComponent<NativeFaceCaptureViewAndroid>('YotiFaceCaptureView');\nconst YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n\ntype NativeCaptureResultState = 'ValidFace' | 'InvalidFace';\n\ntype NATIVE_ANALYSIS_FAILURE_CAUSE =\n | 'FaceTooBig'\n | 'EyesClosed'\n | 'FaceTooSmall'\n | 'FaceNotStable'\n | 'NoFaceDetected'\n | 'FaceNotCentered'\n | 'FaceNotStraight'\n | 'EnvironmentTooDark'\n | 'AnalysisError'\n | 'MultipleFacesDetected';\n\ntype NativeCaptureResult = {\n nativeEvent: {\n cause?: NATIVE_ANALYSIS_FAILURE_CAUSE;\n croppedImage?: string;\n croppedFaceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage?: string;\n state: NativeCaptureResultState;\n };\n};\n\ntype NativeFaceCaptureSuccessState =\n | 'Analyzing'\n | 'CameraReady'\n | 'CameraStopped';\n\ntype NativeFaceCaptureFailureState =\n | 'CameraInitializationError'\n | 'MissingPermissions';\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: NativeFaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: NativeFaceCaptureFailureState;\n };\n};\n\ninterface NativeFaceCaptureViewAndroid {\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: Boolean;\n imageQuality: IMAGE_QUALITY;\n scanningArea: Array<number>;\n onCameraStateChange: (\n faceCaptureState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) => void;\n onFaceCaptureResult: (faceCaptureResult: NativeCaptureResult) => void;\n}\n\ntype FailureRenaming = {\n [Property in NATIVE_ANALYSIS_FAILURE_CAUSE]: ANALYSIS_FAILURE_CAUSE;\n};\n\nconst FACE_CAPTURE_FAILURE_RENAMING: FailureRenaming = {\n FaceTooBig: 'FaceCaptureAnalysisErrorFaceTooBig',\n EyesClosed: 'FaceCaptureAnalysisErrorEyesNotOpen',\n FaceTooSmall: 'FaceCaptureAnalysisErrorFaceTooSmall',\n FaceNotStable: 'FaceCaptureAnalysisErrorFaceNotStable',\n NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',\n FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',\n FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',\n EnvironmentTooDark: 'FaceCaptureAnalysisErrorEnvironmentTooDark',\n AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',\n MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces',\n};\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n YotiFaceCaptureModule.startAnalyzing(this._faceCaptureHandle);\n }\n\n stopAnalyzing() {\n YotiFaceCaptureModule.stopAnalyzing(this._faceCaptureHandle);\n }\n\n startCamera() {\n YotiFaceCaptureModule.startCamera(this._faceCaptureHandle);\n }\n\n stopCamera() {\n YotiFaceCaptureModule.stopCamera(this._faceCaptureHandle);\n }\n\n onCameraStateChange(\n cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) {\n let state = cameraState.nativeEvent.state;\n\n switch (state) {\n case 'Analyzing':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');\n break;\n\n case 'CameraReady':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraReady');\n break;\n\n case 'CameraStopped':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');\n break;\n\n case 'CameraInitializationError':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraInitializingError'\n );\n break;\n\n case 'MissingPermissions':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraNotAccessible'\n );\n break;\n }\n }\n\n onFaceCaptureResult(faceCaptureResult: NativeCaptureResult) {\n const {\n cause: nativeCause,\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n state,\n } = faceCaptureResult.nativeEvent;\n\n if (\n state === 'ValidFace' &&\n croppedImage != null &&\n croppedFaceBoundingBox != null &&\n faceBoundingBox != null &&\n originalImage != null\n ) {\n this.props.onFaceCaptureAnalyzedImage({\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n });\n return;\n }\n if (nativeCause === undefined || originalImage === undefined) {\n return;\n }\n\n let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];\n if (cause === undefined) {\n cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';\n }\n\n this.props.onFaceCaptureImageAnalysisFailed({\n cause,\n originalImage,\n });\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireBrightEnvironment = true,\n requireValidAngle = false,\n requiredStableFrames = 3,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n scanningArea = [\n 0,\n 0,\n PixelRatio.getPixelSizeForLayoutSize(720),\n PixelRatio.getPixelSizeForLayoutSize(1280),\n ],\n } = this.props;\n\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n scanningArea={scanningArea}\n ref={this._setReference}\n onCameraStateChange={this.onCameraStateChange.bind(this)}\n onFaceCaptureResult={this.onFaceCaptureResult.bind(this)}\n />\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["RNYotiCapture.android.tsx"],"names":["YotiFaceCaptureView","YotiFaceCaptureModule","NativeModules","FACE_CAPTURE_FAILURE_RENAMING","FaceTooBig","EyesClosed","FaceTooSmall","FaceNotStable","NoFaceDetected","FaceNotCentered","FaceNotStraight","EnvironmentTooDark","AnalysisError","MultipleFacesDetected","RNYotiCapture","React","Component","constructor","props","ref","_faceCaptureHandle","startAnalyzing","stopAnalyzing","startCamera","stopCamera","onCameraStateChange","cameraState","state","nativeEvent","onFaceCaptureStateChanged","onFaceCaptureStateFailed","onFaceCaptureResult","faceCaptureResult","cause","nativeCause","croppedImage","croppedFaceBoundingBox","faceBoundingBox","originalImage","onFaceCaptureAnalyzedImage","undefined","onFaceCaptureImageAnalysisFailed","render","requireEyesOpen","requireBrightEnvironment","requireValidAngle","requiredStableFrames","imageQuality","IMAGE_QUALITY_MEDIUM","faceCenter","_setReference","bind"],"mappings":";;;;;;;AAAA;;AACA;;AAYA;;;;;;;;AAEA,MAAMA,mBAAmB,GACvB,yCAAqD,qBAArD,CADF;AAEA,MAAMC,qBAAqB,GAAGC,2BAAcD,qBAA5C;AA2EA,MAAME,6BAA8C,GAAG;AACrDC,EAAAA,UAAU,EAAE,oCADyC;AAErDC,EAAAA,UAAU,EAAE,qCAFyC;AAGrDC,EAAAA,YAAY,EAAE,sCAHuC;AAIrDC,EAAAA,aAAa,EAAE,uCAJsC;AAKrDC,EAAAA,cAAc,EAAE,wCALqC;AAMrDC,EAAAA,eAAe,EAAE,yCANoC;AAOrDC,EAAAA,eAAe,EAAE,yCAPoC;AAQrDC,EAAAA,kBAAkB,EAAE,4CARiC;AASrDC,EAAAA,aAAa,EAAE,4CATsC;AAUrDC,EAAAA,qBAAqB,EAAE;AAV8B,CAAvD;;AAae,MAAMC,aAAN,SAA4BC,eAAMC,SAAlC,CAA4D;AAGzEC,EAAAA,WAAW,CAACC,KAAD,EAAwB;AACjC,UAAMA,KAAN;;AADiC;;AAAA,2CAKlBC,GAAD,IAAc;AAC5B,UAAIA,GAAJ,EAAS;AACP,aAA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B,CAA8B,IAA9B,CATvB;AAUE,MAAA,mBAAmB,EAAE,KAAKpB,mBAAL,CAAyBoB,IAAzB,CAA8B,IAA9B;AAVvB,OADF;AAcD;;AAnIwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n requireNativeComponent,\n NativeModules,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\nconst YotiFaceCaptureView =\n requireNativeComponent<NativeFaceCaptureViewAndroid>('YotiFaceCaptureView');\nconst YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n\ntype NativeCaptureResultState = 'ValidFace' | 'InvalidFace';\n\ntype NATIVE_ANALYSIS_FAILURE_CAUSE =\n | 'FaceTooBig'\n | 'EyesClosed'\n | 'FaceTooSmall'\n | 'FaceNotStable'\n | 'NoFaceDetected'\n | 'FaceNotCentered'\n | 'FaceNotStraight'\n | 'EnvironmentTooDark'\n | 'AnalysisError'\n | 'MultipleFacesDetected';\n\ntype NativeCaptureResult = {\n nativeEvent: {\n cause?: NATIVE_ANALYSIS_FAILURE_CAUSE;\n croppedImage?: string;\n croppedFaceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage?: string;\n state: NativeCaptureResultState;\n };\n};\n\ntype NativeFaceCaptureSuccessState =\n | 'Analyzing'\n | 'CameraReady'\n | 'CameraStopped';\n\ntype NativeFaceCaptureFailureState =\n | 'CameraInitializationError'\n | 'MissingPermissions';\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: NativeFaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: NativeFaceCaptureFailureState;\n };\n};\n\ninterface NativeFaceCaptureViewAndroid {\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: Boolean;\n imageQuality: IMAGE_QUALITY;\n faceCenter: Array<number>;\n onCameraStateChange: (\n faceCaptureState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) => void;\n onFaceCaptureResult: (faceCaptureResult: NativeCaptureResult) => void;\n}\n\ntype FailureRenaming = {\n [Property in NATIVE_ANALYSIS_FAILURE_CAUSE]: ANALYSIS_FAILURE_CAUSE;\n};\n\nconst FACE_CAPTURE_FAILURE_RENAMING: FailureRenaming = {\n FaceTooBig: 'FaceCaptureAnalysisErrorFaceTooBig',\n EyesClosed: 'FaceCaptureAnalysisErrorEyesNotOpen',\n FaceTooSmall: 'FaceCaptureAnalysisErrorFaceTooSmall',\n FaceNotStable: 'FaceCaptureAnalysisErrorFaceNotStable',\n NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',\n FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',\n FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',\n EnvironmentTooDark: 'FaceCaptureAnalysisErrorEnvironmentTooDark',\n AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',\n MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces',\n};\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n YotiFaceCaptureModule.startAnalyzing(this._faceCaptureHandle);\n }\n\n stopAnalyzing() {\n YotiFaceCaptureModule.stopAnalyzing(this._faceCaptureHandle);\n }\n\n startCamera() {\n YotiFaceCaptureModule.startCamera(this._faceCaptureHandle);\n }\n\n stopCamera() {\n YotiFaceCaptureModule.stopCamera(this._faceCaptureHandle);\n }\n\n onCameraStateChange(\n cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) {\n let state = cameraState.nativeEvent.state;\n\n switch (state) {\n case 'Analyzing':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');\n break;\n\n case 'CameraReady':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraReady');\n break;\n\n case 'CameraStopped':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');\n break;\n\n case 'CameraInitializationError':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraInitializingError'\n );\n break;\n\n case 'MissingPermissions':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraNotAccessible'\n );\n break;\n }\n }\n\n onFaceCaptureResult(faceCaptureResult: NativeCaptureResult) {\n const {\n cause: nativeCause,\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n state,\n } = faceCaptureResult.nativeEvent;\n\n if (\n state === 'ValidFace' &&\n croppedImage != null &&\n croppedFaceBoundingBox != null &&\n faceBoundingBox != null &&\n originalImage != null\n ) {\n this.props.onFaceCaptureAnalyzedImage({\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n });\n return;\n }\n if (nativeCause === undefined || originalImage === undefined) {\n return;\n }\n\n let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];\n if (cause === undefined) {\n cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';\n }\n\n this.props.onFaceCaptureImageAnalysisFailed({\n cause,\n originalImage,\n });\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireBrightEnvironment = true,\n requireValidAngle = false,\n requiredStableFrames = 3,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n faceCenter = [\n 0.5,\n 0.5\n ],\n } = this.props;\n\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n faceCenter={faceCenter}\n ref={this._setReference}\n onCameraStateChange={this.onCameraStateChange.bind(this)}\n onFaceCaptureResult={this.onFaceCaptureResult.bind(this)}\n />\n );\n }\n}\n"]}
@@ -59,7 +59,7 @@ class RNYotiCapture extends _react.default.Component {
59
59
  requiredStableFrames = 3,
60
60
  requireBrightEnvironment = true,
61
61
  imageQuality = _RNYotiCaptureTypes.IMAGE_QUALITY_MEDIUM,
62
- scanningArea = [0, 0, _reactNative.PixelRatio.getPixelSizeForLayoutSize(720), _reactNative.PixelRatio.getPixelSizeForLayoutSize(1280)]
62
+ faceCenter = [0.5, 0.5]
63
63
  } = this.props;
64
64
  return /*#__PURE__*/_react.default.createElement(YotiFaceCaptureView, _extends({}, this.props, {
65
65
  requireEyesOpen: requireEyesOpen,
@@ -67,7 +67,7 @@ class RNYotiCapture extends _react.default.Component {
67
67
  requiredStableFrames: requiredStableFrames,
68
68
  requireBrightEnvironment: requireBrightEnvironment,
69
69
  imageQuality: imageQuality,
70
- scanningArea: scanningArea,
70
+ faceCenter: faceCenter,
71
71
  onFaceCaptureAnalyzedImage: ({
72
72
  nativeEvent: faceCaptureResult
73
73
  }) => this.props.onFaceCaptureAnalyzedImage(faceCaptureResult),
@@ -1 +1 @@
1
- {"version":3,"sources":["RNYotiCapture.ios.tsx"],"names":["YotiFaceCaptureView","RNYotiCapture","React","Component","constructor","props","ref","_faceCaptureHandle","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","startCamera","startAnalyzing","stopAnalyzing","stopCamera","render","requireEyesOpen","requireValidAngle","requiredStableFrames","requireBrightEnvironment","imageQuality","IMAGE_QUALITY_MEDIUM","scanningArea","PixelRatio","getPixelSizeForLayoutSize","nativeEvent","faceCaptureResult","onFaceCaptureAnalyzedImage","faceCaptureAnalysisFailure","onFaceCaptureImageAnalysisFailed","state","faceCaptureState","onFaceCaptureStateChanged","faceCaptureStateFailure","onFaceCaptureStateFailed","_setReference"],"mappings":";;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GAAG,IAJvB;AAKJC,MAAAA,YAAY,GAAGC,wCALX;AAMJC,MAAAA,YAAY,GAAG,CACb,CADa,EAEb,CAFa,EAGbC,wBAAWC,yBAAX,CAAqC,GAArC,CAHa,EAIbD,wBAAWC,yBAAX,CAAqC,IAArC,CAJa;AANX,QAYF,KAAKpB,KAZT;AAaA,wBACE,6BAAC,mBAAD,eACM,KAAKA,KADX;AAEE,MAAA,eAAe,EAAEY,eAFnB;AAGE,MAAA,iBAAiB,EAAEC,iBAHrB;AAIE,MAAA,oBAAoB,EAAEC,oBAJxB;AAKE,MAAA,wBAAwB,EAAEC,wBAL5B;AAME,MAAA,YAAY,EAAEC,YANhB;AAOE,MAAA,YAAY,EAAEE,YAPhB;AAQE,MAAA,0BAA0B,EAAE,CAAC;AAC3BG,QAAAA,WAAW,EAAEC;AADc,OAAD,KAG1B,KAAKtB,KAAL,CAAWuB,0BAAX,CAAsCD,iBAAtC,CAXJ;AAaE,MAAA,gCAAgC,EAAE,CAAC;AACjCD,QAAAA,WAAW,EAAEG;AADoB,OAAD,KAGhC,KAAKxB,KAAL,CAAWyB,gCAAX,CACED,0BADF,CAhBJ;AAoBE,MAAA,yBAAyB,EAAE,CAAC;AAC1BH,QAAAA,WAAW,EAAE;AAAEK,UAAAA,KAAK,EAAEC;AAAT;AADa,OAAD,KAGzB,KAAK3B,KAAL,CAAW4B,yBAAX,CAAqCD,gBAArC,CAvBJ;AAyBE,MAAA,wBAAwB,EAAE,CAAC;AACzBN,QAAAA,WAAW,EAAE;AAAEK,UAAAA,KAAK,EAAEG;AAAT;AADY,OAAD,KAGxB,KAAK7B,KAAL,CAAW8B,wBAAX,CAAoCD,uBAApC,CA5BJ;AA8BE,MAAA,GAAG,EAAE,KAAKE;AA9BZ,OADF;AAkCD;;AAnGwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n PixelRatio,\n requireNativeComponent,\n UIManager,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n FaceCaptureResult,\n FaceCaptureSuccessState,\n FaceCaptureFailureState,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\ntype NativeFaceCaptureResult = {\n nativeEvent: FaceCaptureResult;\n};\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: FaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: FaceCaptureFailureState;\n };\n};\n\ntype NativeFaceCaptureAnalysisFailure = {\n nativeEvent: {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n };\n};\n\ninterface NativeFaceCaptureViewIOS {\n imageQuality: IMAGE_QUALITY;\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: boolean;\n scanningArea: Array<number>;\n onFaceCaptureAnalyzedImage: (\n faceCaptureResult: NativeFaceCaptureResult\n ) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: NativeFaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (faceCaptureState: NativeFaceCaptureState) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: NativeFaceCaptureStateFailure\n ) => void;\n}\n\nconst YotiFaceCaptureView = requireNativeComponent<NativeFaceCaptureViewIOS>(\n 'YotiFaceCaptureView'\n);\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startAnalyzing,\n []\n );\n }\n\n stopAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .stopAnalyzing,\n []\n );\n }\n\n public startCamera = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startCamera,\n []\n );\n };\n\n stopCamera() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopCamera,\n []\n );\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireValidAngle = false,\n requiredStableFrames = 3,\n requireBrightEnvironment = true,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n scanningArea = [\n 0,\n 0,\n PixelRatio.getPixelSizeForLayoutSize(720),\n PixelRatio.getPixelSizeForLayoutSize(1280),\n ],\n } = this.props;\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n scanningArea={scanningArea}\n onFaceCaptureAnalyzedImage={({\n nativeEvent: faceCaptureResult,\n }: NativeFaceCaptureResult) =>\n this.props.onFaceCaptureAnalyzedImage(faceCaptureResult)\n }\n onFaceCaptureImageAnalysisFailed={({\n nativeEvent: faceCaptureAnalysisFailure,\n }: NativeFaceCaptureAnalysisFailure) =>\n this.props.onFaceCaptureImageAnalysisFailed(\n faceCaptureAnalysisFailure\n )\n }\n onFaceCaptureStateChanged={({\n nativeEvent: { state: faceCaptureState },\n }: NativeFaceCaptureState) =>\n this.props.onFaceCaptureStateChanged(faceCaptureState)\n }\n onFaceCaptureStateFailed={({\n nativeEvent: { state: faceCaptureStateFailure },\n }: NativeFaceCaptureStateFailure) =>\n this.props.onFaceCaptureStateFailed(faceCaptureStateFailure)\n }\n ref={this._setReference}\n />\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["RNYotiCapture.ios.tsx"],"names":["YotiFaceCaptureView","RNYotiCapture","React","Component","constructor","props","ref","_faceCaptureHandle","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","startCamera","startAnalyzing","stopAnalyzing","stopCamera","render","requireEyesOpen","requireValidAngle","requiredStableFrames","requireBrightEnvironment","imageQuality","IMAGE_QUALITY_MEDIUM","faceCenter","nativeEvent","faceCaptureResult","onFaceCaptureAnalyzedImage","faceCaptureAnalysisFailure","onFaceCaptureImageAnalysisFailed","state","faceCaptureState","onFaceCaptureStateChanged","faceCaptureStateFailure","onFaceCaptureStateFailed","_setReference"],"mappings":";;;;;;;AAAA;;AACA;;AAeA;;;;;;;;AA4CA,MAAMA,mBAAmB,GAAG,yCAC1B,qBAD0B,CAA5B;;AAIe,MAAMC,aAAN,SAA4BC,eAAMC,SAAlC,CAA4D;AAGzEC,EAAAA,WAAW,CAACC,KAAD,EAAwB;AACjC,UAAMA,KAAN;;AADiC;;AAAA,2CAKlBC,GAAD,IAAc;AAC5B,UAAIA,GAAJ,EAAS;AACP,aAAKC,kBAAL,GAA0B,iCAAeD,GAAf,CAA1B;AACD,OAFD,MAEO;AACL,aAAKC,kBAAL,GAA0B,IAA1B;AACD;AACF,KAXkC;;AAAA,yCA+Bd,MAAM;AACzBC,6BAAUC,0BAAV,CACE,iCAAe,KAAKF,kBAApB,CADF,EAEEC,uBAAUE,oBAAV,CAA+B,qBAA/B,EAAsDC,QAAtD,CACGC,WAHL,EAIE,EAJF;AAMD,KAtCkC;;AAEjC,SAAKL,kBAAL,GAA0B,IAA1B;AACD;;AAUDM,EAAAA,cAAc,GAAG;AACfL,2BAAUC,0BAAV,CACE,iCAAe,IAAf,CADF,EAEED,uBAAUE,oBAAV,CAA+B,qBAA/B,EAAsDC,QAAtD,CACGE,cAHL,EAIE,EAJF;AAMD;;AAEDC,EAAAA,aAAa,GAAG;AACdN,2BAAUC,0BAAV,CACE,iCAAe,IAAf,CADF,EAEED,uBAAUE,oBAA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QAAAA,WAAW,EAAE;AAAEK,UAAAA,KAAK,EAAEG;AAAT;AADY,OAAD,KAGxB,KAAK3B,KAAL,CAAW4B,wBAAX,CAAoCD,uBAApC,CA5BJ;AA8BE,MAAA,GAAG,EAAE,KAAKE;AA9BZ,OADF;AAkCD;;AAjGwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n requireNativeComponent,\n UIManager,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n FaceCaptureResult,\n FaceCaptureSuccessState,\n FaceCaptureFailureState,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\ntype NativeFaceCaptureResult = {\n nativeEvent: FaceCaptureResult;\n};\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: FaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: FaceCaptureFailureState;\n };\n};\n\ntype NativeFaceCaptureAnalysisFailure = {\n nativeEvent: {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n };\n};\n\ninterface NativeFaceCaptureViewIOS {\n imageQuality: IMAGE_QUALITY;\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: boolean;\n faceCenter: Array<number>;\n onFaceCaptureAnalyzedImage: (\n faceCaptureResult: NativeFaceCaptureResult\n ) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: NativeFaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (faceCaptureState: NativeFaceCaptureState) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: NativeFaceCaptureStateFailure\n ) => void;\n}\n\nconst YotiFaceCaptureView = requireNativeComponent<NativeFaceCaptureViewIOS>(\n 'YotiFaceCaptureView'\n);\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startAnalyzing,\n []\n );\n }\n\n stopAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .stopAnalyzing,\n []\n );\n }\n\n public startCamera = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startCamera,\n []\n );\n };\n\n stopCamera() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopCamera,\n []\n );\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireValidAngle = false,\n requiredStableFrames = 3,\n requireBrightEnvironment = true,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n faceCenter = [\n 0.5,\n 0.5\n ],\n } = this.props;\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n faceCenter={faceCenter}\n onFaceCaptureAnalyzedImage={({\n nativeEvent: faceCaptureResult,\n }: NativeFaceCaptureResult) =>\n this.props.onFaceCaptureAnalyzedImage(faceCaptureResult)\n }\n onFaceCaptureImageAnalysisFailed={({\n nativeEvent: faceCaptureAnalysisFailure,\n }: NativeFaceCaptureAnalysisFailure) =>\n this.props.onFaceCaptureImageAnalysisFailed(\n faceCaptureAnalysisFailure\n )\n }\n onFaceCaptureStateChanged={({\n nativeEvent: { state: faceCaptureState },\n }: NativeFaceCaptureState) =>\n this.props.onFaceCaptureStateChanged(faceCaptureState)\n }\n onFaceCaptureStateFailed={({\n nativeEvent: { state: faceCaptureStateFailure },\n }: NativeFaceCaptureStateFailure) =>\n this.props.onFaceCaptureStateFailed(faceCaptureStateFailure)\n }\n ref={this._setReference}\n />\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["RNYotiCaptureTypes.tsx"],"names":["qualityConstants","IMAGE_QUALITY_LOW","IMAGE_QUALITY_MEDIUM","IMAGE_QUALITY_HIGH","Platform","OS","iOSConstants","UIManager","YotiFaceCaptureView","Constants","YotiFaceCaptureModule","NativeModules","androidConstants","getConstants","IMAGE_QUALITY"],"mappings":";;;;;;;AACA;;AAcA,IAAIA,gBAAgB,GAAG;AACrBC,EAAAA,iBAAiB,EAAE,CADE;AAErBC,EAAAA,oBAAoB,EAAE,CAFD;AAGrBC,EAAAA,kBAAkB,EAAE;AAHC,CAAvB;;AAMA,IAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB,QAAMC,YAA+B,GACnC;AACAC,yBAAUC,mBAAV,CAA8BC,SAFhC;AAGAT,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCK,YAAY,CAACL,iBAAlD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCI,YAAY,CAACJ,oBAArD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCG,YAAY,CAACH,kBAAnD;AACD,CAPD,MAOO;AACL,QAAMO,qBAAqB,GAAGC,2BAAcD,qBAA5C;AACA,QAAME,gBAAmC,GACvCF,qBAAqB,CAACG,YAAtB,EADF;AAEAb,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCW,gBAAgB,CAACX,iBAAtD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCU,gBAAgB,CAACV,oBAAzD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCS,gBAAgB,CAACT,kBAAvD;AACD;;AAEM,IAAIF,iBAAiB,GAAGD,gBAAgB,CAACC,iBAAzC;;AACA,IAAIC,oBAAoB,GAAGF,gBAAgB,CAACE,oBAA5C;;AACA,IAAIC,kBAAkB,GAAGH,gBAAgB,CAACG,kBAA1C;;IAEKW,a;;;WAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a","sourcesContent":["import type { Component } from 'react';\nimport {\n NativeModules,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\ninterface PlatformConstants {\n IMAGE_QUALITY_LOW: number;\n IMAGE_QUALITY_MEDIUM: number;\n IMAGE_QUALITY_HIGH: number;\n}\n\nlet qualityConstants = {\n IMAGE_QUALITY_LOW: 0,\n IMAGE_QUALITY_MEDIUM: 0,\n IMAGE_QUALITY_HIGH: 0,\n};\n\nif (Platform.OS === 'ios') {\n const iOSConstants: PlatformConstants =\n // @ts-ignore UIManagerStatic\n UIManager.YotiFaceCaptureView.Constants;\n qualityConstants.IMAGE_QUALITY_LOW = iOSConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = iOSConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = iOSConstants.IMAGE_QUALITY_HIGH;\n} else {\n const YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n const androidConstants: PlatformConstants =\n YotiFaceCaptureModule.getConstants();\n qualityConstants.IMAGE_QUALITY_LOW = androidConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = androidConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = androidConstants.IMAGE_QUALITY_HIGH;\n}\n\nexport let IMAGE_QUALITY_LOW = qualityConstants.IMAGE_QUALITY_LOW;\nexport let IMAGE_QUALITY_MEDIUM = qualityConstants.IMAGE_QUALITY_MEDIUM;\nexport let IMAGE_QUALITY_HIGH = qualityConstants.IMAGE_QUALITY_HIGH;\n\nexport enum IMAGE_QUALITY {\n IMAGE_QUALITY_HIGH,\n IMAGE_QUALITY_MEDIUM,\n IMAGE_QUALITY_LOW,\n}\n\nexport type FaceCaptureResult = {\n croppedImage: string;\n croppedFaceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage: string;\n};\n\nexport type ANALYSIS_FAILURE_CAUSE =\n | 'FaceCaptureAnalysisErrorFaceTooBig'\n | 'FaceCaptureAnalysisErrorEyesNotOpen'\n | 'FaceCaptureAnalysisErrorFaceTooSmall'\n | 'FaceCaptureAnalysisErrorFaceNotStable'\n | 'FaceCaptureAnalysisErrorNoFaceDetected'\n | 'FaceCaptureAnalysisErrorFaceNotCentered'\n | 'FaceCaptureAnalysisErrorFaceNotStraight'\n | 'FaceCaptureAnalysisErrorEnvironmentTooDark'\n | 'FaceCaptureAnalysisErrorFaceAnalysisFailed'\n | 'FaceCaptureAnalysisErrorMultipleFaces';\n\nexport type FaceCaptureAnalysisFailure = {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n};\n\nexport type FaceCaptureSuccessState =\n | 'FaceCaptureStateAnalyzing'\n | 'FaceCaptureStateCameraReady'\n | 'FaceCaptureStateCameraStopped';\n\nexport type FaceCaptureFailureState =\n | 'FaceCaptureStateErrorCameraInitializingError'\n | 'FaceCaptureStateErrorInvalidState'\n | 'FaceCaptureStateErrorCameraNotAccessible';\n\nexport type ComponentProps = {\n requireEyesOpen?: boolean;\n requireValidAngle?: boolean;\n requiredStableFrames?: number;\n requireBrightEnvironment?: boolean;\n imageQuality?: IMAGE_QUALITY;\n scanningArea?: Array<number>;\n onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: FaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (\n faceCaptureState: FaceCaptureSuccessState\n ) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: FaceCaptureFailureState\n ) => void;\n style?: StyleProp<ViewStyle>;\n ref: Component;\n};\n"]}
1
+ {"version":3,"sources":["RNYotiCaptureTypes.tsx"],"names":["qualityConstants","IMAGE_QUALITY_LOW","IMAGE_QUALITY_MEDIUM","IMAGE_QUALITY_HIGH","Platform","OS","iOSConstants","UIManager","YotiFaceCaptureView","Constants","YotiFaceCaptureModule","NativeModules","androidConstants","getConstants","IMAGE_QUALITY"],"mappings":";;;;;;;AACA;;AAcA,IAAIA,gBAAgB,GAAG;AACrBC,EAAAA,iBAAiB,EAAE,CADE;AAErBC,EAAAA,oBAAoB,EAAE,CAFD;AAGrBC,EAAAA,kBAAkB,EAAE;AAHC,CAAvB;;AAMA,IAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB,QAAMC,YAA+B,GACnC;AACAC,yBAAUC,mBAAV,CAA8BC,SAFhC;AAGAT,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCK,YAAY,CAACL,iBAAlD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCI,YAAY,CAACJ,oBAArD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCG,YAAY,CAACH,kBAAnD;AACD,CAPD,MAOO;AACL,QAAMO,qBAAqB,GAAGC,2BAAcD,qBAA5C;AACA,QAAME,gBAAmC,GACvCF,qBAAqB,CAACG,YAAtB,EADF;AAEAb,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCW,gBAAgB,CAACX,iBAAtD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCU,gBAAgB,CAACV,oBAAzD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCS,gBAAgB,CAACT,kBAAvD;AACD;;AAEM,IAAIF,iBAAiB,GAAGD,gBAAgB,CAACC,iBAAzC;;AACA,IAAIC,oBAAoB,GAAGF,gBAAgB,CAACE,oBAA5C;;AACA,IAAIC,kBAAkB,GAAGH,gBAAgB,CAACG,kBAA1C;;IAEKW,a;;;WAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a","sourcesContent":["import type { Component } from 'react';\nimport {\n NativeModules,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\ninterface PlatformConstants {\n IMAGE_QUALITY_LOW: number;\n IMAGE_QUALITY_MEDIUM: number;\n IMAGE_QUALITY_HIGH: number;\n}\n\nlet qualityConstants = {\n IMAGE_QUALITY_LOW: 0,\n IMAGE_QUALITY_MEDIUM: 0,\n IMAGE_QUALITY_HIGH: 0,\n};\n\nif (Platform.OS === 'ios') {\n const iOSConstants: PlatformConstants =\n // @ts-ignore UIManagerStatic\n UIManager.YotiFaceCaptureView.Constants;\n qualityConstants.IMAGE_QUALITY_LOW = iOSConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = iOSConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = iOSConstants.IMAGE_QUALITY_HIGH;\n} else {\n const YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n const androidConstants: PlatformConstants =\n YotiFaceCaptureModule.getConstants();\n qualityConstants.IMAGE_QUALITY_LOW = androidConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = androidConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = androidConstants.IMAGE_QUALITY_HIGH;\n}\n\nexport let IMAGE_QUALITY_LOW = qualityConstants.IMAGE_QUALITY_LOW;\nexport let IMAGE_QUALITY_MEDIUM = qualityConstants.IMAGE_QUALITY_MEDIUM;\nexport let IMAGE_QUALITY_HIGH = qualityConstants.IMAGE_QUALITY_HIGH;\n\nexport enum IMAGE_QUALITY {\n IMAGE_QUALITY_HIGH,\n IMAGE_QUALITY_MEDIUM,\n IMAGE_QUALITY_LOW,\n}\n\nexport type FaceCaptureResult = {\n croppedImage: string;\n croppedFaceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage: string;\n};\n\nexport type ANALYSIS_FAILURE_CAUSE =\n | 'FaceCaptureAnalysisErrorFaceTooBig'\n | 'FaceCaptureAnalysisErrorEyesNotOpen'\n | 'FaceCaptureAnalysisErrorFaceTooSmall'\n | 'FaceCaptureAnalysisErrorFaceNotStable'\n | 'FaceCaptureAnalysisErrorNoFaceDetected'\n | 'FaceCaptureAnalysisErrorFaceNotCentered'\n | 'FaceCaptureAnalysisErrorFaceNotStraight'\n | 'FaceCaptureAnalysisErrorEnvironmentTooDark'\n | 'FaceCaptureAnalysisErrorFaceAnalysisFailed'\n | 'FaceCaptureAnalysisErrorMultipleFaces';\n\nexport type FaceCaptureAnalysisFailure = {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n};\n\nexport type FaceCaptureSuccessState =\n | 'FaceCaptureStateAnalyzing'\n | 'FaceCaptureStateCameraReady'\n | 'FaceCaptureStateCameraStopped';\n\nexport type FaceCaptureFailureState =\n | 'FaceCaptureStateErrorCameraInitializingError'\n | 'FaceCaptureStateErrorInvalidState'\n | 'FaceCaptureStateErrorCameraNotAccessible';\n\nexport type ComponentProps = {\n requireEyesOpen?: boolean;\n requireValidAngle?: boolean;\n requiredStableFrames?: number;\n requireBrightEnvironment?: boolean;\n imageQuality?: IMAGE_QUALITY;\n faceCenter?: Array<number>;\n onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: FaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (\n faceCaptureState: FaceCaptureSuccessState\n ) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: FaceCaptureFailureState\n ) => void;\n style?: StyleProp<ViewStyle>;\n ref: Component;\n};\n"]}
@@ -3,7 +3,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
4
 
5
5
  import React from 'react';
6
- import { findNodeHandle, PixelRatio, requireNativeComponent, NativeModules } from 'react-native';
6
+ import { findNodeHandle, requireNativeComponent, NativeModules } from 'react-native';
7
7
  import { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';
8
8
  const YotiFaceCaptureView = requireNativeComponent('YotiFaceCaptureView');
9
9
  const YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;
@@ -121,7 +121,7 @@ export default class RNYotiCapture extends React.Component {
121
121
  requireValidAngle = false,
122
122
  requiredStableFrames = 3,
123
123
  imageQuality = IMAGE_QUALITY_MEDIUM,
124
- scanningArea = [0, 0, PixelRatio.getPixelSizeForLayoutSize(720), PixelRatio.getPixelSizeForLayoutSize(1280)]
124
+ faceCenter = [0.5, 0.5]
125
125
  } = this.props;
126
126
  return /*#__PURE__*/React.createElement(YotiFaceCaptureView, _extends({}, this.props, {
127
127
  requireEyesOpen: requireEyesOpen,
@@ -129,7 +129,7 @@ export default class RNYotiCapture extends React.Component {
129
129
  requiredStableFrames: requiredStableFrames,
130
130
  requireBrightEnvironment: requireBrightEnvironment,
131
131
  imageQuality: imageQuality,
132
- scanningArea: scanningArea,
132
+ faceCenter: faceCenter,
133
133
  ref: this._setReference,
134
134
  onCameraStateChange: this.onCameraStateChange.bind(this),
135
135
  onFaceCaptureResult: this.onFaceCaptureResult.bind(this)
@@ -1 +1 @@
1
- {"version":3,"sources":["RNYotiCapture.android.tsx"],"names":["React","findNodeHandle","PixelRatio","requireNativeComponent","NativeModules","IMAGE_QUALITY_MEDIUM","YotiFaceCaptureView","YotiFaceCaptureModule","FACE_CAPTURE_FAILURE_RENAMING","FaceTooBig","EyesClosed","FaceTooSmall","FaceNotStable","NoFaceDetected","FaceNotCentered","FaceNotStraight","EnvironmentTooDark","AnalysisError","MultipleFacesDetected","RNYotiCapture","Component","constructor","props","ref","_faceCaptureHandle","startAnalyzing","stopAnalyzing","startCamera","stopCamera","onCameraStateChange","cameraState","state","nativeEvent","onFaceCaptureStateChanged","onFaceCaptureStateFailed","onFaceCaptureResult","faceCaptureResult","cause","nativeCause","croppedImage","croppedFaceBoundingBox","faceBoundingBox","originalImage","onFaceCaptureAnalyzedImage","undefined","onFaceCaptureImageAnalysisFailed","render","requireEyesOpen","requireBrightEnvironment","requireValidAngle","requiredStableFrames","imageQuality","scanningArea","getPixelSizeForLayoutSize","_setReference","bind"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,cADF,EAEEC,UAFF,EAGEC,sBAHF,EAIEC,aAJF,QAKO,cALP;AAaA,SAASC,oBAAT,QAAqC,sBAArC;AAEA,MAAMC,mBAAmB,GACvBH,sBAAsB,CAA+B,qBAA/B,CADxB;AAEA,MAAMI,qBAAqB,GAAGH,aAAa,CAACG,qBAA5C;AA2EA,MAAMC,6BAA8C,GAAG;AACrDC,EAAAA,UAAU,EAAE,oCADyC;AAErDC,EAAAA,UAAU,EAAE,qCAFyC;AAGrDC,EAAAA,YAAY,EAAE,sCAHuC;AAIrDC,EAAAA,aAAa,EAAE,uCAJsC;AAKrDC,EAAAA,cAAc,EAAE,wCALqC;AAMrDC,EAAAA,eAAe,EAAE,yCANoC;AAOrDC,EAAAA,eAAe,EAAE,yCAPoC;AAQrDC,EAAAA,kBAAkB,EAAE,4CARiC;AASrDC,EAAAA,aAAa,EAAE,4CATsC;AAUrDC,EAAAA,qBAAqB,EAAE;AAV8B,CAAvD;AAaA,eAAe,MAAMC,aAAN,SAA4BnB,KAAK,CAACoB,SAAlC,CAA4D;AAGzEC,EAAAA,WAAW,CAACC,KAAD,EA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C,oBAJxB;AAKE,MAAA,wBAAwB,EAAEF,wBAL5B;AAME,MAAA,YAAY,EAAEG,YANhB;AAOE,MAAA,YAAY,EAAEC,YAPhB;AAQE,MAAA,GAAG,EAAE,KAAKE,aARZ;AASE,MAAA,mBAAmB,EAAE,KAAKzB,mBAAL,CAAyB0B,IAAzB,CAA8B,IAA9B,CATvB;AAUE,MAAA,mBAAmB,EAAE,KAAKpB,mBAAL,CAAyBoB,IAAzB,CAA8B,IAA9B;AAVvB,OADF;AAcD;;AArIwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n PixelRatio,\n requireNativeComponent,\n NativeModules,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\nconst YotiFaceCaptureView =\n requireNativeComponent<NativeFaceCaptureViewAndroid>('YotiFaceCaptureView');\nconst YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n\ntype NativeCaptureResultState = 'ValidFace' | 'InvalidFace';\n\ntype NATIVE_ANALYSIS_FAILURE_CAUSE =\n | 'FaceTooBig'\n | 'EyesClosed'\n | 'FaceTooSmall'\n | 'FaceNotStable'\n | 'NoFaceDetected'\n | 'FaceNotCentered'\n | 'FaceNotStraight'\n | 'EnvironmentTooDark'\n | 'AnalysisError'\n | 'MultipleFacesDetected';\n\ntype NativeCaptureResult = {\n nativeEvent: {\n cause?: NATIVE_ANALYSIS_FAILURE_CAUSE;\n croppedImage?: string;\n croppedFaceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage?: string;\n state: NativeCaptureResultState;\n };\n};\n\ntype NativeFaceCaptureSuccessState =\n | 'Analyzing'\n | 'CameraReady'\n | 'CameraStopped';\n\ntype NativeFaceCaptureFailureState =\n | 'CameraInitializationError'\n | 'MissingPermissions';\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: NativeFaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: NativeFaceCaptureFailureState;\n };\n};\n\ninterface NativeFaceCaptureViewAndroid {\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: Boolean;\n imageQuality: IMAGE_QUALITY;\n scanningArea: Array<number>;\n onCameraStateChange: (\n faceCaptureState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) => void;\n onFaceCaptureResult: (faceCaptureResult: NativeCaptureResult) => void;\n}\n\ntype FailureRenaming = {\n [Property in NATIVE_ANALYSIS_FAILURE_CAUSE]: ANALYSIS_FAILURE_CAUSE;\n};\n\nconst FACE_CAPTURE_FAILURE_RENAMING: FailureRenaming = {\n FaceTooBig: 'FaceCaptureAnalysisErrorFaceTooBig',\n EyesClosed: 'FaceCaptureAnalysisErrorEyesNotOpen',\n FaceTooSmall: 'FaceCaptureAnalysisErrorFaceTooSmall',\n FaceNotStable: 'FaceCaptureAnalysisErrorFaceNotStable',\n NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',\n FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',\n FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',\n EnvironmentTooDark: 'FaceCaptureAnalysisErrorEnvironmentTooDark',\n AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',\n MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces',\n};\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n YotiFaceCaptureModule.startAnalyzing(this._faceCaptureHandle);\n }\n\n stopAnalyzing() {\n YotiFaceCaptureModule.stopAnalyzing(this._faceCaptureHandle);\n }\n\n startCamera() {\n YotiFaceCaptureModule.startCamera(this._faceCaptureHandle);\n }\n\n stopCamera() {\n YotiFaceCaptureModule.stopCamera(this._faceCaptureHandle);\n }\n\n onCameraStateChange(\n cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) {\n let state = cameraState.nativeEvent.state;\n\n switch (state) {\n case 'Analyzing':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');\n break;\n\n case 'CameraReady':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraReady');\n break;\n\n case 'CameraStopped':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');\n break;\n\n case 'CameraInitializationError':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraInitializingError'\n );\n break;\n\n case 'MissingPermissions':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraNotAccessible'\n );\n break;\n }\n }\n\n onFaceCaptureResult(faceCaptureResult: NativeCaptureResult) {\n const {\n cause: nativeCause,\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n state,\n } = faceCaptureResult.nativeEvent;\n\n if (\n state === 'ValidFace' &&\n croppedImage != null &&\n croppedFaceBoundingBox != null &&\n faceBoundingBox != null &&\n originalImage != null\n ) {\n this.props.onFaceCaptureAnalyzedImage({\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n });\n return;\n }\n if (nativeCause === undefined || originalImage === undefined) {\n return;\n }\n\n let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];\n if (cause === undefined) {\n cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';\n }\n\n this.props.onFaceCaptureImageAnalysisFailed({\n cause,\n originalImage,\n });\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireBrightEnvironment = true,\n requireValidAngle = false,\n requiredStableFrames = 3,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n scanningArea = [\n 0,\n 0,\n PixelRatio.getPixelSizeForLayoutSize(720),\n PixelRatio.getPixelSizeForLayoutSize(1280),\n ],\n } = this.props;\n\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n scanningArea={scanningArea}\n ref={this._setReference}\n onCameraStateChange={this.onCameraStateChange.bind(this)}\n onFaceCaptureResult={this.onFaceCaptureResult.bind(this)}\n />\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["RNYotiCapture.android.tsx"],"names":["React","findNodeHandle","requireNativeComponent","NativeModules","IMAGE_QUALITY_MEDIUM","YotiFaceCaptureView","YotiFaceCaptureModule","FACE_CAPTURE_FAILURE_RENAMING","FaceTooBig","EyesClosed","FaceTooSmall","FaceNotStable","NoFaceDetected","FaceNotCentered","FaceNotStraight","EnvironmentTooDark","AnalysisError","MultipleFacesDetected","RNYotiCapture","Component","constructor","props","ref","_faceCaptureHandle","startAnalyzing","stopAnalyzing","startCamera","stopCamera","onCameraStateChange","cameraState","state","nativeEvent","onFaceCaptureStateChanged","onFaceCaptureStateFailed","onFaceCaptureResult","faceCaptureResult","cause","nativeCause","croppedImage","croppedFaceBoundingBox","faceBoundingBox","originalImage","onFaceCaptureAnalyzedImage","undefined","onFaceCaptureImageAnalysisFailed","render","requireEyesOpen","requireBrightEnvironment","requireValidAngle","requiredStableFrames","imageQuality","faceCenter","_setReference","bind"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,cADF,EAEEC,sBAFF,EAGEC,aAHF,QAIO,cAJP;AAYA,SAASC,oBAAT,QAAqC,sBAArC;AAEA,MAAMC,mBAAmB,GACvBH,sBAAsB,CAA+B,qBAA/B,CADxB;AAEA,MAAMI,qBAAqB,GAAGH,aAA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,MAAM,GAAG;AACP,UAAM;AACJC,MAAAA,eAAe,GAAG,KADd;AAEJC,MAAAA,wBAAwB,GAAG,IAFvB;AAGJC,MAAAA,iBAAiB,GAAG,KAHhB;AAIJC,MAAAA,oBAAoB,GAAG,CAJnB;AAKJC,MAAAA,YAAY,GAAG9C,oBALX;AAMJ+C,MAAAA,UAAU,GAAG,CACX,GADW,EAEX,GAFW;AANT,QAUF,KAAK9B,KAVT;AAYA,wBACE,oBAAC,mBAAD,eACM,KAAKA,KADX;AAEE,MAAA,eAAe,EAAEyB,eAFnB;AAGE,MAAA,iBAAiB,EAAEE,iBAHrB;AAIE,MAAA,oBAAoB,EAAEC,oBAJxB;AAKE,MAAA,wBAAwB,EAAEF,wBAL5B;AAME,MAAA,YAAY,EAAEG,YANhB;AAOE,MAAA,UAAU,EAAEC,UAPd;AAQE,MAAA,GAAG,EAAE,KAAKC,aARZ;AASE,MAAA,mBAAmB,EAAE,KAAKxB,mBAAL,CAAyByB,IAAzB,CAA8B,IAA9B,CATvB;AAUE,MAAA,mBAAmB,EAAE,KAAKnB,mBAAL,CAAyBmB,IAAzB,CAA8B,IAA9B;AAVvB,OADF;AAcD;;AAnIwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n requireNativeComponent,\n NativeModules,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\nconst YotiFaceCaptureView =\n requireNativeComponent<NativeFaceCaptureViewAndroid>('YotiFaceCaptureView');\nconst YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n\ntype NativeCaptureResultState = 'ValidFace' | 'InvalidFace';\n\ntype NATIVE_ANALYSIS_FAILURE_CAUSE =\n | 'FaceTooBig'\n | 'EyesClosed'\n | 'FaceTooSmall'\n | 'FaceNotStable'\n | 'NoFaceDetected'\n | 'FaceNotCentered'\n | 'FaceNotStraight'\n | 'EnvironmentTooDark'\n | 'AnalysisError'\n | 'MultipleFacesDetected';\n\ntype NativeCaptureResult = {\n nativeEvent: {\n cause?: NATIVE_ANALYSIS_FAILURE_CAUSE;\n croppedImage?: string;\n croppedFaceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage?: string;\n state: NativeCaptureResultState;\n };\n};\n\ntype NativeFaceCaptureSuccessState =\n | 'Analyzing'\n | 'CameraReady'\n | 'CameraStopped';\n\ntype NativeFaceCaptureFailureState =\n | 'CameraInitializationError'\n | 'MissingPermissions';\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: NativeFaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: NativeFaceCaptureFailureState;\n };\n};\n\ninterface NativeFaceCaptureViewAndroid {\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: Boolean;\n imageQuality: IMAGE_QUALITY;\n faceCenter: Array<number>;\n onCameraStateChange: (\n faceCaptureState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) => void;\n onFaceCaptureResult: (faceCaptureResult: NativeCaptureResult) => void;\n}\n\ntype FailureRenaming = {\n [Property in NATIVE_ANALYSIS_FAILURE_CAUSE]: ANALYSIS_FAILURE_CAUSE;\n};\n\nconst FACE_CAPTURE_FAILURE_RENAMING: FailureRenaming = {\n FaceTooBig: 'FaceCaptureAnalysisErrorFaceTooBig',\n EyesClosed: 'FaceCaptureAnalysisErrorEyesNotOpen',\n FaceTooSmall: 'FaceCaptureAnalysisErrorFaceTooSmall',\n FaceNotStable: 'FaceCaptureAnalysisErrorFaceNotStable',\n NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',\n FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',\n FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',\n EnvironmentTooDark: 'FaceCaptureAnalysisErrorEnvironmentTooDark',\n AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',\n MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces',\n};\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n YotiFaceCaptureModule.startAnalyzing(this._faceCaptureHandle);\n }\n\n stopAnalyzing() {\n YotiFaceCaptureModule.stopAnalyzing(this._faceCaptureHandle);\n }\n\n startCamera() {\n YotiFaceCaptureModule.startCamera(this._faceCaptureHandle);\n }\n\n stopCamera() {\n YotiFaceCaptureModule.stopCamera(this._faceCaptureHandle);\n }\n\n onCameraStateChange(\n cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) {\n let state = cameraState.nativeEvent.state;\n\n switch (state) {\n case 'Analyzing':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');\n break;\n\n case 'CameraReady':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraReady');\n break;\n\n case 'CameraStopped':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');\n break;\n\n case 'CameraInitializationError':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraInitializingError'\n );\n break;\n\n case 'MissingPermissions':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraNotAccessible'\n );\n break;\n }\n }\n\n onFaceCaptureResult(faceCaptureResult: NativeCaptureResult) {\n const {\n cause: nativeCause,\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n state,\n } = faceCaptureResult.nativeEvent;\n\n if (\n state === 'ValidFace' &&\n croppedImage != null &&\n croppedFaceBoundingBox != null &&\n faceBoundingBox != null &&\n originalImage != null\n ) {\n this.props.onFaceCaptureAnalyzedImage({\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n });\n return;\n }\n if (nativeCause === undefined || originalImage === undefined) {\n return;\n }\n\n let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];\n if (cause === undefined) {\n cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';\n }\n\n this.props.onFaceCaptureImageAnalysisFailed({\n cause,\n originalImage,\n });\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireBrightEnvironment = true,\n requireValidAngle = false,\n requiredStableFrames = 3,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n faceCenter = [\n 0.5,\n 0.5\n ],\n } = this.props;\n\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n faceCenter={faceCenter}\n ref={this._setReference}\n onCameraStateChange={this.onCameraStateChange.bind(this)}\n onFaceCaptureResult={this.onFaceCaptureResult.bind(this)}\n />\n );\n }\n}\n"]}
@@ -3,7 +3,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
4
 
5
5
  import React from 'react';
6
- import { findNodeHandle, PixelRatio, requireNativeComponent, UIManager } from 'react-native';
6
+ import { findNodeHandle, requireNativeComponent, UIManager } from 'react-native';
7
7
  import { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';
8
8
  const YotiFaceCaptureView = requireNativeComponent('YotiFaceCaptureView');
9
9
  export default class RNYotiCapture extends React.Component {
@@ -46,7 +46,7 @@ export default class RNYotiCapture extends React.Component {
46
46
  requiredStableFrames = 3,
47
47
  requireBrightEnvironment = true,
48
48
  imageQuality = IMAGE_QUALITY_MEDIUM,
49
- scanningArea = [0, 0, PixelRatio.getPixelSizeForLayoutSize(720), PixelRatio.getPixelSizeForLayoutSize(1280)]
49
+ faceCenter = [0.5, 0.5]
50
50
  } = this.props;
51
51
  return /*#__PURE__*/React.createElement(YotiFaceCaptureView, _extends({}, this.props, {
52
52
  requireEyesOpen: requireEyesOpen,
@@ -54,7 +54,7 @@ export default class RNYotiCapture extends React.Component {
54
54
  requiredStableFrames: requiredStableFrames,
55
55
  requireBrightEnvironment: requireBrightEnvironment,
56
56
  imageQuality: imageQuality,
57
- scanningArea: scanningArea,
57
+ faceCenter: faceCenter,
58
58
  onFaceCaptureAnalyzedImage: ({
59
59
  nativeEvent: faceCaptureResult
60
60
  }) => this.props.onFaceCaptureAnalyzedImage(faceCaptureResult),
@@ -1 +1 @@
1
- {"version":3,"sources":["RNYotiCapture.ios.tsx"],"names":["React","findNodeHandle","PixelRatio","requireNativeComponent","UIManager","IMAGE_QUALITY_MEDIUM","YotiFaceCaptureView","RNYotiCapture","Component","constructor","props","ref","_faceCaptureHandle","dispatchViewManagerCommand","getViewManagerConfig","Commands","startCamera","startAnalyzing","stopAnalyzing","stopCamera","render","requireEyesOpen","requireValidAngle","requiredStableFrames","requireBrightEnvironment","imageQuality","scanningArea","getPixelSizeForLayoutSize","nativeEvent","faceCaptureResult","onFaceCaptureAnalyzedImage","faceCaptureAnalysisFailure","onFaceCaptureImageAnalysisFailed","state","faceCaptureState","onFaceCaptureStateChanged","faceCaptureStateFailure","onFaceCaptureStateFailed","_setReference"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,cADF,EAEEC,UAFF,EAGEC,sBAHF,EAIEC,SAJF,QAKO,cALP;AAgBA,SAASC,oBAAT,QAAqC,sBAArC;AA4CA,MAAMC,mBAAmB,GAAGH,sBAAsB,CAChD,qBADgD,CAAlD;AAIA,eAAe,MAAMI,aAAN,SAA4BP,KAAK,CAAC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AAA,YAAY,GAAGpB,oBALX;AAMJqB,MAAAA,YAAY,GAAG,CACb,CADa,EAEb,CAFa,EAGbxB,UAAU,CAACyB,yBAAX,CAAqC,GAArC,CAHa,EAIbzB,UAAU,CAACyB,yBAAX,CAAqC,IAArC,CAJa;AANX,QAYF,KAAKjB,KAZT;AAaA,wBACE,oBAAC,mBAAD,eACM,KAAKA,KADX;AAEE,MAAA,eAAe,EAAEW,eAFnB;AAGE,MAAA,iBAAiB,EAAEC,iBAHrB;AAIE,MAAA,oBAAoB,EAAEC,oBAJxB;AAKE,MAAA,wBAAwB,EAAEC,wBAL5B;AAME,MAAA,YAAY,EAAEC,YANhB;AAOE,MAAA,YAAY,EAAEC,YAPhB;AAQE,MAAA,0BAA0B,EAAE,CAAC;AAC3BE,QAAAA,WAAW,EAAEC;AADc,OAAD,KAG1B,KAAKnB,KAAL,CAAWoB,0BAAX,CAAsCD,iBAAtC,CAXJ;AAaE,MAAA,gCAAgC,EAAE,CAAC;AACjCD,QAAAA,WAAW,EAAEG;AADoB,OAAD,KAGhC,KAAKrB,KAAL,CAAWsB,gCAAX,CACED,0BADF,CAhBJ;AAoBE,MAAA,yBAAyB,EAAE,CAAC;AAC1BH,QAAAA,WAAW,EAAE;AAAEK,UAAAA,KAAK,EAAEC;AAAT;AADa,OAAD,KAGzB,KAAKxB,KAAL,CAAWyB,yBAAX,CAAqCD,gBAArC,CAvBJ;AAyBE,MAAA,wBAAwB,EAAE,CAAC;AACzBN,QAAAA,WAAW,EAAE;AAAEK,UAAAA,KAAK,EAAEG;AAAT;AADY,OAAD,KAGxB,KAAK1B,KAAL,CAAW2B,wBAAX,CAAoCD,uBAApC,CA5BJ;AA8BE,MAAA,GAAG,EAAE,KAAKE;AA9BZ,OADF;AAkCD;;AAnGwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n PixelRatio,\n requireNativeComponent,\n UIManager,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n FaceCaptureResult,\n FaceCaptureSuccessState,\n FaceCaptureFailureState,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\ntype NativeFaceCaptureResult = {\n nativeEvent: FaceCaptureResult;\n};\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: FaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: FaceCaptureFailureState;\n };\n};\n\ntype NativeFaceCaptureAnalysisFailure = {\n nativeEvent: {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n };\n};\n\ninterface NativeFaceCaptureViewIOS {\n imageQuality: IMAGE_QUALITY;\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: boolean;\n scanningArea: Array<number>;\n onFaceCaptureAnalyzedImage: (\n faceCaptureResult: NativeFaceCaptureResult\n ) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: NativeFaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (faceCaptureState: NativeFaceCaptureState) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: NativeFaceCaptureStateFailure\n ) => void;\n}\n\nconst YotiFaceCaptureView = requireNativeComponent<NativeFaceCaptureViewIOS>(\n 'YotiFaceCaptureView'\n);\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startAnalyzing,\n []\n );\n }\n\n stopAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .stopAnalyzing,\n []\n );\n }\n\n public startCamera = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startCamera,\n []\n );\n };\n\n stopCamera() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopCamera,\n []\n );\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireValidAngle = false,\n requiredStableFrames = 3,\n requireBrightEnvironment = true,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n scanningArea = [\n 0,\n 0,\n PixelRatio.getPixelSizeForLayoutSize(720),\n PixelRatio.getPixelSizeForLayoutSize(1280),\n ],\n } = this.props;\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n scanningArea={scanningArea}\n onFaceCaptureAnalyzedImage={({\n nativeEvent: faceCaptureResult,\n }: NativeFaceCaptureResult) =>\n this.props.onFaceCaptureAnalyzedImage(faceCaptureResult)\n }\n onFaceCaptureImageAnalysisFailed={({\n nativeEvent: faceCaptureAnalysisFailure,\n }: NativeFaceCaptureAnalysisFailure) =>\n this.props.onFaceCaptureImageAnalysisFailed(\n faceCaptureAnalysisFailure\n )\n }\n onFaceCaptureStateChanged={({\n nativeEvent: { state: faceCaptureState },\n }: NativeFaceCaptureState) =>\n this.props.onFaceCaptureStateChanged(faceCaptureState)\n }\n onFaceCaptureStateFailed={({\n nativeEvent: { state: faceCaptureStateFailure },\n }: NativeFaceCaptureStateFailure) =>\n this.props.onFaceCaptureStateFailed(faceCaptureStateFailure)\n }\n ref={this._setReference}\n />\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["RNYotiCapture.ios.tsx"],"names":["React","findNodeHandle","requireNativeComponent","UIManager","IMAGE_QUALITY_MEDIUM","YotiFaceCaptureView","RNYotiCapture","Component","constructor","props","ref","_faceCaptureHandle","dispatchViewManagerCommand","getViewManagerConfig","Commands","startCamera","startAnalyzing","stopAnalyzing","stopCamera","render","requireEyesOpen","requireValidAngle","requiredStableFrames","requireBrightEnvironment","imageQuality","faceCenter","nativeEvent","faceCaptureResult","onFaceCaptureAnalyzedImage","faceCaptureAnalysisFailure","onFaceCaptureImageAnalysisFailed","state","faceCaptureState","onFaceCaptureStateChanged","faceCaptureStateFailure","onFaceCaptureStateFailed","_setReference"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,cADF,EAEEC,sBAFF,EAGEC,SAHF,QAIO,cAJP;AAeA,SAASC,oBAAT,QAAqC,sBAArC;AA4CA,MAAMC,mBAAmB,GAAGH,sBAAsB,CAChD,qBADgD,CAAlD;AAIA,eAAe,MAAMI,aAAN,SAA4BN,KAAK,CAACO,SAAlC,CAA4D;AAGzEC,EAAAA,WAAW,CAACC,KAAD,EAAwB;AACjC,UAAMA,KAAN;;AADiC;;AAAA,2CAKlBC,GAAD,IAAc;AAC5B,UAAIA,GAAJ,EAAS;AACP,aAAKC,kBAAL,GAA0BV,cAAc,CAACS,GAAD,CAAxC;AACD,OAFD,MAEO;AACL,aAAKC,kBAAL,GAA0B,IAA1B;AACD;AACF,KAXkC;;AAAA,yCA+Bd,MAAM;AACzBR,MAAAA,SAAS,CAACS,0BAAV,CACEX,cAAc,CAAC,KAAKU,kBAAN,CADhB,EAEER,SAAS,CAACU,oBAAV,CAA+B,qBAA/B,EAAsDC,QAAtD,CACGC,WAHL,EAIE,EAJF;AAMD,KAtCkC;;AAEjC,SAAKJ,kBAAL,GAA0B,IAA1B;AACD;;AAUDK,EAAAA,cAAc,GAAG;AACfb,IAAAA,SAAS,CAACS,0BAAV,CACEX,cAAc,CAAC,IAAD,CADhB,EAEEE,SAA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hBJ;AAoBE,MAAA,yBAAyB,EAAE,CAAC;AAC1BH,QAAAA,WAAW,EAAE;AAAEK,UAAAA,KAAK,EAAEC;AAAT;AADa,OAAD,KAGzB,KAAKvB,KAAL,CAAWwB,yBAAX,CAAqCD,gBAArC,CAvBJ;AAyBE,MAAA,wBAAwB,EAAE,CAAC;AACzBN,QAAAA,WAAW,EAAE;AAAEK,UAAAA,KAAK,EAAEG;AAAT;AADY,OAAD,KAGxB,KAAKzB,KAAL,CAAW0B,wBAAX,CAAoCD,uBAApC,CA5BJ;AA8BE,MAAA,GAAG,EAAE,KAAKE;AA9BZ,OADF;AAkCD;;AAjGwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n requireNativeComponent,\n UIManager,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n FaceCaptureResult,\n FaceCaptureSuccessState,\n FaceCaptureFailureState,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\ntype NativeFaceCaptureResult = {\n nativeEvent: FaceCaptureResult;\n};\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: FaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: FaceCaptureFailureState;\n };\n};\n\ntype NativeFaceCaptureAnalysisFailure = {\n nativeEvent: {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n };\n};\n\ninterface NativeFaceCaptureViewIOS {\n imageQuality: IMAGE_QUALITY;\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: boolean;\n faceCenter: Array<number>;\n onFaceCaptureAnalyzedImage: (\n faceCaptureResult: NativeFaceCaptureResult\n ) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: NativeFaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (faceCaptureState: NativeFaceCaptureState) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: NativeFaceCaptureStateFailure\n ) => void;\n}\n\nconst YotiFaceCaptureView = requireNativeComponent<NativeFaceCaptureViewIOS>(\n 'YotiFaceCaptureView'\n);\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startAnalyzing,\n []\n );\n }\n\n stopAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .stopAnalyzing,\n []\n );\n }\n\n public startCamera = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startCamera,\n []\n );\n };\n\n stopCamera() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopCamera,\n []\n );\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireValidAngle = false,\n requiredStableFrames = 3,\n requireBrightEnvironment = true,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n faceCenter = [\n 0.5,\n 0.5\n ],\n } = this.props;\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n faceCenter={faceCenter}\n onFaceCaptureAnalyzedImage={({\n nativeEvent: faceCaptureResult,\n }: NativeFaceCaptureResult) =>\n this.props.onFaceCaptureAnalyzedImage(faceCaptureResult)\n }\n onFaceCaptureImageAnalysisFailed={({\n nativeEvent: faceCaptureAnalysisFailure,\n }: NativeFaceCaptureAnalysisFailure) =>\n this.props.onFaceCaptureImageAnalysisFailed(\n faceCaptureAnalysisFailure\n )\n }\n onFaceCaptureStateChanged={({\n nativeEvent: { state: faceCaptureState },\n }: NativeFaceCaptureState) =>\n this.props.onFaceCaptureStateChanged(faceCaptureState)\n }\n onFaceCaptureStateFailed={({\n nativeEvent: { state: faceCaptureStateFailure },\n }: NativeFaceCaptureStateFailure) =>\n this.props.onFaceCaptureStateFailed(faceCaptureStateFailure)\n }\n ref={this._setReference}\n />\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["RNYotiCaptureTypes.tsx"],"names":["NativeModules","Platform","UIManager","qualityConstants","IMAGE_QUALITY_LOW","IMAGE_QUALITY_MEDIUM","IMAGE_QUALITY_HIGH","OS","iOSConstants","YotiFaceCaptureView","Constants","YotiFaceCaptureModule","androidConstants","getConstants","IMAGE_QUALITY"],"mappings":"AACA,SACEA,aADF,EAEEC,QAFF,EAIEC,SAJF,QAMO,cANP;AAcA,IAAIC,gBAAgB,GAAG;AACrBC,EAAAA,iBAAiB,EAAE,CADE;AAErBC,EAAAA,oBAAoB,EAAE,CAFD;AAGrBC,EAAAA,kBAAkB,EAAE;AAHC,CAAvB;;AAMA,IAAIL,QAAQ,CAACM,EAAT,KAAgB,KAApB,EAA2B;AACzB,QAAMC,YAA+B,GACnC;AACAN,EAAAA,SAAS,CAACO,mBAAV,CAA8BC,SAFhC;AAGAP,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCI,YAAY,CAACJ,iBAAlD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCG,YAAY,CAACH,oBAArD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCE,YAAY,CAACF,kBAAnD;AACD,CAPD,MAOO;AACL,QAAMK,qBAAqB,GAAGX,aAAa,CAACW,qBAA5C;AACA,QAAMC,gBAAmC,GACvCD,qBAAqB,CAACE,YAAtB,EADF;AAEAV,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCQ,gBAAgB,CAACR,iBAAtD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCO,gBAAgB,CAACP,oBAAzD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCM,gBAAgB,CAACN,kBAAvD;AACD;;AAED,OAAO,IAAIF,iBAAiB,GAAGD,gBAAgB,CAACC,iBAAzC;AACP,OAAO,IAAIC,oBAAoB,GAAGF,gBAAgB,CAACE,oBAA5C;AACP,OAAO,IAAIC,kBAAkB,GAAGH,gBAAgB,CAACG,kBAA1C;AAEP,WAAYQ,aAAZ;;WAAYA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,KAAAA,a","sourcesContent":["import type { Component } from 'react';\nimport {\n NativeModules,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\ninterface PlatformConstants {\n IMAGE_QUALITY_LOW: number;\n IMAGE_QUALITY_MEDIUM: number;\n IMAGE_QUALITY_HIGH: number;\n}\n\nlet qualityConstants = {\n IMAGE_QUALITY_LOW: 0,\n IMAGE_QUALITY_MEDIUM: 0,\n IMAGE_QUALITY_HIGH: 0,\n};\n\nif (Platform.OS === 'ios') {\n const iOSConstants: PlatformConstants =\n // @ts-ignore UIManagerStatic\n UIManager.YotiFaceCaptureView.Constants;\n qualityConstants.IMAGE_QUALITY_LOW = iOSConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = iOSConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = iOSConstants.IMAGE_QUALITY_HIGH;\n} else {\n const YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n const androidConstants: PlatformConstants =\n YotiFaceCaptureModule.getConstants();\n qualityConstants.IMAGE_QUALITY_LOW = androidConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = androidConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = androidConstants.IMAGE_QUALITY_HIGH;\n}\n\nexport let IMAGE_QUALITY_LOW = qualityConstants.IMAGE_QUALITY_LOW;\nexport let IMAGE_QUALITY_MEDIUM = qualityConstants.IMAGE_QUALITY_MEDIUM;\nexport let IMAGE_QUALITY_HIGH = qualityConstants.IMAGE_QUALITY_HIGH;\n\nexport enum IMAGE_QUALITY {\n IMAGE_QUALITY_HIGH,\n IMAGE_QUALITY_MEDIUM,\n IMAGE_QUALITY_LOW,\n}\n\nexport type FaceCaptureResult = {\n croppedImage: string;\n croppedFaceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage: string;\n};\n\nexport type ANALYSIS_FAILURE_CAUSE =\n | 'FaceCaptureAnalysisErrorFaceTooBig'\n | 'FaceCaptureAnalysisErrorEyesNotOpen'\n | 'FaceCaptureAnalysisErrorFaceTooSmall'\n | 'FaceCaptureAnalysisErrorFaceNotStable'\n | 'FaceCaptureAnalysisErrorNoFaceDetected'\n | 'FaceCaptureAnalysisErrorFaceNotCentered'\n | 'FaceCaptureAnalysisErrorFaceNotStraight'\n | 'FaceCaptureAnalysisErrorEnvironmentTooDark'\n | 'FaceCaptureAnalysisErrorFaceAnalysisFailed'\n | 'FaceCaptureAnalysisErrorMultipleFaces';\n\nexport type FaceCaptureAnalysisFailure = {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n};\n\nexport type FaceCaptureSuccessState =\n | 'FaceCaptureStateAnalyzing'\n | 'FaceCaptureStateCameraReady'\n | 'FaceCaptureStateCameraStopped';\n\nexport type FaceCaptureFailureState =\n | 'FaceCaptureStateErrorCameraInitializingError'\n | 'FaceCaptureStateErrorInvalidState'\n | 'FaceCaptureStateErrorCameraNotAccessible';\n\nexport type ComponentProps = {\n requireEyesOpen?: boolean;\n requireValidAngle?: boolean;\n requiredStableFrames?: number;\n requireBrightEnvironment?: boolean;\n imageQuality?: IMAGE_QUALITY;\n scanningArea?: Array<number>;\n onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: FaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (\n faceCaptureState: FaceCaptureSuccessState\n ) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: FaceCaptureFailureState\n ) => void;\n style?: StyleProp<ViewStyle>;\n ref: Component;\n};\n"]}
1
+ {"version":3,"sources":["RNYotiCaptureTypes.tsx"],"names":["NativeModules","Platform","UIManager","qualityConstants","IMAGE_QUALITY_LOW","IMAGE_QUALITY_MEDIUM","IMAGE_QUALITY_HIGH","OS","iOSConstants","YotiFaceCaptureView","Constants","YotiFaceCaptureModule","androidConstants","getConstants","IMAGE_QUALITY"],"mappings":"AACA,SACEA,aADF,EAEEC,QAFF,EAIEC,SAJF,QAMO,cANP;AAcA,IAAIC,gBAAgB,GAAG;AACrBC,EAAAA,iBAAiB,EAAE,CADE;AAErBC,EAAAA,oBAAoB,EAAE,CAFD;AAGrBC,EAAAA,kBAAkB,EAAE;AAHC,CAAvB;;AAMA,IAAIL,QAAQ,CAACM,EAAT,KAAgB,KAApB,EAA2B;AACzB,QAAMC,YAA+B,GACnC;AACAN,EAAAA,SAAS,CAACO,mBAAV,CAA8BC,SAFhC;AAGAP,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCI,YAAY,CAACJ,iBAAlD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCG,YAAY,CAACH,oBAArD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCE,YAAY,CAACF,kBAAnD;AACD,CAPD,MAOO;AACL,QAAMK,qBAAqB,GAAGX,aAAa,CAACW,qBAA5C;AACA,QAAMC,gBAAmC,GACvCD,qBAAqB,CAACE,YAAtB,EADF;AAEAV,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCQ,gBAAgB,CAACR,iBAAtD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCO,gBAAgB,CAACP,oBAAzD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCM,gBAAgB,CAACN,kBAAvD;AACD;;AAED,OAAO,IAAIF,iBAAiB,GAAGD,gBAAgB,CAACC,iBAAzC;AACP,OAAO,IAAIC,oBAAoB,GAAGF,gBAAgB,CAACE,oBAA5C;AACP,OAAO,IAAIC,kBAAkB,GAAGH,gBAAgB,CAACG,kBAA1C;AAEP,WAAYQ,aAAZ;;WAAYA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,KAAAA,a","sourcesContent":["import type { Component } from 'react';\nimport {\n NativeModules,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\ninterface PlatformConstants {\n IMAGE_QUALITY_LOW: number;\n IMAGE_QUALITY_MEDIUM: number;\n IMAGE_QUALITY_HIGH: number;\n}\n\nlet qualityConstants = {\n IMAGE_QUALITY_LOW: 0,\n IMAGE_QUALITY_MEDIUM: 0,\n IMAGE_QUALITY_HIGH: 0,\n};\n\nif (Platform.OS === 'ios') {\n const iOSConstants: PlatformConstants =\n // @ts-ignore UIManagerStatic\n UIManager.YotiFaceCaptureView.Constants;\n qualityConstants.IMAGE_QUALITY_LOW = iOSConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = iOSConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = iOSConstants.IMAGE_QUALITY_HIGH;\n} else {\n const YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n const androidConstants: PlatformConstants =\n YotiFaceCaptureModule.getConstants();\n qualityConstants.IMAGE_QUALITY_LOW = androidConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = androidConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = androidConstants.IMAGE_QUALITY_HIGH;\n}\n\nexport let IMAGE_QUALITY_LOW = qualityConstants.IMAGE_QUALITY_LOW;\nexport let IMAGE_QUALITY_MEDIUM = qualityConstants.IMAGE_QUALITY_MEDIUM;\nexport let IMAGE_QUALITY_HIGH = qualityConstants.IMAGE_QUALITY_HIGH;\n\nexport enum IMAGE_QUALITY {\n IMAGE_QUALITY_HIGH,\n IMAGE_QUALITY_MEDIUM,\n IMAGE_QUALITY_LOW,\n}\n\nexport type FaceCaptureResult = {\n croppedImage: string;\n croppedFaceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage: string;\n};\n\nexport type ANALYSIS_FAILURE_CAUSE =\n | 'FaceCaptureAnalysisErrorFaceTooBig'\n | 'FaceCaptureAnalysisErrorEyesNotOpen'\n | 'FaceCaptureAnalysisErrorFaceTooSmall'\n | 'FaceCaptureAnalysisErrorFaceNotStable'\n | 'FaceCaptureAnalysisErrorNoFaceDetected'\n | 'FaceCaptureAnalysisErrorFaceNotCentered'\n | 'FaceCaptureAnalysisErrorFaceNotStraight'\n | 'FaceCaptureAnalysisErrorEnvironmentTooDark'\n | 'FaceCaptureAnalysisErrorFaceAnalysisFailed'\n | 'FaceCaptureAnalysisErrorMultipleFaces';\n\nexport type FaceCaptureAnalysisFailure = {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n};\n\nexport type FaceCaptureSuccessState =\n | 'FaceCaptureStateAnalyzing'\n | 'FaceCaptureStateCameraReady'\n | 'FaceCaptureStateCameraStopped';\n\nexport type FaceCaptureFailureState =\n | 'FaceCaptureStateErrorCameraInitializingError'\n | 'FaceCaptureStateErrorInvalidState'\n | 'FaceCaptureStateErrorCameraNotAccessible';\n\nexport type ComponentProps = {\n requireEyesOpen?: boolean;\n requireValidAngle?: boolean;\n requiredStableFrames?: number;\n requireBrightEnvironment?: boolean;\n imageQuality?: IMAGE_QUALITY;\n faceCenter?: Array<number>;\n onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: FaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (\n faceCaptureState: FaceCaptureSuccessState\n ) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: FaceCaptureFailureState\n ) => void;\n style?: StyleProp<ViewStyle>;\n ref: Component;\n};\n"]}
@@ -37,7 +37,7 @@ export declare type ComponentProps = {
37
37
  requiredStableFrames?: number;
38
38
  requireBrightEnvironment?: boolean;
39
39
  imageQuality?: IMAGE_QUALITY;
40
- scanningArea?: Array<number>;
40
+ faceCenter?: Array<number>;
41
41
  onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;
42
42
  onFaceCaptureImageAnalysisFailed: (faceCaptureAnalysisFailure: FaceCaptureAnalysisFailure) => void;
43
43
  onFaceCaptureStateChanged: (faceCaptureState: FaceCaptureSuccessState) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getyoti/react-native-yoti-face-capture",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "An easy to use face detection component for React Native from Yoti.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm}"
17
17
 
18
18
  s.dependency "React-Core"
19
- s.dependency "YotiFaceCapture", "4.1.0"
19
+ s.dependency "YotiFaceCapture", "5.0.0"
20
20
  end
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import {
3
3
  findNodeHandle,
4
- PixelRatio,
5
4
  requireNativeComponent,
6
5
  NativeModules,
7
6
  } from 'react-native';
@@ -80,7 +79,7 @@ interface NativeFaceCaptureViewAndroid {
80
79
  requiredStableFrames: number;
81
80
  requireBrightEnvironment: Boolean;
82
81
  imageQuality: IMAGE_QUALITY;
83
- scanningArea: Array<number>;
82
+ faceCenter: Array<number>;
84
83
  onCameraStateChange: (
85
84
  faceCaptureState: NativeFaceCaptureState | NativeFaceCaptureStateFailure
86
85
  ) => void;
@@ -215,11 +214,9 @@ export default class RNYotiCapture extends React.Component<ComponentProps> {
215
214
  requireValidAngle = false,
216
215
  requiredStableFrames = 3,
217
216
  imageQuality = IMAGE_QUALITY_MEDIUM,
218
- scanningArea = [
219
- 0,
220
- 0,
221
- PixelRatio.getPixelSizeForLayoutSize(720),
222
- PixelRatio.getPixelSizeForLayoutSize(1280),
217
+ faceCenter = [
218
+ 0.5,
219
+ 0.5
223
220
  ],
224
221
  } = this.props;
225
222
 
@@ -231,7 +228,7 @@ export default class RNYotiCapture extends React.Component<ComponentProps> {
231
228
  requiredStableFrames={requiredStableFrames}
232
229
  requireBrightEnvironment={requireBrightEnvironment}
233
230
  imageQuality={imageQuality}
234
- scanningArea={scanningArea}
231
+ faceCenter={faceCenter}
235
232
  ref={this._setReference}
236
233
  onCameraStateChange={this.onCameraStateChange.bind(this)}
237
234
  onFaceCaptureResult={this.onFaceCaptureResult.bind(this)}
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import {
3
3
  findNodeHandle,
4
- PixelRatio,
5
4
  requireNativeComponent,
6
5
  UIManager,
7
6
  } from 'react-native';
@@ -46,7 +45,7 @@ interface NativeFaceCaptureViewIOS {
46
45
  requireValidAngle: boolean;
47
46
  requiredStableFrames: number;
48
47
  requireBrightEnvironment: boolean;
49
- scanningArea: Array<number>;
48
+ faceCenter: Array<number>;
50
49
  onFaceCaptureAnalyzedImage: (
51
50
  faceCaptureResult: NativeFaceCaptureResult
52
51
  ) => void;
@@ -121,11 +120,9 @@ export default class RNYotiCapture extends React.Component<ComponentProps> {
121
120
  requiredStableFrames = 3,
122
121
  requireBrightEnvironment = true,
123
122
  imageQuality = IMAGE_QUALITY_MEDIUM,
124
- scanningArea = [
125
- 0,
126
- 0,
127
- PixelRatio.getPixelSizeForLayoutSize(720),
128
- PixelRatio.getPixelSizeForLayoutSize(1280),
123
+ faceCenter = [
124
+ 0.5,
125
+ 0.5
129
126
  ],
130
127
  } = this.props;
131
128
  return (
@@ -136,7 +133,7 @@ export default class RNYotiCapture extends React.Component<ComponentProps> {
136
133
  requiredStableFrames={requiredStableFrames}
137
134
  requireBrightEnvironment={requireBrightEnvironment}
138
135
  imageQuality={imageQuality}
139
- scanningArea={scanningArea}
136
+ faceCenter={faceCenter}
140
137
  onFaceCaptureAnalyzedImage={({
141
138
  nativeEvent: faceCaptureResult,
142
139
  }: NativeFaceCaptureResult) =>
@@ -95,7 +95,7 @@ export type ComponentProps = {
95
95
  requiredStableFrames?: number;
96
96
  requireBrightEnvironment?: boolean;
97
97
  imageQuality?: IMAGE_QUALITY;
98
- scanningArea?: Array<number>;
98
+ faceCenter?: Array<number>;
99
99
  onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;
100
100
  onFaceCaptureImageAnalysisFailed: (
101
101
  faceCaptureAnalysisFailure: FaceCaptureAnalysisFailure