valtech-components 4.0.188 → 4.0.190

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.
@@ -2,5 +2,5 @@
2
2
  * Current version of valtech-components.
3
3
  * This is automatically updated during the publish process.
4
4
  */
5
- export const VERSION = '4.0.188';
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0dBR0c7QUFDSCxNQUFNLENBQUMsTUFBTSxPQUFPLEdBQUcsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDdXJyZW50IHZlcnNpb24gb2YgdmFsdGVjaC1jb21wb25lbnRzLlxuICogVGhpcyBpcyBhdXRvbWF0aWNhbGx5IHVwZGF0ZWQgZHVyaW5nIHRoZSBwdWJsaXNoIHByb2Nlc3MuXG4gKi9cbmV4cG9ydCBjb25zdCBWRVJTSU9OID0gJzQuMC4xODgnO1xuIl19
5
+ export const VERSION = '4.0.190';
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0dBR0c7QUFDSCxNQUFNLENBQUMsTUFBTSxPQUFPLEdBQUcsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDdXJyZW50IHZlcnNpb24gb2YgdmFsdGVjaC1jb21wb25lbnRzLlxuICogVGhpcyBpcyBhdXRvbWF0aWNhbGx5IHVwZGF0ZWQgZHVyaW5nIHRoZSBwdWJsaXNoIHByb2Nlc3MuXG4gKi9cbmV4cG9ydCBjb25zdCBWRVJTSU9OID0gJzQuMC4xOTAnO1xuIl19
@@ -56,7 +56,7 @@ import { BrowserMultiFormatReader } from '@zxing/browser';
56
56
  * Current version of valtech-components.
57
57
  * This is automatically updated during the publish process.
58
58
  */
59
- const VERSION = '4.0.188';
59
+ const VERSION = '4.0.190';
60
60
 
61
61
  // Control de estado de refresco (singleton a nivel de módulo)
62
62
  let isRefreshing = false;
@@ -8284,6 +8284,19 @@ class AuthService {
8284
8284
  if (claims.org) {
8285
8285
  this.stateService.updateActiveOrg(claims.org);
8286
8286
  }
8287
+ // Sync isSuperAdmin from JWT in case IsPlatformAdmin changed since last login
8288
+ const jwtAdmin = claims.admin === true;
8289
+ if (jwtAdmin !== (storedState.isSuperAdmin ?? false)) {
8290
+ const roles = storedState.roles ?? [];
8291
+ const perms = storedState.permissions ?? [];
8292
+ this.stateService.updatePermissions(roles, perms, jwtAdmin);
8293
+ this.storageService.savePermissions({
8294
+ operationId: '',
8295
+ roles,
8296
+ permissions: perms,
8297
+ isSuperAdmin: jwtAdmin,
8298
+ });
8299
+ }
8287
8300
  }
8288
8301
  // 3. Iniciar timer de refresco proactivo
8289
8302
  this.startRefreshTimer();
@@ -8670,6 +8683,19 @@ class AuthService {
8670
8683
  this.stateService.updateRefreshToken(response.refreshToken);
8671
8684
  this.storageService.saveAccessToken(response.accessToken, expiresAt);
8672
8685
  this.storageService.saveRefreshToken(response.refreshToken); // self-gate: no-op en cookieOnly
8686
+ // Sync isSuperAdmin from refreshed JWT so platform admin promotion/revocation
8687
+ // takes effect without requiring a full re-login.
8688
+ const parsedToken = this.tokenService.parseToken(response.accessToken);
8689
+ const newIsSuperAdmin = response.permissions?.includes('*:*') || parsedToken?.admin === true || false;
8690
+ const newRoles = response.roles ?? this.state().roles;
8691
+ const newPerms = response.permissions ?? this.state().permissions;
8692
+ this.stateService.updatePermissions(newRoles, newPerms, newIsSuperAdmin);
8693
+ this.storageService.savePermissions({
8694
+ operationId: '',
8695
+ roles: newRoles,
8696
+ permissions: newPerms,
8697
+ isSuperAdmin: newIsSuperAdmin,
8698
+ });
8673
8699
  if (this.config?.enableFirebaseIntegration && response.firebaseToken) {
8674
8700
  this.signInWithFirebase(response.firebaseToken);
8675
8701
  }
@@ -53956,7 +53982,7 @@ class SwitchOrgModalComponent {
53956
53982
  }
53957
53983
  loadOrgs() {
53958
53984
  this.loading.set(true);
53959
- const source$ = this.auth.isSuperAdmin() ? this.orgService.listAllOrgs() : this.orgService.listMyOrgs();
53985
+ const source$ = this.orgService.listMyOrgs();
53960
53986
  source$.pipe(take(1)).subscribe({
53961
53987
  next: orgs => {
53962
53988
  const activeId = this.activeOrgId();