@shopgate/engage
Version:
Shopgate's ENGAGE library.
19 lines (17 loc) • 665 B
JavaScript
import _noop from "lodash/noop";
import { createContext } from 'react';
/**
* @callback SetActiveWidget
* @param {string} code The code of the widget to set as active.
* @param {boolean} [highlight=false] Whether to highlight the widget after setting it as active.
*/
/**
* @typedef {Object} WidgetsPreviewContextType
* @property {string} activeWidget The code of the currently active widget.
* @property {SetActiveWidget} setActiveWidget A function to set the active widget code
*/
/** @type {React.Context<WidgetsPreviewContextType>} */
export const WidgetsPreviewContext = /*#__PURE__*/createContext({
activeWidget: null,
setActiveWidget: _noop
});