(function ($) {
	'use strict';

	$(document).ready(function () {
		$('.devikit-sellsy-banner-remind-later').on('click', function (e) {
			e.preventDefault();
			dismissBanner('remind_later');
		});

		$('.devikit-sellsy-banner-dismiss-permanent').on('click', function (e) {
			e.preventDefault();
			dismissBanner('dismiss_permanent');
		});

		function dismissBanner(actionType) {
			$.ajax({
				url: devikitSellsyBanner.ajaxurl,
				type: 'POST',
				data: {
					action: 'devikit_sellsy_dismiss_banner',
					action_type: actionType,
					nonce: devikitSellsyBanner.nonce
				},
				success: function (response) {
					if (response.success) {
						$('.devikit-sellsy-pro-banner').fadeOut(300, function () {
							$(this).remove();
						});
					}
				}
			});
		}
	});
})(jQuery);
