@@ -162,19 +162,21 @@ export const Chat = ({
162162 } = useChatState ( )
163163
164164 const { statusMessage } = useClipboard ( )
165- const { ad } = useGravityAd ( )
165+
166+ // Fetch subscription data early - needed for session credits tracking and ad gating
167+ const { data : subscriptionData } = useSubscriptionQuery ( {
168+ refetchInterval : 60 * 1000 ,
169+ } )
170+ const hasSubscription = subscriptionData ?. hasSubscription ?? false
171+
172+ const { ad } = useGravityAd ( { enabled : ! hasSubscription } )
166173 const [ adsManuallyDisabled , setAdsManuallyDisabled ] = useState ( false )
167174
168175 const handleDisableAds = useCallback ( ( ) => {
169176 handleAdsDisable ( )
170177 setAdsManuallyDisabled ( true )
171178 } , [ ] )
172179
173- // Fetch subscription data early - needed for session credits tracking
174- const { data : subscriptionData } = useSubscriptionQuery ( {
175- refetchInterval : 60 * 1000 ,
176- } )
177-
178180 // Set initial mode from CLI flag on mount
179181 useEffect ( ( ) => {
180182 if ( initialMode ) {
@@ -221,16 +223,17 @@ export const Chat = ({
221223 const loadedSkills = useMemo ( ( ) => getLoadedSkills ( ) , [ ] )
222224
223225 // Filter slash commands based on current ads state - only show the option that changes state
226+ // Hide both ads commands entirely for subscribers
224227 // Also merge in skill commands
225228 const filteredSlashCommands = useMemo ( ( ) => {
226229 const adsEnabled = getAdsEnabled ( )
227230 const allCommands = getSlashCommandsWithSkills ( loadedSkills )
228231 return allCommands . filter ( ( cmd ) => {
229- if ( cmd . id === 'ads:enable' ) return ! adsEnabled
230- if ( cmd . id === 'ads:disable' ) return adsEnabled
232+ if ( cmd . id === 'ads:enable' ) return ! hasSubscription && ! adsEnabled
233+ if ( cmd . id === 'ads:disable' ) return ! hasSubscription && adsEnabled
231234 return true
232235 } )
233- } , [ inputValue , loadedSkills ] ) // Re-evaluate when input changes (user may have just toggled)
236+ } , [ inputValue , loadedSkills , hasSubscription ] ) // Re-evaluate when input changes (user may have just toggled)
234237
235238 const {
236239 slashContext,
0 commit comments