Skip to content

Commit d9957dc

Browse files
author
vikasrohit
authored
Merge pull request #1109 from appirio-tech/feature/refcode-from-query-param
Github issue#1102, Process/add ref code from deep link
2 parents c19210d + e741586 commit d9957dc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/projects/create/components/ProjectWizard.jsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import SelectProduct from './SelectProduct'
88
import IncompleteProjectConfirmation from './IncompleteProjectConfirmation'
99
import FillProjectDetails from './FillProjectDetails'
1010
import update from 'react-addons-update'
11-
import { LS_INCOMPLETE_PROJECT } from '../../../config/constants'
11+
import { LS_INCOMPLETE_PROJECT, PROJECT_REF_CODE_MAX_LENGTH } from '../../../config/constants'
1212
import './ProjectWizard.scss'
1313

1414
const WZ_STEP_INCOMP_PROJ_CONF = 0
@@ -65,14 +65,15 @@ class ProjectWizard extends Component {
6565
wizardStep = WZ_STEP_FILL_PROJ_DETAILS
6666
}
6767
}
68-
// retrieve refcode from query param
69-
const refcode = _.get(location, 'query.refcode')
70-
if (refcode) {
71-
// if refcode exists, update the updateQuery to set that refcode
68+
// retrieve refCode from query param
69+
// TODO give warning after truncating
70+
const refCode = _.get(location, 'query.refCode', '').trim().substr(0, PROJECT_REF_CODE_MAX_LENGTH)
71+
if (refCode.trim().length > 0) {
72+
// if refCode exists, update the updateQuery to set that refCode
7273
if (_.get(updateQuery, 'details')) {
73-
updateQuery['details']['utm'] = { $set : { code : refcode }}
74+
updateQuery['details']['utm'] = { $set : { code : refCode }}
7475
} else {
75-
updateQuery['details'] = { utm : { $set : { code : refcode }}}
76+
updateQuery['details'] = { utm : { $set : { code : refCode }}}
7677
}
7778
}
7879
this.setState({

0 commit comments

Comments
 (0)