assentify-sdk-react-native 1.0.0-Beta.22 → 1.0.0-Beta.24

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/Package.swift +172 -0
  2. package/README.md +10 -32
  3. package/android/build.gradle +0 -5
  4. package/ios/AssentifySdkBaseModule.swift +1 -0
  5. package/ios/NativeAssentifySdk.swift +9 -7
  6. package/ios/UIComponents/RNPassportScanner.swift +4 -3
  7. package/ios/View/AssentifySdkEventEmitting.swift +10 -0
  8. package/ios/View/DataDecoder.swift +16 -16
  9. package/ios/View/FaceMatchController.swift +51 -51
  10. package/ios/View/IDCardController.swift +37 -37
  11. package/ios/View/OtherController.swift +33 -33
  12. package/ios/View/PassportController.swift +36 -36
  13. package/ios/View/QrController.swift +10 -10
  14. package/ios/View/UI.swift +77 -26
  15. package/lib/commonjs/AssentifyProvider.js +3 -0
  16. package/lib/commonjs/AssentifyProvider.js.map +1 -1
  17. package/lib/module/AssentifyProvider.js +4 -0
  18. package/lib/module/AssentifyProvider.js.map +1 -1
  19. package/lib/typescript/babel.config.d.ts +0 -1
  20. package/lib/typescript/example/babel.config.d.ts +7 -4
  21. package/lib/typescript/example/babel.config.d.ts.map +1 -1
  22. package/lib/typescript/example/metro.config.d.ts +9 -1
  23. package/lib/typescript/example/metro.config.d.ts.map +1 -1
  24. package/lib/typescript/example/react-native.config.d.ts +5 -2
  25. package/lib/typescript/example/react-native.config.d.ts.map +1 -1
  26. package/lib/typescript/example/src/App.d.ts.map +1 -1
  27. package/lib/typescript/example/src/Home.d.ts.map +1 -1
  28. package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -1
  29. package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
  30. package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
  31. package/package.json +9 -8
  32. package/src/AssentifyProvider.tsx +341 -305
  33. package/assentify-sdk.podspec +0 -44
  34. package/lib/typescript/example/src/navigator.d.ts +0 -4
  35. package/lib/typescript/example/src/navigator.d.ts.map +0 -1
