@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,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Rejourney
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import UIKit
|
|
18
|
+
|
|
19
|
+
@objc public class ViewHierarchyScanner: NSObject {
|
|
20
|
+
|
|
21
|
+
@objc public static let shared = ViewHierarchyScanner()
|
|
22
|
+
@objc public var maxDepth: Int = 12
|
|
23
|
+
@objc public var includeTextContent: Bool = true
|
|
24
|
+
@objc public var includeVisualProperties: Bool = true
|
|
25
|
+
|
|
26
|
+
private let _timeBudgetNs: UInt64 = 16_000_000
|
|
27
|
+
|
|
28
|
+
private override init() {
|
|
29
|
+
super.init()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@objc public func captureHierarchy() -> [String: Any]? {
|
|
33
|
+
guard let w = _keyWindow() else { return nil }
|
|
34
|
+
// Only serialize the key window — skip keyboard/system windows
|
|
35
|
+
// whose internal views produce NaN frames during transition
|
|
36
|
+
return serializeWindow(w)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@objc public func serializeWindow(_ window: UIWindow) -> [String: Any] {
|
|
40
|
+
let ts = Int64(Date().timeIntervalSince1970 * 1000)
|
|
41
|
+
let scale = window.screen.scale
|
|
42
|
+
let bounds = window.bounds
|
|
43
|
+
let start = DispatchTime.now().uptimeNanoseconds
|
|
44
|
+
let root = _serializeView(window, depth: 0, start: start)
|
|
45
|
+
|
|
46
|
+
var result: [String: Any] = [
|
|
47
|
+
"timestamp": ts,
|
|
48
|
+
"screen": ["width": bounds.width, "height": bounds.height, "scale": scale],
|
|
49
|
+
"root": root ?? [:]
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
if let sn = ReplayOrchestrator.shared.currentScreenName {
|
|
53
|
+
result["screenName"] = sn
|
|
54
|
+
}
|
|
55
|
+
return result
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private func _keyWindow() -> UIWindow? {
|
|
59
|
+
if #available(iOS 15.0, *) {
|
|
60
|
+
return UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.flatMap { $0.windows }.first { $0.isKeyWindow }
|
|
61
|
+
} else {
|
|
62
|
+
return UIApplication.shared.windows.first { $0.isKeyWindow }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private func _serializeView(_ view: UIView, depth: Int, start: UInt64) -> [String: Any]? {
|
|
67
|
+
if depth > maxDepth { return nil }
|
|
68
|
+
if (DispatchTime.now().uptimeNanoseconds - start) > _timeBudgetNs { return ["type": _typeName(view), "bailout": true] }
|
|
69
|
+
if depth > 0 && (view.isHidden || view.alpha <= 0.01 || view.bounds.width <= 0 || view.bounds.height <= 0) { return nil }
|
|
70
|
+
|
|
71
|
+
// Skip keyboard/system windows to avoid NaN frames during keyboard transitions
|
|
72
|
+
let className = _typeName(view)
|
|
73
|
+
if className.contains("UIRemoteKeyboardWindow") ||
|
|
74
|
+
className.contains("UITextEffectsWindow") ||
|
|
75
|
+
className.contains("UIInputSetHostView") ||
|
|
76
|
+
className.contains("UIKeyboard") {
|
|
77
|
+
return nil
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var node: [String: Any] = [:]
|
|
81
|
+
node["type"] = className
|
|
82
|
+
|
|
83
|
+
// Guard frame values against NaN / Inf — keyboard and animated views
|
|
84
|
+
// can have degenerate frames that poison downstream JSON serialization
|
|
85
|
+
let f = view.frame
|
|
86
|
+
let fx = f.origin.x.isFinite && !f.origin.x.isNaN ? f.origin.x : 0
|
|
87
|
+
let fy = f.origin.y.isFinite && !f.origin.y.isNaN ? f.origin.y : 0
|
|
88
|
+
let fw = f.width.isFinite && !f.width.isNaN ? f.width : 0
|
|
89
|
+
let fh = f.height.isFinite && !f.height.isNaN ? f.height : 0
|
|
90
|
+
node["frame"] = ["x": fx, "y": fy, "w": fw, "h": fh]
|
|
91
|
+
|
|
92
|
+
if view.isHidden { node["hidden"] = true }
|
|
93
|
+
if view.alpha < 1.0 { node["alpha"] = view.alpha }
|
|
94
|
+
if let aid = view.accessibilityIdentifier, !aid.isEmpty { node["testID"] = aid }
|
|
95
|
+
if let lbl = view.accessibilityLabel, !lbl.isEmpty { node["label"] = lbl }
|
|
96
|
+
if _isSensitive(view) { node["masked"] = true }
|
|
97
|
+
|
|
98
|
+
if includeVisualProperties, let bg = view.backgroundColor, bg != .clear { node["bg"] = _hexColor(bg) }
|
|
99
|
+
|
|
100
|
+
if includeTextContent {
|
|
101
|
+
if let tv = view as? UITextView { node["text"] = _mask(tv.text ?? ""); node["textLength"] = tv.text?.count ?? 0 }
|
|
102
|
+
else if let lb = view as? UILabel { node["text"] = _mask(lb.text ?? ""); node["textLength"] = lb.text?.count ?? 0 }
|
|
103
|
+
else if let tf = view as? UITextField { node["text"] = "***"; node["textLength"] = tf.text?.count ?? 0; node["placeholder"] = tf.placeholder }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if _isInteractive(view) {
|
|
107
|
+
node["interactive"] = true
|
|
108
|
+
if let btn = view as? UIButton { if let t = btn.title(for: .normal) { node["buttonTitle"] = t }; node["enabled"] = btn.isEnabled }
|
|
109
|
+
if let ctrl = view as? UIControl { node["enabled"] = ctrl.isEnabled }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if let sv = view as? UIScrollView {
|
|
113
|
+
node["scrollEnabled"] = sv.isScrollEnabled
|
|
114
|
+
let ox = sv.contentOffset.x.isFinite && !sv.contentOffset.x.isNaN ? sv.contentOffset.x : 0
|
|
115
|
+
let oy = sv.contentOffset.y.isFinite && !sv.contentOffset.y.isNaN ? sv.contentOffset.y : 0
|
|
116
|
+
let cw = sv.contentSize.width.isFinite && !sv.contentSize.width.isNaN ? sv.contentSize.width : 0
|
|
117
|
+
let ch = sv.contentSize.height.isFinite && !sv.contentSize.height.isNaN ? sv.contentSize.height : 0
|
|
118
|
+
node["contentOffset"] = ["x": ox, "y": oy]
|
|
119
|
+
node["contentSize"] = ["w": cw, "h": ch]
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if view is UIImageView { node["hasImage"] = true }
|
|
123
|
+
|
|
124
|
+
let subs = view.subviews.filter { !$0.isHidden && $0.alpha > 0.01 }
|
|
125
|
+
if !subs.isEmpty {
|
|
126
|
+
var children: [[String: Any]] = []
|
|
127
|
+
for s in subs {
|
|
128
|
+
if let cn = _serializeView(s, depth: depth + 1, start: start) { children.append(cn) }
|
|
129
|
+
}
|
|
130
|
+
if !children.isEmpty { node["children"] = children }
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return node
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private func _typeName(_ v: UIView) -> String { String(describing: type(of: v)) }
|
|
137
|
+
|
|
138
|
+
private func _isSensitive(_ v: UIView) -> Bool {
|
|
139
|
+
if let tf = v as? UITextField, tf.isSecureTextEntry { return true }
|
|
140
|
+
return false
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private func _isInteractive(_ v: UIView) -> Bool {
|
|
144
|
+
v is UIButton || v is UIControl || v is UITextField || v is UITextView
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private func _mask(_ text: String) -> String {
|
|
148
|
+
text.count > 100 ? String(text.prefix(100)) + "..." : text
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private func _hexColor(_ c: UIColor) -> String {
|
|
152
|
+
var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0
|
|
153
|
+
c.getRed(&r, green: &g, blue: &b, alpha: &a)
|
|
154
|
+
return String(format: "#%02X%02X%02X", Int(r * 255), Int(g * 255), Int(b * 255))
|
|
155
|
+
}
|
|
156
|
+
}
|