@sentry/react-native 7.0.0-beta.2 → 7.0.0-rc.2

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 (148) hide show
  1. package/RNSentry.podspec +1 -1
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +77 -0
  4. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  5. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +5 -0
  6. package/dist/js/NativeRNSentry.d.ts +1 -0
  7. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  8. package/dist/js/NativeRNSentry.js.map +1 -1
  9. package/dist/js/client.d.ts +2 -2
  10. package/dist/js/client.d.ts.map +1 -1
  11. package/dist/js/client.js +6 -6
  12. package/dist/js/client.js.map +1 -1
  13. package/dist/js/feedback/FeedbackWidget.js +12 -12
  14. package/dist/js/feedback/FeedbackWidget.js.map +1 -1
  15. package/dist/js/feedback/FeedbackWidgetManager.js +2 -2
  16. package/dist/js/feedback/FeedbackWidgetManager.js.map +1 -1
  17. package/dist/js/feedback/FeedbackWidgetProvider.js +3 -3
  18. package/dist/js/feedback/FeedbackWidgetProvider.js.map +1 -1
  19. package/dist/js/index.d.ts +1 -1
  20. package/dist/js/index.d.ts.map +1 -1
  21. package/dist/js/index.js +1 -1
  22. package/dist/js/index.js.map +1 -1
  23. package/dist/js/integrations/appRegistry.js +2 -2
  24. package/dist/js/integrations/appRegistry.js.map +1 -1
  25. package/dist/js/integrations/debugsymbolicator.js +3 -3
  26. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  27. package/dist/js/integrations/debugsymbolicatorutils.js +3 -3
  28. package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
  29. package/dist/js/integrations/default.d.ts.map +1 -1
  30. package/dist/js/integrations/default.js +7 -4
  31. package/dist/js/integrations/default.js.map +1 -1
  32. package/dist/js/integrations/devicecontext.js +2 -2
  33. package/dist/js/integrations/devicecontext.js.map +1 -1
  34. package/dist/js/integrations/expocontext.d.ts.map +1 -1
  35. package/dist/js/integrations/expocontext.js +2 -2
  36. package/dist/js/integrations/expocontext.js.map +1 -1
  37. package/dist/js/integrations/exports.d.ts +1 -0
  38. package/dist/js/integrations/exports.d.ts.map +1 -1
  39. package/dist/js/integrations/exports.js +1 -0
  40. package/dist/js/integrations/exports.js.map +1 -1
  41. package/dist/js/integrations/logEnricherIntegration.d.ts +3 -0
  42. package/dist/js/integrations/logEnricherIntegration.d.ts.map +1 -0
  43. package/dist/js/integrations/logEnricherIntegration.js +65 -0
  44. package/dist/js/integrations/logEnricherIntegration.js.map +1 -0
  45. package/dist/js/integrations/modulesloader.js +2 -2
  46. package/dist/js/integrations/modulesloader.js.map +1 -1
  47. package/dist/js/integrations/reactnativeerrorhandlers.js +12 -12
  48. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  49. package/dist/js/integrations/reactnativeerrorhandlersutils.js +6 -6
  50. package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -1
  51. package/dist/js/integrations/sdkinfo.js +3 -3
  52. package/dist/js/integrations/sdkinfo.js.map +1 -1
  53. package/dist/js/integrations/spotlight.js +4 -4
  54. package/dist/js/integrations/spotlight.js.map +1 -1
  55. package/dist/js/integrations/viewhierarchy.js +2 -2
  56. package/dist/js/integrations/viewhierarchy.js.map +1 -1
  57. package/dist/js/options.d.ts +8 -0
  58. package/dist/js/options.d.ts.map +1 -1
  59. package/dist/js/options.js.map +1 -1
  60. package/dist/js/playground/modal.js +3 -3
  61. package/dist/js/playground/modal.js.map +1 -1
  62. package/dist/js/profiling/convertHermesProfile.js +5 -5
  63. package/dist/js/profiling/convertHermesProfile.js.map +1 -1
  64. package/dist/js/profiling/debugid.d.ts.map +1 -1
  65. package/dist/js/profiling/debugid.js +2 -2
  66. package/dist/js/profiling/debugid.js.map +1 -1
  67. package/dist/js/profiling/integration.js +13 -13
  68. package/dist/js/profiling/integration.js.map +1 -1
  69. package/dist/js/profiling/utils.js +3 -3
  70. package/dist/js/profiling/utils.js.map +1 -1
  71. package/dist/js/replay/CustomMask.js +3 -3
  72. package/dist/js/replay/CustomMask.js.map +1 -1
  73. package/dist/js/replay/mobilereplay.js +5 -5
  74. package/dist/js/replay/mobilereplay.js.map +1 -1
  75. package/dist/js/sdk.js +7 -7
  76. package/dist/js/sdk.js.map +1 -1
  77. package/dist/js/tools/ModulesCollector.js +12 -12
  78. package/dist/js/tools/ModulesCollector.js.map +1 -1
  79. package/dist/js/tools/enableLogger.js +1 -1
  80. package/dist/js/tools/enableLogger.js.map +1 -1
  81. package/dist/js/tools/metroMiddleware.js +6 -6
  82. package/dist/js/tools/metroMiddleware.js.map +1 -1
  83. package/dist/js/tools/metroconfig.js +2 -2
  84. package/dist/js/tools/metroconfig.js.map +1 -1
  85. package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -1
  86. package/dist/js/tools/sentryBabelTransformerUtils.js +6 -6
  87. package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
  88. package/dist/js/touchevents.js +3 -3
  89. package/dist/js/touchevents.js.map +1 -1
  90. package/dist/js/tracing/gesturetracing.js +5 -5
  91. package/dist/js/tracing/gesturetracing.js.map +1 -1
  92. package/dist/js/tracing/integrations/appStart.js +34 -34
  93. package/dist/js/tracing/integrations/appStart.js.map +1 -1
  94. package/dist/js/tracing/integrations/nativeFrames.js +14 -14
  95. package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
  96. package/dist/js/tracing/integrations/stalltracking.js +7 -7
  97. package/dist/js/tracing/integrations/stalltracking.js.map +1 -1
  98. package/dist/js/tracing/integrations/timeToDisplayIntegration.js +11 -11
  99. package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
  100. package/dist/js/tracing/integrations/userInteraction.js +8 -8
  101. package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
  102. package/dist/js/tracing/onSpanEndUtils.js +10 -10
  103. package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
  104. package/dist/js/tracing/reactnativeprofiler.js +2 -2
  105. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  106. package/dist/js/tracing/reactnavigation.js +14 -14
  107. package/dist/js/tracing/reactnavigation.js.map +1 -1
  108. package/dist/js/tracing/span.d.ts.map +1 -1
  109. package/dist/js/tracing/span.js +11 -5
  110. package/dist/js/tracing/span.js.map +1 -1
  111. package/dist/js/tracing/timetodisplay.js +20 -20
  112. package/dist/js/tracing/timetodisplay.js.map +1 -1
  113. package/dist/js/tracing/utils.js +2 -2
  114. package/dist/js/tracing/utils.js.map +1 -1
  115. package/dist/js/utils/safe.js +3 -3
  116. package/dist/js/utils/safe.js.map +1 -1
  117. package/dist/js/version.d.ts +1 -1
  118. package/dist/js/version.d.ts.map +1 -1
  119. package/dist/js/version.js +1 -1
  120. package/dist/js/version.js.map +1 -1
  121. package/dist/js/wrapper.d.ts +1 -0
  122. package/dist/js/wrapper.d.ts.map +1 -1
  123. package/dist/js/wrapper.js +40 -26
  124. package/dist/js/wrapper.js.map +1 -1
  125. package/ios/RNSentry.h +7 -1
  126. package/ios/RNSentry.mm +86 -21
  127. package/ios/RNSentryReplay.mm +4 -0
  128. package/ios/RNSentryReplayBreadcrumbConverter.h +1 -1
  129. package/ios/RNSentryReplayBreadcrumbConverter.m +17 -4
  130. package/ios/RNSentryReplayQuality.h +13 -0
  131. package/ios/RNSentryReplayQuality.m +25 -0
  132. package/ios/RNSentryVersion.m +1 -1
  133. package/ios/SentrySDKWrapper.h +18 -0
  134. package/ios/SentrySDKWrapper.m +31 -0
  135. package/package.json +11 -11
  136. package/scripts/expo-upload-sourcemaps.js +4 -1
  137. package/scripts/sentry-xcode-debug-files.sh +25 -2
  138. package/scripts/sentry-xcode.sh +23 -3
  139. package/sentry.gradle +27 -6
  140. package/src/js/NativeRNSentry.ts +1 -0
  141. package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -0
  142. package/ts3.8/dist/js/client.d.ts +2 -2
  143. package/ts3.8/dist/js/index.d.ts +1 -1
  144. package/ts3.8/dist/js/integrations/exports.d.ts +1 -0
  145. package/ts3.8/dist/js/integrations/logEnricherIntegration.d.ts +3 -0
  146. package/ts3.8/dist/js/options.d.ts +8 -0
  147. package/ts3.8/dist/js/version.d.ts +1 -1
  148. package/ts3.8/dist/js/wrapper.d.ts +1 -0
