@luciq/react-native 18.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 (239) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/FONTS_SETUP_GUIDE.md +521 -0
  3. package/Gemfile +1 -0
  4. package/Gemfile.lock +11 -0
  5. package/LICENSE +21 -0
  6. package/README.md +148 -0
  7. package/RNLuciq.podspec +21 -0
  8. package/android/build.gradle +88 -0
  9. package/android/gradle.properties +4 -0
  10. package/android/jacoco.gradle +52 -0
  11. package/android/native.gradle +7 -0
  12. package/android/proguard-rules.txt +1 -0
  13. package/android/sourcemaps.gradle +255 -0
  14. package/android/src/main/AndroidManifest.xml +4 -0
  15. package/android/src/main/java/ai/luciq/reactlibrary/ArgsRegistry.java +278 -0
  16. package/android/src/main/java/ai/luciq/reactlibrary/Constants.java +20 -0
  17. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciq.java +328 -0
  18. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqAPMModule.java +392 -0
  19. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqBugReportingModule.java +444 -0
  20. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqCrashReportingModule.java +169 -0
  21. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqFeatureRequestsModule.java +98 -0
  22. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqNetworkLoggerModule.java +195 -0
  23. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqReactnativeModule.java +1611 -0
  24. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqReactnativePackage.java +41 -0
  25. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqRepliesModule.java +298 -0
  26. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqSessionReplayModule.java +213 -0
  27. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqSurveysModule.java +237 -0
  28. package/android/src/main/java/ai/luciq/reactlibrary/utils/ArrayUtil.java +167 -0
  29. package/android/src/main/java/ai/luciq/reactlibrary/utils/EventEmitterModule.java +35 -0
  30. package/android/src/main/java/ai/luciq/reactlibrary/utils/LuciqUtil.java +58 -0
  31. package/android/src/main/java/ai/luciq/reactlibrary/utils/MainThreadHandler.java +13 -0
  32. package/android/src/main/java/ai/luciq/reactlibrary/utils/MapUtil.java +171 -0
  33. package/android/src/main/java/ai/luciq/reactlibrary/utils/RNTouchedViewExtractor.java +167 -0
  34. package/android/src/main/java/ai/luciq/reactlibrary/utils/ReportUtil.java +67 -0
  35. package/app.plugin.js +1 -0
  36. package/babel.config.js +3 -0
  37. package/bin/commands/MigrateCommand.d.ts +6 -0
  38. package/bin/commands/UploadEasUpdatesSourcemaps.d.ts +2 -0
  39. package/bin/commands/UploadSoFiles.d.ts +6 -0
  40. package/bin/commands/UploadSourcemaps.d.ts +2 -0
  41. package/bin/config/migration-config.json +125 -0
  42. package/bin/index.d.ts +2 -0
  43. package/bin/index.js +19179 -0
  44. package/bin/upload/index.d.ts +4 -0
  45. package/bin/upload/migrate.d.ts +14 -0
  46. package/bin/upload/uploadEasUpdatesSourcemaps.d.ts +21 -0
  47. package/bin/upload/uploadSoFiles.d.ts +21 -0
  48. package/bin/upload/uploadSourcemaps.d.ts +21 -0
  49. package/cli/commands/MigrateCommand.ts +32 -0
  50. package/cli/commands/UploadEasUpdatesSourcemaps.ts +34 -0
  51. package/cli/commands/UploadSoFiles.ts +38 -0
  52. package/cli/commands/UploadSourcemaps.ts +40 -0
  53. package/cli/config/migration-config.json +125 -0
  54. package/cli/index.ts +21 -0
  55. package/cli/upload/index.ts +4 -0
  56. package/cli/upload/migrate.ts +271 -0
  57. package/cli/upload/uploadEasUpdatesSourcemaps.ts +74 -0
  58. package/cli/upload/uploadSoFiles.ts +112 -0
  59. package/cli/upload/uploadSourcemaps.ts +73 -0
  60. package/dangerfile.ts +44 -0
  61. package/dist/index.d.ts +19 -0
  62. package/dist/index.js +14 -0
  63. package/dist/models/FeatureFlag.d.ts +11 -0
  64. package/dist/models/FeatureFlag.js +1 -0
  65. package/dist/models/LuciqConfig.d.ts +42 -0
  66. package/dist/models/LuciqConfig.js +1 -0
  67. package/dist/models/NonFatalOptions.d.ts +15 -0
  68. package/dist/models/NonFatalOptions.js +1 -0
  69. package/dist/models/OverAirUpdate.d.ts +12 -0
  70. package/dist/models/OverAirUpdate.js +1 -0
  71. package/dist/models/Report.d.ts +70 -0
  72. package/dist/models/Report.js +109 -0
  73. package/dist/models/ReproConfig.d.ts +27 -0
  74. package/dist/models/ReproConfig.js +1 -0
  75. package/dist/models/SessionMetadata.d.ts +55 -0
  76. package/dist/models/SessionMetadata.js +1 -0
  77. package/dist/models/ThemeConfig.d.ts +27 -0
  78. package/dist/models/ThemeConfig.js +1 -0
  79. package/dist/models/W3cExternalTraceAttributes.d.ts +22 -0
  80. package/dist/models/W3cExternalTraceAttributes.js +1 -0
  81. package/dist/modules/APM.d.ts +77 -0
  82. package/dist/modules/APM.js +104 -0
  83. package/dist/modules/BugReporting.d.ts +138 -0
  84. package/dist/modules/BugReporting.js +202 -0
  85. package/dist/modules/CrashReporting.d.ts +19 -0
  86. package/dist/modules/CrashReporting.js +40 -0
  87. package/dist/modules/FeatureRequests.d.ts +20 -0
  88. package/dist/modules/FeatureRequests.js +28 -0
  89. package/dist/modules/Luciq.d.ts +362 -0
  90. package/dist/modules/Luciq.js +797 -0
  91. package/dist/modules/NetworkLogger.d.ts +52 -0
  92. package/dist/modules/NetworkLogger.js +208 -0
  93. package/dist/modules/Replies.d.ts +78 -0
  94. package/dist/modules/Replies.js +121 -0
  95. package/dist/modules/SessionReplay.d.ts +78 -0
  96. package/dist/modules/SessionReplay.js +98 -0
  97. package/dist/modules/Surveys.d.ts +75 -0
  98. package/dist/modules/Surveys.js +101 -0
  99. package/dist/native/NativeAPM.d.ts +18 -0
  100. package/dist/native/NativeAPM.js +4 -0
  101. package/dist/native/NativeBugReporting.d.ts +32 -0
  102. package/dist/native/NativeBugReporting.js +10 -0
  103. package/dist/native/NativeConstants.d.ts +182 -0
  104. package/dist/native/NativeConstants.js +1 -0
  105. package/dist/native/NativeCrashReporting.d.ts +18 -0
  106. package/dist/native/NativeCrashReporting.js +2 -0
  107. package/dist/native/NativeFeatureRequests.d.ts +8 -0
  108. package/dist/native/NativeFeatureRequests.js +2 -0
  109. package/dist/native/NativeLuciq.d.ts +86 -0
  110. package/dist/native/NativeLuciq.js +10 -0
  111. package/dist/native/NativeNetworkLogger.d.ts +21 -0
  112. package/dist/native/NativeNetworkLogger.js +14 -0
  113. package/dist/native/NativePackage.d.ts +21 -0
  114. package/dist/native/NativePackage.js +2 -0
  115. package/dist/native/NativeReplies.d.ts +21 -0
  116. package/dist/native/NativeReplies.js +8 -0
  117. package/dist/native/NativeSessionReplay.d.ts +16 -0
  118. package/dist/native/NativeSessionReplay.js +8 -0
  119. package/dist/native/NativeSurveys.d.ts +22 -0
  120. package/dist/native/NativeSurveys.js +9 -0
  121. package/dist/utils/AppStatesHandler.d.ts +3 -0
  122. package/dist/utils/AppStatesHandler.js +16 -0
  123. package/dist/utils/Enums.d.ts +244 -0
  124. package/dist/utils/Enums.js +266 -0
  125. package/dist/utils/FeatureFlags.d.ts +7 -0
  126. package/dist/utils/FeatureFlags.js +24 -0
  127. package/dist/utils/LuciqConstants.d.ts +14 -0
  128. package/dist/utils/LuciqConstants.js +15 -0
  129. package/dist/utils/LuciqUtils.d.ts +97 -0
  130. package/dist/utils/LuciqUtils.js +301 -0
  131. package/dist/utils/UnhandledRejectionTracking.d.ts +9 -0
  132. package/dist/utils/UnhandledRejectionTracking.js +99 -0
  133. package/dist/utils/XhrNetworkInterceptor.d.ts +39 -0
  134. package/dist/utils/XhrNetworkInterceptor.js +253 -0
  135. package/dist/utils/config.d.ts +5 -0
  136. package/dist/utils/config.js +6 -0
  137. package/dist/utils/logger.d.ts +10 -0
  138. package/dist/utils/logger.js +39 -0
  139. package/expo.d.ts +1 -0
  140. package/expo.js +1 -0
  141. package/ios/RNLuciq/ArgsRegistry.h +32 -0
  142. package/ios/RNLuciq/ArgsRegistry.m +276 -0
  143. package/ios/RNLuciq/LuciqAPMBridge.h +26 -0
  144. package/ios/RNLuciq/LuciqAPMBridge.m +99 -0
  145. package/ios/RNLuciq/LuciqBugReportingBridge.h +60 -0
  146. package/ios/RNLuciq/LuciqBugReportingBridge.m +241 -0
  147. package/ios/RNLuciq/LuciqCrashReportingBridge.h +18 -0
  148. package/ios/RNLuciq/LuciqCrashReportingBridge.m +68 -0
  149. package/ios/RNLuciq/LuciqFeatureRequestsBridge.h +30 -0
  150. package/ios/RNLuciq/LuciqFeatureRequestsBridge.m +61 -0
  151. package/ios/RNLuciq/LuciqNetworkLoggerBridge.h +44 -0
  152. package/ios/RNLuciq/LuciqNetworkLoggerBridge.m +206 -0
  153. package/ios/RNLuciq/LuciqReactBridge.h +151 -0
  154. package/ios/RNLuciq/LuciqReactBridge.m +548 -0
  155. package/ios/RNLuciq/LuciqRepliesBridge.h +40 -0
  156. package/ios/RNLuciq/LuciqRepliesBridge.m +80 -0
  157. package/ios/RNLuciq/LuciqSessionReplayBridge.h +32 -0
  158. package/ios/RNLuciq/LuciqSessionReplayBridge.m +107 -0
  159. package/ios/RNLuciq/LuciqSurveysBridge.h +46 -0
  160. package/ios/RNLuciq/LuciqSurveysBridge.m +107 -0
  161. package/ios/RNLuciq/RCTConvert+LuciqEnums.h +18 -0
  162. package/ios/RNLuciq/RCTConvert+LuciqEnums.m +127 -0
  163. package/ios/RNLuciq/RNLuciq.h +35 -0
  164. package/ios/RNLuciq/RNLuciq.m +107 -0
  165. package/ios/RNLuciq/Util/LCQAPM+PrivateAPIs.h +15 -0
  166. package/ios/RNLuciq/Util/LCQCrashReporting+CP.h +13 -0
  167. package/ios/RNLuciq/Util/LCQNetworkLogger+CP.h +68 -0
  168. package/ios/RNLuciq/Util/Luciq+CP.h +12 -0
  169. package/ios/RNLuciq.xcodeproj/project.pbxproj +352 -0
  170. package/ios/native.rb +12 -0
  171. package/ios/sourcemaps.sh +120 -0
  172. package/migrate.js +569 -0
  173. package/package.json +92 -0
  174. package/plugin/build/index.js +42078 -0
  175. package/plugin/src/index.ts +5 -0
  176. package/plugin/src/pluginProps.ts +6 -0
  177. package/plugin/src/withLuciq.ts +51 -0
  178. package/plugin/src/withLuciqAndroid.ts +99 -0
  179. package/plugin/src/withLuciqIOS.ts +109 -0
  180. package/plugin/tsconfig.json +7 -0
  181. package/react-native.config.js +16 -0
  182. package/scripts/customize-ios-endpoints.sh +28 -0
  183. package/scripts/dream-11-delete-unused-features.sh +62 -0
  184. package/scripts/find-token.js +58 -0
  185. package/scripts/find-token.sh +70 -0
  186. package/scripts/notify-github.sh +15 -0
  187. package/scripts/replace.js +58 -0
  188. package/scripts/snapshot-comment.md +15 -0
  189. package/scripts/snapshot-version.sh +11 -0
  190. package/src/index.ts +40 -0
  191. package/src/models/FeatureFlag.ts +12 -0
  192. package/src/models/LuciqConfig.ts +48 -0
  193. package/src/models/NonFatalOptions.ts +16 -0
  194. package/src/models/OverAirUpdate.ts +14 -0
  195. package/src/models/Report.ts +124 -0
  196. package/src/models/ReproConfig.ts +31 -0
  197. package/src/models/SessionMetadata.ts +57 -0
  198. package/src/models/ThemeConfig.ts +34 -0
  199. package/src/models/W3cExternalTraceAttributes.ts +22 -0
  200. package/src/modules/APM.ts +117 -0
  201. package/src/modules/BugReporting.ts +254 -0
  202. package/src/modules/CrashReporting.ts +54 -0
  203. package/src/modules/FeatureRequests.ts +32 -0
  204. package/src/modules/Luciq.ts +934 -0
  205. package/src/modules/NetworkLogger.ts +270 -0
  206. package/src/modules/Replies.ts +137 -0
  207. package/src/modules/SessionReplay.ts +111 -0
  208. package/src/modules/Surveys.ts +118 -0
  209. package/src/native/NativeAPM.ts +51 -0
  210. package/src/native/NativeBugReporting.ts +70 -0
  211. package/src/native/NativeConstants.ts +215 -0
  212. package/src/native/NativeCrashReporting.ts +29 -0
  213. package/src/native/NativeFeatureRequests.ts +12 -0
  214. package/src/native/NativeLuciq.ts +179 -0
  215. package/src/native/NativeNetworkLogger.ts +42 -0
  216. package/src/native/NativePackage.ts +25 -0
  217. package/src/native/NativeReplies.ts +34 -0
  218. package/src/native/NativeSessionReplay.ts +21 -0
  219. package/src/native/NativeSurveys.ts +34 -0
  220. package/src/promise.d.ts +11 -0
  221. package/src/utils/AppStatesHandler.ts +19 -0
  222. package/src/utils/Enums.ts +266 -0
  223. package/src/utils/FeatureFlags.ts +33 -0
  224. package/src/utils/LuciqConstants.ts +24 -0
  225. package/src/utils/LuciqUtils.ts +417 -0
  226. package/src/utils/UnhandledRejectionTracking.ts +118 -0
  227. package/src/utils/XhrNetworkInterceptor.ts +333 -0
  228. package/src/utils/config.ts +7 -0
  229. package/src/utils/logger.ts +54 -0
  230. package/tsconfig.json +32 -0
  231. package/tsconfig.test.json +4 -0
  232. package/tsconfig.upload.json +10 -0
  233. package/upload/index.d.ts +4 -0
  234. package/upload/index.js +17314 -0
  235. package/upload/migrate.d.ts +14 -0
  236. package/upload/package.json +5 -0
  237. package/upload/uploadEasUpdatesSourcemaps.d.ts +21 -0
  238. package/upload/uploadSoFiles.d.ts +21 -0
  239. package/upload/uploadSourcemaps.d.ts +21 -0
