@@ -124,24 +124,41 @@ class Configuration extends BaseModel {
124
124
125
125
// Get configuration for a sandbox audit type
126
126
getSandboxAuditConfig ( auditType ) {
127
- return this . state ?. sandboxAudits ?. enabledAudits ?. [ auditType ] || null ;
127
+ return this . getSandboxAudits ( ) ?. enabledAudits ?. [ auditType ] || null ;
128
128
}
129
129
130
130
// Get all enabled sandbox audit types
131
131
getEnabledSandboxAudits ( ) {
132
- return Object . keys ( this . state ?. sandboxAudits ?. enabledAudits || { } ) ;
132
+ return Object . keys ( this . getSandboxAudits ( ) ?. enabledAudits || { } ) ;
133
133
}
134
134
135
135
// Update sandbox audit configuration
136
136
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 ) ;
139
150
}
140
151
141
152
// Remove a sandbox audit configuration
142
153
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
+ } ) ;
145
162
}
146
163
}
147
164
0 commit comments