@qore-id/react-native-qoreid-sdk 1.1.4 → 1.2.2

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 (45) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/android/build.gradle +69 -63
  4. package/android/gradle.properties +5 -9
  5. package/android/src/main/AndroidManifest.xml +1 -1
  6. package/android/src/main/java/com/qoreidsdk/QoreidSdkModule.kt +169 -137
  7. package/android/src/main/java/com/qoreidsdk/QoreidSdkPackage.kt +1 -4
  8. package/ios/QoreidSdk.m +4 -13
  9. package/ios/QoreidSdk.swift +30 -23
  10. package/lib/commonjs/index.js +2 -2
  11. package/lib/commonjs/index.js.map +1 -1
  12. package/lib/commonjs/qoreIdSdk.js +32 -6
  13. package/lib/commonjs/qoreIdSdk.js.map +1 -1
  14. package/lib/commonjs/types.d.js.map +1 -1
  15. package/lib/commonjs/utils.js.map +1 -1
  16. package/lib/module/index.js +4 -2
  17. package/lib/module/index.js.map +1 -1
  18. package/lib/module/qoreIdSdk.js +33 -6
  19. package/lib/module/qoreIdSdk.js.map +1 -1
  20. package/lib/module/types.d.js +1 -1
  21. package/lib/module/types.d.js.map +1 -1
  22. package/lib/module/utils.js +2 -0
  23. package/lib/module/utils.js.map +1 -1
  24. package/lib/typescript/src/index.d.ts +4 -0
  25. package/lib/typescript/src/index.d.ts.map +1 -0
  26. package/lib/typescript/{qoreIdSdk.d.ts → src/qoreIdSdk.d.ts} +6 -1
  27. package/lib/typescript/src/qoreIdSdk.d.ts.map +1 -0
  28. package/lib/typescript/src/utils.d.ts.map +1 -0
  29. package/package.json +64 -42
  30. package/qore-id-react-native-qoreid-sdk.podspec +23 -16
  31. package/src/index.tsx +1 -0
  32. package/src/qoreIdSdk.tsx +40 -5
  33. package/src/types.d.ts +22 -3
  34. package/android/src/main/java/com/qoreidsdk/QoreIdJSData.kt +0 -50
  35. package/ios/QoreidSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
  36. package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  37. package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +0 -5
  38. package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcuserdata/e.ugwuoke.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  39. package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcuserdata/e.ugwuoke.xcuserdatad/WorkspaceSettings.xcsettings +0 -14
  40. package/ios/QoreidSdk.xcodeproj/xcuserdata/e.ugwuoke.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  41. package/lib/typescript/index.d.ts +0 -3
  42. package/lib/typescript/index.d.ts.map +0 -1
  43. package/lib/typescript/qoreIdSdk.d.ts.map +0 -1
  44. package/lib/typescript/utils.d.ts.map +0 -1
  45. /package/lib/typescript/{utils.d.ts → src/utils.d.ts} +0 -0
@@ -11,25 +11,32 @@ Pod::Spec.new do |s|
11
11
  s.license = package["license"]
12
12
  s.authors = package["author"]
13
13
 
14
- s.platforms = { :ios => "12.0" }
14
+ s.platforms = { :ios => min_ios_version_supported }
15
15
  s.source = { :git => "https://.git", :tag => "#{s.version}" }
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
- s.dependency "React-Core"
19
18
  s.dependency 'QoreIDSDK'
20
-
21
- # Don't install the dependencies when we run `pod install` in the old architecture.
22
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
23
- s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
24
- s.pod_target_xcconfig = {
25
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
26
- "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
27
- "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
28
- }
29
- s.dependency "React-Codegen"
30
- s.dependency "RCT-Folly"
31
- s.dependency "RCTRequired"
32
- s.dependency "RCTTypeSafety"
33
- s.dependency "ReactCommon/turbomodule/core"
19
+
20
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
21
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
22
+ if respond_to?(:install_modules_dependencies, true)
23
+ install_modules_dependencies(s)
24
+ else
25
+ s.dependency "React-Core"
26
+
27
+ # Don't install the dependencies when we run `pod install` in the old architecture.
28
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
29
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
30
+ s.pod_target_xcconfig = {
31
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
32
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
33
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
34
+ }
35
+ s.dependency "React-Codegen"
36
+ s.dependency "RCT-Folly"
37
+ s.dependency "RCTRequired"
38
+ s.dependency "RCTTypeSafety"
39
+ s.dependency "ReactCommon/turbomodule/core"
40
+ end
34
41
  end
