/**
 * Rating Notice JavaScript
 *
 * @package shopbar
 */

(function($) {
	'use strict';

	$(document).ready(function() {

		$(document).on('click', '.shopbar-rating-notice .notice-dismiss', function(e) {
			e.preventDefault();
			$(document).find('.shopbar-rating-notice').slideUp();
			$.post({
				url: shopbar_rating.ajax_url,
				data: {
					action: 'shopbar_rating_dismiss_notice',
					nonce: shopbar_rating.nonce,
				}
			});
		});

		$(document).on('click', '.shopbar-maybe-later', function() {
			$(document).find('.shopbar-rating-notice').slideUp();
			$.post({
				url: shopbar_rating.ajax_url,
				data: {
					action: 'shopbar_rating_maybe_later',
					nonce: shopbar_rating.nonce,
				}
			});
		});

		$(document).on('click', '.shopbar-already-rated', function() {
			$(document).find('.shopbar-rating-notice').slideUp();
			$.post({
				url: shopbar_rating.ajax_url,
				data: {
					action: 'shopbar_rating_already_rated',
					nonce: shopbar_rating.nonce,
				}
			});
		});

	});

})(jQuery);
