var woo_appProperties = (function() {
var woo_appProperties_Global = {};
var self = document.getElementById('woo_appProperties');
self.classList.add("woo-ui-gadget");
woo_appProperties_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded woo_appProperties");
}
return woo_appProperties_Global;
})();var gkxwvsqf_20248415557__820_857 = (function() {
var self = document.getElementById('gkxwvsqf_20248415557__820_857');
var gkxwvsqf_20248415557__820_857_Global = {};
gkxwvsqf_20248415557__820_857_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_20248415557__820_857");
}
return gkxwvsqf_20248415557__820_857_Global;
})();var gkxwvsqf_202494204618_139 = (function() {
var self = document.getElementById('gkxwvsqf_202494204618_139');
var gkxwvsqf_202494204618_139_Global = {};
gkxwvsqf_202494204618_139_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202494204618_139");
}
return gkxwvsqf_202494204618_139_Global;
})();var gkxwvsqf_202382815548_882_561_699 = (function() {
var self = document.getElementById('gkxwvsqf_202382815548_882_561_699');
//self.classList.add("sun_editor_content");
var gkxwvsqf_202382815548_882_561_699_Global = {};
gkxwvsqf_202382815548_882_561_699_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202382815548_882_561_699");
}
return gkxwvsqf_202382815548_882_561_699_Global;
})();var gkxwvsqf_2024919134944_840 = (function() {
var self = document.getElementById('gkxwvsqf_2024919134944_840');
var gkxwvsqf_2024919134944_840_Global = {};
gkxwvsqf_2024919134944_840_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2024919134944_840");
}
function handleBreadcrumbClick(event) {
event.preventDefault(); // Prevent the default anchor behavior
var key = this.dataset.key;
var linked = this.dataset.linked; // Access the linked status from data attribute
var linkID = this.dataset.linkID; // Access the linkID from data attribute
var url = this.dataset.url; // Access the URL from data attribute
if (linked === "true") {
if (linkID !== "") {
// If linked is true and linkID is not empty, update the current page
Promise.all([woo.updateCurrentPage(linkID)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0; // Scroll to top
});
} else {
window.location = url; // Fallback navigation if linkID is empty
}
} else {
// If linked is false, just update the current page
Promise.all([woo.updateCurrentPage(key)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0; // Scroll to top
});
}
}
woo.getFullPageStructure().then((response) => {
console.log(response);
const result = findKeyAndParents(response, woo.getCurrentPage());
if (result) {
console.log(result);
var breadcrumbHTML = generateBreadcrumbHTML(result.path);
$(self).html(breadcrumbHTML);
} else {
console.log("Key not found");
}
});
function findKeyAndParents(obj, targetKey, path = []) {
for (var key in obj) {
if (obj.hasOwnProperty(key) && obj[key].props && obj[key].props.name) {
// Add key-name pair and linked-related info to the path
var currentPath = path.concat({
key: key,
name: obj[key].props.name,
linked: obj[key].props.linked || false, // Check if 'linked' is true
linkID: obj[key].props.linked ? obj[key].props.linkID : null, // Return linkID if linked is true
linkURL: obj[key].props.linked ? obj[key].props.linkURL : null // Return linkURL if linked is true
});
// Check if the key matches the targetKey
if (key === targetKey) {
return { value: obj[key].props.name, path: currentPath }; // Return the key-value pair
}
// If 'children' exist, recursively check them (async)
if (obj[key].children) {
var result = findKeyAndParents(obj[key].children, targetKey, currentPath);
if (result) {
return result;
}
}
}
}
return null; // Return null if targetKey is not found
}
function generateBreadcrumbHTML(path) {
if (!path || path.length === 0) return '';
var breadcrumbContainer = document.createElement('div'); // Create a container for breadcrumbs
for (var i = 0; i < path.length; i++) {
var item = path[i];
// If it's the last item, display it without a link
if (i === path.length - 1) {
var finalItem = document.createElement('span'); // Use a span for the final item
finalItem.textContent = item.name; // Just the name for the final item
breadcrumbContainer.appendChild(finalItem);
} else {
var linkElement = document.createElement('a'); // Create an anchor element
linkElement.className = "woo_breadcrumbLink";
linkElement.textContent = item.name; // Set the link text
linkElement.href = "#"; // Set href to '#' to avoid page jumps
linkElement.dataset.key = item.key; // Store linked status in a data attribute
linkElement.dataset.linked = item.linked; // Store linked status in a data attribute
linkElement.dataset.linkID = item.linkID; // Store linkID in a data attribute
linkElement.dataset.url = item.url; // Store url in a data attribute
// Add event listener to handle the click event
linkElement.addEventListener('click', handleBreadcrumbClick);
breadcrumbContainer.appendChild(linkElement); // Add link to the container
// Append separator " > " unless it's the last item
if (i < path.length - 1) { // Avoid adding a separator after the last link
breadcrumbContainer.appendChild(document.createTextNode(' > '));
}
}
}
return breadcrumbContainer; // Return the breadcrumb container element
}
return gkxwvsqf_2024919134944_840_Global;
})();var login_125_594 = (function() {
var login_125_594_Global = {};
var loginDom = document.getElementById('login-text_login_125_594');
var loginDomMob = document.getElementById('mob_icon_login_125_594');
var loggedIn = false;
var loggingInOrOut = false;
var openModal = false;
var whatIs = document.querySelector(".woo_whatIsWooID_login_125_594");
var forgotPass = document.querySelector(".forgot_pass_login_125_594");
function getAppData(){
return new Promise((resolve) => {
var url = woo.getRemoteCouch() + "/gatemaster$public/gatemaster-invoice-settings";
var data = {}
resolve(woo.queryCouch(url, "GET", data));
}).catch((error) => {
return null;
});
}
getAppData().then((data) => {
if (data){
$("#login_125_594 .website_name").html(data.brandName);
$("#login_125_594 #fullLogoImage").attr("src", "/resources/gatemaster/uploads/" + data.logoImage);
}
})
function forgotPass_login_125_594(){
woo.updateCurrentPage("forgot-password");
}
function whatIsClick_login_125_594(){
var note = "
What is the Woo ID?
With a growing awareness of on-line privacy and security issues, further tightening of the spam laws worldwide and the need for businesses to have more robust collection of data systems in place, Woo has risen to the challenge by creating a universal ID for users on the platform - called a Woo ID.
The Woo ID provides you with the security that Woo is dedicated, and bound by law, to ensure your information is kept private and that all anti-spam laws are adhered to. Every user added to a Woo website gets to verify their email address. This ensures issues with data entry and out-of-date email accounts are spotted early.
The Woo ID universal ID is the market leader: creating a safe and spam free environment for you.
';
html += ' ';
spanAbout.innerHTML = html;
form.appendChild(spanAbout);
makeModal(form);
}
function escapeHtml(str) {
var div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
function getCart(showCartFlag = false) {
var cart = getCookie("shoppingCart");
if (!cart) cart = { items: [] };
if (showCartFlag) showCart(cart);
return cart;
}
function clearCart() {
const cart = { items: [] };
setCookie('shoppingCart', cart, 7);
getTotalItems();
showCart(cart);
return cart;
}
function getTotalItems() {
var cart = getCookie("shoppingCart") || { items: [] };
const totalItems = cart.items.reduce((sum, item) => sum + parseInt(item.productQty || 0, 10), 0);
$(".totalCartItems").text(totalItems);
console.log("Badge updated to", totalItems);
}
function removeFromCart(uniqueKey) {
const cart = getCart();
cart.items = cart.items.filter(item => (item.uniqueKey || item.stockCode) !== uniqueKey);
setCookie('shoppingCart', cart, 7);
getTotalItems();
showCart(cart);
return cart;
}
function addToCart(items) {
if (!Array.isArray(items)) items = [items];
console.log("=== ADD TO CART STARTED ===");
let cart = getCart(false); // always fresh
items.forEach((item, idx) => {
if (!item || !item.stockCode) return;
const searchKey = item.uniqueKey || item.stockCode;
console.log(`Processing item ${idx} - key:`, searchKey);
const existingIndex = cart.items.findIndex(i => (i.uniqueKey || i.stockCode) === searchKey);
if (existingIndex !== -1) {
console.log("→ Found existing - incrementing");
const existing = cart.items[existingIndex];
const newQty = parseInt(existing.productQty, 10) + parseInt(item.productQty, 10);
existing.productQty = String(newQty);
existing.productTotal = (parseFloat(existing.productPrice) * newQty).toFixed(2);
// FIX: Ensure that if an updated selection array arrives, we maintain it
if (item.forMultiVariationSelects) {
existing.forMultiVariationSelects = item.forMultiVariationSelects;
}
} else {
console.log("→ New item - pushing");
const qty = parseInt(item.productQty, 10) || 1;
const price = parseFloat(item.productPrice) || 0;
const newItem = {
uniqueKey: item.uniqueKey || item.stockCode,
stockCode: item.stockCode,
productName: item.productName || "Unknown",
productPrice: item.productPrice || "0",
appId: item.appId || "",
forVariation: item.forVariation || null,
// 🔥 FIX: Explicitly parse and capture the multi-variation array
forMultiVariationSelects: item.forMultiVariationSelects || [],
productQty: String(qty),
productTotal: (price * qty).toFixed(2),
subscriptionId: item.subscriptionId || null
};
cart.items.push(newItem);
}
});
console.log("Final cart before save:", JSON.stringify(cart, null, 2));
setCookie('shoppingCart', cart, 7);
// Force refresh everything
getTotalItems();
showCart(getCart(false));
console.log("=== ADD TO CART FINISHED ===");
}
$(document).on("click", "#checkout", function(){
console.log("=== CHECKOUT CLICKED ===");
const currentCart = getCart(false);
setCookie('shoppingCart', currentCart, 7);
woo.updateCurrentPage("checkout");
});
$(document).on("click", ".delete-item", function(){
var uniqueKey = $(this).attr("data-unique-key");
removeFromCart(uniqueKey);
});
$(".totalCartItems, #cartIcon").on("click", function() {
getCart(true);
});
$(document).on("click", "#clearCart", clearCart);
gkxwvsqf_202548114144_477_Global.addToCart = (item) => addToCart(item);
gkxwvsqf_202548114144_477_Global.removeFromCart = (key) => removeFromCart(key);
gkxwvsqf_202548114144_477_Global.clearCart = clearCart;
gkxwvsqf_202548114144_477_Global.updateTotal = getTotalItems;
gkxwvsqf_202548114144_477_Global.unload = () => {
$(document).off("click", "#checkout");
$(document).off("click", ".delete-item");
$(".totalCartItems, #cartIcon").off("click");
$(document).off("click", "#clearCart");
console.log("Unloaded gkxwvsqf_202548114144_477");
};
getTotalItems();
return gkxwvsqf_202548114144_477_Global;
})();var gkxwvsqf_202391320119_972_543_181 = (function() {
var self = document.getElementById('gkxwvsqf_202391320119_972_543_181');
var gkxwvsqf_202391320119_972_543_181_Global = {};
function gkxwvsqf_202391320119_972_543_181Reveal() {
if (document.querySelector("#gkxwvsqf_202391320119_972_543_181 .reveal")){
var reveals = document.querySelector("#gkxwvsqf_202391320119_972_543_181 .reveal");
var windowHeight = window.innerHeight;
var elementTop = reveals.getBoundingClientRect().top;
var elementVisible = 150;
if (elementTop < windowHeight - elementVisible) {
reveals.classList.add("active");
self.classList.add("gkxwvsqf_202391320119_972_543_181ShadowReveal");
self.classList.remove("gkxwvsqf_202391320119_972_543_181ShadowRevealOff");
} else {
reveals.classList.remove("active");
self.classList.remove("gkxwvsqf_202391320119_972_543_181ShadowReveal");
self.classList.add("gkxwvsqf_202391320119_972_543_181ShadowRevealOff");
}
}
}
gkxwvsqf_202391320119_972_543_181_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202391320119_972_543_181");
}
$("#gkxwvsqf_202391320119_972_543_181 .buttonWysiwygText").on("click", function(){
if ("Page_ID" == "Page_ID") {
/*woo.updateCurrentPage("home").then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0;
});*/
Promise.all([woo.updateCurrentPage("home")]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
} else {
window.location = "home";
}
});
return gkxwvsqf_202391320119_972_543_181_Global;
})();var gkxwvsqf_202392093827_673_40_991 = (function() {
var self = document.getElementById('gkxwvsqf_202392093827_673_40_991');
var gkxwvsqf_202392093827_673_40_991_Global = {};
window.addEventListener("scroll", gkxwvsqf_202392093827_673_40_991Reveal);
const childElement = document.getElementById('gkxwvsqf_202392093827_673_40_991');
const parent = childElement.parentElement.parentElement;
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === 'attributes' && mutation.attributeName === 'style') {
const visibility = parent.style.visibility;
var reveals = document.querySelector("#gkxwvsqf_202392093827_673_40_991 .reveal");
if (visibility === 'visible') {
//console.log('Element became visible');
// Perform actions when visibility changes to visible
reveals.classList.add("active");
self.classList.add("gkxwvsqf_202392093827_673_40_991ShadowReveal");
self.classList.remove("gkxwvsqf_202392093827_673_40_991ShadowRevealOff");
} else if (visibility === 'hidden') {
//console.log('Element became hidden');
// Perform actions when visibility changes to hidden
reveals.classList.remove("active");
self.classList.remove("gkxwvsqf_202392093827_673_40_991ShadowReveal");
self.classList.add("gkxwvsqf_202392093827_673_40_991ShadowRevealOff");
}
}
});
});
// Start observing the element for changes in attribute 'style'
observer.observe(parent, {
attributes: true,
attributeFilter: ['style']
});
gkxwvsqf_202392093827_673_40_991_Global.unload = () => {
//Unload callbacks here
window.removeEventListener("scroll", gkxwvsqf_202392093827_673_40_991Reveal);
console.log("Unloaded gkxwvsqf_202392093827_673_40_991");
}
function gkxwvsqf_202392093827_673_40_991Reveal() {
var reveals = document.querySelector("#gkxwvsqf_202392093827_673_40_991 .reveal");
var windowHeight = window.innerHeight;
var elementTop = reveals.getBoundingClientRect().top;
var elementVisible = 150;
if (elementTop < windowHeight - elementVisible) {
reveals.classList.add("active");
self.classList.add("gkxwvsqf_202392093827_673_40_991ShadowReveal");
self.classList.remove("gkxwvsqf_202392093827_673_40_991ShadowRevealOff");
} else {
reveals.classList.remove("active");
self.classList.remove("gkxwvsqf_202392093827_673_40_991ShadowReveal");
self.classList.add("gkxwvsqf_202392093827_673_40_991ShadowRevealOff");
}
}
if ("" != "" || "Change_Page" == "Open_Image_in_New_Window"){
$("#gkxwvsqf_202392093827_673_40_991 .mainImage").css("cursor", "pointer");
$("#gkxwvsqf_202392093827_673_40_991 .mainImage").on("click", function(){
switch ("Change_Page"){
case "Change_Page":
woo.updateCurrentPage("");
break;
case "External_Link":
window.location("");
break;
case "Open_Image_in_New_Window":
window.open("/resources/gatemaster/uploads/banner-image-1.jpg");
break;
default:
console.error("No link option selected");
}
});
}
// To check the scroll position on page load
gkxwvsqf_202392093827_673_40_991Reveal();
gkxwvsqf_202392093827_673_40_991_Global.animateMenuIn = () => {
animateMenuIn();
};
function animateMenuIn(){
$("#gkxwvsqf_202392093827_673_40_991 .imageWrapper").removeClass("animateMenuOut").addClass("animateMenuIn");
}
gkxwvsqf_202392093827_673_40_991_Global.animateMenuOut = () => {
animateMenuOut();
};
function animateMenuOut(){
$("#gkxwvsqf_202392093827_673_40_991 .imageWrapper").removeClass("animateMenuIn").addClass("animateMenuOut");
}
return gkxwvsqf_202392093827_673_40_991_Global;
})();var gkxwvsqf_202552123748__808_181 = (function() {
var self = document.getElementById('gkxwvsqf_202552123748__808_181');
var gkxwvsqf_202552123748__808_181_Global = {};
gkxwvsqf_202552123748__808_181_Global.unload = () => {
//Unload callbacks here
window.removeEventListener("scroll", gkxwvsqf_202552123748__808_181Reveal);
console.log("Unloaded gkxwvsqf_202552123748__808_181");
}
function gkxwvsqf_202552123748__808_181Reveal() {
var reveals = document.querySelector("#gkxwvsqf_202552123748__808_181 .reveal");
var windowHeight = window.innerHeight;
var elementTop = reveals.getBoundingClientRect().top;
var elementVisible = 150;
if (elementTop < windowHeight - elementVisible) {
reveals.classList.add("active");
self.classList.add("gkxwvsqf_202552123748__808_181ShadowReveal");
self.classList.remove("gkxwvsqf_202552123748__808_181ShadowRevealOff");
} else {
reveals.classList.remove("active");
self.classList.remove("gkxwvsqf_202552123748__808_181ShadowReveal");
self.classList.add("gkxwvsqf_202552123748__808_181ShadowRevealOff");
}
}
if ("home" != "" || "Change_Page" == "Open_Image_in_New_Window"){
$("#gkxwvsqf_202552123748__808_181 .mainImage").css("cursor", "pointer");
$("#gkxwvsqf_202552123748__808_181 .mainImage").on("click", function(){
switch ("Change_Page"){
case "Change_Page":
woo.updateCurrentPage("home");
break;
case "External_Link":
window.location("home");
break;
case "Open_Image_in_New_Window":
window.open("/resources/gatemaster/uploads/gatemaster-logo.png");
break;
default:
console.error("No link option selected");
}
});
}
gkxwvsqf_202552123748__808_181_Global.animateMenuIn = () => {
animateMenuIn();
};
function animateMenuIn(){
$("#gkxwvsqf_202552123748__808_181 .imageWrapper").removeClass("animateMenuOut").addClass("animateMenuIn");
}
gkxwvsqf_202552123748__808_181_Global.animateMenuOut = () => {
animateMenuOut();
};
function animateMenuOut(){
$("#gkxwvsqf_202552123748__808_181 .imageWrapper").removeClass("animateMenuIn").addClass("animateMenuOut");
}
return gkxwvsqf_202552123748__808_181_Global;
})();var gkxwvsqf_20247111213__322_741 = (function() {
var self = document.getElementById('gkxwvsqf_20247111213__322_741');
var email = document.getElementById('contactEmailAddress');
var number = document.getElementById('contactNumber');
var firstName = document.getElementById('enquiryFirstName');
var lastName = document.getElementById('enquiryLastName');
var formSubmit = document.getElementById('contactSubmit');
var gkxwvsqf_20247111213__322_741_Global = {};
function getExtraData() {
return new Promise((resolve, reject) => {
var inputs = $('#gkxwvsqf_20247111213__322_741 input, #gkxwvsqf_20247111213__322_741 textarea, #gkxwvsqf_20247111213__322_741 select')
.not(':input[type=button], :input[type=submit], :input[type=reset], #contactEmailAddress, #contactNumber, #enquiryFirstName, #enquiryLastName, #enquiryLastName');
var enquiryText = "";
$(inputs).each(function() {
if (this.type == "text" || this.type == "textarea" || this.type == "select-one"){
if ( this.type == "select-one" && this.value == "none"){
alert("Please choose an option for '" + this.name + "'!");
resolve("select option issue");
}
enquiryText = enquiryText + "\n" + this.name + ": " + this.value + "\n";
} else if (this.checked) {
enquiryText = enquiryText + "\n" + this.name + ": " + this.value + "\n";
}
});
resolve(enquiryText);
}).catch((error) => {
console.error("Error in content method:", error);
reject("");
});
}
function submitButtonPressed() {
var emailAddress = email.value.trim();
var numberVal = number.value.trim();
var firstNameVal = firstName.value.trim();
var lastNameVal = lastName.value.trim();
// Remove everything that's not a digit
var cleanNumber = numberVal.replace(/[^0-9]/g, '');
// Basic checks
if (emailAddress === "" ||
cleanNumber === "" ||
firstNameVal === "" ||
lastNameVal === "") {
alert("Oops! Please fill in all required fields:\n\n" +
"- First Name\n" +
"- Last Name\n" +
"- Phone number\n" +
"- Email address");
return;
}
// Check if we actually have a valid phone number (at least 7-8 digits usually)
if (cleanNumber.length < 7) {
alert("Please enter a valid phone number\n\n" +
"(Must contain at least 7 digits after removing spaces, dashes, dots, etc.)");
number.focus(); // Put cursor back in phone field
return;
}
// Show loading
$("#contactLoadWait").css({"zIndex": "10000000", "display": "flex"});
getExtraData().then((enquiryText) => {
if (enquiryText !== "select option issue") {
// Use the original number (with formatting) for submission/display
// or use cleanNumber if your backend prefers it
contact(firstNameVal, lastNameVal, numberVal, emailAddress, enquiryText)
.then((response) => {
console.log(response);
$("form").hide();
$("#contactLoadWait").hide();
var responseDiv = document.createElement('div');
responseDiv.innerHTML = it.responseWysiwygContent; // fixed syntax
self.appendChild(responseDiv);
return woo.checkEmail(emailAddress);
})
.then((response) => {
console.log(response);
if (response && response.ok === true) {
var registerData = {
"name": firstNameVal,
"lastName": lastNameVal,
"number": numberVal, // keeping original format
// "number": cleanNumber, // alternative: send clean version
"email": emailAddress,
"password": "",
"confirmPassword": ""
};
return woo.register(registerData);
} else {
return false;
}
})
.then((response) => {
console.log(response);
if (response === false) {
console.log("Not Registered");
}
})
.catch((error) => {
console.log(error);
$("#contactLoadWait").hide().css("zIndex", "1");
// alert("Something went wrong");
});
} else {
$("#contactLoadWait").hide().css("zIndex", "1");
}
});
}
function contact(firstNameVal, lastNameVal, numberVal, emailAddress, enquiryText) {
return $.ajax({
type: "POST",
url: woo.getAuthServer() + "/mailer/enquiry",
headers: {
"Content-Type": "application/json"
},
crossDomain: true,
cache: false,
data: JSON.stringify({
"firstName": firstNameVal,
"lastName": lastNameVal,
"number": numberVal,
"emailAddress": emailAddress,
"enquiryString": enquiryText
}),
timeout: 10000
});
}
function addEventListeners() {
formSubmit.addEventListener('click', submitButtonPressed);
}
addEventListeners();
gkxwvsqf_20247111213__322_741_Global.unload = () => {
//Unload callbacks here
formSubmit.removeEventListener('click', submitButtonPressed);
console.log("Unloaded gkxwvsqf_20247111213__322_741");
}
return gkxwvsqf_20247111213__322_741_Global;
})();var gkxwvsqf_2024810131454_191 = (function() {
var self = document.getElementById('gkxwvsqf_2024810131454_191');
var gkxwvsqf_2024810131454_191_Global = {};
var unloadPromise;
gkxwvsqf_2024810131454_191_Global.unload = () => {
return new Promise((resolve, reject) => {
//Unload callbacks here
if (unloadPromise){
unloadPromise.then(() => {
resolve("done");
}).catch((error) => {
reject(error);
});
} else {
resolve("done");
}
woo.events.off("Page Added", recreate);
woo.events.off("Page Deleted", recreate);
woo.events.off("Page Hidden", recreate);
woo.events.off("Page Unhidden", recreate);
woo.events.off("Page Linked", recreate);
woo.events.off("Page Unlinked", recreate);
woo.events.off("Page Order Updated", recreate);
woo.events.off("Page Parent Updated", recreate);
woo.events.off("Page pageName Updated", recreate);
console.log("Unloaded gkxwvsqf_2024810131454_191");
});
}
woo.events.on("Page Added", recreate);
woo.events.on("Page Deleted", recreate);
woo.events.on("Page Hidden", recreate);
woo.events.on("Page Unhidden", recreate);
woo.events.on("Page Linked", recreate);
woo.events.on("Page Unlinked", recreate);
woo.events.on("Page Order Updated", recreate);
woo.events.on("Page Parent Updated", recreate);
woo.events.on("Page pageName Updated", recreate);
function recreate(){
unloadPromise = createFullULMenu().then(() => {
console.log("boy oh boy a lincoln toy!");
createFullULMenu();
}).catch((error) => {
console.log("Menu not created! " + error);
});
}
checkBuild();
gkxwvsqf_2024810131454_191_Global.createMenu = () => {
createFullULMenu().then(() => {
}).catch((error) => {
console.error(error);
});
}
function checkBuild(){
return new Promise((resolve, reject) => {
woo.getGadgetProperty("gkxwvsqf_2024810131454_191", woo.instanceDB, "toolbarBuild").then((propValue) => {
if (!propValue){
createFullULMenu();
}
resolve("done");
}).catch((error) => {
reject(error);
});
}).catch((error) => {
console.error(error);
});
}
var showPage ='home';
var pageCount = 0;
function createFullULMenu(){
return new Promise((resolve, reject) => {
$("#mainMenuContent_gkxwvsqf_2024810131454_191").empty();
var form = document.querySelector("#mainMenuContent_gkxwvsqf_2024810131454_191");
var allHtml = {};
var pages = {};
var rootPage = "";
var parentPageName = "Home";
woo.getFullPageStructure().then((response) => {
console.log(response);
if ("home" == "home"){
rootPage = Object.keys(response)[0];
pages = response[rootPage].children;
parentPageName = response[rootPage]["props"].name;
} else {
rootPage = Object.keys(response)[0];
pages = response[rootPage].children["home"].children;
parentPageName = response[rootPage].children["home"]["props"].name;
}
console.log(parentPageName);
//console.log(pages);
var promises = Object.entries(pages).map((node) => {
if (node[1]["props"].hidden == false){
return createPageNode(node, 1).then((gadgetHtml) => {
allHtml[node[0]] = gadgetHtml;
});
}
});
return Promise.all(promises);
}).then(() => {
var pageListUL = document.createElement('ul');
pageListUL.className = "menuUl1";
if (Object.keys(allHtml).length != 0) {
Object.entries(pages).forEach((entry) => {
if (allHtml[entry[0]]){
pageListUL.appendChild(allHtml[entry[0]]);
}
});
}
var parentPageTitle = document.createElement('div');
parentPageTitle.className = "woo_parentPageTitle";
parentPageTitle.append(parentPageName);
var menuOpenClose = document.createElement('span');
menuOpenClose.className = "material-symbols-outlined";
menuOpenClose.classList.add("woo_menuOpenClose");
menuOpenClose.setAttribute("rotate", false);
menuOpenClose.append("keyboard_arrow_down");
parentPageTitle.appendChild(menuOpenClose);
form.appendChild(parentPageTitle);
form.appendChild(pageListUL);
var str = form.innerHTML;
woo.updateGadgetProperty("gkxwvsqf_2024810131454_191", woo.instanceDB, "toolbarBuild", str, woo.getCurrentPage()).then(() => {
$(".menuClick_gkxwvsqf_2024810131454_191").unbind();
$(".menuClick_gkxwvsqf_2024810131454_191").on("click", function(){
if ($(this).attr("linked") == "true"){
if ($(this).attr("linkID") != ""){
showPage = $(this).attr("linkID");
changePage(showPage);
} else {
window.location = $(this).attr("linkURL");
}
} else {
showPage = $(this).attr("showPage");
changePage(showPage);
}
});
resolve("done");
}).catch((err) => {
console.error(err);
reject(err);
});
}).catch((error) => {
console.error(error);
reject(error);
});
});
}
function createPageNode(page, level){
return new Promise((resolve) => {
//create li
var pageLI = document.createElement('li');
pageLI.className = "menuLi1";
var menuMouseOverID = page[0];
pageLI.id = menuMouseOverID;
var nameSpan = document.createElement('button');
nameSpan.className = "woo_menuName";
nameSpan.classList.add("menuClick_gkxwvsqf_2024810131454_191");
pageCount++;
nameSpan.innerText = page[1]["props"].name;
if (page[1]["props"].linked == "true" || page[1]["props"].linked == true){
nameSpan.setAttribute("linked", page[1]["props"].linked);
nameSpan.setAttribute("linkID", page[1]["props"].linkID);
nameSpan.setAttribute("linkURL", page[1]["props"].linkURL);
} else {
nameSpan.setAttribute("showPage", page[0]);
}
nameSpan.setAttribute("menuid", page[0]);
pageLI.appendChild(nameSpan);
resolve(pageLI);
});
}
$("#gkxwvsqf_2024810131454_191 .woo_menuOpenClose").on("click", function(){
$("#gkxwvsqf_2024810131454_191 ul").toggle();
if ($(this).attr("rotate") == "true"){
$(this).attr("rotate", false).css("transform", 'rotate(0deg)');
} else {
$(this).attr("rotate", true).css("transform", 'rotate(180deg)');
}
});
$(".menuClick_gkxwvsqf_2024810131454_191").on("click", function(){
if ($(this).attr("linked")){
if ($(this).attr("linkID") != ""){
showPage = $(this).attr("linkID");
changePage(showPage);
} else {
window.location = $(this).attr("linkURL");
}
} else {
showPage = $(this).attr("showPage");
changePage(showPage);
}
});
function changePage(showPage) {
Promise.all([woo.updateCurrentPage(showPage)]).then(() => {
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
}
return gkxwvsqf_2024810131454_191_Global;
})();var gkxwvsqf_202382815548_882_561_428 = (function() {
var self = document.getElementById('gkxwvsqf_202382815548_882_561_428');
//self.classList.add("sun_editor_content");
var gkxwvsqf_202382815548_882_561_428_Global = {};
gkxwvsqf_202382815548_882_561_428_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_202382815548_882_561_428");
}
return gkxwvsqf_202382815548_882_561_428_Global;
})();var gkxwvsqf_202541292044_302c5v = (function() {
var self = document.getElementById('gkxwvsqf_202541292044_302c5v');
var loginDom = document.getElementById('checkoutLogin');
var gkxwvsqf_202541292044_302c5v_Global = {};
var loggedIn = false;
var loggingInOrOut = false;
var modelContent = null;
var openModal = false;
var isGuest = false;
var whatIs = document.querySelector(".woo_whatIsWooID_gkxwvsqf_202541292044_302c5v");
var forgotPass = document.querySelector(".forgot_pass_gkxwvsqf_202541292044_302c5v");
function getUserDetails(){
return new Promise((resolve, reject) => {
$.ajax({
type: "GET",
url: woo.getAuthServer() + "/app/getUser/" + woo.sessionData.user_id,
headers: {
"Authorization": "Bearer " + woo.sessionData.token + ":" + woo.sessionData.password
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
cache: false,
timeout: 10000,
}).then((userData) => {
resolve(userData);
}).catch((error) => {
console.error(error);
reject(error);
});
});
}
if(woo.sessionData){
getUserDetails().then((userData) => {
$("#guestUserRegistration").show();
$("#updateDetails, #updateDetailsLabel").show();
$("#firstNameGuest").val(userData.name);
$("#lastNameGuest").val(userData.lastName);
$("#phoneGuest").val(userData.number);
$("#emailGuest").val(userData.email).prop('disabled', true);
$("#isGuest").val(isGuest);
});
}
function getAppData(){
return new Promise((resolve) => {
var url = woo.getRemoteCouch() + "/gatemaster$public/gatemaster-invoice-settings";
var data = {}
resolve(woo.queryCouch(url, "GET", data));
}).catch((error) => {
return null;
});
}
getAppData().then((data) => {
if (data){
$("#gkxwvsqf_202541292044_302c5v .website_name").html(data.brandName);
$("#gkxwvsqf_202541292044_302c5v #fullLogoImage").attr("src", "/resources/gatemaster/uploads/" + data.logoImage);
}
})
function forgotPass_gkxwvsqf_202541292044_302c5v(){
woo.updateCurrentPage("forgot-password");
}
function whatIsClick_gkxwvsqf_202541292044_302c5v(){
var note = "
What is the Woo ID?
With a growing awareness of on-line privacy and security issues, further tightening of the spam laws worldwide and the need for businesses to have more robust collection of data systems in place, Woo has risen to the challenge by creating a universal ID for users on the platform - called a Woo ID.
The Woo ID provides you with the security that Woo is dedicated, and bound by law, to ensure your information is kept private and that all anti-spam laws are adhered to. Every user added to a Woo website gets to verify their email address. This ensures issues with data entry and out-of-date email accounts are spotted early.
The Woo ID universal ID is the market leader: creating a safe and spam free environment for you.
';
html += '';
html += '';
spanAbout.innerHTML = html;
self.appendChild(spanAbout);
}
function escapeHtml(str) {
var div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
function getCart(showCartFlag) {
var cart = getCookie("shoppingCart");
console.log("Checkout getCart() loaded from cookie:", JSON.stringify(cart, null, 2));
if (!cart) {
cart = { items: [] };
setCookie("shoppingCart", cart, 7);
}
if (showCartFlag) {
showCartgkxwvsqf_2025411102238_303hdl(cart);
}
return cart;
}
function clearCartgkxwvsqf_2025411102238_303hdl() {
const cart = { items: [] };
setCookie('shoppingCart', cart, 7);
showCartgkxwvsqf_2025411102238_303hdl(cart);
return cart;
}
function removeFromCartgkxwvsqf_2025411102238_303hdl(uniqueKey) {
const cart = getCart(false);
console.log("Removing item with uniqueKey:", uniqueKey);
cart.items = cart.items.filter(item => (item.uniqueKey || item.stockCode) !== uniqueKey);
setCookie('shoppingCart', cart, 7);
showCartgkxwvsqf_2025411102238_303hdl(cart);
return cart;
}
// Initial load
getCart(true);
// Events
$(document).on("click", "#clearCartgkxwvsqf_2025411102238_303hdl", clearCartgkxwvsqf_2025411102238_303hdl);
$(document).on("click", ".delete-item", function() {
var uniqueKey = $(this).attr("data-unique-key");
if (uniqueKey) removeFromCartgkxwvsqf_2025411102238_303hdl(uniqueKey);
});
gkxwvsqf_2025411102238_303hdl_Global.clearCart = () => clearCartgkxwvsqf_2025411102238_303hdl();
gkxwvsqf_2025411102238_303hdl_Global.unload = () => {
$(document).off("click", "#clearCartgkxwvsqf_2025411102238_303hdl");
$(document).off("click", ".delete-item");
console.log("Unloaded gkxwvsqf_2025411102238_303hdl");
};
return gkxwvsqf_2025411102238_303hdl_Global;
})();var gkxwvsqf_20254121434_303of9 = (function() {
var self = document.getElementById('gkxwvsqf_20254121434_303of9');
var gkxwvsqf_20254121434_303of9_Global = {};
var openModal = false;
var keyData = "";
var emailAddress = "";
function closeButtonPressed_gkxwvsqf_20254121434_303of9(){
$(".woo-dialogBox").remove();
openModal = false;
}
function makeModal_gkxwvsqf_20254121434_303of9(content){
openModal = true;
var dialogBox = document.createElement('div');
dialogBox.className = "woo-dialogBox";
document.getElementsByClassName("wooMainContent")[0].appendChild(dialogBox);
var closeBox = document.createElement('button');
closeBox.className = 'woo-dialogClose';
closeBox.classList.add('material-symbols-outlined');
closeBox.addEventListener('click', closeButtonPressed_gkxwvsqf_20254121434_303of9);
var dialogContent = document.createElement('div');
dialogContent.className = "woo-dialogContent";
dialogContent.appendChild(closeBox);
var dialogContentContainer = document.createElement('div');
dialogContentContainer.id = "dialogContentContainer";
dialogContentContainer.appendChild(content);
dialogContent.appendChild(dialogContentContainer);
dialogBox.appendChild(dialogContent);
}
// Function to update user details, returning a Promise
function updateUserDetails(userData) {
return new Promise((resolve, reject) => {
$.ajax({
type: "POST",
url: woo.getAuthServer() + "/app/editOwnUser",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer " + woo.sessionData.token + ":" + woo.sessionData.password
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
json: true,
processData: true,
cache: false,
timeout: 10000,
data: JSON.stringify(userData),
success: (response) => {
resolve(response); // Resolve with the response data
},
error: (xhr, status, error) => {
reject(new Error('Failed to update user details: ' + status + ' - ' + error));
}
});
});
}
async function makeUserData(data){
// Validate required fields
if (data.name && data.email && data.number) {
// Clean phone number (remove non-digits)
if (data.number) {
data.number = data.number.replace(/\D/g, '');
}
// Update user details if checkbox is checked
if (updateDetails.checked) {
const userData = {
firstName: data.name,
lastName: data.lastName,
number: data.number,
email: data.email
};
try {
await updateUserDetails(userData); // Await the AJAX call
console.log('User details updated successfully');
} catch (error) {
console.error(error);
alert('Failed to update user details. Please try again.');
return "fail";
}
}
return data;
} else {
//alert("Please either 'Login / Register' or 'Continue as Guest' and fill out all the required fields.");
alert("Please 'Login / Register' to Continue.");
return "fail";
}
}
// Async function to collect form data and update user details if needed
async function getUserdata() {
// Collect form elements
const firstName = document.getElementById('firstNameGuest');
const lastName = document.getElementById('lastNameGuest');
const emailAddress = document.getElementById('emailGuest');
const phoneNumber = document.getElementById('phoneGuest');
const isGuest = document.getElementById('isGuest');
const updateDetails = document.getElementById('updateDetails');
// Validate elements exist
if (firstName.value == null || lastName.value == null || emailAddress.value == null || phoneNumber.value == null){
console.error('One or more form elements not found');
alert("Opps! Please ensure all fields are present.");
return "fail";
}
return woo.checkEmail(emailAddress.value).then(async (response) => {
// Build data object
let data = {
name: firstName.value,
lastName: lastName.value,
email: emailAddress.value,
number: phoneNumber.value,
isGuest: isGuest.value
};
return await makeUserData(data);
}).catch(async (error) => {
if (isGuest.value == "true") {
console.error('Email address already registered');
alert("Good News! This email address is already registered.\n\nPlease login.");
return "fail";
} else {
let data = {
name: firstName.value,
lastName: lastName.value,
email: emailAddress.value,
number: phoneNumber.value,
isGuest: isGuest.value
};
return await makeUserData(data);
}
});
}
function getAddressData(){
var name =$("#name").val();
var firstLine = $("#firstLine").val();
var secondLine = $("#secondLine").val();
var suburb = $("#suburb").val();
var city = $("#city").val();
var country = $("#country").val();
var postcode = $("#postcode").val();
if (name != "" && firstLine != "" && city != "" && postcode != ""){
var data = {
"name": name,
"firstLine": firstLine,
"secondLine": secondLine,
"suburb": suburb,
"city": city,
"country": country,
"postcode": postcode
}
var addressGadgetId = $('.gkxwvsqf_2025412123739').first().attr('id');
if (window[addressGadgetId]){
if (typeof window[addressGadgetId].setAddress === "function") {
window[addressGadgetId].setAddress(data);
}
}
return data;
} else {
alert("Please fill in your full address.");
return "fail";
}
}
function getSelectedCardId() {
// Find the checked radio button with name="cardSelector"
var selectedRadio = $('input[name="cardSelector"]:checked');
var storeNewCard = $('#storeNewCard').is(":checked");
var storeCard = false;
// Check if a radio button is selected
if (selectedRadio.length === 0) {
console.error('No card selected');
return [null, storeNewCard];
}
// Get the id attribute (e.g., "card-0000080201087697" or "card-NewCard")
var radioId = selectedRadio.attr('id');
// Extract the card ID or return "NewCard"
var cardId = radioId.replace('card-', '');
if (cardId == "NewCard") {
storeCard = storeNewCard;
}
return [cardId, storeCard]; // e.g., "0000080201087697" or "NewCard"
}
// Function to get a cookie by name
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length === 2) {
return JSON.parse(decodeURIComponent(parts.pop().split(";").shift()));
}
return null;
}
function extractPaymentDetails(sourceObject) {
// Validate input
if (!sourceObject || typeof sourceObject !== "object" || !sourceObject.lambdaResponse) {
throw new Error("Source object must have a 'lambdaResponse' array");
}
if (!Array.isArray(sourceObject.lambdaResponse) || sourceObject.lambdaResponse.length < 2) {
throw new Error("lambdaResponse array must have at least two elements");
}
// Extract lambdaResponse array
const lambdaResponse = sourceObject.lambdaResponse;
console.log(lambdaResponse);
// Extract fields
const sessionData = lambdaResponse[0] || {};
const invoiceId = lambdaResponse[1] || "";
// Find the redirect link (href where rel is "hpp")
const redirectLinkObj = sessionData.links?.find(link => link.rel === "hpp") || {};
const redirectLink = redirectLinkObj.href || "";
// Extract id
const id = sessionData.id || "";
// Validate extracted fields
if (!id) {
throw new Error("Session ID is missing");
}
if (!invoiceId) {
throw new Error("Invoice ID is missing");
}
if (!redirectLink) {
throw new Error("No valid redirect link found with rel='hpp'");
}
return {
id,
invoiceId,
redirectLink
};
}
function getCardPayment(invoiceData, hostName, cardId){
console.log(invoiceData, hostName, cardId);
return new Promise((resolve, reject) => {
$.ajax({
type: "POST",
url: woo.getAuthServer() + "/app/runJS/invoice/purchaseWithExistingCard",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer " + woo.sessionData.token + ":" + woo.sessionData.password
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
json: true,
processData: true,
cache: false,
timeout: 10000,
data: JSON.stringify({
"data": {
"invoice": invoiceData,
"cardId": cardId,
"hostName": hostName
}
})
}).then((paymentData) => {
resolve(paymentData);
}).catch((error) => {
console.error(error);
reject(error);
});
});
}
function getGateway(invoiceData, isGuest, storeCard, hostName){
return new Promise((resolve, reject) => {
$.ajax({
type: "POST",
url: woo.getAuthServer() + "/app/runJS/invoice/purchase",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer " + woo.sessionData.token + ":" + woo.sessionData.password
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
json: true,
processData: true,
cache: false,
timeout: 10000,
data: JSON.stringify({
"data": {
"invoice": invoiceData,
"isGuest": isGuest,
"storeCard": storeCard,
"hostName": hostName
}
})
}).then((gatewayData) => {
resolve(gatewayData);
}).catch((error) => {
console.error(error);
reject(error);
});
});
}
function completePurchase(dataObject, email){
return new Promise((resolve, reject) => {
$.ajax({
type: "POST",
url: woo.getAuthServer() + "/app/runJS/invoice/completePurchase",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer " + woo.sessionData.token + ":" + woo.sessionData.password
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
json: true,
processData: true,
cache: false,
timeout: 10000,
data: JSON.stringify({
data: {
sessionID: dataObject.id,
invoiceID: dataObject.invoiceId
}
})
}).then((transactionResult) => {
resolve(transactionResult);
}).catch((error) => {
console.error(error);
reject(error);
});
});
}
function completeAndSendOrder(invoiceData, hostName){
console.log(invoiceData, hostName);
return new Promise((resolve, reject) => {
$.ajax({
type: "POST",
url: woo.getAuthServer() + "/app/runJS/invoice/completeInvoiceAndEmail",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer " + woo.sessionData.token + ":" + woo.sessionData.password
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
json: true,
processData: true,
cache: false,
timeout: 10000,
data: JSON.stringify({
"data": {
"invoice": invoiceData,
"hostName": hostName
}
})
}).then((resultData) => {
resolve(resultData);
}).catch((error) => {
console.error(error);
reject(error);
});
});
}
// Define the listener function
function handlePaymentMessage(event) {
console.log("Received message:", event);
const iFrame = document.getElementById('gatewayIFrame');
if (!iFrame) {
console.warn('Iframe not found');
return;
}
// Handle payment actions
if (event.data.action === 'paymentSuccess') {
iFrame.remove();
hasiFrame = false;
// Do extra (e.g., update UI, notify server)
$("#dialogContentContainer").html("
Congratulations!
Your payment was successfull!
Please wait a moment while we do smart things and complete the transaction...
");
// Remove listener to prevent further processing
window.removeEventListener('message', handlePaymentMessage);
//complete the purchase
completePurchase(keyData, emailAddress).then((result) => {
console.log(result);
$("#dialogContentContainer").html("
Congratulations!
Transaction completed!
An email has been sent to you with a link to your invoice.
");
});
//finally clear the basket and remove the cookie
var basketGadgetId = $('.gkxwvsqf_2025411102238').first().attr('id');
if (window[basketGadgetId]){
if (typeof window[basketGadgetId].clearCart === "function") {
window[basketGadgetId].clearCart();
}
}
} else if (event.data.action === 'paymentFail') {
iFrame.remove();
hasiFrame = false;
// Do extra
console.log('Payment failed');
$("#dialogContentContainer").html("
Sorry!
Your payment was unsuccessfull!
Please close this box and try again.
");
window.removeEventListener('message', handlePaymentMessage);
} else if (event.data.action === 'paymentCancel') {
iFrame.remove();
hasiFrame = false;
// Do extra
console.log('Payment cancelled');
$(".woo-dialogBox").remove();
openModal = false;
window.removeEventListener('message', handlePaymentMessage);
}
}
function openLoadingModel(message){
$(".woo-dialogBox").remove();
var form = document.createElement('div');
var title = document.createElement('span');
title.className = "dialog_title";
title.innerHTML = message;
form.appendChild(title);
makeModal_gkxwvsqf_20254121434_303of9(form);
}
var hasiFrame = false;
function openGateway(data){
$(".woo-dialogBox").remove();
var form = document.createElement('div');
var title = document.createElement('span');
title.className = "dialog_title";
title.innerHTML = "
Enter Payment Details
Note: DO NOT leave or refresh the page until this is completed
";
form.appendChild(title);
var iframe = document.createElement('iFrame');
iframe.classList.add('gatewayIFrame'); // Add class for styling
iframe.src = data.redirectLink; // Set the URL to load (e.g., Windcave payment page)
iframe.id = 'gatewayIFrame'; // Optional: Add an ID for easy reference
iframe.name = 'gatewayIFrame'; // Optional: Useful for form submissions targeting the iframe
iframe.width = '100%'; // Optional: Set width (adjust as needed)
iframe.height = '600'; // Optional: Set height (adjust based on content)
iframe.frameBorder = '0'; // Optional: Remove border for cleaner look
form.appendChild(iframe);
makeModal_gkxwvsqf_20254121434_303of9(form);
hasiFrame = true;
// Add the listener
window.addEventListener('message', handlePaymentMessage);
}
function getCountryName(countryCode) {
/**
* Returns the full country name given a two-letter ISO 3166-1 alpha-2 country code.
* Returns 'Unknown Country Code' if the code is not found.
*/
const countryCodes = {
'AD': 'Andorra',
'AE': 'United Arab Emirates',
'AF': 'Afghanistan',
'AG': 'Antigua and Barbuda',
'AI': 'Anguilla',
'AL': 'Albania',
'AM': 'Armenia',
'AO': 'Angola',
'AQ': 'Antarctica',
'AR': 'Argentina',
'AS': 'American Samoa',
'AT': 'Austria',
'AU': 'Australia',
'AW': 'Aruba',
'AX': 'Åland Islands',
'AZ': 'Azerbaijan',
'BA': 'Bosnia and Herzegovina',
'BB': 'Barbados',
'BD': 'Bangladesh',
'BE': 'Belgium',
'BF': 'Burkina Faso',
'BG': 'Bulgaria',
'BH': 'Bahrain',
'BI': 'Burundi',
'BJ': 'Benin',
'BL': 'Saint Barthélemy',
'BM': 'Bermuda',
'BN': 'Brunei Darussalam',
'BO': 'Bolivia',
'BQ': 'Bonaire, Sint Eustatius and Saba',
'BR': 'Brazil',
'BS': 'Bahamas',
'BT': 'Bhutan',
'BV': 'Bouvet Island',
'BW': 'Botswana',
'BY': 'Belarus',
'BZ': 'Belize',
'CA': 'Canada',
'CC': 'Cocos (Keeling) Islands',
'CD': 'Congo, Democratic Republic of the',
'CF': 'Central African Republic',
'CG': 'Congo',
'CH': 'Switzerland',
'CI': "Côte d'Ivoire",
'CK': 'Cook Islands',
'CL': 'Chile',
'CM': 'Cameroon',
'CN': 'China',
'CO': 'Colombia',
'CR': 'Costa Rica',
'CU': 'Cuba',
'CV': 'Cabo Verde',
'CW': 'Curaçao',
'CX': 'Christmas Island',
'CY': 'Cyprus',
'CZ': 'Czechia',
'DE': 'Germany',
'DJ': 'Djibouti',
'DK': 'Denmark',
'DM': 'Dominica',
'DO': 'Dominican Republic',
'DZ': 'Algeria',
'EC': 'Ecuador',
'EE': 'Estonia',
'EG': 'Egypt',
'EH': 'Western Sahara',
'ER': 'Eritrea',
'ES': 'Spain',
'ET': 'Ethiopia',
'FI': 'Finland',
'FJ': 'Fiji',
'FK': 'Falkland Islands (Malvinas)',
'FM': 'Micronesia, Federated States of',
'FO': 'Faroe Islands',
'FR': 'France',
'GA': 'Gabon',
'GB': 'United Kingdom',
'GD': 'Grenada',
'GE': 'Georgia',
'GF': 'French Guiana',
'GG': 'Guernsey',
'GH': 'Ghana',
'GI': 'Gibraltar',
'GL': 'Greenland',
'GM': 'Gambia',
'GN': 'Guinea',
'GP': 'Guadeloupe',
'GQ': 'Equatorial Guinea',
'GR': 'Greece',
'GS': 'South Georgia and the South Sandwich Islands',
'GT': 'Guatemala',
'GU': 'Guam',
'GW': 'Guinea-Bissau',
'GY': 'Guyana',
'HK': 'Hong Kong',
'HM': 'Heard Island and McDonald Islands',
'HN': 'Honduras',
'HR': 'Croatia',
'HT': 'Haiti',
'HU': 'Hungary',
'ID': 'Indonesia',
'IE': 'Ireland',
'IL': 'Israel',
'IM': 'Isle of Man',
'IN': 'India',
'IO': 'British Indian Ocean Territory',
'IQ': 'Iraq',
'IR': 'Iran, Islamic Republic of',
'IS': 'Iceland',
'IT': 'Italy',
'JE': 'Jersey',
'JM': 'Jamaica',
'JO': 'Jordan',
'JP': 'Japan',
'KE': 'Kenya',
'KG': 'Kyrgyzstan',
'KH': 'Cambodia',
'KI': 'Kiribati',
'KM': 'Comoros',
'KN': 'Saint Kitts and Nevis',
'KP': "Korea, Democratic People's Republic of",
'KR': 'Korea, Republic of',
'KW': 'Kuwait',
'KY': 'Cayman Islands',
'KZ': 'Kazakhstan',
'LA': "Lao People's Democratic Republic",
'LB': 'Lebanon',
'LC': 'Saint Lucia',
'LI': 'Liechtenstein',
'LK': 'Sri Lanka',
'LR': 'Liberia',
'LS': 'Lesotho',
'LT': 'Lithuania',
'LU': 'Luxembourg',
'LV': 'Latvia',
'LY': 'Libya',
'MA': 'Morocco',
'MC': 'Monaco',
'MD': 'Moldova, Republic of',
'ME': 'Montenegro',
'MF': 'Saint Martin (French part)',
'MG': 'Madagascar',
'MH': 'Marshall Islands',
'MK': 'North Macedonia',
'ML': 'Mali',
'MM': 'Myanmar',
'MN': 'Mongolia',
'MO': 'Macao',
'MP': 'Northern Mariana Islands',
'MQ': 'Martinique',
'MR': 'Mauritania',
'MS': 'Montserrat',
'MT': 'Malta',
'MU': 'Mauritius',
'MV': 'Maldives',
'MW': 'Malawi',
'MX': 'Mexico',
'MY': 'Malaysia',
'MZ': 'Mozambique',
'NA': 'Namibia',
'NC': 'New Caledonia',
'NE': 'Niger',
'NF': 'Norfolk Island',
'NG': 'Nigeria',
'NI': 'Nicaragua',
'NL': 'Netherlands',
'NO': 'Norway',
'NP': 'Nepal',
'NR': 'Nauru',
'NU': 'Niue',
'NZ': 'New Zealand',
'OM': 'Oman',
'PA': 'Panama',
'PE': 'Peru',
'PF': 'French Polynesia',
'PG': 'Papua New Guinea',
'PH': 'Philippines',
'PK': 'Pakistan',
'PL': 'Poland',
'PM': 'Saint Pierre and Miquelon',
'PN': 'Pitcairn',
'PR': 'Puerto Rico',
'PS': 'Palestine, State of',
'PT': 'Portugal',
'PW': 'Palau',
'PY': 'Paraguay',
'QA': 'Qatar',
'RE': 'Réunion',
'RO': 'Romania',
'RS': 'Serbia',
'RU': 'Russian Federation',
'RW': 'Rwanda',
'SA': 'Saudi Arabia',
'SB': 'Solomon Islands',
'SC': 'Seychelles',
'SD': 'Sudan',
'SE': 'Sweden',
'SG': 'Singapore',
'SH': 'Saint Helena, Ascension and Tristan da Cunha',
'SI': 'Slovenia',
'SJ': 'Svalbard and Jan Mayen',
'SK': 'Slovakia',
'SL': 'Sierra Leone',
'SM': 'San Marino',
'SN': 'Senegal',
'SO': 'Somalia',
'SR': 'Suriname',
'SS': 'South Sudan',
'ST': 'Sao Tome and Principe',
'SV': 'El Salvador',
'SX': 'Sint Maarten (Dutch part)',
'SY': 'Syrian Arab Republic',
'SZ': 'Eswatini',
'TC': 'Turks and Caicos Islands',
'TD': 'Chad',
'TF': 'French Southern Territories',
'TG': 'Togo',
'TH': 'Thailand',
'TJ': 'Tajikistan',
'TK': 'Tokelau',
'TL': 'Timor-Leste',
'TM': 'Turkmenistan',
'TN': 'Tunisia',
'TO': 'Tonga',
'TR': 'Türkiye',
'TT': 'Trinidad and Tobago',
'TV': 'Tuvalu',
'TW': 'Taiwan, Province of China',
'TZ': 'Tanzania, United Republic of',
'UA': 'Ukraine',
'UG': 'Uganda',
'UM': 'United States Minor Outlying Islands',
'US': 'United States of America',
'UY': 'Uruguay',
'UZ': 'Uzbekistan',
'VA': 'Holy See',
'VC': 'Saint Vincent and the Grenadines',
'VE': 'Venezuela, Bolivarian Republic of',
'VG': 'Virgin Islands (British)',
'VI': 'Virgin Islands (U.S.)',
'VN': 'Viet Nam',
'VU': 'Vanuatu',
'WF': 'Wallis and Futuna',
'WS': 'Samoa',
'YE': 'Yemen',
'YT': 'Mayotte',
'ZA': 'South Africa',
'ZM': 'Zambia',
'ZW': 'Zimbabwe'
};
// Convert input to uppercase to handle lowercase inputs
countryCode = countryCode.toUpperCase();
// Return country name if found, otherwise return 'Unknown Country Code'
return countryCodes[countryCode] || 'Unknown Country Code';
}
async function getPayment(){
var cart = getCookie("shoppingCart");
console.log(cart);
if (cart && cart.items && Array.isArray(cart.items) && cart.items.length > 0) {
var $button = $("#buyButton");
var originalHtml = $button.html();
var cardId = getSelectedCardId()[0];
var storeCard = getSelectedCardId()[1];
console.log(cardId);
if (!cardId || cardId == "NewCard"){
openLoadingModel("
An email has been sent to you with a link to your invoice.
");
//finally clear the basket and remove the cookie
var basketGadgetId = $('.gkxwvsqf_2025411102238').first().attr('id');
if (window[basketGadgetId]){
if (typeof window[basketGadgetId].clearCart === "function") {
window[basketGadgetId].clearCart();
}
}
} else {
openLoadingModel("
An email has been sent to you with a link to your order Invoice.
");
//finally clear the basket and remove the cookie
var basketGadgetId = $('.gkxwvsqf_2025411102238').first().attr('id');
if (window[basketGadgetId]){
if (typeof window[basketGadgetId].clearCart === "function") {
window[basketGadgetId].clearCart();
}
}
} else {
openLoadingModel("
Sorry!
Your order could not be sent!
Please contact support.
");
}
} else {
openLoadingModel("
Sorry!
Your order could not be sent!
Please contact support.
");
}
$button.html(originalHtml).prop("disabled", false).css({"background-color": "#5eb917", "box-shadow": "0 1px 2px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.19)", "color": "#fff"});
});
} else {
$(".woo-dialogBox").remove();
openModal = false;
$button.html(originalHtml).prop("disabled", false).css({"background-color": "#5eb917", "box-shadow": "0 1px 2px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.19)", "color": "#fff"});
}
} else {
$(".woo-dialogBox").remove();
openModal = false;
$button.html(originalHtml).prop("disabled", false).css({"background-color": "#5eb917", "box-shadow": "0 1px 2px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.19)", "color": "#fff"});
}
} else {
alert("Please add items to the Shopping Cart.");
}
}
$("#buyButton").on("click", getPayment);
$("#invoiceButton").on("click", sendOrder);
gkxwvsqf_20254121434_303of9_Global.unload = () => {
//Unload callbacks here
if (hasiFrame){
window.removeEventListener('message', handlePaymentMessage);
}
$("#invoiceButton").off("click", sendOrder);
$("#buyButton").off("click", getPayment);
console.log("Unloaded gkxwvsqf_20254121434_303of9");
}
return gkxwvsqf_20254121434_303of9_Global;
})();var box_container_573 = (function() {
var box_container_573_Global = {};
var self = $("#box_container_573");
box_container_573_Global.unload = () => {
//Unload callbacks here
window.removeEventListener("resize", setLeftOnPercent);
console.log("Unloaded box_container_573");
}
setLeftOnPercent();
window.addEventListener("resize", setLeftOnPercent);
var currentTop = parseInt($(self).css("top"));
function fixDiv() {
var scrollTop = parseInt($(window).scrollTop());
var newTop = currentTop;
if ($("#property_toolbar").length > 0) {
var elemToolBar = $("#property_toolbar");
var elemHeight = window.getComputedStyle(elemToolBar[0]).height;
var elemPosition = elemToolBar.position();
var elemTop = elemPosition.top;
var elemBottom = parseInt(elemTop) + parseInt(elemHeight);
newTop = elemBottom + currentTop;
}
var currentPosition = ((parseInt($(self).css("top")) - newTop) + parseInt($(self).css("min-height")));
if (!isNaN(currentPosition) && !isNaN(scrollTop) && (newTop => 0)){
//console.log("scrollTop: " + scrollTop);
//console.log("currentPosition: " + currentPosition);
//console.log("newTop: " + newTop);
if (scrollTop > (currentPosition + 100)) {
$(self).css({'position': 'fixed', 'top': newTop}).slideDown('slow');
} else {
$(self).css({'position': 'absolute', 'top': '0px'});
}
}
}
//$(window).scroll(fixDiv);
function setLeftOnPercent(){
var container = $(self).parent();
var containerWidth = container.css("width");
var boxWidth = "100%";
var mainWrapper = document.querySelector("#woo_ui_wrapper");
if (mainWrapper){
var docWidth = $("#woo_ui_wrapper").width();
}else{
var docWidth = $(window).width();
}
if (boxWidth.indexOf("%") > -1){
if ((parseInt(containerWidth) < docWidth) && (containerWidth != "100%")){
//if ((parseInt(containerWidth) < docWidth)){
var intWidth = parseInt(boxWidth);
var newWidth = parseInt((docWidth * (intWidth/100)));
var leftSide1 =((docWidth - newWidth)/2);
var leftSide2 = ((docWidth - parseInt(container.css("width")))/2);
leftValue = leftSide2 - leftSide1;
$(self).css({"width": newWidth + "px", "margin-left": "0px", "margin-right": "0px", "left": -leftValue + "px"});
}
}
}
return box_container_573_Global;
})();var box_container_327 = (function() {
var box_container_327_Global = {};
var self = $("#box_container_327");
box_container_327_Global.unload = () => {
//Unload callbacks here
window.removeEventListener("resize", setLeftOnPercent);
console.log("Unloaded box_container_327");
}
setLeftOnPercent();
window.addEventListener("resize", setLeftOnPercent);
var currentTop = parseInt($(self).css("top"));
function fixDiv() {
var scrollTop = parseInt($(window).scrollTop());
var newTop = currentTop;
if ($("#property_toolbar").length > 0) {
var elemToolBar = $("#property_toolbar");
var elemHeight = window.getComputedStyle(elemToolBar[0]).height;
var elemPosition = elemToolBar.position();
var elemTop = elemPosition.top;
var elemBottom = parseInt(elemTop) + parseInt(elemHeight);
newTop = elemBottom + currentTop;
}
var currentPosition = ((parseInt($(self).css("top")) - newTop) + parseInt($(self).css("min-height")));
if (!isNaN(currentPosition) && !isNaN(scrollTop) && (newTop => 0)){
//console.log("scrollTop: " + scrollTop);
//console.log("currentPosition: " + currentPosition);
//console.log("newTop: " + newTop);
if (scrollTop > (currentPosition + 100)) {
$(self).css({'position': 'fixed', 'top': newTop}).slideDown('slow');
} else {
$(self).css({'position': 'absolute', 'top': '0px'});
}
}
}
//$(window).scroll(fixDiv);
function setLeftOnPercent(){
var container = $(self).parent();
var containerWidth = container.css("width");
var boxWidth = "100%";
var mainWrapper = document.querySelector("#woo_ui_wrapper");
if (mainWrapper){
var docWidth = $("#woo_ui_wrapper").width();
}else{
var docWidth = $(window).width();
}
if (boxWidth.indexOf("%") > -1){
if ((parseInt(containerWidth) < docWidth) && (containerWidth != "100%")){
//if ((parseInt(containerWidth) < docWidth)){
var intWidth = parseInt(boxWidth);
var newWidth = parseInt((docWidth * (intWidth/100)));
var leftSide1 =((docWidth - newWidth)/2);
var leftSide2 = ((docWidth - parseInt(container.css("width")))/2);
leftValue = leftSide2 - leftSide1;
$(self).css({"width": newWidth + "px", "margin-left": "0px", "margin-right": "0px", "left": -leftValue + "px"});
}
}
}
return box_container_327_Global;
})();var box_container_992 = (function() {
var box_container_992_Global = {};
var self = $("#box_container_992");
box_container_992_Global.unload = () => {
//Unload callbacks here
window.removeEventListener("resize", setLeftOnPercent);
console.log("Unloaded box_container_992");
}
setLeftOnPercent();
window.addEventListener("resize", setLeftOnPercent);
var currentTop = parseInt($(self).css("top"));
function fixDiv() {
var scrollTop = parseInt($(window).scrollTop());
var newTop = currentTop;
if ($("#property_toolbar").length > 0) {
var elemToolBar = $("#property_toolbar");
var elemHeight = window.getComputedStyle(elemToolBar[0]).height;
var elemPosition = elemToolBar.position();
var elemTop = elemPosition.top;
var elemBottom = parseInt(elemTop) + parseInt(elemHeight);
newTop = elemBottom + currentTop;
}
var currentPosition = ((parseInt($(self).css("top")) - newTop) + parseInt($(self).css("min-height")));
if (!isNaN(currentPosition) && !isNaN(scrollTop) && (newTop => 0)){
//console.log("scrollTop: " + scrollTop);
//console.log("currentPosition: " + currentPosition);
//console.log("newTop: " + newTop);
if (scrollTop > (currentPosition + 100)) {
$(self).css({'position': 'fixed', 'top': newTop}).slideDown('slow');
} else {
$(self).css({'position': 'absolute', 'top': '0px'});
}
}
}
//$(window).scroll(fixDiv);
function setLeftOnPercent(){
var container = $(self).parent();
var containerWidth = container.css("width");
var boxWidth = "100%";
var mainWrapper = document.querySelector("#woo_ui_wrapper");
if (mainWrapper){
var docWidth = $("#woo_ui_wrapper").width();
}else{
var docWidth = $(window).width();
}
if (boxWidth.indexOf("%") > -1){
if ((parseInt(containerWidth) < docWidth) && (containerWidth != "100%")){
//if ((parseInt(containerWidth) < docWidth)){
var intWidth = parseInt(boxWidth);
var newWidth = parseInt((docWidth * (intWidth/100)));
var leftSide1 =((docWidth - newWidth)/2);
var leftSide2 = ((docWidth - parseInt(container.css("width")))/2);
leftValue = leftSide2 - leftSide1;
$(self).css({"width": newWidth + "px", "margin-left": "0px", "margin-right": "0px", "left": -leftValue + "px"});
}
}
}
return box_container_992_Global;
})();var gkxwvsqf_2023913213116_2984fc = (function() {
var self = document.getElementById('gkxwvsqf_2023913213116_2984fc');
var gkxwvsqf_2023913213116_2984fc_Global = {};
gkxwvsqf_2023913213116_2984fc_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023913213116_2984fc");
}
return gkxwvsqf_2023913213116_2984fc_Global;
})();var gkxwvsqf_2023913213116_298w0m = (function() {
var self = document.getElementById('gkxwvsqf_2023913213116_298w0m');
var gkxwvsqf_2023913213116_298w0m_Global = {};
gkxwvsqf_2023913213116_298w0m_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2023913213116_298w0m");
}
return gkxwvsqf_2023913213116_298w0m_Global;
})();var gkxwvsqf_2025419135123__50_127 = (function() {
var self = document.getElementById('gkxwvsqf_2025419135123__50_127');
var gkxwvsqf_2025419135123__50_127_Global = {};
gkxwvsqf_2025419135123__50_127_Global.unload = () => {
//Unload callbacks here
console.log("Unloaded gkxwvsqf_2025419135123__50_127");
}
return gkxwvsqf_2025419135123__50_127_Global;
})();