@regulaforensics/face-sdk 7.2.422-beta → 7.2.425-beta

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 (171) hide show
  1. package/README.md +2 -3
  2. package/RNFaceSDK.podspec +1 -1
  3. package/android/src/main/java/com/regula/plugin/facesdk/JSONConstructor.kt +2 -0
  4. package/android/src/main/java/com/regula/plugin/facesdk/Main.kt +18 -0
  5. package/examples/capacitor/android/app/src/main/AndroidManifest.xml +2 -2
  6. package/examples/capacitor/index.html +2 -7
  7. package/examples/capacitor/index.tsx +53 -0
  8. package/examples/capacitor/package-lock.json +17 -3
  9. package/examples/capacitor/package.json +2 -2
  10. package/examples/capacitor/scripts/setup.sh +4 -2
  11. package/examples/capacitor/src/main.css +60 -6
  12. package/examples/capacitor/src/main.html +1 -1
  13. package/examples/capacitor/src/main.tsx +51 -87
  14. package/examples/ionic/README.md +1 -1
  15. package/examples/ionic/angular.json +3 -3
  16. package/examples/ionic/config.xml +4 -2
  17. package/examples/ionic/index.tsx +68 -0
  18. package/examples/ionic/package-lock.json +849 -763
  19. package/examples/ionic/package.json +2 -2
  20. package/examples/ionic/src/main.css +60 -6
  21. package/examples/ionic/src/main.html +1 -1
  22. package/examples/ionic/src/{main.ts → main.tsx} +52 -97
  23. package/examples/ionic/tsconfig.json +3 -2
  24. package/examples/react_native/README.md +1 -0
  25. package/examples/react_native/app.config.ts +1 -1
  26. package/examples/react_native/index.tsx +49 -7
  27. package/examples/react_native/package-lock.json +618 -621
  28. package/examples/react_native/package.json +8 -8
  29. package/examples/react_native/src/main.css +60 -6
  30. package/examples/react_native/src/main.html +1 -1
  31. package/examples/react_native/src/main.tsx +54 -79
  32. package/ios/RFSWJSONConstructor.h +0 -1
  33. package/ios/RFSWJSONConstructor.m +5 -14
  34. package/ios/RFSWMain.m +30 -0
  35. package/package.json +1 -1
  36. package/plugin.xml +1 -1
  37. package/test/json.tsx +375 -0
  38. package/test/package-lock.json +584 -0
  39. package/test/package.json +9 -0
  40. package/test/test.tsx +61 -0
  41. package/test/utils.tsx +38 -0
  42. package/www/capacitor/customization/customization_fonts.js +1 -1
  43. package/www/capacitor/customization/customization_images.js +1 -1
  44. package/www/capacitor/customization/font.js +8 -0
  45. package/www/capacitor/detect_faces/detect_face_result.js +12 -0
  46. package/www/capacitor/detect_faces/detect_faces_attribute_result.js +9 -0
  47. package/www/capacitor/detect_faces/detect_faces_backend_exception.js +7 -0
  48. package/www/capacitor/detect_faces/detect_faces_config.js +34 -0
  49. package/www/capacitor/detect_faces/detect_faces_exception.js +8 -0
  50. package/www/capacitor/detect_faces/detect_faces_request.js +22 -0
  51. package/www/capacitor/detect_faces/detect_faces_response.js +9 -0
  52. package/www/capacitor/face_capture/face_capture_config.js +37 -0
  53. package/www/capacitor/face_capture/face_capture_exception.js +7 -0
  54. package/www/capacitor/face_capture/face_capture_image.js +8 -0
  55. package/www/capacitor/face_capture/face_capture_response.js +7 -0
  56. package/www/capacitor/image_params/output_image_crop.js +23 -0
  57. package/www/capacitor/image_params/output_image_params.js +19 -0
  58. package/www/capacitor/image_params/point.js +7 -0
  59. package/www/capacitor/image_params/rect.js +9 -0
  60. package/www/capacitor/image_params/size.js +12 -0
  61. package/www/capacitor/image_quality/image_quality_characteristic.js +22 -0
  62. package/www/capacitor/image_quality/image_quality_range.js +7 -0
  63. package/www/capacitor/image_quality/image_quality_result.js +10 -0
  64. package/www/capacitor/index.js +48 -0
  65. package/www/capacitor/init/face_sdk_version.js +8 -0
  66. package/www/capacitor/init/init_config.js +19 -0
  67. package/www/capacitor/init/init_exception.js +8 -0
  68. package/www/capacitor/init/license_exception.js +7 -0
  69. package/www/capacitor/internal/bridge.js +20 -1
  70. package/www/capacitor/liveness/liveness_backend_exception.js +7 -0
  71. package/www/capacitor/liveness/liveness_config.js +43 -0
  72. package/www/capacitor/liveness/liveness_exception.js +8 -0
  73. package/www/capacitor/liveness/liveness_notification.js +7 -0
  74. package/www/capacitor/liveness/liveness_response.js +11 -0
  75. package/www/capacitor/match_faces/compared_face.js +9 -0
  76. package/www/capacitor/match_faces/compared_faces_pair.js +10 -0
  77. package/www/capacitor/match_faces/compared_faces_split.js +7 -0
  78. package/www/capacitor/match_faces/match_faces_backend_exception.js +7 -0
  79. package/www/capacitor/match_faces/match_faces_config.js +19 -0
  80. package/www/capacitor/match_faces/match_faces_detection.js +9 -0
  81. package/www/capacitor/match_faces/match_faces_detection_face.js +11 -0
  82. package/www/capacitor/match_faces/match_faces_exception.js +8 -0
  83. package/www/capacitor/match_faces/match_faces_image.js +9 -0
  84. package/www/capacitor/match_faces/match_faces_request.js +27 -0
  85. package/www/capacitor/match_faces/match_faces_response.js +9 -0
  86. package/www/capacitor/person_database/edit_group_persons_request.js +15 -0
  87. package/www/capacitor/person_database/image_upload.js +17 -0
  88. package/www/capacitor/person_database/pageable_item_list.js +8 -0
  89. package/www/capacitor/person_database/person.js +13 -0
  90. package/www/capacitor/person_database/person_group.js +11 -0
  91. package/www/capacitor/person_database/person_image.js +13 -0
  92. package/www/capacitor/person_database/search_person.js +14 -0
  93. package/www/capacitor/person_database/search_person_detection.js +9 -0
  94. package/www/capacitor/person_database/search_person_image.js +15 -0
  95. package/www/capacitor/person_database/search_person_request.js +29 -0
  96. package/www/cordova.js +753 -6
  97. package/www/react-native/customization/customization_fonts.js +1 -1
  98. package/www/react-native/customization/customization_images.js +1 -1
  99. package/www/react-native/customization/font.js +8 -0
  100. package/www/react-native/detect_faces/detect_face_result.js +12 -0
  101. package/www/react-native/detect_faces/detect_faces_attribute_result.js +9 -0
  102. package/www/react-native/detect_faces/detect_faces_backend_exception.js +7 -0
  103. package/www/react-native/detect_faces/detect_faces_config.js +34 -0
  104. package/www/react-native/detect_faces/detect_faces_exception.js +8 -0
  105. package/www/react-native/detect_faces/detect_faces_request.js +22 -0
  106. package/www/react-native/detect_faces/detect_faces_response.js +9 -0
  107. package/www/react-native/face_capture/face_capture_config.js +37 -0
  108. package/www/react-native/face_capture/face_capture_exception.js +7 -0
  109. package/www/react-native/face_capture/face_capture_image.js +8 -0
  110. package/www/react-native/face_capture/face_capture_response.js +7 -0
  111. package/www/react-native/image_params/output_image_crop.js +23 -0
  112. package/www/react-native/image_params/output_image_params.js +19 -0
  113. package/www/react-native/image_params/point.js +7 -0
  114. package/www/react-native/image_params/rect.js +9 -0
  115. package/www/react-native/image_params/size.js +12 -0
  116. package/www/react-native/image_quality/image_quality_characteristic.js +22 -0
  117. package/www/react-native/image_quality/image_quality_range.js +7 -0
  118. package/www/react-native/image_quality/image_quality_result.js +10 -0
  119. package/www/react-native/index.js +48 -0
  120. package/www/react-native/init/face_sdk_version.js +8 -0
  121. package/www/react-native/init/init_config.js +19 -0
  122. package/www/react-native/init/init_exception.js +8 -0
  123. package/www/react-native/init/license_exception.js +7 -0
  124. package/www/react-native/internal/bridge.js +20 -1
  125. package/www/react-native/liveness/liveness_backend_exception.js +7 -0
  126. package/www/react-native/liveness/liveness_config.js +43 -0
  127. package/www/react-native/liveness/liveness_exception.js +8 -0
  128. package/www/react-native/liveness/liveness_notification.js +7 -0
  129. package/www/react-native/liveness/liveness_response.js +11 -0
  130. package/www/react-native/match_faces/compared_face.js +9 -0
  131. package/www/react-native/match_faces/compared_faces_pair.js +10 -0
  132. package/www/react-native/match_faces/compared_faces_split.js +7 -0
  133. package/www/react-native/match_faces/match_faces_backend_exception.js +7 -0
  134. package/www/react-native/match_faces/match_faces_config.js +19 -0
  135. package/www/react-native/match_faces/match_faces_detection.js +9 -0
  136. package/www/react-native/match_faces/match_faces_detection_face.js +11 -0
  137. package/www/react-native/match_faces/match_faces_exception.js +8 -0
  138. package/www/react-native/match_faces/match_faces_image.js +9 -0
  139. package/www/react-native/match_faces/match_faces_request.js +27 -0
  140. package/www/react-native/match_faces/match_faces_response.js +9 -0
  141. package/www/react-native/person_database/edit_group_persons_request.js +15 -0
  142. package/www/react-native/person_database/image_upload.js +17 -0
  143. package/www/react-native/person_database/pageable_item_list.js +8 -0
  144. package/www/react-native/person_database/person.js +13 -0
  145. package/www/react-native/person_database/person_group.js +11 -0
  146. package/www/react-native/person_database/person_image.js +13 -0
  147. package/www/react-native/person_database/search_person.js +14 -0
  148. package/www/react-native/person_database/search_person_detection.js +9 -0
  149. package/www/react-native/person_database/search_person_image.js +15 -0
  150. package/www/react-native/person_database/search_person_request.js +29 -0
  151. package/www/types/index.d.ts +12 -0
  152. package/www/types/match_faces/match_faces_config.d.ts +2 -0
  153. package/www/types/person_database/search_person_request.d.ts +4 -0
  154. package/examples/cordova/.vscode/launch.json +0 -28
  155. package/examples/cordova/README.md +0 -25
  156. package/examples/cordova/config.xml +0 -26
  157. package/examples/cordova/package-lock.json +0 -1313
  158. package/examples/cordova/package.json +0 -30
  159. package/examples/cordova/scripts/android.sh +0 -8
  160. package/examples/cordova/scripts/ios.sh +0 -8
  161. package/examples/cordova/scripts/setup.sh +0 -8
  162. package/examples/cordova/www/images/logo.png +0 -0
  163. package/examples/cordova/www/index.html +0 -21
  164. package/examples/cordova/www/src/main.css +0 -83
  165. package/examples/cordova/www/src/main.html +0 -25
  166. package/examples/cordova/www/src/main.js +0 -152
  167. package/examples/ionic/index.ts +0 -17
  168. package/examples/ionic/src/images/portrait.png +0 -0
  169. /package/examples/ionic/{src/assets → assets}/.gitkeep +0 -0
  170. /package/examples/ionic/{src/images → images}/icon.png +0 -0
  171. /package/examples/{cordova/www → ionic}/images/portrait.png +0 -0
