import { createHandlerChainRunner, Handler } from "@insite/client-framework/HandlerCreator";

type HandlerType = Handler<{
    isOpen: boolean;
    isBillTo?: boolean;
}>;

export const DispatchSetIsOpen: HandlerType = ({ dispatch, parameter: { isOpen, isBillTo } }) => {
    dispatch({
        type: "Components/AddressBookOverlay/SetAddressBookOverlayIsOpen",
        isOpen,
        isBillTo,
    });
};

export const chain = [DispatchSetIsOpen];

const setAddressBookOverlayIsOpen = createHandlerChainRunner(chain, "SetAddressBookOverlayIsOpen");
export default setAddressBookOverlayIsOpen;
