@@ -124,24 +124,41 @@ class Configuration extends BaseModel {
124124
125125 // Get configuration for a sandbox audit type
126126 getSandboxAuditConfig ( auditType ) {
127- return this . state ?. sandboxAudits ?. enabledAudits ?. [ auditType ] || null ;
127+ return this . getSandboxAudits ( ) ?. enabledAudits ?. [ auditType ] || null ;
128128 }
129129
130130 // Get all enabled sandbox audit types
131131 getEnabledSandboxAudits ( ) {
132- return Object . keys ( this . state ?. sandboxAudits ?. enabledAudits || { } ) ;
132+ return Object . keys ( this . getSandboxAudits ( ) ?. enabledAudits || { } ) ;
133133 }
134134
135135 // Update sandbox audit configuration
136136 updateSandboxAuditConfig ( auditType , config = { } ) {
137- this . state . sandboxAudits = this . state . sandboxAudits || { enabledAudits : { } } ;
138- this . state . sandboxAudits . enabledAudits [ auditType ] = config ;
137+ // eslint-disable-next-line no-console
138+ console . log ( `[Configuration Model] Updating sandbox audit config for ${ auditType } :` , config ) ;
139+ const currentSandboxAudits = this . getSandboxAudits ( ) || { enabledAudits : { } } ;
140+ const updatedSandboxAudits = {
141+ ...currentSandboxAudits ,
142+ enabledAudits : {
143+ ...currentSandboxAudits . enabledAudits ,
144+ [ auditType ] : config
145+ }
146+ } ;
147+ this . setSandboxAudits ( updatedSandboxAudits ) ;
148+ // eslint-disable-next-line no-console
149+ console . log ( `[Configuration Model] Updated sandbox audits:` , updatedSandboxAudits ) ;
139150 }
140151
141152 // Remove a sandbox audit configuration
142153 removeSandboxAuditConfig ( auditType ) {
143- if ( this . state ?. sandboxAudits ?. enabledAudits ) {
144- delete this . state . sandboxAudits . enabledAudits [ auditType ] ;
154+ const currentSandboxAudits = this . getSandboxAudits ( ) ;
155+ if ( currentSandboxAudits ?. enabledAudits ) {
156+ const updatedEnabledAudits = { ...currentSandboxAudits . enabledAudits } ;
157+ delete updatedEnabledAudits [ auditType ] ;
158+ this . setSandboxAudits ( {
159+ ...currentSandboxAudits ,
160+ enabledAudits : updatedEnabledAudits
161+ } ) ;
145162 }
146163 }
147164
0 commit comments