Skip to content

feat: skip onboarding for users signing up from challenges page #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@ module.exports = {
MEMBERS_API_URL: process.env.MEMBERS_API_URL || 'https://api.topcoder-dev.com/v5/members',

// List of registration sources that can skip the onboarding wizard
SKIP_ONBOARDING_REG_SOURCES: process.env.SKIP_ONBOARDING_REG_SOURCES || ['taasApp', 'gigs', 'selfService']
SKIP_ONBOARDING_REG_SOURCES: process.env.SKIP_ONBOARDING_REG_SOURCES || ['taasApp', 'gigs', 'selfService'],
// List of registration sources that should carry over original registration url (retUrl); users registering
// through these sources will be taken to retUrl at the end of the onboarding process
FORWARD_TO_RET_URL_REG_SOURCES: process.env.FORWARD_TO_RET_URL_REG_SOURCES || ['challenges']
}
16 changes: 9 additions & 7 deletions src/common/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,16 @@ async function getOnboardingChecklist (handle, token) {
}

/**
* update trait onboarding_checklist to indicate to consumers that showing the user
* identified by handle is not required
* update trait onboarding_checklist to indicate to consumers if onboarding wizard
* can be skipped or if onboarding wizard should take the user to the original url
* the user signed up from
*
* @param {string} handle the handle of the member
* @param {string} message the skip reason
* @param {string} type skip to skip the onboarding wizard; forward to use retUrl
* @param {string} message the skip/carry forward reason
* @returns {promise}
*/
async function addSkipOnboardingInOnboardingChecklist (handle, message) {
async function addOverrideOnboardingChecklist (handle, type, message) {
const token = await getM2MToken()

const existingOnboardingCheckilst = await getOnboardingChecklist(handle, token)
Expand All @@ -152,10 +154,10 @@ async function addSkipOnboardingInOnboardingChecklist (handle, message) {
const onboardingWizardIndex = _.findIndex(existingOnboardingCheckilst, data => data['onboarding_wizard'] != null)
const onboardingWizardData = {
onboarding_wizard: {
skip: true,
override: type,
date: new Date().getTime(),
metadata: {
skipReason: message
overrideReason: message
},
status: 'pending_at_user'
}
Expand Down Expand Up @@ -208,5 +210,5 @@ module.exports = {
createTable,
deleteTable,
updateRecord,
addSkipOnboardingInOnboardingChecklist
addOverrideOnboardingChecklist
}
8 changes: 6 additions & 2 deletions src/services/ProcessorService.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ async function processCreateUser (message, producer) {
logger.info(`Registration source for member with handle ${message.payload.handle} is ${regSource}.`)
if (_.find(config.SKIP_ONBOARDING_REG_SOURCES, source => source === regSource) != null) {
logger.info(`Registration source is part of sources that can skip onboarding.`)
helper.addSkipOnboardingInOnboardingChecklist(message.payload.handle, `Registration source[${regSource}] doesn't require onboarding.`)
} else {
helper.addOverrideOnboardingChecklist(message.payload.handle, 'skip', `Registration source[${regSource}] doesn't require onboarding.`)
} else if (_.find(config.FORWARD_TO_RET_URL_REG_SOURCES, source => source === regSource) != null) {
logger.info(`Registration source is part of sources that require taking user to original registration url (retUrl).`)
helper.addOverrideOnboardingChecklist(message.payload.handle, 'useRetUrl', `Registration source[${regSource}] requires taking user to original registration url at the end of onboarding flow.`)
}
else {
logger.info(`Registration source requires member to be presented with the onboarding wizard.`)
}
}
Expand Down