wt-front-shared 1.0.71 → 1.0.73
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/esm2020/lib/core/+state/main/main.effects.mjs +13 -6
- package/esm2020/lib/core/interceptors/headers.interceptor.mjs +39 -24
- package/esm2020/lib/models/config/app-config.mjs +1 -1
- package/fesm2015/wt-front-shared.mjs +50 -27
- package/fesm2015/wt-front-shared.mjs.map +1 -1
- package/fesm2020/wt-front-shared.mjs +48 -27
- package/fesm2020/wt-front-shared.mjs.map +1 -1
- package/lib/core/+state/main/main.effects.d.ts +3 -1
- package/lib/core/interceptors/headers.interceptor.d.ts +1 -0
- package/lib/models/config/app-config.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3793,19 +3793,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
3793
3793
|
}], ctorParameters: function () { return [{ type: i1$2.Actions }, { type: i1.Store }, { type: UiUnitsFacade }]; } });
|
|
3794
3794
|
|
|
3795
3795
|
class MainEffects {
|
|
3796
|
-
constructor(actions$, store) {
|
|
3796
|
+
constructor(actions$, store, config) {
|
|
3797
3797
|
this.actions$ = actions$;
|
|
3798
3798
|
this.store = store;
|
|
3799
|
+
this.config = config;
|
|
3799
3800
|
this.notificationAdd$ = createEffect(() => this.actions$.pipe(tap((action) => {
|
|
3800
|
-
|
|
3801
|
+
if (this.config.env === 'develop') {
|
|
3802
|
+
console.info('[ action ]', action.type);
|
|
3803
|
+
}
|
|
3801
3804
|
})), { dispatch: false });
|
|
3802
3805
|
}
|
|
3803
3806
|
}
|
|
3804
|
-
MainEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MainEffects, deps: [{ token: i1$2.Actions }, { token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3807
|
+
MainEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MainEffects, deps: [{ token: i1$2.Actions }, { token: i1.Store }, { token: CORE_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3805
3808
|
MainEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MainEffects });
|
|
3806
3809
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MainEffects, decorators: [{
|
|
3807
3810
|
type: Injectable
|
|
3808
|
-
}], ctorParameters: function () { return [{ type: i1$2.Actions }, { type: i1.Store }
|
|
3811
|
+
}], ctorParameters: function () { return [{ type: i1$2.Actions }, { type: i1.Store }, { type: undefined, decorators: [{
|
|
3812
|
+
type: Inject,
|
|
3813
|
+
args: [CORE_CONFIG]
|
|
3814
|
+
}] }]; } });
|
|
3809
3815
|
|
|
3810
3816
|
const TAGS_FEATURE_KEY = 'tags';
|
|
3811
3817
|
const initialState$8 = {
|
|
@@ -12677,32 +12683,36 @@ class HeadersInterceptor {
|
|
|
12677
12683
|
try {
|
|
12678
12684
|
const userInfo = this.authenticationService.loadAuthDataFromLocalStore();
|
|
12679
12685
|
this.updateRequestData(request.urlWithParams, request.method, errResponse.error.formErrors);
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
|
|
12684
|
-
|
|
12685
|
-
this.checkErrors(errResponse.error.formErrors);
|
|
12686
|
-
}
|
|
12687
|
-
if (errResponse.error.formId) {
|
|
12688
|
-
this.formsFacade.updateForm({
|
|
12689
|
-
formId: errResponse.error.formId,
|
|
12690
|
-
loading: false,
|
|
12691
|
-
hasError: true,
|
|
12692
|
-
isComplete: true,
|
|
12693
|
-
error: errResponse.error.error,
|
|
12694
|
-
code: errResponse.error.code
|
|
12695
|
-
});
|
|
12686
|
+
const currentHost = window.location.host;
|
|
12687
|
+
const requestDomain = this.getDomainByUrl(request.url);
|
|
12688
|
+
if (currentHost === requestDomain) {
|
|
12689
|
+
if (errResponse.status === 401) {
|
|
12690
|
+
return this.handle401Error(errResponse, userInfo, request, next);
|
|
12696
12691
|
}
|
|
12697
|
-
if (errResponse.error
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
|
|
12692
|
+
if (errResponse.status === 422 && errResponse.error) {
|
|
12693
|
+
if (errResponse.error.formErrors) {
|
|
12694
|
+
this.checkErrors(errResponse.error.formErrors);
|
|
12695
|
+
}
|
|
12696
|
+
if (errResponse.error.formId) {
|
|
12697
|
+
this.formsFacade.updateForm({
|
|
12698
|
+
formId: errResponse.error.formId,
|
|
12699
|
+
loading: false,
|
|
12700
|
+
hasError: true,
|
|
12701
|
+
isComplete: true,
|
|
12702
|
+
error: errResponse.error.error,
|
|
12703
|
+
code: errResponse.error.code
|
|
12704
|
+
});
|
|
12705
|
+
}
|
|
12706
|
+
if (errResponse.error.data?.publicationResult) {
|
|
12707
|
+
const { errors, warnings } = errResponse.error.data.publicationResult;
|
|
12708
|
+
if (errors || warnings) {
|
|
12709
|
+
this.checkPublishErrors(errors, warnings);
|
|
12710
|
+
}
|
|
12701
12711
|
}
|
|
12702
12712
|
}
|
|
12703
|
-
|
|
12704
|
-
|
|
12705
|
-
|
|
12713
|
+
if (errResponse.status === 403) {
|
|
12714
|
+
this.sendForbiddenError();
|
|
12715
|
+
}
|
|
12706
12716
|
}
|
|
12707
12717
|
const error = (errResponse.error && errResponse.error.message) || errResponse.statusText;
|
|
12708
12718
|
return throwError(error);
|
|
@@ -12782,6 +12792,17 @@ class HeadersInterceptor {
|
|
|
12782
12792
|
console.error('[ headers.interceptor ][ intercept ][ handlePublicationMessagesAndFiles ]', e);
|
|
12783
12793
|
}
|
|
12784
12794
|
}
|
|
12795
|
+
getDomainByUrl(url, subdomain = false) {
|
|
12796
|
+
let newUrl = url.replace(/(https?:\/\/)?(www.)?/i, '');
|
|
12797
|
+
if (subdomain) {
|
|
12798
|
+
const urlParams = newUrl.split('.');
|
|
12799
|
+
newUrl = urlParams.slice(url.length - 2).join('.');
|
|
12800
|
+
}
|
|
12801
|
+
if (newUrl.indexOf('/') !== -1) {
|
|
12802
|
+
return newUrl.split('/')[0];
|
|
12803
|
+
}
|
|
12804
|
+
return newUrl;
|
|
12805
|
+
}
|
|
12785
12806
|
handle401Error(err, userInfo, request, next) {
|
|
12786
12807
|
console.error('[ header.interceptor ][ handle401Error ]', userInfo);
|
|
12787
12808
|
if (err.error.error === 'refresh-token-fail' ||
|