@luciq/react-native 19.3.0 → 19.4.0-44237-SNAPSHOT

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 (110) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +118 -0
  3. package/RNLuciq.podspec +6 -2
  4. package/android/build.gradle +25 -0
  5. package/android/native.gradle +1 -1
  6. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqAPMModule.java +3 -3
  7. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqBugReportingModule.java +28 -24
  8. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqCrashReportingModule.java +18 -7
  9. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqFeatureRequestsModule.java +1 -2
  10. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqNetworkLoggerModule.java +24 -29
  11. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqReactnativeModule.java +112 -16
  12. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqReactnativePackage.java +2 -0
  13. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqRepliesModule.java +4 -16
  14. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqSessionReplayModule.java +5 -16
  15. package/android/src/main/java/ai/luciq/reactlibrary/RNLuciqSurveysModule.java +7 -15
  16. package/android/src/main/java/ai/luciq/reactlibrary/utils/ReportUtil.java +0 -7
  17. package/android/src/newarch/java/ai/luciq/reactlibrary/RNLuciqAPMBaseSpec.java +9 -0
  18. package/android/src/newarch/java/ai/luciq/reactlibrary/RNLuciqBaseSpec.java +33 -0
  19. package/android/src/newarch/java/ai/luciq/reactlibrary/RNLuciqBugReportingBaseSpec.java +33 -0
  20. package/android/src/newarch/java/ai/luciq/reactlibrary/RNLuciqCrashReportingBaseSpec.java +9 -0
  21. package/android/src/newarch/java/ai/luciq/reactlibrary/RNLuciqFeatureRequestsBaseSpec.java +9 -0
  22. package/android/src/newarch/java/ai/luciq/reactlibrary/RNLuciqNetworkLoggerBaseSpec.java +33 -0
  23. package/android/src/newarch/java/ai/luciq/reactlibrary/RNLuciqRepliesBaseSpec.java +33 -0
  24. package/android/src/newarch/java/ai/luciq/reactlibrary/RNLuciqSessionReplayBaseSpec.java +33 -0
  25. package/android/src/newarch/java/ai/luciq/reactlibrary/RNLuciqSurveysBaseSpec.java +33 -0
  26. package/android/src/oldarch/java/ai/luciq/reactlibrary/RNLuciqAPMBaseSpec.java +11 -0
  27. package/android/src/oldarch/java/ai/luciq/reactlibrary/RNLuciqBaseSpec.java +22 -0
  28. package/android/src/oldarch/java/ai/luciq/reactlibrary/RNLuciqBugReportingBaseSpec.java +22 -0
  29. package/android/src/oldarch/java/ai/luciq/reactlibrary/RNLuciqCrashReportingBaseSpec.java +10 -0
  30. package/android/src/oldarch/java/ai/luciq/reactlibrary/RNLuciqFeatureRequestsBaseSpec.java +10 -0
  31. package/android/src/oldarch/java/ai/luciq/reactlibrary/RNLuciqNetworkLoggerBaseSpec.java +22 -0
  32. package/android/src/oldarch/java/ai/luciq/reactlibrary/RNLuciqRepliesBaseSpec.java +22 -0
  33. package/android/src/oldarch/java/ai/luciq/reactlibrary/RNLuciqSessionReplayBaseSpec.java +22 -0
  34. package/android/src/oldarch/java/ai/luciq/reactlibrary/RNLuciqSurveysBaseSpec.java +22 -0
  35. package/dist/modules/BugReporting.js +3 -3
  36. package/dist/modules/Luciq.d.ts +15 -0
  37. package/dist/modules/Luciq.js +22 -1
  38. package/dist/modules/Replies.js +1 -1
  39. package/dist/modules/Surveys.js +2 -2
  40. package/dist/native/NativeBugReporting.d.ts +4 -4
  41. package/dist/native/NativeCrashReporting.d.ts +2 -2
  42. package/dist/native/NativeLuciq.d.ts +5 -3
  43. package/dist/native/NativePackage.js +25 -2
  44. package/dist/native/NativeReplies.d.ts +1 -1
  45. package/dist/native/NativeSurveys.d.ts +2 -2
  46. package/dist/native/specs/NativeAPM.d.ts +21 -0
  47. package/dist/native/specs/NativeAPM.js +2 -0
  48. package/dist/native/specs/NativeBugReporting.d.ts +29 -0
  49. package/dist/native/specs/NativeBugReporting.js +2 -0
  50. package/dist/native/specs/NativeCrashReporting.d.ts +12 -0
  51. package/dist/native/specs/NativeCrashReporting.js +2 -0
  52. package/dist/native/specs/NativeFeatureRequests.d.ts +8 -0
  53. package/dist/native/specs/NativeFeatureRequests.js +2 -0
  54. package/dist/native/specs/NativeLuciq.d.ts +80 -0
  55. package/dist/native/specs/NativeLuciq.js +2 -0
  56. package/dist/native/specs/NativeNetworkLogger.d.ts +16 -0
  57. package/dist/native/specs/NativeNetworkLogger.js +2 -0
  58. package/dist/native/specs/NativeReplies.d.ts +21 -0
  59. package/dist/native/specs/NativeReplies.js +2 -0
  60. package/dist/native/specs/NativeSessionReplay.d.ts +17 -0
  61. package/dist/native/specs/NativeSessionReplay.js +2 -0
  62. package/dist/native/specs/NativeSurveys.d.ts +18 -0
  63. package/dist/native/specs/NativeSurveys.js +2 -0
  64. package/dist/utils/Enums.js +3 -1
  65. package/dist/utils/LuciqUtils.d.ts +1 -1
  66. package/dist/utils/LuciqUtils.js +0 -3
  67. package/ios/RNLuciq/LuciqAPMBridge.h +5 -5
  68. package/ios/RNLuciq/{LuciqAPMBridge.m → LuciqAPMBridge.mm} +48 -39
  69. package/ios/RNLuciq/LuciqBugReportingBridge.h +6 -6
  70. package/ios/RNLuciq/LuciqBugReportingBridge.mm +234 -0
  71. package/ios/RNLuciq/LuciqCrashReportingBridge.h +16 -5
  72. package/ios/RNLuciq/LuciqCrashReportingBridge.mm +91 -0
  73. package/ios/RNLuciq/LuciqFeatureRequestsBridge.h +1 -1
  74. package/ios/RNLuciq/{LuciqFeatureRequestsBridge.m → LuciqFeatureRequestsBridge.mm} +21 -16
  75. package/ios/RNLuciq/LuciqNetworkLoggerBridge.h +1 -30
  76. package/ios/RNLuciq/{LuciqNetworkLoggerBridge.m → LuciqNetworkLoggerBridge.mm} +46 -77
  77. package/ios/RNLuciq/LuciqReactBridge.h +13 -13
  78. package/ios/RNLuciq/{LuciqReactBridge.m → LuciqReactBridge.mm} +95 -34
  79. package/ios/RNLuciq/LuciqRepliesBridge.h +3 -3
  80. package/ios/RNLuciq/LuciqRepliesBridge.mm +86 -0
  81. package/ios/RNLuciq/LuciqSessionReplayBridge.h +5 -5
  82. package/ios/RNLuciq/{LuciqSessionReplayBridge.m → LuciqSessionReplayBridge.mm} +35 -25
  83. package/ios/RNLuciq/LuciqSurveysBridge.h +5 -5
  84. package/ios/RNLuciq/{LuciqSurveysBridge.m → LuciqSurveysBridge.mm} +34 -35
  85. package/ios/native.rb +1 -1
  86. package/package.json +9 -2
  87. package/src/modules/BugReporting.ts +3 -3
  88. package/src/modules/Luciq.ts +25 -1
  89. package/src/modules/Replies.ts +1 -1
  90. package/src/modules/Surveys.ts +2 -2
  91. package/src/native/NativeBugReporting.ts +3 -6
  92. package/src/native/NativeCrashReporting.ts +2 -2
  93. package/src/native/NativeLuciq.ts +7 -3
  94. package/src/native/NativePackage.ts +52 -2
  95. package/src/native/NativeReplies.ts +1 -1
  96. package/src/native/NativeSurveys.ts +2 -2
  97. package/src/native/specs/NativeAPM.ts +47 -0
  98. package/src/native/specs/NativeBugReporting.ts +53 -0
  99. package/src/native/specs/NativeCrashReporting.ts +23 -0
  100. package/src/native/specs/NativeFeatureRequests.ts +10 -0
  101. package/src/native/specs/NativeLuciq.ts +137 -0
  102. package/src/native/specs/NativeNetworkLogger.ts +31 -0
  103. package/src/native/specs/NativeReplies.ts +27 -0
  104. package/src/native/specs/NativeSessionReplay.ts +20 -0
  105. package/src/native/specs/NativeSurveys.ts +23 -0
  106. package/src/utils/Enums.ts +4 -1
  107. package/src/utils/LuciqUtils.ts +1 -6
  108. package/ios/RNLuciq/LuciqBugReportingBridge.m +0 -249
  109. package/ios/RNLuciq/LuciqCrashReportingBridge.m +0 -68
  110. package/ios/RNLuciq/LuciqRepliesBridge.m +0 -80
