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EAAAA,GAAY,CACVJ,IAAKG,EACLE,eAAgB,GAChBC,aAAc,CACZ,IAAIC,EAAAA,GAAe,CACjBC,eAAgB,CACd,iCACA,yBACA,YACA,OAEFC,eAAgB,SAACC,GACf,MAA6B7I,OAAO8I,SAA5BC,EAAR,EAAQA,SAAUC,EAAlB,EAAkBA,OACZC,EAAqBzB,EAAoBd,SAASqC,GACxD,OAAO,UACFF,EADL,CAEEK,KAAMD,EAAqBF,EAASI,OAAOH,GAAUD,QAK7DK,SAAU,CAER,gBACA,iBAEFC,iBAAkBjB,EAClBC,MAAAA,EACAiB,kBAAkB,EAClBrB,QAAAA,EACAsB,aAAc,CACZC,KAAM,CAAEC,GAAIvB,IAEdF,YAAAA,EACA0B,WAAY,SAAC9C,EAAOL,GAClB,OACED,EAAsCC,IACtCI,EAAmCC,IACnCI,EAAuCJ,GAEhC,KAEFA,QAMR,IAAMxF,EAAW,SAACuI,IACnB1F,EAAAA,EAAAA,MAEF1F,QAAQG,MAAM,eAAgBiL,GAGhCpB,EAAAA,GAAwBoB,IAGbC,EAAa,SAACjI,IACrBsC,EAAAA,EAAAA,MAEF1F,QAAQC,IAAI,iBAAkBmD,GAGhC4G,EAAAA,GAAsB5G","sources":["webpack://StravaModern/./app/javascript/apps/Microfrontend/styles.scss?dd46","webpack://StravaModern/./app/javascript/apps/Microfrontend/Microfrontend.js","webpack://StravaModern/./app/javascript/globalLibraries.js","webpack://StravaModern/./app/javascript/components/shared/FormattedHTMLMessage/index.js","webpack://StravaModern/./app/javascript/utils/I18n.js","webpack://StravaModern/./app/javascript/utils/analytics.js","webpack://StravaModern/./app/javascript/utils/devUtils.js","webpack://StravaModern/./app/javascript/utils/public-service-env.js","webpack://StravaModern/./app/javascript/utils/react-component-mounter.js","webpack://StravaModern/./app/javascript/utils/sentry.helper.js","webpack://StravaModern/./app/javascript/utils/sentry.js"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport default {\"mfcontainer\":\"Microfrontend--mfcontainer--Sw1H-\"};","import React from 'react';\nimport {\n TranslationContext,\n AnalyticsContext,\n ErrorLoggingContext\n} from '@strava/container-context';\nimport { logError } from '../../utils/sentry';\nimport I18n from '../../utils/I18n';\nimport styles from './styles.scss';\n\n// We want to track each url that we use to load a remote entry,\n// because we want to check if we've already downloaded and avoid\n// downloading the same remote multiple times.\nconst remoteUrls = {};\n\n// We want to initialize the 'scope' (remote entry code) a single time,\n// and not many times for many different components.\n// Specifically, we only want to call this line once:\n// `containerResolve(window[scope].init(legacyShareScope));`\nconst initializedScopes = {};\n\nconst cleanup = (scriptElement) => {\n if (scriptElement.parentNode) {\n scriptElement.parentNode.removeChild(scriptElement);\n }\n};\n\nconst loadDynamicScript = (url) => {\n if (remoteUrls[url] == null) {\n remoteUrls[url] = new Promise((resolve, reject) => {\n // insert remote script into document and add\n // onerror and onload listeners that will finalize\n // installation\n const element = document.createElement('script');\n element.src = url;\n element.type = 'text/javascript';\n element.async = true;\n\n element.onload = () => {\n console.log(`Dynamic Script Loaded: ${url}`);\n resolve(element);\n };\n\n element.onerror = () => {\n console.error(`Dynamic Script Error: ${url}`);\n reject(element);\n };\n\n document.head.appendChild(element);\n });\n }\n\n return remoteUrls[url];\n};\n\nconst cleanupScript = (url) => {\n if (remoteUrls[url]) {\n remoteUrls[url].then(cleanup, cleanup);\n }\n};\n\n// TODO: remove once we've upgraded to webpacker 6 (webpack 5)\n// The code here only supports consumption of federated modules\n// and does not allow hosting federated modules\n// copied from\n// https://github.com/module-federation/practical-module-federation/blob/master/chapter7/packages/home-wp4/src/App.jsx\nconst useDynamicScript = (url) => {\n const [isLoading, setIsLoading] = React.useState(true);\n const [failed, setFailed] = React.useState(false);\n\n React.useEffect(() => {\n if (!url) {\n return;\n }\n\n const promise = loadDynamicScript(url);\n\n setIsLoading(true);\n setFailed(false);\n\n promise.then(\n () => {\n console.log(`Dynamic Script Loaded: ${url}`);\n setIsLoading(false);\n },\n () => {\n console.error(`Dynamic Script Error: ${url}`);\n setIsLoading(false);\n setFailed(true);\n }\n );\n\n // eslint-disable-next-line consistent-return\n return () => {\n // cleanup code to remove script added as part of loading\n // the remote federated module. This code is ran before\n // another execution of this useEffect is ran before\n // rendering and when the component unmounts\n console.log(`Dynamic Script Removed: ${url}`);\n cleanupScript(url);\n };\n }, [url]);\n\n return {\n isLoading,\n failed\n };\n};\n\n// eslint-disable-next-line react/prop-types\nconst DynamicWidget = ({ url, scope, component, appContext }) => {\n const { isLoading, failed } = useDynamicScript(url);\n\n if (isLoading) {\n return null;\n }\n\n if (failed) {\n return

