solution-plugin 1.3.1 → 1.4.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.
@@ -1,103 +1,67 @@
1
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/'
2
+ ext {
3
+ kotlin_version = "1.8.0"
4
+ }
5
+ repositories {
6
+ google()
7
+ mavenCentral()
8
+ }
9
+ dependencies {
10
+ classpath "com.android.tools.build:gradle:7.3.1"
11
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12
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
13
  }
33
14
 
15
+ apply plugin: 'com.android.library'
16
+ apply plugin: 'kotlin-android'
17
+ apply plugin: 'com.facebook.react'
34
18
 
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()
19
+ def safeExtGet(prop, fallback) {
20
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
42
21
  }
43
22
 
44
23
  android {
45
- namespace "com.solutionplugin"
24
+ compileSdkVersion safeExtGet('compileSdkVersion', 33)
25
+ namespace "com.solutionplugin"
46
26
 
47
- compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
48
-
49
- defaultConfig {
50
- minSdkVersion getExtOrIntegerDefault("minSdkVersion")
51
- targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
52
- }
53
-
54
- buildFeatures {
55
- buildConfig true
56
- }
27
+ defaultConfig {
28
+ minSdkVersion 21
29
+ targetSdkVersion safeExtGet('targetSdkVersion', 33)
30
+ }
57
31
 
58
- buildTypes {
59
- release {
60
- minifyEnabled false
32
+ buildTypes {
33
+ release {
34
+ minifyEnabled false
35
+ }
61
36
  }
62
- }
63
37
 
64
- lintOptions {
65
- disable "GradleCompatible"
66
- }
38
+ lintOptions {
39
+ disable 'GradleCompatible'
40
+ }
67
41
 
68
- compileOptions {
69
- sourceCompatibility JavaVersion.VERSION_1_8
70
- targetCompatibility JavaVersion.VERSION_1_8
71
- }
42
+ compileOptions {
43
+ sourceCompatibility JavaVersion.VERSION_17
44
+ targetCompatibility JavaVersion.VERSION_17
45
+ }
72
46
 
73
- sourceSets {
74
- main {
75
- java.srcDirs += [
76
- "generated/java",
77
- "generated/jni"
78
- ]
47
+ kotlinOptions {
48
+ jvmTarget = '17'
79
49
  }
80
- }
81
50
  }
82
51
 
83
- repositories {
84
- mavenCentral()
85
- google()
86
- maven {
87
- url 'https://public-n3.advai.net/repository/maven-releases/'
88
- }
52
+ react {
53
+ jsRootDir = file("../src/")
54
+ libraryName = "SolutionPlugin"
55
+ codegenJavaPackageName = "com.solutionplugin"
89
56
  }
90
57
 
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"
58
+ repositories {
59
+ mavenCentral()
60
+ google()
97
61
  }
98
62
 
99
- react {
100
- jsRootDir = file("../src/")
101
- libraryName = "SolutionPlugin"
102
- codegenJavaPackageName = "com.livenessplugin"
63
+ dependencies {
64
+ implementation 'com.facebook.react:react-native:+'
65
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
66
+ implementation "ai.advance.mobile-sdk.android:solution-lib:1.4.0"
103
67
  }
@@ -36,34 +36,43 @@ class SolutionPluginModule(private val reactContext: ReactApplicationContext) :
36
36
  }
37
37
 
38
38
  @ReactMethod
39
- override fun setDarkThemeType(type: String?, promise: Promise?) {
39
+ override fun setDarkThemeType(type: String?, promise: Promise) {
40
40
  try {
41
41
  val themeType = ThemeType.valueOf(type ?: ThemeType.LIGHT.name)
42
42
  GuardianSolutionSDK.setThemeType(themeType)
43
43
  } catch (e: Exception) {
44
- promise?.reject("SET_DARK_THEME_TYPE_ERROR", e.message, e)
44
+ promise.reject("SET_DARK_THEME_TYPE_ERROR", e.message, e)
45
45
  }
46
46
  }
47
47
 
48
- override fun getSDKVersion(promise: Promise?) {
48
+ @ReactMethod
49
+ override fun getSDKVersion(promise: Promise) {
49
50
  Log.d("SolutionPluginModule", "getVersion")
50
51
  try {
51
52
  val version = GuardianSolutionSDK.getSDKVersion()
52
- promise?.resolve(version)
53
+ promise.resolve(version)
53
54
  } catch (e: Exception) {
54
- promise?.reject("GET_VERSION_ERROR", e.message, e)
55
+ promise.reject("GET_VERSION_ERROR", e.message, e)
55
56
  }
56
57
  }
57
58
 
58
- override fun start(url: String?, promise: Promise?) {
59
+ @ReactMethod
60
+ override fun start(url: String?, promise: Promise) {
59
61
  GuardianSolutionSDK.init(application)
60
62
  GuardianSolutionSDK.setPluginPlatform(PluginPlatform.ReactNative)
61
- GuardianSolutionSDK.start(currentActivity, url) { result ->
62
- promise?.resolve(
63
+ GuardianSolutionSDK.start(getCurrentActivity(), url) { result ->
64
+ promise.resolve(
63
65
  Arguments.createMap().apply {
64
66
  putString("code", result.code)
65
67
  putString("signatureId", result.signatureId)
66
68
  putString("finishRedirectUrl", result.finishRedirectUrl)
69
+ if (result.extraInfo != null) {
70
+ val extraInfoMap = Arguments.createMap()
71
+ for ((key, value) in result.extraInfo) {
72
+ extraInfoMap.putString(key, value as? String ?: "")
73
+ }
74
+ putMap("extraInfo", extraInfoMap)
75
+ }
67
76
  })
68
77
  }
69
78
  }
@@ -15,7 +15,7 @@ RCT_EXTERN_METHOD(start:(nonnull NSString *)url
15
15
  resolver:(RCTPromiseResolveBlock)resolve
16
16
  rejecter:(RCTPromiseRejectBlock)reject)
17
17
 
18
- RCT_EXTERN_METHOD(getSDKVersion:(RCTPromiseResolveBlock)resolve
18
+ RCT_EXTERN_METHOD(getVersion:(RCTPromiseResolveBlock)resolve
19
19
  rejecter:(RCTPromiseRejectBlock)reject)
20
20
 
21
21
  @end
@@ -29,25 +29,25 @@ class SolutionPlugin: NSObject {
29
29
  @objc
30
30
  func start(_ url: String, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
31
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)
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
+ resultDict["extraInfo"] = result.extraInfo
40
+ resolver(resultDict)
41
+ }))
42
+ SolutionCenter.shared.pluginPlatform = "react-native"
43
+ SolutionCenter.shared.start(with: url)
44
44
  }
45
45
  }
46
46
 
47
47
  // MARK: - Legacy Methods
48
48
 
49
49
  @objc
50
- func getSDKVersion(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
50
+ func getVersion(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
51
51
 
52
52
  resolver(SolutionCenter.shared.sdkVersion)
53
53
  }
@@ -1,21 +1,24 @@
1
1
  import type { TurboModule } from 'react-native';
2
2
  import { TurboModuleRegistry } from 'react-native';
3
3
 
4
- // --- Inlined from types.ts ---
5
- export type ThemeType = 'LIGHT' | 'DARK' | 'FOLLOW_SYSTEM';
4
+ export enum ThemeType {
5
+ LIGHT = 'LIGHT',
6
+ DARK = 'DARK',
7
+ FOLLOW_SYSTEM = 'FOLLOW_SYSTEM',
8
+ }
6
9
 
7
10
  export interface EndResult {
8
11
  code: string;
9
- signatureId: string;
10
- finishRedirectUrl: string;
12
+ signatureId?: string;
13
+ finishRedirectUrl?: string;
14
+ extraInfo?: { [key: string]: string };
11
15
  }
12
- // --- End inlined types ---
13
16
 
14
17
  export interface Spec extends TurboModule {
15
18
  setThemeARGBColor(light: string, dark: string): Promise<void>;
16
- setDarkThemeType(type: string): Promise<void>;
19
+ setDarkThemeType(type: ThemeType): Promise<void>;
17
20
  getSDKVersion(): Promise<string>;
18
21
  start(url: string): Promise<EndResult>;
19
22
  }
20
23
 
21
- export default TurboModuleRegistry.get<Spec>('SolutionPlugin');
24
+ export default TurboModuleRegistry.getEnforcing<Spec>('SolutionPlugin');
@@ -1,34 +1,24 @@
1
1
  "use strict";
2
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
- });
3
+ // We re-export all named exports from the native spec, which includes the ThemeType object and types.
4
+ export * from './NativeSolutionPlugin';
5
+ // We still need to import the types for use within this file's function signatures.
6
+
7
+ import NativeSolutionPlugin from './NativeSolutionPlugin';
19
8
  export function setThemeARGBColor(light, dark) {
20
- return SolutionPlugin.setThemeARGBColor(light, dark);
9
+ return NativeSolutionPlugin?.setThemeARGBColor(light, dark) ?? Promise.reject(new Error('SolutionPlugin not available'));
21
10
  }
22
11
  export function setDarkThemeType(type) {
23
- return SolutionPlugin.setDarkThemeType(type);
12
+ return NativeSolutionPlugin?.setDarkThemeType(type) ?? Promise.reject(new Error('SolutionPlugin not available'));
24
13
  }
25
- export function getSDKVersion() {
26
- return SolutionPlugin.getSDKVersion();
14
+ export function getSolutionVersion() {
15
+ return NativeSolutionPlugin?.getSDKVersion() ?? Promise.reject(new Error('SolutionPlugin not available'));
27
16
  }
28
17
  export function getPluginVersion() {
29
- return Promise.resolve("1.3.0");
18
+ // This is a hardcoded value. Remember to update it manually on release.
19
+ return Promise.resolve("1.4.0.deta");
30
20
  }
31
21
  export function start(url) {
32
- return SolutionPlugin.start(url);
22
+ return NativeSolutionPlugin?.start(url) ?? Promise.reject(new Error('SolutionPlugin not available'));
33
23
  }
34
24
  //# sourceMappingURL=index.js.map
@@ -1 +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":[]}
1
+ {"version":3,"names":["NativeSolutionPlugin","setThemeARGBColor","light","dark","Promise","reject","Error","setDarkThemeType","type","getSolutionVersion","getSDKVersion","getPluginVersion","resolve","start","url"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA,cAAc,wBAAwB;AACtC;;AAGA,OAAOA,oBAAoB,MAAM,wBAAwB;AAEzD,OAAO,SAASC,iBAAiBA,CAACC,KAAa,EAAEC,IAAY,EAAiB;EAC5E,OAAOH,oBAAoB,EAAEC,iBAAiB,CAACC,KAAK,EAAEC,IAAI,CAAC,IAAIC,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAC1H;AAEA,OAAO,SAASC,gBAAgBA,CAACC,IAAe,EAAiB;EAC/D,OAAOR,oBAAoB,EAAEO,gBAAgB,CAACC,IAAI,CAAC,IAAIJ,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAClH;AAEA,OAAO,SAASG,kBAAkBA,CAAA,EAAoB;EACpD,OAAOT,oBAAoB,EAAEU,aAAa,CAAC,CAAC,IAAIN,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAC3G;AAEA,OAAO,SAASK,gBAAgBA,CAAA,EAAoB;EAClD;EACA,OAAOP,OAAO,CAACQ,OAAO,CAAC,YAAY,CAAC;AACtC;AAEA,OAAO,SAASC,KAAKA,CAACC,GAAW,EAAsB;EACrD,OAAOd,oBAAoB,EAAEa,KAAK,CAACC,GAAG,CAAC,IAAIV,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AACtG","ignoreList":[]}
@@ -1,16 +1,23 @@
1
1
  import type { TurboModule } from 'react-native';
2
- export type ThemeType = 'LIGHT' | 'DARK' | 'FOLLOW_SYSTEM';
2
+ export declare enum ThemeType {
3
+ LIGHT = "LIGHT",
4
+ DARK = "DARK",
5
+ FOLLOW_SYSTEM = "FOLLOW_SYSTEM"
6
+ }
3
7
  export interface EndResult {
4
8
  code: string;
5
- signatureId: string;
6
- finishRedirectUrl: string;
9
+ signatureId?: string;
10
+ finishRedirectUrl?: string;
11
+ extraInfo?: {
12
+ [key: string]: string;
13
+ };
7
14
  }
8
15
  export interface Spec extends TurboModule {
9
16
  setThemeARGBColor(light: string, dark: string): Promise<void>;
10
- setDarkThemeType(type: string): Promise<void>;
17
+ setDarkThemeType(type: ThemeType): Promise<void>;
11
18
  getSDKVersion(): Promise<string>;
12
19
  start(url: string): Promise<EndResult>;
13
20
  }
14
- declare const _default: Spec | null;
21
+ declare const _default: Spec;
15
22
  export default _default;
16
23
  //# sourceMappingURL=NativeSolutionPlugin.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"NativeSolutionPlugin.d.ts","sourceRoot":"","sources":["../../../src/NativeSolutionPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,aAAa,kBAAkB;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACvC;AAED,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,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACxC;;AAED,wBAAwE"}
@@ -1,14 +1,9 @@
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 };
1
+ export * from './NativeSolutionPlugin';
2
+ import type { EndResult } from './NativeSolutionPlugin';
3
+ import { ThemeType } from './NativeSolutionPlugin';
9
4
  export declare function setThemeARGBColor(light: string, dark: string): Promise<void>;
10
5
  export declare function setDarkThemeType(type: ThemeType): Promise<void>;
11
- export declare function getSDKVersion(): Promise<string>;
6
+ export declare function getSolutionVersion(): Promise<string>;
12
7
  export declare function getPluginVersion(): Promise<string>;
13
8
  export declare function start(url: string): Promise<EndResult>;
14
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,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,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEpD;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAGlD;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAErD"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "solution-plugin",
3
- "version": "1.3.1",
4
- "description": "Guardian Solution SDK React Native plugin.",
3
+ "version": "1.4.0",
4
+ "description": "A plugin to add two numbers using native code.",
5
5
  "main": "./lib/module/index.js",
6
6
  "source": "src/index.tsx",
7
7
  "react-native": "src/index.tsx",
8
- "types": "./lib/typescript/src/index.d.ts",
8
+ "types": "lib/typescript/src/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "source": "./src/index.tsx",
@@ -47,16 +47,13 @@
47
47
  "ios",
48
48
  "android"
49
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)",
50
+ "repository": "https://github.com/your-repo/solution-plugin",
51
+ "author": "Your Name",
55
52
  "license": "MIT",
56
53
  "bugs": {
57
- "url": "https://repo.advai.net/guardian/mobile-center/mobile-plugins/guardian-liveness-detection-react-natiive-plugin.git/issues"
54
+ "url": "https://github.com/your-repo/solution-plugin/issues"
58
55
  },
59
- "homepage": "https://repo.advai.net/guardian/mobile-center/mobile-plugins/guardian-liveness-detection-react-natiive-plugin.git#readme",
56
+ "homepage": "https://github.com/your-repo/solution-plugin#readme",
60
57
  "publishConfig": {
61
58
  "registry": "https://registry.npmjs.org/"
62
59
  },
@@ -0,0 +1,19 @@
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 = "solution-plugin"
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
+ s.platforms = { :ios => "11.0" }
13
+ s.source = { :git => "https://github.com/your-repo/solution-plugin.git", :tag => "#{s.version}" }
14
+
15
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
16
+ s.dependency "SolutionH5"
17
+ s.dependency "AAICore"
18
+ s.dependency "React-Core"
19
+ end
@@ -1,21 +1,24 @@
1
1
  import type { TurboModule } from 'react-native';
2
2
  import { TurboModuleRegistry } from 'react-native';
3
3
 
4
- // --- Inlined from types.ts ---
5
- export type ThemeType = 'LIGHT' | 'DARK' | 'FOLLOW_SYSTEM';
4
+ export enum ThemeType {
5
+ LIGHT = 'LIGHT',
6
+ DARK = 'DARK',
7
+ FOLLOW_SYSTEM = 'FOLLOW_SYSTEM',
8
+ }
6
9
 
7
10
  export interface EndResult {
8
11
  code: string;
9
- signatureId: string;
10
- finishRedirectUrl: string;
12
+ signatureId?: string;
13
+ finishRedirectUrl?: string;
14
+ extraInfo?: { [key: string]: string };
11
15
  }
12
- // --- End inlined types ---
13
16
 
14
17
  export interface Spec extends TurboModule {
15
18
  setThemeARGBColor(light: string, dark: string): Promise<void>;
16
- setDarkThemeType(type: string): Promise<void>;
19
+ setDarkThemeType(type: ThemeType): Promise<void>;
17
20
  getSDKVersion(): Promise<string>;
18
21
  start(url: string): Promise<EndResult>;
19
22
  }
20
23
 
21
- export default TurboModuleRegistry.get<Spec>('SolutionPlugin');
24
+ export default TurboModuleRegistry.getEnforcing<Spec>('SolutionPlugin');
package/src/index.tsx CHANGED
@@ -1,53 +1,27 @@
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;
1
+ // We re-export all named exports from the native spec, which includes the ThemeType object and types.
2
+ export * from './NativeSolutionPlugin';
3
+ // We still need to import the types for use within this file's function signatures.
4
+ import type { EndResult } from './NativeSolutionPlugin';
5
+ import { ThemeType } from './NativeSolutionPlugin';
6
+ import NativeSolutionPlugin from './NativeSolutionPlugin';
34
7
 
35
8
  export function setThemeARGBColor(light: string, dark: string): Promise<void> {
36
- return SolutionPlugin.setThemeARGBColor(light, dark);
9
+ return NativeSolutionPlugin?.setThemeARGBColor(light, dark) ?? Promise.reject(new Error('SolutionPlugin not available'));
37
10
  }
38
11
 
39
12
  export function setDarkThemeType(type: ThemeType): Promise<void> {
40
- return SolutionPlugin.setDarkThemeType(type);
13
+ return NativeSolutionPlugin?.setDarkThemeType(type) ?? Promise.reject(new Error('SolutionPlugin not available'));
41
14
  }
42
15
 
43
- export function getSDKVersion(): Promise<string> {
44
- return SolutionPlugin.getSDKVersion();
16
+ export function getSolutionVersion(): Promise<string> {
17
+ return NativeSolutionPlugin?.getSDKVersion() ?? Promise.reject(new Error('SolutionPlugin not available'));
45
18
  }
46
19
 
47
20
  export function getPluginVersion(): Promise<string> {
48
- return Promise.resolve("1.3.0");
21
+ // This is a hardcoded value. Remember to update it manually on release.
22
+ return Promise.resolve("1.4.0.deta");
49
23
  }
50
24
 
51
25
  export function start(url: string): Promise<EndResult> {
52
- return SolutionPlugin.start(url);
26
+ return NativeSolutionPlugin?.start(url) ?? Promise.reject(new Error('SolutionPlugin not available'));
53
27
  }
package/LICENSE DELETED
@@ -1,20 +0,0 @@
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 DELETED
@@ -1,52 +0,0 @@
1
- # liveness-plugin
2
-
3
- Guardian Solution SDK React Native plugin.
4
-
5
- ## Installation
6
-
7
- ```sh
8
- npm install solution-plugin
9
- ```
10
-
11
- ## Usage
12
-
13
- ```js
14
- import {
15
- getSDKVersion,
16
- setThemeARGBColor,
17
- setDarkThemeType,
18
- start,
19
- type EndResult,
20
- ThemeType,
21
- } from 'solution-plugin';
22
-
23
- // ...
24
-
25
- // Get the SDK version
26
- const version = await getSDKVersion();
27
-
28
- // Sets the appearance mode.
29
- // Options: LIGHT, DARK, FOLLOW_SYSTEM. Default: LIGHT.
30
- setDarkThemeType(ThemeType.FOLLOW_SYSTEM);
31
-
32
- // Sets the loading color of the page for both light and dark appearance modes.The provided color value must be in ARGB or RGB format.
33
- // This can be specified as an ARGB hex string:
34
- setThemeARGBColor('#FF000000', '#FFFFFFFF');
35
-
36
- // Starts the Solution flow. Call the start method, pass a url parameter, and receive an asynchronous return value.
37
- const result = (await start('Your own url',)) as EndResult;
38
- console.log('Solution result:', result);
39
- ```
40
-
41
-
42
- ## Contributing
43
-
44
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
45
-
46
- ## License
47
-
48
- MIT
49
-
50
- ---
51
-
52
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -1,27 +0,0 @@
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