@koalarx/ui 20.1.8 → 20.1.9
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/core/components/kl-root/index.d.ts +0 -1
- package/fesm2022/koalarx-ui-core-components-kl-root.mjs +1 -3
- package/fesm2022/koalarx-ui-core-components-kl-root.mjs.map +1 -1
- package/fesm2022/koalarx-ui.mjs +1 -2
- package/fesm2022/koalarx-ui.mjs.map +1 -1
- package/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -2,7 +2,6 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { OnInit } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
declare class KlRoot implements OnInit {
|
|
5
|
-
private readonly authorization;
|
|
6
5
|
routerLoaderColor: i0.InputSignal<string>;
|
|
7
6
|
ngOnInit(): void;
|
|
8
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<KlRoot, never>;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, Component } from '@angular/core';
|
|
3
3
|
import { DialogContainer } from '@koalarx/ui/core/components/dialog';
|
|
4
4
|
import { LoaderPageContent } from '@koalarx/ui/core/components/loader-page';
|
|
5
5
|
import { SideWindowContainer } from '@koalarx/ui/core/components/side-window';
|
|
6
6
|
import { SnackbarContainer } from '@koalarx/ui/core/components/snackbar';
|
|
7
|
-
import { Authorization } from '@koalarx/ui/shared/services';
|
|
8
7
|
import { LoadingBarRouterModule } from '@ngx-loading-bar/router';
|
|
9
8
|
import * as i1 from '@ngx-loading-bar/core';
|
|
10
9
|
|
|
11
10
|
class KlRoot {
|
|
12
|
-
authorization = inject(Authorization);
|
|
13
11
|
routerLoaderColor = input('#6A1B9A');
|
|
14
12
|
ngOnInit() {
|
|
15
13
|
if (document.querySelector('html')?.getAttribute('data-theme') === null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"koalarx-ui-core-components-kl-root.mjs","sources":["../../projects/koala-ui/core/components/kl-root/kl-root.ts","../../projects/koala-ui/core/components/kl-root/kl-root.html","../../projects/koala-ui/core/components/kl-root/koalarx-ui-core-components-kl-root.ts"],"sourcesContent":["import { Component,
|
|
1
|
+
{"version":3,"file":"koalarx-ui-core-components-kl-root.mjs","sources":["../../projects/koala-ui/core/components/kl-root/kl-root.ts","../../projects/koala-ui/core/components/kl-root/kl-root.html","../../projects/koala-ui/core/components/kl-root/koalarx-ui-core-components-kl-root.ts"],"sourcesContent":["import { Component, input, OnInit } from '@angular/core';\nimport { DialogContainer } from '@koalarx/ui/core/components/dialog';\nimport { LoaderPageContent } from '@koalarx/ui/core/components/loader-page';\nimport { SideWindowContainer } from '@koalarx/ui/core/components/side-window';\nimport { SnackbarContainer } from '@koalarx/ui/core/components/snackbar';\nimport { LoadingBarRouterModule } from '@ngx-loading-bar/router';\n\n@Component({\n selector: 'kl-root',\n templateUrl: './kl-root.html',\n imports: [\n DialogContainer,\n LoadingBarRouterModule,\n SideWindowContainer,\n SnackbarContainer,\n LoaderPageContent,\n ],\n})\nexport class KlRoot implements OnInit {\n routerLoaderColor = input<string>('#6A1B9A');\n\n ngOnInit(): void {\n if (document.querySelector('html')?.getAttribute('data-theme') === null) {\n document.querySelector('html')?.setAttribute('data-theme', 'light');\n }\n }\n}\n","<ngx-loading-bar\n [color]=\"routerLoaderColor()\"\n height=\"4px\"\n [includeSpinner]=\"false\"\n/>\n\n<main class=\"overflow-x-hidden\">\n <kl-loader-page-content />\n <kl-snackbar-container />\n <kl-dialog-container />\n <kl-side-window-container />\n <div class=\"kl-generic-component-container\"></div>\n\n <ng-content />\n</main>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAkBa,MAAM,CAAA;AACjB,IAAA,iBAAiB,GAAG,KAAK,CAAS,SAAS,CAAC;IAE5C,QAAQ,GAAA;AACN,QAAA,IAAI,QAAQ,CAAC,aAAa,C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BAAsB;wBACtB,mBAAmB;wBACnB,iBAAiB;wBACjB,iBAAiB;AAClB,qBAAA,EAAA,QAAA,EAAA,4VAAA,EAAA;;;AEhBH;;AAEG;;;;"}
|
package/fesm2022/koalarx-ui.mjs
CHANGED
|
@@ -24,7 +24,6 @@ class AuthorizationInterceptor {
|
|
|
24
24
|
return request.clone();
|
|
25
25
|
}
|
|
26
26
|
intercept(request, next) {
|
|
27
|
-
const clonedReq = this.setAuthorization(request);
|
|
28
27
|
if (this.authorization.hasToken() &&
|
|
29
28
|
this.authorization.isExpired() &&
|
|
30
29
|
!this.authConfig?.refreshToken?.url) {
|
|
@@ -32,7 +31,7 @@ class AuthorizationInterceptor {
|
|
|
32
31
|
.updateToken()
|
|
33
32
|
.pipe(switchMap(() => next.handle(this.setAuthorization(request))));
|
|
34
33
|
}
|
|
35
|
-
return next.handle(
|
|
34
|
+
return next.handle(this.setAuthorization(request));
|
|
36
35
|
}
|
|
37
36
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AuthorizationInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
38
37
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AuthorizationInterceptor });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"koalarx-ui.mjs","sources":["../../projects/koala-ui/core/interceptors/authorization-interceptor.ts","../../projects/koala-ui/core/interceptors/feedback-request-interceptor.ts","../../projects/koala-ui/core/koala-provider.ts","../../projects/koala-ui/koalarx-ui.ts"],"sourcesContent":["import {\n HttpInterceptor as AngularHttpInterceptor,\n HttpEvent,\n HttpHandler,\n HttpRequest,\n} from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { AppConfig } from '@koalarx/ui/core/config';\nimport { Authorization } from '@koalarx/ui/shared/services';\nimport { Observable } from 'rxjs/internal/Observable';\nimport { switchMap } from 'rxjs/internal/operators/switchMap';\n\n@Injectable()\nexport class AuthorizationInterceptor implements AngularHttpInterceptor {\n private readonly authorization = inject(Authorization);\n private readonly authConfig = inject(AppConfig).authConfig;\n\n private setAuthorization(request: HttpRequest<any>) {\n if (this.authorization.hasToken()) {\n return request.clone({\n headers: request.headers.set(\n 'Authorization',\n `Bearer ${\n request.url === this.authConfig?.refreshToken?.url\n ? this.authorization.refreshToken\n : this.authorization.accessToken\n }`\n ),\n });\n }\n\n return request.clone();\n }\n\n intercept(\n request: HttpRequest<any>,\n next: HttpHandler\n ): Observable<HttpEvent<any>> {\n
|
|
1
|
+
{"version":3,"file":"koalarx-ui.mjs","sources":["../../projects/koala-ui/core/interceptors/authorization-interceptor.ts","../../projects/koala-ui/core/interceptors/feedback-request-interceptor.ts","../../projects/koala-ui/core/koala-provider.ts","../../projects/koala-ui/koalarx-ui.ts"],"sourcesContent":["import {\n HttpInterceptor as AngularHttpInterceptor,\n HttpEvent,\n HttpHandler,\n HttpRequest,\n} from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { AppConfig } from '@koalarx/ui/core/config';\nimport { Authorization } from '@koalarx/ui/shared/services';\nimport { Observable } from 'rxjs/internal/Observable';\nimport { switchMap } from 'rxjs/internal/operators/switchMap';\n\n@Injectable()\nexport class AuthorizationInterceptor implements AngularHttpInterceptor {\n private readonly authorization = inject(Authorization);\n private readonly authConfig = inject(AppConfig).authConfig;\n\n private setAuthorization(request: HttpRequest<any>) {\n if (this.authorization.hasToken()) {\n return request.clone({\n headers: request.headers.set(\n 'Authorization',\n `Bearer ${\n request.url === this.authConfig?.refreshToken?.url\n ? this.authorization.refreshToken\n : this.authorization.accessToken\n }`\n ),\n });\n }\n\n return request.clone();\n }\n\n intercept(\n request: HttpRequest<any>,\n next: HttpHandler\n ): Observable<HttpEvent<any>> {\n if (\n this.authorization.hasToken() &&\n this.authorization.isExpired() &&\n !this.authConfig?.refreshToken?.url\n ) {\n return this.authorization\n .updateToken()\n .pipe(switchMap(() => next.handle(this.setAuthorization(request))));\n }\n\n return next.handle(this.setAuthorization(request));\n }\n}\n","import {\n HttpInterceptor as AngularHttpInterceptor,\n HttpEvent,\n HttpHandler,\n HttpRequest,\n} from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { HttpErrorFeedbackAlert } from '@koalarx/ui/shared/utils';\nimport { Observable } from 'rxjs/internal/Observable';\nimport { tap } from 'rxjs/internal/operators/tap';\n\n@Injectable()\nexport class FeedbackRequestInterceptor implements AngularHttpInterceptor {\n private readonly httpError = inject(HttpErrorFeedbackAlert);\n\n intercept(\n request: HttpRequest<any>,\n next: HttpHandler\n ): Observable<HttpEvent<any>> {\n return next.handle(request.clone()).pipe(\n tap({\n error: (error) => this.httpError.tapError(error),\n })\n );\n }\n}\n","import {\n HTTP_INTERCEPTORS,\n HttpClient,\n HttpInterceptor,\n provideHttpClient,\n withInterceptorsFromDi,\n} from '@angular/common/http';\nimport { Provider, Type } from '@angular/core';\nimport { AppConfig } from '@koalarx/ui/core/config';\nimport { HttpClientErrorsMiddleware } from '@koalarx/ui/core/middlewares';\nimport { AuthConfig } from '@koalarx/ui/core/models';\nimport {\n getTranslationByLanguage,\n KoalaLanguage,\n} from '@koalarx/ui/core/translations';\nimport { MARKED_OPTIONS, provideMarkdown } from 'ngx-markdown';\nimport { NgxMaskConfig, provideEnvironmentNgxMask } from 'ngx-mask';\nimport { AuthorizationInterceptor } from './interceptors/authorization-interceptor';\nimport { FeedbackRequestInterceptor } from './interceptors/feedback-request-interceptor';\n\nconst maskOptions: Partial<NgxMaskConfig> = {\n validation: false,\n thousandSeparator: '.',\n};\n\ninterface KoalaSettings {\n hostApi?: string;\n language?: KoalaLanguage;\n httpClientErrorsMiddleware?: HttpClientErrorsMiddleware;\n authConfig?: AuthConfig;\n authorizationInterceptor?: Type<HttpInterceptor>;\n}\n\nexport function provideKoala(config?: KoalaSettings): Provider {\n const appConfig = new AppConfig();\n\n appConfig.language = config?.language ?? 'en';\n appConfig.translation = getTranslationByLanguage(config?.language ?? 'en');\n appConfig.hostApi = config?.hostApi;\n appConfig.httpClientErrorsMiddleware = config?.httpClientErrorsMiddleware;\n appConfig.authConfig = config?.authConfig;\n\n const providers: Provider = [\n provideEnvironmentNgxMask(maskOptions),\n provideHttpClient(withInterceptorsFromDi()),\n provideMarkdown({\n loader: HttpClient,\n markedOptions: {\n provide: MARKED_OPTIONS,\n useValue: {\n gfm: true,\n breaks: true,\n pedantic: false,\n },\n },\n }),\n {\n provide: HTTP_INTERCEPTORS,\n useClass: FeedbackRequestInterceptor,\n multi: true,\n },\n {\n provide: AppConfig,\n useValue: appConfig,\n },\n ];\n\n if (config?.authConfig) {\n providers.push({\n provide: HTTP_INTERCEPTORS,\n useClass: config?.authorizationInterceptor ?? AuthorizationInterceptor,\n multi: true,\n });\n }\n\n return providers;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MAaa,wBAAwB,CAAA;AAClB,IAAA,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;AACrC,IAAA,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,UAAU;AAElD,IAAA,gBAAgB,CAAC,OAAyB,EAAA;AAChD,QAAA,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE;YACjC,OAAO,OAAO,CAAC,KAAK,CAAC;gBACnB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAC1B,eAAe,EACf,CAAA,OAAA,EACE,OAAO,CAAC,GAAG,KAAK,IAAI,CAAC,UAAU,EAAE,YAAY,EAAE;AAC7C,sBAAE,IAAI,CAAC,aAAa,CAAC;AACrB,sBAAE,IAAI,CAAC,aAAa,CAAC,WACzB,EAAE,CACH;AACF,aAAA,CAAC;;AAGJ,QAAA,OAAO,OAAO,CAAC,KAAK,EAAE;;IAGxB,SAAS,CACP,OAAyB,EACzB,IAAiB,EAAA;AAEjB,QAAA,IACE,IAAI,CAAC,aA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|
1
1
|
import { HttpInterceptor } from '@angular/common/http';
|
|
2
|
-
import { Provider } from '@angular/core';
|
|
2
|
+
import { Type, Provider } from '@angular/core';
|
|
3
3
|
import { HttpClientErrorsMiddleware } from '@koalarx/ui/core/middlewares';
|
|
4
4
|
import { AuthConfig } from '@koalarx/ui/core/models';
|
|
5
5
|
import { KoalaLanguage } from '@koalarx/ui/core/translations';
|
|
@@ -9,7 +9,7 @@ interface KoalaSettings {
|
|
|
9
9
|
language?: KoalaLanguage;
|
|
10
10
|
httpClientErrorsMiddleware?: HttpClientErrorsMiddleware;
|
|
11
11
|
authConfig?: AuthConfig;
|
|
12
|
-
authorizationInterceptor?: HttpInterceptor
|
|
12
|
+
authorizationInterceptor?: Type<HttpInterceptor>;
|
|
13
13
|
}
|
|
14
14
|
declare function provideKoala(config?: KoalaSettings): Provider;
|
|
15
15
|
|