@@ -77,23 +77,25 @@ async function loadFreestylerModule(): Promise<typeof Freestyler> {
7777 return loadedFreestylerModule ;
7878}
7979
80- function isFeatureAvailable ( config ?: Root . Runtime . HostConfig ) : boolean {
80+ function isFreestylerFeatureAvailable ( config ?: Root . Runtime . HostConfig ) : boolean {
8181 return ( config ?. aidaAvailability ?. enabled && config ?. devToolsFreestyler ?. enabled ) === true ;
8282}
8383
8484function isDrJonesNetworkFeatureAvailable ( config ?: Root . Runtime . HostConfig ) : boolean {
85- return ( config ?. aidaAvailability ?. enabled && config ?. devToolsFreestyler ?. enabled &&
86- config ?. devToolsExplainThisResourceDogfood ?. enabled ) === true ;
85+ return ( config ?. aidaAvailability ?. enabled && config ?. devToolsExplainThisResourceDogfood ?. enabled ) === true ;
8786}
8887
8988function isDrJonesPerformanceFeatureAvailable ( config ?: Root . Runtime . HostConfig ) : boolean {
90- return ( config ?. aidaAvailability ?. enabled && config ?. devToolsFreestyler ?. enabled &&
91- config ?. devToolsAiAssistancePerformanceAgentDogfood ?. enabled ) === true ;
89+ return ( config ?. aidaAvailability ?. enabled && config ?. devToolsAiAssistancePerformanceAgentDogfood ?. enabled ) === true ;
9290}
9391
9492function isDrJonesFileFeatureAvailable ( config ?: Root . Runtime . HostConfig ) : boolean {
95- return ( config ?. aidaAvailability ?. enabled && config ?. devToolsFreestyler ?. enabled &&
96- config ?. devToolsAiAssistanceFileAgentDogfood ?. enabled ) === true ;
93+ return ( config ?. aidaAvailability ?. enabled && config ?. devToolsAiAssistanceFileAgentDogfood ?. enabled ) === true ;
94+ }
95+
96+ function isAnyFeatureAvailable ( config ?: Root . Runtime . HostConfig ) : boolean {
97+ return isFreestylerFeatureAvailable ( config ) || isDrJonesNetworkFeatureAvailable ( config ) ||
98+ isDrJonesPerformanceFeatureAvailable ( config ) || isDrJonesFileFeatureAvailable ( config ) ;
9799}
98100
99101UI . ViewManager . registerViewExtension ( {
@@ -105,7 +107,7 @@ UI.ViewManager.registerViewExtension({
105107 isPreviewFeature : true ,
106108 persistence : UI . ViewManager . ViewPersistence . CLOSEABLE ,
107109 hasToolbar : false ,
108- condition : config => isFeatureAvailable ( config ) && ! isPolicyRestricted ( config ) ,
110+ condition : config => isAnyFeatureAvailable ( config ) && ! isPolicyRestricted ( config ) ,
109111 async loadView ( ) {
110112 const Freestyler = await loadFreestylerModule ( ) ;
111113 return Freestyler . FreestylerPanel . instance ( ) ;
@@ -119,7 +121,7 @@ Common.Settings.registerSettingExtension({
119121 title : i18nLazyString ( UIStrings . enableAiAssistance ) ,
120122 defaultValue : false ,
121123 reloadRequired : false ,
122- condition : isFeatureAvailable ,
124+ condition : isAnyFeatureAvailable ,
123125 disabledCondition : config => {
124126 if ( isLocaleRestricted ( ) ) {
125127 return { disabled : true , reason : i18nString ( UIStrings . wrongLocale ) } ;
@@ -147,7 +149,7 @@ UI.ActionRegistration.registerActionExtension({
147149 const Freestyler = await loadFreestylerModule ( ) ;
148150 return new Freestyler . ActionDelegate ( ) ;
149151 } ,
150- condition : config => isFeatureAvailable ( config ) && ! isPolicyRestricted ( config ) ,
152+ condition : config => isFreestylerFeatureAvailable ( config ) && ! isPolicyRestricted ( config ) ,
151153} ) ;
152154
153155UI . ActionRegistration . registerActionExtension ( {
@@ -161,7 +163,7 @@ UI.ActionRegistration.registerActionExtension({
161163 const Freestyler = await loadFreestylerModule ( ) ;
162164 return new Freestyler . ActionDelegate ( ) ;
163165 } ,
164- condition : config => isFeatureAvailable ( config ) && ! isPolicyRestricted ( config ) ,
166+ condition : config => isFreestylerFeatureAvailable ( config ) && ! isPolicyRestricted ( config ) ,
165167} ) ;
166168
167169UI . ActionRegistration . registerActionExtension ( {
0 commit comments