@sentry/react-native 6.13.1 → 7.0.0-alpha.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 (182) 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 +11 -14
  4. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  5. package/dist/js/client.d.ts +12 -0
  6. package/dist/js/client.d.ts.map +1 -1
  7. package/dist/js/client.js +24 -1
  8. package/dist/js/client.js.map +1 -1
  9. package/dist/js/feedback/FeedbackWidget.d.ts +1 -1
  10. package/dist/js/feedback/FeedbackWidget.d.ts.map +1 -1
  11. package/dist/js/feedback/FeedbackWidget.js +18 -17
  12. package/dist/js/feedback/FeedbackWidget.js.map +1 -1
  13. package/dist/js/feedback/FeedbackWidget.types.d.ts +29 -29
  14. package/dist/js/feedback/FeedbackWidget.types.d.ts.map +1 -1
  15. package/dist/js/feedback/FeedbackWidget.types.js.map +1 -1
  16. package/dist/js/feedback/FeedbackWidgetManager.d.ts.map +1 -1
  17. package/dist/js/feedback/FeedbackWidgetManager.js +6 -3
  18. package/dist/js/feedback/FeedbackWidgetManager.js.map +1 -1
  19. package/dist/js/feedback/defaults.d.ts +1 -1
  20. package/dist/js/feedback/defaults.d.ts.map +1 -1
  21. package/dist/js/feedback/defaults.js.map +1 -1
  22. package/dist/js/feedback/integration.d.ts +1 -1
  23. package/dist/js/feedback/integration.d.ts.map +1 -1
  24. package/dist/js/feedback/integration.js.map +1 -1
  25. package/dist/js/feedback/utils.js +2 -2
  26. package/dist/js/feedback/utils.js.map +1 -1
  27. package/dist/js/index.d.ts +2 -2
  28. package/dist/js/index.d.ts.map +1 -1
  29. package/dist/js/index.js +1 -1
  30. package/dist/js/index.js.map +1 -1
  31. package/dist/js/integrations/debugsymbolicator.js +2 -1
  32. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  33. package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -1
  34. package/dist/js/integrations/debugsymbolicatorutils.js +12 -2
  35. package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
  36. package/dist/js/integrations/default.d.ts.map +1 -1
  37. package/dist/js/integrations/default.js +9 -5
  38. package/dist/js/integrations/default.js.map +1 -1
  39. package/dist/js/integrations/expocontext.d.ts +18 -0
  40. package/dist/js/integrations/expocontext.d.ts.map +1 -1
  41. package/dist/js/integrations/expocontext.js +20 -12
  42. package/dist/js/integrations/expocontext.js.map +1 -1
  43. package/dist/js/integrations/nativelinkederrors.js +4 -3
  44. package/dist/js/integrations/nativelinkederrors.js.map +1 -1
  45. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  46. package/dist/js/integrations/reactnativeerrorhandlers.js +2 -1
  47. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  48. package/dist/js/integrations/screenshot.js +3 -3
  49. package/dist/js/integrations/screenshot.js.map +1 -1
  50. package/dist/js/integrations/spotlight.d.ts.map +1 -1
  51. package/dist/js/integrations/spotlight.js +8 -4
  52. package/dist/js/integrations/spotlight.js.map +1 -1
  53. package/dist/js/integrations/viewhierarchy.js +2 -1
  54. package/dist/js/integrations/viewhierarchy.js.map +1 -1
  55. package/dist/js/options.d.ts +8 -1
  56. package/dist/js/options.d.ts.map +1 -1
  57. package/dist/js/options.js.map +1 -1
  58. package/dist/js/profiling/cache.d.ts +1 -1
  59. package/dist/js/profiling/convertHermesProfile.d.ts.map +1 -1
  60. package/dist/js/profiling/convertHermesProfile.js +18 -5
  61. package/dist/js/profiling/convertHermesProfile.js.map +1 -1
  62. package/dist/js/profiling/debugid.d.ts.map +1 -1
  63. package/dist/js/profiling/debugid.js +9 -1
  64. package/dist/js/profiling/debugid.js.map +1 -1
  65. package/dist/js/profiling/hermes.d.ts +1 -1
  66. package/dist/js/profiling/hermes.d.ts.map +1 -1
  67. package/dist/js/profiling/integration.js +2 -1
  68. package/dist/js/profiling/integration.js.map +1 -1
  69. package/dist/js/profiling/utils.d.ts.map +1 -1
  70. package/dist/js/profiling/utils.js +15 -17
  71. package/dist/js/profiling/utils.js.map +1 -1
  72. package/dist/js/replay/CustomMask.js +1 -1
  73. package/dist/js/replay/CustomMask.js.map +1 -1
  74. package/dist/js/replay/mobilereplay.js +2 -1
  75. package/dist/js/replay/mobilereplay.js.map +1 -1
  76. package/dist/js/scopeSync.d.ts.map +1 -1
  77. package/dist/js/scopeSync.js +7 -1
  78. package/dist/js/scopeSync.js.map +1 -1
  79. package/dist/js/sdk.d.ts.map +1 -1
  80. package/dist/js/sdk.js +2 -2
  81. package/dist/js/sdk.js.map +1 -1
  82. package/dist/js/tools/ModulesCollector.js +1 -0
  83. package/dist/js/tools/ModulesCollector.js.map +1 -1
  84. package/dist/js/tools/collectModules.js +1 -0
  85. package/dist/js/tools/collectModules.js.map +1 -1
  86. package/dist/js/tools/enableLogger.js +1 -0
  87. package/dist/js/tools/enableLogger.js.map +1 -1
  88. package/dist/js/tools/metroMiddleware.js +2 -1
  89. package/dist/js/tools/metroMiddleware.js.map +1 -1
  90. package/dist/js/tools/metroconfig.js +5 -3
  91. package/dist/js/tools/metroconfig.js.map +1 -1
  92. package/dist/js/tools/sentryBabelTransformer.js +1 -0
  93. package/dist/js/tools/sentryBabelTransformer.js.map +1 -1
  94. package/dist/js/tools/sentryBabelTransformerUtils.js +1 -0
  95. package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
  96. package/dist/js/tools/sentryMetroSerializer.js +1 -0
  97. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  98. package/dist/js/tools/utils.js +1 -0
  99. package/dist/js/tools/utils.js.map +1 -1
  100. package/dist/js/tools/vendor/expo/expoconfig.js +1 -0
  101. package/dist/js/tools/vendor/expo/expoconfig.js.map +1 -1
  102. package/dist/js/tools/vendor/metro/metroBabelTransformer.js +1 -0
  103. package/dist/js/tools/vendor/metro/metroBabelTransformer.js.map +1 -1
  104. package/dist/js/tools/vendor/metro/utils.js +1 -0
  105. package/dist/js/tools/vendor/metro/utils.js.map +1 -1
  106. package/dist/js/touchevents.d.ts.map +1 -1
  107. package/dist/js/touchevents.js +4 -0
  108. package/dist/js/touchevents.js.map +1 -1
  109. package/dist/js/tracing/integrations/appStart.d.ts +1 -1
  110. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
  111. package/dist/js/tracing/integrations/appStart.js +9 -2
  112. package/dist/js/tracing/integrations/appStart.js.map +1 -1
  113. package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
  114. package/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
  115. package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -1
  116. package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -1
  117. package/dist/js/tracing/integrations/timeToDisplayIntegration.js +14 -10
  118. package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
  119. package/dist/js/tracing/onSpanEndUtils.d.ts +1 -1
  120. package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
  121. package/dist/js/tracing/onSpanEndUtils.js +2 -1
  122. package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
  123. package/dist/js/tracing/reactnativenavigation.js +1 -1
  124. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  125. package/dist/js/tracing/reactnativeprofiler.d.ts +3 -1
  126. package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
  127. package/dist/js/tracing/reactnativeprofiler.js +2 -1
  128. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  129. package/dist/js/tracing/reactnativetracing.d.ts +4 -1
  130. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  131. package/dist/js/tracing/reactnativetracing.js +5 -1
  132. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  133. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  134. package/dist/js/tracing/reactnavigation.js +5 -4
  135. package/dist/js/tracing/reactnavigation.js.map +1 -1
  136. package/dist/js/tracing/span.js +3 -3
  137. package/dist/js/tracing/span.js.map +1 -1
  138. package/dist/js/tracing/timeToDisplayFallback.d.ts +1 -1
  139. package/dist/js/tracing/timeToDisplayFallback.d.ts.map +1 -1
  140. package/dist/js/tracing/timeToDisplayFallback.js.map +1 -1
  141. package/dist/js/transports/encodePolyfill.d.ts.map +1 -1
  142. package/dist/js/transports/encodePolyfill.js +5 -5
  143. package/dist/js/transports/encodePolyfill.js.map +1 -1
  144. package/dist/js/utils/AsyncExpiringMap.d.ts.map +1 -1
  145. package/dist/js/utils/AsyncExpiringMap.js +8 -4
  146. package/dist/js/utils/AsyncExpiringMap.js.map +1 -1
  147. package/dist/js/utils/envelope.d.ts.map +1 -1
  148. package/dist/js/utils/envelope.js +1 -2
  149. package/dist/js/utils/envelope.js.map +1 -1
  150. package/dist/js/utils/environment.d.ts.map +1 -1
  151. package/dist/js/utils/environment.js +5 -6
  152. package/dist/js/utils/environment.js.map +1 -1
  153. package/dist/js/vendor/base64-js/fromByteArray.d.ts.map +1 -1
  154. package/dist/js/vendor/base64-js/fromByteArray.js +6 -0
  155. package/dist/js/vendor/base64-js/fromByteArray.js.map +1 -1
  156. package/dist/js/version.d.ts +1 -1
  157. package/dist/js/version.d.ts.map +1 -1
  158. package/dist/js/version.js +1 -1
  159. package/dist/js/version.js.map +1 -1
  160. package/dist/js/wrapper.js +3 -2
  161. package/dist/js/wrapper.js.map +1 -1
  162. package/ios/RNSentryVersion.m +1 -1
  163. package/package.json +12 -13
  164. package/plugin/build/withSentry.js +1 -1
  165. package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
  166. package/ts3.8/dist/js/client.d.ts +12 -0
  167. package/ts3.8/dist/js/feedback/FeedbackWidget.d.ts +1 -1
  168. package/ts3.8/dist/js/feedback/FeedbackWidget.types.d.ts +29 -29
  169. package/ts3.8/dist/js/feedback/defaults.d.ts +1 -1
  170. package/ts3.8/dist/js/feedback/integration.d.ts +1 -1
  171. package/ts3.8/dist/js/index.d.ts +2 -2
  172. package/ts3.8/dist/js/integrations/expocontext.d.ts +18 -0
  173. package/ts3.8/dist/js/options.d.ts +8 -1
  174. package/ts3.8/dist/js/profiling/cache.d.ts +1 -1
  175. package/ts3.8/dist/js/profiling/hermes.d.ts +1 -1
  176. package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +1 -1
  177. package/ts3.8/dist/js/tracing/integrations/stalltracking.d.ts +1 -1
  178. package/ts3.8/dist/js/tracing/onSpanEndUtils.d.ts +1 -1
  179. package/ts3.8/dist/js/tracing/reactnativeprofiler.d.ts +3 -1
  180. package/ts3.8/dist/js/tracing/reactnativetracing.d.ts +4 -1
  181. package/ts3.8/dist/js/tracing/timeToDisplayFallback.d.ts +1 -1
  182. package/ts3.8/dist/js/version.d.ts +1 -1
