@sumsub/cordova-idensic-mobile-sdk-plugin 1.19.4 → 1.19.5
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 +1 -1
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/src/android/build-extras.gradle +2 -2
- package/src/android/build.gradle +2 -2
- package/src/android/src/main/java/com/sumsub/msdk/plugins/cordova/SNSMobileSdkCordovaPlugin.java +23 -9
- package/src/ios/SNSMobileSdkCordovaPlugin.m +9 -0
- package/www/SNSMobileSDK.js +14 -2
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}function u(e,t){return this.apiUrl=e,this.flowName=t,this.debug=!1,this.handlers={},this.applicantConf={},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?e.flowName&&!e.sdkConf.apiUrl?n(new Error("API URL is required")):(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"))})},u.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},u.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},u.prototype.withDebug=function(e){if("boolean"!=typeof e)throw new Error('Invalid parameter, "withDebug" expects a boolean');return this.debug=e,this},u.prototype.withLocale=function(e){if("string"!=typeof e)throw new Error('Invalid parameter, "locale" must be a string');return this.locale=e,this},u.prototype.withSupportEmail=function(e){if("string"!=typeof e)throw new Error('Invalid parameter, "supportEmail" must be a string');return this.supportEmail=e,this},u.prototype.withApplicantConf=function(e){if(!e||"object"!=typeof e)throw new Error('Invalid parameter, "withApplicantConf" expects a hash');return this.applicantConf=e,this},u.prototype.withBaseUrl=function(e){if("string"!=typeof e)throw new Error('Invalid parameter, "baseUrl" must be a string');return this.apiUrl=e,this},u.prototype.onTestEnv=function(){return this.withBaseUrl("https://test-api.sumsub.com")},u.prototype.build=function(){var e={};return Object.keys(this.handlers).forEach(t=>{e[t]=!0}),new a({apiUrl:this.apiUrl,flowName:this.flowName,accessToken:this.accessToken,tokenExpirationHandler:this.tokenExpirationHandler,handlers:this.handlers,hasHandlers:e,locale:this.locale,supportEmail:this.supportEmail,applicantConf:this.applicantConf,debug:this.debug})},e.exports={init:function(e,t){return(new u).withAccessToken(e,t)},Builder:function(e,t){return new u(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}])}));
|
|
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 u(e,t){return this.apiUrl=e,this.flowName=t,this.debug=!1,this.handlers={},this.applicantConf={},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?e.flowName&&!e.sdkConf.apiUrl?n(new Error("API URL is required")):(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"))})},u.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},u.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},u.prototype.withDebug=function(e){if("boolean"!=typeof e)throw new Error('Invalid parameter, "withDebug" expects a boolean');return this.debug=e,this},u.prototype.withLocale=function(e){if("string"!=typeof e)throw new Error('Invalid parameter, "locale" must be a string');return this.locale=e,this},u.prototype.withSupportEmail=function(e){if("string"!=typeof e)throw new Error('Invalid parameter, "supportEmail" must be a string');return this.supportEmail=e,this},u.prototype.withApplicantConf=function(e){if(!e||"object"!=typeof e)throw new Error('Invalid parameter, "withApplicantConf" expects a hash');return this.applicantConf=e,this},u.prototype.withTheme=function(e){if(!e||"object"!=typeof e)throw new Error('Invalid parameter, "withTheme" expects a hash');return this.theme=e,this},u.prototype.withBaseUrl=function(e){if("string"!=typeof e)throw new Error('Invalid parameter, "baseUrl" must be a string');return this.apiUrl=e,this},u.prototype.onTestEnv=function(){return this.withBaseUrl("https://test-api.sumsub.com")},u.prototype.build=function(){var e={};return Object.keys(this.handlers).forEach(t=>{e[t]=!0}),new a({apiUrl:this.apiUrl,flowName:this.flowName,accessToken:this.accessToken,tokenExpirationHandler:this.tokenExpirationHandler,handlers:this.handlers,hasHandlers:e,locale:this.locale,supportEmail:this.supportEmail,applicantConf:this.applicantConf,theme:this.theme,debug:this.debug})},e.exports={init:function(e,t){return(new u).withAccessToken(e,t)},Builder:function(e,t){return new u(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.19.
|
|
2
|
+
<plugin id="cordova-idensic-mobile-sdk-plugin" version="1.19.5" 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>
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
<source url="https://cdn.cocoapods.org/"/>
|
|
72
72
|
</config>
|
|
73
73
|
<pods>
|
|
74
|
-
<pod name="IdensicMobileSDK" spec="=1.19.
|
|
74
|
+
<pod name="IdensicMobileSDK" spec="=1.19.5" />
|
|
75
75
|
</pods>
|
|
76
76
|
</podspec>
|
|
77
77
|
|
|
@@ -16,7 +16,7 @@ allprojects {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
dependencies {
|
|
19
|
-
implementation "com.sumsub.sns:idensic-mobile-sdk:1.19.
|
|
20
|
-
implementation "com.sumsub.sns:idensic-mobile-sdk-prooface:1.19.
|
|
19
|
+
implementation "com.sumsub.sns:idensic-mobile-sdk:1.19.5"
|
|
20
|
+
implementation "com.sumsub.sns:idensic-mobile-sdk-prooface:1.19.5"
|
|
21
21
|
implementation 'com.google.android.material:material:1.3.0'
|
|
22
22
|
}
|
package/src/android/build.gradle
CHANGED
|
@@ -47,8 +47,8 @@ android {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
dependencies {
|
|
50
|
-
implementation "com.sumsub.sns:idensic-mobile-sdk:1.19.
|
|
51
|
-
implementation "com.sumsub.sns:idensic-mobile-sdk-prooface:1.19.
|
|
50
|
+
implementation "com.sumsub.sns:idensic-mobile-sdk:1.19.5"
|
|
51
|
+
implementation "com.sumsub.sns:idensic-mobile-sdk-prooface:1.19.5"
|
|
52
52
|
|
|
53
53
|
implementation 'com.google.android.material:material:1.3.0'
|
|
54
54
|
implementation 'org.apache.cordova:framework:8.1.0'
|
package/src/android/src/main/java/com/sumsub/msdk/plugins/cordova/SNSMobileSdkCordovaPlugin.java
CHANGED
|
@@ -31,11 +31,7 @@ import org.json.JSONArray;
|
|
|
31
31
|
import org.json.JSONException;
|
|
32
32
|
import org.json.JSONObject;
|
|
33
33
|
|
|
34
|
-
import java.util
|
|
35
|
-
import java.util.Collections;
|
|
36
|
-
import java.util.HashMap;
|
|
37
|
-
import java.util.Locale;
|
|
38
|
-
import java.util.Map;
|
|
34
|
+
import java.util.*;
|
|
39
35
|
|
|
40
36
|
import androidx.annotation.Nullable;
|
|
41
37
|
import kotlin.Unit;
|
|
@@ -43,6 +39,8 @@ import kotlin.jvm.functions.Function1;
|
|
|
43
39
|
import kotlin.jvm.functions.Function2;
|
|
44
40
|
import timber.log.Timber;
|
|
45
41
|
|
|
42
|
+
import com.sumsub.sns.core.theme.SNSCustomizationFileFormat;
|
|
43
|
+
|
|
46
44
|
public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
47
45
|
private static final String LAUNCH_ACTION = "launchSNSMobileSDK";
|
|
48
46
|
private static final String NEW_TOKEN_ACTION = "setNewAccessToken";
|
|
@@ -71,6 +69,8 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
71
69
|
boolean isDebug = conf.optBoolean("debug", false);
|
|
72
70
|
JSONObject hasHandlers = conf.getJSONObject("hasHandlers");
|
|
73
71
|
JSONObject applicantConf = conf.optJSONObject("applicantConf");
|
|
72
|
+
JSONObject settings = conf.optJSONObject("settings");
|
|
73
|
+
JSONObject theme = conf.optJSONObject("theme");
|
|
74
74
|
String phone = applicantConf.optString("phone");
|
|
75
75
|
String email = applicantConf.optString("email");
|
|
76
76
|
|
|
@@ -85,7 +85,7 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
85
85
|
if (TextUtils.isEmpty(locale)) {
|
|
86
86
|
locale = Locale.getDefault().getLanguage();
|
|
87
87
|
}
|
|
88
|
-
this.launchSNSMobileSDK(apiUrl, flowName, accessToken, supportEmail, email, phone, locale, isDebug, hasHandlers, callbackContext);
|
|
88
|
+
this.launchSNSMobileSDK(apiUrl, flowName, accessToken, supportEmail, email, phone, locale, isDebug, theme, settings, hasHandlers, callbackContext);
|
|
89
89
|
return true;
|
|
90
90
|
} else if (action.equals(NEW_TOKEN_ACTION)) {
|
|
91
91
|
newAccessToken = args.getString(0);
|
|
@@ -139,7 +139,7 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
private void launchSNSMobileSDK(final String apiUrl, final String flowName, final String accessToken, String supportEmail, String email, String phone, final String locale, final boolean isDebug, final JSONObject hasHandlers, CallbackContext callbackContext) {
|
|
142
|
+
private void launchSNSMobileSDK(final String apiUrl, final String flowName, final String accessToken, String supportEmail, String email, String phone, final String locale, final boolean isDebug, final JSONObject theme, final JSONObject settings, final JSONObject hasHandlers, CallbackContext callbackContext) {
|
|
143
143
|
|
|
144
144
|
cordova.getActivity().runOnUiThread(new Runnable() {
|
|
145
145
|
@Override
|
|
@@ -232,7 +232,9 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
232
232
|
SNSIconHandler.SNSCommonIcons.MAIL.getImageName(),
|
|
233
233
|
null
|
|
234
234
|
);
|
|
235
|
-
|
|
235
|
+
if (theme != null) {
|
|
236
|
+
snsSdkBuilder.withJsonTheme(theme, SNSCustomizationFileFormat.CORDOVA);
|
|
237
|
+
}
|
|
236
238
|
snsSdk = snsSdkBuilder
|
|
237
239
|
.withAccessToken(accessToken, () -> {
|
|
238
240
|
Timber.d("SumSub: calling onTokenExpired!");
|
|
@@ -261,7 +263,8 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
261
263
|
.withEventHandler(eventHandler)
|
|
262
264
|
.withSupportItems(Collections.singletonList(supportItem))
|
|
263
265
|
.withLocale(new Locale(locale))
|
|
264
|
-
.
|
|
266
|
+
.withSettings(toMap(settings))
|
|
267
|
+
.withConf(new SNSInitConfig(email, phone, null))
|
|
265
268
|
.build();
|
|
266
269
|
snsSdk.launch();
|
|
267
270
|
} catch (Exception e) {
|
|
@@ -346,4 +349,15 @@ public class SNSMobileSdkCordovaPlugin extends CordovaPlugin {
|
|
|
346
349
|
super.onActivityResult(requestCode, resultCode, data);
|
|
347
350
|
}
|
|
348
351
|
|
|
352
|
+
public static Map<String, String> toMap(JSONObject jsonobj) throws JSONException {
|
|
353
|
+
Map<String, String> map = new HashMap<String, String>();
|
|
354
|
+
Iterator<String> keys = jsonobj.keys();
|
|
355
|
+
while(keys.hasNext()) {
|
|
356
|
+
String key = keys.next();
|
|
357
|
+
String value = (String)jsonobj.get(key);
|
|
358
|
+
map.put(key, value);
|
|
359
|
+
} return map;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
|
|
349
363
|
}
|
|
@@ -56,6 +56,10 @@
|
|
|
56
56
|
sdk.logLevel = SNSLogLevel_Debug;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
if (params[@"settings"]) {
|
|
60
|
+
sdk.settings = params[@"settings"];
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
if (params[@"applicantConf"][@"email"]) {
|
|
60
64
|
sdk.initialEmail = params[@"applicantConf"][@"email"];
|
|
61
65
|
}
|
|
@@ -114,6 +118,11 @@
|
|
|
114
118
|
}];
|
|
115
119
|
}
|
|
116
120
|
|
|
121
|
+
if (params[@"theme"]) {
|
|
122
|
+
|
|
123
|
+
sdk.theme = [SNSTheme fromJSON:params[@"theme"]];
|
|
124
|
+
}
|
|
125
|
+
|
|
117
126
|
[self applyCustomizationIfAny];
|
|
118
127
|
|
|
119
128
|
[sdk presentFrom:self.viewController];
|
package/www/SNSMobileSDK.js
CHANGED
|
@@ -28,6 +28,11 @@ var _currentInstance = null;
|
|
|
28
28
|
|
|
29
29
|
function SNSMobileSDK(sdkConf) {
|
|
30
30
|
this.sdkConf = sdkConf
|
|
31
|
+
|
|
32
|
+
this.sdkConf.settings = {
|
|
33
|
+
"appFrameworkName": "cordova",
|
|
34
|
+
// "appFrameworkVersion": "..."
|
|
35
|
+
}
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
SNSMobileSDK.prototype.dismiss = function () {
|
|
@@ -199,15 +204,21 @@ Builder.prototype.withSupportEmail = function (supportEmail) {
|
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
Builder.prototype.withApplicantConf = function (applicantConf) {
|
|
202
|
-
|
|
203
207
|
if (!applicantConf || typeof applicantConf !== 'object') {
|
|
204
208
|
throw new Error('Invalid parameter, "withApplicantConf" expects a hash')
|
|
205
209
|
}
|
|
206
|
-
|
|
207
210
|
this.applicantConf = applicantConf
|
|
208
211
|
return this
|
|
209
212
|
}
|
|
210
213
|
|
|
214
|
+
Builder.prototype.withTheme = function (theme) {
|
|
215
|
+
if (!theme || typeof theme !== 'object') {
|
|
216
|
+
throw new Error('Invalid parameter, "withTheme" expects a hash')
|
|
217
|
+
}
|
|
218
|
+
this.theme = theme;
|
|
219
|
+
return this
|
|
220
|
+
}
|
|
221
|
+
|
|
211
222
|
Builder.prototype.withBaseUrl = function (apiUrl) {
|
|
212
223
|
if (typeof apiUrl !== 'string') {
|
|
213
224
|
throw new Error('Invalid parameter, "baseUrl" must be a string');
|
|
@@ -237,6 +248,7 @@ Builder.prototype.build = function () {
|
|
|
237
248
|
locale: this.locale,
|
|
238
249
|
supportEmail: this.supportEmail,
|
|
239
250
|
applicantConf: this.applicantConf,
|
|
251
|
+
theme: this.theme,
|
|
240
252
|
debug: this.debug
|
|
241
253
|
});
|
|
242
254
|
}
|