@@ -0,0 +1,254 @@
1
+ import { Platform } from 'react-native';
2
+
3
+ import { NativeBugReporting, NativeEvents, emitter } from '../native/NativeBugReporting';
4
+
5
+ import type {
6
+ DismissType,
7
+ ExtendedBugReportMode,
8
+ FloatingButtonPosition,
9
+ InvocationEvent,
10
+ InvocationOption,
11
+ RecordingButtonPosition,
12
+ ReportType,
13
+ userConsentActionType,
14
+ } from '../utils/Enums';
15
+
16
+ /**
17
+ * Enables and disables manual invocation and prompt options for bug and feedback.
18
+ * @param isEnabled
19
+ */
20
+ export const setEnabled = (isEnabled: boolean) => {
21
+ NativeBugReporting.setEnabled(isEnabled);
22
+ };
23
+
24
+ /**
25
+ * Sets the events that invoke the feedback form.
26
+ * Default is set by `Luciq.init`.
27
+ * @param events Array of events that invokes the feedback form.
28
+ */
29
+ export const setInvocationEvents = (events: InvocationEvent[]) => {
30
+ NativeBugReporting.setInvocationEvents(events);
31
+ };
32
+
33
+ /**
34
+ * Sets the invocation options.
35
+ * Default is set by `Luciq.init`.
36
+ * @param options Array of invocation options
37
+ */
38
+ export const setOptions = (options: InvocationOption[]) => {
39
+ NativeBugReporting.setOptions(options);
40
+ };
41
+
42
+ /**
43
+ * Sets a block of code to be executed just before the SDK's UI is presented.
44
+ * This block is executed on the UI thread. Could be used for performing any
45
+ * UI changes before the SDK's UI is shown.
46
+ * @param handler A callback that gets executed before invoking the SDK
47
+ */
48
+ export const onInvokeHandler = (handler: () => void) => {
49
+ emitter.addListener(NativeEvents.ON_INVOKE_HANDLER, handler);
50
+ NativeBugReporting.setOnInvokeHandler(handler);
51
+ };
52
+
53
+ /**
54
+ * Sets a block of code to be executed right after the SDK's UI is dismissed.
55
+ * This block is executed on the UI thread. Could be used for performing any
56
+ * UI changes after the SDK's UI is dismissed.
57
+ * @param handler A callback to get executed after dismissing the SDK.
58
+ */
59
+ export const onSDKDismissedHandler = (
60
+ handler: (dismissType: DismissType, reportType: ReportType) => void,
61
+ ) => {
62
+ emitter.addListener(NativeEvents.ON_DISMISS_HANDLER, (payload) => {
63
+ handler(payload.dismissType, payload.reportType);
64
+ });
65
+ NativeBugReporting.setOnSDKDismissedHandler(handler);
66
+ };
67
+
68
+ /**
69
+ * Sets the threshold value of the shake gesture for iPhone/iPod Touch
70
+ * Default for iPhone is 2.5.
71
+ * @param threshold Threshold for iPhone.
72
+ */
73
+ export const setShakingThresholdForiPhone = (threshold: number) => {
74
+ if (Platform.OS === 'ios') {
75
+ NativeBugReporting.setShakingThresholdForiPhone(threshold);
76
+ }
77
+ };
78
+
79
+ /**
80
+ * Sets the threshold value of the shake gesture for iPad.
81
+ * Default for iPad is 0.6.
82
+ * @param threshold Threshold for iPad.
83
+ */
84
+ export const setShakingThresholdForiPad = (threshold: number) => {
85
+ if (Platform.OS === 'ios') {
86
+ NativeBugReporting.setShakingThresholdForiPad(threshold);
87
+ }
88
+ };
89
+
90
+ /**
91
+ * Sets the threshold value of the shake gesture for android devices.
92
+ * Default for android is an integer value equals 350.
93
+ * you could increase the shaking difficulty level by
94
+ * increasing the `350` value and vice versa
95
+ * @param threshold Threshold for android devices.
96
+ */
97
+ export const setShakingThresholdForAndroid = (threshold: number) => {
98
+ if (Platform.OS === 'android') {
99
+ NativeBugReporting.setShakingThresholdForAndroid(threshold);
100
+ }
101
+ };
102
+
103
+ /**
104
+ * Sets whether the extended bug report mode should be disabled, enabled with
105
+ * required fields or enabled with optional fields.
106
+ * @param mode An enum to disable the extended bug report mode,
107
+ * enable it with required or with optional fields.
108
+ */
109
+ export const setExtendedBugReportMode = (mode: ExtendedBugReportMode) => {
110
+ NativeBugReporting.setExtendedBugReportMode(mode);
111
+ };
112
+
113
+ /**
114
+ * Sets what type of reports, bug or feedback, should be invoked.
115
+ * @param types Array of reportTypes
116
+ */
117
+ export const setReportTypes = (types: ReportType[]) => {
118
+ NativeBugReporting.setReportTypes(types);
119
+ };
120
+
121
+ /**
122
+ * Invoke bug reporting with report type and options.
123
+ * @param type
124
+ * @param options
125
+ */
126
+ export const show = (type: ReportType, options: InvocationOption[]) => {
127
+ NativeBugReporting.show(type, options ?? []);
128
+ };
129
+
130
+ /**
131
+ * Enable/Disable screen recording
132
+ * @param isEnabled enable/disable screen recording on crash feature
133
+ */
134
+ export const setAutoScreenRecordingEnabled = (isEnabled: boolean) => {
135
+ NativeBugReporting.setAutoScreenRecordingEnabled(isEnabled);
136
+ };
137
+
138
+ /**
139
+ * Sets auto screen recording maximum duration
140
+ *
141
+ * @param maxDuration maximum duration of the screen recording video in seconds.
142
+ * The maximum duration is 30 seconds
143
+ */
144
+ export const setAutoScreenRecordingDurationIOS = (maxDuration: number) => {
145
+ if (Platform.OS !== 'ios') {
146
+ return;
147
+ }
148
+ NativeBugReporting.setAutoScreenRecordingDuration(maxDuration);
149
+ };
150
+
151
+ /**
152
+ * Sets the default position at which the Luciq screen recording button will be shown.
153
+ * Different orientations are already handled.
154
+ * (Default for `position` is `bottomRight`)
155
+ *
156
+ * @param buttonPosition is of type position `topLeft` to show on the top left
157
+ * of screen, or `bottomRight` to show on the bottom right of screen.
158
+ */
159
+ export const setVideoRecordingFloatingButtonPosition = (
160
+ buttonPosition: RecordingButtonPosition,
161
+ ) => {
162
+ NativeBugReporting.setVideoRecordingFloatingButtonPosition(buttonPosition);
163
+ };
164
+
165
+ /**
166
+ * Enables/disables inspect view hierarchy when reporting a bug/feedback.
167
+ * @param isEnabled A boolean to set whether view hierarchy are enabled or disabled.
168
+ */
169
+ export const setViewHierarchyEnabled = (isEnabled: boolean) => {
170
+ NativeBugReporting.setViewHierarchyEnabled(isEnabled);
171
+ };
172
+
173
+ /**
174
+ * Adds a user consent item to the bug reporting form.
175
+ * @param key A unique identifier string for the consent item.
176
+ * @param description The text shown to the user describing the consent item.
177
+ * @param mandatory Whether the user must agree to this item before submitting a report.
178
+ * @param checked Whether the consent checkbox is pre-selected.
179
+ * @param actionType A string representing the action type to map to SDK behavior.
180
+ */
181
+ export const addUserConsent = (
182
+ key: string,
183
+ description: string,
184
+ mandatory: boolean,
185
+ checked: boolean,
186
+ actionType?: userConsentActionType,
187
+ ) => {
188
+ NativeBugReporting.addUserConsent(key, description, mandatory, checked, actionType);
189
+ };
190
+ /**
191
+ * Sets a block of code to be executed when a prompt option is selected.
192
+ * @param handler - A callback that gets executed when a prompt option is selected.
193
+ */
194
+ export const setDidSelectPromptOptionHandler = (handler: (promptOption: string) => void) => {
195
+ if (Platform.OS === 'android') {
196
+ return;
197
+ }
198
+ emitter.addListener(NativeEvents.DID_SELECT_PROMPT_OPTION_HANDLER, (payload) => {
199
+ handler(payload.promptOption);
200
+ });
201
+ NativeBugReporting.setDidSelectPromptOptionHandler(handler);
202
+ };
203
+
204
+ /**
205
+ * Sets the default edge and offset from the top at which the floating button
206
+ * will be shown. Different orientations are already handled.
207
+ * @param edge The screen edge to show the floating button onto. Default is `floatingButtonEdge.right`.
208
+ * @param offset The offset of the floating button from the top of the screen. Default is 50.
209
+ */
210
+ export const setFloatingButtonEdge = (edge: FloatingButtonPosition, offset: number) => {
211
+ NativeBugReporting.setFloatingButtonEdge(edge, offset);
212
+ };
213
+
214
+ /**
215
+ * Sets whether attachments in bug reporting and in-app messaging are enabled or not.
216
+ * @param screenshot A boolean to enable or disable screenshot attachments.
217
+ * @param extraScreenshot A boolean to enable or disable extra screenshot attachments.
218
+ * @param galleryImage A boolean to enable or disable gallery image attachments. In iOS 10+,
219
+ * NSPhotoLibraryUsageDescription should be set in info.plist to enable gallery image attachments.
220
+ * @param screenRecording A boolean to enable or disable screen recording attachments.
221
+ */
222
+ export const setEnabledAttachmentTypes = (
223
+ screenshot: boolean,
224
+ extraScreenshot: boolean,
225
+ galleryImage: boolean,
226
+ screenRecording: boolean,
227
+ ) => {
228
+ NativeBugReporting.setEnabledAttachmentTypes(
229
+ screenshot,
230
+ extraScreenshot,
231
+ galleryImage,
232
+ screenRecording,
233
+ );
234
+ };
235
+
236
+ /**
237
+ * Adds a disclaimer text within the bug reporting form, which can include hyperlinked text.
238
+ * @param text String text.
239
+ */
240
+ export const setDisclaimerText = (text: string) => {
241
+ NativeBugReporting.setDisclaimerText(text);
242
+ };
243
+
244
+ /**
245
+ * Sets a minimum number of characters as a requirement for the comments field in the different report types.
246
+ * @param limit int number of characters.
247
+ * @param reportTypes (Optional) Array of reportType. If it's not passed, the limit will apply to all report types.
248
+ * @platform iOS
249
+ */
250
+ export const setCommentMinimumCharacterCount = (limit: number, reportTypes?: ReportType[]) => {
251
+ if (Platform.OS === 'ios') {
252
+ NativeBugReporting.setCommentMinimumCharacterCount(limit, reportTypes ?? []);
253
+ }
254
+ };
@@ -0,0 +1,54 @@
1
+ import type { ExtendedError } from 'react-native/Libraries/Core/Devtools/parseErrorStack';
2
+
3
+ import { NativeCrashReporting } from '../native/NativeCrashReporting';
4
+ import LuciqUtils from '../utils/LuciqUtils';
5
+ import { Platform } from 'react-native';
6
+ import type { NonFatalOptions } from '../models/NonFatalOptions';
7
+ import { NonFatalErrorLevel } from '../utils/Enums';
8
+ import { Logger } from '../utils/logger';
9
+
10
+ /**
11
+ * Enables and disables everything related to crash reporting including intercepting
12
+ * errors in the global error handler. It is enabled by default.
13
+ * @param isEnabled
14
+ */
15
+ export const setEnabled = (isEnabled: boolean) => {
16
+ NativeCrashReporting.setEnabled(isEnabled);
17
+ };
18
+
19
+ /**
20
+ * Send handled JS error object
21
+ * @param error Error object to be sent to Luciq's servers
22
+ * @param nonFatalOptions extra config for the non-fatal error sent with Error Object
23
+ */
24
+ export const reportError = (error: ExtendedError, nonFatalOptions: NonFatalOptions = {}) => {
25
+ if (error instanceof Error) {
26
+ let level = NonFatalErrorLevel.error;
27
+ if (nonFatalOptions.level != null) {
28
+ level = nonFatalOptions.level;
29
+ }
30
+ return LuciqUtils.sendCrashReport(error, (data) =>
31
+ NativeCrashReporting.sendHandledJSCrash(
32
+ data,
33
+ nonFatalOptions.userAttributes,
34
+ nonFatalOptions.fingerprint,
35
+ level,
36
+ ),
37
+ );
38
+ } else {
39
+ Logger.warn(
40
+ `LCQ-RN: The error ${error} has been omitted because only error type is supported.`,
41
+ );
42
+ return;
43
+ }
44
+ };
45
+
46
+ /**
47
+ * Enables and disables capturing native C++ NDK crashes.
48
+ * @param isEnabled
49
+ */
50
+ export const setNDKCrashesEnabled = (isEnabled: boolean) => {
51
+ if (Platform.OS === 'android') {
52
+ NativeCrashReporting.setNDKCrashesEnabled(isEnabled);
53
+ }
54
+ };
@@ -0,0 +1,32 @@
1
+ import { NativeFeatureRequests } from '../native/NativeFeatureRequests';
2
+ import type { ActionType } from '../utils/Enums';
3
+
4
+ /**
5
+ * Enables and disables everything related to feature requests.
6
+ *
7
+ * @param isEnabled
8
+ */
9
+ export const setEnabled = (isEnabled: boolean) => {
10
+ NativeFeatureRequests.setEnabled(isEnabled);
11
+ };
12
+
13
+ /**
14
+ * Sets whether users are required to enter an email address or not when
15
+ * sending reports.
16
+ * Defaults to YES.
17
+ *
18
+ * @param isEmailFieldRequired A boolean to indicate whether email field is required or not.
19
+ * @param types An enum that indicates which action types will have the isEmailFieldRequired
20
+ */
21
+ export const setEmailFieldRequired = (isEmailFieldRequired: boolean, type: ActionType) => {
22
+ NativeFeatureRequests.setEmailFieldRequiredForFeatureRequests(isEmailFieldRequired, [
23
+ type,
24
+ ] as ActionType[]);
25
+ };
26
+
27
+ /**
28
+ * Shows the UI for feature requests list
29
+ */
30
+ export const show = () => {
31
+ NativeFeatureRequests.show();
32
+ };