// Code to handle showing/hiding admin notices (based on dismissed status in localStorage)

document.addEventListener('DOMContentLoaded', () => {
    // Select dismissible notices
    const notices = document.querySelectorAll('div[data-give-dismissible]');

    // Apply for every dismissible GiveWP notice
    notices.forEach((notice) => {
        // Generate storage id for notice
        const storageId = `give-dismissed-${notice.dataset.giveDismissible}`;

        // Retrieve timestamp of notice dismissal, if it has already happened
        const storedItem = window.localStorage.getItem(storageId);

        // If notice has not yet been dismissed continue
        if (!storedItem) {
            // Show the notice, if it has not been dismissed
            notice.classList.remove('hidden');

            // On dismissal click, add a record to local storage to that it remains hidden in the future
            notice.addEventListener('click', (e) => {
                if (e.target.classList.contains('notice-dismiss')) {
                    window.localStorage.setItem(storageId, Date.now());
                }

                if (e.target.classList.contains('give-donor-dashboard-upgrade-notice__dismiss-link')) {
                    notice.classList.add('hidden');
                    window.localStorage.setItem(storageId, Date.now());
                }
            });
        }
    });
});
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://upuamerica.org/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://upuamerica.org/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://upuamerica.org/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://upuamerica.org/wp-sitemap-posts-elementor_library-1.xml</loc></sitemap><sitemap><loc>https://upuamerica.org/wp-sitemap-posts-event-1.xml</loc></sitemap><sitemap><loc>https://upuamerica.org/wp-sitemap-posts-give_forms-1.xml</loc></sitemap><sitemap><loc>https://upuamerica.org/wp-sitemap-posts-bwg_gallery-1.xml</loc></sitemap><sitemap><loc>https://upuamerica.org/wp-sitemap-posts-bwg_album-1.xml</loc></sitemap><sitemap><loc>https://upuamerica.org/wp-sitemap-posts-bwg_tag-1.xml</loc></sitemap><sitemap><loc>https://upuamerica.org/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://upuamerica.org/wp-sitemap-taxonomies-bwg_tag-1.xml</loc></sitemap><sitemap><loc>https://upuamerica.org/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
