idwise-cordova-sdk 0.1.0 → 4.6.9

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idwise-cordova-sdk",
3
- "version": "0.1.0",
3
+ "version": "4.6.9",
4
4
  "description": "IDWise SDK wrapper for Cordova projects",
5
5
  "cordova": {
6
6
  "id": "idwise-cordova-sdk",
package/plugin.xml CHANGED
@@ -1,10 +1,9 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="idwise-cordova-sdk" version="0.1.0" xmlns="http://apache.org/cordova/ns/plugins/1.0"
2
+ <plugin id="idwise-cordova-sdk" version="4.6.9" xmlns="http://apache.org/cordova/ns/plugins/1.0"
3
3
  xmlns:android="http://schemas.android.com/apk/res/android">
4
4
  <name>IDWiseCordovaSDK</name>
5
5
  <js-module name="IDWiseCordovaSDK" src="www/IDWiseCordovaSDK.js">
6
6
  <clobbers target="IDWise" />
7
- <!-- <clobbers target="IDWise" />-->
8
7
  </js-module>
9
8
  <platform name="ios">
10
9
  <config-file parent="/*" target="config.xml">
@@ -22,7 +21,7 @@
22
21
  <source url="https://github.com/idwise/ios-sdk.git" />
23
22
  </config>
24
23
  <pods use-frameworks="true">
25
- <pod name="IDWise" />
24
+ <pod name="IDWise" spec="4.6.9" />
26
25
  </pods>
27
26
  </podspec>
28
27
  </platform>
package/readme.md ADDED
@@ -0,0 +1,38 @@
1
+ <p align="center">
2
+ <img alt="idwise-Cordova-sdk" src="https://www.idwise.com/wp-content/uploads/2022/09/IDWise-Logo.svg" width="300">
3
+ </p>
4
+ <p align="center">
5
+ Next-Gen Identity Verification Suite<br/>
6
+ <a href="https://www.idwise.com/">idwise.com</a>
7
+ </p>
8
+
9
+ ---
10
+
11
+ [![Version][version-badge]][package]
12
+
13
+ <p align="center"><i>IDWise React Native SDK, a package having a bridge implementation which provides an ease with the integration of IDWise Native Android and iOS SDKs.</i></p>
14
+
15
+ ## Getting Started
16
+
17
+ Refer to the [getting started guide](https://docs.idwise.com/docs/integration-with-idwise) for instructions.
18
+
19
+ ## Documentation
20
+
21
+ Check the sdk and their usage in our [documentation](https://docs.idwise.com/docs/idwise-cordova-sdk).
22
+
23
+ ## Try it out
24
+
25
+ 🧑‍💻 The source code for the examples are under the [/example](/example) folder.
26
+
27
+ 📲 You can also try out components in our [demo app](https://github.com/idwise/idwise-react-native-sdk-samples) available in Github.
28
+
29
+ ## Installation
30
+
31
+ ```sh
32
+ cordova plugin add idwise-cordova-sdk
33
+ ```
34
+
35
+ <!-- badges -->
36
+
37
+ [version-badge]: https://img.shields.io/npm/v/idwise-cordova-sdk.svg?style=flat-square
38
+ [package]: https://www.npmjs.com/package/idwise-cordova-sdk
@@ -59,8 +59,17 @@ class IDWiseCordovaSDK : CordovaPlugin() {
59
59
  ) {
60
60
 
61
61
  IDWise.initialize(clientKey, theme) { error: IDWiseSDKError? ->
62
- Log.e("IDWISE", "onInitializeError: ${error?.message}")
63
- callbackContext.error("onError: ${error?.message}")
62
+ val params = JSONObject()
63
+ params.put("event", "onError")
64
+
65
+ val data = JSONObject()
66
+ data.put("errorCode", error!!.errorCode)
67
+ data.put("message", error!!.message)
68
+ params.put("data", data)
69
+
70
+ val result = PluginResult(PluginResult.Status.ERROR, params)
71
+ result.keepCallback = true
72
+ callbackContext.sendPluginResult(result)
64
73
  }
65
74
  }
66
75
 
@@ -1,3 +1,3 @@
1
1
  dependencies {
2
- implementation 'com.idwise:android-sdk:4.5.0'
2
+ implementation 'com.idwise:android-sdk:4.6.9'
3
3
  }
@@ -9,14 +9,31 @@ import IDWiseSDK
9
9
  @objc(initialize:)
10
10
  func initialize(_ command: CDVInvokedUrlCommand) {
11
11
  let clientKey = command.arguments[0] as? String ?? ""
12
- IDWise.initialize(clientKey: clientKey, theme: .systemDefault) { err in
12
+ let theme = command.arguments[1] as? String ?? ""
13
+
14
+ var sdkTheme: IDWiseSDKTheme = .systemDefault
15
+ if theme == "LIGHT" {
16
+ sdkTheme = .light
17
+ } else if theme == "DARK" {
18
+ sdkTheme = .dark
19
+ }
20
+ IDWise.initialize(clientKey: clientKey, theme: sdkTheme) { err in
13
21
  // Deal with error here
14
22
  if let error = err {
15
- print(error)
23
+ let arguments =
24
+ [
25
+ "event": "onError",
26
+ "data": ["errorCode": error.code, "message": error.message] as [String: Any],
27
+ ]
28
+ as [String: Any]
29
+
30
+ print(arguments)
31
+
16
32
  var pluginResult = CDVPluginResult(
17
33
  status: CDVCommandStatus_ERROR,
18
- messageAs: error.message
34
+ messageAs: arguments
19
35
  )
36
+ pluginResult?.keepCallback = true
20
37
  self.commandDelegate!.send(pluginResult, callbackId: command.callbackId)
21
38
 
22
39
  }
@@ -26,19 +43,28 @@ import IDWiseSDK
26
43
  @objc(startJourney:)
27
44
  func startJourney(_ command: CDVInvokedUrlCommand) {
28
45
  let flowId = command.arguments[0] as? String ?? ""
46
+ let referenceNumber = command.arguments[1] as? String ?? ""
47
+ let locale = command.arguments[2] as? String ?? ""
48
+
29
49
  self.journeyCallbackId = command.callbackId
30
50
 
31
51
  IDWise.startJourney(
32
- journeyDefinitionId: flowId, referenceNumber: "<YOUR_REFERENCE_NO>",
33
- locale: "en", journeyDelegate: self)
52
+ journeyDefinitionId: flowId, referenceNumber: referenceNumber,
53
+ locale: locale, journeyDelegate: self)
34
54
  }
35
55
  }
36
56
 
37
57
  extension IDWiseCordovaSDK: IDWiseSDKJourneyDelegate {
38
58
  func onError(error: IDWiseSDKError) {
59
+ let arguments =
60
+ [
61
+ "event": "onError",
62
+ "data": ["errorCode": error.code, "message": error.message] as [String: Any],
63
+ ]
64
+ as [String: Any]
39
65
  var pluginResult = CDVPluginResult(
40
66
  status: CDVCommandStatus_ERROR,
41
- messageAs: error.message
67
+ messageAs: arguments
42
68
  )
43
69
  pluginResult?.keepCallback = true
44
70
  self.commandDelegate!.send(pluginResult, callbackId: self.journeyCallbackId)
@@ -5,7 +5,10 @@ exports.initialize = function (clientKey,theme, error) {
5
5
  function success(result){
6
6
  //dummy success required to pass to exec
7
7
  }
8
- exec(success, error, 'IDWiseCordovaSDK', 'initialize', [clientKey, theme]);
8
+ function errorCb(ex){
9
+ error(ex.data);
10
+ }
11
+ exec(success, errorCb, 'IDWiseCordovaSDK', 'initialize', [clientKey, theme]);
9
12
  };
10
13
 
11
14