idwise-nfc-react-native-sdk 4.9.5 → 5.0.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 (54) hide show
  1. package/android/build.gradle +5 -5
  2. package/android/gradle.properties +1 -1
  3. package/android/src/main/java/com/idwisemobilesdk/IdwiseMobileSdkModule.kt +94 -73
  4. package/idwise-react-native-sdk.podspec +3 -4
  5. package/ios/IDWiseNFC.framework/Assets.car +0 -0
  6. package/ios/IDWiseNFC.framework/IDWiseNFC +0 -0
  7. package/ios/IDWiseNFC.framework/Info.plist +0 -0
  8. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  9. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  10. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/arm64-apple-ios.abi.json +5689 -4620
  11. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/arm64-apple-ios.private.swiftinterface +95 -57
  12. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/arm64-apple-ios.swiftinterface +95 -57
  13. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  14. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/x86_64-apple-ios-simulator.abi.json +5689 -4620
  15. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +95 -57
  16. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +95 -57
  17. package/ios/IDWiseNFC.framework/Modules/IDWiseNFC.swiftmodule/x86_64-apple-ios-simulator.swiftmodule +0 -0
  18. package/ios/IDWiseNFC.framework/ProcessJourneyViewController.storyboardc/yS7-79-T86-view-owr-v5-NaP.nib/objects-13.0+.nib +0 -0
  19. package/ios/IDWiseNFC.framework/ProcessJourneyViewController.storyboardc/yS7-79-T86-view-owr-v5-NaP.nib/runtime.nib +0 -0
  20. package/ios/IDWiseNFC.framework/document_detector.mlmodelc/metadata.json +2 -2
  21. package/ios/IDWiseNFC.framework/document_detector.mlmodelc/model0/coremldata.bin +0 -0
  22. package/ios/IdwiseMobileSdk.mm +5 -2
  23. package/ios/IdwiseMobileSdk.swift +160 -115
  24. package/lib/commonjs/ApplicantDetailsKeys.js +12 -0
  25. package/lib/commonjs/ApplicantDetailsKeys.js.map +1 -0
  26. package/lib/commonjs/IDWise.js +3 -38
  27. package/lib/commonjs/IDWise.js.map +1 -1
  28. package/lib/commonjs/IDWiseConstants.js +3 -3
  29. package/lib/commonjs/IDWiseConstants.js.map +1 -1
  30. package/lib/commonjs/IDWiseDynamic.js +60 -0
  31. package/lib/commonjs/IDWiseDynamic.js.map +1 -0
  32. package/lib/commonjs/IDWiseEventListeners.js +16 -11
  33. package/lib/commonjs/IDWiseEventListeners.js.map +1 -1
  34. package/lib/commonjs/index.js +4 -2
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/module/ApplicantDetailsKeys.js +6 -0
  37. package/lib/module/ApplicantDetailsKeys.js.map +1 -0
  38. package/lib/module/IDWise.js +4 -39
  39. package/lib/module/IDWise.js.map +1 -1
  40. package/lib/module/IDWiseConstants.js +2 -2
  41. package/lib/module/IDWiseConstants.js.map +1 -1
  42. package/lib/module/IDWiseDynamic.js +54 -0
  43. package/lib/module/IDWiseDynamic.js.map +1 -0
  44. package/lib/module/IDWiseEventListeners.js +16 -11
  45. package/lib/module/IDWiseEventListeners.js.map +1 -1
  46. package/lib/module/index.js +4 -2
  47. package/lib/module/index.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/ApplicantDetailsKeys.js +5 -0
  50. package/src/IDWise.js +8 -64
  51. package/src/IDWiseConstants.js +2 -2
  52. package/src/IDWiseDynamic.js +98 -0
  53. package/src/IDWiseEventListeners.js +17 -16
  54. package/src/index.js +3 -2
