diff --git a/src/shared/actions/growSurf.js b/src/shared/actions/growSurf.js deleted file mode 100644 index 38f7920de..000000000 --- a/src/shared/actions/growSurf.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Actions related to growsurf (gig referrals) - */ -/* global fetch */ -import { redux, config } from 'topcoder-react-utils'; - -const PROXY_ENDPOINT = `${config.URL.COMMUNITY_APP}/api`; - -/** - * Fetch init - */ -function getReferralIdInit() { - return { - loading: true, - }; -} - -/** - * Get referral id for the logged user - * if this member does not exist in growsurf it creates it in the system - * @param {Object} profile the member auth profile - * @param {String} token the auth token - */ -async function getReferralIdDone(profile, tokenV3) { - if (profile.email) { - const res = await fetch(`${PROXY_ENDPOINT}/growsurf/participants?participantId=${profile.email}`, { - method: 'POST', - body: JSON.stringify({ - email: profile.email, - firstName: profile.firstName, - lastName: profile.lastName, - tcHandle: profile.handle, - }), - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${tokenV3}`, - }, - }); - if (res.status >= 300) { - return { - error: true, - details: await res.json(), - }; - } - const data = await res.json(); - return { - data, - }; - } - // no referral id without email - return { - error: true, - details: 'No profile email found', - }; -} - -export default redux.createActions({ - GROWSURF: { - GET_REFERRALID_INIT: getReferralIdInit, - GET_REFERRALID_DONE: getReferralIdDone, - }, -}); diff --git a/src/shared/components/Gigs/GigDetails/index.jsx b/src/shared/components/Gigs/GigDetails/index.jsx index 282e82584..b7bbd2a15 100644 --- a/src/shared/components/Gigs/GigDetails/index.jsx +++ b/src/shared/components/Gigs/GigDetails/index.jsx @@ -8,16 +8,11 @@ import { isEmpty } from 'lodash'; import React, { useState } from 'react'; import PT from 'prop-types'; import { connect } from 'react-redux'; -import { isomorphy, Link, config } from 'topcoder-react-utils'; -import { PrimaryButton } from 'topcoder-react-ui-kit'; +import { Link, config } from 'topcoder-react-utils'; import ReactHtmlParser from 'react-html-parser'; import { getSalaryType, getCustomField } from 'utils/gigs'; import SubscribeMailChimpTag from 'containers/SubscribeMailChimpTag'; -import { isValidEmail } from 'utils/tc'; import './style.scss'; -import IconFacebook from 'assets/images/icon-facebook.svg'; -import IconTwitter from 'assets/images/icon-twitter.svg'; -import IconLinkedIn from 'assets/images/icon-linkedIn.svg'; import IconLocation from 'assets/images/icon-location.svg'; import IconMoney from 'assets/images/icon-payment.svg'; import IconDuration from 'assets/images/icon-calendar-gig.svg'; @@ -28,7 +23,6 @@ import iconLabel1 from 'assets/images/l1.png'; import iconLabel2 from 'assets/images/l2.png'; import iconLabel3 from 'assets/images/l3.png'; import SadFace from 'assets/images/sad-face-icon.svg'; -import ReferralModal from '../ReferralModal'; import LoginModal from '../LoginModal'; // Cleanup HTML from style tags @@ -44,28 +38,16 @@ const ReactHtmlParserOptions = { function GigDetails(props) { const { - job, application, profile, onSendClick, isReferrSucess, isReferrError, onReferralDone, growSurf, + job, application, profile, } = props; - let shareUrl; let retUrl; - if (isomorphy.isClientSide()) { - shareUrl = encodeURIComponent(window.location.href); - if (growSurf && growSurf.data) { - shareUrl = `${window.location.origin}${window.location.pathname}?referralId=${growSurf.data.id}`; - } - retUrl = `${window.location.origin}${window.location.pathname}/apply${window.location.search}`; - } let skills = getCustomField(job.custom_fields, 'Technologies Required'); if (skills !== 'n/a') skills = skills.split(',').join(', '); const hPerW = getCustomField(job.custom_fields, 'Hours per week'); const compens = job.min_annual_salary === job.max_annual_salary ? job.max_annual_salary : `${job.min_annual_salary} - ${job.max_annual_salary} (USD)`; - const [isModalOpen, setModalOpen] = useState(false); const [isLoginModalOpen, setLoginModalOpen] = useState(false); - const [copyBtnText, setCopyBtnText] = useState('COPY'); - const [referrEmail, setreferrEmail] = useState(); const duration = getCustomField(job.custom_fields, 'Duration'); - let refEmailInput; return (
@@ -157,83 +139,6 @@ function GigDetails(props) {
-
-
REFER THIS GIG
- { - growSurf && growSurf.data ? ( - - Share your Referral Link: - -
- { - const copyhelper = document.createElement('input'); - copyhelper.className = 'copyhelper'; - document.body.appendChild(copyhelper); - copyhelper.value = `https://www.topcoder.com/gigs/${job.slug}?referralId=${growSurf.data.id}`; - copyhelper.select(); - document.execCommand('copy'); - document.body.removeChild(copyhelper); - setCopyBtnText('COPIED'); - setTimeout(() => { - setCopyBtnText('COPY'); - }, 3000); - }} - > - {copyBtnText} - -
- Share on:   - - - - - - - - - -
-
-
- ) : ( -
- Share this job on:   - - - - - - - - - -
- ) - } -
-
- or -
-
-

Refer someone to this gig and earn $500. Just add their email below. See how it works.

-
- setreferrEmail(e.target.value)} ref={ref => refEmailInput = ref} /> - -
-
SUBSCRIBE TO WEEKLY GIG UPDATES
@@ -256,27 +161,6 @@ function GigDetails(props) {
If you have any questions or doubts, don’t hesitate to email gigwork@topcoder.com.
-
- { - isModalOpen - && ( - { - onReferralDone(); - setModalOpen(false); - }} - isReferrSucess={isReferrSucess} - isReferrError={isReferrError} - referralId={growSurf && growSurf.data ? growSurf.data.id : null} - onReferralDone={() => { - onReferralDone(true); - setModalOpen(false); - }} - /> - ) - } -
{ isLoginModalOpen && setLoginModalOpen(false)} /> } @@ -292,19 +176,12 @@ function GigDetails(props) { GigDetails.defaultProps = { application: null, profile: {}, - growSurf: {}, - isReferrError: null, }; GigDetails.propTypes = { job: PT.shape().isRequired, application: PT.shape(), profile: PT.shape(), - onSendClick: PT.func.isRequired, - isReferrSucess: PT.bool.isRequired, - isReferrError: PT.shape(), - onReferralDone: PT.func.isRequired, - growSurf: PT.shape(), }; function mapStateToProps(state) { diff --git a/src/shared/components/Gigs/GigDetails/style.scss b/src/shared/components/Gigs/GigDetails/style.scss index 63e6036d0..145ecf9e3 100644 --- a/src/shared/components/Gigs/GigDetails/style.scss +++ b/src/shared/components/Gigs/GigDetails/style.scss @@ -31,10 +31,6 @@ @include primaryBtn; } -.referral { - display: flex; -} - .container { max-width: $screen-lg; min-height: 50vh; diff --git a/src/shared/components/Gigs/ReferralCode/index.jsx b/src/shared/components/Gigs/ReferralCode/index.jsx deleted file mode 100644 index 1de0976d4..000000000 --- a/src/shared/components/Gigs/ReferralCode/index.jsx +++ /dev/null @@ -1,120 +0,0 @@ -/* eslint-disable max-len */ -/** - * Connects the Redux store to the GigsPages component. - */ -import React, { useState, useEffect } from 'react'; -import PT from 'prop-types'; -import _ from 'lodash'; -import { PrimaryButton } from 'topcoder-react-ui-kit'; -import LoadingIndicator from 'components/LoadingIndicator'; -import tc from 'components/buttons/themed/tc.scss'; -import ReferralModal from '../ReferralModal'; -import defautlStyle from './style.scss'; - -/** Themes for buttons - * those overwrite PrimaryButton style to match achieve various styles. - * Should implement pattern of classes. - */ -const buttonThemes = { - tc, -}; - -function ReferralCode(props) { - const { profile, growSurf } = props; - const [loginModalOpen, setLoginModalOpen] = useState(false); - const [growSurfState, setGrowSurfState] = useState(growSurf); - const [copyBtnText, setCopyBtnText] = useState('COPY'); - useEffect(() => { - setGrowSurfState(growSurf); - }, [growSurf]); - - return ( -
- { - _.isEmpty(profile) ? ( - Topcoder Referral Program: - ) : ( - Topcoder Referral Program: - ) - } - { - _.isEmpty(profile) ? ( - - Do you know someone who is perfect for a gig? You could earn $500 for referring them! - { - setLoginModalOpen(true); - }} - theme={{ - button: buttonThemes.tc['primary-borderless-sm'], - }} - > - REFER A FRIEND - - { - loginModalOpen - && ( - setLoginModalOpen(false)} - isReferrSucess={false} - isReferrError={false} - onReferralDone={() => { }} - /> - ) - } - - ) : ( - - Your referral link: - { - growSurfState.loading && - } - { - growSurfState.data && ( -
- {`https://www.topcoder.com/gigs?referralId=${growSurfState.data.id}`} - { - const copyhelper = document.createElement('input'); - copyhelper.className = 'copyhelper'; - document.body.appendChild(copyhelper); - copyhelper.value = `https://www.topcoder.com/gigs?referralId=${growSurfState.data.id}`; - copyhelper.select(); - document.execCommand('copy'); - document.body.removeChild(copyhelper); - setCopyBtnText('COPIED'); - setTimeout(() => { - setCopyBtnText('COPY'); - }, 3000); - }} - theme={{ - button: buttonThemes.tc['primary-borderless-xs'], - }} - > - {copyBtnText} - -
- ) - } - { - growSurfState.error && Oops, we couldn't load your profile. Please try again later or contact support. - } -
- ) - } -
- ); -} - -ReferralCode.defaultProps = { - profile: {}, - growSurf: {}, -}; - -ReferralCode.propTypes = { - profile: PT.shape(), - growSurf: PT.shape(), -}; - -export default ReferralCode; diff --git a/src/shared/components/Gigs/ReferralCode/style.scss b/src/shared/components/Gigs/ReferralCode/style.scss deleted file mode 100644 index 3c35b10fe..000000000 --- a/src/shared/components/Gigs/ReferralCode/style.scss +++ /dev/null @@ -1,107 +0,0 @@ -.container, -.containerWithLink { - display: flex; - background-image: linear-gradient(97.21deg, #2984bd 0%, #0ab88a 100%); - border-radius: 10px; - width: 100%; - max-width: 1280px; - margin: 30px auto 0; - align-items: center; - padding: 13px 25px 11px; - - @media screen and (max-width: 1280px) { - margin: 30px 15px 0; - width: auto; - } - - @media screen and (max-width: 768px) { - flex-direction: column; - align-items: flex-start; - } - - .title { - font-weight: bold; - color: #fff; - font-family: Roboto, sans-serif; - font-size: 18px; - margin-right: 5px; - - @media screen and (max-width: 768px) { - margin-bottom: 10px; - } - } - - span { - font-family: Roboto, sans-serif; - font-size: 18px; - color: #fff; - line-height: 22px; - margin-right: 5px; - } - - button { - margin-left: 10px !important; - - &:hover { - margin-left: 10px !important; - } - - @media screen and (max-width: 768px) { - margin: 10px 0 0 !important; - - &:hover { - margin: 10px 0 0 !important; - } - } - } - - .rondedArea { - border: 1px solid rgba(255, 255, 255, 0.4); - border-radius: 2px; - height: 35px; - display: flex; - align-items: center; - padding: 0 12px; - - @media screen and (max-width: 768px) { - max-width: 100%; - flex-direction: column; - align-items: flex-start; - position: relative; - width: 100%; - height: auto; - padding: 6px; - margin-bottom: 40px; - } - - span { - white-space: nowrap; - - @media screen and (max-width: 768px) { - max-width: 100%; - display: block; - overflow: auto; - margin-right: 0; - } - } - - button { - @media screen and (max-width: 768px) { - position: absolute; - bottom: -30px; - margin: 0 !important; - left: 0; - } - } - } -} - -.containerWithLink { - padding: 10px 25px 9px; - - svg { - width: 34px; - height: 34px; - margin: initial; - } -} diff --git a/src/shared/components/Gigs/ReferralModal/index.jsx b/src/shared/components/Gigs/ReferralModal/index.jsx deleted file mode 100644 index 82f4d3c99..000000000 --- a/src/shared/components/Gigs/ReferralModal/index.jsx +++ /dev/null @@ -1,137 +0,0 @@ -/* eslint-disable max-len */ -/** - * The modal used for gig referral flow - */ - -/* global window */ - -import { isEmpty } from 'lodash'; -import PT from 'prop-types'; -import React from 'react'; -import { Modal, PrimaryButton } from 'topcoder-react-ui-kit'; -import { config, Link } from 'topcoder-react-utils'; -import tc from 'components/buttons/themed/tc.scss'; -import LoadingIndicator from 'components/LoadingIndicator'; -import modalStyle from './modal.scss'; - -/** Themes for buttons - * those overwrite PrimaryButton style to match achieve various styles. - * Should implement pattern of classes. - */ -const buttonThemes = { - tc, -}; - -// help article link -const HELP_INFO_LINK = '/community/gig-referral'; - -function ReferralModal({ - profile, - onCloseButton, - isReferrSucess, - isReferrError, - referralId, - onReferralDone, -}) { - const retUrl = window.location.href; - return ( - - { !isEmpty(profile) ? ( -
- { - referralId && !isReferrError && !isReferrSucess && ( -
-

Sending your referral...

- -
- ) - } - { - isReferrSucess ? ( -
-

CONGRATULATIONS!

-

Your referral has been sent.

-
- - CLOSE - - FIND ANOTHER GIG -
-
- ) : null - } - { - isReferrError ? ( -
-

OOPS!

-

{isReferrError.message}

- { - isReferrError.userError ? ( -

If you think this is an error please contact support@topcoder.com.

- ) : ( -

Looks like there is a problem on our end. Please try again.
If this persists please contact support@topcoder.com.

- ) - } -
- - CLOSE - - FIND ANOTHER GIG -
-
- ) : null - } -
- ) : ( -
-

REFERRAL PROGRAM

-

Please login to receive your referral code.

-
- { - window.location = `${config.URL.AUTH}/member?retUrl=${encodeURIComponent(retUrl)}`; - }} - theme={{ - button: buttonThemes.tc['primary-green-md'], - }} - > - LOGIN - - REGISTER -
-

Find out how the referral program works here.

-
- )} -
- ); -} - -ReferralModal.defaultProps = { - profile: null, - referralId: null, - isReferrError: null, -}; - -ReferralModal.propTypes = { - profile: PT.shape(), - onCloseButton: PT.func.isRequired, - isReferrSucess: PT.bool.isRequired, - isReferrError: PT.shape(), - referralId: PT.string, - onReferralDone: PT.func.isRequired, -}; - -export default ReferralModal; diff --git a/src/shared/components/Gigs/ReferralModal/modal.scss b/src/shared/components/Gigs/ReferralModal/modal.scss deleted file mode 100644 index ec36a10e3..000000000 --- a/src/shared/components/Gigs/ReferralModal/modal.scss +++ /dev/null @@ -1,133 +0,0 @@ -/* stylelint-disable no-descending-specificity */ -@import "~styles/mixins"; -@import "~components/Contentful/default"; - -.container { - padding: 0; - width: auto; - max-width: 95vw; - height: auto; - max-height: 95vh; - border-radius: 10px; - display: flex; - flex-direction: column; - justify-content: center; - - @include gui-kit-headers; - @include gui-kit-content; - - .title { - color: #1e94a3; - font-family: BarlowCondensed, sans-serif; - font-size: 34px; - line-height: 38px; - font-weight: 500; - margin: 0; - margin-bottom: 20px; - } - - .loginMsg { - color: #2a2a2a; - font-size: 24px; - line-height: 36px; - margin-bottom: 40px; - } - - .ctaButtons { - display: flex; - align-content: center; - justify-content: center; - - & > button:first-child { - margin-right: 10px !important; - } - - & > a:first-child { - margin-right: 10px !important; - } - } - - .referrals { - display: flex; - overflow: auto; - - .sucessMsg { - font-size: 24px; - line-height: 36px; - margin-bottom: 40px; - } - - .rightAlign { - justify-content: flex-end; - } - - .referrForm { - display: flex; - flex-direction: column; - padding: 60px 84px 40px; - min-width: 618px; - - @include xs-to-sm { - padding: 20px; - width: 90vw; - min-width: auto; - } - - h3 { - margin-bottom: 12px; - text-align: center; - } - - .margin { - margin-top: 10px; - } - - :global { - textarea { - height: 250px; - } - } - - .ctaButtons { - justify-content: flex-end; - margin-top: 20px; - } - } - } - - .loginRequired, - .referrSucess { - display: flex; - flex-direction: column; - padding: 100px 80px; - text-align: center; - - @include xs-to-sm { - padding: 50px 40px; - } - - .loginMsg { - font-size: 20px; - } - - .regTxt { - font-size: 14px; - margin: 10px 0 0; - } - - .ctaButtons { - @include xs-to-sm { - flex-direction: column; - - > button { - margin: 0 0 20px !important; - } - } - } - } -} - -.overlay { - background-color: #2a2a2a; - opacity: 0.95; -} diff --git a/src/shared/containers/Gigs/RecruitCRMJobDetails.jsx b/src/shared/containers/Gigs/RecruitCRMJobDetails.jsx index 8ec55e9b0..130c84073 100644 --- a/src/shared/containers/Gigs/RecruitCRMJobDetails.jsx +++ b/src/shared/containers/Gigs/RecruitCRMJobDetails.jsx @@ -10,33 +10,9 @@ import GigDetails from 'components/Gigs/GigDetails'; import PT from 'prop-types'; import React from 'react'; import { connect } from 'react-redux'; -import { config } from 'topcoder-react-utils'; -import fetch from 'isomorphic-fetch'; import RecruitCRMJobApply from './RecruitCRMJobApply'; -const PROXY_ENDPOINT = `${config.URL.COMMUNITY_APP}/api`; - class RecruitCRMJobDetailsContainer extends React.Component { - constructor(props) { - super(props); - - this.state = { - isReferrSucess: false, - formErrors: {}, - formData: { - body: `Hey there! - -Topcoder has a freelance gig that I thought you would be interested in. If you get the gig, I could earn cash! - -Check it out: -${config.URL.BASE}${config.GIGS_PAGES_PATH}/${props.id}`, - }, - }; - - this.onSendClick = this.onSendClick.bind(this); - this.onReferralDone = this.onReferralDone.bind(this); - } - componentDidMount() { const { getJob, @@ -49,136 +25,6 @@ ${config.URL.BASE}${config.GIGS_PAGES_PATH}/${props.id}`, } } - /** - * Send gig referral invite - */ - async onSendClick(email) { - const { - profile, growSurf, tokenV3, - } = this.props; - const { formData } = this.state; - // should not be able to send emails to themselves - if (profile.email === email) { - this.setState({ - isReferrError: { - message: 'You are not allowed to send to yourself.', - userError: true, - }, - }); - // exit no email sending - return; - } - // check if email is already referred? - const growCheck = await fetch(`${PROXY_ENDPOINT}/growsurf/participant/${email}`); - if (growCheck.status === 200) { - const growCheckData = await growCheck.json(); - if (growCheckData.referrer) { - this.setState({ - isReferrError: { - message: `${email} has already been referred.`, - userError: true, - }, - }); - // exit no email sending - return; - } - } - // // email the invite - const res = await fetch(`${PROXY_ENDPOINT}/mailchimp/email`, { - method: 'POST', - body: JSON.stringify({ - personalizations: [ - { - to: [{ email }], - subject: `${profile.firstName} ${profile.lastName} Thinks This Topcoder Gig Is For You!`, - }, - ], - from: { email: 'noreply@topcoder.com', name: `${profile.firstName} ${profile.lastName} via Topcoder Gigwork` }, - content: [{ - type: 'text/plain', value: `${formData.body}?referralId=${growSurf.data.id}`, - }], - }), - headers: { - 'Content-Type': 'application/json', - }, - redirect: 'follow', - }); - if (res.status >= 300) { - this.setState({ - isReferrError: await res.json(), - }); - // exit no email tracking due to the error - return; - } - // process sent log - let { emailInvitesLog, emailInvitesStatus } = growSurf.data.metadata; - if (!emailInvitesLog) emailInvitesLog = ''; - // check if email is in sent log alredy? - const foundInLog = emailInvitesLog.indexOf(email); - // only when email is new - put it in log, update counters and etc. - if (foundInLog === -1) { - // parse the log to array of emails - if (emailInvitesLog.length) { - emailInvitesLog = emailInvitesLog.split(','); - } else emailInvitesLog = []; - // prepare growSurf update payload - // we keep only 10 emails in the log to justify program rules - if (emailInvitesLog.length < 10) { - emailInvitesLog.push(email); - } - // Auto change status when 10 emails sent - if (emailInvitesLog.length === 10 && emailInvitesStatus !== 'Paid' && emailInvitesStatus !== 'Payment Pending') { - emailInvitesStatus = 'Payment Pending'; - } - // put the tracking update in growsurf - const updateRed = await fetch(`${PROXY_ENDPOINT}/growsurf/participant/${growSurf.data.id}`, { - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${tokenV3}`, - }, - body: JSON.stringify({ - ...growSurf.data, - metadata: { - ...growSurf.data.metadata, - emailInvitesSent: Number(growSurf.data.metadata.emailInvitesSent || 0) + 1, - emailInvitesLog: emailInvitesLog.join(), - emailInvitesStatus, - }, - }), - }); - if (updateRed.status >= 300) { - this.setState({ - isReferrError: await updateRed.json(), - }); - // exit no email tracking due to the error - // just notify the user about it - return; - } - } - // finally do: - this.setState({ - isReferrSucess: true, - }); - } - - /** - * Reset the form when referral done - */ - onReferralDone(refresh = false) { - if (refresh) { - window.location.reload(false); - return; - } - const { formData } = this.state; - delete formData.email; - this.setState({ - isReferrSucess: false, - isReferrError: false, - formData, - }); - } - render() { const { loading, @@ -186,15 +32,7 @@ ${config.URL.BASE}${config.GIGS_PAGES_PATH}/${props.id}`, isApply, application, profile, - growSurf, } = this.props; - const { - formErrors, - formData, - isReferrSucess, - isReferrError, - // referralId, - } = this.state; if (loading) { return ; @@ -207,13 +45,6 @@ ${config.URL.BASE}${config.GIGS_PAGES_PATH}/${props.id}`, job={job} application={application} profile={profile} - onSendClick={this.onSendClick} - isReferrSucess={isReferrSucess} - formErrors={formErrors} - formData={formData} - isReferrError={isReferrError} - onReferralDone={this.onReferralDone} - growSurf={growSurf} /> ); } @@ -223,8 +54,6 @@ RecruitCRMJobDetailsContainer.defaultProps = { job: {}, application: null, profile: {}, - growSurf: {}, - tokenV3: null, }; RecruitCRMJobDetailsContainer.propTypes = { @@ -235,21 +64,16 @@ RecruitCRMJobDetailsContainer.propTypes = { isApply: PT.bool.isRequired, application: PT.shape(), profile: PT.shape(), - growSurf: PT.shape(), - tokenV3: PT.string, }; function mapStateToProps(state, ownProps) { const data = state.recruitCRM[ownProps.id]; const profile = state.auth && state.auth.profile ? { ...state.auth.profile } : {}; - const { growSurf } = state; return { job: data ? data.job : {}, loading: data ? data.loading : true, application: data ? data.application : null, profile, - growSurf, - tokenV3: state.auth ? state.auth.tokenV3 : null, }; } diff --git a/src/shared/containers/GigsPages/index.jsx b/src/shared/containers/GigsPages/index.jsx index 757d3167e..91a1081fa 100644 --- a/src/shared/containers/GigsPages/index.jsx +++ b/src/shared/containers/GigsPages/index.jsx @@ -5,7 +5,6 @@ import React from 'react'; import PT from 'prop-types'; import Header from 'containers/TopcoderHeader'; import Footer from 'components/TopcoderFooter'; -import Viewport from 'components/Contentful/Viewport'; import { config, isomorphy } from 'topcoder-react-utils'; import RecruitCRMJobDetails from 'containers/Gigs/RecruitCRMJobDetails'; import { Helmet } from 'react-helmet'; @@ -15,9 +14,7 @@ import { connect } from 'react-redux'; import _ from 'lodash'; import { v4 as uuidv4 } from 'uuid'; import { getQuery } from 'utils/url'; -import ReferralCode from 'components/Gigs/ReferralCode'; import ChallengeTab from 'components/challenge-listing/ChallengeTab'; -import actions from 'actions/growSurf'; import './style.scss'; @@ -32,9 +29,6 @@ function GigsPagesContainer(props) { const { match, profile, - growSurf, - getReferralId, - tokenV3, history, location, } = props; @@ -46,12 +40,6 @@ function GigsPagesContainer(props) { optProfile.attributes.TC_Handle = profile.handle; optProfile.attributes.HomeCountryCode = profile.homeCountryCode; optProfile.attributes.email = profile.email; - // trigger referral id fetching when profile is loaded - if (isomorphy.isClientSide()) { - if (_.isEmpty(growSurf) || (!growSurf.loading && !growSurf.data && !growSurf.error)) { - getReferralId(profile, tokenV3); - } - } } else if (isomorphy.isClientSide()) { const idCookie = cookies.get('_tc.aid'); if (idCookie) { @@ -76,7 +64,7 @@ function GigsPagesContainer(props) { }), config.GROWSURF_COOKIE_SETTINGS); } } - const { id, type } = match.params; + const { id } = match.params; const isApply = `${config.GIGS_PAGES_PATH}/${id}/apply` === match.url; const title = 'Find Freelance Work | Gigs | Topcoder'; const description = 'Compete and build up your profiles and skills! Topcoder members become eligible to work on Gig Work projects by first proving themselves in various skill sets through Topcoder competitions.'; @@ -112,17 +100,6 @@ window._chatlio = window._chatlio||[]; /> ) : null } - { - !id && !type ? ( - - - - - ) : null - }
); @@ -141,8 +118,6 @@ window._chatlio = window._chatlio||[]; GigsPagesContainer.defaultProps = { profile: null, - growSurf: null, - tokenV3: null, }; GigsPagesContainer.propTypes = { @@ -153,32 +128,15 @@ GigsPagesContainer.propTypes = { history: PT.shape().isRequired, match: PT.shape().isRequired, profile: PT.shape(), - growSurf: PT.shape(), - getReferralId: PT.func.isRequired, - tokenV3: PT.string, }; function mapStateToProps(state) { const profile = state.auth && state.auth.profile ? { ...state.auth.profile } : {}; - const { growSurf } = state; return { profile, - growSurf, - tokenV3: state.auth ? state.auth.tokenV3 : null, - }; -} - -function mapDispatchToActions(dispatch) { - const a = actions.growsurf; - return { - getReferralId: (profile, tokenV3) => { - dispatch(a.getReferralidInit()); - dispatch(a.getReferralidDone(profile, tokenV3)); - }, }; } export default connect( mapStateToProps, - mapDispatchToActions, )(GigsPagesContainer); diff --git a/src/shared/reducers/growSurf.js b/src/shared/reducers/growSurf.js deleted file mode 100644 index 9ee65bb74..000000000 --- a/src/shared/reducers/growSurf.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Reducer for state.growSurf - */ -import _ from 'lodash'; -import actions from 'actions/growSurf'; -import { handleActions } from 'redux-actions'; - -/** - * Handles getReferralIdInit action. - * @param {Object} state Previous state. - */ -function onInit(state, { payload }) { - return { - ...state, - ...payload, - }; -} - -/** - * Handles getReferralIdDone action. - * @param {Object} state Previous state. - * @param {Object} action The action. - */ -function onDone(state, { payload }) { - return { - ...state, - loading: false, - data: payload.data, - error: payload.error || false, - }; -} - -/** - * Creates mmleaderboard reducer with the specified initial state. - * @param {Object} state Optional. If not given, the default one is - * generated automatically. - * @return {Function} Reducer. - */ -function create(state = {}) { - return handleActions({ - [actions.growsurf.getReferralidInit]: onInit, - [actions.growsurf.getReferralidDone]: onDone, - }, _.defaults(state, { - loading: false, - })); -} - -/* Reducer with the default initial state. */ -export default create(); diff --git a/src/shared/reducers/index.js b/src/shared/reducers/index.js index a3172cc2a..f5e978206 100644 --- a/src/shared/reducers/index.js +++ b/src/shared/reducers/index.js @@ -43,7 +43,6 @@ import tcoLeaderboards from './tco/leaderboards'; import recruitCRM from './recruitCRM'; import gSheet from './gSheet'; import timelineWall from './timelineWall'; -import growSurf from './growSurf'; import thrive from './contentful/thrive'; import dashboard from './dashboard'; import blog from './blog'; @@ -181,7 +180,6 @@ export function factory(req) { recruitCRM, mmLeaderboard, gSheet, - growSurf, thrive, tcoLeaderboards, dashboard,