@reclaimprotocol/inapp-rn-sdk 0.1.3

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.
Files changed (54) hide show
  1. package/InappRnSdk.podspec +43 -0
  2. package/LICENSE +20 -0
  3. package/README.md +292 -0
  4. package/android/build.gradle +130 -0
  5. package/android/generated/java/com/reclaimprotocol/inapp_rn_sdk/NativeInappRnSdkSpec.java +71 -0
  6. package/android/generated/jni/CMakeLists.txt +36 -0
  7. package/android/generated/jni/RNInappRnSdkSpec-generated.cpp +61 -0
  8. package/android/generated/jni/RNInappRnSdkSpec.h +31 -0
  9. package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI-generated.cpp +56 -0
  10. package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI.h +930 -0
  11. package/android/gradle.properties +5 -0
  12. package/android/src/main/AndroidManifest.xml +3 -0
  13. package/android/src/main/AndroidManifestNew.xml +2 -0
  14. package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/InappRnSdkModule.kt +327 -0
  15. package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/InappRnSdkPackage.kt +33 -0
  16. package/ios/InappRnSdk-Bridging-Header.h +1 -0
  17. package/ios/InappRnSdk.h +17 -0
  18. package/ios/InappRnSdk.mm +215 -0
  19. package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec-generated.mm +136 -0
  20. package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec.h +391 -0
  21. package/ios/generated/RNInappRnSdkSpecJSI-generated.cpp +56 -0
  22. package/ios/generated/RNInappRnSdkSpecJSI.h +930 -0
  23. package/ios/inapp_rn_sdk/Api.swift +405 -0
  24. package/lib/commonjs/ReclaimVerificationPlatformChannel.js +177 -0
  25. package/lib/commonjs/ReclaimVerificationPlatformChannel.js.map +1 -0
  26. package/lib/commonjs/index.js +43 -0
  27. package/lib/commonjs/index.js.map +1 -0
  28. package/lib/commonjs/specs/NativeInappRnSdk.js +23 -0
  29. package/lib/commonjs/specs/NativeInappRnSdk.js.map +1 -0
  30. package/lib/module/ReclaimVerificationPlatformChannel.js +171 -0
  31. package/lib/module/ReclaimVerificationPlatformChannel.js.map +1 -0
  32. package/lib/module/index.js +27 -0
  33. package/lib/module/index.js.map +1 -0
  34. package/lib/module/specs/NativeInappRnSdk.js +24 -0
  35. package/lib/module/specs/NativeInappRnSdk.js.map +1 -0
  36. package/lib/typescript/commonjs/package.json +1 -0
  37. package/lib/typescript/commonjs/src/ReclaimVerificationPlatformChannel.d.ts +80 -0
  38. package/lib/typescript/commonjs/src/ReclaimVerificationPlatformChannel.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/src/index.d.ts +12 -0
  40. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts +281 -0
  42. package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts.map +1 -0
  43. package/lib/typescript/module/package.json +1 -0
  44. package/lib/typescript/module/src/ReclaimVerificationPlatformChannel.d.ts +80 -0
  45. package/lib/typescript/module/src/ReclaimVerificationPlatformChannel.d.ts.map +1 -0
  46. package/lib/typescript/module/src/index.d.ts +12 -0
  47. package/lib/typescript/module/src/index.d.ts.map +1 -0
  48. package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts +281 -0
  49. package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts.map +1 -0
  50. package/package.json +204 -0
  51. package/react-native.config.js +12 -0
  52. package/src/ReclaimVerificationPlatformChannel.ts +245 -0
  53. package/src/index.tsx +32 -0
  54. package/src/specs/NativeInappRnSdk.ts +313 -0
