import { createHandlerChainRunner, Handler } from "@insite/client-framework/HandlerCreator";
import { sendCartPageViewEvent } from "@insite/client-framework/OdpEvents/CartPageViewEvent";
import { getCurrentPage } from "@insite/client-framework/Store/Data/Pages/PageSelectors";

type HandlerType = Handler;

export const SendCartPageView: HandlerType = props => {
    const page = getCurrentPage(props.getState());
    sendCartPageViewEvent(page, props.getState());
};

export const chain = [SendCartPageView];

const sendCartPageView = createHandlerChainRunner(chain, "SendCartPageView");
export default sendCartPageView;
