Skip to content
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

Mask params in navigation bar for external apps #5050

Merged
merged 1 commit into from
Sep 25, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ describe('ExternalAppIFrame view ', () => {
const userService = new UserService(mockUserServer, logService, new AlertMessageService());
const menuService = new MenuService(configService, userService, logService);
globalStyleService = new GlobalStyleService(new UserPreferencesService(), configService, menuService);

// Mock method not supported in test context
history.replaceState = () => {};
});

// menu1/entry1 ==> https://test/ ==> https://test/?opfab_theme=DAY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import {ConfigService} from 'app/business/services/config.service';
import {GlobalStyleService} from 'app/business/services/global-style.service';
import {RouterStore} from 'app/business/store/router.store';
import {Observable, ReplaySubject, skip, Subject, takeUntil} from 'rxjs';
import {environment} from '@env/environment';

export class ExternalAppIFrameView {
urlSubject: Subject<string> = new ReplaySubject<string>(1);
unsubscribe$: Subject<void> = new Subject<void>();
private businessConfigUrl = `${environment.url}/#businessconfigparty`;

constructor(
private configService: ConfigService,
Expand Down Expand Up @@ -64,9 +66,15 @@ export class ExternalAppIFrameView {
url = this.addParamsToUrl(url, deeplinkParams);
url = this.addOpfabThemeParamToUrl(url);
this.urlSubject.next(url);
this.removeParamsFromCurrentURLInBrowserNavigationBar(menuId,menuEntryId);
});
}


private removeParamsFromCurrentURLInBrowserNavigationBar(menuId:string,menuEntryId:string) {
history.replaceState({},'',this.businessConfigUrl + "/" + menuId + "/" + menuEntryId + "/" );
}

private addParamsToUrl(url, params) {
let newUrl = url;
if (params) {
Expand Down