@sentry/react-native 7.0.0-beta.0 → 7.0.0-beta.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 (138) hide show
  1. package/RNSentry.podspec +10 -3
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +42 -0
  4. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  5. package/android/src/newarch/java/io/sentry/react/replay/RNSentryReplayUnmaskManager.java +2 -2
  6. package/dist/js/client.d.ts +1 -0
  7. package/dist/js/client.d.ts.map +1 -1
  8. package/dist/js/client.js +16 -2
  9. package/dist/js/client.js.map +1 -1
  10. package/dist/js/feedback/FeedbackWidget.d.ts +2 -0
  11. package/dist/js/feedback/FeedbackWidget.d.ts.map +1 -1
  12. package/dist/js/feedback/FeedbackWidget.js +39 -21
  13. package/dist/js/feedback/FeedbackWidget.js.map +1 -1
  14. package/dist/js/feedback/ScreenshotButton.js +1 -1
  15. package/dist/js/feedback/ScreenshotButton.js.map +1 -1
  16. package/dist/js/index.d.ts +1 -0
  17. package/dist/js/index.d.ts.map +1 -1
  18. package/dist/js/index.js +1 -0
  19. package/dist/js/index.js.map +1 -1
  20. package/dist/js/integrations/default.d.ts.map +1 -1
  21. package/dist/js/integrations/default.js +4 -3
  22. package/dist/js/integrations/default.js.map +1 -1
  23. package/dist/js/integrations/exports.d.ts +1 -0
  24. package/dist/js/integrations/exports.d.ts.map +1 -1
  25. package/dist/js/integrations/exports.js +1 -0
  26. package/dist/js/integrations/exports.js.map +1 -1
  27. package/dist/js/integrations/primitiveTagIntegration.d.ts +16 -0
  28. package/dist/js/integrations/primitiveTagIntegration.d.ts.map +1 -0
  29. package/dist/js/integrations/primitiveTagIntegration.js +35 -0
  30. package/dist/js/integrations/primitiveTagIntegration.js.map +1 -0
  31. package/dist/js/integrations/reactnativeinfo.js +1 -1
  32. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  33. package/dist/js/options.d.ts +14 -2
  34. package/dist/js/options.d.ts.map +1 -1
  35. package/dist/js/options.js +2 -3
  36. package/dist/js/options.js.map +1 -1
  37. package/dist/js/playground/animations.d.ts +4 -0
  38. package/dist/js/playground/animations.d.ts.map +1 -0
  39. package/dist/js/playground/animations.js +4 -0
  40. package/dist/js/playground/animations.js.map +1 -0
  41. package/dist/js/playground/examples.d.ts +13 -0
  42. package/dist/js/playground/examples.d.ts.map +1 -0
  43. package/dist/js/playground/examples.js +35 -0
  44. package/dist/js/playground/examples.js.map +1 -0
  45. package/dist/js/playground/images.d.ts +4 -0
  46. package/dist/js/playground/images.d.ts.map +1 -0
  47. package/dist/js/playground/images.js +4 -0
  48. package/dist/js/playground/images.js.map +1 -0
  49. package/dist/js/playground/index.d.ts +2 -0
  50. package/dist/js/playground/index.d.ts.map +1 -0
  51. package/dist/js/playground/index.js +2 -0
  52. package/dist/js/playground/index.js.map +1 -0
  53. package/dist/js/playground/modal.d.ts +29 -0
  54. package/dist/js/playground/modal.d.ts.map +1 -0
  55. package/dist/js/playground/modal.js +259 -0
  56. package/dist/js/playground/modal.js.map +1 -0
  57. package/dist/js/scopeSync.js +2 -2
  58. package/dist/js/scopeSync.js.map +1 -1
  59. package/dist/js/sdk.d.ts.map +1 -1
  60. package/dist/js/sdk.js +9 -7
  61. package/dist/js/sdk.js.map +1 -1
  62. package/dist/js/tools/metroconfig.d.ts +6 -0
  63. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  64. package/dist/js/tools/metroconfig.js +5 -3
  65. package/dist/js/tools/metroconfig.js.map +1 -1
  66. package/dist/js/tools/sentryMetroSerializer.d.ts +1 -1
  67. package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
  68. package/dist/js/tools/sentryMetroSerializer.js +6 -42
  69. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  70. package/dist/js/tools/sentryReleaseInjector.d.ts +10 -0
  71. package/dist/js/tools/sentryReleaseInjector.d.ts.map +1 -0
  72. package/dist/js/tools/sentryReleaseInjector.js +30 -0
  73. package/dist/js/tools/sentryReleaseInjector.js.map +1 -0
  74. package/dist/js/tools/utils.d.ts +18 -1
  75. package/dist/js/tools/utils.d.ts.map +1 -1
  76. package/dist/js/tools/utils.js +69 -1
  77. package/dist/js/tools/utils.js.map +1 -1
  78. package/dist/js/tracing/integrations/appStart.d.ts +7 -1
  79. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
  80. package/dist/js/tracing/integrations/appStart.js +60 -9
  81. package/dist/js/tracing/integrations/appStart.js.map +1 -1
  82. package/dist/js/tracing/span.js +3 -3
  83. package/dist/js/tracing/span.js.map +1 -1
  84. package/dist/js/utils/environment.js +3 -3
  85. package/dist/js/utils/environment.js.map +1 -1
  86. package/dist/js/utils/expoglobalobject.d.ts +2 -1
  87. package/dist/js/utils/expoglobalobject.d.ts.map +1 -1
  88. package/dist/js/utils/expoglobalobject.js.map +1 -1
  89. package/dist/js/utils/expomodules.d.ts +5 -1
  90. package/dist/js/utils/expomodules.d.ts.map +1 -1
  91. package/dist/js/utils/expomodules.js +7 -0
  92. package/dist/js/utils/expomodules.js.map +1 -1
  93. package/dist/js/utils/primitiveConverter.d.ts +6 -0
  94. package/dist/js/utils/primitiveConverter.d.ts.map +1 -0
  95. package/dist/js/utils/primitiveConverter.js +24 -0
  96. package/dist/js/utils/primitiveConverter.js.map +1 -0
  97. package/dist/js/utils/release.d.ts +9 -0
  98. package/dist/js/utils/release.d.ts.map +1 -0
  99. package/dist/js/utils/release.js +29 -0
  100. package/dist/js/utils/release.js.map +1 -0
  101. package/dist/js/utils/worldwide.d.ts +6 -0
  102. package/dist/js/utils/worldwide.d.ts.map +1 -1
  103. package/dist/js/utils/worldwide.js.map +1 -1
  104. package/dist/js/version.d.ts +1 -1
  105. package/dist/js/version.js +1 -1
  106. package/dist/js/version.js.map +1 -1
  107. package/dist/js/wrapper.d.ts +6 -2
  108. package/dist/js/wrapper.d.ts.map +1 -1
  109. package/dist/js/wrapper.js +17 -2
  110. package/dist/js/wrapper.js.map +1 -1
  111. package/ios/RNSentry.mm +92 -3
  112. package/ios/RNSentryExperimentalOptions.h +26 -0
  113. package/ios/RNSentryExperimentalOptions.m +22 -0
  114. package/ios/RNSentryVersion.m +1 -1
  115. package/package.json +3 -3
  116. package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -0
  117. package/plugin/build/withSentryAndroidGradlePlugin.js +3 -3
  118. package/react-native.config.js +4 -4
  119. package/scripts/sentry_utils.rb +5 -0
  120. package/ts3.8/dist/js/client.d.ts +1 -0
  121. package/ts3.8/dist/js/feedback/FeedbackWidget.d.ts +2 -0
  122. package/ts3.8/dist/js/index.d.ts +2 -0
  123. package/ts3.8/dist/js/integrations/exports.d.ts +1 -0
  124. package/ts3.8/dist/js/integrations/primitiveTagIntegration.d.ts +16 -0
  125. package/ts3.8/dist/js/options.d.ts +14 -2
  126. package/ts3.8/dist/js/playground/animations.d.ts +4 -0
  127. package/ts3.8/dist/js/playground/examples.d.ts +13 -0
  128. package/ts3.8/dist/js/playground/images.d.ts +4 -0
  129. package/ts3.8/dist/js/playground/index.d.ts +2 -0
  130. package/ts3.8/dist/js/playground/modal.d.ts +29 -0
  131. package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +7 -1
  132. package/ts3.8/dist/js/utils/expoglobalobject.d.ts +2 -1
  133. package/ts3.8/dist/js/utils/expomodules.d.ts +5 -1
  134. package/ts3.8/dist/js/utils/primitiveConverter.d.ts +6 -0
  135. package/ts3.8/dist/js/utils/release.d.ts +9 -0
  136. package/ts3.8/dist/js/utils/worldwide.d.ts +6 -0
  137. package/ts3.8/dist/js/version.d.ts +1 -1
  138. package/ts3.8/dist/js/wrapper.d.ts +6 -2
