@getyoti/react-native-yoti-face-capture 3.0.0 → 4.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.
Files changed (35) hide show
  1. package/README.md +4 -4
  2. package/android/build.gradle +34 -30
  3. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  4. package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureEvent.java +34 -0
  5. package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureModule.java +55 -56
  6. package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCapturePackage.java +5 -2
  7. package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureView.java +129 -73
  8. package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureViewManager.java +10 -1
  9. package/android/src/main/res/layout/yotifacecapture.xml +3 -9
  10. package/lib/commonjs/RNYotiCapture.android.js +63 -94
  11. package/lib/commonjs/RNYotiCapture.android.js.map +1 -1
  12. package/lib/commonjs/RNYotiCapture.ios.js +77 -84
  13. package/lib/commonjs/RNYotiCapture.ios.js.map +1 -1
  14. package/lib/commonjs/RNYotiCaptureTypes.js +9 -17
  15. package/lib/commonjs/RNYotiCaptureTypes.js.map +1 -1
  16. package/lib/commonjs/index.js +21 -6
  17. package/lib/commonjs/index.js.map +1 -1
  18. package/lib/module/RNYotiCapture.android.js +62 -85
  19. package/lib/module/RNYotiCapture.android.js.map +1 -1
  20. package/lib/module/RNYotiCapture.ios.js +76 -75
  21. package/lib/module/RNYotiCapture.ios.js.map +1 -1
  22. package/lib/module/RNYotiCaptureTypes.js +5 -7
  23. package/lib/module/RNYotiCaptureTypes.js.map +1 -1
  24. package/lib/module/index.js +1 -0
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/typescript/RNYotiCapture.android.d.ts +7 -46
  27. package/lib/typescript/RNYotiCapture.ios.d.ts +7 -9
  28. package/lib/typescript/RNYotiCaptureTypes.d.ts +6 -6
  29. package/lib/typescript/index.d.ts +1 -0
  30. package/package.json +6 -8
  31. package/react-native-yoti-face-capture.podspec +1 -1
  32. package/src/RNYotiCapture.android.tsx +128 -115
  33. package/src/RNYotiCapture.ios.tsx +107 -80
  34. package/src/index.tsx +6 -0
  35. package/CHANGELOG.md +0 -29
@@ -1,12 +1,6 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <androidx.constraintlayout.widget.ConstraintLayout
2
+ <com.yoti.mobile.android.capture.face.ui.FaceCapture
3
3
  xmlns:android="http://schemas.android.com/apk/res/android"
4
- xmlns:app="http://schemas.android.com/apk/res-auto"
5
- xmlns:tools="http://schemas.android.com/tools"
4
+ android:id="@+id/faceCapture"
6
5
  android:layout_width="match_parent"
7
- android:layout_height="match_parent">
8
- <com.yoti.mobile.android.capture.face.ui.FaceCapture
9
- android:id="@+id/faceCapture"
10
- android:layout_width="match_parent"
11
- android:layout_height="match_parent"/>
12
- </androidx.constraintlayout.widget.ConstraintLayout>
6
+ android:layout_height="match_parent"/>
@@ -4,19 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
7
+ var _react = _interopRequireWildcard(require("react"));
10
8
  var _reactNative = require("react-native");
11
-
12
9
  var _RNYotiCaptureTypes = require("./RNYotiCaptureTypes");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
17
-
18
- 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; }
19
-
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
20
12
  const YotiFaceCaptureView = (0, _reactNative.requireNativeComponent)('YotiFaceCaptureView');
21
13
  const YotiFaceCaptureModule = _reactNative.NativeModules.YotiFaceCaptureModule;
