@sumsub/cordova-idensic-mobile-sdk-plugin 1.24.0 → 1.25.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/dist/SNSMobileSDK.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("cordova/exec")):"function"==typeof define&&define.amd?define(["cordova/exec"],t):"object"==typeof exports?exports.SNSMobileSDK=t(require("cordova/exec")):e.SNSMobileSDK=t(e["cordova/exec"])}(window,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}([function(e,t,n){const r=n(1),o="SNSMobileSdkCordovaPlugin",i={onStatusChanged:null,onEvent:null,onActionResult:"onActionResultCompleted"};var s=null;function a(e){this.sdkConf=e,this.sdkConf.settings.appFrameworkName="cordova"}function c(){return this.debug=!1,this.handlers={},this.applicantConf={},this.preferredDocumentDefinitions={},this.autoCloseOnApprove=3,this.settings={},this
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("cordova/exec")):"function"==typeof define&&define.amd?define(["cordova/exec"],t):"object"==typeof exports?exports.SNSMobileSDK=t(require("cordova/exec")):e.SNSMobileSDK=t(e["cordova/exec"])}(window,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}([function(e,t,n){const r=n(1),o="SNSMobileSdkCordovaPlugin",i={onStatusChanged:null,onEvent:null,onActionResult:"onActionResultCompleted"};var s=null;function a(e){this.sdkConf=e,this.sdkConf.settings.appFrameworkName="cordova"}function c(){return this.debug=!1,this.handlers={},this.applicantConf={},this.preferredDocumentDefinitions={},this.autoCloseOnApprove=3,this.settings={},this}a.prototype.dismiss=function(){r(e=>{},e=>{},o,"dismiss",[])},a.prototype.sendEvent=function(e,t){var n=this.sdkConf.handlers[e];if(n){var s=i[e];if(s){var a=function(e,t){r(e=>{},e=>{},o,s,[{error:e,result:t}])};n(t).then(e=>{a(null,e)}).catch(e=>{a(e||new Error("rejected"),null)})}else n(t)}},a.prototype.getNewAccessToken=function(){var e=function(e){r(e=>{},e=>{},o,"setNewAccessToken",[e])};this.sdkConf.tokenExpirationHandler().then(t=>{e(t)}).catch(t=>{console.error(t instanceof Error?t.message:t),e(null)})},a.prototype.launch=function(){let e=this;return console.log("InSumSub",JSON.stringify(this.sdkConf)),new Promise((t,n)=>{s?n(new Error("Aborted since another instance is in use!")):e.sdkConf.accessToken?(s=e,r(e=>{s=null,console.log("Promise SumSub Result",JSON.stringify(e)),t(e)},e=>{s=null,console.log("Promise SumSub Error",JSON.stringify(e)),n(e)},o,"launchSNSMobileSDK",[e.sdkConf])):n(new Error("Access token is required"))})},c.prototype.withAccessToken=function(e,t){if(this.accessToken=e,!t||"function"!=typeof t)throw new Error('Invalid parameter, "expirationHandler" must be a function');return this.tokenExpirationHandler=t,this},c.prototype.withHandlers=function(e){if(!e||"object"!=typeof e)throw new Error('Invalid parameter, "withHandlers" expects a hash');return Object.keys(i).forEach(t=>{var n=e[t];if(n){if("function"!=typeof n)throw new Error('Invalid handler, "'+t+'" must be a function');this.handlers[t]=n}}),this},c.prototype.withDebug=function(e){if("boolean"!=typeof e)throw new Error('Invalid parameter, "withDebug" expects a boolean');return this.debug=e,this},c.prototype.withAnalyticsEnabled=function(e){if("boolean"!=typeof e)throw new Error('Invalid parameter, "withAnalyticsEnabled" expects a boolean');return this.isAnalyticsEnabled=e,this},c.prototype.withLocale=function(e){if("string"!=typeof e)throw new Error('Invalid parameter, "locale" must be a string');return this.locale=e,this},c.prototype.withApplicantConf=function(e){if(!e||"object"!=typeof e)throw new Error('Invalid parameter, "withApplicantConf" expects a hash');return this.applicantConf=e,this},c.prototype.withPreferredDocumentDefinitions=function(e){if(!e||"object"!=typeof e)throw new Error('Invalid parameter, "withPreferredDocumentDefinitions" expects a hash');return this.preferredDocumentDefinitions=e,this},c.prototype.withSettings=function(e){if(!e||"object"!=typeof e)throw new Error('Invalid parameter, "withSettings" expects a hash');return this.settings=e,this},c.prototype.withStrings=function(e){if(!e||"object"!=typeof e)throw new Error('Invalid parameter, "withStrings" expects a hash');return this.strings=e,this},c.prototype.withTheme=function(e){if(!e||"object"!=typeof e)throw new Error('Invalid parameter, "withTheme" expects a hash');return this.theme=e,this},c.prototype.withBaseUrl=function(e){if("string"!=typeof e)throw new Error('Invalid parameter, "baseUrl" must be a string');return this.apiUrl=e,this},c.prototype.withAutoCloseOnApprove=function(e){if("number"!=typeof e)throw new Error('Invalid parameter, "autoCloseOnApprove" expects a number');return this.autoCloseOnApprove=e,this},c.prototype.build=function(){var e={};return Object.keys(this.handlers).forEach(t=>{e[t]=!0}),new a({apiUrl:this.apiUrl,accessToken:this.accessToken,tokenExpirationHandler:this.tokenExpirationHandler,handlers:this.handlers,hasHandlers:e,locale:this.locale,applicantConf:this.applicantConf,preferredDocumentDefinitions:this.preferredDocumentDefinitions,settings:this.settings,theme:this.theme,strings:this.strings,isAnalyticsEnabled:this.isAnalyticsEnabled,autoCloseOnApprove:this.autoCloseOnApprove,debug:this.debug})},e.exports={init:function(e,t){return(new c).withAccessToken(e,t)},getNewAccessToken:function(){s&&s.getNewAccessToken()},sendEvent:function(e,t){s&&s.sendEvent(e,t)},reset:function(){s=null}}},function(t,n){t.exports=e}])}));
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
|
-
<plugin id="cordova-idensic-mobile-sdk-plugin" version="1.
|
|
2
|
+
<plugin id="cordova-idensic-mobile-sdk-plugin" version="1.25.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
3
|
|
|
4
4
|
<name>cordova-idensic-mobile-sdk-plugin</name>
|
|
5
5
|
<description>Cordova plugin exposing SumSub Mobile SDK</description>
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
<source url="https://cdn.cocoapods.org/"/>
|
|
79
79
|
</config>
|
|
80
80
|
<pods>
|
|
81
|
-
<pod name="IdensicMobileSDK" spec="=1.
|
|
81
|
+
<pod name="IdensicMobileSDK" spec="=1.25.0" />
|
|
82
82
|
</pods>
|
|
83
83
|
</podspec>
|
|
84
84
|
|
|
@@ -14,8 +14,8 @@ allprojects {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
dependencies {
|
|
17
|
-
implementation "com.sumsub.sns:idensic-mobile-sdk:1.
|
|
18
|
-
implementation "com.sumsub.sns:idensic-mobile-sdk-prooface:1.
|
|
19
|
-
// implementation "com.sumsub.sns:idensic-mobile-sdk-videoident:1.
|
|
17
|
+
implementation "com.sumsub.sns:idensic-mobile-sdk:1.25.0"
|
|
18
|
+
implementation "com.sumsub.sns:idensic-mobile-sdk-prooface:1.25.0"
|
|
19
|
+
// implementation "com.sumsub.sns:idensic-mobile-sdk-videoident:1.25.0"
|
|
20
20
|
implementation 'com.google.android.material:material:1.8.0'
|
|
21
21
|
}
|
package/src/android/src/main/java/com/sumsub/msdk/plugins/cordova/SNSMobileSdkCordovaPlugin.java
CHANGED
|
@@ -4,6 +4,7 @@ import android.content.Intent;
|
|
|
4
4
|
import android.text.TextUtils;
|
|
5
5
|
import android.util.Log;
|
|
6
6
|
import android.webkit.ValueCallback;
|
|
7
|
+
import android.webkit.WebView;
|
|
7
8
|
|
|
8
9
|
import androidx.annotation.Nullable;
|
|
9
10
|
|
|
@@ -63,7 +64,6 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
63
64
|
JSONObject preferredDocumentDefinitions = conf.getJSONObject("preferredDocumentDefinitions");
|
|
64
65
|
boolean isAnalyticsEnabled = !(conf.has("isAnalyticsEnabled") && !conf.optBoolean("isAnalyticsEnabled"));
|
|
65
66
|
int autoCloseOnApprove = conf.optInt("autoCloseOnApprove", 3);
|
|
66
|
-
boolean isDisableMLKit = conf.optBoolean("disableMLKit", false);
|
|
67
67
|
|
|
68
68
|
if (TextUtils.isEmpty(accessToken)) {
|
|
69
69
|
callbackContext.error("Error: Access token must be provided");
|
|
@@ -72,7 +72,7 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
72
72
|
if (TextUtils.isEmpty(locale)) {
|
|
73
73
|
locale = Locale.getDefault().getLanguage();
|
|
74
74
|
}
|
|
75
|
-
this.launchSNSMobileSDK(apiUrl, accessToken, email, phone, locale, isDebug, theme, settings, strings, isAnalyticsEnabled, hasHandlers, preferredDocumentDefinitions, autoCloseOnApprove,
|
|
75
|
+
this.launchSNSMobileSDK(apiUrl, accessToken, email, phone, locale, isDebug, theme, settings, strings, isAnalyticsEnabled, hasHandlers, preferredDocumentDefinitions, autoCloseOnApprove, callbackContext);
|
|
76
76
|
return true;
|
|
77
77
|
} else if (action.equals(NEW_TOKEN_ACTION)) {
|
|
78
78
|
newAccessToken = args.getString(0);
|
|
@@ -99,12 +99,19 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
99
99
|
cordova.getActivity().runOnUiThread(new Runnable() {
|
|
100
100
|
@Override
|
|
101
101
|
public void run() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
try {
|
|
103
|
+
WebView view = (WebView) webView.getView();
|
|
104
|
+
if (view != null) {
|
|
105
|
+
view.evaluateJavascript("window.SNSMobileSDK.getNewAccessToken()", new ValueCallback<String>() {
|
|
106
|
+
@Override
|
|
107
|
+
public void onReceiveValue(String s) {
|
|
108
|
+
// no op
|
|
109
|
+
}
|
|
110
|
+
});
|
|
106
111
|
}
|
|
107
|
-
})
|
|
112
|
+
} catch (Exception e) {
|
|
113
|
+
Log.e(TAG, "Exception: " + e);
|
|
114
|
+
}
|
|
108
115
|
}
|
|
109
116
|
});
|
|
110
117
|
}
|
|
@@ -113,15 +120,22 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
113
120
|
cordova.getActivity().runOnUiThread(new Runnable() {
|
|
114
121
|
@Override
|
|
115
122
|
public void run() {
|
|
123
|
+
try {
|
|
124
|
+
WebView view = (WebView) webView.getView();
|
|
125
|
+
if (view != null) {
|
|
116
126
|
|
|
117
|
-
|
|
127
|
+
final String func = "window.SNSMobileSDK.sendEvent('onActionResult', { actionId: '" + actionId + "', answer: '" + answer + "', actionType: '" + actionType + ", allowContinuing: '" + allowContinuing + "})";
|
|
118
128
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
129
|
+
view.evaluateJavascript(func, new ValueCallback<String>() {
|
|
130
|
+
@Override
|
|
131
|
+
public void onReceiveValue(String s) {
|
|
132
|
+
// no op
|
|
133
|
+
}
|
|
134
|
+
});
|
|
123
135
|
}
|
|
124
|
-
})
|
|
136
|
+
} catch (Exception e) {
|
|
137
|
+
Log.e(TAG, "Exception: " + e);
|
|
138
|
+
}
|
|
125
139
|
}
|
|
126
140
|
});
|
|
127
141
|
}
|
|
@@ -140,7 +154,6 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
140
154
|
final JSONObject hasHandlers,
|
|
141
155
|
final JSONObject preferredDocumentDefinitions,
|
|
142
156
|
final int autoCloseOnApprove,
|
|
143
|
-
final boolean isDisableMLKit,
|
|
144
157
|
CallbackContext callbackContext
|
|
145
158
|
) {
|
|
146
159
|
|
|
@@ -179,12 +192,20 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
179
192
|
cordova.getActivity().runOnUiThread(new Runnable() {
|
|
180
193
|
@Override
|
|
181
194
|
public void run() {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
195
|
+
try {
|
|
196
|
+
WebView view = (WebView) webView.getView();
|
|
197
|
+
if (view != null) {
|
|
198
|
+
view.evaluateJavascript(func, new ValueCallback<String>() {
|
|
199
|
+
@Override
|
|
200
|
+
public void onReceiveValue(String s) {
|
|
201
|
+
// no op
|
|
202
|
+
}
|
|
203
|
+
});
|
|
186
204
|
}
|
|
187
|
-
})
|
|
205
|
+
} catch (Exception e) {
|
|
206
|
+
Log.e(TAG, "Exception: " + e);
|
|
207
|
+
callbackContext.error("Error:" + e.getMessage());
|
|
208
|
+
}
|
|
188
209
|
}
|
|
189
210
|
});
|
|
190
211
|
};
|
|
@@ -205,12 +226,20 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
205
226
|
cordova.getActivity().runOnUiThread(new Runnable() {
|
|
206
227
|
@Override
|
|
207
228
|
public void run() {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
229
|
+
try {
|
|
230
|
+
WebView view = (WebView) webView.getView();
|
|
231
|
+
if (view != null) {
|
|
232
|
+
view.evaluateJavascript(func, new ValueCallback<String>() {
|
|
233
|
+
@Override
|
|
234
|
+
public void onReceiveValue(String s) {
|
|
235
|
+
// no op
|
|
236
|
+
}
|
|
237
|
+
});
|
|
212
238
|
}
|
|
213
|
-
})
|
|
239
|
+
} catch (Exception e) {
|
|
240
|
+
Log.e(TAG, "Exception: " + e);
|
|
241
|
+
callbackContext.error("Error:" + e.getMessage());
|
|
242
|
+
}
|
|
214
243
|
}
|
|
215
244
|
});
|
|
216
245
|
};
|
|
@@ -257,9 +286,6 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
257
286
|
|
|
258
287
|
List<SNSModule> modules = new ArrayList<>();
|
|
259
288
|
modules.add(new SNSProoface());
|
|
260
|
-
if (isDisableMLKit) {
|
|
261
|
-
modules.add(new SNSCoreModule(SNSCoreModule.FEATURE_DISABLE_MLKIT));
|
|
262
|
-
}
|
|
263
289
|
|
|
264
290
|
snsSdk = snsSdkBuilder
|
|
265
291
|
.withAccessToken(accessToken, () -> {
|
|
@@ -388,4 +414,4 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
388
414
|
}
|
|
389
415
|
|
|
390
416
|
|
|
391
|
-
}
|
|
417
|
+
}
|
package/www/SNSMobileSDK.js
CHANGED
|
@@ -144,7 +144,6 @@ function Builder() {
|
|
|
144
144
|
this.preferredDocumentDefinitions = {};
|
|
145
145
|
this.autoCloseOnApprove = 3;
|
|
146
146
|
this.settings = {};
|
|
147
|
-
this.disableMLKit = false
|
|
148
147
|
return this;
|
|
149
148
|
}
|
|
150
149
|
|
|
@@ -257,14 +256,6 @@ Builder.prototype.withAutoCloseOnApprove = function (autoCloseOnApprove) {
|
|
|
257
256
|
return this
|
|
258
257
|
}
|
|
259
258
|
|
|
260
|
-
Builder.prototype.withDisableMLKit = function (flag) {
|
|
261
|
-
if (typeof flag !== 'boolean') {
|
|
262
|
-
throw new Error('Invalid parameter, "withDisableMLKit" expects a boolean');
|
|
263
|
-
}
|
|
264
|
-
this.disableMLKit = flag;
|
|
265
|
-
return this;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
259
|
Builder.prototype.build = function () {
|
|
269
260
|
|
|
270
261
|
var hasHandlers = {}
|
|
@@ -287,7 +278,6 @@ Builder.prototype.build = function () {
|
|
|
287
278
|
isAnalyticsEnabled: this.isAnalyticsEnabled,
|
|
288
279
|
autoCloseOnApprove: this.autoCloseOnApprove,
|
|
289
280
|
debug: this.debug,
|
|
290
|
-
disableMLKit: this.disableMLKit
|
|
291
281
|
});
|
|
292
282
|
}
|
|
293
283
|
|