@@ -0,0 +1,259 @@
1
+ /* eslint-disable max-lines */
2
+ import { logger } from '@sentry/core';
3
+ import * as React from 'react';
4
+ import { Animated, Image, Modal, Platform, Pressable, SafeAreaView, StyleSheet, Text, useColorScheme, View, } from 'react-native';
5
+ import { getDevServer } from '../integrations/debugsymbolicatorutils';
6
+ import { isExpo, isExpoGo, isWeb } from '../utils/environment';
7
+ import { bug as bugAnimation, hi as hiAnimation, thumbsup as thumbsupAnimation } from './animations';
8
+ import { nativeCrashExample, tryCatchExample, uncaughtErrorExample } from './examples';
9
+ import { bug as bugImage, hi as hiImage, thumbsup as thumbsupImage } from './images';
10
+ /**
11
+ * Wrapper to add Sentry Playground to your application
12
+ * to test your Sentry React Native SDK setup.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * import * as Sentry from '@sentry/react-native';
17
+ * import { withSentryPlayground } from '@sentry/react-native/playground';
18
+ *
19
+ * function App() {
20
+ * return <View>...</View>;
21
+ * }
22
+ *
23
+ * export default withSentryPlayground(Sentry.wrap(App), {
24
+ * projectId: '123456',
25
+ * organizationSlug: 'my-org'
26
+ * });
27
+ * ```
28
+ */
29
+ export const withSentryPlayground = (Component, options = {}) => {
30
+ const Wrapper = (props) => {
31
+ return (React.createElement(React.Fragment, null,
32
+ React.createElement(SentryPlayground, { projectId: options.projectId, organizationSlug: options.organizationSlug }),
33
+ React.createElement(Component, Object.assign({}, props))));
34
+ };
35
+ Wrapper.displayName = 'withSentryPlayground()';
36
+ return Wrapper;
37
+ };
38
+ export const SentryPlayground = ({ projectId, organizationSlug, }) => {
39
+ const issuesStreamUrl = projectId && organizationSlug
40
+ ? `https://${organizationSlug}.sentry.io/issues/?project=${projectId}&statsPeriod=1h`
41
+ : 'https://sentry.io/';
42
+ const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;
43
+ const [show, setShow] = React.useState(true);
44
+ const [animation, setAnimation] = React.useState('hi');
45
+ const onAnimationPress = () => {
46
+ switch (animation) {
47
+ case 'hi':
48
+ setAnimation('thumbsup');
49
+ break;
50
+ default:
51
+ setAnimation('hi');
52
+ }
53
+ };
54
+ const showOpenSentryButton = !isExpo();
55
+ const isNativeCrashDisabled = isWeb() || isExpoGo() || __DEV__;
56
+ const animationContainerYPosition = React.useRef(new Animated.Value(0)).current;
57
+ const springAnimation = Animated.sequence([
58
+ Animated.timing(animationContainerYPosition, {
59
+ toValue: -50,
60
+ duration: 300,
61
+ useNativeDriver: true,
62
+ }),
63
+ Animated.spring(animationContainerYPosition, {
64
+ toValue: 0,
65
+ friction: 4,
66
+ tension: 40,
67
+ useNativeDriver: true,
68
+ }),
69
+ ]);
70
+ const changeAnimationToBug = (func) => {
71
+ setAnimation('bug');
72
+ springAnimation.start(() => {
73
+ func();
74
+ });
75
+ };
76
+ return (React.createElement(Modal, { presentationStyle: "formSheet", visible: show, animationType: "slide", onRequestClose: () => {
77
+ setShow(false);
78
+ } },
79
+ React.createElement(SafeAreaView, { style: styles.background },
80
+ React.createElement(View, { style: styles.container },
81
+ React.createElement(Text, { style: styles.welcomeText }, "Welcome to Sentry Playground!"),
82
+ React.createElement(Animated.View, { style: {
83
+ width: '100%',
84
+ alignItems: 'center',
85
+ justifyContent: 'center',
86
+ transform: [{ translateY: animationContainerYPosition }],
87
+ }, onTouchEnd: () => {
88
+ springAnimation.start();
89
+ } },
90
+ React.createElement(Pressable, { onPress: onAnimationPress },
91
+ React.createElement(Animation, { id: animation }))),
92
+ React.createElement(View, { style: styles.listContainer },
93
+ React.createElement(Row, { title: 'captureException()', description: 'In a try-catch scenario, errors can be reported using manual APIs.', actionDescription: 'Try', action: tryCatchExample }),
94
+ React.createElement(Row, { title: 'throw new Error()', description: 'Uncaught errors are automatically reported by the React Native Global Handler.', actionDescription: 'Throw', action: () => changeAnimationToBug(uncaughtErrorExample) }),
95
+ React.createElement(Row, { title: 'throw RuntimeException()', description: isNativeCrashDisabled
96
+ ? 'For testing native crashes, build the mobile application in release mode.'
97
+ : 'Unhandled errors in native layers such as Java, Objective-C, C, Swift, or Kotlin are automatically reported.', actionDescription: 'Crash', action: nativeCrashExample, last: true, disabled: isNativeCrashDisabled })),
98
+ React.createElement(View, { style: { marginTop: 40 } }),
99
+ React.createElement(View, { style: {
100
+ width: '100%',
101
+ flexDirection: 'row',
102
+ justifyContent: 'space-evenly', // Space between buttons
103
+ } },
104
+ showOpenSentryButton && (React.createElement(Button, { secondary: true, title: 'Open Sentry', onPress: () => {
105
+ openURLInBrowser(issuesStreamUrl);
106
+ } })),
107
+ React.createElement(Button, { title: 'Go to my App', onPress: () => {
108
+ setShow(false);
109
+ } }))))));
110
+ };
111
+ const Animation = ({ id }) => {
112
+ const shouldFallbackToImage = Platform.OS === 'android';
113
+ switch (id) {
114
+ case 'hi':
115
+ return (React.createElement(Image, { source: { uri: shouldFallbackToImage ? hiImage : hiAnimation }, style: { width: 100, height: 100 } }));
116
+ case 'bug':
117
+ return (React.createElement(Image, { source: { uri: shouldFallbackToImage ? bugImage : bugAnimation }, style: { width: 100, height: 100 } }));
118
+ case 'thumbsup':
119
+ return (React.createElement(Image, { source: { uri: shouldFallbackToImage ? thumbsupImage : thumbsupAnimation }, style: { width: 100, height: 100 } }));
120
+ default:
121
+ return null;
122
+ }
123
+ };
124
+ const Row = ({ last = false,
125
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
126
+ action = () => { }, actionDescription = '', title, description, disabled = false, }) => {
127
+ const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;
128
+ return (React.createElement(View, { style: [styles.rowContainer, last && styles.lastRowContainer] },
129
+ React.createElement(View, { style: { flexShrink: 1, paddingRight: 12 } },
130
+ React.createElement(Text, { style: styles.rowTitle }, title),
131
+ React.createElement(Text, { style: { color: 'rgb(146, 130, 170)', fontSize: 12 } }, description)),
132
+ React.createElement(View, null,
133
+ React.createElement(Button, { disabled: disabled, secondary: true, onPress: action, title: actionDescription }))));
134
+ };
135
+ const Button = ({ onPress, title, secondary, disabled = false, }) => {
136
+ const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;
137
+ return (React.createElement(View, { style: [styles.buttonBottomLayer, styles.buttonCommon, secondary && styles.buttonSecondaryBottomLayer] },
138
+ React.createElement(Pressable, { style: ({ pressed }) => [
139
+ styles.buttonMainContainer,
140
+ pressed && styles.buttonMainContainerPressed,
141
+ styles.buttonCommon,
142
+ secondary && styles.buttonSecondaryContainer,
143
+ disabled && styles.buttonDisabledContainer,
144
+ ], onPress: onPress, disabled: disabled },
145
+ React.createElement(Text, { style: [styles.buttonText, secondary && styles.buttonSecondaryText, disabled && styles.buttonDisabledText] }, title))));
146
+ };
147
+ const defaultDarkStyles = StyleSheet.create({
148
+ welcomeText: { color: 'rgb(246, 245, 250)', fontSize: 24, fontWeight: 'bold' },
149
+ background: {
150
+ flex: 1,
151
+ backgroundColor: 'rgb(26, 20, 31)',
152
+ width: '100%',
153
+ minHeight: '100%',
154
+ alignItems: 'center',
155
+ justifyContent: 'center', // Center content vertically
156
+ },
157
+ container: {
158
+ flex: 1,
159
+ flexDirection: 'column',
160
+ padding: 12,
161
+ marginTop: 20,
162
+ width: '100%',
163
+ alignItems: 'center',
164
+ justifyContent: 'space-evenly', // Center image and button container
165
+ },
166
+ buttonContainer: {
167
+ flexDirection: 'row',
168
+ marginTop: 20, // Add some space above the buttons
169
+ },
170
+ listContainer: {
171
+ backgroundColor: 'rgb(39, 36, 51)',
172
+ width: '100%',
173
+ flexDirection: 'column',
174
+ marginTop: 20,
175
+ borderColor: 'rgb(7, 5, 15)',
176
+ borderWidth: 1,
177
+ borderRadius: 8,
178
+ },
179
+ rowTitle: {
180
+ color: 'rgb(246, 245, 250)',
181
+ fontSize: 14,
182
+ fontWeight: 'bold',
183
+ textAlign: 'left',
184
+ fontFamily: 'Menlo',
185
+ },
186
+ rowContainer: {
187
+ overflow: 'hidden',
188
+ flexDirection: 'row',
189
+ justifyContent: 'space-between',
190
+ paddingTop: 16,
191
+ paddingBottom: 10,
192
+ paddingHorizontal: 10,
193
+ borderColor: 'rgb(7, 5, 15)',
194
+ borderBottomWidth: 1,
195
+ },
196
+ lastRowContainer: {
197
+ borderBottomWidth: 0, // Remove border for the last row
198
+ },
199
+ buttonCommon: {
200
+ borderRadius: 8,
201
+ },
202
+ buttonBottomLayer: {
203
+ backgroundColor: 'rgb(7, 5, 15)',
204
+ },
205
+ buttonMainContainer: {
206
+ paddingVertical: 8,
207
+ paddingHorizontal: 13,
208
+ backgroundColor: 'rgb(117, 83, 255)',
209
+ transform: [{ translateY: -4 }],
210
+ borderWidth: 1,
211
+ borderColor: 'rgb(7, 5, 15)',
212
+ },
213
+ buttonSecondaryContainer: {
214
+ backgroundColor: 'rgb(39, 36, 51)',
215
+ },
216
+ buttonSecondaryBottomLayer: {},
217
+ buttonSecondaryText: {},
218
+ buttonMainContainerPressed: {
219
+ transform: [{ translateY: 0 }],
220
+ },
221
+ buttonText: {
222
+ color: 'rgb(246, 245, 250)',
223
+ fontSize: 16,
224
+ fontWeight: 'bold',
225
+ textAlign: 'center',
226
+ },
227
+ buttonDisabledText: {
228
+ color: 'rgb(146, 130, 170)',
229
+ },
230
+ buttonDisabledContainer: {
231
+ transform: [{ translateY: -2 }],
232
+ backgroundColor: 'rgb(39, 36, 51)',
233
+ },
234
+ });
235
+ const lightStyles = StyleSheet.create(Object.assign(Object.assign({}, defaultDarkStyles), { welcomeText: Object.assign(Object.assign({}, defaultDarkStyles.welcomeText), { color: 'rgb(24, 20, 35)' }), background: Object.assign(Object.assign({}, defaultDarkStyles.background), { backgroundColor: 'rgb(251, 250, 255)' }), buttonMainContainer: Object.assign(Object.assign({}, defaultDarkStyles.buttonMainContainer), { backgroundColor: 'rgb(117, 83, 255)', borderColor: 'rgb(85, 61, 184)' }), buttonBottomLayer: {
236
+ backgroundColor: 'rgb(85, 61, 184)',
237
+ }, buttonSecondaryContainer: {
238
+ backgroundColor: 'rgb(255, 255, 255)',
239
+ borderColor: 'rgb(218, 215, 229)',
240
+ }, buttonSecondaryBottomLayer: {
241
+ backgroundColor: 'rgb(218, 215, 229)',
242
+ }, buttonText: Object.assign({}, defaultDarkStyles.buttonText), buttonSecondaryText: Object.assign(Object.assign({}, defaultDarkStyles.buttonText), { color: 'rgb(24, 20, 35)' }), rowTitle: Object.assign(Object.assign({}, defaultDarkStyles.rowTitle), { color: 'rgb(24, 20, 35)' }), rowContainer: Object.assign(Object.assign({}, defaultDarkStyles.rowContainer), { borderColor: 'rgb(218, 215, 229)' }), listContainer: Object.assign(Object.assign({}, defaultDarkStyles.listContainer), { borderColor: 'rgb(218, 215, 229)', backgroundColor: 'rgb(255, 255, 255)' }), buttonDisabledContainer: Object.assign(Object.assign({}, defaultDarkStyles.buttonDisabledContainer), { backgroundColor: 'rgb(238, 235, 249)' }) }));
243
+ function openURLInBrowser(url) {
244
+ const devServer = getDevServer();
245
+ if (devServer === null || devServer === void 0 ? void 0 : devServer.url) {
246
+ // This doesn't work for Expo project with Web enabled
247
+ // disable-next-line @typescript-eslint/no-floating-promises
248
+ fetch(`${devServer.url}open-url`, {
249
+ method: 'POST',
250
+ body: JSON.stringify({ url }),
251
+ }).catch(e => {
252
+ logger.error('Error opening URL:', e);
253
+ });
254
+ }
255
+ else {
256
+ logger.error('Dev server URL not available');
257
+ }
258
+ }
259
+ //# sourceMappingURL=modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../src/js/playground/modal.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,cAAc,EACd,IAAI,GACL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,GAAG,IAAI,YAAY,EAAE,EAAE,IAAI,WAAW,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,kBA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AC,GAAG,UAAU,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;SAC9B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACX,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;KAC9C;AACH,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport { logger } from '@sentry/core';\nimport * as React from 'react';\nimport {\n Animated,\n Image,\n Modal,\n Platform,\n Pressable,\n SafeAreaView,\n StyleSheet,\n Text,\n useColorScheme,\n View,\n} from 'react-native';\nimport { getDevServer } from '../integrations/debugsymbolicatorutils';\nimport { isExpo, isExpoGo, isWeb } from '../utils/environment';\nimport { bug as bugAnimation, hi as hiAnimation, thumbsup as thumbsupAnimation } from './animations';\nimport { nativeCrashExample, tryCatchExample, uncaughtErrorExample } from './examples';\nimport { bug as bugImage, hi as hiImage, thumbsup as thumbsupImage } from './images';\n\n/**\n * Wrapper to add Sentry Playground to your application\n * to test your Sentry React Native SDK setup.\n *\n * @example\n * ```tsx\n * import * as Sentry from '@sentry/react-native';\n * import { withSentryPlayground } from '@sentry/react-native/playground';\n *\n * function App() {\n * return <View>...</View>;\n * }\n *\n * export default withSentryPlayground(Sentry.wrap(App), {\n * projectId: '123456',\n * organizationSlug: 'my-org'\n * });\n * ```\n */\nexport const withSentryPlayground = <P extends object>(\n Component: React.ComponentType<P>,\n options: { projectId?: string; organizationSlug?: string } = {},\n): React.ComponentType<P> => {\n const Wrapper = (props: P): React.ReactElement => {\n return (\n <>\n <SentryPlayground projectId={options.projectId} organizationSlug={options.organizationSlug} />\n <Component {...props} />\n </>\n );\n };\n\n Wrapper.displayName = 'withSentryPlayground()';\n return Wrapper;\n};\n\nexport const SentryPlayground = ({\n projectId,\n organizationSlug,\n}: {\n projectId?: string;\n organizationSlug?: string;\n}): React.ReactElement => {\n const issuesStreamUrl =\n projectId && organizationSlug\n ? `https://${organizationSlug}.sentry.io/issues/?project=${projectId}&statsPeriod=1h`\n : 'https://sentry.io/';\n const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;\n\n const [show, setShow] = React.useState(true);\n const [animation, setAnimation] = React.useState('hi');\n\n const onAnimationPress = (): void => {\n switch (animation) {\n case 'hi':\n setAnimation('thumbsup');\n break;\n default:\n setAnimation('hi');\n }\n };\n\n const showOpenSentryButton = !isExpo();\n const isNativeCrashDisabled = isWeb() || isExpoGo() || __DEV__;\n\n const animationContainerYPosition = React.useRef(new Animated.Value(0)).current;\n\n const springAnimation = Animated.sequence([\n Animated.timing(animationContainerYPosition, {\n toValue: -50,\n duration: 300,\n useNativeDriver: true,\n }),\n Animated.spring(animationContainerYPosition, {\n toValue: 0,\n friction: 4,\n tension: 40,\n useNativeDriver: true,\n }),\n ]);\n\n const changeAnimationToBug = (func: () => void): void => {\n setAnimation('bug');\n springAnimation.start(() => {\n func();\n });\n };\n\n return (\n <Modal\n presentationStyle=\"formSheet\"\n visible={show}\n animationType=\"slide\"\n onRequestClose={() => {\n setShow(false);\n }}\n >\n <SafeAreaView style={styles.background}>\n <View style={styles.container}>\n <Text style={styles.welcomeText}>Welcome to Sentry Playground!</Text>\n <Animated.View\n style={{\n width: '100%',\n alignItems: 'center',\n justifyContent: 'center',\n transform: [{ translateY: animationContainerYPosition }],\n }}\n onTouchEnd={() => {\n springAnimation.start();\n }}\n >\n <Pressable onPress={onAnimationPress}>\n <Animation id={animation} />\n </Pressable>\n </Animated.View>\n <View style={styles.listContainer}>\n <Row\n title={'captureException()'}\n description={'In a try-catch scenario, errors can be reported using manual APIs.'}\n actionDescription={'Try'}\n action={tryCatchExample}\n />\n <Row\n title={'throw new Error()'}\n description={'Uncaught errors are automatically reported by the React Native Global Handler.'}\n actionDescription={'Throw'}\n action={() => changeAnimationToBug(uncaughtErrorExample)}\n />\n <Row\n title={'throw RuntimeException()'}\n description={\n isNativeCrashDisabled\n ? 'For testing native crashes, build the mobile application in release mode.'\n : 'Unhandled errors in native layers such as Java, Objective-C, C, Swift, or Kotlin are automatically reported.'\n }\n actionDescription={'Crash'}\n action={nativeCrashExample}\n last\n disabled={isNativeCrashDisabled}\n />\n </View>\n <View style={{ marginTop: 40 }} />\n <View\n style={{\n width: '100%',\n flexDirection: 'row', // Arrange buttons horizontally\n justifyContent: 'space-evenly', // Space between buttons\n }}\n >\n {showOpenSentryButton && (\n <Button\n secondary\n title={'Open Sentry'}\n onPress={() => {\n openURLInBrowser(issuesStreamUrl);\n }}\n />\n )}\n <Button\n title={'Go to my App'}\n onPress={() => {\n setShow(false);\n }}\n />\n </View>\n </View>\n </SafeAreaView>\n </Modal>\n );\n};\n\nconst Animation = ({ id }: { id: string }): React.ReactElement | null => {\n const shouldFallbackToImage = Platform.OS === 'android';\n\n switch (id) {\n case 'hi':\n return (\n <Image source={{ uri: shouldFallbackToImage ? hiImage : hiAnimation }} style={{ width: 100, height: 100 }} />\n );\n case 'bug':\n return (\n <Image source={{ uri: shouldFallbackToImage ? bugImage : bugAnimation }} style={{ width: 100, height: 100 }} />\n );\n case 'thumbsup':\n return (\n <Image\n source={{ uri: shouldFallbackToImage ? thumbsupImage : thumbsupAnimation }}\n style={{ width: 100, height: 100 }}\n />\n );\n default:\n return null;\n }\n};\n\nconst Row = ({\n last = false,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n action = () => {},\n actionDescription = '',\n title,\n description,\n disabled = false,\n}: {\n last?: boolean;\n action?: () => void;\n actionDescription?: string;\n title: string;\n description: string;\n disabled?: boolean;\n}): React.ReactElement => {\n const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;\n\n return (\n <View style={[styles.rowContainer, last && styles.lastRowContainer]}>\n <View style={{ flexShrink: 1, paddingRight: 12 }}>\n <Text style={styles.rowTitle}>{title}</Text>\n <Text style={{ color: 'rgb(146, 130, 170)', fontSize: 12 }}>{description}</Text>\n </View>\n <View>\n <Button disabled={disabled} secondary onPress={action} title={actionDescription} />\n </View>\n </View>\n );\n};\n\nconst Button = ({\n onPress,\n title,\n secondary,\n disabled = false,\n}: {\n onPress: () => void;\n title: string;\n secondary?: boolean;\n disabled?: boolean;\n}): React.ReactElement => {\n const styles = useColorScheme() === 'dark' ? defaultDarkStyles : lightStyles;\n\n return (\n <View style={[styles.buttonBottomLayer, styles.buttonCommon, secondary && styles.buttonSecondaryBottomLayer]}>\n <Pressable\n style={({ pressed }) => [\n styles.buttonMainContainer,\n pressed && styles.buttonMainContainerPressed,\n styles.buttonCommon,\n secondary && styles.buttonSecondaryContainer,\n disabled && styles.buttonDisabledContainer,\n ]}\n onPress={onPress}\n disabled={disabled}\n >\n <Text\n style={[styles.buttonText, secondary && styles.buttonSecondaryText, disabled && styles.buttonDisabledText]}\n >\n {title}\n </Text>\n </Pressable>\n </View>\n );\n};\n\nconst defaultDarkStyles = StyleSheet.create({\n welcomeText: { color: 'rgb(246, 245, 250)', fontSize: 24, fontWeight: 'bold' },\n background: {\n flex: 1,\n backgroundColor: 'rgb(26, 20, 31)',\n width: '100%',\n minHeight: '100%',\n alignItems: 'center', // Center content horizontally\n justifyContent: 'center', // Center content vertically\n },\n container: {\n flex: 1,\n flexDirection: 'column',\n padding: 12,\n marginTop: 20,\n width: '100%',\n alignItems: 'center', // Center image and button container\n justifyContent: 'space-evenly', // Center image and button container\n },\n buttonContainer: {\n flexDirection: 'row', // Arrange buttons horizontally\n marginTop: 20, // Add some space above the buttons\n },\n listContainer: {\n backgroundColor: 'rgb(39, 36, 51)',\n width: '100%',\n flexDirection: 'column',\n marginTop: 20, // Add some space above the buttons\n borderColor: 'rgb(7, 5, 15)',\n borderWidth: 1,\n borderRadius: 8,\n },\n rowTitle: {\n color: 'rgb(246, 245, 250)',\n fontSize: 14,\n fontWeight: 'bold',\n textAlign: 'left',\n fontFamily: 'Menlo',\n },\n rowContainer: {\n overflow: 'hidden',\n flexDirection: 'row',\n justifyContent: 'space-between', // Space between buttons\n paddingTop: 16,\n paddingBottom: 10,\n paddingHorizontal: 10,\n borderColor: 'rgb(7, 5, 15)',\n borderBottomWidth: 1,\n },\n lastRowContainer: {\n borderBottomWidth: 0, // Remove border for the last row\n },\n buttonCommon: {\n borderRadius: 8,\n },\n buttonBottomLayer: {\n backgroundColor: 'rgb(7, 5, 15)',\n },\n buttonMainContainer: {\n paddingVertical: 8,\n paddingHorizontal: 13,\n backgroundColor: 'rgb(117, 83, 255)',\n transform: [{ translateY: -4 }],\n borderWidth: 1,\n borderColor: 'rgb(7, 5, 15)',\n },\n buttonSecondaryContainer: {\n backgroundColor: 'rgb(39, 36, 51)',\n },\n buttonSecondaryBottomLayer: {},\n buttonSecondaryText: {},\n buttonMainContainerPressed: {\n transform: [{ translateY: 0 }],\n },\n buttonText: {\n color: 'rgb(246, 245, 250)',\n fontSize: 16,\n fontWeight: 'bold',\n textAlign: 'center',\n },\n buttonDisabledText: {\n color: 'rgb(146, 130, 170)',\n },\n buttonDisabledContainer: {\n transform: [{ translateY: -2 }],\n backgroundColor: 'rgb(39, 36, 51)',\n },\n});\n\nconst lightStyles: typeof defaultDarkStyles = StyleSheet.create({\n ...defaultDarkStyles,\n welcomeText: {\n ...defaultDarkStyles.welcomeText,\n color: 'rgb(24, 20, 35)',\n },\n background: {\n ...defaultDarkStyles.background,\n backgroundColor: 'rgb(251, 250, 255)',\n },\n buttonMainContainer: {\n ...defaultDarkStyles.buttonMainContainer,\n backgroundColor: 'rgb(117, 83, 255)',\n borderColor: 'rgb(85, 61, 184)',\n },\n buttonBottomLayer: {\n backgroundColor: 'rgb(85, 61, 184)',\n },\n buttonSecondaryContainer: {\n backgroundColor: 'rgb(255, 255, 255)',\n borderColor: 'rgb(218, 215, 229)',\n },\n buttonSecondaryBottomLayer: {\n backgroundColor: 'rgb(218, 215, 229)',\n },\n buttonText: {\n ...defaultDarkStyles.buttonText,\n },\n buttonSecondaryText: {\n ...defaultDarkStyles.buttonText,\n color: 'rgb(24, 20, 35)',\n },\n rowTitle: {\n ...defaultDarkStyles.rowTitle,\n color: 'rgb(24, 20, 35)',\n },\n rowContainer: {\n ...defaultDarkStyles.rowContainer,\n borderColor: 'rgb(218, 215, 229)',\n },\n listContainer: {\n ...defaultDarkStyles.listContainer,\n borderColor: 'rgb(218, 215, 229)',\n backgroundColor: 'rgb(255, 255, 255)',\n },\n buttonDisabledContainer: {\n ...defaultDarkStyles.buttonDisabledContainer,\n backgroundColor: 'rgb(238, 235, 249)',\n },\n});\n\nfunction openURLInBrowser(url: string): void {\n const devServer = getDevServer();\n if (devServer?.url) {\n // This doesn't work for Expo project with Web enabled\n // disable-next-line @typescript-eslint/no-floating-promises\n fetch(`${devServer.url}open-url`, {\n method: 'POST',\n body: JSON.stringify({ url }),\n }).catch(e => {\n logger.error('Error opening URL:', e);\n });\n } else {\n logger.error('Dev server URL not available');\n }\n}\n"]}
@@ -21,13 +21,13 @@ export function enableSyncToNative(scope) {
21
21
  return original.call(scope, user);
22
22
  });
