From ba65bd2655e4a5778fad98a0773da1d8c82381ba Mon Sep 17 00:00:00 2001 From: "kim.tran" Date: Wed, 28 Aug 2024 13:05:56 +0200 Subject: [PATCH 1/2] fix: improved urlChangeListenerInitializer --- src/app/app.module.ts | 44 +++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3813dd3..3fb1846 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -54,27 +54,27 @@ import { EventsPublisher, EventsTopic } from '@onecx/integration-interface'; export function createTranslateLoader( http: HttpClient, - translationCacheService: TranslationCacheService + translationCacheService: TranslationCacheService, ) { return new TranslateCombinedLoader( new CachingTranslateLoader( translationCacheService, http, `./assets/i18n/`, - '.json' + '.json', ), new CachingTranslateLoader( translationCacheService, http, `./onecx-portal-lib/assets/i18n/`, - '.json' - ) + '.json', + ), ); } function publishCurrentWorkspace( appStateService: AppStateService, - loadWorkspaceConfigResponse: LoadWorkspaceConfigResponse + loadWorkspaceConfigResponse: LoadWorkspaceConfigResponse, ) { return appStateService.currentWorkspace$.publish({ baseUrl: loadWorkspaceConfigResponse.workspace.baseUrl, @@ -83,7 +83,7 @@ function publishCurrentWorkspace( routes: loadWorkspaceConfigResponse.routes, homePage: loadWorkspaceConfigResponse.workspace.homePage, microfrontendRegistrations: [], - displayName: loadWorkspaceConfigResponse.workspace.displayName + displayName: loadWorkspaceConfigResponse.workspace.displayName, }); } @@ -93,7 +93,7 @@ export function workspaceConfigInitializer( themeService: ThemeService, appStateService: AppStateService, remoteComponentsService: RemoteComponentsService, - router: Router + router: Router, ) { return async () => { await appStateService.isAuthenticated$.isInitialized; @@ -106,13 +106,13 @@ export function workspaceConfigInitializer( retry({ delay: 500, count: 3 }), catchError((error) => { return initializationErrorHandler(error, router); - }) - ) + }), + ), ); if (loadWorkspaceConfigResponse) { const parsedProperties = JSON.parse( - loadWorkspaceConfigResponse.theme.properties + loadWorkspaceConfigResponse.theme.properties, ) as Record>; const themeWithParsedProperties = { ...loadWorkspaceConfigResponse.theme, @@ -138,7 +138,7 @@ export function userProfileInitializer( userProfileBffService: UserProfileBffService, userService: UserService, appStateService: AppStateService, - router: Router + router: Router, ) { return async () => { await appStateService.isAuthenticated$.isInitialized; @@ -147,14 +147,14 @@ export function userProfileInitializer( retry({ delay: 500, count: 3 }), catchError((error) => { return initializationErrorHandler(error, router); - }) - ) + }), + ), ); if (getUserProfileResponse) { console.log( 'ORGANIZATION : ', - getUserProfileResponse.userProfile.organization + getUserProfileResponse.userProfile.organization, ); await userService.profile$.publish(getUserProfileResponse.userProfile); @@ -167,13 +167,13 @@ export function slotInitializer(slotService: SlotService) { } export function permissionProxyInitializer( - permissionProxyService: PermissionProxyService + permissionProxyService: PermissionProxyService, ) { return () => permissionProxyService.init(); } export function configurationServiceInitializer( - configurationService: ConfigurationService + configurationService: ConfigurationService, ) { return () => configurationService.init(); } @@ -201,21 +201,25 @@ window.history.replaceState = (data: any, unused: string, url?: string) => { export function urlChangeListenerInitializer( router: Router, - appStateService: AppStateService + appStateService: AppStateService, ) { return async () => { await appStateService.isAuthenticated$.isInitialized; let lastUrl = ''; + let lastHash = ''; let isFirstRoute = true; const observer = new EventsTopic(); observer.pipe(filter((e) => e.type === 'navigated')).subscribe(() => { const routerUrl = `${location.pathname.substring( - getLocation().deploymentPath.length + getLocation().deploymentPath.length, )}${location.search}`; - if (routerUrl !== lastUrl) { + if (routerUrl !== lastUrl || location.hash !== lastHash) { lastUrl = routerUrl; + lastHash = location.hash; if (!isFirstRoute) { - router.navigateByUrl(routerUrl); + router.navigate([routerUrl], { + fragment: location.hash.substring(1), + }); } else { isFirstRoute = false; } From a4858277edcb083900390654b6b36eeac84db24b Mon Sep 17 00:00:00 2001 From: "kim.tran" Date: Wed, 28 Aug 2024 13:13:31 +0200 Subject: [PATCH 2/2] fix: update onecx libs --- package-lock.json | 99 ++++++++++++++++++++++++++--------------------- package.json | 22 +++++------ 2 files changed, 66 insertions(+), 55 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32a846d..19975ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,17 +22,17 @@ "@angular/router": "^18.2.1", "@ngx-translate/core": "^15.0.0", "@nx/angular": "19.6.3", - "@onecx/accelerator": "^5.9.0", - "@onecx/angular-accelerator": "^5.9.0", - "@onecx/angular-auth": "^5.9.0", - "@onecx/angular-integration-interface": "^5.9.0", - "@onecx/angular-remote-components": "^5.9.0", - "@onecx/angular-webcomponents": "^5.9.0", - "@onecx/integration-interface": "^5.9.0", - "@onecx/keycloak-auth": "^5.9.0", - "@onecx/portal-integration-angular": "^5.9.0", - "@onecx/portal-layout-styles": "^5.9.0", - "@onecx/shell-core": "^5.9.0", + "@onecx/accelerator": "^5.9.2", + "@onecx/angular-accelerator": "^5.9.2", + "@onecx/angular-auth": "^5.9.2", + "@onecx/angular-integration-interface": "^5.9.2", + "@onecx/angular-remote-components": "^5.9.2", + "@onecx/angular-webcomponents": "^5.9.2", + "@onecx/integration-interface": "^5.9.2", + "@onecx/keycloak-auth": "^5.9.2", + "@onecx/portal-integration-angular": "^5.9.2", + "@onecx/portal-layout-styles": "^5.9.2", + "@onecx/shell-core": "^5.9.2", "@openapitools/openapi-generator-cli": "^2.13.5", "keycloak-angular": "^16.0.1", "keycloak-js": "^25.0.4", @@ -6944,18 +6944,20 @@ } }, "node_modules/@onecx/accelerator": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/accelerator/-/accelerator-5.9.0.tgz", - "integrity": "sha512-LNN323H0YK7I/MQQfh6p/XgpHjv7Dds+3MKo8xSY5XExsy/6I1BI5K4x3LXMG4xih1WmU6EahPMSclaq/TwWFg==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/accelerator/-/accelerator-5.9.2.tgz", + "integrity": "sha512-aXpwH4AEMAIaI/wUkjBMDj5Zp0lDuxzCxw6JP53uMvgmCizcL7AcvvZKi0y7apc7N5BKj0djrt7mF7syIAMR6g==", + "license": "Apache-2.0", "peerDependencies": { "rxjs": "7.8.1", "tslib": "^2.6.3" } }, "node_modules/@onecx/angular-accelerator": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/angular-accelerator/-/angular-accelerator-5.9.0.tgz", - "integrity": "sha512-mvCuKs6HxDv2vo0cDeD5hN4BYOTnxajFkaZGvQUtCOgtyt/d9Ub/ag9Vm2IsRL3gHbgz4T54gYdOrBo3PiPRZQ==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/angular-accelerator/-/angular-accelerator-5.9.2.tgz", + "integrity": "sha512-NQOFodTJv/An2h9ABDoebQcaZlxDbPss2tYh4d8HpPDIFFbCb1W8lZdtGTe7AT4OW+64KDTfu228H37jEH3y4w==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.3.0" }, @@ -6977,9 +6979,10 @@ } }, "node_modules/@onecx/angular-auth": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/angular-auth/-/angular-auth-5.9.0.tgz", - "integrity": "sha512-9wS40d2tH5/qDR0F663FcH2GTYRqHYTbUMXEy48P7fXoqJzUvcmi+GIGn/uvim23JLDLMQuXjAMI4CCSgdfVhw==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/angular-auth/-/angular-auth-5.9.2.tgz", + "integrity": "sha512-VgJQCmZpYBKdykaCjrGyxgqpoUtAomqW6WpuzH0gdrMg/00zNHsNJAgo6HS/sIulGvbERNmb+ditC8stxTwFKQ==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.3.0" }, @@ -6995,9 +6998,10 @@ } }, "node_modules/@onecx/angular-integration-interface": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/angular-integration-interface/-/angular-integration-interface-5.9.0.tgz", - "integrity": "sha512-baIHyrzXiNvjrwPF3MD762a2O7PiH1+1j1Ch8Uyk3Vfv5LKN/QlgSYalcqxxorS5tYO2Ovu6JPzg+Ftefz46Eg==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/angular-integration-interface/-/angular-integration-interface-5.9.2.tgz", + "integrity": "sha512-RwEun2cQX66oPyqkkBvyY5l8AFPxnSiMN4YGZsofwER0LMC20F8f2+64phIgnMc5FF7XzQQUT2wxAaXjSDy7JA==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.3.0" }, @@ -7008,9 +7012,10 @@ } }, "node_modules/@onecx/angular-remote-components": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/angular-remote-components/-/angular-remote-components-5.9.0.tgz", - "integrity": "sha512-uwRlbeOYsynPl6M/0K7rEqWc+SzH5Y8lty1MFf2nqulikGzLPePq0D9Omzqo7Uo7ruRjqiutOAM3wBRHnW13cg==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/angular-remote-components/-/angular-remote-components-5.9.2.tgz", + "integrity": "sha512-0wUgCH7lSIBadkpB0s50tv5FgRHpMzU74X9rrdeWJeMzE2WHT5lBFDrtzHvKNsHZnmeEVzodu/0i1i5aJdTZqA==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.3.0" }, @@ -7039,9 +7044,10 @@ } }, "node_modules/@onecx/angular-webcomponents": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/angular-webcomponents/-/angular-webcomponents-5.9.0.tgz", - "integrity": "sha512-n/Hguc3herlYeEgDP3orC3Hgu/ae5jhS9EF/qLMUEqkTJTgjwp222ZmNBd0aWssztemB4WjHymjUY3ZfE7BRuQ==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/angular-webcomponents/-/angular-webcomponents-5.9.2.tgz", + "integrity": "sha512-GqBOdVyDNIikPE7Jsj3eHCdZz4xHxQTWSaKYWosaT3oGLXKmDh1MDvsdg79tj5vFV3JdoKaVMbyhfKbyn3QgUg==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.3.0" }, @@ -7056,9 +7062,10 @@ } }, "node_modules/@onecx/integration-interface": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/integration-interface/-/integration-interface-5.9.0.tgz", - "integrity": "sha512-j3GHBY85Ymf3cbtib38EQg0rZ4Zu6cw1AzDIMZaveGTSr0JgPphXss5HVmCSGWcMX2QgiF14NUAenLOcDCjXmQ==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/integration-interface/-/integration-interface-5.9.2.tgz", + "integrity": "sha512-PlsmeGHpZFjqwWvMDeWA6Dprqv2P4nikMNvRKe6ZxKq+T32X6z/Yt1PuhDpxuNgismAnyrN+dk7skkEok0bCcw==", + "license": "Apache-2.0", "peerDependencies": { "@onecx/accelerator": "^5", "rxjs": "7.8.1", @@ -7066,9 +7073,10 @@ } }, "node_modules/@onecx/keycloak-auth": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/keycloak-auth/-/keycloak-auth-5.9.0.tgz", - "integrity": "sha512-U28M/S2cNscg0EUWoiDalYnNqjjM4ZeYc/nJW4jsQvzHtWyAHvWAkh9csvIM2/lQUwvoaRqhgQcq5AeoZqQ3FQ==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/keycloak-auth/-/keycloak-auth-5.9.2.tgz", + "integrity": "sha512-Ce5Q9TSF7wTNBDWLvxR0XOfkNC1ve2ak74QDXEwv61wMjE6A73jKnBaLCA5QJvI/nos4w/I3072OcEcimZ/8eg==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.3.0" }, @@ -7083,9 +7091,10 @@ } }, "node_modules/@onecx/portal-integration-angular": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/portal-integration-angular/-/portal-integration-angular-5.9.0.tgz", - "integrity": "sha512-VloriJUGg1GyV9VffjVzce3NHSwLNPJWcA5HLHVwSFh2iBTuFT1l/JWJFW4Ma/bISHJO2kJZ1iYPQy/macBYbQ==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/portal-integration-angular/-/portal-integration-angular-5.9.2.tgz", + "integrity": "sha512-7uD3q95n+y/OQTDqOHfw1NZQONV4/uX9DvKMipne2PeaKYQ6g61+PPIWnc3b3QnH9POzKEEd/ws1CXhMMHsChw==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.3.0" }, @@ -7117,17 +7126,19 @@ } }, "node_modules/@onecx/portal-layout-styles": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/portal-layout-styles/-/portal-layout-styles-5.9.0.tgz", - "integrity": "sha512-bCQKpUfNeRGawyfKwxY7QhAGzogpO94TPreeCzn4wwaLWQAfIDiMm+U30yIMowLqE6O6S/rHt/H2DqieZS0cvw==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/portal-layout-styles/-/portal-layout-styles-5.9.2.tgz", + "integrity": "sha512-YeDWGpamnc6a8viXkhwjA/fv7cN2X5JFwx1nceXfwBQgtuLBKBtg7RfJbEL8cv5pHwk0amMc0JBsC3jcEY0qCw==", + "license": "Apache-2.0", "peerDependencies": { "tslib": "^2.6.3" } }, "node_modules/@onecx/shell-core": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@onecx/shell-core/-/shell-core-5.9.0.tgz", - "integrity": "sha512-d9JbW3/ApW1cByIB6SzH489P6rbDBrxdXXeOGp38Fsq+2GCXd8QDO4O0sI09MNZ51Bd+nNidNf8jP5cmOFNHZQ==", + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/@onecx/shell-core/-/shell-core-5.9.2.tgz", + "integrity": "sha512-4MGsNKtBVS+4X/Fiosj6QGF/6fKeX+nVz+gK2mgI4j6Ec+vlTkhMOeNZntp2Ly9GrcMw0JeAeFb8QNjsjENA7Q==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.3.0" }, diff --git a/package.json b/package.json index 1bc6be9..3b7b201 100644 --- a/package.json +++ b/package.json @@ -38,17 +38,17 @@ "@angular/router": "^18.2.1", "@ngx-translate/core": "^15.0.0", "@nx/angular": "19.6.3", - "@onecx/accelerator": "^5.9.0", - "@onecx/angular-accelerator": "^5.9.0", - "@onecx/angular-auth": "^5.9.0", - "@onecx/angular-integration-interface": "^5.9.0", - "@onecx/angular-remote-components": "^5.9.0", - "@onecx/angular-webcomponents": "^5.9.0", - "@onecx/integration-interface": "^5.9.0", - "@onecx/keycloak-auth": "^5.9.0", - "@onecx/portal-integration-angular": "^5.9.0", - "@onecx/portal-layout-styles": "^5.9.0", - "@onecx/shell-core": "^5.9.0", + "@onecx/accelerator": "^5.9.2", + "@onecx/angular-accelerator": "^5.9.2", + "@onecx/angular-auth": "^5.9.2", + "@onecx/angular-integration-interface": "^5.9.2", + "@onecx/angular-remote-components": "^5.9.2", + "@onecx/angular-webcomponents": "^5.9.2", + "@onecx/integration-interface": "^5.9.2", + "@onecx/keycloak-auth": "^5.9.2", + "@onecx/portal-integration-angular": "^5.9.2", + "@onecx/portal-layout-styles": "^5.9.2", + "@onecx/shell-core": "^5.9.2", "@openapitools/openapi-generator-cli": "^2.13.5", "keycloak-angular": "^16.0.1", "keycloak-js": "^25.0.4",