Home > widget-integration > PredictiveBundleStateService

PredictiveBundleStateService class

Stores transient predictive bundle UI state shared across bundle surfaces.

Keep overrides lightweight and prefer clearing state when a custom flow no longer needs cached bundle data.

Signature:

export declare class PredictiveBundleStateService 

Properties

Property

Modifiers

Type

Description

activeBlockType

string

bundleDataCache

Map<string, PredictiveBundleData>

defaultBlockType

protected

readonly

(not declared)

focusRestoreTargets

Map<PredictiveBundleFocusRestoreKey, string>

openingWidgetId

string | null

Methods

Method

Modifiers

Description

clear()

Clears all cached bundle and focus state.

clearBundleData(widgetId)

Removes cached state for a single widget.

clearFocusRestoreTargets()

Clears all saved focus restore targets.

getActiveBlockType()

Returns the last active block type.

getBundleData(widgetId)

Reads cached bundle state for a widget.

getBundleDataWithPopupState(widgetId, isPopupOpening)

Returns cached bundle state while forcing popup-open state.

getFocusRestoreTarget(key)

Reads a focus restore target.

getOpeningWidgetId()

Returns the widget id currently associated with the modal surface.

setActiveBlockType(blockType)

Tracks the most recent block type driving bundle interactions.

setBundleData(widgetId, data)

Caches bundle state for a widget.

setFocusRestoreTarget(key, elementId)

Stores the element id that should receive focus after a rerender.

setOpeningWidgetId(widgetId)

Tracks the widget currently controlling the modal surface.