23
23
  fillTyped(scope, 'setTag', original => (key, value) => {
24
- NATIVE.setTag(key, value);
24
+ NATIVE.setTag(key, NATIVE.primitiveProcessor(value));
25
25
  return original.call(scope, key, value);
26
26
  });
27
27
  fillTyped(scope, 'setTags', original => (tags) => {
28
28
  // As native only has setTag, we just loop through each tag key.
29
29
  Object.keys(tags).forEach(key => {
30
- NATIVE.setTag(key, tags[key]);
30
+ NATIVE.setTag(key, NATIVE.primitiveProcessor(tags[key]));
31
31
  });
32
32
  return original.call(scope, tags);
33
33
  });
@@ -1 +1 @@
1
- {"version":3,"file":"scopeSync.js","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,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AK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,kBAAkB,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAU,EAAE;QAC3D,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,8DAA8D;IAC9D,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAW,EAAE,OAAsC,EAAS,EAAE;QACxG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Breadcrumb, Scope } from '@sentry/core';\nimport { logger } from '@sentry/react';\nimport { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';\nimport { fillTyped } from './utils/fill';\nimport { convertToNormalizedObject } from './utils/normalize';\nimport { NATIVE } from './wrapper';\n\n/**\n * This WeakMap is used to keep track of which scopes have been synced to the native SDKs.\n * This ensures that we don't double sync the same scope.\n */\nconst syncedToNativeMap = new WeakMap<Scope, true>();\n\n/**\n * Hooks into the scope set methods and sync new data added to the given scope with the native SDKs.\n */\nexport function enableSyncToNative(scope: Scope): void {\n if (syncedToNativeMap.has(scope)) {\n return;\n }\n syncedToNativeMap.set(scope, true);\n\n fillTyped(scope, 'setUser', original => (user): Scope => {\n NATIVE.setUser(user);\n return original.call(scope, user);\n });\n\n fillTyped(scope, 'setTag', original => (key, value): Scope => {\n NATIVE.setTag(key, value as string);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setTags', original => (tags): Scope => {\n // As native only has setTag, we just loop through each tag key.\n Object.keys(tags).forEach(key => {\n NATIVE.setTag(key, tags[key] as string);\n });\n return original.call(scope, tags);\n });\n\n fillTyped(scope, 'setExtras', original => (extras): Scope => {\n Object.keys(extras).forEach(key => {\n NATIVE.setExtra(key, extras[key]);\n });\n return original.call(scope, extras);\n });\n\n fillTyped(scope, 'setExtra', original => (key, value): Scope => {\n NATIVE.setExtra(key, value);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'addBreadcrumb', original => (breadcrumb, maxBreadcrumbs): Scope => {\n const mergedBreadcrumb: Breadcrumb = {\n ...breadcrumb,\n level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL,\n data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined,\n };\n\n original.call(scope, mergedBreadcrumb, maxBreadcrumbs);\n\n const finalBreadcrumb = scope.getLastBreadcrumb();\n if (finalBreadcrumb) {\n NATIVE.addBreadcrumb(finalBreadcrumb);\n } else {\n logger.warn('[ScopeSync] Last created breadcrumb is undefined. Skipping sync to native.');\n }\n\n return scope;\n });\n\n fillTyped(scope, 'clearBreadcrumbs', original => (): Scope => {\n NATIVE.clearBreadcrumbs();\n return original.call(scope);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fillTyped(scope, 'setContext', original => (key: string, context: { [key: string]: any } | null): Scope => {\n NATIVE.setContext(key, context);\n return original.call(scope, key, context);\n });\n}\n"]}
1
+ {"version":3,"file":"scopeSync.js","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;GAGG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAe,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAY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B,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,8DAA8D;IAC9D,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAW,EAAE,OAAsC,EAAS,EAAE;QACxG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Breadcrumb, Scope } from '@sentry/core';\nimport { logger } from '@sentry/react';\nimport { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';\nimport { fillTyped } from './utils/fill';\nimport { convertToNormalizedObject } from './utils/normalize';\nimport { NATIVE } from './wrapper';\n\n/**\n * This WeakMap is used to keep track of which scopes have been synced to the native SDKs.\n * This ensures that we don't double sync the same scope.\n */\nconst syncedToNativeMap = new WeakMap<Scope, true>();\n\n/**\n * Hooks into the scope set methods and sync new data added to the given scope with the native SDKs.\n */\nexport function enableSyncToNative(scope: Scope): void {\n if (syncedToNativeMap.has(scope)) {\n return;\n }\n syncedToNativeMap.set(scope, true);\n\n fillTyped(scope, 'setUser', original => (user): Scope => {\n NATIVE.setUser(user);\n return original.call(scope, user);\n });\n\n fillTyped(scope, 'setTag', original => (key, value): Scope => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(value));\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setTags', original => (tags): Scope => {\n // As native only has setTag, we just loop through each tag key.\n Object.keys(tags).forEach(key => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(tags[key]));\n });\n return original.call(scope, tags);\n });\n\n fillTyped(scope, 'setExtras', original => (extras): Scope => {\n Object.keys(extras).forEach(key => {\n NATIVE.setExtra(key, extras[key]);\n });\n return original.call(scope, extras);\n });\n\n fillTyped(scope, 'setExtra', original => (key, value): Scope => {\n NATIVE.setExtra(key, value);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'addBreadcrumb', original => (breadcrumb, maxBreadcrumbs): Scope => {\n const mergedBreadcrumb: Breadcrumb = {\n ...breadcrumb,\n level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL,\n data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined,\n };\n\n original.call(scope, mergedBreadcrumb, maxBreadcrumbs);\n\n const finalBreadcrumb = scope.getLastBreadcrumb();\n if (finalBreadcrumb) {\n NATIVE.addBreadcrumb(finalBreadcrumb);\n } else {\n logger.warn('[ScopeSync] Last created breadcrumb is undefined. Skipping sync to native.');\n }\n\n return scope;\n });\n\n fillTyped(scope, 'clearBreadcrumbs', original => (): Scope => {\n NATIVE.clearBreadcrumbs();\n return original.call(scope);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fillTyped(scope, 'setContext', original => (key: string, context: { [key: string]: any } | null): Scope => {\n NATIVE.setContext(key, context);\n return original.call(scope, key, context);\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA2C,KAAK,EAAE,MAAM,cAAc,CAAC;AAgBnF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAA4B,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AA6BzG;;GAEG;AACH,wBAAgB,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAuG5D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACrC,OAAO,CAAC,EAAE,yBAAyB,GAClC,KAAK,CAAC,aAAa,CAAC,C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QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAUzE;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAE9D"}
package/dist/js/sdk.js CHANGED
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { getClient, getGlobalScope, getIntegrationsToSetup, getIsolationScope, initAndBind, logger, makeDsn, stackParserFromStackParserOptions, withScope as coreWithScope, } from '@sentry/core';
11
- import { defaultStackParser, makeFetchTransport, } from '@sentry/react';
11
+ import { defaultStackParser, makeFetchTransport, Profiler } from '@sentry/react';
12
12
  import * as React from 'react';