@@ -0,0 +1,98 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ import {
3
+ setInitializeEventListeners,
4
+ setJourneyEventListeners,
5
+ setJourneySummaryEventListener,
6
+ setStepEventListeners,
7
+ } from './IDWiseEventListeners';
8
+
9
+ const LINKING_ERROR =
10
+ `The package 'idwise-mobile-sdk' doesn't seem to be linked. Make sure: \n\n` +
11
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
12
+ '- You rebuilt the app after installing the package\n' +
13
+ '- You are not using Expo Go\n';
14
+
15
+ const RNIDWise = NativeModules.IdwiseMobileSdk
16
+ ? NativeModules.IdwiseMobileSdk
17
+ : new Proxy(
18
+ {},
19
+ {
20
+ get() {
21
+ throw new Error(LINKING_ERROR);
22
+ },
23
+ }
24
+ );
25
+
26
+ const initialize = (clientKey, theme, callback) => {
27
+ console.log('IDWise - initialize');
28
+ setInitializeEventListeners(callback);
29
+
30
+ RNIDWise.initialize(clientKey, theme);
31
+ };
32
+
33
+ const startJourney = (
34
+ journeyDefinitionId,
35
+ referenceNo,
36
+ locale,
37
+ applicantDetails,
38
+ journeyCallback,
39
+ stepCallback
40
+ ) => {
41
+ console.log('IDWise - startDynamicJourney');
42
+ setJourneyEventListeners(journeyCallback);
43
+ setStepEventListeners(stepCallback);
44
+
45
+ RNIDWise.startDynamicJourney(
46
+ journeyDefinitionId,
47
+ referenceNo,
48
+ locale,
49
+ applicantDetails
50
+ );
51
+ };
52
+
53
+ const resumeJourney = (
54
+ journeyDefinitionId,
55
+ journeyId,
56
+ locale,
57
+ journeyCallback,
58
+ stepCallback
59
+ ) => {
60
+ console.log('IDWise - resumeDynamicJourney');
61
+ setJourneyEventListeners(journeyCallback);
62
+ setStepEventListeners(stepCallback);
63
+
64
+ RNIDWise.resumeDynamicJourney(journeyDefinitionId, journeyId, locale);
65
+ };
66
+
67
+ const startStep = (stepId) => RNIDWise.startStep(stepId);
68
+
69
+ const skipStep = (stepId) => RNIDWise.skipStep(stepId);
70
+
71
+ const getJourneySummary = (callback) => {
72
+ console.log('IDWise - getJourneySummary');
73
+ setJourneySummaryEventListener(callback);
74
+
75
+ RNIDWise.getJourneySummary();
76
+ };
77
+
78
+ const finishJourney = () => {
79
+ console.log('IDWise - finishDynamicJourney');
80
+
81
+ RNIDWise.finishDynamicJourney();
82
+ };
83
+
84
+ const unloadSDK = () => {
85
+ console.log('IDWise - unloadSDK');
86
+ RNIDWise.unloadSDK();
87
+ };
88
+
89
+ export const IDWiseDynamic = {
90
+ initialize,
91
+ startJourney,
92
+ startStep,
93
+ getJourneySummary,
94
+ finishJourney,
95
+ skipStep,
96
+ resumeJourney,
97
+ unloadSDK,
98
+ };
@@ -19,7 +19,7 @@ const setInitializeEventListeners = (idwiseInitializeCallback) => {
19
19
  eventEmitter.removeAllListeners(IDWiseEvents.EVENT_INITIALIZE_ERRROR);
20
20
 
21
21
  eventEmitter.addListener(IDWiseEvents.EVENT_INITIALIZE_ERRROR, (event) => {
22
- idwiseInitializeCallback?.onError(event);
22
+ idwiseInitializeCallback?.onError(JSON.parse(event.data));
23
23
  });
24
24
  };
25
25
 
