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.js","webpack://StravaModern/./app/javascript/apps/StravaPackageContextProviders/index.js","webpack://StravaModern/./app/javascript/components/shared/FormattedHTMLMessage/index.js","webpack://StravaModern/./app/javascript/utils/I18n.js","webpack://StravaModern/./app/javascript/utils/react-component-mounter.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport I18n from 'utils/I18n';\nimport * as ContainerContext from '@strava/container-context';\nimport {\n logError,\n logMessage,\n setTag,\n setTags,\n setContext,\n withScope\n} from 'utils/sentry';\n\nconst {\n AnalyticsContext,\n ErrorLoggingContext,\n TranslationContext\n} = ContainerContext;\n\nconst { Provider: AnalyticsProvider } = AnalyticsContext;\nconst { Provider: TranslationProvider } = TranslationContext;\nconst { Provider: ErrorLoggingProvider } = ErrorLoggingContext;\n\nconst analyticsContext = {\n track: (data) => window.Strava.ExternalAnalytics.trackV2(data)\n};\n\nconst translationContext = {\n t: (key, props = {}) => I18n.t(key, props),\n getLanguage: () => I18n.language()\n};\n\nconst errorLoggingContext = {\n logError,\n logMessage,\n setContext,\n setTag,\n setTags,\n withScope\n};\n\n// does not include the branch context\nconst StravaPackageContextProviders = ({ children }) => (\n \n \n \n {children}\n \n \n \n);\n\nStravaPackageContextProviders.propTypes = {\n children: PropTypes.node.isRequired\n};\n\nexport default StravaPackageContextProviders;\n","export { default } from './StravaPackageContextProviders';\n","import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst FormattedHTMLMessage = ({ tagName, message, className, onLinkClick }) => {\n const handleLinkClick = (e) => {\n if (e.target.nodeName === 'A' && !!onLinkClick) {\n onLinkClick(e);\n }\n };\n\n return React.createElement(tagName, {\n className,\n dangerouslySetInnerHTML: {\n __html: message\n },\n onClick: handleLinkClick\n });\n};\n\nFormattedHTMLMessage.propTypes = {\n message: PropTypes.string.isRequired,\n tagName: PropTypes.string,\n className: PropTypes.string,\n onLinkClick: PropTypes.func\n};\n\nFormattedHTMLMessage.defaultProps = {\n tagName: 'span',\n className: null,\n onLinkClick: null\n};\n\nexport default FormattedHTMLMessage;\n","import React from 'react';\n\nimport FormattedHTMLMessage from '../components/shared/FormattedHTMLMessage';\n\nfunction t(key, props = {}) {\n return window.Strava.I18n.Locale.t(key, props);\n}\n\nfunction elevationFormatter(unitSystem) {\n return new window.Strava.I18n.ElevationFormatter(unitSystem);\n}\n\nfunction elevationLabelFormatter(unitSystem) {\n return new window.Strava.I18n.ChartLabelElevationFormatter(unitSystem);\n}\n\nfunction distanceFormatter(unitSystem) {\n return new window.Strava.I18n.DistanceFormatter(unitSystem);\n}\n\nfunction distanceLabelFormatter(unitSystem) {\n return new window.Strava.I18n.ChartLabelDistanceFormatter(unitSystem);\n}\n\nfunction distancePerTimeFormatter(unitSystem) {\n return new window.Strava.I18n.DistancePerTimeFormatter(unitSystem);\n}\n\nfunction distancePerTimeLabelFormatter(unitSystem) {\n return new window.Strava.I18n.ChartLabelDistancePerTimeFormatter(unitSystem);\n}\n\nfunction percentFormatter() {\n return new window.Strava.I18n.PercentFormatter();\n}\n\nfunction timespanFormatter() {\n return new window.Strava.I18n.TimespanFormatter();\n}\n\nexport default {\n t,\n t_html(key, props = {}, options = {}) {\n return ;\n },\n elevationFormatter,\n elevationLabelFormatter,\n distanceFormatter,\n distanceLabelFormatter,\n distancePerTimeFormatter,\n distancePerTimeLabelFormatter,\n percentFormatter,\n timespanFormatter,\n language() {\n return window.Strava.I18n.Locales.LANGUAGE_CODE;\n },\n measurementUnits() {\n return window.Strava.I18n.UnitSystem.get();\n }\n};\n","import React, { useCallback, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport * as ContainerContext from '@strava/container-context';\nimport { useBranchIO } from '@strava/react-hooks';\nimport StravaPackageContextProviders from '../apps/StravaPackageContextProviders';\nimport { logError, logMessage } from './sentry';\n\nconst { BranchContext } = ContainerContext;\n\nconst { Provider: BranchContextProvider } = BranchContext;\n\nconst BranchContextProxy = ({\n dataSharingOptedOut = false,\n denyNonessentialCookies = true,\n children\n}) => {\n // non-essential third party cookies\n const [cookiesAccepted, setCookiesAccepted] = useState(\n !denyNonessentialCookies\n );\n\n const branch = useBranchIO({\n dataSharingOptedOut,\n cookiesAccepted,\n logError\n });\n\n const handleAcceptCookiesEvent = useCallback(() => {\n setCookiesAccepted(true);\n }, [setCookiesAccepted]);\n\n useEffect(() => {\n window.addEventListener('AcceptCookies', handleAcceptCookiesEvent);\n return () => {\n window.removeEventListener('AcceptCookies', handleAcceptCookiesEvent);\n };\n }, [handleAcceptCookiesEvent]);\n\n return (\n {children}\n );\n};\n\nBranchContextProxy.propTypes = {\n dataSharingOptedOut: PropTypes.bool.isRequired,\n denyNonessentialCookies: PropTypes.bool.isRequired,\n children: PropTypes.node.isRequired\n};\n\n// Object that stores references to all the registered components\nlet registeredComponents = {};\n\n// Track a single component that should be mounted after the DOM content has loaded\nfunction register(components) {\n // Registered components are passed in as Hash keys (as opposed to individual arguments)\n // in order to preserve their names during JavaScript minification.\n //\n // For example:\n // ReactComponentMounter.register({ Hello });\n\n registeredComponents = { ...registeredComponents, ...components };\n}\n\nfunction mountComponent({ node, component, props }) {\n const className = component || node.getAttribute('data-react-class');\n const reactComponent = registeredComponents[className];\n\n if (!reactComponent) {\n logMessage(`Cannot find a component registered with the name ${className}`);\n return;\n }\n\n const propsJson = node.getAttribute('data-react-props');\n try {\n const reactProps = {\n ...(propsJson && JSON.parse(propsJson)),\n ...props\n };\n\n const { dataSharingOptedOut, denyNonessentialCookies } = reactProps || {};\n\n let reactElement = React.createElement(reactComponent, reactProps);\n\n // react-components imported from published `web` packages\n // these packages are developed locally using MFEs so they need\n // providers from @strava/container-context\n const isPublished = node.getAttribute('data-is-published') === 'true';\n if (isPublished) {\n reactElement = (\n \n \n {reactElement}\n \n \n );\n }\n\n ReactDOM.render(reactElement, node);\n } catch (e) {\n logError(e);\n }\n}\n\n// Allows a page to mount a component right away rather than\n// wait for the DOMContentLoaded event\nfunction inlineMount(node, component) {\n mountComponent({ node, component });\n}\n\n// Search the DOM for all react components to be mounted,\n// and mount them into the DOM\nfunction mountComponents() {\n const nodesToMount = document.querySelectorAll('[data-react-class]');\n // IE does not support NodeList.forEach, so we need to do it the old fashion way\n /* eslint-disable-next-line no-plusplus */\n for (let i = 0; i < nodesToMount.length; ++i) {\n mountComponent({ node: nodesToMount[i] });\n }\n}\n\n// Ensure pages can mount components more specifically\nif (window.stravaInlineMount === undefined) {\n window.stravaInlineMount = inlineMount;\n}\n\n// Add this listener only once, when the module is first imported\ndocument.addEventListener('DOMContentLoaded', mountComponents);\n\n/**\n * Also added once, this listener can be used to render react components\n * that were created after the DOM was loaded via the ruby `react_component` helper\n *\n * example usage:\n *\n * document.dispatchEvent(new CustomEvent('JSCreatedReactNode', {detail: {node: $('#my-react-component')}}))\n * document.dispatchEvent(new CustomEvent('JSCreatedReactNode', {detail: {node: $('#my-react-component')[index]}}))\n */\nfunction mountJSCreatedComponent(e) {\n const { node, component, props } = e.detail;\n if (!node) {\n return;\n }\n\n const unwrappedNode = node.length ? node[0] : node;\n if (!unwrappedNode) {\n return;\n }\n\n mountComponent({ node: unwrappedNode, component, props });\n}\n\ndocument.addEventListener('JSCreatedReactNode', mountJSCreatedComponent);\n\n/**\n * Components mounted using certain erb - jquery setup do not go through their whole\n * lifecyle so they are left unmounted as the athlete interacts on the page.\n *\n * For examples, see interval.js.rb, graph_data_range.js.rb and interval_type.js.rb\n */\ndocument.addEventListener('JSUnmountReactNode', (e) => {\n ReactDOM.unmountComponentAtNode(e.detail.node);\n});\n\nexport default { register, mountComponent };\n"],"names":["cov_1nb4yexh4i","ContainerContext","AnalyticsContext","ErrorLoggingContext","TranslationContext","AnalyticsProvider","Provider","TranslationProvider","ErrorLoggingProvider","analyticsContext","track","data","window","Strava","ExternalAnalytics","trackV2","translationContext","t","key","props","I18n","getLanguage","language","errorLoggingContext","logError","logMessage","setContext","setTag","setTags","withScope","_ref","children","value","React","cov_2it78ek94o","cov_26k0eqz9ch","FormattedHTMLMessage","tagName","message","className","onLinkClick","dangerouslySetInnerHTML","__html","onClick","e","target","nodeName","defaultProps","cov_2r1tokpcg7","Locale","t_html","options","_extends","elevationFormatter","unitSystem","ElevationFormatter","elevationLabelFormatter","ChartLabelElevationFormatter","distanceFormatter","DistanceFormatter","distanceLabelFormatter","ChartLabelDistanceFormatter","distancePerTimeFormatter","DistancePerTimeFormatter","distancePerTimeLabelFormatter","ChartLabelDistancePerTimeFormatter","percentFormatter","PercentFormatter","timespanFormatter","TimespanFormatter","Locales","LANGUAGE_CODE","measurementUnits","UnitSystem","get","cov_nd2f96vxg","BranchContext","BranchContextProvider","BranchContextProxy","dataSharingOptedOut","denyNonessentialCookies","useState","cookiesAccepted","setCookiesAccepted","branch","useBranchIO","handleAcceptCookiesEvent","useCallback","useEffect","addEventListener","removeEventListener","registeredComponents","mountComponent","_ref2","node","component","getAttribute","reactComponent","propsJson","reactProps","JSON","parse","reactElement","isPublished","StravaPackageContextProviders","ReactDOM","undefined","stravaInlineMount","document","nodesToMount","querySelectorAll","i","length","detail","unwrappedNode","register","components"],"sourceRoot":""}