(function($) {
    $(document).ready(function() {
        $('.book-review-blog-rswpbs-install').on('click', function(e) {
            e.preventDefault();
            $(this).html('Processing.. Please wait').addClass('updating-message');
            $.post(book_review_blog_rswpbs_ajax_object.ajaxUrl, { 'action': 'install_rswpbs_only' }, function(response) {
                location.href = 'edit.php?post_type=book&page=import-books-from-json#rswpbs-nav-wrapper';
            });
        });
    });
    jQuery(document).ready(function($) {
        // Handle Dismiss Forever
         $('.book-review-blog-dismiss-forever').on('click', function(e) {
            e.preventDefault();
            let $this = $(this);

            $.post(book_review_blog_rswpbs_ajax_object.ajaxUrl, {
                action: 'book_review_blog_amz_dismiss_forever',
                security: $this.data('nonce')
            }, function(response) {
                $('.book-review-blog-amz-import-admin-notice').slideUp();
            });
        });


        // Handle Remind Me Later
        $('.book-review-blog-remind-later').on('click', function(e) {
            e.preventDefault();
            let $this = $(this);

            $.post(book_review_blog_rswpbs_ajax_object.ajaxUrl, {
                action: 'book_review_blog_amz_remind_later',
                security: $this.data('nonce')
            }, function(response) {
                $('.book-review-blog-amz-import-admin-notice').slideUp();
            });
        });

        // Handle default dismiss button
        // $('.book-review-blog-amz-import-admin-notice').on('click', '.notice-dismiss', function() {
        //     $.post(book_review_blog_rswpbs_ajax_object.ajaxUrl, {
        //         action: 'book_review_blog_amz_remind_later',
        //         security: '<?php echo wp_create_nonce("book_review_blog_amz_remind_later"); ?>'
        //     });
        // });
    });
}(jQuery))