<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://niqabella.co.za/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://niqabella.co.za/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://niqabella.co.za/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://niqabella.co.za/wp-sitemap-posts-product-1.xml</loc></sitemap><sitemap><loc>https://niqabella.co.za/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://niqabella.co.za/wp-sitemap-taxonomies-product_cat-1.xml</loc></sitemap><sitemap><loc>https://niqabella.co.za/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
<!-- Niqabella Welcome Popup: shutdown fallback -->        <style>
        #niqabella-welcome-overlay{
            display:none;position:fixed;inset:0;background:rgba(0,0,0,.62);
            z-index:2147483646;align-items:center;justify-content:center;padding:20px;
            box-sizing:border-box;
        }
        #niqabella-welcome-modal{
            width:min(520px,100%);background:#fff;color:#111;position:relative;
            border-radius:4px;box-shadow:0 20px 70px rgba(0,0,0,.35);
            padding:42px 34px 34px;text-align:center;font-family:Arial,sans-serif;
            box-sizing:border-box;
        }
        #niqabella-welcome-close{
            position:absolute;right:13px;top:8px;border:0;background:transparent;
            font-size:28px;line-height:1;cursor:pointer;color:#555;padding:5px;
        }
        #niqabella-welcome-title{
            margin:0 0 10px;font-family:Georgia,serif;font-size:29px;font-weight:500;
        }
        #niqabella-welcome-copy{
            margin:0 auto 22px;max-width:420px;font-size:15px;line-height:1.6;
        }
        #niqabella-welcome-form input[type=email]{
            width:100%;height:50px;border:1px solid #bbb;padding:0 14px;
            box-sizing:border-box;font-size:15px;margin-bottom:10px;
        }
        #niqabella-welcome-submit{
            width:100%;height:50px;border:0;background:#111;color:#fff;
            cursor:pointer;font-size:14px;letter-spacing:.5px;text-transform:uppercase;
        }
        #niqabella-welcome-submit:disabled{opacity:.55;cursor:wait}
        #niqabella-welcome-consent{
            display:flex;gap:8px;text-align:left;align-items:flex-start;
            font-size:11px;line-height:1.4;margin:8px 0 14px;color:#555;
        }
        #niqabella-welcome-consent input{margin-top:2px}
        #niqabella-welcome-result{display:none;margin-top:18px}
        #niqabella-welcome-code{
            display:inline-block;background:#f3f3f3;border:1px dashed #777;
            padding:10px 16px;font-weight:700;letter-spacing:1px;font-size:18px;margin:8px 0;
        }
        #niqabella-welcome-copy-code{
            border:0;background:#111;color:#fff;padding:9px 14px;cursor:pointer;
            font-size:12px;margin-left:5px;
        }
        #niqabella-welcome-error{display:none;color:#a00000;font-size:13px;margin-top:12px;line-height:1.45}
        #niqabella-welcome-note{font-size:11px;color:#777;margin-top:12px;line-height:1.4}
        @media(max-width:600px){
            #niqabella-welcome-modal{padding:38px 22px 26px}
            #niqabella-welcome-title{font-size:25px}
        }
        </style>

        <div id="niqabella-welcome-overlay" aria-hidden="true">
            <div id="niqabella-welcome-modal" role="dialog" aria-modal="true" aria-labelledby="niqabella-welcome-title">
                <button id="niqabella-welcome-close" type="button" aria-label="Close">&times;</button>

                <div id="niqabella-welcome-form-wrap">
                    <h2 id="niqabella-welcome-title">Assalamu'alaykum and Welcome to Niqabella</h2>
                    <p id="niqabella-welcome-copy">
                        Sign up for our newsletter and receive <strong>10% off your first purchase.</strong>
                    </p>

                    <form id="niqabella-welcome-form">
                        <input id="niqabella-welcome-email" type="email" name="email"
                               placeholder="Enter your email address" autocomplete="email" required>
                        <label id="niqabella-welcome-consent">
                            <input type="checkbox" id="niqabella-welcome-optin" required>
                            <span>I agree to receive Niqabella newsletters and promotional emails.</span>
                        </label>
                        <button id="niqabella-welcome-submit" type="submit">Get My 10% Off</button>
                        <div id="niqabella-welcome-error"></div>
                    </form>

                    <div id="niqabella-welcome-note">
                        One 10% welcome offer per email address. Offer is for new customers only.
                    </div>
                </div>

                <div id="niqabella-welcome-result">
                    <h2 id="niqabella-welcome-title">Welcome to Niqabella ✨</h2>
                    <p>Your unique <strong>10% off</strong> code is:</p>
                    <div>
                        <span id="niqabella-welcome-code"></span>
                        <button id="niqabella-welcome-copy-code" type="button">Copy</button>
                    </div>
                    <p id="niqabella-welcome-result-msg">Your discount has also been applied to your cart.</p>
                    <button id="niqabella-welcome-shop" type="button"
                            style="margin-top:12px;border:0;background:#111;color:#fff;padding:12px 20px;cursor:pointer;">
                        Start Shopping
                    </button>
                </div>
            </div>
        </div>

        <script>
        (function(){
            const overlay = document.getElementById('niqabella-welcome-overlay');
            if(!overlay) return;

            const closeBtn = document.getElementById('niqabella-welcome-close');
            const form = document.getElementById('niqabella-welcome-form');
            const email = document.getElementById('niqabella-welcome-email');
            const consent = document.getElementById('niqabella-welcome-optin');
            const submit = document.getElementById('niqabella-welcome-submit');
            const error = document.getElementById('niqabella-welcome-error');
            const formWrap = document.getElementById('niqabella-welcome-form-wrap');
            const result = document.getElementById('niqabella-welcome-result');
            const codeEl = document.getElementById('niqabella-welcome-code');
            const copyBtn = document.getElementById('niqabella-welcome-copy-code');
            const shopBtn = document.getElementById('niqabella-welcome-shop');

            // Show once per browser after 10 seconds.
            const sessionKey = 'niqabella_welcome_popup_seen_v2';
            if (!localStorage.getItem(sessionKey)) {
                setTimeout(function(){
                    overlay.style.display = 'flex';
                    overlay.setAttribute('aria-hidden','false');
                    localStorage.setItem(sessionKey,'1');
                    setTimeout(()=>email.focus(),100);
                },10000);
            }

            function closePopup(){
                overlay.style.display='none';
                overlay.setAttribute('aria-hidden','true');
            }
            closeBtn.addEventListener('click', closePopup);
            overlay.addEventListener('click', function(e){
                if(e.target === overlay) closePopup();
            });

            form.addEventListener('submit', function(e){
                e.preventDefault();
                error.style.display='none';

                if(!consent.checked){
                    error.textContent='Please tick the newsletter consent box to continue.';
                    error.style.display='block';
                    return;
                }

                submit.disabled=true;
                submit.textContent='Creating your 10% offer…';

                const body = new URLSearchParams();
                body.append('action','niqabella_welcome_signup');
                body.append('nonce','b86c4562eb');
                body.append('email',email.value);

                fetch('/wp-admin/admin-ajax.php',{credentials:'same-origin',
                    method:'POST',
                    headers:{'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'},
                    body:body.toString()
                })
                .then(async r=>{
                    const text = await r.text();
                    let data;
                    try { data = JSON.parse(text); } catch(e) {
                        throw new Error('The signup request reached the site, but the server did not return a valid response. Please try again.');
                    }
                    return data;
                })
                .then(data=>{
                    if(!data.success){
                        throw new Error(data.data && data.data.message ? data.data.message : 'Something went wrong.');
                    }

                    const code = data.data.code;
                    codeEl.textContent=code;
                    formWrap.style.display='none';
                    result.style.display='block';

                    // Apply coupon immediately if WooCommerce cart URL is available.
                    const current = new URL(window.location.href);
                    current.searchParams.set('apply_coupon', code);

                    // WooCommerce does not universally auto-apply via query string,
                    // so send the visitor to the shop with the code visible.
                    // The coupon remains restricted to their email and one use.
                    shopBtn.onclick=function(){
                        window.location.href = 'https://niqabella.co.za/shop/?coupon='+encodeURIComponent(code);
                    };
                })
                .catch(err=>{
                    error.textContent=err.message;
                    error.style.display='block';
                })
                .finally(()=>{
                    submit.disabled=false;
                    submit.textContent='Get My 10% Off';
                });
            });

            copyBtn.addEventListener('click', function(){
                navigator.clipboard.writeText(codeEl.textContent).then(()=>{
                    copyBtn.textContent='Copied';
                    setTimeout(()=>copyBtn.textContent='Copy',1500);
                });
            });
        })();
        </script>
        