@@ -32,23 +32,23 @@ const setJourneyEventListeners = (idwiseJourneyCallback) => {
32
32
  eventEmitter.removeAllListeners(IDWiseEvents.EVENT_JOURNEY_ERROR);
33
33
 
34
34
  eventEmitter.addListener(IDWiseEvents.EVENT_JOURNEY_STARTED, (event) => {
35
- idwiseJourneyCallback?.onJourneyStarted(event);
35
+ idwiseJourneyCallback?.onJourneyStarted(JSON.parse(event.data));
36
36
  });
37
37
 
38
38
  eventEmitter.addListener(IDWiseEvents.EVENT_JOURNEY_RESUMED, (event) => {
39
- idwiseJourneyCallback?.onJourneyResumed(event);
39
+ idwiseJourneyCallback?.onJourneyResumed(JSON.parse(event.data));
40
40
  });
41
41
 
42
42
  eventEmitter.addListener(IDWiseEvents.EVENT_JOURNEY_FINISHED, (event) => {
43
- idwiseJourneyCallback?.onJourneyFinished(event);
43
+ idwiseJourneyCallback?.onJourneyCompleted(JSON.parse(event.data));
44
44
  });
45
45
 
46
46
  eventEmitter.addListener(IDWiseEvents.EVENT_JOURNEY_CANCELLED, (event) => {
47
- idwiseJourneyCallback?.onJourneyCancelled(event);
47
+ idwiseJourneyCallback?.onJourneyCancelled(JSON.parse(event.data));
48
48
  });
49
49
 
50
50
  eventEmitter.addListener(IDWiseEvents.EVENT_JOURNEY_ERROR, (event) => {
51
- idwiseJourneyCallback?.onError(event);
51
+ idwiseJourneyCallback?.onError(JSON.parse(event.data));
52
52
  });
53
53
  };
54
54
 
@@ -60,22 +60,19 @@ const setStepEventListeners = (idwiseStepCallback) => {
60
60
  eventEmitter.removeAllListeners(IDWiseEvents.EVENT_STEP_SKIPPED);
61
61
 
62
62
  eventEmitter.addListener(IDWiseEvents.EVENT_STEP_CAPTURED, (event) => {
63
- idwiseStepCallback?.onStepCaptured(event.stepId, event.capturedImage);
63
+ idwiseStepCallback?.onStepCaptured(JSON.parse(event.data));
64
64
  });
65
65
 
66
66
  eventEmitter.addListener(IDWiseEvents.EVENT_STEP_RESULT, (event) => {
67
- idwiseStepCallback?.onStepResult(
68
- event.stepId,
69
- JSON.parse(event.stepResult)
70
- );
67
+ idwiseStepCallback?.onStepResult(JSON.parse(event.data));
71
68
  });
72
69
 
73
70
  eventEmitter.addListener(IDWiseEvents.EVENT_STEP_CANCELLED, (event) => {
74
- idwiseStepCallback?.onStepCancelled(event);
71
+ idwiseStepCallback?.onStepCancelled(JSON.parse(event.data));
75
72
  });
76
73
 
77
74
  eventEmitter.addListener(IDWiseEvents.EVENT_STEP_SKIPPED, (event) => {
78
- idwiseStepCallback?.onStepSkipped(event);
75
+ idwiseStepCallback?.onStepSkipped(JSON.parse(event.data));
79
76
  });
80
77
  };
81
78
 
@@ -85,7 +82,12 @@ const setJourneySummaryEventListener = (idwiseJourneySummaryCallback) => {
85
82
  eventEmitter.removeAllListeners(IDWiseEvents.EVENT_JOURNEY_SUMMARY_ERROR);
86
83
 
87
84
  eventEmitter.addListener(IDWiseEvents.EVENT_JOURNEY_SUMMARY, (event) => {
88
- idwiseJourneySummaryCallback?.onJourneySummary(JSON.parse(event.summary));
85
+ let summary = JSON.parse(event.data);
86
+ if (summary.error == null) {
87
+ idwiseJourneySummaryCallback?.onJourneySummary(summary.summary);
88
+ } else {
89
+ idwiseJourneySummaryCallback?.onError(summary.error);
90
+ }
89
91
  });
90
92
 
91
93
  eventEmitter.addListener(
@@ -100,6 +102,5 @@ export {
100
102
  setInitializeEventListeners,
101
103
  setJourneyEventListeners,
102
104
  setJourneySummaryEventListener,
103
- setStepEventListeners
105
+ setStepEventListeners,
104
106
  };
105
-
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as IDWise from './IDWise';
2
- import { IDWiseSDKTheme } from './IDWiseConstants';
2
+ import { IDWiseTheme } from './IDWiseConstants';
3
+ import * as IDWiseDynamic from './IDWiseDynamic';
3
4
 
4
- export default { IDWise, IDWiseSDKTheme };
5
+ export default { IDWise, IDWiseTheme, IDWiseDynamic };