Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
bistaastha committed Jan 20, 2025
1 parent 536a9d6 commit c90c61b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/app/auth/switch-org/switch-org.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,17 @@ export class SwitchOrgPage implements OnInit, AfterViewChecked {
navigateToDashboard(openOptInDialog?: boolean): void {
forkJoin([this.orgSettingsService.get(), this.spenderOnboardingService.getOnboardingStatus()]).subscribe(
([orgSettings, onboardingStatus]) => {
if (
/**
* Org orgp5onHZThs requires additional steps before enrolling cards, hence they are skipped for onboarding
*/
const shouldProceedToOnboarding =
orgSettings.org_id !== 'orgp5onHZThs' &&
orgSettings.corporate_credit_card_settings.enabled &&
(orgSettings.visa_enrollment_settings.enabled ||
orgSettings.mastercard_enrollment_settings.enabled ||
orgSettings.amex_feed_enrollment_settings.enabled) &&
onboardingStatus.state !== OnboardingState.COMPLETED
) {
onboardingStatus.state !== OnboardingState.COMPLETED;
if (shouldProceedToOnboarding) {
this.router.navigate(['/', 'enterprise', 'spender_onboarding']);
} else {
this.router.navigate([
Expand Down
3 changes: 2 additions & 1 deletion src/app/fyle/spender-onboarding/spender-onboarding.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ export class SpenderOnboardingPage {
) {}

navigateToDashboard(orgSettings: OrgSettings, onboardingStatus: OnboardingStatus): void {
const restrictedOrg = orgSettings.org_id === 'orgp5onHZThs';
const hasEnabledCards =
orgSettings.corporate_credit_card_settings.enabled &&
(orgSettings.visa_enrollment_settings.enabled ||
orgSettings.mastercard_enrollment_settings.enabled ||
orgSettings.amex_feed_enrollment_settings.enabled);
const shouldShowOnboarding = hasEnabledCards && onboardingStatus.state !== OnboardingState.COMPLETED;
if (!shouldShowOnboarding) {
if (!shouldShowOnboarding || restrictedOrg) {
this.router.navigate(['/', 'enterprise', 'my_dashboard']);
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/app/post-verification/invited-user/invited-user.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ export class InvitedUserPage implements OnInit {
navigateToDashboard(): void {
forkJoin([this.orgSettingsService.get(), this.spenderOnboardingService.getOnboardingStatus()]).subscribe(
([orgSettings, onboardingStatus]) => {
/**
* Org orgp5onHZThs requires additional steps before enrolling cards, hence they are skipped for onboarding
*/
const shouldProceedToOnboarding =
orgSettings.org_id !== 'orgp5onHZThs' &&
orgSettings.corporate_credit_card_settings.enabled &&
(orgSettings.visa_enrollment_settings.enabled ||
orgSettings.mastercard_enrollment_settings.enabled ||
Expand Down

0 comments on commit c90c61b

Please sign in to comment.