When defining a widget, one of the properties you may choose to set in the widget.json
file is the imports
property. By default, widgets have access to data and functions contained in the common view models (user, cart, site and so on). However, in order for a widget to have access to page-specific view models, those view models must be explicitly defined in the imports
property. The possible values that are acceptable for the imports
property depends on the type of page the widget will be placed on. To determine which page-specific view models your widget can have access to, determine the page type the widget will be placed on and then review the acceptable values for that page type in the following sections.
Note that some page types have no page-specific view models. These include home, order history, article, error, shopper wish list profile, search results, and no search results.