idwise-react-native-sdk 6.0.2 → 6.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.
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
17
17
  s.private_header_files = "ios/**/*.h"
18
18
 
19
- s.dependency 'IDWise', '6.0.1'
19
+ s.dependency 'IDWise', '6.1.0'
20
20
  s.pod_target_xcconfig = {
21
21
  "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
22
22
  "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
@@ -4,4 +4,4 @@ IdwiseReactNativeSdk_targetSdkVersion=34
4
4
  IdwiseReactNativeSdk_compileSdkVersion=35
5
5
  IdwiseReactNativeSdk_ndkVersion=27.1.12297006
6
6
  # Idwise SDK version
7
- idwise_sdk_version=6.0.2
7
+ idwise_sdk_version=6.1.0
@@ -60,16 +60,23 @@ class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationConte
60
60
  IDWiseTheme.SYSTEM_DEFAULT
61
61
  }
62
62
 
63
- IDWise.initialize(clientKey, idwiseTheme) { error ->
64
- val params: WritableMap = Arguments.createMap()
65
- val errorMap = JSONObject()
66
- error?.let{
67
- errorMap.put("code", error?.code)
68
- errorMap.put("message", error?.message)
63
+ IDWise.initialize(
64
+ clientKey=clientKey, theme=idwiseTheme,
65
+ onSuccess = {
66
+ val params: WritableMap = Arguments.createMap()
67
+ sendEvent("onInitializeSuccess", params)
68
+ },
69
+ onError = { error ->
70
+ val params: WritableMap = Arguments.createMap()
71
+ val errorMap = JSONObject()
72
+ error?.let{
73
+ errorMap.put("code", error?.code)
74
+ errorMap.put("message", error?.message)
75
+ }
76
+ params.putString("data", errorMap.toString())
77
+ sendEvent("onInitializeError", params)
69
78
  }
70
- params.putString("data", errorMap.toString())
71
- sendEvent("onInitializeError", params)
72
- }
79
+ );
73
80
  }
74
81
 
75
82
  @ReactMethod
@@ -12,7 +12,7 @@ class IdwiseReactNativeSdk: RCTEventEmitter {
12
12
  "onJourneyStarted", "onJourneyResumed", "onJourneyCancelled", "onJourneyBlocked", "onError", "onJourneyError",
13
13
  "onJourneyCompleted",
14
14
  "onJourneySummary", "onStepCaptured", "onStepResult", "onStepCancelled", "onStepSkipped",
15
- "onInitializeError",
15
+ "onInitializeError", "onInitializeSuccess",
16
16
  "onJourneySummaryError",
17
17
  ]
18
18
  }
@@ -29,7 +29,16 @@ class IdwiseReactNativeSdk: RCTEventEmitter {
29
29
  } else if theme == "DARK" {
30
30
  sdkTheme = .dark
31
31
  }
32
- IDWise.initialize(clientKey: clientKey, theme: sdkTheme) { err in
32
+ IDWise.initialize(clientKey: clientKey, theme: sdkTheme, onSuccess: {
33
+ print("SDK is Initialized")
34
+ do {
35
+ IdwiseReactNativeSdk.emitter.sendEvent(
36
+ withName: "onInitializeSuccess",
37
+ body: nil)
38
+ } catch {
39
+ print(error)
40
+ }
41
+ }, onError: { err in
33
42
  if let error = err {
34
43
  do {
35
44
  let jsonData = try JSONEncoder().encode(error)
@@ -42,7 +51,7 @@ class IdwiseReactNativeSdk: RCTEventEmitter {
42
51
  print(error)
43
52
  }
44
53
  }
45
- }
54
+ })
46
55
 
47
56
  }
48
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idwise-react-native-sdk",
3
- "version": "6.0.2",
3
+ "version": "6.1.0",
4
4
  "description": "React-Native Wrapper for IDWise SDK",
5
5
  "main": "./lib/index.js",
6
6
  "react-native": "./src/index.js",
@@ -1,5 +1,6 @@
1
1
  export const IDWiseEvents = {
2
2
  EVENT_INITIALIZE_ERRROR: 'onInitializeError',
3
+ EVENT_INITIALIZE_SUCCESS: 'onInitializeSuccess',
3
4
 
4
5
  EVENT_JOURNEY_STARTED: 'onJourneyStarted',
5
6
  EVENT_JOURNEY_RESUMED: 'onJourneyResumed',
@@ -23,10 +23,17 @@ const eventEmitter = new NativeEventEmitter(RNIDWise);
23
23
  const setInitializeEventListeners = (idwiseInitializeCallback) => {
24
24
  console.log('IDWise - setInitializeEventListeners');
25
25
  eventEmitter.removeAllListeners(IDWiseEvents.EVENT_INITIALIZE_ERRROR);
26
+ eventEmitter.removeAllListeners(IDWiseEvents.EVENT_INITIALIZE_SUCCESS);
26
27
 
27
28
  eventEmitter.addListener(IDWiseEvents.EVENT_INITIALIZE_ERRROR, (event) => {
28
29
  idwiseInitializeCallback?.onError(JSON.parse(event.data));
29
30
  });
31
+
32
+ eventEmitter.addListener(IDWiseEvents.EVENT_INITIALIZE_SUCCESS, (event) => {
33
+ try {
34
+ idwiseInitializeCallback?.onSuccess();
35
+ } catch (error) {}
36
+ });
30
37
  };
31
38
 
32
39
  const setJourneyEventListeners = (idwiseJourneyCallback) => {