<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">console.log("Klaviyo events script loaded");

$(document).ready(function() {
    $( "body" ).on( "click", ".addtocart", function() {
        console.log("Add to cart clicked");

        try {
            productLink = $(this).closest('.inner').find('.productlink2').attr('href');

            // Check if #productlink2 exists
            if (typeof(productLink) !== 'undefined') {
                var shortHref = productLink.replace('/products/', '');

                var item = {
                    "ProductName": $(this).closest('.inner').find('.producttitle').text(),
                    "ProductID": shortHref,
                    "ImageURL": $(this).closest('.inner').find('.p-img').attr('src'),
                    "Brand": $(this).closest('.inner').find('.brand').text(),
                    "Category": $(this).closest('.inner').find('.category').text(),
                    "SubCategory": $(this).closest('.inner').find('.subcategory').text(),
                    "Price": $(this).closest('.inner').find('.price').text(),
                };
            } else {
                var item = {
                    "ProductName": $(this).data('productname'),
                    "ProductID": $(this).data('productid'),
                    "ImageURL": $(this).data('image'),
                    "Brand": $(this).data('brand'),
                    "Category": $(this).data('category'),
                    "Price": $(this).data('price'),
                };
            }

            klaviyo.push(['track', 'Added to Cart', item]);
        } catch (error) {
            console.log("An error occurred while tracking the Klaviyo event:", error);
            // Optionally, you can display an error message to the user or handle the error in another way
        }
    });


    $( "body" ).on( "click", ".removefromcart", function() {
        try {
            var item = {
                "ProductName": $(this).closest('.inner').find('.product-title').text(),
                "Brand": $(this).closest('.inner').find('.brand').text(),
                "Price": $(this).closest('.inner').find('.price').text(),
            };

            klaviyo.push(['track', 'Removed From Cart', item]);
        } catch (error) {
            console.log("An error occurred while tracking the Klaviyo event:", error);
            // Optionally, you can display an error message to the user or handle the error in another way
        }
    });


    $( "body" ).on( "click", ".banktransfertext", function() {
        var item = {
            "PaymentMethod": "Bank Transfer",
        };

        try {
            klaviyo.push(['track', 'Payment Type selected', item]);
        } catch (error) {
            console.error("An error occurred while tracking the Klaviyo event:", error);
            // Optionally, you can display an error message to the user or handle the error in another way
        }
    });

    $( "body" ).on( "click", ".setcashondelivery", function() {
        var item = {
            "PaymentMethod": "Cash on Delivery",
        };

        try {
            klaviyo.push(['track', 'Payment Type selected', item]);
        } catch (error) {
            console.error("An error occurred while tracking the Klaviyo event:", error);
            // Optionally, you can display an error message to the user or handle the error in another way
        }
    });

    $( "body" ).on( "click", ".addcard", function() {
        var item = {
            "PaymentMethod": "Card",
        };

        try {
            klaviyo.push(['track', 'Payment Type selected', item]);
        } catch (error) {
            console.error("An error occurred while tracking the Klaviyo event:", error);
            // Optionally, you can display an error message to the user or handle the error in another way
        }
    });

    $( "body" ).on( "click", ".selectexpress", function() {
        var item = {
            "Delivery Type": "Express",
        };

        try {
            klaviyo.push(['track', 'Delivery Option', item]);
        } catch (error) {
            console.error("An error occurred while tracking the Klaviyo event:", error);
            // Optionally, you can display an error message to the user or handle the error in another way
        }
    });

    $( "body" ).on( "click", ".scheduleselect", function() {
        try {
            var dateString = $('.border-black').data('day');
            var dateObject = new Date(dateString);
            var formattedDate = dateObject.toLocaleDateString();
            var dayName = dateObject.toLocaleDateString('en-US', { weekday: 'long' });
            var selectedSlot = $('input[name="slot"]:checked').val();
            var timeRange = selectedSlot.split(' ')[1] + ' ' + selectedSlot.split(' ')[2] + ' ' + selectedSlot.split(' ')[3];

            var item = {
                "Delivery Type": "Scheduled",
                "Date": dayName + ', ' + formattedDate,
                "Time": timeRange,
            };


            klaviyo.push(['track', 'Delivery Option', item]);
        } catch (error) {
            console.error("An error occurred while tracking the Klaviyo event:", error);
            // Optionally, you can display an error message to the user or handle the error in another way
        }
    });

    $( "body" ).on( "click", ".close-address-entry", function() {
        var item = {
            "Address": $('#fulladdresscheckoutform').text(),
        };

        try {
            klaviyo.push(['track', 'Delivery Location', item]);
        } catch (error) {
            console.error("An error occurred while tracking the Klaviyo event:", error);
            // Optionally, you can display an error message to the user or handle the error in another way
        }
    });

    $( "body" ).on( "click", ".savepromocode", function() {
        var item = {
            "Code": $('#promo-code').val(),
        };

        try {
            klaviyo.push(['track', 'Promo Code Added', item]);
        } catch (error) {
            console.error("An error occurred while tracking the Klaviyo event:", error);
            // Optionally, you can display an error message to the user or handle the error in another way
        }
    });
});

</pre></body></html>