Home > widget-integration > FilterModule

FilterModule class

Filter widget module for Widget Integration.

Manages the initialization, registration, and lifecycle of filter widgets on collection and search pages. Handles widget connection with TAE framework and dependency injection for all filter-related services.

Signature:

export declare class FilterModule 

Remarks

This module is registered with the TAE framework and automatically initializes filter widgets when filter blocks are detected. It provides all filter services, helpers, and controllers through dependency injection.

Technical Support teams typically don't extend this module directly. Instead, extend the individual services (FilterAPI, FilterHandler, FilterHelper) exported by this module.

Example

Access filter services in custom code:

// Get FilterAPI instance from module
const filterAPI = moduleRef.get('FilterAPI');

// Extend FilterAPI for shop-specific customization
window.boostWidgetIntegration.extend('FilterAPI', (FilterAPI) => {
  return class CustomFilterAPI extends FilterAPI {
    // Custom implementation
  };
});

Constructors

Constructor

Modifiers

Description

(constructor)(moduleRef, appService)

Creates a new FilterModule instance.

Initializes the filter module and sets up block listeners to automatically detect and initialize filter widgets when they are registered with TAEApp.

Properties

Property

Modifiers

Type

Description

appService

protected

AppService

moduleRef

protected

ModuleRefImpl

Methods

Method

Modifiers

Description

connectWidget(widget, block)

protected

Connects a FilterController widget with an AppBlock configuration.

Extracts filter-specific properties from the block and passes them to the widget's connect method. This establishes the widget's initial state and configuration.

handleBlockInitError(error, block)

protected

Handles errors during filter block initialization.

Logs initialization errors to the console without throwing, preventing one failed widget from breaking other widgets or the application.

onInitBlock(block)

protected

Initializes a filter widget block.

Called when a new filter block is registered with TAEApp. Validates the block has a valid DOM context, resolves the FilterController from dependency injection, and connects the widget with the block configuration.

setupBlockListener()

protected

Sets up listener for filter block registration with TAEApp.

Registers a callback that triggers when TAEApp detects a new block. Filters for blocks with blockType 'filter' and initializes them.