(function () {
window.customizerData = {"url":"https:\/\/customizer.theextensions.com\/storefront\/yiztnpnc8t","script":"https:\/\/customizer.theextensions.com\/js\/product_customizer.js","settings":{"id":22,"store_id":22,"button_label":"Personalize","button_text_color":"#FFF","button_bg_color":"#0054a6","popup_width":"50vw","popup_height":"50vh","button_placement":"below_add_to_cart","temp_product_id":6343,"text_min_size":null,"text_max_size":null,"image_max_mb":5,"image_formats":null,"created_at":"2026-10-01T16:18:35.000000Z","updated_at":"2026-10-01T17:39:39.000000Z"},"enabled":true,"place":{"id":"below_add_to_cart","label":"Below \"Add to Cart\"","selectors":[{"selector":"input#form-action-addToCart","position":"after"},{"selector":"button#form-action-addToCart","position":"after"},{"selector":"input.add-to-cart-buttons","position":"after"},{"selector":"button.add-to-cart-buttons","position":"after"}]},"currency":{"code":null,"format":null},"bc_client_id":"lixbx136nt8qw9kewi4hxyo42guy4zj"};
window.customizerApplicationBaseApiUrl = customizerData.url;
if (!window.customizerData.enabled) {
return;
}
const addScript = async src => new Promise((resolve, reject) => {
const el = document.createElement('script');
el.src = src;
el.addEventListener('load', resolve);
el.addEventListener('error', reject);
document.body.append(el);
});
const insertPlaceHolders = () => {
let place = window.customizerData.place;
place.selectors.map((sel, index) => {
let element = document.querySelector(sel.selector);
let id = `product-customizer-placeholder-${place.id}-${index}`;
if (element && !document.getElementById(id)) {
let placeHolder = document.createElement(sel.tag ?? 'div');
placeHolder.className = place.id;
placeHolder.id = id;
placeHolder.dataset.productCustomizer = place.id;
placeHolder.innerHTML = ["
"
, "Loading..."
, "
"].join('');
if (sel.position === 'before') {
element.parentNode.insertBefore(placeHolder, element)
} else if (sel.position === 'inside') {
element.append(placeHolder);
} else if (sel.position === 'instead') {
if (element.parentNode) {
element.parentNode.replaceChild(placeHolder, element);
}
} else {
element.parentNode.insertBefore(placeHolder, element.nextSibling);
}
}
});
}
insertPlaceHolders();
setTimeout(() => {
fetch('/api/storefront/carts', {
method: "GET",
credentials: "same-origin"
})
.then(response => response.json())
.then(result => {
window.bigcommerceCartId = result.length ? result[0].id : null;
})
.catch(error => console.error(error));
// Current Customer JWT: signed by BigCommerce, proves the logged-in shopper's
// identity to our backend so it can verify cart ownership cryptographically.
// Guests simply get a 404 here, which is expected and not an error.
if (window.customizerData.bc_client_id) {
fetch('/customer/current.jwt?app_client_id=' + encodeURIComponent(window.customizerData.bc_client_id), {
method: "GET",
credentials: "same-origin"
})
.then(response => response.ok ? response.text() : null)
.then(jwt => {
window.bigcommerceCustomerJwt = jwt || null;
})
.catch(() => {
window.bigcommerceCustomerJwt = null;
});
}
function getProductId() {
const selectors = [
() => document.querySelector('.productView[data-entity-id]')?.dataset.entityId,
() => document.querySelector('.productView[data-ymm-product-id]')?.dataset.ymmProductId,
() => document.querySelector('.productView-options input[name="product_id"]')?.value,
() => window.__bc__?.productId,
];
for (const getValue of selectors) {
const value = getValue();
if (value != null && value !== '') {
const id = Number(value);
if (!Number.isNaN(id)) return id;
}
}
return null;
}
const productId = getProductId();
fetch(window.customizerApplicationBaseApiUrl + '/customizer-config/' + (productId || 0), {
method: "GET",
credentials: "include"
})
.then(response => response.json())
.then(result => {
window.customizerProductData = result;
if (result.csrf_token) window.__CUSTOMIZER_CSRF_TOKEN__ = result.csrf_token;
addScript(customizerData.script + "?v=1").then();
})
.catch(error => console.error(error));
}, 300)
})();