package/test/utils.tsx ADDED
@@ -0,0 +1,38 @@
1
+ import test from 'node:test'
2
+ import * as assert from 'assert'
3
+
4
+ export function compare(
5
+ name: string,
6
+ json: Record<string, any>,
7
+ fromJson: (json: Record<string, any>) => any,
8
+ skip?: string[],
9
+ ) {
10
+ test(name, () => {
11
+ var actual = removeUndefineds(fromJson(json).toJson())
12
+ if (skip) for (const item of skip) delete actual[item]
13
+ assert.deepEqual(actual, json)
14
+ })
15
+ }
16
+
17
+ function removeUndefineds(input) {
18
+ const isPlainObject = obj => Object.prototype.toString.call(obj) === '[object Object]';
19
+
20
+ if (input === undefined) return undefined;
21
+ if (input === null || typeof input !== 'object') return input;
22
+
23
+ if (Array.isArray(input)) {
24
+ return input
25
+ .map(item => removeUndefineds(item))
26
+ .filter(item => item !== undefined);
27
+ }
28
+
29
+ if (!isPlainObject(input)) return input;
30
+
31
+ const result = {};
32
+ for (const [key, value] of Object.entries(input)) {
33
+ if (value === undefined) continue;
34
+ const cleaned = removeUndefineds(value);
35
+ if (cleaned !== undefined) result[key] = cleaned;
36
+ }
37
+ return result;
38
+ }
@@ -101,6 +101,6 @@ export class CustomizationFonts {
101
101
  }
