@@ -13,15 +13,13 @@ import {
1313} from '@sim/emcn'
1414import { useParams } from 'next/navigation'
1515import { useQueryStates } from 'nuqs'
16- import { getServiceAccountGatingBlockType } from '@/lib/credentials/service-account-provider-ids'
1716import {
1817 blockTypeToIconMap ,
1918 formatIntegrationType ,
2019 INTEGRATIONS ,
2120 type Integration ,
2221 resolveCredentialDisplay ,
2322} from '@/lib/integrations'
24- import { getServiceAccountMetadata } from '@/lib/integrations/service-account-metadata'
2523import { IntegrationSection } from '@/app/workspace/[workspaceId]/integrations/components/integration-section'
2624import { IntegrationTabsHeader } from '@/app/workspace/[workspaceId]/integrations/components/integration-tabs-header'
2725import { IntegrationTile } from '@/app/workspace/[workspaceId]/integrations/components/integrations-showcase'
@@ -36,8 +34,6 @@ import {
3634} from '@/app/workspace/[workspaceId]/integrations/search-params'
3735import { SettingsEmptyState } from '@/app/workspace/[workspaceId]/settings/components/settings-empty-state'
3836import { SettingsResourceRow } from '@/app/workspace/[workspaceId]/settings/components/settings-resource-row'
39- import { useCustomBlockOverlayVersion } from '@/blocks/custom/client-overlay'
40- import { overlayVisibility } from '@/blocks/visibility/context'
4137import { useWorkspaceCredentials , type WorkspaceCredential } from '@/hooks/queries/credentials'
4238import { useDebouncedSearchSetter } from '@/hooks/use-debounced-search-setter'
4339import { usePermissionConfig } from '@/hooks/use-permission-config'
@@ -66,31 +62,6 @@ const ALL_CATEGORY_SECTIONS: readonly { label: string; integrations: Integration
6662 } ) ) . sort ( ( a , b ) => a . label . localeCompare ( b . label ) )
6763} ) ( )
6864
69- /** Resolves preview-gated service-account paths revealed for the current viewer. */
70- function useRevealedServiceAccountIntegrationTypes ( ) : ReadonlySet < string > {
71- const overlayVersion = useCustomBlockOverlayVersion ( )
72- return useMemo ( ( ) => {
73- const visibility = overlayVisibility ( )
74- return new Set (
75- INTEGRATIONS . flatMap ( ( integration ) => {
76- if ( ! integration . oauthServiceId ) return [ ]
77- const metadata = getServiceAccountMetadata ( integration . oauthServiceId )
78- if ( metadata ?. deploymentRequirement !== 'preview-gated' ) return [ ]
79- const gatingBlockType = getServiceAccountGatingBlockType ( metadata . providerId )
80- if ( ! gatingBlockType ) {
81- throw new Error (
82- `Preview-gated service account ${ metadata . providerId } has no gating block type`
83- )
84- }
85- return visibility ?. revealed . has ( gatingBlockType ) &&
86- ! visibility . disabled . has ( gatingBlockType )
87- ? [ integration . type . toLowerCase ( ) ]
88- : [ ]
89- } )
90- )
91- } , [ overlayVersion ] )
92- }
93-
9465interface IntegrationItemProps {
9566 blockType : string
9667 slug : string
@@ -167,7 +138,6 @@ export function Integrations() {
167138 const params = useParams ( )
168139 const workspaceId = ( params ?. workspaceId as string ) || ''
169140 const { integrationAvailability } = usePermissionConfig ( )
170- const revealedServiceAccountIntegrationTypes = useRevealedServiceAccountIntegrationTypes ( )
171141
172142 const [ { category : selectedCategory , search : urlSearchTerm } , setIntegrationFilters ] =
173143 useQueryStates ( integrationsParsers , integrationsUrlKeys )
@@ -379,9 +349,6 @@ export function Integrations() {
379349 const availability = integrationAvailability . get ( integration . type . toLowerCase ( ) )
380350 const deploymentUnavailable =
381351 availability ?. state === 'unavailable' || availability ?. state === 'misconfigured'
382- const previewServiceAccountAvailable = revealedServiceAccountIntegrationTypes . has (
383- integration . type . toLowerCase ( )
384- )
385352 return (
386353 < IntegrationItem
387354 key = { integration . type }
@@ -391,11 +358,7 @@ export function Integrations() {
391358 name = { integration . name }
392359 description = { integration . description }
393360 icon = { Icon }
394- unavailable = {
395- integration . authType === 'oauth' &&
396- ! previewServiceAccountAvailable &&
397- deploymentUnavailable
398- }
361+ unavailable = { integration . authType === 'oauth' && deploymentUnavailable }
399362 />
400363 )
401364 } ) }
0 commit comments