@sentry/react-native 5.28.0 → 5.29.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 (35) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/android/build.gradle +1 -1
  3. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  4. package/dist/js/tracing/reactnavigation.js +9 -25
  5. package/dist/js/tracing/reactnavigation.js.map +1 -1
  6. package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
  7. package/dist/js/tracing/timetodisplay.js +2 -0
  8. package/dist/js/tracing/timetodisplay.js.map +1 -1
  9. package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
  10. package/dist/js/tracing/timetodisplaynative.js +5 -3
  11. package/dist/js/tracing/timetodisplaynative.js.map +1 -1
  12. package/dist/js/tracing/utils.d.ts +8 -2
  13. package/dist/js/tracing/utils.d.ts.map +1 -1
  14. package/dist/js/tracing/utils.js +13 -3
  15. package/dist/js/tracing/utils.js.map +1 -1
  16. package/dist/js/utils/normalize.d.ts.map +1 -1
  17. package/dist/js/utils/normalize.js +8 -5
  18. package/dist/js/utils/normalize.js.map +1 -1
  19. package/dist/js/utils/rnlibraries.d.ts.map +1 -1
  20. package/dist/js/utils/rnlibraries.js +6 -0
  21. package/dist/js/utils/rnlibraries.js.map +1 -1
  22. package/dist/js/utils/rnlibrariesinterface.d.ts +3 -0
  23. package/dist/js/utils/rnlibrariesinterface.d.ts.map +1 -1
  24. package/dist/js/utils/rnlibrariesinterface.js.map +1 -1
  25. package/dist/js/vendor/react-native/index.d.ts +4 -0
  26. package/dist/js/vendor/react-native/index.d.ts.map +1 -1
  27. package/dist/js/vendor/react-native/index.js.map +1 -1
  28. package/dist/js/version.d.ts +1 -1
  29. package/dist/js/version.js +1 -1
  30. package/dist/js/version.js.map +1 -1
  31. package/package.json +13 -12
  32. package/ts3.8/dist/js/tracing/utils.d.ts +8 -2
  33. package/ts3.8/dist/js/utils/rnlibrariesinterface.d.ts +3 -0
  34. package/ts3.8/dist/js/vendor/react-native/index.d.ts +4 -0
  35. package/ts3.8/dist/js/version.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.29.0
