Home > widget-integration > PredictiveBundleModule

PredictiveBundleModule class

Wires predictive bundle blocks into TAE and bridges the legacy global open event.

Override this module to customize block discovery, controller connection, or validation of externally dispatched bundle payloads before the modal opens.

Signature:

export declare class PredictiveBundleModule 

Example

export class CustomPredictiveBundleModule extends PredictiveBundleModule {
  protected normalizeOpenEventBundleData(bundleData: unknown, expectedWidgetId: string) {
    const normalized = super.normalizeOpenEventBundleData(bundleData, expectedWidgetId);
    if (!normalized) {
      return undefined;
    }

    return {
      ...normalized,
      recommendation_type: normalized.recommendation_type || 'shop-custom',
    };
  }
}

Constructors

Constructor

Modifiers

Description

(constructor)(moduleRef, appService, platformLoader)

Constructs a new instance of the PredictiveBundleModule class

Properties

Methods

Method

Modifiers

Description

connectWidget(widget, block)

Connects a predictive bundle controller to a registered block.

destroy()

Removes global listeners and destroys tracked controllers.

Safe to call multiple times during custom module teardown.

getController()

Returns the most recently resolved predictive bundle controller.

handleBlockInitError(error, block)

protected

Logs initialization failures without breaking other widgets.

isOpenEventProductCandidate(product)

protected

normalizeOpenEventBundleData(bundleData, expectedWidgetId)

protected

Normalizes bundle payloads coming from the global open event bridge.

Override to accept additional payload fields or custom product metadata.

onInitBlock(block)

Initializes predictive bundle behavior for product-page blocks.

onInitInstantSearchBlock(block)

Initializes predictive bundle behavior for instant-search blocks.

parseWidgetId(blockId)

protected

Extracts a widget id from the TAE block id convention.

registerController(controller)

protected

renderBlocksForProductPage(productId, blockType)

resolveController()

protected

setupBlockListener()

Registers TAE block listeners for predictive bundle and instant search surfaces.