Home > widget-integration > PredictiveBundleController
PredictiveBundleController class
Manages predictive bundle rendering, modal behavior, and interaction handling.
Override public methods in this controller to customize modal opening behavior, rendering hooks, or interaction responses without replacing the full module.
Signature:
export declare class PredictiveBundleController extends Controller<PredictiveBundleControllerProps>
Extends: Controller<PredictiveBundleControllerProps>
Example
window.boostWidgetIntegration.extend('PredictiveBundleController', (PredictiveBundleController) => {
return class extends PredictiveBundleController {
notifyAfterRender(payload) {
window.dispatchEvent(new CustomEvent('shop:predictive-bundle:after-render', {
detail: payload,
}));
super.notifyAfterRender(payload);
}
};
});
Constructors
|
Constructor |
Modifiers |
Description |
|---|---|---|
|
Constructs a new instance of the |
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
Set<HTMLElement> | ||
|
string | |||
|
FocusTrapService | |||
|
|
Map<string, HTMLElement> |
Maps widgetId → the DOM element that was passed to renderPreparedBundle as targetElement. | |
|
Map<string, () => void> | |||
|
ModalSurfaceService | |||
|
NavigationHelper | |||
|
|
Set<string> | ||
|
string | |||
|
|
WeakMap<HTMLElement, RootBindingRecord> | ||
|
DOMActionRuntime | |||
|
Signal<PredictiveBundleControllerState> | |||
|
WCAGHelper |
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
Activates a focus trap for the provided modal surface. | ||
|
Adds the selected bundle products to cart. | ||
|
Binds delegated click and keyboard handlers to a bundle root. Override | ||
|
|
Removes delegated listeners registered by this controller instance. | |
|
|
Clears all focus trap cleanups registered by this controller instance. | |
|
|
Clears controller-owned widget state from the shared state service. | |
|
Closes all currently open predictive bundle dropdowns. | ||
|
Closes the predictive bundle modal surface. | ||
|
Closes the predictive bundle modal and restores focus when appropriate. | ||
|
Connects the controller to a predictive bundle root element. | ||
|
Releases bound roots, focus traps, and controller-owned bundle state. | ||
|
Ensures delegated handlers are attached to the shared modal surface. | ||
|
Finds an element by id within a root node. | ||
|
Resolves the active block type, preferring an explicit value when provided. | ||
|
Reads cached bundle data for a widget. | ||
|
|
Returns click actions delegated from a predictive bundle root. Override to add or replace click behavior for shop-specific integrations. | |
|
Resolves the widget and wrapper associated with a user interaction. | ||
|
|
Returns keyboard actions delegated from a predictive bundle root. Override to adjust keyboard interactions without rewriting | |
|
Builds the DOM id used for the modal surface. | ||
|
Resolves or creates the modal surface for the active block type. | ||
|
Resolves the inline target that should receive bundle updates. | ||
|
Opens the modal from an embedded bundle click target. | ||
|
Handles keyboard navigation for variant combobox interactions. | ||
|
Opens a dropdown in response to keyboard activation. | ||
|
Handles inline trigger clicks that should open the predictive bundle modal. | ||
|
Dispatches the legacy after-render event bridge for bundle integrations. | ||
|
Opens the predictive bundle modal and focuses the first interactive element. | ||
|
Opens the predictive bundle modal for a widget. | ||
|
|
Calculates bundle state and renders markup once so it can be reused across multiple targets. | |
|
Positions the shared modal surface for the active block context. | ||
|
Produces HTML for a predictive bundle template. | ||
|
renderOneBundleByTargetElement(targetElement, bundle, blockType) |
Renders a single predictive bundle into a target element. | |
|
Renders predictive bundle blocks on a product page. | ||
|
renderPredictiveBundleWithData(widgetId, bundleData, wrapper, templateName, blockType, callback) |
Renders bundle markup into either the modal wrapper or an inline target. | |
|
|
Applies pre-rendered bundle markup to a target element. | |
|
renderRecommendationForSearchPage(predictiveBundles, blockType) |
Renders predictive bundles on search and embedded bundle surfaces. | |
|
Restores keyboard focus after a bundle rerender. | ||
|
|
Selects the highest-priority bundle for the bottom layout position from a raw bundle list. Priority rules (applied in order): 1. Bundles with Override to apply shop-specific priority or filtering. | |
|
Updates bundle state after a variant selection. | ||
|
Stores bundle data and tracks ownership for later cleanup. | ||
|
Toggles product selection inside a predictive bundle. | ||
|
Toggles the variant dropdown associated with an interaction target. |