@reclaimprotocol/inapp-rn-sdk 0.9.4-alpha.4 → 0.10.2

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.
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
 
18
18
  s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
19
19
  s.private_header_files = "ios/generated/**/*.h"
20
- s.dependency "ReclaimInAppSdk", "~> 0.9.2"
20
+ s.dependency "ReclaimInAppSdk", "~> 0.10.2"
21
21
 
22
22
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
23
23
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
package/README.md CHANGED
@@ -18,255 +18,17 @@ This SDK allows you to integrate Reclaim's in-app verification process into your
18
18
  ## Example
19
19
 
20
20
  - See the [Reclaim Example - React Native](samples/example_new_arch/README.md) for a complete example of how to use the SDK in a React Native application.
21
+ - See the [Reclaim Example - React Native Expo](samples/example_expo/README.md) for a complete example of how to use the SDK in a React Native Expo application.
21
22
 
22
23
  ## Installation
23
24
 
24
- ```sh
25
- npm install @reclaimprotocol/inapp-rn-sdk
26
- ```
27
-
28
- Or if you're using Expo, use:
29
-
30
- ```sh
31
- npx expo install @reclaimprotocol/inapp-rn-sdk
32
- ```
33
-
34
- ### Alternative: Install from git source
35
-
36
- #### NPM
37
-
38
- ```sh
39
- npm install git+https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk.git
40
- ```
41
-
42
- #### Yarn
43
-
44
- ```sh
45
- yarn add git+https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk.git
46
- ```
47
-
48
- ## Setup
49
-
50
- ### Expo Only Setup
51
-
52
- Expo users can skip the native configuration changes by adding the Reclaim InApp Config Plugin. To do so merge the following code to the plugins section of your `app.json`, `app.config.js`, or `app.config.ts` file:
53
-
54
- ```diff
55
- {
56
- // .. other plugin options (removed for brevity)
57
- "plugins": [
58
- "expo-router",
59
- // Add the following in the plugins section:
60
- + "@reclaimprotocol/inapp-rn-sdk",
61
- [
62
- "expo-splash-screen",
63
- {
64
- "image": "./assets/images/splash-icon.png",
65
- "imageWidth": 200,
66
- "resizeMode": "contain",
67
- "backgroundColor": "#ffffff"
68
- }
69
- ]
70
- // ... other plugins (removed for brevity)
71
- ],
72
- // .. other options (removed for brevity)
73
- }
74
- ```
75
-
76
- Note: This module contains custom native code which is NOT supported by Expo Go
77
-
78
- If you're using Expo without EAS, run the following commands:
79
-
80
- ```
81
- # For iOS
82
- npx expo prebuild
83
- npx expo run:ios
84
-
85
- # For Android
86
- npx expo prebuild
87
- npx expo run:android
88
- ```
89
-
90
- If you're using Expo with EAS, create a new build:
91
-
92
- ```
93
- # For online builds
94
- npx eas-cli build --profile development
95
-
96
- # For local builds
97
- npx eas-cli build --profile development --local
98
- ```
99
-
100
- Follow [the fixing ios performance issues guide](#fixing-performance-issues-on-ios-physical-devices) to fix slow proof generation on iOS physicial devices.
101
-
102
- Now your expo project is ready to use. [You can follow the usage section for more](#usage).
103
-
104
- ### Android Setup
105
-
106
- Add the following to your `android/app/src/main/AndroidManifest.xml` file under the `<application>` tag:
107
-
108
- ```xml
109
- <activity
110
- android:name="org.reclaimprotocol.inapp_sdk.ReclaimActivity"
111
- android:theme="@style/Theme.ReclaimInAppSdk.LaunchTheme"
112
- android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
113
- android:hardwareAccelerated="true"
114
- android:windowSoftInputMode="adjustResize"
115
- />
116
- ```
117
-
118
- add the following to the end of settings.gradle:
119
-
120
- ```groovy
121
- dependencyResolutionManagement {
122
- repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
123
- String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
124
- String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/repo"
125
- repositories {
126
- google()
127
- mavenCentral()
128
- maven {
129
- url "$reclaimStorageUrl"
130
- }
131
- maven {
132
- url "$flutterStorageUrl/download.flutter.io"
133
- }
134
- }
135
- }
136
- ```
137
-
138
- (Ignore if already added in settings.gradle from above)
139
- or alternatively add the following repositories to the relevant repositories block:
140
-
141
- ```groovy
142
- String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
143
- String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/repo"
144
- maven {
145
- url "$reclaimStorageUrl"
146
- }
147
- maven {
148
- url "$flutterStorageUrl/download.flutter.io"
149
- }
150
- ```
151
-
152
- 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.
153
-
154
- ### iOS Setup
155
-
156
- 1. Make sure to define a global platform for your project in your `Podfile` with version 13.0 or higher.
157
-
158
- ```
159
- platform :ios, '13.0' # or platform :ios, min_ios_version_supported
160
- ```
161
-
162
- Ignore if you already have this declaration in your `Podfile`.
25
+ Choose the appropriate installation guide based on your project setup:
163
26
 
164
- 2. Add the following to your `Podfile` to override SDK dependency:
27
+ **For React Native projects without Expo:**
28
+ 📖 [Installation Guide for React Native (No Framework)](documentation/install-no-framework.md)
165
29
 
166
- - You can override the version of dependency when you wish to use a specific version of the SDK.
167
- - You can add a declaration in your `Podfile` to install the SDK from cocoapods, or from a specific git tag, head, commit, or branch.
168
-
169
- ##### From cocoapods (recommended)
170
-
171
- ```ruby
172
- # Cocoapods is the recommended way to install the SDK.
173
- pod 'ReclaimInAppSdk', '~> 0.9.2'
174
- ```
175
-
176
- ##### From a specific tag
177
-
178
- ```ruby
179
- pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.9.2'
180
- ```
181
-
182
- ##### From git HEAD
183
-
184
- ```ruby
185
- pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git'
186
- ```
187
-
188
- ##### From a specific commit
189
-
190
- ```ruby
191
- pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :commit => 'eeb5a5484a5927217065e5c988fab8201cb2db2e'
192
- ```
193
-
194
- ##### From a specific branch
195
-
196
- ```ruby
197
- pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :branch => 'main'
198
- ```
199
-
200
- - After adding the dependency, your podfile may look like this:
201
-
202
- ```ruby
203
- platform :ios, '13.0'
204
-
205
- # ... some podfile content (removed for brevity)
206
-
207
- target 'InappRnSdkExample' do
208
- config = use_native_modules!
209
-
210
- use_react_native!(
211
- :path => config[:reactNativePath],
212
- :app_path => "#{Pod::Config.instance.installation_root}/.."
213
- )
214
-
215
- # This is the line that you may need to add in your podfile.
216
- pod 'ReclaimInAppSdk', '~> 0.9.2'
217
-
218
- pre_install do |installer|
219
- system("cd ../../ && npx bob build --target codegen")
220
- end
221
-
222
- # ... rest of the podfile. (removed for brevity)
223
- ```
224
-
225
- 3. Run `pod install` inside the `ios/` directory of your project.
226
-
227
- ```sh
228
- cd ios/
229
- pod install
230
- ```
231
-
232
- #### Fixing performance issues on IOS physical devices
233
-
234
- 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.
235
-
236
- ##### Method 1: Update Environment Variables for XCScheme (Recommended)
237
- 1. Open your iOS project (*.xcworkspace) in Xcode.
238
- 2. Click on the project target.
239
- 3. Click on the **Scheme** dropdown.
240
-
241
- <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">
242
-
243
- 4. Click on the **Edit Scheme** button.
244
- 5. Click on the **Run** tab.
245
- 6. Click on the **Arguments** tab and check the **Environment Variables** section.
246
-
247
- <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">
248
-
249
- 7. Add the following environment variable:
250
- - Key: `GODEBUG`
251
- - Value: `asyncpreemptoff=1`
252
- 8. Click on the **Close** button in the dialog and build the project.
253
- 9. Run the app on a physical device.
254
-
255
- ##### Method 2: Disable "Debug executable"
256
-
257
- This method is **not recommended** but could be useful if you don't want to add environment variables to the xcscheme.
258
-
259
- 1. Open your iOS project (*.xcworkspace) in Xcode.
260
- 2. Click on the project target.
261
- 3. Click on the **Scheme** dropdown.
262
-
263
- <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">
264
-
265
- 4. Click on the **Edit Scheme** button.
266
- 5. Click on the **Run** tab.
267
- 6. Uncheck the **Debug executable** checkbox.
268
-
269
- <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">
30
+ **For React Native Expo projects:**
31
+ 📖 [Installation Guide for React Native Expo](documentation/install-expo.md)
270
32
 
271
33
  ## Usage
272
34
 
@@ -352,12 +114,31 @@ error.innerError
352
114
 
353
115
  ## Troubleshooting
354
116
 
117
+ ### Compatibility Notice: expo-dev-client on iOS
118
+
119
+ Please be aware of a known incompatibility between ReclaimInAppSdk and the [`expo-dev-client`](https://www.npmjs.com/package/expo-dev-client) package on the iOS platform.
120
+
121
+ When both packages are present in your iOS application, critical network requests from ReclaimInAppSdk may fail with a request timeout error (i.e `Http failed. Checking if we can retry..\nNSErrorClientException: The request timed out.`).
122
+
123
+ Our team is investigating this issue to find a solution. In the meantime, we recommend temporarily removing expo-dev-client from your project when you need to test or use ReclaimInAppSdk functionality on iOS.
124
+
125
+ ### iOS build issues
126
+
127
+ Incase you get errors which say `CocoaPods could not find compatible versions for pod "ReclaimInAppSdk"`, run the following in your project's `ios/` directory:
128
+
129
+ ```sh
130
+ bundle exec pod update ReclaimInAppSdk
131
+ # or
132
+ pod update ReclaimInAppSdk
133
+ ```
134
+
355
135
  ### Build failures for iOS in 0.7.x
356
136
 
357
137
  - An accidental breaking change may cause 0.7.0, 0.7.1, 0.7.2 to fail with build failures for Android and iOS. Update 0.7.3 fixes this issue.
358
138
 
359
139
  ## Migration
360
140
 
141
+ - Migration steps for [0.10.2](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#0102)
361
142
  - Migration steps for [0.9.2](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#092)
362
143
  - Migration steps for [0.9.1](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#091)
363
144
  - Migration steps for [0.9.0](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#090)
@@ -118,7 +118,7 @@ dependencies {
118
118
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
119
119
 
120
120
  //noinspection UseTomlInstead
121
- implementation "org.reclaimprotocol:inapp_sdk:0.9.2"
121
+ implementation "org.reclaimprotocol:inapp_sdk:0.10.2"
122
122
  }
123
123
 
124
124
  if (isNewArchitectureEnabled()) {
package/ios/InappRnSdk.mm CHANGED
@@ -132,6 +132,24 @@ Api *api = [[Api alloc] init];
132
132
  }];
133
133
  }
134
134
 
135
+ - (void)startVerificationFromJson:(nonnull NSString *)templateJsonString resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
136
+ NSLog(@"[InappRnSdk] starting verification");
137
+
138
+ NSLog(@"[InappRnSdk] starting verification now");
139
+ [api startVerificationFromJsonWithTemplate:templateJsonString
140
+ completionHandler:^(
141
+ NSDictionary<NSString *, id> *_Nullable result,
142
+ NSError *_Nullable error) {
143
+ if (error != nil) {
144
+ NSLog(@"[InappRnSdk] Api Error: %@", error);
145
+ reject(@"VERIFICATION_ERROR", @"Verification Error",
146
+ error);
147
+ } else {
148
+ resolve(result);
149
+ }
150
+ }];
151
+ }
152
+
135
153
  - (void)setOverrides:(JS::NativeInappRnSdk::Overrides &)overrides
136
154
  resolve:(nonnull RCTPromiseResolveBlock)resolve
137
155
  reject:(nonnull RCTPromiseRejectBlock)reject {
@@ -126,7 +126,13 @@ import ReclaimInAppSdk
126
126
  ) async throws -> [String: Any] {
127
127
  return try await startVerificationWithRequest(.url(url))
128
128
  }
129
-
129
+
130
+ @objc public func startVerificationFromJson(
131
+ template: String
132
+ ) async throws -> [String: Any] {
133
+ return try await startVerificationWithRequest(.json(JSONUtility.fromString(template) as? [AnyHashable?: Sendable?] ?? [:]))
134
+ }
135
+
130
136
  @objc public func setOverrides(
131
137
  provider: OverridenProviderInformation?,
132
138
  featureOptions: OverridenFeatureOptions?,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reclaimprotocol/inapp-rn-sdk",
3
- "version": "0.9.4-alpha.4",
3
+ "version": "0.10.2",
4
4
  "description": "Reclaim Protocol's InApp React Native SDK for ZK proof generations for requests with an in-app experience of web verification",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/commonjs/index.js",