solution-plugin 1.3.0-alpha.1

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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Advance AI
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # liveness-plugin
2
+
3
+ Guardian Liveness Detection SDK React Native plugin.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install liveness-plugin
9
+ ```
10
+
11
+ ## Usage
12
+
13
+
14
+ ```js
15
+ import {
16
+ getSDKVersion,
17
+ initSDKOfLicense,
18
+ setLicenseAndCheck,
19
+ startLivenessDetection,
20
+ } from 'liveness-plugin';
21
+
22
+ // ...
23
+
24
+ // Get the SDK version
25
+ const version = await getSDKVersion();
26
+
27
+ // Initialize the SDK with market selection
28
+ initSDKOfLicense(SELECTED_MARKET);
29
+
30
+ // Set the license key and check if it's valid
31
+ const checkResult = await setLicenseAndCheck(YOUR_LICENSE_KEY);
32
+ if (checkResult === 'SUCCESS') {
33
+ startLivenessDetection();
34
+ }
35
+
36
+ // Start the liveness detection process
37
+ const livenessParams: LivenessParams = {
38
+ cameraType: 'FRONT',
39
+ detectOcclusion: false, // Whether to detect occlusion
40
+ auditImageConfig: {
41
+ enableCollectSwitch: true, // Whether to enable the collection switch
42
+ imageWidth: 400, // Image width
43
+ imageQuality: 30, // Image quality
44
+ relativeSecondsCaptureAfterCameraLaunched: 3.0, // Capture at a relative number of seconds after the camera is launched
45
+ },
46
+ livenessType: 'test_more', // Liveness detection type
47
+ signatureId: '', // Signature ID, if available
48
+ distantNearTimeout: 50000, // Timeout for distant-near detection in milliseconds
49
+ silentTimeout: 50000, // Timeout for silent detection in milliseconds
50
+ actionTimeout: 10000, // Timeout for actions in milliseconds
51
+ prepareMillSeconds: 0, // Preparation time in milliseconds
52
+ resultPictureSize: 600, // Result picture size
53
+ maxRecordVideoSeconds: 600, // Maximum video recording time in seconds
54
+ userId: '', // User ID, in JSON string format
55
+ maskColor: '#000000', // Mask color
56
+ ovalColor: '#000000', // Oval color
57
+ ovalNormalColor: '#000000', // Normal oval color
58
+ };
59
+ startLivenessDetection(livenessParams, (result) => {
60
+ console.log('Liveness detection result received:', result);
61
+ });
62
+
63
+ ```
64
+
65
+
66
+ ## Contributing
67
+
68
+ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
69
+
70
+ ## License
71
+
72
+ MIT
73
+
74
+ ---
75
+
76
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -0,0 +1,27 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "SolutionPlugin"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://repo.advai.net/guardian/mobile-center/mobile-plugins/guardian-liveness-detection-react-natiive-plugin.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
17
+ s.private_header_files = "ios/**/*.h"
18
+
19
+ # Swift 支持
20
+ s.swift_version = "5.0"
21
+ s.requires_arc = true
22
+
23
+ s.dependency "SolutionH5"
24
+ s.static_framework = true
25
+
26
+ install_modules_dependencies(s)
27
+ end
@@ -0,0 +1,103 @@
1
+ buildscript {
2
+ ext.getExtOrDefault = {name ->
3
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['SolutionPlugin_' + name]
4
+ }
5
+
6
+ repositories {
7
+ google()
8
+ mavenCentral()
9
+ jcenter()
10
+ maven {
11
+ url 'https://public-n3.advai.net/repository/maven-releases/'
12
+ }
13
+ }
14
+
15
+ rootProject.allprojects {
16
+ repositories {
17
+ google()
18
+ jcenter()
19
+ repositories {
20
+ maven {
21
+ url 'https://public-n3.advai.net/repository/maven-releases/'
22
+ }
23
+ }
24
+ }
25
+ }
26
+
27
+ dependencies {
28
+ classpath "com.android.tools.build:gradle:8.7.2"
29
+ // noinspection DifferentKotlinGradleVersion
30
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
31
+ }
32
+ }
33
+
34
+
35
+ apply plugin: "com.android.library"
36
+ apply plugin: "kotlin-android"
37
+
38
+ apply plugin: "com.facebook.react"
39
+
40
+ def getExtOrIntegerDefault(name) {
41
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["SolutionPlugin_" + name]).toInteger()
42
+ }
43
+
44
+ android {
45
+ namespace "com.solutionplugin"
46
+
47
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
48
+
49
+ defaultConfig {
50
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
51
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
52
+ }
53
+
54
+ buildFeatures {
55
+ buildConfig true
56
+ }
57
+
58
+ buildTypes {
59
+ release {
60
+ minifyEnabled false
61
+ }
62
+ }
63
+
64
+ lintOptions {
65
+ disable "GradleCompatible"
66
+ }
67
+
68
+ compileOptions {
69
+ sourceCompatibility JavaVersion.VERSION_1_8
70
+ targetCompatibility JavaVersion.VERSION_1_8
71
+ }
72
+
73
+ sourceSets {
74
+ main {
75
+ java.srcDirs += [
76
+ "generated/java",
77
+ "generated/jni"
78
+ ]
79
+ }
80
+ }
81
+ }
82
+
83
+ repositories {
84
+ mavenCentral()
85
+ google()
86
+ maven {
87
+ url 'https://public-n3.advai.net/repository/maven-releases/'
88
+ }
89
+ }
90
+
91
+ def kotlin_version = getExtOrDefault("kotlinVersion")
92
+
93
+ dependencies {
94
+ implementation "com.facebook.react:react-android"
95
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
96
+ implementation "ai.advance.mobile-sdk.android:solution-lib:1.3.0"
97
+ }
98
+
99
+ react {
100
+ jsRootDir = file("../src/")
101
+ libraryName = "SolutionPlugin"
102
+ codegenJavaPackageName = "com.livenessplugin"
103
+ }
@@ -0,0 +1,5 @@
1
+ SolutionPlugin_kotlinVersion=2.0.21
2
+ SolutionPlugin_minSdkVersion=24
3
+ SolutionPlugin_targetSdkVersion=34
4
+ SolutionPlugin_compileSdkVersion=35
5
+ SolutionPlugin_ndkVersion=27.1.12297006
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.solutionplugin">
3
+ </manifest>
@@ -0,0 +1,74 @@
1
+ package com.solutionplugin
2
+
3
+ import aai.liveness.sdk.Colors
4
+ import aai.liveness.sdk.GuardianSolutionSDK
5
+ import aai.liveness.sdk.ThemeType
6
+ import aai.telemetry.enums.PluginPlatform
7
+ import android.app.Application
8
+ import android.util.Log
9
+ import com.facebook.react.bridge.Arguments
10
+ import com.facebook.react.bridge.Promise
11
+ import com.facebook.react.bridge.ReactApplicationContext
12
+ import com.facebook.react.bridge.ReactMethod
13
+ import com.facebook.react.module.annotations.ReactModule
14
+
15
+ @ReactModule(name = SolutionPluginModule.NAME)
16
+ class SolutionPluginModule(private val reactContext: ReactApplicationContext) :
17
+ NativeSolutionPluginSpec(reactContext) {
18
+
19
+
20
+ private val application: Application by lazy { reactContext.applicationContext as Application }
21
+
22
+ override fun getName() = NAME
23
+
24
+
25
+ @ReactMethod
26
+ override fun setThemeARGBColor(light: String, dark: String, promise: Promise) {
27
+ try {
28
+ GuardianSolutionSDK.setThemeColors(
29
+ Colors.Builder().setPrimaryColor(light).build(),
30
+ Colors.Builder().setPrimaryColor(dark).build()
31
+ )
32
+ promise.resolve(true)
33
+ } catch (e: Exception) {
34
+ promise.reject("SET_THEME_COLOR_ERROR", e.message, e)
35
+ }
36
+ }
37
+
38
+ @ReactMethod
39
+ override fun setDarkThemeType(type: String?, promise: Promise?) {
40
+ try {
41
+ val themeType = ThemeType.valueOf(type ?: ThemeType.LIGHT.name)
42
+ GuardianSolutionSDK.setThemeType(themeType)
43
+ } catch (e: Exception) {
44
+ promise?.reject("SET_DARK_THEME_TYPE_ERROR", e.message, e)
45
+ }
46
+ }
47
+
48
+ override fun getSDKVersion(promise: Promise?) {
49
+ Log.d("SolutionPluginModule", "getVersion")
50
+ try {
51
+ val version = GuardianSolutionSDK.getSDKVersion()
52
+ promise?.resolve(version)
53
+ } catch (e: Exception) {
54
+ promise?.reject("GET_VERSION_ERROR", e.message, e)
55
+ }
56
+ }
57
+
58
+ override fun start(url: String?, promise: Promise?) {
59
+ GuardianSolutionSDK.init(application)
60
+ GuardianSolutionSDK.setPluginPlatform(PluginPlatform.ReactNative)
61
+ GuardianSolutionSDK.start(currentActivity, url) { result ->
62
+ promise?.resolve(
63
+ Arguments.createMap().apply {
64
+ putString("code", result.code)
65
+ putString("signatureId", result.signatureId)
66
+ putString("finishRedirectUrl", result.finishRedirectUrl)
67
+ })
68
+ }
69
+ }
70
+
71
+ companion object {
72
+ const val NAME = "SolutionPlugin"
73
+ }
74
+ }
@@ -0,0 +1,33 @@
1
+ package com.solutionplugin
2
+
3
+ import com.facebook.react.BaseReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
8
+ import java.util.HashMap
9
+
10
+ class SolutionPluginPackage : BaseReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
+ return if (name == SolutionPluginModule.NAME) {
13
+ SolutionPluginModule(reactContext)
14
+ } else {
15
+ null
16
+ }
17
+ }
18
+
19
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
+ return ReactModuleInfoProvider {
21
+ val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
22
+ moduleInfos[SolutionPluginModule.NAME] = ReactModuleInfo(
23
+ SolutionPluginModule.NAME,
24
+ SolutionPluginModule.NAME,
25
+ false, // canOverrideExistingModule
26
+ false, // needsEagerInit
27
+ false, // isCxxModule
28
+ true // isTurboModule
29
+ )
30
+ moduleInfos
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,21 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(SolutionPlugin, NSObject)
4
+
5
+ RCT_EXTERN_METHOD(setThemeARGBColor:(nonnull NSString *)light
6
+ dark:(nonnull NSString *)dark
7
+ resolver:(RCTPromiseResolveBlock)resolve
8
+ rejecter:(RCTPromiseRejectBlock)reject)
9
+
10
+ RCT_EXTERN_METHOD(setDarkThemeType:(nonnull NSString *)type
11
+ resolver:(RCTPromiseResolveBlock)resolve
12
+ rejecter:(RCTPromiseRejectBlock)reject)
13
+
14
+ RCT_EXTERN_METHOD(start:(nonnull NSString *)url
15
+ resolver:(RCTPromiseResolveBlock)resolve
16
+ rejecter:(RCTPromiseRejectBlock)reject)
17
+
18
+ RCT_EXTERN_METHOD(getSDKVersion:(RCTPromiseResolveBlock)resolve
19
+ rejecter:(RCTPromiseRejectBlock)reject)
20
+
21
+ @end
@@ -0,0 +1,79 @@
1
+ import Foundation
2
+ import React
3
+ import SolutionSDK
4
+
5
+ @objc(SolutionPlugin)
6
+ class SolutionPlugin: NSObject {
7
+
8
+ // MARK: - Exported Methods
9
+
10
+ @objc
11
+ func setThemeARGBColor(_ light: String, dark: String, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
12
+ DispatchQueue.main.async {
13
+ let lightColor = self.color(from: light)
14
+ let darkColor = self.color(from: dark)
15
+ SolutionCenter.shared.setThemeARGBColor(light: lightColor, dark: darkColor)
16
+ resolver(true)
17
+ }
18
+ }
19
+
20
+ @objc
21
+ func setDarkThemeType(_ type: String, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
22
+ DispatchQueue.main.async {
23
+ let themeType = SolutionCenter.ThemeType(rawValue: type)
24
+ SolutionCenter.shared.setDarkThemeType(themeType)
25
+ resolver(true)
26
+ }
27
+ }
28
+
29
+ @objc
30
+ func start(_ url: String, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
31
+ DispatchQueue.main.async {
32
+ SolutionCenter.shared.register(listener: .init(end: { result in
33
+ var resultDict: [String: Any] = [
34
+ "code": result.code
35
+ ]
36
+ resultDict["signatureId"] = result.signatureId
37
+ resultDict["finishRedirectUrl"] = result.finishRedirectUrl
38
+ // Use compactMapValues to remove nil values
39
+ resolver(resultDict.compactMapValues { $0 })
40
+ }))
41
+
42
+ SolutionCenter.shared.pluginPlatform = "react-native"
43
+ SolutionCenter.shared.start(with: url)
44
+ }
45
+ }
46
+
47
+ // MARK: - Legacy Methods
48
+
49
+ @objc
50
+ func getSDKVersion(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
51
+
52
+ resolver(SolutionCenter.shared.sdkVersion)
53
+ }
54
+
55
+ // MARK: - Static Methods
56
+
57
+ @objc
58
+ static func requiresMainQueueSetup() -> Bool {
59
+ return true
60
+ }
61
+
62
+ // MARK: - Helper Methods
63
+ private func color(from hexString: String) -> UInt32 {
64
+ var colorString = hexString.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
65
+
66
+ if colorString.hasPrefix("#") {
67
+ colorString.remove(at: colorString.startIndex)
68
+ }
69
+
70
+ if colorString.count != 8 { // We expect AARRGGBB
71
+ return 0
72
+ }
73
+
74
+ var rgbValue: UInt64 = 0
75
+ Scanner(string: colorString).scanHexInt64(&rgbValue)
76
+
77
+ return UInt32(rgbValue)
78
+ }
79
+ }
@@ -0,0 +1,21 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ // --- Inlined from types.ts ---
5
+ export type ThemeType = 'LIGHT' | 'DARK' | 'FOLLOW_SYSTEM';
6
+
7
+ export interface EndResult {
8
+ code: string;
9
+ signatureId: string;
10
+ finishRedirectUrl: string;
11
+ }
12
+ // --- End inlined types ---
13
+
14
+ export interface Spec extends TurboModule {
15
+ setThemeARGBColor(light: string, dark: string): Promise<void>;
16
+ setDarkThemeType(type: string): Promise<void>;
17
+ getSDKVersion(): Promise<string>;
18
+ start(url: string): Promise<EndResult>;
19
+ }
20
+
21
+ export default TurboModuleRegistry.get<Spec>('SolutionPlugin');
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ import { Platform } from 'react-native';
4
+ import SolutionPluginSpec from './NativeSolutionPlugin';
5
+ export const ThemeType = {
6
+ LIGHT: 'LIGHT',
7
+ DARK: 'DARK',
8
+ FOLLOW_SYSTEM: 'FOLLOW_SYSTEM'
9
+ };
10
+ const LINKING_ERROR = `The package 'solution-plugin' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
11
+ ios: "- You have run 'pod install'\n",
12
+ default: ''
13
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
14
+ const SolutionPlugin = SolutionPluginSpec ? SolutionPluginSpec : new Proxy({}, {
15
+ get() {
16
+ throw new Error(LINKING_ERROR);
17
+ }
18
+ });
19
+ export function setThemeARGBColor(light, dark) {
20
+ return SolutionPlugin.setThemeARGBColor(light, dark);
21
+ }
22
+ export function setDarkThemeType(type) {
23
+ return SolutionPlugin.setDarkThemeType(type);
24
+ }
25
+ export function getSDKVersion() {
26
+ return SolutionPlugin.getSDKVersion();
27
+ }
28
+ export function getPluginVersion() {
29
+ return Promise.resolve("1.3.0");
30
+ }
31
+ export function start(url) {
32
+ return SolutionPlugin.start(url);
33
+ }
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","SolutionPluginSpec","ThemeType","LIGHT","DARK","FOLLOW_SYSTEM","LINKING_ERROR","select","ios","default","SolutionPlugin","Proxy","get","Error","setThemeARGBColor","light","dark","setDarkThemeType","type","getSDKVersion","getPluginVersion","Promise","resolve","start","url"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,kBAAkB,MAGlB,wBAAwB;AAE/B,OAAO,MAAMC,SAAS,GAAG;EACvBC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,aAAa,EAAE;AACjB,CAAU;AAKV,MAAMC,aAAa,GACjB,0EAA0E,GAC1EN,QAAQ,CAACO,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,cAAc,GAClBT,kBAAkB,GACdA,kBAAkB,GAClB,IAAIU,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CACG;AAET,OAAO,SAASQ,iBAAiBA,CAACC,KAAa,EAAEC,IAAY,EAAiB;EAC5E,OAAON,cAAc,CAACI,iBAAiB,CAACC,KAAK,EAAEC,IAAI,CAAC;AACtD;AAEA,OAAO,SAASC,gBAAgBA,CAACC,IAAe,EAAiB;EAC/D,OAAOR,cAAc,CAACO,gBAAgB,CAACC,IAAI,CAAC;AAC9C;AAEA,OAAO,SAASC,aAAaA,CAAA,EAAoB;EAC/C,OAAOT,cAAc,CAACS,aAAa,CAAC,CAAC;AACvC;AAEA,OAAO,SAASC,gBAAgBA,CAAA,EAAoB;EAClD,OAAOC,OAAO,CAACC,OAAO,CAAC,OAAO,CAAC;AACjC;AAEA,OAAO,SAASC,KAAKA,CAACC,GAAW,EAAsB;EACrD,OAAOd,cAAc,CAACa,KAAK,CAACC,GAAG,CAAC;AAClC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,16 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export type ThemeType = 'LIGHT' | 'DARK' | 'FOLLOW_SYSTEM';
3
+ export interface EndResult {
4
+ code: string;
5
+ signatureId: string;
6
+ finishRedirectUrl: string;
7
+ }
8
+ export interface Spec extends TurboModule {
9
+ setThemeARGBColor(light: string, dark: string): Promise<void>;
10
+ setDarkThemeType(type: string): Promise<void>;
11
+ getSDKVersion(): Promise<string>;
12
+ start(url: string): Promise<EndResult>;
13
+ }
14
+ declare const _default: Spec | null;
15
+ export default _default;
16
+ //# sourceMappingURL=NativeSolutionPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeSolutionPlugin.d.ts","sourceRoot":"","sources":["../../../src/NativeSolutionPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,eAAe,CAAC;AAE3D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAGD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACxC;;AAED,wBAA+D"}
@@ -0,0 +1,14 @@
1
+ import { type EndResult } from './NativeSolutionPlugin';
2
+ export declare const ThemeType: {
3
+ readonly LIGHT: "LIGHT";
4
+ readonly DARK: "DARK";
5
+ readonly FOLLOW_SYSTEM: "FOLLOW_SYSTEM";
6
+ };
7
+ export type ThemeType = (typeof ThemeType)[keyof typeof ThemeType];
8
+ export type { EndResult };
9
+ export declare function setThemeARGBColor(light: string, dark: string): Promise<void>;
10
+ export declare function setDarkThemeType(type: ThemeType): Promise<void>;
11
+ export declare function getSDKVersion(): Promise<string>;
12
+ export declare function getPluginVersion(): Promise<string>;
13
+ export declare function start(url: string): Promise<EndResult>;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAA2B,EACzB,KAAK,SAAS,EAEf,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,SAAS;;;;CAIZ,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,YAAY,EAAE,SAAS,EAAE,CAAC;AAqB1B,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;AAED,wBAAgB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAE/C;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAElD;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAErD"}
package/package.json ADDED
@@ -0,0 +1,166 @@
1
+ {
2
+ "name": "solution-plugin",
3
+ "version": "1.3.0-alpha.1",
4
+ "description": "Guardian Solution SDK React Native plugin.",
5
+ "main": "./lib/module/index.js",
6
+ "source": "src/index.tsx",
7
+ "react-native": "src/index.tsx",
8
+ "types": "./lib/typescript/src/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "source": "./src/index.tsx",
12
+ "types": "./lib/typescript/src/index.d.ts",
13
+ "default": "./lib/module/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "files": [
18
+ "src",
19
+ "lib",
20
+ "android",
21
+ "ios",
22
+ "cpp",
23
+ "*.podspec",
24
+ "react-native.config.js",
25
+ "!ios/build",
26
+ "!android/build",
27
+ "!android/gradle",
28
+ "!android/gradlew",
29
+ "!android/gradlew.bat",
30
+ "!android/local.properties",
31
+ "!**/__tests__",
32
+ "!**/__fixtures__",
33
+ "!**/__mocks__",
34
+ "!**/.*"
35
+ ],
36
+ "scripts": {
37
+ "example": "yarn workspace solution-plugin-example",
38
+ "test": "jest",
39
+ "typecheck": "tsc",
40
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
41
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
42
+ "prepare": "bob build",
43
+ "release": "release-it --only-version"
44
+ },
45
+ "keywords": [
46
+ "react-native",
47
+ "ios",
48
+ "android"
49
+ ],
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "git+https://repo.advai.net/guardian/mobile-center/mobile-plugins/guardian-liveness-detection-react-natiive-plugin.git.git"
53
+ },
54
+ "author": "Advance AI <advance.ai.mobile@gmail.com> (https://www.advance.ai)",
55
+ "license": "MIT",
56
+ "bugs": {
57
+ "url": "https://repo.advai.net/guardian/mobile-center/mobile-plugins/guardian-liveness-detection-react-natiive-plugin.git/issues"
58
+ },
59
+ "homepage": "https://repo.advai.net/guardian/mobile-center/mobile-plugins/guardian-liveness-detection-react-natiive-plugin.git#readme",
60
+ "publishConfig": {
61
+ "registry": "https://registry.npmjs.org/"
62
+ },
63
+ "devDependencies": {
64
+ "@commitlint/config-conventional": "^19.6.0",
65
+ "@eslint/compat": "^1.2.7",
66
+ "@eslint/eslintrc": "^3.3.0",
67
+ "@eslint/js": "^9.22.0",
68
+ "@evilmartians/lefthook": "^1.5.0",
69
+ "@react-native-community/cli": "15.0.0-alpha.2",
70
+ "@react-native/babel-preset": "0.79.2",
71
+ "@react-native/eslint-config": "^0.78.0",
72
+ "@release-it/conventional-changelog": "^9.0.2",
73
+ "@types/jest": "^29.5.5",
74
+ "@types/react": "^19.0.0",
75
+ "commitlint": "^19.6.1",
76
+ "del-cli": "^5.1.0",
77
+ "eslint": "^9.22.0",
78
+ "eslint-config-prettier": "^10.1.1",
79
+ "eslint-plugin-prettier": "^5.2.3",
80
+ "jest": "^29.7.0",
81
+ "prettier": "^3.0.3",
82
+ "react": "19.0.0",
83
+ "react-native": "0.79.2",
84
+ "react-native-builder-bob": "^0.38.4",
85
+ "release-it": "^17.10.0",
86
+ "turbo": "^1.10.7",
87
+ "typescript": "^5.8.3"
88
+ },
89
+ "peerDependencies": {
90
+ "react": "*",
91
+ "react-native": "*"
92
+ },
93
+ "workspaces": [
94
+ "example"
95
+ ],
96
+ "packageManager": "yarn@3.6.1",
97
+ "jest": {
98
+ "preset": "react-native",
99
+ "modulePathIgnorePatterns": [
100
+ "<rootDir>/example/node_modules",
101
+ "<rootDir>/lib/"
102
+ ]
103
+ },
104
+ "commitlint": {
105
+ "extends": [
106
+ "@commitlint/config-conventional"
107
+ ]
108
+ },
109
+ "release-it": {
110
+ "git": {
111
+ "commitMessage": "chore: release ${version}",
112
+ "tagName": "v${version}"
113
+ },
114
+ "npm": {
115
+ "publish": true
116
+ },
117
+ "github": {
118
+ "release": true
119
+ },
120
+ "plugins": {
121
+ "@release-it/conventional-changelog": {
122
+ "preset": {
123
+ "name": "angular"
124
+ }
125
+ }
126
+ }
127
+ },
128
+ "prettier": {
129
+ "quoteProps": "consistent",
130
+ "singleQuote": true,
131
+ "tabWidth": 2,
132
+ "trailingComma": "es5",
133
+ "useTabs": false
134
+ },
135
+ "react-native-builder-bob": {
136
+ "source": "src",
137
+ "output": "lib",
138
+ "targets": [
139
+ [
140
+ "module",
141
+ {
142
+ "esm": true
143
+ }
144
+ ],
145
+ [
146
+ "typescript",
147
+ {
148
+ "project": "tsconfig.build.json"
149
+ }
150
+ ]
151
+ ]
152
+ },
153
+ "codegenConfig": {
154
+ "name": "SolutionPluginSpec",
155
+ "type": "modules",
156
+ "jsSrcsDir": "src",
157
+ "android": {
158
+ "javaPackageName": "com.solutionplugin"
159
+ }
160
+ },
161
+ "create-react-native-library": {
162
+ "languages": "kotlin-objc",
163
+ "type": "turbo-module",
164
+ "version": "0.51.0"
165
+ }
166
+ }
@@ -0,0 +1,21 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ // --- Inlined from types.ts ---
5
+ export type ThemeType = 'LIGHT' | 'DARK' | 'FOLLOW_SYSTEM';
6
+
7
+ export interface EndResult {
8
+ code: string;
9
+ signatureId: string;
10
+ finishRedirectUrl: string;
11
+ }
12
+ // --- End inlined types ---
13
+
14
+ export interface Spec extends TurboModule {
15
+ setThemeARGBColor(light: string, dark: string): Promise<void>;
16
+ setDarkThemeType(type: string): Promise<void>;
17
+ getSDKVersion(): Promise<string>;
18
+ start(url: string): Promise<EndResult>;
19
+ }
20
+
21
+ export default TurboModuleRegistry.get<Spec>('SolutionPlugin');
package/src/index.tsx ADDED
@@ -0,0 +1,53 @@
1
+ import { Platform } from 'react-native';
2
+ import SolutionPluginSpec, {
3
+ type EndResult,
4
+ type Spec,
5
+ } from './NativeSolutionPlugin';
6
+
7
+ export const ThemeType = {
8
+ LIGHT: 'LIGHT',
9
+ DARK: 'DARK',
10
+ FOLLOW_SYSTEM: 'FOLLOW_SYSTEM',
11
+ } as const;
12
+ export type ThemeType = (typeof ThemeType)[keyof typeof ThemeType];
13
+
14
+ export type { EndResult };
15
+
16
+ const LINKING_ERROR =
17
+ `The package 'solution-plugin' doesn't seem to be linked. Make sure: \n\n` +
18
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
19
+ '- You rebuilt the app after installing the package\n' +
20
+ '- You are not using Expo Go\n';
21
+
22
+ const SolutionPlugin = (
23
+ SolutionPluginSpec
24
+ ? SolutionPluginSpec
25
+ : new Proxy(
26
+ {},
27
+ {
28
+ get() {
29
+ throw new Error(LINKING_ERROR);
30
+ },
31
+ }
32
+ )
33
+ ) as Spec;
34
+
35
+ export function setThemeARGBColor(light: string, dark: string): Promise<void> {
36
+ return SolutionPlugin.setThemeARGBColor(light, dark);
37
+ }
38
+
39
+ export function setDarkThemeType(type: ThemeType): Promise<void> {
40
+ return SolutionPlugin.setDarkThemeType(type);
41
+ }
42
+
43
+ export function getSDKVersion(): Promise<string> {
44
+ return SolutionPlugin.getSDKVersion();
45
+ }
46
+
47
+ export function getPluginVersion(): Promise<string> {
48
+ return Promise.resolve("1.3.0");
49
+ }
50
+
51
+ export function start(url: string): Promise<EndResult> {
52
+ return SolutionPlugin.start(url);
53
+ }