4
+
5
+ ### Features
6
+
7
+ - `TimeToInitialDisplay` and `TimeToFullDisplay` start the time to display spans on mount ([#4020](https://github.com/getsentry/sentry-react-native/pull/4020))
8
+
9
+ ### Fixed
10
+
11
+ - fix(ttid): End and measure TTID regardless current active span ([#4019](https://github.com/getsentry/sentry-react-native/pull/4019))
12
+ - Fixes possible missing TTID measurements and spans
13
+ - Fix crash when passing array as data to `Sentry.addBreadcrumb({ data: [] })` ([#4021](https://github.com/getsentry/sentry-react-native/pull/4021))
14
+ - The expected `data` type is plain JS object, otherwise the data might be lost.
15
+ - Fix `requireNativeComponent` missing in `react-native-web` ([#3958](https://github.com/getsentry/sentry-react-native/pull/3958))
16
+
17
+ ### Dependencies
18
+
19
+ - Bump JavaScript SDK from v7.117.0 to v7.118.0 ([#4018](https://github.com/getsentry/sentry-react-native/pull/4018))
20
+ - [changelog](https://github.com/getsentry/sentry-javascript/blob/v7/CHANGELOG.md#71180)
21
+ - [diff](https://github.com/getsentry/sentry-javascript/compare/7.117.0...7.118.0)
22
+ - Bump Android SDK from v7.13.0 to v7.14.0 ([#4022](https://github.com/getsentry/sentry-react-native/pull/4022))
23
+ - [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7140)
24
+ - [diff](https://github.com/getsentry/sentry-java/compare/7.13.0...7.14.0)
25
+
3
26
  ## 5.28.0
4
27
 
5
28
  ### Fixes
@@ -54,5 +54,5 @@ android {
54
54
 
55
55
  dependencies {
56
56
  implementation 'com.facebook.react:react-native:+'
57
- api 'io.sentry:sentry-android:7.13.0'
57
+ api 'io.sentry:sentry-android:7.14.0'
58
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reactnavigation.d.ts","sourceRoot":"","sources":["../../../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BAAkB,CAAC,CAAkB;IAC7C,OAAO,CAAC,yBAAyB,CAAC,CAAO;IAEzC,OAAO,CAAC,oBAAoB,CAAkB;IAC9C,OAAO,CAAC,mBAAmB,CAAC,CAAqB;IACjD,OAAO,CAAC,gBAAgB,CAAgB;IAExC,OAAO,CAAC,QAAQ,CAAyB;gBAEtB,OAAO,GAAE,OAAO,CAAC,sBAAsB,CAAM;IAiBhE;;OAEG;IACI,8BAA8B,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC7B,IAAI;IAeP;;;OAGG;IAEI,2BAA2B,CAAC,sBAAsB,EAAE,GAAG,GAAG,IAAI;IAgDrE;;;;OAIG;IACH,OAAO,CAAC,WAAW;IA2BnB;;OAEG;IACH,OAAO,CAAC,cAAc;IAyGtB,4DAA4D;IAC5D,OAAO,CAAC,oBAAoB;IA4B5B,sGAAsG;IACtG,OAAO,CAAC,mBAAmB,CAMzB;IAEF,wEAAwE;IACxE,OAAO,CAAC,yBAAyB;IAWjC;;OAEG;IACH,OAAO,CAAC,wBAAwB;CAMjC;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,uCAAiC,CAAC;AAE/E,eAAO,MAAM,yBAAyB;;;;;;;CAOrC,CAAC"}
@@ -1,12 +1,12 @@
1
1
  /* eslint-disable max-lines */
2
- import { getActiveSpan, setMeasurement, spanToJSON, startInactiveSpan } from '@sentry/core';
2
+ import { getActiveSpan, startInactiveSpan } from '@sentry/core';
3
3
  import { logger, timestampInSeconds } from '@sentry/utils';
4
4
  import { createSentryEventEmitter, NewFrameEventName } from '../utils/sentryeventemitter';
5
5
  import { RN_GLOBAL_OBJ } from '../utils/worldwide';
6
6
  import { NATIVE } from '../wrapper';
7
7
  import { InternalRoutingInstrumentation } from './routingInstrumentation';
8
8
  import { manualInitialDisplaySpans, startTimeToInitialDisplaySpan } from './timetodisplay';
9
- import { customTransactionSource, defaultTransactionSource, getBlankTransactionContext } from './utils';
9
+ import { customTransactionSource, defaultTransactionSource, getBlankTransactionContext, setSpanDurationAsMeasurementOnTransaction, } from './utils';
10
10
  const defaultOptions = {
11
11
  routeChangeTimeoutMs: 1000,
12
12
  enableTimeToInitialDisplay: false,
@@ -142,6 +142,7 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati
142
142
  if (this._latestTransaction) {
143
143
  if (!previousRoute || previousRoute.key !== route.key) {
144
144
  const routeHasBeenSeen = this._recentRouteKeys.includes(route.key);
145
+ const latestTransaction = this._latestTransaction;
145
146
  const latestTtidSpan = !routeHasBeenSeen &&
146
147
  this._options.enableTimeToInitialDisplay &&
147
148
  startTimeToInitialDisplaySpan({
@@ -149,39 +150,22 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati
149
150
  isAutoInstrumented: true,
150
151
  });
151
152
  !routeHasBeenSeen &&
153
+ latestTtidSpan &&
152
154
  ((_a = this._newScreenFrameEventEmitter) === null || _a === void 0 ? void 0 : _a.once(NewFrameEventName, ({ newFrameTimestampInSeconds }) => {
153
- var _a;
154
155
  const activeSpan = getActiveSpan();
155
- if (!activeSpan) {
156
- logger.warn('[ReactNavigationInstrumentation] No active span found to attach ui.load.initial_display to.');
157
- return;
158
- }
159
- if (manualInitialDisplaySpans.has(activeSpan)) {
156
+ if (activeSpan && manualInitialDisplaySpans.has(activeSpan)) {
160
157
  logger.warn('[ReactNavigationInstrumentation] Detected manual instrumentation for the current active span.');
161
158
  return;
162
159
  }
163
- if (!latestTtidSpan) {
164
- return;
165
- }
166
- if (spanToJSON(latestTtidSpan).parent_span_id !== ((_a = getActiveSpan()) === null || _a === void 0 ? void 0 : _a.spanContext().spanId)) {
167
- logger.warn('[ReactNavigationInstrumentation] Currently Active Span changed before the new frame was rendered, _latestTtidSpan is not a child of the currently active span.');
168
- return;
169
- }
170
160
  latestTtidSpan.setStatus('ok');
171
161
  latestTtidSpan.end(newFrameTimestampInSeconds);
172
- const ttidSpan = spanToJSON(latestTtidSpan);
173
- const ttidSpanEnd = ttidSpan.timestamp;
174
- const ttidSpanStart = ttidSpan.start_timestamp;
175
- if (!ttidSpanEnd || !ttidSpanStart) {
176
- return;
177
- }
178
- setMeasurement('time_to_initial_display', (ttidSpanEnd - ttidSpanStart) * 1000, 'millisecond');
162
+ setSpanDurationAsMeasurementOnTransaction(latestTransaction, 'time_to_initial_display', latestTtidSpan);
179
163
  }));
180
164
  (_b = this._navigationProcessingSpan) === null || _b === void 0 ? void 0 : _b.updateName(`Processing navigation to ${route.name}`);
181
165
  (_c = this._navigationProcessingSpan) === null || _c === void 0 ? void 0 : _c.setStatus('ok');
182
166
  (_d = this._navigationProcessingSpan) === null || _d === void 0 ? void 0 : _d.end(stateChangedTimestamp);
183
167
  this._navigationProcessingSpan = undefined;
184
- const originalContext = this._latestTransaction.toContext();
168
+ const originalContext = latestTransaction.toContext();
185
169
  const data = Object.assign(Object.assign({}, originalContext.data), { route: {
186
170
  name: route.name,
187
171
  key: route.key,
@@ -198,9 +182,9 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati
198
182
  : null });
199
183
  const updatedContext = Object.assign(Object.assign({}, originalContext), { name: route.name, tags: Object.assign(Object.assign({}, originalContext.tags), { 'routing.route.name': route.name }), data });
200
184
  const finalContext = this._prepareFinalContext(updatedContext);
201
- this._latestTransaction.updateWithContext(finalContext);
185
+ latestTransaction.updateWithContext(finalContext);
202
186
  const isCustomName = updatedContext.name !== finalContext.name;
203
- this._latestTransaction.setName(finalContext.name, isCustomName ? customTransactionSource : defaultTransactionSource);
187
+ latestTransaction.setName(finalContext.name, isCustomName ? customTransactionSource : defaultTransactionSource);
204
188
  (_e = this._onConfirmRoute) === null || _e === void 0 ? void 0 : _e.call(this, finalContext);
205
189
  }
206
190
  this._pushRecentRouteKey(route.key);
@@ -1 +1 @@
1
- {"version":3,"file":"reactnavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,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AE,EAAE;CACT,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport { getActiveSpan, setMeasurement, spanToJSON, startInactiveSpan } from '@sentry/core';\nimport type { Span, Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport type { NewFrameEvent } from '../utils/sentryeventemitter';\nimport { type SentryEventEmitter, createSentryEventEmitter, NewFrameEventName } from '../utils/sentryeventemitter';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { NATIVE } from '../wrapper';\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport { manualInitialDisplaySpans, startTimeToInitialDisplaySpan } from './timetodisplay';\nimport type { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData } from './types';\nimport { customTransactionSource, defaultTransactionSource, getBlankTransactionContext } from './utils';\n\nexport interface NavigationRoute {\n name: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\ninterface NavigationContainer {\n addListener: (type: string, listener: () => void) => void;\n getCurrentRoute: () => NavigationRoute;\n}\n\ninterface ReactNavigationOptions {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n * Time is in ms.\n *\n * @default 1000\n */\n routeChangeTimeoutMs: number;\n\n /**\n * Time to initial display measures the time it takes from\n * navigation dispatch to the render of the first frame of the new screen.\n *\n * @default false\n */\n enableTimeToInitialDisplay: boolean;\n}\n\nconst defaultOptions: ReactNavigationOptions = {\n routeChangeTimeoutMs: 1000,\n enableTimeToInitialDisplay: false,\n};\n\n/**\n * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.\n *\n * How this works:\n * - `_onDispatch` is called every time a dispatch happens and sets an IdleTransaction on the scope without any route context.\n * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.\n */\nexport class ReactNavigationInstrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-navigation-v5';\n\n public readonly name: string = ReactNavigationInstrumentation.instrumentationName;\n\n private _navigationContainer: NavigationContainer | null = null;\n private _newScreenFrameEventEmitter: SentryEventEmitter | null = null;\n\n private readonly _maxRecentRouteLen: number = 200;\n\n private _latestRoute?: NavigationRoute;\n private _latestTransaction?: TransactionType;\n private _navigationProcessingSpan?: Span;\n\n private _initialStateHandled: boolean = false;\n private _stateChangeTimeout?: number | undefined;\n private _recentRouteKeys: string[] = [];\n\n private _options: ReactNavigationOptions;\n\n public constructor(options: Partial<ReactNavigationOptions> = {}) {\n super();\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n\n if (this._options.enableTimeToInitialDisplay) {\n this._newScreenFrameEventEmitter = createSentryEventEmitter();\n this._newScreenFrameEventEmitter.initAsync(NewFrameEventName);\n NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => {\n logger.error(`[ReactNavigationInstrumentation] Failed to initialize native new frame tracking: ${reason}`);\n });\n }\n }\n\n /**\n * Extends by calling _handleInitialState at the end.\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n // We create an initial state here to ensure a transaction gets created before the first route mounts.\n if (!this._initialStateHandled) {\n this._onDispatch();\n if (this._navigationContainer) {\n // Navigation container already registered, just populate with route state\n this._onStateChange();\n\n this._initialStateHandled = true;\n }\n }\n }\n\n /**\n * Pass the ref to the navigation container to register it to the instrumentation\n * @param navigationContainerRef Ref to a `NavigationContainer`\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public registerNavigationContainer(navigationContainerRef: any): void {\n /* We prevent duplicate routing instrumentation to be initialized on fast refreshes\n\n Explanation: If the user triggers a fast refresh on the file that the instrumentation is\n initialized in, it will initialize a new instance and will cause undefined behavior.\n */\n if (!RN_GLOBAL_OBJ.__sentry_rn_v5_registered) {\n if ('current' in navigationContainerRef) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._navigationContainer = navigationContainerRef.current;\n } else {\n this._navigationContainer = navigationContainerRef;\n }\n\n if (this._navigationContainer) {\n this._navigationContainer.addListener(\n '__unsafe_action__', // This action is emitted on every dispatch\n this._onDispatch.bind(this),\n );\n this._navigationContainer.addListener(\n 'state', // This action is emitted on every state change\n this._onStateChange.bind(this),\n );\n\n if (!this._initialStateHandled) {\n if (this._latestTransaction) {\n // If registerRoutingInstrumentation was called first _onDispatch has already been called\n this._onStateChange();\n\n this._initialStateHandled = true;\n } else {\n logger.log(\n '[ReactNavigationInstrumentation] Navigation container registered, but integration has not been setup yet.',\n );\n }\n }\n\n RN_GLOBAL_OBJ.__sentry_rn_v5_registered = true;\n } else {\n logger.warn('[ReactNavigationInstrumentation] Received invalid navigation container ref!');\n }\n } else {\n logger.log(\n '[ReactNavigationInstrumentation] Instrumentation already exists, but register has been called again, doing nothing.',\n );\n }\n }\n\n /**\n * To be called on every React-Navigation action dispatch.\n * It does not name the transaction or populate it with route information. Instead, it waits for the state to fully change\n * and gets the route information from there, @see _onStateChange\n */\n private _onDispatch(): void {\n if (this._latestTransaction) {\n logger.log(\n '[ReactNavigationInstrumentation] A transaction was detected that turned out to be a noop, discarding.',\n );\n this._discardLatestTransaction();\n this._clearStateChangeTimeout();\n }\n\n this._latestTransaction = this.onRouteWillChange(\n getBlankTransactionContext(ReactNavigationInstrumentation.instrumentationName),\n );\n\n if (this._options.enableTimeToInitialDisplay) {\n this._navigationProcessingSpan = startInactiveSpan({\n op: 'navigation.processing',\n name: 'Navigation processing',\n startTimestamp: this._latestTransaction?.startTimestamp,\n });\n }\n\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n private _onStateChange(): void {\n const stateChangedTimestamp = timestampInSeconds();\n\n // Use the getCurrentRoute method to be accurate.\n const previousRoute = this._latestRoute;\n\n if (!this._navigationContainer) {\n logger.warn(\n '[ReactNavigationInstrumentation] Missing navigation container ref. Route transactions will not be sent.',\n );\n\n return;\n }\n\n const route = this._navigationContainer.getCurrentRoute();\n\n if (route) {\n if (this._latestTransaction) {\n if (!previousRoute || previousRoute.key !== route.key) {\n const routeHasBeenSeen = this._recentRouteKeys.includes(route.key);\n const latestTtidSpan =\n !routeHasBeenSeen &&\n this._options.enableTimeToInitialDisplay &&\n startTimeToInitialDisplaySpan({\n name: `${route.name} initial display`,\n isAutoInstrumented: true,\n });\n\n !routeHasBeenSeen &&\n this._newScreenFrameEventEmitter?.once(\n NewFrameEventName,\n ({ newFrameTimestampInSeconds }: NewFrameEvent) => {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(\n '[ReactNavigationInstrumentation] No active span found to attach ui.load.initial_display to.',\n );\n return;\n }\n\n if (manualInitialDisplaySpans.has(activeSpan)) {\n logger.warn(\n '[ReactNavigationInstrumentation] Detected manual instrumentation for the current active span.',\n );\n return;\n }\n\n if (!latestTtidSpan) {\n return;\n }\n\n if (spanToJSON(latestTtidSpan).parent_span_id !== getActiveSpan()?.spanContext().spanId) {\n logger.warn(\n '[ReactNavigationInstrumentation] Currently Active Span changed before the new frame was rendered, _latestTtidSpan is not a child of the currently active span.',\n );\n return;\n }\n\n latestTtidSpan.setStatus('ok');\n latestTtidSpan.end(newFrameTimestampInSeconds);\n const ttidSpan = spanToJSON(latestTtidSpan);\n\n const ttidSpanEnd = ttidSpan.timestamp;\n const ttidSpanStart = ttidSpan.start_timestamp;\n if (!ttidSpanEnd || !ttidSpanStart) {\n return;\n }\n\n setMeasurement('time_to_initial_display', (ttidSpanEnd - ttidSpanStart) * 1000, 'millisecond');\n },\n );\n\n this._navigationProcessingSpan?.updateName(`Processing navigation to ${route.name}`);\n this._navigationProcessingSpan?.setStatus('ok');\n this._navigationProcessingSpan?.end(stateChangedTimestamp);\n this._navigationProcessingSpan = undefined;\n\n const originalContext = this._latestTransaction.toContext() as typeof BLANK_TRANSACTION_CONTEXT;\n\n const data: RouteChangeContextData = {\n ...originalContext.data,\n route: {\n name: route.name,\n key: route.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n hasBeenSeen: routeHasBeenSeen,\n },\n previousRoute: previousRoute\n ? {\n name: previousRoute.name,\n key: previousRoute.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n }\n : null,\n };\n\n const updatedContext: ReactNavigationTransactionContext = {\n ...originalContext,\n name: route.name,\n tags: {\n ...originalContext.tags,\n 'routing.route.name': route.name,\n },\n data,\n };\n\n const finalContext = this._prepareFinalContext(updatedContext);\n this._latestTransaction.updateWithContext(finalContext);\n\n const isCustomName = updatedContext.name !== finalContext.name;\n this._latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n\n this._onConfirmRoute?.(finalContext);\n }\n\n this._pushRecentRouteKey(route.key);\n this._latestRoute = route;\n\n // Clear the latest transaction as it has been handled.\n this._latestTransaction = undefined;\n }\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(updatedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...updatedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[ReactNavigationInstrumentation] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...updatedContext,\n sampled: false,\n };\n }\n\n // Note: finalContext.sampled will be false at this point only if the user sets it to be so in beforeNavigate.\n if (finalContext.sampled === false) {\n logger.log(\n `[ReactNavigationInstrumentation] Will not send transaction \"${finalContext.name}\" due to beforeNavigate.`,\n );\n } else {\n // Clear the timeout so the transaction does not get cancelled.\n this._clearStateChangeTimeout();\n }\n\n return finalContext;\n }\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n private _pushRecentRouteKey = (key: string): void => {\n this._recentRouteKeys.push(key);\n\n if (this._recentRouteKeys.length > this._maxRecentRouteLen) {\n this._recentRouteKeys = this._recentRouteKeys.slice(this._recentRouteKeys.length - this._maxRecentRouteLen);\n }\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n if (this._navigationProcessingSpan) {\n this._navigationProcessingSpan = undefined;\n }\n }\n\n /**\n *\n */\n private _clearStateChangeTimeout(): void {\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n }\n}\n\n/**\n * Backwards compatibility alias for ReactNavigationInstrumentation\n * @deprecated Use ReactNavigationInstrumentation\n */\nexport const ReactNavigationV5Instrumentation = ReactNavigationInstrumentation;\n\nexport const BLANK_TRANSACTION_CONTEXT = {\n name: 'Route Change',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationInstrumentation.instrumentationName,\n },\n data: {},\n};\n"]}
1
+ {"version":3,"file":"reactnavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAA2B,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACnH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,yBAA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BAAmB,GAAG,SAAS,CAAC;SACtC;IACH,CAAC;;AArTa,kDAAmB,GAAW,qBAAqB,CAAC;AAwTpE;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,8BAA8B,CAAC;AAE/E,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,cAAc;IACpB,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE;QACJ,yBAAyB,EAAE,8BAA8B,CAAC,mBAAmB;KAC9E;IACD,IAAI,EAAE,EAAE;CACT,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport { getActiveSpan, startInactiveSpan } from '@sentry/core';\nimport type { Span, Transaction as TransactionType, TransactionContext } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport type { NewFrameEvent } from '../utils/sentryeventemitter';\nimport { type SentryEventEmitter, createSentryEventEmitter, NewFrameEventName } from '../utils/sentryeventemitter';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { NATIVE } from '../wrapper';\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport { manualInitialDisplaySpans, startTimeToInitialDisplaySpan } from './timetodisplay';\nimport type { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData } from './types';\nimport {\n customTransactionSource,\n defaultTransactionSource,\n getBlankTransactionContext,\n setSpanDurationAsMeasurementOnTransaction,\n} from './utils';\n\nexport interface NavigationRoute {\n name: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\ninterface NavigationContainer {\n addListener: (type: string, listener: () => void) => void;\n getCurrentRoute: () => NavigationRoute;\n}\n\ninterface ReactNavigationOptions {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n * Time is in ms.\n *\n * @default 1000\n */\n routeChangeTimeoutMs: number;\n\n /**\n * Time to initial display measures the time it takes from\n * navigation dispatch to the render of the first frame of the new screen.\n *\n * @default false\n */\n enableTimeToInitialDisplay: boolean;\n}\n\nconst defaultOptions: ReactNavigationOptions = {\n routeChangeTimeoutMs: 1000,\n enableTimeToInitialDisplay: false,\n};\n\n/**\n * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.\n *\n * How this works:\n * - `_onDispatch` is called every time a dispatch happens and sets an IdleTransaction on the scope without any route context.\n * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.\n */\nexport class ReactNavigationInstrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-navigation-v5';\n\n public readonly name: string = ReactNavigationInstrumentation.instrumentationName;\n\n private _navigationContainer: NavigationContainer | null = null;\n private _newScreenFrameEventEmitter: SentryEventEmitter | null = null;\n\n private readonly _maxRecentRouteLen: number = 200;\n\n private _latestRoute?: NavigationRoute;\n private _latestTransaction?: TransactionType;\n private _navigationProcessingSpan?: Span;\n\n private _initialStateHandled: boolean = false;\n private _stateChangeTimeout?: number | undefined;\n private _recentRouteKeys: string[] = [];\n\n private _options: ReactNavigationOptions;\n\n public constructor(options: Partial<ReactNavigationOptions> = {}) {\n super();\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n\n if (this._options.enableTimeToInitialDisplay) {\n this._newScreenFrameEventEmitter = createSentryEventEmitter();\n this._newScreenFrameEventEmitter.initAsync(NewFrameEventName);\n NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => {\n logger.error(`[ReactNavigationInstrumentation] Failed to initialize native new frame tracking: ${reason}`);\n });\n }\n }\n\n /**\n * Extends by calling _handleInitialState at the end.\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n // We create an initial state here to ensure a transaction gets created before the first route mounts.\n if (!this._initialStateHandled) {\n this._onDispatch();\n if (this._navigationContainer) {\n // Navigation container already registered, just populate with route state\n this._onStateChange();\n\n this._initialStateHandled = true;\n }\n }\n }\n\n /**\n * Pass the ref to the navigation container to register it to the instrumentation\n * @param navigationContainerRef Ref to a `NavigationContainer`\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public registerNavigationContainer(navigationContainerRef: any): void {\n /* We prevent duplicate routing instrumentation to be initialized on fast refreshes\n\n Explanation: If the user triggers a fast refresh on the file that the instrumentation is\n initialized in, it will initialize a new instance and will cause undefined behavior.\n */\n if (!RN_GLOBAL_OBJ.__sentry_rn_v5_registered) {\n if ('current' in navigationContainerRef) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._navigationContainer = navigationContainerRef.current;\n } else {\n this._navigationContainer = navigationContainerRef;\n }\n\n if (this._navigationContainer) {\n this._navigationContainer.addListener(\n '__unsafe_action__', // This action is emitted on every dispatch\n this._onDispatch.bind(this),\n );\n this._navigationContainer.addListener(\n 'state', // This action is emitted on every state change\n this._onStateChange.bind(this),\n );\n\n if (!this._initialStateHandled) {\n if (this._latestTransaction) {\n // If registerRoutingInstrumentation was called first _onDispatch has already been called\n this._onStateChange();\n\n this._initialStateHandled = true;\n } else {\n logger.log(\n '[ReactNavigationInstrumentation] Navigation container registered, but integration has not been setup yet.',\n );\n }\n }\n\n RN_GLOBAL_OBJ.__sentry_rn_v5_registered = true;\n } else {\n logger.warn('[ReactNavigationInstrumentation] Received invalid navigation container ref!');\n }\n } else {\n logger.log(\n '[ReactNavigationInstrumentation] Instrumentation already exists, but register has been called again, doing nothing.',\n );\n }\n }\n\n /**\n * To be called on every React-Navigation action dispatch.\n * It does not name the transaction or populate it with route information. Instead, it waits for the state to fully change\n * and gets the route information from there, @see _onStateChange\n */\n private _onDispatch(): void {\n if (this._latestTransaction) {\n logger.log(\n '[ReactNavigationInstrumentation] A transaction was detected that turned out to be a noop, discarding.',\n );\n this._discardLatestTransaction();\n this._clearStateChangeTimeout();\n }\n\n this._latestTransaction = this.onRouteWillChange(\n getBlankTransactionContext(ReactNavigationInstrumentation.instrumentationName),\n );\n\n if (this._options.enableTimeToInitialDisplay) {\n this._navigationProcessingSpan = startInactiveSpan({\n op: 'navigation.processing',\n name: 'Navigation processing',\n startTimestamp: this._latestTransaction?.startTimestamp,\n });\n }\n\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n private _onStateChange(): void {\n const stateChangedTimestamp = timestampInSeconds();\n\n // Use the getCurrentRoute method to be accurate.\n const previousRoute = this._latestRoute;\n\n if (!this._navigationContainer) {\n logger.warn(\n '[ReactNavigationInstrumentation] Missing navigation container ref. Route transactions will not be sent.',\n );\n\n return;\n }\n\n const route = this._navigationContainer.getCurrentRoute();\n\n if (route) {\n if (this._latestTransaction) {\n if (!previousRoute || previousRoute.key !== route.key) {\n const routeHasBeenSeen = this._recentRouteKeys.includes(route.key);\n const latestTransaction = this._latestTransaction;\n const latestTtidSpan =\n !routeHasBeenSeen &&\n this._options.enableTimeToInitialDisplay &&\n startTimeToInitialDisplaySpan({\n name: `${route.name} initial display`,\n isAutoInstrumented: true,\n });\n\n !routeHasBeenSeen &&\n latestTtidSpan &&\n this._newScreenFrameEventEmitter?.once(\n NewFrameEventName,\n ({ newFrameTimestampInSeconds }: NewFrameEvent) => {\n const activeSpan = getActiveSpan();\n if (activeSpan && manualInitialDisplaySpans.has(activeSpan)) {\n logger.warn(\n '[ReactNavigationInstrumentation] Detected manual instrumentation for the current active span.',\n );\n return;\n }\n\n latestTtidSpan.setStatus('ok');\n latestTtidSpan.end(newFrameTimestampInSeconds);\n setSpanDurationAsMeasurementOnTransaction(latestTransaction, 'time_to_initial_display', latestTtidSpan);\n },\n );\n\n this._navigationProcessingSpan?.updateName(`Processing navigation to ${route.name}`);\n this._navigationProcessingSpan?.setStatus('ok');\n this._navigationProcessingSpan?.end(stateChangedTimestamp);\n this._navigationProcessingSpan = undefined;\n\n const originalContext = latestTransaction.toContext() as typeof BLANK_TRANSACTION_CONTEXT;\n\n const data: RouteChangeContextData = {\n ...originalContext.data,\n route: {\n name: route.name,\n key: route.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n hasBeenSeen: routeHasBeenSeen,\n },\n previousRoute: previousRoute\n ? {\n name: previousRoute.name,\n key: previousRoute.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n }\n : null,\n };\n\n const updatedContext: ReactNavigationTransactionContext = {\n ...originalContext,\n name: route.name,\n tags: {\n ...originalContext.tags,\n 'routing.route.name': route.name,\n },\n data,\n };\n\n const finalContext = this._prepareFinalContext(updatedContext);\n latestTransaction.updateWithContext(finalContext);\n\n const isCustomName = updatedContext.name !== finalContext.name;\n latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n\n this._onConfirmRoute?.(finalContext);\n }\n\n this._pushRecentRouteKey(route.key);\n this._latestRoute = route;\n\n // Clear the latest transaction as it has been handled.\n this._latestTransaction = undefined;\n }\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(updatedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...updatedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[ReactNavigationInstrumentation] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...updatedContext,\n sampled: false,\n };\n }\n\n // Note: finalContext.sampled will be false at this point only if the user sets it to be so in beforeNavigate.\n if (finalContext.sampled === false) {\n logger.log(\n `[ReactNavigationInstrumentation] Will not send transaction \"${finalContext.name}\" due to beforeNavigate.`,\n );\n } else {\n // Clear the timeout so the transaction does not get cancelled.\n this._clearStateChangeTimeout();\n }\n\n return finalContext;\n }\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n private _pushRecentRouteKey = (key: string): void => {\n this._recentRouteKeys.push(key);\n\n if (this._recentRouteKeys.length > this._maxRecentRouteLen) {\n this._recentRouteKeys = this._recentRouteKeys.slice(this._recentRouteKeys.length - this._maxRecentRouteLen);\n }\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n if (this._navigationProcessingSpan) {\n this._navigationProcessingSpan = undefined;\n }\n }\n\n /**\n *\n */\n private _clearStateChangeTimeout(): void {\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n }\n}\n\n/**\n * Backwards compatibility alias for ReactNavigationInstrumentation\n * @deprecated Use ReactNavigationInstrumentation\n */\nexport const ReactNavigationV5Instrumentation = ReactNavigationInstrumentation;\n\nexport const BLANK_TRANSACTION_CONTEXT = {\n name: 'Route Change',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationInstrumentation.instrumentationName,\n },\n data: {},\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"timetodisplay.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAC,gBAAgB,EAAG,MAAM,eAAe,CAAC;AAE5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;GAEG;AACH,eAAO,MAAM,yBAAyB,qBAA4B,CAAC;AAOnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,k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AAgB,6BAA6B,CAC3C,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,GACA,IAAI,GAAG,SAAS,CAiClB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAEnF,GACA,IAAI,GAAG,SAAS,CAoDlB"}
@@ -23,6 +23,7 @@ export function TimeToInitialDisplay(props) {
23
23
  const activeSpan = getActiveSpan();
24
24
  if (activeSpan) {
25
25
  manualInitialDisplaySpans.set(activeSpan, true);
26
+ startTimeToInitialDisplaySpan();
26
27
  }
27
28
  return React.createElement(TimeToDisplay, { initialDisplay: props.record }, props.children);
28
29
  }
@@ -34,6 +35,7 @@ export function TimeToInitialDisplay(props) {
34
35
  * <TimeToInitialDisplay record />
35
36
  */
36
37
  export function TimeToFullDisplay(props) {
38
+ startTimeToFullDisplaySpan();
37
39
  return React.createElement(TimeToDisplay, { fullDisplay: props.record }, props.children);
38
40
  }
39
41
  function TimeToDisplay(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"timetodisplay.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,IAAI,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE/F,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEzF,OAAO,EAAE,4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MAAM,0BAA0B,GAAG,0BAA0B,IAAI,UAAU,CAAC,0BAA0B,CAAC,CAAC,SAAS,CAAC;IAClH,IAAI,CAAC,0BAA0B,EAAE;QAC/B,+BAA+B,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACtD,MAAM,CAAC,IAAI,CAAC,+EAA+E,UAAU,CAAC,WAAW,EAAE,CAAC,MAAM,IAAI,CAAC,CAAC;QAChI,OAAO;KACR;IAED,MAAM,IAAI,GAAG,0BAA0B,EAAE,CAAC;IAC1C,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,CAAC,IAAI,CAAC,+FAA+F,CAAC,CAAC;QAC7G,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,QAAQ,CAAC,SAAS,EAAE;QACtB,MAAM,CAAC,IAAI,CAAC,mBAAmB,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,OAAO,uBAAuB,CAAC,CAAC;QACjG,OAAO;KACR;IAED,IAAI,0BAA0B,GAAG,qBAAqB,EAAE;QACtD,MAAM,CAAC,IAAI,CAAC,4GAA4G,CAAC,CAAC;QAC1H,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;KACtC;SAAM;QACL,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;KACjC;IAED,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACrB,MAAM,CAAC,KAAK,CAAC,mBAAmB,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,OAAO,oCAAoC,CAAC,CAAC;IAE/G,4BAA4B,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { getActiveSpan, Span as SpanClass, spanToJSON, startInactiveSpan } from '@sentry/core';\nimport type { Span,StartSpanOptions } from '@sentry/types';\nimport { fill, logger } from '@sentry/utils';\nimport * as React from 'react';\n\nimport { getRNSentryOnDrawReporter, nativeComponentExists } from './timetodisplaynative';\nimport type {RNSentryOnDrawNextFrameEvent } from './timetodisplaynative.types';\nimport { setSpanDurationAsMeasurement } from './utils';\n\nlet nativeComponentMissingLogged = false;\n\n/**\n * Flags of active spans with manual initial display.\n */\nexport const manualInitialDisplaySpans = new WeakMap<Span, true>();\n\n/**\n * Flag full display called before initial display for an active span.\n */\nconst fullDisplayBeforeInitialDisplay = new WeakMap<Span, true>();\n\nexport type TimeToDisplayProps = {\n children?: React.ReactNode;\n spanName?: string;\n record?: boolean;\n};\n\n/**\n * Component to measure time to initial display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n if (activeSpan) {\n manualInitialDisplaySpans.set(activeSpan, true);\n }\n\n return <TimeToDisplay initialDisplay={props.record}>{props.children}</TimeToDisplay>;\n}\n\n/**\n * Component to measure time to full display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToFullDisplay(props: TimeToDisplayProps): React.ReactElement {\n return <TimeToDisplay fullDisplay={props.record}>{props.children}</TimeToDisplay>;\n}\n\nfunction TimeToDisplay(props: {\n children?: React.ReactNode;\n initialDisplay?: boolean;\n fullDisplay?: boolean;\n}): React.ReactElement {\n const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();\n\n if (__DEV__ && !nativeComponentMissingLogged && !nativeComponentExists) {\n nativeComponentMissingLogged = true;\n // Using setTimeout with a delay of 0 milliseconds to defer execution and avoid printing the React stack trace.\n setTimeout(() => {\n logger.warn('TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native');\n }, 0);\n }\n\n const onDraw = (event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void => onDrawNextFrame(event);\n\n return (\n <>\n <RNSentryOnDrawReporter\n onDrawNextFrame={onDraw}\n initialDisplay={props.initialDisplay}\n fullDisplay={props.fullDisplay} />\n {props.children}\n </>\n );\n}\n\n/**\n * Starts a new span for the initial display.\n *\n * Returns current span if already exists in the currently active span.\n */\nexport function startTimeToInitialDisplaySpan(\n options?: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string;\n isAutoInstrumented?: boolean\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return;\n }\n\n if (!(activeSpan instanceof SpanClass)) {\n logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);\n return;\n }\n\n const existingSpan = activeSpan.spanRecorder?.spans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.initial_display span.`);\n return existingSpan\n }\n\n const initialDisplaySpan = startInactiveSpan({\n op: 'ui.load.initial_display',\n name: 'Time To Initial Display',\n startTimestamp: spanToJSON(activeSpan).start_timestamp,\n ...options,\n });\n\n if (!initialDisplaySpan) {\n return;\n }\n\n if (!options?.isAutoInstrumented) {\n manualInitialDisplaySpans.set(activeSpan, true);\n }\n return initialDisplaySpan;\n}\n\n/**\n * Starts a new span for the full display.\n *\n * Returns current span if already exists in the currently active span.\n */\nexport function startTimeToFullDisplaySpan(\n options: Omit<StartSpanOptions, 'op' | 'name'> & { name?: string, timeoutMs?: number } = {\n timeoutMs: 30_000,\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.full_display to.`);\n return;\n }\n\n if (!(activeSpan instanceof SpanClass)) {\n logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);\n return;\n }\n\n const descendantSpans = activeSpan.spanRecorder?.spans || [];\n\n const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (!initialDisplaySpan) {\n logger.warn(`[TimeToDisplay] No initial display span found to attach ui.load.full_display to.`);\n return;\n }\n\n const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.full_display span.`);\n return existingSpan;\n }\n\n const fullDisplaySpan = startInactiveSpan({\n op: 'ui.load.full_display',\n name: 'Time To Full Display',\n startTimestamp: spanToJSON(initialDisplaySpan).start_timestamp,\n ...options,\n });\n if (!fullDisplaySpan) {\n return;\n }\n\n const timeout = setTimeout(() => {\n if (spanToJSON(fullDisplaySpan).timestamp) {\n return;\n }\n fullDisplaySpan.setStatus('deadline_exceeded');\n fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);\n setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);\n logger.warn(`[TimeToDisplay] Full display span deadline_exceeded.`);\n }, options.timeoutMs);\n\n fill(fullDisplaySpan, 'end', (originalEnd: SpanClass['end']) => (endTimestamp?: Parameters<SpanClass['end']>[0]) => {\n clearTimeout(timeout);\n originalEnd.call(fullDisplaySpan, endTimestamp);\n });\n\n return fullDisplaySpan;\n}\n\nfunction onDrawNextFrame(event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void {\n logger.debug(`[TimeToDisplay] onDrawNextFrame: ${JSON.stringify(event.nativeEvent)}`);\n if (event.nativeEvent.type === 'fullDisplay') {\n return updateFullDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);\n }\n if (event.nativeEvent.type === 'initialDisplay') {\n return updateInitialDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);\n }\n}\n\nfunction updateInitialDisplaySpan(frameTimestampSeconds: number): void {\n const span = startTimeToInitialDisplaySpan();\n if (!span) {\n logger.warn(`[TimeToDisplay] No span found or created, possibly performance is disabled.`);\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return;\n }\n\n if (spanToJSON(span).parent_span_id !== spanToJSON(activeSpan).span_id) {\n logger.warn(`[TimeToDisplay] Initial display span is not a child of current active span.`);\n return;\n }\n\n if (spanToJSON(span).timestamp) {\n logger.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);\n return;\n }\n\n span.end(frameTimestampSeconds);\n span.setStatus('ok');\n logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`);\n\n if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {\n fullDisplayBeforeInitialDisplay.delete(activeSpan);\n logger.debug(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);\n updateFullDisplaySpan(frameTimestampSeconds, span);\n }\n\n setSpanDurationAsMeasurement('time_to_initial_display', span);\n}\n\nfunction updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to update ui.load.full_display in.`);\n return;\n }\n\n if (!(activeSpan instanceof SpanClass)) {\n logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);\n return;\n }\n\n const existingInitialDisplaySpan = passedInitialDisplaySpan\n || activeSpan.spanRecorder?.spans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;\n if (!initialDisplayEndTimestamp) {\n fullDisplayBeforeInitialDisplay.set(activeSpan, true);\n logger.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`);\n return;\n }\n\n const span = startTimeToFullDisplaySpan();\n if (!span) {\n logger.warn(`[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.`);\n return;\n }\n\n const spanJSON = spanToJSON(span);\n if (spanJSON.timestamp) {\n logger.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`);\n return;\n }\n\n if (initialDisplayEndTimestamp > frameTimestampSeconds) {\n logger.warn(`[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.`);\n span.end(initialDisplayEndTimestamp);\n } else {\n span.end(frameTimestampSeconds);\n }\n\n span.setStatus('ok');\n logger.debug(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`);\n\n setSpanDurationAsMeasurement('time_to_full_display', span);\n}\n"]}
1
+ {"version":3,"file":"timetodisplay.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,IAAI,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE/F,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvD,IAAI,4BAA4B,GAAG,KAAK,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,OAAO,EAAc,CAAC;AAEnE;;GAEG;AACH,MAAM,+BAA+B,GAAG,IAAI,OAAO,EAAc,CAAC;AAQlE;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAyB;IAC5D,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,IAAI,UAAU,EAAE;QACd,yBAAyB,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAChD,6BAA6B,EAAE,CAAC;KACjC;IAED,OAAO,oBAAC,aAAa,IAAC,cAAc,EAAE,KAAK,CAAC,MAAM,IAAG,KAAK,CAAC,QAAQ,CAAiB,CAAC;AACvF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAyB;IACzD,0BAA0B,EAAE,CAAC;IAC7B,OAAO,oBAAC,aAAa,IAA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AO,uBAAuB,CAAC,CAAC;QACjG,OAAO;KACR;IAED,IAAI,0BAA0B,GAAG,qBAAqB,EAAE;QACtD,MAAM,CAAC,IAAI,CAAC,4GAA4G,CAAC,CAAC;QAC1H,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;KACtC;SAAM;QACL,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;KACjC;IAED,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACrB,MAAM,CAAC,KAAK,CAAC,mBAAmB,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,OAAO,oCAAoC,CAAC,CAAC;IAE/G,4BAA4B,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { getActiveSpan, Span as SpanClass, spanToJSON, startInactiveSpan } from '@sentry/core';\nimport type { Span,StartSpanOptions } from '@sentry/types';\nimport { fill, logger } from '@sentry/utils';\nimport * as React from 'react';\n\nimport { getRNSentryOnDrawReporter, nativeComponentExists } from './timetodisplaynative';\nimport type {RNSentryOnDrawNextFrameEvent } from './timetodisplaynative.types';\nimport { setSpanDurationAsMeasurement } from './utils';\n\nlet nativeComponentMissingLogged = false;\n\n/**\n * Flags of active spans with manual initial display.\n */\nexport const manualInitialDisplaySpans = new WeakMap<Span, true>();\n\n/**\n * Flag full display called before initial display for an active span.\n */\nconst fullDisplayBeforeInitialDisplay = new WeakMap<Span, true>();\n\nexport type TimeToDisplayProps = {\n children?: React.ReactNode;\n spanName?: string;\n record?: boolean;\n};\n\n/**\n * Component to measure time to initial display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n if (activeSpan) {\n manualInitialDisplaySpans.set(activeSpan, true);\n startTimeToInitialDisplaySpan();\n }\n\n return <TimeToDisplay initialDisplay={props.record}>{props.children}</TimeToDisplay>;\n}\n\n/**\n * Component to measure time to full display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToFullDisplay(props: TimeToDisplayProps): React.ReactElement {\n startTimeToFullDisplaySpan();\n return <TimeToDisplay fullDisplay={props.record}>{props.children}</TimeToDisplay>;\n}\n\nfunction TimeToDisplay(props: {\n children?: React.ReactNode;\n initialDisplay?: boolean;\n fullDisplay?: boolean;\n}): React.ReactElement {\n const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();\n\n if (__DEV__ && !nativeComponentMissingLogged && !nativeComponentExists) {\n nativeComponentMissingLogged = true;\n // Using setTimeout with a delay of 0 milliseconds to defer execution and avoid printing the React stack trace.\n setTimeout(() => {\n logger.warn('TimeToInitialDisplay and TimeToFullDisplay are not supported on the web, Expo Go and New Architecture. Run native build or report an issue at https://github.com/getsentry/sentry-react-native');\n }, 0);\n }\n\n const onDraw = (event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void => onDrawNextFrame(event);\n\n return (\n <>\n <RNSentryOnDrawReporter\n onDrawNextFrame={onDraw}\n initialDisplay={props.initialDisplay}\n fullDisplay={props.fullDisplay} />\n {props.children}\n </>\n );\n}\n\n/**\n * Starts a new span for the initial display.\n *\n * Returns current span if already exists in the currently active span.\n */\nexport function startTimeToInitialDisplaySpan(\n options?: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string;\n isAutoInstrumented?: boolean\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return;\n }\n\n if (!(activeSpan instanceof SpanClass)) {\n logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);\n return;\n }\n\n const existingSpan = activeSpan.spanRecorder?.spans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.initial_display span.`);\n return existingSpan\n }\n\n const initialDisplaySpan = startInactiveSpan({\n op: 'ui.load.initial_display',\n name: 'Time To Initial Display',\n startTimestamp: spanToJSON(activeSpan).start_timestamp,\n ...options,\n });\n\n if (!initialDisplaySpan) {\n return;\n }\n\n if (!options?.isAutoInstrumented) {\n manualInitialDisplaySpans.set(activeSpan, true);\n }\n return initialDisplaySpan;\n}\n\n/**\n * Starts a new span for the full display.\n *\n * Returns current span if already exists in the currently active span.\n */\nexport function startTimeToFullDisplaySpan(\n options: Omit<StartSpanOptions, 'op' | 'name'> & { name?: string, timeoutMs?: number } = {\n timeoutMs: 30_000,\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.full_display to.`);\n return;\n }\n\n if (!(activeSpan instanceof SpanClass)) {\n logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);\n return;\n }\n\n const descendantSpans = activeSpan.spanRecorder?.spans || [];\n\n const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (!initialDisplaySpan) {\n logger.warn(`[TimeToDisplay] No initial display span found to attach ui.load.full_display to.`);\n return;\n }\n\n const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display');\n if (existingSpan) {\n logger.debug(`[TimeToDisplay] Found existing ui.load.full_display span.`);\n return existingSpan;\n }\n\n const fullDisplaySpan = startInactiveSpan({\n op: 'ui.load.full_display',\n name: 'Time To Full Display',\n startTimestamp: spanToJSON(initialDisplaySpan).start_timestamp,\n ...options,\n });\n if (!fullDisplaySpan) {\n return;\n }\n\n const timeout = setTimeout(() => {\n if (spanToJSON(fullDisplaySpan).timestamp) {\n return;\n }\n fullDisplaySpan.setStatus('deadline_exceeded');\n fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);\n setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);\n logger.warn(`[TimeToDisplay] Full display span deadline_exceeded.`);\n }, options.timeoutMs);\n\n fill(fullDisplaySpan, 'end', (originalEnd: SpanClass['end']) => (endTimestamp?: Parameters<SpanClass['end']>[0]) => {\n clearTimeout(timeout);\n originalEnd.call(fullDisplaySpan, endTimestamp);\n });\n\n return fullDisplaySpan;\n}\n\nfunction onDrawNextFrame(event: { nativeEvent: RNSentryOnDrawNextFrameEvent }): void {\n logger.debug(`[TimeToDisplay] onDrawNextFrame: ${JSON.stringify(event.nativeEvent)}`);\n if (event.nativeEvent.type === 'fullDisplay') {\n return updateFullDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);\n }\n if (event.nativeEvent.type === 'initialDisplay') {\n return updateInitialDisplaySpan(event.nativeEvent.newFrameTimestampInSeconds);\n }\n}\n\nfunction updateInitialDisplaySpan(frameTimestampSeconds: number): void {\n const span = startTimeToInitialDisplaySpan();\n if (!span) {\n logger.warn(`[TimeToDisplay] No span found or created, possibly performance is disabled.`);\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to attach ui.load.initial_display to.`);\n return;\n }\n\n if (spanToJSON(span).parent_span_id !== spanToJSON(activeSpan).span_id) {\n logger.warn(`[TimeToDisplay] Initial display span is not a child of current active span.`);\n return;\n }\n\n if (spanToJSON(span).timestamp) {\n logger.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);\n return;\n }\n\n span.end(frameTimestampSeconds);\n span.setStatus('ok');\n logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`);\n\n if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {\n fullDisplayBeforeInitialDisplay.delete(activeSpan);\n logger.debug(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);\n updateFullDisplaySpan(frameTimestampSeconds, span);\n }\n\n setSpanDurationAsMeasurement('time_to_initial_display', span);\n}\n\nfunction updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n logger.warn(`[TimeToDisplay] No active span found to update ui.load.full_display in.`);\n return;\n }\n\n if (!(activeSpan instanceof SpanClass)) {\n logger.warn(`[TimeToDisplay] Active span is not instance of Span class.`);\n return;\n }\n\n const existingInitialDisplaySpan = passedInitialDisplaySpan\n || activeSpan.spanRecorder?.spans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;\n if (!initialDisplayEndTimestamp) {\n fullDisplayBeforeInitialDisplay.set(activeSpan, true);\n logger.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`);\n return;\n }\n\n const span = startTimeToFullDisplaySpan();\n if (!span) {\n logger.warn(`[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.`);\n return;\n }\n\n const spanJSON = spanToJSON(span);\n if (spanJSON.timestamp) {\n logger.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`);\n return;\n }\n\n if (initialDisplayEndTimestamp > frameTimestampSeconds) {\n logger.warn(`[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.`);\n span.end(initialDisplayEndTimestamp);\n } else {\n span.end(frameTimestampSeconds);\n }\n\n span.setStatus('ok');\n logger.debug(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span updated with end timestamp.`);\n\n setSpanDurationAsMeasurement('time_to_full_display', span);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"timetodisplaynative.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAGjD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAI/E,eAAO,MAAM,qBAAqB,SAEzB,CAAC;AAEV;;GAEG;AACH,cAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,2BAA2B,CAAC;IAC5E,MAAM,IAAI,KAAK,CAAC,SAAS;CAKjC;AAED,QAAA,IAAI,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAAC,GAAG,OAAO,0BAA0B,CAAC;AAE3G;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,6BAO5C,CAAA"}
1
+ {"version":3,"file":"timetodisplaynative.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAI/E,eAAO,MAAM,qBAAqB,SAEzB,CAAC;AAEV;;GAEG;AACH,cAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,2BAA2B,CAAC;IAC5E,MAAM,IAAI,KAAK,CAAC,SAAS;CAKjC;AAED,QAAA,IAAI,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAAC,GAAG,OAAO,0BAA0B,CAAC;AAE3G;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,6BAO5C,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- import { requireNativeComponent, UIManager, View } from 'react-native';
2
+ import { UIManager, View } from 'react-native';
3
+ import { ReactNativeLibraries } from '../utils/rnlibraries';
3
4
  const RNSentryOnDrawReporterClass = 'RNSentryOnDrawReporter';
4
5
  export const nativeComponentExists = UIManager.hasViewManagerConfig
5
6
  ? UIManager.hasViewManagerConfig(RNSentryOnDrawReporterClass)
@@ -17,9 +18,10 @@ let RNSentryOnDrawReporter;
17
18
  * Native component that reports the on draw timestamp.
18
19
  */
19
20
  export const getRNSentryOnDrawReporter = () => {
21
+ var _a;
20
22
  if (!RNSentryOnDrawReporter) {
21
- RNSentryOnDrawReporter = nativeComponentExists
22
- ? requireNativeComponent(RNSentryOnDrawReporterClass)
23
+ RNSentryOnDrawReporter = nativeComponentExists && ((_a = ReactNativeLibraries.ReactNative) === null || _a === void 0 ? void 0 : _a.requireNativeComponent)
24
+ ? ReactNativeLibraries.ReactNative.requireNativeComponent(RNSentryOnDrawReporterClass)
23
25
  : RNSentryOnDrawReporterNoop;
24
26
  }
25
27
  return RNSentryOnDrawReporter;
@@ -1 +1 @@
1
- {"version":3,"file":"timetodisplaynative.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIvE,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AAE7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC,oBAAoB;IACjE,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,2BAA2B,CAAC;IAC7D,CAAC,CAAC,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAsC;IAC5E,MAAM;QACX,OAAO,CACL,oBAAC,IAAI,oBAAK,IAAI,CAAC,KAAK,EAAI,CACzB,CAAC;IACJ,CAAC;CACF;AAED,IAAI,sBAAsG,CAAC;AAE3G;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAkC,EAAE;IAC3E,IAAI,CAAC,sBAAsB,EAAE;QAC3B,sBAAsB,GAAG,qBAAqB;YAC5C,CAAC,CAAC,sBAAsB,CAAC,2BAA2B,CAAC;YACrD,CAAC,CAAC,0BAA0B,CAAC;KAChC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC,CAAA","sourcesContent":["import * as React from 'react';\nimport type { HostComponent} from 'react-native';\nimport { requireNativeComponent, UIManager, View } from 'react-native';\n\nimport type { RNSentryOnDrawReporterProps } from './timetodisplaynative.types';\n\nconst RNSentryOnDrawReporterClass = 'RNSentryOnDrawReporter';\n\nexport const nativeComponentExists = UIManager.hasViewManagerConfig\n ? UIManager.hasViewManagerConfig(RNSentryOnDrawReporterClass)\n : false;\n\n/**\n * This is a fallback component for environments where the native component is not available.\n */\nclass RNSentryOnDrawReporterNoop extends React.Component<RNSentryOnDrawReporterProps> {\n public render(): React.ReactNode {\n return (\n <View {...this.props} />\n );\n }\n}\n\nlet RNSentryOnDrawReporter: HostComponent<RNSentryOnDrawReporterProps> | typeof RNSentryOnDrawReporterNoop;\n\n/**\n * Native component that reports the on draw timestamp.\n */\nexport const getRNSentryOnDrawReporter = (): typeof RNSentryOnDrawReporter => {\n if (!RNSentryOnDrawReporter) {\n RNSentryOnDrawReporter = nativeComponentExists\n ? requireNativeComponent(RNSentryOnDrawReporterClass)\n : RNSentryOnDrawReporterNoop;\n }\n return RNSentryOnDrawReporter;\n}\n"]}
1
+ {"version":3,"file":"timetodisplaynative.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAG5D,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AAE7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC,oBAAoB;IACjE,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,2BAA2B,CAAC;IAC7D,CAAC,CAAC,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAsC;IAC5E,MAAM;QACX,OAAO,CACL,oBAAC,IAAI,oBAAK,IAAI,CAAC,KAAK,EAAI,CACzB,CAAC;IACJ,CAAC;CACF;AAED,IAAI,sBAAsG,CAAC;AAE3G;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAkC,EAAE;;IAC3E,IAAI,CAAC,sBAAsB,EAAE;QAC3B,sBAAsB,GAAG,qBAAqB,KAAI,MAAA,oBAAoB,CAAC,WAAW,0CAAE,sBAAsB,CAAA;YACxG,CAAC,CAAC,oBAAoB,CAAC,WAAW,CAAC,sBAAsB,CAAC,2BAA2B,CAAC;YACtF,CAAC,CAAC,0BAA0B,CAAC;KAChC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC,CAAA","sourcesContent":["import * as React from 'react';\nimport type { HostComponent } from 'react-native';\nimport { UIManager, View } from 'react-native';\n\nimport { ReactNativeLibraries } from '../utils/rnlibraries';\nimport type { RNSentryOnDrawReporterProps } from './timetodisplaynative.types';\n\nconst RNSentryOnDrawReporterClass = 'RNSentryOnDrawReporter';\n\nexport const nativeComponentExists = UIManager.hasViewManagerConfig\n ? UIManager.hasViewManagerConfig(RNSentryOnDrawReporterClass)\n : false;\n\n/**\n * This is a fallback component for environments where the native component is not available.\n */\nclass RNSentryOnDrawReporterNoop extends React.Component<RNSentryOnDrawReporterProps> {\n public render(): React.ReactNode {\n return (\n <View {...this.props} />\n );\n }\n}\n\nlet RNSentryOnDrawReporter: HostComponent<RNSentryOnDrawReporterProps> | typeof RNSentryOnDrawReporterNoop;\n\n/**\n * Native component that reports the on draw timestamp.\n */\nexport const getRNSentryOnDrawReporter = (): typeof RNSentryOnDrawReporter => {\n if (!RNSentryOnDrawReporter) {\n RNSentryOnDrawReporter = nativeComponentExists && ReactNativeLibraries.ReactNative?.requireNativeComponent\n ? ReactNativeLibraries.ReactNative.requireNativeComponent(RNSentryOnDrawReporterClass)\n : RNSentryOnDrawReporterNoop;\n }\n return RNSentryOnDrawReporter;\n}\n"]}
@@ -1,5 +1,6 @@
1
- import { type IdleTransaction, type Span as SpanClass, type Transaction } from '@sentry/core';
2
- import type { Span, TransactionContext, TransactionSource } from '@sentry/types';
1
+ import type { Transaction } from '@sentry/core';
2
+ import { type IdleTransaction, type Span as SpanClass } from '@sentry/core';
3
+ import type { Span, Transaction as TransactionType, TransactionContext, TransactionSource } from '@sentry/types';
3
4
  export declare const defaultTransactionSource: TransactionSource;
4
5
  export declare const customTransactionSource: TransactionSource;
5
6
  export declare const getBlankTransactionContext: (name: string) => TransactionContext;
@@ -29,6 +30,11 @@ export declare function isNearToNow(timestamp: number): boolean;
29
30
  * Uses `setMeasurement` function from @sentry/core.
30
31
  */
31
32
  export declare function setSpanDurationAsMeasurement(name: string, span: Span): void;
33
+ /**
34
+ * Sets the duration of the span as a measurement.
35
+ * Uses `setMeasurement` function from @sentry/core.
36
+ */
37
+ export declare function setSpanDurationAsMeasurementOnTransaction(transaction: TransactionType, name: string, span: Span): void;
32
38
  /**
33
39
  * Returns unix timestamp in ms of the bundle start time.
34
40
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,IAAI,IAAI,SAAS,EACtB,KAAK,WAAW,EAGjB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAKjF,eAAO,MAAM,wBAAwB,EAAE,iBAA+B,CAAC;AACvE,eAAO,MAAM,uBAAuB,EAAE,iBAA4B,CAAC;AAEnE,eAAO,MAAM,0BAA0B,SAAU,MAAM,KAAG,kBAYzD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAI5C;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,MAAM,GACnB,IAAI,CAON;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,CAAC,IAAI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AAS,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAO3E;AAED;;;GAGG;AACH,wBAAgB,yCAAyC,CACvD,WAAW,EAAE,eAAe,EAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,GACT,IAAI,CAON;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,SAAS,CAe9D"}
@@ -1,4 +1,4 @@
1
- import { setMeasurement, spanToJSON, } from '@sentry/core';
1
+ import { setMeasurement, spanToJSON } from '@sentry/core';
2
2
  import { logger, timestampInSeconds } from '@sentry/utils';
3
3
  import { RN_GLOBAL_OBJ } from '../utils/worldwide';
4
4
  export const defaultTransactionSource = 'component';
@@ -74,13 +74,23 @@ export function isNearToNow(timestamp) {
74
74
  * Uses `setMeasurement` function from @sentry/core.
75
75
  */
76
76
  export function setSpanDurationAsMeasurement(name, span) {
77
- const spanEnd = spanToJSON(span).timestamp;
78
- const spanStart = spanToJSON(span).start_timestamp;
77
+ const { timestamp: spanEnd, start_timestamp: spanStart } = spanToJSON(span);
79
78
  if (!spanEnd || !spanStart) {
80
79
  return;
81
80
  }
82
81
  setMeasurement(name, (spanEnd - spanStart) * 1000, 'millisecond');
83
82
  }
83
+ /**
84
+ * Sets the duration of the span as a measurement.
85
+ * Uses `setMeasurement` function from @sentry/core.
86
+ */
87
+ export function setSpanDurationAsMeasurementOnTransaction(transaction, name, span) {
88
+ const { timestamp: spanEnd, start_timestamp: spanStart } = spanToJSON(span);
89
+ if (!spanEnd || !spanStart) {
90
+ return;
91
+ }
92
+ transaction.setMeasurement(name, (spanEnd - spanStart) * 1000, 'millisecond');
93
+ }
84
94
  /**
85
95
  * Returns unix timestamp in ms of the bundle start time.
86
96
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/tracing/utils.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E;QAC1B,OAAO;KACR;IAED,cAAc,CAAC,IAAI,EAAE,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB;IACvC,MAAM,eAAe,GAAG,aAAa,CAAC,qBAAqB,CAAC;IAC5D,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;QACnE,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE;QACvC,gDAAgD;QAChD,OAAO,eAAe,CAAC;KACxB;IAED,mEAAmE;IACnE,MAAM,wBAAwB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa,CAAC,oBAAoB,EAAE,CAAC;IACnF,OAAO,wBAAwB,GAAG,eAAe,CAAC;AACpD,CAAC","sourcesContent":["import {\n type IdleTransaction,\n type Span as SpanClass,\n type Transaction,\n setMeasurement,\n spanToJSON,\n} from '@sentry/core';\nimport type { Span, TransactionContext, TransactionSource } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\n\nexport const defaultTransactionSource: TransactionSource = 'component';\nexport const customTransactionSource: TransactionSource = 'custom';\n\nexport const getBlankTransactionContext = (name: string): TransactionContext => {\n return {\n name: 'Route Change',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': name,\n },\n data: {},\n metadata: {\n source: defaultTransactionSource,\n },\n };\n};\n\n/**\n * A margin of error of 50ms is allowed for the async native bridge call.\n * Anything larger would reduce the accuracy of our frames measurements.\n */\nexport const MARGIN_OF_ERROR_SECONDS = 0.05;\n\nconst timeOriginMilliseconds = Date.now();\n\n/**\n *\n */\nexport function adjustTransactionDuration(\n maxDurationMs: number,\n transaction: IdleTransaction,\n endTimestamp: number,\n): void {\n const diff = endTimestamp - transaction.startTimestamp;\n const isOutdatedTransaction = endTimestamp && (diff > maxDurationMs || diff < 0);\n if (isOutdatedTransaction) {\n transaction.setStatus('deadline_exceeded');\n transaction.setTag('maxTransactionDurationExceeded', 'true');\n }\n}\n\n/**\n * Returns the timestamp where the JS global scope was initialized.\n */\nexport function getTimeOriginMilliseconds(): number {\n return timeOriginMilliseconds;\n}\n\n/**\n * Calls the callback every time a child span of the transaction is finished.\n */\nexport function instrumentChildSpanFinish(\n transaction: Transaction,\n callback: (span: SpanClass, endTimestamp?: number) => void,\n): void {\n if (transaction.spanRecorder) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalAdd = transaction.spanRecorder.add;\n\n transaction.spanRecorder.add = (span: SpanClass): void => {\n originalAdd.apply(transaction.spanRecorder, [span]);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSpanFinish = span.finish;\n\n span.finish = (endTimestamp?: number) => {\n originalSpanFinish.apply(span, [endTimestamp]);\n\n callback(span, endTimestamp);\n };\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSpanEnd = span.end;\n\n span.end = (endTimestamp?: number) => {\n originalSpanEnd.apply(span, [endTimestamp]);\n\n callback(span, endTimestamp);\n };\n };\n }\n}\n\n/**\n * Determines if the timestamp is now or within the specified margin of error from now.\n */\nexport function isNearToNow(timestamp: number): boolean {\n return Math.abs(timestampInSeconds() - timestamp) <= MARGIN_OF_ERROR_SECONDS;\n}\n\n/**\n * Sets the duration of the span as a measurement.\n * Uses `setMeasurement` function from @sentry/core.\n */\nexport function setSpanDurationAsMeasurement(name: string, span: Span): void {\n const spanEnd = spanToJSON(span).timestamp;\n const spanStart = spanToJSON(span).start_timestamp;\n if (!spanEnd || !spanStart) {\n return;\n }\n\n setMeasurement(name, (spanEnd - spanStart) * 1000, 'millisecond');\n}\n\n/**\n * Returns unix timestamp in ms of the bundle start time.\n *\n * If not available, returns undefined.\n */\nexport function getBundleStartTimestampMs(): number | undefined {\n const bundleStartTime = RN_GLOBAL_OBJ.__BUNDLE_START_TIME__;\n if (!bundleStartTime) {\n logger.warn('Missing the bundle start time on the global object.');\n return undefined;\n }\n\n if (!RN_GLOBAL_OBJ.nativePerformanceNow) {\n // bundleStartTime is Date.now() in milliseconds\n return bundleStartTime;\n }\n\n // nativePerformanceNow() is monotonic clock like performance.now()\n const approxStartingTimeOrigin = Date.now() - RN_GLOBAL_OBJ.nativePerformanceNow();\n return approxStartingTimeOrigin + bundleStartTime;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/tracing/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAgD,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAExG,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,MAAM,wBAAwB,GAAsB,WAAW,CAAC;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAsB,QAAQ,CAAC;AAEnE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAY,EAAsB,EAAE;IAC7E,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE;YACJ,yBAAyB,EAAE,IAAI;SAChC;QACD,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE;YACR,MAAM,EAAE,wBAAwB;SACjC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,MAAM,sBAAsB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAE1C;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,aAAqB,EACrB,WAA4B,EAC5B,YAAoB;IAEpB,MAAM,IAAI,GAAG,YAAY,GAAG,WAAW,CAAC,cAAc,CAAC;IACvD,MAAM,qBAAqB,GAAG,YAAY,IAAI,CAAC,IAAI,GAAG,aAAa,I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AAC","sourcesContent":["import type { Transaction } from '@sentry/core';\nimport { type IdleTransaction, type Span as SpanClass, setMeasurement, spanToJSON } from '@sentry/core';\nimport type { Span, Transaction as TransactionType, TransactionContext, TransactionSource } from '@sentry/types';\nimport { logger, timestampInSeconds } from '@sentry/utils';\n\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\n\nexport const defaultTransactionSource: TransactionSource = 'component';\nexport const customTransactionSource: TransactionSource = 'custom';\n\nexport const getBlankTransactionContext = (name: string): TransactionContext => {\n return {\n name: 'Route Change',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': name,\n },\n data: {},\n metadata: {\n source: defaultTransactionSource,\n },\n };\n};\n\n/**\n * A margin of error of 50ms is allowed for the async native bridge call.\n * Anything larger would reduce the accuracy of our frames measurements.\n */\nexport const MARGIN_OF_ERROR_SECONDS = 0.05;\n\nconst timeOriginMilliseconds = Date.now();\n\n/**\n *\n */\nexport function adjustTransactionDuration(\n maxDurationMs: number,\n transaction: IdleTransaction,\n endTimestamp: number,\n): void {\n const diff = endTimestamp - transaction.startTimestamp;\n const isOutdatedTransaction = endTimestamp && (diff > maxDurationMs || diff < 0);\n if (isOutdatedTransaction) {\n transaction.setStatus('deadline_exceeded');\n transaction.setTag('maxTransactionDurationExceeded', 'true');\n }\n}\n\n/**\n * Returns the timestamp where the JS global scope was initialized.\n */\nexport function getTimeOriginMilliseconds(): number {\n return timeOriginMilliseconds;\n}\n\n/**\n * Calls the callback every time a child span of the transaction is finished.\n */\nexport function instrumentChildSpanFinish(\n transaction: Transaction,\n callback: (span: SpanClass, endTimestamp?: number) => void,\n): void {\n if (transaction.spanRecorder) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalAdd = transaction.spanRecorder.add;\n\n transaction.spanRecorder.add = (span: SpanClass): void => {\n originalAdd.apply(transaction.spanRecorder, [span]);\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSpanFinish = span.finish;\n\n span.finish = (endTimestamp?: number) => {\n originalSpanFinish.apply(span, [endTimestamp]);\n\n callback(span, endTimestamp);\n };\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalSpanEnd = span.end;\n\n span.end = (endTimestamp?: number) => {\n originalSpanEnd.apply(span, [endTimestamp]);\n\n callback(span, endTimestamp);\n };\n };\n }\n}\n\n/**\n * Determines if the timestamp is now or within the specified margin of error from now.\n */\nexport function isNearToNow(timestamp: number): boolean {\n return Math.abs(timestampInSeconds() - timestamp) <= MARGIN_OF_ERROR_SECONDS;\n}\n\n/**\n * Sets the duration of the span as a measurement.\n * Uses `setMeasurement` function from @sentry/core.\n */\nexport function setSpanDurationAsMeasurement(name: string, span: Span): void {\n const { timestamp: spanEnd, start_timestamp: spanStart } = spanToJSON(span);\n if (!spanEnd || !spanStart) {\n return;\n }\n\n setMeasurement(name, (spanEnd - spanStart) * 1000, 'millisecond');\n}\n\n/**\n * Sets the duration of the span as a measurement.\n * Uses `setMeasurement` function from @sentry/core.\n */\nexport function setSpanDurationAsMeasurementOnTransaction(\n transaction: TransactionType,\n name: string,\n span: Span,\n): void {\n const { timestamp: spanEnd, start_timestamp: spanStart } = spanToJSON(span);\n if (!spanEnd || !spanStart) {\n return;\n }\n\n transaction.setMeasurement(name, (spanEnd - spanStart) * 1000, 'millisecond');\n}\n\n/**\n * Returns unix timestamp in ms of the bundle start time.\n *\n * If not available, returns undefined.\n */\nexport function getBundleStartTimestampMs(): number | undefined {\n const bundleStartTime = RN_GLOBAL_OBJ.__BUNDLE_START_TIME__;\n if (!bundleStartTime) {\n logger.warn('Missing the bundle start time on the global object.');\n return undefined;\n }\n\n if (!RN_GLOBAL_OBJ.nativePerformanceNow) {\n // bundleStartTime is Date.now() in milliseconds\n return bundleStartTime;\n }\n\n // nativePerformanceNow() is monotonic clock like performance.now()\n const approxStartingTimeOrigin = Date.now() - RN_GLOBAL_OBJ.nativePerformanceNow();\n return approxStartingTimeOrigin + bundleStartTime;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/js/utils/normalize.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAU5E"}
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/js/utils/normalize.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAe5E"}
@@ -6,14 +6,17 @@ const KEY = 'value';
6
6
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
7
  export function convertToNormalizedObject(data) {
8
8
  const normalized = normalize(data);
9
- if (normalized === null || typeof normalized !== 'object') {
9
+ if (normalized !== null &&
10
+ typeof normalized === 'object' &&
11
+ !Array.isArray(normalized) &&
12
+ normalized.constructor === Object) {
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ return normalized;
15
+ }
16
+ else {
10
17
  return {
11
18
  [KEY]: normalized,
12
19
  };
13
20
  }
14
- else {
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
- return normalized;
17
- }
18
21
  }
19
22
  //# sourceMappingURL=normalize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/js/utils/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB;;GAEG;AACH,8DAA8D;AAC9D,MAAM,UAAU,yBAAyB,CAAC,IAAa;IACrD,MAAM,UAAU,GAAY,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAI,UAAU,KAAK,IAAI,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QACzD,OAAO;YACL,CAAC,GAAG,CAAC,EAAE,UAAU;SAClB,CAAC;KACH;SAAM;QACL,8DAA8D;QAC9D,OAAO,UAAiC,CAAC;KAC1C;AACH,CAAC","sourcesContent":["import { normalize } from '@sentry/utils';\n\nconst KEY = 'value';\n\n/**\n * Converts any input into a valid record with string keys.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function convertToNormalizedObject(data: unknown): Record<string, any> {\n const normalized: unknown = normalize(data);\n if (normalized === null || typeof normalized !== 'object') {\n return {\n [KEY]: normalized,\n };\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return normalized as Record<string, any>;\n }\n}\n"]}
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/js/utils/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB;;GAEG;AACH,8DAA8D;AAC9D,MAAM,UAAU,yBAAyB,CAAC,IAAa;IACrD,MAAM,UAAU,GAAY,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5C,IACE,UAAU,KAAK,IAAI;QACnB,OAAO,UAAU,KAAK,QAAQ;QAC9B,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QAC1B,UAAU,CAAC,WAAW,KAAK,MAAM,EACjC;QACA,8DAA8D;QAC9D,OAAO,UAAiC,CAAC;KAC1C;SAAM;QACL,OAAO;YACL,CAAC,GAAG,CAAC,EAAE,UAAU;SAClB,CAAC;KACH;AACH,CAAC","sourcesContent":["import { normalize } from '@sentry/utils';\n\nconst KEY = 'value';\n\n/**\n * Converts any input into a valid record with string keys.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function convertToNormalizedObject(data: unknown): Record<string, any> {\n const normalized: unknown = normalize(data);\n if (\n normalized !== null &&\n typeof normalized === 'object' &&\n !Array.isArray(normalized) &&\n normalized.constructor === Object\n ) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return normalized as Record<string, any>;\n } else {\n return {\n [KEY]: normalized,\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"rnlibraries.d.ts","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,6BAA6B,CA6BxE,CAAC"}
1
+ {"version":3,"file":"rnlibraries.d.ts","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE5E,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,6BAA6B,CAmCxE,CAAC"}
@@ -27,5 +27,11 @@ export const ReactNativeLibraries = {
27
27
  version: (_a = Platform.constants) === null || _a === void 0 ? void 0 : _a.reactNativeVersion,
28
28
  },
29
29
  TurboModuleRegistry,
30
+ ReactNative: {
31
+ requireNativeComponent: (viewName) => {
32
+ const { requireNativeComponent } = require('react-native');
33
+ return requireNativeComponent(viewName);
34
+ },
35
+ },
30
36
  };
31
37
  //# sourceMappingURL=rnlibraries.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rnlibraries.js","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.ts"],"names":[],"mappings":"AAAA,uDAAuD;;AAEvD,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAK7D,MAAM,CAAC,MAAM,oBAAoB,GAA4C;IAC3E,QAAQ,EAAE;QACR,eAAe,EAAE,CAAC,UAAkB,EAAiC,EAAE;YACrE,MAAM,eAAe,GAAG,OAAO,CAAC,sDAAsD,CAAC,CAAC;YACxF,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC;QACD,qBAAqB,EAAE,CACrB,KAAoC,EACpC,SAAmC,EACU,EAAE;YAC/C,MAAM,qBAAqB,GAAG,OAAO,CAAC,4DAA4D,CAAC,CAAC;YACpG,OAAO,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACjD,CAAC;QACD,YAAY,EAAE,GAA8B,EAAE;YAC5C,MAAM,YAAY,GAAG,OAAO,CAAC,mDAAmD,CAAC,CAAC;YAClF,OAAO,YAAY,EAAE,CAAC;QACxB,CAAC;KACF;IACD,OAAO,EAAE,OAAO,CAAC,gCAAgC,CAAC;IAClD,SAAS,EAAE;QACT,cAAc,EAAE,CAAI,IAAY,EAAE,QAAiB,EAAQ,EAAE;YAC3D,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,oDAAoD,CAAC,CAAC;YACzF,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjC,CAAC;KACF;IACD,kBAAkB,EAAE;QAClB,OAAO,EAAE,MAAA,QAAQ,CAAC,SAAS,0CAAE,kBAAkB;KAChD;IACD,mBAAmB;CACpB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n\nimport { Platform, TurboModuleRegistry } from 'react-native';\n\nimport type * as ReactNative from '../vendor/react-native';\nimport type { ReactNativeLibrariesInterface } from './rnlibrariesinterface';\n\nexport const ReactNativeLibraries: Required<ReactNativeLibrariesInterface> = {\n Devtools: {\n parseErrorStack: (errorStack: string): Array<ReactNative.StackFrame> => {\n const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');\n return parseErrorStack(errorStack);\n },\n symbolicateStackTrace: (\n stack: Array<ReactNative.StackFrame>,\n extraData?: Record<string, unknown>,\n ): Promise<ReactNative.SymbolicatedStackTrace> => {\n const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');\n return symbolicateStackTrace(stack, extraData);\n },\n getDevServer: (): ReactNative.DevServerInfo => {\n const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');\n return getDevServer();\n },\n },\n Promise: require('react-native/Libraries/Promise'),\n Utilities: {\n polyfillGlobal: <T>(name: string, getValue: () => T): void => {\n const { polyfillGlobal } = require('react-native/Libraries/Utilities/PolyfillFunctions');\n polyfillGlobal(name, getValue);\n },\n },\n ReactNativeVersion: {\n version: Platform.constants?.reactNativeVersion,\n },\n TurboModuleRegistry,\n};\n"]}
1
+ {"version":3,"file":"rnlibraries.js","sourceRoot":"","sources":["../../../src/js/utils/rnlibraries.ts"],"names":[],"mappings":"AAAA,uDAAuD;;AAEvD,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAK7D,MAAM,CAAC,MAAM,oBAAoB,GAA4C;IAC3E,QAAQ,EAAE;QACR,eAAe,EAAE,CAAC,UAAkB,EAAiC,EAAE;YACrE,MAAM,eAAe,GAAG,OAAO,CAAC,sDAAsD,CAAC,CAAC;YACxF,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC;QACD,qBAAqB,EAAE,CACrB,KAAoC,EACpC,SAAmC,EACU,EAAE;YAC/C,MAAM,qBAAqB,GAAG,OAAO,CAAC,4DAA4D,CAAC,CAAC;YACpG,OAAO,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACjD,CAAC;QACD,YAAY,EAAE,GAA8B,EAAE;YAC5C,MAAM,YAAY,GAAG,OAAO,CAAC,mDAAmD,CAAC,CAAC;YAClF,OAAO,YAAY,EAAE,CAAC;QACxB,CAAC;KACF;IACD,OAAO,EAAE,OAAO,CAAC,gCAAgC,CAAC;IAClD,SAAS,EAAE;QACT,cAAc,EAAE,CAAI,IAAY,EAAE,QAAiB,EAAQ,EAAE;YAC3D,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,oDAAoD,CAAC,CAAC;YACzF,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjC,CAAC;KACF;IACD,kBAAkB,EAAE;QAClB,OAAO,EAAE,MAAA,QAAQ,CAAC,SAAS,0CAAE,kBAAkB;KAChD;IACD,mBAAmB;IACnB,WAAW,EAAE;QACX,sBAAsB,EAAE,CAAI,QAAgB,EAAgC,EAAE;YAC5E,MAAM,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;YAC3D,OAAO,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;KACF;CACF,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n\nimport { Platform, TurboModuleRegistry } from 'react-native';\n\nimport type * as ReactNative from '../vendor/react-native';\nimport type { ReactNativeLibrariesInterface } from './rnlibrariesinterface';\n\nexport const ReactNativeLibraries: Required<ReactNativeLibrariesInterface> = {\n Devtools: {\n parseErrorStack: (errorStack: string): Array<ReactNative.StackFrame> => {\n const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');\n return parseErrorStack(errorStack);\n },\n symbolicateStackTrace: (\n stack: Array<ReactNative.StackFrame>,\n extraData?: Record<string, unknown>,\n ): Promise<ReactNative.SymbolicatedStackTrace> => {\n const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');\n return symbolicateStackTrace(stack, extraData);\n },\n getDevServer: (): ReactNative.DevServerInfo => {\n const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');\n return getDevServer();\n },\n },\n Promise: require('react-native/Libraries/Promise'),\n Utilities: {\n polyfillGlobal: <T>(name: string, getValue: () => T): void => {\n const { polyfillGlobal } = require('react-native/Libraries/Utilities/PolyfillFunctions');\n polyfillGlobal(name, getValue);\n },\n },\n ReactNativeVersion: {\n version: Platform.constants?.reactNativeVersion,\n },\n TurboModuleRegistry,\n ReactNative: {\n requireNativeComponent: <T>(viewName: string): ReactNative.HostComponent<T> => {\n const { requireNativeComponent } = require('react-native');\n return requireNativeComponent(viewName);\n },\n },\n};\n"]}
@@ -13,5 +13,8 @@ export interface ReactNativeLibrariesInterface {
13
13
  Promise?: typeof Promise;
14
14
  ReactNativeVersion?: ReactNative.ReactNativeVersion;
15
15
  TurboModuleRegistry?: ReactNative.TurboModuleRegistry;
16
+ ReactNative?: {
17
+ requireNativeComponent?: <T>(viewName: string) => ReactNative.HostComponent<T>;
18
+ };
16
19
  }
17
20
  //# sourceMappingURL=rnlibrariesinterface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rnlibrariesinterface.d.ts","sourceRoot":"","sources":["../../../src/js/utils/rnlibrariesinterface.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,WAAW,MAAM,wBAAwB,CAAC;AAE3D,YAAY,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,YAAY,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAE9F,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,EAAE;QACT,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QACvE,qBAAqB,EAAE,CACrB,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,EACpC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAChC,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;QACjD,YAAY,EAAE,MAAM,WAAW,CAAC,aAAa,CAAC;KAC/C,CAAC;IACF,SAAS,CAAC,EAAE;QACV,cAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;KAC9D,CAAC;IACF,OAAO,CAAC,EAAE,OAAO,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC;IACpD,mBAAmB,CAAC,EAAE,WAAW,CAAC,mBAAmB,CAAC;CACvD"}
1
+ {"version":3,"file":"rnlibrariesinterface.d.ts","sourceRoot":"","sources":["../../../src/js/utils/rnlibrariesinterface.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,WAAW,MAAM,wBAAwB,CAAC;AAE3D,YAAY,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,YAAY,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAE9F,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,EAAE;QACT,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QACvE,qBAAqB,EAAE,CACrB,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,EACpC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAChC,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;QACjD,YAAY,EAAE,MAAM,WAAW,CAAC,aAAa,CAAC;KAC/C,CAAC;IACF,SAAS,CAAC,EAAE;QACV,cAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;KAC9D,CAAC;IACF,OAAO,CAAC,EAAE,OAAO,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC;IACpD,mBAAmB,CAAC,EAAE,WAAW,CAAC,mBAAmB,CAAC;IACtD,WAAW,CAAC,EAAE;QACZ,sBAAsB,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;KAChF,CAAC;CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"rnlibrariesinterface.js","sourceRoot":"","sources":["../../../src/js/utils/rnlibrariesinterface.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,yFAAyF;AACzF,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,EAAE","sourcesContent":["//\n// This interface contains all of react-native internals Libraries used in Sentry RN SDK.\n//\n// Containing the internals in one place enables us to handle platforms\n// that don't have all the internals available. For example react-native-web.\n//\n\nimport type * as ReactNative from '../vendor/react-native';\n\nexport type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';\nexport type { EmitterSubscription } from 'react-native/Libraries/vendor/emitter/EventEmitter';\n\nexport interface ReactNativeLibrariesInterface {\n Devtools?: {\n parseErrorStack: (errorStack: string) => Array<ReactNative.StackFrame>;\n symbolicateStackTrace: (\n stack: Array<ReactNative.StackFrame>,\n extraData?: Record<string, unknown>,\n ) => Promise<ReactNative.SymbolicatedStackTrace>;\n getDevServer: () => ReactNative.DevServerInfo;\n };\n Utilities?: {\n polyfillGlobal: <T>(name: string, getValue: () => T) => void;\n };\n Promise?: typeof Promise;\n ReactNativeVersion?: ReactNative.ReactNativeVersion;\n TurboModuleRegistry?: ReactNative.TurboModuleRegistry;\n}\n"]}
1
+ {"version":3,"file":"rnlibrariesinterface.js","sourceRoot":"","sources":["../../../src/js/utils/rnlibrariesinterface.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,yFAAyF;AACzF,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,EAAE","sourcesContent":["//\n// This interface contains all of react-native internals Libraries used in Sentry RN SDK.\n//\n// Containing the internals in one place enables us to handle platforms\n// that don't have all the internals available. For example react-native-web.\n//\n\nimport type * as ReactNative from '../vendor/react-native';\n\nexport type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';\nexport type { EmitterSubscription } from 'react-native/Libraries/vendor/emitter/EventEmitter';\n\nexport interface ReactNativeLibrariesInterface {\n Devtools?: {\n parseErrorStack: (errorStack: string) => Array<ReactNative.StackFrame>;\n symbolicateStackTrace: (\n stack: Array<ReactNative.StackFrame>,\n extraData?: Record<string, unknown>,\n ) => Promise<ReactNative.SymbolicatedStackTrace>;\n getDevServer: () => ReactNative.DevServerInfo;\n };\n Utilities?: {\n polyfillGlobal: <T>(name: string, getValue: () => T) => void;\n };\n Promise?: typeof Promise;\n ReactNativeVersion?: ReactNative.ReactNativeVersion;\n TurboModuleRegistry?: ReactNative.TurboModuleRegistry;\n ReactNative?: {\n requireNativeComponent?: <T>(viewName: string) => ReactNative.HostComponent<T>;\n };\n}\n"]}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type StackFrame = {
2
3
  column?: number;
3
4
  file?: string;
@@ -31,6 +32,9 @@ export type TurboModuleRegistry = {
31
32
  get<T extends TurboModule>(name: string): T | null;
32
33
  getEnforcing<T extends TurboModule>(name: string): T;
33
34
  };
35
+ export interface HostComponent<P> extends Pick<React.ComponentClass<P>, Exclude<keyof React.ComponentClass<P>, 'new'>> {
36
+ new (props: P, context?: any): React.Component<P> & Readonly<unknown>;
37
+ }
34
38
  export type ReactNativeVersion = {
35
39
  version: {
36
40
  major: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/js/vendor/react-native/index.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAGF,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QACvB,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAGH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC,CAAC;AAGH,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,GAAG,EAAE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KAAK,CAAC,UAAU,CAAC,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC,CAAC;AAGH,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,OAAO,CAAC;CACjC,CAAC;AAGF,KAAK,WAAW,GAAG;IACjB,YAAY,CAAC,IAAI,MAAM,CAAC;CACzB,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC;IACnD,YAAY,CAAC,CAAC,SAAS,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC;CACtD,CAAC;AAGF,MAAM,WAAW,aAAa,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACpH,KAAK,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;CACvE;AAGD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;KACxC,CAAC;CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/js/vendor/react-native/index.ts"],"names":[],"mappings":"AAAA,cAAc","sourcesContent":["// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/NativeExceptionsManager.js#L17\nexport type StackFrame = {\n column?: number;\n file?: string;\n lineNumber?: number;\n methodName: string;\n collapse?: boolean;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js#L17\nexport type CodeFrame = Readonly<{\n content: string;\n location?: {\n [key: string]: unknown;\n row: number;\n column: number;\n };\n fileName: string;\n}>;\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js#L27\nexport type SymbolicatedStackTrace = Readonly<{\n stack: Array<StackFrame>;\n codeFrame?: CodeFrame;\n}>;\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/getDevServer.js#L17\nexport type DevServerInfo = {\n [key: string]: unknown;\n url: string;\n fullBundleUrl?: string;\n bundleLoadedFromServer: boolean;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/TurboModule/RCTExport.d.ts#L10\ntype TurboModule = {\n getConstants?(): object;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/TurboModule/TurboModuleRegistry.d.ts#L12\nexport type TurboModuleRegistry = {\n get<T extends TurboModule>(name: string): T | null;\n getEnforcing<T extends TurboModule>(name: string): T;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/575ab7862553d7ad7bc753951ed19dcd50d59b95/packages/react-native/Libraries/Utilities/Platform.d.ts#L23-L28\nexport type ReactNativeVersion = {\n version: {\n major: number;\n minor: number;\n patch: number;\n prerelease?: number | null | undefined;\n };\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/js/vendor/react-native/index.ts"],"names":[],"mappings":"AAAA,cAAc","sourcesContent":["// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/NativeExceptionsManager.js#L17\nexport type StackFrame = {\n column?: number;\n file?: string;\n lineNumber?: number;\n methodName: string;\n collapse?: boolean;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js#L17\nexport type CodeFrame = Readonly<{\n content: string;\n location?: {\n [key: string]: unknown;\n row: number;\n column: number;\n };\n fileName: string;\n}>;\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js#L27\nexport type SymbolicatedStackTrace = Readonly<{\n stack: Array<StackFrame>;\n codeFrame?: CodeFrame;\n}>;\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/Core/Devtools/getDevServer.js#L17\nexport type DevServerInfo = {\n [key: string]: unknown;\n url: string;\n fullBundleUrl?: string;\n bundleLoadedFromServer: boolean;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/TurboModule/RCTExport.d.ts#L10\ntype TurboModule = {\n getConstants?(): object;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/Libraries/TurboModule/TurboModuleRegistry.d.ts#L12\nexport type TurboModuleRegistry = {\n get<T extends TurboModule>(name: string): T | null;\n getEnforcing<T extends TurboModule>(name: string): T;\n};\n\n// Adapted from https://github.com/facebook/react-native/blob/3f8340975b35767b192e3118f05d2b039676052e/packages/react-native/types/public/ReactNativeTypes.d.ts#L137\nexport interface HostComponent<P> extends Pick<React.ComponentClass<P>, Exclude<keyof React.ComponentClass<P>, 'new'>> {\n new (props: P, context?: any): React.Component<P> & Readonly<unknown>;\n}\n\n// Adapted from https://github.com/facebook/react-native/blob/575ab7862553d7ad7bc753951ed19dcd50d59b95/packages/react-native/Libraries/Utilities/Platform.d.ts#L23-L28\nexport type ReactNativeVersion = {\n version: {\n major: number;\n minor: number;\n patch: number;\n prerelease?: number | null | undefined;\n };\n};\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.28.0";
3
+ export declare const SDK_VERSION = "5.29.0";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -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.28.0';
3
+ export const SDK_VERSION = '5.29.0';
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.28.0';\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,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.29.0';\n"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "5.28.0",
5
+ "version": "5.29.0",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -68,22 +68,22 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@sentry/babel-plugin-component-annotate": "2.20.1",
71
- "@sentry/browser": "7.117.0",
71
+ "@sentry/browser": "7.118.0",
72
72
  "@sentry/cli": "2.31.2",
73
- "@sentry/core": "7.117.0",
74
- "@sentry/hub": "7.117.0",
75
- "@sentry/integrations": "7.117.0",
76
- "@sentry/react": "7.117.0",
77
- "@sentry/types": "7.117.0",
78
- "@sentry/utils": "7.117.0"
73
+ "@sentry/core": "7.118.0",
74
+ "@sentry/hub": "7.118.0",
75
+ "@sentry/integrations": "7.118.0",
76
+ "@sentry/react": "7.118.0",
77
+ "@sentry/types": "7.118.0",
78
+ "@sentry/utils": "7.118.0"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@babel/core": "^7.23.5",
82
82
  "@expo/metro-config": "0.17.5",
83
83
  "@mswjs/interceptors": "^0.25.15",
84
- "@sentry-internal/eslint-config-sdk": "7.117.0",
85
- "@sentry-internal/eslint-plugin-sdk": "7.117.0",
86
- "@sentry-internal/typescript": "7.117.0",
84
+ "@sentry-internal/eslint-config-sdk": "7.118.0",
85
+ "@sentry-internal/eslint-plugin-sdk": "7.118.0",
86
+ "@sentry-internal/typescript": "7.118.0",
87
87
  "@sentry/wizard": "3.16.3",
88
88
  "@types/jest": "^29.5.3",
89
89
  "@types/node": "^20.9.3",
@@ -130,5 +130,6 @@
130
130
  "expo": {
131
131
  "optional": true
132
132
  }
133
- }
133
+ },
134
+ "packageManager": "yarn@1.22.22"
134
135
  }
@@ -1,5 +1,6 @@
1
- import type { IdleTransaction, Span as SpanClass, Transaction } from '@sentry/core';
2
- import type { Span, TransactionContext, TransactionSource } from '@sentry/types';
1
+ import type { Transaction } from '@sentry/core';
2
+ import type { IdleTransaction, Span as SpanClass } from '@sentry/core';
3
+ import type { Span, Transaction as TransactionType, TransactionContext, TransactionSource } from '@sentry/types';
3
4
  export declare const defaultTransactionSource: TransactionSource;
4
5
  export declare const customTransactionSource: TransactionSource;
5
6
  export declare const getBlankTransactionContext: (name: string) => TransactionContext;
@@ -29,6 +30,11 @@ export declare function isNearToNow(timestamp: number): boolean;
29
30
  * Uses `setMeasurement` function from @sentry/core.
30
31
  */
31
32
  export declare function setSpanDurationAsMeasurement(name: string, span: Span): void;
33
+ /**
34
+ * Sets the duration of the span as a measurement.
35
+ * Uses `setMeasurement` function from @sentry/core.
36
+ */
37
+ export declare function setSpanDurationAsMeasurementOnTransaction(transaction: TransactionType, name: string, span: Span): void;
32
38
  /**
33
39
  * Returns unix timestamp in ms of the bundle start time.
34
40
  *
@@ -13,5 +13,8 @@ export interface ReactNativeLibrariesInterface {
13
13
  Promise?: typeof Promise;
14
14
  ReactNativeVersion?: ReactNative.ReactNativeVersion;
15
15
  TurboModuleRegistry?: ReactNative.TurboModuleRegistry;
16
+ ReactNative?: {
17
+ requireNativeComponent?: <T>(viewName: string) => ReactNative.HostComponent<T>;
18
+ };
16
19
  }
17
20
  //# sourceMappingURL=rnlibrariesinterface.d.ts.map
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type StackFrame = {
2
3
  column?: number;
3
4
  file?: string;
@@ -31,6 +32,9 @@ export type TurboModuleRegistry = {
31
32
  get<T extends TurboModule>(name: string): T | null;
32
33
  getEnforcing<T extends TurboModule>(name: string): T;
33
34
  };
35
+ export interface HostComponent<P> extends Pick<React.ComponentClass<P>, Exclude<keyof React.ComponentClass<P>, 'new'>> {
36
+ new (props: P, context?: any): React.Component<P> & Readonly<unknown>;
37
+ }
34
38
  export type ReactNativeVersion = {
35
39
  version: {
36
40
  major: number;
@@ -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.28.0";
3
+ export declare const SDK_VERSION = "5.29.0";
4
4
  //# sourceMappingURL=version.d.ts.map