wt-front-shared 1.0.57 → 1.0.58

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.
@@ -6953,6 +6953,15 @@ class StaticDataFacade {
6953
6953
  }
6954
6954
  }));
6955
6955
  }
6956
+ updateSuccess(contentType, itemId, data) {
6957
+ this.store.dispatch(StaticDataUpdateSuccess({
6958
+ payload: {
6959
+ contentType,
6960
+ itemId,
6961
+ data
6962
+ }
6963
+ }));
6964
+ }
6956
6965
  patchUpdate(formId, contentType, itemId, data, publicApi = false) {
6957
6966
  this.store.dispatch(StaticDataPatchUpdate({
6958
6967
  payload: {
@@ -12452,7 +12461,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
12452
12461
  }] });
12453
12462
 
12454
12463
  class HeadersInterceptor {
12455
- constructor(authenticationService, routerFacade, usersFacade, formErrorsFacade, formsFacade, filesFacade, publicationMessagesFacade, requestsFacade, notificationsFacade) {
12464
+ constructor(authenticationService, routerFacade, usersFacade, formErrorsFacade, formsFacade, filesFacade, publicationMessagesFacade, requestsFacade, notificationsFacade, staticDataFacade) {
12456
12465
  this.authenticationService = authenticationService;
12457
12466
  this.routerFacade = routerFacade;
12458
12467
  this.usersFacade = usersFacade;
@@ -12462,12 +12471,14 @@ class HeadersInterceptor {
12462
12471
  this.publicationMessagesFacade = publicationMessagesFacade;
12463
12472
  this.requestsFacade = requestsFacade;
12464
12473
  this.notificationsFacade = notificationsFacade;
12474
+ this.staticDataFacade = staticDataFacade;
12465
12475
  this.modelAdapter = BaseModelAdapter.createInstance();
12466
12476
  }
12467
12477
  intercept(request, next) {
12468
12478
  return next.handle(request).pipe(tap((response) => {
12469
12479
  try {
12470
12480
  this.handlePublicationMessagesAndFiles(response);
12481
+ this.updateStaticData(response);
12471
12482
  }
12472
12483
  catch (e) {
12473
12484
  console.error('[ headers.interceptor ][ intercept.tap ]', e);
@@ -12491,7 +12502,7 @@ class HeadersInterceptor {
12491
12502
  hasError: true,
12492
12503
  isComplete: true,
12493
12504
  error: errResponse.error.error,
12494
- code: errResponse.error.code,
12505
+ code: errResponse.error.code
12495
12506
  });
12496
12507
  }
12497
12508
  if (errResponse.error.data?.publicationResult) {
@@ -12520,6 +12531,18 @@ class HeadersInterceptor {
12520
12531
  const itemIdOrSlug = +urlParams2[2];
12521
12532
  this.requestsFacade.updateRequestData(endPointUrl, httpMethod.toLowerCase(), itemIdOrSlug, RequestStatus.LOADED, secondEndPointUrl, error);
12522
12533
  }
12534
+ updateStaticData(response) {
12535
+ try {
12536
+ if (response.body?.meta?.autoAction === 'update-static-data' && response.body.meta?.staticDataType) {
12537
+ if (response.body?.data?.id) {
12538
+ this.staticDataFacade.updateSuccess(response.body.meta.staticDataType, response.body?.data?.id, response.body?.data);
12539
+ }
12540
+ }
12541
+ }
12542
+ catch (e) {
12543
+ console.error('[ headers.interceptor ][ intercept ][ updateStaticData ]', e);
12544
+ }
12545
+ }
12523
12546
  handlePublicationMessagesAndFiles(response) {
12524
12547
  try {
12525
12548
  let allPublicationMessages = [];
@@ -12625,7 +12648,7 @@ class HeadersInterceptor {
12625
12648
  list = Object.values(error);
12626
12649
  }
12627
12650
  list.forEach(errorItem => {
12628
- const { formId, form_id, field, message, errorMessage, errorCode, } = errorItem;
12651
+ const { formId, form_id, field, message, errorMessage, errorCode } = errorItem;
12629
12652
  const formError = {
12630
12653
  formId: formId || form_id,
12631
12654
  field,
@@ -12648,11 +12671,11 @@ class HeadersInterceptor {
12648
12671
  this.notificationsFacade.showForbiddenError();
12649
12672
  }
12650
12673
  }
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 });
12674
+ 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
12675
  HeadersInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HeadersInterceptor });
12653
12676
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HeadersInterceptor, decorators: [{
12654
12677
  type: Injectable
12655
- }], ctorParameters: function () { return [{ type: AuthenticationService }, { type: RouterFacade }, { type: UsersFacade }, { type: FormErrorsFacade }, { type: FormsFacade }, { type: FilesFacade }, { type: PublicationMessagesFacade }, { type: RequestsFacade }, { type: NotificationsFacade }]; } });
12678
+ }], ctorParameters: function () { return [{ type: AuthenticationService }, { type: RouterFacade }, { type: UsersFacade }, { type: FormErrorsFacade }, { type: FormsFacade }, { type: FilesFacade }, { type: PublicationMessagesFacade }, { type: RequestsFacade }, { type: NotificationsFacade }, { type: StaticDataFacade }]; } });
12656
12679
 
12657
12680
  class JwtInterceptor {
12658
12681
  constructor(authenticationService) {