package/Package.swift ADDED
@@ -0,0 +1,172 @@
1
+ // swift-tools-version: 6.0
2
+ // Root SPM manifest for assentify-sdk-react-native, consumed by RN 0.87+'s
3
+ // `npx react-native spm` autolinking (dep root registered via
4
+ // example/react-native.config.js; a real app registers it via its own
5
+ // node_modules install instead).
6
+ //
7
+ // Three build targets:
8
+ // - AssentifySdkReactNative (Swift): ios/View/** + ios/Resources. Zero
9
+ // React dependency -- talks to the bridge layer only through the
10
+ // AssentifySdkEventEmitting protocol (ios/View/AssentifySdkEventEmitting.swift).
11
+ // Ships as plain source in this same package graph (not a precompiled
12
+ // xcframework/binaryTarget -- that was tried first, but a binaryTarget
13
+ // whose public API exposes another SPM package's types (AssentifySdk)
14
+ // bakes in a module reference from its OWN isolated build/resolution
15
+ // graph, which doesn't resolve when a consuming app's SEPARATE SPM
16
+ // resolution tries to use it ("module 'AssentifySdk' not found" scanning
17
+ // the framework's generated header). Shipping as source means AssentifySdk
18
+ // resolves exactly once, consistently, for the whole app graph.
19
+ // - AssentifySdkReactNativeBridge (Swift): NativeAssentifySdk.swift,
20
+ // RNPassportScanner.swift, AssentifySdkBaseModule.swift. These subclass
21
+ // RCTEventEmitter/RCTViewManager directly, so they need RCTEventEmitter's
22
+ // ObjC interface visible at compile time -- `import React` (the module
23
+ // name the ReactHeaders target's custom module map declares) below.
24
+ // - AssentifySdkReactNativeObjC (Objective-C++): NativeAssentifySdk.mm,
25
+ // RNPassportScanner.m, RNIOSProgressBar.*, RNTMapManager.*. These use
26
+ // RCT_EXTERN_MODULE, which forward-declares the bridge module by name and
27
+ // resolves the Swift implementation via the Objective-C runtime at
28
+ // startup -- there is no compile-time symbol reference between this
29
+ // target and the Swift ones, so neither depends on the other; both just
30
+ // need to end up linked into the same product.
31
+ //
32
+ // Split into three (rather than the podspec's single mixed-language pod
33
+ // target) because SPM cannot compile Swift + Objective-C/C++ in one target.
34
+ import PackageDescription
35
+
36
+ let package = Package(
37
+ name: "AssentifySdkReactNative",
38
+ // Must be >= the upstream AssentifySdk.iOS.SPM engine's own minimum
39
+ // (15.0) -- SPM rejects a target claiming a lower floor than a product
40
+ // it depends on. NOTE: RN 0.87's autolinking aggregator
41
+ // (generate-spm-autolinking.js) currently hardcodes iOS 15 for EVERY
42
+ // autolinked package with no way to raise it per-dependency, so an app
43
+ // consuming this library via `npx react-native spm` will need that
44
+ // upstream limitation fixed/configurable before this resolves cleanly
45
+ // end-to-end; verified locally by patching the generated aggregator.
46
+ platforms: [.iOS(.v15)],
47
+ products: [
48
+ .library(
49
+ name: "AssentifySdkReactNative",
50
+ targets: [
51
+ "AssentifySdkReactNative",
52
+ "AssentifySdkReactNativeBridge",
53
+ "AssentifySdkReactNativeObjC",
54
+ ]
55
+ ),
56
+ ],
57
+ dependencies: [
58
+ // RN 0.87+'s SPM app-side pipeline materializes this locally at
59
+ // <appRoot>/build/xcframeworks; a self-managed dep's relative
60
+ // .package(path:) is resolved against the autolinker's
61
+ // <appRoot>/build/generated/autolinking/libs/<SwiftName> symlink, not
62
+ // this file's real location -- both live under <appRoot>/build, so
63
+ // the "../../../../" depth is fixed by that RN-tooling convention
64
+ // regardless of which app consumes this package.
65
+ .package(name: "ReactNative", path: "../../../../xcframeworks"),
66
+ .package(name: "React-GeneratedCode", path: "../../../../generated/ios"),
67
+ .package(
68
+ url: "https://github.com/AssentifyLTD/Assentify.SDK.iOS.SPM.git",
69
+ exact: "1.0.0-Beta.20"
70
+ ),
71
+ ],
72
+ targets: [
73
+ .target(
74
+ name: "AssentifySdkReactNative",
75
+ dependencies: [
76
+ .product(name: "AssentifySdk", package: "assentify.sdk.ios.spm"),
77
+ ],
78
+ path: "ios",
79
+ sources: [
80
+ "View/AssentifySdkEventEmitting.swift",
81
+ "View/DataDecoder.swift",
82
+ "View/FaceMatchController.swift",
83
+ "View/IDCardController.swift",
84
+ "View/OtherController.swift",
85
+ "View/PassportController.swift",
86
+ "View/QrController.swift",
87
+ "View/UI.swift",
88
+ ],
89
+ // Individually-listed (not `.copy("Resources")`) so the files land
90
+ // flat at the resource bundle's root -- a nested top-level dir
91
+ // literally named "Resources" alongside the bundle's own Info.plist
92
+ // makes Xcode's codesign misidentify the bundle as a malformed
93
+ // macOS Contents/Resources layout ("bundle format unrecognized,
94
+ // invalid, or unsuitable"), failing CodeSign at build time.
95
+ resources: [
96
+ .copy("Resources/card.gif"),
97
+ .copy("Resources/expire.png"),
98
+ .copy("Resources/id.gif"),
99
+ .copy("Resources/id_warning.png"),
100
+ .copy("Resources/info_icon.png"),
101
+ .copy("Resources/passport.gif"),
102
+ .copy("Resources/sending.png"),
103
+ .copy("Resources/warning.png"),
104
+ .copy("Resources/zoom_in.png"),
105
+ .copy("Resources/zoom_out.png"),
106
+ ],
107
+ // See the Bridge target below: this source predates Swift 6's
108
+ // strict concurrency checking (main-actor isolation wasn't a
109
+ // compile error under the podspec's Swift 5).
110
+ swiftSettings: [.swiftLanguageMode(.v5)]
111
+ ),
112
+ .target(
113
+ name: "AssentifySdkReactNativeBridge",
114
+ dependencies: [
115
+ "AssentifySdkReactNative",
116
+ .product(name: "AssentifySdk", package: "assentify.sdk.ios.spm"),
117
+ .product(name: "ReactHeaders", package: "ReactNative"),
118
+ .product(name: "ReactNativeHeaders", package: "ReactNative"),
119
+ .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
120
+ .product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
121
+ ],
122
+ path: "ios",
123
+ sources: [
124
+ "AssentifySdkBaseModule.swift",
125
+ "NativeAssentifySdk.swift",
126
+ "UIComponents/RNPassportScanner.swift",
127
+ ],
128
+ // Matches the podspec's `swift_versions` (5.0-5.5): this source
129
+ // predates Swift 6 mode, which turns some existing syntax (e.g.
130
+ // `@objc (Name)` with a space) into hard errors instead of warnings.
131
+ swiftSettings: [.swiftLanguageMode(.v5)]
132
+ ),
133
+ .target(
134
+ name: "AssentifySdkReactNativeObjC",
135
+ dependencies: [
136
+ // RCT_EXTERN_MODULE (NativeAssentifySdk.mm, RNPassportScanner.m)
137
+ // resolves NativeAssentifySdk/RNPassportScanner purely via the
138
+ // Objective-C runtime at startup -- no #import ever references
139
+ // the Bridge target, so nothing here creates a compile-time
140
+ // symbol reference to it. Without an explicit target
141
+ // dependency, Xcode's SPM integration doesn't guarantee this
142
+ // product's sibling targets all get linked into a consumer:
143
+ // observed in practice as this target's object linking fine
144
+ // while AssentifySdkReactNativeBridge's compiled Swift classes
145
+ // (which define those @objc names) silently drop out of the
146
+ // final link ("Undefined symbols: _OBJC_CLASS_$_NativeAssentifySdk").
147
+ // This dependency exists only to force that link edge.
148
+ "AssentifySdkReactNativeBridge",
149
+ .product(name: "ReactHeaders", package: "ReactNative"),
150
+ .product(name: "ReactNativeHeaders", package: "ReactNative"),
151
+ .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
152
+ .product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
153
+ ],
154
+ path: "ios",
155
+ sources: [
156
+ "NativeAssentifySdk.mm",
157
+ "UIComponents/RNPassportScanner.m",
158
+ "UIComponents/RNIOSProgressBar.m",
159
+ "UIComponents/RNTMapManager.m",
160
+ ],
161
+ publicHeadersPath: "UIComponents",
162
+ cxxSettings: [
163
+ .define("DEBUG", .when(configuration: .debug)),
164
+ .define("NDEBUG", .when(configuration: .release)),
165
+ ],
166
+ linkerSettings: [
167
+ .linkedFramework("MapKit"),
168
+ ]
169
+ ),
170
+ ],
171
+ cxxLanguageStandard: .cxx20
172
+ )
package/README.md CHANGED
@@ -56,43 +56,21 @@ yarn add assentify-sdk-react-native
56
56
  ```
57
57
 
58
58
  ## Installation iOS
59
- **Podfile**
60
- ```
61
- platform :ios, '18.0'
62
- dynamic_frameworks = ['AssentifySdk', 'TensorFlowLiteSwift']
63
-
64
- permissions_path = '../node_modules/react-native-permissions/ios'
65
- pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
66
-
67
- pod 'SVGKit', :git => 'https://github.com/jbagaresgaray/SVGKit.git', :branch => '3.x', :modular_headers => true
68
- pod 'CocoaLumberjack', :modular_headers => true
69
- pod 'TensorFlowLiteSwift', '2.7.0' // If needed
70
- use_frameworks!
71
-
72
-
73
- pre_install do |installer|
74
- installer.pod_targets.each do |pod|
75
- if !dynamic_frameworks.include?(pod.name)
76
- puts "Overriding the static_framework? method for #{pod.name}"
77
- def pod.static_framework?;
78
- true
79
- end
80
- def pod.build_type;
81
- Pod::BuildType.static_library
82
- end
83
- end
84
- end
85
- end
86
59
 
