@qore-id/react-native-qoreid-sdk 1.0.8 → 1.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/LICENSE +1 -1
- package/README.md +139 -63
- package/android/build.gradle +0 -1
- package/android/src/main/java/com/qoreidsdk/QoreidSdkModule.kt +29 -34
- package/ios/QoreidSdk-Bridging-Header.h +7 -0
- package/ios/QoreidSdk.m +21 -0
- package/ios/QoreidSdk.swift +104 -0
- package/ios/QoreidSdk.xcodeproj/project.pbxproj +22 -4
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +5 -0
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcuserdata/e.ugwuoke.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcuserdata/e.ugwuoke.xcuserdatad/WorkspaceSettings.xcsettings +14 -0
- package/ios/QoreidSdk.xcodeproj/xcuserdata/e.ugwuoke.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/ViewController.swift +22 -0
- package/lib/commonjs/index.js +10 -28
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/qoreIdSdk.js +57 -0
- package/lib/commonjs/qoreIdSdk.js.map +1 -0
- package/lib/module/index.js +1 -24
- package/lib/module/index.js.map +1 -1
- package/lib/module/qoreIdSdk.js +50 -0
- package/lib/module/qoreIdSdk.js.map +1 -0
- package/lib/typescript/index.d.ts +1 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/qoreIdSdk.d.ts +16 -0
- package/lib/typescript/qoreIdSdk.d.ts.map +1 -0
- package/package.json +1 -2
- package/qore-id-react-native-qoreid-sdk.podspec +3 -3
- package/src/index.tsx +1 -29
- package/src/qoreIdSdk.tsx +60 -0
- package/src/types.d.ts +14 -49
- package/ios/QoreidSdk.h +0 -12
- package/ios/QoreidSdk.mm +0 -27
- package/lib/commonjs/qoreIdButton.android.js +0 -56
- package/lib/commonjs/qoreIdButton.android.js.map +0 -1
- package/lib/commonjs/qoreIdButton.ios.js +0 -129
- package/lib/commonjs/qoreIdButton.ios.js.map +0 -1
- package/lib/module/qoreIdButton.android.js +0 -47
- package/lib/module/qoreIdButton.android.js.map +0 -1
- package/lib/module/qoreIdButton.ios.js +0 -121
- package/lib/module/qoreIdButton.ios.js.map +0 -1
- package/lib/typescript/qoreIdButton.android.d.ts +0 -4
- package/lib/typescript/qoreIdButton.android.d.ts.map +0 -1
- package/lib/typescript/qoreIdButton.ios.d.ts +0 -4
- package/lib/typescript/qoreIdButton.ios.d.ts.map +0 -1
- package/src/qoreIdButton.android.tsx +0 -63
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ViewController.swift
|
|
3
|
+
// qore-id-react-native-qoreid-sdk
|
|
4
|
+
//
|
|
5
|
+
// Created by Guru King on 03/10/2023.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
import QoreIDSDK
|
|
10
|
+
|
|
11
|
+
class ViewController: UIViewController {
|
|
12
|
+
var param:QoreIDParam?
|
|
13
|
+
var onQoreIdResult:((QoreIDResult) -> ())?
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
override func viewDidLoad() {
|
|
17
|
+
super.viewDidLoad()
|
|
18
|
+
QoreIdSdk.shared.launch(param: param ?? QoreIDParam(), vc: self, "react_native_ios_sdk") { [weak self] result in
|
|
19
|
+
self?.onQoreIdResult!(result)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,16 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
QoreIdButton: true
|
|
8
|
-
};
|
|
9
|
-
exports.QoreIdButton = void 0;
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
var _react = _interopRequireDefault(require("react"));
|
|
12
6
|
var _utils = require("./utils");
|
|
13
7
|
Object.keys(_utils).forEach(function (key) {
|
|
14
8
|
if (key === "default" || key === "__esModule") return;
|
|
15
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
9
|
if (key in exports && exports[key] === _utils[key]) return;
|
|
17
10
|
Object.defineProperty(exports, key, {
|
|
18
11
|
enumerable: true,
|
|
@@ -21,26 +14,15 @@ Object.keys(_utils).forEach(function (key) {
|
|
|
21
14
|
}
|
|
22
15
|
});
|
|
23
16
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
flex: 1,
|
|
33
|
-
justifyContent: 'center',
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
paddingHorizontal: 10,
|
|
36
|
-
paddingVertical: 5
|
|
37
|
-
}
|
|
38
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
39
|
-
style: {
|
|
40
|
-
color: 'blue'
|
|
17
|
+
var _qoreIdSdk = require("./qoreIdSdk");
|
|
18
|
+
Object.keys(_qoreIdSdk).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _qoreIdSdk[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _qoreIdSdk[key];
|
|
41
25
|
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const QoreIdButton = _reactNative.Platform.OS === 'android' ? require('./qoreIdButton.android').QoreIdButton : QoreIdButtonIOS; // (require('./qoreIdButton.ios').QoreIdButton as React.FC<IQoreIdButton>);
|
|
45
|
-
exports.QoreIdButton = QoreIdButton;
|
|
26
|
+
});
|
|
27
|
+
});
|
|
46
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_utils","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_qoreIdSdk"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.QoreIdSdk = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
const QoreIdSdk = {
|
|
10
|
+
/**
|
|
11
|
+
* lauches QoreID SDK
|
|
12
|
+
* @param initialData - data to launch Qore ID SDK
|
|
13
|
+
* @requires QoreIdSdk native module installed
|
|
14
|
+
*/
|
|
15
|
+
launch(initialData) {
|
|
16
|
+
_reactNative.NativeModules.QoreidSdk.launchQoreidSdk({
|
|
17
|
+
config: {
|
|
18
|
+
flowId: initialData.flowId || 0,
|
|
19
|
+
customerReference: initialData.customerReference,
|
|
20
|
+
productCode: initialData.productCode,
|
|
21
|
+
clientId: initialData.clientId
|
|
22
|
+
},
|
|
23
|
+
applicantData: {
|
|
24
|
+
...initialData.applicantData
|
|
25
|
+
},
|
|
26
|
+
addressData: {
|
|
27
|
+
...initialData.addressData
|
|
28
|
+
},
|
|
29
|
+
acceptedDocuments: initialData.ocrAcceptedDocuments,
|
|
30
|
+
identityData: {
|
|
31
|
+
...initialData.identityData
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* QoreIdSdk events listener. It takes callbacks to handle success and error events
|
|
37
|
+
* @param onSuccess Called on success with result
|
|
38
|
+
* @param onError Called on error with error object
|
|
39
|
+
*/
|
|
40
|
+
events(onSuccess, onError) {
|
|
41
|
+
(0, _react.useEffect)(() => {
|
|
42
|
+
const eventEmitter = _reactNative.Platform.OS === 'android' ? new _reactNative.NativeEventEmitter() : new _reactNative.NativeEventEmitter(_reactNative.NativeModules.QoreidSdk);
|
|
43
|
+
let eventListener = eventEmitter.addListener('onResult', event => {
|
|
44
|
+
if (event !== null && event !== void 0 && event.code) {
|
|
45
|
+
onError === null || onError === void 0 ? void 0 : onError(event);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event);
|
|
49
|
+
});
|
|
50
|
+
return () => {
|
|
51
|
+
eventEmitter.removeSubscription(eventListener);
|
|
52
|
+
};
|
|
53
|
+
}, []);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.QoreIdSdk = QoreIdSdk;
|
|
57
|
+
//# sourceMappingURL=qoreIdSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","QoreIdSdk","launch","initialData","NativeModules","QoreidSdk","launchQoreidSdk","config","flowId","customerReference","productCode","clientId","applicantData","addressData","acceptedDocuments","ocrAcceptedDocuments","identityData","events","onSuccess","onError","useEffect","eventEmitter","Platform","OS","NativeEventEmitter","eventListener","addListener","event","code","removeSubscription","exports"],"sourceRoot":"../../src","sources":["qoreIdSdk.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGO,MAAME,SAAS,GAAG;EACvB;AACF;AACA;AACA;AACA;EACEC,MAAMA,CAACC,WAAqB,EAAE;IAC5BC,0BAAa,CAACC,SAAS,CAACC,eAAe,CAAC;MACtCC,MAAM,EAAE;QACNC,MAAM,EAAEL,WAAW,CAACK,MAAM,IAAI,CAAC;QAC/BC,iBAAiB,EAAEN,WAAW,CAACM,iBAAiB;QAChDC,WAAW,EAAEP,WAAW,CAACO,WAAW;QACpCC,QAAQ,EAAER,WAAW,CAACQ;MACxB,CAAC;MACDC,aAAa,EAAE;QACb,GAAGT,WAAW,CAACS;MACjB,CAAC;MACDC,WAAW,EAAE;QACX,GAAGV,WAAW,CAACU;MACjB,CAAC;MACDC,iBAAiB,EAAEX,WAAW,CAACY,oBAAoB;MACnDC,YAAY,EAAE;QAAE,GAAGb,WAAW,CAACa;MAAa;IAC9C,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,MAAMA,CACJC,SAAqD,EACrDC,OAAqC,EACrC;IACA,IAAAC,gBAAS,EAAC,MAAM;MACd,MAAMC,YAAY,GAChBC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACrB,IAAIC,+BAAkB,EAAE,GACxB,IAAIA,+BAAkB,CAACpB,0BAAa,CAACC,SAAS,CAAC;MACrD,IAAIoB,aAAa,GAAGJ,YAAY,CAACK,WAAW,CAC1C,UAAU,EACTC,KAAmB,IAAK;QACvB,IAAIA,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEC,IAAI,EAAE;UACfT,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGQ,KAAK,CAAC;UAChB;QACF;QACAT,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGS,KAAK,CAAC;MACpB,CAAC,CACF;MAED,OAAO,MAAM;QACXN,YAAY,CAACQ,kBAAkB,CAACJ,aAAa,CAAC;MAChD,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;EACR;AACF,CAAC;AAACK,OAAA,CAAA7B,SAAA,GAAAA,SAAA"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
import { Platform, Text, TouchableOpacity } from 'react-native';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
//Safe fail implementation for iOS
|
|
5
|
-
const QoreIdButtonIOS = initialData => {
|
|
6
|
-
console.info('No implementation for iOS');
|
|
7
|
-
return initialData.render && initialData.render({
|
|
8
|
-
onPress: () => {}
|
|
9
|
-
}) || /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
10
|
-
style: {
|
|
11
|
-
flex: 1,
|
|
12
|
-
justifyContent: 'center',
|
|
13
|
-
alignItems: 'center',
|
|
14
|
-
paddingHorizontal: 10,
|
|
15
|
-
paddingVertical: 5
|
|
16
|
-
}
|
|
17
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
18
|
-
style: {
|
|
19
|
-
color: 'blue'
|
|
20
|
-
}
|
|
21
|
-
}, "Start QoreID"));
|
|
22
|
-
};
|
|
23
|
-
export const QoreIdButton = Platform.OS === 'android' ? require('./qoreIdButton.android').QoreIdButton : QoreIdButtonIOS; // (require('./qoreIdButton.ios').QoreIdButton as React.FC<IQoreIdButton>);
|
|
24
|
-
|
|
25
1
|
export * from './utils';
|
|
2
|
+
export * from './qoreIdSdk';
|
|
26
3
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AACA,cAAc,SAAS;AACvB,cAAc,aAAa"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
3
|
+
export const QoreIdSdk = {
|
|
4
|
+
/**
|
|
5
|
+
* lauches QoreID SDK
|
|
6
|
+
* @param initialData - data to launch Qore ID SDK
|
|
7
|
+
* @requires QoreIdSdk native module installed
|
|
8
|
+
*/
|
|
9
|
+
launch(initialData) {
|
|
10
|
+
NativeModules.QoreidSdk.launchQoreidSdk({
|
|
11
|
+
config: {
|
|
12
|
+
flowId: initialData.flowId || 0,
|
|
13
|
+
customerReference: initialData.customerReference,
|
|
14
|
+
productCode: initialData.productCode,
|
|
15
|
+
clientId: initialData.clientId
|
|
16
|
+
},
|
|
17
|
+
applicantData: {
|
|
18
|
+
...initialData.applicantData
|
|
19
|
+
},
|
|
20
|
+
addressData: {
|
|
21
|
+
...initialData.addressData
|
|
22
|
+
},
|
|
23
|
+
acceptedDocuments: initialData.ocrAcceptedDocuments,
|
|
24
|
+
identityData: {
|
|
25
|
+
...initialData.identityData
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* QoreIdSdk events listener. It takes callbacks to handle success and error events
|
|
31
|
+
* @param onSuccess Called on success with result
|
|
32
|
+
* @param onError Called on error with error object
|
|
33
|
+
*/
|
|
34
|
+
events(onSuccess, onError) {
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const eventEmitter = Platform.OS === 'android' ? new NativeEventEmitter() : new NativeEventEmitter(NativeModules.QoreidSdk);
|
|
37
|
+
let eventListener = eventEmitter.addListener('onResult', event => {
|
|
38
|
+
if (event !== null && event !== void 0 && event.code) {
|
|
39
|
+
onError === null || onError === void 0 ? void 0 : onError(event);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event);
|
|
43
|
+
});
|
|
44
|
+
return () => {
|
|
45
|
+
eventEmitter.removeSubscription(eventListener);
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=qoreIdSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","NativeEventEmitter","NativeModules","Platform","QoreIdSdk","launch","initialData","QoreidSdk","launchQoreidSdk","config","flowId","customerReference","productCode","clientId","applicantData","addressData","acceptedDocuments","ocrAcceptedDocuments","identityData","events","onSuccess","onError","eventEmitter","OS","eventListener","addListener","event","code","removeSubscription"],"sourceRoot":"../../src","sources":["qoreIdSdk.tsx"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAS,cAAc;AAG3E,OAAO,MAAMC,SAAS,GAAG;EACvB;AACF;AACA;AACA;AACA;EACEC,MAAMA,CAACC,WAAqB,EAAE;IAC5BJ,aAAa,CAACK,SAAS,CAACC,eAAe,CAAC;MACtCC,MAAM,EAAE;QACNC,MAAM,EAAEJ,WAAW,CAACI,MAAM,IAAI,CAAC;QAC/BC,iBAAiB,EAAEL,WAAW,CAACK,iBAAiB;QAChDC,WAAW,EAAEN,WAAW,CAACM,WAAW;QACpCC,QAAQ,EAAEP,WAAW,CAACO;MACxB,CAAC;MACDC,aAAa,EAAE;QACb,GAAGR,WAAW,CAACQ;MACjB,CAAC;MACDC,WAAW,EAAE;QACX,GAAGT,WAAW,CAACS;MACjB,CAAC;MACDC,iBAAiB,EAAEV,WAAW,CAACW,oBAAoB;MACnDC,YAAY,EAAE;QAAE,GAAGZ,WAAW,CAACY;MAAa;IAC9C,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,MAAMA,CACJC,SAAqD,EACrDC,OAAqC,EACrC;IACArB,SAAS,CAAC,MAAM;MACd,MAAMsB,YAAY,GAChBnB,QAAQ,CAACoB,EAAE,KAAK,SAAS,GACrB,IAAItB,kBAAkB,EAAE,GACxB,IAAIA,kBAAkB,CAACC,aAAa,CAACK,SAAS,CAAC;MACrD,IAAIiB,aAAa,GAAGF,YAAY,CAACG,WAAW,CAC1C,UAAU,EACTC,KAAmB,IAAK;QACvB,IAAIA,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEC,IAAI,EAAE;UACfN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGK,KAAK,CAAC;UAChB;QACF;QACAN,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGM,KAAK,CAAC;MACpB,CAAC,CACF;MAED,OAAO,MAAM;QACXJ,YAAY,CAACM,kBAAkB,CAACJ,aAAa,CAAC;MAChD,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;EACR;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { OnResultType, DataType } from './types';
|
|
2
|
+
export declare const QoreIdSdk: {
|
|
3
|
+
/**
|
|
4
|
+
* lauches QoreID SDK
|
|
5
|
+
* @param initialData - data to launch Qore ID SDK
|
|
6
|
+
* @requires QoreIdSdk native module installed
|
|
7
|
+
*/
|
|
8
|
+
launch(initialData: DataType): void;
|
|
9
|
+
/**
|
|
10
|
+
* QoreIdSdk events listener. It takes callbacks to handle success and error events
|
|
11
|
+
* @param onSuccess Called on success with result
|
|
12
|
+
* @param onError Called on error with error object
|
|
13
|
+
*/
|
|
14
|
+
events(onSuccess: (data: Omit<OnResultType, 'code'>) => void, onError: (data: OnResultType) => void): void;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=qoreIdSdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qoreIdSdk.d.ts","sourceRoot":"","sources":["../../src/qoreIdSdk.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,SAAS;IACpB;;;;OAIG;wBACiB,QAAQ;IAmB5B;;;;OAIG;6BAEiB,KAAK,YAAY,EAAE,MAAM,CAAC,KAAK,IAAI,kBACrC,YAAY,KAAK,IAAI;CAuBxC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qore-id/react-native-qoreid-sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "QoreId React Native SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"ios",
|
|
15
15
|
"cpp",
|
|
16
16
|
"*.podspec",
|
|
17
|
-
"!src/qoreIdButton.ios.tsx",
|
|
18
17
|
"!lib/typescript/example",
|
|
19
18
|
"!ios/build",
|
|
20
19
|
"!android/build",
|
|
@@ -14,10 +14,10 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.platforms = { :ios => "11.0" }
|
|
15
15
|
s.source = { :git => "https://.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
|
-
s.source_files = "ios/**/*.{h,m,mm}"
|
|
18
|
-
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
19
18
|
s.dependency "React-Core"
|
|
20
|
-
|
|
19
|
+
s.dependency 'QoreIDSDK'
|
|
20
|
+
|
|
21
21
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
22
22
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
23
23
|
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
package/src/index.tsx
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
import { Platform, Text, TouchableOpacity } from 'react-native';
|
|
2
|
-
import type { IQoreIdButton } from './types';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
//Safe fail implementation for iOS
|
|
6
|
-
const QoreIdButtonIOS: React.FC<IQoreIdButton> = (initialData) => {
|
|
7
|
-
console.info('No implementation for iOS');
|
|
8
|
-
return (
|
|
9
|
-
(initialData.render && initialData.render({ onPress: () => {} })) || (
|
|
10
|
-
<TouchableOpacity
|
|
11
|
-
style={{
|
|
12
|
-
flex: 1,
|
|
13
|
-
justifyContent: 'center',
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
paddingHorizontal: 10,
|
|
16
|
-
paddingVertical: 5,
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
<Text style={{ color: 'blue' }}>Start QoreID</Text>
|
|
20
|
-
</TouchableOpacity>
|
|
21
|
-
)
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const QoreIdButton =
|
|
26
|
-
Platform.OS === 'android'
|
|
27
|
-
? (require('./qoreIdButton.android')
|
|
28
|
-
.QoreIdButton as React.FC<IQoreIdButton>)
|
|
29
|
-
: (QoreIdButtonIOS as React.FC<IQoreIdButton>); // (require('./qoreIdButton.ios').QoreIdButton as React.FC<IQoreIdButton>);
|
|
30
1
|
|
|
31
2
|
export * from './utils';
|
|
3
|
+
export * from './qoreIdSdk'
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { NativeEventEmitter, NativeModules, Platform, } from 'react-native';
|
|
3
|
+
import type { OnResultType, DataType } from './types';
|
|
4
|
+
|
|
5
|
+
export const QoreIdSdk = {
|
|
6
|
+
/**
|
|
7
|
+
* lauches QoreID SDK
|
|
8
|
+
* @param initialData - data to launch Qore ID SDK
|
|
9
|
+
* @requires QoreIdSdk native module installed
|
|
10
|
+
*/
|
|
11
|
+
launch(initialData: DataType) {
|
|
12
|
+
NativeModules.QoreidSdk.launchQoreidSdk({
|
|
13
|
+
config: {
|
|
14
|
+
flowId: initialData.flowId || 0,
|
|
15
|
+
customerReference: initialData.customerReference,
|
|
16
|
+
productCode: initialData.productCode,
|
|
17
|
+
clientId: initialData.clientId,
|
|
18
|
+
},
|
|
19
|
+
applicantData: {
|
|
20
|
+
...initialData.applicantData,
|
|
21
|
+
},
|
|
22
|
+
addressData: {
|
|
23
|
+
...initialData.addressData,
|
|
24
|
+
},
|
|
25
|
+
acceptedDocuments: initialData.ocrAcceptedDocuments,
|
|
26
|
+
identityData: { ...initialData.identityData },
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* QoreIdSdk events listener. It takes callbacks to handle success and error events
|
|
32
|
+
* @param onSuccess Called on success with result
|
|
33
|
+
* @param onError Called on error with error object
|
|
34
|
+
*/
|
|
35
|
+
events(
|
|
36
|
+
onSuccess: (data: Omit<OnResultType, 'code'>) => void,
|
|
37
|
+
onError: (data: OnResultType) => void
|
|
38
|
+
) {
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const eventEmitter =
|
|
41
|
+
Platform.OS === 'android'
|
|
42
|
+
? new NativeEventEmitter()
|
|
43
|
+
: new NativeEventEmitter(NativeModules.QoreidSdk);
|
|
44
|
+
let eventListener = eventEmitter.addListener(
|
|
45
|
+
'onResult',
|
|
46
|
+
(event: OnResultType) => {
|
|
47
|
+
if (event?.code) {
|
|
48
|
+
onError?.(event);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
onSuccess?.(event);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
return () => {
|
|
56
|
+
eventEmitter.removeSubscription(eventListener);
|
|
57
|
+
};
|
|
58
|
+
}, []);
|
|
59
|
+
},
|
|
60
|
+
};
|
package/src/types.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { GestureResponderEvent } from 'react-native';
|
|
2
2
|
|
|
3
3
|
export interface DataType {
|
|
4
|
-
|
|
4
|
+
flowId?: number;
|
|
5
|
+
customerReference: string;
|
|
6
|
+
productCode: string;
|
|
7
|
+
clientId: string;
|
|
5
8
|
applicantData?: ApplicantData;
|
|
6
9
|
addressData?: AddressData;
|
|
7
|
-
|
|
10
|
+
ocrAcceptedDocuments: string[];
|
|
8
11
|
identityData?: IdentityData
|
|
9
12
|
}
|
|
10
13
|
|
|
@@ -47,53 +50,15 @@ export interface OnResultType {
|
|
|
47
50
|
message: string;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
export interface Options {
|
|
51
|
-
config: string;
|
|
52
|
-
onSubmitted?: (data: Omit<OnResultType, 'code'>) => void;
|
|
53
|
-
onError?: (data: OnResultType) => void;
|
|
54
|
-
buttonProps?: {
|
|
55
|
-
title?: string;
|
|
56
|
-
color?: string;
|
|
57
|
-
backgroundColor?: string;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
53
|
|
|
63
|
-
export interface BrowserEventData {
|
|
64
|
-
type: string;
|
|
65
|
-
detail: any;
|
|
66
|
-
}
|
|
67
54
|
|
|
68
|
-
declare interface IQoreIdButton <T = JSX.Element>{
|
|
69
|
-
title?: string
|
|
70
|
-
sdkSource?: string
|
|
71
|
-
flowId?: number
|
|
72
|
-
clientId: string
|
|
73
|
-
productCode?: string
|
|
74
|
-
customerReference: string
|
|
75
|
-
applicantData?: {
|
|
76
|
-
firstName: string,
|
|
77
|
-
middleName?: string,
|
|
78
|
-
lastName: string,
|
|
79
|
-
gender: 'male'|'female'|'others' | string,
|
|
80
|
-
phoneNumber?: string,
|
|
81
|
-
email?: string,
|
|
82
|
-
},
|
|
83
|
-
identityData?: {
|
|
84
|
-
idType: string,
|
|
85
|
-
idNumber: string,
|
|
86
|
-
},
|
|
87
|
-
addressData?: {
|
|
88
|
-
address: string,
|
|
89
|
-
city: string,
|
|
90
|
-
lga: string,
|
|
91
|
-
},
|
|
92
|
-
ocrAcceptedDocuments?: string,
|
|
93
|
-
onQoreIDSdkSubmitted: (data: BrowserEventData | Omit<OnResultType, 'code'>) => void;
|
|
94
|
-
onQoreIDSdkError: (data: BrowserEventData | OnResultType) => void;
|
|
95
|
-
onQoreIDSdkClosed: (data: BrowserEventData) => void;
|
|
96
|
-
/** Render custom button or a Pressable Component */
|
|
97
|
-
render?: ({onPress}:{onPress:(event: GestureResponderEvent) => void}) => T.onPress extends {onPress: (event: GestureResponderEvent) => void} ? T : never;
|
|
98
|
-
}
|
|
99
55
|
|
|
56
|
+
export type QoreIdSdkType = {
|
|
57
|
+
launchQoreId: (
|
|
58
|
+
initialData: DataType
|
|
59
|
+
) => void;
|
|
60
|
+
events: (
|
|
61
|
+
onSuccess: (data: Omit<OnResultType, 'code'>) => void,
|
|
62
|
+
onError: (data: OnResultType) => void
|
|
63
|
+
) => void;
|
|
64
|
+
}
|
package/ios/QoreidSdk.h
DELETED
package/ios/QoreidSdk.mm
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#import "QoreidSdk.h"
|
|
2
|
-
|
|
3
|
-
@implementation QoreidSdk
|
|
4
|
-
RCT_EXPORT_MODULE()
|
|
5
|
-
|
|
6
|
-
// Example method
|
|
7
|
-
// See // https://reactnative.dev/docs/native-modules-ios
|
|
8
|
-
RCT_REMAP_METHOD(multiply,
|
|
9
|
-
multiplyWithA:(double)a withB:(double)b
|
|
10
|
-
withResolver:(RCTPromiseResolveBlock)resolve
|
|
11
|
-
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
12
|
-
{
|
|
13
|
-
NSNumber *result = @(a * b);
|
|
14
|
-
|
|
15
|
-
resolve(result);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Don't compile this code when we build for the old architecture.
|
|
19
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
20
|
-
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
21
|
-
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
22
|
-
{
|
|
23
|
-
return std::make_shared<facebook::react::NativeQoreidSdkSpecJSI>(params);
|
|
24
|
-
}
|
|
25
|
-
#endif
|
|
26
|
-
|
|
27
|
-
@end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.QoreIdButton = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
const QoreIdButton = initialData => {
|
|
12
|
-
const onSubmitted = (0, _react.useCallback)(data => initialData.onQoreIDSdkSubmitted && initialData.onQoreIDSdkSubmitted(data), [initialData]);
|
|
13
|
-
const onError = (0, _react.useCallback)(data => initialData.onQoreIDSdkError && initialData.onQoreIDSdkError(data), [initialData]);
|
|
14
|
-
(0, _react.useEffect)(() => {
|
|
15
|
-
const eventEmitter = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.QoreidSdk);
|
|
16
|
-
let eventListener = eventEmitter.addListener('onResult', event => {
|
|
17
|
-
if (event !== null && event !== void 0 && event.code) {
|
|
18
|
-
onError && onError(event);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
onSubmitted && onSubmitted(event);
|
|
22
|
-
});
|
|
23
|
-
return () => {
|
|
24
|
-
eventListener.remove();
|
|
25
|
-
};
|
|
26
|
-
}, []);
|
|
27
|
-
const startDSK = () => {
|
|
28
|
-
var _initialData$ocrAccep;
|
|
29
|
-
_reactNative.NativeModules.QoreidSdk.launchQoreId(JSON.stringify({
|
|
30
|
-
config: {
|
|
31
|
-
flowId: initialData.flowId || 0,
|
|
32
|
-
customerRef: initialData.customerReference,
|
|
33
|
-
productCode: initialData.productCode,
|
|
34
|
-
clientId: initialData.clientId
|
|
35
|
-
},
|
|
36
|
-
applicantData: {
|
|
37
|
-
...initialData.applicantData
|
|
38
|
-
},
|
|
39
|
-
addressData: {
|
|
40
|
-
...initialData.addressData
|
|
41
|
-
},
|
|
42
|
-
acceptedDocuments: (_initialData$ocrAccep = initialData.ocrAcceptedDocuments) === null || _initialData$ocrAccep === void 0 ? void 0 : _initialData$ocrAccep.split(','),
|
|
43
|
-
identityData: {
|
|
44
|
-
...initialData.identityData
|
|
45
|
-
}
|
|
46
|
-
}));
|
|
47
|
-
};
|
|
48
|
-
return initialData.render ? initialData.render({
|
|
49
|
-
onPress: startDSK
|
|
50
|
-
}) : /*#__PURE__*/_react.default.createElement(_reactNative.Button, {
|
|
51
|
-
onPress: startDSK,
|
|
52
|
-
title: "Start Verification"
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
exports.QoreIdButton = QoreIdButton;
|
|
56
|
-
//# sourceMappingURL=qoreIdButton.android.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","QoreIdButton","initialData","onSubmitted","useCallback","data","onQoreIDSdkSubmitted","onError","onQoreIDSdkError","useEffect","eventEmitter","NativeEventEmitter","NativeModules","QoreidSdk","eventListener","addListener","event","code","remove","startDSK","_initialData$ocrAccep","launchQoreId","JSON","stringify","config","flowId","customerRef","customerReference","productCode","clientId","applicantData","addressData","acceptedDocuments","ocrAcceptedDocuments","split","identityData","render","onPress","createElement","Button","title","exports"],"sourceRoot":"../../src","sources":["qoreIdButton.android.tsx"],"mappings":"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"}
|