@@ -6,6 +6,7 @@ import React, { useMemo, useState } from "react";
66import { z } from "zod" ;
77
88import AgentPreview from "./AgentPreview" ;
9+ import { AgentMonetizationSummary } from "./AgentMonetizationSummary" ;
910
1011import { Button } from "@/components/ui/button" ;
1112import {
@@ -28,6 +29,7 @@ import {
2829 useKnowledgeBaseOptionsQuery ,
2930} from "@/data/options" ;
3031import { AgentConfigSchema } from "@/lib/schemas/agent" ;
32+ import { getAgentUsageProfile } from "@/lib/agents/monetization" ;
3133import {
3234 Tooltip ,
3335 TooltipContent ,
@@ -247,6 +249,26 @@ export default function AgentModal(props: {
247249 const monetizationEnabled = isCreate
248250 ? Boolean ( form . watch ( "monetize" as any ) )
249251 : false ;
252+ const roleValue = isCreate
253+ ? ( form . watch ( "role" as any ) as string | undefined )
254+ : undefined ;
255+ const multiplierValueRaw = isCreate
256+ ? form . watch ( "rateMultiplier" as any )
257+ : undefined ;
258+ const multiplierValue = Number ( multiplierValueRaw ?? 1 ) || 1 ;
259+ const usageProfile = React . useMemo (
260+ ( ) => getAgentUsageProfile ( roleValue ) ,
261+ [ roleValue ] ,
262+ ) ;
263+ const currencyFormatter = React . useMemo (
264+ ( ) =>
265+ new Intl . NumberFormat ( "en-US" , {
266+ style : "currency" ,
267+ currency : usageProfile . currency ,
268+ maximumFractionDigits : 2 ,
269+ } ) ,
270+ [ usageProfile . currency ] ,
271+ ) ;
250272
251273 const fields = useMemo ( ( ) => {
252274 const base : FieldsConfig < Record < string , unknown > > & Record < string , any > = {
@@ -423,14 +445,25 @@ export default function AgentModal(props: {
423445 } ;
424446
425447 if ( isCreate ) {
426- base . monetize = { label : "Enable Monetization" } ;
448+ const baseRateText = currencyFormatter . format ( usageProfile . baseAmount ) ;
449+ base . monetize = {
450+ label : "Enable Monetization" ,
451+ widget : "switch" ,
452+ helpText : monetizationEnabled
453+ ? "Monetized agents become eligible for payouts."
454+ : "Switch on to price this agent and enable payouts." ,
455+ } ;
427456 base . rateMultiplier = {
428457 label : "Rate Multiplier" ,
429458 widget : "select" ,
430459 options : RATE_MULTIPLIER_OPTIONS ,
431460 placeholder : monetizationEnabled
432461 ? undefined
433462 : "Enable monetization first" ,
463+ disabled : ! monetizationEnabled ,
464+ helpText : monetizationEnabled
465+ ? `Applies to the ${ usageProfile . label . toLowerCase ( ) } base of ${ baseRateText } .`
466+ : `Current base for ${ usageProfile . label . toLowerCase ( ) } : ${ baseRateText } .` ,
434467 } ;
435468 }
436469
@@ -442,6 +475,9 @@ export default function AgentModal(props: {
442475 mcpServerOptions ,
443476 monetizationEnabled ,
444477 isCreate ,
478+ currencyFormatter ,
479+ usageProfile . baseAmount ,
480+ usageProfile . label ,
445481 ] ) ;
446482
447483 return (
@@ -506,8 +542,9 @@ export default function AgentModal(props: {
506542 </ TooltipTrigger >
507543 < TooltipContent >
508544 < p className = "max-w-xs text-xs" >
509- To monetize your agent, multiply by the current base
510- agent rate.
545+ { `Base ${ usageProfile . label . toLowerCase ( ) } rate: ${ currencyFormatter . format (
546+ usageProfile . baseAmount ,
547+ ) } . Multipliers scale your payout per active session.`}
511548 </ p >
512549 </ TooltipContent >
513550 </ Tooltip >
@@ -559,6 +596,13 @@ export default function AgentModal(props: {
559596 onOpenChange ( false ) ;
560597 } }
561598 />
599+ { isCreate && (
600+ < AgentMonetizationSummary
601+ enabled = { monetizationEnabled }
602+ multiplier = { multiplierValue }
603+ profile = { usageProfile }
604+ />
605+ ) }
562606 </ >
563607 ) }
564608 </ div >
0 commit comments