87
- ```
60
+ As of this version, the underlying [AssentifySdk](https://github.com/AssentifyLTD/Assentify.SDK.iOS.SPM) native library is
61
+ distributed via **Swift Package Manager** instead of CocoaPods. You don't need to add it to your Podfile or install it
62
+ manually — the `assentify-sdk` pod declares it as an SPM dependency, and `pod install` wires the Swift package into your
63
+ Xcode project automatically (using React Native's built-in `spm_dependency`/autolinking support).
88
64
 
89
- ```swift
90
- cd ios
91
- pod install
92
- ```
93
65
 
94
66
  ## Versions
95
67
 
68
+ ***1.0.0-Beta.24***
69
+ 1. *iOS 15+ support.*
70
+
71
+ ***1.0.0-Beta.23***
72
+ 1. *iOS: Switched from CocoaPods to Swift Package Manager (SPM) for dependency management.*
73
+
96
74
  ***1.0.0-Beta.22***
97
75
  1. *Added full RTL (Right-to-Left) and LTR (Left-to-Right) , Arabic and English layout support.*
98
76
  2. *Enhanced the slider click animation*
@@ -23,7 +23,6 @@ def isNewArchitectureEnabled() {
23
23
  }
24
24
 
25
25
  apply plugin: "com.android.library"
26
- apply plugin: "kotlin-android"
27
26
 
28
27
  def getExtOrDefault(name) {
29
28
  return rootProject.ext.has(name)
@@ -79,10 +78,6 @@ android {
79
78
  targetCompatibility JavaVersion.VERSION_17
80
79
  }
81
80
 
82
- kotlinOptions {
83
- jvmTarget = "17"
84
- }
85
-
86
81
  packagingOptions {
87
82
  pickFirst '**/libc++_shared.so'
88
83
  pickFirst '**/libfbjni.so'
@@ -1,6 +1,7 @@
1
1
  import ObjectiveC
2
2
  import UIKit
3
3
  import Foundation
4
+ import React
4
5
 
5
6
  @objc(AssentifySdkBaseModule)
6
7
  class AssentifySdkBaseModule: RCTEventEmitter {
@@ -1,10 +1,12 @@
1
1
  import ObjectiveC
2
2
  import UIKit
3
3
  import Foundation
4
+ import React
4
5
  import AssentifySdk
6
+ import AssentifySdkReactNative
5
7
 
6
8
  @objc(NativeAssentifySdk)
7
- class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDelegate,FlowDelegate{
9
+ public class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDelegate,FlowDelegate,AssentifySdkEventEmitting{
8
10
 
9
11
 
10
12
 
@@ -148,14 +150,14 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
148
150
 
149
151
  }
150
152
 
151
- func onAssentifySdkInitError(message: String) {
153
+ public func onAssentifySdkInitError(message: String) {
152
154
  DispatchQueue.main.async {
153
155
  let eventResultMap: [String: Any] = ["assentifySdkInitSuccess": false]
154
156
  self.sendEvent(withName: "AppResult",body : eventResultMap)
155
157
  }
156
158
  }
157
159
 
158
- func onAssentifySdkInitSuccess(configModel: ConfigModel) {
160
+ public func onAssentifySdkInitSuccess(configModel: ConfigModel) {
159
161
  configModel.stepDefinitions.forEach{step in
160
162
  if UserDefaults.standard.object(forKey: String(step.stepId)) != nil {
161
163
  UserDefaults.standard.removeObject(forKey: String(step.stepId))
@@ -191,7 +193,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
191
193
 
192
194
 
193
195
 
194
- override func supportedEvents() -> [String]! {
196
+ public override func supportedEvents() -> [String]! {
195
197
  return [
196
198
  "AppResult",
197
199
  "EventResult",
@@ -443,7 +445,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
443
445
  extractedInformationBlockLoader[property.key] = self.configModel?.instanceHash
444
446
 
445
447
  }
446
- if (property.key.contains(BlockLoaderKeys.interactionID)) {
448
+ if (property.key.contains(AssentifySdkReactNative.BlockLoaderKeys.interactionID)) {
447
449
  extractedInformationBlockLoader[property.key] = self.configModel?.instanceId
448
450
  }
449
451
  if !data.isEmpty {
@@ -477,7 +479,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
477
479
 
478
480
  }
479
481
 
480
- func onSubmitError(message: String) {
482
+ public func onSubmitError(message: String) {
481
483
  DispatchQueue.main.async {
482
484
  let eventResultMap: [String: Any] = [
483
485
  "success": false,
@@ -486,7 +488,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
486
488
  }
487
489
  }
488
490
 
489
- func onSubmitSuccess() {
491
+ public func onSubmitSuccess() {
490
492
  DispatchQueue.main.async {
491
493
  let eventResultMap: [String: Any] = [
492
494
  "success": true,
@@ -1,4 +1,5 @@
1
1
  import UIKit
2
+ import React
2
3
  import AssentifySdk
3
4
 
4
5
  class PassportScannerView: UIView, ScanPassportDelegate {
@@ -242,13 +243,13 @@ class PassportScannerView: UIView, ScanPassportDelegate {
242
243
  }
243
244
 
244
245
  @objc (RNPassportScanner)
245
- class RNPassportScanner: RCTViewManager {
246
+ public class RNPassportScanner: RCTViewManager {
246
247
 
247
- override static func requiresMainQueueSetup() -> Bool {
248
+ public override static func requiresMainQueueSetup() -> Bool {
248
249
  return true
249
250
  }
250
251
 
251
- override func view() -> UIView! {
252
+ public override func view() -> UIView! {
252
253
  return PassportScannerView()
253
254
  }
254
255
  }
@@ -0,0 +1,10 @@
1
+ import Foundation
2
+
3
+ // Breaks the circular module dependency between the View layer (precompiled,
4
+ // no React dependency) and the bridge-registration layer (NativeAssentifySdk,
5
+ // built via CocoaPods since it needs RCTEventEmitter). View only ever needs to
6
+ // call sendEvent, so it depends on this protocol instead of the concrete
7
+ // NativeAssentifySdk/RCTEventEmitter type.
8
+ public protocol AssentifySdkEventEmitting: AnyObject {
9
+ func sendEvent(withName name: String!, body: Any!)
10
+ }
@@ -13,29 +13,29 @@ enum IDType{
13
13
 
14
14
 
15
15
 
16
- struct StepsName {
17
- static let DocumentCapture = "IdentificationDocumentCapture"
18
- static let FaceMatch = "FaceImageAcquisition"
19
- static let ContextAwareSigning = "ContextAwareSigning"
20
- static let WrapUp = "WrapUp"
21
- static let BlockLoader = "BlockLoader"
16
+ public struct StepsName {
17
+ public static let DocumentCapture = "IdentificationDocumentCapture"
18
+ public static let FaceMatch = "FaceImageAcquisition"
19
+ public static let ContextAwareSigning = "ContextAwareSigning"
20
+ public static let WrapUp = "WrapUp"
21
+ public static let BlockLoader = "BlockLoader"
22
22
  }
23
23
 
24
24
 
25
25
 
26
- struct WrapUpKeys {
27
- static let TimeEnded = "OnBoardMe_WrapUp_TimeEnded"
26
+ public struct WrapUpKeys {
27
+ public static let TimeEnded = "OnBoardMe_WrapUp_TimeEnded"
28
28
 
29
29
  }
30
30
 
31
- struct BlockLoaderKeys {
32
- static let DeviceName = "OnBoardMe_BlockLoader_DeviceName"
33
- static let FlowName = "OnBoardMe_BlockLoader_FlowName"
34
- static let TimeStarted = "OnBoardMe_BlockLoader_TimeStarted"
35
- static let Application = "OnBoardMe_BlockLoader_Application"
36
- static let UserAgent = "OnBoardMe_BlockLoader_UserAgent"
37
- static let InstanceHash = "OnBoardMe_BlockLoader_InstanceHash"
38
- static let interactionID = "OnBoardMe_BlockLoader_Interaction"
31
+ public struct BlockLoaderKeys {
32
+ public static let DeviceName = "OnBoardMe_BlockLoader_DeviceName"
33
+ public static let FlowName = "OnBoardMe_BlockLoader_FlowName"
34
+ public static let TimeStarted = "OnBoardMe_BlockLoader_TimeStarted"
35
+ public static let Application = "OnBoardMe_BlockLoader_Application"
36
+ public static let UserAgent = "OnBoardMe_BlockLoader_UserAgent"
37
+ public static let InstanceHash = "OnBoardMe_BlockLoader_InstanceHash"
38
+ public static let interactionID = "OnBoardMe_BlockLoader_Interaction"
39
39
  }
40
40
 
41
41