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

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

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

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

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