package/RNSentry.podspec CHANGED
@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
37
37
 
38
38
  s.compiler_flags = other_cflags
39
39
 
40
- s.dependency 'Sentry/HybridSDK', '8.49.2'
40
+ s.dependency 'Sentry/HybridSDK', '8.50.0'
41
41
 
42
42
  if defined? install_modules_dependencies
43
43
  # Default React Native dependencies for 0.71 and above (new and legacy architecture)
@@ -54,5 +54,5 @@ android {
54
54
 
55
55
  dependencies {
56
56
  implementation 'com.facebook.react:react-native:+'
57
- api 'io.sentry:sentry-android:7.22.5'
57
+ api 'io.sentry:sentry-android:8.11.1'
58
58
  }
@@ -30,12 +30,12 @@ import com.facebook.react.bridge.WritableNativeArray;
30
30
  import com.facebook.react.bridge.WritableNativeMap;
31
31
  import com.facebook.react.common.JavascriptException;
32
32
  import io.sentry.Breadcrumb;
33
- import io.sentry.HubAdapter;
34
33
  import io.sentry.ILogger;
35
34
  import io.sentry.IScope;
36
35
  import io.sentry.ISentryExecutorService;
37
36
  import io.sentry.ISerializer;
38
37
  import io.sentry.Integration;
38
+ import io.sentry.ScopesAdapter;
39
39
  import io.sentry.Sentry;
40
40
  import io.sentry.SentryDate;
41
41
  import io.sentry.SentryDateProvider;
@@ -87,6 +87,7 @@ import java.util.Iterator;
87
87
  import java.util.List;
88
88
  import java.util.Map;
89
89
  import java.util.Properties;
90
+ import java.util.Set;
90
91
  import java.util.concurrent.CountDownLatch;
91
92
  import org.jetbrains.annotations.NotNull;
92
93
  import org.jetbrains.annotations.Nullable;
@@ -527,7 +528,7 @@ public class RNSentryModuleImpl {
527
528
  }
528
529
 
529
530
  public void captureReplay(boolean isHardCrash, Promise promise) {
530
- Sentry.getCurrentHub().getOptions().getReplayController().captureReplay(isHardCrash);
531
+ Sentry.getCurrentScopes().getOptions().getReplayController().captureReplay(isHardCrash);
531
532
  promise.resolve(getCurrentReplayId());
532
533
  }
533
534
 
@@ -623,7 +624,7 @@ public class RNSentryModuleImpl {
623
624
  return;
624
625
  }
625
626
 
626
- ISerializer serializer = HubAdapter.getInstance().getOptions().getSerializer();
627
+ ISerializer serializer = ScopesAdapter.getInstance().getOptions().getSerializer();
627
628
  final @Nullable byte[] bytes =
628
629
  JsonSerializationUtils.bytesFrom(serializer, logger, viewHierarchy);
629
630
  if (bytes == null) {
@@ -677,10 +678,6 @@ public class RNSentryModuleImpl {
677
678
  if (userKeys.hasKey("ip_address")) {
678
679
  userInstance.setIpAddress(userKeys.getString("ip_address"));
679
680
  }
680
-
681
- if (userKeys.hasKey("segment")) {
682
- userInstance.setSegment(userKeys.getString("segment"));
683
- }
684
681
  }
685
682
 
686
683
  if (userDataKeys != null) {
@@ -842,8 +839,7 @@ public class RNSentryModuleImpl {
842
839
  (int) SECONDS.toMicros(1) / profilingTracesHz,
843
840
  new SentryFrameMetricsCollector(reactApplicationContext, logger, buildInfo),
844
841
  executorService,
845
- logger,
846
- buildInfo);
842
+ logger);
847
843
  }
848
844
 
849
845
  public WritableMap startProfiling(boolean platformProfilers) {
@@ -867,7 +863,7 @@ public class RNSentryModuleImpl {
867
863
  }
868
864
 
869
865
  public WritableMap stopProfiling() {
870
- final boolean isDebug = HubAdapter.getInstance().getOptions().isDebug();
866
+ final boolean isDebug = ScopesAdapter.getInstance().getOptions().isDebug();
871
867
  final WritableMap result = new WritableNativeMap();
872
868
  File output = null;
873
869
  try {
@@ -953,7 +949,7 @@ public class RNSentryModuleImpl {
953
949
  }
954
950
 
955
951
  public void fetchNativeDeviceContexts(Promise promise) {
956
- final @NotNull SentryOptions options = HubAdapter.getInstance().getOptions();
952
+ final @NotNull SentryOptions options = ScopesAdapter.getInstance().getOptions();
957
953
  final @Nullable Context context = this.getReactApplicationContext().getApplicationContext();
958
954
  final @Nullable IScope currentScope = InternalSentrySdk.getCurrentScope();
959
955
  fetchNativeDeviceContexts(promise, options, context, currentScope);
@@ -990,7 +986,8 @@ public class RNSentryModuleImpl {
990
986
  }
991
987
 
992
988
  public void fetchNativeSdkInfo(Promise promise) {
993
- final @Nullable SdkVersion sdkVersion = HubAdapter.getInstance().getOptions().getSdkVersion();
989
+ final @Nullable SdkVersion sdkVersion =
990
+ ScopesAdapter.getInstance().getOptions().getSdkVersion();
994
991
  if (sdkVersion == null) {
995
992
  promise.resolve(null);
996
993
  } else {
@@ -1069,14 +1066,14 @@ public class RNSentryModuleImpl {
1069
1066
  if (eventSdk != null
1070
1067
  && "sentry.javascript.react-native".equals(eventSdk.getName())
1071
1068
  && sdk != null) {
1072
- List<SentryPackage> sentryPackages = sdk.getPackages();
1069
+ Set<SentryPackage> sentryPackages = sdk.getPackageSet();
1073
1070
  if (sentryPackages != null) {
1074
1071
  for (SentryPackage sentryPackage : sentryPackages) {
1075
1072
  eventSdk.addPackage(sentryPackage.getName(), sentryPackage.getVersion());
1076
1073
  }
1077
1074
  }
1078
1075
 
1079
- List<String> integrations = sdk.getIntegrations();
1076
+ Set<String> integrations = sdk.getIntegrationSet();
1080
1077
  if (integrations != null) {
1081
1078
  for (String integration : integrations) {
1082
1079
  eventSdk.addIntegration(integration);
@@ -2,7 +2,7 @@ package io.sentry.react;
2
2
 
3
3
  class RNSentryVersion {
4
4
  static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
5
- static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "6.13.1";
5
+ static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.0.0-alpha.0";
6
6
  static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
7
7
  static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
8
8
  static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";
@@ -44,6 +44,18 @@ export declare class ReactNativeClient extends BaseClient<ReactNativeClientOptio
44
44
  * @inheritDoc
45
45
  */
46
46
  init(): void;
47
+ /**
48
+ * Register a hook on this client.
49
+ *
50
+ * (Generic method signature to allow for custom React Native Client events.)
51
+ */
52
+ on(hook: string, callback: unknown): () => void;
53
+ /**
54
+ * Emit a hook that was previously registered via `on()`.
55
+ *
56
+ * (Generic method signature to allow for custom React Native Client events.)
57
+ */
58
+ emit(hook: string, ...rest: unknown[]): void;
47
59
  /**
48
60
  * Starts native client with dsn and options
49
61
  */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAET,aAAa,EACb,4BAA4B,EAC5B,YAAY,EACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAA+C,MAAM,cAAc,CAAC;AAMvF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAS1D;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IACzE,OAAO,CAAC,eAAe,CAAY;IAEnC;;;OAGG;gBACgB,OAAO,EAAE,wBAAwB;IAYpD;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,GAAE,SAAc,GAAG,WAAW,CAAC,KAAK,CAAC;IAIvF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa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OAAO,CAAC;IAOpC;;;OAGG;IACI,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAUxD;;OAEG;IACI,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC,4BAA4B,CAAC;IAiClF;;OAEG;IACI,IAAI,IAAI,IAAI;IAKnB;;;;OAIG;IACI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,IAAI;IAKtD;;;;OAIG;IACI,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAKnD;;OAEG;IACH,OAAO,CAAC,cAAc;IA6BtB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAShC;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAa9B"}
package/dist/js/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { eventFromException, eventFromMessage } from '@sentry/browser';
2
- import { BaseClient, dateTimestampInSeconds, logger, SentryError } from '@sentry/core';
2
+ import { addAutoIpAddressToSession, addAutoIpAddressToUser, BaseClient, dateTimestampInSeconds, logger, SentryError, } from '@sentry/core';
3
3
  import { Alert } from 'react-native';
4
4
  import { getDevServer } from './integrations/debugsymbolicatorutils';
5
5
  import { defaultSdkInfo } from './integrations/sdkinfo';
@@ -31,6 +31,10 @@ export class ReactNativeClient extends BaseClient {
31
31
  options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;
32
32
  super(options);
33
33
  this._outcomesBuffer = [];
34
+ if (options.sendDefaultPii === true) {
35
+ this.on('postprocessEvent', addAutoIpAddressToUser);
36
+ this.on('beforeSendSession', addAutoIpAddressToSession);
37
+ }
34
38
  }
35
39
  /**
36
40
  * @inheritDoc
@@ -112,6 +116,24 @@ export class ReactNativeClient extends BaseClient {
112
116
  super.init();
113
117
  this._initNativeSdk();
114
118
  }
119
+ /**
120
+ * Register a hook on this client.
121
+ *
122
+ * (Generic method signature to allow for custom React Native Client events.)
123
+ */
124
+ on(hook, callback) {
125
+ // @ts-expect-error on from the base class doesn't support generic types
126
+ return super.on(hook, callback);
127
+ }
128
+ /**
129
+ * Emit a hook that was previously registered via `on()`.
130
+ *
131
+ * (Generic method signature to allow for custom React Native Client events.)
132
+ */
133
+ emit(hook, ...rest) {
134
+ // @ts-expect-error emit from the base class doesn't support generic types
135
+ super.emit(hook, ...rest);
136
+ }
115
137
  /**
116
138
  * Starts native client with dsn and options
117
139
  */
@@ -130,6 +152,7 @@ export class ReactNativeClient extends BaseClient {
130
152
  .then((didCallNativeInit) => {
131
153
  var _a, _b;
132
154
  (_b = (_a = this._options).onReady) === null || _b === void 0 ? void 0 : _b.call(_a, { didCallNativeInit });
155
+ this.emit('afterInit');
133
156
  })
134
157
  .then(undefined, error => {
135
158
  logger.error('The OnReady callback threw an error: ', error);
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAYvE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAA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,EAAE,KAAK,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACK,wBAAwB;QAC9B,IAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;YAC/C,KAAK,CAAC,KAAK,CACT,QAAQ,EACR,6NAA6N,CAC9N,CAAC;SACH;IACH,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,QAAmB,EAAE,QAA8B;QAC/E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,MAAM,gBAAgB,GAAqB;gBACzC,EAAE,IAAI,EAAE,eAAe,EAAE;gBACzB;oBACE,SAAS,EAAE,sBAAsB,EAAE;oBACnC,gBAAgB,EAAE,QAAQ;iBAC3B;aACF,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { eventFromException, eventFromMessage } from '@sentry/browser';\nimport type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Outcome,\n SeverityLevel,\n TransportMakeRequestResponse,\n UserFeedback,\n} from '@sentry/core';\nimport { BaseClient, dateTimestampInSeconds, logger, SentryError } from '@sentry/core';\nimport { Alert } from 'react-native';\n\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport { getDefaultSidecarUrl } from './integrations/spotlight';\nimport type { ReactNativeClientOptions } from './options';\nimport type { mobileReplayIntegration } from './replay/mobilereplay';\nimport { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { ReactNativeLibraries } from './utils/rnlibraries';\nimport { NATIVE } from './wrapper';\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n ignoreRequireCycleLogs(ReactNativeLibraries.ReactNativeVersion?.version);\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;\n // We default this to true, as it is the safer scenario\n options.parentSpanIsAlwaysRootSpan =\n options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;\n super(options);\n\n this._outcomesBuffer = [];\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint: EventHint = {}): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n * @deprecated Use `Sentry.captureFeedback` instead.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(feedback, {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: undefined,\n });\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * @inheritdoc\n */\n public sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._isEnabled() && this._transport && this._dsn) {\n this.emit('beforeEnvelope', envelope);\n\n this._transport.send(envelope).then(null, reason => {\n if (reason instanceof SentryError) {\n // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n logger.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n logger.error('Error while sending event:', reason);\n }\n });\n } else {\n logger.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n\n return Promise.resolve({});\n }\n\n /**\n * @inheritDoc\n */\n public init(): void {\n super.init();\n this._initNativeSdk();\n }\n\n /**\n * Starts native client with dsn and options\n */\n private _initNativeSdk(): void {\n NATIVE.initNativeSdk({\n ...this._options,\n defaultSidecarUrl: getDefaultSidecarUrl(),\n devServerUrl: getDevServer()?.url || '',\n mobileReplayOptions:\n this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&\n 'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]\n ? (this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] as ReturnType<typeof mobileReplayIntegration>).options\n : undefined,\n })\n .then(\n (result: boolean) => {\n return result;\n },\n () => {\n this._showCannotConnectDialog();\n return false;\n },\n )\n .then((didCallNativeInit: boolean) => {\n this._options.onReady?.({ didCallNativeInit });\n })\n .then(undefined, error => {\n logger.error('The OnReady callback threw an error: ', error);\n });\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/ for more details.',\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAYvE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,UAAU,EACV,sBAAsB,EACtB,MAAM,EACN,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,UAAoC;IAGzE;;;OAGG;IACH,YAAmB,OAAiC;;QAClD,sBAAsB,CAAC,MAAA,oBAAoB,CAAC,kBAAkB,0CAAE,OAAO,C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f,CAAC,CACF;aACA,IAAI,CAAC,CAAC,iBAA0B,EAAE,EAAE;;YACnC,MAAA,MAAA,IAAI,CAAC,QAAQ,EAAC,OAAO,mDAAG,EAAE,iBAAiB,EAAE,CAAC,CAAC;YAC/C,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzB,CAAC,CAAC;aACD,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE;YACvB,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACK,wBAAwB;QAC9B,IAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;YAC/C,KAAK,CAAC,KAAK,CACT,QAAQ,EACR,6NAA6N,CAC9N,CAAC;SACH;IACH,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,QAAmB,EAAE,QAA8B;QAC/E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,MAAM,gBAAgB,GAAqB;gBACzC,EAAE,IAAI,EAAE,eAAe,EAAE;gBACzB;oBACE,SAAS,EAAE,sBAAsB,EAAE;oBACnC,gBAAgB,EAAE,QAAQ;iBAC3B;aACF,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { eventFromException, eventFromMessage } from '@sentry/browser';\nimport type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Outcome,\n SeverityLevel,\n TransportMakeRequestResponse,\n UserFeedback,\n} from '@sentry/core';\nimport {\n addAutoIpAddressToSession,\n addAutoIpAddressToUser,\n BaseClient,\n dateTimestampInSeconds,\n logger,\n SentryError,\n} from '@sentry/core';\nimport { Alert } from 'react-native';\n\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport { getDefaultSidecarUrl } from './integrations/spotlight';\nimport type { ReactNativeClientOptions } from './options';\nimport type { mobileReplayIntegration } from './replay/mobilereplay';\nimport { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { ReactNativeLibraries } from './utils/rnlibraries';\nimport { NATIVE } from './wrapper';\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n ignoreRequireCycleLogs(ReactNativeLibraries.ReactNativeVersion?.version);\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;\n // We default this to true, as it is the safer scenario\n options.parentSpanIsAlwaysRootSpan =\n options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;\n super(options);\n\n this._outcomesBuffer = [];\n\n if (options.sendDefaultPii === true) {\n this.on('postprocessEvent', addAutoIpAddressToUser);\n this.on('beforeSendSession', addAutoIpAddressToSession);\n }\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint: EventHint = {}): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n * @deprecated Use `Sentry.captureFeedback` instead.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(feedback, {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: undefined,\n });\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * @inheritdoc\n */\n public sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._isEnabled() && this._transport && this._dsn) {\n this.emit('beforeEnvelope', envelope);\n\n this._transport.send(envelope).then(null, reason => {\n if (reason instanceof SentryError) {\n // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n logger.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n logger.error('Error while sending event:', reason);\n }\n });\n } else {\n logger.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n\n return Promise.resolve({});\n }\n\n /**\n * @inheritDoc\n */\n public init(): void {\n super.init();\n this._initNativeSdk();\n }\n\n /**\n * Register a hook on this client.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public on(hook: string, callback: unknown): () => void {\n // @ts-expect-error on from the base class doesn't support generic types\n return super.on(hook, callback);\n }\n\n /**\n * Emit a hook that was previously registered via `on()`.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public emit(hook: string, ...rest: unknown[]): void {\n // @ts-expect-error emit from the base class doesn't support generic types\n super.emit(hook, ...rest);\n }\n\n /**\n * Starts native client with dsn and options\n */\n private _initNativeSdk(): void {\n NATIVE.initNativeSdk({\n ...this._options,\n defaultSidecarUrl: getDefaultSidecarUrl(),\n devServerUrl: getDevServer()?.url || '',\n mobileReplayOptions:\n this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&\n 'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]\n ? (this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] as ReturnType<typeof mobileReplayIntegration>).options\n : undefined,\n })\n .then(\n (result: boolean) => {\n return result;\n },\n () => {\n this._showCannotConnectDialog();\n return false;\n },\n )\n .then((didCallNativeInit: boolean) => {\n this._options.onReady?.({ didCallNativeInit });\n this.emit('afterInit');\n })\n .then(undefined, error => {\n logger.error('The OnReady callback threw an error: ', error);\n });\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/ for more details.',\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
@@ -5,7 +5,7 @@ import type { FeedbackWidgetProps, FeedbackWidgetState } from './FeedbackWidget.
5
5
  * Implements a feedback form screen that sends feedback to Sentry using Sentry.captureFeedback.
6
6
  */
7
7
  export declare class FeedbackWidget extends React.Component<FeedbackWidgetProps, FeedbackWidgetState> {
8
- static defaultProps: Partial<FeedbackWidgetProps>;
8
+ static defaultProps: FeedbackWidgetProps;
9
9
  private static _savedState;
10
10
  private _didSubmitForm;
11
11
  constructor(props: FeedbackWidgetProps);
@@ -1 +1 @@
1
- {"version":3,"file":"FeedbackWidget.d.ts","sourceRoot":"","sources":["../../../src/js/feedback/FeedbackWidget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiB/B,OAAO,KAAK,EAA2D,mBAAmB,EAAE,mBAAmB,EAAkD,MAAM,wBAAwB,CAAC;AAIhM;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAC3F,OAAc,YAAY,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAEvD;IAED,OAAO,CAAC,MAAM,CAAC,WAAW,CAOxB;IAEF,OAAO,CAAC,cAAc,CAAkB;gBAErB,KAAK,EAAE,mBAAmB;IAuBtC,oBAAoB,EAAE,MAAM,IAAI,CAmDrC;IAEK,uBAAuB,EAAE,MAAM,IAAI,CAmEzC;IAED;;OAEG;IACI,oBAAoB,IAAI,IAAI;IASnC;;OAEG;IACI,MAAM,IAAI,KAAK,CAAC,SAAS;IAwGhC,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,eAAe,CASrB;CACH"}
1
+ {"version":3,"file":"FeedbackWidget.d.ts","sourceRoot":"","sources":["../../../src/js/feedback/FeedbackWidget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiB/B,OAAO,KAAK,EAA2D,mBAAmB,EAAE,mBAAmB,EAAkD,MAAM,wBAAwB,CAAC;AAIhM;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAC3F,OAAc,YAAY,sBAAwB;IAElD,OAAO,CAAC,MAAM,CAAC,WAAW,CAOxB;IAEF,OAAO,CAAC,cAAc,CAAkB;gBAErB,KAAK,EAAE,mBAAmB;IAuBtC,oBAAoB,EAAE,MAAM,IAAI,CAmDrC;IAEK,uBAAuB,EAAE,MAAM,IAAI,CAmEzC;IAED;;OAEG;IACI,oBAAoB,IAAI,IAAI;IASnC;;OAEG;IACI,MAAM,IAAI,KAAK,CAAC,SAAS;IAwGhC,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,eAAe,CASrB;CACH"}
@@ -74,15 +74,16 @@ export class FeedbackWidget extends React.Component {
74
74
  }
75
75
  };
76
76
  this.onScreenshotButtonPress = () => __awaiter(this, void 0, void 0, function* () {
77
+ var _j, _k, _l, _m, _o;
77
78
  if (!this.state.filename && !this.state.attachment) {
78
- const imagePickerConfiguration = this.props;
79
- if (imagePickerConfiguration.imagePicker) {
80
- const launchImageLibrary = imagePickerConfiguration.imagePicker.launchImageLibraryAsync
79
+ const { imagePicker } = this.props;
80
+ if (imagePicker) {
81
+ const launchImageLibrary = imagePicker.launchImageLibraryAsync
81
82
  // expo-image-picker library is available
82
- ? () => imagePickerConfiguration.imagePicker.launchImageLibraryAsync({ mediaTypes: ['images'], base64: isWeb() })
83
+ ? () => { var _a; return (_a = imagePicker.launchImageLibraryAsync) === null || _a === void 0 ? void 0 : _a.call(imagePicker, { mediaTypes: ['images'], base64: isWeb() }); }
83
84
  // react-native-image-picker library is available
84
- : imagePickerConfiguration.imagePicker.launchImageLibrary
85
- ? () => imagePickerConfiguration.imagePicker.launchImageLibrary({ mediaType: 'photo', includeBase64: isWeb() })
85
+ : imagePicker.launchImageLibrary
86
+ ? () => { var _a; return (_a = imagePicker.launchImageLibrary) === null || _a === void 0 ? void 0 : _a.call(imagePicker, { mediaType: 'photo', includeBase64: isWeb() }); }
86
87
  : null;
87
88
  if (!launchImageLibrary) {
88
89
  logger.warn('No compatible image picker library found. Please provide a valid image picker library.');
@@ -92,13 +93,13 @@ export class FeedbackWidget extends React.Component {
92
93
  return;
93
94
  }
94
95
  const result = yield launchImageLibrary();
95
- if (result.assets && result.assets.length > 0) {
96
+ if ((result === null || result === void 0 ? void 0 : result.assets) && result.assets.length > 0) {
96
97
  if (isWeb()) {
97
- const filename = result.assets[0].fileName;
98
- const imageUri = result.assets[0].uri;
99
- const base64 = result.assets[0].base64;
100
- const data = base64ToUint8Array(base64);
101
- if (data != null) {
98
+ const filename = (_j = result.assets[0]) === null || _j === void 0 ? void 0 : _j.fileName;
99
+ const imageUri = (_k = result.assets[0]) === null || _k === void 0 ? void 0 : _k.uri;
100
+ const base64 = (_l = result.assets[0]) === null || _l === void 0 ? void 0 : _l.base64;
101
+ const data = base64 ? base64ToUint8Array(base64) : undefined;
102
+ if (data) {
102
103
  this.setState({ filename, attachment: data, attachmentUri: imageUri });
103
104
  }
104
105
  else {
@@ -106,10 +107,10 @@ export class FeedbackWidget extends React.Component {
106
107
  }
107
108
  }
108
109
  else {
109
- const filename = result.assets[0].fileName;
110
- const imageUri = result.assets[0].uri;
111
- getDataFromUri(imageUri).then((data) => {
112
- if (data != null) {
110
+ const filename = (_m = result.assets[0]) === null || _m === void 0 ? void 0 : _m.fileName;
111
+ const imageUri = (_o = result.assets[0]) === null || _o === void 0 ? void 0 : _o.uri;
112
+ imageUri && getDataFromUri(imageUri).then((data) => {
113
+ if (data) {
113
114
  this.setState({ filename, attachment: data, attachmentUri: imageUri });
114
115
  }
115
116
  else {
@@ -237,7 +238,7 @@ export class FeedbackWidget extends React.Component {
237
238
  React.createElement(Text, { style: styles.cancelText }, text.cancelButtonLabel)))));
238
239
  }
239
240
  }
240
- FeedbackWidget.defaultProps = Object.assign({}, defaultConfiguration);
241
+ FeedbackWidget.defaultProps = defaultConfiguration;
241
242
  FeedbackWidget._savedState = {
242
243
  name: '',
243
244
  email: '',
@@ -1 +1 @@
1
- {"version":3,"file":"FeedbackWidget.js","sourceRoot":"","sources":["../../../src/js/feedback/FeedbackWidget.tsx"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE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C9C,CACd,CACkB,CAC5B,CAAC;IACJ,CAAC;;AArRa,2BAAY,qBACrB,oBAAoB,EACxB;AAEc,0BAAW,GAA2C;IACnE,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,WAAW,EAAE,EAAE;IACf,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,SAAS;IACrB,aAAa,EAAE,SAAS;CACzB,CAAC","sourcesContent":["import type { SendFeedbackParams } from '@sentry/core';\nimport { captureFeedback, getCurrentScope, lastEventId, logger } from '@sentry/core';\nimport * as React from 'react';\nimport type { KeyboardTypeOptions } from 'react-native';\nimport {\n Image,\n Keyboard,\n Text,\n TextInput,\n TouchableOpacity,\n TouchableWithoutFeedback,\n View\n} from 'react-native';\n\nimport { isWeb, notWeb } from '../utils/environment';\nimport { getDataFromUri } from '../wrapper';\nimport { sentryLogo } from './branding';\nimport { defaultConfiguration } from './defaults';\nimport defaultStyles from './FeedbackWidget.styles';\nimport type { FeedbackGeneralConfiguration, FeedbackTextConfiguration, FeedbackWidgetProps, FeedbackWidgetState, FeedbackWidgetStyles, ImagePickerConfiguration } from './FeedbackWidget.types';\nimport { lazyLoadFeedbackIntegration } from './lazy';\nimport { base64ToUint8Array, feedbackAlertDialog, isValidEmail } from './utils';\n\n/**\n * @beta\n * Implements a feedback form screen that sends feedback to Sentry using Sentry.captureFeedback.\n */\nexport class FeedbackWidget extends React.Component<FeedbackWidgetProps, FeedbackWidgetState> {\n public static defaultProps: Partial<FeedbackWidgetProps> = {\n ...defaultConfiguration\n }\n\n private static _savedState: Omit<FeedbackWidgetState, 'isVisible'> = {\n name: '',\n email: '',\n description: '',\n filename: undefined,\n attachment: undefined,\n attachmentUri: undefined,\n };\n\n private _didSubmitForm: boolean = false;\n\n public constructor(props: FeedbackWidgetProps) {\n super(props);\n\n const currentUser = {\n useSentryUser: {\n email: this.props?.useSentryUser?.email || getCurrentScope()?.getUser()?.email || '',\n name: this.props?.useSentryUser?.name || getCurrentScope()?.getUser()?.name || '',\n }\n }\n\n this.state = {\n isVisible: true,\n name: FeedbackWidget._savedState.name || currentUser.useSentryUser.name,\n email: FeedbackWidget._savedState.email || currentUser.useSentryUser.email,\n description: FeedbackWidget._savedState.description || '',\n filename: FeedbackWidget._savedState.filename || undefined,\n attachment: FeedbackWidget._savedState.attachment || undefined,\n attachmentUri: FeedbackWidget._savedState.attachmentUri || undefined,\n };\n\n lazyLoadFeedbackIntegration();\n }\n\n public handleFeedbackSubmit: () => void = () => {\n const { name, email, description } = this.state;\n const { onSubmitSuccess, onSubmitError, onFormSubmitted } = this.props;\n const text: FeedbackTextConfiguration = this.props;\n\n const trimmedName = name?.trim();\n const trimmedEmail = email?.trim();\n const trimmedDescription = description?.trim();\n\n if ((this.props.isNameRequired && !trimmedName) || (this.props.isEmailRequired && !trimmedEmail) || !trimmedDescription) {\n feedbackAlertDialog(text.errorTitle, text.formError);\n return;\n }\n\n if (this.props.shouldValidateEmail && (this.props.isEmailRequired || trimmedEmail.length > 0) && !isValidEmail(trimmedEmail)) {\n feedbackAlertDialog(text.errorTitle, text.emailError);\n return;\n }\n\n const attachments = this.state.filename && this.state.attachment\n ? [\n {\n filename: this.state.filename,\n data: this.state.attachment,\n },\n ]\n : undefined;\n\n const eventId = lastEventId();\n const userFeedback: SendFeedbackParams = {\n message: trimmedDescription,\n name: trimmedName,\n email: trimmedEmail,\n associatedEventId: eventId,\n };\n\n try {\n if (!onFormSubmitted) {\n this.setState({ isVisible: false });\n }\n captureFeedback(userFeedback, attachments ? { attachments } : undefined);\n onSubmitSuccess({ name: trimmedName, email: trimmedEmail, message: trimmedDescription, attachments: attachments });\n feedbackAlertDialog(text.successMessageText , '');\n onFormSubmitted();\n this._didSubmitForm = true;\n } catch (error) {\n const errorString = `Feedback form submission failed: ${error}`;\n onSubmitError(new Error(errorString));\n feedbackAlertDialog(text.errorTitle, text.genericError);\n logger.error(`Feedback form submission failed: ${error}`);\n }\n };\n\n public onScreenshotButtonPress: () => void = async () => {\n if (!this.state.filename && !this.state.attachment) {\n const imagePickerConfiguration: ImagePickerConfiguration = this.props;\n if (imagePickerConfiguration.imagePicker) {\n const launchImageLibrary = imagePickerConfiguration.imagePicker.launchImageLibraryAsync\n // expo-image-picker library is available\n ? () => imagePickerConfiguration.imagePicker.launchImageLibraryAsync({ mediaTypes: ['images'], base64: isWeb() })\n // react-native-image-picker library is available\n : imagePickerConfiguration.imagePicker.launchImageLibrary\n ? () => imagePickerConfiguration.imagePicker.launchImageLibrary({ mediaType: 'photo', includeBase64: isWeb() })\n : null;\n if (!launchImageLibrary) {\n logger.warn('No compatible image picker library found. Please provide a valid image picker library.');\n if (__DEV__) {\n feedbackAlertDialog(\n 'Development note',\n 'No compatible image picker library found. Please provide a compatible version of `expo-image-picker` or `react-native-image-picker`.',\n );\n }\n return;\n }\n\n const result = await launchImageLibrary();\n if (result.assets && result.assets.length > 0) {\n if (isWeb()) {\n const filename = result.assets[0].fileName;\n const imageUri = result.assets[0].uri;\n const base64 = result.assets[0].base64;\n const data = base64ToUint8Array(base64);\n if (data != null) {\n this.setState({ filename, attachment: data, attachmentUri: imageUri });\n } else {\n logger.error('Failed to read image data on the web');\n }\n } else {\n const filename = result.assets[0].fileName;\n const imageUri = result.assets[0].uri;\n getDataFromUri(imageUri).then((data) => {\n if (data != null) {\n this.setState({ filename, attachment: data, attachmentUri: imageUri });\n } else {\n logger.error('Failed to read image data from uri:', imageUri);\n }\n }).catch((error) => {\n logger.error('Failed to read image data from uri:', imageUri, 'error: ', error);\n });\n }\n }\n } else {\n // Defaulting to the onAddScreenshot callback\n const { onAddScreenshot } = { ...defaultConfiguration, ...this.props };\n onAddScreenshot((uri: string) => {\n getDataFromUri(uri).then((data) => {\n if (data != null) {\n this.setState({ filename: 'feedback_screenshot', attachment: data, attachmentUri: uri });\n } else {\n logger.error('Failed to read image data from uri:', uri);\n }\n })\n .catch((error) => {\n logger.error('Failed to read image data from uri:', uri, 'error: ', error);\n });\n });\n }\n } else {\n this.setState({ filename: undefined, attachment: undefined, attachmentUri: undefined });\n }\n }\n\n /**\n * Save the state before unmounting the component.\n */\n public componentWillUnmount(): void {\n if (this._didSubmitForm) {\n this._clearFormState();\n this._didSubmitForm = false;\n } else {\n this._saveFormState();\n }\n }\n\n /**\n * Renders the feedback form screen.\n */\n public render(): React.ReactNode {\n const { name, email, description } = this.state;\n const { onFormClose } = this.props;\n const config: FeedbackGeneralConfiguration = this.props;\n const imagePickerConfiguration: ImagePickerConfiguration = this.props;\n const text: FeedbackTextConfiguration = this.props;\n const styles: FeedbackWidgetStyles = { ...defaultStyles, ...this.props.styles };\n const onCancel = (): void => {\n if (onFormClose) {\n onFormClose();\n } else {\n this.setState({ isVisible: false });\n }\n }\n\n if (!this.state.isVisible) {\n return null;\n }\n\n return (\n <TouchableWithoutFeedback onPress={notWeb() ? Keyboard.dismiss: undefined}>\n <View style={styles.container}>\n <View style={styles.titleContainer}>\n <Text style={styles.title}>{text.formTitle}</Text>\n {config.showBranding && (\n <Image\n source={{ uri: sentryLogo }}\n style={styles.sentryLogo}\n testID='sentry-logo'\n />\n )}\n </View>\n\n {config.showName && (\n <>\n <Text style={styles.label}>\n {text.nameLabel}\n {config.isNameRequired && ` ${text.isRequiredLabel}`}\n </Text>\n <TextInput\n style={styles.input}\n placeholder={text.namePlaceholder}\n value={name}\n onChangeText={(value) => this.setState({ name: value })}\n />\n </>\n )}\n\n {config.showEmail && (\n <>\n <Text style={styles.label}>\n {text.emailLabel}\n {config.isEmailRequired && ` ${text.isRequiredLabel}`}\n </Text>\n <TextInput\n style={styles.input}\n placeholder={text.emailPlaceholder}\n keyboardType={'email-address' as KeyboardTypeOptions}\n value={email}\n onChangeText={(value) => this.setState({ email: value })}\n />\n </>\n )}\n\n <Text style={styles.label}>\n {text.messageLabel}\n {` ${text.isRequiredLabel}`}\n </Text>\n <TextInput\n style={[styles.input, styles.textArea]}\n placeholder={text.messagePlaceholder}\n value={description}\n onChangeText={(value) => this.setState({ description: value })}\n multiline\n />\n {(config.enableScreenshot || imagePickerConfiguration.imagePicker) && (\n <View style={styles.screenshotContainer}>\n {this.state.attachmentUri && (\n <Image\n source={{ uri: this.state.attachmentUri }}\n style={styles.screenshotThumbnail}\n />\n )}\n <TouchableOpacity style={styles.screenshotButton} onPress={this.onScreenshotButtonPress}>\n <Text style={styles.screenshotText}>\n {!this.state.filename && !this.state.attachment\n ? text.addScreenshotButtonLabel\n : text.removeScreenshotButtonLabel}\n </Text>\n </TouchableOpacity>\n </View>\n )}\n <TouchableOpacity style={styles.submitButton} onPress={this.handleFeedbackSubmit}>\n <Text style={styles.submitText}>{text.submitButtonLabel}</Text>\n </TouchableOpacity>\n\n <TouchableOpacity style={styles.cancelButton} onPress={onCancel}>\n <Text style={styles.cancelText}>{text.cancelButtonLabel}</Text>\n </TouchableOpacity>\n </View>\n </TouchableWithoutFeedback>\n );\n }\n\n private _saveFormState = (): void => {\n FeedbackWidget._savedState = { ...this.state };\n };\n\n private _clearFormState = (): void => {\n FeedbackWidget._savedState = {\n name: '',\n email: '',\n description: '',\n filename: undefined,\n attachment: undefined,\n attachmentUri: undefined,\n };\n };\n}\n"]}
1
+ {"version":3,"file":"FeedbackWidget.js","sourceRoot":"","sources":["../../../src/js/feedback/FeedbackWidget.tsx"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,wBAAwB,EACxB,IAAI,EACL,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE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ope, lastEventId, logger } from '@sentry/core';\nimport * as React from 'react';\nimport type { KeyboardTypeOptions } from 'react-native';\nimport {\n Image,\n Keyboard,\n Text,\n TextInput,\n TouchableOpacity,\n TouchableWithoutFeedback,\n View\n} from 'react-native';\n\nimport { isWeb, notWeb } from '../utils/environment';\nimport { getDataFromUri } from '../wrapper';\nimport { sentryLogo } from './branding';\nimport { defaultConfiguration } from './defaults';\nimport defaultStyles from './FeedbackWidget.styles';\nimport type { FeedbackGeneralConfiguration, FeedbackTextConfiguration, FeedbackWidgetProps, FeedbackWidgetState, FeedbackWidgetStyles, ImagePickerConfiguration } from './FeedbackWidget.types';\nimport { lazyLoadFeedbackIntegration } from './lazy';\nimport { base64ToUint8Array, feedbackAlertDialog, isValidEmail } from './utils';\n\n/**\n * @beta\n * Implements a feedback form screen that sends feedback to Sentry using Sentry.captureFeedback.\n */\nexport class FeedbackWidget extends React.Component<FeedbackWidgetProps, FeedbackWidgetState> {\n public static defaultProps = defaultConfiguration;\n\n private static _savedState: Omit<FeedbackWidgetState, 'isVisible'> = {\n name: '',\n email: '',\n description: '',\n filename: undefined,\n attachment: undefined,\n attachmentUri: undefined,\n };\n\n private _didSubmitForm: boolean = false;\n\n public constructor(props: FeedbackWidgetProps) {\n super(props);\n\n const currentUser = {\n useSentryUser: {\n email: this.props?.useSentryUser?.email || getCurrentScope()?.getUser()?.email || '',\n name: this.props?.useSentryUser?.name || getCurrentScope()?.getUser()?.name || '',\n }\n }\n\n this.state = {\n isVisible: true,\n name: FeedbackWidget._savedState.name || currentUser.useSentryUser.name,\n email: FeedbackWidget._savedState.email || currentUser.useSentryUser.email,\n description: FeedbackWidget._savedState.description || '',\n filename: FeedbackWidget._savedState.filename || undefined,\n attachment: FeedbackWidget._savedState.attachment || undefined,\n attachmentUri: FeedbackWidget._savedState.attachmentUri || undefined,\n };\n\n lazyLoadFeedbackIntegration();\n }\n\n public handleFeedbackSubmit: () => void = () => {\n const { name, email, description } = this.state;\n const { onSubmitSuccess, onSubmitError, onFormSubmitted } = this.props;\n const text = this.props;\n\n const trimmedName = name?.trim();\n const trimmedEmail = email?.trim();\n const trimmedDescription = description?.trim();\n\n if ((this.props.isNameRequired && !trimmedName) || (this.props.isEmailRequired && !trimmedEmail) || !trimmedDescription) {\n feedbackAlertDialog(text.errorTitle, text.formError);\n return;\n }\n\n if (this.props.shouldValidateEmail && (this.props.isEmailRequired || trimmedEmail.length > 0) && !isValidEmail(trimmedEmail)) {\n feedbackAlertDialog(text.errorTitle, text.emailError);\n return;\n }\n\n const attachments = this.state.filename && this.state.attachment\n ? [\n {\n filename: this.state.filename,\n data: this.state.attachment,\n },\n ]\n : undefined;\n\n const eventId = lastEventId();\n const userFeedback: SendFeedbackParams = {\n message: trimmedDescription,\n name: trimmedName,\n email: trimmedEmail,\n associatedEventId: eventId,\n };\n\n try {\n if (!onFormSubmitted) {\n this.setState({ isVisible: false });\n }\n captureFeedback(userFeedback, attachments ? { attachments } : undefined);\n onSubmitSuccess({ name: trimmedName, email: trimmedEmail, message: trimmedDescription, attachments: attachments });\n feedbackAlertDialog(text.successMessageText , '');\n onFormSubmitted();\n this._didSubmitForm = true;\n } catch (error) {\n const errorString = `Feedback form submission failed: ${error}`;\n onSubmitError(new Error(errorString));\n feedbackAlertDialog(text.errorTitle, text.genericError);\n logger.error(`Feedback form submission failed: ${error}`);\n }\n };\n\n public onScreenshotButtonPress: () => void = async () => {\n if (!this.state.filename && !this.state.attachment) {\n const { imagePicker } = this.props;\n if (imagePicker) {\n const launchImageLibrary = imagePicker.launchImageLibraryAsync\n // expo-image-picker library is available\n ? () => imagePicker.launchImageLibraryAsync?.({ mediaTypes: ['images'], base64: isWeb() })\n // react-native-image-picker library is available\n : imagePicker.launchImageLibrary\n ? () => imagePicker.launchImageLibrary?.({ mediaType: 'photo', includeBase64: isWeb() })\n : null;\n if (!launchImageLibrary) {\n logger.warn('No compatible image picker library found. Please provide a valid image picker library.');\n if (__DEV__) {\n feedbackAlertDialog(\n 'Development note',\n 'No compatible image picker library found. Please provide a compatible version of `expo-image-picker` or `react-native-image-picker`.',\n );\n }\n return;\n }\n\n const result = await launchImageLibrary();\n if (result?.assets && result.assets.length > 0) {\n if (isWeb()) {\n const filename = result.assets[0]?.fileName;\n const imageUri = result.assets[0]?.uri;\n const base64 = result.assets[0]?.base64;\n const data = base64 ? base64ToUint8Array(base64) : undefined;\n if (data) {\n this.setState({ filename, attachment: data, attachmentUri: imageUri });\n } else {\n logger.error('Failed to read image data on the web');\n }\n } else {\n const filename = result.assets[0]?.fileName;\n const imageUri = result.assets[0]?.uri;\n imageUri && getDataFromUri(imageUri).then((data) => {\n if (data) {\n this.setState({ filename, attachment: data, attachmentUri: imageUri });\n } else {\n logger.error('Failed to read image data from uri:', imageUri);\n }\n }).catch((error) => {\n logger.error('Failed to read image data from uri:', imageUri, 'error: ', error);\n });\n }\n }\n } else {\n // Defaulting to the onAddScreenshot callback\n const { onAddScreenshot } = { ...defaultConfiguration, ...this.props };\n onAddScreenshot((uri: string) => {\n getDataFromUri(uri).then((data) => {\n if (data != null) {\n this.setState({ filename: 'feedback_screenshot', attachment: data, attachmentUri: uri });\n } else {\n logger.error('Failed to read image data from uri:', uri);\n }\n })\n .catch((error) => {\n logger.error('Failed to read image data from uri:', uri, 'error: ', error);\n });\n });\n }\n } else {\n this.setState({ filename: undefined, attachment: undefined, attachmentUri: undefined });\n }\n }\n\n /**\n * Save the state before unmounting the component.\n */\n public componentWillUnmount(): void {\n if (this._didSubmitForm) {\n this._clearFormState();\n this._didSubmitForm = false;\n } else {\n this._saveFormState();\n }\n }\n\n /**\n * Renders the feedback form screen.\n */\n public render(): React.ReactNode {\n const { name, email, description } = this.state;\n const { onFormClose } = this.props;\n const config: FeedbackGeneralConfiguration = this.props;\n const imagePickerConfiguration: ImagePickerConfiguration = this.props;\n const text: FeedbackTextConfiguration = this.props;\n const styles: FeedbackWidgetStyles = { ...defaultStyles, ...this.props.styles };\n const onCancel = (): void => {\n if (onFormClose) {\n onFormClose();\n } else {\n this.setState({ isVisible: false });\n }\n }\n\n if (!this.state.isVisible) {\n return null;\n }\n\n return (\n <TouchableWithoutFeedback onPress={notWeb() ? Keyboard.dismiss: undefined}>\n <View style={styles.container}>\n <View style={styles.titleContainer}>\n <Text style={styles.title}>{text.formTitle}</Text>\n {config.showBranding && (\n <Image\n source={{ uri: sentryLogo }}\n style={styles.sentryLogo}\n testID='sentry-logo'\n />\n )}\n </View>\n\n {config.showName && (\n <>\n <Text style={styles.label}>\n {text.nameLabel}\n {config.isNameRequired && ` ${text.isRequiredLabel}`}\n </Text>\n <TextInput\n style={styles.input}\n placeholder={text.namePlaceholder}\n value={name}\n onChangeText={(value) => this.setState({ name: value })}\n />\n </>\n )}\n\n {config.showEmail && (\n <>\n <Text style={styles.label}>\n {text.emailLabel}\n {config.isEmailRequired && ` ${text.isRequiredLabel}`}\n </Text>\n <TextInput\n style={styles.input}\n placeholder={text.emailPlaceholder}\n keyboardType={'email-address' as KeyboardTypeOptions}\n value={email}\n onChangeText={(value) => this.setState({ email: value })}\n />\n </>\n )}\n\n <Text style={styles.label}>\n {text.messageLabel}\n {` ${text.isRequiredLabel}`}\n </Text>\n <TextInput\n style={[styles.input, styles.textArea]}\n placeholder={text.messagePlaceholder}\n value={description}\n onChangeText={(value) => this.setState({ description: value })}\n multiline\n />\n {(config.enableScreenshot || imagePickerConfiguration.imagePicker) && (\n <View style={styles.screenshotContainer}>\n {this.state.attachmentUri && (\n <Image\n source={{ uri: this.state.attachmentUri }}\n style={styles.screenshotThumbnail}\n />\n )}\n <TouchableOpacity style={styles.screenshotButton} onPress={this.onScreenshotButtonPress}>\n <Text style={styles.screenshotText}>\n {!this.state.filename && !this.state.attachment\n ? text.addScreenshotButtonLabel\n : text.removeScreenshotButtonLabel}\n </Text>\n </TouchableOpacity>\n </View>\n )}\n <TouchableOpacity style={styles.submitButton} onPress={this.handleFeedbackSubmit}>\n <Text style={styles.submitText}>{text.submitButtonLabel}</Text>\n </TouchableOpacity>\n\n <TouchableOpacity style={styles.cancelButton} onPress={onCancel}>\n <Text style={styles.cancelText}>{text.cancelButtonLabel}</Text>\n </TouchableOpacity>\n </View>\n </TouchableWithoutFeedback>\n );\n }\n\n private _saveFormState = (): void => {\n FeedbackWidget._savedState = { ...this.state };\n };\n\n private _clearFormState = (): void => {\n FeedbackWidget._savedState = {\n name: '',\n email: '',\n description: '',\n filename: undefined,\n attachment: undefined,\n attachmentUri: undefined,\n };\n };\n}\n"]}
@@ -15,32 +15,32 @@ export interface FeedbackGeneralConfiguration {
15
15
  *
16
16
  * @default true
17
17
  */
18
- showBranding?: boolean;
18
+ showBranding: boolean;
19
19
  /**
20
20
  * Should the email field be required?
21
21
  */
22
- isEmailRequired?: boolean;
22
+ isEmailRequired: boolean;
23
23
  /**
24
24
  * Should the email field be validated?
25
25
  */
26
- shouldValidateEmail?: boolean;
26
+ shouldValidateEmail: boolean;
27
27
  /**
28
28
  * Should the name field be required?
29
29
  */
30
- isNameRequired?: boolean;
30
+ isNameRequired: boolean;
31
31
  /**
32
32
  * Should the email input field be visible? Note: email will still be collected if set via `Sentry.setUser()`
33
33
  */
34
- showEmail?: boolean;
34
+ showEmail: boolean;
35
35
  /**
36
36
  * Should the name input field be visible? Note: name will still be collected if set via `Sentry.setUser()`
37
37
  */
38
- showName?: boolean;
38
+ showName: boolean;
39
39
  /**
40
40
  * This flag determines whether the "Add Screenshot" button is displayed
41
41
  * @default false
42
42
  */
43
- enableScreenshot?: boolean;
43
+ enableScreenshot: boolean;
44
44
  /**
45
45
  * Fill in email/name input fields with Sentry user context if it exists.
46
46
  * The value of the email/name keys represent the properties of your user context.
@@ -57,27 +57,27 @@ export interface FeedbackTextConfiguration {
57
57
  /**
58
58
  * The label for the Feedback form cancel button that closes dialog
59
59
  */
60
- cancelButtonLabel?: string;
60
+ cancelButtonLabel: string;
61
61
  /**
62
62
  * The label for the Feedback form submit button that sends feedback
63
63
  */
64
- submitButtonLabel?: string;
64
+ submitButtonLabel: string;
65
65
  /**
66
66
  * The title of the Feedback form
67
67
  */
68
- formTitle?: string;
68
+ formTitle: string;
69
69
  /**
70
70
  * Label for the email input
71
71
  */
72
- emailLabel?: string;
72
+ emailLabel: string;
73
73
  /**
74
74
  * Placeholder text for Feedback email input
75
75
  */
76
- emailPlaceholder?: string;
76
+ emailPlaceholder: string;
77
77
  /**
78
78
  * Label for the message input
79
79
  */
80
- messageLabel?: string;
80
+ messageLabel: string;
81
81
  /**
82
82
  * Placeholder text for Feedback message input
83
83
  */
@@ -85,43 +85,43 @@ export interface FeedbackTextConfiguration {
85
85
  /**
86
86
  * Label for the name input
87
87
  */
88
- nameLabel?: string;
88
+ nameLabel: string;
89
89
  /**
90
90
  * Message after feedback was sent successfully
91
91
  */
92
- successMessageText?: string;
92
+ successMessageText: string;
93
93
  /**
94
94
  * Placeholder text for Feedback name input
95
95
  */
96
- namePlaceholder?: string;
96
+ namePlaceholder: string;
97
97
  /**
98
98
  * Text which indicates that a field is required
99
99
  */
100
- isRequiredLabel?: string;
100
+ isRequiredLabel: string;
101
101
  /**
102
102
  * The label for the button that adds a screenshot and renders the image editor
103
103
  */
104
- addScreenshotButtonLabel?: string;
104
+ addScreenshotButtonLabel: string;
105
105
  /**
106
106
  * The label for the button that removes a screenshot and hides the image editor
107
107
  */
108
- removeScreenshotButtonLabel?: string;
108
+ removeScreenshotButtonLabel: string;
109
109
  /**
110
110
  * The title of the error dialog
111
111
  */
112
- errorTitle?: string;
112
+ errorTitle: string;
113
113
  /**
114
114
  * The error message when the form is invalid
115
115
  */
116
- formError?: string;
116
+ formError: string;
117
117
  /**
118
118
  * The error message when the email is invalid
119
119
  */
120
- emailError?: string;
120
+ emailError: string;
121
121
  /**
122
122
  * Message when there is a generic error
123
123
  */
124
- genericError?: string;
124
+ genericError: string;
125
125
  }
126
126
  /**
127
127
  * The public callbacks available for the feedback integration
@@ -130,29 +130,29 @@ export interface FeedbackCallbacks {
130
130
  /**
131
131
  * Callback when form is opened
132
132
  */
133
- onFormOpen?: () => void;
133
+ onFormOpen: () => void;
134
134
  /**
135
135
  * Callback when form is closed and not submitted
136
136
  */
137
- onFormClose?: () => void;
137
+ onFormClose: () => void;
138
138
  /**
139
139
  * Callback when a screenshot is added
140
140
  */
141
- onAddScreenshot?: (addScreenshot: (uri: string) => void) => void;
141
+ onAddScreenshot: (addScreenshot: (uri: string) => void) => void;
142
142
  /**
143
143
  * Callback when feedback is successfully submitted
144
144
  *
145
145
  * After this you'll see a SuccessMessage on the screen for a moment.
146
146
  */
147
- onSubmitSuccess?: (data: FeedbackFormData) => void;
147
+ onSubmitSuccess: (data: FeedbackFormData) => void;
148
148
  /**
149
149
  * Callback when feedback is unsuccessfully submitted
150
150
  */
151
- onSubmitError?: (error: Error) => void;
151
+ onSubmitError: (error: Error) => void;
152
152
  /**
153
153
  * Callback when the feedback form is submitted successfully, and the SuccessMessage is complete, or dismissed
154
154
  */
155
- onFormSubmitted?: () => void;
155
+ onFormSubmitted: () => void;
156
156
  }
157
157
  /**
158
158
  * Image Picker configuration interface compatible with: