(function ($) {
	'use strict';

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

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

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