13
13
  import { ReactNativeClient } from './client';
14
14
  import { FeedbackWidgetProvider } from './feedback/FeedbackWidgetProvider';
@@ -20,7 +20,8 @@ import { TouchEventBoundary } from './touchevents';
20
20
  import { ReactNativeProfiler } from './tracing';
21
21
  import { useEncodePolyfill } from './transports/encodePolyfill';
22
22
  import { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';
23
- import { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer } from './utils/environment';
23
+ import { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer, isWeb } from './utils/environment';
24
+ import { getDefaultRelease } from './utils/release';
24
25
  import { safeFactory, safeTracesSampler } from './utils/safe';
25
26
  import { NATIVE } from './wrapper';
26
27
  const DEFAULT_OPTIONS = {
@@ -44,7 +45,7 @@ const DEFAULT_OPTIONS = {
44
45
  * Inits the SDK and returns the final options.
45
46
  */
46
47
  export function init(passedOptions) {
47
- var _a, _b, _c, _d, _e;
48
+ var _a, _b, _c, _d, _e, _f;
48
49
  if (isRunningInMetroDevServer()) {
49
50
  return;
50
51
  }
@@ -93,13 +94,13 @@ export function init(passedOptions) {
93
94
  }
94
95
  return defaultBeforeBreadcrumb(modifiedBreadcrumb, hint);
95
96
  };
96
- const options = Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS), passedOptions), { enableNative, enableNativeNagger: shouldEnableNativeNagger(passedOptions.enableNativeNagger),
97
+ const options = Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS), passedOptions), { release: (_e = passedOptions.release) !== null && _e !== void 0 ? _e : getDefaultRelease(), enableNative, enableNativeNagger: shouldEnableNativeNagger(passedOptions.enableNativeNagger),
97
98
  // If custom transport factory fails the SDK won't initialize
98
99
  transport: passedOptions.transport
99
100
  || makeNativeTransportFactory({
100
101
  enableNative,
101
102
  })
102
- || makeFetchTransport, transportOptions: Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS.transportOptions), ((_e = passedOptions.transportOptions) !== null && _e !== void 0 ? _e : {})), { bufferSize: maxQueueSize }), maxQueueSize, integrations: [], stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser), beforeBreadcrumb: chainedBeforeBreadcrumb, initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }) });
103
+ || makeFetchTransport, transportOptions: Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS.transportOptions), ((_f = passedOptions.transportOptions) !== null && _f !== void 0 ? _f : {})), { bufferSize: maxQueueSize }), maxQueueSize, integrations: [], stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser), beforeBreadcrumb: chainedBeforeBreadcrumb, initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }) });
103
104
  if ('tracesSampler' in options) {
104
105
  options.tracesSampler = safeTracesSampler(options.tracesSampler);
105
106
  }
