@sentry/react-native 5.24.1 → 5.25.0-alpha.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 (85) hide show
  1. package/CHANGELOG.md +76 -2
  2. package/RNSentry.podspec +1 -1
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +56 -2
  5. package/android/src/main/java/io/sentry/react/RNSentryReplayBreadcrumbConverter.java +178 -0
  6. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +10 -0
  7. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +10 -0
  8. package/dist/js/NativeRNSentry.d.ts +2 -0
  9. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  10. package/dist/js/NativeRNSentry.js.map +1 -1
  11. package/dist/js/client.d.ts +4 -0
  12. package/dist/js/client.d.ts.map +1 -1
  13. package/dist/js/client.js +12 -2
  14. package/dist/js/client.js.map +1 -1
  15. package/dist/js/integrations/default.d.ts.map +1 -1
  16. package/dist/js/integrations/default.js +9 -1
  17. package/dist/js/integrations/default.js.map +1 -1
  18. package/dist/js/integrations/exports.d.ts +2 -1
  19. package/dist/js/integrations/exports.d.ts.map +1 -1
  20. package/dist/js/integrations/exports.js +2 -1
  21. package/dist/js/integrations/exports.js.map +1 -1
  22. package/dist/js/integrations/index.d.ts +1 -0
  23. package/dist/js/integrations/index.d.ts.map +1 -1
  24. package/dist/js/integrations/index.js +1 -0
  25. package/dist/js/integrations/index.js.map +1 -1
  26. package/dist/js/options.d.ts +24 -2
  27. package/dist/js/options.d.ts.map +1 -1
  28. package/dist/js/options.js.map +1 -1
  29. package/dist/js/replay/mobilereplay.d.ts +36 -0
  30. package/dist/js/replay/mobilereplay.d.ts.map +1 -0
  31. package/dist/js/replay/mobilereplay.js +99 -0
  32. package/dist/js/replay/mobilereplay.js.map +1 -0
  33. package/dist/js/replay/networkUtils.d.ts +8 -0
  34. package/dist/js/replay/networkUtils.d.ts.map +1 -0
  35. package/dist/js/replay/networkUtils.js +52 -0
  36. package/dist/js/replay/networkUtils.js.map +1 -0
  37. package/dist/js/replay/xhrUtils.d.ts +6 -0
  38. package/dist/js/replay/xhrUtils.d.ts.map +1 -0
  39. package/dist/js/replay/xhrUtils.js +31 -0
  40. package/dist/js/replay/xhrUtils.js.map +1 -0
  41. package/dist/js/touchevents.d.ts +4 -0
  42. package/dist/js/touchevents.d.ts.map +1 -1
  43. package/dist/js/touchevents.js +93 -53
  44. package/dist/js/touchevents.js.map +1 -1
  45. package/dist/js/utils/clientutils.d.ts +10 -0
  46. package/dist/js/utils/clientutils.d.ts.map +1 -0
  47. package/dist/js/utils/clientutils.js +9 -0
  48. package/dist/js/utils/clientutils.js.map +1 -0
  49. package/dist/js/utils/environment.d.ts +4 -0
  50. package/dist/js/utils/environment.d.ts.map +1 -1
  51. package/dist/js/utils/environment.js +8 -0
  52. package/dist/js/utils/environment.js.map +1 -1
  53. package/dist/js/utils/worldwide.d.ts +6 -0
  54. package/dist/js/utils/worldwide.d.ts.map +1 -1
  55. package/dist/js/utils/worldwide.js.map +1 -1
  56. package/dist/js/version.d.ts +1 -1
  57. package/dist/js/version.d.ts.map +1 -1
  58. package/dist/js/version.js +1 -1
  59. package/dist/js/version.js.map +1 -1
  60. package/dist/js/wrapper.d.ts +7 -1
  61. package/dist/js/wrapper.d.ts.map +1 -1
  62. package/dist/js/wrapper.js +24 -0
  63. package/dist/js/wrapper.js.map +1 -1
  64. package/ios/RNSentry.mm +33 -1
  65. package/ios/RNSentryReplay.h +8 -0
  66. package/ios/RNSentryReplay.m +60 -0
  67. package/ios/RNSentryReplayBreadcrumbConverter.h +16 -0
  68. package/ios/RNSentryReplayBreadcrumbConverter.m +172 -0
  69. package/package.json +1 -1
  70. package/scripts/expo-upload-sourcemaps.js +10 -10
  71. package/src/js/NativeRNSentry.ts +2 -0
  72. package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -0
  73. package/ts3.8/dist/js/client.d.ts +4 -0
  74. package/ts3.8/dist/js/integrations/exports.d.ts +2 -1
  75. package/ts3.8/dist/js/integrations/index.d.ts +1 -0
  76. package/ts3.8/dist/js/options.d.ts +24 -2
  77. package/ts3.8/dist/js/replay/mobilereplay.d.ts +36 -0
  78. package/ts3.8/dist/js/replay/networkUtils.d.ts +8 -0
  79. package/ts3.8/dist/js/replay/xhrUtils.d.ts +6 -0
  80. package/ts3.8/dist/js/touchevents.d.ts +4 -0
  81. package/ts3.8/dist/js/utils/clientutils.d.ts +10 -0
  82. package/ts3.8/dist/js/utils/environment.d.ts +4 -0
  83. package/ts3.8/dist/js/utils/worldwide.d.ts +6 -0
  84. package/ts3.8/dist/js/version.d.ts +1 -1
  85. package/ts3.8/dist/js/wrapper.d.ts +7 -1
@@ -1,5 +1,5 @@
1
1
  import { addBreadcrumb, getCurrentHub } from '@sentry/core';
2
- import { logger } from '@sentry/utils';
2
+ import { dropUndefinedKeys, logger } from '@sentry/utils';
3
3
  import * as React from 'react';
4
4
  import { StyleSheet, View } from 'react-native';
5
5
  import { createIntegration } from './integrations/factory';
@@ -14,6 +14,9 @@ const DEFAULT_BREADCRUMB_CATEGORY = 'touch';
14
14
  const DEFAULT_BREADCRUMB_TYPE = 'user';
15
15
  const DEFAULT_MAX_COMPONENT_TREE_SIZE = 20;
16
16
  const SENTRY_LABEL_PROP_KEY = 'sentry-label';
17
+ const SENTRY_COMPONENT_PROP_KEY = 'data-sentry-component';
18
+ const SENTRY_ELEMENT_PROP_KEY = 'data-sentry-element';
19
+ const SENTRY_FILE_PROP_KEY = 'data-sentry-source-file';
17
20
  /**
18
21
  * Boundary to log breadcrumbs for interaction events.
19
22
  */