package/ios/RNSentry.mm CHANGED
@@ -21,10 +21,22 @@
21
21
  #import <Sentry/PrivateSentrySDKOnly.h>
22
22
  #import <Sentry/SentryAppStartMeasurement.h>
23
23
  #import <Sentry/SentryBinaryImageCache.h>
24
+ #import <Sentry/SentryBreadcrumb.h>
24
25
  #import <Sentry/SentryDebugImageProvider+HybridSDKs.h>
26
+ #import <Sentry/SentryDebugMeta.h>
25
27
  #import <Sentry/SentryDependencyContainer.h>
28
+ #import <Sentry/SentryEvent.h>
29
+ #import <Sentry/SentryException.h>
26
30
  #import <Sentry/SentryFormatter.h>
27
- #import <Sentry/SentryOptions+HybridSDKs.h>
31
+ #import <Sentry/SentryOptions.h>
32
+ #import <Sentry/SentryUser.h>
33
+ #if __has_include(<Sentry/SentryOptions+HybridSDKs.h>)
34
+ # define USE_SENTRY_OPTIONS 1
35
+ # import <Sentry/SentryOptions+HybridSDKs.h>
36
+ #else
37
+ # define USE_SENTRY_OPTIONS 0
38
+ # import <Sentry/SentryOptionsInternal.h>
39
+ #endif
28
40
  #import <Sentry/SentryScreenFrames.h>
29
41
 
30
42
  // This guard prevents importing Hermes in JSC apps
