wt-front-shared 1.0.70 → 1.0.72
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/static-data/static-data.selectors.mjs +2 -3
- package/esm2020/lib/core/interceptors/headers.interceptor.mjs +39 -24
- package/fesm2015/wt-front-shared.mjs +39 -25
- package/fesm2015/wt-front-shared.mjs.map +1 -1
- package/fesm2020/wt-front-shared.mjs +39 -25
- package/fesm2020/wt-front-shared.mjs.map +1 -1
- package/lib/core/interceptors/headers.interceptor.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6165,7 +6165,6 @@ const getStaticData = (contentType, subSection, where) => createSelector(getStat
|
|
|
6165
6165
|
let result = true;
|
|
6166
6166
|
Object.keys(where)
|
|
6167
6167
|
.forEach(whereItem => {
|
|
6168
|
-
// item[whereItem] is not Array
|
|
6169
6168
|
if (!Array.isArray(item[whereItem])) {
|
|
6170
6169
|
const fieldValue = item[whereItem];
|
|
6171
6170
|
if (!Array.isArray(where[whereItem])) {
|
|
@@ -6182,7 +6181,7 @@ const getStaticData = (contentType, subSection, where) => createSelector(getStat
|
|
|
6182
6181
|
result = item[whereItem].includes(where[whereItem]);
|
|
6183
6182
|
}
|
|
6184
6183
|
else {
|
|
6185
|
-
result = where[whereItem].
|
|
6184
|
+
result = where[whereItem].some(subItem => item[whereItem].includes(subItem));
|
|
6186
6185
|
}
|
|
6187
6186
|
}
|
|
6188
6187
|
});
|
|
@@ -12678,32 +12677,36 @@ class HeadersInterceptor {
|
|
|
12678
12677
|
try {
|
|
12679
12678
|
const userInfo = this.authenticationService.loadAuthDataFromLocalStore();
|
|
12680
12679
|
this.updateRequestData(request.urlWithParams, request.method, errResponse.error.formErrors);
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
|
|
12684
|
-
|
|
12685
|
-
|
|
12686
|
-
this.checkErrors(errResponse.error.formErrors);
|
|
12687
|
-
}
|
|
12688
|
-
if (errResponse.error.formId) {
|
|
12689
|
-
this.formsFacade.updateForm({
|
|
12690
|
-
formId: errResponse.error.formId,
|
|
12691
|
-
loading: false,
|
|
12692
|
-
hasError: true,
|
|
12693
|
-
isComplete: true,
|
|
12694
|
-
error: errResponse.error.error,
|
|
12695
|
-
code: errResponse.error.code
|
|
12696
|
-
});
|
|
12680
|
+
const currentHost = window.location.host;
|
|
12681
|
+
const requestDomain = this.getDomainByUrl(request.url);
|
|
12682
|
+
if (currentHost === requestDomain) {
|
|
12683
|
+
if (errResponse.status === 401) {
|
|
12684
|
+
return this.handle401Error(errResponse, userInfo, request, next);
|
|
12697
12685
|
}
|
|
12698
|
-
if (errResponse.error
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
|
|
12686
|
+
if (errResponse.status === 422 && errResponse.error) {
|
|
12687
|
+
if (errResponse.error.formErrors) {
|
|
12688
|
+
this.checkErrors(errResponse.error.formErrors);
|
|
12689
|
+
}
|
|
12690
|
+
if (errResponse.error.formId) {
|
|
12691
|
+
this.formsFacade.updateForm({
|
|
12692
|
+
formId: errResponse.error.formId,
|
|
12693
|
+
loading: false,
|
|
12694
|
+
hasError: true,
|
|
12695
|
+
isComplete: true,
|
|
12696
|
+
error: errResponse.error.error,
|
|
12697
|
+
code: errResponse.error.code
|
|
12698
|
+
});
|
|
12699
|
+
}
|
|
12700
|
+
if (errResponse.error.data?.publicationResult) {
|
|
12701
|
+
const { errors, warnings } = errResponse.error.data.publicationResult;
|
|
12702
|
+
if (errors || warnings) {
|
|
12703
|
+
this.checkPublishErrors(errors, warnings);
|
|
12704
|
+
}
|
|
12702
12705
|
}
|
|
12703
12706
|
}
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
+
if (errResponse.status === 403) {
|
|
12708
|
+
this.sendForbiddenError();
|
|
12709
|
+
}
|
|
12707
12710
|
}
|
|
12708
12711
|
const error = (errResponse.error && errResponse.error.message) || errResponse.statusText;
|
|
12709
12712
|
return throwError(error);
|
|
@@ -12783,6 +12786,17 @@ class HeadersInterceptor {
|
|
|
12783
12786
|
console.error('[ headers.interceptor ][ intercept ][ handlePublicationMessagesAndFiles ]', e);
|
|
12784
12787
|
}
|
|
12785
12788
|
}
|
|
12789
|
+
getDomainByUrl(url, subdomain = false) {
|
|
12790
|
+
let newUrl = url.replace(/(https?:\/\/)?(www.)?/i, '');
|
|
12791
|
+
if (subdomain) {
|
|
12792
|
+
const urlParams = newUrl.split('.');
|
|
12793
|
+
newUrl = urlParams.slice(url.length - 2).join('.');
|
|
12794
|
+
}
|
|
12795
|
+
if (newUrl.indexOf('/') !== -1) {
|
|
12796
|
+
return newUrl.split('/')[0];
|
|
12797
|
+
}
|
|
12798
|
+
return newUrl;
|
|
12799
|
+
}
|
|
12786
12800
|
handle401Error(err, userInfo, request, next) {
|
|
12787
12801
|
console.error('[ header.interceptor ][ handle401Error ]', userInfo);
|
|
12788
12802
|
if (err.error.error === 'refresh-token-fail' ||
|