import { wpjEvent } from '@assets/components/util.event';
import { DISABLE_BUY_FORM_ADD_TO_CART, ENABLE_BUY_FORM_ADD_TO_CART, RELOAD_NOTE_BUY_FORM } from '@assets/js-multisets/common/constants/eventTypes';

export type EventType = typeof RELOAD_NOTE_BUY_FORM | typeof DISABLE_BUY_FORM_ADD_TO_CART | typeof ENABLE_BUY_FORM_ADD_TO_CART

export const triggerEvent = (event: EventType, payload: any = null) => {
   if (payload) {
      wpjEvent.trigger(document.getElementById('set-submit'), event, payload);
   } else {
      wpjEvent.trigger(document.getElementById('set-submit'), event);
   }
}
