oip-common 0.0.38 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/oip-common.mjs +35 -5
- package/fesm2022/oip-common.mjs.map +1 -1
- package/index.d.ts +19 -2
- package/package.json +1 -1
package/fesm2022/oip-common.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject, signal, computed, effect, ChangeDetectorRef, Component, Input, PLATFORM_ID,
|
|
2
|
+
import { Injectable, inject, InjectionToken, signal, computed, effect, ChangeDetectorRef, Component, Input, PLATFORM_ID, HostBinding, EventEmitter, Output, ViewChild, Renderer2, SecurityContext, ChangeDetectionStrategy, Pipe } from '@angular/core';
|
|
3
3
|
import * as i2$6 from 'primeng/api';
|
|
4
4
|
import { MessageService, ConfirmationService, PrimeIcons, SharedModule } from 'primeng/api';
|
|
5
5
|
import { HttpErrorResponse, HttpClient as HttpClient$1, HttpHeaders } from '@angular/common/http';
|
|
@@ -197,6 +197,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
197
197
|
args: [{ providedIn: 'root' }]
|
|
198
198
|
}] });
|
|
199
199
|
|
|
200
|
+
const DEFAULT_OIP_FRONTEND_CONFIG = {
|
|
201
|
+
appMode: 'standalone',
|
|
202
|
+
apiBaseUrl: '',
|
|
203
|
+
notificationHubUrl: ''
|
|
204
|
+
};
|
|
205
|
+
const OIP_FRONTEND_CONFIG = new InjectionToken('OIP_FRONTEND_CONFIG', {
|
|
206
|
+
factory: () => DEFAULT_OIP_FRONTEND_CONFIG
|
|
207
|
+
});
|
|
208
|
+
|
|
200
209
|
/**
|
|
201
210
|
* BaseDataService provides a unified interface for sending HTTP requests
|
|
202
211
|
* using Angular's HttpClient. It supports standard HTTP methods and automatic
|
|
@@ -205,12 +214,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
205
214
|
class BaseDataService {
|
|
206
215
|
constructor() {
|
|
207
216
|
this.http = inject(HttpClient$1);
|
|
217
|
+
this.frontendConfig = inject(OIP_FRONTEND_CONFIG);
|
|
208
218
|
}
|
|
209
219
|
/**
|
|
210
220
|
* Gets the base URL of the application from the HTML <base> tag.
|
|
211
221
|
*/
|
|
212
222
|
get baseUrl() {
|
|
213
|
-
return document.getElementsByTagName('base')[0].href;
|
|
223
|
+
return this.normalizeBaseUrl(this.frontendConfig.apiBaseUrl || document.getElementsByTagName('base')[0].href);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Builds a fully-qualified application URL based on frontend mode.
|
|
227
|
+
*/
|
|
228
|
+
buildUrl(path) {
|
|
229
|
+
const normalizedPath = path.startsWith('/') ? path.substring(1) : path;
|
|
230
|
+
return `${this.baseUrl}${normalizedPath}`;
|
|
214
231
|
}
|
|
215
232
|
/**
|
|
216
233
|
* Sends an HTTP request with the specified method and data.
|
|
@@ -258,6 +275,9 @@ class BaseDataService {
|
|
|
258
275
|
const result = this.http.get(url, httpOptions);
|
|
259
276
|
return lastValueFrom(result);
|
|
260
277
|
}
|
|
278
|
+
normalizeBaseUrl(baseUrl) {
|
|
279
|
+
return baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
|
|
280
|
+
}
|
|
261
281
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BaseDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
262
282
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BaseDataService }); }
|
|
263
283
|
}
|
|
@@ -1561,7 +1581,7 @@ class UserService {
|
|
|
1561
1581
|
* and updates the `photo` and `photoLoaded` properties accordingly.
|
|
1562
1582
|
*/
|
|
1563
1583
|
getUserPhoto() {
|
|
1564
|
-
const url =
|
|
1584
|
+
const url = this.baseDataService.buildUrl(`api/user-profile/get-user-photo?email=${this.securityService.getCurrentUser().email}`);
|
|
1565
1585
|
this.baseDataService.getBlob(url).then((data) => {
|
|
1566
1586
|
this.createImageFromBlob(data);
|
|
1567
1587
|
this.photoLoaded = true;
|
|
@@ -5896,6 +5916,7 @@ class NotificationService {
|
|
|
5896
5916
|
constructor() {
|
|
5897
5917
|
this.securityService = inject(SecurityService);
|
|
5898
5918
|
this.msgService = inject(MsgService);
|
|
5919
|
+
this.frontendConfig = inject(OIP_FRONTEND_CONFIG);
|
|
5899
5920
|
this.securityService.getAccessToken().subscribe((token) => {
|
|
5900
5921
|
this.securityData = token;
|
|
5901
5922
|
if (token) {
|
|
@@ -5905,7 +5926,7 @@ class NotificationService {
|
|
|
5905
5926
|
}
|
|
5906
5927
|
});
|
|
5907
5928
|
this.connection = new signalR.HubConnectionBuilder()
|
|
5908
|
-
.withUrl(
|
|
5929
|
+
.withUrl(this.resolveHubUrl(), {
|
|
5909
5930
|
accessTokenFactory: () => this.securityData,
|
|
5910
5931
|
skipNegotiation: true,
|
|
5911
5932
|
transport: signalR.HttpTransportType.WebSockets
|
|
@@ -5922,6 +5943,15 @@ class NotificationService {
|
|
|
5922
5943
|
this.msgService.add(opt);
|
|
5923
5944
|
});
|
|
5924
5945
|
}
|
|
5946
|
+
resolveHubUrl() {
|
|
5947
|
+
if (this.frontendConfig.notificationHubUrl) {
|
|
5948
|
+
return this.frontendConfig.notificationHubUrl;
|
|
5949
|
+
}
|
|
5950
|
+
if (this.frontendConfig.apiBaseUrl) {
|
|
5951
|
+
return `${this.frontendConfig.apiBaseUrl.replace(/\/$/, '')}/hubs/notification`;
|
|
5952
|
+
}
|
|
5953
|
+
return '/hubs/notification';
|
|
5954
|
+
}
|
|
5925
5955
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: NotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5926
5956
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: NotificationService, providedIn: 'root' }); }
|
|
5927
5957
|
}
|
|
@@ -6060,5 +6090,5 @@ const httpLoaderAuthFactory = (httpClient) => {
|
|
|
6060
6090
|
* Generated bundle index. Do not edit.
|
|
6061
6091
|
*/
|
|
6062
6092
|
|
|
6063
|
-
export { AppConfiguratorComponent, AppFloatingConfiguratorComponent, AppLayoutComponent, AppModulesComponent, AppTopbar, AuthGuardService, BaseDataService, BaseModuleComponent, ConfigComponent, ContentType, DbMigrationComponent, DiscussionComponent, ErrorComponent, FooterComponent, HttpClient, KeycloakSecurityService, L10nService, LOGO_COMPONENT_TOKEN, LayoutService, LogoComponent, LogoService, MenuComponent, MenuService, MsgService, NotfoundComponent, NotificationService, ProfileComponent, SecurePipe, SecurityComponent, SecurityDataService, SecurityService, SecurityStorageService, SidebarComponent, TableFilterService, TopBarService, UnauthorizedComponent, UserService, httpLoaderAuthFactory, langIntercept, provideLogoComponent };
|
|
6093
|
+
export { AppConfiguratorComponent, AppFloatingConfiguratorComponent, AppLayoutComponent, AppModulesComponent, AppTopbar, AuthGuardService, BaseDataService, BaseModuleComponent, ConfigComponent, ContentType, DEFAULT_OIP_FRONTEND_CONFIG, DbMigrationComponent, DiscussionComponent, ErrorComponent, FooterComponent, HttpClient, KeycloakSecurityService, L10nService, LOGO_COMPONENT_TOKEN, LayoutService, LogoComponent, LogoService, MenuComponent, MenuService, MsgService, NotfoundComponent, NotificationService, OIP_FRONTEND_CONFIG, ProfileComponent, SecurePipe, SecurityComponent, SecurityDataService, SecurityService, SecurityStorageService, SidebarComponent, TableFilterService, TopBarService, UnauthorizedComponent, UserService, httpLoaderAuthFactory, langIntercept, provideLogoComponent };
|
|
6064
6094
|
//# sourceMappingURL=oip-common.mjs.map
|