22
14
  const FACE_CAPTURE_FAILURE_RENAMING = {
@@ -31,67 +23,62 @@ const FACE_CAPTURE_FAILURE_RENAMING = {
31
23
  AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',
32
24
  MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces'
33
25
  };
34
-
35
- class RNYotiCapture extends _react.default.Component {
36
- constructor(props) {
37
- super(props);
38
-
39
- _defineProperty(this, "_faceCaptureHandle", void 0);
40
-
41
- _defineProperty(this, "_setReference", ref => {
42
- if (ref) {
43
- this._faceCaptureHandle = (0, _reactNative.findNodeHandle)(ref);
44
- } else {
45
- this._faceCaptureHandle = null;
46
- }
47
- });
48
-
49
- this._faceCaptureHandle = null;
50
- }
51
-
52
- startAnalyzing() {
53
- YotiFaceCaptureModule.startAnalyzing(this._faceCaptureHandle);
54
- }
55
-
56
- stopAnalyzing() {
57
- YotiFaceCaptureModule.stopAnalyzing(this._faceCaptureHandle);
58
- }
59
-
60
- startCamera() {
61
- YotiFaceCaptureModule.startCamera(this._faceCaptureHandle);
62
- }
63
-
64
- stopCamera() {
65
- YotiFaceCaptureModule.stopCamera(this._faceCaptureHandle);
66
- }
67
-
68
- onCameraStateChange(cameraState) {
69
- let state = cameraState.nativeEvent.state;
70
-
26
+ const RNYotiCapture = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
27
+ const {
28
+ requireEyesOpen = false,
29
+ requireBrightEnvironment = true,
30
+ requireValidAngle = false,
31
+ requiredStableFrames = 3,
32
+ imageQuality = _RNYotiCaptureTypes.IMAGE_QUALITY_MEDIUM,
33
+ faceCenter = [0.5, 0.5],
34
+ onFaceCaptureStateChanged,
35
+ onFaceCaptureStateFailed,
36
+ onFaceCaptureAnalyzedImage,
37
+ onFaceCaptureImageAnalysisFailed
38
+ } = props;
39
+ const faceCaptureHandleRef = (0, _react.useRef)(null);
40
+ const setReference = (0, _react.useCallback)(nativeRef => {
41
+ if (nativeRef) {
42
+ faceCaptureHandleRef.current = (0, _reactNative.findNodeHandle)(nativeRef);
43
+ } else {
44
+ faceCaptureHandleRef.current = null;
45
+ }
46
+ }, []);
47
+ (0, _react.useImperativeHandle)(ref, () => ({
48
+ startAnalyzing: () => {
49
+ YotiFaceCaptureModule.startAnalyzing(faceCaptureHandleRef.current);
50
+ },
51
+ stopAnalyzing: () => {
52
+ YotiFaceCaptureModule.stopAnalyzing(faceCaptureHandleRef.current);
53
+ },
54
+ startCamera: () => {
55
+ YotiFaceCaptureModule.startCamera(faceCaptureHandleRef.current);
56
+ },
57
+ stopCamera: () => {
58
+ YotiFaceCaptureModule.stopCamera(faceCaptureHandleRef.current);
59
+ }
60
+ }));
61
+ const handleCameraStateChange = (0, _react.useCallback)(cameraState => {
62
+ const state = cameraState.nativeEvent.state;
71
63
  switch (state) {
72
64
  case 'Analyzing':
73
- this.props.onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');
65
+ onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');
74
66
  break;
75
-
76
67
  case 'CameraReady':
77
- this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraReady');
68
+ onFaceCaptureStateChanged('FaceCaptureStateCameraReady');
78
69
  break;
79
-
80
70
  case 'CameraStopped':
81
- this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');
71
+ onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');
82
72
  break;
83
-
84
73
  case 'CameraInitializationError':
85
- this.props.onFaceCaptureStateFailed('FaceCaptureStateErrorCameraInitializingError');
74
+ onFaceCaptureStateFailed('FaceCaptureStateErrorCameraInitializingError');
86
75
  break;
87
-
88
76
  case 'MissingPermissions':
89
- this.props.onFaceCaptureStateFailed('FaceCaptureStateErrorCameraNotAccessible');
77
+ onFaceCaptureStateFailed('FaceCaptureStateErrorCameraNotAccessible');
90
78
  break;
91
79
  }
92
- }
93
-
94
- onFaceCaptureResult(faceCaptureResult) {
80
+ }, [onFaceCaptureStateChanged, onFaceCaptureStateFailed]);
81
+ const handleFaceCaptureResult = (0, _react.useCallback)(faceCaptureResult => {
95
82
  const {
96
83
  cause: nativeCause,
97
84
  croppedImage,
@@ -100,9 +87,8 @@ class RNYotiCapture extends _react.default.Component {
100
87
  originalImage,
101
88
  state
102
89
  } = faceCaptureResult.nativeEvent;
103
-
104
90
  if (state === 'ValidFace' && croppedImage != null && croppedFaceBoundingBox != null && faceBoundingBox != null && originalImage != null) {
105
- this.props.onFaceCaptureAnalyzedImage({
91
+ onFaceCaptureAnalyzedImage({
106
92
  croppedImage,
107
93
  croppedFaceBoundingBox,
108
94
  faceBoundingBox,
@@ -110,46 +96,29 @@ class RNYotiCapture extends _react.default.Component {
110
96
  });
111
97
  return;
112
98
  }
113
-
114
99
  if (nativeCause === undefined || originalImage === undefined) {
115
100
  return;
116
101
  }
117
-
118
102
  let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];
119
-
120
103
  if (cause === undefined) {
121
104
  cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';
122
105
  }
123
-
124
- this.props.onFaceCaptureImageAnalysisFailed({
106
+ onFaceCaptureImageAnalysisFailed({
125
107
  cause,
126
108
  originalImage
127
109
  });
128
- }
129
-
130
- render() {
131
- const {
132
- requireEyesOpen = false,
133
- requireBrightEnvironment = true,
134
- requireValidAngle = false,
135
- requiredStableFrames = 3,
136
- imageQuality = _RNYotiCaptureTypes.IMAGE_QUALITY_MEDIUM,
137
- faceCenter = [0.5, 0.5]
138
- } = this.props;
139
- return /*#__PURE__*/_react.default.createElement(YotiFaceCaptureView, _extends({}, this.props, {
140
- requireEyesOpen: requireEyesOpen,
141
- requireValidAngle: requireValidAngle,
142
- requiredStableFrames: requiredStableFrames,
143
- requireBrightEnvironment: requireBrightEnvironment,
144
- imageQuality: imageQuality,
145
- faceCenter: faceCenter,
146
- ref: this._setReference,
147
- onCameraStateChange: this.onCameraStateChange.bind(this),
148
- onFaceCaptureResult: this.onFaceCaptureResult.bind(this)
149
- }));
150
- }
151
-
152
- }
153
-
154
- exports.default = RNYotiCapture;
110
+ }, [onFaceCaptureAnalyzedImage, onFaceCaptureImageAnalysisFailed]);
111
+ return /*#__PURE__*/_react.default.createElement(YotiFaceCaptureView, _extends({}, props, {
112
+ requireEyesOpen: requireEyesOpen,
113
+ requireValidAngle: requireValidAngle,
114
+ requiredStableFrames: requiredStableFrames,
115
+ requireBrightEnvironment: requireBrightEnvironment,
116
+ imageQuality: imageQuality,
117
+ faceCenter: faceCenter,
118
+ ref: setReference,
119
+ onCameraStateChange: handleCameraStateChange,
120
+ onFaceCaptureResult: handleFaceCaptureResult
121
+ }));
122
+ });
123
+ var _default = exports.default = RNYotiCapture;
155
124
  //# sourceMappingURL=RNYotiCapture.android.js.map
@@ -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","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,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,IAAA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'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"]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_RNYotiCaptureTypes","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","YotiFaceCaptureView","requireNativeComponent","YotiFaceCaptureModule","NativeModules","FACE_CAPTURE_FAILURE_RENAMING","FaceTooBig","EyesClosed","FaceTooSmall","FaceNotStable","NoFaceDetected","FaceNotCentered","FaceNotStraight","EnvironmentTooDark","AnalysisError","MultipleFacesDetected","RNYotiCapture","forwardRef","props","ref","requireEyesOpen","requireBrightEnvironment","requireValidAngle","requiredStableFrames","imageQuality","IMAGE_QUALITY_MEDIUM","faceCenter","onFaceCaptureStateChanged","onFaceCaptureStateFailed","onFaceCaptureAnalyzedImage","onFaceCaptureImageAnalysisFailed","faceCaptureHandleRef","useRef","setReference","useCallback","nativeRef","current","findNodeHandle","useImperativeHandle","startAnalyzing","stopAnalyzing","startCamera","stopCamera","handleCameraStateChange","cameraState","state","nativeEvent","handleFaceCaptureResult","faceCaptureResult","cause","nativeCause","croppedImage","croppedFaceBoundingBox","faceBoundingBox","originalImage","undefined","createElement","onCameraStateChange","onFaceCaptureResult","_default","exports"],"sources":["RNYotiCapture.android.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useRef,\n} 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 type RNYotiCaptureRef = {\n startAnalyzing: () => void;\n stopAnalyzing: () => void;\n startCamera: () => void;\n stopCamera: () => void;\n};\n\nconst RNYotiCapture = forwardRef<RNYotiCaptureRef, ComponentProps>(\n (props, ref) => {\n const {\n requireEyesOpen = false,\n requireBrightEnvironment = true,\n requireValidAngle = false,\n requiredStableFrames = 3,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n faceCenter = [0.5, 0.5],\n onFaceCaptureStateChanged,\n onFaceCaptureStateFailed,\n onFaceCaptureAnalyzedImage,\n onFaceCaptureImageAnalysisFailed,\n } = props;\n\n const faceCaptureHandleRef = useRef<number | null>(null);\n\n const setReference = useCallback((nativeRef: any) => {\n if (nativeRef) {\n faceCaptureHandleRef.current = findNodeHandle(nativeRef);\n } else {\n faceCaptureHandleRef.current = null;\n }\n }, []);\n\n useImperativeHandle(ref, () => ({\n startAnalyzing: () => {\n YotiFaceCaptureModule.startAnalyzing(faceCaptureHandleRef.current);\n },\n stopAnalyzing: () => {\n YotiFaceCaptureModule.stopAnalyzing(faceCaptureHandleRef.current);\n },\n startCamera: () => {\n YotiFaceCaptureModule.startCamera(faceCaptureHandleRef.current);\n },\n stopCamera: () => {\n YotiFaceCaptureModule.stopCamera(faceCaptureHandleRef.current);\n },\n }));\n\n const handleCameraStateChange = useCallback(\n (cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure) => {\n const state = cameraState.nativeEvent.state;\n\n switch (state) {\n case 'Analyzing':\n onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');\n break;\n\n case 'CameraReady':\n onFaceCaptureStateChanged('FaceCaptureStateCameraReady');\n break;\n\n case 'CameraStopped':\n onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');\n break;\n\n case 'CameraInitializationError':\n onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraInitializingError'\n );\n break;\n\n case 'MissingPermissions':\n onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraNotAccessible'\n );\n break;\n }\n },\n [onFaceCaptureStateChanged, onFaceCaptureStateFailed]\n );\n\n const handleFaceCaptureResult = useCallback(\n (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 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 onFaceCaptureImageAnalysisFailed({\n cause,\n originalImage,\n });\n },\n [onFaceCaptureAnalyzedImage, onFaceCaptureImageAnalysisFailed]\n );\n\n return (\n <YotiFaceCaptureView\n {...props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n faceCenter={faceCenter}\n ref={setReference}\n onCameraStateChange={handleCameraStateChange}\n onFaceCaptureResult={handleFaceCaptureResult}\n />\n );\n }\n);\n\nexport default RNYotiCapture;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAMA,IAAAC,YAAA,GAAAD,OAAA;AAYA,IAAAE,mBAAA,GAAAF,OAAA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IAAI,IAAI,IACpBC,sBAAsB,IAAI,IAAI,IAC9BC,eAAe,IAAI,IAAI,IACvBC,aAAa,IAAI,IAAI,EACrB;MACAzB,0BAA0B,CAAC;QACzBsB,YAAY;QACZC,sBAAsB;QACtBC,eAAe;QACfC;MACF,CAAC,CAAC;MACF;IACF;IACA,IAAIJ,WAAW,KAAKK,SAAS,IAAID,aAAa,KAAKC,SAAS,EAAE;MAC5D;IACF;IAEA,IAAIN,KAAK,GAAG5C,6BAA6B,CAAC6C,WAAW,CAAC;IACtD,IAAID,KAAK,KAAKM,SAAS,EAAE;MACvBN,KAAK,GAAG,4CAA4C;IACtD;IAEAnB,gCAAgC,CAAC;MAC/BmB,KAAK;MACLK;IACF,CAAC,CAAC;EACJ,CAAC,EACD,CAACzB,0BAA0B,EAAEC,gCAAgC,CAC/D,CAAC;EAED,oBACE3D,MAAA,CAAAe,OAAA,CAAAsE,aAAA,CAACvD,mBAAmB,EAAAN,QAAA,KACduB,KAAK;IACTE,eAAe,EAAEA,eAAgB;IACjCE,iBAAiB,EAAEA,iBAAkB;IACrCC,oBAAoB,EAAEA,oBAAqB;IAC3CF,wBAAwB,EAAEA,wBAAyB;IACnDG,YAAY,EAAEA,YAAa;IAC3BE,UAAU,EAAEA,UAAW;IACvBP,GAAG,EAAEc,YAAa;IAClBwB,mBAAmB,EAAEd,uBAAwB;IAC7Ce,mBAAmB,EAAEX;EAAwB,EAC9C,CAAC;AAEN,CACF,CAAC;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAA1E,OAAA,GAEa8B,aAAa","ignoreList":[]}
@@ -4,91 +4,84 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
7
+ var _react = _interopRequireWildcard(require("react"));
10
8
  var _reactNative = require("react-native");
11
-
12
9
  var _RNYotiCaptureTypes = require("./RNYotiCaptureTypes");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
17
-
18
- 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; }
19
-
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
20
12
  const YotiFaceCaptureView = (0, _reactNative.requireNativeComponent)('YotiFaceCaptureView');
21
-
22
- class RNYotiCapture extends _react.default.Component {
23
- constructor(props) {
24
- super(props);
25
-
26
- _defineProperty(this, "_faceCaptureHandle", void 0);
27
-
28
- _defineProperty(this, "_setReference", ref => {
29
- if (ref) {
30
- this._faceCaptureHandle = (0, _reactNative.findNodeHandle)(ref);
31
- } else {
32
- this._faceCaptureHandle = null;
33
- }
34
- });
35
-
36
- _defineProperty(this, "startCamera", () => {
37
- _reactNative.UIManager.dispatchViewManagerCommand((0, _reactNative.findNodeHandle)(this._faceCaptureHandle), _reactNative.UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.startCamera, []);
38
- });
39
-
40
- this._faceCaptureHandle = null;
41
- }
42
-
43
- startAnalyzing() {
44
- _reactNative.UIManager.dispatchViewManagerCommand((0, _reactNative.findNodeHandle)(this), _reactNative.UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.startAnalyzing, []);
45
- }
46
-
47
- stopAnalyzing() {
48
- _reactNative.UIManager.dispatchViewManagerCommand((0, _reactNative.findNodeHandle)(this), _reactNative.UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopAnalyzing, []);
49
- }
50
-
51
- stopCamera() {
52
- _reactNative.UIManager.dispatchViewManagerCommand((0, _reactNative.findNodeHandle)(this._faceCaptureHandle), _reactNative.UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopCamera, []);
53
- }
54
-
55
- render() {
56
- const {
57
- requireEyesOpen = false,
58
- requireValidAngle = false,
59
- requiredStableFrames = 3,
60
- requireBrightEnvironment = true,
61
- imageQuality = _RNYotiCaptureTypes.IMAGE_QUALITY_MEDIUM,
62
- faceCenter = [0.5, 0.5]
63
- } = this.props;
64
- return /*#__PURE__*/_react.default.createElement(YotiFaceCaptureView, _extends({}, this.props, {
65
- requireEyesOpen: requireEyesOpen,
66
- requireValidAngle: requireValidAngle,
67
- requiredStableFrames: requiredStableFrames,
68
- requireBrightEnvironment: requireBrightEnvironment,
69
- imageQuality: imageQuality,
70
- faceCenter: faceCenter,
71
- onFaceCaptureAnalyzedImage: ({
72
- nativeEvent: faceCaptureResult
73
- }) => this.props.onFaceCaptureAnalyzedImage(faceCaptureResult),
74
- onFaceCaptureImageAnalysisFailed: ({
75
- nativeEvent: faceCaptureAnalysisFailure
76
- }) => this.props.onFaceCaptureImageAnalysisFailed(faceCaptureAnalysisFailure),
77
- onFaceCaptureStateChanged: ({
78
- nativeEvent: {
79
- state: faceCaptureState
80
- }
81
- }) => this.props.onFaceCaptureStateChanged(faceCaptureState),
82
- onFaceCaptureStateFailed: ({
83
- nativeEvent: {
84
- state: faceCaptureStateFailure
85
- }
86
- }) => this.props.onFaceCaptureStateFailed(faceCaptureStateFailure),
87
- ref: this._setReference
88
- }));
89
- }
90
-
91
- }
92
-
93
- exports.default = RNYotiCapture;
13
+ const RNYotiCapture = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
14
+ const {
15
+ requireEyesOpen = false,
16
+ requireValidAngle = false,
17
+ requiredStableFrames = 3,
18
+ requireBrightEnvironment = true,
19
+ imageQuality = _RNYotiCaptureTypes.IMAGE_QUALITY_MEDIUM,
20
+ faceCenter = [0.5, 0.5],
21
+ onFaceCaptureAnalyzedImage,
22
+ onFaceCaptureImageAnalysisFailed,
23
+ onFaceCaptureStateChanged,
24
+ onFaceCaptureStateFailed
25
+ } = props;
26
+ const faceCaptureHandleRef = (0, _react.useRef)(null);
27
+ const setReference = (0, _react.useCallback)(nativeRef => {
28
+ if (nativeRef) {
29
+ faceCaptureHandleRef.current = (0, _reactNative.findNodeHandle)(nativeRef);
30
+ } else {
31
+ faceCaptureHandleRef.current = null;
32
+ }
33
+ }, []);
34
+ (0, _react.useImperativeHandle)(ref, () => ({
35
+ startAnalyzing: () => {
36
+ _reactNative.UIManager.dispatchViewManagerCommand(faceCaptureHandleRef.current, _reactNative.UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.startAnalyzing, []);
37
+ },
38
+ stopAnalyzing: () => {
39
+ _reactNative.UIManager.dispatchViewManagerCommand(faceCaptureHandleRef.current, _reactNative.UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopAnalyzing, []);
40
+ },
41
+ startCamera: () => {
42
+ _reactNative.UIManager.dispatchViewManagerCommand(faceCaptureHandleRef.current, _reactNative.UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.startCamera, []);
43
+ },
44
+ stopCamera: () => {
45
+ _reactNative.UIManager.dispatchViewManagerCommand(faceCaptureHandleRef.current, _reactNative.UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopCamera, []);
46
+ }
47
+ }));
48
+ const handleFaceCaptureAnalyzedImage = (0, _react.useCallback)(({
49
+ nativeEvent: faceCaptureResult
50
+ }) => {
51
+ onFaceCaptureAnalyzedImage(faceCaptureResult);
52
+ }, [onFaceCaptureAnalyzedImage]);
53
+ const handleFaceCaptureImageAnalysisFailed = (0, _react.useCallback)(({
54
+ nativeEvent: faceCaptureAnalysisFailure
55
+ }) => {
56
+ onFaceCaptureImageAnalysisFailed(faceCaptureAnalysisFailure);
57
+ }, [onFaceCaptureImageAnalysisFailed]);
58
+ const handleFaceCaptureStateChanged = (0, _react.useCallback)(({
59
+ nativeEvent: {
60
+ state: faceCaptureState
61
+ }
62
+ }) => {
63
+ onFaceCaptureStateChanged(faceCaptureState);
64
+ }, [onFaceCaptureStateChanged]);
65
+ const handleFaceCaptureStateFailed = (0, _react.useCallback)(({
66
+ nativeEvent: {
67
+ state: faceCaptureStateFailure
68
+ }
69
+ }) => {
70
+ onFaceCaptureStateFailed(faceCaptureStateFailure);
71
+ }, [onFaceCaptureStateFailed]);
72
+ return /*#__PURE__*/_react.default.createElement(YotiFaceCaptureView, _extends({}, props, {
73
+ requireEyesOpen: requireEyesOpen,
74
+ requireValidAngle: requireValidAngle,
75
+ requiredStableFrames: requiredStableFrames,
76
+ requireBrightEnvironment: requireBrightEnvironment,
77
+ imageQuality: imageQuality,
78
+ faceCenter: faceCenter,
79
+ onFaceCaptureAnalyzedImage: handleFaceCaptureAnalyzedImage,
80
+ onFaceCaptureImageAnalysisFailed: handleFaceCaptureImageAnalysisFailed,
81
+ onFaceCaptureStateChanged: handleFaceCaptureStateChanged,
82
+ onFaceCaptureStateFailed: handleFaceCaptureStateFailed,
83
+ ref: setReference
84
+ }));
85
+ });
86
+ var _default = exports.default = RNYotiCapture;
94
87
  //# sourceMappingURL=RNYotiCapture.ios.js.map
