idwise-react-native-sdk 6.2.2 → 6.2.4
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/IdwiseReactNativeSdk.podspec +1 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/idwisereactnativesdk/IdwiseReactNativeSdkModule.kt +21 -0
- package/ios/IdwiseReactNativeSdk.mm +1 -0
- package/ios/IdwiseReactNativeSdk.swift +23 -1
- package/package.json +1 -1
- package/src/IDWise.js +9 -0
- package/src/IDWiseConstants.js +3 -0
- package/src/IDWiseEventListeners.js +21 -0
- package/src/NativeIdwiseReactNativeSdk.ts +1 -0
- package/src/index.d.ts +9 -0
|
@@ -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.2.
|
|
19
|
+
s.dependency 'IDWise', '6.2.4'
|
|
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",
|
|
@@ -18,6 +18,7 @@ import com.idwise.sdk.IDWiseDynamic
|
|
|
18
18
|
import com.idwise.sdk.IDWiseJourneyCallbacks
|
|
19
19
|
import com.idwise.sdk.IDWiseStepCallbacks
|
|
20
20
|
import com.idwise.sdk.data.models.*
|
|
21
|
+
import com.idwise.sdk.data.models.FinalJourneyResultSummary
|
|
21
22
|
import java.io.ByteArrayOutputStream
|
|
22
23
|
import org.json.JSONObject
|
|
23
24
|
|
|
@@ -179,6 +180,20 @@ class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationConte
|
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
|
|
183
|
+
@ReactMethod
|
|
184
|
+
override fun getJourneyResult() {
|
|
185
|
+
|
|
186
|
+
IDWise.getJourneyResult { finalResult, error ->
|
|
187
|
+
|
|
188
|
+
val argsMap = Arguments.createMap()
|
|
189
|
+
|
|
190
|
+
val resultResponse = JourneyResultExposed(finalResult,error)
|
|
191
|
+
argsMap.putString("data", objectMapper.writeValueAsString(resultResponse))
|
|
192
|
+
sendEvent("onJourneyResult", argsMap)
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
182
197
|
@ReactMethod
|
|
183
198
|
override fun unloadSDK() {
|
|
184
199
|
UiThreadUtil.runOnUiThread { IDWiseDynamic.unloadSDK() }
|
|
@@ -304,6 +319,12 @@ class IdwiseReactNativeSdkModule(private val reactContext: ReactApplicationConte
|
|
|
304
319
|
val error:IDWiseError?
|
|
305
320
|
)
|
|
306
321
|
|
|
322
|
+
internal data class JourneyResultExposed(
|
|
323
|
+
val result:FinalJourneyResultSummary?,
|
|
324
|
+
@JsonIgnoreProperties(value = ["cause", "stackTrace", "suppressed"])
|
|
325
|
+
val error:IDWiseError?
|
|
326
|
+
)
|
|
327
|
+
|
|
307
328
|
// Example method
|
|
308
329
|
// See https://reactnative.dev/docs/native-modules-android
|
|
309
330
|
override fun multiply(a: Double, b: Double): Double {
|
|
@@ -23,6 +23,7 @@ RCT_EXTERN_METHOD(resumeJourney:(NSString *)journeyDefinitionId
|
|
|
23
23
|
:(NSString *)journeyId
|
|
24
24
|
:(NSString *)locale)
|
|
25
25
|
RCT_EXTERN_METHOD(getJourneySummary)
|
|
26
|
+
RCT_EXTERN_METHOD(getJourneyResult)
|
|
26
27
|
RCT_EXTERN_METHOD(isDeviceBlocked:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
|
27
28
|
RCT_EXTERN_METHOD(unloadSDK)
|
|
28
29
|
RCT_EXTERN_METHOD(finishDynamicJourney)
|
|
@@ -13,7 +13,7 @@ class IdwiseReactNativeSdk: RCTEventEmitter {
|
|
|
13
13
|
"onJourneyCompleted",
|
|
14
14
|
"onJourneySummary", "onStepCaptured", "onStepResult", "onStepCancelled", "onStepSkipped",
|
|
15
15
|
"onInitializeError", "onInitializeSuccess",
|
|
16
|
-
"onJourneySummaryError",
|
|
16
|
+
"onJourneySummaryError", "onJourneyResult", "onJourneyResultError"
|
|
17
17
|
]
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -148,6 +148,22 @@ class IdwiseReactNativeSdk: RCTEventEmitter {
|
|
|
148
148
|
}
|
|
149
149
|
}*/
|
|
150
150
|
|
|
151
|
+
@objc func getJourneyResult() {
|
|
152
|
+
IDWise.getJourneyResult { result, error in
|
|
153
|
+
do {
|
|
154
|
+
let responseResult = JourneyResultExposed(result: result,error: error)
|
|
155
|
+
|
|
156
|
+
let jsonData = try JSONEncoder().encode(responseResult)
|
|
157
|
+
let jsonString = String(data: jsonData, encoding: String.Encoding.utf8)
|
|
158
|
+
IdwiseReactNativeSdk.emitter.sendEvent(withName: "onJourneyResult", body: ["data": jsonString] as [String: Any])
|
|
159
|
+
|
|
160
|
+
} catch {
|
|
161
|
+
print(error)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
151
167
|
@objc func getJourneySummary() {
|
|
152
168
|
IDWiseDynamic.getJourneySummary(
|
|
153
169
|
callback: { journeySummary, error in
|
|
@@ -334,6 +350,12 @@ private struct JourneySummaryExposed: Codable {
|
|
|
334
350
|
var error: IDWiseError?
|
|
335
351
|
}
|
|
336
352
|
|
|
353
|
+
|
|
354
|
+
private struct JourneyResultExposed: Codable {
|
|
355
|
+
var result: IDWiseSDK.FinalJourneyResultSummary?
|
|
356
|
+
var error: IDWiseError?
|
|
357
|
+
}
|
|
358
|
+
|
|
337
359
|
private struct OnStepCapturedExposed: Codable {
|
|
338
360
|
var stepId: String
|
|
339
361
|
var originalImage: String?
|
package/package.json
CHANGED
package/src/IDWise.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
setInitializeEventListeners,
|
|
5
5
|
setJourneyEventListeners,
|
|
6
6
|
setStepEventListeners,
|
|
7
|
+
setJourneyResultEventListener,
|
|
7
8
|
} from './IDWiseEventListeners';
|
|
8
9
|
|
|
9
10
|
const LINKING_ERROR =
|
|
@@ -67,9 +68,17 @@ const resumeJourney = (
|
|
|
67
68
|
RNIDWise.resumeJourney(journeyDefinitionId, journeyId, locale);
|
|
68
69
|
};
|
|
69
70
|
|
|
71
|
+
const getJourneyResult = (callback) => {
|
|
72
|
+
console.log('IDWise - getJourneyResult');
|
|
73
|
+
setJourneyResultEventListener(callback);
|
|
74
|
+
|
|
75
|
+
RNIDWise.getJourneyResult();
|
|
76
|
+
};
|
|
77
|
+
|
|
70
78
|
export const IDWise = {
|
|
71
79
|
initialize,
|
|
72
80
|
startJourney,
|
|
73
81
|
resumeJourney,
|
|
74
82
|
isDeviceBlocked,
|
|
83
|
+
getJourneyResult,
|
|
75
84
|
};
|
package/src/IDWiseConstants.js
CHANGED
|
@@ -12,6 +12,9 @@ export const IDWiseEvents = {
|
|
|
12
12
|
EVENT_JOURNEY_SUMMARY: 'onJourneySummary',
|
|
13
13
|
EVENT_JOURNEY_SUMMARY_ERROR: 'onJourneySummaryError',
|
|
14
14
|
|
|
15
|
+
EVENT_JOURNEY_RESULT: 'onJourneyResult',
|
|
16
|
+
EVENT_JOURNEY_RESULT_ERROR: 'onJourneyResultError',
|
|
17
|
+
|
|
15
18
|
EVENT_STEP_CAPTURED: 'onStepCaptured',
|
|
16
19
|
EVENT_STEP_RESULT: 'onStepResult',
|
|
17
20
|
EVENT_STEP_CANCELLED: 'onStepCancelled',
|
|
@@ -94,6 +94,26 @@ const setStepEventListeners = (idwiseStepCallback) => {
|
|
|
94
94
|
});
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
const setJourneyResultEventListener = (idwiseJourneySummaryCallback) => {
|
|
98
|
+
console.log('IDWise - setJourneyResultEventListener');
|
|
99
|
+
eventEmitter.removeAllListeners(IDWiseEvents.EVENT_JOURNEY_RESULT);
|
|
100
|
+
eventEmitter.removeAllListeners(IDWiseEvents.EVENT_JOURNEY_RESULT_ERROR);
|
|
101
|
+
|
|
102
|
+
eventEmitter.addListener(IDWiseEvents.EVENT_JOURNEY_RESULT, (event) => {
|
|
103
|
+
let summary = JSON.parse(event.data);
|
|
104
|
+
console.log('IDWise - Journey Result received', summary);
|
|
105
|
+
if (summary.error == null) {
|
|
106
|
+
idwiseJourneySummaryCallback?.onJourneyResult(summary.result);
|
|
107
|
+
} else {
|
|
108
|
+
idwiseJourneySummaryCallback?.onError(summary.error);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
eventEmitter.addListener(IDWiseEvents.EVENT_JOURNEY_RESULT_ERROR, (event) => {
|
|
113
|
+
idwiseJourneySummaryCallback?.onError(JSON.parse(event.error));
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
97
117
|
const setJourneySummaryEventListener = (idwiseJourneySummaryCallback) => {
|
|
98
118
|
console.log('IDWise - setJourneySummaryEventListener');
|
|
99
119
|
eventEmitter.removeAllListeners(IDWiseEvents.EVENT_JOURNEY_SUMMARY);
|
|
@@ -121,4 +141,5 @@ export {
|
|
|
121
141
|
setJourneyEventListeners,
|
|
122
142
|
setJourneySummaryEventListener,
|
|
123
143
|
setStepEventListeners,
|
|
144
|
+
setJourneyResultEventListener,
|
|
124
145
|
};
|
package/src/index.d.ts
CHANGED
|
@@ -35,6 +35,13 @@ export interface JourneySummaryCallback {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
export interface JourneyResultCallback {
|
|
39
|
+
onJourneyResult:(journeyResult:JSON) => void;
|
|
40
|
+
onError:(error:JSON) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
38
45
|
// ===== IDWise Module =====
|
|
39
46
|
export namespace IDWise {
|
|
40
47
|
function initialize(
|
|
@@ -59,6 +66,8 @@ export namespace IDWise {
|
|
|
59
66
|
locale: string,
|
|
60
67
|
journeyCallback: IDWiseJourneyCallbacks
|
|
61
68
|
): void;
|
|
69
|
+
|
|
70
|
+
function getJourneyResult(callback: JourneyResultCallback): void;
|
|
62
71
|
}
|
|
63
72
|
|
|
64
73
|
// ===== IDWiseDynamic Module =====
|