Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
bistaastha committed Jan 2, 2025
1 parent 755e0e4 commit 1167cc1
Show file tree
Hide file tree
Showing 13 changed files with 445 additions and 274 deletions.
2 changes: 1 addition & 1 deletion src/app/auth/sign-in/sign-in.page.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ion-content class="sign-in" class="no-keyboard-adjust">
<ion-content class="sign-in no-keyboard-adjust">
<div class="sign-in__select-sign-in" *ngIf="currentStep === signInPageState.SELECT_SIGN_IN_METHOD">
<div class="sign-in__video-container">
<video
Expand Down
40 changes: 29 additions & 11 deletions src/app/auth/switch-org/switch-org.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ import { TransactionService } from 'src/app/core/services/transaction.service';
import { DeepLinkService } from 'src/app/core/services/deep-link.service';
import { ExpensesService } from 'src/app/core/services/platform/v1/spender/expenses.service';
import { LaunchDarklyService } from 'src/app/core/services/launch-darkly.service';
import { OrgSettings } from 'src/app/core/models/org-settings.model';

Check failure on line 34 in src/app/auth/switch-org/switch-org.page.ts

View workflow job for this annotation

GitHub Actions / Run linters

'OrgSettings' is defined but never used

Check failure on line 34 in src/app/auth/switch-org/switch-org.page.ts

View workflow job for this annotation

GitHub Actions / Run linters

'OrgSettings' is defined but never used
import { OrgSettingsService } from 'src/app/core/services/org-settings.service';
import { SpenderOnboardingService } from 'src/app/core/services/spender-onboarding.service';
import { OnboardingState } from 'src/app/core/models/onboarding-state.enum';

@Component({
selector: 'app-switch-org',
Expand Down Expand Up @@ -86,7 +90,9 @@ export class SwitchOrgPage implements OnInit, AfterViewChecked {
private transactionService: TransactionService,
private deepLinkService: DeepLinkService,
private expensesService: ExpensesService,
private launchDarklyService: LaunchDarklyService
private launchDarklyService: LaunchDarklyService,
private orgSettingsService: OrgSettingsService,
private spenderOnboardingService: SpenderOnboardingService
) {}

ngOnInit(): void {
Expand Down Expand Up @@ -208,14 +214,7 @@ export class SwitchOrgPage implements OnInit, AfterViewChecked {
)
.subscribe({
next: () => {
this.router.navigate([
'/',
'enterprise',
'my_dashboard',
{
openSMSOptInDialog: true,
},
]);
this.navigateToDashboard(true);
},
error: () => this.router.navigate(['/', 'auth', 'switch_org']),
});
Expand Down Expand Up @@ -319,13 +318,32 @@ export class SwitchOrgPage implements OnInit, AfterViewChecked {
}
}

navigateToDashboard(openOptInDialog?: boolean): void {
forkJoin([this.orgSettingsService.get(), this.spenderOnboardingService.getOnboardingStatus()]).subscribe(
([orgSettings, onboardingStatus]) => {

Check failure on line 323 in src/app/auth/switch-org/switch-org.page.ts

View workflow job for this annotation

GitHub Actions / Run linters

'orgSettings' is defined but never used

Check failure on line 323 in src/app/auth/switch-org/switch-org.page.ts

View workflow job for this annotation

GitHub Actions / Run linters

'orgSettings' is defined but never used
if (onboardingStatus.state !== OnboardingState.COMPLETED) {
this.router.navigate(['/', 'enterprise', 'spender_onboarding']);
} else {
this.router.navigate([
'/',
'enterprise',
'my_dashboard',
{
openSMSOptInDialog: openOptInDialog,
},
]);
}
}
);
}

// Mark the user active in the selected org and redirect them to the dashboard.
markUserActive(): Observable<ExtendedOrgUser> {
return from(this.loaderService.showLoader()).pipe(
switchMap(() => this.orgUserService.markActive()),
finalize(() => {
this.loaderService.hideLoader();
this.router.navigate(['/', 'enterprise', 'my_dashboard']);
this.navigateToDashboard();
})
);
}
Expand Down Expand Up @@ -370,7 +388,7 @@ export class SwitchOrgPage implements OnInit, AfterViewChecked {
if (config.isPendingDetails) {
return this.handlePendingDetails(config.roles, config?.isFromInviteLink);
} else if (config.eou.ou.status === 'ACTIVE') {
this.router.navigate(['/', 'enterprise', 'my_dashboard']);
this.navigateToDashboard();
} else if (config.eou.ou.status === 'DISABLED') {
this.router.navigate(['/', 'auth', 'disabled']);
}
Expand Down
Loading

0 comments on commit 1167cc1

Please sign in to comment.