@snaplyagent/react-native 0.0.0-stage → 1.1.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +7 -0
  3. package/README.md +139 -2
  4. package/SnaplyAgentReactNative.podspec +24 -0
  5. package/android/build.gradle +33 -0
  6. package/android/src/main/AndroidManifest.xml +1 -0
  7. package/android/src/main/java/com/snaplyagent/reactnative/SnaplyAgentModule.kt +104 -0
  8. package/android/src/main/java/com/snaplyagent/reactnative/SnaplyAgentPackage.kt +26 -0
  9. package/ios/Frameworks/SnaplyAgent.xcframework/Info.plist +44 -0
  10. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64/SnaplyAgent.framework/Headers/SnaplyAgent-Swift.h +382 -0
  11. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64/SnaplyAgent.framework/Info.plist +0 -0
  12. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64/SnaplyAgent.framework/Modules/SnaplyAgent.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  13. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64/SnaplyAgent.framework/Modules/SnaplyAgent.swiftmodule/arm64-apple-ios.swiftinterface +175 -0
  14. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64/SnaplyAgent.framework/Modules/module.modulemap +3 -0
  15. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64/SnaplyAgent.framework/PrivacyInfo.xcprivacy +149 -0
  16. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64/SnaplyAgent.framework/SnaplyAgent +0 -0
  17. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64/SnaplyAgent.framework/en.lproj/Snaply.strings +0 -0
  18. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64/SnaplyAgent.framework/hy.lproj/Snaply.strings +0 -0
  19. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64/SnaplyAgent.framework/ru.lproj/Snaply.strings +0 -0
  20. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/Headers/SnaplyAgent-Swift.h +760 -0
  21. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/Info.plist +0 -0
  22. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/Modules/SnaplyAgent.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/Modules/SnaplyAgent.swiftmodule/arm64-apple-ios-simulator.swiftinterface +175 -0
  24. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/Modules/SnaplyAgent.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  25. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/Modules/SnaplyAgent.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +175 -0
  26. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/Modules/module.modulemap +3 -0
  27. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/PrivacyInfo.xcprivacy +149 -0
  28. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/SnaplyAgent +0 -0
  29. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/_CodeSignature/CodeResources +233 -0
  30. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/en.lproj/Snaply.strings +0 -0
  31. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/hy.lproj/Snaply.strings +0 -0
  32. package/ios/Frameworks/SnaplyAgent.xcframework/ios-arm64_x86_64-simulator/SnaplyAgent.framework/ru.lproj/Snaply.strings +0 -0
  33. package/ios/Sources/SnaplyAgentModule.h +5 -0
  34. package/ios/Sources/SnaplyAgentModule.mm +142 -0
  35. package/ios/Sources/SnaplyBridge.swift +123 -0
  36. package/lib/SnaplyRedact.d.ts +9 -0
  37. package/lib/index.d.ts +86 -0
  38. package/lib/index.js +1 -0
  39. package/package.json +43 -4
  40. package/spec/NativeSnaplyAgent.ts +41 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ ## 1.1.0
