mesauth-angular 1.15.0 → 1.15.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.
|
@@ -10,7 +10,7 @@ import { DomSanitizer } from '@angular/platform-browser';
|
|
|
10
10
|
import { DatePipe } from '@angular/common';
|
|
11
11
|
|
|
12
12
|
/** Current installed package version — keep in sync with package.json. */
|
|
13
|
-
const PACKAGE_VERSION = '1.15.
|
|
13
|
+
const PACKAGE_VERSION = '1.15.1';
|
|
14
14
|
/**
|
|
15
15
|
* Provides server-driven UI configuration loaded from the hosted manifest.
|
|
16
16
|
* Components read `labels()` and `features()` signals instead of hardcoded strings.
|
|
@@ -167,20 +167,30 @@ class MesAuthService {
|
|
|
167
167
|
this.http = httpClient;
|
|
168
168
|
this.router = router;
|
|
169
169
|
this.apiBase = config.apiBaseUrl.replace(/\/$/, '');
|
|
170
|
-
//
|
|
171
|
-
//
|
|
170
|
+
// Server-hosted theme CSS and manifest are best-effort: if the MesAuth API is
|
|
171
|
+
// unreachable the consumer app must keep working (unstyled library components
|
|
172
|
+
// are acceptable). Any failure here is logged and swallowed so bootstrap
|
|
173
|
+
// never fails because of a missing stylesheet or manifest.
|
|
172
174
|
const assetsUrl = config.uiAssetsUrl || `${this.apiBase}/mesauth-angular/v1`;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
175
|
+
try {
|
|
176
|
+
const uiConfig = inject(MaUiConfigService);
|
|
177
|
+
this.injectThemeStylesheet(assetsUrl);
|
|
178
|
+
uiConfig.loadManifest(assetsUrl, httpClient);
|
|
179
|
+
// After manifest loads, refresh CSS URL if server version differs from package version.
|
|
180
|
+
// This forces a re-fetch when default.css is updated on the server independently of the npm package.
|
|
181
|
+
const manifestSub = toObservable(uiConfig.manifestVersion).subscribe({
|
|
182
|
+
next: ver => {
|
|
183
|
+
if (ver && ver !== PACKAGE_VERSION) {
|
|
184
|
+
this.updateThemeStylesheetVersion(assetsUrl, ver);
|
|
185
|
+
manifestSub.unsubscribe();
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
error: err => console.warn('[mesauth-angular] manifest version stream failed:', err)
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
console.warn('[mesauth-angular] hot UI asset loading skipped:', err);
|
|
193
|
+
}
|
|
184
194
|
// Fetch user once on init. Route changes do NOT re-fetch the user.
|
|
185
195
|
// Auth state is maintained via cookies; 401 errors are handled by HTTP interceptors.
|
|
186
196
|
// SignalR handles real-time notification delivery without polling.
|
|
@@ -190,18 +200,42 @@ class MesAuthService {
|
|
|
190
200
|
const id = 'ma-theme-css';
|
|
191
201
|
if (typeof document === 'undefined' || document.getElementById(id))
|
|
192
202
|
return;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
203
|
+
try {
|
|
204
|
+
const link = document.createElement('link');
|
|
205
|
+
link.id = id;
|
|
206
|
+
link.rel = 'stylesheet';
|
|
207
|
+
link.href = `${assetsUrl}/themes/default.css?v=${PACKAGE_VERSION}`;
|
|
208
|
+
// If the CSS cannot be fetched (server down, 404, CORS) detach the link so
|
|
209
|
+
// the browser stops reporting it and the consumer app renders unstyled
|
|
210
|
+
// library components instead of a broken one.
|
|
211
|
+
link.onerror = () => {
|
|
212
|
+
console.warn(`[mesauth-angular] theme stylesheet failed to load from ${link.href} — continuing without hosted theme`);
|
|
213
|
+
link.remove();
|
|
214
|
+
};
|
|
215
|
+
document.head.appendChild(link);
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
console.warn('[mesauth-angular] could not inject theme stylesheet:', err);
|
|
219
|
+
}
|
|
198
220
|
}
|
|
199
221
|
updateThemeStylesheetVersion(assetsUrl, manifestVersion) {
|
|
200
222
|
if (typeof document === 'undefined')
|
|
201
223
|
return;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
224
|
+
try {
|
|
225
|
+
const existing = document.getElementById('ma-theme-css');
|
|
226
|
+
if (existing) {
|
|
227
|
+
existing.href = `${assetsUrl}/themes/default.css?v=${manifestVersion}`;
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
// Original link was removed by an earlier load failure — retry with the
|
|
231
|
+
// server-reported version; it may now be reachable.
|
|
232
|
+
this.injectThemeStylesheet(`${assetsUrl}`);
|
|
233
|
+
const retry = document.getElementById('ma-theme-css');
|
|
234
|
+
if (retry)
|
|
235
|
+
retry.href = `${assetsUrl}/themes/default.css?v=${manifestVersion}`;
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
console.warn('[mesauth-angular] could not update theme stylesheet version:', err);
|
|
205
239
|
}
|
|
206
240
|
}
|
|
207
241
|
getConfig() {
|