{"version":3,"file":"App-Cf8kwf83.js","sources":["../../../node_modules/@sentry/react/build/esm/constants.js","../../../node_modules/@sentry/react/build/esm/profiler.js","../../../app/javascript/utils/scrollToTop.tsx","../../../app/javascript/App.jsx"],"sourcesContent":["const REACT_RENDER_OP = 'ui.react.render';\n\nconst REACT_UPDATE_OP = 'ui.react.update';\n\nconst REACT_MOUNT_OP = 'ui.react.mount';\n\nexport { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP };\n//# sourceMappingURL=constants.js.map\n","import { startInactiveSpan } from '@sentry/browser';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, withActiveSpan, spanToJSON } from '@sentry/core';\nimport { timestampInSeconds } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { REACT_MOUNT_OP, REACT_UPDATE_OP, REACT_RENDER_OP } from './constants.js';\n\nconst UNKNOWN_COMPONENT = 'unknown';\n\n/**\n * The Profiler component leverages Sentry's Tracing integration to generate\n * spans based on component lifecycles.\n */\nclass Profiler extends React.Component {\n /**\n * The span of the mount activity\n * Made protected for the React Native SDK to access\n */\n\n /**\n * The span that represents the duration of time between shouldComponentUpdate and componentDidUpdate\n */\n\n // eslint-disable-next-line @typescript-eslint/member-ordering\n static __initStatic() {this.defaultProps = {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n };}\n\n constructor(props) {\n super(props);\n const { name, disabled = false } = this.props;\n\n if (disabled) {\n return;\n }\n\n this._mountSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_MOUNT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n }\n\n // If a component mounted, we can finish the mount activity.\n componentDidMount() {\n if (this._mountSpan) {\n this._mountSpan.end();\n }\n }\n\n shouldComponentUpdate({ updateProps, includeUpdates = true }) {\n // Only generate an update span if includeUpdates is true, if there is a valid mountSpan,\n // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.\n // We are just trying to give baseline clues for further investigation.\n if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {\n // See what props haved changed between the previous props, and the current props. This is\n // set as data on the span. We just store the prop keys as the values could be potenially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n const now = timestampInSeconds();\n this._updateSpan = withActiveSpan(this._mountSpan, () => {\n return startInactiveSpan({\n name: `<${this.props.name}>`,\n onlyIfParent: true,\n op: REACT_UPDATE_OP,\n startTime: now,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': this.props.name,\n 'ui.react.changed_props': changedProps,\n },\n });\n });\n }\n }\n\n return true;\n }\n\n componentDidUpdate() {\n if (this._updateSpan) {\n this._updateSpan.end();\n this._updateSpan = undefined;\n }\n }\n\n // If a component is unmounted, we can say it is no longer on the screen.\n // This means we can finish the span representing the component render.\n componentWillUnmount() {\n const endTimestamp = timestampInSeconds();\n const { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n const startTime = spanToJSON(this._mountSpan).timestamp;\n withActiveSpan(this._mountSpan, () => {\n const renderSpan = startInactiveSpan({\n onlyIfParent: true,\n name: `<${name}>`,\n op: REACT_RENDER_OP,\n startTime,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n });\n }\n }\n\n render() {\n return this.props.children;\n }\n} Profiler.__initStatic();\n\n/**\n * withProfiler is a higher order component that wraps a\n * component in a {@link Profiler} component. It is recommended that\n * the higher order component be used over the regular {@link Profiler} component.\n *\n * @param WrappedComponent component that is wrapped by Profiler\n * @param options the {@link ProfilerProps} you can pass into the Profiler\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withProfiler(\n WrappedComponent,\n // We do not want to have `updateProps` given in options, it is instead filled through the HOC.\n options,\n) {\n const componentDisplayName =\n (options && options.name) || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped = (props) => (\n React.createElement(Profiler, { ...options, name: componentDisplayName, updateProps: props,}\n , React.createElement(WrappedComponent, { ...props,} )\n )\n );\n\n Wrapped.displayName = `profiler(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\n/**\n *\n * `useProfiler` is a React hook that profiles a React component.\n *\n * Requires React 16.8 or above.\n * @param name displayName of component being profiled\n */\nfunction useProfiler(\n name,\n options = {\n disabled: false,\n hasRenderSpan: true,\n },\n) {\n const [mountSpan] = React.useState(() => {\n if (options && options.disabled) {\n return undefined;\n }\n\n return startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_MOUNT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.end();\n }\n\n return () => {\n if (mountSpan && options.hasRenderSpan) {\n const startTime = spanToJSON(mountSpan).timestamp;\n const endTimestamp = timestampInSeconds();\n\n const renderSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n op: REACT_RENDER_OP,\n startTime,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n }\n };\n // We only want this to run once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport { Profiler, UNKNOWN_COMPONENT, useProfiler, withProfiler };\n//# sourceMappingURL=profiler.js.map\n","import { useEffect } from 'react';\nimport {\n NavigationType,\n useLocation,\n useNavigationType,\n} from 'react-router-dom';\n\nconst ScrollToTop = () => {\n // Extracts pathname property(key) from an object\n const { pathname } = useLocation();\n const navType: NavigationType = useNavigationType();\n\n // Automatically scrolls to top whenever pathname changes (but not on back button)\n useEffect(() => {\n if (navType === 'PUSH') {\n window.scrollTo(0, 0);\n }\n }, [pathname]);\n};\n\nexport default ScrollToTop;\n","import { StaticRoutes } from './Router';\nimport ScrollToTop from 'utils/scrollToTop';\nimport ErrorBoundary from 'components/ErrorBoundary';\nimport * as Sentry from '@sentry/react';\nimport { PostHogProvider } from 'posthog-js/react';\nimport posthog from 'posthog-js';\n\nif (typeof window !== 'undefined' && import.meta.env.POSTHOG_PUBLIC_KEY) {\n posthog.init(import.meta.env.POSTHOG_PUBLIC_KEY, {\n loaded: function (posthog) {\n console.debug('Posthog started');\n // adding identify if we have a user coming from another domain with a posthogid\n const params = new URLSearchParams(window.location.search);\n const posthogId = params.get('posthog_id');\n if (posthogId) {\n posthog.identify(posthogId);\n }\n },\n autocapture: false, // we will enable it on consent\n });\n}\n\nfunction App() {\n return (\n \n \n \n \n \n \n );\n}\n\nexport default Sentry.withProfiler(App);\n"],"names":["REACT_RENDER_OP","REACT_UPDATE_OP","REACT_MOUNT_OP","UNKNOWN_COMPONENT","Profiler","React.Component","props","name","disabled","startInactiveSpan","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","updateProps","includeUpdates","changedProps","k","now","timestampInSeconds","withActiveSpan","endTimestamp","includeRender","startTime","spanToJSON","renderSpan","withProfiler","WrappedComponent","options","componentDisplayName","Wrapped","React.createElement","hoistNonReactStatics","ScrollToTop","pathname","useLocation","navType","useNavigationType","useEffect","posthog","posthogId","App","jsx","ErrorBoundary","PostHogProvider","StaticRoutes","Sentry.withProfiler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