@@ -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","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,oBAAV,CAA+B,qBAA/B,EAAsDC,QAAtD,CACGG,aAHL,EAIE,EAJF;AAMD;;AAWDC,EAAAA,UAAU,GAAG;AACXP,2BAAUC,0BAAV,CACE,iCAAe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;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
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_RNYotiCaptureTypes","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","YotiFaceCaptureView","requireNativeComponent","RNYotiCapture","forwardRef","props","ref","requireEyesOpen","requireValidAngle","requiredStableFrames","requireBrightEnvironment","imageQuality","IMAGE_QUALITY_MEDIUM","faceCenter","onFaceCaptureAnalyzedImage","onFaceCaptureImageAnalysisFailed","onFaceCaptureStateChanged","onFaceCaptureStateFailed","faceCaptureHandleRef","useRef","setReference","useCallback","nativeRef","current","findNodeHandle","useImperativeHandle","startAnalyzing","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","stopAnalyzing","startCamera","stopCamera","handleFaceCaptureAnalyzedImage","nativeEvent","faceCaptureResult","handleFaceCaptureImageAnalysisFailed","faceCaptureAnalysisFailure","handleFaceCaptureStateChanged","state","faceCaptureState","handleFaceCaptureStateFailed","faceCaptureStateFailure","createElement","_default","exports"],"sources":["RNYotiCapture.ios.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useRef,\n} 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 type RNYotiCaptureRef = {\n startAnalyzing: () => void;\n stopAnalyzing: () => void;\n startCamera: () => void;\n stopCamera: () => void;\n};\n\nconst RNYotiCapture = forwardRef<RNYotiCaptureRef, ComponentProps>(\n (props, ref) => {\n const {\n requireEyesOpen = false,\n requireValidAngle = false,\n requiredStableFrames = 3,\n requireBrightEnvironment = true,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n faceCenter = [0.5, 0.5],\n onFaceCaptureAnalyzedImage,\n onFaceCaptureImageAnalysisFailed,\n onFaceCaptureStateChanged,\n onFaceCaptureStateFailed,\n } = props;\n\n const faceCaptureHandleRef = useRef<number | null>(null);\n\n const setReference = useCallback((nativeRef: any) => {\n if (nativeRef) {\n faceCaptureHandleRef.current = findNodeHandle(nativeRef);\n } else {\n faceCaptureHandleRef.current = null;\n }\n }, []);\n\n useImperativeHandle(ref, () => ({\n startAnalyzing: () => {\n UIManager.dispatchViewManagerCommand(\n faceCaptureHandleRef.current,\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startAnalyzing,\n []\n );\n },\n stopAnalyzing: () => {\n UIManager.dispatchViewManagerCommand(\n faceCaptureHandleRef.current,\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .stopAnalyzing,\n []\n );\n },\n startCamera: () => {\n UIManager.dispatchViewManagerCommand(\n faceCaptureHandleRef.current,\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startCamera,\n []\n );\n },\n stopCamera: () => {\n UIManager.dispatchViewManagerCommand(\n faceCaptureHandleRef.current,\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .stopCamera,\n []\n );\n },\n }));\n\n const handleFaceCaptureAnalyzedImage = useCallback(\n ({ nativeEvent: faceCaptureResult }: NativeFaceCaptureResult) => {\n onFaceCaptureAnalyzedImage(faceCaptureResult);\n },\n [onFaceCaptureAnalyzedImage]\n );\n\n const handleFaceCaptureImageAnalysisFailed = useCallback(\n ({\n nativeEvent: faceCaptureAnalysisFailure,\n }: NativeFaceCaptureAnalysisFailure) => {\n onFaceCaptureImageAnalysisFailed(faceCaptureAnalysisFailure);\n },\n [onFaceCaptureImageAnalysisFailed]\n );\n\n const handleFaceCaptureStateChanged = useCallback(\n ({\n nativeEvent: { state: faceCaptureState },\n }: NativeFaceCaptureState) => {\n onFaceCaptureStateChanged(faceCaptureState);\n },\n [onFaceCaptureStateChanged]\n );\n\n const handleFaceCaptureStateFailed = useCallback(\n ({\n nativeEvent: { state: faceCaptureStateFailure },\n }: NativeFaceCaptureStateFailure) => {\n onFaceCaptureStateFailed(faceCaptureStateFailure);\n },\n [onFaceCaptureStateFailed]\n );\n\n return (\n <YotiFaceCaptureView\n {...props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n faceCenter={faceCenter}\n onFaceCaptureAnalyzedImage={handleFaceCaptureAnalyzedImage}\n onFaceCaptureImageAnalysisFailed={handleFaceCaptureImageAnalysisFailed}\n onFaceCaptureStateChanged={handleFaceCaptureStateChanged}\n onFaceCaptureStateFailed={handleFaceCaptureStateFailed}\n ref={setReference}\n />\n );\n }\n);\n\nexport default RNYotiCapture;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAMA,IAAAC,YAAA,GAAAD,OAAA;AAeA,IAAAE,mBAAA,GAAAF,OAAA;AAA4D,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;A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yBAAyB,CAACyB,gBAAgB,CAAC;EAC7C,CAAC,EACD,CAACzB,yBAAyB,CAC5B,CAAC;EAED,MAAM0B,4BAA4B,GAAG,IAAArB,kBAAW,EAC9C,CAAC;IACCc,WAAW,EAAE;MAAEK,KAAK,EAAEG;IAAwB;EACjB,CAAC,KAAK;IACnC1B,wBAAwB,CAAC0B,uBAAuB,CAAC;EACnD,CAAC,EACD,CAAC1B,wBAAwB,CAC3B,CAAC;EAED,oBACE9C,MAAA,CAAAe,OAAA,CAAA0D,aAAA,CAAC3C,mBAAmB,EAAAN,QAAA,KACdU,KAAK;IACTE,eAAe,EAAEA,eAAgB;IACjCC,iBAAiB,EAAEA,iBAAkB;IACrCC,oBAAoB,EAAEA,oBAAqB;IAC3CC,wBAAwB,EAAEA,wBAAyB;IACnDC,YAAY,EAAEA,YAAa;IAC3BE,UAAU,EAAEA,UAAW;IACvBC,0BAA0B,EAAEoB,8BAA+B;IAC3DnB,gCAAgC,EAAEsB,oCAAqC;IACvErB,yBAAyB,EAAEuB,6BAA8B;IACzDtB,wBAAwB,EAAEyB,4BAA6B;IACvDpC,GAAG,EAAEc;EAAa,EACnB,CAAC;AAEN,CACF,CAAC;AAAC,IAAAyB,QAAA,GAAAC,OAAA,CAAA5D,OAAA,GAEaiB,aAAa","ignoreList":[]}
@@ -3,18 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.IMAGE_QUALITY = exports.IMAGE_QUALITY_HIGH = exports.IMAGE_QUALITY_MEDIUM = exports.IMAGE_QUALITY_LOW = void 0;
7
-
6
+ exports.IMAGE_QUALITY_MEDIUM = exports.IMAGE_QUALITY_LOW = exports.IMAGE_QUALITY_HIGH = exports.IMAGE_QUALITY = void 0;
8
7
  var _reactNative = require("react-native");
9
-
10
8
  let qualityConstants = {
11
9
  IMAGE_QUALITY_LOW: 0,
12
10
  IMAGE_QUALITY_MEDIUM: 0,
13
11
  IMAGE_QUALITY_HIGH: 0
14
12
  };
15
-
16
13
  if (_reactNative.Platform.OS === 'ios') {
17
- const iOSConstants = // @ts-ignore UIManagerStatic
14
+ const iOSConstants =
15
+ // @ts-ignore UIManagerStatic
18
16
  _reactNative.UIManager.YotiFaceCaptureView.Constants;
19
17
  qualityConstants.IMAGE_QUALITY_LOW = iOSConstants.IMAGE_QUALITY_LOW;
20
18
  qualityConstants.IMAGE_QUALITY_MEDIUM = iOSConstants.IMAGE_QUALITY_MEDIUM;
@@ -26,19 +24,13 @@ if (_reactNative.Platform.OS === 'ios') {
26
24
  qualityConstants.IMAGE_QUALITY_MEDIUM = androidConstants.IMAGE_QUALITY_MEDIUM;
27
25
  qualityConstants.IMAGE_QUALITY_HIGH = androidConstants.IMAGE_QUALITY_HIGH;
28
26
  }
29
-
30
- let IMAGE_QUALITY_LOW = qualityConstants.IMAGE_QUALITY_LOW;
31
- exports.IMAGE_QUALITY_LOW = IMAGE_QUALITY_LOW;
32
- let IMAGE_QUALITY_MEDIUM = qualityConstants.IMAGE_QUALITY_MEDIUM;
33
- exports.IMAGE_QUALITY_MEDIUM = IMAGE_QUALITY_MEDIUM;
34
- let IMAGE_QUALITY_HIGH = qualityConstants.IMAGE_QUALITY_HIGH;
35
- exports.IMAGE_QUALITY_HIGH = IMAGE_QUALITY_HIGH;
36
- let IMAGE_QUALITY;
37
- exports.IMAGE_QUALITY = IMAGE_QUALITY;
38
-
39
- (function (IMAGE_QUALITY) {
27
+ let IMAGE_QUALITY_LOW = exports.IMAGE_QUALITY_LOW = qualityConstants.IMAGE_QUALITY_LOW;
28
+ let IMAGE_QUALITY_MEDIUM = exports.IMAGE_QUALITY_MEDIUM = qualityConstants.IMAGE_QUALITY_MEDIUM;
29
+ let IMAGE_QUALITY_HIGH = exports.IMAGE_QUALITY_HIGH = qualityConstants.IMAGE_QUALITY_HIGH;
30
+ let IMAGE_QUALITY = exports.IMAGE_QUALITY = /*#__PURE__*/function (IMAGE_QUALITY) {
40
31
  IMAGE_QUALITY[IMAGE_QUALITY["IMAGE_QUALITY_HIGH"] = 0] = "IMAGE_QUALITY_HIGH";
41
32
  IMAGE_QUALITY[IMAGE_QUALITY["IMAGE_QUALITY_MEDIUM"] = 1] = "IMAGE_QUALITY_MEDIUM";
42
33
  IMAGE_QUALITY[IMAGE_QUALITY["IMAGE_QUALITY_LOW"] = 2] = "IMAGE_QUALITY_LOW";
43
- })(IMAGE_QUALITY || (exports.IMAGE_QUALITY = IMAGE_QUALITY = {}));
34
+ return IMAGE_QUALITY;
35
+ }({});
44
36
  //# sourceMappingURL=RNYotiCaptureTypes.js.map
@@ -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 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"]}
1
+ {"version":3,"names":["_reactNative","require","qualityConstants","IMAGE_QUALITY_LOW","IMAGE_QUALITY_MEDIUM","IMAGE_QUALITY_HIGH","Platform","OS","iOSConstants","UIManager","YotiFaceCaptureView","Constants","YotiFaceCaptureModule","NativeModules","androidConstants","getConstants","exports","IMAGE_QUALITY"],"sources":["RNYotiCaptureTypes.tsx"],"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"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAcA,IAAIC,gBAAgB,GAAG;EACrBC,iBAAiB,EAAE,CAAC;EACpBC,oBAAoB,EAAE,CAAC;EACvBC,kBAAkB,EAAE;AACtB,CAAC;AAED,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;EACzB,MAAMC,YAA+B;EACnC;EACAC,sBAAS,CAACC,mBAAmB,CAACC,SAAS;EACzCT,gBAAgB,CAACC,iBAAiB,GAAGK,YAAY,CAACL,iBAAiB;EACnED,gBAAgB,CAACE,oBAAoB,GAAGI,YAAY,CAACJ,oBAAoB;EACzEF,gBAAgB,CAACG,kBAAkB,GAAGG,YAAY,CAACH,kBAAkB;AACvE,CAAC,MAAM;EACL,MAAMO,qBAAqB,GAAGC,0BAAa,CAACD,qBAAqB;EACjE,MAAME,gBAAmC,GACvCF,qBAAqB,CAACG,YAAY,CAAC,CAAC;EACtCb,gBAAgB,CAACC,iBAAiB,GAAGW,gBAAgB,CAACX,iBAAiB;EACvED,gBAAgB,CAACE,oBAAoB,GAAGU,gBAAgB,CAACV,oBAAoB;EAC7EF,gBAAgB,CAACG,kBAAkB,GAAGS,gBAAgB,CAACT,kBAAkB;AAC3E;AAEO,IAAIF,iBAAiB,GAAAa,OAAA,CAAAb,iBAAA,GAAGD,gBAAgB,CAACC,iBAAiB;AAC1D,IAAIC,oBAAoB,GAAAY,OAAA,CAAAZ,oBAAA,GAAGF,gBAAgB,CAACE,oBAAoB;AAChE,IAAIC,kBAAkB,GAAAW,OAAA,CAAAX,kBAAA,GAAGH,gBAAgB,CAACG,kBAAkB;AAAC,IAExDY,aAAa,GAAAD,OAAA,CAAAC,aAAA,0BAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA","ignoreList":[]}
@@ -3,13 +3,28 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "IMAGE_QUALITY_HIGH", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _RNYotiCaptureTypes.IMAGE_QUALITY_HIGH;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "IMAGE_QUALITY_LOW", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _RNYotiCaptureTypes.IMAGE_QUALITY_LOW;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "IMAGE_QUALITY_MEDIUM", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _RNYotiCaptureTypes.IMAGE_QUALITY_MEDIUM;
22
+ }
23
+ });
6
24
  exports.default = void 0;