102
102
 
103
103
  _apply() {
104
- this._set(toJson())
104
+ this._set(this.toJson())
105
105
  }
106
106
  }
@@ -124,6 +124,6 @@ export class CustomizationImages {
124
124
  }
125
125
 
126
126
  _apply() {
127
- this._set(toJson())
127
+ this._set(this.toJson())
128
128
  }
129
129
  }
@@ -19,6 +19,14 @@ export class Font {
19
19
 
20
20
  return result
21
21
  }
22
+
23
+ toJson() {
24
+ return {
25
+ "name": this.name,
26
+ "size": this.size,
27
+ "style": this.style,
28
+ }
29
+ }
22
30
  }
23
31
 
24
32
  export const FontStyle = {
@@ -35,4 +35,16 @@ export class DetectFaceResult {
35
35
 
36
36
  return result
37
37
  }
38
+
39
+ toJson() {
40
+ return {
41
+ "quality": this.quality?.map(e => e.toJson()),
42
+ "crop": this.crop,
43
+ "attributes": this.attributes?.map(e => e.toJson()),
44
+ "landmarks": this.landmarks?.map(e => e.toJson()),
45
+ "faceRect": this.faceRect?.toJson(),
46
+ "originalRect": this.originalRect?.toJson(),
47
+ "isQualityCompliant": this.isQualityCompliant,
48
+ }
49
+ }
38
50
  }