2
+
3
+ Carries the Snaply Agent iOS SDK 2.56.0 and brings the Android SDK 2.47.0 from Maven Central.
4
+
5
+ * Your app can ask whether support is watching or controlling it right now: `Snaply.isLiveViewActive` and
6
+ `Snaply.isRemoteControlActive` — for anything it would rather not show or do meanwhile.
7
+ * `onLiveView(active)` tells your app when a live view starts and ends, as `onRemoteControl(active)` does for
8
+ remote control.
9
+ * A silent screenshot inside an approval is taken only while the "Screenshots allowed" banner is on screen.
10
+
11
+ ## 1.0.0
12
+
13
+ The first release on npm. Carries the Snaply Agent iOS SDK 2.55.0 and brings the Android SDK 2.46.0 from Maven
14
+ Central.
15
+
16
+ * A screenshot, a live view and remote control of your app, each only after the person allows it.
17
+ * Sensitive fields are hidden on the device before anything is sent: mark a view with `SnaplyRedact`, or let your
18
+ workspace's rules hide fields by their text.
19
+ * One package, autolinked: no code in the `ios` or `android` folders.
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Snaply Agent React Native package — proprietary software
2
+
3
+ Copyright © 2026 iFixgroup. All rights reserved.
4
+
5
+ This package is licensed, not sold. Its use is governed by the Snaply Agent Terms of Service,
6
+ https://snaplyagent.com/terms, which every customer accepts on sign-up. No other rights are granted.
7
+ Questions: privacy@snaplyagent.com.
package/README.md CHANGED
@@ -1,3 +1,140 @@
1
- # Temporary Holding Version
1
+ # @snaplyagent/react-native
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Snaply Agent for React Native — consent-first screen capture for support teams: a screenshot, a live
4
+ view and remote control of your app, each only after the person allows it, with sensitive fields
5
+ hidden on the device before anything is sent.
6
+
7
+ One package, autolinked. No code in the `ios` or `android` folders.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ npm install @snaplyagent/react-native
13
+ cd ios && pod install
14
+ ```
15
+
16
+ - React Native 0.88 or later (the New Architecture).
17
+ - **iOS 15.1** or later. The package carries the Snaply Agent iOS SDK; do not add its Swift package to
18
+ the app as well.
19
+ - **Android** `minSdk` 24. The package brings the Snaply Agent Android SDK from Maven Central.
20
+
21
+ ## Use
22
+
23
+ ```tsx
24
+ import { Platform } from 'react-native';
25
+ import { Snaply, SnaplyRedact } from '@snaplyagent/react-native';
26
+
27
+ // 1. Listen first: a request can arrive as soon as the device is registered.
28
+ Snaply.on({
29
+ onAllowed: capture => console.log('Screenshot shared'),
30
+ onError: error => console.warn(`Snaply: ${error.code}`),
31
+ });
32
+
33
+ // 2. Configure once. An iOS product and an Android product each have their own key
34
+ // (Console → Products → your product → API key). A key is not a secret.
35
+ await Snaply.configure({
36
+ key: Platform.OS === 'ios' ? iosKey : androidKey,
37
+ user: { id: 'usr_20481', name: 'Maya Kowalski' }, // optional
38
+ });
39
+
40
+ // When someone signs in later, and when they sign out:
41
+ Snaply.identify({ id: 'usr_20481', name: 'Maya Kowalski' });
42
+ Snaply.reset();
43
+
44
+ // An anonymous caller reads this to the agent:
45
+ const code = await Snaply.supportCode();
46
+ Snaply.showSupportCode(); // …or the SDK shows it in its own sheet
47
+
48
+ // Is support watching or controlling the app right now? For anything your app would rather not show or do
49
+ // meanwhile. `onLiveView(active)` and `onRemoteControl(active)` tell you when either starts and ends.
50
+ if (Snaply.isLiveViewActive || Snaply.isRemoteControlActive) {
51
+ // hold it back
52
+ }
53
+ ```
54
+
55
+ Add the app's identifier (bundle id, package name) to each product's allowed list in the console, or
56
+ `configure` rejects with `origin_mismatch`. On Android `configure` resolves as soon as the SDK has
57
+ started; a refused registration arrives through `onError`.
58
+
59
+ ## A Snaply server of your own
60
+
61
+ Everything the SDK and Snaply's server exchange is sealed a second time inside HTTPS, and the live server's keys are
62
+ built in: an app that talks to the live server has nothing to set. A server of your own is named with its address
63
+ and its master public keys together — without the keys the SDK sends nothing and reports `no_master_key`.
64
+
65
+ ```tsx
66
+ import { Snaply, SnaplyDevelopmentMaster } from '@snaplyagent/react-native';
67
+
68
+ await Snaply.configure({
69
+ key,
70
+ environment: 'https://snaply.your-company.example',
71
+ serverKeys: ['<your server's master public key>'],
72
+ });
73
+
74
+ // A Snaply stack on your own machine uses one published key, good for nothing else:
75
+ await Snaply.configure({ key, environment: 'http://localhost:5100', serverKeys: [SnaplyDevelopmentMaster] });
76
+ ```
77
+
78
+ ## What is hidden
79
+
80
+ A React Native screen is native views, so the native SDKs capture it and hide fields in it as in any
81
+ other app. Everything is painted over **on the device, before the image is encoded**. A hidden field
82
+ is also locked for remote control: it takes neither a tap nor text.
83
+
84
+ | | Hidden |
85
+ |---|---|
86
+ | `<TextInput secureTextEntry />` | On its own |
87
+ | `<SnaplyRedact>…</SnaplyRedact>` | Whatever is inside |
88
+ | A `testID` containing `snaply-redact` | That view |
89
+ | A dashboard rule **by identifier** (Products → Hidden fields) | The view with that `testID` — exact match |
90
+ | A dashboard rule **by text** | A view whose `placeholder` or `accessibilityLabel` contains the text, in any case |
91
+
92
+ ```tsx
93
+ <SnaplyRedact>
94
+ <TextInput value={card} onChangeText={setCard} />
95
+ </SnaplyRedact>
96
+ <TextInput testID="ibanField" value={iban} onChangeText={setIban} />
97
+ ```
98
+
99
+ Anything else on screen is captured as it is. On iOS a `<Text>` is its own accessibility label, so a
100
+ rule by text also hides a caption that contains the text.
101
+
102
+ ## Remote control
103
+
104
+ When the person allows it during a live view, the agent can tap, scroll and type. Nothing needs
105
+ adding to your components: `Pressable`, the `Touchable`s and `Button` respond to an agent's tap as
106
+ they do to a finger.
107
+
108
+ ## Not in this version
109
+
110
+ - A tap inside a React Native `Modal` is delivered the SDK's own way only (the modal is another
111
+ window); a pressable there needs `onAccessibilityTap` beside `onPress` on iOS.
112
+ - Expo: not measured. A development build should work; Expo Go cannot load native code.
113
+
114
+ ## What was measured
115
+
116
+ On 2026-11-10 with the example app
117
+ (<https://github.com/Mobile-LLC/SnaplyAgent-Example-ReactNative>): React Native 0.88.1, an iOS 18.6
118
+ simulator and an API 34 emulator, debug builds, against a local Snaply backend.
119
+
120
+ | | iOS | Android |
121
+ |---|---|---|
122
+ | Starts from JavaScript, registers, comes online | ✓ | ✓ |
123
+ | Screenshot after consent, screen content correct | ✓ | ✓ |
124
+ | `secureTextEntry` field hidden on its own | ✓ | ✓ |
125
+ | `<SnaplyRedact>` | ✓ | ✓ |
126
+ | Dashboard rule by identifier (`testID`) | ✓ | ✓ |
127
+ | Dashboard rule by text | ✓ | ✓ |
128
+ | Live view | ✓ | ✓ |
129
+ | Remote control — tap a plain `Pressable` | ✓ | ✓ |
130
+ | Remote control — type into a field | ✓ | ✓ |
131
+ | A hidden field refuses a tap and typed text | ✓ | ✓ |
132
+ | `identify`, `reset`, `supportCode`, `showSupportCode` | ✓ | ✓ |
133
+ | Callbacks reach JavaScript | ✓ | ✓ |
134
+
135
+ Not measured: scrolling (a React Native scroll view is a native one, the SDK's own path), a physical
136
+ device, a release build, Expo, a tap inside a `Modal`.
137
+
138
+ ## Docs
139
+
140
+ <https://snaplyagent.com/docs>
@@ -0,0 +1,24 @@
1
+ # Copyright © 2026 iFixgroup. All rights reserved.
2
+ require "json"
3
+
4
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "SnaplyAgentReactNative"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = { :type => "Proprietary", :file => "LICENSE" }
12
+ s.authors = "iFixgroup"
13
+ s.platforms = { :ios => "15.1" }
14
+ s.source = { :http => "https://registry.npmjs.org/@snaplyagent/react-native/-/react-native-#{s.version}.tgz" }
15
+
16
+ s.source_files = "ios/Sources/**/*.{h,m,mm,swift}"
17
+ s.private_header_files = "ios/Sources/**/*.h"
18
+ s.swift_version = "5.9"
19
+ s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES" }
20
+
21
+ s.vendored_frameworks = "ios/Frameworks/SnaplyAgent.xcframework"
22
+
23
+ install_modules_dependencies(s)
24
+ end
@@ -0,0 +1,33 @@
1
+ // Copyright © 2026 iFixgroup. All rights reserved.
2
+ buildscript {
3
+ ext.safeExtGet = { prop, fallback ->
4
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
5
+ }
6
+ }
7
+
8
+ apply plugin: "com.android.library"
9
+ apply plugin: "org.jetbrains.kotlin.android"
10
+ apply plugin: "com.facebook.react"
11
+
12
+ android {
13
+ namespace "com.snaplyagent.reactnative"
14
+ compileSdkVersion safeExtGet("compileSdkVersion", 36)
15
+
16
+ defaultConfig {
17
+ minSdkVersion safeExtGet("minSdkVersion", 24)
18
+ }
19
+
20
+ compileOptions {
21
+ sourceCompatibility JavaVersion.VERSION_17
22
+ targetCompatibility JavaVersion.VERSION_17
23
+ }
24
+
25
+ kotlinOptions {
26
+ jvmTarget = "17"
27
+ }
28
+ }
29
+
30
+ dependencies {
31
+ implementation "com.facebook.react:react-android"
32
+ api "com.snaplyagent:agent:2.47.0"
33
+ }
@@ -0,0 +1 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" />
@@ -0,0 +1,104 @@
1
+ // Copyright © 2026 iFixgroup. All rights reserved.
2
+ package com.snaplyagent.reactnative
3
+
4
+ import com.facebook.react.bridge.Arguments
5
+ import com.facebook.react.bridge.Promise
6
+ import com.facebook.react.bridge.ReactApplicationContext
7
+ import com.facebook.react.bridge.ReadableArray
8
+ import com.facebook.react.bridge.UiThreadUtil
9
+ import com.facebook.react.bridge.WritableMap
10
+ import com.facebook.react.module.annotations.ReactModule
11
+ import com.snaply.agent.CaptureResult
12
+ import com.snaply.agent.LiveSession
13
+ import com.snaply.agent.Snaply
14
+ import com.snaply.agent.SnaplyCallbacks
15
+ import com.snaply.agent.SnaplyEnvironment
16
+ import com.snaply.agent.SnaplyException
17
+ import com.snaply.agent.SnaplyUser
18
+
19
+ @ReactModule(name = SnaplyAgentModule.NAME)
20
+ class SnaplyAgentModule(reactContext: ReactApplicationContext) : NativeSnaplyAgentSpec(reactContext) {
21
+ override fun getName(): String = NAME
22
+
23
+ override fun configure(
24
+ key: String,
25
+ host: String?,
26
+ userId: String?,
27
+ userName: String?,
28
+ collectVendorId: Boolean,
29
+ language: String,
30
+ serverKeys: ReadableArray,
31
+ promise: Promise,
32
+ ) {
33
+ UiThreadUtil.runOnUiThread {
34
+ try {
35
+ Snaply.on(callbacks)
36
+ Snaply.init(
37
+ context = reactApplicationContext.currentActivity ?: reactApplicationContext,
38
+ key = key,
39
+ environment = host?.let { SnaplyEnvironment.Custom(it, serverKeys.toArrayList().map(Any?::toString)) } ?: SnaplyEnvironment.Live,
40
+ user = userId?.let { SnaplyUser(it, userName) },
41
+ collectVendorId = collectVendorId,
42
+ language = language,
43
+ )
44
+ promise.resolve(null)
45
+ } catch (error: SnaplyException) {
46
+ promise.reject(error.code, error.message, error, Arguments.createMap().apply { putInt("status", error.status) })
47
+ }
48
+ }
49
+ }
50
+
51
+ override fun identify(id: String, name: String?, phone: String?, identitySignature: String?) {
52
+ Snaply.identify(id = id, name = name, phone = phone, identitySignature = identitySignature)
53
+ }
54
+
55
+ override fun reset() = Snaply.reset()
56
+
57
+ override fun supportCode(promise: Promise) = promise.resolve(Snaply.supportCode())
58
+
59
+ override fun showSupportCode() {
60
+ UiThreadUtil.runOnUiThread { Snaply.showSupportCode() }
61
+ }
62
+
63
+ override fun stop() {
64
+ UiThreadUtil.runOnUiThread { Snaply.stop() }
65
+ }
66
+
67
+ override fun isLiveViewActive(): Boolean = Snaply.isLiveViewActive
68
+
69
+ override fun isRemoteControlActive(): Boolean = Snaply.isRemoteControlActive
70
+
71
+ private val callbacks = object : SnaplyCallbacks {
72
+ override fun onRequestShown() = emit("requestShown")
73
+
74
+ override fun onAllowed(capture: CaptureResult) = emit("allowed") {
75
+ putString("captureId", capture.captureId)
76
+ putString("imageUrl", capture.imageUrl)
77
+ }
78
+
79
+ override fun onDenied() = emit("denied")
80
+
81
+ override fun onExpired() = emit("expired")
82
+
83
+ override fun onError(error: Exception) = emit("error") {
84
+ val snaply = error as? SnaplyException
85
+ putString("code", snaply?.code ?: "error")
86
+ putString("message", error.message.orEmpty())
87
+ putInt("status", snaply?.status ?: 0)
88
+ }
89
+
90
+ override fun onRemoteControl(active: Boolean) = emit("remoteControl") { putBoolean("active", active) }
91
+
92
+ override fun onLiveEnded(session: LiveSession) = emit("liveEnded") { putString("sessionId", session.sessionId) }
93
+
94
+ override fun onLiveView(active: Boolean) = emit("liveView") { putBoolean("active", active) }
95
+ }
96
+
97
+ private fun emit(name: String, fields: WritableMap.() -> Unit = {}) {
98
+ emitOnSnaplyEvent(Arguments.createMap().apply { putString("name", name) }.apply(fields))
99
+ }
100
+
101
+ companion object {
102
+ const val NAME = "SnaplyAgent"
103
+ }
104
+ }
@@ -0,0 +1,26 @@
1
+ // Copyright © 2026 iFixgroup. All rights reserved.
2
+ package com.snaplyagent.reactnative
3
+
4
+ import com.facebook.react.BaseReactPackage
5
+ import com.facebook.react.bridge.NativeModule
6
+ import com.facebook.react.bridge.ReactApplicationContext
7
+ import com.facebook.react.module.model.ReactModuleInfo
8
+ import com.facebook.react.module.model.ReactModuleInfoProvider
9
+
10
+ class SnaplyAgentPackage : BaseReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? =
12
+ if (name == SnaplyAgentModule.NAME) SnaplyAgentModule(reactContext) else null
13
+
14
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider {
15
+ mapOf(
16
+ SnaplyAgentModule.NAME to ReactModuleInfo(
17
+ name = SnaplyAgentModule.NAME,
18
+ className = SnaplyAgentModule.NAME,
19
+ canOverrideExistingModule = false,
20
+ needsEagerInit = false,
21
+ isCxxModule = false,
22
+ isTurboModule = true,
23
+ ),
24
+ )
25
+ }
26
+ }
@@ -0,0 +1,44 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>AvailableLibraries</key>
6
+ <array>
7
+ <dict>
8
+ <key>BinaryPath</key>
9
+ <string>SnaplyAgent.framework/SnaplyAgent</string>
10
+ <key>LibraryIdentifier</key>
11
+ <string>ios-arm64_x86_64-simulator</string>
12
+ <key>LibraryPath</key>
13
+ <string>SnaplyAgent.framework</string>
14
+ <key>SupportedArchitectures</key>
15
+ <array>
16
+ <string>arm64</string>
17
+ <string>x86_64</string>
18
+ </array>
19
+ <key>SupportedPlatform</key>
20
+ <string>ios</string>
21
+ <key>SupportedPlatformVariant</key>
22
+ <string>simulator</string>
23
+ </dict>
24
+ <dict>
25
+ <key>BinaryPath</key>
26
+ <string>SnaplyAgent.framework/SnaplyAgent</string>
27
+ <key>LibraryIdentifier</key>
28
+ <string>ios-arm64</string>
29
+ <key>LibraryPath</key>
30
+ <string>SnaplyAgent.framework</string>
31
+ <key>SupportedArchitectures</key>
32
+ <array>
33
+ <string>arm64</string>
34
+ </array>
35
+ <key>SupportedPlatform</key>
36
+ <string>ios</string>
37
+ </dict>
38
+ </array>
39
+ <key>CFBundlePackageType</key>
40
+ <string>XFWK</string>
41
+ <key>XCFrameworkFormatVersion</key>
42
+ <string>1.0</string>
43
+ </dict>
44
+ </plist>