Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit c75494d

Browse files
committed
fix: check to decide if to show onboarding wizard
1 parent ebccd02 commit c75494d

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/utils/index.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import _ from 'lodash';
1+
import _ from "lodash";
22
import moment from "moment";
33
import config from "../../config";
44

@@ -57,21 +57,29 @@ export const businessLogin = () => {
5757
*/
5858
export function checkOnboarding(resp) {
5959
if (resp?.data.length === 0) {
60-
// return "/onboard/";
61-
return false;
60+
return "/onboard/";
6261
}
6362

6463
const onboardingChecklistTrait = resp?.data.filter(
6564
(item) => item.traitId === "onboarding_checklist"
6665
)[0].traits;
6766

68-
// // Check if onboarding flow needs to be skipped
69-
// if (
70-
// onboardingChecklistTrait.data[0].skip_onboarding &&
71-
// onboardingChecklistTrait.data[0].skip_onboarding.value === true
72-
// ) {
73-
// return false;
74-
// }
67+
// Check if onboarding flow needs to be skipped
68+
// 1. if the trait onboarding_wizard has a valid value for status.
69+
// possible values of status are [seeen, completed]. Since we only want to show
70+
// the onboarding wizard to users who haven't at least once seen the wizard
71+
// it is sufficient to check for a non null value.
72+
// 2. if the trait onboarding_wizard has a truthy value for skip.
73+
74+
for (let checklistTrait of onboardingChecklistTrait.data) {
75+
if (
76+
checklistTrait.onboarding_wizard != null &&
77+
(checklistTrait.onboarding_wizard.status != null ||
78+
checklistTrait.onboarding_wizard.skip)
79+
) {
80+
return false;
81+
}
82+
}
7583

7684
const profileCompletedData =
7785
onboardingChecklistTrait.data[0].profile_completed;

0 commit comments

Comments
 (0)