@@ -17,4 +17,13 @@ export class DetectFacesAttributeResult {
17
17
 
18
18
  return result
19
19
  }
20
+
21
+ toJson() {
22
+ return {
23
+ "attribute": this.attribute,
24
+ "value": this.value,
25
+ "range": this.range?.toJson(),
26
+ "confidence": this.confidence,
27
+ }
28
+ }
20
29
  }
@@ -11,6 +11,13 @@ export class DetectFacesBackendException {
11
11
 
12
12
  return result
13
13
  }
14
+
15
+ toJson() {
16
+ return {
17
+ "code": this.code,
18
+ "message": this.message,
19
+ }
20
+ }
14
21
  }
15
22
 
16
23
  export const DetectFacesBackendErrorCode = {
@@ -1,3 +1,6 @@
1
+ import { ImageQualityCharacteristic } from '../image_quality/image_quality_characteristic'
2
+ import { OutputImageParams } from '../image_params/output_image_params'
3
+
1
4
  export class DetectFacesConfig {
2
5
  attributes
3
6
  customQuality
@@ -11,4 +14,35 @@ export class DetectFacesConfig {
11
14
  this.outputImageParams = params?.outputImageParams
12
15
  this.onlyCentralFace = params?.onlyCentralFace ?? this.onlyCentralFace
13
16
  }
17
+
18
+ static fromJson(jsonObject) {
19
+ if (jsonObject == null) return null
20
+ const result = new DetectFacesConfig()
21
+
22
+ if (jsonObject["attributes"] != null) {
23
+ result.attributes = []
24
+ for (const item of jsonObject["attributes"]) {
25
+ result.attributes.push(item)
26
+ }
27
+ }
28
+ if (jsonObject["customQuality"] != null) {
29
+ result.customQuality = []
30
+ for (const item of jsonObject["customQuality"]) {
31
+ result.customQuality.push(ImageQualityCharacteristic.fromJson(item))
32
+ }
33
+ }
34
+ result.outputImageParams = OutputImageParams.fromJson(jsonObject["outputImageParams"])
35
+ result.onlyCentralFace = jsonObject["onlyCentralFace"]
36
+
37
+ return result
38
+ }
39
+
40
+ toJson() {
41
+ return {
42
+ "attributes": this.attributes?.map(e => e),
43
+ "customQuality": this.customQuality?.map(e => e.toJson()),
44
+ "outputImageParams": this.outputImageParams?.toJson(),
45
+ "onlyCentralFace": this.onlyCentralFace,
46
+ }
47
+ }
14
48
  }
@@ -15,6 +15,14 @@ export class DetectFacesException {
15
15
 
16
16
  return result
17
17
  }
18
+
19
+ toJson() {
20
+ return {
21
+ "code": this.code,
22
+ "message": this.message,
23
+ "underlyingError": this.underlyingError?.toJson(),
24
+ }
25
+ }
18
26
  }
