@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,797 @@
1
+ import { AppState, findNodeHandle, Platform } from 'react-native';
2
+ import Report from '../models/Report';
3
+ import { emitter, NativeEvents, NativeLuciq } from '../native/NativeLuciq';
4
+ import { registerFeatureFlagsListener } from '../utils/FeatureFlags';
5
+ import { LogLevel, NetworkInterceptionMode, ReproStepsMode, StringKey, } from '../utils/Enums';
6
+ import LuciqUtils, { checkNetworkRequestHandlers, resetNativeObfuscationListener, setApmNetworkFlagsIfChanged, stringifyIfNotString, } from '../utils/LuciqUtils';
7
+ import * as NetworkLogger from './NetworkLogger';
8
+ import { captureUnhandledRejections } from '../utils/UnhandledRejectionTracking';
9
+ import { addAppStateListener } from '../utils/AppStatesHandler';
10
+ import { NativeNetworkLogger } from '../native/NativeNetworkLogger';
11
+ import LuciqConstants from '../utils/LuciqConstants';
12
+ import { LuciqRNConfig } from '../utils/config';
13
+ import { Logger } from '../utils/logger';
14
+ let _currentScreen = null;
15
+ let _lastScreen = null;
16
+ let _isFirstScreen = false;
17
+ const firstScreen = 'Initial Screen';
18
+ let _currentAppState = AppState.currentState;
19
+ let isNativeInterceptionFeatureEnabled = false; // Checks the value of "cp_native_interception_enabled" backend flag.
20
+ let hasAPMNetworkPlugin = false; // Android only: checks if the APM plugin is installed.
21
+ let shouldEnableNativeInterception = false; // For Android: used to disable APM logging inside reportNetworkLog() -> NativeAPM.networkLogAndroid(), For iOS: used to control native interception (true == enabled , false == disabled)
22
+ /**
23
+ * Enables or disables Luciq functionality.
24
+ * @param isEnabled A boolean to enable/disable Luciq.
25
+ */
26
+ export const setEnabled = (isEnabled) => {
27
+ NativeLuciq.setEnabled(isEnabled);
28
+ };
29
+ /**
30
+ * Reports that the screen name been changed (Current View field on dashboard).
31
+ * only for android.
32
+ *
33
+ * Normally reportScreenChange handles taking a screenshot for reproduction
34
+ * steps and the Current View field on the dashboard. But we've faced issues
35
+ * in android where we needed to separate them, that's why we only call it
36
+ * for android.
37
+ *
38
+ * @param screenName string containing the screen name
39
+ */
40
+ function reportCurrentViewForAndroid(screenName) {
41
+ if (Platform.OS === 'android' && screenName != null) {
42
+ NativeLuciq.reportCurrentViewChange(screenName);
43
+ }
44
+ }
45
+ /**
46
+ * Initializes the SDK.
47
+ * This is the main SDK method that does all the magic. This is the only
48
+ * method that SHOULD be called.
49
+ * Should be called in constructor of the AppRegistry component
50
+ * @param config SDK configurations. See {@link LuciqConfig} for more info.
51
+ */
52
+ export const init = (config) => {
53
+ if (Platform.OS === 'android') {
54
+ // Add android feature flags listener for android
55
+ registerFeatureFlagsListener();
56
+ addOnFeatureUpdatedListener(config);
57
+ }
58
+ else {
59
+ isNativeInterceptionFeatureEnabled = NativeNetworkLogger.isNativeInterceptionEnabled();
60
+ // Add app state listener to handle background/foreground transitions
61
+ addAppStateListener(async (nextAppState) => handleAppStateChange(nextAppState, config));
62
+ handleNetworkInterceptionMode(config);
63
+ //Set APM networking flags for the first time
64
+ setApmNetworkFlagsIfChanged({
65
+ isNativeInterceptionFeatureEnabled: isNativeInterceptionFeatureEnabled,
66
+ hasAPMNetworkPlugin: hasAPMNetworkPlugin,
67
+ shouldEnableNativeInterception: shouldEnableNativeInterception,
68
+ });
69
+ }
70
+ // call Luciq native init method
71
+ initializeNativeLuciq(config);
72
+ // Set up error capturing and rejection handling
73
+ LuciqUtils.captureJsErrors();
74
+ captureUnhandledRejections();
75
+ _isFirstScreen = true;
76
+ _currentScreen = firstScreen;
77
+ LuciqRNConfig.debugLogsLevel = config.debugLogsLevel ?? LogLevel.error;
78
+ reportCurrentViewForAndroid(firstScreen);
79
+ setTimeout(() => {
80
+ if (_currentScreen === firstScreen) {
81
+ NativeLuciq.reportScreenChange(firstScreen);
82
+ _currentScreen = null;
83
+ }
84
+ }, 1000);
85
+ };
86
+ /**
87
+ * Set Current App Variant.
88
+ * @param appVariant the current App variant name
89
+ */
90
+ export const setAppVariant = (appVariant) => {
91
+ NativeLuciq.setAppVariant(appVariant);
92
+ };
93
+ /**
94
+ * Handles app state changes and updates APM network flags if necessary.
95
+ */
96
+ const handleAppStateChange = async (nextAppState, config) => {
97
+ // Checks if the app has come to the foreground
98
+ if (['inactive', 'background'].includes(_currentAppState) && nextAppState === 'active') {
99
+ const isUpdated = await fetchApmNetworkFlags();
100
+ if (isUpdated) {
101
+ refreshAPMNetworkConfigs(config);
102
+ }
103
+ }
104
+ _currentAppState = nextAppState;
105
+ };
106
+ /**
107
+ * Fetches the current APM network flags.
108
+ */
109
+ const fetchApmNetworkFlags = async () => {
110
+ let isUpdated = false;
111
+ const newNativeInterceptionFeatureEnabled = NativeNetworkLogger.isNativeInterceptionEnabled();
112
+ if (isNativeInterceptionFeatureEnabled !== newNativeInterceptionFeatureEnabled) {
113
+ isNativeInterceptionFeatureEnabled = newNativeInterceptionFeatureEnabled;
114
+ isUpdated = true;
115
+ }
116
+ if (Platform.OS === 'android') {
117
+ const newHasAPMNetworkPlugin = await NativeNetworkLogger.hasAPMNetworkPlugin();
118
+ if (hasAPMNetworkPlugin !== newHasAPMNetworkPlugin) {
119
+ hasAPMNetworkPlugin = newHasAPMNetworkPlugin;
120
+ isUpdated = true;
121
+ }
122
+ }
123
+ return isUpdated;
124
+ };
125
+ /**
126
+ * Handles platform-specific checks and updates the network interception mode.
127
+ */
128
+ const handleNetworkInterceptionMode = (config) => {
129
+ // Default networkInterceptionMode to JavaScript if not set
130
+ if (config.networkInterceptionMode == null) {
131
+ config.networkInterceptionMode = NetworkInterceptionMode.javascript;
132
+ }
133
+ if (Platform.OS === 'android') {
134
+ handleInterceptionModeForAndroid(config);
135
+ config.networkInterceptionMode = NetworkInterceptionMode.javascript; // Need to enable JS interceptor in all scenarios for Bugs & Crashes network logs
136
+ }
137
+ else if (Platform.OS === 'ios') {
138
+ handleInterceptionModeForIOS(config);
139
+ //enable | disable native obfuscation and filtering synchronously
140
+ NetworkLogger.setNativeInterceptionEnabled(shouldEnableNativeInterception);
141
+ }
142
+ if (config.networkInterceptionMode === NetworkInterceptionMode.javascript) {
143
+ NetworkLogger.setEnabled(true);
144
+ }
145
+ };
146
+ /**
147
+ * Handles the network interception logic for Android if the user set
148
+ * network interception mode with [NetworkInterceptionMode.javascript].
149
+ */
150
+ function handleAndroidJSInterception() {
151
+ if (isNativeInterceptionFeatureEnabled && hasAPMNetworkPlugin) {
152
+ shouldEnableNativeInterception = true;
153
+ Logger.warn(LuciqConstants.LCQ_APM_TAG + LuciqConstants.SWITCHED_TO_NATIVE_INTERCEPTION_MESSAGE);
154
+ }
155
+ }
156
+ /**
157
+ * Handles the network interception logic for Android if the user set
158
+ * network interception mode with [NetworkInterceptionMode.native].
159
+ */
160
+ function handleAndroidNativeInterception() {
161
+ if (isNativeInterceptionFeatureEnabled) {
162
+ shouldEnableNativeInterception = hasAPMNetworkPlugin;
163
+ if (!hasAPMNetworkPlugin) {
164
+ Logger.error(LuciqConstants.LCQ_APM_TAG + LuciqConstants.PLUGIN_NOT_INSTALLED_MESSAGE);
165
+ }
166
+ }
167
+ else {
168
+ shouldEnableNativeInterception = false; // rollback to use JS interceptor for APM & Core.
169
+ Logger.error(LuciqConstants.LCQ_APM_TAG + LuciqConstants.NATIVE_INTERCEPTION_DISABLED_MESSAGE);
170
+ }
171
+ }
172
+ /**
173
+ * Control either to enable or disable the native interception for iOS after the init method is called.
174
+ */
175
+ function handleIOSNativeInterception(config) {
176
+ if (shouldEnableNativeInterception &&
177
+ config.networkInterceptionMode === NetworkInterceptionMode.native) {
178
+ NativeNetworkLogger.forceStartNetworkLoggingIOS(); // Enable native iOS automatic network logging.
179
+ }
180
+ else {
181
+ NativeNetworkLogger.forceStopNetworkLoggingIOS(); // Disable native iOS automatic network logging.
182
+ }
183
+ }
184
+ /**
185
+ * Handles the network interception mode logic for Android.
186
+ * By deciding which interception mode should be enabled (Native or JavaScript).
187
+ */
188
+ const handleInterceptionModeForAndroid = (config) => {
189
+ const { networkInterceptionMode } = config;
190
+ if (networkInterceptionMode === NetworkInterceptionMode.javascript) {
191
+ handleAndroidJSInterception();
192
+ }
193
+ else {
194
+ handleAndroidNativeInterception();
195
+ }
196
+ };
197
+ /**
198
+ * Handles the interception mode logic for iOS.
199
+ * By deciding which interception mode should be enabled (Native or JavaScript).
200
+ */
201
+ const handleInterceptionModeForIOS = (config) => {
202
+ if (config.networkInterceptionMode === NetworkInterceptionMode.native) {
203
+ if (isNativeInterceptionFeatureEnabled) {
204
+ shouldEnableNativeInterception = true;
205
+ NetworkLogger.setEnabled(false); // insure JS interceptor is disabled
206
+ }
207
+ else {
208
+ shouldEnableNativeInterception = false;
209
+ NetworkLogger.setEnabled(true); // rollback to JS interceptor
210
+ Logger.error(LuciqConstants.LCQ_APM_TAG + LuciqConstants.NATIVE_INTERCEPTION_DISABLED_MESSAGE);
211
+ }
212
+ }
213
+ };
214
+ /**
215
+ * Initializes Luciq with the given configuration.
216
+ */
217
+ const initializeNativeLuciq = (config) => {
218
+ NativeLuciq.init(config.token, config.invocationEvents, config.debugLogsLevel ?? LogLevel.error, shouldEnableNativeInterception &&
219
+ config.networkInterceptionMode === NetworkInterceptionMode.native, config.codePushVersion, config.appVariant, config.ignoreAndroidSecureFlag != null
220
+ ? {
221
+ ignoreAndroidSecureFlag: config.ignoreAndroidSecureFlag,
222
+ }
223
+ : undefined, config.overAirVersion);
224
+ };
225
+ /**
226
+ * Refresh the APM network configurations.
227
+ */
228
+ function refreshAPMNetworkConfigs(config, forceRefreshIOS = true) {
229
+ handleNetworkInterceptionMode(config);
230
+ if (Platform.OS === 'ios' && forceRefreshIOS) {
231
+ handleIOSNativeInterception(config);
232
+ }
233
+ setApmNetworkFlagsIfChanged({
234
+ isNativeInterceptionFeatureEnabled,
235
+ hasAPMNetworkPlugin,
236
+ shouldEnableNativeInterception,
237
+ });
238
+ if (shouldEnableNativeInterception) {
239
+ checkNetworkRequestHandlers();
240
+ }
241
+ else {
242
+ // remove any attached [NativeNetworkLogger] Listeners if exists, to avoid memory leaks.
243
+ resetNativeObfuscationListener();
244
+ }
245
+ }
246
+ /**
247
+ * Add Android Listener for native feature flags changes.
248
+ */
249
+ function addOnFeatureUpdatedListener(config) {
250
+ emitter.addListener(NativeEvents.LCQ_ON_FEATURES_UPDATED_CALLBACK, (flags) => {
251
+ const { cpNativeInterceptionEnabled, hasAPMPlugin } = flags;
252
+ isNativeInterceptionFeatureEnabled = cpNativeInterceptionEnabled;
253
+ hasAPMNetworkPlugin = hasAPMPlugin;
254
+ shouldEnableNativeInterception =
255
+ config.networkInterceptionMode === NetworkInterceptionMode.native;
256
+ refreshAPMNetworkConfigs(config);
257
+ });
258
+ NativeLuciq.setOnFeaturesUpdatedListener();
259
+ }
260
+ /**
261
+ * Sets the Code Push version to be sent with each report.
262
+ * @param version the Code Push version.
263
+ *
264
+ * @deprecated Use {@link setOverAirVersion} instead.
265
+ */
266
+ export const setCodePushVersion = (version) => {
267
+ NativeLuciq.setCodePushVersion(version);
268
+ };
269
+ /**
270
+ * Sets over air update version to be sent with each report.
271
+ * @param version the OTA version.
272
+ *
273
+ */
274
+ export const setOverAirVersion = (OTAserviceVersion) => {
275
+ NativeLuciq.setOverAirVersion(OTAserviceVersion);
276
+ };
277
+ /**
278
+ * Attaches user data to each report being sent.
279
+ * Each call to this method overrides the user data to be attached.
280
+ * Maximum size of the string is 1,000 characters.
281
+ * @param data A string to be attached to each report, with a maximum size of 1,000 characters.
282
+ */
283
+ export const setUserData = (data) => {
284
+ NativeLuciq.setUserData(data);
285
+ };
286
+ /**
287
+ * Sets whether the SDK is tracking user steps or not.
288
+ * Enabling user steps would give you an insight on the scenario a user has
289
+ * performed before encountering a bug or a crash. User steps are attached
290
+ * with each report being sent.
291
+ * @param isEnabled A boolean to set user steps tracking to being enabled or disabled.
292
+ */
293
+ export const setTrackUserSteps = (isEnabled) => {
294
+ if (Platform.OS === 'ios') {
295
+ NativeLuciq.setTrackUserSteps(isEnabled);
296
+ }
297
+ };
298
+ /**
299
+ * Sets whether LCQLog should also print to Xcode's console log or not.
300
+ * @param printsToConsole A boolean to set whether printing to
301
+ * Xcode's console is enabled or not.
302
+ */
303
+ export const setLCQLogPrintsToConsole = (printsToConsole) => {
304
+ if (Platform.OS === 'ios') {
305
+ NativeLuciq.setLCQLogPrintsToConsole(printsToConsole);
306
+ }
307
+ };
308
+ /**
309
+ * The session profiler is enabled by default and it attaches to the bug and
310
+ * crash reports the following information during the last 60 seconds before the report is sent.
311
+ * @param isEnabled A boolean parameter to enable or disable the feature.
312
+ */
313
+ export const setSessionProfilerEnabled = (isEnabled) => {
314
+ NativeLuciq.setSessionProfilerEnabled(isEnabled);
315
+ };
316
+ /**
317
+ * Sets the SDK's locale.
318
+ * Use to change the SDK's UI to different language.
319
+ * Defaults to the device's current locale.
320
+ * @param sdkLocale A locale to set the SDK to.
321
+ */
322
+ export const setLocale = (sdkLocale) => {
323
+ NativeLuciq.setLocale(sdkLocale);
324
+ };
325
+ /**
326
+ * Sets the color theme of the SDK's whole UI.
327
+ * @param sdkTheme
328
+ */
329
+ export const setColorTheme = (sdkTheme) => {
330
+ NativeLuciq.setColorTheme(sdkTheme);
331
+ };
332
+ /**
333
+ * Sets the primary color of the SDK's UI.
334
+ * Sets the color of UI elements indicating interactivity or call to action.
335
+ * To use, import processColor and pass to it with argument the color hex
336
+ * as argument.
337
+ * @param color A color to set the UI elements of the SDK to.
338
+ * @deprecated Please migrate to the new UI customization API: {@link setTheme}
339
+ */
340
+ export const setPrimaryColor = (color) => {
341
+ NativeLuciq.setTheme({ primaryColor: color });
342
+ };
343
+ /**
344
+ * Appends a set of tags to previously added tags of reported feedback,
345
+ * bug or crash.
346
+ * @param tags An array of tags to append to current tags.
347
+ */
348
+ export const appendTags = (tags) => {
349
+ NativeLuciq.appendTags(tags);
350
+ };
351
+ /**
352
+ * Manually removes all tags of reported feedback, bug or crash.
353
+ */
354
+ export const resetTags = () => {
355
+ NativeLuciq.resetTags();
356
+ };
357
+ /**
358
+ * Gets all tags of reported feedback, bug or crash.
359
+ */
360
+ export const getTags = async () => {
361
+ const tags = await NativeLuciq.getTags();
362
+ return tags;
363
+ };
364
+ /**
365
+ * Overrides any of the strings shown in the SDK with custom ones.
366
+ * Allows you to customize any of the strings shown to users in the SDK.
367
+ * @param key Key of string to override.
368
+ * @param string String value to override the default one.
369
+ */
370
+ export const setString = (key, string) => {
371
+ // Suffix the repro steps list item numbering title with a # to unify the string key's
372
+ // behavior between Android and iOS
373
+ if (Platform.OS === 'android' && key === StringKey.reproStepsListItemNumberingTitle) {
374
+ string = `${string} #`;
375
+ }
376
+ NativeLuciq.setString(string, key);
377
+ };
378
+ /**
379
+ * Sets the default value of the user's email and ID and hides the email field from the reporting UI
380
+ * and set the user's name to be included with all reports.
381
+ * It also reset the chats on device to that email and removes user attributes,
382
+ * user data and completed surveys.
383
+ * @param email Email address to be set as the user's email.
384
+ * @param name Name of the user to be set.
385
+ * @param [id] ID of the user to be set.
386
+ */
387
+ export const identifyUser = (email, name, id) => {
388
+ NativeLuciq.identifyUser(email, name, id);
389
+ };
390
+ /**
391
+ * Sets the default value of the user's email to nil and show email field and remove user name
392
+ * from all reports
393
+ * It also reset the chats on device and removes user attributes, user data and completed surveys.
394
+ */
395
+ export const logOut = () => {
396
+ NativeLuciq.logOut();
397
+ };
398
+ /**
399
+ * Logs a user event that happens through the lifecycle of the application.
400
+ * Logged user events are going to be sent with each report, as well as at the end of a session.
401
+ * @param name Event name.
402
+ */
403
+ export const logUserEvent = (name) => {
404
+ NativeLuciq.logUserEvent(name);
405
+ };
406
+ /**
407
+ * Appends a log message to Luciq internal log.
408
+ * These logs are then sent along the next uploaded report.
409
+ * All log messages are timestamped.
410
+ * Logs aren't cleared per single application run.
411
+ * If you wish to reset the logs, use {@link clearLogs()}
412
+ * Note: logs passed to this method are **NOT** printed to Logcat.
413
+ *
414
+ * @param message the message
415
+ */
416
+ export const logVerbose = (message) => {
417
+ if (!message) {
418
+ return;
419
+ }
420
+ message = stringifyIfNotString(message);
421
+ NativeLuciq.logVerbose(message);
422
+ };
423
+ /**
424
+ * Appends a log message to Luciq internal log.
425
+ * These logs are then sent along the next uploaded report.
426
+ * All log messages are timestamped.
427
+ * Logs aren't cleared per single application run.
428
+ * If you wish to reset the logs, use {@link clearLogs()}
429
+ * Note: logs passed to this method are **NOT** printed to Logcat.
430
+ *
431
+ * @param message the message
432
+ */
433
+ export const logInfo = (message) => {
434
+ if (!message) {
435
+ return;
436
+ }
437
+ message = stringifyIfNotString(message);
438
+ NativeLuciq.logInfo(message);
439
+ };
440
+ /**
441
+ * Appends a log message to Luciq internal log.
442
+ * These logs are then sent along the next uploaded report.
443
+ * All log messages are timestamped.
444
+ * Logs aren't cleared per single application run.
445
+ * If you wish to reset the logs, use {@link clearLogs()}
446
+ * Note: logs passed to this method are **NOT** printed to Logcat.
447
+ *
448
+ * @param message the message
449
+ */
450
+ export const logDebug = (message) => {
451
+ if (!message) {
452
+ return;
453
+ }
454
+ message = stringifyIfNotString(message);
455
+ NativeLuciq.logDebug(message);
456
+ };
457
+ /**
458
+ * Appends a log message to Luciq internal log.
459
+ * These logs are then sent along the next uploaded report.
460
+ * All log messages are timestamped.
461
+ * Logs aren't cleared per single application run.
462
+ * If you wish to reset the logs, use {@link clearLogs()}
463
+ * Note: logs passed to this method are **NOT** printed to Logcat.
464
+ *
465
+ * @param message the message
466
+ */
467
+ export const logError = (message) => {
468
+ if (!message) {
469
+ return;
470
+ }
471
+ message = stringifyIfNotString(message);
472
+ NativeLuciq.logError(message);
473
+ };
474
+ /**
475
+ * Appends a log message to Luciq internal log.
476
+ * These logs are then sent along the next uploaded report.
477
+ * All log messages are timestamped.
478
+ * Logs aren't cleared per single application run.
479
+ * If you wish to reset the logs, use {@link clearLogs()}
480
+ * Note: logs passed to this method are **NOT** printed to Logcat.
481
+ *
482
+ * @param message the message
483
+ */
484
+ export const logWarn = (message) => {
485
+ if (!message) {
486
+ return;
487
+ }
488
+ message = stringifyIfNotString(message);
489
+ NativeLuciq.logWarn(message);
490
+ };
491
+ /**
492
+ * Clear all Luciq logs, console logs, network logs and user steps.
493
+ */
494
+ export const clearLogs = () => {
495
+ NativeLuciq.clearLogs();
496
+ };
497
+ /**
498
+ * Sets the repro steps mode for bugs and crashes.
499
+ *
500
+ * @param config The repro steps config.
501
+ *
502
+ * @example
503
+ * ```js
504
+ * Luciq.setReproStepsConfig({
505
+ * bug: ReproStepsMode.enabled,
506
+ * crash: ReproStepsMode.disabled,
507
+ * sessionReplay: ReproStepsMode.enabled,
508
+ * });
509
+ * ```
510
+ */
511
+ export const setReproStepsConfig = (config) => {
512
+ let bug = config.bug ?? ReproStepsMode.enabled;
513
+ let crash = config.crash ?? ReproStepsMode.enabledWithNoScreenshots;
514
+ let sessionReplay = config.sessionReplay ?? ReproStepsMode.enabled;
515
+ if (config.all != null) {
516
+ bug = config.all;
517
+ crash = config.all;
518
+ sessionReplay = config.all;
519
+ }
520
+ NativeLuciq.setReproStepsConfig(bug, crash, sessionReplay);
521
+ };
522
+ /**
523
+ * Sets user attribute to overwrite it's value or create a new one if it doesn't exist.
524
+ *
525
+ * @param key the attribute
526
+ * @param value the value
527
+ */
528
+ export const setUserAttribute = (key, value) => {
529
+ if (!key || typeof key !== 'string' || typeof value !== 'string') {
530
+ Logger.error(LuciqConstants.SET_USER_ATTRIBUTES_ERROR_TYPE_MESSAGE);
531
+ return;
532
+ }
533
+ NativeLuciq.setUserAttribute(key, value);
534
+ };
535
+ /**
536
+ * Returns the user attribute associated with a given key.
537
+ * @param key The attribute key as string
538
+ */
539
+ export const getUserAttribute = async (key) => {
540
+ const attribute = await NativeLuciq.getUserAttribute(key);
541
+ return attribute;
542
+ };
543
+ /**
544
+ * Removes user attribute if exists.
545
+ *
546
+ * @param key the attribute key as string
547
+ * @see {@link setUserAttribute}
548
+ */
549
+ export const removeUserAttribute = (key) => {
550
+ if (!key || typeof key !== 'string') {
551
+ Logger.error(LuciqConstants.REMOVE_USER_ATTRIBUTES_ERROR_TYPE_MESSAGE);
552
+ return;
553
+ }
554
+ NativeLuciq.removeUserAttribute(key);
555
+ };
556
+ /**
557
+ * Returns all user attributes.
558
+ * set user attributes, or an empty dictionary if no user attributes have been set.
559
+ */
560
+ export const getAllUserAttributes = async () => {
561
+ const attributes = await NativeLuciq.getAllUserAttributes();
562
+ return attributes;
563
+ };
564
+ /**
565
+ * Clears all user attributes if exists.
566
+ */
567
+ export const clearAllUserAttributes = () => {
568
+ NativeLuciq.clearAllUserAttributes();
569
+ };
570
+ /**
571
+ * Shows the welcome message in a specific mode.
572
+ * @param mode An enum to set the welcome message mode to live, or beta.
573
+ */
574
+ export const showWelcomeMessage = (mode) => {
575
+ NativeLuciq.showWelcomeMessageWithMode(mode);
576
+ };
577
+ /**
578
+ * Sets the welcome message mode to live, beta or disabled.
579
+ * @param mode An enum to set the welcome message mode to live, beta or disabled.
580
+ */
581
+ export const setWelcomeMessageMode = (mode) => {
582
+ NativeLuciq.setWelcomeMessageMode(mode);
583
+ };
584
+ /**
585
+ * Add file to be attached to the bug report.
586
+ * @param filePath
587
+ * @param fileName
588
+ */
589
+ export const addFileAttachment = (filePath, fileName) => {
590
+ if (Platform.OS === 'android') {
591
+ NativeLuciq.setFileAttachment(filePath, fileName);
592
+ }
593
+ else {
594
+ NativeLuciq.setFileAttachment(filePath);
595
+ }
596
+ };
597
+ /**
598
+ * Hides component from screenshots, screen recordings and view hierarchy.
599
+ * @param viewRef the ref of the component to hide
600
+ */
601
+ export const addPrivateView = (viewRef) => {
602
+ const nativeTag = findNodeHandle(viewRef);
603
+ NativeLuciq.addPrivateView(nativeTag);
604
+ };
605
+ /**
606
+ * Removes component from the set of hidden views. The component will show again in
607
+ * screenshots, screen recordings and view hierarchy.
608
+ * @param viewRef the ref of the component to remove from hidden views
609
+ */
610
+ export const removePrivateView = (viewRef) => {
611
+ const nativeTag = findNodeHandle(viewRef);
612
+ NativeLuciq.removePrivateView(nativeTag);
613
+ };
614
+ /**
615
+ * Shows default Luciq prompt.
616
+ */
617
+ export const show = () => {
618
+ NativeLuciq.show();
619
+ };
620
+ export const onReportSubmitHandler = (handler) => {
621
+ emitter.addListener(NativeEvents.PRESENDING_HANDLER, (report) => {
622
+ const { tags, consoleLogs, luciqLogs, userAttributes, fileAttachments } = report;
623
+ const reportObj = new Report(tags, consoleLogs, luciqLogs, userAttributes, fileAttachments);
624
+ handler && handler(reportObj);
625
+ });
626
+ NativeLuciq.setPreSendingHandler(handler);
627
+ };
628
+ export const onNavigationStateChange = (prevState, currentState, _action) => {
629
+ const currentScreen = LuciqUtils.getActiveRouteName(currentState);
630
+ const prevScreen = LuciqUtils.getActiveRouteName(prevState);
631
+ if (prevScreen !== currentScreen) {
632
+ reportCurrentViewForAndroid(currentScreen);
633
+ if (_currentScreen != null && _currentScreen !== firstScreen) {
634
+ NativeLuciq.reportScreenChange(_currentScreen);
635
+ _currentScreen = null;
636
+ }
637
+ _currentScreen = currentScreen;
638
+ setTimeout(() => {
639
+ if (currentScreen && _currentScreen === currentScreen) {
640
+ NativeLuciq.reportScreenChange(currentScreen);
641
+ _currentScreen = null;
642
+ }
643
+ }, 1000);
644
+ }
645
+ };
646
+ export const onStateChange = (state) => {
647
+ if (!state) {
648
+ return;
649
+ }
650
+ const currentScreen = LuciqUtils.getFullRoute(state);
651
+ reportCurrentViewForAndroid(currentScreen);
652
+ if (_currentScreen !== null && _currentScreen !== firstScreen) {
653
+ NativeLuciq.reportScreenChange(_currentScreen);
654
+ _currentScreen = null;
655
+ }
656
+ _currentScreen = currentScreen;
657
+ setTimeout(() => {
658
+ if (_currentScreen === currentScreen) {
659
+ NativeLuciq.reportScreenChange(currentScreen);
660
+ _currentScreen = null;
661
+ }
662
+ }, 1000);
663
+ };
664
+ /**
665
+ * Sets a listener for screen change
666
+ * @param navigationRef a refrence of a navigation container
667
+ *
668
+ */
669
+ export const setNavigationListener = (navigationRef) => {
670
+ return navigationRef.addListener('state', () => {
671
+ onStateChange(navigationRef.getRootState());
672
+ });
673
+ };
674
+ export const reportScreenChange = (screenName) => {
675
+ NativeLuciq.reportScreenChange(screenName);
676
+ };
677
+ /**
678
+ * Add feature flags to the next report.
679
+ * @param featureFlags An array of feature flags to add to the next report.
680
+ */
681
+ export const addFeatureFlags = (featureFlags) => {
682
+ const entries = featureFlags.map((item) => [item.name, item.variant || '']);
683
+ const flags = Object.fromEntries(entries);
684
+ NativeLuciq.addFeatureFlags(flags);
685
+ };
686
+ /**
687
+ * Add a feature flag to the to next report.
688
+ */
689
+ export const addFeatureFlag = (featureFlag) => {
690
+ addFeatureFlags([featureFlag]);
691
+ };
692
+ /**
693
+ * Remove feature flags from the next report.
694
+ * @param featureFlags An array of feature flags to remove from the next report.
695
+ */
696
+ export const removeFeatureFlags = (featureFlags) => {
697
+ NativeLuciq.removeFeatureFlags(featureFlags);
698
+ };
699
+ /**
700
+ * Remove a feature flag from the next report.
701
+ * @param name the name of the feature flag to remove from the next report.
702
+ */
703
+ export const removeFeatureFlag = (name) => {
704
+ removeFeatureFlags([name]);
705
+ };
706
+ /**
707
+ * Clear all feature flags
708
+ */
709
+ export const removeAllFeatureFlags = () => {
710
+ NativeLuciq.removeAllFeatureFlags();
711
+ };
712
+ /**
713
+ * This API has to be call when using custom app rating prompt
714
+ */
715
+ export const willRedirectToStore = () => {
716
+ NativeLuciq.willRedirectToStore();
717
+ };
718
+ /**
719
+ * This API has be called when changing the default Metro server port (8081) to exclude the DEV URL from network logging.
720
+ */
721
+ export const setMetroDevServerPort = (port) => {
722
+ LuciqRNConfig.metroDevServerPort = port.toString();
723
+ };
724
+ export const componentDidAppearListener = (event) => {
725
+ if (_isFirstScreen) {
726
+ _lastScreen = event.componentName;
727
+ _isFirstScreen = false;
728
+ return;
729
+ }
730
+ if (_lastScreen !== event.componentName) {
731
+ NativeLuciq.reportScreenChange(event.componentName);
732
+ _lastScreen = event.componentName;
733
+ }
734
+ };
735
+ /**
736
+ * Sets listener to feature flag changes
737
+ * @param handler A callback that gets the update value of the flag
738
+ */
739
+ export const _registerFeatureFlagsChangeListener = (handler) => {
740
+ emitter.addListener(NativeEvents.ON_FEATURE_FLAGS_CHANGE, (payload) => {
741
+ handler(payload);
742
+ });
743
+ NativeLuciq.registerFeatureFlagsChangeListener();
744
+ };
745
+ /**
746
+ * Sets the auto mask screenshots types.
747
+ * @param autoMaskingTypes The masking type to be applied.
748
+ */
749
+ export const enableAutoMasking = (autoMaskingTypes) => {
750
+ NativeLuciq.enableAutoMasking(autoMaskingTypes);
751
+ };
752
+ /**
753
+ * Sets a custom theme for Luciq UI elements.
754
+ *
755
+ * This method provides comprehensive theming support. It will automatically use LCQTheme
756
+ * if available in the SDK version, otherwise falls back to individual theming methods.
757
+ *
758
+ * @param theme - Configuration object containing theme properties
759
+ *
760
+ * @example
761
+ * ```typescript
762
+ * // Basic usage with primary color (always supported)
763
+ * Luciq.setTheme({
764
+ * primaryColor: '#FF6B6B'
765
+ * });
766
+ *
767
+ * // Comprehensive theming (uses LCQTheme when available)
768
+ * Luciq.setTheme({
769
+ * primaryColor: '#FF6B6B',
770
+ * secondaryTextColor: '#666666',
771
+ * primaryTextColor: '#333333',
772
+ * titleTextColor: '#000000',
773
+ * backgroundColor: '#FFFFFF',
774
+ * primaryTextStyle: 'bold',
775
+ * secondaryTextStyle: 'normal',
776
+ * titleTextStyle: 'bold',
777
+ * ctaTextStyle: 'bold',
778
+ * primaryFontPath: '/data/user/0/ai.yourapp/files/fonts/YourFont.ttf',
779
+ * secondaryFontPath: '/data/user/0/ai.yourapp/files/fonts/YourFont.ttf',
780
+ * ctaTextType: '/data/user/0/ai.yourapp/files/fonts/YourFont.ttf',
781
+ * primaryFontAsset: 'fonts/YourFont.ttf',
782
+ * secondaryFontAsset: 'fonts/YourFont.ttf'
783
+ * });
784
+ * ```
785
+ */
786
+ export const setTheme = (theme) => {
787
+ NativeLuciq.setTheme(theme);
788
+ };
789
+ /**
790
+ * Enables or disables displaying in full-screen mode, hiding the status and navigation bars.
791
+ * @param isEnabled A boolean to enable/disable setFullscreen.
792
+ */
793
+ export const setFullscreen = (isEnabled) => {
794
+ if (Platform.OS === 'android') {
795
+ NativeLuciq.setFullscreen(isEnabled);
796
+ }
797
+ };