idwise-cordova-sdk 5.3.0 → 5.4.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.
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -304,6 +304,20 @@ class IDWiseCordovaSDK : CordovaPlugin() {
|
|
|
304
304
|
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
+
|
|
308
|
+
override fun onJourneyBlocked(journeyInfo: JourneyBlockedInfo) {
|
|
309
|
+
val params = JSONObject()
|
|
310
|
+
params.put("event", "onJourneyBlocked")
|
|
311
|
+
|
|
312
|
+
params.put("data", gson.toJson(journeyInfo))
|
|
313
|
+
|
|
314
|
+
val result = PluginResult(PluginResult.Status.OK, params)
|
|
315
|
+
result.keepCallback = false
|
|
316
|
+
|
|
317
|
+
journeyCallbackContext.sendPluginResult(result)
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
|
|
307
321
|
override fun onError(error: IDWiseError) {
|
|
308
322
|
val params = JSONObject()
|
|
309
323
|
params.put("event", "onError")
|
|
@@ -195,6 +195,25 @@ extension IDWiseCordovaSDK: IDWiseJourneyCallbacks {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
|
|
199
|
+
func onJourneyBlocked(journeyBlockedInfo: JourneyBlockedInfo) {
|
|
200
|
+
|
|
201
|
+
let jsonEncoder = JSONEncoder()
|
|
202
|
+
do {
|
|
203
|
+
let jsonData = try jsonEncoder.encode(journeyBlockedInfo)
|
|
204
|
+
let json = String(data: jsonData, encoding: String.Encoding.utf8)
|
|
205
|
+
let arguments = ["event": "onJourneyBlocked", "data": json] as [String: Any]
|
|
206
|
+
var pluginResult = CDVPluginResult(
|
|
207
|
+
status: CDVCommandStatus_OK,
|
|
208
|
+
messageAs: arguments
|
|
209
|
+
)
|
|
210
|
+
pluginResult?.keepCallback = true
|
|
211
|
+
self.commandDelegate!.send(pluginResult, callbackId: self.journeyCallbackId)
|
|
212
|
+
} catch {
|
|
213
|
+
print(error)
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
198
217
|
func onJourneyStarted(journeyStartedInfo: JourneyStartedInfo) {
|
|
199
218
|
|
|
200
219
|
let jsonEncoder = JSONEncoder()
|
package/www/IDWiseCordovaSDK.js
CHANGED
|
@@ -11,29 +11,49 @@ exports.initialize = function (clientKey, theme, error) {
|
|
|
11
11
|
exec(success, errorCb, "IDWiseCordovaSDK", "initialize", [clientKey, theme]);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
exports.resumeJourney = function (flowId, journeyId, locale, journeyCallback) {
|
|
15
|
+
console.log("IDWISE.JS -> resumeJourney");
|
|
16
|
+
function success(result) {
|
|
17
|
+
triggerCallbacks(result, journeyCallback);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function error(error) {
|
|
21
|
+
console.log("onError ", error.data);
|
|
22
|
+
journeyCallback.onError(error.data);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exec(success, error, "IDWiseCordovaSDK", "resumeJourney", [flowId, journeyId, locale]);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function triggerCallbacks(result, journeyCallback) {
|
|
29
|
+
switch (result.event) {
|
|
30
|
+
case "onJourneyStarted":
|
|
31
|
+
journeyCallback.onJourneyStarted(JSON.parse(result.data));
|
|
32
|
+
break;
|
|
33
|
+
case "onJourneyResumed":
|
|
34
|
+
journeyCallback.onJourneyResumed(JSON.parse(result.data));
|
|
35
|
+
break;
|
|
36
|
+
case "onJourneyBlocked":
|
|
37
|
+
journeyCallback.onJourneyBlocked(JSON.parse(result.data));
|
|
38
|
+
break;
|
|
39
|
+
case "onJourneyCompleted":
|
|
40
|
+
journeyCallback.onJourneyCompleted(JSON.parse(result.data));
|
|
41
|
+
break;
|
|
42
|
+
case "onJourneyCancelled":
|
|
43
|
+
journeyCallback.onJourneyCancelled(JSON.parse(result.data));
|
|
44
|
+
break;
|
|
45
|
+
|
|
46
|
+
default:
|
|
47
|
+
console.log("unknown event call", result.event);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
14
51
|
exports.startJourney = function (flowId, referenceNo, locale, applicantDetails, journeyCallback) {
|
|
15
52
|
console.log("applicant details");
|
|
16
53
|
console.log(applicantDetails);
|
|
17
54
|
function success(result) {
|
|
18
55
|
console.log(result);
|
|
19
|
-
|
|
20
|
-
switch (result.event) {
|
|
21
|
-
case "onJourneyStarted":
|
|
22
|
-
journeyCallback.onJourneyStarted(JSON.parse(result.data));
|
|
23
|
-
break;
|
|
24
|
-
case "onJourneyResumed":
|
|
25
|
-
journeyCallback.onJourneyResumed(JSON.parse(result.data));
|
|
26
|
-
break;
|
|
27
|
-
case "onJourneyCompleted":
|
|
28
|
-
journeyCallback.onJourneyCompleted(JSON.parse(result.data));
|
|
29
|
-
break;
|
|
30
|
-
case "onJourneyCancelled":
|
|
31
|
-
journeyCallback.onJourneyCancelled(JSON.parse(result.data));
|
|
32
|
-
break;
|
|
33
|
-
|
|
34
|
-
default:
|
|
35
|
-
console.log("unknown event call", result.event);
|
|
36
|
-
}
|
|
56
|
+
triggerCallbacks(result, journeyCallback);
|
|
37
57
|
}
|
|
38
58
|
|
|
39
59
|
function error(error) {
|
|
@@ -107,6 +107,9 @@ function triggerCallbacks(result, journeyCallback, stepCallback) {
|
|
|
107
107
|
case "onJourneyCompleted":
|
|
108
108
|
journeyCallback.onJourneyCompleted(JSON.parse(result.data));
|
|
109
109
|
break;
|
|
110
|
+
case "onJourneyBlocked":
|
|
111
|
+
journeyCallback.onJourneyBlocked(JSON.parse(result.data));
|
|
112
|
+
break;
|
|
110
113
|
case "onJourneyCancelled":
|
|
111
114
|
journeyCallback.onJourneyCancelled(JSON.parse(result.data));
|
|
112
115
|
break;
|