@@ -0,0 +1,43 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "InappRnSdk"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => min_ios_version_supported }
15
+ s.source = { :git => "https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk.git.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
18
+ s.private_header_files = "ios/generated/**/*.h"
19
+ s.dependency "ReclaimInAppSdk"
20
+
21
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
22
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
23
+ if respond_to?(:install_modules_dependencies, true)
24
+ install_modules_dependencies(s)
25
+ else
26
+ s.dependency "React-Core"
27
+
28
+ # Don't install the dependencies when we run `pod install` in the old architecture.
29
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
30
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
31
+ s.pod_target_xcconfig = {
32
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
33
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
34
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
35
+ }
36
+ s.dependency "React-Codegen"
37
+ s.dependency "RCT-Folly"
38
+ s.dependency "RCTRequired"
39
+ s.dependency "RCTTypeSafety"
40
+ s.dependency "ReactCommon/turbomodule/core"
41
+ end
42
+ end
43
+ end
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Reclaim Protocol
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,292 @@
1
+ # Reclaim InApp React Native SDK
2
+
3
+ ## @reclaimprotocol/inapp-rn-sdk
4
+
5
+ This SDK allows you to integrate Reclaim's in-app verification process into your React Native application.
6
+
7
+ ## Prerequisites
8
+
9
+ - A [Reclaim account](https://dev.reclaimprotocol.org/explore) where you've created an app and have the app id, app secret.
10
+ - A provider id that you've added to your app in [Reclaim Devtools](https://dev.reclaimprotocol.org/explore).
11
+
12
+ ## Example
13
+
14
+ - See the [Reclaim Example - React Native](example/README.md) for a complete example of how to use the SDK in a React Native application.
15
+
16
+ ## Installation
17
+
18
+ ```sh
19
+ npm install @reclaimprotocol/inapp-rn-sdk
20
+ ```
21
+
22
+ Note: This package is not published to npm registry. Will be published soon. For now, you can install it from git source.
23
+
24
+ ### Install from git source (alternative)
25
+
26
+ #### NPM
27
+
28
+ ```sh
29
+ npm install git+https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk.git
30
+ ```
31
+
32
+ #### Yarn
33
+
34
+ ```sh
35
+ yarn add git+https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk.git
36
+ ```
37
+
38
+ ## Setup
39
+
40
+ ### Android Setup
41
+
42
+ Add the following to your `android/app/src/main/AndroidManifest.xml` file under the `<application>` tag:
43
+
44
+ ```xml
45
+ <activity
46
+ android:name="org.reclaimprotocol.inapp_sdk.ReclaimActivity"
47
+ android:theme="@style/Theme.ReclaimInAppSdk.LaunchTheme"
48
+ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
49
+ android:hardwareAccelerated="true"
50
+ android:windowSoftInputMode="adjustResize"
51
+ />
52
+ ```
53
+
54
+ add the following to the end of settings.gradle:
55
+
56
+ ```groovy
57
+ dependencyResolutionManagement {
58
+ repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
59
+ String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
60
+ String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.1.2/repo"
61
+ repositories {
62
+ google()
63
+ mavenCentral()
64
+ maven {
65
+ url "$reclaimStorageUrl"
66
+ }
67
+ maven {
68
+ url "$flutterStorageUrl/download.flutter.io"
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ (Ignore if already added in settings.gradle from above)
75
+ or alternatively add the following repositories to the relevant repositories block:
76
+
77
+ ```groovy
78
+ String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
79
+ String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.1.2/repo"
80
+ maven {
81
+ url "$reclaimStorageUrl"
82
+ }
83
+ maven {
84
+ url "$flutterStorageUrl/download.flutter.io"
85
+ }
86
+ ```
87
+
88
+ Some projects may require you to add the repositories to the root `build.gradle` file or your app-level `build.gradle` file's allprojects section.
89
+
90
+ ### iOS Setup
91
+
92
+ 1. Make sure to define a global platform for your project in your `Podfile` with version 13.0 or higher.
93
+
94
+ ```
95
+ platform :ios, '13.0'
96
+ ```
97
+ 2. Add the following to your `Podfile`:
98
+
99
+ - From a specific tag (recommended):
100
+
101
+ ```ruby
102
+ pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.1.2'
103
+ ```
104
+
105
+ - or from git HEAD (Alternative):
106
+
107
+ ```ruby
108
+ pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git'
109
+ ```
110
+
111
+ - or from a specific commit (Alternative):
112
+
113
+ ```ruby
114
+ pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :commit => '184d41628026768feb703dc7bb9a3d913c6b271e'
115
+ ```
116
+
117
+ - or from a specific branch (Alternative):
118
+
119
+ ```ruby
120
+ pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :branch => 'main'
121
+ ```
122
+
123
+ 2. After adding the dependency, your podfile may look like this:
124
+
125
+ ```ruby
126
+ platform :ios, '13.0'
127
+
128
+ # ... some podfile content (removed for brevity)
129
+
130
+ target 'InappRnSdkExample' do
131
+ config = use_native_modules!
132
+
133
+ use_react_native!(
134
+ :path => config[:reactNativePath],
135
+ :app_path => "#{Pod::Config.instance.installation_root}/.."
136
+ )
137
+
138
+ # This is the line you need to add to your podfile.
139
+ pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.1.2'
140
+
141
+ pre_install do |installer|
142
+ system("cd ../../ && npx bob build --target codegen")
143
+ end
144
+
145
+ # ... rest of the podfile. (removed for brevity)
146
+ ```
147
+
148
+ #### Fixing performance issues on IOS physical devices
149
+
150
+ Your app performance will be severely impacted when you run debug executable on a physical device. Fixing this requires a simple change in your Xcode project xcscheme.
151
+
152
+ #### Method 1: Update Environment Variables for XCScheme (Recommended)
153
+ 1. Open your iOS project (*.xcworkspace) in Xcode.
154
+ 2. Click on the project target.
155
+ 3. Click on the **Scheme** dropdown.
156
+
157
+ <img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/83f23570a47828d011b713679852053acdba89c1/Screenshots/Install/10.png?raw=true" alt="Edit current xcscheme in Xcode" width="500">
158
+
159
+ 4. Click on the **Edit Scheme** button.
160
+ 5. Click on the **Run** tab.
161
+ 6. Click on the **Arguments** tab and check the **Environment Variables** section.
162
+
163
+ <img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/83f23570a47828d011b713679852053acdba89c1/Screenshots/Install/12.png?raw=true" alt="Enable Debug executable in Xcode" width="500">
164
+
165
+ 7. Add the following environment variable:
166
+ - Key: `GODEBUG`
167
+ - Value: `asyncpreemptoff=1`
168
+ 8. Click on the **Close** button in the dialog and build the project.
169
+ 9. Run the app on a physical device.
170
+
171
+ #### Method 2: Disable "Debug executable"
172
+
173
+ This method is **not recommended** but could be useful if you don't want to add environment variables to the xcscheme.
174
+
175
+ 1. Open your iOS project (*.xcworkspace) in Xcode.
176
+ 2. Click on the project target.
177
+ 3. Click on the **Scheme** dropdown.
178
+
179
+ <img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/83f23570a47828d011b713679852053acdba89c1/Screenshots/Install/10.png?raw=true" alt="Edit current xcscheme in Xcode" width="500">
180
+
181
+ 4. Click on the **Edit Scheme** button.
182
+ 5. Click on the **Run** tab.
183
+ 6. Uncheck the **Debug executable** checkbox.
184
+
185
+ <img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/83f23570a47828d011b713679852053acdba89c1/Screenshots/Install/11.png?raw=true" alt="Enable Debug executable in Xcode" width="500">
186
+
187
+ ## Usage
188
+
189
+ To use Reclaim InApp Sdk in your project, follow these steps:
190
+
191
+ 1. Import the `@reclaimprotocol/inapp-rn-sdk` package in your project file.
192
+
193
+ ```js
194
+ import { ReclaimVerification } from '@reclaimprotocol/inapp-rn-sdk';
195
+ ```
196
+
197
+ 2. Initialize the `ReclaimVerification` class to create an instance.
198
+
199
+ ```js
200
+ const reclaimVerification = new ReclaimVerification();
201
+ ```
202
+
203
+ 3. Start the verification flow by providing the app id, secret and provider id.
204
+
205
+ ```js
206
+ const verificationResult = await reclaimVerification.startVerification({
207
+ appId: config.REACT_APP_RECLAIM_APP_ID ?? '',
208
+ secret: config.REACT_APP_RECLAIM_APP_SECRET ?? '',
209
+ providerId: providerId,
210
+ });
211
+ ```
212
+
213
+ The returned result is a [ReclaimVerificationApi.Response] object. This object contains a response that has proofs, exception, and the sessionId if the verification is successful.
214
+
215
+ ### Exception Handling
216
+
217
+ If the verification ends with an exception, the exception is thrown as a [ReclaimVerificationApi.ReclaimVerificationException] object.
218
+
219
+ Following is an example of how to handle the exception using [error.type]:
220
+
221
+ ```js
222
+ try {
223
+ // ... start verification
224
+ } catch (error) {
225
+ if (error instanceof ReclaimVerificationApi.ReclaimVerificationException) {
226
+ switch (error.type) {
227
+ case ReclaimVerificationApi.ExceptionType.Cancelled:
228
+ Snackbar.show({
229
+ text: 'Verification cancelled',
230
+ duration: Snackbar.LENGTH_LONG,
231
+ });
232
+ break;
233
+ case ReclaimVerificationApi.ExceptionType.Dismissed:
234
+ Snackbar.show({
235
+ text: 'Verification dismissed',
236
+ duration: Snackbar.LENGTH_LONG,
237
+ });
238
+ break;
239
+ case ReclaimVerificationApi.ExceptionType.SessionExpired:
240
+ Snackbar.show({
241
+ text: 'Verification session expired',
242
+ duration: Snackbar.LENGTH_LONG,
243
+ });
244
+ break;
245
+ case ReclaimVerificationApi.ExceptionType.Failed:
246
+ default:
247
+ Snackbar.show({
248
+ text: 'Verification failed',
249
+ duration: Snackbar.LENGTH_LONG,
250
+ });
251
+ }
252
+ } else {
253
+ Snackbar.show({
254
+ text: error instanceof Error ? error.message : 'An unknown verification error occurred',
255
+ duration: Snackbar.LENGTH_LONG,
256
+ });
257
+ }
258
+ }
259
+ ```
260
+
261
+ This error also contains `sessionId`, `reason`, and `innerError` that can be used to get more details about the occurred error.
262
+
263
+ ```js
264
+ error.sessionId
265
+ error.reason
266
+ error.innerError
267
+ ```
268
+
269
+ ## Advanced Usage
270
+
271
+ ### Overriding SDK Config
272
+
273
+ ```js
274
+ // Advanced Usage: Use ReclaimVerification.setOverrides for overriding sdk
275
+ reclaimVerification.setOverrides({
276
+ appInfo: {
277
+ appName: "Overriden Example",
278
+ appImageUrl: "https://placehold.co/400x400/png"
279
+ }
280
+ // .. other overrides
281
+ })
282
+ ```
283
+
284
+ Note: Overriding again will clear previous overrides
285
+
286
+ ## Contributing
287
+
288
+ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
289
+
290
+ ## License
291
+
292
+ MIT
@@ -0,0 +1,130 @@
1
+ buildscript {
2
+ ext.getExtOrDefault = {name ->
3
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['InappRnSdk_' + name]
4
+ }
5
+ String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
6
+ String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.1.2/repo"
7
+ repositories {
8
+ google()
9
+ mavenCentral()
10
+ maven {
11
+ url "$reclaimStorageUrl"
12
+ }
13
+ maven {
14
+ url "$flutterStorageUrl/download.flutter.io"
15
+ }
16
+ }
17
+
18
+ dependencies {
19
+ classpath "com.android.tools.build:gradle:8.7.2"
20
+ // noinspection DifferentKotlinGradleVersion
21
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
22
+ }
23
+ }
24
+
25
+
26
+ def isNewArchitectureEnabled() {
27
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
28
+ }
29
+
30
+ apply plugin: "com.android.library"
31
+ apply plugin: "kotlin-android"
32
+
33
+ if (isNewArchitectureEnabled()) {
34
+ apply plugin: "com.facebook.react"
35
+ }
36
+
37
+ def getExtOrIntegerDefault(name) {
38
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["InappRnSdk_" + name]).toInteger()
39
+ }
40
+
41
+ def supportsNamespace() {
42
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
43
+ def major = parsed[0].toInteger()
44
+ def minor = parsed[1].toInteger()
45
+
46
+ // Namespace support was added in 7.3.0
47
+ return (major == 7 && minor >= 3) || major >= 8
48
+ }
49
+
50
+ android {
51
+ if (supportsNamespace()) {
52
+ namespace "com.reclaimprotocol.inapp_rn_sdk"
53
+
54
+ sourceSets {
55
+ main {
56
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
57
+ }
58
+ }
59
+ }
60
+
61
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
62
+
63
+ defaultConfig {
64
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
65
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
66
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
67
+ }
68
+
69
+ buildFeatures {
70
+ buildConfig true
71
+ }
72
+
73
+ buildTypes {
74
+ release {
75
+ minifyEnabled false
76
+ }
77
+ }
78
+
79
+ lintOptions {
80
+ disable "GradleCompatible"
81
+ }
82
+
83
+ compileOptions {
84
+ sourceCompatibility JavaVersion.VERSION_1_8
85
+ targetCompatibility JavaVersion.VERSION_1_8
86
+ }
87
+
88
+ sourceSets {
89
+ main {
90
+ if (isNewArchitectureEnabled()) {
91
+ java.srcDirs += [
92
+ "generated/java",
93
+ "generated/jni"
94
+ ]
95
+ }
96
+ }
97
+ }
98
+ }
99
+
100
+ String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
101
+ String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.1.2/repo"
102
+
103
+ repositories {
104
+ mavenCentral()
105
+ google()
106
+ maven {
107
+ url "$reclaimStorageUrl"
108
+ }
109
+ maven {
110
+ url "$flutterStorageUrl/download.flutter.io"
111
+ }
112
+ }
113
+
114
+ def kotlin_version = getExtOrDefault("kotlinVersion")
115
+
116
+ dependencies {
117
+ implementation "com.facebook.react:react-android"
118
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
119
+
120
+ //noinspection UseTomlInstead
121
+ implementation "org.reclaimprotocol:inapp_sdk:0.1.2"
122
+ }
123
+
124
+ if (isNewArchitectureEnabled()) {
125
+ react {
126
+ jsRootDir = file("../src/")
127
+ libraryName = "InappRnSdk"
128
+ codegenJavaPackageName = "com.reclaimprotocol.inapp_rn_sdk"
129
+ }
130
+ }
@@ -0,0 +1,71 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.reclaimprotocol.inapp_rn_sdk;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.Promise;
17
+ import com.facebook.react.bridge.ReactApplicationContext;
18
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
+ import com.facebook.react.bridge.ReactMethod;
20
+ import com.facebook.react.bridge.ReadableMap;
21
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
22
+ import javax.annotation.Nonnull;
23
+
24
+ public abstract class NativeInappRnSdkSpec extends ReactContextBaseJavaModule implements TurboModule {
25
+ public static final String NAME = "InappRnSdk";
26
+
27
+ public NativeInappRnSdkSpec(ReactApplicationContext reactContext) {
28
+ super(reactContext);
29
+ }
30
+
31
+ @Override
32
+ public @Nonnull String getName() {
33
+ return NAME;
34
+ }
35
+
36
+ protected final void emitOnLogs(String value) {
37
+ mEventEmitterCallback.invoke("onLogs", value);
38
+ }
39
+
40
+ protected final void emitOnSessionLogs(ReadableMap value) {
41
+ mEventEmitterCallback.invoke("onSessionLogs", value);
42
+ }
43
+
44
+ protected final void emitOnSessionCreateRequest(ReadableMap value) {
45
+ mEventEmitterCallback.invoke("onSessionCreateRequest", value);
46
+ }
47
+
48
+ protected final void emitOnSessionUpdateRequest(ReadableMap value) {
49
+ mEventEmitterCallback.invoke("onSessionUpdateRequest", value);
50
+ }
51
+
52
+ @ReactMethod
53
+ @DoNotStrip
54
+ public abstract void startVerification(ReadableMap request, Promise promise);
55
+
56
+ @ReactMethod
57
+ @DoNotStrip
58
+ public abstract void startVerificationFromUrl(String requestUrl, Promise promise);
59
+
60
+ @ReactMethod
61
+ @DoNotStrip
62
+ public abstract void setOverrides(ReadableMap overrides, Promise promise);
63
+
64
+ @ReactMethod
65
+ @DoNotStrip
66
+ public abstract void reply(String replyId, boolean reply);
67
+
68
+ @ReactMethod
69
+ @DoNotStrip
70
+ public abstract void ping(Promise promise);
71
+ }
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNInappRnSdkSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RNInappRnSdkSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RNInappRnSdkSpec PUBLIC . react/renderer/components/RNInappRnSdkSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RNInappRnSdkSpec
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_options(
29
+ react_codegen_RNInappRnSdkSpec
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,61 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "RNInappRnSdkSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_startVerification(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
+ static jmethodID cachedMethodId = nullptr;
17
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "startVerification", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_startVerificationFromUrl(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "startVerificationFromUrl", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_setOverrides(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
26
+ static jmethodID cachedMethodId = nullptr;
27
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setOverrides", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
28
+ }
29
+
30
+ static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_reply(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
31
+ static jmethodID cachedMethodId = nullptr;
32
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "reply", "(Ljava/lang/String;Z)V", args, count, cachedMethodId);
33
+ }
34
+
35
+ static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_ping(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
36
+ static jmethodID cachedMethodId = nullptr;
37
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "ping", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
38
+ }
39
+
40
+ NativeInappRnSdkSpecJSI::NativeInappRnSdkSpecJSI(const JavaTurboModule::InitParams &params)
41
+ : JavaTurboModule(params) {
42
+ methodMap_["startVerification"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_startVerification};
43
+ methodMap_["startVerificationFromUrl"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_startVerificationFromUrl};
44
+ methodMap_["setOverrides"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_setOverrides};
45
+ methodMap_["reply"] = MethodMetadata {2, __hostFunction_NativeInappRnSdkSpecJSI_reply};
46
+ methodMap_["ping"] = MethodMetadata {0, __hostFunction_NativeInappRnSdkSpecJSI_ping};
47
+ eventEmitterMap_["onLogs"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
48
+ eventEmitterMap_["onSessionLogs"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
49
+ eventEmitterMap_["onSessionCreateRequest"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
50
+ eventEmitterMap_["onSessionUpdateRequest"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
51
+ setEventEmitterCallback(params.instance);
52
+ }
53
+
54
+ std::shared_ptr<TurboModule> RNInappRnSdkSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
55
+ if (moduleName == "InappRnSdk") {
56
+ return std::make_shared<NativeInappRnSdkSpecJSI>(params);
57
+ }
58
+ return nullptr;
59
+ }
60
+
61
+ } // namespace facebook::react
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ /**
20
+ * JNI C++ class for module 'NativeInappRnSdk'
21
+ */
22
+ class JSI_EXPORT NativeInappRnSdkSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeInappRnSdkSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> RNInappRnSdkSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react