@@ -150,7 +150,7 @@ function IntegrationsContent() {
150150 const scrollContainerRef = useRef<HTMLDivElement>(null)
151151 const params = useParams()
152152 const workspaceId = (params?.workspaceId as string) || ''
153- const { integrationAvailability } = usePermissionConfig()
153+ const { integrationAvailability, isBlockPermitted } = usePermissionConfig()
154154
155155 const [{ category: selectedCategory, search: urlSearchTerm }, setIntegrationFilters] =
156156 useQueryStates(integrationsParsers, integrationsUrlKeys)
@@ -205,6 +205,22 @@ function IntegrationsContent() {
205205 })
206206 }, [oauthCredentials])
207207
208+ const permittedFeatured = useMemo(
209+ () => FEATURED_INTEGRATIONS.filter((integration) => isBlockPermitted(integration.type)),
210+ [isBlockPermitted]
211+ )
212+
213+ const permittedCategorySections = useMemo(
214+ () =>
215+ ALL_CATEGORY_SECTIONS.flatMap((section) => {
216+ const integrations = section.integrations.filter((integration) =>
217+ isBlockPermitted(integration.type)
218+ )
219+ return integrations.length > 0 ? [{ label: section.label, integrations }] : []
220+ }),
221+ [isBlockPermitted]
222+ )
223+
208224 const setSelectedCategory = useCallback(
209225 (category: string) => {
210226 setIntegrationFilters({ category })
@@ -215,8 +231,8 @@ function IntegrationsContent() {
215231 const categoryOptions = [
216232 ALL_CATEGORY,
217233 ...(connectedItems.length > 0 ? [CONNECTED_LABEL] : []),
218- FEATURED_LABEL,
219- ...ALL_CATEGORY_SECTIONS .map((section) => section.label),
234+ ...(permittedFeatured.length > 0 ? [ FEATURED_LABEL] : []) ,
235+ ...permittedCategorySections .map((section) => section.label),
220236 ]
221237
222238 const isAllCategorySelected = selectedCategory === ALL_CATEGORY
@@ -234,7 +250,7 @@ function IntegrationsContent() {
234250 integration.description.toLowerCase().includes(normalizedSearch)
235251
236252 if (isFeaturedSelected) {
237- const items = FEATURED_INTEGRATIONS .filter(matchesSearch)
253+ const items = permittedFeatured .filter(matchesSearch)
238254 return items.length > 0 ? [{ label: FEATURED_LABEL, integrations: items }] : []
239255 }
240256
@@ -243,27 +259,22 @@ function IntegrationsContent() {
243259
244260 // Featured is a curated home-row pin: hide it during search so results
245261 // are not duplicated between the Featured section and the category list.
246- const featured = normalizedSearch ? [] : FEATURED_INTEGRATIONS .filter(matchesCategory)
262+ const featured = normalizedSearch ? [] : permittedFeatured .filter(matchesCategory)
247263 const featuredSection =
248264 featured.length > 0 ? [{ label: FEATURED_LABEL, integrations: featured }] : []
249265
250- if (isAllCategorySelected) {
251- const rest = ALL_CATEGORY_SECTIONS.map((section) => ({
266+ const categorySections = permittedCategorySections
267+ .filter((section) => isAllCategorySelected || section.label === selectedCategory)
268+ .map((section) => ({
252269 label: section.label,
253270 integrations: section.integrations.filter(matchesSearch),
254- })).filter((section) => section.integrations.length > 0)
255- return [...featuredSection, ...rest]
256- }
257-
258- const integrations = INTEGRATIONS.filter(matchesCategory)
259- .filter(matchesSearch)
260- .sort((a, b) => a.name.localeCompare(b.name))
271+ }))
272+ .filter((section) => section.integrations.length > 0)
261273
262- return [
263- ...featuredSection,
264- ...(integrations.length > 0 ? [{ label: selectedCategory, integrations }] : []),
265- ]
274+ return [...featuredSection, ...categorySections]
266275 }, [
276+ permittedFeatured,
277+ permittedCategorySections,
267278 isAllCategorySelected,
268279 isConnectedSelected,
269280 isFeaturedSelected,
0 commit comments