@qore-id/react-native-qoreid-sdk 1.2.5 → 2.0.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/LICENSE +1 -1
- package/README.md +6 -2
- package/RNQoreIdSdk.podspec +22 -0
- package/android/build.gradle +25 -46
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/qoreid/reactnativeqoreidsdk/RNQoreIdSdkModule.kt +220 -0
- package/android/src/main/java/com/qoreid/reactnativeqoreidsdk/RNQoreIdSdkPackage.kt +33 -0
- package/ios/{QoreidSdk.swift → RCTRNQoreIdSdk.swift} +28 -15
- package/ios/RNQoreIdSdk.h +14 -0
- package/ios/RNQoreIdSdk.mm +38 -0
- package/lib/module/NativeRNQoreIdSdk.js +5 -0
- package/lib/module/NativeRNQoreIdSdk.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/qoreIdSdk.js +9 -9
- package/lib/module/qoreIdSdk.js.map +1 -1
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeRNQoreIdSdk.d.ts +8 -0
- package/lib/typescript/src/NativeRNQoreIdSdk.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/qoreIdSdk.d.ts +4 -4
- package/lib/typescript/src/qoreIdSdk.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +51 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +1 -0
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/package.json +42 -71
- package/src/NativeRNQoreIdSdk.ts +12 -0
- package/src/index.tsx +1 -0
- package/src/qoreIdSdk.tsx +11 -19
- package/src/{types.d.ts → types.ts} +16 -31
- package/src/utils.ts +2 -0
- package/android/src/main/java/com/qoreidsdk/QoreidSdkModule.kt +0 -241
- package/android/src/main/java/com/qoreidsdk/QoreidSdkPackage.kt +0 -17
- package/ios/QoreidSdk-Bridging-Header.h +0 -7
- package/ios/QoreidSdk.m +0 -12
- package/ios/QoreidSdk.xcodeproj/project.pbxproj +0 -292
- package/lib/commonjs/QoreIDSDKSpec.js +0 -9
- package/lib/commonjs/QoreIDSDKSpec.js.map +0 -1
- package/lib/commonjs/index.js +0 -28
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/qoreIdSdk.js +0 -93
- package/lib/commonjs/qoreIdSdk.js.map +0 -1
- package/lib/commonjs/types.d.js +0 -13
- package/lib/commonjs/types.d.js.map +0 -1
- package/lib/commonjs/utils.js +0 -19
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/module/QoreIDSDKSpec.js +0 -5
- package/lib/module/QoreIDSDKSpec.js.map +0 -1
- package/lib/module/types.d.js +0 -4
- package/lib/module/types.d.js.map +0 -1
- package/lib/typescript/src/QoreIDSDKSpec.d.ts +0 -7
- package/lib/typescript/src/QoreIDSDKSpec.d.ts.map +0 -1
- package/qore-id-react-native-qoreid-sdk.podspec +0 -42
- package/src/QoreIDSDKSpec.ts +0 -8
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CodegenTypes, type TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
launchQoreidSdk: (arg: Object) => void;
|
|
4
|
+
readonly onResult: CodegenTypes.EventEmitter<Object>;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: Spec;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=NativeRNQoreIdSdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeRNQoreIdSdk.d.ts","sourceRoot":"","sources":["../../../src/NativeRNQoreIdSdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;CACtD;;AAED,wBAAqE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { QoreIdData, QoreIdSdkCallback } from './types';
|
|
2
2
|
export declare const QoreIdSdk: {
|
|
3
3
|
/**
|
|
4
4
|
* lauches QoreID SDK
|
|
@@ -10,10 +10,10 @@ export declare const QoreIdSdk: {
|
|
|
10
10
|
* QoreIdSdk events listener. It takes callbacks to handle success and error events
|
|
11
11
|
* @param callback(data: OnResultType) Handles various events from QoreID SDK
|
|
12
12
|
*/
|
|
13
|
-
events(callback:
|
|
13
|
+
events(callback: QoreIdSdkCallback): () => void;
|
|
14
14
|
};
|
|
15
|
-
export declare function useQoreIdSdk({ onResult
|
|
16
|
-
onResult:
|
|
15
|
+
export declare function useQoreIdSdk({ onResult }: {
|
|
16
|
+
onResult: QoreIdSdkCallback;
|
|
17
17
|
}): {
|
|
18
18
|
launchQoreId: (data: QoreIdData) => void;
|
|
19
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qoreIdSdk.d.ts","sourceRoot":"","sources":["../../../src/qoreIdSdk.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qoreIdSdk.d.ts","sourceRoot":"","sources":["../../../src/qoreIdSdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAmCvE,eAAO,MAAM,SAAS;IACpB;;;;OAIG;iBACU,UAAU;IAyBvB;;;OAGG;qBACc,iBAAiB;CAOnC,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,iBAAiB,CAAA;CAAE;yBAtC3D,UAAU;EA+CxB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface QoreIdData {
|
|
2
|
+
flowId?: number;
|
|
3
|
+
customerReference: string;
|
|
4
|
+
productCode: string;
|
|
5
|
+
clientId: string;
|
|
6
|
+
defaultIdType?: string;
|
|
7
|
+
applicantData?: ApplicantData;
|
|
8
|
+
addressData?: AddressData;
|
|
9
|
+
ocrAcceptedDocuments?: string[];
|
|
10
|
+
identityData?: IdentityData;
|
|
11
|
+
/** extra property is only usable for internal use only */
|
|
12
|
+
extraData?: ExtraData;
|
|
13
|
+
}
|
|
14
|
+
export interface ExtraData {
|
|
15
|
+
organisationId: string;
|
|
16
|
+
organisationName: string;
|
|
17
|
+
requestSource: string;
|
|
18
|
+
internalReferenceId: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ApplicantData {
|
|
21
|
+
firstName?: string;
|
|
22
|
+
lastName?: string;
|
|
23
|
+
phoneNumber?: string;
|
|
24
|
+
email?: string;
|
|
25
|
+
dob?: string;
|
|
26
|
+
gender?: string;
|
|
27
|
+
middleName?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface IdentityData {
|
|
30
|
+
idType?: string;
|
|
31
|
+
idNumber?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface AddressData {
|
|
34
|
+
address?: string;
|
|
35
|
+
town?: string;
|
|
36
|
+
lga?: string;
|
|
37
|
+
city?: string;
|
|
38
|
+
state?: string;
|
|
39
|
+
region?: string;
|
|
40
|
+
district?: string;
|
|
41
|
+
virAddress?: string;
|
|
42
|
+
}
|
|
43
|
+
export type QoreIdSdkEvent = 'SESSION_RESULT' | 'SUCCESS_RESULT' | 'ERROR_RESULT';
|
|
44
|
+
export interface OnResult {
|
|
45
|
+
code: string;
|
|
46
|
+
data: Record<string, unknown> | string | number | null;
|
|
47
|
+
event: QoreIdSdkEvent;
|
|
48
|
+
message: string;
|
|
49
|
+
}
|
|
50
|
+
export type QoreIdSdkCallback = (result: OnResult) => void | Promise<void>;
|
|
51
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,0DAA0D;IAC1D,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,cAAc,GACtB,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,CAAC;AAEnB,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACvD,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAqEA,eAAO,MAAM,KAAK;;;;;;;CAGjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAqEA,eAAO,MAAM,KAAK;;;;;;;CAGjB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qore-id/react-native-qoreid-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "QoreId React Native SDK",
|
|
5
|
-
"
|
|
6
|
-
"main": "./lib/commonjs/index.js",
|
|
7
|
-
"module": "./lib/module/index.js",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
8
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
9
7
|
"exports": {
|
|
10
8
|
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
11
10
|
"types": "./lib/typescript/src/index.d.ts",
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
15
14
|
},
|
|
16
15
|
"files": [
|
|
17
16
|
"src",
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
"ios",
|
|
21
20
|
"cpp",
|
|
22
21
|
"*.podspec",
|
|
23
|
-
"react-native.config.
|
|
22
|
+
"react-native.config.js",
|
|
24
23
|
"!ios/build",
|
|
25
24
|
"!android/build",
|
|
26
25
|
"!android/gradle",
|
|
@@ -39,7 +38,7 @@
|
|
|
39
38
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
39
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
41
40
|
"prepare": "bob build",
|
|
42
|
-
"release": "release-it"
|
|
41
|
+
"release": "release-it --only-version"
|
|
43
42
|
},
|
|
44
43
|
"keywords": [
|
|
45
44
|
"react-native",
|
|
@@ -50,7 +49,7 @@
|
|
|
50
49
|
"type": "git",
|
|
51
50
|
"url": "git+https://.git"
|
|
52
51
|
},
|
|
53
|
-
"author": "Emmannuel
|
|
52
|
+
"author": "Emmannuel <e.ugwuoke@verifyme.ng> (https://)",
|
|
54
53
|
"license": "MIT",
|
|
55
54
|
"bugs": {
|
|
56
55
|
"url": "https:///issues"
|
|
@@ -60,32 +59,32 @@
|
|
|
60
59
|
"registry": "https://registry.npmjs.org/"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
63
|
-
"@commitlint/config-conventional": "^
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
62
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
63
|
+
"@eslint/compat": "^1.3.2",
|
|
64
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
65
|
+
"@eslint/js": "^9.35.0",
|
|
66
|
+
"@evilmartians/lefthook": "^1.12.3",
|
|
67
|
+
"@react-native-community/cli": "20.0.1",
|
|
68
|
+
"@react-native/babel-preset": "0.81.1",
|
|
69
|
+
"@react-native/eslint-config": "^0.81.1",
|
|
70
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
71
|
+
"@testing-library/react-native": "^13.3.3",
|
|
72
|
+
"@types/jest": "^29.5.14",
|
|
73
|
+
"@types/react": "^19.1.0",
|
|
74
|
+
"commitlint": "^19.8.1",
|
|
75
|
+
"del-cli": "^6.0.0",
|
|
76
|
+
"eslint": "^9.35.0",
|
|
77
|
+
"eslint-config-prettier": "^10.1.8",
|
|
78
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
77
79
|
"jest": "^29.7.0",
|
|
78
|
-
"prettier": "^3.
|
|
79
|
-
"react": "
|
|
80
|
-
"react-native": "0.
|
|
81
|
-
"react-native-builder-bob": "^0.
|
|
82
|
-
"react-test-renderer": "
|
|
83
|
-
"release-it": "^
|
|
84
|
-
"turbo": "^
|
|
85
|
-
"typescript": "^5.
|
|
86
|
-
},
|
|
87
|
-
"resolutions": {
|
|
88
|
-
"@types/react": "^18.2.44"
|
|
80
|
+
"prettier": "^3.6.2",
|
|
81
|
+
"react": "19.1.0",
|
|
82
|
+
"react-native": "0.81.1",
|
|
83
|
+
"react-native-builder-bob": "^0.40.13",
|
|
84
|
+
"react-test-renderer": "19.1.0",
|
|
85
|
+
"release-it": "^19.0.4",
|
|
86
|
+
"turbo": "^2.5.6",
|
|
87
|
+
"typescript": "^5.9.2"
|
|
89
88
|
},
|
|
90
89
|
"peerDependencies": {
|
|
91
90
|
"react": "*",
|
|
@@ -120,34 +119,12 @@
|
|
|
120
119
|
},
|
|
121
120
|
"plugins": {
|
|
122
121
|
"@release-it/conventional-changelog": {
|
|
123
|
-
"preset":
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"eslintConfig": {
|
|
128
|
-
"root": true,
|
|
129
|
-
"extends": [
|
|
130
|
-
"@react-native",
|
|
131
|
-
"prettier"
|
|
132
|
-
],
|
|
133
|
-
"rules": {
|
|
134
|
-
"react/react-in-jsx-scope": "off",
|
|
135
|
-
"prettier/prettier": [
|
|
136
|
-
"error",
|
|
137
|
-
{
|
|
138
|
-
"quoteProps": "consistent",
|
|
139
|
-
"singleQuote": true,
|
|
140
|
-
"tabWidth": 2,
|
|
141
|
-
"trailingComma": "es5",
|
|
142
|
-
"useTabs": false
|
|
122
|
+
"preset": {
|
|
123
|
+
"name": "angular"
|
|
143
124
|
}
|
|
144
|
-
|
|
125
|
+
}
|
|
145
126
|
}
|
|
146
127
|
},
|
|
147
|
-
"eslintIgnore": [
|
|
148
|
-
"node_modules/",
|
|
149
|
-
"lib/"
|
|
150
|
-
],
|
|
151
128
|
"prettier": {
|
|
152
129
|
"quoteProps": "consistent",
|
|
153
130
|
"singleQuote": true,
|
|
@@ -159,12 +136,6 @@
|
|
|
159
136
|
"source": "src",
|
|
160
137
|
"output": "lib",
|
|
161
138
|
"targets": [
|
|
162
|
-
[
|
|
163
|
-
"commonjs",
|
|
164
|
-
{
|
|
165
|
-
"esm": true
|
|
166
|
-
}
|
|
167
|
-
],
|
|
168
139
|
[
|
|
169
140
|
"module",
|
|
170
141
|
{
|
|
@@ -180,16 +151,16 @@
|
|
|
180
151
|
]
|
|
181
152
|
},
|
|
182
153
|
"codegenConfig": {
|
|
183
|
-
"name": "
|
|
154
|
+
"name": "RNQoreIdSdkSpec",
|
|
184
155
|
"type": "modules",
|
|
185
156
|
"jsSrcsDir": "src",
|
|
186
157
|
"android": {
|
|
187
|
-
"javaPackageName": "com.
|
|
158
|
+
"javaPackageName": "com.qoreid.reactnativeqoreidsdk"
|
|
188
159
|
}
|
|
189
160
|
},
|
|
190
161
|
"create-react-native-library": {
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"version": "0.
|
|
162
|
+
"languages": "kotlin-objc",
|
|
163
|
+
"type": "turbo-module",
|
|
164
|
+
"version": "0.54.7"
|
|
194
165
|
}
|
|
195
166
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TurboModuleRegistry,
|
|
3
|
+
type CodegenTypes,
|
|
4
|
+
type TurboModule,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
|
|
7
|
+
export interface Spec extends TurboModule {
|
|
8
|
+
launchQoreidSdk: (arg: Object) => void;
|
|
9
|
+
readonly onResult: CodegenTypes.EventEmitter<Object>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNQoreIdSdk');
|
package/src/index.tsx
CHANGED
package/src/qoreIdSdk.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
2
1
|
import { useEffect } from 'react';
|
|
2
|
+
import type { OnResult, QoreIdData, QoreIdSdkCallback } from './types';
|
|
3
|
+
import NativeRNQoreIdSdk from './NativeRNQoreIdSdk';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
import type { OnResult, QoreIdData } from './types';
|
|
5
|
+
const QoreIDSDKModule = NativeRNQoreIdSdk;
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @name validateLaunchData
|
|
@@ -42,7 +42,7 @@ export const QoreIdSdk = {
|
|
|
42
42
|
*/
|
|
43
43
|
launch(data: QoreIdData) {
|
|
44
44
|
// Validate the initial data
|
|
45
|
-
validateLaunchData(data,
|
|
45
|
+
validateLaunchData(data, QoreIDSDKModule);
|
|
46
46
|
|
|
47
47
|
const payload = {
|
|
48
48
|
config: {
|
|
@@ -62,31 +62,23 @@ export const QoreIdSdk = {
|
|
|
62
62
|
identityData: { ...data.identityData },
|
|
63
63
|
extraData: data.extraData,
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
QoreIDSDKModule.launchQoreidSdk(payload);
|
|
66
66
|
},
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* QoreIdSdk events listener. It takes callbacks to handle success and error events
|
|
70
70
|
* @param callback(data: OnResultType) Handles various events from QoreID SDK
|
|
71
71
|
*/
|
|
72
|
-
events(callback:
|
|
73
|
-
const eventEmitter =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
: new NativeEventEmitter(NativeModules.QoreidSdk);
|
|
77
|
-
let eventListener = eventEmitter?.addListener('onResult', callback);
|
|
72
|
+
events(callback: QoreIdSdkCallback) {
|
|
73
|
+
const eventEmitter = QoreIDSDKModule.onResult((data) => {
|
|
74
|
+
callback(data as unknown as OnResult);
|
|
75
|
+
});
|
|
78
76
|
|
|
79
|
-
return () =>
|
|
80
|
-
eventListener.remove();
|
|
81
|
-
};
|
|
77
|
+
return () => eventEmitter.remove();
|
|
82
78
|
},
|
|
83
79
|
};
|
|
84
80
|
|
|
85
|
-
export function useQoreIdSdk({
|
|
86
|
-
onResult,
|
|
87
|
-
}: {
|
|
88
|
-
onResult: (data: OnResult) => void;
|
|
89
|
-
}) {
|
|
81
|
+
export function useQoreIdSdk({ onResult }: { onResult: QoreIdSdkCallback }) {
|
|
90
82
|
useEffect(() => {
|
|
91
83
|
const unsubscribed = QoreIdSdk.events(onResult);
|
|
92
84
|
return () => {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { utils } from './utils';
|
|
2
|
-
|
|
3
1
|
export interface QoreIdData {
|
|
4
2
|
flowId?: number;
|
|
5
3
|
customerReference: string;
|
|
@@ -11,22 +9,17 @@ export interface QoreIdData {
|
|
|
11
9
|
ocrAcceptedDocuments?: string[];
|
|
12
10
|
identityData?: IdentityData;
|
|
13
11
|
/** extra property is only usable for internal use only */
|
|
14
|
-
extraData?:
|
|
15
|
-
organisationId: string;
|
|
16
|
-
organisationName: string;
|
|
17
|
-
requestSource: string;
|
|
18
|
-
internalReferenceId: string;
|
|
19
|
-
};
|
|
12
|
+
extraData?: ExtraData;
|
|
20
13
|
}
|
|
21
14
|
|
|
22
|
-
interface
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
export interface ExtraData {
|
|
16
|
+
organisationId: string;
|
|
17
|
+
organisationName: string;
|
|
18
|
+
requestSource: string;
|
|
19
|
+
internalReferenceId: string;
|
|
27
20
|
}
|
|
28
21
|
|
|
29
|
-
interface ApplicantData {
|
|
22
|
+
export interface ApplicantData {
|
|
30
23
|
firstName?: string;
|
|
31
24
|
lastName?: string;
|
|
32
25
|
phoneNumber?: string;
|
|
@@ -36,12 +29,12 @@ interface ApplicantData {
|
|
|
36
29
|
middleName?: string;
|
|
37
30
|
}
|
|
38
31
|
|
|
39
|
-
interface IdentityData {
|
|
32
|
+
export interface IdentityData {
|
|
40
33
|
idType?: string;
|
|
41
34
|
idNumber?: string;
|
|
42
35
|
}
|
|
43
36
|
|
|
44
|
-
interface AddressData {
|
|
37
|
+
export interface AddressData {
|
|
45
38
|
address?: string;
|
|
46
39
|
town?: string;
|
|
47
40
|
lga?: string;
|
|
@@ -52,24 +45,16 @@ interface AddressData {
|
|
|
52
45
|
virAddress?: string;
|
|
53
46
|
}
|
|
54
47
|
|
|
48
|
+
export type QoreIdSdkEvent =
|
|
49
|
+
| 'SESSION_RESULT'
|
|
50
|
+
| 'SUCCESS_RESULT'
|
|
51
|
+
| 'ERROR_RESULT';
|
|
52
|
+
|
|
55
53
|
export interface OnResult {
|
|
56
54
|
code: string;
|
|
57
55
|
data: Record<string, unknown> | string | number | null;
|
|
58
|
-
event:
|
|
56
|
+
event: QoreIdSdkEvent;
|
|
59
57
|
message: string;
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
export type
|
|
63
|
-
launchQoreId: (initialData: QoreIdData) => void;
|
|
64
|
-
events: (OnResult: (data: OnResult) => void) => void;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export function useQoreIdSdk({
|
|
68
|
-
onResult,
|
|
69
|
-
}: {
|
|
70
|
-
onResult: (data: OnResult) => void;
|
|
71
|
-
}): {
|
|
72
|
-
launchQoreId: (initialData: QoreIdData) => void;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export type Utils = typeof utils;
|
|
60
|
+
export type QoreIdSdkCallback = (result: OnResult) => void | Promise<void>;
|