web-manager 4.1.41 → 4.1.42
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/CHANGELOG.md +8 -0
- package/dist/index.js +28 -7
- package/dist/modules/auth.js +2 -2
- package/dist/modules/service-worker.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
14
14
|
- `Fixed` for any bug fixes.
|
|
15
15
|
- `Security` in case of vulnerabilities.
|
|
16
16
|
|
|
17
|
+
---
|
|
18
|
+
## [4.1.42] - 2026-05-11
|
|
19
|
+
### Changed
|
|
20
|
+
- **Firebase config: presence-driven + flat shape canonical.** Firebase now initializes when a `firebaseConfig` blob is present in config (matching BEM/BXM/EM/OMEGA shape) — no separate `firebase.app.enabled` flag needed. Removes the `enabled` redundancy where consumers had to set both a credentials blob AND flip a flag.
|
|
21
|
+
- New internal helper `_resolveFirebaseConfig()` reads flat `config.firebaseConfig` first (canonical), falls back to nested `config.firebase.app.config` (UJM legacy yaml). Used by `_initializeFirebase`, `getFunctionsUrl`, `getApiUrl`, `service-worker.js`, and `auth.js#listen` (Firebase-not-configured short-circuit).
|
|
22
|
+
- `_initializeFirebase` now reuses an existing `[DEFAULT]` Firebase app if present (via `getApps()` / `getApp()`) instead of throwing `app/duplicate-app` on re-init (live reload, test re-runs).
|
|
23
|
+
- No backwards-compat shim needed for UJM: both shapes resolve. UJM can migrate to the flat `firebaseConfig` shape on its own schedule; until then, its `firebase.app.config` keeps working.
|
|
24
|
+
|
|
17
25
|
---
|
|
18
26
|
## [4.1.41] - 2026-05-10
|
|
19
27
|
### Changed
|
package/dist/index.js
CHANGED
|
@@ -95,8 +95,11 @@ class Manager {
|
|
|
95
95
|
// Set platform and runtime on HTML element
|
|
96
96
|
this._setHtmlDataAttributes();
|
|
97
97
|
|
|
98
|
-
// Initialize Firebase if
|
|
99
|
-
|
|
98
|
+
// Initialize Firebase if a config blob is present (presence-driven — matches BEM
|
|
99
|
+
// convention). Reads flat `firebaseConfig` (BEM/BXM/EM canonical shape) and falls
|
|
100
|
+
// back to nested `firebase.app.config` (UJM's current `_config.yml` shape).
|
|
101
|
+
// Once UJM migrates to the flat shape this fallback can be dropped.
|
|
102
|
+
if (this._resolveFirebaseConfig()) {
|
|
100
103
|
await this._initializeFirebase();
|
|
101
104
|
}
|
|
102
105
|
|
|
@@ -389,8 +392,23 @@ class Manager {
|
|
|
389
392
|
$html.dataset.device = this._utilities.getDevice();
|
|
390
393
|
}
|
|
391
394
|
|
|
395
|
+
// Resolve the Firebase web SDK config blob. Flat `firebaseConfig` first (canonical
|
|
396
|
+
// shape — BEM/BXM/EM), then nested `firebase.app.config` (UJM legacy yaml shape).
|
|
397
|
+
// Returns the blob when it has at least one own key, otherwise null.
|
|
398
|
+
_resolveFirebaseConfig() {
|
|
399
|
+
const flat = this.config.firebaseConfig;
|
|
400
|
+
if (flat && typeof flat === 'object' && Object.keys(flat).length > 0) {
|
|
401
|
+
return flat;
|
|
402
|
+
}
|
|
403
|
+
const nested = this.config.firebase?.app?.config;
|
|
404
|
+
if (nested && typeof nested === 'object' && Object.keys(nested).length > 0) {
|
|
405
|
+
return nested;
|
|
406
|
+
}
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
|
|
392
410
|
async _initializeFirebase() {
|
|
393
|
-
const firebaseConfig = this.
|
|
411
|
+
const firebaseConfig = this._resolveFirebaseConfig();
|
|
394
412
|
|
|
395
413
|
// Dynamically import Firebase v12
|
|
396
414
|
const { initializeApp } = await import('firebase/app');
|
|
@@ -403,8 +421,11 @@ class Manager {
|
|
|
403
421
|
// firebaseConfig.authDomain = window.location.hostname;
|
|
404
422
|
// }
|
|
405
423
|
|
|
406
|
-
// Initialize Firebase
|
|
407
|
-
|
|
424
|
+
// Initialize Firebase. Re-init guards: if there's already a [DEFAULT] app
|
|
425
|
+
// (live reload, re-init in tests), get the existing one rather than throwing
|
|
426
|
+
// `app/duplicate-app`.
|
|
427
|
+
const { getApp, getApps } = await import('firebase/app');
|
|
428
|
+
const app = getApps().length > 0 ? getApp() : initializeApp(firebaseConfig);
|
|
408
429
|
|
|
409
430
|
// Store Firebase references
|
|
410
431
|
this._firebaseApp = app;
|
|
@@ -463,7 +484,7 @@ class Manager {
|
|
|
463
484
|
|
|
464
485
|
getFunctionsUrl(environment) {
|
|
465
486
|
const env = environment || this.config.environment;
|
|
466
|
-
const projectId = this.
|
|
487
|
+
const projectId = this._resolveFirebaseConfig()?.projectId;
|
|
467
488
|
|
|
468
489
|
if (!projectId) {
|
|
469
490
|
throw new Error('Firebase project ID not configured');
|
|
@@ -488,7 +509,7 @@ class Manager {
|
|
|
488
509
|
return 'http://localhost:5002';
|
|
489
510
|
}
|
|
490
511
|
|
|
491
|
-
const apiDomain = this.
|
|
512
|
+
const apiDomain = this._resolveFirebaseConfig()?.authDomain; // Has to be this since some projects like Clockii use ITW Universal Auth
|
|
492
513
|
// const apiDomain = this.config.brand.url;
|
|
493
514
|
const baseUrl = url || (apiDomain ? `https://${apiDomain}` : window.location.origin);
|
|
494
515
|
const urlObj = new URL(baseUrl);
|
package/dist/modules/auth.js
CHANGED
|
@@ -133,8 +133,8 @@ class Auth {
|
|
|
133
133
|
options = {};
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
// If Firebase
|
|
137
|
-
if (!this.manager.
|
|
136
|
+
// If Firebase isn't configured (no firebaseConfig blob), call callback immediately with null.
|
|
137
|
+
if (!this.manager._resolveFirebaseConfig()) {
|
|
138
138
|
callback({
|
|
139
139
|
user: null,
|
|
140
140
|
account: resolveAccount({}, {}),
|
|
@@ -42,7 +42,7 @@ class ServiceWorker {
|
|
|
42
42
|
brand: this.manager.config.brand?.id,
|
|
43
43
|
environment: this.manager.config.environment,
|
|
44
44
|
buildTime: this.manager.config.buildTime,
|
|
45
|
-
firebase: this.manager.
|
|
45
|
+
firebase: this.manager._resolveFirebaseConfig()
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
// Register service worker
|
package/package.json
CHANGED