/**
 * SWP Painting — Admin promo banner dismissal.
 */
(function ($) {
	'use strict';

	$(function () {
		$(document).on('click', '.swp-painting-promo-banner__close', function (e) {
			e.preventDefault();

			var $banner = $(this).closest('.swp-painting-promo-banner');
			var nonce   = $banner.data('nonce');

			$banner.addClass('is-dismissing');

			$.post(swpPaintingPromo.ajaxUrl, {
				action: swpPaintingPromo.action,
				nonce:  nonce
			}).always(function () {
				window.setTimeout(function () {
					$banner.remove();
				}, 250);
			});
		});
	});
})(jQuery);
