From bc016b88c47c6b81d8fba347cede7c9196380451 Mon Sep 17 00:00:00 2001 From: Rakib Ansary Date: Thu, 17 Feb 2022 09:59:02 +0600 Subject: [PATCH] feat: redirect to return all after onboarding is completed --- .circleci/config.yml | 1 + .../auth0/dev-tenant/rules/onboardingChecklist.js | 6 +++--- web-assets/js/setupAuth0WithRedirect.js | 10 ++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f1e812a..3f8a712 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -71,6 +71,7 @@ workflows: only: - dev - hotfix/resendActivationEmail + - feat/plat-320 # Production builds are exectuted only on tagged commits to the # master branch. diff --git a/web-assets/auth0/dev-tenant/rules/onboardingChecklist.js b/web-assets/auth0/dev-tenant/rules/onboardingChecklist.js index aeaa92c..f630b35 100644 --- a/web-assets/auth0/dev-tenant/rules/onboardingChecklist.js +++ b/web-assets/auth0/dev-tenant/rules/onboardingChecklist.js @@ -115,13 +115,13 @@ function (user, context, callback) { for (let checklistTrait of onboardingChecklistTrait.data) { if (checklistTrait.onboarding_wizard != null) { - if ( /* checklistTrait.onboarding_wizard.status != null || */ // any valid status indicates user has already seen onboarding wizard and needn't be shown again. + if ( checklistTrait.onboarding_wizard.status !== 'pending_at_user' || // any non pending_at_user status indicates OB was either seen or completed and can be skipped checklistTrait.onboarding_wizard.skip ||// for certain signup routes skip is set to true, and thus onboarding wizard needn't be shown checklistTrait.onboarding_wizard.override === 'skip') { return callback(null, user, context); - } else if (checklistTrait.onboarding_wizard.override === 'retUrl') { - override = 'retUrl'; + } else if (checklistTrait.onboarding_wizard.override === 'useRetUrl') { + override = 'useRetUrl'; } } } diff --git a/web-assets/js/setupAuth0WithRedirect.js b/web-assets/js/setupAuth0WithRedirect.js index ed2d974..59c4689 100644 --- a/web-assets/js/setupAuth0WithRedirect.js +++ b/web-assets/js/setupAuth0WithRedirect.js @@ -47,6 +47,9 @@ const authSetup = function () { let returnAppUrl = handleSpecificReturnUrl(qs['retUrl'], 'retUrl'); let appUrl = qs['appUrl'] || false; + console.log('returnAppUrl', returnAppUrl); + console.log('appUrl', appUrl); + if (utmSource && (utmSource != 'undefined') && (enterpriseCustomers.indexOf(utmSource) > -1)) { @@ -272,7 +275,7 @@ const authSetup = function () { Object.keys(claims).forEach(key => { logger('Checking key', key); if (key.indexOf('onboarding_wizard') !== -1) { - if (claims[key] === 'show' || claims[key] === 'override') { + if (claims[key] === 'show' || claims[key] === 'useRetUrl') { showOnboardingWizard = claims[key]; } } @@ -315,9 +318,8 @@ const authSetup = function () { if (showOnboardingWizard) { logger('Take user to onboarding wizard', showOnboardingWizard); - if (showOnboardingWizard === 'retUrl') { - logger('Need to persist appUrl', returnAppUrl) - setCookie('returnAfterOnboard', returnAppUrl) // TODO: use localStorage instead? + if (showOnboardingWizard === 'useRetUrl') { + setCookie('returnAfterOnboard', qs['appUrl'] || qs['retUrl']) } redirectToOnboardingWizard(returnAppUrl); }