@@ -1,5 +1,7 @@
1
1
  import { NativeLuciq } from '../native/NativeLuciq';
2
- const constants = NativeLuciq.getConstants();
2
+ const constants = typeof NativeLuciq.getConstants === 'function'
3
+ ? NativeLuciq.getConstants()
4
+ : NativeLuciq.getAllConstants();
3
5
  /**
4
6
  * Verbosity level of the SDK debug logs. This has nothing to do with `Luciq.log`,
5
7
  * and only affect the logs used to debug the SDK itself.
@@ -28,7 +28,7 @@ export declare const stringifyIfNotString: (input: unknown) => string;
28
28
  * `sendCrashReport(error, NativeCrashReporting.sendJSCrash);`
29
29
  *
30
30
  */
31
- export declare function sendCrashReport(error: ExtendedError, remoteSenderCallback: (json: CrashData | string) => Promise<void>): Promise<void>;
31
+ export declare function sendCrashReport(error: ExtendedError, remoteSenderCallback: (json: CrashData) => Promise<void>): Promise<void>;
32
32
  /**
33
33
  * Generate random 32 bit unsigned integer Hexadecimal (8 chars) lower case letters
34
34
  * Should not return all zeros
@@ -128,9 +128,6 @@ export const stringifyIfNotString = (input) => {
128
128
  */
