/**
 * Demo Notice JS
 *
 * Handles the dismissal of the demo notice via AJAX.
 */
(function($) {
    'use strict';

    jQuery(document).ready(function($) {
    // Handle the dismiss link click for upgrade notice
    $('.newsx-paper-dismiss-link').on('click', function(e) {
        e.preventDefault();
        
        $.ajax({
            url: newsxpaperUpgradeNotice.ajaxUrl,
            type: 'POST',
            data: {
                action: 'newsx_paper_dismiss_upgrade_notice',
                nonce: newsxpaperUpgradeNotice.nonce
            },
            success: function() {
                $('.newsx-paper-upgrade-notice').fadeOut();
            }
        });
    });


     $('.newsx-paper-dismiss-notice').on('click', function(e) {
        e.preventDefault();
        
        $.ajax({
            url: ajaxurl, // WordPress global variable for admin-ajax.php
            type: 'POST',
            data: {
                action: 'newsx_paper_dismiss_documentation_notice',
                nonce: $(this).data('nonce')
            },
            success: function() {
                $('.newsx-paper-documentation-notice').fadeOut();
            }
        });
    });
});
    
})(jQuery);