@rejourneyco/react-native 1.0.7
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.
- package/README.md +29 -0
- package/android/build.gradle.kts +135 -0
- package/android/consumer-rules.pro +10 -0
- package/android/proguard-rules.pro +1 -0
- package/android/src/main/AndroidManifest.xml +15 -0
- package/android/src/main/java/com/rejourney/RejourneyModuleImpl.kt +860 -0
- package/android/src/main/java/com/rejourney/engine/DeviceRegistrar.kt +290 -0
- package/android/src/main/java/com/rejourney/engine/DiagnosticLog.kt +385 -0
- package/android/src/main/java/com/rejourney/engine/RejourneyImpl.kt +512 -0
- package/android/src/main/java/com/rejourney/platform/OEMDetector.kt +173 -0
- package/android/src/main/java/com/rejourney/platform/PerfTiming.kt +384 -0
- package/android/src/main/java/com/rejourney/platform/SessionLifecycleService.kt +160 -0
- package/android/src/main/java/com/rejourney/platform/Telemetry.kt +301 -0
- package/android/src/main/java/com/rejourney/platform/WindowUtils.kt +100 -0
- package/android/src/main/java/com/rejourney/recording/AnrSentinel.kt +129 -0
- package/android/src/main/java/com/rejourney/recording/EventBuffer.kt +330 -0
- package/android/src/main/java/com/rejourney/recording/InteractionRecorder.kt +519 -0
- package/android/src/main/java/com/rejourney/recording/ReplayOrchestrator.kt +740 -0
- package/android/src/main/java/com/rejourney/recording/SegmentDispatcher.kt +559 -0
- package/android/src/main/java/com/rejourney/recording/StabilityMonitor.kt +238 -0
- package/android/src/main/java/com/rejourney/recording/TelemetryPipeline.kt +633 -0
- package/android/src/main/java/com/rejourney/recording/ViewHierarchyScanner.kt +232 -0
- package/android/src/main/java/com/rejourney/recording/VisualCapture.kt +474 -0
- package/android/src/main/java/com/rejourney/utility/DataCompression.kt +63 -0
- package/android/src/main/java/com/rejourney/utility/ImageBlur.kt +412 -0
- package/android/src/main/java/com/rejourney/utility/ViewIdentifier.kt +169 -0
- package/android/src/newarch/java/com/rejourney/RejourneyModule.kt +232 -0
- package/android/src/newarch/java/com/rejourney/RejourneyPackage.kt +40 -0
- package/android/src/oldarch/java/com/rejourney/RejourneyModule.kt +268 -0
- package/android/src/oldarch/java/com/rejourney/RejourneyPackage.kt +23 -0
- package/ios/Engine/DeviceRegistrar.swift +288 -0
- package/ios/Engine/DiagnosticLog.swift +387 -0
- package/ios/Engine/RejourneyImpl.swift +719 -0
- package/ios/Recording/AnrSentinel.swift +142 -0
- package/ios/Recording/EventBuffer.swift +326 -0
- package/ios/Recording/InteractionRecorder.swift +428 -0
- package/ios/Recording/ReplayOrchestrator.swift +624 -0
- package/ios/Recording/SegmentDispatcher.swift +492 -0
- package/ios/Recording/StabilityMonitor.swift +223 -0
- package/ios/Recording/TelemetryPipeline.swift +547 -0
- package/ios/Recording/ViewHierarchyScanner.swift +156 -0
- package/ios/Recording/VisualCapture.swift +675 -0
- package/ios/Rejourney.h +38 -0
- package/ios/Rejourney.mm +375 -0
- package/ios/Utility/DataCompression.swift +55 -0
- package/ios/Utility/ImageBlur.swift +89 -0
- package/ios/Utility/RuntimeMethodSwap.swift +41 -0
- package/ios/Utility/ViewIdentifier.swift +37 -0
- package/lib/commonjs/NativeRejourney.js +40 -0
- package/lib/commonjs/components/Mask.js +88 -0
- package/lib/commonjs/index.js +1443 -0
- package/lib/commonjs/sdk/autoTracking.js +1087 -0
- package/lib/commonjs/sdk/constants.js +166 -0
- package/lib/commonjs/sdk/errorTracking.js +187 -0
- package/lib/commonjs/sdk/index.js +50 -0
- package/lib/commonjs/sdk/metricsTracking.js +205 -0
- package/lib/commonjs/sdk/navigation.js +128 -0
- package/lib/commonjs/sdk/networkInterceptor.js +375 -0
- package/lib/commonjs/sdk/utils.js +433 -0
- package/lib/commonjs/sdk/version.js +13 -0
- package/lib/commonjs/types/expo-router.d.js +2 -0
- package/lib/commonjs/types/index.js +2 -0
- package/lib/module/NativeRejourney.js +38 -0
- package/lib/module/components/Mask.js +83 -0
- package/lib/module/index.js +1341 -0
- package/lib/module/sdk/autoTracking.js +1059 -0
- package/lib/module/sdk/constants.js +154 -0
- package/lib/module/sdk/errorTracking.js +177 -0
- package/lib/module/sdk/index.js +26 -0
- package/lib/module/sdk/metricsTracking.js +187 -0
- package/lib/module/sdk/navigation.js +120 -0
- package/lib/module/sdk/networkInterceptor.js +364 -0
- package/lib/module/sdk/utils.js +412 -0
- package/lib/module/sdk/version.js +7 -0
- package/lib/module/types/expo-router.d.js +2 -0
- package/lib/module/types/index.js +2 -0
- package/lib/typescript/NativeRejourney.d.ts +160 -0
- package/lib/typescript/components/Mask.d.ts +54 -0
- package/lib/typescript/index.d.ts +117 -0
- package/lib/typescript/sdk/autoTracking.d.ts +226 -0
- package/lib/typescript/sdk/constants.d.ts +138 -0
- package/lib/typescript/sdk/errorTracking.d.ts +47 -0
- package/lib/typescript/sdk/index.d.ts +24 -0
- package/lib/typescript/sdk/metricsTracking.d.ts +75 -0
- package/lib/typescript/sdk/navigation.d.ts +48 -0
- package/lib/typescript/sdk/networkInterceptor.d.ts +62 -0
- package/lib/typescript/sdk/utils.d.ts +193 -0
- package/lib/typescript/sdk/version.d.ts +6 -0
- package/lib/typescript/types/index.d.ts +618 -0
- package/package.json +122 -0
- package/rejourney.podspec +23 -0
- package/src/NativeRejourney.ts +185 -0
- package/src/components/Mask.tsx +93 -0
- package/src/index.ts +1555 -0
- package/src/sdk/autoTracking.ts +1245 -0
- package/src/sdk/constants.ts +155 -0
- package/src/sdk/errorTracking.ts +231 -0
- package/src/sdk/index.ts +25 -0
- package/src/sdk/metricsTracking.ts +227 -0
- package/src/sdk/navigation.ts +152 -0
- package/src/sdk/networkInterceptor.ts +423 -0
- package/src/sdk/utils.ts +442 -0
- package/src/sdk/version.ts +6 -0
- package/src/types/expo-router.d.ts +7 -0
- package/src/types/index.ts +709 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* New Architecture (TurboModules) module wrapper for Rejourney SDK.
|
|
3
|
+
*
|
|
4
|
+
* This thin wrapper extends the Codegen-generated NativeRejourneySpec for the New Architecture
|
|
5
|
+
* and delegates all method implementations to RejourneyModuleImpl.
|
|
6
|
+
*
|
|
7
|
+
* This file is compiled when newArchEnabled=true in gradle.properties.
|
|
8
|
+
*/
|
|
9
|
+
package com.rejourney
|
|
10
|
+
|
|
11
|
+
import com.facebook.react.bridge.*
|
|
12
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
13
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
14
|
+
import com.rejourney.engine.DiagnosticLog
|
|
15
|
+
|
|
16
|
+
@ReactModule(name = RejourneyModule.NAME)
|
|
17
|
+
class RejourneyModule(reactContext: ReactApplicationContext) :
|
|
18
|
+
NativeRejourneySpec(reactContext) {
|
|
19
|
+
|
|
20
|
+
companion object {
|
|
21
|
+
const val NAME = RejourneyModuleImpl.NAME
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private var initError: Throwable? = null
|
|
25
|
+
|
|
26
|
+
// Lazy initialization to avoid constructor crashes blocking module creation
|
|
27
|
+
private val impl: RejourneyModuleImpl? by lazy {
|
|
28
|
+
try {
|
|
29
|
+
RejourneyModuleImpl(reactContext, isNewArchitecture = true)
|
|
30
|
+
} catch (e: Throwable) {
|
|
31
|
+
initError = e
|
|
32
|
+
DiagnosticLog.fault("✗ CRITICAL: Failed to create RejourneyModuleImpl: ${e.message}")
|
|
33
|
+
null
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private fun getImplOrReject(promise: Promise): RejourneyModuleImpl? {
|
|
38
|
+
val instance = impl
|
|
39
|
+
if (instance == null) {
|
|
40
|
+
val message = initError?.message ?: "Module initialization failed"
|
|
41
|
+
promise.resolve(createErrorMap(message))
|
|
42
|
+
return null
|
|
43
|
+
}
|
|
44
|
+
return instance
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override fun getName(): String = NAME
|
|
48
|
+
|
|
49
|
+
@ReactMethod
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
override fun debugTriggerANR(durationMs: Double) {
|
|
52
|
+
val instance = impl
|
|
53
|
+
if (instance == null) {
|
|
54
|
+
DiagnosticLog.fault("debugTriggerANR failed: module not initialized")
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
instance.debugTriggerANR(durationMs)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
override fun invalidate() {
|
|
61
|
+
impl?.invalidate()
|
|
62
|
+
super.invalidate()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@ReactMethod
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
override fun setSDKVersion(version: String) {
|
|
68
|
+
impl?.setSDKVersion(version)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@ReactMethod
|
|
72
|
+
@DoNotStrip
|
|
73
|
+
override fun startSession(userId: String, apiUrl: String, publicKey: String, promise: Promise) {
|
|
74
|
+
val instance = getImplOrReject(promise) ?: return
|
|
75
|
+
instance.startSession(userId, apiUrl, publicKey, promise)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@ReactMethod
|
|
79
|
+
@DoNotStrip
|
|
80
|
+
override fun stopSession(promise: Promise) {
|
|
81
|
+
val instance = getImplOrReject(promise) ?: return
|
|
82
|
+
instance.stopSession(promise)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@ReactMethod
|
|
86
|
+
@DoNotStrip
|
|
87
|
+
override fun logEvent(eventType: String, details: ReadableMap, promise: Promise) {
|
|
88
|
+
val instance = getImplOrReject(promise) ?: return
|
|
89
|
+
instance.logEvent(eventType, details, promise)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@ReactMethod
|
|
93
|
+
@DoNotStrip
|
|
94
|
+
override fun screenChanged(screenName: String, promise: Promise) {
|
|
95
|
+
val instance = getImplOrReject(promise) ?: return
|
|
96
|
+
instance.screenChanged(screenName, promise)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@ReactMethod
|
|
100
|
+
@DoNotStrip
|
|
101
|
+
override fun onScroll(offsetY: Double, promise: Promise) {
|
|
102
|
+
val instance = getImplOrReject(promise) ?: return
|
|
103
|
+
instance.onScroll(offsetY, promise)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@ReactMethod
|
|
107
|
+
@DoNotStrip
|
|
108
|
+
override fun markVisualChange(reason: String, importance: String, promise: Promise) {
|
|
109
|
+
val instance = getImplOrReject(promise) ?: return
|
|
110
|
+
instance.markVisualChange(reason, importance, promise)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@ReactMethod
|
|
114
|
+
@DoNotStrip
|
|
115
|
+
override fun onExternalURLOpened(urlScheme: String, promise: Promise) {
|
|
116
|
+
val instance = getImplOrReject(promise) ?: return
|
|
117
|
+
instance.onExternalURLOpened(urlScheme, promise)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@ReactMethod
|
|
121
|
+
@DoNotStrip
|
|
122
|
+
override fun onOAuthStarted(provider: String, promise: Promise) {
|
|
123
|
+
val instance = getImplOrReject(promise) ?: return
|
|
124
|
+
instance.onOAuthStarted(provider, promise)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@ReactMethod
|
|
128
|
+
@DoNotStrip
|
|
129
|
+
override fun onOAuthCompleted(provider: String, success: Boolean, promise: Promise) {
|
|
130
|
+
val instance = getImplOrReject(promise) ?: return
|
|
131
|
+
instance.onOAuthCompleted(provider, success, promise)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@ReactMethod
|
|
135
|
+
@DoNotStrip
|
|
136
|
+
override fun getSDKMetrics(promise: Promise) {
|
|
137
|
+
val instance = getImplOrReject(promise) ?: return
|
|
138
|
+
instance.getSDKMetrics(promise)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@ReactMethod
|
|
142
|
+
@DoNotStrip
|
|
143
|
+
override fun getDeviceInfo(promise: Promise) {
|
|
144
|
+
val instance = getImplOrReject(promise) ?: return
|
|
145
|
+
instance.getDeviceInfo(promise)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@ReactMethod
|
|
149
|
+
@DoNotStrip
|
|
150
|
+
override fun debugCrash() {
|
|
151
|
+
val instance = impl
|
|
152
|
+
if (instance == null) {
|
|
153
|
+
DiagnosticLog.fault("debugCrash failed: module not initialized")
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
instance.debugCrash()
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@ReactMethod
|
|
160
|
+
@DoNotStrip
|
|
161
|
+
override fun getSessionId(promise: Promise) {
|
|
162
|
+
val instance = getImplOrReject(promise) ?: return
|
|
163
|
+
instance.getSessionId(promise)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@ReactMethod
|
|
167
|
+
@DoNotStrip
|
|
168
|
+
override fun maskViewByNativeID(nativeID: String, promise: Promise) {
|
|
169
|
+
val instance = getImplOrReject(promise) ?: return
|
|
170
|
+
instance.maskViewByNativeID(nativeID, promise)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@ReactMethod
|
|
174
|
+
@DoNotStrip
|
|
175
|
+
override fun unmaskViewByNativeID(nativeID: String, promise: Promise) {
|
|
176
|
+
val instance = getImplOrReject(promise) ?: return
|
|
177
|
+
instance.unmaskViewByNativeID(nativeID, promise)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@ReactMethod
|
|
181
|
+
@DoNotStrip
|
|
182
|
+
override fun setUserIdentity(userId: String, promise: Promise) {
|
|
183
|
+
val instance = getImplOrReject(promise) ?: return
|
|
184
|
+
instance.setUserIdentity(userId, promise)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@ReactMethod
|
|
188
|
+
@DoNotStrip
|
|
189
|
+
override fun getUserIdentity(promise: Promise) {
|
|
190
|
+
val instance = getImplOrReject(promise) ?: return
|
|
191
|
+
instance.getUserIdentity(promise)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@ReactMethod
|
|
195
|
+
@DoNotStrip
|
|
196
|
+
override fun setDebugMode(enabled: Boolean, promise: Promise) {
|
|
197
|
+
val instance = getImplOrReject(promise) ?: return
|
|
198
|
+
instance.setDebugMode(enabled, promise)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@ReactMethod
|
|
202
|
+
@DoNotStrip
|
|
203
|
+
override fun setRemoteConfig(
|
|
204
|
+
rejourneyEnabled: Boolean,
|
|
205
|
+
recordingEnabled: Boolean,
|
|
206
|
+
sampleRate: Double,
|
|
207
|
+
maxRecordingMinutes: Double,
|
|
208
|
+
promise: Promise
|
|
209
|
+
) {
|
|
210
|
+
val instance = getImplOrReject(promise) ?: return
|
|
211
|
+
instance.setRemoteConfig(rejourneyEnabled, recordingEnabled, sampleRate, maxRecordingMinutes, promise)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
private fun createErrorMap(error: String): WritableMap {
|
|
215
|
+
return Arguments.createMap().apply {
|
|
216
|
+
putBoolean("success", false)
|
|
217
|
+
putString("error", error)
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@ReactMethod
|
|
222
|
+
@DoNotStrip
|
|
223
|
+
fun addListener(eventName: String) {
|
|
224
|
+
try { impl?.addListener(eventName) } catch (_: Exception) {}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@ReactMethod
|
|
228
|
+
@DoNotStrip
|
|
229
|
+
fun removeListeners(count: Double) {
|
|
230
|
+
try { impl?.removeListeners(count) } catch (_: Exception) {}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* New Architecture (TurboModules) package registration for Rejourney SDK.
|
|
3
|
+
*
|
|
4
|
+
* This package is compiled when newArchEnabled=true in gradle.properties.
|
|
5
|
+
* It uses BaseReactPackage for proper TurboModule registration.
|
|
6
|
+
*/
|
|
7
|
+
package com.rejourney
|
|
8
|
+
|
|
9
|
+
import com.facebook.react.BaseReactPackage
|
|
10
|
+
import com.facebook.react.bridge.NativeModule
|
|
11
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
12
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
13
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
14
|
+
import com.facebook.react.uimanager.ViewManager
|
|
15
|
+
|
|
16
|
+
class RejourneyPackage : BaseReactPackage() {
|
|
17
|
+
|
|
18
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
19
|
+
return if (name == RejourneyModuleImpl.NAME) {
|
|
20
|
+
RejourneyModule(reactContext)
|
|
21
|
+
} else {
|
|
22
|
+
null
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
27
|
+
return ReactModuleInfoProvider {
|
|
28
|
+
mapOf(
|
|
29
|
+
RejourneyModuleImpl.NAME to ReactModuleInfo(
|
|
30
|
+
RejourneyModuleImpl.NAME, // name
|
|
31
|
+
RejourneyModule::class.java.name, // className (full class name)
|
|
32
|
+
false, // canOverrideExistingModule
|
|
33
|
+
false, // needsEagerInit
|
|
34
|
+
false, // isCxxModule - NOT a C++ module
|
|
35
|
+
true // isTurboModule - MUST be true for TurboModules
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Old Architecture (Bridge) module wrapper for Rejourney SDK.
|
|
3
|
+
*
|
|
4
|
+
* This thin wrapper extends ReactContextBaseJavaModule for the Old Architecture
|
|
5
|
+
* and delegates all method implementations to RejourneyModuleImpl.
|
|
6
|
+
*
|
|
7
|
+
* This file is compiled when newArchEnabled=false in gradle.properties.
|
|
8
|
+
*/
|
|
9
|
+
package com.rejourney
|
|
10
|
+
|
|
11
|
+
import com.facebook.react.bridge.*
|
|
12
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
13
|
+
import com.rejourney.engine.DiagnosticLog
|
|
14
|
+
|
|
15
|
+
@ReactModule(name = RejourneyModule.NAME)
|
|
16
|
+
class RejourneyModule(reactContext: ReactApplicationContext) :
|
|
17
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
18
|
+
|
|
19
|
+
companion object {
|
|
20
|
+
const val NAME = RejourneyModuleImpl.NAME
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Lazy initialization - create impl only when first method is called
|
|
24
|
+
// This ensures the module constructor completes successfully for React Native
|
|
25
|
+
private val impl: RejourneyModuleImpl by lazy {
|
|
26
|
+
try {
|
|
27
|
+
RejourneyModuleImpl(reactContext, isNewArchitecture = false)
|
|
28
|
+
} catch (e: Throwable) {
|
|
29
|
+
DiagnosticLog.fault("✗ CRITICAL: Failed to create RejourneyModuleImpl: ${e.message}")
|
|
30
|
+
throw e // Re-throw to make the error visible
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun getName(): String = NAME
|
|
35
|
+
|
|
36
|
+
override fun invalidate() {
|
|
37
|
+
impl?.invalidate()
|
|
38
|
+
super.invalidate()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@ReactMethod
|
|
42
|
+
fun startSession(userId: String, apiUrl: String, publicKey: String, promise: Promise) {
|
|
43
|
+
try {
|
|
44
|
+
impl.startSession(userId, apiUrl, publicKey, promise)
|
|
45
|
+
} catch (e: Exception) {
|
|
46
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@ReactMethod
|
|
51
|
+
fun stopSession(promise: Promise) {
|
|
52
|
+
try {
|
|
53
|
+
impl.stopSession(promise)
|
|
54
|
+
} catch (e: Exception) {
|
|
55
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@ReactMethod
|
|
60
|
+
fun logEvent(eventType: String, details: ReadableMap, promise: Promise) {
|
|
61
|
+
try {
|
|
62
|
+
impl.logEvent(eventType, details, promise)
|
|
63
|
+
} catch (e: Exception) {
|
|
64
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@ReactMethod
|
|
69
|
+
fun screenChanged(screenName: String, promise: Promise) {
|
|
70
|
+
try {
|
|
71
|
+
impl.screenChanged(screenName, promise)
|
|
72
|
+
} catch (e: Exception) {
|
|
73
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@ReactMethod
|
|
78
|
+
fun onScroll(offsetY: Double, promise: Promise) {
|
|
79
|
+
try {
|
|
80
|
+
impl.onScroll(offsetY, promise)
|
|
81
|
+
} catch (e: Exception) {
|
|
82
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@ReactMethod
|
|
87
|
+
fun markVisualChange(reason: String, importance: String, promise: Promise) {
|
|
88
|
+
try {
|
|
89
|
+
impl.markVisualChange(reason, importance, promise)
|
|
90
|
+
} catch (e: Exception) {
|
|
91
|
+
promise.resolve(false)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@ReactMethod
|
|
96
|
+
fun onExternalURLOpened(urlScheme: String, promise: Promise) {
|
|
97
|
+
try {
|
|
98
|
+
impl.onExternalURLOpened(urlScheme, promise)
|
|
99
|
+
} catch (e: Exception) {
|
|
100
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@ReactMethod
|
|
105
|
+
fun onOAuthStarted(provider: String, promise: Promise) {
|
|
106
|
+
try {
|
|
107
|
+
impl.onOAuthStarted(provider, promise)
|
|
108
|
+
} catch (e: Exception) {
|
|
109
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@ReactMethod
|
|
114
|
+
fun onOAuthCompleted(provider: String, success: Boolean, promise: Promise) {
|
|
115
|
+
try {
|
|
116
|
+
impl.onOAuthCompleted(provider, success, promise)
|
|
117
|
+
} catch (e: Exception) {
|
|
118
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@ReactMethod
|
|
123
|
+
fun getSDKMetrics(promise: Promise) {
|
|
124
|
+
try {
|
|
125
|
+
impl.getSDKMetrics(promise)
|
|
126
|
+
} catch (e: Exception) {
|
|
127
|
+
promise.resolve(Arguments.createMap())
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@ReactMethod
|
|
132
|
+
fun getDeviceInfo(promise: Promise) {
|
|
133
|
+
try {
|
|
134
|
+
impl.getDeviceInfo(promise)
|
|
135
|
+
} catch (e: Exception) {
|
|
136
|
+
promise.resolve(Arguments.createMap())
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@ReactMethod
|
|
141
|
+
fun debugCrash() {
|
|
142
|
+
try {
|
|
143
|
+
impl.debugCrash()
|
|
144
|
+
} catch (e: Exception) {
|
|
145
|
+
DiagnosticLog.fault("debugCrash failed: ${e.message}")
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@ReactMethod
|
|
150
|
+
fun debugTriggerANR(durationMs: Double) {
|
|
151
|
+
try {
|
|
152
|
+
impl.debugTriggerANR(durationMs)
|
|
153
|
+
} catch (e: Exception) {
|
|
154
|
+
DiagnosticLog.fault("debugTriggerANR failed: ${e.message}")
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@ReactMethod
|
|
159
|
+
fun getSessionId(promise: Promise) {
|
|
160
|
+
try {
|
|
161
|
+
impl.getSessionId(promise)
|
|
162
|
+
} catch (e: Exception) {
|
|
163
|
+
promise.resolve(null)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@ReactMethod
|
|
168
|
+
fun maskViewByNativeID(nativeID: String, promise: Promise) {
|
|
169
|
+
try {
|
|
170
|
+
impl.maskViewByNativeID(nativeID, promise)
|
|
171
|
+
} catch (e: Exception) {
|
|
172
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@ReactMethod
|
|
177
|
+
fun unmaskViewByNativeID(nativeID: String, promise: Promise) {
|
|
178
|
+
try {
|
|
179
|
+
impl.unmaskViewByNativeID(nativeID, promise)
|
|
180
|
+
} catch (e: Exception) {
|
|
181
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@ReactMethod
|
|
186
|
+
fun setUserIdentity(userId: String, promise: Promise) {
|
|
187
|
+
try {
|
|
188
|
+
impl.setUserIdentity(userId, promise)
|
|
189
|
+
} catch (e: Exception) {
|
|
190
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@ReactMethod
|
|
195
|
+
fun setDebugMode(enabled: Boolean, promise: Promise) {
|
|
196
|
+
try {
|
|
197
|
+
impl.setDebugMode(enabled, promise)
|
|
198
|
+
} catch (e: Exception) {
|
|
199
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@ReactMethod
|
|
204
|
+
fun setRemoteConfig(
|
|
205
|
+
rejourneyEnabled: Boolean,
|
|
206
|
+
recordingEnabled: Boolean,
|
|
207
|
+
sampleRate: Double,
|
|
208
|
+
maxRecordingMinutes: Double,
|
|
209
|
+
promise: Promise
|
|
210
|
+
) {
|
|
211
|
+
try {
|
|
212
|
+
impl.setRemoteConfig(rejourneyEnabled, recordingEnabled, sampleRate, maxRecordingMinutes, promise)
|
|
213
|
+
} catch (e: Exception) {
|
|
214
|
+
promise.resolve(createErrorMap("Module initialization failed: ${e.message}"))
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@ReactMethod
|
|
219
|
+
fun getUserIdentity(promise: Promise) {
|
|
220
|
+
try {
|
|
221
|
+
impl.getUserIdentity(promise)
|
|
222
|
+
} catch (e: Exception) {
|
|
223
|
+
promise.resolve(null)
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@ReactMethod
|
|
228
|
+
fun setSDKVersion(version: String) {
|
|
229
|
+
try {
|
|
230
|
+
impl.setSDKVersion(version)
|
|
231
|
+
} catch (_: Exception) {}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@ReactMethod
|
|
235
|
+
fun setLogLevel(level: String, promise: Promise) {
|
|
236
|
+
try {
|
|
237
|
+
val minLevel = when (level.uppercase()) {
|
|
238
|
+
"DEBUG", "TRACE" -> 0
|
|
239
|
+
"INFO", "NOTICE" -> 1
|
|
240
|
+
"WARNING", "CAUTION" -> 2
|
|
241
|
+
"ERROR", "FAULT" -> 3
|
|
242
|
+
"SILENT" -> 4
|
|
243
|
+
else -> 3
|
|
244
|
+
}
|
|
245
|
+
DiagnosticLog.minimumLevel = minLevel
|
|
246
|
+
promise.resolve(true)
|
|
247
|
+
} catch (e: Exception) {
|
|
248
|
+
promise.resolve(false)
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
private fun createErrorMap(error: String): WritableMap {
|
|
253
|
+
return Arguments.createMap().apply {
|
|
254
|
+
putBoolean("success", false)
|
|
255
|
+
putString("error", error)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
@ReactMethod
|
|
260
|
+
fun addListener(eventName: String) {
|
|
261
|
+
try { impl.addListener(eventName) } catch (_: Exception) {}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
@ReactMethod
|
|
265
|
+
fun removeListeners(count: Double) {
|
|
266
|
+
try { impl.removeListeners(count) } catch (_: Exception) {}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Old Architecture (Bridge) package registration for Rejourney SDK.
|
|
3
|
+
*
|
|
4
|
+
* This package is compiled when newArchEnabled=false in gradle.properties.
|
|
5
|
+
* It uses the standard ReactPackage interface for legacy Native Modules.
|
|
6
|
+
*/
|
|
7
|
+
package com.rejourney
|
|
8
|
+
|
|
9
|
+
import com.facebook.react.ReactPackage
|
|
10
|
+
import com.facebook.react.bridge.NativeModule
|
|
11
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
12
|
+
import com.facebook.react.uimanager.ViewManager
|
|
13
|
+
|
|
14
|
+
class RejourneyPackage : ReactPackage {
|
|
15
|
+
|
|
16
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
17
|
+
return listOf(RejourneyModule(reactContext))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
21
|
+
return emptyList()
|
|
22
|
+
}
|
|
23
|
+
}
|