@idnow/react-idcheckio 8.1.9 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -45
- package/android/build.gradle +2 -2
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/src/main/java/com/idnowreactidcheckio/{IdnowReactIdcheckioModule.kt → IDCheckIOBridgeModule.kt} +25 -27
- package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioActivity.kt +17 -15
- package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioPackage.kt +1 -1
- package/android/src/main/java/com/idnowreactidcheckio/bean/ExtractionReact.kt +4 -4
- package/android/src/main/java/com/idnowreactidcheckio/bean/IntegrityCheckReact.kt +2 -2
- package/android/src/main/java/com/idnowreactidcheckio/bean/OnlineContextEnum.kt +9 -0
- package/android/src/main/java/com/idnowreactidcheckio/bean/ParamsEnum.kt +1 -2
- package/android/src/main/java/com/idnowreactidcheckio/utils/Mapper.kt +17 -53
- package/app.plugin.js +19 -0
- package/idnow-react-idcheckio.podspec +5 -24
- package/ios/IDCheckIOBridgeModule.m +29 -0
- package/ios/IDCheckIOBridgeModule.swift +106 -0
- package/ios/Models/ParamsEnum.swift +0 -1
- package/ios/Utils/Mapper.swift +16 -38
- package/package.json +7 -3
- package/plugins/addSPMDependency.js +119 -0
- package/plugins/copyNativeFiles.js +135 -0
- package/release-public.sh +2 -2
- package/src/index.d.ts +6 -33
- package/src/index.js +36 -58
- package/android/src/main/java/com/idnowreactidcheckio/bean/Theme.kt +0 -29
- package/android/src/main/java/com/idnowreactidcheckio/bean/ThemeEnum.kt +0 -13
- package/ios/IdnowReactIdcheckio-Bridging-Header.h +0 -2
- package/ios/IdnowReactIdcheckio.mm +0 -29
- package/ios/IdnowReactIdcheckio.swift +0 -131
- package/ios/Models/ThemeEnum.swift +0 -20
- package/ios/Models/ThemeReact.swift +0 -32
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import IDCheckIOSDK
|
|
3
|
+
import React
|
|
4
|
+
|
|
5
|
+
@objc(IDCheckIOBridgeModule)
|
|
6
|
+
class IDCheckIOBridgeModule: NSObject {
|
|
7
|
+
let tag = "IDnowReactIDCheckIO"
|
|
8
|
+
|
|
9
|
+
@objc
|
|
10
|
+
func preload(_ extractData: Bool) {
|
|
11
|
+
Task(priority: .userInitiated) { @MainActor in
|
|
12
|
+
Idcheckio.preload(extractData: extractData)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@objc
|
|
17
|
+
func activate(
|
|
18
|
+
_ token: String,
|
|
19
|
+
extractData: Bool,
|
|
20
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
21
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
22
|
+
) {
|
|
23
|
+
Task(priority: .userInitiated) { @MainActor in
|
|
24
|
+
do {
|
|
25
|
+
Idcheckio.framework = .reactNative
|
|
26
|
+
try await Idcheckio.activate(withToken: token, extractData: extractData)
|
|
27
|
+
print("[\(self.tag))] Initialization ended successfully !")
|
|
28
|
+
resolve(true)
|
|
29
|
+
} catch {
|
|
30
|
+
print("[\(self.tag))] Error occured on activation : \(error.localizedDescription)")
|
|
31
|
+
let jsonError = self.getErrorJson(error)
|
|
32
|
+
reject(self.tag, jsonError, error)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@objc
|
|
38
|
+
func startOnboarding(
|
|
39
|
+
_ folderUid: String,
|
|
40
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
41
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
42
|
+
) {
|
|
43
|
+
Task(priority: .userInitiated) { @MainActor in
|
|
44
|
+
do {
|
|
45
|
+
try await Idcheckio.startOnboarding(with: folderUid)
|
|
46
|
+
print("[\(self.tag))] Onboarding ended successfully")
|
|
47
|
+
resolve(true)
|
|
48
|
+
} catch {
|
|
49
|
+
print("[\(self.tag))] Error occured : \(error)")
|
|
50
|
+
let jsonError = self.getErrorJson(error)
|
|
51
|
+
reject(self.tag, jsonError, error)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@objc
|
|
57
|
+
func startSession(
|
|
58
|
+
_ onlineContext: [String: Any]?,
|
|
59
|
+
params: [String: Any],
|
|
60
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
61
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
62
|
+
) {
|
|
63
|
+
Task(priority: .userInitiated) { @MainActor in
|
|
64
|
+
let (sdkParams, sdkExtraParams) = Mapper.getIdcheckioParams(map: params)
|
|
65
|
+
let onlineContextJson = Mapper.dictionaryToJSONString(onlineContext ?? [:]) ?? ""
|
|
66
|
+
let onlineContextValue = OnlineContext.from(json: onlineContextJson)
|
|
67
|
+
do {
|
|
68
|
+
let idcheckioResult = try await Idcheckio.startSession(
|
|
69
|
+
onlineContext: onlineContextValue,
|
|
70
|
+
sdkParams: sdkParams,
|
|
71
|
+
sdkExtraParams: sdkExtraParams)
|
|
72
|
+
if let resultValue = idcheckioResult {
|
|
73
|
+
print("[\(self.tag))] Session ended successfully")
|
|
74
|
+
// Manage success
|
|
75
|
+
resolve(self.resultToJSON(resultValue))
|
|
76
|
+
} else {
|
|
77
|
+
print("[\(self.tag))] Session ended with empty result")
|
|
78
|
+
resolve("{}")
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
} catch {
|
|
82
|
+
print("[\(self.tag))] Error occured: \(error))")
|
|
83
|
+
let jsonError = self.getErrorJson(error)
|
|
84
|
+
reject(self.tag, jsonError, error)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// MARK: - Privates functions
|
|
90
|
+
private func resultToJSON(_ result: IdcheckioResult) -> String {
|
|
91
|
+
if let jsonData = try? JSONEncoder().encode(result) {
|
|
92
|
+
return String(data: jsonData, encoding: .utf8) ?? ""
|
|
93
|
+
} else {
|
|
94
|
+
return "{}"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private func getErrorJson(_ error: Error) -> String {
|
|
99
|
+
if let jsonData = try? JSONEncoder().encode(error as! IdcheckioError) {
|
|
100
|
+
return String(data: jsonData, encoding: .utf8) ?? ""
|
|
101
|
+
} else {
|
|
102
|
+
return
|
|
103
|
+
"{\"message\":\"Internal error.\",\"details\":\"INTERNAL_ERROR\",\"cause\":\"INTERNAL_ERROR\"}"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
package/ios/Utils/Mapper.swift
CHANGED
|
@@ -9,43 +9,17 @@ import Foundation
|
|
|
9
9
|
import IDCheckIOSDK
|
|
10
10
|
|
|
11
11
|
class Mapper {
|
|
12
|
-
/**
|
|
13
|
-
* Retrieve an [OnboardingCustomization] from a Map.
|
|
14
|
-
* @param map the map containing all the colors.
|
|
15
|
-
* @return the onboardingCustomization to apply.
|
|
16
|
-
*/
|
|
17
|
-
static func getOnboardingCustomizationFromReadableMap(map: Dictionary<String, String>) -> OnboardingCustomization {
|
|
18
|
-
return OnboardingCustomization(theme: getThemeFromReadableMap(map: map))
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Retrieve a [Theme] from a Map.
|
|
23
|
-
* @param map the map containing all the colors.
|
|
24
|
-
* @return the theme to apply.
|
|
25
|
-
*/
|
|
26
|
-
static func getThemeFromReadableMap(map: Dictionary<String, String?>?) -> Theme {
|
|
27
|
-
let reactTheme = ThemeReact(foregroundColor: map?[ThemeEnum.FOREGROUND_COLOR.rawValue] ?? "",
|
|
28
|
-
borderColor: map?[ThemeEnum.BORDER_COLOR.rawValue] ?? "",
|
|
29
|
-
backgroundColor: map?[ThemeEnum.BACKGROUND_COLOR.rawValue] ?? "",
|
|
30
|
-
primaryColor: map?[ThemeEnum.PRIMARY_COLOR.rawValue] ?? "",
|
|
31
|
-
titleColor: map?[ThemeEnum.TITLE_COLOR.rawValue] ?? "",
|
|
32
|
-
textColor: map?[ThemeEnum.TEXT_COLOR.rawValue] ?? "")
|
|
33
|
-
return reactTheme.toIDCheckioTheme()
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
12
|
/**
|
|
38
13
|
* Retrieve a SDKParams and a SDKExtraParams from a Map.
|
|
39
14
|
* @param map the map containing all the parameters.
|
|
40
15
|
* @return the params completed.
|
|
41
16
|
*/
|
|
42
|
-
static func getIdcheckioParams(map:
|
|
17
|
+
static func getIdcheckioParams(map: [String: Any?]?) -> (SDKParams, SDKExtraParams) {
|
|
43
18
|
// SDK Params
|
|
44
19
|
let sdkParams = SDKParams()
|
|
45
20
|
let confirmTypeValue = map?[ParamsEnum.confirmationType.rawValue] as? String
|
|
46
21
|
sdkParams.confirmType = ConfirmationType(rawValue: confirmTypeValue ?? "") ?? .none
|
|
47
22
|
sdkParams.useHD = map?[ParamsEnum.useHd.rawValue] as? Bool ?? false
|
|
48
|
-
sdkParams.overrideWordings = map?[ParamsEnum.overrideWordings.rawValue] as? [String: String]? ?? nil
|
|
49
23
|
let documentType = map?[ParamsEnum.docType.rawValue] as? String
|
|
50
24
|
sdkParams.documentType = DocumentType(rawValue: documentType ?? "") ?? .disabled
|
|
51
25
|
let mapExtraction1 = map?[ParamsEnum.sideOneExtraction.rawValue] as? [String: Any?]
|
|
@@ -62,17 +36,18 @@ class Mapper {
|
|
|
62
36
|
// SDK Extra Params
|
|
63
37
|
let sdkExtraParams = SDKExtraParams()
|
|
64
38
|
let languageValue = map?[ParamsEnum.language.rawValue] as? String
|
|
65
|
-
sdkExtraParams.
|
|
39
|
+
sdkExtraParams.language = Language(rawValue: languageValue ?? "")
|
|
66
40
|
let manualButtonValue = map?[ParamsEnum.manualButtonTimer.rawValue] as? Double
|
|
67
41
|
sdkExtraParams.manualButtonTimer = manualButtonValue ?? 10
|
|
68
42
|
let sizeValue = map?[ParamsEnum.maxPictureFilesize.rawValue] as? String
|
|
69
|
-
sdkExtraParams.
|
|
43
|
+
sdkExtraParams.maxPictureFilesize =
|
|
44
|
+
FileSize(rawValue: sizeValue ?? "") ?? FileSize.fourMegaBytes
|
|
70
45
|
let confirmAbortValue = map?[ParamsEnum.confirmAbort.rawValue] as? Bool
|
|
71
46
|
sdkExtraParams.confirmAbort = confirmAbortValue ?? false
|
|
72
47
|
let adjustCropValue = map?[ParamsEnum.adjustCrop.rawValue] as? Bool
|
|
73
48
|
sdkExtraParams.adjustCrop = adjustCropValue ?? false
|
|
74
49
|
let captureMode = map?[ParamsEnum.captureMode.rawValue] as? String
|
|
75
|
-
sdkExtraParams.
|
|
50
|
+
sdkExtraParams.captureMode = CaptureMode(rawValue: captureMode ?? "") ?? CaptureMode.camera
|
|
76
51
|
|
|
77
52
|
return (sdkParams, sdkExtraParams)
|
|
78
53
|
}
|
|
@@ -89,7 +64,8 @@ class Mapper {
|
|
|
89
64
|
|
|
90
65
|
// Attempt to serialize the dictionary to JSON data
|
|
91
66
|
do {
|
|
92
|
-
let jsonData = try JSONSerialization.data(
|
|
67
|
+
let jsonData = try JSONSerialization.data(
|
|
68
|
+
withJSONObject: jsonCompatibleDict, options: [])
|
|
93
69
|
// Convert JSON data to a string
|
|
94
70
|
return String(data: jsonData, encoding: .utf8)
|
|
95
71
|
} catch {
|
|
@@ -103,11 +79,12 @@ class Mapper {
|
|
|
103
79
|
* @param map the map containing all the extraction values.
|
|
104
80
|
* @return the extraction completed.
|
|
105
81
|
*/
|
|
106
|
-
private static func getExtraction(map:
|
|
82
|
+
private static func getExtraction(map: [String: Any?]?) -> Extraction {
|
|
107
83
|
let dataRequirementValue = map?[ExtractionEnum.codeline.rawValue] as? String ?? ""
|
|
108
84
|
let faceDetectionValue = map?[ExtractionEnum.faceDetection.rawValue] as? String ?? ""
|
|
109
|
-
let extractionReact = ExtractionReact(
|
|
110
|
-
|
|
85
|
+
let extractionReact = ExtractionReact(
|
|
86
|
+
codeline: Extraction.DataRequirement(rawValue: dataRequirementValue),
|
|
87
|
+
face: Extraction.FaceDetection(rawValue: faceDetectionValue))
|
|
111
88
|
return extractionReact.toExtraction()
|
|
112
89
|
}
|
|
113
90
|
|
|
@@ -116,11 +93,12 @@ class Mapper {
|
|
|
116
93
|
* @param map the map containing all the integrity check values.
|
|
117
94
|
* @return the integrityCheck completed.
|
|
118
95
|
*/
|
|
119
|
-
private static func getIntegrityCheck(map:
|
|
96
|
+
private static func getIntegrityCheck(map: [String: Any?]?) -> IntegrityCheck {
|
|
120
97
|
let readEmrtdValue = map?[IntegrityCheckEnum.readEmrtd.rawValue] as? Bool
|
|
121
98
|
let docLivenessValue = map?[IntegrityCheckEnum.docLiveness.rawValue] as? Bool
|
|
122
|
-
let integrityCheckReact = IntegrityCheckReact(
|
|
123
|
-
|
|
99
|
+
let integrityCheckReact = IntegrityCheckReact(
|
|
100
|
+
readEmrtd: readEmrtdValue,
|
|
101
|
+
docLiveness: docLivenessValue)
|
|
124
102
|
return integrityCheckReact.toIntegrityCheck()
|
|
125
103
|
}
|
|
126
104
|
|
|
@@ -129,7 +107,7 @@ class Mapper {
|
|
|
129
107
|
* @param map the map containing all the online config values.
|
|
130
108
|
* @return the onlineConfig completed.
|
|
131
109
|
*/
|
|
132
|
-
private static func getOnlineConfig(map:
|
|
110
|
+
private static func getOnlineConfig(map: [String: Any?]?) -> OnlineConfig {
|
|
133
111
|
let jsonData = (dictionaryToJSONString(map ?? [:]) ?? "").data(using: .utf8)!
|
|
134
112
|
guard let onlineConfig = try? JSONDecoder().decode(OnlineConfig.self, from: jsonData) else {
|
|
135
113
|
fatalError("Cannot convert to onlineConfig")
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idnow/react-idcheckio",
|
|
3
3
|
"title": "IDCheckIO SDK ReactNative",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.1.0",
|
|
5
5
|
"description": "React Native plugin for IDCheck.io Mobile SDK",
|
|
6
6
|
"homepage": "https://www.idnow.io/",
|
|
7
7
|
"react-native": "src/index",
|
|
@@ -17,9 +17,13 @@
|
|
|
17
17
|
"resolutions": {
|
|
18
18
|
"@types/react": "^18.2.44"
|
|
19
19
|
},
|
|
20
|
+
"app": {
|
|
21
|
+
"plugin": "./app.plugin.js"
|
|
22
|
+
},
|
|
20
23
|
"peerDependencies": {
|
|
21
24
|
"react": "19.1.0",
|
|
22
|
-
"react-native": "0.81.5"
|
|
25
|
+
"react-native": "0.81.5",
|
|
26
|
+
"expo": "54.0.0"
|
|
23
27
|
},
|
|
24
28
|
"packageManager": "yarn@3.6.1"
|
|
25
|
-
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// plugins/addSPMDependency.js
|
|
2
|
+
const { withXcodeProject } = require('@expo/config-plugins');
|
|
3
|
+
|
|
4
|
+
const addSPMDependency = (config, options) =>
|
|
5
|
+
withXcodeProject(config, (config) => {
|
|
6
|
+
const { version, repositoryUrl, repoName, productName } = options;
|
|
7
|
+
const xcodeProject = config.modResults;
|
|
8
|
+
|
|
9
|
+
// === STEP 1 : XCRemoteSwiftPackageReference ===
|
|
10
|
+
if (!xcodeProject.hash.project.objects['XCRemoteSwiftPackageReference']) {
|
|
11
|
+
xcodeProject.hash.project.objects['XCRemoteSwiftPackageReference'] = {};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const packageReferenceUUID = xcodeProject.generateUuid();
|
|
15
|
+
|
|
16
|
+
xcodeProject.hash.project.objects['XCRemoteSwiftPackageReference'][
|
|
17
|
+
`${packageReferenceUUID} /* XCRemoteSwiftPackageReference "${repoName}" */`
|
|
18
|
+
] = {
|
|
19
|
+
isa: 'XCRemoteSwiftPackageReference',
|
|
20
|
+
repositoryURL: repositoryUrl,
|
|
21
|
+
requirement: {
|
|
22
|
+
kind: 'upToNextMajorVersion',
|
|
23
|
+
minimumVersion: version,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// === STEP 2 : XCSwiftPackageProductDependency ===
|
|
28
|
+
if (!xcodeProject.hash.project.objects['XCSwiftPackageProductDependency']) {
|
|
29
|
+
xcodeProject.hash.project.objects['XCSwiftPackageProductDependency'] = {};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const packageUUID = xcodeProject.generateUuid();
|
|
33
|
+
|
|
34
|
+
xcodeProject.hash.project.objects['XCSwiftPackageProductDependency'][
|
|
35
|
+
`${packageUUID} /* ${productName} */`
|
|
36
|
+
] = {
|
|
37
|
+
isa: 'XCSwiftPackageProductDependency',
|
|
38
|
+
package: `${packageReferenceUUID} /* XCRemoteSwiftPackageReference "${repoName}" */`,
|
|
39
|
+
productName: productName,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// === STEP 3 : PBXProject — packageReferences ===
|
|
43
|
+
const projectId = Object.keys(
|
|
44
|
+
xcodeProject.hash.project.objects['PBXProject']
|
|
45
|
+
).at(0);
|
|
46
|
+
|
|
47
|
+
if (
|
|
48
|
+
!xcodeProject.hash.project.objects['PBXProject'][projectId][
|
|
49
|
+
'packageReferences'
|
|
50
|
+
]
|
|
51
|
+
) {
|
|
52
|
+
xcodeProject.hash.project.objects['PBXProject'][projectId][
|
|
53
|
+
'packageReferences'
|
|
54
|
+
] = [];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
xcodeProject.hash.project.objects['PBXProject'][projectId][
|
|
58
|
+
'packageReferences'
|
|
59
|
+
].push(
|
|
60
|
+
`${packageReferenceUUID} /* XCRemoteSwiftPackageReference "${repoName}" */`
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// === STEP 4 : PBXBuildFile ===
|
|
64
|
+
const frameworkUUID = xcodeProject.generateUuid();
|
|
65
|
+
|
|
66
|
+
xcodeProject.hash.project.objects['PBXBuildFile'][
|
|
67
|
+
`${frameworkUUID}_comment`
|
|
68
|
+
] = `${productName} in Frameworks`;
|
|
69
|
+
|
|
70
|
+
xcodeProject.hash.project.objects['PBXBuildFile'][frameworkUUID] = {
|
|
71
|
+
isa: 'PBXBuildFile',
|
|
72
|
+
productRef: packageUUID,
|
|
73
|
+
productRef_comment: productName,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// === STEP 5 : PBXFrameworksBuildPhase ===
|
|
77
|
+
const buildPhaseId = Object.keys(
|
|
78
|
+
xcodeProject.hash.project.objects['PBXFrameworksBuildPhase']
|
|
79
|
+
).at(0);
|
|
80
|
+
|
|
81
|
+
if (
|
|
82
|
+
!xcodeProject.hash.project.objects['PBXFrameworksBuildPhase'][
|
|
83
|
+
buildPhaseId
|
|
84
|
+
]['files']
|
|
85
|
+
) {
|
|
86
|
+
xcodeProject.hash.project.objects['PBXFrameworksBuildPhase'][
|
|
87
|
+
buildPhaseId
|
|
88
|
+
]['files'] = [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
xcodeProject.hash.project.objects['PBXFrameworksBuildPhase'][buildPhaseId][
|
|
92
|
+
'files'
|
|
93
|
+
].push(`${frameworkUUID} /* ${productName} in Frameworks */`);
|
|
94
|
+
|
|
95
|
+
// === STEP 6 : PBXNativeTarget — packageProductDependencies ===
|
|
96
|
+
const nativeTargets = xcodeProject.hash.project.objects['PBXNativeTarget'];
|
|
97
|
+
const nativeTargetKeys = Object.keys(nativeTargets).filter(
|
|
98
|
+
(key) => !key.endsWith('_comment')
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const mainTargetId = nativeTargetKeys.find(
|
|
102
|
+
(key) =>
|
|
103
|
+
nativeTargets[key].productType ===
|
|
104
|
+
'"com.apple.product-type.application"'
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
if (mainTargetId) {
|
|
108
|
+
if (!nativeTargets[mainTargetId]['packageProductDependencies']) {
|
|
109
|
+
nativeTargets[mainTargetId]['packageProductDependencies'] = [];
|
|
110
|
+
}
|
|
111
|
+
nativeTargets[mainTargetId]['packageProductDependencies'].push(
|
|
112
|
+
`${packageUUID} /* ${productName} */`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return config;
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
module.exports = addSPMDependency;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
const { withDangerousMod, withXcodeProject } = require('@expo/config-plugins');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
const copyNativeFiles = (config) => {
|
|
6
|
+
config = withDangerousMod(config, [
|
|
7
|
+
'ios',
|
|
8
|
+
(config) => {
|
|
9
|
+
const projectName = config.modRequest.projectName;
|
|
10
|
+
const destDir = path.join(config.modRequest.platformProjectRoot, projectName);
|
|
11
|
+
|
|
12
|
+
const packageDir = path.dirname(
|
|
13
|
+
require.resolve('@idnow/react-idcheckio/package.json', {
|
|
14
|
+
paths: [config.modRequest.projectRoot],
|
|
15
|
+
})
|
|
16
|
+
);
|
|
17
|
+
const srcDir = path.join(packageDir, 'ios');
|
|
18
|
+
|
|
19
|
+
const filesToCopy = [
|
|
20
|
+
'IDCheckIOBridgeModule.swift',
|
|
21
|
+
'IDCheckIOBridgeModule.m',
|
|
22
|
+
'Utils/Mapper.swift',
|
|
23
|
+
'Models/ExtractionEnum.swift',
|
|
24
|
+
'Models/ExtractionReact.swift',
|
|
25
|
+
'Models/IntegrityCheckEnum.swift',
|
|
26
|
+
'Models/IntegrityCheckReact.swift',
|
|
27
|
+
'Models/OnlineConfigEnum.swift',
|
|
28
|
+
'Models/ParamsEnum.swift'
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const utilsDestDir = path.join(destDir, 'Utils');
|
|
32
|
+
if (!fs.existsSync(utilsDestDir)) {
|
|
33
|
+
fs.mkdirSync(utilsDestDir, { recursive: true });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const modelsDestDir = path.join(destDir, 'Models');
|
|
37
|
+
if (!fs.existsSync(modelsDestDir)) {
|
|
38
|
+
fs.mkdirSync(modelsDestDir, { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
filesToCopy.forEach((file) => {
|
|
42
|
+
const src = path.join(srcDir, file);
|
|
43
|
+
const dest = path.join(destDir, file);
|
|
44
|
+
if (fs.existsSync(src)) {
|
|
45
|
+
fs.copyFileSync(src, dest);
|
|
46
|
+
console.log(`[IDCheckIO] Copied ${file} to ${dest}`);
|
|
47
|
+
} else {
|
|
48
|
+
console.warn(`[IDCheckIO] Source file not found: ${src}`);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return config;
|
|
53
|
+
},
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
config = withXcodeProject(config, (config) => {
|
|
57
|
+
const xcodeProject = config.modResults;
|
|
58
|
+
const projectName = config.modRequest.projectName;
|
|
59
|
+
|
|
60
|
+
const filesToAdd = [
|
|
61
|
+
{ name: 'IDCheckIOBridgeModule.swift', type: 'sourcecode.swift', localPath: 'IDCheckIOBridgeModule.swift' },
|
|
62
|
+
{ name: 'IDCheckIOBridgeModule.m', type: 'sourcecode.c.objc', localPath: 'IDCheckIOBridgeModule.m' },
|
|
63
|
+
{ name: 'Mapper.swift', type: 'sourcecode.swift', localPath: 'Utils/Mapper.swift' },
|
|
64
|
+
{ name: 'ExtractionEnum.swift', type: 'sourcecode.swift', localPath: 'Models/ExtractionEnum.swift' },
|
|
65
|
+
{ name: 'ExtractionReact.swift', type: 'sourcecode.swift', localPath: 'Models/ExtractionReact.swift' },
|
|
66
|
+
{ name: 'IntegrityCheckEnum.swift', type: 'sourcecode.swift', localPath: 'Models/IntegrityCheckEnum.swift' },
|
|
67
|
+
{ name: 'IntegrityCheckReact.swift', type: 'sourcecode.swift', localPath: 'Models/IntegrityCheckReact.swift' },
|
|
68
|
+
{ name: 'OnlineConfigEnum.swift', type: 'sourcecode.swift', localPath: 'Models/OnlineConfigEnum.swift' },
|
|
69
|
+
{ name: 'ParamsEnum.swift', type: 'sourcecode.swift', localPath: 'Models/ParamsEnum.swift' },
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
const nativeTargets = xcodeProject.hash.project.objects['PBXNativeTarget'];
|
|
73
|
+
const mainTargetKey = Object.keys(nativeTargets).find(
|
|
74
|
+
(key) =>
|
|
75
|
+
!key.endsWith('_comment') &&
|
|
76
|
+
nativeTargets[key].productType === '"com.apple.product-type.application"'
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
if (!mainTargetKey) return config;
|
|
80
|
+
|
|
81
|
+
const groups = xcodeProject.hash.project.objects['PBXGroup'];
|
|
82
|
+
const projectGroupKey = Object.keys(groups).find(
|
|
83
|
+
(key) =>
|
|
84
|
+
!key.endsWith('_comment') &&
|
|
85
|
+
(groups[key].name === projectName ||
|
|
86
|
+
groups[key].path === `"${projectName}"` ||
|
|
87
|
+
groups[key].path === projectName)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const sourcesBuildPhases = xcodeProject.hash.project.objects['PBXSourcesBuildPhase'];
|
|
91
|
+
const sourcePhaseKey = Object.keys(sourcesBuildPhases).find(
|
|
92
|
+
(key) => !key.endsWith('_comment')
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
filesToAdd.forEach(({ name, type, localPath }) => {
|
|
96
|
+
const fileRefUUID = xcodeProject.generateUuid();
|
|
97
|
+
xcodeProject.hash.project.objects['PBXFileReference'][fileRefUUID] = {
|
|
98
|
+
isa: 'PBXFileReference',
|
|
99
|
+
lastKnownFileType: type,
|
|
100
|
+
name: name,
|
|
101
|
+
path: `${projectName}/${localPath}`,
|
|
102
|
+
sourceTree: '"<group>"',
|
|
103
|
+
};
|
|
104
|
+
xcodeProject.hash.project.objects['PBXFileReference'][`${fileRefUUID}_comment`] = name;
|
|
105
|
+
|
|
106
|
+
if (projectGroupKey && groups[projectGroupKey].children) {
|
|
107
|
+
groups[projectGroupKey].children.push({
|
|
108
|
+
value: fileRefUUID,
|
|
109
|
+
comment: name,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const buildFileUUID = xcodeProject.generateUuid();
|
|
114
|
+
xcodeProject.hash.project.objects['PBXBuildFile'][buildFileUUID] = {
|
|
115
|
+
isa: 'PBXBuildFile',
|
|
116
|
+
fileRef: fileRefUUID,
|
|
117
|
+
fileRef_comment: name,
|
|
118
|
+
};
|
|
119
|
+
xcodeProject.hash.project.objects['PBXBuildFile'][`${buildFileUUID}_comment`] = `${name} in Sources`;
|
|
120
|
+
|
|
121
|
+
if (sourcePhaseKey) {
|
|
122
|
+
sourcesBuildPhases[sourcePhaseKey].files.push({
|
|
123
|
+
value: buildFileUUID,
|
|
124
|
+
comment: `${name} in Sources`,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
return config;
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
return config;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
module.exports = copyNativeFiles;
|
package/release-public.sh
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
PACKAGE_VERSION=$(node -p -e "require('./package.json').version")
|
|
15
15
|
|
|
16
16
|
# Don't modify theses two variables!
|
|
17
|
-
current_android_version="
|
|
18
|
-
current_ios_version="
|
|
17
|
+
current_android_version="9.1.0"
|
|
18
|
+
current_ios_version="9.1.0"
|
|
19
19
|
|
|
20
20
|
# Read version wanted from input
|
|
21
21
|
android_value=""
|
package/src/index.d.ts
CHANGED
|
@@ -20,27 +20,25 @@ export function activate(token: string, extractData: boolean): Promise<void>;
|
|
|
20
20
|
* Start an onboarding session with the given folder uid.
|
|
21
21
|
*
|
|
22
22
|
* @param folderUid - The folder that will be used to run the session.
|
|
23
|
-
* @param theme - A theme to customize SDK colors.
|
|
24
23
|
* @returns Void on success.
|
|
25
24
|
* @throws An error of type {@link IDCheckioError} if the session fails.
|
|
26
25
|
*/
|
|
27
|
-
export function startOnboarding(folderUid: string
|
|
26
|
+
export function startOnboarding(folderUid: string): Promise<void>;
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* Start the capture of one document with the given parameters.
|
|
31
|
-
*
|
|
32
|
-
* @param parameters - The parameters to configure the capture session.
|
|
30
|
+
*
|
|
33
31
|
* @param onlineContext - Online context. Let it null and the first capture and send the one you receive on result to chain to capture.
|
|
34
|
-
* @param
|
|
32
|
+
* @param parameters - The parameters to configure the capture session.
|
|
35
33
|
* @returns {@link IDCheckioResult}
|
|
36
34
|
* @throws An error of type {@link IDCheckioError} if the capture fails.
|
|
37
35
|
*/
|
|
38
|
-
export function
|
|
36
|
+
export function startSession(onlineContext: IDCheckioOnlineContext | null, parameters: IDCheckioParams): Promise<IDCheckioResult>;
|
|
39
37
|
|
|
40
38
|
/**
|
|
41
39
|
* Used to store all the parameters used for a capture.
|
|
42
40
|
*/
|
|
43
|
-
export class IDCheckioParams {}
|
|
41
|
+
export class IDCheckioParams { }
|
|
44
42
|
|
|
45
43
|
/**
|
|
46
44
|
* Simplify the creation of an {@link IDCheckioParams} with the Buidler pattern.
|
|
@@ -61,7 +59,6 @@ export class IDCheckioParamsBuilder {
|
|
|
61
59
|
setToken(token: string): this;
|
|
62
60
|
setConfirmAbort(confirmAbort: boolean): this;
|
|
63
61
|
setOnlineConfig(onlineConfig: OnlineConfig): this;
|
|
64
|
-
setOverrideWordings(overrideWordings: Map<string, string>): this;
|
|
65
62
|
build(): IDCheckioParams;
|
|
66
63
|
}
|
|
67
64
|
|
|
@@ -107,30 +104,6 @@ export class OnlineConfig {
|
|
|
107
104
|
})
|
|
108
105
|
}
|
|
109
106
|
|
|
110
|
-
export class IDCheckTheme {
|
|
111
|
-
public primaryColor?: string | null;
|
|
112
|
-
public foregroundColor?: string | null;
|
|
113
|
-
public backgroundColor?: string | null;
|
|
114
|
-
public borderColor?: string | null;
|
|
115
|
-
public textColor?: string | null;
|
|
116
|
-
public titleColor?: string | null;
|
|
117
|
-
constructor({
|
|
118
|
-
primaryColor = null,
|
|
119
|
-
foregroundColor = null,
|
|
120
|
-
backgroundColor = null,
|
|
121
|
-
borderColor = null,
|
|
122
|
-
textColor = null,
|
|
123
|
-
titleColor = null
|
|
124
|
-
}: {
|
|
125
|
-
primaryColor?: string | null,
|
|
126
|
-
foregroundColor?: string | null,
|
|
127
|
-
backgroundColor?: string | null,
|
|
128
|
-
borderColor?: string | null,
|
|
129
|
-
textColor?: string | null,
|
|
130
|
-
titleColor?: string | null
|
|
131
|
-
})
|
|
132
|
-
}
|
|
133
|
-
|
|
134
107
|
export enum DocumentType {
|
|
135
108
|
DISABLED = 'DISABLED',
|
|
136
109
|
ID = 'ID',
|
|
@@ -238,7 +211,7 @@ export type IDCheckioError = {
|
|
|
238
211
|
message?: string | undefined;
|
|
239
212
|
};
|
|
240
213
|
|
|
241
|
-
export type IDCheckioLivenessStatus =
|
|
214
|
+
export type IDCheckioLivenessStatus =
|
|
242
215
|
| 'AVAILABLE'
|
|
243
216
|
| 'NO_FACE_ON_DOCUMENT'
|
|
244
217
|
| 'UNAVAILABLE';
|