@socure-inc/docv-react-native 3.1.1 → 3.1.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.
package/.whitesource ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "scanSettings": {
3
+ "configMode": "AUTO",
4
+ "configExternalURL": "",
5
+ "projectToken": "",
6
+ "baseBranches": []
7
+ },
8
+ "commitStatusSettings": {
9
+ "vulnerableCommitStatus": "FAILED",
10
+ "displayMode": "diff",
11
+ "useMendStatusNames": true
12
+ },
13
+ "issueSettings": {
14
+ "minSeverityLevel": "LOW",
15
+ "openConfidentialIssues": true,
16
+ "issueType": "DEPENDENCY"
17
+ },
18
+ "remediateSettings": {
19
+ "workflowRules": {
20
+ "enabled": true
21
+ }
22
+ }
23
+ }
@@ -2,6 +2,7 @@ package com.socure.docv.reactnative
2
2
 
3
3
  import android.app.Activity
4
4
  import android.content.Intent
5
+ import android.util.Log
5
6
  import android.util.Base64
6
7
  import com.facebook.react.bridge.*
7
8
  import com.socure.docv.capturesdk.api.Platform.REACT_NATIVE
@@ -17,13 +18,12 @@ import org.json.JSONObject
17
18
  class SocureDocVReactNativeModule(reactContext: ReactApplicationContext) :
18
19
  ReactContextBaseJavaModule(reactContext), ActivityEventListener {
19
20
 
21
+ private val TAG = "SDLT_RN"
22
+
23
+ private val SOCURE_SDK_REQUEST_CODE = 753
20
24
  private var onSuccessCallback: Callback? = null
21
25
  private var onErrorCallback: Callback? = null
22
26
 
23
- init {
24
- reactApplicationContext.addActivityEventListener(this)
25
- }
26
-
27
27
  override fun getName(): String {
28
28
  return "SocureDocVReactNative"
29
29
  }
@@ -37,10 +37,15 @@ class SocureDocVReactNativeModule(reactContext: ReactApplicationContext) :
37
37
  ) {
38
38
  this.onSuccessCallback = onSuccess
39
39
  this.onErrorCallback = onError
40
+
41
+ Log.d(TAG, "launchSocureDocV - registering activity event listener")
42
+
43
+ reactApplicationContext.addActivityEventListener(this)
44
+
40
45
  setSource(REACT_NATIVE)
41
46
  currentActivity?.startActivityForResult(
42
47
  getIntent(currentActivity!!, socureApiKey, flow),
43
- 123
48
+ SOCURE_SDK_REQUEST_CODE
44
49
  )
45
50
  }
46
51
 
@@ -50,16 +55,24 @@ class SocureDocVReactNativeModule(reactContext: ReactApplicationContext) :
50
55
  resultCode: Int,
51
56
  data: Intent?
52
57
  ) {
53
- data?.let {
54
- getResult(data, object : ResultListener {
55
- override fun onSuccess(scannedData: ScannedData) {
56
- onSuccessCallback?.invoke(convertResultToReadbleMap(scannedData))
57
- }
58
+ if (requestCode == SOCURE_SDK_REQUEST_CODE) {
59
+ Log.d(TAG, "onActivityResult - requestCode matched, removing activity event listener")
60
+
61
+ data?.let {
62
+ getResult(data, object : ResultListener {
63
+ override fun onSuccess(scannedData: ScannedData) {
64
+ onSuccessCallback?.invoke(convertResultToReadbleMap(scannedData))
65
+ }
66
+
67
+ override fun onError(scanError: ScanError) {
68
+ onErrorCallback?.invoke(convertErrorToReadableMap(scanError))
69
+ }
70
+ })
71
+ }
58
72
 
59
- override fun onError(scanError: ScanError) {
60
- onErrorCallback?.invoke(convertErrorToReadableMap(scanError))
61
- }
62
- })
73
+ reactApplicationContext.removeActivityEventListener(this)
74
+ } else {
75
+ Log.d(TAG, "onActivityResult - requestCode does not match: $requestCode, not removing activity event listener")
63
76
  }
64
77
  }
65
78
 
@@ -0,0 +1,39 @@
1
+ export declare function launchSocureDocV(socureApiKey: string, flow: string | null | undefined, onSuccess: Function, onError: Function): any;
2
+ export interface ScannedData {
3
+ docUUID: string;
4
+ sessionId: string;
5
+ extractedData?: ExtractedInfo;
6
+ captureData: {
7
+ [doc_type: string]: [capture_type: string];
8
+ };
9
+ capturedImages: {
10
+ [doc_type: string]: [image_data: string];
11
+ };
12
+ }
13
+ export interface ScanError {
14
+ statusCode: string;
15
+ errorMessage: string;
16
+ sessionId?: string;
17
+ capturedImages?: {
18
+ [doc_type: string]: [image_data: string];
19
+ };
20
+ }
21
+ export interface ExtractedInfo {
22
+ type?: string;
23
+ expirationDate?: string;
24
+ dob?: string;
25
+ firstName?: string;
26
+ fullName?: string;
27
+ documentNumber?: string;
28
+ address?: string;
29
+ surName?: string;
30
+ issueDate?: string;
31
+ parsedAddress?: AddressInfo;
32
+ }
33
+ export interface AddressInfo {
34
+ state?: String;
35
+ postalCode?: String;
36
+ city?: String;
37
+ country?: String;
38
+ physicalAddress?: String;
39
+ }
package/package.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "@socure-inc/docv-react-native",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
4
4
  "description": "The Predictive Document Verification (DocV) SDK React Native bridge allows you to use the DocV SDK v3 for Android and iOS in your React Native application.",
5
- "main": "lib/commonjs/index",
6
- "module": "lib/module/index",
7
- "types": "lib/typescript/index.d.ts",
8
- "react-native": "src/index",
9
- "source": "src/index",
5
+ "main": "src/index",
6
+ "types": "dist/index.d.ts",
10
7
  "keywords": [
11
8
  "react-native",
12
9
  "ios",
@@ -30,10 +27,14 @@
30
27
  "react-native": ">=0.66.0"
31
28
  },
32
29
  "devDependencies": {
30
+ "@types/react": "^18.0.27",
31
+ "@types/react-native": "^0.71.1",
33
32
  "react": "17.0.2",
34
- "react-native": "0.68.2"
33
+ "react-native": "0.68.2",
34
+ "typescript": "^4.9.4"
35
35
  },
36
36
  "scripts": {
37
+ "prepack": "tsc -p tsconfig.json",
37
38
  "test": "echo \"Error: no test specified\" && exit 1"
38
39
  }
39
40
  }
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "files": ["src/index.tsx"],
3
+ "compilerOptions": {
4
+ "allowJs": true,
5
+ "declaration": true,
6
+ "emitDeclarationOnly": true,
7
+ "outDir": "dist",
8
+ "skipLibCheck": true,
9
+ "strict": true,
10
+ "forceConsistentCasingInFileNames":true
11
+ }
12
+ }