@shopgate/engage
Version:
Shopgate's ENGAGE library.
8 lines • 658 B
JavaScript
import{useRoute}from"./useRoute";import{getWidgetConfig}from"../config/getWidgetConfig";/**
* Retrieves the pure config for widget by its id and optional index on the current page.
* See documentation of `getWidgetConfig` for further details.
*
* @param {string} widgetId The id of the widget to look for, which must exist in the config.
* @param {number|undefined} [index=0] The optional index of the widget.
* @returns {Object}
*/export function useWidgetConfig(widgetId){var index=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var _useRoute=useRoute(),pagePattern=_useRoute.pattern;return getWidgetConfig(pagePattern,widgetId,index);}