ngx-vector-components 6.15.1 → 6.16.0

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [6.16.0] (25/08/2026)
4
+
5
+ ### Feat
6
+
7
+ - `http-interceptor` now sends `x-client-platform: web` and `x-client: vector-<app>` (derived from the `APP_NAME` token) on every backend request, so the backend can tell web from native app (pair of the app header and the `IsFromApp()` helper on `VectioCargo.Shared`). External URLs (`external-url` header) and `/assets/` requests are skipped. Replaces the per-app `ClientHeaderInterceptor`, which has been removed from portal/fintech/marketplace/logtech/survey;
8
+
3
9
  ## [6.15.1] (25/08/2026)
4
10
 
5
11
  ### Fix
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Input, Component, Pipe, NgModule, InjectionToken, Injectable, Inject, EventEmitter, Output, ViewChild, signal, ViewEncapsulation, HostBinding, HostListener, input, output, inject } from '@angular/core';
2
+ import { Input, Component, Pipe, NgModule, InjectionToken, Injectable, Inject, EventEmitter, Output, ViewChild, signal, ViewEncapsulation, HostBinding, HostListener, input, output, inject, Optional } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import * as i2 from 'primeng/tooltip';
@@ -6499,19 +6499,21 @@ const tokenIsPresentGuard = (routeSnapshot) => {
6499
6499
  };
6500
6500
 
6501
6501
  class HttpInterceptorProvider {
6502
- constructor(storageService, errorMessageService, loadingService, authService, messageService, environment) {
6502
+ constructor(storageService, errorMessageService, loadingService, authService, messageService, environment, appName = null) {
6503
6503
  this.storageService = storageService;
6504
6504
  this.errorMessageService = errorMessageService;
6505
6505
  this.loadingService = loadingService;
6506
6506
  this.authService = authService;
6507
6507
  this.messageService = messageService;
6508
6508
  this.environment = environment;
6509
+ this.appName = appName;
6509
6510
  this.activeRequests = [];
6510
6511
  this.isRefreshing = false;
6511
6512
  this.refreshTokenSubject = new BehaviorSubject(null);
6512
6513
  }
6513
6514
  intercept(request, next) {
6514
6515
  const isExternalUrl = request.headers.get('external-url');
6516
+ const isAssetsRequest = request.url.startsWith('/assets/');
6515
6517
  if (!this.isRefreshTokenRequest(request.url)) {
6516
6518
  if (!isExternalUrl) {
6517
6519
  request = this.addTokenIfPresent(request);
@@ -6524,6 +6526,9 @@ class HttpInterceptorProvider {
6524
6526
  if (!isExternalUrl) {
6525
6527
  request = this.fixUrl(request);
6526
6528
  }
6529
+ if (!isExternalUrl && !isAssetsRequest) {
6530
+ request = this.addClientHeaders(request);
6531
+ }
6527
6532
  const noSpinnerHeader = request.headers.get('no-spinner');
6528
6533
  if (!noSpinnerHeader && !request.url.startsWith('/assets/')) {
6529
6534
  this.loadingService.loading$.next(true);
@@ -6622,6 +6627,28 @@ class HttpInterceptorProvider {
6622
6627
  }
6623
6628
  return request;
6624
6629
  }
6630
+ /**
6631
+ * Marca a origem da request pro backend: `x-client-platform: web` (+ `x-client` com o nome do
6632
+ * frontend), pro backend distinguir web de app nativo (ver helper IsFromApp() no VectioCargo.Shared).
6633
+ *
6634
+ * So nas chamadas do nosso backend; ignora URL externa (header `external-url`) e assets — nao
6635
+ * vaza o header p/ APIs de terceiros. Header e spoofavel: telemetria/roteamento/log, NAO
6636
+ * controle de seguranca.
6637
+ */
6638
+ addClientHeaders(request) {
6639
+ return request.clone({
6640
+ setHeaders: {
6641
+ 'x-client-platform': 'web',
6642
+ 'x-client': this.getClientName(),
6643
+ },
6644
+ });
6645
+ }
6646
+ getClientName() {
6647
+ if (!this.appName) {
6648
+ return 'vector-web';
6649
+ }
6650
+ return `vector-${this.appName.toLowerCase().replace(/_/g, '-')}`;
6651
+ }
6625
6652
  addContentType(request) {
6626
6653
  return request.clone({ setHeaders: { contentType: 'application/json' } });
6627
6654
  }
@@ -6665,7 +6692,7 @@ class HttpInterceptorProvider {
6665
6692
  }
6666
6693
  return this.refreshTokenSubject.pipe(filter((token) => token !== null), take(1), switchMap((token) => next.handle(this.addTokenIfPresent(request))));
6667
6694
  }
6668
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: HttpInterceptorProvider, deps: [{ token: StorageService }, { token: ErrorMessageService }, { token: LoadingService }, { token: AuthService }, { token: i2$2.MessageService }, { token: ENVIRONMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
6695
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: HttpInterceptorProvider, deps: [{ token: StorageService }, { token: ErrorMessageService }, { token: LoadingService }, { token: AuthService }, { token: i2$2.MessageService }, { token: ENVIRONMENT }, { token: APP_NAME, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
6669
6696
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: HttpInterceptorProvider }); }
6670
6697
  }
6671
6698
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: HttpInterceptorProvider, decorators: [{
@@ -6673,6 +6700,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
6673
6700
  }], ctorParameters: () => [{ type: StorageService }, { type: ErrorMessageService }, { type: LoadingService }, { type: AuthService }, { type: i2$2.MessageService }, { type: undefined, decorators: [{
6674
6701
  type: Inject,
6675
6702
  args: [ENVIRONMENT]
6703
+ }] }, { type: AppName, decorators: [{
6704
+ type: Optional
6705
+ }, {
6706
+ type: Inject,
6707
+ args: [APP_NAME]
6676
6708
  }] }] });
6677
6709
 
6678
6710
  const getSelectedCrudItemResolver = (routeSnapshot) => {