@sentry/react-native 7.0.0-alpha.0 → 7.0.0-beta.1
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.
- package/RNSentry.podspec +10 -3
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +16 -0
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/dist/js/NativeRNSentry.d.ts +1 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts +1 -0
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +16 -2
- package/dist/js/client.js.map +1 -1
- package/dist/js/feedback/FeedbackButton.d.ts +23 -0
- package/dist/js/feedback/FeedbackButton.d.ts.map +1 -0
- package/dist/js/feedback/FeedbackButton.js +51 -0
- package/dist/js/feedback/FeedbackButton.js.map +1 -0
- package/dist/js/feedback/FeedbackWidget.d.ts +14 -1
- package/dist/js/feedback/FeedbackWidget.d.ts.map +1 -1
- package/dist/js/feedback/FeedbackWidget.js +144 -48
- package/dist/js/feedback/FeedbackWidget.js.map +1 -1
- package/dist/js/feedback/FeedbackWidget.styles.d.ts +6 -3
- package/dist/js/feedback/FeedbackWidget.styles.d.ts.map +1 -1
- package/dist/js/feedback/FeedbackWidget.styles.js +155 -106
- package/dist/js/feedback/FeedbackWidget.styles.js.map +1 -1
- package/dist/js/feedback/FeedbackWidget.theme.d.ts +37 -0
- package/dist/js/feedback/FeedbackWidget.theme.d.ts.map +1 -0
- package/dist/js/feedback/FeedbackWidget.theme.js +31 -0
- package/dist/js/feedback/FeedbackWidget.theme.js.map +1 -0
- package/dist/js/feedback/FeedbackWidget.types.d.ts +71 -2
- package/dist/js/feedback/FeedbackWidget.types.d.ts.map +1 -1
- package/dist/js/feedback/FeedbackWidget.types.js.map +1 -1
- package/dist/js/feedback/FeedbackWidgetManager.d.ts +43 -23
- package/dist/js/feedback/FeedbackWidgetManager.d.ts.map +1 -1
- package/dist/js/feedback/FeedbackWidgetManager.js +62 -138
- package/dist/js/feedback/FeedbackWidgetManager.js.map +1 -1
- package/dist/js/feedback/FeedbackWidgetProvider.d.ts +48 -0
- package/dist/js/feedback/FeedbackWidgetProvider.d.ts.map +1 -0
- package/dist/js/feedback/FeedbackWidgetProvider.js +176 -0
- package/dist/js/feedback/FeedbackWidgetProvider.js.map +1 -0
- package/dist/js/feedback/ScreenshotButton.d.ts +25 -0
- package/dist/js/feedback/ScreenshotButton.d.ts.map +1 -0
- package/dist/js/feedback/ScreenshotButton.js +80 -0
- package/dist/js/feedback/ScreenshotButton.js.map +1 -0
- package/dist/js/feedback/defaults.d.ts +3 -1
- package/dist/js/feedback/defaults.d.ts.map +1 -1
- package/dist/js/feedback/defaults.js +15 -0
- package/dist/js/feedback/defaults.js.map +1 -1
- package/dist/js/feedback/icons.d.ts +30 -0
- package/dist/js/feedback/icons.d.ts.map +1 -0
- package/dist/js/feedback/icons.js +30 -0
- package/dist/js/feedback/icons.js.map +1 -0
- package/dist/js/feedback/integration.d.ts +19 -2
- package/dist/js/feedback/integration.d.ts.map +1 -1
- package/dist/js/feedback/integration.js +58 -3
- package/dist/js/feedback/integration.js.map +1 -1
- package/dist/js/feedback/lazy.d.ts +10 -0
- package/dist/js/feedback/lazy.d.ts.map +1 -1
- package/dist/js/feedback/lazy.js +24 -0
- package/dist/js/feedback/lazy.js.map +1 -1
- package/dist/js/feedback/utils.d.ts.map +1 -1
- package/dist/js/feedback/utils.js.map +1 -1
- package/dist/js/index.d.ts +5 -3
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +4 -2
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/appRegistry.d.ts.map +1 -1
- package/dist/js/integrations/appRegistry.js.map +1 -1
- package/dist/js/integrations/breadcrumbs.d.ts +47 -0
- package/dist/js/integrations/breadcrumbs.d.ts.map +1 -0
- package/dist/js/integrations/breadcrumbs.js +15 -0
- package/dist/js/integrations/breadcrumbs.js.map +1 -0
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +2 -2
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/devicecontext.d.ts.map +1 -1
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/expocontext.d.ts.map +1 -1
- package/dist/js/integrations/expocontext.js.map +1 -1
- package/dist/js/integrations/exports.d.ts +2 -1
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +2 -1
- package/dist/js/integrations/exports.js.map +1 -1
- package/dist/js/integrations/modulesloader.d.ts.map +1 -1
- package/dist/js/integrations/modulesloader.js.map +1 -1
- package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
- package/dist/js/integrations/nativelinkederrors.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +65 -31
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlersutils.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -1
- package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
- package/dist/js/integrations/reactnativeinfo.js.map +1 -1
- package/dist/js/integrations/release.d.ts.map +1 -1
- package/dist/js/integrations/release.js.map +1 -1
- package/dist/js/integrations/rewriteframes.d.ts.map +1 -1
- package/dist/js/integrations/rewriteframes.js.map +1 -1
- package/dist/js/integrations/screenshot.d.ts.map +1 -1
- package/dist/js/integrations/screenshot.js.map +1 -1
- package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/integrations/spotlight.d.ts.map +1 -1
- package/dist/js/integrations/spotlight.js.map +1 -1
- package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
- package/dist/js/integrations/viewhierarchy.js.map +1 -1
- package/dist/js/options.d.ts +4 -2
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js +2 -3
- package/dist/js/options.js.map +1 -1
- package/dist/js/playground/animations.d.ts +4 -0
- package/dist/js/playground/animations.d.ts.map +1 -0
- package/dist/js/playground/animations.js +4 -0
- package/dist/js/playground/animations.js.map +1 -0
- package/dist/js/playground/examples.d.ts +13 -0
- package/dist/js/playground/examples.d.ts.map +1 -0
- package/dist/js/playground/examples.js +35 -0
- package/dist/js/playground/examples.js.map +1 -0
- package/dist/js/playground/images.d.ts +4 -0
- package/dist/js/playground/images.d.ts.map +1 -0
- package/dist/js/playground/images.js +4 -0
- package/dist/js/playground/images.js.map +1 -0
- package/dist/js/playground/index.d.ts +2 -0
- package/dist/js/playground/index.d.ts.map +1 -0
- package/dist/js/playground/index.js +2 -0
- package/dist/js/playground/index.js.map +1 -0
- package/dist/js/playground/modal.d.ts +29 -0
- package/dist/js/playground/modal.d.ts.map +1 -0
- package/dist/js/playground/modal.js +259 -0
- package/dist/js/playground/modal.js.map +1 -0
- package/dist/js/profiling/convertHermesProfile.d.ts.map +1 -1
- package/dist/js/profiling/convertHermesProfile.js.map +1 -1
- package/dist/js/profiling/debugid.d.ts.map +1 -1
- package/dist/js/profiling/debugid.js.map +1 -1
- package/dist/js/profiling/hermes.d.ts.map +1 -1
- package/dist/js/profiling/hermes.js.map +1 -1
- package/dist/js/profiling/integration.d.ts.map +1 -1
- package/dist/js/profiling/integration.js.map +1 -1
- package/dist/js/profiling/types.d.ts.map +1 -1
- package/dist/js/profiling/types.js.map +1 -1
- package/dist/js/profiling/utils.d.ts.map +1 -1
- package/dist/js/profiling/utils.js.map +1 -1
- package/dist/js/replay/CustomMask.d.ts.map +1 -1
- package/dist/js/replay/CustomMask.js.map +1 -1
- package/dist/js/replay/browserReplay.d.ts +13 -1
- package/dist/js/replay/browserReplay.d.ts.map +1 -1
- package/dist/js/replay/browserReplay.js +26 -0
- package/dist/js/replay/browserReplay.js.map +1 -1
- package/dist/js/replay/mobilereplay.d.ts +14 -1
- package/dist/js/replay/mobilereplay.d.ts.map +1 -1
- package/dist/js/replay/mobilereplay.js +9 -7
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/replay/networkUtils.d.ts.map +1 -1
- package/dist/js/replay/networkUtils.js +4 -11
- package/dist/js/replay/networkUtils.js.map +1 -1
- package/dist/js/replay/replayInterface.d.ts +52 -0
- package/dist/js/replay/replayInterface.d.ts.map +1 -0
- package/dist/js/replay/replayInterface.js +2 -0
- package/dist/js/replay/replayInterface.js.map +1 -0
- package/dist/js/replay/xhrUtils.d.ts.map +1 -1
- package/dist/js/replay/xhrUtils.js.map +1 -1
- package/dist/js/scopeSync.d.ts.map +1 -1
- package/dist/js/scopeSync.js.map +1 -1
- package/dist/js/sdk.d.ts +1 -6
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +7 -19
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/collectModules.js.map +1 -1
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js +1 -1
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.js +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
- package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
- package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
- package/dist/js/tools/vendor/metro/utils.js.map +1 -1
- package/dist/js/touchevents.d.ts.map +1 -1
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
- package/dist/js/tracing/gesturetracing.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.d.ts +7 -1
- package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +61 -10
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
- package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -1
- package/dist/js/tracing/integrations/stalltracking.js.map +1 -1
- package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -1
- package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
- package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -1
- package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
- package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
- package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
- package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
- package/dist/js/tracing/reactnativenavigation.js.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/span.d.ts.map +1 -1
- package/dist/js/tracing/span.js +5 -5
- package/dist/js/tracing/span.js.map +1 -1
- package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.js +13 -13
- package/dist/js/tracing/timetodisplay.js.map +1 -1
- package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplaynative.js.map +1 -1
- package/dist/js/tracing/utils.d.ts.map +1 -1
- package/dist/js/tracing/utils.js.map +1 -1
- package/dist/js/transports/encodePolyfill.d.ts +4 -0
- package/dist/js/transports/encodePolyfill.d.ts.map +1 -1
- package/dist/js/transports/encodePolyfill.js +19 -5
- package/dist/js/transports/encodePolyfill.js.map +1 -1
- package/dist/js/transports/native.d.ts.map +1 -1
- package/dist/js/transports/native.js.map +1 -1
- package/dist/js/utils/carrier.d.ts +5 -0
- package/dist/js/utils/carrier.d.ts.map +1 -0
- package/dist/js/utils/carrier.js +11 -0
- package/dist/js/utils/carrier.js.map +1 -0
- package/dist/js/utils/encode.d.ts +5 -0
- package/dist/js/utils/encode.d.ts.map +1 -0
- package/dist/js/utils/encode.js +13 -0
- package/dist/js/utils/encode.js.map +1 -0
- package/dist/js/utils/environment.d.ts.map +1 -1
- package/dist/js/utils/environment.js +3 -3
- package/dist/js/utils/environment.js.map +1 -1
- package/dist/js/utils/expoglobalobject.d.ts +2 -1
- package/dist/js/utils/expoglobalobject.d.ts.map +1 -1
- package/dist/js/utils/expoglobalobject.js.map +1 -1
- package/dist/js/utils/expomodules.d.ts +5 -1
- package/dist/js/utils/expomodules.d.ts.map +1 -1
- package/dist/js/utils/expomodules.js +7 -0
- package/dist/js/utils/expomodules.js.map +1 -1
- package/dist/js/utils/rnlibraries.d.ts.map +1 -1
- package/dist/js/utils/rnlibraries.js.map +1 -1
- package/dist/js/utils/safe.d.ts.map +1 -1
- package/dist/js/utils/safe.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +10 -2
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/worldwide.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +1 -0
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +25 -8
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +24 -0
- package/ios/RNSentryOnDrawReporter.m +4 -0
- package/ios/RNSentryReplay.mm +1 -2
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +13 -13
- package/plugin/build/withSentry.js +2 -2
- package/plugin/build/withSentryAndroidGradlePlugin.js +2 -2
- package/react-native.config.js +4 -4
- package/scripts/expo-upload-sourcemaps.js +2 -2
- package/scripts/sentry_utils.rb +5 -0
- package/src/js/NativeRNSentry.ts +1 -1
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -0
- package/ts3.8/dist/js/client.d.ts +1 -0
- package/ts3.8/dist/js/feedback/FeedbackButton.d.ts +23 -0
- package/ts3.8/dist/js/feedback/FeedbackWidget.d.ts +14 -1
- package/ts3.8/dist/js/feedback/FeedbackWidget.styles.d.ts +6 -3
- package/ts3.8/dist/js/feedback/FeedbackWidget.theme.d.ts +37 -0
- package/ts3.8/dist/js/feedback/FeedbackWidget.types.d.ts +71 -2
- package/ts3.8/dist/js/feedback/FeedbackWidgetManager.d.ts +43 -23
- package/ts3.8/dist/js/feedback/FeedbackWidgetProvider.d.ts +48 -0
- package/ts3.8/dist/js/feedback/ScreenshotButton.d.ts +25 -0
- package/ts3.8/dist/js/feedback/defaults.d.ts +3 -1
- package/ts3.8/dist/js/feedback/icons.d.ts +30 -0
- package/ts3.8/dist/js/feedback/integration.d.ts +19 -2
- package/ts3.8/dist/js/feedback/lazy.d.ts +10 -0
- package/ts3.8/dist/js/index.d.ts +5 -3
- package/ts3.8/dist/js/integrations/breadcrumbs.d.ts +47 -0
- package/ts3.8/dist/js/integrations/exports.d.ts +2 -1
- package/ts3.8/dist/js/options.d.ts +4 -2
- package/ts3.8/dist/js/playground/animations.d.ts +4 -0
- package/ts3.8/dist/js/playground/examples.d.ts +13 -0
- package/ts3.8/dist/js/playground/images.d.ts +4 -0
- package/ts3.8/dist/js/playground/index.d.ts +2 -0
- package/ts3.8/dist/js/playground/modal.d.ts +29 -0
- package/ts3.8/dist/js/replay/browserReplay.d.ts +13 -1
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +14 -1
- package/ts3.8/dist/js/replay/replayInterface.d.ts +52 -0
- package/ts3.8/dist/js/sdk.d.ts +1 -6
- package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +7 -1
- package/ts3.8/dist/js/transports/encodePolyfill.d.ts +4 -0
- package/ts3.8/dist/js/utils/carrier.d.ts +5 -0
- package/ts3.8/dist/js/utils/encode.d.ts +5 -0
- package/ts3.8/dist/js/utils/expoglobalobject.d.ts +2 -1
- package/ts3.8/dist/js/utils/expomodules.d.ts +5 -1
- package/ts3.8/dist/js/utils/worldwide.d.ts +10 -2
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/profiling/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAU7C;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAyB;IACtD,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE;QAC/B,IAAI,OAAO,EAAE;YACX,6EAA6E;YAC7E,8EAA8E;YAC9E,gEAAgE;YAChE,MAAM,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;SACtF;QACD,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAAC,QAAkB;IACrE,MAAM,MAAM,GAAY,EAAE,CAAC;IAE3B,mBAAmB,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;;QAC3C,IAAI,IAAI,KAAK,aAAa,EAAE;YAC1B,OAAO;SACR;QAED,yBAAyB;QACzB,KAAK,IAAI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ClD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Envelope, Event, ThreadCpuProfile } from '@sentry/core';\nimport { forEachEnvelopeItem, logger } from '@sentry/core';\n\nimport { getDefaultEnvironment } from '../utils/environment';\nimport { getDebugMetadata } from './debugid';\nimport type {\n AndroidCombinedProfileEvent,\n AndroidProfileEvent,\n CombinedProfileEvent,\n HermesProfileEvent,\n ProfileEvent,\n RawThreadCpuProfile,\n} from './types';\n\n/**\n *\n */\nexport function isValidProfile(profile: ThreadCpuProfile): profile is RawThreadCpuProfile & { profile_id: string } {\n if (profile.samples.length <= 1) {\n if (__DEV__) {\n // Log a warning if the profile has less than 2 samples so users can know why\n // they are not seeing any profiling data and we cant avoid the back and forth\n // of asking them to provide us with a dump of the profile data.\n logger.log('[Profiling] Discarding profile because it contains less than 2 samples');\n }\n return false;\n }\n return true;\n}\n\n/**\n * Finds transactions with profile_id context in the envelope\n * @param envelope\n * @returns\n */\nexport function findProfiledTransactionsFromEnvelope(envelope: Envelope): Event[] {\n const events: Event[] = [];\n\n forEachEnvelopeItem(envelope, (item, type) => {\n if (type !== 'transaction') {\n return;\n }\n\n // First item is the type\n for (let j = 1; j < item.length; j++) {\n const event = item[j];\n\n // @ts-expect-error accessing private property\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (event.contexts?.trace?.data?.profile_id) {\n events.push(item[j] as Event);\n }\n }\n });\n\n return events;\n}\n\n/**\n * Creates a profiling envelope item, if the profile does not pass validation, returns null.\n * @param event\n * @returns {ProfileEvent | null}\n */\nexport function enrichCombinedProfileWithEventContext(\n profile_id: string,\n profile: CombinedProfileEvent | AndroidCombinedProfileEvent,\n event: Event,\n): ProfileEvent | null {\n if ('js_profile' in profile) {\n return enrichAndroidProfileWithEventContext(profile_id, profile, event);\n }\n\n if (!profile.profile || !isValidProfile(profile.profile)) {\n return null;\n }\n\n const trace_id = event.contexts?.trace?.trace_id || '';\n\n // Log a warning if the profile has an invalid traceId (should be uuidv4).\n // All profiles and transactions are rejected if this is the case and we want to\n // warn users that this is happening if they enable debug flag\n if (trace_id?.length !== 32) {\n if (__DEV__) {\n logger.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);\n }\n }\n\n return {\n ...profile,\n event_id: profile_id,\n runtime: {\n name: 'hermes',\n version: '', // TODO: get hermes version\n },\n timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(),\n release: event.release || '',\n environment: event.environment || getDefaultEnvironment(),\n os: {\n name: event.contexts?.os?.name || '',\n version: event.contexts?.os?.version || '',\n build_number: event.contexts?.os?.build || '',\n },\n device: {\n locale: (event.contexts?.device && (event.contexts.device.locale as string)) || '',\n model: event.contexts?.device?.model || '',\n manufacturer: event.contexts?.device?.manufacturer || '',\n architecture: event.contexts?.device?.arch || '',\n is_emulator: event.contexts?.device?.simulator || false,\n },\n transaction: {\n name: event.transaction || '',\n id: event.event_id || '',\n trace_id,\n active_thread_id: profile.transaction?.active_thread_id || '',\n },\n debug_meta: {\n images: [...getDebugMetadata(), ...(profile.debug_meta?.images || [])],\n },\n };\n}\n\n/**\n * Creates Android profiling envelope item.\n */\nexport function enrichAndroidProfileWithEventContext(\n profile_id: string,\n profile: AndroidCombinedProfileEvent,\n event: Event,\n): AndroidProfileEvent | null {\n return {\n ...profile,\n debug_meta: {\n images: getDebugMetadata(),\n },\n build_id: profile.build_id || '',\n\n device_cpu_frequencies: [],\n device_is_emulator: event.contexts?.device?.simulator || false,\n device_locale: (event.contexts?.device && (event.contexts.device.locale as string)) || '',\n device_manufacturer: event.contexts?.device?.manufacturer || '',\n device_model: event.contexts?.device?.model || '',\n device_os_name: event.contexts?.os?.name || '',\n device_os_version: event.contexts?.os?.version || '',\n\n device_physical_memory_bytes:\n (event.contexts?.device?.memory_size && Number(event.contexts.device.memory_size).toString(10)) || '',\n\n environment: event.environment || getDefaultEnvironment(),\n\n profile_id,\n\n timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(),\n\n release: event.release || '',\n dist: event.dist || '',\n\n transaction_id: event.event_id || '',\n transaction_name: event.transaction || '',\n trace_id: event.contexts?.trace?.trace_id || '',\n\n version_name: event.release || '',\n version_code: event.dist || '',\n };\n}\n\n/**\n * Creates profiling event compatible carrier Object from raw Hermes profile.\n */\nexport function createHermesProfilingEvent(profile: RawThreadCpuProfile): HermesProfileEvent {\n return {\n platform: 'javascript',\n version: '1',\n profile,\n transaction: {\n active_thread_id: profile.active_thread_id,\n },\n };\n}\n\n/**\n * Adds items to envelope if they are not already present - mutates the envelope.\n * @param envelope\n */\nexport function addProfilesToEnvelope(envelope: Envelope, profiles: ProfileEvent[]): Envelope {\n if (!profiles.length) {\n return envelope;\n }\n\n for (const profile of profiles) {\n // @ts-expect-error untyped envelope\n envelope[1].push([{ type: 'profile' }, profile]);\n }\n return envelope;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/js/profiling/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAU7C;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAyB;IACtD,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE;QAC/B,IAAI,OAAO,EAAE;YACX,6EAA6E;YAC7E,8EAA8E;YAC9E,gEAAgE;YAChE,MAAM,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;SACtF;QACD,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAAC,QAAkB;IACrE,MAAM,MAAM,GAAY,EAAE,CAAC;IAE3B,mBAAmB,CAAC,QAAQ,EA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oCAAoC;QACpC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;KAClD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport type { Envelope, Event, ThreadCpuProfile } from '@sentry/core';\nimport { forEachEnvelopeItem, logger } from '@sentry/core';\nimport { getDefaultEnvironment } from '../utils/environment';\nimport { getDebugMetadata } from './debugid';\nimport type {\n AndroidCombinedProfileEvent,\n AndroidProfileEvent,\n CombinedProfileEvent,\n HermesProfileEvent,\n ProfileEvent,\n RawThreadCpuProfile,\n} from './types';\n\n/**\n *\n */\nexport function isValidProfile(profile: ThreadCpuProfile): profile is RawThreadCpuProfile & { profile_id: string } {\n if (profile.samples.length <= 1) {\n if (__DEV__) {\n // Log a warning if the profile has less than 2 samples so users can know why\n // they are not seeing any profiling data and we cant avoid the back and forth\n // of asking them to provide us with a dump of the profile data.\n logger.log('[Profiling] Discarding profile because it contains less than 2 samples');\n }\n return false;\n }\n return true;\n}\n\n/**\n * Finds transactions with profile_id context in the envelope\n * @param envelope\n * @returns\n */\nexport function findProfiledTransactionsFromEnvelope(envelope: Envelope): Event[] {\n const events: Event[] = [];\n\n forEachEnvelopeItem(envelope, (item, type) => {\n if (type !== 'transaction') {\n return;\n }\n\n // First item is the type\n for (let j = 1; j < item.length; j++) {\n const event = item[j];\n\n // @ts-expect-error accessing private property\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (event.contexts?.trace?.data?.profile_id) {\n events.push(item[j] as Event);\n }\n }\n });\n\n return events;\n}\n\n/**\n * Creates a profiling envelope item, if the profile does not pass validation, returns null.\n * @param event\n * @returns {ProfileEvent | null}\n */\nexport function enrichCombinedProfileWithEventContext(\n profile_id: string,\n profile: CombinedProfileEvent | AndroidCombinedProfileEvent,\n event: Event,\n): ProfileEvent | null {\n if ('js_profile' in profile) {\n return enrichAndroidProfileWithEventContext(profile_id, profile, event);\n }\n\n if (!profile.profile || !isValidProfile(profile.profile)) {\n return null;\n }\n\n const trace_id = event.contexts?.trace?.trace_id || '';\n\n // Log a warning if the profile has an invalid traceId (should be uuidv4).\n // All profiles and transactions are rejected if this is the case and we want to\n // warn users that this is happening if they enable debug flag\n if (trace_id?.length !== 32) {\n if (__DEV__) {\n logger.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);\n }\n }\n\n return {\n ...profile,\n event_id: profile_id,\n runtime: {\n name: 'hermes',\n version: '', // TODO: get hermes version\n },\n timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(),\n release: event.release || '',\n environment: event.environment || getDefaultEnvironment(),\n os: {\n name: event.contexts?.os?.name || '',\n version: event.contexts?.os?.version || '',\n build_number: event.contexts?.os?.build || '',\n },\n device: {\n locale: (event.contexts?.device && (event.contexts.device.locale as string)) || '',\n model: event.contexts?.device?.model || '',\n manufacturer: event.contexts?.device?.manufacturer || '',\n architecture: event.contexts?.device?.arch || '',\n is_emulator: event.contexts?.device?.simulator || false,\n },\n transaction: {\n name: event.transaction || '',\n id: event.event_id || '',\n trace_id,\n active_thread_id: profile.transaction?.active_thread_id || '',\n },\n debug_meta: {\n images: [...getDebugMetadata(), ...(profile.debug_meta?.images || [])],\n },\n };\n}\n\n/**\n * Creates Android profiling envelope item.\n */\nexport function enrichAndroidProfileWithEventContext(\n profile_id: string,\n profile: AndroidCombinedProfileEvent,\n event: Event,\n): AndroidProfileEvent | null {\n return {\n ...profile,\n debug_meta: {\n images: getDebugMetadata(),\n },\n build_id: profile.build_id || '',\n\n device_cpu_frequencies: [],\n device_is_emulator: event.contexts?.device?.simulator || false,\n device_locale: (event.contexts?.device && (event.contexts.device.locale as string)) || '',\n device_manufacturer: event.contexts?.device?.manufacturer || '',\n device_model: event.contexts?.device?.model || '',\n device_os_name: event.contexts?.os?.name || '',\n device_os_version: event.contexts?.os?.version || '',\n\n device_physical_memory_bytes:\n (event.contexts?.device?.memory_size && Number(event.contexts.device.memory_size).toString(10)) || '',\n\n environment: event.environment || getDefaultEnvironment(),\n\n profile_id,\n\n timestamp: event.start_timestamp ? new Date(event.start_timestamp * 1000).toISOString() : new Date().toISOString(),\n\n release: event.release || '',\n dist: event.dist || '',\n\n transaction_id: event.event_id || '',\n transaction_name: event.transaction || '',\n trace_id: event.contexts?.trace?.trace_id || '',\n\n version_name: event.release || '',\n version_code: event.dist || '',\n };\n}\n\n/**\n * Creates profiling event compatible carrier Object from raw Hermes profile.\n */\nexport function createHermesProfilingEvent(profile: RawThreadCpuProfile): HermesProfileEvent {\n return {\n platform: 'javascript',\n version: '1',\n profile,\n transaction: {\n active_thread_id: profile.active_thread_id,\n },\n };\n}\n\n/**\n * Adds items to envelope if they are not already present - mutates the envelope.\n * @param envelope\n */\nexport function addProfilesToEnvelope(envelope: Envelope, profiles: ProfileEvent[]): Envelope {\n if (!profiles.length) {\n return envelope;\n }\n\n for (const profile of profiles) {\n // @ts-expect-error untyped envelope\n envelope[1].push([{ type: 'profile' }, profile]);\n }\n return envelope;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomMask.d.ts","sourceRoot":"","sources":["../../../src/js/replay/CustomMask.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomMask.d.ts","sourceRoot":"","sources":["../../../src/js/replay/CustomMask.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAuB7D,QAAA,MAAM,YAAY,cAAe,SAAS,KAAG,MAAM,YAGlD,CAAC;AAEF,QAAA,MAAM,cAAc,cAAe,SAAS,KAAG,MAAM,YAGpD,CAAC;AAIF,QAAA,MAAM,IAAI,2DAWN,CAAA;AAEJ,QAAA,MAAM,MAAM,2DAWR,CAAC;AAEL,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomMask.js","sourceRoot":"","sources":["../../../src/js/replay/CustomMask.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomMask.js","sourceRoot":"","sources":["../../../src/js/replay/CustomMask.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,uBAAuB,GAGzB,OAAO,CAAC,gEAAgE,CAAC,CAAC;AAE9E,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AACrD,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAEzD,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAU,EAAE,CAAC,yBAAyB,SAAS,2DAA2D,SAAS,+EAA+E,CAAC;AAEzO,MAAM,IAAI,GAAG,CAAC,SAAiB,EAAQ,EAAE;IACvC,UAAU,CAAC,GAAG,EAAE;QACd,gGAAgG;QAChG,4CAA4C;QAC5C,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,CAAC,CAAC;AACR,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,SAAo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AE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { logger } from '@sentry/core';\nimport * as React from 'react';\nimport type { HostComponent, ViewProps } from 'react-native';\nimport { UIManager, View } from 'react-native';\nimport { isExpoGo } from '../utils/environment';\n\nconst NativeComponentRegistry: {\n get<T, C extends Record<string, unknown>>(componentName: string, createViewConfig: () => C): HostComponent<T>;\n// eslint-disable-next-line @typescript-eslint/no-var-requires\n} = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');\n\nconst MaskNativeComponentName = 'RNSentryReplayMask';\nconst UnmaskNativeComponentName = 'RNSentryReplayUnmask';\n\nconst warnMessage = (component: string): string => `[SentrySessionReplay] ${component} component is not supported on the current platform. If ${component} should be supported, please ensure that the application build is up to date.`;\n\nconst warn = (component: string): void => {\n setTimeout(() => {\n // Missing mask component could cause leaking PII, we have to ensure that the warning is visible\n // even if the app is running without debug.\n // eslint-disable-next-line no-console\n console.warn(warnMessage(component));\n }, 0);\n};\n\nconst MaskFallback = (viewProps: ViewProps): React.ReactElement => {\n warn('Mask');\n return <View {...viewProps} />;\n};\n\nconst UnmaskFallback = (viewProps: ViewProps): React.ReactElement => {\n warn('Unmask');\n return <View {...viewProps} />;\n};\n\nconst hasViewManagerConfig = (nativeComponentName: string): boolean => UIManager.hasViewManagerConfig?.(nativeComponentName);\n\nconst Mask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> => {\n if (isExpoGo() || !hasViewManagerConfig(MaskNativeComponentName)) {\n logger.warn(`[SentrySessionReplay] Can't load ${MaskNativeComponentName}.`);\n return MaskFallback;\n }\n\n // Based on @react-native/babel-plugin-codegen output\n // https://github.com/facebook/react-native/blob/b32c6c2cc1bc566a85a883901dbf5e23b5a75b61/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L139\n return NativeComponentRegistry.get(MaskNativeComponentName, () => ({\n uiViewClassName: MaskNativeComponentName,\n }));\n})()\n\nconst Unmask = ((): HostComponent<ViewProps> | React.ComponentType<ViewProps> => {\n if (isExpoGo() || !hasViewManagerConfig(UnmaskNativeComponentName)) {\n logger.warn(`[SentrySessionReplay] Can't load ${UnmaskNativeComponentName}.`);\n return UnmaskFallback;\n }\n\n // Based on @react-native/babel-plugin-codegen output\n // https://github.com/facebook/react-native/blob/b32c6c2cc1bc566a85a883901dbf5e23b5a75b61/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L139\n return NativeComponentRegistry.get(UnmaskNativeComponentName, () => ({\n uiViewClassName: UnmaskNativeComponentName,\n }));\n})();\n\nexport { Mask, Unmask, MaskFallback, UnmaskFallback };\n"]}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { replayIntegration } from '@sentry/react';
|
|
2
|
-
|
|
2
|
+
import type { Replay } from './replayInterface';
|
|
3
|
+
/**
|
|
4
|
+
* ReplayConfiguration for browser replay integration.
|
|
5
|
+
*
|
|
6
|
+
* See the [Configuration documentation](https://docs.sentry.io/platforms/javascript/session-replay/configuration/) for more information.
|
|
7
|
+
*/
|
|
8
|
+
type ReplayConfiguration = Parameters<typeof replayIntegration>[0];
|
|
9
|
+
/**
|
|
10
|
+
* Browser Replay integration for React Native.
|
|
11
|
+
*
|
|
12
|
+
* See the [Browser Replay documentation](https://docs.sentry.io/platforms/javascript/session-replay/) for more information.
|
|
13
|
+
*/
|
|
14
|
+
declare const browserReplayIntegration: (options?: ReplayConfiguration) => Replay;
|
|
3
15
|
export { browserReplayIntegration };
|
|
4
16
|
//# sourceMappingURL=browserReplay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserReplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/browserReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,
|
|
1
|
+
{"version":3,"file":"browserReplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/browserReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;GAIG;AACH,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;AAKnE;;;;GAIG;AACH,QAAA,MAAM,wBAAwB,aAAa,mBAAmB,KAAQ,MAYrE,CAAC;AAgBF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { replayIntegration } from '@sentry/react';
|
|
2
|
+
import { notWeb } from '../utils/environment';
|
|
3
|
+
// https://github.com/getsentry/sentry-javascript/blob/e00cb04f1bbf494067cd8475d392266ba296987a/packages/replay-internal/src/integration.ts#L109
|
|
4
|
+
const INTEGRATION_NAME = 'Replay';
|
|
5
|
+
/**
|
|
6
|
+
* Browser Replay integration for React Native.
|
|
7
|
+
*
|
|
8
|
+
* See the [Browser Replay documentation](https://docs.sentry.io/platforms/javascript/session-replay/) for more information.
|
|
9
|
+
*/
|
|
2
10
|
const browserReplayIntegration = (options = {}) => {
|
|
11
|
+
if (notWeb()) {
|
|
12
|
+
// This is required because `replayIntegration` browser check doesn't
|
|
13
|
+
// work for React Native.
|
|
14
|
+
return browserReplayIntegrationNoop();
|
|
15
|
+
}
|
|
3
16
|
return replayIntegration(Object.assign(Object.assign({}, options), { mask: ['.sentry-react-native-mask', ...(options.mask || [])], unmask: ['.sentry-react-native-unmask:not(.sentry-react-native-mask *) > *', ...(options.unmask || [])] }));
|
|
4
17
|
};
|
|
18
|
+
const browserReplayIntegrationNoop = () => {
|
|
19
|
+
return {
|
|
20
|
+
name: INTEGRATION_NAME,
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
22
|
+
start: () => { },
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
24
|
+
startBuffering: () => { },
|
|
25
|
+
stop: () => Promise.resolve(),
|
|
26
|
+
flush: () => Promise.resolve(),
|
|
27
|
+
getReplayId: () => undefined,
|
|
28
|
+
getRecordingMode: () => undefined,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
5
31
|
export { browserReplayIntegration };
|
|
6
32
|
//# sourceMappingURL=browserReplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserReplay.js","sourceRoot":"","sources":["../../../src/js/replay/browserReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"browserReplay.js","sourceRoot":"","sources":["../../../src/js/replay/browserReplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,gJAAgJ;AAChJ,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,CAAC,UAA+B,EAAE,EAAU,EAAE;IAC7E,IAAI,MAAM,EAAE,EAAE;QACZ,qEAAqE;QACrE,yBAAyB;QACzB,OAAO,4BAA4B,EAAE,CAAC;KACvC;IAED,OAAO,iBAAiB,iCACnB,OAAO,KACV,IAAI,EAAE,CAAC,2BAA2B,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAC5D,MAAM,EAAE,CAAC,kEAAkE,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IACvG,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAG,GAAW,EAAE;IAChD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,gEAAgE;QAChE,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;QACf,gEAAgE;QAChE,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;QACxB,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7B,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;QAC9B,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS;QAC5B,gBAAgB,EAAE,GAAG,EAAE,CAAC,SAAS;KAClC,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["import { replayIntegration } from '@sentry/react';\nimport { notWeb } from '../utils/environment';\nimport type { Replay } from './replayInterface';\n\n/**\n * ReplayConfiguration for browser replay integration.\n *\n * See the [Configuration documentation](https://docs.sentry.io/platforms/javascript/session-replay/configuration/) for more information.\n */\ntype ReplayConfiguration = Parameters<typeof replayIntegration>[0];\n\n// https://github.com/getsentry/sentry-javascript/blob/e00cb04f1bbf494067cd8475d392266ba296987a/packages/replay-internal/src/integration.ts#L109\nconst INTEGRATION_NAME = 'Replay';\n\n/**\n * Browser Replay integration for React Native.\n *\n * See the [Browser Replay documentation](https://docs.sentry.io/platforms/javascript/session-replay/) for more information.\n */\nconst browserReplayIntegration = (options: ReplayConfiguration = {}): Replay => {\n if (notWeb()) {\n // This is required because `replayIntegration` browser check doesn't\n // work for React Native.\n return browserReplayIntegrationNoop();\n }\n\n return replayIntegration({\n ...options,\n mask: ['.sentry-react-native-mask', ...(options.mask || [])],\n unmask: ['.sentry-react-native-unmask:not(.sentry-react-native-mask *) > *', ...(options.unmask || [])],\n });\n};\n\nconst browserReplayIntegrationNoop = (): Replay => {\n return {\n name: INTEGRATION_NAME,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n start: () => {},\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n startBuffering: () => {},\n stop: () => Promise.resolve(),\n flush: () => Promise.resolve(),\n getReplayId: () => undefined,\n getRecordingMode: () => undefined,\n };\n};\n\nexport { browserReplayIntegration };\n"]}
|
|
@@ -28,9 +28,22 @@ export interface MobileReplayOptions {
|
|
|
28
28
|
*
|
|
29
29
|
* - Experiment: This is an experimental feature and is therefore disabled by default.
|
|
30
30
|
*
|
|
31
|
-
* @
|
|
31
|
+
* @deprecated Use `enableViewRendererV2` instead.
|
|
32
32
|
*/
|
|
33
33
|
enableExperimentalViewRenderer?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.
|
|
36
|
+
*
|
|
37
|
+
* Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing
|
|
38
|
+
* interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of
|
|
39
|
+
* **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.
|
|
40
|
+
*
|
|
41
|
+
* - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).
|
|
42
|
+
* Eventually, we will remove this feature flag and use the new view renderer by default.
|
|
43
|
+
*
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
enableViewRendererV2?: boolean;
|
|
34
47
|
/**
|
|
35
48
|
* Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.
|
|
36
49
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyC,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"mobilereplay.d.ts","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyC,WAAW,EAAE,MAAM,cAAc,CAAC;AAQvF,eAAO,MAAM,8BAA8B,iBAAiB,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;OASG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IAEzC;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAwBD,KAAK,uBAAuB,GAAG,WAAW,GAAG;IAC3C,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,iBAAiB,mBAAmB,KAAoB,uBAoE3F,CAAC"}
|
|
@@ -19,8 +19,16 @@ const defaultOptions = {
|
|
|
19
19
|
maskAllImages: true,
|
|
20
20
|
maskAllVectors: true,
|
|
21
21
|
enableExperimentalViewRenderer: false,
|
|
22
|
+
enableViewRendererV2: true,
|
|
22
23
|
enableFastViewRendering: false,
|
|
23
24
|
};
|
|
25
|
+
function mergeOptions(initOptions) {
|
|
26
|
+
const merged = Object.assign(Object.assign({}, defaultOptions), initOptions);
|
|
27
|
+
if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {
|
|
28
|
+
merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;
|
|
29
|
+
}
|
|
30
|
+
return merged;
|
|
31
|
+
}
|
|
24
32
|
/**
|
|
25
33
|
* The Mobile Replay Integration, let's you adjust the default mobile replay options.
|
|
26
34
|
* To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.
|
|
@@ -47,7 +55,7 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
|
|
|
47
55
|
if (isExpoGo() || notMobileOs()) {
|
|
48
56
|
return mobileReplayIntegrationNoop();
|
|
49
57
|
}
|
|
50
|
-
const options =
|
|
58
|
+
const options = mergeOptions(initOptions);
|
|
51
59
|
function processEvent(event) {
|
|
52
60
|
var _a;
|
|
53
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -89,9 +97,6 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
|
|
|
89
97
|
// https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45
|
|
90
98
|
return {
|
|
91
99
|
name: MOBILE_REPLAY_INTEGRATION_NAME,
|
|
92
|
-
setupOnce() {
|
|
93
|
-
/* Noop */
|
|
94
|
-
},
|
|
95
100
|
setup,
|
|
96
101
|
processEvent,
|
|
97
102
|
options: options,
|
|
@@ -100,9 +105,6 @@ export const mobileReplayIntegration = (initOptions = defaultOptions) => {
|
|
|
100
105
|
const mobileReplayIntegrationNoop = () => {
|
|
101
106
|
return {
|
|
102
107
|
name: MOBILE_REPLAY_INTEGRATION_NAME,
|
|
103
|
-
setupOnce() {
|
|
104
|
-
/* Noop */
|
|
105
|
-
},
|
|
106
108
|
options: defaultOptions,
|
|
107
109
|
};
|
|
108
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"mobilereplay.js","sourceRoot":"","sources":["../../../src/js/replay/mobilereplay.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;AAiE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gBACrB,MAAM,CAAC,KAAK,CACV,YAAY,8BAA8B,oCAAoC,iBAAiB,cAAc,KAAK,CAAC,QAAQ,GAAG,CAC/H,CAAC;gBACF,OAAO,KAAK,CAAC;aACd;YAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;YAChE,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,CAAC,KAAK,CAAC,YAAY,8BAA8B,0BAA0B,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;gBACpG,OAAO,KAAK,CAAC;aACd;YAED,OAAO,KAAK,CAAC;;KACd;IAED,SAAS,KAAK,CAAC,MAAc;QAC3B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACrB,OAAO;SACR;QAED,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,GAA2B,EAAE,EAAE;YACrD,IAAI,GAAG,CAAC,SAAS,EAAE;gBACjB,OAAO;aACR;YAED,6GAA6G;YAC7G,MAAM,eAAe,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;YACpD,IAAI,eAAe,EAAE;gBACnB,GAAG,CAAC,SAAS,GAAG,eAAe,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,mCAAmC,CAAC,CAAC;IACxE,CAAC;IAED,iHAAiH;IACjH,8GAA8G;IAC9G,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK;QACL,YAAY;QACZ,OAAO,EAAE,OAAO;KACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,2BAA2B,GAAG,GAA4B,EAAE;IAChE,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,cAAc;KACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Client, DynamicSamplingContext, Event, Integration } from '@sentry/core';\nimport { logger } from '@sentry/core';\nimport { isHardCrash } from '../misc';\nimport { hasHooks } from '../utils/clientutils';\nimport { isExpoGo, notMobileOs } from '../utils/environment';\nimport { NATIVE } from '../wrapper';\nimport { enrichXhrBreadcrumbsForMobileReplay } from './xhrUtils';\n\nexport const MOBILE_REPLAY_INTEGRATION_NAME = 'MobileReplay';\n\nexport interface MobileReplayOptions {\n /**\n * Mask all text in recordings\n *\n * @default true\n */\n maskAllText?: boolean;\n\n /**\n * Mask all images in recordings\n *\n * @default true\n */\n maskAllImages?: boolean;\n\n /**\n * Mask all vector graphics in recordings\n * Supports `react-native-svg`\n *\n * @default true\n */\n maskAllVectors?: boolean;\n\n /**\n * Enables the up to 5x faster experimental view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @deprecated Use `enableViewRendererV2` instead.\n */\n enableExperimentalViewRenderer?: boolean;\n\n /**\n * Enables up to 5x faster new view renderer used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag. [Our benchmarks](https://github.com/getsentry/sentry-cocoa/pull/4940) have shown a significant improvement of\n * **up to 4-5x faster rendering** (reducing `~160ms` to `~36ms` per frame) on older devices.\n *\n * - Experiment: In case you are noticing issues with the new view renderer, please report the issue on [GitHub](https://github.com/getsentry/sentry-cocoa).\n * Eventually, we will remove this feature flag and use the new view renderer by default.\n *\n * @default true\n */\n enableViewRendererV2?: boolean;\n\n /**\n * Enables up to 5x faster but incomplete view rendering used by the Session Replay integration on iOS.\n *\n * Enabling this flag will reduce the amount of time it takes to render each frame of the session replay on the main thread, therefore reducing\n * interruptions and visual lag.\n *\n * - Note: This flag can only be used together with `enableExperimentalViewRenderer` with up to 20% faster render times.\n * - Experiment: This is an experimental feature and is therefore disabled by default.\n *\n * @default false\n */\n enableFastViewRendering?: boolean;\n}\n\nconst defaultOptions: Required<MobileReplayOptions> = {\n maskAllText: true,\n maskAllImages: true,\n maskAllVectors: true,\n enableExperimentalViewRenderer: false,\n enableViewRendererV2: true,\n enableFastViewRendering: false,\n};\n\nfunction mergeOptions(initOptions: Partial<MobileReplayOptions>): Required<MobileReplayOptions> {\n const merged = {\n ...defaultOptions,\n ...initOptions,\n };\n\n if (initOptions.enableViewRendererV2 === undefined && initOptions.enableExperimentalViewRenderer !== undefined) {\n merged.enableViewRendererV2 = initOptions.enableExperimentalViewRenderer;\n }\n\n return merged;\n}\n\ntype MobileReplayIntegration = Integration & {\n options: Required<MobileReplayOptions>;\n};\n\n/**\n * The Mobile Replay Integration, let's you adjust the default mobile replay options.\n * To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.\n *\n * ```javascript\n * Sentry.init({\n * replaysOnErrorSampleRate: 1.0,\n * replaysSessionSampleRate: 1.0,\n * integrations: [mobileReplayIntegration({\n * // Adjust the default options\n * })],\n * });\n * ```\n *\n * @experimental\n */\nexport const mobileReplayIntegration = (initOptions: MobileReplayOptions = defaultOptions): MobileReplayIntegration => {\n if (isExpoGo()) {\n logger.warn(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported in Expo Go. Use EAS Build or \\`expo prebuild\\` to enable it.`,\n );\n }\n if (notMobileOs()) {\n logger.warn(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} is not supported on this platform.`);\n }\n\n if (isExpoGo() || notMobileOs()) {\n return mobileReplayIntegrationNoop();\n }\n\n const options = mergeOptions(initOptions);\n\n async function processEvent(event: Event): Promise<Event> {\n const hasException = event.exception?.values && event.exception.values.length > 0;\n if (!hasException) {\n // Event is not an error, will not capture replay\n return event;\n }\n\n const recordingReplayId = NATIVE.getCurrentReplayId();\n if (recordingReplayId) {\n logger.debug(\n `[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} assign already recording replay ${recordingReplayId} for event ${event.event_id}.`,\n );\n return event;\n }\n\n const replayId = await NATIVE.captureReplay(isHardCrash(event));\n if (!replayId) {\n logger.debug(`[Sentry] ${MOBILE_REPLAY_INTEGRATION_NAME} not sampled for event ${event.event_id}.`);\n return event;\n }\n\n return event;\n }\n\n function setup(client: Client): void {\n if (!hasHooks(client)) {\n return;\n }\n\n client.on('createDsc', (dsc: DynamicSamplingContext) => {\n if (dsc.replay_id) {\n return;\n }\n\n // TODO: For better performance, we should emit replayId changes on native, and hold the replayId value in JS\n const currentReplayId = NATIVE.getCurrentReplayId();\n if (currentReplayId) {\n dsc.replay_id = currentReplayId;\n }\n });\n\n client.on('beforeAddBreadcrumb', enrichXhrBreadcrumbsForMobileReplay);\n }\n\n // TODO: When adding manual API, ensure overlap with the web replay so users can use the same API interchangeably\n // https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/integration.ts#L45\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n setup,\n processEvent,\n options: options,\n };\n};\n\nconst mobileReplayIntegrationNoop = (): MobileReplayIntegration => {\n return {\n name: MOBILE_REPLAY_INTEGRATION_NAME,\n options: defaultOptions,\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":";;AAEA,2DAA2D;AAC3D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO9F;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAEtG,8BAA8B;AAC9B,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAiCjE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { utf8ToBytes } from '../vendor';
|
|
1
|
+
import { encodeUTF8 } from '../utils/encode';
|
|
3
2
|
/** Convert a Content-Length header to number/undefined. */
|
|
4
3
|
export function parseContentLengthHeader(header) {
|
|
5
4
|
if (!header) {
|
|
@@ -15,14 +14,14 @@ export function getBodySize(body) {
|
|
|
15
14
|
}
|
|
16
15
|
try {
|
|
17
16
|
if (typeof body === 'string') {
|
|
18
|
-
return
|
|
17
|
+
return encodeUTF8(body).length;
|
|
19
18
|
}
|
|
20
19
|
if (body instanceof URLSearchParams) {
|
|
21
|
-
return
|
|
20
|
+
return encodeUTF8(body.toString()).length;
|
|
22
21
|
}
|
|
23
22
|
if (body instanceof FormData) {
|
|
24
23
|
const formDataStr = _serializeFormData(body);
|
|
25
|
-
return
|
|
24
|
+
return encodeUTF8(formDataStr).length;
|
|
26
25
|
}
|
|
27
26
|
if (body instanceof Blob) {
|
|
28
27
|
return body.size;
|
|
@@ -37,12 +36,6 @@ export function getBodySize(body) {
|
|
|
37
36
|
}
|
|
38
37
|
return undefined;
|
|
39
38
|
}
|
|
40
|
-
function _encode(input) {
|
|
41
|
-
if (RN_GLOBAL_OBJ.TextEncoder) {
|
|
42
|
-
return new RN_GLOBAL_OBJ.TextEncoder().encode(input);
|
|
43
|
-
}
|
|
44
|
-
return utf8ToBytes(input);
|
|
45
|
-
}
|
|
46
39
|
function _serializeFormData(formData) {
|
|
47
40
|
// This is a bit simplified, but gives us a decent estimate
|
|
48
41
|
// This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../../../src/js/replay/networkUtils.ts"],"names":[],"mappings":"AAAA,OAAO,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{ encodeUTF8 } from '../utils/encode';\n\n/** Convert a Content-Length header to number/undefined. */\nexport function parseContentLengthHeader(header: string | null | undefined): number | undefined {\n if (!header) {\n return undefined;\n }\n\n const size = parseInt(header, 10);\n return isNaN(size) ? undefined : size;\n}\n\nexport type RequestBody = null | Blob | FormData | URLSearchParams | string | ArrayBuffer | undefined;\n\n/** Get the size of a body. */\nexport function getBodySize(body: RequestBody): number | undefined {\n if (!body) {\n return undefined;\n }\n\n try {\n if (typeof body === 'string') {\n return encodeUTF8(body).length;\n }\n\n if (body instanceof URLSearchParams) {\n return encodeUTF8(body.toString()).length;\n }\n\n if (body instanceof FormData) {\n const formDataStr = _serializeFormData(body);\n return encodeUTF8(formDataStr).length;\n }\n\n if (body instanceof Blob) {\n return body.size;\n }\n\n if (body instanceof ArrayBuffer) {\n return body.byteLength;\n }\n\n // Currently unhandled types: ArrayBufferView, ReadableStream\n } catch {\n // just return undefined\n }\n\n return undefined;\n}\n\nfunction _serializeFormData(formData: FormData): string {\n // This is a bit simplified, but gives us a decent estimate\n // This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'\n // @ts-expect-error passing FormData to URLSearchParams won't correctly serialize `File` entries, which is fine for this use-case. See https://github.com/microsoft/TypeScript/issues/30584\n return new URLSearchParams(formData).toString();\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Integration, ReplayRecordingMode } from '@sentry/core';
|
|
2
|
+
/**
|
|
3
|
+
* Common interface for React Native Replay integrations.
|
|
4
|
+
*
|
|
5
|
+
* Both browser and mobile replay integrations should implement this interface
|
|
6
|
+
* to allow user manually control the replay.
|
|
7
|
+
*/
|
|
8
|
+
export interface Replay extends Integration {
|
|
9
|
+
/**
|
|
10
|
+
* Start a replay regardless of sampling rate. Calling this will always
|
|
11
|
+
* create a new session. Will log a message if replay is already in progress.
|
|
12
|
+
*
|
|
13
|
+
* Creates or loads a session, attaches listeners to varying events (DOM,
|
|
14
|
+
* PerformanceObserver, Recording, Sentry SDK, etc)
|
|
15
|
+
*/
|
|
16
|
+
start(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Start replay buffering. Buffers until `flush()` is called or, if
|
|
19
|
+
* `replaysOnErrorSampleRate` > 0, until an error occurs.
|
|
20
|
+
*/
|
|
21
|
+
startBuffering(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK
|
|
24
|
+
* does not support a teardown
|
|
25
|
+
*/
|
|
26
|
+
stop(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* If not in "session" recording mode, flush event buffer which will create a new replay.
|
|
29
|
+
* If replay is not enabled, a new session replay is started.
|
|
30
|
+
* Unless `continueRecording` is false, the replay will continue to record and
|
|
31
|
+
* behave as a "session"-based replay.
|
|
32
|
+
*
|
|
33
|
+
* Otherwise, queue up a flush.
|
|
34
|
+
*/
|
|
35
|
+
flush(options?: {
|
|
36
|
+
continueRecording?: boolean;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Get the current session ID.
|
|
40
|
+
*/
|
|
41
|
+
getReplayId(): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Get the current recording mode. This can be either `session` or `buffer`.
|
|
44
|
+
*
|
|
45
|
+
* `session`: Recording the whole session, sending it continuously
|
|
46
|
+
* `buffer`: Always keeping the last 60s of recording, requires:
|
|
47
|
+
* - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs
|
|
48
|
+
* - or calling `flush()` to send the replay
|
|
49
|
+
*/
|
|
50
|
+
getRecordingMode(): ReplayRecordingMode | undefined;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=replayInterface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replayInterface.d.ts","sourceRoot":"","sources":["../../../src/js/replay/replayInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAIrE;;;;;GAKG;AACH,MAAM,WAAW,MAAO,SAAQ,WAAW;IACzC;;;;;;OAMG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;OAGG;IACH,cAAc,IAAI,IAAI,CAAC;IAEvB;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE;QAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhE;;OAEG;IACH,WAAW,IAAI,MAAM,GAAG,SAAS,CAAC;IAElC;;;;;;;OAOG;IACH,gBAAgB,IAAI,mBAAmB,GAAG,SAAS,CAAC;CACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replayInterface.js","sourceRoot":"","sources":["../../../src/js/replay/replayInterface.ts"],"names":[],"mappings":"","sourcesContent":["import type { Integration, ReplayRecordingMode } from '@sentry/core';\n\n// Based on Replay Class https://github.com/getsentry/sentry-javascript/blob/e00cb04f1bbf494067cd8475d392266ba296987a/packages/replay-internal/src/integration.ts#L50\n\n/**\n * Common interface for React Native Replay integrations.\n *\n * Both browser and mobile replay integrations should implement this interface\n * to allow user manually control the replay.\n */\nexport interface Replay extends Integration {\n /**\n * Start a replay regardless of sampling rate. Calling this will always\n * create a new session. Will log a message if replay is already in progress.\n *\n * Creates or loads a session, attaches listeners to varying events (DOM,\n * PerformanceObserver, Recording, Sentry SDK, etc)\n */\n start(): void;\n\n /**\n * Start replay buffering. Buffers until `flush()` is called or, if\n * `replaysOnErrorSampleRate` > 0, until an error occurs.\n */\n startBuffering(): void;\n\n /**\n * Currently, this needs to be manually called (e.g. for tests). Sentry SDK\n * does not support a teardown\n */\n stop(): Promise<void>;\n\n /**\n * If not in \"session\" recording mode, flush event buffer which will create a new replay.\n * If replay is not enabled, a new session replay is started.\n * Unless `continueRecording` is false, the replay will continue to record and\n * behave as a \"session\"-based replay.\n *\n * Otherwise, queue up a flush.\n */\n flush(options?: { continueRecording?: boolean }): Promise<void>;\n\n /**\n * Get the current session ID.\n */\n getReplayId(): string | undefined;\n\n /**\n * Get the current recording mode. This can be either `session` or `buffer`.\n *\n * `session`: Recording the whole session, sending it continuously\n * `buffer`: Always keeping the last 60s of recording, requires:\n * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs\n * - or calling `flush()` to send the replay\n */\n getRecordingMode(): ReplayRecordingMode | undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhrUtils.d.ts","sourceRoot":"","sources":["../../../src/js/replay/xhrUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAkD,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"xhrUtils.d.ts","sourceRoot":"","sources":["../../../src/js/replay/xhrUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAkD,MAAM,cAAc,CAAC;AAK/G;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAyBlH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhrUtils.js","sourceRoot":"","sources":["../../../src/js/replay/xhrUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"xhrUtils.js","sourceRoot":"","sources":["../../../src/js/replay/xhrUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAEvE;;GAEG;AACH,MAAM,UAAU,mCAAmC,CAAC,UAAsB,EAAE,IAAgC;IAC1G,IAAI,U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eys } from '@sentry/core';\nimport type { RequestBody } from './networkUtils';\nimport { getBodySize, parseContentLengthHeader } from './networkUtils';\n\n/**\n * Enrich an XHR breadcrumb with additional data for Mobile Replay network tab.\n */\nexport function enrichXhrBreadcrumbsForMobileReplay(breadcrumb: Breadcrumb, hint: BreadcrumbHint | undefined): void {\n if (breadcrumb.category !== 'xhr' || !hint) {\n return;\n }\n\n const xhrHint = hint as Partial<XhrHint>;\n if (!xhrHint.xhr) {\n return;\n }\n\n const now = Date.now();\n const { startTimestamp = now, endTimestamp = now, input, xhr } = xhrHint;\n\n const reqSize = getBodySize(input);\n const resSize = xhr.getResponseHeader('content-length')\n ? parseContentLengthHeader(xhr.getResponseHeader('content-length'))\n : _getBodySize(xhr.response, xhr.responseType);\n\n breadcrumb.data = dropUndefinedKeys({\n start_timestamp: startTimestamp,\n end_timestamp: endTimestamp,\n request_body_size: reqSize,\n response_body_size: resSize,\n ...breadcrumb.data,\n });\n}\n\ntype XhrHint = XhrBreadcrumbHint & {\n xhr: XMLHttpRequest & SentryWrappedXMLHttpRequest;\n input?: RequestBody;\n};\n\nfunction _getBodySize(\n body: XMLHttpRequest['response'],\n responseType: XMLHttpRequest['responseType'],\n): number | undefined {\n try {\n const bodyStr = responseType === 'json' && body && typeof body === 'object' ? JSON.stringify(body) : body;\n return getBodySize(bodyStr);\n } catch {\n return undefined;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scopeSync.d.ts","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"scopeSync.d.ts","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,KAAK,EAAE,MAAM,cAAc,CAAC;AAatD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAiErD"}
|
package/dist/js/scopeSync.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scopeSync.js","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"scopeSync.js","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;GAGG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAe,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAY;IAC7C,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAChC,OAAO;KACR;IACD,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEnC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAS,EAAE;QACtD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrB,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,EAAS,EAAE;QAC3D,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,KAAe,CAAC,CAAC;QACpC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK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wBAAwB,EACnD,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAyB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,GAC/E,CAAC;QAEF,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;QAEvD,MAAM,eAAe,GAAG,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAClD,IAAI,eAAe,EAAE;YACnB,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;SACvC;aAAM;YACL,MAAM,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC;SAC3F;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,kBAAkB,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAU,EAAE;QAC3D,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,8DAA8D;IAC9D,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAW,EAAE,OAAsC,EAAS,EAAE;QACxG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Breadcrumb, Scope } from '@sentry/core';\nimport { logger } from '@sentry/react';\nimport { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';\nimport { fillTyped } from './utils/fill';\nimport { convertToNormalizedObject } from './utils/normalize';\nimport { NATIVE } from './wrapper';\n\n/**\n * This WeakMap is used to keep track of which scopes have been synced to the native SDKs.\n * This ensures that we don't double sync the same scope.\n */\nconst syncedToNativeMap = new WeakMap<Scope, true>();\n\n/**\n * Hooks into the scope set methods and sync new data added to the given scope with the native SDKs.\n */\nexport function enableSyncToNative(scope: Scope): void {\n if (syncedToNativeMap.has(scope)) {\n return;\n }\n syncedToNativeMap.set(scope, true);\n\n fillTyped(scope, 'setUser', original => (user): Scope => {\n NATIVE.setUser(user);\n return original.call(scope, user);\n });\n\n fillTyped(scope, 'setTag', original => (key, value): Scope => {\n NATIVE.setTag(key, value as string);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setTags', original => (tags): Scope => {\n // As native only has setTag, we just loop through each tag key.\n Object.keys(tags).forEach(key => {\n NATIVE.setTag(key, tags[key] as string);\n });\n return original.call(scope, tags);\n });\n\n fillTyped(scope, 'setExtras', original => (extras): Scope => {\n Object.keys(extras).forEach(key => {\n NATIVE.setExtra(key, extras[key]);\n });\n return original.call(scope, extras);\n });\n\n fillTyped(scope, 'setExtra', original => (key, value): Scope => {\n NATIVE.setExtra(key, value);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'addBreadcrumb', original => (breadcrumb, maxBreadcrumbs): Scope => {\n const mergedBreadcrumb: Breadcrumb = {\n ...breadcrumb,\n level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL,\n data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined,\n };\n\n original.call(scope, mergedBreadcrumb, maxBreadcrumbs);\n\n const finalBreadcrumb = scope.getLastBreadcrumb();\n if (finalBreadcrumb) {\n NATIVE.addBreadcrumb(finalBreadcrumb);\n } else {\n logger.warn('[ScopeSync] Last created breadcrumb is undefined. Skipping sync to native.');\n }\n\n return scope;\n });\n\n fillTyped(scope, 'clearBreadcrumbs', original => (): Scope => {\n NATIVE.clearBreadcrumbs();\n return original.call(scope);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fillTyped(scope, 'setContext', original => (key: string, context: { [key: string]: any } | null): Scope => {\n NATIVE.setContext(key, context);\n return original.call(scope, key, context);\n });\n}\n"]}
|
package/dist/js/sdk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Scope
|
|
1
|
+
import type { Scope } from '@sentry/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { ReactNativeOptions, ReactNativeWrapperOptions } from './options';
|
|
4
4
|
/**
|
|
@@ -23,11 +23,6 @@ export declare function flush(): Promise<boolean>;
|
|
|
23
23
|
* Closes the SDK, stops sending events.
|
|
24
24
|
*/
|
|
25
25
|
export declare function close(): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Captures user feedback and sends it to Sentry.
|
|
28
|
-
* @deprecated Use `Sentry.captureFeedback` instead.
|
|
29
|
-
*/
|
|
30
|
-
export declare function captureUserFeedback(feedback: UserFeedback): void;
|
|
31
26
|
/**
|
|
32
27
|
* Creates a new scope with and executes the given operation within.
|
|
33
28
|
* The scope is automatically removed once the operation
|
package/dist/js/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA2C,KAAK,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA2C,KAAK,EAAE,MAAM,cAAc,CAAC;AAanF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAA4B,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AA6BzG;;GAEG;AACH,wBAAgB,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAuG5D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACrC,OAAO,CAAC,EAAE,yBAAyB,GAClC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAsBxB;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;;GAGG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAe9C;AAED;;GAEG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAU3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAUzE;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAE9D"}
|
package/dist/js/sdk.js
CHANGED
|
@@ -7,11 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import { defaultStackParser, makeFetchTransport, } from '@sentry/react';
|
|
10
|
+
import { getClient, getGlobalScope, getIntegrationsToSetup, getIsolationScope, initAndBind, logger, makeDsn, stackParserFromStackParserOptions, withScope as coreWithScope, } from '@sentry/core';
|
|
11
|
+
import { defaultStackParser, makeFetchTransport, Profiler } from '@sentry/react';
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import { ReactNativeClient } from './client';
|
|
14
|
-
import { FeedbackWidgetProvider } from './feedback/
|
|
14
|
+
import { FeedbackWidgetProvider } from './feedback/FeedbackWidgetProvider';
|
|
15
15
|
import { getDevServer } from './integrations/debugsymbolicatorutils';
|
|
16
16
|
import { getDefaultIntegrations } from './integrations/default';
|
|
17
17
|
import { shouldEnableNativeNagger } from './options';
|
|
@@ -20,7 +20,7 @@ import { TouchEventBoundary } from './touchevents';
|
|
|
20
20
|
import { ReactNativeProfiler } from './tracing';
|
|
21
21
|
import { useEncodePolyfill } from './transports/encodePolyfill';
|
|
22
22
|
import { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from './transports/native';
|
|
23
|
-
import { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer } from './utils/environment';
|
|
23
|
+
import { getDefaultEnvironment, isExpoGo, isRunningInMetroDevServer, isWeb } from './utils/environment';
|
|
24
24
|
import { safeFactory, safeTracesSampler } from './utils/safe';
|
|
25
25
|
import { NATIVE } from './wrapper';
|
|
26
26
|
const DEFAULT_OPTIONS = {
|
|
@@ -125,10 +125,11 @@ export function init(passedOptions) {
|
|
|
125
125
|
export function wrap(RootComponent, options) {
|
|
126
126
|
var _a;
|
|
127
127
|
const profilerProps = Object.assign(Object.assign({}, (options === null || options === void 0 ? void 0 : options.profilerProps)), { name: (_a = RootComponent.displayName) !== null && _a !== void 0 ? _a : 'Root', updateProps: {} });
|
|
128
|
-
const
|
|
128
|
+
const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler;
|
|
129
|
+
const RootApp = appProps => {
|
|
129
130
|
var _a;
|
|
130
131
|
return (React.createElement(TouchEventBoundary, Object.assign({}, ((_a = options === null || options === void 0 ? void 0 : options.touchEventBoundaryProps) !== null && _a !== void 0 ? _a : {})),
|
|
131
|
-
React.createElement(
|
|
132
|
+
React.createElement(ProfilerComponent, Object.assign({}, profilerProps),
|
|
132
133
|
React.createElement(FeedbackWidgetProvider, null,
|
|
133
134
|
React.createElement(RootComponent, Object.assign({}, appProps))))));
|
|
134
135
|
};
|
|
@@ -176,19 +177,6 @@ export function close() {
|
|
|
176
177
|
}
|
|
177
178
|
});
|
|
178
179
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Captures user feedback and sends it to Sentry.
|
|
181
|
-
* @deprecated Use `Sentry.captureFeedback` instead.
|
|
182
|
-
*/
|
|
183
|
-
export function captureUserFeedback(feedback) {
|
|
184
|
-
const feedbackParams = {
|
|
185
|
-
name: feedback.name,
|
|
186
|
-
email: feedback.email,
|
|
187
|
-
message: feedback.comments,
|
|
188
|
-
associatedEventId: feedback.event_id,
|
|
189
|
-
};
|
|
190
|
-
captureFeedback(feedbackParams);
|
|
191
|
-
}
|
|
192
180
|
/**
|
|
193
181
|
* Creates a new scope with and executes the given operation within.
|
|
194
182
|
* The scope is automatically removed once the operation
|