@idnow/react-idcheckio 8.1.9 → 9.0.3

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 (29) hide show
  1. package/README.md +2 -2
  2. package/android/build.gradle +2 -2
  3. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  4. package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  5. package/android/src/main/java/com/idnowreactidcheckio/{IdnowReactIdcheckioModule.kt → IDCheckIOBridgeModule.kt} +23 -27
  6. package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioActivity.kt +17 -15
  7. package/android/src/main/java/com/idnowreactidcheckio/IdnowReactIdcheckioPackage.kt +1 -1
  8. package/android/src/main/java/com/idnowreactidcheckio/bean/ExtractionReact.kt +4 -4
  9. package/android/src/main/java/com/idnowreactidcheckio/bean/IntegrityCheckReact.kt +2 -2
  10. package/android/src/main/java/com/idnowreactidcheckio/bean/OnlineContextEnum.kt +9 -0
  11. package/android/src/main/java/com/idnowreactidcheckio/utils/Mapper.kt +17 -52
  12. package/app.plugin.js +19 -0
  13. package/idnow-react-idcheckio.podspec +5 -24
  14. package/ios/IDCheckIOBridgeModule.m +29 -0
  15. package/ios/IDCheckIOBridgeModule.swift +106 -0
  16. package/ios/Utils/Mapper.swift +18 -38
  17. package/package.json +7 -3
  18. package/plugins/addSPMDependency.js +119 -0
  19. package/plugins/copyNativeFiles.js +135 -0
  20. package/release-public.sh +2 -2
  21. package/src/index.d.ts +6 -30
  22. package/src/index.js +50 -48
  23. package/android/src/main/java/com/idnowreactidcheckio/bean/Theme.kt +0 -29
  24. package/android/src/main/java/com/idnowreactidcheckio/bean/ThemeEnum.kt +0 -13
  25. package/ios/IdnowReactIdcheckio-Bridging-Header.h +0 -2
  26. package/ios/IdnowReactIdcheckio.mm +0 -29
  27. package/ios/IdnowReactIdcheckio.swift +0 -131
  28. package/ios/Models/ThemeEnum.swift +0 -20
  29. package/ios/Models/ThemeReact.swift +0 -32
