wt-front-shared 1.0.57 → 1.0.59
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/behavios/static-data-get-list-behavior.mjs +4 -3
- package/esm2020/lib/core/+state/static-data/behavios/static-data-get-list-categories-behavior.mjs +4 -4
- package/esm2020/lib/core/+state/static-data/static-data.actions.mjs +1 -1
- package/esm2020/lib/core/+state/static-data/static-data.facade.mjs +11 -2
- package/esm2020/lib/core/+state/static-data/static-data.reducer.mjs +13 -8
- package/esm2020/lib/core/interceptors/headers.interceptor.mjs +26 -11
- package/esm2020/lib/models/models/meta.model.mjs +1 -1
- package/fesm2015/wt-front-shared.mjs +38 -8
- package/fesm2015/wt-front-shared.mjs.map +1 -1
- package/fesm2020/wt-front-shared.mjs +42 -13
- package/fesm2020/wt-front-shared.mjs.map +1 -1
- package/lib/core/+state/static-data/behavios/static-data-get-list-categories-behavior.d.ts +3 -3
- package/lib/core/+state/static-data/static-data.actions.d.ts +2 -0
- package/lib/core/+state/static-data/static-data.facade.d.ts +1 -0
- package/lib/core/+state/static-data/static-data.reducer.d.ts +1 -1
- package/lib/core/interceptors/headers.interceptor.d.ts +8 -5
- package/lib/models/models/meta.model.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4809,10 +4809,11 @@ class StaticDataGetListBehavior extends Behavior {
|
|
|
4809
4809
|
case ResponseStatus.STATUS_200: {
|
|
4810
4810
|
const response = this.result.data;
|
|
4811
4811
|
const { data, meta } = response.body;
|
|
4812
|
+
const actionPayload = this.action['payload'];
|
|
4812
4813
|
if (data) {
|
|
4813
4814
|
returnedActions = [
|
|
4814
4815
|
StaticDataGetListSuccess({
|
|
4815
|
-
payload: { data, meta }
|
|
4816
|
+
payload: { data, meta, keepState: actionPayload.payload.keepState }
|
|
4816
4817
|
})
|
|
4817
4818
|
];
|
|
4818
4819
|
}
|
|
@@ -5989,10 +5990,10 @@ const _staticDataReducer$2 = createReducer(initialState$3, on(StaticDataGetList,
|
|
|
5989
5990
|
};
|
|
5990
5991
|
}
|
|
5991
5992
|
return {
|
|
5992
|
-
...state
|
|
5993
|
+
...state
|
|
5993
5994
|
};
|
|
5994
5995
|
}), on(StaticDataGetListSuccess, (state, action) => {
|
|
5995
|
-
const { data, meta } = action.payload;
|
|
5996
|
+
const { data, meta, keepState } = action.payload;
|
|
5996
5997
|
const { staticDataType, subSection } = meta;
|
|
5997
5998
|
const newsState = { list: {}, meta: {} };
|
|
5998
5999
|
const storeSubSection = subSection || 'list';
|
|
@@ -6026,7 +6027,12 @@ const _staticDataReducer$2 = createReducer(initialState$3, on(StaticDataGetList,
|
|
|
6026
6027
|
if (!newsState['list'][staticDataType]) {
|
|
6027
6028
|
newsState['list'][staticDataType] = { [storeSubSection]: {} };
|
|
6028
6029
|
}
|
|
6029
|
-
|
|
6030
|
+
if (!keepState) {
|
|
6031
|
+
newsState['list'][staticDataType][storeSubSection] = Array.isArray(data) ? [...data] : [];
|
|
6032
|
+
}
|
|
6033
|
+
else {
|
|
6034
|
+
newsState['list'][staticDataType][storeSubSection] = Array.isArray(data) ? [...state.list[staticDataType][storeSubSection], ...data] : [];
|
|
6035
|
+
}
|
|
6030
6036
|
newsState['meta'][staticDataType] = {
|
|
6031
6037
|
...newsState['meta']?.[staticDataType],
|
|
6032
6038
|
[storeSubSection]: {
|
|
@@ -6045,7 +6051,7 @@ const _staticDataReducer$2 = createReducer(initialState$3, on(StaticDataGetList,
|
|
|
6045
6051
|
};
|
|
6046
6052
|
}
|
|
6047
6053
|
return {
|
|
6048
|
-
...state
|
|
6054
|
+
...state
|
|
6049
6055
|
};
|
|
6050
6056
|
}), on(StaticDataDeleteSuccess, (state, action) => {
|
|
6051
6057
|
const { contentType, itemId } = action.payload;
|
|
@@ -6218,7 +6224,7 @@ const _staticDataReducer$2 = createReducer(initialState$3, on(StaticDataGetList,
|
|
|
6218
6224
|
const newState = {
|
|
6219
6225
|
...state,
|
|
6220
6226
|
meta: {
|
|
6221
|
-
...state.meta
|
|
6227
|
+
...state.meta
|
|
6222
6228
|
}
|
|
6223
6229
|
};
|
|
6224
6230
|
contentTypes.forEach(contentType => {
|
|
@@ -6238,7 +6244,7 @@ const _staticDataReducer$2 = createReducer(initialState$3, on(StaticDataGetList,
|
|
|
6238
6244
|
const newState = {
|
|
6239
6245
|
...state,
|
|
6240
6246
|
meta: {
|
|
6241
|
-
...state.meta
|
|
6247
|
+
...state.meta
|
|
6242
6248
|
}
|
|
6243
6249
|
};
|
|
6244
6250
|
contentTypes.forEach(contentType => {
|
|
@@ -6257,7 +6263,7 @@ const _staticDataReducer$2 = createReducer(initialState$3, on(StaticDataGetList,
|
|
|
6257
6263
|
...state,
|
|
6258
6264
|
list: { ...state.list },
|
|
6259
6265
|
meta: {
|
|
6260
|
-
...state.meta
|
|
6266
|
+
...state.meta
|
|
6261
6267
|
}
|
|
6262
6268
|
};
|
|
6263
6269
|
Object.keys(data).forEach(contentType => {
|
|
@@ -6953,6 +6959,15 @@ class StaticDataFacade {
|
|
|
6953
6959
|
}
|
|
6954
6960
|
}));
|
|
6955
6961
|
}
|
|
6962
|
+
updateSuccess(contentType, itemId, data) {
|
|
6963
|
+
this.store.dispatch(StaticDataUpdateSuccess({
|
|
6964
|
+
payload: {
|
|
6965
|
+
contentType,
|
|
6966
|
+
itemId,
|
|
6967
|
+
data
|
|
6968
|
+
}
|
|
6969
|
+
}));
|
|
6970
|
+
}
|
|
6956
6971
|
patchUpdate(formId, contentType, itemId, data, publicApi = false) {
|
|
6957
6972
|
this.store.dispatch(StaticDataPatchUpdate({
|
|
6958
6973
|
payload: {
|
|
@@ -12452,7 +12467,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
12452
12467
|
}] });
|
|
12453
12468
|
|
|
12454
12469
|
class HeadersInterceptor {
|
|
12455
|
-
constructor(authenticationService, routerFacade, usersFacade, formErrorsFacade, formsFacade, filesFacade, publicationMessagesFacade, requestsFacade, notificationsFacade) {
|
|
12470
|
+
constructor(authenticationService, routerFacade, usersFacade, formErrorsFacade, formsFacade, filesFacade, publicationMessagesFacade, requestsFacade, notificationsFacade, staticDataFacade) {
|
|
12456
12471
|
this.authenticationService = authenticationService;
|
|
12457
12472
|
this.routerFacade = routerFacade;
|
|
12458
12473
|
this.usersFacade = usersFacade;
|
|
@@ -12462,12 +12477,14 @@ class HeadersInterceptor {
|
|
|
12462
12477
|
this.publicationMessagesFacade = publicationMessagesFacade;
|
|
12463
12478
|
this.requestsFacade = requestsFacade;
|
|
12464
12479
|
this.notificationsFacade = notificationsFacade;
|
|
12480
|
+
this.staticDataFacade = staticDataFacade;
|
|
12465
12481
|
this.modelAdapter = BaseModelAdapter.createInstance();
|
|
12466
12482
|
}
|
|
12467
12483
|
intercept(request, next) {
|
|
12468
12484
|
return next.handle(request).pipe(tap((response) => {
|
|
12469
12485
|
try {
|
|
12470
12486
|
this.handlePublicationMessagesAndFiles(response);
|
|
12487
|
+
this.updateStaticData(response);
|
|
12471
12488
|
}
|
|
12472
12489
|
catch (e) {
|
|
12473
12490
|
console.error('[ headers.interceptor ][ intercept.tap ]', e);
|
|
@@ -12491,7 +12508,7 @@ class HeadersInterceptor {
|
|
|
12491
12508
|
hasError: true,
|
|
12492
12509
|
isComplete: true,
|
|
12493
12510
|
error: errResponse.error.error,
|
|
12494
|
-
code: errResponse.error.code
|
|
12511
|
+
code: errResponse.error.code
|
|
12495
12512
|
});
|
|
12496
12513
|
}
|
|
12497
12514
|
if (errResponse.error.data?.publicationResult) {
|
|
@@ -12520,6 +12537,18 @@ class HeadersInterceptor {
|
|
|
12520
12537
|
const itemIdOrSlug = +urlParams2[2];
|
|
12521
12538
|
this.requestsFacade.updateRequestData(endPointUrl, httpMethod.toLowerCase(), itemIdOrSlug, RequestStatus.LOADED, secondEndPointUrl, error);
|
|
12522
12539
|
}
|
|
12540
|
+
updateStaticData(response) {
|
|
12541
|
+
try {
|
|
12542
|
+
if (response.body?.meta?.autoAction === 'update-static-data' && response.body.meta?.staticDataType) {
|
|
12543
|
+
if (response.body?.data?.id) {
|
|
12544
|
+
this.staticDataFacade.updateSuccess(response.body.meta.staticDataType, response.body?.data?.id, response.body?.data);
|
|
12545
|
+
}
|
|
12546
|
+
}
|
|
12547
|
+
}
|
|
12548
|
+
catch (e) {
|
|
12549
|
+
console.error('[ headers.interceptor ][ intercept ][ updateStaticData ]', e);
|
|
12550
|
+
}
|
|
12551
|
+
}
|
|
12523
12552
|
handlePublicationMessagesAndFiles(response) {
|
|
12524
12553
|
try {
|
|
12525
12554
|
let allPublicationMessages = [];
|
|
@@ -12625,7 +12654,7 @@ class HeadersInterceptor {
|
|
|
12625
12654
|
list = Object.values(error);
|
|
12626
12655
|
}
|
|
12627
12656
|
list.forEach(errorItem => {
|
|
12628
|
-
const { formId, form_id, field, message, errorMessage, errorCode
|
|
12657
|
+
const { formId, form_id, field, message, errorMessage, errorCode } = errorItem;
|
|
12629
12658
|
const formError = {
|
|
12630
12659
|
formId: formId || form_id,
|
|
12631
12660
|
field,
|
|
@@ -12648,11 +12677,11 @@ class HeadersInterceptor {
|
|
|
12648
12677
|
this.notificationsFacade.showForbiddenError();
|
|
12649
12678
|
}
|
|
12650
12679
|
}
|
|
12651
|
-
HeadersInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HeadersInterceptor, deps: [{ token: AuthenticationService }, { token: RouterFacade }, { token: UsersFacade }, { token: FormErrorsFacade }, { token: FormsFacade }, { token: FilesFacade }, { token: PublicationMessagesFacade }, { token: RequestsFacade }, { token: NotificationsFacade }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
12680
|
+
HeadersInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HeadersInterceptor, deps: [{ token: AuthenticationService }, { token: RouterFacade }, { token: UsersFacade }, { token: FormErrorsFacade }, { token: FormsFacade }, { token: FilesFacade }, { token: PublicationMessagesFacade }, { token: RequestsFacade }, { token: NotificationsFacade }, { token: StaticDataFacade }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
12652
12681
|
HeadersInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HeadersInterceptor });
|
|
12653
12682
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HeadersInterceptor, decorators: [{
|
|
12654
12683
|
type: Injectable
|
|
12655
|
-
}], ctorParameters: function () { return [{ type: AuthenticationService }, { type: RouterFacade }, { type: UsersFacade }, { type: FormErrorsFacade }, { type: FormsFacade }, { type: FilesFacade }, { type: PublicationMessagesFacade }, { type: RequestsFacade }, { type: NotificationsFacade }]; } });
|
|
12684
|
+
}], ctorParameters: function () { return [{ type: AuthenticationService }, { type: RouterFacade }, { type: UsersFacade }, { type: FormErrorsFacade }, { type: FormsFacade }, { type: FilesFacade }, { type: PublicationMessagesFacade }, { type: RequestsFacade }, { type: NotificationsFacade }, { type: StaticDataFacade }]; } });
|
|
12656
12685
|
|
|
12657
12686
|
class JwtInterceptor {
|
|
12658
12687
|
constructor(authenticationService) {
|