@oodle-ai/mobile-sdk-reactnative 0.0.0-stage → 0.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.
- package/LICENSE +201 -0
- package/OodleMobileSdkReactNative.podspec +24 -0
- package/README.md +191 -2
- package/android/build.gradle +55 -0
- package/android/proguard-rules.pro +5 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/ai/oodle/rum/Connectivity.kt +19 -0
- package/android/src/main/java/ai/oodle/rum/CrashReporter.kt +88 -0
- package/android/src/main/java/ai/oodle/rum/DeviceInfo.kt +50 -0
- package/android/src/main/java/ai/oodle/rum/ExitReasons.kt +104 -0
- package/android/src/main/java/ai/oodle/rum/NativeEvents.kt +24 -0
- package/android/src/main/java/ai/oodle/rum/OodleRumModule.kt +96 -0
- package/android/src/main/java/ai/oodle/rum/OodleRumPackage.kt +26 -0
- package/android/src/main/java/ai/oodle/rum/Storage.kt +84 -0
- package/android/src/main/java/ai/oodle/rum/Vitals.kt +188 -0
- package/android/src/main/java/ai/oodle/rum/Watchdog.kt +81 -0
- package/android/src/main/java/ai/oodle/rum/WireframeCapture.kt +398 -0
- package/bin/oodle-rum-upload.mjs +104 -0
- package/ios/OodleCrashReporter.h +16 -0
- package/ios/OodleCrashReporter.m +202 -0
- package/ios/OodleRum.h +18 -0
- package/ios/OodleRum.mm +129 -0
- package/ios/OodleRumImpl.swift +450 -0
- package/ios/WireframeWalker.swift +279 -0
- package/lib/core/clock.d.ts +19 -0
- package/lib/core/clock.js +47 -0
- package/lib/core/clock.js.map +1 -0
- package/lib/core/config.d.ts +142 -0
- package/lib/core/config.js +178 -0
- package/lib/core/config.js.map +1 -0
- package/lib/core/consent.d.ts +5 -0
- package/lib/core/consent.js +33 -0
- package/lib/core/consent.js.map +1 -0
- package/lib/core/context.d.ts +36 -0
- package/lib/core/context.js +172 -0
- package/lib/core/context.js.map +1 -0
- package/lib/core/flags.d.ts +3 -0
- package/lib/core/flags.js +20 -0
- package/lib/core/flags.js.map +1 -0
- package/lib/core/ids.d.ts +7 -0
- package/lib/core/ids.js +40 -0
- package/lib/core/ids.js.map +1 -0
- package/lib/core/internal.d.ts +6 -0
- package/lib/core/internal.js +10 -0
- package/lib/core/internal.js.map +1 -0
- package/lib/core/logger.d.ts +8 -0
- package/lib/core/logger.js +38 -0
- package/lib/core/logger.js.map +1 -0
- package/lib/core/native.d.ts +71 -0
- package/lib/core/native.js +156 -0
- package/lib/core/native.js.map +1 -0
- package/lib/core/rate-limiter.d.ts +7 -0
- package/lib/core/rate-limiter.js +31 -0
- package/lib/core/rate-limiter.js.map +1 -0
- package/lib/core/session.d.ts +51 -0
- package/lib/core/session.js +196 -0
- package/lib/core/session.js.map +1 -0
- package/lib/core/size.d.ts +15 -0
- package/lib/core/size.js +68 -0
- package/lib/core/size.js.map +1 -0
- package/lib/core/tags.d.ts +10 -0
- package/lib/core/tags.js +33 -0
- package/lib/core/tags.js.map +1 -0
- package/lib/core/telemetry.d.ts +6 -0
- package/lib/core/telemetry.js +37 -0
- package/lib/core/telemetry.js.map +1 -0
- package/lib/core/tracing.d.ts +9 -0
- package/lib/core/tracing.js +57 -0
- package/lib/core/tracing.js.map +1 -0
- package/lib/core/transport.d.ts +76 -0
- package/lib/core/transport.js +560 -0
- package/lib/core/transport.js.map +1 -0
- package/lib/core/user.d.ts +12 -0
- package/lib/core/user.js +41 -0
- package/lib/core/user.js.map +1 -0
- package/lib/events/actions.d.ts +13 -0
- package/lib/events/actions.js +147 -0
- package/lib/events/actions.js.map +1 -0
- package/lib/events/emit.d.ts +21 -0
- package/lib/events/emit.js +144 -0
- package/lib/events/emit.js.map +1 -0
- package/lib/events/errors.d.ts +19 -0
- package/lib/events/errors.js +257 -0
- package/lib/events/errors.js.map +1 -0
- package/lib/events/lifecycle.d.ts +7 -0
- package/lib/events/lifecycle.js +101 -0
- package/lib/events/lifecycle.js.map +1 -0
- package/lib/events/longtasks.d.ts +2 -0
- package/lib/events/longtasks.js +42 -0
- package/lib/events/longtasks.js.map +1 -0
- package/lib/events/resources.d.ts +15 -0
- package/lib/events/resources.js +156 -0
- package/lib/events/resources.js.map +1 -0
- package/lib/events/tap-target.d.ts +42 -0
- package/lib/events/tap-target.js +191 -0
- package/lib/events/tap-target.js.map +1 -0
- package/lib/events/view-state.d.ts +13 -0
- package/lib/events/view-state.js +25 -0
- package/lib/events/view-state.js.map +1 -0
- package/lib/events/views.d.ts +21 -0
- package/lib/events/views.js +347 -0
- package/lib/events/views.js.map +1 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +24 -0
- package/lib/index.js.map +1 -0
- package/lib/navigation/react-navigation.d.ts +33 -0
- package/lib/navigation/react-navigation.js +61 -0
- package/lib/navigation/react-navigation.js.map +1 -0
- package/lib/react/OodlePrivacy.d.ts +15 -0
- package/lib/react/OodlePrivacy.js +13 -0
- package/lib/react/OodlePrivacy.js.map +1 -0
- package/lib/react/OodleProvider.d.ts +18 -0
- package/lib/react/OodleProvider.js +72 -0
- package/lib/react/OodleProvider.js.map +1 -0
- package/lib/replay/recorder.d.ts +22 -0
- package/lib/replay/recorder.js +317 -0
- package/lib/replay/recorder.js.map +1 -0
- package/lib/replay/rrweb.d.ts +105 -0
- package/lib/replay/rrweb.js +335 -0
- package/lib/replay/rrweb.js.map +1 -0
- package/lib/rum.d.ts +52 -0
- package/lib/rum.js +281 -0
- package/lib/rum.js.map +1 -0
- package/lib/specs/NativeOodleRum.d.ts +43 -0
- package/lib/specs/NativeOodleRum.js +5 -0
- package/lib/specs/NativeOodleRum.js.map +1 -0
- package/lib/version.d.ts +1 -0
- package/lib/version.js +6 -0
- package/lib/version.js.map +1 -0
- package/package.json +91 -4
- package/react-native.config.js +10 -0
- package/src/core/clock.ts +43 -0
- package/src/core/config.ts +344 -0
- package/src/core/consent.ts +32 -0
- package/src/core/context.ts +189 -0
- package/src/core/flags.ts +15 -0
- package/src/core/ids.ts +35 -0
- package/src/core/internal.ts +6 -0
- package/src/core/logger.ts +37 -0
- package/src/core/native.ts +201 -0
- package/src/core/rate-limiter.ts +34 -0
- package/src/core/session.ts +209 -0
- package/src/core/size.ts +79 -0
- package/src/core/tags.ts +30 -0
- package/src/core/telemetry.ts +35 -0
- package/src/core/tracing.ts +60 -0
- package/src/core/transport.ts +590 -0
- package/src/core/user.ts +45 -0
- package/src/events/actions.ts +157 -0
- package/src/events/emit.ts +131 -0
- package/src/events/errors.ts +283 -0
- package/src/events/lifecycle.ts +102 -0
- package/src/events/longtasks.ts +40 -0
- package/src/events/resources.ts +167 -0
- package/src/events/tap-target.ts +210 -0
- package/src/events/view-state.ts +30 -0
- package/src/events/views.ts +356 -0
- package/src/index.ts +34 -0
- package/src/navigation/react-navigation.ts +72 -0
- package/src/react/OodlePrivacy.tsx +25 -0
- package/src/react/OodleProvider.tsx +88 -0
- package/src/replay/recorder.ts +310 -0
- package/src/replay/rrweb.ts +460 -0
- package/src/rum.ts +295 -0
- package/src/specs/NativeOodleRum.ts +51 -0
- package/src/version.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "OodleMobileSdkReactNative"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
s.platforms = { :ios => "15.1" }
|
|
13
|
+
s.source = { :git => package["repository"]["url"], :tag => "v#{s.version}" }
|
|
14
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
15
|
+
s.swift_version = "5.9"
|
|
16
|
+
s.frameworks = "UIKit", "Network", "QuartzCore"
|
|
17
|
+
# The ObjC++ module imports the generated Swift header.
|
|
18
|
+
s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES" }
|
|
19
|
+
# The module glue imports C++ headers, so it stays out of the module
|
|
20
|
+
# that Swift imports.
|
|
21
|
+
s.private_header_files = "ios/OodleRum.h"
|
|
22
|
+
|
|
23
|
+
install_modules_dependencies(s)
|
|
24
|
+
end
|
package/README.md
CHANGED
|
@@ -1,3 +1,192 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @oodle-ai/mobile-sdk-reactnative
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Real User Monitoring for React Native apps on [Oodle](https://oodle.ai).
|
|
4
|
+
It records screen views, taps, network requests, errors, native crashes,
|
|
5
|
+
ANRs and app hangs, native vitals, and session replays. The data goes to
|
|
6
|
+
the same RUM Explorer, Issues and Session Replay pages as the browser SDK
|
|
7
|
+
([`@oodle-ai/rum`](https://github.com/oodle-ai/browser-sdk)).
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- React Native 0.79 or later, New Architecture.
|
|
12
|
+
- Expo: a development or release build (`expo prebuild`). Expo Go cannot
|
|
13
|
+
load native code.
|
|
14
|
+
- A RUM API key from **Settings > API Keys** (RUM role). The key can only
|
|
15
|
+
write RUM data, so it is safe in an app.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @oodle-ai/mobile-sdk-reactnative
|
|
21
|
+
cd ios && pod install # bare React Native; Expo prebuild links it
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Build the app again after you install the package.
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import {
|
|
30
|
+
NavigationContainer,
|
|
31
|
+
useNavigationContainerRef,
|
|
32
|
+
} from '@react-navigation/native';
|
|
33
|
+
import {
|
|
34
|
+
OodleProvider,
|
|
35
|
+
useOodleNavigationTracking,
|
|
36
|
+
} from '@oodle-ai/mobile-sdk-reactnative';
|
|
37
|
+
|
|
38
|
+
const config = {
|
|
39
|
+
instanceId: '<OODLE_INSTANCE_ID>',
|
|
40
|
+
apiKey: '<OODLE_RUM_API_KEY>',
|
|
41
|
+
endpoint: 'https://<COLLECTOR_DOMAIN>',
|
|
42
|
+
service: 'my-app',
|
|
43
|
+
env: 'production',
|
|
44
|
+
allowedTracingUrls: ['api.example.com'],
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default function App() {
|
|
48
|
+
const navigationRef = useNavigationContainerRef();
|
|
49
|
+
useOodleNavigationTracking(navigationRef);
|
|
50
|
+
return (
|
|
51
|
+
<OodleProvider config={config}>
|
|
52
|
+
<NavigationContainer ref={navigationRef}>{/* screens */}</NavigationContainer>
|
|
53
|
+
</OodleProvider>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`OodleProvider` starts the SDK during the first render and records taps.
|
|
59
|
+
To start it later (for example after consent), call `OodleRum.init(config)`
|
|
60
|
+
yourself and render `<OodleProvider>` without `config`. Every other method
|
|
61
|
+
is safe to call before `init()`: calls made before it run once it does.
|
|
62
|
+
|
|
63
|
+
## API
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { OodleRum, OodleSessionReplay, OodlePrivacy } from '@oodle-ai/mobile-sdk-reactnative';
|
|
67
|
+
|
|
68
|
+
OodleRum.init(config): boolean
|
|
69
|
+
OodleRum.startView(key, name?, attributes?) // a screen
|
|
70
|
+
OodleRum.stopView(key?)
|
|
71
|
+
OodleRum.reportViewLoaded() // the screen has its data
|
|
72
|
+
OodleRum.reportAppFullyDisplayed() // first screen has its data (cold start)
|
|
73
|
+
OodleRum.addAction(name, attributes?)
|
|
74
|
+
OodleRum.addError(error, attributes?)
|
|
75
|
+
OodleRum.addTiming(name) // time since the view started
|
|
76
|
+
OodleRum.trackEvent(name, properties?)
|
|
77
|
+
OodleRum.startOperation(name, key?)
|
|
78
|
+
OodleRum.succeedOperation(name, key?, attributes?)
|
|
79
|
+
OodleRum.failOperation(name, key?, reason?, attributes?)
|
|
80
|
+
OodleRum.setUser({ id, name?, email?, ...extra }) // extra keys become usr.<key> tags
|
|
81
|
+
OodleRum.clearUser()
|
|
82
|
+
OodleRum.setTags(tags) / OodleRum.removeTag(key)
|
|
83
|
+
OodleRum.addFeatureFlag(name, value)
|
|
84
|
+
OodleRum.setTrackingConsent('granted' | 'pending' | 'not-granted')
|
|
85
|
+
OodleRum.stopSession()
|
|
86
|
+
OodleRum.getSessionId(): string
|
|
87
|
+
OodleRum.flush()
|
|
88
|
+
|
|
89
|
+
OodleSessionReplay.start() / .stop() / .isRecording()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Configuration
|
|
93
|
+
|
|
94
|
+
| Option | Default | Description |
|
|
95
|
+
|--------|---------|-------------|
|
|
96
|
+
| `instanceId`, `apiKey`, `endpoint`, `service` | required | Where and as what the data is sent |
|
|
97
|
+
| `env` | `''` | Environment |
|
|
98
|
+
| `version`, `build` | native values | App version and build number |
|
|
99
|
+
| `trackingConsent` | `'granted'` | `'pending'` keeps events on the device until `'granted'` |
|
|
100
|
+
| `sessionSampleRate` | `100` | Percentage of sessions recorded |
|
|
101
|
+
| `trackInteractions` | `true` | Taps, through `OodleProvider` |
|
|
102
|
+
| `useAccessibilityLabel` | `true` | Name taps by `accessibilityLabel` |
|
|
103
|
+
| `actionNameAttribute` | `'oodle-action-name'` | Prop that names a tap |
|
|
104
|
+
| `trackResources` | `true` | XHR and fetch (React Native's fetch runs on XHR) |
|
|
105
|
+
| `trackErrors` | `true` | Global JS errors and unhandled promise rejections |
|
|
106
|
+
| `trackConsole` | `true` | `console.error` and `console.warn` |
|
|
107
|
+
| `allowedTracingUrls` | `[]` | Hosts, URL prefixes, RegExps or functions; `{ match, propagators }` picks `tracecontext`, `b3`, `b3multi`, `datadog` |
|
|
108
|
+
| `traceSampleRate` | `100` | Percentage of traced requests marked as sampled |
|
|
109
|
+
| `nativeCrashReporting` | `true` | JVM exceptions (Android), NSExceptions and fatal signals (iOS) |
|
|
110
|
+
| `trackAnrs` / `anrThresholdMs` | `true` / 5000 Android, 2000 iOS | Main thread watchdog |
|
|
111
|
+
| `longTaskThresholdMs` | `200` | JS thread block that counts as a long task, or `false` |
|
|
112
|
+
| `vitals` | `true` | Refresh rate, slow and frozen frames, memory, CPU per view |
|
|
113
|
+
| `tags` | none | Tags on every event |
|
|
114
|
+
| `sessionReplay` | on, `sampleRate: 10` | `false`, or `{ sampleRate, textAndInputPrivacy, touchPrivacy, startRecordingImmediately }`. `sampleRate` is the percentage of sampled sessions that record a replay |
|
|
115
|
+
| `flushIntervalMs` | `5000` | Batch interval |
|
|
116
|
+
| `beforeSend` | none | Change an event, or return `null` to drop it |
|
|
117
|
+
| `verbosity` | `'warn'` | SDK log level |
|
|
118
|
+
|
|
119
|
+
## Readable stack traces
|
|
120
|
+
|
|
121
|
+
Release builds have minified JS and, with R8, renamed Java classes.
|
|
122
|
+
Upload the source map and the R8 mapping after each release build, with
|
|
123
|
+
the version and build number that the app sends. Oodle then shows
|
|
124
|
+
errors and crashes with source file names and lines.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
export OODLE_API_URL=https://<API_DOMAIN> OODLE_INSTANCE=<INSTANCE_ID> OODLE_API_KEY=<API_KEY>
|
|
128
|
+
|
|
129
|
+
# Android
|
|
130
|
+
npx oodle-rum-upload --service my-app --version 1.4.0 --build 112 \
|
|
131
|
+
--sourcemap android/app/build/generated/sourcemaps/react/release/index.android.bundle.map \
|
|
132
|
+
--bundle index.android.bundle
|
|
133
|
+
npx oodle-rum-upload --service my-app --version 1.4.0 --build 112 \
|
|
134
|
+
--r8-mapping android/app/build/outputs/mapping/release/mapping.txt
|
|
135
|
+
|
|
136
|
+
# iOS: add `export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"`
|
|
137
|
+
# to the "Bundle React Native code and images" build phase first.
|
|
138
|
+
npx oodle-rum-upload --service my-app --version 1.4.0 --build 112 \
|
|
139
|
+
--sourcemap "$DERIVED_FILE_DIR/main.jsbundle.map" --bundle main.jsbundle
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The API key must be able to change RUM settings. Do not use the RUM key
|
|
143
|
+
that is in the app.
|
|
144
|
+
|
|
145
|
+
## Session replay
|
|
146
|
+
|
|
147
|
+
Native code walks the view tree and describes each view as a wireframe
|
|
148
|
+
(position, colors, border, text). The SDK turns the wireframes into
|
|
149
|
+
[rrweb](https://github.com/rrweb-io/rrweb) events: one absolutely
|
|
150
|
+
positioned element per view, a full snapshot first and mutations after
|
|
151
|
+
it. The Oodle replay player plays them as it plays browser sessions.
|
|
152
|
+
|
|
153
|
+
- `textAndInputPrivacy`: `'mask-sensitive-inputs'`, `'mask-all-inputs'`
|
|
154
|
+
(default) or `'mask-all'`. Passwords, emails and phone numbers are
|
|
155
|
+
masked at every level.
|
|
156
|
+
- Images are recorded as gray boxes.
|
|
157
|
+
- `<OodlePrivacy level="hidden" | "mask" | "allow">` sets the privacy of
|
|
158
|
+
one subtree.
|
|
159
|
+
- `touchPrivacy: 'hide'` leaves touches out.
|
|
160
|
+
|
|
161
|
+
## How it works
|
|
162
|
+
|
|
163
|
+
| Part | Where |
|
|
164
|
+
|------|-------|
|
|
165
|
+
| Sessions, views, taps, requests, errors, batching, offline queue, rrweb conversion | TypeScript (`src/`) |
|
|
166
|
+
| Device facts, file storage, crash capture, watchdog, frame/memory/CPU vitals, connectivity, view tree walk | Native module `OodleRum` (`android/`, `ios/`) |
|
|
167
|
+
|
|
168
|
+
Data goes to `POST <endpoint>/v1/rum/ingest` as a gzip NDJSON envelope,
|
|
169
|
+
the same protocol as the browser SDK. Unsent data is written to the
|
|
170
|
+
device when the app goes to the background or a send fails, and is sent
|
|
171
|
+
on the next start. A native crash is written to disk when it happens and
|
|
172
|
+
sent on the next start, on the session it ended.
|
|
173
|
+
|
|
174
|
+
Without the native module (Expo Go, web, Jest) the SDK runs from
|
|
175
|
+
TypeScript alone, without replay, crash capture and vitals.
|
|
176
|
+
|
|
177
|
+
## Develop
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
pnpm install
|
|
181
|
+
pnpm typecheck
|
|
182
|
+
pnpm test
|
|
183
|
+
pnpm mock-collector # a local collector on :4318 that writes what it receives
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Point an emulator at the mock collector with
|
|
187
|
+
`endpoint: 'http://10.0.2.2:4318'` (Android) or `'http://localhost:4318'`
|
|
188
|
+
(iOS simulator). Plain HTTP is accepted only for local and private hosts.
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
Apache-2.0
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
repositories {
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
def getExtOrDefault(name, defaultValue) {
|
|
9
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : defaultValue
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
apply plugin: "com.android.library"
|
|
13
|
+
// AGP 9 can ship Kotlin support itself and registers the `kotlin`
|
|
14
|
+
// extension. Applying the Kotlin plugin again fails configuration.
|
|
15
|
+
if (project.extensions.findByName("kotlin") == null) {
|
|
16
|
+
apply plugin: "kotlin-android"
|
|
17
|
+
}
|
|
18
|
+
// Runs codegen for src/specs, which generates NativeOodleRumSpec.
|
|
19
|
+
apply plugin: "com.facebook.react"
|
|
20
|
+
|
|
21
|
+
android {
|
|
22
|
+
namespace "ai.oodle.rum"
|
|
23
|
+
compileSdkVersion getExtOrDefault("compileSdkVersion", 35)
|
|
24
|
+
|
|
25
|
+
defaultConfig {
|
|
26
|
+
minSdkVersion getExtOrDefault("minSdkVersion", 24)
|
|
27
|
+
targetSdkVersion getExtOrDefault("targetSdkVersion", 35)
|
|
28
|
+
consumerProguardFiles "proguard-rules.pro"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
buildTypes {
|
|
32
|
+
release {
|
|
33
|
+
minifyEnabled false
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
lintOptions {
|
|
38
|
+
abortOnError false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
react {
|
|
43
|
+
jsRootDir = file("../src/")
|
|
44
|
+
libraryName = "OodleRumSpec"
|
|
45
|
+
codegenJavaPackageName = "ai.oodle.rum"
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
repositories {
|
|
49
|
+
google()
|
|
50
|
+
mavenCentral()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
dependencies {
|
|
54
|
+
implementation "com.facebook.react:react-android"
|
|
55
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# React Native calls the TurboModule methods by name from C++, and the SDK
|
|
2
|
+
# reads some React Native classes by reflection.
|
|
3
|
+
-keep class ai.oodle.rum.** { *; }
|
|
4
|
+
-keepnames class com.facebook.react.views.text.PreparedLayoutTextView { *; }
|
|
5
|
+
-keepnames class com.facebook.react.views.text.PreparedLayout { *; }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package ai.oodle.rum
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.net.ConnectivityManager
|
|
5
|
+
import android.net.NetworkCapabilities
|
|
6
|
+
|
|
7
|
+
object Connectivity {
|
|
8
|
+
fun current(context: Context): String {
|
|
9
|
+
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as? ConnectivityManager ?: return "unknown"
|
|
10
|
+
val network = cm.activeNetwork ?: return "none"
|
|
11
|
+
val caps = cm.getNetworkCapabilities(network) ?: return "none"
|
|
12
|
+
return when {
|
|
13
|
+
caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> "wifi"
|
|
14
|
+
caps.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> "cellular"
|
|
15
|
+
caps.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> "ethernet"
|
|
16
|
+
else -> "other"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
package ai.oodle.rum
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.os.Process
|
|
5
|
+
import android.util.Log
|
|
6
|
+
import org.json.JSONObject
|
|
7
|
+
import java.io.File
|
|
8
|
+
import kotlin.system.exitProcess
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Writes an uncaught JVM exception to disk before the process dies. The
|
|
12
|
+
* JS side sends it on the next start, on the session that crashed.
|
|
13
|
+
*/
|
|
14
|
+
object CrashReporter {
|
|
15
|
+
private const val CRASH_FILE = "crash.json"
|
|
16
|
+
/** Written by the JS fatal error handler just before it rethrows. */
|
|
17
|
+
private const val JS_CRASH_MARKER = "js_crash_marker"
|
|
18
|
+
/** A JS fatal reaches native code shortly after the JS handler ran. */
|
|
19
|
+
private const val JS_CRASH_WINDOW_MS = 10_000L
|
|
20
|
+
private const val MAX_STACK_CHARS = 32_000
|
|
21
|
+
|
|
22
|
+
@Volatile private var installed = false
|
|
23
|
+
|
|
24
|
+
@Synchronized
|
|
25
|
+
fun install(context: Context, storage: Storage): Boolean {
|
|
26
|
+
if (installed) return true
|
|
27
|
+
val dir = File(context.applicationContext.filesDir, Storage.DIR).apply { mkdirs() }
|
|
28
|
+
val previous = Thread.getDefaultUncaughtExceptionHandler()
|
|
29
|
+
Thread.setDefaultUncaughtExceptionHandler { thread, error ->
|
|
30
|
+
try {
|
|
31
|
+
if (!alreadyReportedByJs(error, storage)) write(dir, thread, error)
|
|
32
|
+
} catch (_: Throwable) {
|
|
33
|
+
// the app's own handler must still run
|
|
34
|
+
}
|
|
35
|
+
if (previous != null) {
|
|
36
|
+
previous.uncaughtException(thread, error)
|
|
37
|
+
} else {
|
|
38
|
+
Process.killProcess(Process.myPid())
|
|
39
|
+
exitProcess(10)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
installed = true
|
|
43
|
+
return true
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* React Native turns a fatal JS error into a native JavascriptException.
|
|
48
|
+
* The JS handler has already recorded that error with its JS stack, so
|
|
49
|
+
* the native copy is skipped.
|
|
50
|
+
*/
|
|
51
|
+
private fun alreadyReportedByJs(error: Throwable, storage: Storage): Boolean {
|
|
52
|
+
var e: Throwable? = error
|
|
53
|
+
while (e != null) {
|
|
54
|
+
if (e.javaClass.name.endsWith("JavascriptException")) {
|
|
55
|
+
val at = storage.get(JS_CRASH_MARKER)?.toLongOrNull() ?: return false
|
|
56
|
+
return System.currentTimeMillis() - at < JS_CRASH_WINDOW_MS
|
|
57
|
+
}
|
|
58
|
+
e = e.cause
|
|
59
|
+
}
|
|
60
|
+
return false
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private fun write(dir: File, thread: Thread, error: Throwable) {
|
|
64
|
+
var root = error
|
|
65
|
+
while (root.cause != null && root.cause !== root) root = root.cause!!
|
|
66
|
+
val stack = Log.getStackTraceString(error).let { if (it.length > MAX_STACK_CHARS) it.substring(0, MAX_STACK_CHARS) else it }
|
|
67
|
+
val json = JSONObject()
|
|
68
|
+
json.put("timestamp", System.currentTimeMillis())
|
|
69
|
+
json.put("type", error.javaClass.name)
|
|
70
|
+
json.put("message", error.message ?: root.message ?: error.javaClass.simpleName)
|
|
71
|
+
json.put("stack", "Thread: ${thread.name}\n$stack")
|
|
72
|
+
json.put("source", "android")
|
|
73
|
+
File(dir, CRASH_FILE).writeText(json.toString(), Charsets.UTF_8)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The JVM crash file wins. The system exit record is read in both cases,
|
|
78
|
+
* so that its newest timestamp moves on and an exit is sent once only.
|
|
79
|
+
*/
|
|
80
|
+
fun consume(context: Context, storage: Storage): String? {
|
|
81
|
+
val fromSystem = ExitReasons.consume(context.applicationContext, storage)
|
|
82
|
+
val f = File(File(context.applicationContext.filesDir, Storage.DIR), CRASH_FILE)
|
|
83
|
+
if (!f.exists()) return fromSystem
|
|
84
|
+
val text = f.readText(Charsets.UTF_8)
|
|
85
|
+
f.delete()
|
|
86
|
+
return text
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
package ai.oodle.rum
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.content.pm.PackageManager
|
|
5
|
+
import android.os.Build
|
|
6
|
+
import android.os.Process
|
|
7
|
+
import android.os.SystemClock
|
|
8
|
+
import org.json.JSONObject
|
|
9
|
+
import java.util.Locale
|
|
10
|
+
|
|
11
|
+
object DeviceInfo {
|
|
12
|
+
fun collect(context: Context): JSONObject {
|
|
13
|
+
val metrics = context.resources.displayMetrics
|
|
14
|
+
val config = context.resources.configuration
|
|
15
|
+
val json = JSONObject()
|
|
16
|
+
json.put("brand", Build.MANUFACTURER.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.ROOT) else it.toString() })
|
|
17
|
+
json.put("model", Build.MODEL)
|
|
18
|
+
json.put("osName", "Android")
|
|
19
|
+
json.put("osVersion", Build.VERSION.RELEASE ?: "")
|
|
20
|
+
json.put("bundleId", context.packageName)
|
|
21
|
+
try {
|
|
22
|
+
val info =
|
|
23
|
+
if (Build.VERSION.SDK_INT >= 33) {
|
|
24
|
+
context.packageManager.getPackageInfo(context.packageName, PackageManager.PackageInfoFlags.of(0))
|
|
25
|
+
} else {
|
|
26
|
+
@Suppress("DEPRECATION")
|
|
27
|
+
context.packageManager.getPackageInfo(context.packageName, 0)
|
|
28
|
+
}
|
|
29
|
+
json.put("appVersion", info.versionName ?: "")
|
|
30
|
+
val code = if (Build.VERSION.SDK_INT >= 28) info.longVersionCode else @Suppress("DEPRECATION") info.versionCode.toLong()
|
|
31
|
+
json.put("appBuild", code.toString())
|
|
32
|
+
} catch (_: Exception) {
|
|
33
|
+
json.put("appVersion", "")
|
|
34
|
+
json.put("appBuild", "")
|
|
35
|
+
}
|
|
36
|
+
json.put("deviceType", if (config.smallestScreenWidthDp >= 600) "tablet" else "mobile")
|
|
37
|
+
json.put("screenWidth", metrics.widthPixels / metrics.density)
|
|
38
|
+
json.put("screenHeight", metrics.heightPixels / metrics.density)
|
|
39
|
+
json.put("scale", metrics.density.toDouble())
|
|
40
|
+
json.put("locale", Locale.getDefault().toLanguageTag())
|
|
41
|
+
json.put("processStartMs", processStartMs())
|
|
42
|
+
return json
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Wall clock time the process started. */
|
|
46
|
+
fun processStartMs(): Long {
|
|
47
|
+
val sinceStart = SystemClock.elapsedRealtime() - Process.getStartElapsedRealtime()
|
|
48
|
+
return System.currentTimeMillis() - sinceStart
|
|
49
|
+
}
|
|
50
|
+
}
|