@depup/sentry__react 10.44.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/build/cjs/constants.js +12 -0
  4. package/build/cjs/constants.js.map +1 -0
  5. package/build/cjs/debug-build.js +11 -0
  6. package/build/cjs/debug-build.js.map +1 -0
  7. package/build/cjs/error.js +113 -0
  8. package/build/cjs/error.js.map +1 -0
  9. package/build/cjs/errorboundary.js +170 -0
  10. package/build/cjs/errorboundary.js.map +1 -0
  11. package/build/cjs/hoist-non-react-statics.js +159 -0
  12. package/build/cjs/hoist-non-react-statics.js.map +1 -0
  13. package/build/cjs/index.js +51 -0
  14. package/build/cjs/index.js.map +1 -0
  15. package/build/cjs/profiler.js +226 -0
  16. package/build/cjs/profiler.js.map +1 -0
  17. package/build/cjs/reactrouter-compat-utils/instrumentation.js +1295 -0
  18. package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -0
  19. package/build/cjs/reactrouter-compat-utils/lazy-routes.js +160 -0
  20. package/build/cjs/reactrouter-compat-utils/lazy-routes.js.map +1 -0
  21. package/build/cjs/reactrouter-compat-utils/route-manifest.js +194 -0
  22. package/build/cjs/reactrouter-compat-utils/route-manifest.js.map +1 -0
  23. package/build/cjs/reactrouter-compat-utils/utils.js +336 -0
  24. package/build/cjs/reactrouter-compat-utils/utils.js.map +1 -0
  25. package/build/cjs/reactrouter.js +236 -0
  26. package/build/cjs/reactrouter.js.map +1 -0
  27. package/build/cjs/reactrouterv3.js +130 -0
  28. package/build/cjs/reactrouterv3.js.map +1 -0
  29. package/build/cjs/reactrouterv6.js +61 -0
  30. package/build/cjs/reactrouterv6.js.map +1 -0
  31. package/build/cjs/reactrouterv7.js +61 -0
  32. package/build/cjs/reactrouterv7.js.map +1 -0
  33. package/build/cjs/redux.js +106 -0
  34. package/build/cjs/redux.js.map +1 -0
  35. package/build/cjs/sdk.js +21 -0
  36. package/build/cjs/sdk.js.map +1 -0
  37. package/build/cjs/tanstackrouter.js +134 -0
  38. package/build/cjs/tanstackrouter.js.map +1 -0
  39. package/build/esm/constants.js +8 -0
  40. package/build/esm/constants.js.map +1 -0
  41. package/build/esm/debug-build.js +9 -0
  42. package/build/esm/debug-build.js.map +1 -0
  43. package/build/esm/error.js +108 -0
  44. package/build/esm/error.js.map +1 -0
  45. package/build/esm/errorboundary.js +166 -0
  46. package/build/esm/errorboundary.js.map +1 -0
  47. package/build/esm/hoist-non-react-statics.js +157 -0
  48. package/build/esm/hoist-non-react-statics.js.map +1 -0
  49. package/build/esm/index.js +12 -0
  50. package/build/esm/index.js.map +1 -0
  51. package/build/esm/package.json +1 -0
  52. package/build/esm/profiler.js +221 -0
  53. package/build/esm/profiler.js.map +1 -0
  54. package/build/esm/reactrouter-compat-utils/instrumentation.js +1281 -0
  55. package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -0
  56. package/build/esm/reactrouter-compat-utils/lazy-routes.js +156 -0
  57. package/build/esm/reactrouter-compat-utils/lazy-routes.js.map +1 -0
  58. package/build/esm/reactrouter-compat-utils/route-manifest.js +191 -0
  59. package/build/esm/reactrouter-compat-utils/route-manifest.js.map +1 -0
  60. package/build/esm/reactrouter-compat-utils/utils.js +320 -0
  61. package/build/esm/reactrouter-compat-utils/utils.js.map +1 -0
  62. package/build/esm/reactrouter.js +232 -0
  63. package/build/esm/reactrouter.js.map +1 -0
  64. package/build/esm/reactrouterv3.js +128 -0
  65. package/build/esm/reactrouterv3.js.map +1 -0
  66. package/build/esm/reactrouterv6.js +55 -0
  67. package/build/esm/reactrouterv6.js.map +1 -0
  68. package/build/esm/reactrouterv7.js +55 -0
  69. package/build/esm/reactrouterv7.js.map +1 -0
  70. package/build/esm/redux.js +104 -0
  71. package/build/esm/redux.js.map +1 -0
  72. package/build/esm/sdk.js +19 -0
  73. package/build/esm/sdk.js.map +1 -0
  74. package/build/esm/tanstackrouter.js +132 -0
  75. package/build/esm/tanstackrouter.js.map +1 -0
  76. package/build/types/constants.d.ts +4 -0
  77. package/build/types/constants.d.ts.map +1 -0
  78. package/build/types/debug-build.d.ts +7 -0
  79. package/build/types/debug-build.d.ts.map +1 -0
  80. package/build/types/error.d.ts +41 -0
  81. package/build/types/error.d.ts.map +1 -0
  82. package/build/types/errorboundary.d.ts +87 -0
  83. package/build/types/errorboundary.d.ts.map +1 -0
  84. package/build/types/hoist-non-react-statics.d.ts +21 -0
  85. package/build/types/hoist-non-react-statics.d.ts.map +1 -0
  86. package/build/types/index.d.ts +13 -0
  87. package/build/types/index.d.ts.map +1 -0
  88. package/build/types/profiler.d.ts +56 -0
  89. package/build/types/profiler.d.ts.map +1 -0
  90. package/build/types/reactrouter-compat-utils/index.d.ts +5 -0
  91. package/build/types/reactrouter-compat-utils/index.d.ts.map +1 -0
  92. package/build/types/reactrouter-compat-utils/instrumentation.d.ts +117 -0
  93. package/build/types/reactrouter-compat-utils/instrumentation.d.ts.map +1 -0
  94. package/build/types/reactrouter-compat-utils/lazy-routes.d.ts +18 -0
  95. package/build/types/reactrouter-compat-utils/lazy-routes.d.ts.map +1 -0
  96. package/build/types/reactrouter-compat-utils/route-manifest.d.ts +13 -0
  97. package/build/types/reactrouter-compat-utils/route-manifest.d.ts.map +1 -0
  98. package/build/types/reactrouter-compat-utils/utils.d.ts +71 -0
  99. package/build/types/reactrouter-compat-utils/utils.d.ts.map +1 -0
  100. package/build/types/reactrouter.d.ts +41 -0
  101. package/build/types/reactrouter.d.ts.map +1 -0
  102. package/build/types/reactrouterv3.d.ts +29 -0
  103. package/build/types/reactrouterv3.d.ts.map +1 -0
  104. package/build/types/reactrouterv6.d.ts +32 -0
  105. package/build/types/reactrouterv6.d.ts.map +1 -0
  106. package/build/types/reactrouterv7.d.ts +32 -0
  107. package/build/types/reactrouterv7.d.ts.map +1 -0
  108. package/build/types/redux.d.ts +38 -0
  109. package/build/types/redux.d.ts.map +1 -0
  110. package/build/types/sdk.d.ts +7 -0
  111. package/build/types/sdk.d.ts.map +1 -0
  112. package/build/types/tanstackrouter.d.ts +13 -0
  113. package/build/types/tanstackrouter.d.ts.map +1 -0
  114. package/build/types/types.d.ts +163 -0
  115. package/build/types/types.d.ts.map +1 -0
  116. package/build/types/vendor/tanstackrouter-types.d.ts +36 -0
  117. package/build/types/vendor/tanstackrouter-types.d.ts.map +1 -0
  118. package/build/types-ts3.8/constants.d.ts +4 -0
  119. package/build/types-ts3.8/debug-build.d.ts +7 -0
  120. package/build/types-ts3.8/error.d.ts +41 -0
  121. package/build/types-ts3.8/errorboundary.d.ts +87 -0
  122. package/build/types-ts3.8/hoist-non-react-statics.d.ts +21 -0
  123. package/build/types-ts3.8/index.d.ts +13 -0
  124. package/build/types-ts3.8/profiler.d.ts +56 -0
  125. package/build/types-ts3.8/reactrouter-compat-utils/index.d.ts +5 -0
  126. package/build/types-ts3.8/reactrouter-compat-utils/instrumentation.d.ts +117 -0
  127. package/build/types-ts3.8/reactrouter-compat-utils/lazy-routes.d.ts +18 -0
  128. package/build/types-ts3.8/reactrouter-compat-utils/route-manifest.d.ts +13 -0
  129. package/build/types-ts3.8/reactrouter-compat-utils/utils.d.ts +77 -0
  130. package/build/types-ts3.8/reactrouter.d.ts +41 -0
  131. package/build/types-ts3.8/reactrouterv3.d.ts +29 -0
  132. package/build/types-ts3.8/reactrouterv6.d.ts +32 -0
  133. package/build/types-ts3.8/reactrouterv7.d.ts +32 -0
  134. package/build/types-ts3.8/redux.d.ts +38 -0
  135. package/build/types-ts3.8/sdk.d.ts +7 -0
  136. package/build/types-ts3.8/tanstackrouter.d.ts +13 -0
  137. package/build/types-ts3.8/types.d.ts +163 -0
  138. package/build/types-ts3.8/vendor/tanstackrouter-types.d.ts +36 -0
  139. package/changes.json +5 -0
  140. package/package.json +108 -0
