1- import { from as observableFrom , Observable , merge , Subject } from 'rxjs' ;
1+ import { Observable , Subject , merge , from as observableFrom } from 'rxjs' ;
22
33import { Component , OnDestroy , inject , signal } from '@angular/core' ;
44import { ActivatedRoute , Params } from '@angular/router' ;
55
6- import { reduce , mergeMap , take , map , filter , takeUntil } from 'rxjs/operators' ;
6+ import { filter , map , mergeMap , reduce , take , takeUntil } from 'rxjs/operators' ;
77
88import { CwError , HttpCode , LoggerService } from '@dotcms/dotcms-js' ;
99
@@ -12,28 +12,28 @@ import { BundleService, IPublishEnvironment } from '../../../services/api/bundle
1212import { ConditionService } from '../../../services/api/condition/Condition' ;
1313import { ConditionGroupService } from '../../../services/api/condition-group/ConditionGroup' ;
1414import {
15- RuleModel ,
16- RuleService ,
15+ ActionModel ,
1716 ConditionGroupModel ,
1817 ConditionModel ,
19- ActionModel
18+ RuleModel ,
19+ RuleService
2020} from '../../../services/api/rule/Rule' ;
2121import { ServerSideTypeModel } from '../../../services/api/serverside-field/ServerSideFieldModel' ;
2222import {
23- RuleActionEvent ,
24- RuleActionActionEvent ,
23+ ConditionActionEvent ,
2524 ConditionGroupActionEvent ,
26- ConditionActionEvent
25+ RuleActionActionEvent ,
26+ RuleActionEvent
2727} from '../../../services/models/rule-event.model' ;
2828import { RuleViewService } from '../../../services/ui/dot-view-rule-service' ;
2929import { DotRuleEngineComponent } from '../dot-rule-engine.component' ;
3030
3131// Re-export for backward compatibility
3232export {
33- RuleActionEvent ,
34- RuleActionActionEvent ,
33+ ConditionActionEvent ,
3534 ConditionGroupActionEvent ,
36- ConditionActionEvent
35+ RuleActionActionEvent ,
36+ RuleActionEvent
3737} from '../../../services/models/rule-event.model' ;
3838
3939/**
@@ -95,11 +95,9 @@ export class DotRuleEngineContainerComponent implements OnDestroy {
9595 } ) ;
9696
9797 this . _ruleService . _errors$ . subscribe ( ( res ) => {
98- this . ruleViewService . showErrorMessage (
99- res . message ,
100- false ,
101- res . response . headers . get ( 'error-key' )
102- ) ;
98+ const message = ( res . error ?. message || '' ) . replace ( / u s e r - \S + / gi, '' ) ;
99+ const errorKey = res . headers ?. get ( 'error-key' ) ?? '' ;
100+ this . ruleViewService . showErrorMessage ( message , false , errorKey ) ;
103101 this . loading . set ( false ) ;
104102 this . showRules . set ( false ) ;
105103 } ) ;
@@ -710,14 +708,18 @@ export class DotRuleEngineContainerComponent implements OnDestroy {
710708 this . loading . set ( false ) ;
711709 }
712710
713- private _handle403Error ( e : CwError ) : boolean {
711+ private _handle403Error ( e ) : boolean {
714712 let handled = false ;
713+
715714 try {
716- if ( e && e . response . status === HttpCode . FORBIDDEN ) {
717- const errorJson = e . response ;
715+ if ( e && e ?. status === HttpCode . FORBIDDEN ) {
716+ const errorJson = e . error ;
717+
718718 if ( errorJson && errorJson . error ) {
719719 this . ruleViewService . showErrorMessage (
720- errorJson . error . message . replace ( 'dotcms.api.error.forbidden: ' , '' )
720+ errorJson . error
721+ . replace ( 'dotcms.api.error.forbidden: ' , '' )
722+ . replace ( / u s e r - \S + / gi, '' )
721723 ) ;
722724 handled = true ;
723725 }
0 commit comments