7
-
8
25
  var _RNYotiCapture = _interopRequireDefault(require("./RNYotiCapture"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
26
+ var _RNYotiCaptureTypes = require("./RNYotiCaptureTypes");
27
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
28
  // @ts-ignore
13
- var _default = _RNYotiCapture.default;
14
- exports.default = _default;
29
+ var _default = exports.default = _RNYotiCapture.default;
15
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["RNYotiCapture"],"mappings":";;;;;;;AACA;;;;AADA;eAGeA,sB","sourcesContent":["// @ts-ignore\nimport RNYotiCapture from './RNYotiCapture';\n\nexport default RNYotiCapture;\n"]}
1
+ {"version":3,"names":["_RNYotiCapture","_interopRequireDefault","require","_RNYotiCaptureTypes","e","__esModule","default","_default","exports","RNYotiCapture"],"sources":["index.tsx"],"sourcesContent":["// @ts-ignore\nimport RNYotiCapture from './RNYotiCapture';\n\nexport {\n IMAGE_QUALITY_LOW,\n IMAGE_QUALITY_MEDIUM,\n IMAGE_QUALITY_HIGH,\n} from './RNYotiCaptureTypes';\n\nexport default RNYotiCapture;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AAI8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAP9B;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GASeG,sBAAa","ignoreList":[]}