class OrokuBlocks_PromoDiscount_Elementor_Handler extends elementorModules.frontend.handlers.Base {
  getDefaultElements() {
    const container = this.$element[0].querySelector('.orokublocks-promodiscount');

    if (container) {
      const countdownTargetDate = container.getAttribute('data-countdown-target-date') || false;
      const countdownExpirationText = container.getAttribute('data-countdown-expiration-text') || false;
      const countdownElement = container.querySelector('.xm-countdown');

      /**
       * Countdown
       */
      new XM_Countdown({
        containerEl: countdownElement,
        targetDate: countdownTargetDate,
        expirationText: countdownExpirationText
      });
    }

    return {
      promoDiscountCard: container
    };
  }
}

window.addEventListener('elementor/frontend/init', () => {
  elementorFrontend.elementsHandler.attachHandler('orokublocks_promodiscount_elementor_widget', OrokuBlocks_PromoDiscount_Elementor_Handler);
});