19
27
 
20
28
  export const DetectFacesErrorCode = {
@@ -1,4 +1,5 @@
1
1
  import { DetectFacesScenario } from './detect_faces_scenario'
2
+ import { DetectFacesConfig } from './detect_faces_config'
2
3
 
3
4
  export class DetectFacesRequest {
4
5
  image
@@ -66,4 +67,25 @@ export class DetectFacesRequest {
66
67
  result.scenario = DetectFacesScenario.ATTRIBUTES_ALL
67
68
  return result
68
69
  }
70
+
71
+ static fromJson(jsonObject) {
72
+ if (jsonObject == null) return null
73
+ const result = new DetectFacesRequest()
74
+
75
+ result.tag = jsonObject["tag"]
76
+ result.scenario = jsonObject["scenario"]
77
+ result.image = jsonObject["image"]
78
+ result.configuration = DetectFacesConfig.fromJson(jsonObject["configuration"])
79
+
80
+ return result
81
+ }
82
+
83
+ toJson() {
84
+ return {
85
+ "tag": this.tag,
86
+ "scenario": this.scenario,
87
+ "image": this.image,
88
+ "configuration": this.configuration?.toJson(),
89
+ }
90
+ }
69
91
  }
@@ -21,4 +21,13 @@ export class DetectFacesResponse {
21
21
 
22
22
  return result
23
23
  }
24
+
25
+ toJson() {
26
+ return {
27
+ "detection": this.detection?.toJson(),
28
+ "allDetections": this.allDetections?.map(e => e.toJson()),
29
+ "scenario": this.scenario,
30
+ "error": this.error?.toJson(),
31
+ }
32
+ }
24
33
  }
@@ -29,4 +29,41 @@ export class FaceCaptureConfig {
29
29
  this.timeout = params?.timeout
30
30
  this.holdStillDuration = params?.holdStillDuration
31
31
  }
32
+
33
+ static fromJson(jsonObject) {
34
+ if (jsonObject == null) return null
35
+ const result = new FaceCaptureConfig()
36
+
37
+ result.copyright = jsonObject["copyright"]
38
+ result.cameraSwitchEnabled = jsonObject["cameraSwitchEnabled"]
39
+ result.closeButtonEnabled = jsonObject["closeButtonEnabled"]
40
+ result.torchButtonEnabled = jsonObject["torchButtonEnabled"]
41
+ result.vibrateOnSteps = jsonObject["vibrateOnSteps"]
42
+ result.detectOcclusion = jsonObject["detectOcclusion"]
43
+ result.showFaceAnimation = jsonObject["showFaceAnimation"]
44
+ result.cameraPositionAndroid = jsonObject["cameraPositionAndroid"]
45
+ result.cameraPositionIOS = jsonObject["cameraPositionIOS"]
46
+ result.screenOrientation = jsonObject["screenOrientation"]
47
+ result.timeout = jsonObject["timeout"]
48
+ result.holdStillDuration = jsonObject["holdStillDuration"]
49
+
50
+ return result
51
+ }
52
+
53
+ toJson() {
54
+ return {
55
+ "copyright": this.copyright,
56
+ "cameraSwitchEnabled": this.cameraSwitchEnabled,
57
+ "closeButtonEnabled": this.closeButtonEnabled,
58
+ "torchButtonEnabled": this.torchButtonEnabled,
59
+ "vibrateOnSteps": this.vibrateOnSteps,
60
+ "detectOcclusion": this.detectOcclusion,
61
+ "showFaceAnimation": this.showFaceAnimation,
62
+ "cameraPositionAndroid": this.cameraPositionAndroid,
63
+ "cameraPositionIOS": this.cameraPositionIOS,
64
+ "screenOrientation": this.screenOrientation,
65
+ "timeout": this.timeout,
66
+ "holdStillDuration": this.holdStillDuration,
67
+ }
68
+ }
32
69
  }
