contour-ai-sdk 1.10.9-alpha.1 → 1.10.11-alpha.1
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/android/build.gradle +1 -1
- package/android/src/main/java/com/contouraisdk/ContourAiSdkModule.java +31 -6
- package/ios/ContourAiSdk.mm +18 -7
- package/ios/ContourModel.h +13 -0
- package/ios/ContourModel.m +17 -0
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +11 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +31 -10
package/android/build.gradle
CHANGED
|
@@ -93,5 +93,5 @@ dependencies {
|
|
|
93
93
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
94
94
|
//noinspection GradleDynamicVersion
|
|
95
95
|
implementation "com.facebook.react:react-native:+"
|
|
96
|
-
implementation 'com.github.Contour-Document-Imaging:contours-ai-android-sdk:
|
|
96
|
+
implementation 'com.github.Contour-Document-Imaging:contours-ai-android-sdk:Debug1.10.15'
|
|
97
97
|
}
|
|
@@ -9,6 +9,7 @@ import com.contourdocumentimaging.android.contours_ai.ContoursStarterActivity;
|
|
|
9
9
|
import com.contourdocumentimaging.android.contours_ai.callback.IContoursResultListener;
|
|
10
10
|
import com.contourdocumentimaging.android.contours_ai.constants.ContoursConstants;
|
|
11
11
|
import com.contourdocumentimaging.android.contours_ai.models.ContoursCapturingMode;
|
|
12
|
+
import com.contourdocumentimaging.android.contours_ai.models.ContoursScanType;
|
|
12
13
|
import com.contourdocumentimaging.android.contours_ai.models.ContoursModel;
|
|
13
14
|
import com.contourdocumentimaging.android.contours_ai.models.ContoursResultModel;
|
|
14
15
|
import com.facebook.react.bridge.Promise;
|
|
@@ -21,6 +22,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
|
21
22
|
import java.io.*;
|
|
22
23
|
import java.net.URI;
|
|
23
24
|
import java.net.URISyntaxException;
|
|
25
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
24
26
|
import android.widget.Toast;
|
|
25
27
|
import org.json.JSONException;
|
|
26
28
|
import org.json.JSONObject;
|
|
@@ -51,8 +53,22 @@ public class ContourAiSdkModule extends ReactContextBaseJavaModule {
|
|
|
51
53
|
return NAME;
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
@ReactMethod
|
|
57
|
+
public void startContour(ReadableMap options) {
|
|
58
|
+
String clientId = options.getString("clientId");
|
|
59
|
+
String captureType = options.getString("captureType");
|
|
60
|
+
boolean enableMultipleCapturing = options.getBoolean("enableMultipleCapturing");
|
|
61
|
+
String type = options.getString("type");
|
|
62
|
+
String capturingSide = options.getString("capturingSide");
|
|
63
|
+
startContourSDK(capturingSide, clientId, captureType, enableMultipleCapturing, type);
|
|
64
|
+
}
|
|
65
|
+
|
|
54
66
|
@ReactMethod
|
|
55
67
|
public void startContourSDK(String captureSide, String clientID, String captureType, boolean enableMultipleCheckCapturing) {
|
|
68
|
+
startContourSDK(captureSide, clientID, captureType, enableMultipleCheckCapturing, null);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public void startContourSDK(String captureSide, String clientID, String captureType, boolean enableMultipleCapturing, String type) {
|
|
56
72
|
//Put this code before launching sdk to capture check
|
|
57
73
|
ContoursModel contoursModel = new ContoursModel();
|
|
58
74
|
if(captureType.equalsIgnoreCase("auto")) {
|
|
@@ -63,15 +79,24 @@ public class ContourAiSdkModule extends ReactContextBaseJavaModule {
|
|
|
63
79
|
contoursModel.capturingMode = ContoursCapturingMode.BOTH_CAPTURE;
|
|
64
80
|
}
|
|
65
81
|
// checkFace value will be either ContoursConstants.FRONT_FACE of ContoursConstants.BACK_FACE as in openContours() function
|
|
82
|
+
var capturingSide = ContoursConstants.FRONT_FACE;
|
|
66
83
|
if(captureSide.equalsIgnoreCase("front")) {
|
|
67
|
-
|
|
84
|
+
capturingSide = ContoursConstants.FRONT_FACE;
|
|
68
85
|
} else if (captureSide.equalsIgnoreCase("frontFaceOnly")) {
|
|
69
|
-
|
|
86
|
+
capturingSide = ContoursConstants.FRONT_FACE_ONLY;
|
|
70
87
|
} else {
|
|
71
|
-
|
|
88
|
+
capturingSide = ContoursConstants.BACK_FACE;
|
|
72
89
|
}
|
|
73
|
-
|
|
74
|
-
contoursModel.enableMultipleCheckCapturing =
|
|
90
|
+
contoursModel.checkFace = capturingSide;
|
|
91
|
+
contoursModel.enableMultipleCheckCapturing = enableMultipleCapturing;
|
|
92
|
+
if(type != null && type.equalsIgnoreCase(ContoursScanType.ID.name())) {
|
|
93
|
+
contoursModel.type = ContoursScanType.ID;
|
|
94
|
+
} else if(type != null && type.equalsIgnoreCase(ContoursScanType.PASSPORT.name())) {
|
|
95
|
+
contoursModel.type = ContoursScanType.PASSPORT;
|
|
96
|
+
} else {
|
|
97
|
+
contoursModel.type = ContoursScanType.CHECK;
|
|
98
|
+
}
|
|
99
|
+
contoursModel.capturingSide = capturingSide;
|
|
75
100
|
ContoursStarterActivity.Companion.launchSdk(context, contoursModel, clientID, new IContoursResultListener() {
|
|
76
101
|
@Override
|
|
77
102
|
public void onCaptureSuccess(ContoursResultModel contoursResultModel) {
|
|
@@ -94,7 +119,7 @@ public class ContourAiSdkModule extends ReactContextBaseJavaModule {
|
|
|
94
119
|
}
|
|
95
120
|
});
|
|
96
121
|
}
|
|
97
|
-
|
|
122
|
+
|
|
98
123
|
private void sendDataToHost(String frontUri, String rearUri, String frontUriCropped, String rearUriCropped) {
|
|
99
124
|
WritableNativeMap map = new WritableNativeMap();
|
|
100
125
|
if(frontUriCropped != null && !frontUriCropped.isEmpty()) {
|
package/ios/ContourAiSdk.mm
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#import "ContourAiSdk.h"
|
|
2
|
-
|
|
2
|
+
#import "ContourModel.h"
|
|
3
3
|
@implementation ContourAiSdk
|
|
4
4
|
RCT_EXPORT_MODULE()
|
|
5
5
|
|
|
@@ -8,17 +8,28 @@ RCT_EXPORT_MODULE()
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
RCT_REMAP_METHOD(startContourSDK,
|
|
11
|
-
|
|
12
|
-
[self
|
|
11
|
+
CapturingSide:(NSString *)captureSide withClientId:(NSString *)clientID withCaptureType:(NSString *)captureType withEnableMultipleCheckCapturing:(BOOL) enableMultipleCheckCapturing ) {
|
|
12
|
+
[self openContoursSDKwithClientId:clientID withCaptureType:captureType withEnableMultipleCheckCapturing:enableMultipleCheckCapturing withType:@"check" withCapturingSide:captureSide];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
RCT_REMAP_METHOD(startContour, withModel:(NSDictionary *)model) {
|
|
16
|
+
ContourModel *sdkOptions = [[ContourModel alloc] initWithDictionary:model];
|
|
17
|
+
NSLog(@"%@",sdkOptions);
|
|
18
|
+
[self openContoursSDKwithClientId:sdkOptions.clientID withCaptureType:sdkOptions.captureType withEnableMultipleCheckCapturing:sdkOptions.enableMultipleCapturing withType:sdkOptions.type withCapturingSide:sdkOptions.capturingSide];
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
-(void)
|
|
21
|
+
-(void)openContoursSDKwithClientId:(NSString *)clientId withCaptureType:(NSString *)captureType withEnableMultipleCheckCapturing:(BOOL) enableMultipleCheckCapturing withType:(NSString *)type withCapturingSide:(NSString *)capturingSide {
|
|
16
22
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
|
17
23
|
[self removeFile];
|
|
18
|
-
|
|
24
|
+
UINavigationController *navController = (UINavigationController *)[[[UIApplication sharedApplication] keyWindow] rootViewController];
|
|
25
|
+
ContoursModel *model = [[ContoursModel alloc] initWithClientId:clientId
|
|
26
|
+
captureType:captureType
|
|
27
|
+
type:type
|
|
28
|
+
capturingSide:capturingSide
|
|
29
|
+
delegate:self];
|
|
19
30
|
ContoursAIFramework *contourCaptureViewController = [[ContoursAIFramework alloc] init];
|
|
20
|
-
|
|
21
|
-
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:
|
|
31
|
+
UIViewController *capturingVC = [contourCaptureViewController startContourWithConfigModel:model enableMultipleCapturing:enableMultipleCheckCapturing];
|
|
32
|
+
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:capturingVC];
|
|
22
33
|
[nav setModalPresentationStyle:UIModalPresentationFullScreen];
|
|
23
34
|
[navController presentViewController:nav animated:false completion:nil];
|
|
24
35
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
@interface ContourModel : NSObject
|
|
4
|
+
|
|
5
|
+
@property (nonatomic, strong) NSString *capturingSide;
|
|
6
|
+
@property (nonatomic, strong) NSString *clientID;
|
|
7
|
+
@property (nonatomic, strong) NSString *captureType;
|
|
8
|
+
@property (nonatomic, assign) BOOL enableMultipleCapturing;
|
|
9
|
+
@property (nonatomic, strong) NSString *type;
|
|
10
|
+
|
|
11
|
+
- (instancetype)initWithDictionary:(NSDictionary *)dict;
|
|
12
|
+
|
|
13
|
+
@end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#import "ContourModel.h"
|
|
2
|
+
|
|
3
|
+
@implementation ContourModel
|
|
4
|
+
|
|
5
|
+
- (instancetype)initWithDictionary:(NSDictionary *)dict {
|
|
6
|
+
self = [super init];
|
|
7
|
+
if (self) {
|
|
8
|
+
_capturingSide = dict[@"capturingSide"];
|
|
9
|
+
_clientID = dict[@"clientId"];
|
|
10
|
+
_captureType = dict[@"captureType"];
|
|
11
|
+
_enableMultipleCapturing = [dict[@"enableMultipleCapturing"] boolValue];
|
|
12
|
+
_type = dict[@"type"];
|
|
13
|
+
}
|
|
14
|
+
return self;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@end
|
package/lib/commonjs/index.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.onContourClosed = onContourClosed;
|
|
7
7
|
exports.onEventCaptured = onEventCaptured;
|
|
8
|
+
exports.startContour = startContour;
|
|
8
9
|
exports.startContourSDK = startContourSDK;
|
|
9
10
|
var _reactNative = require("react-native");
|
|
10
11
|
const LINKING_ERROR = `The package 'contour-ai-sdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
@@ -17,6 +18,9 @@ const ContourAiSdk = _reactNative.NativeModules.ContourAiSdk ? _reactNative.Nati
|
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
const eventEmitter = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.ContourAiSdk);
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated This method has been deprecated. Use startContour method instead.
|
|
23
|
+
*/
|
|
20
24
|
function startContourSDK(captureSide, clientId, captureType, enableMultipleCheckCapturing, callback) {
|
|
21
25
|
const count = eventEmitter.listenerCount('checkCaptured');
|
|
22
26
|
if (count > 0) {
|
|
@@ -27,6 +31,16 @@ function startContourSDK(captureSide, clientId, captureType, enableMultipleCheck
|
|
|
27
31
|
});
|
|
28
32
|
ContourAiSdk.startContourSDK(captureSide, clientId, captureType, enableMultipleCheckCapturing);
|
|
29
33
|
}
|
|
34
|
+
function startContour(model, callback) {
|
|
35
|
+
const count = eventEmitter.listenerCount('checkCaptured');
|
|
36
|
+
if (count > 0) {
|
|
37
|
+
eventEmitter.removeAllListeners('checkCaptured');
|
|
38
|
+
}
|
|
39
|
+
eventEmitter.addListener('checkCaptured', response => {
|
|
40
|
+
callback(response);
|
|
41
|
+
});
|
|
42
|
+
ContourAiSdk.startContour(model);
|
|
43
|
+
}
|
|
30
44
|
function onContourClosed(callback) {
|
|
31
45
|
const count = eventEmitter.listenerCount('onContourClose');
|
|
32
46
|
if (count > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","ContourAiSdk","NativeModules","Proxy","get","Error","eventEmitter","NativeEventEmitter","startContourSDK","captureSide","clientId","captureType","enableMultipleCheckCapturing","callback","count","listenerCount","removeAllListeners","addListener","response","onContourClosed","onEventCaptured"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","ContourAiSdk","NativeModules","Proxy","get","Error","eventEmitter","NativeEventEmitter","startContourSDK","captureSide","clientId","captureType","enableMultipleCheckCapturing","callback","count","listenerCount","removeAllListeners","addListener","response","startContour","model","onContourClosed","onEventCaptured"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASA,MAAMC,aAAa,GACjB,yEAAyE,GACzEC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,YAAY,GAAGC,0BAAa,CAACD,YAAY,GAC3CC,0BAAa,CAACD,YAAY,GAC1B,IAAIE,KAAK,CACT,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEH,MAAMU,YAAY,GAAG,IAAIC,+BAAkB,CAACL,0BAAa,CAACD,YAAY,CAAC;AACvE;AACA;AACA;AACO,SAASO,eAAeA,CAACC,WAAmB,EAAEC,QAAgB,EAAEC,WAAmB,EAAEC,4BAAqC,EAAEC,QAA6B,EAAE;EAChK,MAAMC,KAAK,GAAGR,YAAY,CAACS,aAAa,CAAC,eAAe,CAAC;EACzD,IAAID,KAAK,GAAG,CAAC,EAAE;IACbR,YAAY,CAACU,kBAAkB,CAAC,eAAe,CAAC;EAClD;EACAV,YAAY,CAACW,WAAW,CAAC,eAAe,EAAGC,QAAa,IAAK;IAC3DL,QAAQ,CAACK,QAAQ,CAAC;EACpB,CAAC,CAAC;EACFjB,YAAY,CAACO,eAAe,CAACC,WAAW,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,4BAA4B,CAAC;AAChG;AAEO,SAASO,YAAYA,CAACC,KAAmB,EAAEP,QAA6B,EAAE;EAC/E,MAAMC,KAAK,GAAGR,YAAY,CAACS,aAAa,CAAC,eAAe,CAAC;EACzD,IAAID,KAAK,GAAG,CAAC,EAAE;IACbR,YAAY,CAACU,kBAAkB,CAAC,eAAe,CAAC;EAClD;EACAV,YAAY,CAACW,WAAW,CAAC,eAAe,EAAGC,QAAa,IAAK;IAC3DL,QAAQ,CAACK,QAAQ,CAAC;EACpB,CAAC,CAAC;EACFjB,YAAY,CAACkB,YAAY,CAACC,KAAK,CAAC;AAClC;AAIO,SAASC,eAAeA,CAACR,QAAoB,EAAE;EACpD,MAAMC,KAAK,GAAGR,YAAY,CAACS,aAAa,CAAC,gBAAgB,CAAC;EAC1D,IAAID,KAAK,GAAG,CAAC,EAAE;IACbR,YAAY,CAACU,kBAAkB,CAAC,gBAAgB,CAAC;EACnD;EACAV,YAAY,CAACW,WAAW,CAAC,gBAAgB,EAAE,MAAM;IAC/CJ,QAAQ,CAAC,CAAC;EACZ,CAAC,CAAC;AACJ;AACO,SAASS,eAAeA,CAACT,QAA6B,EAAE;EAC7D,MAAMC,KAAK,GAAGR,YAAY,CAACS,aAAa,CAAC,iBAAiB,CAAC;EAC3D,IAAID,KAAK,GAAG,CAAC,EAAE;IACbR,YAAY,CAACU,kBAAkB,CAAC,iBAAiB,CAAC;EACpD;EACAV,YAAY,CAACW,WAAW,CAAC,iBAAiB,EAAGC,QAAa,IAAK;IAC7DL,QAAQ,CAACK,QAAQ,CAAC;EACpB,CAAC,CAAC;AACJ","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -9,6 +9,9 @@ const ContourAiSdk = NativeModules.ContourAiSdk ? NativeModules.ContourAiSdk : n
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const eventEmitter = new NativeEventEmitter(NativeModules.ContourAiSdk);
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated This method has been deprecated. Use startContour method instead.
|
|
14
|
+
*/
|
|
12
15
|
export function startContourSDK(captureSide, clientId, captureType, enableMultipleCheckCapturing, callback) {
|
|
13
16
|
const count = eventEmitter.listenerCount('checkCaptured');
|
|
14
17
|
if (count > 0) {
|
|
@@ -19,6 +22,16 @@ export function startContourSDK(captureSide, clientId, captureType, enableMultip
|
|
|
19
22
|
});
|
|
20
23
|
ContourAiSdk.startContourSDK(captureSide, clientId, captureType, enableMultipleCheckCapturing);
|
|
21
24
|
}
|
|
25
|
+
export function startContour(model, callback) {
|
|
26
|
+
const count = eventEmitter.listenerCount('checkCaptured');
|
|
27
|
+
if (count > 0) {
|
|
28
|
+
eventEmitter.removeAllListeners('checkCaptured');
|
|
29
|
+
}
|
|
30
|
+
eventEmitter.addListener('checkCaptured', response => {
|
|
31
|
+
callback(response);
|
|
32
|
+
});
|
|
33
|
+
ContourAiSdk.startContour(model);
|
|
34
|
+
}
|
|
22
35
|
export function onContourClosed(callback) {
|
|
23
36
|
const count = eventEmitter.listenerCount('onContourClose');
|
|
24
37
|
if (count > 0) {
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","ContourAiSdk","Proxy","get","Error","eventEmitter","startContourSDK","captureSide","clientId","captureType","enableMultipleCheckCapturing","callback","count","listenerCount","removeAllListeners","addListener","response","onContourClosed","onEventCaptured"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","ContourAiSdk","Proxy","get","Error","eventEmitter","startContourSDK","captureSide","clientId","captureType","enableMultipleCheckCapturing","callback","count","listenerCount","removeAllListeners","addListener","response","startContour","model","onContourClosed","onEventCaptured"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAS1E,MAAMC,aAAa,GACjB,yEAAyE,GACzED,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,YAAY,GAAGP,aAAa,CAACO,YAAY,GAC3CP,aAAa,CAACO,YAAY,GAC1B,IAAIC,KAAK,CACT,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEH,MAAMQ,YAAY,GAAG,IAAIV,kBAAkB,CAACD,aAAa,CAACO,YAAY,CAAC;AACvE;AACA;AACA;AACA,OAAO,SAASK,eAAeA,CAACC,WAAmB,EAAEC,QAAgB,EAAEC,WAAmB,EAAEC,4BAAqC,EAAEC,QAA6B,EAAE;EAChK,MAAMC,KAAK,GAAGP,YAAY,CAACQ,aAAa,CAAC,eAAe,CAAC;EACzD,IAAID,KAAK,GAAG,CAAC,EAAE;IACbP,YAAY,CAACS,kBAAkB,CAAC,eAAe,CAAC;EAClD;EACAT,YAAY,CAACU,WAAW,CAAC,eAAe,EAAGC,QAAa,IAAK;IAC3DL,QAAQ,CAACK,QAAQ,CAAC;EACpB,CAAC,CAAC;EACFf,YAAY,CAACK,eAAe,CAACC,WAAW,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,4BAA4B,CAAC;AAChG;AAEA,OAAO,SAASO,YAAYA,CAACC,KAAmB,EAAEP,QAA6B,EAAE;EAC/E,MAAMC,KAAK,GAAGP,YAAY,CAACQ,aAAa,CAAC,eAAe,CAAC;EACzD,IAAID,KAAK,GAAG,CAAC,EAAE;IACbP,YAAY,CAACS,kBAAkB,CAAC,eAAe,CAAC;EAClD;EACAT,YAAY,CAACU,WAAW,CAAC,eAAe,EAAGC,QAAa,IAAK;IAC3DL,QAAQ,CAACK,QAAQ,CAAC;EACpB,CAAC,CAAC;EACFf,YAAY,CAACgB,YAAY,CAACC,KAAK,CAAC;AAClC;AAIA,OAAO,SAASC,eAAeA,CAACR,QAAoB,EAAE;EACpD,MAAMC,KAAK,GAAGP,YAAY,CAACQ,aAAa,CAAC,gBAAgB,CAAC;EAC1D,IAAID,KAAK,GAAG,CAAC,EAAE;IACbP,YAAY,CAACS,kBAAkB,CAAC,gBAAgB,CAAC;EACnD;EACAT,YAAY,CAACU,WAAW,CAAC,gBAAgB,EAAE,MAAM;IAC/CJ,QAAQ,CAAC,CAAC;EACZ,CAAC,CAAC;AACJ;AACA,OAAO,SAASS,eAAeA,CAACT,QAA6B,EAAE;EAC7D,MAAMC,KAAK,GAAGP,YAAY,CAACQ,aAAa,CAAC,iBAAiB,CAAC;EAC3D,IAAID,KAAK,GAAG,CAAC,EAAE;IACbP,YAAY,CAACS,kBAAkB,CAAC,iBAAiB,CAAC;EACpD;EACAT,YAAY,CAACU,WAAW,CAAC,iBAAiB,EAAGC,QAAa,IAAK;IAC7DL,QAAQ,CAACK,QAAQ,CAAC;EACpB,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
export interface ContourModel {
|
|
2
|
+
clientId: string;
|
|
3
|
+
captureType: string;
|
|
4
|
+
enableMultipleCapturing: boolean;
|
|
5
|
+
type: string;
|
|
6
|
+
capturingSide: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated This method has been deprecated. Use startContour method instead.
|
|
10
|
+
*/
|
|
1
11
|
export declare function startContourSDK(captureSide: string, clientId: string, captureType: string, enableMultipleCheckCapturing: Boolean, callback: (data: any) => void): void;
|
|
12
|
+
export declare function startContour(model: ContourModel, callback: (data: any) => void): void;
|
|
2
13
|
export declare function onContourClosed(callback: () => void): void;
|
|
3
14
|
export declare function onEventCaptured(callback: (data: any) => void): void;
|
|
4
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB,EAAE,OAAO,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACvB;AAmBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,4BAA4B,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,QAS/J;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,QAS9E;AAID,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,IAAI,QAQnD;AACD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,QAQ5D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contour-ai-sdk",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.11-alpha.1",
|
|
4
4
|
"description": "The Contour AI SDK™ has been designed to be the industry’s most intuitive, and protected, experience for mobile image capture - capturing documents of various kinds via an iOS™ or Android™ mobile device. At the same time, it has been designed to enable the clear, accurate, and complete processing of these documents with limited, if any, human intervention, all while improving your efficiencies and reducing costs.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export interface ContourModel {
|
|
4
|
+
clientId: string;
|
|
5
|
+
captureType: string;
|
|
6
|
+
enableMultipleCapturing: boolean;
|
|
7
|
+
type: string;
|
|
8
|
+
capturingSide: string;
|
|
9
|
+
}
|
|
4
10
|
const LINKING_ERROR =
|
|
5
11
|
`The package 'contour-ai-sdk' doesn't seem to be linked. Make sure: \n\n` +
|
|
6
12
|
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
@@ -10,17 +16,19 @@ const LINKING_ERROR =
|
|
|
10
16
|
const ContourAiSdk = NativeModules.ContourAiSdk
|
|
11
17
|
? NativeModules.ContourAiSdk
|
|
12
18
|
: new Proxy(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
{},
|
|
20
|
+
{
|
|
21
|
+
get() {
|
|
22
|
+
throw new Error(LINKING_ERROR);
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
);
|
|
20
26
|
|
|
21
27
|
const eventEmitter = new NativeEventEmitter(NativeModules.ContourAiSdk);
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated This method has been deprecated. Use startContour method instead.
|
|
30
|
+
*/
|
|
31
|
+
export function startContourSDK(captureSide: string, clientId: string, captureType: string, enableMultipleCheckCapturing: Boolean, callback: (data: any) => void) {
|
|
24
32
|
const count = eventEmitter.listenerCount('checkCaptured');
|
|
25
33
|
if (count > 0) {
|
|
26
34
|
eventEmitter.removeAllListeners('checkCaptured');
|
|
@@ -31,6 +39,19 @@ export function startContourSDK(captureSide: string, clientId: string, captureTy
|
|
|
31
39
|
ContourAiSdk.startContourSDK(captureSide, clientId, captureType, enableMultipleCheckCapturing);
|
|
32
40
|
}
|
|
33
41
|
|
|
42
|
+
export function startContour(model: ContourModel, callback: (data: any) => void) {
|
|
43
|
+
const count = eventEmitter.listenerCount('checkCaptured');
|
|
44
|
+
if (count > 0) {
|
|
45
|
+
eventEmitter.removeAllListeners('checkCaptured');
|
|
46
|
+
}
|
|
47
|
+
eventEmitter.addListener('checkCaptured', (response: any) => {
|
|
48
|
+
callback(response);
|
|
49
|
+
});
|
|
50
|
+
ContourAiSdk.startContour(model);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
34
55
|
export function onContourClosed(callback: () => void) {
|
|
35
56
|
const count = eventEmitter.listenerCount('onContourClose');
|
|
36
57
|
if (count > 0) {
|