From 0d44ccbb8efde00e1b034c28173cad9f6ce8b15b Mon Sep 17 00:00:00 2001 From: himaniraghav3 Date: Fri, 5 Dec 2025 14:39:09 +0530 Subject: [PATCH 1/6] PM-2524 Fix empty submissions tas for DS F2F --- .../components/challenge-detail/Submissions/index.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index 796dd3a0d..ee2e924c6 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -314,7 +314,7 @@ class SubmissionsComponent extends React.Component { isMM() { const { challenge } = this.props; const trackName = getTrackName(challenge); - return (trackName || '').toLowerCase() === 'data science' || checkIsMM(challenge); + return (trackName || '').toLowerCase() === 'data science' && checkIsMM(challenge); } /** @@ -404,6 +404,10 @@ class SubmissionsComponent extends React.Component { provisionalRankClicked: false, provisionalScoreClicked: false, }; + // eslint-disable-next-line no-debugger + debugger; + + console.log('sorted submissions', sortedSubmissions); const modalSubmissionBasicInfo = () => _.find(mmSubmissions, item => item.member === memberOfModal); From 2eaecf723b5ff8a006166eb470a27f996f435e18 Mon Sep 17 00:00:00 2001 From: himaniraghav3 Date: Fri, 5 Dec 2025 14:40:38 +0530 Subject: [PATCH 2/6] cleanup --- src/shared/components/challenge-detail/Submissions/index.jsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index ee2e924c6..113eedb24 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -404,10 +404,6 @@ class SubmissionsComponent extends React.Component { provisionalRankClicked: false, provisionalScoreClicked: false, }; - // eslint-disable-next-line no-debugger - debugger; - - console.log('sorted submissions', sortedSubmissions); const modalSubmissionBasicInfo = () => _.find(mmSubmissions, item => item.member === memberOfModal); From 42d1e9b4cedd119f7cd5796d8107d0234bae9e4b Mon Sep 17 00:00:00 2001 From: himaniraghav3 Date: Mon, 8 Dec 2025 11:51:20 +0530 Subject: [PATCH 3/6] remove track check --- src/shared/components/challenge-detail/Submissions/index.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index 113eedb24..928892351 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -313,8 +313,7 @@ class SubmissionsComponent extends React.Component { isMM() { const { challenge } = this.props; - const trackName = getTrackName(challenge); - return (trackName || '').toLowerCase() === 'data science' && checkIsMM(challenge); + return checkIsMM(challenge); } /** From 1c26e03809cdc5480092649f121f46aee536df37 Mon Sep 17 00:00:00 2001 From: Vasilica Olariu Date: Mon, 15 Dec 2025 12:15:09 +0200 Subject: [PATCH 4/6] PM-3204 - handle utm codes from cookies --- .../containers/challenge-detail/index.jsx | 7 +- src/shared/utils/utm.js | 68 +++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 src/shared/utils/utm.js diff --git a/src/shared/containers/challenge-detail/index.jsx b/src/shared/containers/challenge-detail/index.jsx index 752f14302..af21ce89f 100644 --- a/src/shared/containers/challenge-detail/index.jsx +++ b/src/shared/containers/challenge-detail/index.jsx @@ -57,6 +57,7 @@ import { getService } from 'services/contentful'; import { getSubmissionArtifacts as getSubmissionArtifactsService } from 'services/submissions'; import getReviewSummationsService from 'services/reviewSummations'; import { buildMmSubmissionData, buildStatisticsData } from 'utils/mm-review-summations'; +import { appendUtmParamsToUrl } from 'utils/utm'; // import { // getDisplayRecommendedChallenges, // getRecommendedTags, @@ -349,7 +350,11 @@ class ChallengeDetailPageContainer extends React.Component { } = this.props; if (!auth.tokenV3) { const utmSource = communityId || 'community-app-main'; - window.location.href = `${config.URL.AUTH}/member?retUrl=${encodeURIComponent(`${window.location.origin}${window.location.pathname}`)}&utm_source=${utmSource}®Source=challenges`; + window.location.href = appendUtmParamsToUrl( + `${config.URL.AUTH}/member?retUrl=${encodeURIComponent(`${window.location.origin}${window.location.pathname}`)}®Source=challenges`, { + utm_source: utmSource, + }, + ); } else { // Show security reminder to all registrants this.setState({ diff --git a/src/shared/utils/utm.js b/src/shared/utils/utm.js new file mode 100644 index 000000000..a0531b4da --- /dev/null +++ b/src/shared/utils/utm.js @@ -0,0 +1,68 @@ +// UTM cookie configuration constants +const TC_UTM_COOKIE_NAME = 'tc_utm'; + +/** + * Retrieves and parses the tc_utm cookie + * @returns Parsed UTM parameters or null if cookie doesn't exist + */ +export function getUtmCookie() { + try { + const cookies = document.cookie.split(';'); + const cookieStr = cookies.find(cookie => cookie.trim().startsWith(`${TC_UTM_COOKIE_NAME}=`)); + + if (!cookieStr) { + return null; + } + + // handle values that might contain '=' + const cookieValue = decodeURIComponent(cookieStr.split('=').slice(1).join('=')); + return JSON.parse(cookieValue); + } catch (error) { + console.warn('Error retrieving UTM cookie:', error); + return null; + } +} + +/** + * Appends UTM parameters from the tc_utm cookie to a given URL + * Only appends parameters that exist in the cookie + * @param url - The base URL to append parameters to + * @returns URL with UTM parameters appended, or original URL if no cookie exists + */ +export function appendUtmParamsToUrl(url, defaultParams = {}) { + if (!url) { + return url; + } + + const utmParams = getUtmCookie(); + + // If there are no cookie params and no defaults, nothing to do + if ((!utmParams || Object.keys(utmParams).length === 0) && (!defaultParams || Object.keys(defaultParams).length === 0)) { + return url; + } + + try { + const urlObj = new URL(url, window.location.origin); + const paramNames = ['utm_source', 'utm_medium', 'utm_campaign']; + + paramNames.forEach((param) => { + const cookieVal = utmParams && utmParams[param]; + const defaultVal = defaultParams && defaultParams[param]; + + // Cookie takes precedence and will overwrite existing query param + if (cookieVal) { + urlObj.searchParams.set(param, cookieVal); + } else if (defaultVal) { + // Only apply default if the URL does not already have the param + if (!urlObj.searchParams.has(param)) { + urlObj.searchParams.set(param, defaultVal); + } + } + }); + + return urlObj.toString(); + } catch (error) { + console.warn('Error appending UTM parameters to URL:', error); + return url; + } +} From c785a0606d7994ddbc9a361df89ab775acf94fbf Mon Sep 17 00:00:00 2001 From: Vasilica Olariu Date: Mon, 15 Dec 2025 12:41:48 +0200 Subject: [PATCH 5/6] lint fixes --- src/shared/utils/utm.js | 85 +++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/src/shared/utils/utm.js b/src/shared/utils/utm.js index a0531b4da..4166e6484 100644 --- a/src/shared/utils/utm.js +++ b/src/shared/utils/utm.js @@ -6,21 +6,20 @@ const TC_UTM_COOKIE_NAME = 'tc_utm'; * @returns Parsed UTM parameters or null if cookie doesn't exist */ export function getUtmCookie() { - try { - const cookies = document.cookie.split(';'); - const cookieStr = cookies.find(cookie => cookie.trim().startsWith(`${TC_UTM_COOKIE_NAME}=`)); + try { + const cookies = document.cookie.split(';'); + const cookieStr = cookies.find(cookie => cookie.trim().startsWith(`${TC_UTM_COOKIE_NAME}=`)); - if (!cookieStr) { - return null; - } - - // handle values that might contain '=' - const cookieValue = decodeURIComponent(cookieStr.split('=').slice(1).join('=')); - return JSON.parse(cookieValue); - } catch (error) { - console.warn('Error retrieving UTM cookie:', error); - return null; + if (!cookieStr) { + return null; } + + // handle values that might contain '=' + const cookieValue = decodeURIComponent(cookieStr.split('=').slice(1).join('=')); + return JSON.parse(cookieValue); + } catch (error) { + return null; + } } /** @@ -30,39 +29,41 @@ export function getUtmCookie() { * @returns URL with UTM parameters appended, or original URL if no cookie exists */ export function appendUtmParamsToUrl(url, defaultParams = {}) { - if (!url) { - return url; - } + if (!url) { + return url; + } - const utmParams = getUtmCookie(); + const utmParams = getUtmCookie(); - // If there are no cookie params and no defaults, nothing to do - if ((!utmParams || Object.keys(utmParams).length === 0) && (!defaultParams || Object.keys(defaultParams).length === 0)) { - return url; - } + // If there are no cookie params and no defaults, nothing to do + if ( + (!utmParams || Object.keys(utmParams).length === 0) && + (!defaultParams || Object.keys(defaultParams).length === 0) + ) { + return url; + } - try { - const urlObj = new URL(url, window.location.origin); - const paramNames = ['utm_source', 'utm_medium', 'utm_campaign']; + try { + const urlObj = new URL(url, window.location.origin); + const paramNames = ['utm_source', 'utm_medium', 'utm_campaign']; - paramNames.forEach((param) => { - const cookieVal = utmParams && utmParams[param]; - const defaultVal = defaultParams && defaultParams[param]; + paramNames.forEach((param) => { + const cookieVal = utmParams && utmParams[param]; + const defaultVal = defaultParams && defaultParams[param]; - // Cookie takes precedence and will overwrite existing query param - if (cookieVal) { - urlObj.searchParams.set(param, cookieVal); - } else if (defaultVal) { - // Only apply default if the URL does not already have the param - if (!urlObj.searchParams.has(param)) { - urlObj.searchParams.set(param, defaultVal); - } - } - }); + // Cookie takes precedence and will overwrite existing query param + if (cookieVal) { + urlObj.searchParams.set(param, cookieVal); + } else if (defaultVal) { + // Only apply default if the URL does not already have the param + if (!urlObj.searchParams.has(param)) { + urlObj.searchParams.set(param, defaultVal); + } + } + }); - return urlObj.toString(); - } catch (error) { - console.warn('Error appending UTM parameters to URL:', error); - return url; - } + return urlObj.toString(); + } catch (error) { + return url; + } } From 02378d1aa99fd865d46932f700cc34d868cc81c3 Mon Sep 17 00:00:00 2001 From: Vasilica Olariu Date: Mon, 15 Dec 2025 12:45:30 +0200 Subject: [PATCH 6/6] lint fixes --- src/shared/utils/utm.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/utils/utm.js b/src/shared/utils/utm.js index 4166e6484..529647ca6 100644 --- a/src/shared/utils/utm.js +++ b/src/shared/utils/utm.js @@ -37,8 +37,8 @@ export function appendUtmParamsToUrl(url, defaultParams = {}) { // If there are no cookie params and no defaults, nothing to do if ( - (!utmParams || Object.keys(utmParams).length === 0) && - (!defaultParams || Object.keys(defaultParams).length === 0) + (!utmParams || Object.keys(utmParams).length === 0) + && (!defaultParams || Object.keys(defaultParams).length === 0) ) { return url; }