@@ -39,38 +39,42 @@ export function canShowAgentsBanner(productService: IProductService): boolean {
3939 && ! ! CommandsRegistry . getCommand ( OPEN_AGENTS_WINDOW_COMMAND ) ;
4040}
4141
42+ export interface IAgentsBannerOptions {
43+ /** Dot-separated CSS classes for the banner container (e.g. 'my-banner' or 'foo.bar'). */
44+ readonly cssClass : string ;
45+ /** Identifies where the banner is displayed (e.g. 'welcomePage', 'agentSessionsWelcome'). */
46+ readonly source : string ;
47+ /** Override the default button label. */
48+ readonly label ?: string ;
49+ /** Optional callback invoked when the banner button is clicked. */
50+ readonly onButtonClick ?: ( ) => void ;
51+ }
52+
4253/**
4354 * Creates a banner that promotes the Agents app.
4455 * The banner contains a button that opens the Agents window.
45- *
46- * @param cssClass Dot-separated CSS classes for the banner container (e.g. 'my-banner' or 'foo.bar').
47- * @param source Identifies where the banner is displayed (e.g. 'welcomePage', 'agentSessionsWelcome').
48- * @param commandService Used to execute the open command.
49- * @param telemetryService Used to log banner interactions.
50- * @param onButtonClick Optional callback invoked when the banner button is clicked.
5156 */
5257export function createAgentsBanner (
53- cssClass : string ,
54- source : string ,
58+ options : IAgentsBannerOptions ,
5559 commandService : ICommandService ,
5660 telemetryService : ITelemetryService ,
57- onButtonClick ?: ( ) => void ,
5861) : IAgentsBannerResult {
5962 const disposables = new DisposableStore ( ) ;
63+ const label = options . label ?? localize ( 'agentsBanner.tryAgentsAppLabel' , "Try out the new Agents app" ) ;
6064
6165 const button = $ ( 'button.agents-banner-button' , {
62- title : localize ( 'agentsBanner.tryAgentsApp' , "Try out the new Agents app" ) ,
66+ title : label ,
6367 } ,
6468 $ ( '.codicon.codicon-agent.icon-widget' ) ,
65- $ ( 'span.category-title' , { } , localize ( 'agentsBanner.tryAgentsAppLabel' , "Try out the new Agents app" ) ) ,
69+ $ ( 'span.category-title' , { } , label ) ,
6670 ) ;
6771 disposables . add ( addDisposableListener ( button , 'click' , ( ) => {
68- onButtonClick ?.( ) ;
69- telemetryService . publicLog2 < AgentsBannerClickedEvent , AgentsBannerClickedClassification > ( 'agentsBanner.clicked' , { source, action : 'openAgentsWindow' } ) ;
72+ options . onButtonClick ?.( ) ;
73+ telemetryService . publicLog2 < AgentsBannerClickedEvent , AgentsBannerClickedClassification > ( 'agentsBanner.clicked' , { source : options . source , action : 'openAgentsWindow' } ) ;
7074 commandService . executeCommand ( OPEN_AGENTS_WINDOW_COMMAND , { forceNewWindow : true } ) ;
7175 } ) ) ;
7276
73- const element = $ ( `.${ cssClass } ` , { } , button ) ;
77+ const element = $ ( `.${ options . cssClass } ` , { } , button ) ;
7478
7579 return { element, disposables } ;
7680}
0 commit comments