129
129
  export async function sendCrashReport(error, remoteSenderCallback) {
130
130
  const jsonObject = getCrashDataFromError(error);
131
- if (Platform.OS === 'android') {
132
- return remoteSenderCallback(JSON.stringify(jsonObject));
133
- }
134
131
  return remoteSenderCallback(jsonObject);
135
132
  }
136
133
  /**
@@ -17,7 +17,7 @@
17
17
  - (void)setAutoUITraceEnabled:(BOOL)isEnabled;
18
18
  - (void)startFlow:(NSString *)name;
19
19
  - (void)endFlow:(NSString *)name;
20
- - (void)setFlowAttribute:(NSString *)name :(NSString *)key :(NSString *_Nullable)value;
20
+ - (void)setFlowAttribute:(NSString *)name key:(NSString *)key value:(NSString *_Nullable)value;
21
21
  - (void)startUITrace:(NSString *)name;
22
22
  - (void)endUITrace;
23
23
 
@@ -27,13 +27,13 @@
27
27
  - (void)syncCustomSpan:(NSString *)name
28
28
  startTimestamp:(double)startTimestamp
29
29
  endTimestamp:(double)endTimestamp
30
- resolver:(RCTPromiseResolveBlock)resolve
31
- rejecter:(RCTPromiseRejectBlock)reject;
30
+ resolve:(RCTPromiseResolveBlock)resolve
31
+ reject:(RCTPromiseRejectBlock)reject;
32
32
 
33
33
  - (void)isCustomSpanEnabled:(RCTPromiseResolveBlock)resolve
34
- rejecter:(RCTPromiseRejectBlock)reject;
34
+ reject:(RCTPromiseRejectBlock)reject;
35
35
 
36
36
  - (void)isAPMEnabled:(RCTPromiseResolveBlock)resolve
37
- rejecter:(RCTPromiseRejectBlock)reject;
37
+ reject:(RCTPromiseRejectBlock)reject;
38
38
 
39
39
  @end
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  #import "LuciqAPMBridge.h"
4
2
  #import <LuciqSDK/LCQAPM.h>
5
3
  #import <asl.h>
@@ -9,6 +7,13 @@
9
7
  #import <React/RCTUIManager.h>
10
8
  #import "Util/LCQAPM+PrivateAPIs.h"
11
9
 
10
+ #ifdef RCT_NEW_ARCH_ENABLED
11
+ #import <RNLuciqSpec/RNLuciqSpec.h>
12
+
13
+ @interface LuciqAPMBridge () <NativeAPMSpec>
14
+ @end
15
+ #endif
16
+
12
17
  @implementation LuciqAPMBridge
13
18
 
14
19
  - (dispatch_queue_t)methodQueue {
@@ -26,86 +31,91 @@
26
31
 
27
32
  RCT_EXPORT_MODULE(LCQAPM)
28
33
 
29
- - (id) init
34
+ - (id)init
30
35
  {
31
36
  self = [super init];
32
37
  return self;
33
38
  }
34
39
 
35
- // Pauses the current thread for 3 seconds.
36
- RCT_EXPORT_METHOD(LCQSleep) {
40
+ RCT_EXPORT_METHOD(lcqSleep) {
37
41
  [NSThread sleepForTimeInterval:3.0f];
38
42
  }
39
43
 
40
- // Enables or disables APM.
41
44
  RCT_EXPORT_METHOD(setEnabled:(BOOL)isEnabled) {
42
45
  LCQAPM.enabled = isEnabled;
43
46
  }
44
47
 
45
- // Determines either coldAppLaunch is enabled or not.
46
48
  RCT_EXPORT_METHOD(setAppLaunchEnabled:(BOOL)isEnabled) {
47
49
  LCQAPM.coldAppLaunchEnabled = isEnabled;
48
50
  }
49
51
 
50
- // This method is used to signal the end of the app launch process.
51
52
  RCT_EXPORT_METHOD(endAppLaunch) {
52
53
  [LCQAPM endAppLaunch];
53
54
  }
54
55
 
55
- // Controls whether automatic tracing of UI interactions is enabled or disabled within the SDK.
56
56
  RCT_EXPORT_METHOD(setAutoUITraceEnabled:(BOOL)isEnabled) {
57
57
  LCQAPM.autoUITraceEnabled = isEnabled;
58
58
  }
59
59
 
60
- // Starts a flow trace with the specified `name`,
61
- // allowing the SDK to capture and analyze the flow of execution within the application.
62
- RCT_EXPORT_METHOD(startFlow: (NSString *)name) {
60
+ RCT_EXPORT_METHOD(startFlow:(NSString *)name) {
63
61
  [LCQAPM startFlowWithName:name];
64
62
  }
65
63
 
66
- // Ends a flow with the specified `name`.
67
- RCT_EXPORT_METHOD(endFlow: (NSString *)name) {
64
+ RCT_EXPORT_METHOD(endFlow:(NSString *)name) {
68
65
  [LCQAPM endFlowWithName:name];
69
66
  }
70
67
 
71
-
72
- // Sets a user defined attribute for the currently active flow.
73
- RCT_EXPORT_METHOD(setFlowAttribute:(NSString *)name :(NSString *)key :(NSString *_Nullable)value) {
68
+ RCT_EXPORT_METHOD(setFlowAttribute:(NSString *)name
69
+ key:(NSString *)key
70
+ value:(NSString * _Nullable)value) {
74
71
  [LCQAPM setAttributeForFlowWithName:name key:key value:value];
75
72
  }
76
73
 
77
- // Starts a new `UITrace` with the provided `name` parameter,
78
- // allowing the SDK to capture and analyze the UI components within the application.
79
74
  RCT_EXPORT_METHOD(startUITrace:(NSString *)name) {
80
75
  [LCQAPM startUITraceWithName:name];
81
76
  }
82
77
 
83
- // Terminates the currently active UI trace.
84
78
  RCT_EXPORT_METHOD(endUITrace) {
85
79
  [LCQAPM endUITrace];
86
80
  }
87
81
 
88
- // Enables or disables screen render.
89
82
  RCT_EXPORT_METHOD(setScreenRenderingEnabled:(BOOL)isEnabled) {
90
83
  LCQAPM.screenRenderingEnabled = isEnabled;
91
84
  }
92
85
 
93
- // Syncs a custom span to the native SDK (currently logs only)
86
+ RCT_EXPORT_METHOD(networkLogAndroid:(double)requestStartTime
87
+ requestDuration:(double)requestDuration
88
+ requestHeaders:(NSString *)requestHeaders
89
+ requestBody:(NSString *)requestBody
90
+ requestBodySize:(double)requestBodySize
91
+ requestMethod:(NSString *)requestMethod
92
+ requestUrl:(NSString *)requestUrl
93
+ requestContentType:(NSString *)requestContentType
94
+ responseHeaders:(NSString *)responseHeaders
95
+ responseBody:(NSString * _Nullable)responseBody
96
+ responseBodySize:(double)responseBodySize
97
+ statusCode:(double)statusCode
98
+ responseContentType:(NSString *)responseContentType
99
+ errorDomain:(NSString *)errorDomain
100
+ w3cExternalTraceAttributes:(NSDictionary *)w3cExternalTraceAttributes
101
+ gqlQueryName:(NSString * _Nullable)gqlQueryName
102
+ serverErrorMessage:(NSString * _Nullable)serverErrorMessage) {
103
+ // Android-only; iOS no-op to satisfy unified spec.
104
+ }
105
+
94
106
  RCT_EXPORT_METHOD(syncCustomSpan:(NSString *)name
95
107
  startTimestamp:(double)startTimestamp
96
108
  endTimestamp:(double)endTimestamp
97
- resolver:(RCTPromiseResolveBlock)resolve
98
- rejecter:(RCTPromiseRejectBlock)reject)
109
+ resolve:(RCTPromiseResolveBlock)resolve
110
+ reject:(RCTPromiseRejectBlock)reject)
99
111
  {
100
112
  @try {
101
- // Convert microseconds → seconds (NSDate uses seconds)
102
113
  NSTimeInterval startSeconds = startTimestamp / 1e6;
103
114
  NSTimeInterval endSeconds = endTimestamp / 1e6;
104
115
 
105
116
  NSDate *startDate = [NSDate dateWithTimeIntervalSince1970:startSeconds];
106
117
  NSDate *endDate = [NSDate dateWithTimeIntervalSince1970:endSeconds];
107
118
 
108
- // Add completed span to APM
109
119
  [LCQAPM addCompletedCustomSpanWithName:name
110
120
  startDate:startDate
111
121
  endDate:endDate];
@@ -113,17 +123,14 @@ RCT_EXPORT_METHOD(syncCustomSpan:(NSString *)name
113
123
  resolve(@YES);
114
124
  }
115
125
  @catch (NSException *exception) {
116
- reject(
117
- @"SYNC_CUSTOM_SPAN_ERROR",
118
- exception.reason ?: @"Failed to sync custom span",
119
- nil
120
- );
126
+ reject(@"SYNC_CUSTOM_SPAN_ERROR",
127
+ exception.reason ?: @"Failed to sync custom span",
128
+ nil);
121
129
  }
122
130
  }
123
131
 
124
- // Checks if custom spans feature is enabled
125
132
  RCT_EXPORT_METHOD(isCustomSpanEnabled:(RCTPromiseResolveBlock)resolve
126
- rejecter:(RCTPromiseRejectBlock)reject) {
133
+ reject:(RCTPromiseRejectBlock)reject) {
127
134
  @try {
128
135
  BOOL enabled = LCQAPM.customSpansEnabled;
129
136
  resolve(@(enabled));
@@ -133,9 +140,8 @@ RCT_EXPORT_METHOD(isCustomSpanEnabled:(RCTPromiseResolveBlock)resolve
133
140
  }
134
141
  }
135
142
 
136
- // Checks if APM is enabled
137
143
  RCT_EXPORT_METHOD(isAPMEnabled:(RCTPromiseResolveBlock)resolve
138
- rejecter:(RCTPromiseRejectBlock)reject) {
144
+ reject:(RCTPromiseRejectBlock)reject) {
139
145
  @try {
140
146
  BOOL enabled = LCQAPM.enabled;
141
147
  resolve(@(enabled));
@@ -145,13 +151,16 @@ RCT_EXPORT_METHOD(isAPMEnabled:(RCTPromiseResolveBlock)resolve
145
151
  }
146
152
  }
147
153
 
148
-
154
+ #ifdef RCT_NEW_ARCH_ENABLED
155
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
156
+ (const facebook::react::ObjCTurboModule::InitParams &)params
157
+ {
158
+ return std::make_shared<facebook::react::NativeAPMSpecJSI>(params);
159
+ }
160
+ #endif
149
161
 
150
162
  @synthesize description;
151
-
152
163
  @synthesize hash;
153
-
154
164
  @synthesize superclass;
155
165
 
156
166
  @end
157
-
@@ -25,21 +25,21 @@
25
25
 
26
26
  - (void)setOptions:(NSArray *)optionsArray;
27
27
 
28
- - (void)setFloatingButtonEdge:(CGRectEdge)floatingButtonEdge withTopOffset:(double)floatingButtonOffsetFromTop;
28
+ - (void)setFloatingButtonEdge:(NSString *)edge offset:(double)offset;
29
29
 
30
- - (void)setOnInvokeHandler:(RCTResponseSenderBlock)callBack;
30
+ - (void)setOnInvokeHandler;
31
31
 
32
- - (void)setOnSDKDismissedHandler:(RCTResponseSenderBlock)callBack;
32
+ - (void)setOnSDKDismissedHandler;
33
33
 
34
34
  - (void)setShakingThresholdForiPhone:(double)iPhoneShakingThreshold;
35
35
 
36
36
  - (void)setShakingThresholdForiPad:(double)iPadShakingThreshold;
37
37
 
38
- - (void)setExtendedBugReportMode:(LCQExtendedBugReportMode)extendedBugReportMode;
38
+ - (void)setExtendedBugReportMode:(NSString *)mode;
39
39
 
40
40
  - (void)setReportTypes:(NSArray *)types;
41
41
 
42
- - (void)show:(LCQBugReportingReportType)type options:(NSArray *)options;
42
+ - (void)show:(NSString *)type options:(NSArray *)options;
43
43
 
44
44
  - (void)setAutoScreenRecordingEnabled:(BOOL)enabled;
45
45
 
@@ -57,6 +57,6 @@
57
57
  checked:(BOOL)checked
58
58
  actionType:(id)actionType;
59
59
 
60
- - (void)setProactiveReportingConfigurations:(BOOL)enabled gap:(NSNumber* )gap model:(NSNumber* )modal;
60
+ - (void)setProactiveReportingConfigurations:(BOOL)enabled gapBetweenModals:(double)gapBetweenModals modalDelayAfterDetection:(double)modalDelayAfterDetection;
61
61
 
62
62
  @end
@@ -0,0 +1,234 @@
1
+ #import "LuciqBugReportingBridge.h"
2
+ #import <LuciqSDK/LCQBugReporting.h>
3
+ #import <asl.h>
4
+ #import <React/RCTLog.h>
5
+ #import <os/log.h>
6
+ #import <React/RCTUIManager.h>
7
+
8
+ #ifdef RCT_NEW_ARCH_ENABLED
9
+ #import <RNLuciqSpec/RNLuciqSpec.h>
10
+
11
+ @interface LuciqBugReportingBridge () <NativeBugReportingSpec>
12
+ @end
13
+ #endif
14
+
15
+ @implementation LuciqBugReportingBridge
16
+
17
+ - (dispatch_queue_t)methodQueue {
18
+ return dispatch_get_main_queue();
19
+ }
20
+
21
+ + (BOOL)requiresMainQueueSetup
22
+ {
23
+ return NO;
24
+ }
25
+
26
+ - (NSArray<NSString *> *)supportedEvents {
27
+ return @[
28
+ @"LCQpreInvocationHandler",
29
+ @"LCQpostInvocationHandler",
30
+ @"LCQDidSelectPromptOptionHandler",
31
+ ];
32
+ }
33
+
34
+ RCT_EXPORT_MODULE(LCQBugReporting)
35
+
36
+ RCT_EXPORT_METHOD(setEnabled:(BOOL)isEnabled) {
37
+ LCQBugReporting.enabled = isEnabled;
38
+ }
39
+
40
+ RCT_EXPORT_METHOD(setAutoScreenRecordingEnabled:(BOOL)enabled) {
41
+ LCQBugReporting.autoScreenRecordingEnabled = enabled;
42
+ }
43
+
44
+ RCT_EXPORT_METHOD(setAutoScreenRecordingDuration:(double)duration) {
45
+ LCQBugReporting.autoScreenRecordingDuration = duration;
46
+ }
47
+
48
+ RCT_EXPORT_METHOD(setOnInvokeHandler) {
49
+ __weak LuciqBugReportingBridge *weakSelf = self;
50
+ LCQBugReporting.willInvokeHandler = ^{
51
+ [weakSelf sendEventWithName:@"LCQpreInvocationHandler" body:nil];
52
+ };
53
+ }
54
+
55
+ RCT_EXPORT_METHOD(setOnSDKDismissedHandler) {
56
+ __weak LuciqBugReportingBridge *weakSelf = self;
57
+ LCQBugReporting.didDismissHandler = ^(LCQDismissType dismissType, LCQReportCategory reportType) {
58
+ NSString *dismissTypeString;
59
+ if (dismissType == LCQDismissTypeCancel) {
60
+ dismissTypeString = @"CANCEL";
61
+ } else if (dismissType == LCQDismissTypeSubmit) {
62
+ dismissTypeString = @"SUBMIT";
63
+ } else if (dismissType == LCQDismissTypeAddAttachment) {
64
+ dismissTypeString = @"ADD_ATTACHMENT";
65
+ }
66
+
67
+ NSString *reportTypeString;
68
+ if (reportType == LCQReportCategoryBug) {
69
+ reportTypeString = @"bug";
70
+ } else if (reportType == LCQReportCategoryFeedback) {
71
+ reportTypeString = @"feedback";
72
+ } else {
73
+ reportTypeString = @"other";
74
+ }
75
+ NSDictionary *result = @{ @"dismissType": dismissTypeString,
76
+ @"reportType": reportTypeString };
77
+ [weakSelf sendEventWithName:@"LCQpostInvocationHandler" body:result];
78
+ };
79
+ }
80
+
81
+ RCT_EXPORT_METHOD(setDidSelectPromptOptionHandler) {
82
+ __weak LuciqBugReportingBridge *weakSelf = self;
83
+ LCQBugReporting.didSelectPromptOptionHandler = ^(LCQPromptOption promptOption) {
84
+ NSString *promptOptionString;
85
+ if (promptOption == LCQPromptOptionBug) {
86
+ promptOptionString = @"bug";
87
+ } else if (promptOption == LCQBugReportingTypeFeedback) {
88
+ promptOptionString = @"feedback";
89
+ } else if (promptOption == LCQPromptOptionChat) {
90
+ promptOptionString = @"chat";
91
+ } else {
92
+ promptOptionString = @"none";
93
+ }
94
+ [weakSelf sendEventWithName:@"LCQDidSelectPromptOptionHandler"
95
+ body:@{@"promptOption": promptOptionString}];
96
+ };
97
+ }
98
+
99
+ RCT_EXPORT_METHOD(setInvocationEvents:(NSArray *)invocationEventsArray) {
100
+ LCQInvocationEvent invocationEvents = 0;
101
+ for (id value in invocationEventsArray) {
102
+ invocationEvents |= [value intValue];
103
+ }
104
+ LCQBugReporting.invocationEvents = invocationEvents;
105
+ }
106
+
107
+ RCT_EXPORT_METHOD(setOptions:(NSArray *)invocationOptionsArray) {
108
+ LCQBugReportingOption invocationOptions = 0;
109
+ for (id value in invocationOptionsArray) {
110
+ invocationOptions |= [value intValue];
111
+ }
112
+ LCQBugReporting.bugReportingOptions = invocationOptions;
113
+ }
114
+
115
+ RCT_EXPORT_METHOD(setFloatingButtonEdge:(NSString *)edge offset:(double)offset) {
116
+ LCQBugReporting.floatingButtonEdge = (CGRectEdge)[edge intValue];
117
+ LCQBugReporting.floatingButtonTopOffset = offset;
118
+ }
119
+
120
+ RCT_EXPORT_METHOD(setExtendedBugReportMode:(NSString *)mode) {
121
+ LCQBugReporting.extendedBugReportMode = (LCQExtendedBugReportMode)[mode intValue];
122
+ }
123
+
124
+ RCT_EXPORT_METHOD(setEnabledAttachmentTypes:(BOOL)screenshot
125
+ extraScreenshot:(BOOL)extraScreenshot
126
+ galleryImage:(BOOL)galleryImage
127
+ screenRecording:(BOOL)screenRecording) {
128
+ LCQAttachmentType attachmentTypes = 0;
129
+ if (screenshot) attachmentTypes = LCQAttachmentTypeScreenShot;
130
+ if (extraScreenshot) attachmentTypes |= LCQAttachmentTypeExtraScreenShot;
131
+ if (galleryImage) attachmentTypes |= LCQAttachmentTypeGalleryImage;
132
+ if (screenRecording) attachmentTypes |= LCQAttachmentTypeScreenRecording;
133
+
134
+ LCQBugReporting.enabledAttachmentTypes = attachmentTypes;
135
+ }
136
+
137
+ RCT_EXPORT_METHOD(setViewHierarchyEnabled:(BOOL)viewHierarchyEnabled) {
138
+ LCQBugReporting.shouldCaptureViewHierarchy = viewHierarchyEnabled;
139
+ }
140
+
141
+ RCT_EXPORT_METHOD(setVideoRecordingFloatingButtonPosition:(NSString *)position) {
142
+ LCQBugReporting.videoRecordingFloatingButtonPosition = (LCQPosition)[position intValue];
143
+ }
144
+
145
+ RCT_EXPORT_METHOD(setReportTypes:(NSArray *)types) {
146
+ LCQBugReportingReportType reportTypes = 0;
147
+ for (id value in types) {
148
+ reportTypes |= [value intValue];
149
+ }
150
+ [LCQBugReporting setPromptOptionsEnabledReportTypes:reportTypes];
151
+ }
152
+
153
+ RCT_EXPORT_METHOD(show:(NSString *)type options:(NSArray *)options) {
154
+ LCQBugReportingOption parsedOptions = 0;
155
+ for (id value in options) {
156
+ parsedOptions |= [value intValue];
157
+ }
158
+ NSArray *args = @[@([type intValue]), @(parsedOptions)];
159
+ [[NSRunLoop mainRunLoop] performSelector:@selector(showBugReportingWithReportTypeAndOptionsHelper:)
160
+ target:self
161
+ argument:args
162
+ order:0
163
+ modes:@[NSDefaultRunLoopMode]];
164
+ }
165
+
166
+ - (void)showBugReportingWithReportTypeAndOptionsHelper:(NSArray *)args {
167
+ LCQBugReportingReportType parsedReportType = [args[0] intValue];
168
+ LCQBugReportingOption parsedOptions = [args[1] intValue];
169
+ [LCQBugReporting showWithReportType:parsedReportType options:parsedOptions];
170
+ }
171
+
172
+ RCT_EXPORT_METHOD(setShakingThresholdForiPhone:(double)iPhoneShakingThreshold) {
173
+ LCQBugReporting.shakingThresholdForiPhone = iPhoneShakingThreshold;
174
+ }
175
+
176
+ RCT_EXPORT_METHOD(setShakingThresholdForiPad:(double)iPadShakingThreshold) {
177
+ LCQBugReporting.shakingThresholdForiPad = iPadShakingThreshold;
178
+ }
179
+
180
+ RCT_EXPORT_METHOD(setDisclaimerText:(NSString *)text) {
181
+ [LCQBugReporting setDisclaimerText:text];
182
+ }
183
+
184
+ RCT_EXPORT_METHOD(setCommentMinimumCharacterCount:(double)limit reportTypes:(NSArray *)reportTypes) {
185
+ LCQBugReportingType parsedReportTypes = 0;
186
+ if (![reportTypes count]) {
187
+ parsedReportTypes = LCQBugReportingTypeBug | LCQBugReportingTypeFeedback | LCQBugReportingTypeQuestion;
188
+ } else {
189
+ for (id value in reportTypes) {
190
+ parsedReportTypes |= [value intValue];
191
+ }
192
+ }
193
+ [LCQBugReporting setCommentMinimumCharacterCount:(NSInteger)limit forBugReportType:parsedReportTypes];
194
+ }
195
+
196
+ RCT_EXPORT_METHOD(addUserConsent:(NSString *)key
197
+ description:(NSString *)description
198
+ mandatory:(BOOL)mandatory
199
+ checked:(BOOL)checked
200
+ actionType:(NSString * _Nullable)actionType) {
201
+ LCQConsentAction mappedActionType = (LCQConsentAction)[actionType integerValue];
202
+ [LCQBugReporting addUserConsentWithKey:key
203
+ description:description
204
+ mandatory:mandatory
205
+ checked:checked
206
+ actionType:mappedActionType];
207
+ }
208
+
209
+ RCT_EXPORT_METHOD(setProactiveReportingConfigurations:(BOOL)enabled
210
+ gapBetweenModals:(double)gapBetweenModals
211
+ modalDelayAfterDetection:(double)modalDelayAfterDetection) {
212
+ LCQProactiveReportingConfigurations *configurations = [[LCQProactiveReportingConfigurations alloc] init];
213
+ configurations.enabled = enabled;
214
+ configurations.gapBetweenModals = @(gapBetweenModals);
215
+ configurations.modalDelayAfterDetection = @(modalDelayAfterDetection);
216
+ [LCQBugReporting setProactiveReportingConfigurations:configurations];
217
+ }
218
+
219
+ // Android-only method — iOS no-op.
220
+ RCT_EXPORT_METHOD(setShakingThresholdForAndroid:(double)threshold) { }
221
+
222
+ #ifdef RCT_NEW_ARCH_ENABLED
223
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
224
+ (const facebook::react::ObjCTurboModule::InitParams &)params
225
+ {
226
+ return std::make_shared<facebook::react::NativeBugReportingSpecJSI>(params);
227
+ }
228
+ #endif
229
+
230
+ @synthesize description;
231
+ @synthesize hash;
232
+ @synthesize superclass;
233
+
234
+ @end
@@ -9,10 +9,21 @@
9
9
 
10
10
  @interface LuciqCrashReportingBridge : RCTEventEmitter <RCTBridgeModule>
11
11
 
12
- - (void)setEnabled:(BOOL) isEnabled;
13
- - (void)sendJSCrash:(NSDictionary *_Nonnull )stackTrace resolver:(RCTPromiseResolveBlock _Nullable )resolve
14
- rejecter:(RCTPromiseRejectBlock _Nullable )reject;
15
- - (void)sendHandledJSCrash:(NSDictionary *_Nonnull)stackTrace userAttributes:(nullable NSDictionary *)userAttributes fingerprint:(nullable NSString *)fingerprint nonFatalExceptionLevel:(LCQNonFatalLevel) nonFatalExceptionLevel resolver:(RCTPromiseResolveBlock _Nullable )resolve
16
- rejecter:(RCTPromiseRejectBlock _Nullable )reject;
12
+ - (void)setEnabled:(BOOL)isEnabled;
13
+
14
+ - (void)sendJSCrash:(NSDictionary * _Nonnull)data
15
+ resolve:(RCTPromiseResolveBlock _Nullable)resolve
16
+ reject:(RCTPromiseRejectBlock _Nullable)reject;
17
+
18
+ - (void)sendHandledJSCrash:(NSDictionary * _Nonnull)data
19
+ userAttributes:(NSDictionary * _Nullable)userAttributes
20
+ fingerprint:(NSString * _Nullable)fingerprint
21
+ nonFatalExceptionLevel:(NSString * _Nullable)nonFatalExceptionLevel
22
+ resolve:(RCTPromiseResolveBlock _Nullable)resolve
23
+ reject:(RCTPromiseRejectBlock _Nullable)reject;
24
+
25
+ - (void)setNDKCrashesEnabled:(BOOL)isEnabled
26
+ resolve:(RCTPromiseResolveBlock _Nullable)resolve
27
+ reject:(RCTPromiseRejectBlock _Nullable)reject;
17
28
 
18
29
  @end
@@ -0,0 +1,91 @@
1
+ #import "LuciqCrashReportingBridge.h"
2
+ #import "Util/LCQCrashReporting+CP.h"
3
+
4
+ #ifdef RCT_NEW_ARCH_ENABLED
5
+ #import <RNLuciqSpec/RNLuciqSpec.h>
6
+
7
+ @interface LuciqCrashReportingBridge () <NativeCrashReportingSpec>
8
+ @end
9
+ #endif
10
+
11
+ @implementation LuciqCrashReportingBridge
12
+
13
+ - (dispatch_queue_t)methodQueue {
14
+ return dispatch_get_main_queue();
15
+ }
16
+
17
+ + (BOOL)requiresMainQueueSetup
18
+ {
19
+ return NO;
20
+ }
21
+
22
+ - (NSArray<NSString *> *)supportedEvents {
23
+ return @[
24
+ @"LCQSendHandledJSCrash",
25
+ @"LCQSendUnhandledJSCrash",
26
+ ];
27
+ }
28
+
29
+ RCT_EXPORT_MODULE(LCQCrashReporting)
30
+
31
+ RCT_EXPORT_METHOD(setEnabled:(BOOL)isEnabled) {
32
+ LCQCrashReporting.enabled = isEnabled;
33
+ }
34
+
35
+ RCT_EXPORT_METHOD(sendJSCrash:(NSDictionary *)data
36
+ resolve:(RCTPromiseResolveBlock)resolve
37
+ reject:(RCTPromiseRejectBlock)reject) {
38
+ dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul);
39
+ dispatch_async(queue, ^{
40
+ [LCQCrashReporting cp_reportFatalCrashWithStackTrace:data];
41
+ resolve([NSNull null]);
42
+ });
43
+ }
44
+
45
+ RCT_EXPORT_METHOD(sendHandledJSCrash:(NSDictionary *)data
46
+ userAttributes:(nullable NSDictionary *)userAttributes
47
+ fingerprint:(nullable NSString *)fingerprint
48
+ nonFatalExceptionLevel:(nullable NSString *)nonFatalExceptionLevel
49
+ resolve:(RCTPromiseResolveBlock)resolve
50
+ reject:(RCTPromiseRejectBlock)reject) {
51
+ if ([fingerprint isKindOfClass:NSNull.class]) {
52
+ fingerprint = nil;
53
+ }
54
+ if ([userAttributes isKindOfClass:NSNull.class]) {
55
+ userAttributes = nil;
56
+ }
57
+
58
+ LCQNonFatalLevel level = LCQNonFatalLevelError;
59
+ if (nonFatalExceptionLevel != nil && ![nonFatalExceptionLevel isKindOfClass:NSNull.class]) {
60
+ level = (LCQNonFatalLevel)[nonFatalExceptionLevel intValue];
61
+ }
62
+
63
+ dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
64
+ dispatch_async(queue, ^{
65
+ [LCQCrashReporting cp_reportNonFatalCrashWithStackTrace:data
66
+ level:level
67
+ groupingString:fingerprint
68
+ userAttributes:userAttributes];
69
+ resolve([NSNull null]);
70
+ });
71
+ }
72
+
73
+ RCT_EXPORT_METHOD(setNDKCrashesEnabled:(BOOL)isEnabled
74
+ resolve:(RCTPromiseResolveBlock)resolve
75
+ reject:(RCTPromiseRejectBlock)reject) {
76
+ resolve([NSNull null]);
77
+ }
78
+
79
+ #ifdef RCT_NEW_ARCH_ENABLED
80
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
81
+ (const facebook::react::ObjCTurboModule::InitParams &)params
82
+ {
83
+ return std::make_shared<facebook::react::NativeCrashReportingSpecJSI>(params);
84
+ }
85
+ #endif
86
+
87
+ @synthesize description;
88
+ @synthesize hash;
89
+ @synthesize superclass;
90
+
91
+ @end
@@ -18,7 +18,7 @@
18
18
  +------------------------------------------------------------------------+
19
19
  */
20
20
 
21
- - (void)setEmailFieldRequiredForFeatureRequests:(BOOL)isEmailFieldRequired forAction:(NSArray *)actionTypesArray;
21
+ - (void)setEmailFieldRequiredForFeatureRequests:(BOOL)isEmailFieldRequired types:(NSArray *)actionTypesArray;
22
22
 
23
23
  - (void)show;
24
24