@@ -6,11 +6,8 @@ import { ArrowRight } from '@sim/emcn/icons'
66import { HomeSection } from '@/components/home/home-section'
77import { SettingsGuardedLink } from '@/components/settings/settings-guarded-link'
88import { OAUTH_SEARCH_READ_SCOPE , oauthScopeSatisfies } from '@/lib/auth/oauth-provider'
9+ import { hasSearchIntegrationReady } from '@/lib/credential-groups/member-integrations'
910import { organizationRoutes } from '@/lib/navigation/paths'
10- import {
11- liveSearchProviderForCredential ,
12- supportsLiveSearchMode ,
13- } from '@/lib/sim-search/live/provider-catalog'
1411import { useOrganizationContext } from '@/app/o/[organizationId]/providers/organization-provider'
1512import { useAuthorizedApps } from '@/hooks/queries/oauth-provider'
1613import { useOrganizationAccounts } from '@/hooks/queries/organization-accounts'
@@ -94,63 +91,14 @@ export function GetStarted() {
9491 authorizedApps ?. pages . some ( ( page ) =>
9592 page . apps . some ( ( app ) => oauthScopeSatisfies ( app . scopes , OAUTH_SEARCH_READ_SCOPE ) )
9693 ) ?? false
97- const approvedProviders = new Set (
98- integrations
99- ?. filter ( ( integration ) => integration . approved && integration . available !== false )
100- . map ( ( integration ) => integration . connectorType )
101- )
102- const readyOptions = new Set (
103- accounts ?. credentialGroup ?. options
104- . filter ( ( option ) => {
105- const provider = liveSearchProviderForCredential ( option . provider )
106- return (
107- option . status === 'active' &&
108- option . configurationStatus === 'ready' &&
109- provider &&
110- supportsLiveSearchMode ( provider , 'member' ) &&
111- approvedProviders . has ( provider )
112- )
113- } )
114- . map ( ( option ) => option . id )
115- )
116- const readyMcpServers = new Set (
117- accounts ?. credentialGroup ?. mcpServers
118- . filter ( ( server ) => {
119- const provider = liveSearchProviderForCredential ( `mcp:${ server . managedConnectorId } ` )
120- return (
121- server . enabled &&
122- provider &&
123- approvedProviders . has ( provider ) &&
124- accounts . availableMcpConnectors . some ( ( id ) => id === server . managedConnectorId )
125- )
126- } )
127- . map ( ( server ) => server . id )
128- )
129- const hasSearchConnection =
130- accounts ?. credentialGroup ?. status === 'active' &&
131- ( accounts . viewerAccounts ?. some (
132- ( account ) => account . status === 'active' && readyOptions . has ( account . optionId )
133- ) ||
134- accounts . viewerMcpAccounts ?. some (
135- ( account ) => account . status === 'active' && readyMcpServers . has ( account . mcpServerId )
136- ) )
137-
13894 const hrefs : Record < StepId , string > = {
13995 'connect-integration' : viewer . isAdmin
14096 ? routes . settingsSection ( 'integrations' )
14197 : routes . integrations ,
14298 'connect-sim-search' : routes . settingsSection ( 'search-mcp' ) ,
14399 }
144100 const completed : Record < StepId , boolean > = {
145- 'connect-integration' : Boolean (
146- hasSearchConnection ||
147- integrations ?. some (
148- ( integration ) =>
149- integration . approved &&
150- integration . available !== false &&
151- integration . configuredServiceSource
152- )
153- ) ,
101+ 'connect-integration' : hasSearchIntegrationReady ( accounts , integrations ) ,
154102 'connect-sim-search' : hasSearchAuthorization ,
155103 }
156104 const steps = STEPS . filter ( ( step ) =>
0 commit comments