@veryai/react-native-sdk 1.0.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/android/build.gradle +59 -0
- package/android/gradle.properties +1 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/kotlin/com/verymobilesdk/rn/VeryMobileSDKModule.kt +52 -0
- package/android/src/main/kotlin/com/verymobilesdk/rn/VeryMobileSDKPackage.kt +16 -0
- package/ios/VeryMobileSDKRN.m +12 -0
- package/ios/VeryMobileSDKRN.swift +71 -0
- package/lib/commonjs/NativeVeryMobileSDK.js +18 -0
- package/lib/commonjs/NativeVeryMobileSDK.js.map +1 -0
- package/lib/commonjs/index.js +32 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/NativeVeryMobileSDK.js +12 -0
- package/lib/module/NativeVeryMobileSDK.js.map +1 -0
- package/lib/module/index.js +25 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/NativeVeryMobileSDK.d.ts +7 -0
- package/lib/typescript/NativeVeryMobileSDK.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +7 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +17 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +59 -0
- package/src/NativeVeryMobileSDK.ts +25 -0
- package/src/index.tsx +29 -0
- package/src/types.ts +17 -0
- package/veryai-react-native-sdk.podspec +18 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.kotlin_version = '1.7.22'
|
|
3
|
+
repositories {
|
|
4
|
+
google()
|
|
5
|
+
mavenCentral()
|
|
6
|
+
}
|
|
7
|
+
dependencies {
|
|
8
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
apply plugin: 'com.android.library'
|
|
13
|
+
apply plugin: 'kotlin-android'
|
|
14
|
+
|
|
15
|
+
android {
|
|
16
|
+
if (project.android.hasProperty("namespace")) {
|
|
17
|
+
namespace 'com.verymobilesdk.rn'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
compileSdkVersion 34
|
|
21
|
+
|
|
22
|
+
defaultConfig {
|
|
23
|
+
minSdkVersion 23
|
|
24
|
+
targetSdkVersion 34
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
compileOptions {
|
|
28
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
29
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
kotlinOptions {
|
|
33
|
+
jvmTarget = '1.8'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
sourceSets {
|
|
37
|
+
main {
|
|
38
|
+
java.srcDirs += 'src/main/kotlin'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
repositories {
|
|
44
|
+
google()
|
|
45
|
+
mavenCentral()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
dependencies {
|
|
49
|
+
implementation "com.facebook.react:react-native:+"
|
|
50
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
51
|
+
|
|
52
|
+
// Very Mobile SDK - use published Maven artifact in production,
|
|
53
|
+
// or local project dependency during development
|
|
54
|
+
if (findProject(':very-mobile-sdk') != null) {
|
|
55
|
+
implementation project(':very-mobile-sdk')
|
|
56
|
+
} else {
|
|
57
|
+
implementation "org.very.mobile:sdk:${project.findProperty('veryMobileSDKVersion') ?: '1.0.0'}"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VeryMobileSDKRN_kotlinVersion=1.7.22
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
package com.verymobilesdk.rn
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.*
|
|
4
|
+
import org.very.mobile.sdk.VeryConfig
|
|
5
|
+
import org.very.mobile.sdk.VeryMobileSDK
|
|
6
|
+
import org.very.mobile.sdk.VeryPresentationStyle
|
|
7
|
+
|
|
8
|
+
class VeryMobileSDKModule(reactContext: ReactApplicationContext) :
|
|
9
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
10
|
+
|
|
11
|
+
override fun getName(): String = "VeryMobileSDKRN"
|
|
12
|
+
|
|
13
|
+
@ReactMethod
|
|
14
|
+
fun authenticate(configMap: ReadableMap, promise: Promise) {
|
|
15
|
+
val activity = currentActivity
|
|
16
|
+
if (activity == null) {
|
|
17
|
+
promise.reject("NO_ACTIVITY", "No current activity")
|
|
18
|
+
return
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
val config = VeryConfig(
|
|
22
|
+
sdkKey = configMap.getString("sdkKey") ?: "",
|
|
23
|
+
userId = if (configMap.hasKey("userId") && !configMap.isNull("userId")) configMap.getString("userId") else null,
|
|
24
|
+
language = if (configMap.hasKey("language") && !configMap.isNull("language")) configMap.getString("language") else null,
|
|
25
|
+
themeMode = configMap.getString("themeMode") ?: "dark",
|
|
26
|
+
baseUrl = if (configMap.hasKey("baseUrl") && !configMap.isNull("baseUrl")) configMap.getString("baseUrl") else null
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
val style = when (configMap.getString("presentationStyle")) {
|
|
30
|
+
"bottomSheet" -> VeryPresentationStyle.BOTTOM_SHEET
|
|
31
|
+
else -> VeryPresentationStyle.FULL_SCREEN
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
VeryMobileSDK.authenticate(activity, config, style) { result ->
|
|
35
|
+
val map = Arguments.createMap().apply {
|
|
36
|
+
putString("code", result.code)
|
|
37
|
+
putString("userId", result.userId)
|
|
38
|
+
if (result.signedToken != null) putString("signedToken", result.signedToken)
|
|
39
|
+
if (result.error != null) putString("error", result.error)
|
|
40
|
+
if (result.errorMessage != null) putString("errorMessage", result.errorMessage)
|
|
41
|
+
putBoolean("isSuccess", result.isSuccess)
|
|
42
|
+
}
|
|
43
|
+
promise.resolve(map)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@ReactMethod
|
|
48
|
+
fun isSupported(promise: Promise) {
|
|
49
|
+
val context = currentActivity ?: reactApplicationContext
|
|
50
|
+
promise.resolve(VeryMobileSDK.isSupport(context))
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package com.verymobilesdk.rn
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
|
|
8
|
+
class VeryMobileSDKPackage : ReactPackage {
|
|
9
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
10
|
+
return listOf(VeryMobileSDKModule(reactContext))
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
14
|
+
return emptyList()
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
|
|
3
|
+
@interface RCT_EXTERN_MODULE(VeryMobileSDKRN, NSObject)
|
|
4
|
+
|
|
5
|
+
RCT_EXTERN_METHOD(authenticate:(NSDictionary *)config
|
|
6
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
7
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
8
|
+
|
|
9
|
+
RCT_EXTERN_METHOD(isSupported:(RCTPromiseResolveBlock)resolve
|
|
10
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
11
|
+
|
|
12
|
+
@end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import VeryMobileSDK
|
|
3
|
+
|
|
4
|
+
@objc(VeryMobileSDKRN)
|
|
5
|
+
class VeryMobileSDKRN: NSObject {
|
|
6
|
+
|
|
7
|
+
@objc static func requiresMainQueueSetup() -> Bool { return false }
|
|
8
|
+
|
|
9
|
+
@objc func authenticate(_ config: NSDictionary,
|
|
10
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
11
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
12
|
+
DispatchQueue.main.async {
|
|
13
|
+
guard let rootVC = Self.topViewController() else {
|
|
14
|
+
reject("NO_VC", "No root view controller found", nil)
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let veryConfig = VeryConfig(
|
|
19
|
+
sdkKey: config["sdkKey"] as? String ?? "",
|
|
20
|
+
userId: config["userId"] as? String,
|
|
21
|
+
language: config["language"] as? String,
|
|
22
|
+
themeMode: config["themeMode"] as? String ?? "dark",
|
|
23
|
+
baseUrl: config["baseUrl"] as? String
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
let style: VeryPresentationStyle = .modal
|
|
27
|
+
|
|
28
|
+
VeryMobileSDK.authenticate(from: rootVC, config: veryConfig, presentationStyle: style) { result in
|
|
29
|
+
var dict: [String: Any] = [
|
|
30
|
+
"code": result.code,
|
|
31
|
+
"userId": result.userId ?? "",
|
|
32
|
+
"isSuccess": result.isSuccess,
|
|
33
|
+
]
|
|
34
|
+
if let signedToken = result.signedToken {
|
|
35
|
+
dict["signedToken"] = signedToken
|
|
36
|
+
}
|
|
37
|
+
if let error = result.error {
|
|
38
|
+
dict["error"] = error
|
|
39
|
+
}
|
|
40
|
+
if let errorMessage = result.errorMessage {
|
|
41
|
+
dict["errorMessage"] = errorMessage
|
|
42
|
+
}
|
|
43
|
+
resolve(dict)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@objc func isSupported(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
49
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
50
|
+
resolve(VeryMobileSDK.isSupport())
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// MARK: - Helper
|
|
54
|
+
|
|
55
|
+
private static func topViewController() -> UIViewController? {
|
|
56
|
+
guard let scene = UIApplication.shared.connectedScenes
|
|
57
|
+
.compactMap({ $0 as? UIWindowScene })
|
|
58
|
+
.first(where: { $0.activationState == .foregroundActive }),
|
|
59
|
+
let rootVC = scene.windows.first(where: { $0.isKeyWindow })?.rootViewController
|
|
60
|
+
else { return nil }
|
|
61
|
+
|
|
62
|
+
var top = rootVC
|
|
63
|
+
while let presented = top.presentedViewController {
|
|
64
|
+
top = presented
|
|
65
|
+
}
|
|
66
|
+
if let nav = top as? UINavigationController, let visible = nav.visibleViewController {
|
|
67
|
+
top = visible
|
|
68
|
+
}
|
|
69
|
+
return top
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const LINKING_ERROR = `The package '@veryai/react-native-sdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
9
|
+
ios: "- You have run 'pod install'\n",
|
|
10
|
+
default: ''
|
|
11
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
12
|
+
const VeryMobileSDKRN = _reactNative.NativeModules.VeryMobileSDKRN ? _reactNative.NativeModules.VeryMobileSDKRN : new Proxy({}, {
|
|
13
|
+
get() {
|
|
14
|
+
throw new Error(LINKING_ERROR);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
var _default = exports.default = VeryMobileSDKRN;
|
|
18
|
+
//# sourceMappingURL=NativeVeryMobileSDK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","VeryMobileSDKRN","NativeModules","Proxy","get","Error","_default","exports"],"sourceRoot":"../../src","sources":["NativeVeryMobileSDK.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,mFAAmF,GACnFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,eAAe,GAAGC,0BAAa,CAACD,eAAe,GACjDC,0BAAa,CAACD,eAAe,GAC7B,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAAP,OAAA,GAOSC,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VeryMobileSDK = void 0;
|
|
7
|
+
var _NativeVeryMobileSDK = _interopRequireDefault(require("./NativeVeryMobileSDK"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const VeryMobileSDK = exports.VeryMobileSDK = {
|
|
10
|
+
async authenticate(config) {
|
|
11
|
+
const raw = await _NativeVeryMobileSDK.default.authenticate({
|
|
12
|
+
sdkKey: config.sdkKey,
|
|
13
|
+
userId: config.userId ?? null,
|
|
14
|
+
language: config.language ?? null,
|
|
15
|
+
themeMode: config.themeMode ?? 'dark',
|
|
16
|
+
baseUrl: config.baseUrl ?? null,
|
|
17
|
+
presentationStyle: config.presentationStyle ?? 'fullScreen'
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
code: raw.code,
|
|
21
|
+
userId: raw.userId,
|
|
22
|
+
signedToken: raw.signedToken || undefined,
|
|
23
|
+
error: raw.error || undefined,
|
|
24
|
+
errorMessage: raw.errorMessage || undefined,
|
|
25
|
+
isSuccess: raw.isSuccess
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
async isSupported() {
|
|
29
|
+
return _NativeVeryMobileSDK.default.isSupported();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_NativeVeryMobileSDK","_interopRequireDefault","require","e","__esModule","default","VeryMobileSDK","exports","authenticate","config","raw","NativeModule","sdkKey","userId","language","themeMode","baseUrl","presentationStyle","code","signedToken","undefined","error","errorMessage","isSuccess","isSupported"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAK1C,MAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC3B,MAAME,YAAYA,CAACC,MAAkB,EAAuB;IAC1D,MAAMC,GAAG,GAAG,MAAMC,4BAAY,CAACH,YAAY,CAAC;MAC1CI,MAAM,EAAEH,MAAM,CAACG,MAAM;MACrBC,MAAM,EAAEJ,MAAM,CAACI,MAAM,IAAI,IAAI;MAC7BC,QAAQ,EAAEL,MAAM,CAACK,QAAQ,IAAI,IAAI;MACjCC,SAAS,EAAEN,MAAM,CAACM,SAAS,IAAI,MAAM;MACrCC,OAAO,EAAEP,MAAM,CAACO,OAAO,IAAI,IAAI;MAC/BC,iBAAiB,EAAER,MAAM,CAACQ,iBAAiB,IAAI;IACjD,CAAC,CAAC;IACF,OAAO;MACLC,IAAI,EAAER,GAAG,CAACQ,IAAc;MACxBL,MAAM,EAAEH,GAAG,CAACG,MAAgB;MAC5BM,WAAW,EAAGT,GAAG,CAACS,WAAW,IAAeC,SAAS;MACrDC,KAAK,EAAGX,GAAG,CAACW,KAAK,IAAeD,SAAS;MACzCE,YAAY,EAAGZ,GAAG,CAACY,YAAY,IAAeF,SAAS;MACvDG,SAAS,EAAEb,GAAG,CAACa;IACjB,CAAC;EACH,CAAC;EAED,MAAMC,WAAWA,CAAA,EAAqB;IACpC,OAAOb,4BAAY,CAACa,WAAW,CAAC,CAAC;EACnC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR = `The package '@veryai/react-native-sdk' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install'\n",
|
|
4
|
+
default: ''
|
|
5
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
6
|
+
const VeryMobileSDKRN = NativeModules.VeryMobileSDKRN ? NativeModules.VeryMobileSDKRN : new Proxy({}, {
|
|
7
|
+
get() {
|
|
8
|
+
throw new Error(LINKING_ERROR);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export default VeryMobileSDKRN;
|
|
12
|
+
//# sourceMappingURL=NativeVeryMobileSDK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","VeryMobileSDKRN","Proxy","get","Error"],"sourceRoot":"../../src","sources":["NativeVeryMobileSDK.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,mFAAmF,GACnFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,eAAe,GAAGN,aAAa,CAACM,eAAe,GACjDN,aAAa,CAACM,eAAe,GAC7B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAOL,eAAeI,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import NativeModule from './NativeVeryMobileSDK';
|
|
2
|
+
export const VeryMobileSDK = {
|
|
3
|
+
async authenticate(config) {
|
|
4
|
+
const raw = await NativeModule.authenticate({
|
|
5
|
+
sdkKey: config.sdkKey,
|
|
6
|
+
userId: config.userId ?? null,
|
|
7
|
+
language: config.language ?? null,
|
|
8
|
+
themeMode: config.themeMode ?? 'dark',
|
|
9
|
+
baseUrl: config.baseUrl ?? null,
|
|
10
|
+
presentationStyle: config.presentationStyle ?? 'fullScreen'
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
code: raw.code,
|
|
14
|
+
userId: raw.userId,
|
|
15
|
+
signedToken: raw.signedToken || undefined,
|
|
16
|
+
error: raw.error || undefined,
|
|
17
|
+
errorMessage: raw.errorMessage || undefined,
|
|
18
|
+
isSuccess: raw.isSuccess
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
async isSupported() {
|
|
22
|
+
return NativeModule.isSupported();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModule","VeryMobileSDK","authenticate","config","raw","sdkKey","userId","language","themeMode","baseUrl","presentationStyle","code","signedToken","undefined","error","errorMessage","isSuccess","isSupported"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAOA,YAAY,MAAM,uBAAuB;AAKhD,OAAO,MAAMC,aAAa,GAAG;EAC3B,MAAMC,YAAYA,CAACC,MAAkB,EAAuB;IAC1D,MAAMC,GAAG,GAAG,MAAMJ,YAAY,CAACE,YAAY,CAAC;MAC1CG,MAAM,EAAEF,MAAM,CAACE,MAAM;MACrBC,MAAM,EAAEH,MAAM,CAACG,MAAM,IAAI,IAAI;MAC7BC,QAAQ,EAAEJ,MAAM,CAACI,QAAQ,IAAI,IAAI;MACjCC,SAAS,EAAEL,MAAM,CAACK,SAAS,IAAI,MAAM;MACrCC,OAAO,EAAEN,MAAM,CAACM,OAAO,IAAI,IAAI;MAC/BC,iBAAiB,EAAEP,MAAM,CAACO,iBAAiB,IAAI;IACjD,CAAC,CAAC;IACF,OAAO;MACLC,IAAI,EAAEP,GAAG,CAACO,IAAc;MACxBL,MAAM,EAAEF,GAAG,CAACE,MAAgB;MAC5BM,WAAW,EAAGR,GAAG,CAACQ,WAAW,IAAeC,SAAS;MACrDC,KAAK,EAAGV,GAAG,CAACU,KAAK,IAAeD,SAAS;MACzCE,YAAY,EAAGX,GAAG,CAACW,YAAY,IAAeF,SAAS;MACvDG,SAAS,EAAEZ,GAAG,CAACY;IACjB,CAAC;EACH,CAAC;EAED,MAAMC,WAAWA,CAAA,EAAqB;IACpC,OAAOjB,YAAY,CAACiB,WAAW,CAAC,CAAC;EACnC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface NativeVeryMobileSDKSpec {
|
|
2
|
+
authenticate(config: Record<string, any>): Promise<Record<string, any>>;
|
|
3
|
+
isSupported(): Promise<boolean>;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: NativeVeryMobileSDKSpec;
|
|
6
|
+
export default _default;
|
|
7
|
+
//# sourceMappingURL=NativeVeryMobileSDK.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeVeryMobileSDK.d.ts","sourceRoot":"","sources":["../../src/NativeVeryMobileSDK.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACxE,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;wBAEiC,uBAAuB;AAAzD,wBAA0D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { VeryConfig, VeryResult } from './types';
|
|
2
|
+
export type { VeryConfig, VeryResult };
|
|
3
|
+
export declare const VeryMobileSDK: {
|
|
4
|
+
authenticate(config: VeryConfig): Promise<VeryResult>;
|
|
5
|
+
isSupported(): Promise<boolean>;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AAEvC,eAAO,MAAM,aAAa;yBACG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;mBAmBtC,OAAO,CAAC,OAAO,CAAC;CAGtC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface VeryConfig {
|
|
2
|
+
sdkKey: string;
|
|
3
|
+
userId?: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
themeMode?: 'dark' | 'light';
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
presentationStyle?: 'fullScreen' | 'bottomSheet';
|
|
8
|
+
}
|
|
9
|
+
export interface VeryResult {
|
|
10
|
+
code: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
signedToken?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
errorMessage?: string;
|
|
15
|
+
isSuccess: boolean;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;CAClD;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;CACpB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@veryai/react-native-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React Native wrapper for Very Mobile SDK - Palm biometrics verification",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"veryai-react-native-sdk.podspec",
|
|
16
|
+
"!android/build",
|
|
17
|
+
"!ios/build",
|
|
18
|
+
"!**/__tests__"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"typescript": "tsc --noEmit",
|
|
22
|
+
"prepare": "bob build",
|
|
23
|
+
"clean": "rm -rf lib"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"react-native",
|
|
27
|
+
"palm",
|
|
28
|
+
"biometrics",
|
|
29
|
+
"verification",
|
|
30
|
+
"very"
|
|
31
|
+
],
|
|
32
|
+
"repository": "https://github.com/veroslabs/very-mobile-sdk",
|
|
33
|
+
"author": "Very Mobile Inc.",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": "*",
|
|
37
|
+
"react-native": "*"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"react": "18.2.0",
|
|
41
|
+
"react-native": "0.73.4",
|
|
42
|
+
"react-native-builder-bob": "^0.23.0",
|
|
43
|
+
"typescript": "^5.0.0"
|
|
44
|
+
},
|
|
45
|
+
"react-native-builder-bob": {
|
|
46
|
+
"source": "src",
|
|
47
|
+
"output": "lib",
|
|
48
|
+
"targets": [
|
|
49
|
+
"commonjs",
|
|
50
|
+
"module",
|
|
51
|
+
[
|
|
52
|
+
"typescript",
|
|
53
|
+
{
|
|
54
|
+
"project": "tsconfig.build.json"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const LINKING_ERROR =
|
|
4
|
+
`The package '@veryai/react-native-sdk' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo Go\n';
|
|
8
|
+
|
|
9
|
+
const VeryMobileSDKRN = NativeModules.VeryMobileSDKRN
|
|
10
|
+
? NativeModules.VeryMobileSDKRN
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export interface NativeVeryMobileSDKSpec {
|
|
21
|
+
authenticate(config: Record<string, any>): Promise<Record<string, any>>;
|
|
22
|
+
isSupported(): Promise<boolean>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default VeryMobileSDKRN as NativeVeryMobileSDKSpec;
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import NativeModule from './NativeVeryMobileSDK';
|
|
2
|
+
import type { VeryConfig, VeryResult } from './types';
|
|
3
|
+
|
|
4
|
+
export type { VeryConfig, VeryResult };
|
|
5
|
+
|
|
6
|
+
export const VeryMobileSDK = {
|
|
7
|
+
async authenticate(config: VeryConfig): Promise<VeryResult> {
|
|
8
|
+
const raw = await NativeModule.authenticate({
|
|
9
|
+
sdkKey: config.sdkKey,
|
|
10
|
+
userId: config.userId ?? null,
|
|
11
|
+
language: config.language ?? null,
|
|
12
|
+
themeMode: config.themeMode ?? 'dark',
|
|
13
|
+
baseUrl: config.baseUrl ?? null,
|
|
14
|
+
presentationStyle: config.presentationStyle ?? 'fullScreen',
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
code: raw.code as string,
|
|
18
|
+
userId: raw.userId as string,
|
|
19
|
+
signedToken: (raw.signedToken as string) || undefined,
|
|
20
|
+
error: (raw.error as string) || undefined,
|
|
21
|
+
errorMessage: (raw.errorMessage as string) || undefined,
|
|
22
|
+
isSuccess: raw.isSuccess as boolean,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
async isSupported(): Promise<boolean> {
|
|
27
|
+
return NativeModule.isSupported();
|
|
28
|
+
},
|
|
29
|
+
};
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface VeryConfig {
|
|
2
|
+
sdkKey: string;
|
|
3
|
+
userId?: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
themeMode?: 'dark' | 'light';
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
presentationStyle?: 'fullScreen' | 'bottomSheet';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface VeryResult {
|
|
11
|
+
code: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
signedToken?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
errorMessage?: string;
|
|
16
|
+
isSuccess: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
3
|
+
|
|
4
|
+
Pod::Spec.new do |s|
|
|
5
|
+
s.name = "veryai-react-native-sdk"
|
|
6
|
+
s.version = package["version"]
|
|
7
|
+
s.summary = package["description"]
|
|
8
|
+
s.homepage = "https://very.org"
|
|
9
|
+
s.license = "MIT"
|
|
10
|
+
s.author = { "Very Mobile Inc." => "mail@very.org" }
|
|
11
|
+
s.source = { :git => "https://github.com/veroslabs/very-mobile-sdk.git", :tag => s.version }
|
|
12
|
+
s.platform = :ios, "13.0"
|
|
13
|
+
|
|
14
|
+
s.source_files = "ios/**/*.{swift,h,m}"
|
|
15
|
+
s.dependency "React-Core"
|
|
16
|
+
s.dependency "VeryMobileSDK", "~> 1.0"
|
|
17
|
+
s.swift_version = "5.0"
|
|
18
|
+
end
|