35
42
  end
package/src/index.tsx CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './utils';
2
2
  export * from './qoreIdSdk';
3
+ export type { QoreIdData, OnResult } from './types';
package/src/qoreIdSdk.tsx CHANGED
@@ -1,5 +1,25 @@
1
1
  import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
2
2
  import type { OnResult, QoreIdData } from './types';
3
+ import { useEffect } from 'react';
4
+
5
+ const LINKING_ERROR =
6
+ `The package '@qoreid/react-native-qoreid-sdk' doesn't seem to be linked. Make sure: \n\n` +
7
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
8
+ '- You rebuilt the app after installing the package\n' +
9
+ '- You are not using Expo Go\n';
10
+
11
+ const QoreidRNModule = NativeModules.QoreidSdk;
12
+
13
+ const ReactNativeQoreidSdkModule =
14
+ QoreidRNModule ??
15
+ new Proxy(
16
+ {},
17
+ {
18
+ get() {
19
+ throw new Error(LINKING_ERROR);
20
+ },
21
+ }
22
+ );
3
23
 
4
24
  export const QoreIdSdk = {
5
25
  /**
@@ -7,14 +27,14 @@ export const QoreIdSdk = {
7
27
  * @param initialData - data to launch Qore ID SDK
8
28
  * @requires QoreIdSdk native module installed
9
29
  */
10
- launch(initialData: QoreIdData, _callback?: (data: OnResult) => void) {
30
+ launch(initialData: QoreIdData) {
11
31
  const payload = {
12
32
  config: {
13
33
  flowId: initialData.flowId || 0,
14
34
  customerReference: initialData.customerReference,
15
35
  productCode: initialData.productCode,
16
36
  clientId: initialData.clientId,
17
- defaultIdType: initialData?.defaultIdType || '',
37
+ defaultIdType: initialData?.defaultIdType ?? '',
18
38
  },
19
39
  applicantData: {
20
40
  ...initialData.applicantData,
@@ -24,9 +44,9 @@ export const QoreIdSdk = {
24
44
  },
25
45
  acceptedDocuments: initialData.ocrAcceptedDocuments,
26
46
  identityData: { ...initialData.identityData },
47
+ extraData: initialData.extraData,
27
48
  };
28
-
29
- NativeModules.QoreidSdk.launchQoreidSdk(payload);
49
+ ReactNativeQoreidSdkModule.launchQoreidSdk(payload);
30
50
  },
31
51
 
32
52
  /**
@@ -37,7 +57,7 @@ export const QoreIdSdk = {
37
57
  const eventEmitter =
38
58
  Platform.OS === 'android'
39
59
  ? new NativeEventEmitter()
40
- : new NativeEventEmitter(NativeModules.QoreidSdk);
60
+ : new NativeEventEmitter(ReactNativeQoreidSdkModule);
41
61
  let eventListener = eventEmitter?.addListener('onResult', callback);
42
62
 
43
63
  return () => {
@@ -45,3 +65,18 @@ export const QoreIdSdk = {
45
65
  };
46
66
  },
47
67
  };
68
+
69
+ export function useQoreIdSdk({
70
+ onResult,
71
+ }: {
72
+ onResult: (data: OnResult) => void;
73
+ }) {
74
+ useEffect(() => {
75
+ const unsubscribed = QoreIdSdk.events(onResult);
76
+ return () => {
77
+ unsubscribed();
78
+ };
79
+ }, [onResult]);
80
+
81
+ return { launchQoreId: QoreIdSdk.launch };
82
+ }
package/src/types.d.ts CHANGED
@@ -8,6 +8,13 @@ export interface QoreIdData {
8
8
  addressData?: AddressData;
9
9
  ocrAcceptedDocuments: string[];
10
10
  identityData?: IdentityData;
11
+ /** extra property is only usable for internal use only */
12
+ extraData?: {
13
+ organisationId: string;
14
+ organisationName: string;
15
+ requestSource: string;
16
+ internalReferenceId: string;
17
+ };
11
18
  }
12
19
 
13
20
  interface IConfig {
@@ -45,11 +52,23 @@ interface AddressData {
45
52
 
46
53
  export interface OnResult {
47
54
  code: string;
48
- data: string;
55
+ data: Record<string, unknown> | string | number | null;
56
+ event: 'SESSION_RESULT' | 'SUCCESS_RESULT' | 'ERROR_RESULT';
49
57
  message: string;
50
58
  }
51
59
 
52
60
  export type QoreIdSdk = {
53
- launchQoreId: (initialData: DataTyp) => void;
54
- events: (OnResult: (data: OnResultType) => void) => void;
61
+ launchQoreId: (initialData: QoreIdData) => void;
62
+ events: (OnResult: (data: OnResult) => void) => void;
63
+ };
64
+
65
+ export function useQoreIdSdk({
66
+ onResult,
67
+ }: {
68
+ onResult: (data: OnResult) => void;
69
+ }): {
70
+ launchQoreId: (
71
+ initialData: QoreIdData,
72
+ _callback?: (data: OnResult) => void
73
+ ) => void;
55
74
  };
@@ -1,50 +0,0 @@
1
- package com.qoreidsdk
2
-
3
- data class Config (
4
- val flowId: Long? = 0,
5
- val customerRef: String,
6
- val productCode: String,
7
- val clientId: String,
8
- val acceptedDocuments: List<String>,
9
- )
10
-
11
- data class ApplicantData(
12
- val firstName: String,
13
- val lastName: String,
14
- val phoneNumber: String,
15
- val email: String,
16
- val dob: String,
17
- val gender: String,
18
- val middleName:String
19
- )
20
-
21
- data class IdentityData(
22
- val idType: String,
23
- val idNumber: String,
24
- )
25
-
26
- data class AddressData(
27
- val address: String,
28
- val town: String,
29
- val lga: String,
30
- val city: String,
31
- val state: String,
32
- val region: String,
33
- val district: String,
34
- val virAddress: String
35
- )
36
-
37
- data class QoreIdJSData(
38
- val config: Config,
39
- val applicantData: ApplicantData,
40
- val addressData: AddressData,
41
- val acceptedDocuments: List<String>,
42
- val identityData: IdentityData
43
- )
44
-
45
-
46
- data class StyleOptionsData (
47
- val color:String,
48
- val backgroundColor:String,
49
- val title: String
50
- )
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- </Workspace>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict/>
5
- </plist>
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>BuildLocationStyle</key>
6
- <string>UseAppPreferences</string>
7
- <key>CustomBuildLocationType</key>
8
- <string>RelativeToDerivedData</string>
9
- <key>DerivedDataLocationStyle</key>
10
- <string>Default</string>
11
- <key>ShowSharedSchemesAutomaticallyEnabled</key>
12
- <true/>
13
- </dict>
14
- </plist>
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>SchemeUserState</key>
6
- <dict>
7
- <key>QoreidSdk.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>
@@ -1,3 +0,0 @@
1
- export * from './utils';
2
- export * from './qoreIdSdk';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"qoreIdSdk.d.ts","sourceRoot":"","sources":["../../src/qoreIdSdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,SAAS;IACpB;;;;OAIG;wBACiB,UAAU,sBAAqB,QAAQ,KAAK,IAAI;IAsBpE;;;OAGG;4BACqB,QAAQ,KAAK,IAAI;CAW1C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAqEA,eAAO,MAAM,KAAK;;;;;;;CAGjB,CAAC"}
File without changes