@@ -11,6 +11,13 @@ export class FaceCaptureException {
11
11
 
12
12
  return result
13
13
  }
14
+
15
+ toJson() {
16
+ return {
17
+ "code": this.code,
18
+ "message": this.message,
19
+ }
20
+ }
14
21
  }
15
22
 
16
23
  export const FaceCaptureErrorCode = {
@@ -13,6 +13,14 @@ export class FaceCaptureImage {
13
13
 
14
14
  return result
15
15
  }
16
+
17
+ toJson() {
18
+ return {
19
+ "imageType": this.imageType,
20
+ "image": this.image,
21
+ "tag": this.tag,
22
+ }
23
+ }
16
24
  }
17
25
 
18
26
  export const ImageType = {
@@ -14,4 +14,11 @@ export class FaceCaptureResponse {
14
14
 
15
15
  return result
16
16
  }
17
+
18
+ toJson() {
19
+ return {
20
+ "image": this.image?.toJson(),
21
+ "error": this.error?.toJson(),
22
+ }
23
+ }
17
24
  }
@@ -1,3 +1,5 @@
1
+ import { Size } from './size'
2
+
1
3
  export class OutputImageCrop {
2
4
  type
3
5
  size
@@ -10,6 +12,27 @@ export class OutputImageCrop {
10
12
  this.padColor = params?.padColor
11
13
  this.returnOriginalRect = params?.returnOriginalRect ?? false
12
14
  }
15
+
16
+ static fromJson(jsonObject) {
17
+ if (jsonObject == null) return null
18
+ return new OutputImageCrop(
19
+ jsonObject["type"],
20
+ {
21
+ size: Size.fromJson(jsonObject["size"]),
22
+ padColor: jsonObject["padColor"],
23
+ returnOriginalRect: jsonObject["returnOriginalRect"],
24
+ }
25
+ )
26
+ }
27
+
28
+ toJson() {
29
+ return {
30
+ "type": this.type,
31
+ "size": this.size?.toJson(),
32
+ "padColor": this.padColor,
33
+ "returnOriginalRect": this.returnOriginalRect,
34
+ }
35
+ }
13
36
  }
14
37
 
15
38
  export const OutputImageCropAspectRatio = {
@@ -1,3 +1,5 @@
1
+ import { OutputImageCrop } from './output_image_crop'
2
+
1
3
  export class OutputImageParams {
2
4
  crop
3
5
  backgroundColor
@@ -6,4 +8,21 @@ export class OutputImageParams {
6
8
  this.crop = params?.crop
7
9
  this.backgroundColor = params?.backgroundColor
8
10
  }
11
+
12
+ static fromJson(jsonObject) {
13
+ if (jsonObject == null) return null
14
+ const result = new OutputImageParams()
15
+
16
+ result.crop = OutputImageCrop.fromJson(jsonObject["crop"])
17
+ result.backgroundColor = jsonObject["backgroundColor"]
18
+
19
+ return result
20
+ }
21
+
22
+ toJson() {
23
+ return {
24
+ "crop": this.crop?.toJson(),
25
+ "backgroundColor": this.backgroundColor,
26
+ }
27
+ }
9
28
  }
@@ -11,4 +11,11 @@ export class Point {
11
11
 
12
12
  return result
13
13
  }
14
+
15
+ toJson() {
16
+ return {
17
+ "x": this.x,
18
+ "y": this.y,
19
+ }
20
+ }
14
21
  }