@@ -9,43 +9,19 @@ 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: Dictionary<String, Any?>?) -> (SDKParams, SDKExtraParams) {
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
23
+ sdkParams.overrideWordings =
24
+ map?[ParamsEnum.overrideWordings.rawValue] as? [String: String]? ?? nil
49
25
  let documentType = map?[ParamsEnum.docType.rawValue] as? String
50
26
  sdkParams.documentType = DocumentType(rawValue: documentType ?? "") ?? .disabled
51
27
  let mapExtraction1 = map?[ParamsEnum.sideOneExtraction.rawValue] as? [String: Any?]
@@ -62,17 +38,18 @@ class Mapper {
62
38
  // SDK Extra Params
63
39
  let sdkExtraParams = SDKExtraParams()
64
40
  let languageValue = map?[ParamsEnum.language.rawValue] as? String
65
- sdkExtraParams.setLanguage(languageValue ?? "")
41
+ sdkExtraParams.language = Language(rawValue: languageValue ?? "")
66
42
  let manualButtonValue = map?[ParamsEnum.manualButtonTimer.rawValue] as? Double
67
43
  sdkExtraParams.manualButtonTimer = manualButtonValue ?? 10
68
44
  let sizeValue = map?[ParamsEnum.maxPictureFilesize.rawValue] as? String
69
- sdkExtraParams.setMaxPictureFilesize(sizeValue ?? "\(FileSize.fourMegaBytes.rawValue)")
45
+ sdkExtraParams.maxPictureFilesize =
46
+ FileSize(rawValue: sizeValue ?? "") ?? FileSize.fourMegaBytes
70
47
  let confirmAbortValue = map?[ParamsEnum.confirmAbort.rawValue] as? Bool
71
48
  sdkExtraParams.confirmAbort = confirmAbortValue ?? false
72
49
  let adjustCropValue = map?[ParamsEnum.adjustCrop.rawValue] as? Bool
73
50
  sdkExtraParams.adjustCrop = adjustCropValue ?? false
74
51
  let captureMode = map?[ParamsEnum.captureMode.rawValue] as? String
75
- sdkExtraParams.setCaptureMode(captureMode ?? "camera")
52
+ sdkExtraParams.captureMode = CaptureMode(rawValue: captureMode ?? "") ?? CaptureMode.camera
76
53
 
77
54
  return (sdkParams, sdkExtraParams)
78
55
  }
@@ -89,7 +66,8 @@ class Mapper {
89
66
 
90
67
  // Attempt to serialize the dictionary to JSON data
91
68
  do {
92
- let jsonData = try JSONSerialization.data(withJSONObject: jsonCompatibleDict, options: [])
69
+ let jsonData = try JSONSerialization.data(
70
+ withJSONObject: jsonCompatibleDict, options: [])
93
71
  // Convert JSON data to a string
94
72
  return String(data: jsonData, encoding: .utf8)
95
73
  } catch {
@@ -103,11 +81,12 @@ class Mapper {
103
81
  * @param map the map containing all the extraction values.
104
82
  * @return the extraction completed.
105
83
  */
106
- private static func getExtraction(map: Dictionary<String, Any?>?) -> Extraction {
84
+ private static func getExtraction(map: [String: Any?]?) -> Extraction {
107
85
  let dataRequirementValue = map?[ExtractionEnum.codeline.rawValue] as? String ?? ""
108
86
  let faceDetectionValue = map?[ExtractionEnum.faceDetection.rawValue] as? String ?? ""
109
- let extractionReact = ExtractionReact(codeline: Extraction.DataRequirement(rawValue: dataRequirementValue),
110
- face: Extraction.FaceDetection(rawValue: faceDetectionValue))
87
+ let extractionReact = ExtractionReact(
88
+ codeline: Extraction.DataRequirement(rawValue: dataRequirementValue),
89
+ face: Extraction.FaceDetection(rawValue: faceDetectionValue))
111
90
  return extractionReact.toExtraction()
112
91
  }
113
92
 
@@ -116,11 +95,12 @@ class Mapper {
116
95
  * @param map the map containing all the integrity check values.
117
96
  * @return the integrityCheck completed.
118
97
  */
119
- private static func getIntegrityCheck(map: Dictionary<String, Any?>?) -> IntegrityCheck {
98
+ private static func getIntegrityCheck(map: [String: Any?]?) -> IntegrityCheck {
120
99
  let readEmrtdValue = map?[IntegrityCheckEnum.readEmrtd.rawValue] as? Bool
121
100
  let docLivenessValue = map?[IntegrityCheckEnum.docLiveness.rawValue] as? Bool
122
- let integrityCheckReact = IntegrityCheckReact(readEmrtd: readEmrtdValue,
123
- docLiveness: docLivenessValue)
101
+ let integrityCheckReact = IntegrityCheckReact(
102
+ readEmrtd: readEmrtdValue,
103
+ docLiveness: docLivenessValue)
124
104
  return integrityCheckReact.toIntegrityCheck()
125
105
  }
126
106
 
@@ -129,7 +109,7 @@ class Mapper {
129
109
  * @param map the map containing all the online config values.
130
110
  * @return the onlineConfig completed.
131
111
  */
132
- private static func getOnlineConfig(map: Dictionary<String, Any?>?) -> OnlineConfig {
112
+ private static func getOnlineConfig(map: [String: Any?]?) -> OnlineConfig {
133
113
  let jsonData = (dictionaryToJSONString(map ?? [:]) ?? "").data(using: .utf8)!
134
114
  guard let onlineConfig = try? JSONDecoder().decode(OnlineConfig.self, from: jsonData) else {
135
115
  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": "8.1.9",
4
+ "version": "9.0.3",
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="8.1.9"
18
- current_ios_version="8.1.9"
17
+ current_android_version="9.0.3"
18
+ current_ios_version="9.0.3"
19
19
 
20
20
  # Read version wanted from input
21
21
  android_value=""
package/src/index.d.ts CHANGED
@@ -24,23 +24,23 @@ export function activate(token: string, extractData: boolean): Promise<void>;
24
24
  * @returns Void on success.
25
25
  * @throws An error of type {@link IDCheckioError} if the session fails.
26
26
  */
27
- export function startOnboarding(folderUid: string, theme: IDCheckTheme | null): Promise<void>;
27
+ export function startOnboarding(folderUid: string): Promise<void>;
28
28
 
29
29
  /**
30
30
  * Start the capture of one document with the given parameters.
31
- * s
32
- * @param parameters - The parameters to configure the capture session.
31
+ *
33
32
  * @param onlineContext - Online context. Let it null and the first capture and send the one you receive on result to chain to capture.
33
+ * @param parameters - The parameters to configure the capture session.
34
34
  * @param theme - A theme to customize SDK colors.
35
35
  * @returns {@link IDCheckioResult}
36
36
  * @throws An error of type {@link IDCheckioError} if the capture fails.
37
37
  */
38
- export function start(parameters: IDCheckioParams, onlineContext: IDCheckioOnlineContext | null, theme: IDCheckTheme | null): Promise<IDCheckioResult>;
38
+ export function startSession(onlineContext: IDCheckioOnlineContext | null, parameters: IDCheckioParams): Promise<IDCheckioResult>;
39
39
 
40
40
  /**
41
41
  * Used to store all the parameters used for a capture.
42
42
  */
43
- export class IDCheckioParams {}
43
+ export class IDCheckioParams { }
44
44
 
45
45
  /**
46
46
  * Simplify the creation of an {@link IDCheckioParams} with the Buidler pattern.
@@ -107,30 +107,6 @@ export class OnlineConfig {
107
107
  })
108
108
  }
109
109
 
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
110
  export enum DocumentType {
135
111
  DISABLED = 'DISABLED',
136
112
  ID = 'ID',
@@ -238,7 +214,7 @@ export type IDCheckioError = {
238
214
  message?: string | undefined;
239
215
  };
240
216
 
241
- export type IDCheckioLivenessStatus =
217
+ export type IDCheckioLivenessStatus =
242
218
  | 'AVAILABLE'
243
219
  | 'NO_FACE_ON_DOCUMENT'
244
220
  | 'UNAVAILABLE';
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
+ const { IDCheckIOBridgeModule } = NativeModules;
2
3
 
3
4
  const LINKING_ERROR =
4
5
  `The package '@idnow/react-idcheckio' doesn't seem to be linked. Make sure: \n\n` +
@@ -6,61 +7,61 @@ const LINKING_ERROR =
6
7
  '- You rebuilt the app after installing the package\n' +
7
8
  '- You are not using Expo Go\n';
8
9
 
9
- const IdnowReactIdcheckio = NativeModules.IdnowReactIdcheckio
10
- ? NativeModules.IdnowReactIdcheckio
10
+ const IdnowReactIdcheckio = NativeModules.IDCheckIOBridgeModule
11
+ ? NativeModules.IDCheckIOBridgeModule
11
12
  : new Proxy(
12
- {},
13
- {
14
- get() {
15
- throw new Error(LINKING_ERROR);
16
- },
17
- }
18
- );
13
+ {},
14
+ {
15
+ get() {
16
+ throw new Error(LINKING_ERROR);
17
+ },
18
+ }
19
+ );
19
20
 
20
21
  export function preload(extractData) {
21
22
  IdnowReactIdcheckio.preload(extractData);
22
23
  };
23
24
 
24
25
 
25
- export function activate(token, extractData) {
26
- return IdnowReactIdcheckio.activate(token, extractData);
26
+ export async function activate(token, extractData) {
27
+ return await IDCheckIOBridgeModule.activate(token, extractData);
27
28
  };
28
29
 
29
30
 
30
- export function startOnboarding(folderUid, theme) {
31
- return IdnowReactIdcheckio.startOnboarding(folderUid, theme);
31
+ export function startOnboarding(folderUid) {
32
+ return IdnowReactIdcheckio.startOnboarding(folderUid);
32
33
  };
33
34
 
34
35
 
35
- export function start(parameters, onlineContext, theme) {
36
- return IdnowReactIdcheckio.start(parameters, onlineContext, theme)
37
- .then(function(resultString) {
36
+ export function startSession(onlineContext, parameters) {
37
+ return IdnowReactIdcheckio.startSession(onlineContext, parameters)
38
+ .then(function (resultString) {
38
39
  return JSON.parse(resultString);
39
40
  })
40
- .catch(function(error) {
41
+ .catch(function (error) {
41
42
  throw error;
42
43
  });
43
44
  }
44
45
 
45
46
  export class IDCheckioParams {
46
- constructor({docType, orientation, confirmationType, useHd, integrityCheck, captureMode, sideOneExtraction, sideTwoExtraction,
47
- language, manualButtonTimer, adjustCrop, maxPictureFilesize, token, confirmAbort, onlineConfig, overrideWordings}={}){
48
- this.docType = docType
49
- this.orientation = orientation
50
- this.confirmationType = confirmationType
51
- this.useHd = useHd
52
- this.integrityCheck = integrityCheck
53
- this.captureMode = captureMode
54
- this.sideOneExtraction = sideOneExtraction
55
- this.sideTwoExtraction = sideTwoExtraction
56
- this.language = language
57
- this.manualButtonTimer = manualButtonTimer
58
- this.adjustCrop = adjustCrop
59
- this.maxPictureFilesize = maxPictureFilesize
60
- this.token = token
61
- this.confirmAbort = confirmAbort
62
- this.onlineConfig = onlineConfig
63
- this.overrideWordings = overrideWordings
47
+ constructor({ docType, orientation, confirmationType, useHd, integrityCheck, captureMode, sideOneExtraction, sideTwoExtraction,
48
+ language, manualButtonTimer, adjustCrop, maxPictureFilesize, token, confirmAbort, onlineConfig, overrideWordings } = {}) {
49
+ this.docType = docType
50
+ this.orientation = orientation
51
+ this.confirmationType = confirmationType
52
+ this.useHd = useHd
53
+ this.integrityCheck = integrityCheck
54
+ this.captureMode = captureMode
55
+ this.sideOneExtraction = sideOneExtraction
56
+ this.sideTwoExtraction = sideTwoExtraction
57
+ this.language = language
58
+ this.manualButtonTimer = manualButtonTimer
59
+ this.adjustCrop = adjustCrop
60
+ this.maxPictureFilesize = maxPictureFilesize
61
+ this.token = token
62
+ this.confirmAbort = confirmAbort
63
+ this.onlineConfig = onlineConfig
64
+ this.overrideWordings = overrideWordings
64
65
  }
65
66
  }
66
67
 
@@ -170,19 +171,19 @@ export class OnlineConfig {
170
171
 
171
172
  export class IDCheckTheme {
172
173
  constructor({
173
- primaryColor = null,
174
- foregroundColor = null,
175
- backgroundColor = null,
176
- borderColor = null,
177
- textColor = null,
178
- titleColor = null,
179
- }={}){
180
- this.primaryColor = primaryColor;
181
- this.foregroundColor = foregroundColor;
182
- this.backgroundColor = backgroundColor;
183
- this.borderColor = borderColor;
184
- this.textColor = textColor;
185
- this.titleColor = titleColor;
174
+ primaryColor = null,
175
+ foregroundColor = null,
176
+ backgroundColor = null,
177
+ borderColor = null,
178
+ textColor = null,
179
+ titleColor = null,
180
+ } = {}) {
181
+ this.primaryColor = primaryColor;
182
+ this.foregroundColor = foregroundColor;
183
+ this.backgroundColor = backgroundColor;
184
+ this.borderColor = borderColor;
185
+ this.textColor = textColor;
186
+ this.titleColor = titleColor;
186
187
  }
187
188
  }
188
189
 
@@ -272,3 +273,4 @@ export const CISType = {
272
273
  OTHER: 'OTHER'
273
274
  };
274
275
 
276
+ export default IDCheckIOBridgeModule;
@@ -1,29 +0,0 @@
1
- package com.idnowreactidcheckio.bean
2
-
3
- import androidx.annotation.ColorRes
4
- import com.ariadnext.idcheckio.sdk.bean.DayNightTheme
5
- import com.ariadnext.idcheckio.sdk.R
6
-
7
- internal data class Theme (
8
- @ColorRes var foregroundColor: Int? = null,
9
- @ColorRes var borderColor: Int? = null,
10
- @ColorRes var backgroundColor: Int? = null,
11
- @ColorRes var primaryColor: Int? = null,
12
- @ColorRes var titleColor: Int? = null,
13
- @ColorRes var textColor: Int? = null) {
14
-
15
- /**
16
- * Map a theme to a DayNightTheme
17
- */
18
- fun toDayNightTheme(): DayNightTheme{
19
- return DayNightTheme(
20
- foregroundColor = foregroundColor ?: R.color.idcheckio_sdk_background_color,
21
- borderColor = borderColor ?: R.color.idcheckio_sdk_border_color,
22
- backgroundColor = backgroundColor ?: R.color.idcheckio_sdk_secondary_background_color,
23
- primaryColor = primaryColor ?: R.color.idcheckio_sdk_primary_color,
24
- textColor = textColor,
25
- titleColor = titleColor
26
- )
27
- }
28
- }
29
-
@@ -1,13 +0,0 @@
1
- package com.idnowreactidcheckio.bean
2
-
3
- /**
4
- * Theme enum to simplify the mapping of a Theme Readable Map.
5
- */
6
- internal enum class ThemeEnum(val jsonValue: String) {
7
- PRIMARY_COLOR("primaryColor"),
8
- BACKGROUND_COLOR("backgroundColor"),
9
- FOREGROUND_COLOR("foregroundColor"),
10
- BORDER_COLOR("borderColor"),
11
- TEXT_COLOR("textColor"),
12
- TITLE_COLOR("titleColor")
13
- }
@@ -1,2 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
- #import <React/RCTViewManager.h>