@getyoti/yoti-doc-scan-react-native 3.0.1 → 5.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.
@@ -0,0 +1,120 @@
1
+ //
2
+ // Copyright © 2025 Yoti Ltd. All rights reserved.
3
+ //
4
+
5
+ import YotiSDKDesign
6
+
7
+ struct IllustrationTheme: YotiSDKIllustrationTheme, Decodable {
8
+ var arrowUpFromLine: YotiSDKIllustration?
9
+ var cameraExclamationmark: YotiSDKIllustration?
10
+ var checkmark: YotiSDKIllustration?
11
+ var documentExclamationmark: YotiSDKIllustration?
12
+ var documentXmark: YotiSDKIllustration?
13
+ var duplicateIdentityDocumentExclamationmark: YotiSDKIllustration?
14
+ var exclamationmark: YotiSDKIllustration?
15
+ var faceScanEyeLevelGuideline: YotiSDKIllustration?
16
+ var faceScanGuidance: YotiSDKIllustration?
17
+ var faceScanLightingGuideline: YotiSDKIllustration?
18
+ var faceScanOnePersonGuideline: YotiSDKIllustration?
19
+ var identityDocumentExclamationmark: YotiSDKIllustration?
20
+ var identityDocumentScanGuidance: YotiSDKIllustration?
21
+ var identityDocumentXmark: YotiSDKIllustration?
22
+ var landscape: YotiSDKIllustration?
23
+ var passportChipScanExclamationmark: YotiSDKIllustration?
24
+ var passportChipScanGuidance: YotiSDKIllustration?
25
+ var passportChipScanMovementGuideline: YotiSDKIllustration?
26
+ var passportChipScanPlacementGuideline: YotiSDKIllustration?
27
+ var portraitUpsideDown: YotiSDKIllustration?
28
+ var xmark: YotiSDKIllustration?
29
+
30
+ init(from decoder: Decoder) throws {
31
+ let container = try decoder.container(keyedBy: CodingKeys.self)
32
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .arrowUpFromLine) {
33
+ arrowUpFromLine = YotiSDKIllustration(illustration)
34
+ }
35
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .cameraExclamationmark) {
36
+ cameraExclamationmark = YotiSDKIllustration(illustration)
37
+ }
38
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .checkmark) {
39
+ checkmark = YotiSDKIllustration(illustration)
40
+ }
41
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .documentExclamationmark) {
42
+ documentExclamationmark = YotiSDKIllustration(illustration)
43
+ }
44
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .documentXmark) {
45
+ documentXmark = YotiSDKIllustration(illustration)
46
+ }
47
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .duplicateIdentityDocumentExclamationmark) {
48
+ duplicateIdentityDocumentExclamationmark = YotiSDKIllustration(illustration)
49
+ }
50
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .exclamationmark) {
51
+ exclamationmark = YotiSDKIllustration(illustration)
52
+ }
53
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .faceScanEyeLevelGuideline) {
54
+ faceScanEyeLevelGuideline = YotiSDKIllustration(illustration)
55
+ }
56
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .faceScanGuidance) {
57
+ faceScanGuidance = YotiSDKIllustration(illustration)
58
+ }
59
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .faceScanLightingGuideline) {
60
+ faceScanLightingGuideline = YotiSDKIllustration(illustration)
61
+ }
62
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .faceScanOnePersonGuideline) {
63
+ faceScanOnePersonGuideline = YotiSDKIllustration(illustration)
64
+ }
65
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .identityDocumentExclamationmark) {
66
+ identityDocumentExclamationmark = YotiSDKIllustration(illustration)
67
+ }
68
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .identityDocumentScanGuidance) {
69
+ identityDocumentScanGuidance = YotiSDKIllustration(illustration)
70
+ }
71
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .identityDocumentXmark) {
72
+ identityDocumentXmark = YotiSDKIllustration(illustration)
73
+ }
74
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .landscape) {
75
+ landscape = YotiSDKIllustration(illustration)
76
+ }
77
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .passportChipScanExclamationmark) {
78
+ passportChipScanExclamationmark = YotiSDKIllustration(illustration)
79
+ }
80
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .passportChipScanGuidance) {
81
+ passportChipScanGuidance = YotiSDKIllustration(illustration)
82
+ }
83
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .passportChipScanMovementGuideline) {
84
+ passportChipScanMovementGuideline = YotiSDKIllustration(illustration)
85
+ }
86
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .passportChipScanPlacementGuideline) {
87
+ passportChipScanPlacementGuideline = YotiSDKIllustration(illustration)
88
+ }
89
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .portraitUpsideDown) {
90
+ portraitUpsideDown = YotiSDKIllustration(illustration)
91
+ }
92
+ if let illustration = try container.decodeIfPresent(Illustration.self, forKey: .xmark) {
93
+ xmark = YotiSDKIllustration(illustration)
94
+ }
95
+ }
96
+
97
+ private enum CodingKeys: String, CodingKey {
98
+ case arrowUpFromLine = "arrow_up_from_line"
99
+ case cameraExclamationmark = "camera_exclamationmark"
100
+ case checkmark
101
+ case documentExclamationmark = "document_exclamationmark"
102
+ case documentXmark = "document_xmark"
103
+ case duplicateIdentityDocumentExclamationmark = "duplicate_identity_document_exclamationmark"
104
+ case exclamationmark
105
+ case faceScanEyeLevelGuideline = "face_scan_eye_level_guideline"
106
+ case faceScanGuidance = "face_scan_guidance"
107
+ case faceScanLightingGuideline = "face_scan_lighting_guideline"
108
+ case faceScanOnePersonGuideline = "face_scan_one_person_guideline"
109
+ case identityDocumentExclamationmark = "identity_document_exclamationmark"
110
+ case identityDocumentScanGuidance = "identity_document_scan_guidance"
111
+ case identityDocumentXmark = "identity_document_xmark"
112
+ case landscape
113
+ case passportChipScanExclamationmark = "passport_chip_scan_exclamationmark"
114
+ case passportChipScanGuidance = "passport_chip_scan_guidance"
115
+ case passportChipScanMovementGuideline = "passport_chip_scan_movement_guideline"
116
+ case passportChipScanPlacementGuideline = "passport_chip_scan_placement_guideline"
117
+ case portraitUpsideDown = "portrait_upside_down"
118
+ case xmark
119
+ }
120
+ }
@@ -0,0 +1,26 @@
1
+ //
2
+ // Copyright © 2025 Yoti Ltd. All rights reserved.
3
+ //
4
+
5
+ import CoreFoundation
6
+ import YotiSDKDesign
7
+
8
+ struct ShapeTheme: YotiSDKShapeTheme, Decodable {
9
+ let buttonBorderWidth: CGFloat
10
+ let buttonCornerRadius: CGFloat
11
+ let containerBorderWidth: CGFloat
12
+ let containerMediumCornerRadius: CGFloat
13
+ let containerLargeCornerRadius: CGFloat
14
+ let inputBorderWidth: CGFloat
15
+ let inputCornerRadius: CGFloat
16
+
17
+ private enum CodingKeys: String, CodingKey {
18
+ case buttonBorderWidth = "button_border_width"
19
+ case buttonCornerRadius = "button_corner_radius"
20
+ case containerBorderWidth = "container_border_width"
21
+ case containerMediumCornerRadius = "container_medium_corner_radius"
22
+ case containerLargeCornerRadius = "container_large_corner_radius"
23
+ case inputBorderWidth = "input_border_width"
24
+ case inputCornerRadius = "input_corner_radius"
25
+ }
26
+ }
@@ -0,0 +1,24 @@
1
+ //
2
+ // Copyright © 2025 Yoti Ltd. All rights reserved.
3
+ //
4
+
5
+ import YotiSDKDesign
6
+
7
+ enum SpacingMode: String, Decodable {
8
+ case compact
9
+ case regular
10
+ case relaxed
11
+ }
12
+
13
+ extension YotiSDKSpacingMode {
14
+ init(_ mode: SpacingMode) {
15
+ switch mode {
16
+ case .compact:
17
+ self = .compact
18
+ case .regular:
19
+ self = .regular
20
+ case .relaxed:
21
+ self = .relaxed
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,46 @@
1
+ //
2
+ // Copyright © 2025 Yoti Ltd. All rights reserved.
3
+ //
4
+
5
+ import UIKit
6
+
7
+ enum SymbolWeight: String, Decodable {
8
+ case unspecified
9
+ case ultraLight = "ultra_light"
10
+ case thin
11
+ case light
12
+ case regular
13
+ case medium
14
+ case semibold
15
+ case bold
16
+ case heavy
17
+ case black
18
+ }
19
+
20
+ @available(iOS 13, *)
21
+ extension UIImage.SymbolWeight {
22
+ init(_ weight: SymbolWeight) {
23
+ switch weight {
24
+ case .unspecified:
25
+ self = .unspecified
26
+ case .ultraLight:
27
+ self = .ultraLight
28
+ case .thin:
29
+ self = .thin
30
+ case .light:
31
+ self = .light
32
+ case .regular:
33
+ self = .regular
34
+ case .medium:
35
+ self = .medium
36
+ case .semibold:
37
+ self = .semibold
38
+ case .bold:
39
+ self = .bold
40
+ case .heavy:
41
+ self = .heavy
42
+ case .black:
43
+ self = . black
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,52 @@
1
+ //
2
+ // Copyright © 2025 Yoti Ltd. All rights reserved.
3
+ //
4
+
5
+ import Foundation
6
+ import YotiSDKDesign
7
+
8
+ struct Theme: Decodable {
9
+ var lightPrimaryColor: UIColor?
10
+ var darkPrimaryColor: UIColor?
11
+ let lightColorTheme: YotiSDKColorTheme?
12
+ let darkColorTheme: YotiSDKColorTheme?
13
+ let typographyTheme: YotiSDKTypographyTheme?
14
+ var spacingMode: YotiSDKSpacingMode?
15
+ let shapeTheme: YotiSDKShapeTheme?
16
+ var iconTheme: YotiSDKIconTheme?
17
+ let illustrationTheme: YotiSDKIllustrationTheme?
18
+
19
+ init(from decoder: Decoder) throws {
20
+ let container = try decoder.container(keyedBy: CodingKeys.self)
21
+ if let lightPrimaryColor = try container.decodeIfPresent(String.self, forKey: .lightPrimaryColor) {
22
+ self.lightPrimaryColor = UIColor(hexString: lightPrimaryColor)
23
+ }
24
+ if let darkPrimaryColor = try container.decodeIfPresent(String.self, forKey: .darkPrimaryColor) {
25
+ self.darkPrimaryColor = UIColor(hexString: darkPrimaryColor)
26
+ }
27
+ lightColorTheme = try container.decodeIfPresent(ColorTheme.self, forKey: .lightColorTheme)
28
+ darkColorTheme = try container.decodeIfPresent(ColorTheme.self, forKey: .darkColorTheme)
29
+ typographyTheme = try container.decodeIfPresent(TypographyTheme.self, forKey: .typographyTheme)
30
+ if let rawValue = try container.decodeIfPresent(String.self, forKey: .spacingMode), !rawValue.isEmpty {
31
+ let spacingMode = SpacingMode(rawValue: rawValue)!
32
+ self.spacingMode = YotiSDKSpacingMode(spacingMode)
33
+ }
34
+ shapeTheme = try container.decodeIfPresent(ShapeTheme.self, forKey: .shapeTheme)
35
+ if #available(iOS 13, *) {
36
+ iconTheme = try container.decodeIfPresent(IconTheme.self, forKey: .iconTheme)
37
+ }
38
+ illustrationTheme = try container.decodeIfPresent(IllustrationTheme.self, forKey: .illustrationTheme)
39
+ }
40
+
41
+ private enum CodingKeys: String, CodingKey {
42
+ case lightPrimaryColor = "light_primary_color"
43
+ case darkPrimaryColor = "dark_primary_color"
44
+ case lightColorTheme = "light_color_theme"
45
+ case darkColorTheme = "dark_color_theme"
46
+ case typographyTheme = "typography_theme"
47
+ case spacingMode = "spacing_mode"
48
+ case shapeTheme = "shape_theme"
49
+ case iconTheme = "icon_theme"
50
+ case illustrationTheme = "illustration_theme"
51
+ }
52
+ }
@@ -0,0 +1,41 @@
1
+ //
2
+ // Copyright © 2025 Yoti Ltd. All rights reserved.
3
+ //
4
+
5
+ import CoreFoundation
6
+ import UIKit
7
+ import YotiSDKDesign
8
+
9
+ struct TypographyStyle: YotiSDKTypographyStyle, Decodable {
10
+ var systemFontDesign: UIFontDescriptor.SystemDesign?
11
+ var systemFontWeight: UIFont.Weight?
12
+ let customFontName: String?
13
+ let fontSize: CGFloat
14
+ let lineHeightMultiple: CGFloat?
15
+ let kern: CGFloat?
16
+
17
+ init(from decoder: Decoder) throws {
18
+ let container = try decoder.container(keyedBy: CodingKeys.self)
19
+ if #available(iOS 13, *), let rawValue = try container.decodeIfPresent(String.self, forKey: .systemFontDesign), !rawValue.isEmpty {
20
+ let systemFontDesign = FontDesign(rawValue: rawValue)!
21
+ self.systemFontDesign = UIFontDescriptor.SystemDesign(systemFontDesign)
22
+ }
23
+ if let rawValue = try container.decodeIfPresent(String.self, forKey: .systemFontWeight), !rawValue.isEmpty {
24
+ let systemFontWeight = FontWeight(rawValue: rawValue)!
25
+ self.systemFontWeight = UIFont.Weight(systemFontWeight)
26
+ }
27
+ customFontName = try container.decodeIfPresent(String.self, forKey: .customFontName)
28
+ fontSize = try container.decode(CGFloat.self, forKey: .fontSize)
29
+ lineHeightMultiple = try container.decodeIfPresent(CGFloat.self, forKey: .lineHeightMultiple)
30
+ kern = try container.decodeIfPresent(CGFloat.self, forKey: .kern)
31
+ }
32
+
33
+ private enum CodingKeys: String, CodingKey {
34
+ case systemFontDesign = "system_font_design"
35
+ case systemFontWeight = "system_font_weight"
36
+ case customFontName = "custom_font_name"
37
+ case fontSize = "font_size"
38
+ case lineHeightMultiple = "line_height_multiple"
39
+ case kern
40
+ }
41
+ }
@@ -0,0 +1,115 @@
1
+ //
2
+ // Copyright © 2025 Yoti Ltd. All rights reserved.
3
+ //
4
+
5
+ import YotiSDKDesign
6
+
7
+ struct TypographyTheme: YotiSDKTypographyTheme, Decodable {
8
+ private let smallHeadline: TypographyStyle
9
+ private let smallTitle: TypographyStyle
10
+ private let smallBody: TypographyStyle
11
+ private let smallProminentBody: TypographyStyle
12
+ private let smallLabel: TypographyStyle
13
+ private let smallProminentLabel: TypographyStyle
14
+ private let mediumHeadline: TypographyStyle
15
+ private let mediumTitle: TypographyStyle
16
+ private let mediumBody: TypographyStyle
17
+ private let mediumProminentBody: TypographyStyle
18
+ private let mediumLabel: TypographyStyle
19
+ private let mediumProminentLabel: TypographyStyle
20
+ private let largeHeadline: TypographyStyle
21
+ private let largeTitle: TypographyStyle
22
+ private let largeBody: TypographyStyle
23
+ private let largeProminentBody: TypographyStyle
24
+ private let largeLabel: TypographyStyle
25
+ private let largeProminentLabel: TypographyStyle
26
+
27
+ private enum CodingKeys: String, CodingKey {
28
+ case smallHeadline = "small_headline"
29
+ case smallTitle = "small_title"
30
+ case smallBody = "small_body"
31
+ case smallProminentBody = "small_prominent_body"
32
+ case smallLabel = "small_label"
33
+ case smallProminentLabel = "small_prominent_label"
34
+ case mediumHeadline = "medium_headline"
35
+ case mediumTitle = "medium_title"
36
+ case mediumBody = "medium_body"
37
+ case mediumProminentBody = "medium_prominent_body"
38
+ case mediumLabel = "medium_label"
39
+ case mediumProminentLabel = "medium_prominent_label"
40
+ case largeHeadline = "large_headline"
41
+ case largeTitle = "large_title"
42
+ case largeBody = "large_body"
43
+ case largeProminentBody = "large_prominent_body"
44
+ case largeLabel = "large_label"
45
+ case largeProminentLabel = "large_prominent_label"
46
+ }
47
+ }
48
+
49
+ extension TypographyTheme {
50
+ func headline(scale: YotiSDKTypographyScale) -> YotiSDKTypographyStyle {
51
+ switch scale {
52
+ case .small:
53
+ smallHeadline
54
+ case .medium:
55
+ mediumHeadline
56
+ case .large:
57
+ largeHeadline
58
+ }
59
+ }
60
+
61
+ func title(scale: YotiSDKTypographyScale) -> YotiSDKTypographyStyle {
62
+ switch scale {
63
+ case .small:
64
+ smallTitle
65
+ case .medium:
66
+ mediumTitle
67
+ case .large:
68
+ largeTitle
69
+ }
70
+ }
71
+
72
+ func body(scale: YotiSDKTypographyScale) -> YotiSDKTypographyStyle {
73
+ switch scale {
74
+ case .small:
75
+ smallBody
76
+ case .medium:
77
+ mediumBody
78
+ case .large:
79
+ largeBody
80
+ }
81
+ }
82
+
83
+ func prominentBody(scale: YotiSDKTypographyScale) -> YotiSDKTypographyStyle {
84
+ switch scale {
85
+ case .small:
86
+ smallProminentBody
87
+ case .medium:
88
+ mediumProminentBody
89
+ case .large:
90
+ largeProminentBody
91
+ }
92
+ }
93
+
94
+ func label(scale: YotiSDKTypographyScale) -> YotiSDKTypographyStyle {
95
+ switch scale {
96
+ case .small:
97
+ smallLabel
98
+ case .medium:
99
+ mediumLabel
100
+ case .large:
101
+ largeLabel
102
+ }
103
+ }
104
+
105
+ func prominentLabel(scale: YotiSDKTypographyScale) -> YotiSDKTypographyStyle {
106
+ switch scale {
107
+ case .small:
108
+ smallProminentLabel
109
+ case .medium:
110
+ mediumProminentLabel
111
+ case .large:
112
+ largeProminentLabel
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,24 @@
1
+ //
2
+ // Copyright © 2025 Yoti Ltd. All rights reserved.
3
+ //
4
+
5
+ import UIKit
6
+
7
+ extension UIColor {
8
+ convenience init(hexString: String) {
9
+ var mutableHexString = hexString
10
+ if mutableHexString.hasPrefix("#") {
11
+ mutableHexString.removeFirst()
12
+ }
13
+ guard mutableHexString.count == 6 else {
14
+ preconditionFailure("Expected \(hexString) to be formatted as #rrggbb or rrggbb")
15
+ }
16
+ guard let hex = UInt(mutableHexString, radix: 16) else {
17
+ preconditionFailure("\(hexString) is not a valid hex color")
18
+ }
19
+ let red = Double((hex >> 16) & 0xff) / 255
20
+ let green = Double((hex >> 08) & 0xff) / 255
21
+ let blue = Double((hex >> 00) & 0xff) / 255
22
+ self.init(red: red, green: green, blue: blue, alpha: 1)
23
+ }
24
+ }
package/package.json CHANGED
@@ -5,16 +5,10 @@
5
5
  "license": "https://www.yoti.com/terms/identity-verification",
6
6
  "author": "Yoti Ltd",
7
7
  "main": "RNYotiDocScan.js",
8
- "version": "3.0.1",
9
- "devDependencies": {
10
- "react": "^17.0.2",
11
- "react-dom": "^17.0.2",
12
- "react-hot-loader": "^4.12.20",
13
- "react-native": "^0.68.5"
14
- },
15
- "dependencies": {
16
- "keymirror": "^0.1.1",
17
- "prop-types": "^15.7.2"
8
+ "version": "5.0.0",
9
+ "peerDependencies": {
10
+ "react": ">=18.0.0",
11
+ "react-native": ">=0.70.0"
18
12
  },
19
13
  "repository": {
20
14
  "type": "git",
@@ -11,8 +11,10 @@ Pod::Spec.new do |spec|
11
11
  spec.version = package["version"]
12
12
  spec.pod_target_xcconfig = {
13
13
  "FRAMEWORK_SEARCH_PATHS" => [
14
+ "${PODS_XCFRAMEWORKS_BUILD_DIR}/YotiSDKDocument",
14
15
  "${PODS_XCFRAMEWORKS_BUILD_DIR}/YotiSDKIdentityDocument",
15
16
  "${PODS_XCFRAMEWORKS_BUILD_DIR}/YotiSDKSupplementaryDocument",
17
+ "${PODS_XCFRAMEWORKS_BUILD_DIR}/YotiSDKFace",
16
18
  "${PODS_XCFRAMEWORKS_BUILD_DIR}/YotiSDKFaceTec",
17
19
  "${PODS_XCFRAMEWORKS_BUILD_DIR}/YotiSDKFaceCapture"
18
20
  ]
@@ -20,7 +22,7 @@ Pod::Spec.new do |spec|
20
22
  spec.source = {
21
23
  :git => "https://github.com/getyoti/yoti-doc-scan-react-native.git", :tag => "#{spec.version}"
22
24
  }
23
- spec.source_files = "ios/**/*.{h,m}"
25
+ spec.source_files = "ios/**/*.{h,m,swift}"
24
26
  spec.platform = :ios, "11.0"
25
27
  spec.dependency "React"
26
28
  spec.dependency "YotiSDKCore"
@@ -1,7 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
- #import <UIKit/UIKit.h>
3
- #import <YotiSDKCore/YotiSDKCore-Swift.h>
4
-
5
- @interface RNYotiDocScan: NSObject<RCTBridgeModule, UINavigationControllerDelegate, YotiSDKDataSource, YotiSDKDelegate>
6
-
7
- @end