tion1":"Blue","option2":null,"option3":null,"sku":"","requires_shipping":true,"taxable":true,"featured_image":null,"available":true,"name":"Ortlieb Back-Roller Free - Blue","public_title":"Blue","options":["Blue"],"price":15000,"weight":0,"compare_at_price":null,"inventory_management":"shopify","barcode":"","requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/projektride.co.uk\/cdn\/shop\/files\/1889.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/1887.jpg?v=1723801544","\/\/projektride.co.uk\/cdn\/shop\/files\/6125.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6126.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6127.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6128.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6129.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6130.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6131.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6132.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6133.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6134.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6135.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/6136.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/12466.jpg?v=1723801545","\/\/projektride.co.uk\/cdn\/shop\/files\/12467.jpg?v=1723801545"],"featured_image":"\/\/projektride.co.uk\/cdn\/shop\/files\/1889.jpg?v=1723801545","options":["Color"],"media":[{"alt":null,"id":34467809263842,"position":1,"preview_image":{"aspect_ratio":1.356,"height":885,"width":1200,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/1889.jpg?v=1723801545"},"aspect_ratio":1.356,"height":885,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/1889.jpg?v=1723801545","width":1200},{"alt":null,"id":34467809231074,"position":2,"preview_image":{"aspect_ratio":1.356,"height":885,"width":1200,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/1887.jpg?v=1723801544"},"aspect_ratio":1.356,"height":885,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/1887.jpg?v=1723801544","width":1200},{"alt":null,"id":34467809296610,"position":3,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6125.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6125.jpg?v=1723801545","width":768},{"alt":null,"id":34467809329378,"position":4,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6126.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6126.jpg?v=1723801545","width":768},{"alt":null,"id":34467809362146,"position":5,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6127.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6127.jpg?v=1723801545","width":768},{"alt":null,"id":34467809394914,"position":6,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6128.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6128.jpg?v=1723801545","width":768},{"alt":null,"id":34467809427682,"position":7,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6129.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6129.jpg?v=1723801545","width":768},{"alt":null,"id":34467809460450,"position":8,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6130.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6130.jpg?v=1723801545","width":768},{"alt":null,"id":34467809493218,"position":9,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6131.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6131.jpg?v=1723801545","width":768},{"alt":null,"id":34467809525986,"position":10,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6132.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6132.jpg?v=1723801545","width":768},{"alt":null,"id":34467809558754,"position":11,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6133.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6133.jpg?v=1723801545","width":768},{"alt":null,"id":34467809591522,"position":12,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6134.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6134.jpg?v=1723801545","width":768},{"alt":null,"id":34467809624290,"position":13,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6135.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6135.jpg?v=1723801545","width":768},{"alt":null,"id":34467809657058,"position":14,"preview_image":{"aspect_ratio":1.0,"height":768,"width":768,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6136.jpg?v=1723801545"},"aspect_ratio":1.0,"height":768,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/6136.jpg?v=1723801545","width":768},{"alt":null,"id":34467809689826,"position":15,"preview_image":{"aspect_ratio":1.0,"height":1200,"width":1200,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/12466.jpg?v=1723801545"},"aspect_ratio":1.0,"height":1200,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/12466.jpg?v=1723801545","width":1200},{"alt":null,"id":34467809722594,"position":16,"preview_image":{"aspect_ratio":1.0,"height":1200,"width":1200,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/12467.jpg?v=1723801545"},"aspect_ratio":1.0,"height":1200,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/12467.jpg?v=1723801545","width":1200}],"requires_selling_plan":false,"selling_plan_groups":[],"content":"\u003cp\u003e \u003c\/p\u003e\n\u003cp\u003e\u003cspan\u003eIn keeping with its commitment to innovation, ORTLIEB has just introduced another PVC-free line of products made of a polyurethane-coated polyester fabric. The base fabric of the products in the Free Line is coated with polyurethane in a manner that ensures lasting waterproof qualities. The result is a waterproof and durable canvas material that is as outstanding as the conventional ORTLIEB canvas material when it comes to durability and service life. The products in the Free Line are available in classic black and two other appealing colours.\u003cbr\u003e\u003cbr\u003e\u003c\/span\u003e\u003cspan\u003eThe PVC-free version of the proven ORTLIEB Back-Roller was developed for cyclists and outdoor enthusiasts who would like to avoid PVC entirely. This rear pannier bag with a roll closure offers ultimate practicality for all of your bike tours and weekly grocery-shopping ventures, especially on account of its generous payload. Thanks to its waterproof exterior, easy-to-clean interior and shoulder-bag function, the Back-Roller Free is ideal for all who would like to use their bikes despite having things to carry. With the Quick-Lock2.1 system, the bags attach to any bike rack with a tube diameter of up to 16 mm. Larger hooks (e.g. for e-bikes) are available separately.\u003c\/span\u003e\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eFabric: PD62\/PS60\u003c\/li\u003e\n\u003cli\u003eFeatures: QL2.1\u003c\/li\u003e\n\u003cli\u003eHeight: 42cm\u003c\/li\u003e\n\u003cli\u003eWidth: 23 \/ 32cm\u003c\/li\u003e\n\u003cli\u003eDepth: 17cm\u003c\/li\u003e\n\u003cli\u003eVolume: 40L\u003c\/li\u003e\n\u003cli\u003eWeight: 1900g\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003e \u003c\/p\u003e\n\u003c!----\u003e"};
window._RestockRocketConfig.variantsInventoryPolicy = {45820519121122 : "deny",45820519153890 : "deny",};
window._RestockRocketConfig.variantsInventoryQuantity = {45820519121122 : parseInt("1"),45820519153890 : parseInt("1"),};
window._RestockRocketConfig.variantsPreorderCount = {45820519121122 : parseInt(""),45820519153890 : parseInt(""),};
window._RestockRocketConfig.variantsPreorderCountForMarket = {45820519121122 : null,45820519153890 : null,};
window._RestockRocketConfig.variantsPreorderMaxCount = {45820519121122 : parseInt(""),45820519153890 : parseInt(""),};
window._RestockRocketConfig.variantsPreorderMaxCountForMarket = {45820519121122 : null,45820519153890 : null,};
window._RestockRocketConfig.variantsShippingText = {45820519121122 : "",45820519153890 : "",};
window._RestockRocketConfig.variantsShippingTextForMarket = {45820519121122 : null,45820519153890 : null,};
window._RestockRocketConfig.selected_variant_id = 45820519121122;
window._RestockRocketConfig.selected_variant_available = window._RestockRocketConfig.product.variants.find(function(variant) { return variant.id == window._RestockRocketConfig.selected_variant_id }).available;window._RestockRocketConfig.scriptUrlProduct = 'https://cdn.shopify.com/extensions/019dec7f-4f20-7441-9ced-63c38a0a1af0/restockrocket-1-496/assets/restockrocket-product.js'
window._RestockRocketConfig.scriptUrlCollection = 'https://cdn.shopify.com/extensions/019dec7f-4f20-7441-9ced-63c38a0a1af0/restockrocket-1-496/assets/restockrocket-collection.js'
window._RestockRocketConfig.scriptHost = window._RestockRocketConfig.scriptUrlProduct.substring(0, window._RestockRocketConfig.scriptUrlProduct.lastIndexOf('/') + 1)
window._RestockRocketConfig.host = 'https://app.restockrocket.io'
const SETTINGS_CACHE_DURATION = 15 * 60 * 1000; // 15 minutes in milliseconds
const LIQUID_CACHE_MAX_AGE = 15 * 60; // 15 minutes in seconds
// Calculate Liquid cache freshness once at initialization
const liquidRenderedAt = window._RestockRocketConfig.liquidRenderedAt;
// Validate timestamp and calculate cache age
if (!liquidRenderedAt || typeof liquidRenderedAt !== 'number' || isNaN(liquidRenderedAt)) {
console.debug('STOQ - Invalid or missing liquidRenderedAt timestamp, assuming fresh');
window._RestockRocketConfig.isLiquidCacheFresh = true;
} else {
const now = Math.floor(Date.now() / 1000); // Current time in seconds
const liquidCacheAge = now - liquidRenderedAt; // Age in seconds
// Handle client clock ahead of server
if (liquidCacheAge < 0) {
console.debug(`STOQ - Client clock appears ahead of server by ${Math.abs(Math.round(liquidCacheAge / 60))} minutes, assuming cache fresh`);
window._RestockRocketConfig.isLiquidCacheFresh = true;
} else if (liquidCacheAge <= LIQUID_CACHE_MAX_AGE) {
console.debug(`STOQ - Liquid cache is fresh (${Math.round(liquidCacheAge / 60)} minutes old)`);
window._RestockRocketConfig.isLiquidCacheFresh = true;
} else {
console.debug(`STOQ - Liquid cache is stale (${Math.round(liquidCacheAge / 60)} minutes old, max ${Math.round(LIQUID_CACHE_MAX_AGE / 60)} minutes)`);
window._RestockRocketConfig.isLiquidCacheFresh = false;
}
}
function checkSettingsExpiry(settings) {
try {
if (!settings || !settings.updated_at) {
console.debug('STOQ - Invalid settings data structure');
return null;
}
if (!settings.cache) {
console.debug('STOQ - settings caching disabled');
return null;
}
// Check if translations are enabled but missing from cache
// This handles the backfill period where DB has translations but metafield doesn't
if (settings.multi_language_enabled) {
if (!settings.translations) {
// Translations enabled but no translation data in metafield
// Metafield hasn't been backfilled yet - force refresh
console.debug('STOQ - multi-language enabled but no translation data in cache, fetching fresh');
return null;
}
// Translations object exists in metafield - cache is valid
// If current locale isn't translated, applyTranslations will gracefully use default locale from base fields
if (window._RestockRocketConfig.normalizedLocale &&
!Object.prototype.hasOwnProperty.call(settings.translations, window._RestockRocketConfig.normalizedLocale)) {
console.debug('STOQ - locale not explicitly translated, will use default language from cache');
}
// Don't return null - continue using cache even for untranslated locales
}
const updatedAt = new Date(settings.updated_at);
if (isNaN(updatedAt.getTime())) {
console.debug('STOQ - Invalid updated_at date format in settings');
return null;
}
const age = Date.now() - updatedAt.getTime();
if (age
<
SETTINGS_CACHE_DURATION) {
console.debug('STOQ - settings changed recently, skipping cache');
return null;
}
return settings;
} catch (error) {
console.debug('STOQ - Error checking settings cache:', error);
return null;
}
}
function createRestockRocketContainer() {
const restockRocketContainer = document.createElement('div');
restockRocketContainer.id = 'restock-rocket';
document.body.appendChild(restockRocketContainer);
}
function createRestockRocketScript(scriptUrl) {
const restockRocketScriptElement = document.createElement('script');
restockRocketScriptElement.setAttribute('defer', 'defer');
restockRocketScriptElement.src = scriptUrl;
document.body.appendChild(restockRocketScriptElement);
}
createRestockRocketContainer()
console.debug('STOQ - extension activated')
function applyTranslations(settings) {
try {
// Skip translation logic entirely if multi-language is not enabled
if (!settings || !settings.multi_language_enabled) {
return settings;
}
if (!settings.translations) {
console.debug('STOQ - No translations found, skipping translation');
return settings;
}
const normalizedLocale = window._RestockRocketConfig.normalizedLocale;
const translations = settings.translations;
if (!normalizedLocale) {
// No matching locale has translations; drop payload to save memory
console.debug('STOQ - No matching locale for translations. Available:', Object.keys(translations || {}));
delete settings.translations;
return settings;
}
console.debug(`STOQ - Applying translations for normalized locale: ${normalizedLocale} (original: ${window._RestockRocketConfig.locale})`);
const translatedFields = translations[normalizedLocale];
if (translatedFields && typeof translatedFields === 'object') {
Object.keys(translatedFields).forEach(function(key) {
const value = translatedFields[key];
if (value !== null && value !== undefined && value !== '') {
settings[key] = value;
}
});
} else {
console.debug('STOQ - No translated fields found for locale:', normalizedLocale);
}
delete settings.translations;
return settings;
} catch (e) {
console.debug('STOQ - error applying translations:', e);
return settings;
}
}
// Setup event listener for cart selling plan updates
// This must be called before any scripts are loaded to avoid race conditions
function setupCartSellingPlanUpdater(settings) {
// Setup listener regardless - updateCartSellingPlans has its own guards
// This ensures cleanup happens even when preorders are disabled globally
// Listen for stoq:inventory-data-loaded event dispatched by api.js
window.addEventListener('stoq:inventory-data-loaded', function(event) {
console.debug('STOQ - Inventory data loaded, updating cart selling plans');
if (window._RestockRocket
&& window._RestockRocket.updateCartSellingPlans) {
window._RestockRocket.updateCartSellingPlans()
.then(hasUpdates => {
if (hasUpdates) {
console.debug('STOQ - cart selling plans updated successfully');
} else {
console.debug('STOQ - no cart selling plan updates needed');
}
})
.catch(error => {
console.error('STOQ - error updating cart selling plans:', error);
});
}
});
}
// First try to get settings from metafields with expiry check
const cachedSettings = window._RestockRocketConfig.cachedSettings;
const validCachedSettings = cachedSettings ? checkSettingsExpiry(cachedSettings) : null;
if (validCachedSettings) {
console.debug('STOQ - using cached settings');
initializeScripts(validCachedSettings);
} else {
console.debug('STOQ - fetching fresh settings');
const headers = {
'X-Shopify-Shop-Domain': window._RestockRocketConfig.shop || window.S