@@ -45,15 +48,15 @@ class TouchEventBoundary extends React.Component {
45
48
  /**
46
49
  * Logs the touch event given the component tree names and a label.
47
50
  */
48
- _logTouchEvent(componentTreeNames, activeLabel) {
51
+ _logTouchEvent(touchPath, label) {
49
52
  const level = 'info';
53
+ const root = touchPath[0];
54
+ const detail = label ? label : `${root.name}${root.file ? ` (${root.file})` : ''}`;
50
55
  const crumb = {
51
56
  category: this.props.breadcrumbCategory,
52
- data: { componentTree: componentTreeNames },
57
+ data: { path: touchPath },
53
58
  level: level,
54
- message: activeLabel
55
- ? `Touch event within element: ${activeLabel}`
56
- : 'Touch event within component tree',
59
+ message: `Touch event within element: ${detail}`,
57
60
  type: this.props.breadcrumbType,
58
61
  };
59
62
  addBreadcrumb(crumb);
@@ -82,69 +85,57 @@ class TouchEventBoundary extends React.Component {
82
85
  */
83
86
  // eslint-disable-next-line complexity
84
87
  _onTouchStart(e) {
85
- var _a, _b;
88
+ var _a, _b, _c;
86
89
  if (!e._targetInst) {
87
90
  return;
88
91
  }
89
92
  let currentInst = e._targetInst;
90
- let activeLabel;
91
- let activeDisplayName;
92
- const componentTreeNames = [];
93
+ const touchPath = [];
93
94
  while (currentInst &&
94
95
  // maxComponentTreeSize will always be defined as we have a defaultProps. But ts needs a check so this is here.
95
96
  this.props.maxComponentTreeSize &&
96
- componentTreeNames.length < this.props.maxComponentTreeSize) {
97
+ touchPath.length < this.props.maxComponentTreeSize) {
97
98
  if (
98
99
  // If the loop gets to the boundary itself, break.
99
- ((_a = currentInst.elementType) === null || _a === void 0 ? void 0 : _a.displayName) ===
100
- TouchEventBoundary.displayName) {
100
+ ((_a = currentInst.elementType) === null || _a === void 0 ? void 0 : _a.displayName) === TouchEventBoundary.displayName) {
101
101
  break;
102
102
  }
103
- const props = currentInst.memoizedProps;
104
- const sentryLabel = typeof (props === null || props === void 0 ? void 0 : props[SENTRY_LABEL_PROP_KEY]) !== 'undefined'
105
- ? `${props[SENTRY_LABEL_PROP_KEY]}`
106
- : undefined;
107
- // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in
108
- // the "check-label" if sentence, so we have to assign it to a variable here first
109
- let labelValue;
110
- if (typeof this.props.labelName === 'string')
111
- labelValue = props === null || props === void 0 ? void 0 : props[this.props.labelName];
112
- // Check the label first
113
- if (sentryLabel && !this._isNameIgnored(sentryLabel)) {
114
- if (!activeLabel) {
115
- activeLabel = sentryLabel;
116
- }
117
- componentTreeNames.push(sentryLabel);
118
- }
119
- else if (typeof labelValue === 'string' &&
120
- !this._isNameIgnored(labelValue)) {
121
- if (!activeLabel) {
122
- activeLabel = labelValue;
123
- }
124
- componentTreeNames.push(labelValue);
125
- }
126
- else if (currentInst.elementType) {
127
- const { elementType } = currentInst;
128
- if (elementType.displayName &&
129
- !this._isNameIgnored(elementType.displayName)) {
130
- // Check display name
131
- if (!activeDisplayName) {
132
- activeDisplayName = elementType.displayName;
133
- }
134
- componentTreeNames.push(elementType.displayName);
135
- }
136
- }
103
+ const info = getTouchedComponentInfo(currentInst, this.props.labelName);
104
+ this._pushIfNotIgnored(touchPath, info);
137
105
  currentInst = currentInst.return;
138
106
  }
139
- const finalLabel = activeLabel !== null && activeLabel !== void 0 ? activeLabel : activeDisplayName;
140
- if (componentTreeNames.length > 0 || finalLabel) {
141
- this._logTouchEvent(componentTreeNames, finalLabel);
107
+ const label = (_b = touchPath.find(info => info.label)) === null || _b === void 0 ? void 0 : _b.label;
108
+ if (touchPath.length > 0) {
109
+ this._logTouchEvent(touchPath, label);
142
110
  }
143
- (_b = this._tracingIntegration) === null || _b === void 0 ? void 0 : _b.startUserInteractionTransaction({
144
- elementId: activeLabel,
111
+ (_c = this._tracingIntegration) === null || _c === void 0 ? void 0 : _c.startUserInteractionTransaction({
112
+ elementId: label,
145
113
  op: UI_ACTION_TOUCH,
146
114
  });
147
115
  }
116
+ /**
117
+ * Pushes the name to the componentTreeNames array if it is not ignored.
118
+ */
119
+ _pushIfNotIgnored(touchPath, value) {
120
+ if (!value) {
121
+ return false;
122
+ }
123
+ if (!value.name && !value.label) {
124
+ return false;
125
+ }
126
+ if (value.name && this._isNameIgnored(value.name)) {
127
+ return false;
128
+ }
129
+ if (value.label && this._isNameIgnored(value.label)) {
130
+ return false;
131
+ }
132
+ // Deduplicate same subsequent items.
133
+ if (touchPath.length > 0 && JSON.stringify(touchPath[touchPath.length - 1]) === JSON.stringify(value)) {
134
+ return false;
135
+ }
136
+ touchPath.push(value);
137
+ return true;
138
+ }
148
139
  }
149
140
  TouchEventBoundary.displayName = '__Sentry.TouchEventBoundary';
150
141
  TouchEventBoundary.defaultProps = {
@@ -153,6 +144,55 @@ TouchEventBoundary.defaultProps = {
153
144
  ignoreNames: [],
154
145
  maxComponentTreeSize: DEFAULT_MAX_COMPONENT_TREE_SIZE,
155
146
  };
147
+ function getTouchedComponentInfo(currentInst, labelKey) {
148
+ var _a;
149
+ const displayName = (_a = currentInst.elementType) === null || _a === void 0 ? void 0 : _a.displayName;
150
+ const props = currentInst.memoizedProps;
151
+ if (!props) {
152
+ // Early return if no props are available, as we can't extract any useful information
153
+ if (displayName) {
154
+ return {
155
+ name: displayName,
156
+ };
157
+ }
158
+ return undefined;
159
+ }
160
+ return dropUndefinedKeys({
161
+ // provided by @sentry/babel-plugin-component-annotate
162
+ name: getComponentName(props) || displayName,
163
+ element: getElementName(props),
164
+ file: getFileName(props),
165
+ // `sentry-label` or user defined label key
166
+ label: getLabelValue(props, labelKey),
167
+ });
168
+ }
169
+ function getComponentName(props) {
170
+ return typeof props[SENTRY_COMPONENT_PROP_KEY] === 'string' &&
171
+ props[SENTRY_COMPONENT_PROP_KEY].length > 0 &&
172
+ props[SENTRY_COMPONENT_PROP_KEY] !== 'unknown' &&
173
+ props[SENTRY_COMPONENT_PROP_KEY] || undefined;
174
+ }
175
+ function getElementName(props) {
176
+ return typeof props[SENTRY_ELEMENT_PROP_KEY] === 'string' &&
177
+ props[SENTRY_ELEMENT_PROP_KEY].length > 0 &&
178
+ props[SENTRY_ELEMENT_PROP_KEY] !== 'unknown' &&
179
+ props[SENTRY_ELEMENT_PROP_KEY] || undefined;
180
+ }
181
+ function getFileName(props) {
182
+ return typeof props[SENTRY_FILE_PROP_KEY] === 'string' &&
183
+ props[SENTRY_FILE_PROP_KEY].length > 0 &&
184
+ props[SENTRY_FILE_PROP_KEY] !== 'unknown' &&
185
+ props[SENTRY_FILE_PROP_KEY] || undefined;
186
+ }
187
+ function getLabelValue(props, labelKey) {
188
+ return typeof props[SENTRY_LABEL_PROP_KEY] === 'string' && props[SENTRY_LABEL_PROP_KEY].length > 0
189
+ ? props[SENTRY_LABEL_PROP_KEY]
190
+ // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in
191
+ // the "check-label" if sentence, so we have to assign it to a variable here first
192
+ : typeof labelKey === 'string' && typeof props[labelKey] == 'string' && props[labelKey].length > 0
193
+ ? props[labelKey]
194
+ : undefined;
195
+ }
156
196
  /**
157
197
  * Convenience Higher-Order-Component for TouchEventBoundary
158
198
  * @param WrappedComponent any React Component
@@ -161,7 +201,7 @@ TouchEventBoundary.defaultProps = {
161
201
  const withTouchEventBoundary = (
162
202
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
163
203
  InnerComponent, boundaryProps) => {
164
- const WrappedComponent = (props) => (React.createElement(TouchEventBoundary, Object.assign({}, (boundaryProps !== null && boundaryProps !== void 0 ? boundaryProps : {})),
204
+ const WrappedComponent = props => (React.createElement(TouchEventBoundary, Object.assign({}, (boundaryProps !== null && boundaryProps !== void 0 ? boundaryProps : {})),
165
205
  React.createElement(InnerComponent, Object.assign({}, props))));
166
206
  WrappedComponent.displayName = 'WithTouchEventBoundary';
167
207
  return WrappedComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"touchevents.js","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AA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AAC","sourcesContent":["import { addBreadcrumb, getCurrentHub } from '@sentry/core';\nimport type { SeverityLevel } from '@sentry/types';\nimport { logger } from '@sentry/utils';\nimport * as React from 'react';\nimport type { GestureResponderEvent} from 'react-native';\nimport { StyleSheet, View } from 'react-native';\n\nimport { createIntegration } from './integrations/factory';\nimport { ReactNativeTracing } from './tracing';\nimport { UI_ACTION_TOUCH } from './tracing/ops';\n\nexport type TouchEventBoundaryProps = {\n /**\n * The category assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbCategory?: string;\n /**\n * The type assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbType?: string;\n /**\n * The max number of components to display when logging a touch's component tree.\n */\n maxComponentTreeSize?: number;\n /**\n * Component name(s) to ignore when logging the touch event. This prevents unhelpful logs such as\n * \"Touch event within element: View\" where you still can't tell which View it occurred in.\n */\n ignoreNames?: Array<string | RegExp>;\n /**\n * Deprecated, use ignoreNames instead\n * @deprecated\n */\n ignoredDisplayNames?: Array<string | RegExp>;\n /**\n * React Node wrapped by TouchEventBoundary.\n */\n children?: React.ReactNode;\n /**\n * Label Name used to identify the touched element.\n */\n labelName?: string;\n};\n\nconst touchEventStyles = StyleSheet.create({\n wrapperView: {\n flex: 1,\n },\n});\n\nconst DEFAULT_BREADCRUMB_CATEGORY = 'touch';\nconst DEFAULT_BREADCRUMB_TYPE = 'user';\nconst DEFAULT_MAX_COMPONENT_TREE_SIZE = 20;\n\nconst SENTRY_LABEL_PROP_KEY = 'sentry-label';\n\ninterface ElementInstance {\n elementType?: {\n displayName?: string;\n name?: string;\n };\n memoizedProps?: Record<string, unknown>;\n return?: ElementInstance;\n}\n\ninterface PrivateGestureResponderEvent extends GestureResponderEvent {\n _targetInst?: ElementInstance;\n}\n\n/**\n * Boundary to log breadcrumbs for interaction events.\n */\nclass TouchEventBoundary extends React.Component<TouchEventBoundaryProps> {\n\n public static displayName: string = '__Sentry.TouchEventBoundary';\n public static defaultProps: Partial<TouchEventBoundaryProps> = {\n breadcrumbCategory: DEFAULT_BREADCRUMB_CATEGORY,\n breadcrumbType: DEFAULT_BREADCRUMB_TYPE,\n ignoreNames: [],\n maxComponentTreeSize: DEFAULT_MAX_COMPONENT_TREE_SIZE,\n };\n\n public readonly name: string = 'TouchEventBoundary';\n\n private _tracingIntegration: ReactNativeTracing | null = null;\n\n /**\n * Registers the TouchEventBoundary as a Sentry Integration.\n */\n public componentDidMount(): void {\n const client = getCurrentHub().getClient();\n client?.addIntegration?.(createIntegration(this.name));\n if (!this._tracingIntegration && client) {\n this._tracingIntegration = client.getIntegration(ReactNativeTracing);\n }\n }\n\n /**\n *\n */\n public render(): React.ReactNode {\n return (\n <View\n style={touchEventStyles.wrapperView}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onTouchStart={this._onTouchStart.bind(this) as any}\n >\n {this.props.children}\n </View>\n );\n }\n\n /**\n * Logs the touch event given the component tree names and a label.\n */\n private _logTouchEvent(\n componentTreeNames: string[],\n activeLabel?: string\n ): void {\n const level = 'info' as SeverityLevel;\n const crumb = {\n category: this.props.breadcrumbCategory,\n data: { componentTree: componentTreeNames },\n level: level,\n message: activeLabel\n ? `Touch event within element: ${activeLabel}`\n : 'Touch event within component tree',\n type: this.props.breadcrumbType,\n };\n addBreadcrumb(crumb);\n\n logger.log(`[TouchEvents] ${crumb.message}`);\n }\n\n /**\n * Checks if the name is supposed to be ignored.\n */\n private _isNameIgnored(name: string): boolean {\n let ignoreNames = this.props.ignoreNames || [];\n // eslint-disable-next-line deprecation/deprecation\n if (this.props.ignoredDisplayNames) {\n // This is to make it compatible with prior version.\n // eslint-disable-next-line deprecation/deprecation\n ignoreNames = [...ignoreNames, ...this.props.ignoredDisplayNames];\n }\n\n return ignoreNames.some(\n (ignoreName: string | RegExp) =>\n (typeof ignoreName === 'string' && name === ignoreName) ||\n (ignoreName instanceof RegExp && name.match(ignoreName))\n );\n }\n\n // Originally was going to clean the names of any HOCs as well but decided that it might hinder debugging effectively. Will leave here in case\n // private readonly _cleanName = (name: string): string =>\n // name.replace(/.*\\(/g, \"\").replace(/\\)/g, \"\");\n\n /**\n * Traverses through the component tree when a touch happens and logs it.\n * @param e\n */\n // eslint-disable-next-line complexity\n private _onTouchStart(e: PrivateGestureResponderEvent): void {\n if (!e._targetInst) {\n return;\n }\n\n let currentInst: ElementInstance | undefined = e._targetInst;\n\n let activeLabel: string | undefined;\n let activeDisplayName: string | undefined;\n const componentTreeNames: string[] = [];\n\n while (\n currentInst &&\n // maxComponentTreeSize will always be defined as we have a defaultProps. But ts needs a check so this is here.\n this.props.maxComponentTreeSize &&\n componentTreeNames.length < this.props.maxComponentTreeSize\n ) {\n if (\n // If the loop gets to the boundary itself, break.\n currentInst.elementType?.displayName ===\n TouchEventBoundary.displayName\n ) {\n break;\n }\n\n const props = currentInst.memoizedProps;\n const sentryLabel =\n typeof props?.[SENTRY_LABEL_PROP_KEY] !== 'undefined'\n ? `${props[SENTRY_LABEL_PROP_KEY]}`\n : undefined;\n\n // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in\n // the \"check-label\" if sentence, so we have to assign it to a variable here first\n let labelValue;\n if (typeof this.props.labelName === 'string')\n labelValue = props?.[this.props.labelName];\n\n // Check the label first\n if (sentryLabel && !this._isNameIgnored(sentryLabel)) {\n if (!activeLabel) {\n activeLabel = sentryLabel;\n }\n componentTreeNames.push(sentryLabel);\n } else if (\n typeof labelValue === 'string' &&\n !this._isNameIgnored(labelValue)\n ) {\n if (!activeLabel) {\n activeLabel = labelValue;\n }\n componentTreeNames.push(labelValue);\n } else if (currentInst.elementType) {\n const { elementType } = currentInst;\n\n if (\n elementType.displayName &&\n !this._isNameIgnored(elementType.displayName)\n ) {\n // Check display name\n if (!activeDisplayName) {\n activeDisplayName = elementType.displayName;\n }\n componentTreeNames.push(elementType.displayName);\n }\n }\n\n currentInst = currentInst.return;\n }\n\n const finalLabel = activeLabel ?? activeDisplayName;\n\n if (componentTreeNames.length > 0 || finalLabel) {\n this._logTouchEvent(componentTreeNames, finalLabel);\n }\n\n this._tracingIntegration?.startUserInteractionTransaction({\n elementId: activeLabel,\n op: UI_ACTION_TOUCH,\n });\n }\n}\n\n/**\n * Convenience Higher-Order-Component for TouchEventBoundary\n * @param WrappedComponent any React Component\n * @param boundaryProps TouchEventBoundaryProps\n */\nconst withTouchEventBoundary = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n InnerComponent: React.ComponentType<any>,\n boundaryProps?: TouchEventBoundaryProps\n): React.FunctionComponent => {\n const WrappedComponent: React.FunctionComponent = (props) => (\n <TouchEventBoundary {...(boundaryProps ?? {})}>\n <InnerComponent {...props} />\n </TouchEventBoundary>\n );\n\n WrappedComponent.displayName = 'WithTouchEventBoundary';\n\n return WrappedComponent;\n};\n\nexport { TouchEventBoundary, withTouchEventBoundary };\n"]}
1
+ {"version":3,"file":"touchevents.js","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAmChD,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE;QACX,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC;AAEH,MAAM,2BAA2B,GAAG,OAAO,CAAC;AAC5C,MAAM,uBAAuB,GAAG,MAAM,CAAC;AACvC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAE3C,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAC7C,M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AAC;QAC3C,oBAAC,cAAc,oBAAK,KAAK,EAAI,CACV,CACtB,CAAC;IAEF,gBAAgB,CAAC,WAAW,GAAG,wBAAwB,CAAC;IAExD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["import { addBreadcrumb, getCurrentHub } from '@sentry/core';\nimport type { SeverityLevel } from '@sentry/types';\nimport { dropUndefinedKeys, logger } from '@sentry/utils';\nimport * as React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { StyleSheet, View } from 'react-native';\n\nimport { createIntegration } from './integrations/factory';\nimport { ReactNativeTracing } from './tracing';\nimport { UI_ACTION_TOUCH } from './tracing/ops';\n\nexport type TouchEventBoundaryProps = {\n /**\n * The category assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbCategory?: string;\n /**\n * The type assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbType?: string;\n /**\n * The max number of components to display when logging a touch's component tree.\n */\n maxComponentTreeSize?: number;\n /**\n * Component name(s) to ignore when logging the touch event. This prevents unhelpful logs such as\n * \"Touch event within element: View\" where you still can't tell which View it occurred in.\n */\n ignoreNames?: Array<string | RegExp>;\n /**\n * Deprecated, use ignoreNames instead\n * @deprecated\n */\n ignoredDisplayNames?: Array<string | RegExp>;\n /**\n * React Node wrapped by TouchEventBoundary.\n */\n children?: React.ReactNode;\n /**\n * Label Name used to identify the touched element.\n */\n labelName?: string;\n};\n\nconst touchEventStyles = StyleSheet.create({\n wrapperView: {\n flex: 1,\n },\n});\n\nconst DEFAULT_BREADCRUMB_CATEGORY = 'touch';\nconst DEFAULT_BREADCRUMB_TYPE = 'user';\nconst DEFAULT_MAX_COMPONENT_TREE_SIZE = 20;\n\nconst SENTRY_LABEL_PROP_KEY = 'sentry-label';\nconst SENTRY_COMPONENT_PROP_KEY = 'data-sentry-component';\nconst SENTRY_ELEMENT_PROP_KEY = 'data-sentry-element';\nconst SENTRY_FILE_PROP_KEY = 'data-sentry-source-file';\n\ninterface ElementInstance {\n elementType?: {\n displayName?: string;\n name?: string;\n };\n memoizedProps?: Record<string, unknown>;\n return?: ElementInstance;\n}\n\ninterface TouchedComponentInfo {\n name?: string;\n label?: string;\n element?: string;\n file?: string;\n}\n\ninterface PrivateGestureResponderEvent extends GestureResponderEvent {\n _targetInst?: ElementInstance;\n}\n\n/**\n * Boundary to log breadcrumbs for interaction events.\n */\nclass TouchEventBoundary extends React.Component<TouchEventBoundaryProps> {\n public static displayName: string = '__Sentry.TouchEventBoundary';\n public static defaultProps: Partial<TouchEventBoundaryProps> = {\n breadcrumbCategory: DEFAULT_BREADCRUMB_CATEGORY,\n breadcrumbType: DEFAULT_BREADCRUMB_TYPE,\n ignoreNames: [],\n maxComponentTreeSize: DEFAULT_MAX_COMPONENT_TREE_SIZE,\n };\n\n public readonly name: string = 'TouchEventBoundary';\n\n private _tracingIntegration: ReactNativeTracing | null = null;\n\n /**\n * Registers the TouchEventBoundary as a Sentry Integration.\n */\n public componentDidMount(): void {\n const client = getCurrentHub().getClient();\n client?.addIntegration?.(createIntegration(this.name));\n if (!this._tracingIntegration && client) {\n this._tracingIntegration = client.getIntegration(ReactNativeTracing);\n }\n }\n\n /**\n *\n */\n public render(): React.ReactNode {\n return (\n <View\n style={touchEventStyles.wrapperView}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onTouchStart={this._onTouchStart.bind(this) as any}\n >\n {this.props.children}\n </View>\n );\n }\n\n /**\n * Logs the touch event given the component tree names and a label.\n */\n private _logTouchEvent(touchPath: TouchedComponentInfo[], label?: string): void {\n const level = 'info' as SeverityLevel;\n\n const root = touchPath[0];\n const detail = label ? label : `${root.name}${root.file ? ` (${root.file})` : ''}`;\n\n const crumb = {\n category: this.props.breadcrumbCategory,\n data: { path: touchPath },\n level: level,\n message: `Touch event within element: ${detail}`,\n type: this.props.breadcrumbType,\n };\n addBreadcrumb(crumb);\n\n logger.log(`[TouchEvents] ${crumb.message}`);\n }\n\n /**\n * Checks if the name is supposed to be ignored.\n */\n private _isNameIgnored(name: string): boolean {\n let ignoreNames = this.props.ignoreNames || [];\n // eslint-disable-next-line deprecation/deprecation\n if (this.props.ignoredDisplayNames) {\n // This is to make it compatible with prior version.\n // eslint-disable-next-line deprecation/deprecation\n ignoreNames = [...ignoreNames, ...this.props.ignoredDisplayNames];\n }\n\n return ignoreNames.some(\n (ignoreName: string | RegExp) =>\n (typeof ignoreName === 'string' && name === ignoreName) ||\n (ignoreName instanceof RegExp && name.match(ignoreName)),\n );\n }\n\n // Originally was going to clean the names of any HOCs as well but decided that it might hinder debugging effectively. Will leave here in case\n // private readonly _cleanName = (name: string): string =>\n // name.replace(/.*\\(/g, \"\").replace(/\\)/g, \"\");\n\n /**\n * Traverses through the component tree when a touch happens and logs it.\n * @param e\n */\n // eslint-disable-next-line complexity\n private _onTouchStart(e: PrivateGestureResponderEvent): void {\n if (!e._targetInst) {\n return;\n }\n\n let currentInst: ElementInstance | undefined = e._targetInst;\n const touchPath: TouchedComponentInfo[] = [];\n\n while (\n currentInst &&\n // maxComponentTreeSize will always be defined as we have a defaultProps. But ts needs a check so this is here.\n this.props.maxComponentTreeSize &&\n touchPath.length < this.props.maxComponentTreeSize\n ) {\n if (\n // If the loop gets to the boundary itself, break.\n currentInst.elementType?.displayName === TouchEventBoundary.displayName\n ) {\n break;\n }\n\n const info = getTouchedComponentInfo(currentInst, this.props.labelName);\n this._pushIfNotIgnored(touchPath, info);\n\n currentInst = currentInst.return;\n }\n\n const label = touchPath.find(info => info.label)?.label;\n if (touchPath.length > 0) {\n this._logTouchEvent(touchPath, label);\n }\n\n this._tracingIntegration?.startUserInteractionTransaction({\n elementId: label,\n op: UI_ACTION_TOUCH,\n });\n }\n\n /**\n * Pushes the name to the componentTreeNames array if it is not ignored.\n */\n private _pushIfNotIgnored(touchPath: TouchedComponentInfo[], value: TouchedComponentInfo | undefined): boolean {\n if (!value) {\n return false;\n }\n\n if (!value.name && !value.label) {\n return false;\n }\n if (value.name && this._isNameIgnored(value.name)) {\n return false;\n }\n if (value.label && this._isNameIgnored(value.label)) {\n return false;\n }\n\n // Deduplicate same subsequent items.\n if (touchPath.length > 0 && JSON.stringify(touchPath[touchPath.length - 1]) === JSON.stringify(value)) {\n return false;\n }\n\n touchPath.push(value);\n return true;\n }\n}\n\nfunction getTouchedComponentInfo(currentInst: ElementInstance, labelKey: string | undefined): TouchedComponentInfo | undefined {\n const displayName = currentInst.elementType?.displayName;\n\n const props = currentInst.memoizedProps;\n if (!props) {\n // Early return if no props are available, as we can't extract any useful information\n if (displayName) {\n return {\n name: displayName,\n };\n }\n return undefined;\n }\n\n return dropUndefinedKeys<TouchedComponentInfo>({\n // provided by @sentry/babel-plugin-component-annotate\n name: getComponentName(props) || displayName,\n element: getElementName(props),\n file: getFileName(props),\n\n // `sentry-label` or user defined label key\n label: getLabelValue(props, labelKey),\n });\n}\n\nfunction getComponentName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_COMPONENT_PROP_KEY] === 'string' &&\n props[SENTRY_COMPONENT_PROP_KEY].length > 0 &&\n props[SENTRY_COMPONENT_PROP_KEY] !== 'unknown' &&\n props[SENTRY_COMPONENT_PROP_KEY] || undefined;\n}\n\nfunction getElementName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_ELEMENT_PROP_KEY] === 'string' &&\n props[SENTRY_ELEMENT_PROP_KEY].length > 0 &&\n props[SENTRY_ELEMENT_PROP_KEY] !== 'unknown' &&\n props[SENTRY_ELEMENT_PROP_KEY] || undefined;\n}\n\nfunction getFileName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_FILE_PROP_KEY] === 'string' &&\n props[SENTRY_FILE_PROP_KEY].length > 0 &&\n props[SENTRY_FILE_PROP_KEY] !== 'unknown' &&\n props[SENTRY_FILE_PROP_KEY] || undefined;\n}\n\nfunction getLabelValue(props: Record<string, unknown>, labelKey: string | undefined): string | undefined {\n return typeof props[SENTRY_LABEL_PROP_KEY] === 'string' && props[SENTRY_LABEL_PROP_KEY].length > 0\n ? props[SENTRY_LABEL_PROP_KEY] as string\n // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in\n // the \"check-label\" if sentence, so we have to assign it to a variable here first\n : typeof labelKey === 'string' && typeof props[labelKey] == 'string' && (props[labelKey] as string).length > 0\n ? props[labelKey] as string\n : undefined;\n}\n\n/**\n * Convenience Higher-Order-Component for TouchEventBoundary\n * @param WrappedComponent any React Component\n * @param boundaryProps TouchEventBoundaryProps\n */\nconst withTouchEventBoundary = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n InnerComponent: React.ComponentType<any>,\n boundaryProps?: TouchEventBoundaryProps,\n): React.FunctionComponent => {\n const WrappedComponent: React.FunctionComponent = props => (\n <TouchEventBoundary {...(boundaryProps ?? {})}>\n <InnerComponent {...props} />\n </TouchEventBoundary>\n );\n\n WrappedComponent.displayName = 'WithTouchEventBoundary';\n\n return WrappedComponent;\n};\n\nexport { TouchEventBoundary, withTouchEventBoundary };\n"]}
@@ -0,0 +1,10 @@
1
+ import type { Client } from '@sentry/types';
2
+ /**
3
+ * Checks if the provided Sentry client has hooks implemented.
4
+ * @param client The Sentry client object to check.
5
+ * @returns True if the client has hooks, false otherwise.
6
+ */
7
+ export declare function hasHooks(client: Client): client is Client & {
8
+ on: Required<Client>['on'];
9
+ };
10
+ //# sourceMappingURL=clientutils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientutils.d.ts","sourceRoot":"","sources":["../../../src/js/utils/clientutils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,MAAM,GAAG;IAAE,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;CAAE,CAE1F"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Checks if the provided Sentry client has hooks implemented.
3
+ * @param client The Sentry client object to check.
4
+ * @returns True if the client has hooks, false otherwise.
5
+ */
6
+ export function hasHooks(client) {
7
+ return client.on !== undefined;
8
+ }
9
+ //# sourceMappingURL=clientutils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientutils.js","sourceRoot":"","sources":["../../../src/js/utils/clientutils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,OAAO,MAAM,CAAC,EAAE,KAAK,SAAS,CAAC;AACjC,CAAC","sourcesContent":["import type { Client } from '@sentry/types';\n\n/**\n * Checks if the provided Sentry client has hooks implemented.\n * @param client The Sentry client object to check.\n * @returns True if the client has hooks, false otherwise.\n */\nexport function hasHooks(client: Client): client is Client & { on: Required<Client>['on'] } {\n return client.on !== undefined;\n}\n"]}
@@ -16,6 +16,10 @@ export declare function getExpoGoVersion(): string | undefined;
16
16
  export declare function getExpoSdkVersion(): string | undefined;
17
17
  /** Checks if the current platform is not web */
18
18
  export declare function notWeb(): boolean;
19
+ /** Checks if the current platform is supported mobile platform (iOS or Android) */
20
+ export declare function isMobileOs(): boolean;
21
+ /** Checks if the current platform is not supported mobile platform (iOS or Android) */
22
+ export declare function notMobileOs(): boolean;
19
23
  /** Returns Hermes Version if hermes is present in the runtime */
20
24
  export declare function getHermesVersion(): string | undefined;
21
25
  /** Returns default environment based on __DEV__ */
@@ -1 +1 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/js/utils/environment.ts"],"names":[],"mappings":"AAMA,0DAA0D;AAC1D,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,0DAA0D;AAC1D,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED,4DAA4D;AAC5D,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,oDAAoD;AACpD,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,SAAS,CAM1D;AAED,+CAA+C;A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,GAAG,SAAS,CAMrD;AAED,mDAAmD;AACnD,wBAAgB,qBAAqB,IAAI,aAAa,GAAG,YAAY,CAEpE;AAED,iDAAiD;AACjD,wBAAgB,yBAAyB,IAAI,OAAO,CASnD"}
@@ -47,6 +47,14 @@ export function getExpoSdkVersion() {
47
47
  export function notWeb() {
48
48
  return Platform.OS !== 'web';
49
49
  }
50
+ /** Checks if the current platform is supported mobile platform (iOS or Android) */
51
+ export function isMobileOs() {
52
+ return Platform.OS === 'ios' || Platform.OS === 'android';
53
+ }
54
+ /** Checks if the current platform is not supported mobile platform (iOS or Android) */
55
+ export function notMobileOs() {
56
+ return !isMobileOs();
57
+ }
50
58
  /** Returns Hermes Version if hermes is present in the runtime */
51
59
  export function getHermesVersion() {
52
60
  return (RN_GLOBAL_OBJ.HermesInternal &&
@@ -1 +1 @@
1
- {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/js/utils/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,0DAA0D;AAC1D,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC;AACxC,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,oBAAoB;IAClC,OAAO,aAAa,CAAC,kBAAkB,IAAI,IAAI,CAAC;AAClD,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,eAAe;IAC7B,OAAO,aAAa,CAAC,qBAAqB,IAAI,IAAI,CAAC;AACrD,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,qBAAqB;IACnC,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,EAAE;QAC5C,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,GAAG,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CAAC;AAC/B,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,gBAAgB;IAC9B,OAAO,CACL,aAAa,CAAC,cAAc;QAC5B,aAAa,CAAC,cAAc,CAAC,oBAAoB;QACjD,aAAa,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC,qBAAqB,CAAC,CAC3E,CAAC;AACJ,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,qBAAqB;IACnC,OAAO,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC;AAClF,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,yBAAyB;IACvC,IACE,OAAO,aAAa,CAAC,OAAO,KAAK,WAAW;QAC5C,aAAa,CAAC,OAAO,CAAC,GAAG;QACzB,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,KAAK,MAAM,EAClE;QACA,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { Platform } from 'react-native';\n\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { getExpoConstants } from './expomodules';\nimport { ReactNativeLibraries } from './rnlibraries';\n\n/** Checks if the React Native Hermes engine is running */\nexport function isHermesEnabled(): boolean {\n return !!RN_GLOBAL_OBJ.HermesInternal;\n}\n\n/** Checks if the React Native TurboModules are enabled */\nexport function isTurboModuleEnabled(): boolean {\n return RN_GLOBAL_OBJ.__turboModuleProxy != null;\n}\n\n/** Checks if the React Native Fabric renderer is running */\nexport function isFabricEnabled(): boolean {\n return RN_GLOBAL_OBJ.nativeFabricUIManager != null;\n}\n\n/** Returns React Native Version as semver string */\nexport function getReactNativeVersion(): string | undefined {\n if (!ReactNativeLibraries.ReactNativeVersion) {\n return undefined;\n }\n const RNV = ReactNativeLibraries.ReactNativeVersion.version;\n return `${RNV.major}.${RNV.minor}.${RNV.patch}${RNV.prerelease != null ? `-${RNV.prerelease}` : ''}`;\n}\n\n/** Checks if Expo is present in the runtime */\nexport function isExpo(): boolean {\n return RN_GLOBAL_OBJ.expo != null;\n}\n\n/** Check if JS runs in Expo Go */\nexport function isExpoGo(): boolean {\n const expoConstants = getExpoConstants();\n return (expoConstants && expoConstants.appOwnership) === 'expo';\n}\n\n/** Check Expo Go version if available */\nexport function getExpoGoVersion(): string | undefined {\n const expoConstants = getExpoConstants();\n return typeof expoConstants?.expoVersion === 'string' ? expoConstants.expoVersion : undefined;\n}\n\n/** Returns Expo SDK version if available */\nexport function getExpoSdkVersion(): string | undefined {\n const expoConstants = getExpoConstants();\n const [, expoSdkVersion] =\n typeof expoConstants?.manifest?.runtimeVersion === 'string' ? expoConstants.manifest.runtimeVersion.split(':') : [];\n return expoSdkVersion;\n}\n\n/** Checks if the current platform is not web */\nexport function notWeb(): boolean {\n return Platform.OS !== 'web';\n}\n\n/** Returns Hermes Version if hermes is present in the runtime */\nexport function getHermesVersion(): string | undefined {\n return (\n RN_GLOBAL_OBJ.HermesInternal &&\n RN_GLOBAL_OBJ.HermesInternal.getRuntimeProperties &&\n RN_GLOBAL_OBJ.HermesInternal.getRuntimeProperties()['OSS Release Version']\n );\n}\n\n/** Returns default environment based on __DEV__ */\nexport function getDefaultEnvironment(): 'development' | 'production' {\n return typeof __DEV__ !== 'undefined' && __DEV__ ? 'development' : 'production';\n}\n\n/** Check if SDK runs in Metro Dev Server side */\nexport function isRunningInMetroDevServer(): boolean {\n if (\n typeof RN_GLOBAL_OBJ.process !== 'undefined' &&\n RN_GLOBAL_OBJ.process.env &&\n RN_GLOBAL_OBJ.process.env.___SENTRY_METRO_DEV_SERVER___ === 'true'\n ) {\n return true;\n }\n return false;\n}\n"]}
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/js/utils/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO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,CAAC,OAAO,CAAC,GAAG;QACzB,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,KAAK,MAAM,EAClE;QACA,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { Platform } from 'react-native';\n\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { getExpoConstants } from './expomodules';\nimport { ReactNativeLibraries } from './rnlibraries';\n\n/** Checks if the React Native Hermes engine is running */\nexport function isHermesEnabled(): boolean {\n return !!RN_GLOBAL_OBJ.HermesInternal;\n}\n\n/** Checks if the React Native TurboModules are enabled */\nexport function isTurboModuleEnabled(): boolean {\n return RN_GLOBAL_OBJ.__turboModuleProxy != null;\n}\n\n/** Checks if the React Native Fabric renderer is running */\nexport function isFabricEnabled(): boolean {\n return RN_GLOBAL_OBJ.nativeFabricUIManager != null;\n}\n\n/** Returns React Native Version as semver string */\nexport function getReactNativeVersion(): string | undefined {\n if (!ReactNativeLibraries.ReactNativeVersion) {\n return undefined;\n }\n const RNV = ReactNativeLibraries.ReactNativeVersion.version;\n return `${RNV.major}.${RNV.minor}.${RNV.patch}${RNV.prerelease != null ? `-${RNV.prerelease}` : ''}`;\n}\n\n/** Checks if Expo is present in the runtime */\nexport function isExpo(): boolean {\n return RN_GLOBAL_OBJ.expo != null;\n}\n\n/** Check if JS runs in Expo Go */\nexport function isExpoGo(): boolean {\n const expoConstants = getExpoConstants();\n return (expoConstants && expoConstants.appOwnership) === 'expo';\n}\n\n/** Check Expo Go version if available */\nexport function getExpoGoVersion(): string | undefined {\n const expoConstants = getExpoConstants();\n return typeof expoConstants?.expoVersion === 'string' ? expoConstants.expoVersion : undefined;\n}\n\n/** Returns Expo SDK version if available */\nexport function getExpoSdkVersion(): string | undefined {\n const expoConstants = getExpoConstants();\n const [, expoSdkVersion] =\n typeof expoConstants?.manifest?.runtimeVersion === 'string' ? expoConstants.manifest.runtimeVersion.split(':') : [];\n return expoSdkVersion;\n}\n\n/** Checks if the current platform is not web */\nexport function notWeb(): boolean {\n return Platform.OS !== 'web';\n}\n\n/** Checks if the current platform is supported mobile platform (iOS or Android) */\nexport function isMobileOs(): boolean {\n return Platform.OS === 'ios' || Platform.OS === 'android';\n}\n\n/** Checks if the current platform is not supported mobile platform (iOS or Android) */\nexport function notMobileOs(): boolean {\n return !isMobileOs();\n}\n\n/** Returns Hermes Version if hermes is present in the runtime */\nexport function getHermesVersion(): string | undefined {\n return (\n RN_GLOBAL_OBJ.HermesInternal &&\n RN_GLOBAL_OBJ.HermesInternal.getRuntimeProperties &&\n RN_GLOBAL_OBJ.HermesInternal.getRuntimeProperties()['OSS Release Version']\n );\n}\n\n/** Returns default environment based on __DEV__ */\nexport function getDefaultEnvironment(): 'development' | 'production' {\n return typeof __DEV__ !== 'undefined' && __DEV__ ? 'development' : 'production';\n}\n\n/** Check if SDK runs in Metro Dev Server side */\nexport function isRunningInMetroDevServer(): boolean {\n if (\n typeof RN_GLOBAL_OBJ.process !== 'undefined' &&\n RN_GLOBAL_OBJ.process.env &&\n RN_GLOBAL_OBJ.process.env.___SENTRY_METRO_DEV_SERVER___ === 'true'\n ) {\n return true;\n }\n return false;\n}\n"]}
@@ -22,7 +22,13 @@ export interface ReactNativeInternalGlobal extends InternalGlobal {
22
22
  };
23
23
  __BUNDLE_START_TIME__?: number;
24
24
  nativePerformanceNow?: () => number;
25
+ TextEncoder?: TextEncoder;
25
26
  }
27
+ type TextEncoder = {
28
+ new (): TextEncoder;
29
+ encode(input?: string): Uint8Array;
30
+ };
26
31
  /** Get's the global object for the current JavaScript runtime */
27
32
  export declare const RN_GLOBAL_OBJ: ReactNativeInternalGlobal;
33
+ export {};
28
34
  //# sourceMappingURL=worldwide.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worldwide.d.ts","sourceRoot":"","sources":["../../../src/js/utils/worldwide.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,O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AAE;QACf,oBAAoB,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;KACjE,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,cAAc,CAAC;IACvC,OAAO,CAAC,EAAE;QACR,GAAG,CAAC,EAAE;YACJ,6BAA6B,CAAC,EAAE,MAAM,CAAC;SACxC,CAAC;KACH,CAAC;IACF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,MAAM,CAAC;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,KAAK,WAAW,GAAG;IACjB,QAAQ,WAAW,CAAC;IACpB,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CACpC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,aAAa,2BAA0C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"worldwide.js","sourceRoot":"","sources":["../../../src/js/utils/worldwide.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA2B3C,iEAAiE;AACjE,MAAM,CAAC,MAAM,aAAa,GAAG,UAAuC,CAAC","sourcesContent":["import type { InternalGlobal } from '@sentry/utils';\nimport { GLOBAL_OBJ } from '@sentry/utils';\nimport type { ErrorUtils } from 'react-native/types';\n\nimport type { ExpoGlobalObject } from './expoglobalobject';\n\n/** Internal Global object interface with common and Sentry specific properties */\nexport interface ReactNativeInternalGlobal extends InternalGlobal {\n __sentry_rn_v4_registered?: boolean;\n __sentry_rn_v5_registered?: boolean;\n HermesInternal?: {\n getRuntimeProperties?: () => Record<string, string | undefined>;\n };\n Promise: unknown;\n __turboModuleProxy: unknown;\n nativeFabricUIManager: unknown;\n ErrorUtils?: ErrorUtils;\n expo?: ExpoGlobalObject;\n XMLHttpRequest?: typeof XMLHttpRequest;\n process?: {\n env?: {\n ___SENTRY_METRO_DEV_SERVER___?: string;\n };\n };\n __BUNDLE_START_TIME__?: number;\n nativePerformanceNow?: () => number;\n}\n\n/** Get's the global object for the current JavaScript runtime */\nexport const RN_GLOBAL_OBJ = GLOBAL_OBJ as ReactNativeInternalGlobal;\n"]}
1
+ {"version":3,"file":"worldwide.js","sourceRoot":"","sources":["../../../src/js/utils/worldwide.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAiC3C,iEAAiE;AACjE,MAAM,CAAC,MAAM,aAAa,GAAG,UAAuC,CAAC","sourcesContent":["import type { InternalGlobal } from '@sentry/utils';\nimport { GLOBAL_OBJ } from '@sentry/utils';\nimport type { ErrorUtils } from 'react-native/types';\n\nimport type { ExpoGlobalObject } from './expoglobalobject';\n\n/** Internal Global object interface with common and Sentry specific properties */\nexport interface ReactNativeInternalGlobal extends InternalGlobal {\n __sentry_rn_v4_registered?: boolean;\n __sentry_rn_v5_registered?: boolean;\n HermesInternal?: {\n getRuntimeProperties?: () => Record<string, string | undefined>;\n };\n Promise: unknown;\n __turboModuleProxy: unknown;\n nativeFabricUIManager: unknown;\n ErrorUtils?: ErrorUtils;\n expo?: ExpoGlobalObject;\n XMLHttpRequest?: typeof XMLHttpRequest;\n process?: {\n env?: {\n ___SENTRY_METRO_DEV_SERVER___?: string;\n };\n };\n __BUNDLE_START_TIME__?: number;\n nativePerformanceNow?: () => number;\n TextEncoder?: TextEncoder;\n}\n\ntype TextEncoder = {\n new (): TextEncoder;\n encode(input?: string): Uint8Array;\n};\n\n/** Get's the global object for the current JavaScript runtime */\nexport const RN_GLOBAL_OBJ = GLOBAL_OBJ as ReactNativeInternalGlobal;\n"]}
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "5.24.1";
3
+ export declare const SDK_VERSION = "5.25.0-alpha.2";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAC3D,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AACzD,eAAO,MAAM,WAAW,WAAW,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAC3D,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AACzD,eAAO,MAAM,WAAW,mBAAmB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';
2
2
  export const SDK_NAME = 'sentry.javascript.react-native';
3
- export const SDK_VERSION = '5.24.1';
3
+ export const SDK_VERSION = '5.25.0-alpha.2';
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.24.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.25.0-alpha.2';\n"]}
@@ -4,6 +4,7 @@ import type { NativeAppStartResponse, NativeDeviceContextsResponse, NativeFrames
4
4
  import type { ReactNativeClientOptions } from './options';
5
5
  import type * as Hermes from './profiling/hermes';
6
6
  import type { NativeAndroidProfileEvent, NativeProfileEvent } from './profiling/nativeTypes';
7
+ import type { MobileReplayOptions } from './replay/mobilereplay';
7
8
  /**
8
9
  * Returns the RNSentry module. Dynamically resolves if NativeModule or TurboModule is used.
9
10
  */
@@ -13,6 +14,9 @@ export interface Screenshot {
13
14
  contentType: string;
14
15
  filename: string;
15
16
  }
17
+ export type NativeSdkOptions = Partial<ReactNativeClientOptions> & {
18
+ mobileReplayOptions: MobileReplayOptions | undefined;
19
+ };
16
20
  interface SentryNativeWrapper {
17
21
  enableNative: boolean;
18
22
  nativeIsReady: boolean;
@@ -29,7 +33,7 @@ interface SentryNativeWrapper {
29
33
  };
30
34
  _isModuleLoaded(module: Spec | undefined): module is Spec;
31
35
  isNativeAvailable(): boolean;
32
- initNativeSdk(options: Partial<ReactNativeClientOptions>): PromiseLike<boolean>;
36
+ initNativeSdk(options: NativeSdkOptions): PromiseLike<boolean>;
33
37
  closeNativeSdk(): PromiseLike<void>;
34
38
  sendEnvelope(envelope: Envelope): Promise<void>;
35
39
  captureScreenshot(): Promise<Screenshot[] | null>;
@@ -63,6 +67,8 @@ interface SentryNativeWrapper {
63
67
  */
64
68
  fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | null;
65
69
  initNativeReactNavigationNewFrameTracking(): Promise<void>;
70
+ captureReplay(isHardCrash: boolean): Promise<string | null>;
71
+ getCurrentReplayId(): string | null;
66
72
  }
67
73
  /**
68
74
  * Our internal interface for calling native funct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AAG,IAAI,CAAC;IAET,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAAC;IAExC;;OAEG;IACH,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,iBAAiB,GAAG,IAAI,CAAC;IAC/E,yCAAyC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC5D,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAAC;CACrC;AAID;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,mBAimBpB,CAAC"}
@@ -458,6 +458,30 @@ export const NATIVE = {
458
458
  return RNSentry.initNativeReactNavigationNewFrameTracking();
459
459
  });
460
460
  },
461
+ captureReplay(isHardCrash) {
462
+ return __awaiter(this, void 0, void 0, function* () {
463
+ if (!this.enableNative) {
464
+ logger.warn(`[NATIVE] \`${this.captureReplay.name}\` is not available when native is disabled.`);
465
+ return Promise.resolve(null);
466
+ }
467
+ if (!this._isModuleLoaded(RNSentry)) {
468
+ logger.warn(`[NATIVE] \`${this.captureReplay.name}\` is not available when native is not available.`);
469
+ return Promise.resolve(null);
470
+ }
471
+ return (yield RNSentry.captureReplay(isHardCrash)) || null;
472
+ });
473
+ },
474
+ getCurrentReplayId() {
475
+ if (!this.enableNative) {
476
+ logger.warn(`[NATIVE] \`${this.getCurrentReplayId.name}\` is not available when native is disabled.`);
477
+ return null;
478
+ }
479
+ if (!this._isModuleLoaded(RNSentry)) {
480
+ logger.warn(`[NATIVE] \`${this.getCurrentReplayId.name}\` is not available when native is not available.`);
481
+ return null;
482
+ }
483
+ return RNSentry.getCurrentReplayId() || null;
484
+ },
461
485
  /**
462
486
  * Gets the event from envelopeItem and applies the level filter to the selected event.
463
487
  * @param data An envelope item containing the event.