@@ -125,10 +126,11 @@ export function init(passedOptions) {
125
126
  export function wrap(RootComponent, options) {
126
127
  var _a;
127
128
  const profilerProps = Object.assign(Object.assign({}, (options === null || options === void 0 ? void 0 : options.profilerProps)), { name: (_a = RootComponent.displayName) !== null && _a !== void 0 ? _a : 'Root', updateProps: {} });
128
- const RootApp = (appProps) => {
129
+ const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler;
130
+ const RootApp = appProps => {
129
131
  var _a;
130
132
  return (React.createElement(TouchEventBoundary, Object.assign({}, ((_a = options === null || options === void 0 ? void 0 : options.touchEventBoundaryProps) !== null && _a !== void 0 ? _a : {})),
131
- React.createElement(ReactNativeProfiler, Object.assign({}, profilerProps),
133
+ React.createElement(ProfilerComponent, Object.assign({}, profilerProps),
132
134
  React.createElement(FeedbackWidgetProvider, null,
133
135
  React.createElement(RootComponent, Object.assign({}, appProps))))));
134
136
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,SAAS,EACT,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,MAAM,EACN,OAAO,EACP,iCAAiC,EACjC,SAAS,IAAI,aAAa,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACtF,OA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GAAG,SAAS,EAAE,CAAC;YAE3B,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;gBAEpC,OAAO,MAAM,CAAC;aACf;YACD,oCAAoC;SACrC;QAAC,OAAO,CAAC,EAAE,GAAG;QAEf,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAEjD,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,KAAK;;QACzB,IAAI;YACF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAE3B,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;aACtB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;SACzC;IACH,CAAC;CAAA;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAI,QAA6B;IACxD,MAAM,YAAY,GAAG,CAAC,KAAY,EAAiB,EAAE;QACnD,IAAI;YACF,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;YAC1D,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,CAAC;IACF,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAgB,cAAc;;QAClC,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;CAAA","sourcesContent":["/* eslint-disable complexity */\nimport type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core';\nimport {\n getClient,\n getGlobalScope,\n getIntegrationsToSetup,\n getIsolationScope,\n initAndBind,\n logger,\n makeDsn,\n stackParserFromStackParserOptions,\n withScope as coreWithScope,\n} from '@sentry/core';\nimport {\n defaultStackParser,\n makeFetchTransport,\n} from '@sentry/react';\nimport * as React from 'react';\nimport { ReactNativeClient } from './client';\nimport { FeedbackWidgetProvider } from './feedback/FeedbackWidgetProvider';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { getDefaultIntegrations } from './integrations/default';\nimport type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options';\nimport { shouldEnableNativeNagger } from './options';\nimport { enableSyncToNative } from './scopeSync';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler } from './tracing';\nimport { useEncodePolyfill } from './transports/encodePolyfill';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer } from './utils/environment';\nimport { safeFactory, safeTracesSampler } from './utils/safe';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_OPTIONS: ReactNativeOptions = {\n enableNativeCrashHandling: true,\n enableNativeNagger: true,\n autoInitializeNativeSdk: true,\n enableAutoPerformanceTracing: true,\n enableWatchdogTerminationTracking: true,\n patchGlobalPromise: true,\n sendClientReports: true,\n maxQueueSize: DEFAULT_BUFFER_SIZE,\n attachStacktrace: true,\n enableCaptureFailedRequests: false,\n enableNdk: true,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n if (isRunningInMetroDevServer()) {\n return;\n }\n\n const maxQueueSize = passedOptions.maxQueueSize\n // eslint-disable-next-line deprecation/deprecation\n ?? passedOptions.transportOptions?.bufferSize\n ?? DEFAULT_OPTIONS.maxQueueSize;\n\n const enableNative = passedOptions.enableNative === undefined || passedOptions.enableNative\n ? NATIVE.isNativeAvailable()\n : false;\n\n useEncodePolyfill();\n if (enableNative) {\n enableSyncToNative(getGlobalScope());\n enableSyncToNative(getIsolationScope());\n }\n\n const getURLFromDSN = (dsn: string | undefined): string | undefined => {\n if (!dsn) {\n return undefined;\n }\n const dsnComponents = makeDsn(dsn);\n if (!dsnComponents) {\n logger.error('Failed to extract url from DSN: ', dsn);\n return undefined;\n }\n const port = dsnComponents.port ? `:${dsnComponents.port}` : '';\n return `${dsnComponents.protocol}://${dsnComponents.host}${port}`;\n };\n\n const userBeforeBreadcrumb = safeFactory(passedOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' });\n\n // Exclude Dev Server and Sentry Dsn request from Breadcrumbs\n const devServerUrl = getDevServer()?.url;\n const dsn = getURLFromDSN(passedOptions.dsn);\n const defaultBeforeBreadcrumb = (breadcrumb: Breadcrumb, _hint?: BreadcrumbHint): Breadcrumb | null => {\n const type = breadcrumb.type || '';\n const url = typeof breadcrumb.data?.url === 'string' ? breadcrumb.data.url : '';\n if (type === 'http' && ((devServerUrl && url.startsWith(devServerUrl)) || (dsn && url.startsWith(dsn)))) {\n return null;\n }\n return breadcrumb;\n };\n\n const chainedBeforeBreadcrumb = (breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null => {\n let modifiedBreadcrumb = breadcrumb;\n if (userBeforeBreadcrumb) {\n const result = userBeforeBreadcrumb(breadcrumb, hint);\n if (result === null) {\n return null;\n }\n modifiedBreadcrumb = result;\n }\n return defaultBeforeBreadcrumb(modifiedBreadcrumb, hint);\n };\n\n const options: ReactNativeClientOptions = {\n ...DEFAULT_OPTIONS,\n ...passedOptions,\n enableNative,\n enableNativeNagger: shouldEnableNativeNagger(passedOptions.enableNativeNagger),\n // If custom transport factory fails the SDK won't initialize\n transport: passedOptions.transport\n || makeNativeTransportFactory({\n enableNative,\n })\n || makeFetchTransport,\n transportOptions: {\n ...DEFAULT_OPTIONS.transportOptions,\n ...(passedOptions.transportOptions ?? {}),\n bufferSize: maxQueueSize,\n },\n maxQueueSize,\n integrations: [],\n stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser),\n beforeBreadcrumb: chainedBeforeBreadcrumb,\n initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }),\n };\n if ('tracesSampler' in options) {\n options.tracesSampler = safeTracesSampler(options.tracesSampler);\n }\n\n if (!('environment' in options)) {\n options.environment = getDefaultEnvironment();\n }\n\n const defaultIntegrations: false | Integration[] = passedOptions.defaultIntegrations === undefined\n ? getDefaultIntegrations(options)\n : passedOptions.defaultIntegrations;\n\n options.integrations = getIntegrationsToSetup({\n integrations: safeFactory(passedOptions.integrations, { loggerMessage: 'The integrations threw an error' }),\n defaultIntegrations,\n });\n initAndBind(ReactNativeClient, options);\n\n if (isExpoGo()) {\n logger.info('Offline caching, native errors features are not available in Expo Go.');\n logger.info('Use EAS Build / Native Release Build to test these features.');\n }\n}\n\n/**\n * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.\n */\nexport function wrap<P extends Record<string, unknown>>(\n RootComponent: React.ComponentType<P>,\n options?: ReactNativeWrapperOptions\n): React.ComponentType<P> {\n const profilerProps = {\n ...(options?.profilerProps),\n name: RootComponent.displayName ?? 'Root',\n updateProps: {}\n };\n\n const RootApp: React.FC<P> = (appProps) => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ReactNativeProfiler {...profilerProps}>\n <FeedbackWidgetProvider>\n <RootComponent {...appProps} />\n </FeedbackWidgetProvider>\n </ReactNativeProfiler>\n </TouchEventBoundary>\n );\n };\n\n return RootApp;\n}\n\n/**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\nexport function nativeCrash(): void {\n NATIVE.nativeCrash();\n}\n\n/**\n * Flushes all pending events in the queue to disk.\n * Use this before applying any realtime updates such as code-push or expo updates.\n */\nexport async function flush(): Promise<boolean> {\n try {\n const client = getClient();\n\n if (client) {\n const result = await client.flush();\n\n return result;\n }\n // eslint-disable-next-line no-empty\n } catch (_) { }\n\n logger.error('Failed to flush the event queue.');\n\n return false;\n}\n\n/**\n * Closes the SDK, stops sending events.\n */\nexport async function close(): Promise<void> {\n try {\n const client = getClient();\n\n if (client) {\n await client.close();\n }\n } catch (e) {\n logger.error('Failed to close the SDK');\n }\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nexport function withScope<T>(callback: (scope: Scope) => T): T | undefined {\n const safeCallback = (scope: Scope): T | undefined => {\n try {\n return callback(scope);\n } catch (e) {\n logger.error('Error while running withScope callback', e);\n return undefined;\n }\n };\n return coreWithScope(safeCallback);\n}\n\n/**\n * Returns if the app crashed in the last run.\n */\nexport async function crashedLastRun(): Promise<boolean | null> {\n return NATIVE.crashedLastRun();\n}\n"]}
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,SAAS,EACT,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,WAAW,EACX,MAAM,EACN,OAAO,EACP,iCAAiC,EACjC,SAAS,IAAI,aAAa,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WA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YAAY,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAgB,cAAc;;QAClC,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;CAAA","sourcesContent":["/* eslint-disable complexity */\nimport type { Breadcrumb, BreadcrumbHint, Integration, Scope } from '@sentry/core';\nimport {\n getClient,\n getGlobalScope,\n getIntegrationsToSetup,\n getIsolationScope,\n initAndBind,\n logger,\n makeDsn,\n stackParserFromStackParserOptions,\n withScope as coreWithScope,\n} from '@sentry/core';\nimport { defaultStackParser, makeFetchTransport, Profiler } from '@sentry/react';\nimport * as React from 'react';\nimport { ReactNativeClient } from './client';\nimport { FeedbackWidgetProvider } from './feedback/FeedbackWidgetProvider';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { getDefaultIntegrations } from './integrations/default';\nimport type { ReactNativeClientOptions, ReactNativeOptions, ReactNativeWrapperOptions } from './options';\nimport { shouldEnableNativeNagger } from './options';\nimport { enableSyncToNative } from './scopeSync';\nimport { TouchEventBoundary } from './touchevents';\nimport { ReactNativeProfiler } from './tracing';\nimport { useEncodePolyfill } from './transports/encodePolyfill';\nimport { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';\nimport { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer, isWeb } from './utils/environment';\nimport { getDefaultRelease } from './utils/release';\nimport { safeFactory, safeTracesSampler } from './utils/safe';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_OPTIONS: ReactNativeOptions = {\n enableNativeCrashHandling: true,\n enableNativeNagger: true,\n autoInitializeNativeSdk: true,\n enableAutoPerformanceTracing: true,\n enableWatchdogTerminationTracking: true,\n patchGlobalPromise: true,\n sendClientReports: true,\n maxQueueSize: DEFAULT_BUFFER_SIZE,\n attachStacktrace: true,\n enableCaptureFailedRequests: false,\n enableNdk: true,\n enableAppStartTracking: true,\n enableNativeFramesTracking: true,\n enableStallTracking: true,\n enableUserInteractionTracing: false,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n if (isRunningInMetroDevServer()) {\n return;\n }\n\n const maxQueueSize = passedOptions.maxQueueSize\n // eslint-disable-next-line deprecation/deprecation\n ?? passedOptions.transportOptions?.bufferSize\n ?? DEFAULT_OPTIONS.maxQueueSize;\n\n const enableNative = passedOptions.enableNative === undefined || passedOptions.enableNative\n ? NATIVE.isNativeAvailable()\n : false;\n\n useEncodePolyfill();\n if (enableNative) {\n enableSyncToNative(getGlobalScope());\n enableSyncToNative(getIsolationScope());\n }\n\n const getURLFromDSN = (dsn: string | undefined): string | undefined => {\n if (!dsn) {\n return undefined;\n }\n const dsnComponents = makeDsn(dsn);\n if (!dsnComponents) {\n logger.error('Failed to extract url from DSN: ', dsn);\n return undefined;\n }\n const port = dsnComponents.port ? `:${dsnComponents.port}` : '';\n return `${dsnComponents.protocol}://${dsnComponents.host}${port}`;\n };\n\n const userBeforeBreadcrumb = safeFactory(passedOptions.beforeBreadcrumb, { loggerMessage: 'The beforeBreadcrumb threw an error' });\n\n // Exclude Dev Server and Sentry Dsn request from Breadcrumbs\n const devServerUrl = getDevServer()?.url;\n const dsn = getURLFromDSN(passedOptions.dsn);\n const defaultBeforeBreadcrumb = (breadcrumb: Breadcrumb, _hint?: BreadcrumbHint): Breadcrumb | null => {\n const type = breadcrumb.type || '';\n const url = typeof breadcrumb.data?.url === 'string' ? breadcrumb.data.url : '';\n if (type === 'http' && ((devServerUrl && url.startsWith(devServerUrl)) || (dsn && url.startsWith(dsn)))) {\n return null;\n }\n return breadcrumb;\n };\n\n const chainedBeforeBreadcrumb = (breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null => {\n let modifiedBreadcrumb = breadcrumb;\n if (userBeforeBreadcrumb) {\n const result = userBeforeBreadcrumb(breadcrumb, hint);\n if (result === null) {\n return null;\n }\n modifiedBreadcrumb = result;\n }\n return defaultBeforeBreadcrumb(modifiedBreadcrumb, hint);\n };\n\n const options: ReactNativeClientOptions = {\n ...DEFAULT_OPTIONS,\n ...passedOptions,\n release: passedOptions.release ?? getDefaultRelease(),\n enableNative,\n enableNativeNagger: shouldEnableNativeNagger(passedOptions.enableNativeNagger),\n // If custom transport factory fails the SDK won't initialize\n transport: passedOptions.transport\n || makeNativeTransportFactory({\n enableNative,\n })\n || makeFetchTransport,\n transportOptions: {\n ...DEFAULT_OPTIONS.transportOptions,\n ...(passedOptions.transportOptions ?? {}),\n bufferSize: maxQueueSize,\n },\n maxQueueSize,\n integrations: [],\n stackParser: stackParserFromStackParserOptions(passedOptions.stackParser || defaultStackParser),\n beforeBreadcrumb: chainedBeforeBreadcrumb,\n initialScope: safeFactory(passedOptions.initialScope, { loggerMessage: 'The initialScope threw an error' }),\n };\n if ('tracesSampler' in options) {\n options.tracesSampler = safeTracesSampler(options.tracesSampler);\n }\n\n if (!('environment' in options)) {\n options.environment = getDefaultEnvironment();\n }\n\n const defaultIntegrations: false | Integration[] = passedOptions.defaultIntegrations === undefined\n ? getDefaultIntegrations(options)\n : passedOptions.defaultIntegrations;\n\n options.integrations = getIntegrationsToSetup({\n integrations: safeFactory(passedOptions.integrations, { loggerMessage: 'The integrations threw an error' }),\n defaultIntegrations,\n });\n initAndBind(ReactNativeClient, options);\n\n if (isExpoGo()) {\n logger.info('Offline caching, native errors features are not available in Expo Go.');\n logger.info('Use EAS Build / Native Release Build to test these features.');\n }\n}\n\n/**\n * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.\n */\nexport function wrap<P extends Record<string, unknown>>(\n RootComponent: React.ComponentType<P>,\n options?: ReactNativeWrapperOptions\n): React.ComponentType<P> {\n const profilerProps = {\n ...(options?.profilerProps),\n name: RootComponent.displayName ?? 'Root',\n updateProps: {}\n };\n\n const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler;\n\n const RootApp: React.FC<P> = appProps => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ProfilerComponent {...profilerProps}>\n <FeedbackWidgetProvider>\n <RootComponent {...appProps} />\n </FeedbackWidgetProvider>\n </ProfilerComponent>\n </TouchEventBoundary>\n );\n };\n\n return RootApp;\n}\n\n/**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\nexport function nativeCrash(): void {\n NATIVE.nativeCrash();\n}\n\n/**\n * Flushes all pending events in the queue to disk.\n * Use this before applying any realtime updates such as code-push or expo updates.\n */\nexport async function flush(): Promise<boolean> {\n try {\n const client = getClient();\n\n if (client) {\n const result = await client.flush();\n\n return result;\n }\n // eslint-disable-next-line no-empty\n } catch (_) { }\n\n logger.error('Failed to flush the event queue.');\n\n return false;\n}\n\n/**\n * Closes the SDK, stops sending events.\n */\nexport async function close(): Promise<void> {\n try {\n const client = getClient();\n\n if (client) {\n await client.close();\n }\n } catch (e) {\n logger.error('Failed to close the SDK');\n }\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n *\n * @param callback that will be enclosed into push/popScope.\n */\nexport function withScope<T>(callback: (scope: Scope) => T): T | undefined {\n const safeCallback = (scope: Scope): T | undefined => {\n try {\n return callback(scope);\n } catch (e) {\n logger.error('Error while running withScope callback', e);\n return undefined;\n }\n };\n return coreWithScope(safeCallback);\n}\n\n/**\n * Returns if the app crashed in the last run.\n */\nexport async function crashedLastRun(): Promise<boolean | null> {\n return NATIVE.crashedLastRun();\n}\n"]}
@@ -26,6 +26,12 @@ export interface SentryExpoConfigOptions {
26
26
  * Pass a custom `getDefaultConfig` function to override the default Expo configuration getter.
27
27
  */
28
28
  getDefaultConfig?: typeof getSentryExpoConfig;
29
+ /**
30
+ * For Expo Web, inject `release` and `version` options from `app.json`, the Expo Application Config.
31
+ *
32
+ * @default true
33
+ */
34
+ injectReleaseForWeb?: boolean;
29
35
  }
30
36
  /**
31
37
  * Adds Sentry to the Metro config.
@@ -1 +1 @@
1
- {"version":3,"file":"met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@@ -22,6 +22,7 @@ const enableLogger_1 = require("./enableLogger");
22
22
  const metroMiddleware_1 = require("./metroMiddleware");
23
23
  const sentryBabelTransformerUtils_1 = require("./sentryBabelTransformerUtils");
24
24
  const sentryMetroSerializer_1 = require("./sentryMetroSerializer");
25
+ const sentryReleaseInjector_1 = require("./sentryReleaseInjector");
25
26
  __exportStar(require("./sentryMetroSerializer"), exports);
26
27
  (0, enableLogger_1.enableLogger)();
27
28
  /**
@@ -51,12 +52,13 @@ exports.withSentryConfig = withSentryConfig;
51
52
  * This function returns Default Expo configuration with Sentry plugins.
52
53
  */
53
54
  function getSentryExpoConfig(projectRoot, options = {}) {
54
- var _a;
55
+ var _a, _b;
55
56
  setSentryMetroDevServerEnvFlag();
56
57
  const getDefaultConfig = options.getDefaultConfig || loadExpoMetroConfigModule().getDefaultConfig;
57
58
  const config = getDefaultConfig(projectRoot, Object.assign(Object.assign({}, options), { unstable_beforeAssetSerializationPlugins: [
58
59
  ...(options.unstable_beforeAssetSerializationPlugins || []),
59
- sentryMetroSerializer_1.unstable_beforeAssetSerializationPlugin,
60
+ ...(((_a = options.injectReleaseForWeb) !== null && _a !== void 0 ? _a : true) ? [(0, sentryReleaseInjector_1.unstableReleaseConstantsPlugin)(projectRoot)] : []),
61
+ sentryMetroSerializer_1.unstableBeforeAssetSerializationDebugIdPlugin,
60
62
  ] }));
61
63
  let newConfig = withSentryFramesCollapsed(config);
62
64
  if (options.annotateReactComponents) {
@@ -65,7 +67,7 @@ function getSentryExpoConfig(projectRoot, options = {}) {
65
67
  if (options.includeWebReplay === false) {
66
68
  newConfig = withSentryResolver(newConfig, options.includeWebReplay);
67
69
  }
68
- if ((_a = options.enableSourceContextInDevelopment) !== null && _a !== void 0 ? _a : true) {
70
+ if ((_b = options.enableSourceContextInDevelopment) !== null && _b !== void 0 ? _b : true) {
69
71
  newConfig = (0, metroMiddleware_1.withSentryMiddleware)(newConfig);
70
72
  }
71
73
  return newConfig;