@@ -51,15 +63,7 @@
51
63
 
52
64
  #import "RNSentryExperimentalOptions.h"
53
65
  #import "RNSentryVersion.h"
54
-
55
- @interface
56
- SentrySDK (RNSentry)
57
-
58
- + (void)captureEnvelope:(SentryEnvelope *)envelope;
59
-
60
- + (void)storeEnvelope:(SentryEnvelope *)envelope;
61
-
62
- @end
66
+ #import "SentrySDKWrapper.h"
63
67
 
64
68
  static bool hasFetchedAppStart;
65
69
 
@@ -107,7 +111,7 @@ RCT_EXPORT_METHOD(initNativeSdk
107
111
  [PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
108
112
  version:REACT_NATIVE_SDK_PACKAGE_VERSION];
109
113
 
110
- [SentrySDK startWithOptions:sentryOptions];
114
+ [SentrySDKWrapper startWithOptions:sentryOptions];
111
115
 
112
116
  #if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
113
117
  BOOL appIsActive =
@@ -243,8 +247,13 @@ RCT_EXPORT_METHOD(initNativeSdk
243
247
  [RNSentryReplay updateOptions:mutableOptions];
244
248
  #endif
245
249
 
250
+ #if USE_SENTRY_OPTIONS
246
251
  SentryOptions *sentryOptions = [[SentryOptions alloc] initWithDict:mutableOptions
247
252
  didFailWithError:errorPointer];
253
+ #else
254
+ SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:mutableOptions
255
+ didFailWithError:errorPointer];
256
+ #endif
248
257
  if (*errorPointer != nil) {
249
258
  return nil;
250
259
  }
@@ -432,7 +441,11 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, fetchNativePackageName)
432
441
  - (NSDictionary *)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAddr
433
442
  symbolicate:(SymbolicateCallbackType)symbolicate
434
443
  {
444
+ #if CROSS_PLATFORM_TEST
445
+ BOOL shouldSymbolicateLocally = [SentrySDKInternal.options debug];
446
+ #else
435
447
  BOOL shouldSymbolicateLocally = [SentrySDK.options debug];
448
+ #endif
436
449
  NSString *appPackageName = [[NSBundle mainBundle] executablePath];
437
450
 
438
451
  NSMutableSet<NSString *> *_Nonnull imagesAddrToRetrieveDebugMetaImages =
@@ -510,6 +523,58 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSDictionary *, fetchNativeStackFramesBy
510
523
  return [self fetchNativeStackFramesBy:instructionsAddr symbolicate:dladdr];
511
524
  }
512
525
 
526
+ RCT_EXPORT_METHOD(fetchNativeLogAttributes
527
+ : (RCTPromiseResolveBlock)resolve rejecter
528
+ : (RCTPromiseRejectBlock)reject)
529
+ {
530
+ __block NSMutableDictionary<NSString *, id> *result = [NSMutableDictionary new];
531
+
532
+ [SentrySDKWrapper configureScope:^(SentryScope *_Nonnull scope) {
533
+ // Serialize to get contexts dictionary
534
+ NSDictionary *serializedScope = [scope serialize];
535
+ NSDictionary *allContexts = serializedScope[@"context"]; // It's singular here, annoyingly
536
+
537
+ NSMutableDictionary *contexts = [NSMutableDictionary new];
538
+
539
+ NSDictionary *device = allContexts[@"device"];
540
+ if ([device isKindOfClass:[NSDictionary class]]) {
541
+ contexts[@"device"] = device;
542
+ }
543
+
544
+ NSDictionary *os = allContexts[@"os"];
545
+ if ([os isKindOfClass:[NSDictionary class]]) {
546
+ contexts[@"os"] = os;
547
+ }
548
+
549
+ NSString *releaseName = [SentrySDK options].releaseName;
550
+ if (releaseName) {
551
+ contexts[@"release"] = releaseName;
552
+ }
553
+ // Merge extra context
554
+ NSDictionary *extraContext = [PrivateSentrySDKOnly getExtraContext];
555
+
556
+ if (extraContext) {
557
+ NSDictionary *extraDevice = extraContext[@"device"];
558
+ if ([extraDevice isKindOfClass:[NSDictionary class]]) {
559
+ NSMutableDictionary *mergedDevice =
560
+ [contexts[@"device"] mutableCopy] ?: [NSMutableDictionary new];
561
+ [mergedDevice addEntriesFromDictionary:extraDevice];
562
+ contexts[@"device"] = mergedDevice;
563
+ }
564
+
565
+ NSDictionary *extraOS = extraContext[@"os"];
566
+ if ([extraOS isKindOfClass:[NSDictionary class]]) {
567
+ NSMutableDictionary *mergedOS =
568
+ [contexts[@"os"] mutableCopy] ?: [NSMutableDictionary new];
569
+ [mergedOS addEntriesFromDictionary:extraOS];
570
+ contexts[@"os"] = mergedOS;
571
+ }
572
+ }
573
+ result[@"contexts"] = contexts;
574
+ }];
575
+ resolve(result);
576
+ }
577
+
513
578
  RCT_EXPORT_METHOD(fetchNativeDeviceContexts
514
579
  : (RCTPromiseResolveBlock)resolve rejecter
515
580
  : (RCTPromiseRejectBlock)reject)
@@ -520,7 +585,7 @@ RCT_EXPORT_METHOD(fetchNativeDeviceContexts
520
585
  __block NSMutableDictionary<NSString *, id> *serializedScope;
521
586
  // Temp work around until sorted out this API in sentry-cocoa.
522
587
  // TODO: If the callback isnt' executed the promise wouldn't be resolved.
523
- [SentrySDK configureScope:^(SentryScope *_Nonnull scope) {
588
+ [SentrySDKWrapper configureScope:^(SentryScope *_Nonnull scope) {
524
589
  serializedScope = [[scope serialize] mutableCopy];
525
590
 
526
591
  NSDictionary<NSString *, id> *user = [serializedScope valueForKey:@"user"];
@@ -724,7 +789,7 @@ RCT_EXPORT_METHOD(fetchViewHierarchy
724
789
 
725
790
  RCT_EXPORT_METHOD(setUser : (NSDictionary *)userKeys otherUserKeys : (NSDictionary *)userDataKeys)
726
791
  {
727
- [SentrySDK configureScope:^(SentryScope *_Nonnull scope) {
792
+ [SentrySDKWrapper configureScope:^(SentryScope *_Nonnull scope) {
728
793
  [scope setUser:[RNSentry userFrom:userKeys otherUserKeys:userDataKeys]];
729
794
  }];
730
795
  }
@@ -773,7 +838,7 @@ RCT_EXPORT_METHOD(setUser : (NSDictionary *)userKeys otherUserKeys : (NSDictiona
773
838
 
774
839
  RCT_EXPORT_METHOD(addBreadcrumb : (NSDictionary *)breadcrumb)
775
840
  {
776
- [SentrySDK configureScope:^(SentryScope *_Nonnull scope) {
841
+ [SentrySDKWrapper configureScope:^(SentryScope *_Nonnull scope) {
777
842
  [scope addBreadcrumb:[RNSentryBreadcrumb from:breadcrumb]];
778
843
  }];
779
844
 
@@ -787,12 +852,12 @@ RCT_EXPORT_METHOD(addBreadcrumb : (NSDictionary *)breadcrumb)
787
852
 
788
853
  RCT_EXPORT_METHOD(clearBreadcrumbs)
789
854
  {
790
- [SentrySDK configureScope:^(SentryScope *_Nonnull scope) { [scope clearBreadcrumbs]; }];
855
+ [SentrySDKWrapper configureScope:^(SentryScope *_Nonnull scope) { [scope clearBreadcrumbs]; }];
791
856
  }
792
857
 
793
858
  RCT_EXPORT_METHOD(setExtra : (NSString *)key extra : (NSString *)extra)
794
859
  {
795
- [SentrySDK
860
+ [SentrySDKWrapper
796
861
  configureScope:^(SentryScope *_Nonnull scope) { [scope setExtraValue:extra forKey:key]; }];
797
862
  }
798
863
 
@@ -802,7 +867,7 @@ RCT_EXPORT_METHOD(setContext : (NSString *)key context : (NSDictionary *)context
802
867
  return;
803
868
  }
804
869
 
805
- [SentrySDK configureScope:^(SentryScope *_Nonnull scope) {
870
+ [SentrySDKWrapper configureScope:^(SentryScope *_Nonnull scope) {
806
871
  if (context == nil) {
807
872
  [scope removeContextForKey:key];
808
873
  } else {
@@ -813,17 +878,17 @@ RCT_EXPORT_METHOD(setContext : (NSString *)key context : (NSDictionary *)context
813
878
 
814
879
  RCT_EXPORT_METHOD(setTag : (NSString *)key value : (NSString *)value)
815
880
  {
816
- [SentrySDK
881
+ [SentrySDKWrapper
817
882
  configureScope:^(SentryScope *_Nonnull scope) { [scope setTagValue:value forKey:key]; }];
818
883
  }
819
884
 
820
- RCT_EXPORT_METHOD(crash) { [SentrySDK crash]; }
885
+ RCT_EXPORT_METHOD(crash) { [SentrySDKWrapper crash]; }
821
886
 
822
887
  RCT_EXPORT_METHOD(closeNativeSdk
823
888
  : (RCTPromiseResolveBlock)resolve rejecter
824
889
  : (RCTPromiseRejectBlock)reject)
825
890
  {
826
- [SentrySDK close];
891
+ [SentrySDKWrapper close];
827
892
  resolve(@YES);
828
893
  }
829
894
 
@@ -1026,7 +1091,7 @@ RCT_EXPORT_METHOD(crashedLastRun
1026
1091
  : (RCTPromiseResolveBlock)resolve rejecter
1027
1092
  : (RCTPromiseRejectBlock)reject)
1028
1093
  {
1029
- resolve(@([SentrySDK crashedLastRun]));
1094
+ resolve(@([SentrySDKWrapper crashedLastRun]));
1030
1095
  }
1031
1096
 
1032
1097
  // Thanks to this guard, we won't compile this code when we build for the old architecture.
@@ -1,5 +1,6 @@
1
1
  #import "RNSentryReplay.h"
2
2
  #import "RNSentryReplayBreadcrumbConverterHelper.h"
3
+ #import "RNSentryReplayQuality.h"
3
4
  #import "RNSentryVersion.h"
4
5
  #import "React/RCTTextView.h"
5
6
  #import "Replay/RNSentryReplayMask.h"
@@ -22,9 +23,12 @@
22
23
  NSLog(@"Setting up session replay");
23
24
  NSDictionary *replayOptions = options[@"mobileReplayOptions"] ?: @{};
24
25
 
26
+ NSString *qualityString = options[@"replaysSessionQuality"];
27
+
25
28
  [options setValue:@{
26
29
  @"sessionSampleRate" : options[@"replaysSessionSampleRate"] ?: [NSNull null],
27
30
  @"errorSampleRate" : options[@"replaysOnErrorSampleRate"] ?: [NSNull null],
31
+ @"quality" : @([RNSentryReplayQuality parseReplayQuality:qualityString]),
28
32
  @"maskAllImages" : replayOptions[@"maskAllImages"] ?: [NSNull null],
29
33
  @"maskAllText" : replayOptions[@"maskAllText"] ?: [NSNull null],
30
34
  @"enableViewRendererV2" : replayOptions[@"enableViewRendererV2"] ?: [NSNull null],
@@ -1,7 +1,7 @@
1
1
  @import Sentry;
2
2
 
3
3
  #if SENTRY_TARGET_REPLAY_SUPPORTED
4
- @class SentryRRWebEvent;
4
+ @protocol SentryRRWebEvent;
5
5
 
6
6
  @interface RNSentryReplayBreadcrumbConverter : NSObject <SentryReplayBreadcrumbConverter>
7
7
 
@@ -50,10 +50,23 @@
50
50
  SentryRRWebEvent *nativeBreadcrumb = [self->defaultConverter convertFrom:breadcrumb];
51
51
 
52
52
  // ignore native navigation breadcrumbs
53
- if (nativeBreadcrumb && nativeBreadcrumb.data && nativeBreadcrumb.data[@"payload"]
54
- && nativeBreadcrumb.data[@"payload"][@"category"] &&
55
- [nativeBreadcrumb.data[@"payload"][@"category"] isEqualToString:@"navigation"]) {
56
- return nil;
53
+ if (nativeBreadcrumb) {
54
+ @try {
55
+ id data = [nativeBreadcrumb valueForKey:@"data"];
56
+ if (data && [data isKindOfClass:[NSDictionary class]]) {
57
+ NSDictionary *dataDict = (NSDictionary *)data;
58
+ id payload = dataDict[@"payload"];
59
+ if (payload && [payload isKindOfClass:[NSDictionary class]]) {
60
+ NSDictionary *payloadDict = (NSDictionary *)payload;
61
+ NSString *category = payloadDict[@"category"];
62
+ if ([category isEqualToString:@"navigation"]) {
63
+ return nil;
64
+ }
65
+ }
66
+ }
67
+ } @catch (NSException *exception) {
68
+ // Just continue without ignoring native navigation breadcrumbs
69
+ }
57
70
  }
58
71
 
59
72
  return nativeBreadcrumb;
@@ -0,0 +1,13 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ NS_ASSUME_NONNULL_BEGIN
4
+
5
+ typedef NS_ENUM(NSInteger, SentryReplayQuality);
6
+
7
+ @interface RNSentryReplayQuality : NSObject
8
+
9
+ + (SentryReplayQuality)parseReplayQuality:(NSString *_Nullable)qualityString;
10
+
11
+ @end
12
+
13
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,25 @@
1
+ #import "RNSentryReplayQuality.h"
2
+ @import Sentry;
3
+
4
+ @implementation RNSentryReplayQuality
5
+
6
+ + (SentryReplayQuality)parseReplayQuality:(NSString *_Nullable)qualityString
7
+ {
8
+ if (qualityString == nil) {
9
+ return SentryReplayQualityMedium;
10
+ }
11
+
12
+ NSString *lowercaseQuality = [qualityString lowercaseString];
13
+
14
+ if ([lowercaseQuality isEqualToString:@"low"]) {
15
+ return SentryReplayQualityLow;
16
+ } else if ([lowercaseQuality isEqualToString:@"medium"]) {
17
+ return SentryReplayQualityMedium;
18
+ } else if ([lowercaseQuality isEqualToString:@"high"]) {
19
+ return SentryReplayQualityHigh;
20
+ } else {
21
+ return SentryReplayQualityMedium;
22
+ }
23
+ }
24
+
25
+ @end
@@ -3,4 +3,4 @@
3
3
  NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
4
4
  NSString *const REACT_NATIVE_SDK_NAME = @"sentry.javascript.react-native";
5
5
  NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
6
- NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"7.0.0-beta.2";
6
+ NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"7.0.0-rc.2";
@@ -0,0 +1,18 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ @class SentryOptions;
4
+ @class SentryScope;
5
+
6
+ @interface SentrySDKWrapper : NSObject
7
+
8
+ + (void)configureScope:(void (^)(SentryScope *scope))callback;
9
+
10
+ + (void)crash;
11
+
12
+ + (void)close;
13
+
14
+ + (BOOL)crashedLastRun;
15
+
16
+ + (void)startWithOptions:(SentryOptions *)options;
17
+
18
+ @end
@@ -0,0 +1,31 @@
1
+ #import "SentrySDKWrapper.h"
2
+ @import Sentry;
3
+
4
+ @implementation SentrySDKWrapper
5
+
6
+ + (void)startWithOptions:(SentryOptions *)options
7
+ {
8
+ [SentrySDK startWithOptions:options];
9
+ }
10
+
11
+ + (void)crash
12
+ {
13
+ [SentrySDK crash];
14
+ }
15
+
16
+ + (void)close
17
+ {
18
+ [SentrySDK close];
19
+ }
20
+
21
+ + (BOOL)crashedLastRun
22
+ {
23
+ return [SentrySDK crashedLastRun];
24
+ }
25
+
26
+ + (void)configureScope:(void (^)(SentryScope *scope))callback
27
+ {
28
+ [SentrySDK configureScope:callback];
29
+ }
30
+
31
+ @end
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "7.0.0-beta.2",
5
+ "version": "7.0.0-rc.2",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -65,22 +65,22 @@
65
65
  "react-native": ">=0.65.0"
66
66
  },
67
67
  "dependencies": {
68
- "@sentry/babel-plugin-component-annotate": "3.5.0",
69
- "@sentry/browser": "9.22.0",
70
- "@sentry/cli": "2.47.0",
71
- "@sentry/core": "9.22.0",
72
- "@sentry/react": "9.22.0",
73
- "@sentry/types": "9.22.0"
68
+ "@sentry/babel-plugin-component-annotate": "4.0.2",
69
+ "@sentry/browser": "10.7.0",
70
+ "@sentry/cli": "2.50.2",
71
+ "@sentry/core": "10.7.0",
72
+ "@sentry/react": "10.7.0",
73
+ "@sentry/types": "10.7.0"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@babel/core": "^7.25.2",
77
77
  "@expo/metro-config": "~0.20.0",
78
78
  "@mswjs/interceptors": "^0.25.15",
79
79
  "@react-native/babel-preset": "0.77.1",
80
- "@sentry-internal/eslint-config-sdk": "9.22.0",
81
- "@sentry-internal/eslint-plugin-sdk": "9.22.0",
82
- "@sentry-internal/typescript": "9.22.0",
83
- "@sentry/wizard": "5.3.0",
80
+ "@sentry-internal/eslint-config-sdk": "10.7.0",
81
+ "@sentry-internal/eslint-plugin-sdk": "10.7.0",
82
+ "@sentry-internal/typescript": "10.7.0",
83
+ "@sentry/wizard": "6.1.0",
84
84
  "@testing-library/react-native": "^12.7.2",
85
85
  "@types/jest": "^29.5.13",
86
86
  "@types/node": "^20.9.3",
@@ -129,7 +129,10 @@ try {
129
129
  console.warn(error);
130
130
  }
131
131
 
132
- loadDotenv(path.join(projectRoot, '.env.sentry-build-plugin'));
132
+ const sentryBuildPluginPath = path.join(projectRoot, '.env.sentry-build-plugin');
133
+ if (fs.existsSync(sentryBuildPluginPath)) {
134
+ loadDotenv();
135
+ }
133
136
 
134
137
  let sentryOrg = getEnvVar(SENTRY_ORG);
135
138
  let sentryUrl = getEnvVar(SENTRY_URL);
@@ -24,10 +24,33 @@ LOCAL_NODE_BINARY=${NODE_BINARY:-node}
24
24
  RN_PROJECT_ROOT="${PROJECT_DIR}/.."
25
25
 
26
26
  [ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties
27
- [ -z "$SENTRY_DOTENV_PATH" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
27
+ [ -z "$SENTRY_DOTENV_PATH" ] && [ -f "$RN_PROJECT_ROOT/.env.sentry-build-plugin" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
28
28
 
29
29
  [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
30
- [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="${SENTRY_CLI_PACKAGE_PATH}/bin/sentry-cli"
30
+ [ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"
31
+
32
+ if [ -z "$SENTRY_CLI_EXECUTABLE" ]; then
33
+ # Try standard resolution safely
34
+ RESOLVED_PATH=$(
35
+ "$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))" 2>/dev/null
36
+ ) || true
37
+ if [ -n "$RESOLVED_PATH" ]; then
38
+ SENTRY_CLI_PACKAGE_PATH="$RESOLVED_PATH/bin/sentry-cli"
39
+ else
40
+ # Fallback: parse NODE_PATH from the .bin/sentry-cli shim (file generated by PNPM)
41
+ PNPM_BIN_PATH="$PWD/../node_modules/@sentry/react-native/node_modules/.bin/sentry-cli"
42
+
43
+ if [ -f "$PNPM_BIN_PATH" ]; then
44
+ CLI_FILE_TEXT=$(cat "$PNPM_BIN_PATH")
45
+
46
+ # Filter where PNPM stored Sentry CLI
47
+ NODE_PATH_LINE=$(echo "$CLI_FILE_TEXT" | grep -oE 'NODE_PATH="[^"]+"' | head -n1)
48
+ NODE_PATH_VALUE=$(echo "$NODE_PATH_LINE" | sed -E 's/^NODE_PATH="([^"]+)".*/\1/')
49
+ SENTRY_CLI_PACKAGE_PATH=${NODE_PATH_VALUE%%/bin*}
50
+ fi
51
+ fi
52
+ fi
53
+ [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="$SENTRY_CLI_PACKAGE_PATH"
31
54
 
32
55
  [[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""
33
56
 
@@ -13,11 +13,31 @@ LOCAL_NODE_BINARY=${NODE_BINARY:-node}
13
13
  RN_PROJECT_ROOT="${PROJECT_DIR}/.."
14
14
 
15
15
  [ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties
16
- [ -z "$SENTRY_DOTENV_PATH" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
16
+ [ -z "$SENTRY_DOTENV_PATH" ] && [ -f "$RN_PROJECT_ROOT/.env.sentry-build-plugin" ] && export SENTRY_DOTENV_PATH="$RN_PROJECT_ROOT/.env.sentry-build-plugin"
17
17
  [ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.map"
18
18
 
19
- [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
20
- [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="${SENTRY_CLI_PACKAGE_PATH}/bin/sentry-cli"
19
+ if [ -z "$SENTRY_CLI_EXECUTABLE" ]; then
20
+ # Try standard resolution safely
21
+ RESOLVED_PATH=$(
22
+ "$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))" 2>/dev/null
23
+ ) || true
24
+ if [ -n "$RESOLVED_PATH" ]; then
25
+ SENTRY_CLI_PACKAGE_PATH="$RESOLVED_PATH/bin/sentry-cli"
26
+ else
27
+ # Fallback: parse NODE_PATH from the .bin/sentry-cli shim (file generated by PNPM)
28
+ PNPM_BIN_PATH="$PWD/../node_modules/@sentry/react-native/node_modules/.bin/sentry-cli"
29
+
30
+ if [ -f "$PNPM_BIN_PATH" ]; then
31
+ CLI_FILE_TEXT=$(cat "$PNPM_BIN_PATH")
32
+
33
+ # Filter where PNPM stored Sentry CLI
34
+ NODE_PATH_LINE=$(echo "$CLI_FILE_TEXT" | grep -oE 'NODE_PATH="[^"]+"' | head -n1)
35
+ NODE_PATH_VALUE=$(echo "$NODE_PATH_LINE" | sed -E 's/^NODE_PATH="([^"]+)".*/\1/')
36
+ SENTRY_CLI_PACKAGE_PATH=${NODE_PATH_VALUE%%/bin*}
37
+ fi
38
+ fi
39
+ fi
40
+ [ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="$SENTRY_CLI_PACKAGE_PATH"
21
41
 
22
42
  REACT_NATIVE_XCODE=$1
23
43
 
package/sentry.gradle CHANGED
@@ -167,11 +167,7 @@ project.afterEvaluate {
167
167
  project.logger.info("file not found '$propertiesFile' for '$variant'")
168
168
  }
169
169
 
170
- def resolvedCliPackage = null
171
- try {
172
- resolvedCliPackage = new File(["node", "--print", "require.resolve('@sentry/cli/package.json')"].execute(null, rootDir).text.trim()).getParentFile();
173
- } catch (Throwable ignored) {}
174
- def cliPackage = resolvedCliPackage != null && resolvedCliPackage.exists() ? resolvedCliPackage.getAbsolutePath() : "$reactRoot/node_modules/@sentry/cli"
170
+ def cliPackage = resolveSentryCliPackagePath(reactRoot)
175
171
  def cliExecutable = sentryProps.get("cli.executable", "$cliPackage/bin/sentry-cli")
176
172
 
177
173
  // fix path separator for Windows
@@ -205,7 +201,7 @@ project.afterEvaluate {
205
201
 
206
202
  project.logger.lifecycle("Sentry-CLI arguments: ${args}")
207
203
  def osCompatibility = Os.isFamily(Os.FAMILY_WINDOWS) ? ['cmd', '/c', 'node'] : []
208
- if (!System.getenv('SENTRY_DOTENV_PATH')) {
204
+ if (!System.getenv('SENTRY_DOTENV_PATH') && file("$reactRoot/.env.sentry-build-plugin").exists()) {
209
205
  environment('SENTRY_DOTENV_PATH', "$reactRoot/.env.sentry-build-plugin")
210
206
  }
211
207
  commandLine(*osCompatibility, *args)
@@ -306,6 +302,31 @@ def resolveSentryReactNativeSDKPath(reactRoot) {
306
302
  return sentryPackage
307
303
  }
308
304
 
305
+ def resolveSentryCliPackagePath(reactRoot) {
306
+ def resolvedCliPath = null
307
+ try {
308
+ resolvedCliPath = new File(["node", "--print", "require.resolve('@sentry/cli/package.json')"].execute(null, rootDir).text.trim()).getParentFile();
309
+ } catch (Throwable ignored) { // Check if it's located in .pnpm
310
+ try {
311
+ def pnpmRefPath = reactRoot.toString() + "/node_modules/@sentry/react-native/node_modules/.bin/sentry-cli"
312
+ def sentryCliFile = new File(pnpmRefPath)
313
+
314
+ if (sentryCliFile.exists()) {
315
+ def cliFileText = sentryCliFile.text
316
+ def matcher = cliFileText =~ /NODE_PATH="([^"]*?)@sentry\/cli\//
317
+
318
+ if (matcher.find()) {
319
+ def match = matcher.group(1)
320
+ resolvedCliPath = new File(match + "@sentry/cli")
321
+ }
322
+ }
323
+ } catch (Throwable ignored2) {} // if the resolve fails we fallback to the default path
324
+ }
325
+
326
+ def cliPackage = resolvedCliPath != null && resolvedCliPath.exists() ? resolvedCliPath.getAbsolutePath() : "$reactRoot/node_modules/@sentry/cli"
327
+ return cliPackage
328
+ }
329
+
309
330
  /** Compose lookup map of build variants - to - outputs. */
310
331
  def extractReleasesInfo() {
311
332
  def releases = [:]
@@ -24,6 +24,7 @@ export interface Spec extends TurboModule {
24
24
  fetchNativeRelease(): Promise<NativeReleaseResponse>;
25
25
  fetchNativeSdkInfo(): Promise<Package | null>;
26
26
  fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null>;
27
+ fetchNativeLogAttributes(): Promise<NativeDeviceContextsResponse | null>;
27
28
  fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;
28
29
  fetchNativeFrames(): Promise<NativeFramesResponse | null>;
29
30
  initNativeSdk(options: UnsafeObject): Promise<boolean>;
@@ -17,6 +17,7 @@ export interface Spec extends TurboModule {
17
17
  fetchNativeRelease(): Promise<NativeReleaseResponse>;
18
18
  fetchNativeSdkInfo(): Promise<Package | null>;
19
19
  fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null>;
20
+ fetchNativeLogAttributes(): Promise<NativeDeviceContextsResponse | null>;
20
21
  fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;
21
22
  fetchNativeFrames(): Promise<NativeFramesResponse | null>;
22
23
  initNativeSdk(options: UnsafeObject): Promise<boolean>;
@@ -1,5 +1,5 @@
1
1
  import type { Envelope, Event, EventHint, SeverityLevel, TransportMakeRequestResponse, UserFeedback } from '@sentry/core';
2
- import { BaseClient } from '@sentry/core';
2
+ import { Client } from '@sentry/core';
3
3
  import type { ReactNativeClientOptions } from './options';
4
4
  /**
5
5
  * The Sentry React Native SDK Client.
@@ -7,7 +7,7 @@ import type { ReactNativeClientOptions } from './options';
7
7
  * @see ReactNativeClientOptions for documentation on configuration options.
8
8
  * @see SentryClient for usage documentation.
9
9
  */
10
- export declare class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
10
+ export declare class ReactNativeClient extends Client<ReactNativeClientOptions> {
11
11
  private _outcomesBuffer;
12
12
  private _logFlushIdleTimeout;
13
13
  /**
@@ -1,5 +1,5 @@
1
1
  export type { Breadcrumb, SdkInfo, Event, Exception, SendFeedbackParams, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, UserFeedback, ErrorEvent, TransactionEvent, } from '@sentry/core';
2
- export { addBreadcrumb, captureException, captureEvent, captureFeedback, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, lastEventId, } from '@sentry/core';
2
+ export { addBreadcrumb, addIntegration, captureException, captureEvent, captureFeedback, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, lastEventId, } from '@sentry/core';
3
3
  export { ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
4
4
  export type { FeatureFlagsIntegration } from '@sentry/browser';
5
5
  export { logger, consoleLoggingIntegration, featureFlagsIntegration } from '@sentry/browser';
@@ -24,5 +24,6 @@ export { appRegistryIntegration } from './appRegistry';
24
24
  export { timeToDisplayIntegration } from '../tracing/integrations/timeToDisplayIntegration';
25
25
  export { breadcrumbsIntegration } from './breadcrumbs';
26
26
  export { primitiveTagIntegration } from './primitiveTagIntegration';
27
+ export { logEnricherIntegration } from './logEnricherIntegration';
27
28
  export { browserApiErrorsIntegration, dedupeIntegration, functionToStringIntegration, globalHandlersIntegration as browserGlobalHandlersIntegration, httpClientIntegration, httpContextIntegration, inboundFiltersIntegration, linkedErrorsIntegration as browserLinkedErrorsIntegration, rewriteFramesIntegration, extraErrorDataIntegration, } from '@sentry/react';
28
29
  //# sourceMappingURL=exports.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { Integration } from '@sentry/core';
2
+ export declare const logEnricherIntegration: () => Integration;
3
+ //# sourceMappingURL=logEnricherIntegration.d.ts.map
@@ -207,6 +207,13 @@ export interface BaseReactNativeOptions {
207
207
  * problems.
208
208
  */
209
209
  shutdownTimeout?: number;
210
+ /**
211
+ * Defines the quality of the session replay. The higher the quality, the more accurate the replay
212
+ * will be, but also more data to transfer and more CPU load.
213
+ *
214
+ * @default 'medium'
215
+ */
216
+ replaysSessionQuality?: SentryReplayQuality;
210
217
  /**
211
218
  * Options which are in beta, or otherwise not guaranteed to be stable.
212
219
  */
@@ -243,6 +250,7 @@ export interface BaseReactNativeOptions {
243
250
  */
244
251
  useThreadsForMessageStack?: boolean;
245
252
  }
253
+ export type SentryReplayQuality = 'low' | 'medium' | 'high';
246
254
  export interface ReactNativeTransportOptions extends BrowserTransportOptions {
247
255
  /**
248
256
  * @deprecated use `maxQueueSize` in the root of the SDK options.
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "7.0.0-beta.2";
3
+ export declare const SDK_VERSION = "7.0.0-rc.2";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -45,6 +45,7 @@ interface SentryNativeWrapper {
45
45
  captureScreenshot(): Promise<Screenshot[] | null>;
46
46
  fetchNativeRelease(): PromiseLike<NativeReleaseResponse>;
47
47
  fetchNativeDeviceContexts(): PromiseLike<NativeDeviceContextsResponse | null>;
48
+ fetchNativeLogAttributes(): Promise<NativeDeviceContextsResponse | null>;
48
49
  fetchNativeAppStart(): PromiseLike<NativeAppStartResponse | null>;
49
50
  fetchNativeFrames(): PromiseLike<NativeFramesResponse | null>;
50
51
  fetchNativeSdkInfo(): PromiseLike<Package | null>;