@snaplyagent/react-native 0.0.0-stage → 1.0.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 +9 -0
  2. package/LICENSE +7 -0
  3. package/README.md +133 -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 +98 -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 +168 -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 +168 -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 +168 -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 +132 -0
  35. package/ios/Sources/SnaplyBridge.swift +118 -0
  36. package/lib/SnaplyRedact.d.ts +9 -0
  37. package/lib/index.d.ts +71 -0
  38. package/lib/index.js +1 -0
  39. package/package.json +43 -4
  40. package/spec/NativeSnaplyAgent.ts +39 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ ## 1.0.0
2
+
3
+ The first release on npm. Carries the Snaply Agent iOS SDK 2.55.0 and brings the Android SDK 2.46.0 from Maven
4
+ Central.
5
+
6
+ * A screenshot, a live view and remote control of your app, each only after the person allows it.
7
+ * Sensitive fields are hidden on the device before anything is sent: mark a view with `SnaplyRedact`, or let your
8
+ workspace's rules hide fields by their text.
9
+ * 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,134 @@
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
+
49
+ Add the app's identifier (bundle id, package name) to each product's allowed list in the console, or
50
+ `configure` rejects with `origin_mismatch`. On Android `configure` resolves as soon as the SDK has
51
+ started; a refused registration arrives through `onError`.
52
+
53
+ ## A Snaply server of your own
54
+
55
+ Everything the SDK and Snaply's server exchange is sealed a second time inside HTTPS, and the live server's keys are
56
+ built in: an app that talks to the live server has nothing to set. A server of your own is named with its address
57
+ and its master public keys together — without the keys the SDK sends nothing and reports `no_master_key`.
58
+
59
+ ```tsx
60
+ import { Snaply, SnaplyDevelopmentMaster } from '@snaplyagent/react-native';
61
+
62
+ await Snaply.configure({
63
+ key,
64
+ environment: 'https://snaply.your-company.example',
65
+ serverKeys: ['<your server's master public key>'],
66
+ });
67
+
68
+ // A Snaply stack on your own machine uses one published key, good for nothing else:
69
+ await Snaply.configure({ key, environment: 'http://localhost:5100', serverKeys: [SnaplyDevelopmentMaster] });
70
+ ```
71
+
72
+ ## What is hidden
73
+
74
+ A React Native screen is native views, so the native SDKs capture it and hide fields in it as in any
75
+ other app. Everything is painted over **on the device, before the image is encoded**. A hidden field
76
+ is also locked for remote control: it takes neither a tap nor text.
77
+
78
+ | | Hidden |
79
+ |---|---|
80
+ | `<TextInput secureTextEntry />` | On its own |
81
+ | `<SnaplyRedact>…</SnaplyRedact>` | Whatever is inside |
82
+ | A `testID` containing `snaply-redact` | That view |
83
+ | A dashboard rule **by identifier** (Products → Hidden fields) | The view with that `testID` — exact match |
84
+ | A dashboard rule **by text** | A view whose `placeholder` or `accessibilityLabel` contains the text, in any case |
85
+
86
+ ```tsx
87
+ <SnaplyRedact>
88
+ <TextInput value={card} onChangeText={setCard} />
89
+ </SnaplyRedact>
90
+ <TextInput testID="ibanField" value={iban} onChangeText={setIban} />
91
+ ```
92
+
93
+ Anything else on screen is captured as it is. On iOS a `<Text>` is its own accessibility label, so a
94
+ rule by text also hides a caption that contains the text.
95
+
96
+ ## Remote control
97
+
98
+ When the person allows it during a live view, the agent can tap, scroll and type. Nothing needs
99
+ adding to your components: `Pressable`, the `Touchable`s and `Button` respond to an agent's tap as
100
+ they do to a finger.
101
+
102
+ ## Not in this version
103
+
104
+ - A tap inside a React Native `Modal` is delivered the SDK's own way only (the modal is another
105
+ window); a pressable there needs `onAccessibilityTap` beside `onPress` on iOS.
106
+ - Expo: not measured. A development build should work; Expo Go cannot load native code.
107
+
108
+ ## What was measured
109
+
110
+ On 2026-11-10 with the example app
111
+ (<https://github.com/Mobile-LLC/SnaplyAgent-Example-ReactNative>): React Native 0.88.1, an iOS 18.6
112
+ simulator and an API 34 emulator, debug builds, against a local Snaply backend.
113
+
114
+ | | iOS | Android |
115
+ |---|---|---|
116
+ | Starts from JavaScript, registers, comes online | ✓ | ✓ |
117
+ | Screenshot after consent, screen content correct | ✓ | ✓ |
118
+ | `secureTextEntry` field hidden on its own | ✓ | ✓ |
119
+ | `<SnaplyRedact>` | ✓ | ✓ |
120
+ | Dashboard rule by identifier (`testID`) | ✓ | ✓ |
121
+ | Dashboard rule by text | ✓ | ✓ |
122
+ | Live view | ✓ | ✓ |
123
+ | Remote control — tap a plain `Pressable` | ✓ | ✓ |
124
+ | Remote control — type into a field | ✓ | ✓ |
125
+ | A hidden field refuses a tap and typed text | ✓ | ✓ |
126
+ | `identify`, `reset`, `supportCode`, `showSupportCode` | ✓ | ✓ |
127
+ | Callbacks reach JavaScript | ✓ | ✓ |
128
+
129
+ Not measured: scrolling (a React Native scroll view is a native one, the SDK's own path), a physical
130
+ device, a release build, Expo, a tap inside a `Modal`.
131
+
132
+ ## Docs
133
+
134
+ <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.46.0"
33
+ }
@@ -0,0 +1 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" />
@@ -0,0 +1,98 @@
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
+ private val callbacks = object : SnaplyCallbacks {
68
+ override fun onRequestShown() = emit("requestShown")
69
+
70
+ override fun onAllowed(capture: CaptureResult) = emit("allowed") {
71
+ putString("captureId", capture.captureId)
72
+ putString("imageUrl", capture.imageUrl)
73
+ }
74
+
75
+ override fun onDenied() = emit("denied")
76
+
77
+ override fun onExpired() = emit("expired")
78
+
79
+ override fun onError(error: Exception) = emit("error") {
80
+ val snaply = error as? SnaplyException
81
+ putString("code", snaply?.code ?: "error")
82
+ putString("message", error.message.orEmpty())
83
+ putInt("status", snaply?.status ?: 0)
84
+ }
85
+
86
+ override fun onRemoteControl(active: Boolean) = emit("remoteControl") { putBoolean("active", active) }
87
+
88
+ override fun onLiveEnded(session: LiveSession) = emit("liveEnded") { putString("sessionId", session.sessionId) }
89
+ }
90
+
91
+ private fun emit(name: String, fields: WritableMap.() -> Unit = {}) {
92
+ emitOnSnaplyEvent(Arguments.createMap().apply { putString("name", name) }.apply(fields))
93
+ }
94
+
95
+ companion object {
96
+ const val NAME = "SnaplyAgent"
97
+ }
98
+ }
@@ -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</string>
12
+ <key>LibraryPath</key>
13
+ <string>SnaplyAgent.framework</string>
14
+ <key>SupportedArchitectures</key>
15
+ <array>
16
+ <string>arm64</string>
17
+ </array>
18
+ <key>SupportedPlatform</key>
19
+ <string>ios</string>
20
+ </dict>
21
+ <dict>
22
+ <key>BinaryPath</key>
23
+ <string>SnaplyAgent.framework/SnaplyAgent</string>
24
+ <key>LibraryIdentifier</key>
25
+ <string>ios-arm64_x86_64-simulator</string>
26
+ <key>LibraryPath</key>
27
+ <string>SnaplyAgent.framework</string>
28
+ <key>SupportedArchitectures</key>
29
+ <array>
30
+ <string>arm64</string>
31
+ <string>x86_64</string>
32
+ </array>
33
+ <key>SupportedPlatform</key>
34
+ <string>ios</string>
35
+ <key>SupportedPlatformVariant</key>
36
+ <string>simulator</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>