@@ -15,4 +15,13 @@ export class Rect {
15
15
 
16
16
  return result
17
17
  }
18
+
19
+ toJson() {
20
+ return {
21
+ "left": this.left,
22
+ "top": this.top,
23
+ "right": this.right,
24
+ "bottom": this.bottom,
25
+ }
26
+ }
18
27
  }
@@ -6,4 +6,16 @@ export class Size {
6
6
  this.width = width
7
7
  this.height = height
8
8
  }
9
+
10
+ static fromJson(jsonObject) {
11
+ if (jsonObject == null) return null
12
+ return new Size(jsonObject["width"], jsonObject["height"])
13
+ }
14
+
15
+ toJson() {
16
+ return {
17
+ "width": this.width,
18
+ "height": this.height,
19
+ }
20
+ }
9
21
  }
@@ -23,4 +23,26 @@ export class ImageQualityCharacteristic {
23
23
  this.customRange = ImageQualityRange.withValue(value)
24
24
  return this
25
25
  }
26
+
27
+ static fromJson(jsonObject) {
28
+ if (jsonObject == null) return null
29
+
30
+ return ImageQualityCharacteristic._create(
31
+ jsonObject["characteristicName"],
32
+ {
33
+ recommended: ImageQualityRange.fromJson(jsonObject["recommendedRange"]),
34
+ custom: ImageQualityRange.fromJson(jsonObject["customRange"]),
35
+ color: jsonObject["color"],
36
+ }
37
+ )
38
+ }
39
+
40
+ toJson() {
41
+ return {
42
+ "characteristicName": this.characteristicName,
43
+ "recommendedRange": this.recommendedRange?.toJson(),
44
+ "customRange": this.customRange?.toJson(),
45
+ "color": this.color,
46
+ }
47
+ }
26
48
  }
@@ -23,4 +23,11 @@ export class ImageQualityRange {
23
23
 
24
24
  return result
25
25
  }
26
+
27
+ toJson() {
28
+ return {
29
+ "min": this.min,
30
+ "max": this.max,
31
+ }
32
+ }
26
33
  }
@@ -19,6 +19,16 @@ export class ImageQualityResult {
19
19
 
20
20
  return result
21
21
  }
22
+
23
+ toJson() {
24
+ return {
25
+ "group": this.group,
26
+ "name": this.name,
27
+ "status": this.status,
28
+ "value": this.value,
29
+ "range": this.range?.toJson(),
30
+ }
31
+ }
22
32
  }
23
33
 