Failed to load dynamic script: {url}

;\n }\n\n const Component = React.lazy(\n () =>\n // moduleResolve is the reference to use to mark this\n // promise as completed/resolved.\n new Promise((moduleResolve) => {\n // signal webpacker to load the pages react\n // and create a share scope to initialize with\n // the component.\n // eslint-disable-next-line global-require\n const react = require('react');\n\n // eslint-disable-next-line global-require\n const translationscontext = require('@strava/container-context');\n\n const legacyShareScope = {\n react: {\n [react.version]: {\n get: () => {\n return () => react;\n },\n singleton: true,\n loaded: true,\n from: 'webpack4'\n }\n },\n // the context provider needs to be a singleton for the\n // shared info to be the same between container and MFE\n '@strava/container-context': {\n [translationscontext.version]: {\n get: () => {\n return () => translationscontext;\n },\n singleton: true,\n loaded: true,\n from: 'webpack4'\n }\n }\n };\n new Promise((containerResolve) => {\n // when we load the remoteEntry.js, it creates the scope\n // defined in the remote exposed components. We use the\n // pages shared scope to compare the react version on the\n // page vs the one of the remote component\n\n // Initialize a remote once even when multiple components use it\n if (initializedScopes[scope]) {\n containerResolve();\n } else {\n initializedScopes[scope] = true;\n containerResolve(window[scope].init(legacyShareScope));\n }\n }).then(() => {\n // finally, load the component/module and resolve\n // topmost promise\n window[scope].get(component).then((factory) => {\n moduleResolve(factory());\n });\n });\n })\n );\n\n return (\n \n \n \n );\n};\n\n// eslint-disable-next-line no-unused-vars,react/prop-types\nconst Microfrontend = ({ url, scope, component, appContext }) => (\n
\n {\n return window.Strava.ExternalAnalytics.trackV2(data);\n }\n }}\n >\n {\n return I18n.t(key, props);\n },\n getLanguage: () => {\n return I18n.language();\n }\n }}\n >\n \n \n \n \n \n
\n);\n\nexport default Microfrontend;\n","// This file is deprecated and only used to move node_modules accessed in the\n// sprockets asset pipeline to webpack entry points\n// adding random string to force recompile:\n// A998D3152224818D225A880A9B627F1FB4484DD7E408EACA1B243326ED4AA01B\n\n// importing jquery using script-loader to mimic adding jQuery via a script tag\n/* eslint-disable no-unused-vars,import/extensions */\nimport 'jquery/dist/jquery.min.js';\nimport 'leaflet/dist/leaflet.js';\nimport 'dexie/dist/dexie.min.js';\nimport 'intersection-observer/intersection-observer.js';\nimport '@strava/clio/dist/strava_analytics.min.js';\nimport '@strava/autotrack/autotrack.js';\nimport 'dropzone/dist/dropzone.js';\nimport 'blueimp-load-image/js/load-image.all.min.js';\nimport 'dropzone/dist/min/dropzone.min.css';\n\nimport { setPublicServiceEnv } from './utils/public-service-env';\nimport { devLog } from './utils/devUtils';\n\n// Expose method on global scope that sets public keys that are commonly passed\n// to 3rd party libs or tooling.\nif (window.stravaPublicServiceEnv === undefined) {\n window.stravaPublicServiceEnv = setPublicServiceEnv;\n}\n\ndevLog('loading global libraries');\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","export function trackV2({ category, page, action, element, properties = {} }) {\n try {\n window.Strava.ExternalAnalytics.trackV2({\n category,\n page,\n action,\n element,\n properties\n });\n } catch (e) {\n console.error(\n `Could not execute Strava.ExternalAnalytics.trackV2 event with the category:action ${category}:${action}`,\n e\n );\n }\n}\n\nexport default {\n trackV2\n};\n","/**\n * dev utils to make local development easier (dynamically-imported mock data,\n * dev-only console logs, etc.)\n */\n\nexport const isDev = () => {\n return process.env.NODE_ENV === 'development';\n};\n\nexport const isTest = () => process.env.NODE_ENV === 'test';\n\nexport const devLog = (string) => {\n if (isDev() || window?.StravaDevTools?.enabled) {\n // eslint-disable-next-line no-console\n console.log(string);\n }\n};\n\nexport const timeout = (ms) => {\n return new Promise((resolve) => setTimeout(resolve, ms));\n};\n\nexport default { isDev, devLog, timeout };\n","// Object containing no secret key value pairs that are expected to be seen and\n// used in the browser. This keys are commonly passed to 3rd party libs or tooling.\n//\n// Data that gets set to this object is set in the following file:\n// app/views/common/_react_public_service_env.haml\n//\n// Do not set values directly into this object here as that is not intended use\nconst publicServiceEnv = {};\n\n/**\n * Sets data to an object and freezes it on the initial call.\n * @param {Object} envData Object containing key value pairs that are not nested objects\n */\nfunction setPublicServiceEnv(envData) {\n // Only update the object if it's empty as we do not want to allow any updated\n // after the initial call to this method\n if (Object.keys(publicServiceEnv).length === 0) {\n const keys = Object.keys(envData);\n\n if (keys.length > 0) {\n keys.forEach((value) => {\n publicServiceEnv[value] = envData[value];\n });\n\n // Freeze object so that it can not be updated or changed\n Object.freeze(publicServiceEnv);\n }\n }\n}\n\nexport { publicServiceEnv, setPublicServiceEnv };\n","import React from 'react';\nimport ReactDOM from 'react-dom';\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 console.error(\n `Cannot find a component registered with the name ${className}`\n );\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 reactElement = React.createElement(reactComponent, reactProps);\n ReactDOM.render(reactElement, node);\n } catch (e) {\n console.error(\n `Could not parse props for component registered with the name ${className}`\n );\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","const BROWSER_EXTENSION = '-extension://';\nconst ANONYMOUS = '';\n\nexport const hasExtensionReferenceInHintErrorStack = (hint) =>\n hint?.originalException?.stack?.includes(BROWSER_EXTENSION);\n\nexport const hasExtensionReferenceInBreadCrumbs = (event) =>\n !!event?.breadcrumbs?.find((entry) =>\n entry.data?.url?.includes(BROWSER_EXTENSION)\n );\n\nexport const hasExtensionReferenceInEventErrorStack = (event) => {\n return !!event?.exception?.values?.find((entry) => {\n return !!entry.stacktrace?.frames?.find(\n (frame) =>\n frame?.filename?.includes(BROWSER_EXTENSION) ||\n frame?.abs_path?.includes(BROWSER_EXTENSION) ||\n frame?.filename?.includes(ANONYMOUS) ||\n frame?.abs_path?.includes(ANONYMOUS)\n );\n });\n};\n\nexport default {\n hasExtensionReferenceInHintErrorStack,\n hasExtensionReferenceInBreadCrumbs,\n hasExtensionReferenceInEventErrorStack\n};\n","import * as Sentry from '@sentry/browser';\nimport { BrowserTracing } from '@sentry/tracing';\nimport { isDev } from './devUtils';\nimport {\n hasExtensionReferenceInBreadCrumbs,\n hasExtensionReferenceInHintErrorStack,\n hasExtensionReferenceInEventErrorStack\n} from './sentry.helper';\n\n// List of pages that have the same pathname but different variants controlled with\n// search params. Pages added to this list will have the search param added to the name\n// during tracing (performance tracking)\nconst PAGES_WITH_VARIANTS = ['/onboarding/continue'];\n\nif (!window.StravaSentryDsn) {\n window.StravaSentryDsn = {};\n}\nif (!window.StravaSentryDsn.deferred) {\n window.StravaSentryDsn.deferred = {};\n const promise = new Promise(\n function _(resolve, reject) {\n this.doResolve = resolve;\n this.doReject = reject;\n }.bind(window.StravaSentryDsn.deferred)\n );\n window.StravaSentryDsn.deferred.then = promise.then.bind(promise);\n}\n\nconst { enabled, environment, release, userId, dsn, sampleRate, debug } =\n window.StravaSentry || {};\n\nwindow.StravaSentryDsn.deferred.doResolve(dsn);\n\nwindow.StravaSentryDsn.deferred.then((_dsn) => {\n // configure sentry_frontend.yml to enable sentry on local\n if (enabled) {\n Sentry.init({\n dsn: _dsn,\n maxBreadcrumbs: 50,\n integrations: [\n new BrowserTracing({\n tracingOrigins: [\n 'https://www.staging.strava.com',\n 'https://www.strava.com',\n 'localhost',\n /^\\//\n ],\n beforeNavigate: (context) => {\n const { pathname, search } = window.location;\n const includeSearchParam = PAGES_WITH_VARIANTS.includes(pathname);\n return {\n ...context,\n name: includeSearchParam ? pathname.concat(search) : pathname\n };\n }\n })\n ],\n denyUrls: [\n // Chrome extensions\n /extensions\\//i,\n /^chrome:\\/\\//i\n ],\n tracesSampleRate: sampleRate,\n debug,\n attachStacktrace: true,\n release,\n initialScope: {\n user: { id: userId }\n },\n environment,\n beforeSend: (event, hint) => {\n if (\n hasExtensionReferenceInHintErrorStack(hint) ||\n hasExtensionReferenceInBreadCrumbs(event) ||\n hasExtensionReferenceInEventErrorStack(event)\n ) {\n return null;\n }\n return event;\n }\n });\n }\n});\n\nexport const logError = (err) => {\n if (isDev()) {\n // eslint-disable-next-line no-console\n console.error('logError :::', err);\n return;\n }\n Sentry.captureException(err);\n};\n\nexport const logMessage = (message) => {\n if (isDev()) {\n // eslint-disable-next-line no-console\n console.log('logMessage :::', message);\n return;\n }\n Sentry.captureMessage(message);\n};\n\nexport default { logError, logMessage };\n"],"names":["remoteUrls","initializedScopes","cleanup","scriptElement","parentNode","removeChild","useDynamicScript","url","React","isLoading","setIsLoading","failed","setFailed","promise","Promise","resolve","reject","element","document","createElement","src","type","async","onload","console","log","onerror","error","head","appendChild","loadDynamicScript","then","cleanupScript","DynamicWidget","scope","component","appContext","Component","moduleResolve","react","require","translationscontext","legacyShareScope","version","get","singleton","loaded","from","containerResolve","window","init","factory","fallback","className","styles","AnalyticsContext","value","track","data","Strava","ExternalAnalytics","trackV2","TranslationContext","t","key","props","I18n","getLanguage","ErrorLoggingContext","logError","undefined","stravaPublicServiceEnv","setPublicServiceEnv","devLog","FormattedHTMLMessage","tagName","message","onLinkClick","dangerouslySetInnerHTML","__html","onClick","e","target","nodeName","defaultProps","Locale","t_html","options","elevationFormatter","unitSystem","ElevationFormatter","elevationLabelFormatter","ChartLabelElevationFormatter","distanceFormatter","DistanceFormatter","distanceLabelFormatter","ChartLabelDistanceFormatter","distancePerTimeFormatter","DistancePerTimeFormatter","distancePerTimeLabelFormatter","ChartLabelDistancePerTimeFormatter","percentFormatter","PercentFormatter","timespanFormatter","TimespanFormatter","language","Locales","LANGUAGE_CODE","measurementUnits","UnitSystem","category","page","action","properties","isDev","process","string","StravaDevTools","enabled","timeout","ms","setTimeout","publicServiceEnv","envData","Object","keys","length","forEach","freeze","registeredComponents","mountComponent","node","getAttribute","reactComponent","propsJson","reactProps","JSON","parse","reactElement","ReactDOM","stravaInlineMount","addEventListener","nodesToMount","querySelectorAll","i","detail","unwrappedNode","register","components","BROWSER_EXTENSION","ANONYMOUS","hasExtensionReferenceInHintErrorStack","hint","originalException","stack","includes","hasExtensionReferenceInBreadCrumbs","event","breadcrumbs","find","entry","hasExtensionReferenceInEventErrorStack","exception","values","stacktrace","frames","frame","filename","abs_path","PAGES_WITH_VARIANTS","StravaSentryDsn","deferred","this","doResolve","doReject","bind","StravaSentry","environment","release","userId","dsn","sampleRate","debug","_dsn","Sentry","maxBreadcrumbs","integrations","BrowserTracing","tracingOrigins","beforeNavigate","context","location","pathname","search","includeSearchParam","name","concat","denyUrls","tracesSampleRate","attachStacktrace","initialScope","user","id","beforeSend","err","logMessage"],"sourceRoot":""}