valtech-components 4.0.993 → 4.0.995
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/esm2022/lib/services/auth/auth.service.mjs +4 -6
- package/esm2022/lib/services/auth/oauth-callback.component.mjs +4 -5
- package/esm2022/lib/services/auth/org-switch.service.mjs +38 -1
- package/esm2022/lib/services/firebase/firebase.service.mjs +2 -2
- package/esm2022/lib/services/requests/types.mjs +1 -1
- package/esm2022/lib/version.mjs +2 -2
- package/fesm2022/valtech-components.mjs +45 -11
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/services/auth/org-switch.service.d.ts +28 -0
- package/lib/services/requests/types.d.ts +4 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -70,7 +70,7 @@ import fixWebmDuration from 'fix-webm-duration';
|
|
|
70
70
|
* Current version of valtech-components.
|
|
71
71
|
* This is automatically updated during the publish process.
|
|
72
72
|
*/
|
|
73
|
-
const VERSION = '4.0.
|
|
73
|
+
const VERSION = '4.0.995';
|
|
74
74
|
|
|
75
75
|
function evaluateValtechAccess(rule, context, features = {}, visitedFeatures = new Set()) {
|
|
76
76
|
if (rule == null)
|
|
@@ -3567,7 +3567,7 @@ class FirebaseService {
|
|
|
3567
3567
|
});
|
|
3568
3568
|
}
|
|
3569
3569
|
async ejecutarSignInWithCustomToken(token) {
|
|
3570
|
-
console.log(
|
|
3570
|
+
console.log('[FBAuth] signInWithCustomToken called');
|
|
3571
3571
|
try {
|
|
3572
3572
|
const credential = await signInWithCustomToken(this.auth, token);
|
|
3573
3573
|
// Forzar refresh del token para asegurar que los claims estén actualizados
|
|
@@ -10871,14 +10871,12 @@ class AuthService {
|
|
|
10871
10871
|
// Integración con Firebase
|
|
10872
10872
|
console.log('[ValtechAuth] handleSuccessfulAuth - Firebase check:', {
|
|
10873
10873
|
enableFirebaseIntegration: this.config?.enableFirebaseIntegration,
|
|
10874
|
-
|
|
10875
|
-
firebaseTokenValue: !!response.firebaseToken,
|
|
10876
|
-
firebaseTokenLength: response.firebaseToken?.length || 0,
|
|
10874
|
+
hasFirebaseToken: !!response.firebaseToken,
|
|
10877
10875
|
});
|
|
10878
10876
|
if (this.config?.enableFirebaseIntegration &&
|
|
10879
10877
|
'firebaseToken' in response &&
|
|
10880
10878
|
response.firebaseToken) {
|
|
10881
|
-
console.log('[ValtechAuth] Calling signInWithFirebase
|
|
10879
|
+
console.log('[ValtechAuth] Calling signInWithFirebase');
|
|
10882
10880
|
await this.signInWithFirebase(response.firebaseToken);
|
|
10883
10881
|
}
|
|
10884
10882
|
else if (this.config?.enableFirebaseIntegration) {
|
|
@@ -11098,7 +11096,7 @@ class AuthService {
|
|
|
11098
11096
|
// FIREBASE INTEGRATION
|
|
11099
11097
|
// =============================================
|
|
11100
11098
|
async signInWithFirebase(firebaseToken) {
|
|
11101
|
-
console.log(`[FBAuth] auth flow
|
|
11099
|
+
console.log(`[FBAuth] auth flow -> signInWithFirebase attempt ` +
|
|
11102
11100
|
`firebaseServicePresent=${!!this.firebaseService}`);
|
|
11103
11101
|
try {
|
|
11104
11102
|
if (this.firebaseService) {
|
|
@@ -43577,14 +43575,13 @@ class OAuthCallbackComponent {
|
|
|
43577
43575
|
async processCallback() {
|
|
43578
43576
|
const params = new URLSearchParams(window.location.search);
|
|
43579
43577
|
this.clientNonce = params.get('client_nonce');
|
|
43580
|
-
// DEBUG: Log all received params
|
|
43581
43578
|
console.log('[OAuthCallback] URL params received:', {
|
|
43582
|
-
url: window.location.href,
|
|
43583
43579
|
hasAccessToken: params.has('access_token'),
|
|
43584
43580
|
hasRefreshToken: params.has('refresh_token'),
|
|
43585
43581
|
hasFirebaseToken: params.has('firebase_token'),
|
|
43586
|
-
|
|
43587
|
-
|
|
43582
|
+
hasError: params.has('error'),
|
|
43583
|
+
hasMFAChallenge: params.get('mfa_required') === 'true',
|
|
43584
|
+
isPopup: params.get('popup') === 'true',
|
|
43588
43585
|
});
|
|
43589
43586
|
// Verificar si hay error
|
|
43590
43587
|
const error = params.get('error');
|
|
@@ -43992,11 +43989,41 @@ class OrgSwitchService {
|
|
|
43992
43989
|
notifyOrgDataUpdated(org) {
|
|
43993
43990
|
this._orgDataUpdated.next(org);
|
|
43994
43991
|
}
|
|
43992
|
+
/**
|
|
43993
|
+
* Registra la función que lleva a "home" tras un cambio de org (FE-7,
|
|
43994
|
+
* `TODO.md`). Llamar UNA vez en el constructor del shell raíz de la app
|
|
43995
|
+
* (ej. `AppLayoutPage`), reemplazando cualquier `orgChanged$.subscribe(() =>
|
|
43996
|
+
* router.navigateByUrl(...))` manual que la app tuviera antes — ese patrón
|
|
43997
|
+
* es exactamente el bug: `navigateByUrl` sin `await` deja que otro
|
|
43998
|
+
* subscriber del mismo evento (`connectPageRefresh` de una página de
|
|
43999
|
+
* detalle) dispare su refetch ANTES de que la navegación reemplace el
|
|
44000
|
+
* componente, y por un instante se ve el estado vacío de la org anterior.
|
|
44001
|
+
*
|
|
44002
|
+
* @example
|
|
44003
|
+
* ```ts
|
|
44004
|
+
* constructor() {
|
|
44005
|
+
* this.orgSwitch.registerHomeNavigator(() =>
|
|
44006
|
+
* this.router.navigateByUrl('/app/home', { replaceUrl: true }).then(() => {})
|
|
44007
|
+
* );
|
|
44008
|
+
* }
|
|
44009
|
+
* ```
|
|
44010
|
+
*/
|
|
44011
|
+
registerHomeNavigator(fn) {
|
|
44012
|
+
this.homeNavigator = fn;
|
|
44013
|
+
}
|
|
43995
44014
|
constructor(auth) {
|
|
43996
44015
|
this.auth = auth;
|
|
43997
44016
|
this._switching = signal(false);
|
|
43998
44017
|
this._orgChanged = new Subject();
|
|
43999
44018
|
this._orgDataUpdated = new Subject();
|
|
44019
|
+
/**
|
|
44020
|
+
* Navegador a "home" registrado por el shell de la app (opcional — ver
|
|
44021
|
+
* `registerHomeNavigator`). Si existe, `switchTo` lo AWAIT-ea antes de
|
|
44022
|
+
* emitir `orgChanged$`, así el shell termina de navegar (y destruye la
|
|
44023
|
+
* vista de detalle vieja) antes de que cualquier página con
|
|
44024
|
+
* `connectPageRefresh` reaccione al cambio de org.
|
|
44025
|
+
*/
|
|
44026
|
+
this.homeNavigator = null;
|
|
44000
44027
|
/**
|
|
44001
44028
|
* `true` while a switch is in flight. UI should disable interactions
|
|
44002
44029
|
* with org-scoped data and show a loading indicator.
|
|
@@ -44041,6 +44068,13 @@ class OrgSwitchService {
|
|
|
44041
44068
|
this._switching.set(true);
|
|
44042
44069
|
try {
|
|
44043
44070
|
await firstValueFrom(this.auth.switchOrg(orgId));
|
|
44071
|
+
// FE-7: si el shell registró un navegador a home, esperarlo ANTES de
|
|
44072
|
+
// avisar a las páginas — así la vista de detalle vieja ya fue
|
|
44073
|
+
// destruida (o nunca llega a refetchear con la org anterior) cuando
|
|
44074
|
+
// `connectPageRefresh` reacciona.
|
|
44075
|
+
if (this.homeNavigator) {
|
|
44076
|
+
await this.homeNavigator();
|
|
44077
|
+
}
|
|
44044
44078
|
this._orgChanged.next({ previousOrg, newOrg: orgId });
|
|
44045
44079
|
if (options.reload && typeof window !== 'undefined') {
|
|
44046
44080
|
window.location.reload();
|