@seniorsistemas/platform-components 5.2.0 → 5.2.2

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.
@@ -15,7 +15,7 @@ import { user, service } from '@seniorsistemas/senior-platform-data';
15
15
  import { CookieService } from 'ngx-cookie-service';
16
16
  import { BehaviorSubject } from 'rxjs/BehaviorSubject';
17
17
  import { Subject, Observable, from, BehaviorSubject as BehaviorSubject$1, defer, forkJoin, throwError, of } from 'rxjs';
18
- import { map, takeUntil, filter, tap, mergeMap, catchError, shareReplay } from 'rxjs/operators';
18
+ import { map, takeUntil, filter, tap, mergeMap, flatMap, catchError, shareReplay } from 'rxjs/operators';
19
19
  import { NavigationEnd, Router } from '@angular/router';
20
20
  import moment from 'moment';
21
21
  import { contains, equals, clone } from 'ramda';
@@ -1648,54 +1648,27 @@ var RestUrl = /** @class */ (function () {
1648
1648
  return RestUrl;
1649
1649
  }());
1650
1650
 
1651
- var XServicesUrl = /** @class */ (function () {
1652
- function XServicesUrl() {
1653
- }
1654
- XServicesUrl.prototype.get = function () {
1655
- return defer(function () {
1656
- var url = service.getXServicesUrl();
1657
- return from(url);
1658
- });
1659
- };
1660
- XServicesUrl = __decorate([
1661
- Injectable()
1662
- ], XServicesUrl);
1663
- return XServicesUrl;
1664
- }());
1665
-
1666
1651
  var HttpInterceptor = /** @class */ (function () {
1667
- function HttpInterceptor(restUrl, xServicesUrl) {
1652
+ function HttpInterceptor(restUrl) {
1668
1653
  this.restUrl = restUrl;
1669
- this.xServicesUrl = xServicesUrl;
1670
1654
  }
1671
1655
  HttpInterceptor.prototype.intercept = function (originalReq, next) {
1672
- var _this = this;
1673
1656
  if (!originalReq.url.includes("://")) {
1674
- var getAuthHeader = defer(function () { return from(user.getAuthHeader()); });
1675
- if (/^\/?[^\/]+\/[^\/]+\/api\/(?:latest|v\d+)\/.+$/g.test(originalReq.url)) {
1676
- var xUrl = this.xServicesUrl.get();
1677
- return forkJoin({ xUrl: xUrl, getAuthHeader: getAuthHeader }).pipe(mergeMap(function (values) {
1678
- return _this.injectBaseUrl(originalReq, next, values.xUrl, values.getAuthHeader);
1679
- }));
1680
- }
1681
1657
  var getRestUrl = this.restUrl.get();
1682
- return forkJoin({ getRestUrl: getRestUrl, getAuthHeader: getAuthHeader }).pipe(mergeMap(function (values) {
1658
+ var getAuthHeader = defer(function () { return from(user.getAuthHeader()); });
1659
+ return forkJoin(getRestUrl, getAuthHeader).pipe(flatMap(function (values) {
1683
1660
  var _a = __read(values, 2), bridgeUrl = _a[0], authHeader = _a[1];
1684
- return _this.injectBaseUrl(originalReq, next, bridgeUrl, authHeader);
1661
+ var request = originalReq.clone({
1662
+ url: bridgeUrl + originalReq.url,
1663
+ headers: originalReq.headers.set("Authorization", authHeader)
1664
+ });
1665
+ return next.handle(request);
1685
1666
  }));
1686
1667
  }
1687
1668
  return next.handle(originalReq);
1688
1669
  };
1689
- HttpInterceptor.prototype.injectBaseUrl = function (originalReq, next, baseUrl, authorization) {
1690
- var request = originalReq.clone({
1691
- url: baseUrl + originalReq.url,
1692
- headers: originalReq.headers.set("Authorization", authorization)
1693
- });
1694
- return next.handle(request);
1695
- };
1696
1670
  HttpInterceptor.ctorParameters = function () { return [
1697
- { type: RestUrl },
1698
- { type: XServicesUrl }
1671
+ { type: RestUrl }
1699
1672
  ]; };
1700
1673
  HttpInterceptor = __decorate([
1701
1674
  Injectable()
@@ -1709,7 +1682,7 @@ var HttpInterceptorModule = /** @class */ (function () {
1709
1682
  HttpInterceptorModule = __decorate([
1710
1683
  NgModule({
1711
1684
  imports: [HttpClientModule],
1712
- providers: [RestUrl, XServicesUrl, { provide: HTTP_INTERCEPTORS, useClass: HttpInterceptor, multi: true }]
1685
+ providers: [RestUrl, { provide: HTTP_INTERCEPTORS, useClass: HttpInterceptor, multi: true }]
1713
1686
  })
1714
1687
  ], HttpInterceptorModule);
1715
1688
  return HttpInterceptorModule;
@@ -2455,5 +2428,5 @@ var SpotlightModule = /** @class */ (function () {
2455
2428
  * Generated bundle index. Do not edit.
2456
2429
  */
2457
2430
 
2458
- export { AdvancedFilterComponent, AdvancedFilterModule, AdvancedFilterService, AppRoutingModule, CyclicJsonInterceptorModule, FeatureToggleModule, FeatureToggleService, Filter, FilterType, FormFilter, HttpInterceptorModule, PermissionsModule, PermissionsService, RestUrl, Scope, SpotlightComponent, SpotlightModule, TranslationsConfig, TranslationsModule, USER_INFO, XServicesUrl, factory, promise, fallback as ɵa, CalendarOptionsService as ɵb, FormFilterComponent as ɵc, MapValuesPipe as ɵd, TranslatePipe as ɵe, CyclicJsonInterceptor as ɵf, HttpInterceptor as ɵg, RESOURCES as ɵh, ENVIRONMENT as ɵi, Environment as ɵk, fallback$1 as ɵl, SpotlightService as ɵm, TranslatePipe$1 as ɵn };
2431
+ export { AdvancedFilterComponent, AdvancedFilterModule, AdvancedFilterService, AppRoutingModule, CyclicJsonInterceptorModule, FeatureToggleModule, FeatureToggleService, Filter, FilterType, FormFilter, HttpInterceptorModule, PermissionsModule, PermissionsService, RestUrl, Scope, SpotlightComponent, SpotlightModule, TranslationsConfig, TranslationsModule, USER_INFO, factory, promise, fallback as ɵa, CalendarOptionsService as ɵb, FormFilterComponent as ɵc, MapValuesPipe as ɵd, TranslatePipe as ɵe, CyclicJsonInterceptor as ɵf, HttpInterceptor as ɵg, RESOURCES as ɵh, ENVIRONMENT as ɵi, Environment as ɵk, fallback$1 as ɵl, SpotlightService as ɵm, TranslatePipe$1 as ɵn };
2459
2432
  //# sourceMappingURL=seniorsistemas-platform-components.js.map