@@ -0,0 +1,226 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const browser = require('@sentry/browser');
4
+ const core = require('@sentry/core');
5
+ const React = require('react');
6
+ const constants = require('./constants.js');
7
+ const hoistNonReactStatics = require('./hoist-non-react-statics.js');
8
+
9
+ const UNKNOWN_COMPONENT = 'unknown';
10
+
11
+ /**
12
+ * The Profiler component leverages Sentry's Tracing integration to generate
13
+ * spans based on component lifecycles.
14
+ */
15
+ class Profiler extends React.Component {
16
+ /**
17
+ * The span of the mount activity
18
+ * Made protected for the React Native SDK to access
19
+ */
20
+
21
+ /**
22
+ * The span that represents the duration of time between shouldComponentUpdate and componentDidUpdate
23
+ */
24
+
25
+ constructor(props) {
26
+ super(props);
27
+ const { name, disabled = false } = this.props;
28
+
29
+ if (disabled) {
30
+ return;
31
+ }
32
+
33
+ this._mountSpan = browser.startInactiveSpan({
34
+ name: `<${name}>`,
35
+ onlyIfParent: true,
36
+ op: constants.REACT_MOUNT_OP,
37
+ attributes: {
38
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',
39
+ 'ui.component_name': name,
40
+ },
41
+ });
42
+ }
43
+
44
+ // If a component mounted, we can finish the mount activity.
45
+ componentDidMount() {
46
+ if (this._mountSpan) {
47
+ this._mountSpan.end();
48
+ }
49
+ }
50
+
51
+ shouldComponentUpdate({ updateProps, includeUpdates = true }) {
52
+ // Only generate an update span if includeUpdates is true, if there is a valid mountSpan,
53
+ // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.
54
+ // We are just trying to give baseline clues for further investigation.
55
+ if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {
56
+ // See what props have changed between the previous props, and the current props. This is
57
+ // set as data on the span. We just store the prop keys as the values could be potentially very large.
58
+ const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
59
+ if (changedProps.length > 0) {
60
+ const now = core.timestampInSeconds();
61
+ this._updateSpan = core.withActiveSpan(this._mountSpan, () => {
62
+ return browser.startInactiveSpan({
63
+ name: `<${this.props.name}>`,
64
+ onlyIfParent: true,
65
+ op: constants.REACT_UPDATE_OP,
66
+ startTime: now,
67
+ attributes: {
68
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',
69
+ 'ui.component_name': this.props.name,
70
+ 'ui.react.changed_props': changedProps,
71
+ },
72
+ });
73
+ });
74
+ }
75
+ }
76
+
77
+ return true;
78
+ }
79
+
80
+ componentDidUpdate() {
81
+ if (this._updateSpan) {
82
+ this._updateSpan.end();
83
+ this._updateSpan = undefined;
84
+ }
85
+ }
86
+
87
+ // If a component is unmounted, we can say it is no longer on the screen.
88
+ // This means we can finish the span representing the component render.
89
+ componentWillUnmount() {
90
+ const endTimestamp = core.timestampInSeconds();
91
+ const { name, includeRender = true } = this.props;
92
+
93
+ if (this._mountSpan && includeRender) {
94
+ const startTime = core.spanToJSON(this._mountSpan).timestamp;
95
+ core.withActiveSpan(this._mountSpan, () => {
96
+ const renderSpan = browser.startInactiveSpan({
97
+ onlyIfParent: true,
98
+ name: `<${name}>`,
99
+ op: constants.REACT_RENDER_OP,
100
+ startTime,
101
+ attributes: {
102
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',
103
+ 'ui.component_name': name,
104
+ },
105
+ });
106
+ if (renderSpan) {
107
+ // Have to cast to Span because the type of _mountSpan is Span | undefined
108
+ // and not getting narrowed properly
109
+ renderSpan.end(endTimestamp);
110
+ }
111
+ });
112
+ }
113
+ }
114
+
115
+ render() {
116
+ return this.props.children;
117
+ }
118
+ }
119
+
120
+ // React.Component default props are defined as static property on the class
121
+ Object.assign(Profiler, {
122
+ defaultProps: {
123
+ disabled: false,
124
+ includeRender: true,
125
+ includeUpdates: true,
126
+ },
127
+ });
128
+
129
+ /**
130
+ * withProfiler is a higher order component that wraps a
131
+ * component in a {@link Profiler} component. It is recommended that
132
+ * the higher order component be used over the regular {@link Profiler} component.
133
+ *
134
+ * @param WrappedComponent component that is wrapped by Profiler
135
+ * @param options the {@link ProfilerProps} you can pass into the Profiler
136
+ */
137
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
138
+ function withProfiler(
139
+ WrappedComponent,
140
+ // We do not want to have `updateProps` given in options, it is instead filled through the HOC.
141
+ options,
142
+ ) {
143
+ const componentDisplayName =
144
+ options?.name || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;
145
+
146
+ const Wrapped = (props) => (
147
+ React.createElement(Profiler, { ...options, name: componentDisplayName, updateProps: props,}
148
+ , React.createElement(WrappedComponent, { ...props,} )
149
+ )
150
+ );
151
+
152
+ Wrapped.displayName = `profiler(${componentDisplayName})`;
153
+
154
+ // Copy over static methods from Wrapped component to Profiler HOC
155
+ // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over
156
+ hoistNonReactStatics.hoistNonReactStatics(Wrapped, WrappedComponent);
157
+ return Wrapped;
158
+ }
159
+
160
+ /**
161
+ *
162
+ * `useProfiler` is a React hook that profiles a React component.
163
+ *
164
+ * Requires React 16.8 or above.
165
+ * @param name displayName of component being profiled
166
+ */
167
+ function useProfiler(
168
+ name,
169
+ options = {
170
+ disabled: false,
171
+ hasRenderSpan: true,
172
+ },
173
+ ) {
174
+ const [mountSpan] = React.useState(() => {
175
+ if (options?.disabled) {
176
+ return undefined;
177
+ }
178
+
179
+ return browser.startInactiveSpan({
180
+ name: `<${name}>`,
181
+ onlyIfParent: true,
182
+ op: constants.REACT_MOUNT_OP,
183
+ attributes: {
184
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',
185
+ 'ui.component_name': name,
186
+ },
187
+ });
188
+ });
189
+
190
+ React.useEffect(() => {
191
+ if (mountSpan) {
192
+ mountSpan.end();
193
+ }
194
+
195
+ return () => {
196
+ if (mountSpan && options.hasRenderSpan) {
197
+ const startTime = core.spanToJSON(mountSpan).timestamp;
198
+ const endTimestamp = core.timestampInSeconds();
199
+
200
+ const renderSpan = browser.startInactiveSpan({
201
+ name: `<${name}>`,
202
+ onlyIfParent: true,
203
+ op: constants.REACT_RENDER_OP,
204
+ startTime,
205
+ attributes: {
206
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',
207
+ 'ui.component_name': name,
208
+ },
209
+ });
210
+ if (renderSpan) {
211
+ // Have to cast to Span because the type of _mountSpan is Span | undefined
212
+ // and not getting narrowed properly
213
+ renderSpan.end(endTimestamp);
214
+ }
215
+ }
216
+ };
217
+ // We only want this to run once.
218
+ // eslint-disable-next-line react-hooks/exhaustive-deps
219
+ }, []);
220
+ }
221
+
222
+ exports.Profiler = Profiler;
223
+ exports.UNKNOWN_COMPONENT = UNKNOWN_COMPONENT;
224
+ exports.useProfiler = useProfiler;
225
+ exports.withProfiler = withProfiler;
226
+ //# sourceMappingURL=profiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiler.js","sources":["../../src/profiler.tsx"],"sourcesContent":["import { startInactiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, timestampInSeconds, withActiveSpan } from '@sentry/core';\nimport * as React from 'react';\nimport { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP } from './constants';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type ProfilerProps = {\n // The name of the component being profiled.\n name: string;\n // If the Profiler is disabled. False by default. This is useful if you want to disable profilers\n // in certain environments.\n disabled?: boolean;\n // If time component is on page should be displayed as spans. True by default.\n includeRender?: boolean;\n // If component updates should be displayed as spans. True by default.\n includeUpdates?: boolean;\n // Component that is being profiled.\n children?: React.ReactNode;\n // props given to component being profiled.\n updateProps: { [key: string]: unknown };\n};\n\n/**\n * The Profiler component leverages Sentry's Tracing integration to generate\n * spans based on component lifecycles.\n */\nclass Profiler extends React.Component<ProfilerProps> {\n /**\n * The span of the mount activity\n * Made protected for the React Native SDK to access\n */\n protected _mountSpan: Span | undefined;\n /**\n * The span that represents the duration of time between shouldComponentUpdate and componentDidUpdate\n */\n protected _updateSpan: Span | undefined;\n\n public constructor(props: ProfilerProps) {\n super(props);\n const { name, disabled = false } = this.props;\n\n if (disabled) {\n return;\n }\n\n this._mountSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_MOUNT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n }\n\n // If a component mounted, we can finish the mount activity.\n public componentDidMount(): void {\n if (this._mountSpan) {\n this._mountSpan.end();\n }\n }\n\n public shouldComponentUpdate({ updateProps, includeUpdates = true }: ProfilerProps): boolean {\n // Only generate an update span if includeUpdates is true, if there is a valid mountSpan,\n // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.\n // We are just trying to give baseline clues for further investigation.\n if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {\n // See what props have changed between the previous props, and the current props. This is\n // set as data on the span. We just store the prop keys as the values could be potentially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n const now = timestampInSeconds();\n this._updateSpan = withActiveSpan(this._mountSpan, () => {\n return startInactiveSpan({\n name: `<${this.props.name}>`,\n onlyIfParent: true,\n op: REACT_UPDATE_OP,\n startTime: now,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': this.props.name,\n 'ui.react.changed_props': changedProps,\n },\n });\n });\n }\n }\n\n return true;\n }\n\n public componentDidUpdate(): void {\n if (this._updateSpan) {\n this._updateSpan.end();\n this._updateSpan = undefined;\n }\n }\n\n // If a component is unmounted, we can say it is no longer on the screen.\n // This means we can finish the span representing the component render.\n public componentWillUnmount(): void {\n const endTimestamp = timestampInSeconds();\n const { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n const startTime = spanToJSON(this._mountSpan).timestamp;\n withActiveSpan(this._mountSpan, () => {\n const renderSpan = startInactiveSpan({\n onlyIfParent: true,\n name: `<${name}>`,\n op: REACT_RENDER_OP,\n startTime,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n });\n }\n }\n\n public render(): React.ReactNode {\n return this.props.children;\n }\n}\n\n// React.Component default props are defined as static property on the class\nObject.assign(Profiler, {\n defaultProps: {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n },\n});\n\n/**\n * withProfiler is a higher order component that wraps a\n * component in a {@link Profiler} component. It is recommended that\n * the higher order component be used over the regular {@link Profiler} component.\n *\n * @param WrappedComponent component that is wrapped by Profiler\n * @param options the {@link ProfilerProps} you can pass into the Profiler\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withProfiler<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n // We do not want to have `updateProps` given in options, it is instead filled through the HOC.\n options?: Pick<Partial<ProfilerProps>, Exclude<keyof ProfilerProps, 'updateProps' | 'children'>>,\n): React.FC<P> {\n const componentDisplayName =\n options?.name || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <Profiler {...options} name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </Profiler>\n );\n\n Wrapped.displayName = `profiler(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\n/**\n *\n * `useProfiler` is a React hook that profiles a React component.\n *\n * Requires React 16.8 or above.\n * @param name displayName of component being profiled\n */\nfunction useProfiler(\n name: string,\n options: { disabled?: boolean; hasRenderSpan?: boolean } = {\n disabled: false,\n hasRenderSpan: true,\n },\n): void {\n const [mountSpan] = React.useState(() => {\n if (options?.disabled) {\n return undefined;\n }\n\n return startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_MOUNT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.end();\n }\n\n return (): void => {\n if (mountSpan && options.hasRenderSpan) {\n const startTime = spanToJSON(mountSpan).timestamp;\n const endTimestamp = timestampInSeconds();\n\n const renderSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_RENDER_OP,\n startTime,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n }\n };\n // We only want this to run once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport { Profiler, useProfiler, withProfiler };\n"],"names":["startInactiveSpan","REACT_MOUNT_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","timestampInSeconds","withActiveSpan","REACT_UPDATE_OP","spanToJSON","REACT_RENDER_OP","hoistNonReactStatics"],"mappings":";;;;;;;;AAOO,MAAM,iBAAA,GAAoB;;AAkBjC;AACA;AACA;AACA;AACA,MAAM,QAAA,SAAiB,KAAK,CAAC,SAAS,CAAgB;AACtD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAGA,GAAS,WAAW,CAAC,KAAK,EAAiB;AAC3C,IAAI,KAAK,CAAC,KAAK,CAAC;AAChB,IAAI,MAAM,EAAE,IAAI,EAAE,QAAA,GAAW,KAAA,EAAM,GAAI,IAAI,CAAC,KAAK;;AAEjD,IAAI,IAAI,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