24
34
  export const ImageQualityGroupName = {
@@ -105,6 +105,27 @@ export class FaceSDK {
105
105
  this._setServiceUrl(val)
106
106
  }
107
107
 
108
+ get tenant() { return this._tenant }
109
+ _tenant = null
110
+ set tenant(val) {
111
+ this._tenant = val;
112
+ this._setTenant(val);
113
+ }
114
+
115
+ get env() { return this._env }
116
+ _env = null
117
+ set env(val) {
118
+ this._env = val;
119
+ this._setEnv(val);
120
+ }
121
+
122
+ get locale() { return this._locale }
123
+ _locale = null
124
+ set locale(val) {
125
+ this._locale = val;
126
+ this._setLocale(val);
127
+ }
128
+
108
129
  get localizationDictionary() { return this._localizationDictionary }
109
130
  _localizationDictionary
110
131
  set localizationDictionary(val) {
@@ -196,6 +217,9 @@ export class FaceSDK {
196
217
  async _onInit() {
197
218
  this._version = await this._getVersion()
198
219
  this._serviceUrl = await this._getServiceUrl()
220
+ this._tenant = await this._getTenant();
221
+ this._env = await this._getEnv();
222
+ this._locale = await this._getLocale();
199
223
  }
200
224
 
201
225
  async _getVersion() {
@@ -211,6 +235,30 @@ export class FaceSDK {
211
235
  exec("setServiceUrl", [url])
212
236
  }
213
237
 
238
+ async _getTenant() {
239
+ return await exec("getTenant", []);
240
+ }
241
+
242
+ _setTenant(tenant) {
243
+ exec("setTenant", [tenant]);
244
+ }
245
+
246
+ async _getEnv() {
247
+ return await exec("getEnv", []);
248
+ }
249
+
250
+ _setEnv(env) {
251
+ exec("setEnv", [env]);
252
+ }
253
+
254
+ async _getLocale() {
255
+ return await exec("getLocale", []);
256
+ }
257
+
258
+ _setLocale(locale) {
259
+ exec("setLocale", [locale]);
260
+ }
261
+
214
262
  _setLocalizationDictionary(dictionary) {
215
263
  exec("setLocalizationDictionary", [dictionary])
216
264
  }
@@ -13,4 +13,12 @@ export class FaceSDKVersion {
13
13
 
14
14
  return result
15
15
  }
16
+
17
+ toJson() {
18
+ return {
19
+ "api": this.api,
20
+ "core": this.core,
21
+ "coreMode": this.coreMode,
22
+ }
23
+ }
16
24
  }
@@ -14,4 +14,23 @@ export class InitConfig {
14
14
  this.licenseUpdate = params?.licenseUpdate
15
15
  this.useBleDevice = false
16
16
  }
17
+
18
+ static fromJson(jsonObject) {
19
+ if (jsonObject == null) return null
20
+ const result = new InitConfig()
21
+
22
+ result.license = jsonObject["license"]
23
+ result.licenseUpdate = jsonObject["licenseUpdate"]
24
+ result.useBleDevice = jsonObject["useBleDevice"]
25
+
26
+ return result
27
+ }
28
+
29
+ toJson() {
30
+ return {
31
+ "license": this.license,
32
+ "licenseUpdate": this.licenseUpdate,
33
+ "useBleDevice": this.useBleDevice,
34
+ }
35
+ }
17
36
  }
@@ -15,6 +15,14 @@ export class InitException {
15
15
 
16
16
  return result
17
17
  }
18
+
19
+ toJson() {
20
+ return {
21
+ "code": this.code,
22
+ "message": this.message,
23
+ "underlyingError": this.underlyingError?.toJson(),
24
+ }
25
+ }
18
26
  }
19
27
 
20
28
  export const InitErrorCode = {
@@ -11,6 +11,13 @@ export class LicenseException {
11
11
 
12
12
  return result
13
13
  }
14
+
15
+ toJson() {
16
+ return {
17
+ "code": this.code,
18
+ "message": this.message,
19
+ }
20
+ }
14
21
  }
15
22
 
16
23
  export const LicensingResultCode = {
@@ -37,4 +37,23 @@ export function _setLivenessNotificationCompletion(completion) {
37
37
 
38
38
  export function _setCameraSwitchCallback(completion) {
39
39
  _setEvent("cameraSwitchEvent", completion)
40
- }
40
+ }
41
+
42
+ export function dateToString(date) {
43
+ if (date == null) return null
44
+ const fmt = new Intl.DateTimeFormat('en', {
45
+ year: 'numeric',
46
+ month: '2-digit',
47
+ day: '2-digit',
48
+ hour: '2-digit',
49
+ minute: '2-digit',
50
+ second: '2-digit',
51
+ fractionalSecondDigits: 3,
52
+ hour12: false
53
+ });
54
+
55
+ const parts = fmt.formatToParts(date);
56
+ const get = (t) => parts.find(p => p.type === t)?.value ?? '';
57
+
58
+ return `${get('year')}-${get('month')}-${get('day')} ${get('hour')}:${get('minute')}:${get('second')}.${get('fractionalSecond')}`;
59
+ }
@@ -11,6 +11,13 @@ export class LivenessBackendException {
11
11
 
12
12
  return result
13
13
  }
14
+
15
+ toJson() {
16
+ return {
17
+ "code": this.code,
18
+ "message": this.message,
19
+ }
20
+ }
14
21
  }
15
22
 
16
23
  export const LivenessBackendErrorCode = {