ng":true,"taxable":true,"featured_image":null,"available":true,"name":"Trek Marlin 6 Gen 3 - XS \/ Matte Lichen\/Keswick Green Fade","public_title":"XS \/ Matte Lichen\/Keswick Green Fade","options":["XS","Matte Lichen\/Keswick Green Fade"],"price":85000,"weight":0,"compare_at_price":null,"inventory_management":"shopify","barcode":"","requires_selling_plan":false,"selling_plan_allocations":[]},{"id":56385027539327,"title":"XS \/ Gloss Lavender Haze","option1":"XS","option2":"Gloss Lavender Haze","option3":null,"sku":"5337092","requires_shipping":true,"taxable":true,"featured_image":null,"available":true,"name":"Trek Marlin 6 Gen 3 - XS \/ Gloss Lavender Haze","public_title":"XS \/ Gloss Lavender Haze","options":["XS","Gloss Lavender Haze"],"price":85000,"weight":0,"compare_at_price":null,"inventory_management":"shopify","barcode":"","requires_selling_plan":false,"selling_plan_allocations":[]},{"id":56385027572095,"title":"XS \/ Lava","option1":"XS","option2":"Lava","option3":null,"sku":"5337085","requires_shi
pping":true,"taxable":true,"featured_image":null,"available":true,"name":"Trek Marlin 6 Gen 3 - XS \/ Lava","public_title":"XS \/ Lava","options":["XS","Lava"],"price":85000,"weight":0,"compare_at_price":null,"inventory_management":"shopify","barcode":"","requires_selling_plan":false,"selling_plan_allocations":[]},{"id":56385027604863,"title":"S \/ Matte Lichen\/Keswick Green Fade","option1":"S","option2":"Matte Lichen\/Keswick Green Fade","option3":null,"sku":"5337079","requires_shipping":true,"taxable":true,"featured_image":null,"available":true,"name":"Trek Marlin 6 Gen 3 - S \/ Matte Lichen\/Keswick Green Fade","public_title":"S \/ Matte Lichen\/Keswick Green Fade","options":["S","Matte Lichen\/Keswick Green Fade"],"price":85000,"weight":0,"compare_at_price":null,"inventory_management":"shopify","barcode":"","requires_selling_plan":false,"selling_plan_allocations":[]},{"id":56385027637631,"title":"S \/ Gloss Lavender Haze","option1":"S","option2":"Gloss Lavender Haze","option3":null,"sku":"5337093","requi
\" class=\"pdl-collapse-item__wrap\" role=\"region\" aria-hidden=\"false\" aria-labelledby=\"pdl-collapse-head-phu2an\" data-old-padding-top=\"\" data-old-padding-bottom=\"\" data-old-overflow=\"\"\u003e\n\u003cdiv class=\"pdl-collapse-item__content is-active flex-row-reverse items-center font-heading font-bold text-lg border-b-2 focusing\"\u003e\n\u003cdl class=\"font-body flex flex-row flex-wrap text-gray-80 text-lg\" aria-label=\"Specifications\"\u003e\n\u003cdt class=\"flex-none w-full md:w-1\/5 mb-0 py-2 pr-1 font-medium border-b-2 md:border-r-2 border-gray-10\"\u003eSaddle\u003c\/dt\u003e\n\u003cdd class=\"flex-none w-full md:w-4\/5 font-normal\"\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cdiv\u003eBontrager Verse Short, stainless steel rails\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/dd\u003e\n\u003cdt class=\"flex-none w-full md:w-1\/5 mb-0 py-2 pr-1 font-medium border-b-2 md:border-r-2 border-gray-10\"\u003e*Seatpost\u003c\/dt\u003e\n\u003cdd class=\"flex-none w-full md:w-
4\/5 font-normal\"\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eXS , S\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eTranzX JD-YSI34, 100 mm travel, internal routing, 31.6 mm, 350 mm length\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eM\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eTranzX JD-YSI34, 125 mm travel, internal routing, 31.6 mm, 405 mm length\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eML , L , XL\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eTranzX JD-YSI34, 150 mm travel, internal routing, 31.6 mm, 456 mm length\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eXXL\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eTranzX JD-YSI34, 170 mm travel, internal routing, 31.6 mm, 500 mm length\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/dd\u003e\n\u003cdt class=\"flex-none w-full md:w-1\/5 mb-0 py-2 pr-1 font-medium border-b-2 md:border-r-2 border-gray-10\"\u003e*Handlebar\u003c\/dt\u003e\n\u003cdd class=\"flex-none w-full md:w-4\/5 font-normal\"\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eXS\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eBontrager alloy, 31.8 mm, 5 mm rise, 690 mm width\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eS\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eBontrager alloy, 31.8 mm, 15 mm rise, 720 mm width\u003c\/di
v\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eM , ML , L , XL , XXL\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eBontrager alloy, 31.8 mm, 15 mm rise, 750 mm width\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/dd\u003e\n\u003cdt class=\"flex-none w-full md:w-1\/5 mb-0 py-2 pr-1 font-medium border-b-2 md:border-r-2 border-gray-10\"\u003eGrips\u003c\/dt\u003e\n\u003cdd class=\"flex-none w-full md:w-4\/5 font-normal\"\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\u003ca href=\"https:\/\/www.trekbikes.com\/b2b\/gb\/en_GB\/p\/5330249\" class=\"block underline\"\u003eTrek Line Comp, nylon lock-on\u003c\/a\u003e\u003c\/div\u003e\n\u003c\/dd\u003e\n\u003cdt class=\"flex-none w-full md:w-1\/5 mb-0 py-2 pr-1 font-medium border-b-2 md:border-r-2 border-gray-10\"\u003e*Stem\u003c\/dt\u003e\n\u003cdd class=\"flex-none w-full md:w-4\/5 font-normal\"\u003e\n\u003cdiv class=\"p-
2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eXS , S\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eBontrager Comp, 31.8 mm, 7-degree, 35 mm length\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eM , ML , L\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eBontrager Comp, 31.8 mm, Blendr compatible, 7-degree, 50 mm length\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eXL\u003cbr\u003e\u003c\/span\u003e\u003ca href=\"https:\/\/www.trekbikes.com\/b2b\/gb\/en_GB\/p\/W565208\" class=\"block underline\"\u003eBontrager Comp, 31.8 mm, Blendr compatible, 7-degree, 60 mm length\u003c\/a\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n
\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eXXL\u003cbr\u003e\u003c\/span\u003e\u003ca href=\"https:\/\/www.trekbikes.com\/b2b\/gb\/en_GB\/p\/567621\" class=\"block underline\"\u003eBontrager Comp, 31.8 mm, Blendr compatible, 7-degree, 70 mm length\u003c\/a\u003e\n\u003c\/div\u003e\n\u003c\/dd\u003e\n\u003cdt class=\"flex-none w-full md:w-1\/5 mb-0 py-2 pr-1 font-medium border-b-2 md:border-r-2 border-gray-10\"\u003eHead set\u003c\/dt\u003e\n\u003cdd class=\"flex-none w-full md:w-4\/5 font-normal\"\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cdiv\u003eSemi-integrated, 1-1\/8\"\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/dd\u003e\n\u003cdt class=\"flex-none w-full md:w-1\/5 mb-0 py-2 pr-1 font-medium border-b-2 md:border-r-2 border-gray-10\"\u003eBrake\u003c\/dt\u003e\n\u003cdd class=\"flex-none w-full md:w-4\/5 font-normal\"\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cdiv\u003eShimano MT200 hydraulic disc\u003c\hts may vary in final production.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e"};
window._RestockRocketConfig.variantsInventoryPolicy = {56385027506559 : "deny",56385027539327 : "deny",56385027572095 : "deny",56385027604863 : "deny",56385027637631 : "deny",56385027670399 : "deny",56385027703167 : "deny",56385027735935 : "deny",56385027768703 : "deny",56385027801471 : "deny",56385027834239 : "deny",56385027867007 : "deny",56385027899775 : "deny",56385027932543 : "deny",56385027965311 : "deny",56385027998079 : "deny",56385028030847 : "deny",56385028063615 : "deny",56385028096383 : "deny",56385028129151 : "deny",56385028161919 : "deny",};
window._RestockRocketConfig.variantsInventoryQuantity = {56385027506559 : parseInt("20"),56385027539327 : parseInt("20"),56385027572095 : parseInt("20"),56385027604863 : parseInt("20"),56385027637631 : parseInt("20"),56385027670399 : parseInt("20"),56385027703167 : parseInt("20"),56385027735935 : parseInt("20"),56385027768703 : parseInt("20"),56385027801471 : pa
rseInt("20"),56385027834239 : parseInt("20"),56385027867007 : parseInt("20"),56385027899775 : parseInt("20"),56385027932543 : parseInt("20"),56385027965311 : parseInt("20"),56385027998079 : parseInt("20"),56385028030847 : parseInt("20"),56385028063615 : parseInt("20"),56385028096383 : parseInt("6"),56385028129151 : parseInt("20"),56385028161919 : parseInt("20"),};
window._RestockRocketConfig.variantsPreorderCount = {56385027506559 : parseInt(""),56385027539327 : parseInt(""),56385027572095 : parseInt(""),56385027604863 : parseInt(""),56385027637631 : parseInt(""),56385027670399 : parseInt(""),56385027703167 : parseInt(""),56385027735935 : parseInt(""),56385027768703 : parseInt(""),56385027801471 : parseInt(""),56385027834239 : parseInt(""),56385027867007 : parseInt(""),56385027899775 : parseInt(""),56385027932543 : parseInt(""),56385027965311 : parseInt(""),56385027998079 : parseInt(""),56385028030847 : parseInt(""),56385028063615 : parseInt(""),56385028096383 : parseInt(""),56385028129151 : parseInt(""),
2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eXS , S\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eBontrager Comp, 31.8 mm, 7-degree, 35 mm length\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eM , ML , L\u003cbr\u003e\u003c\/span\u003e\n\u003cdiv\u003eBontrager Comp, 31.8 mm, Blendr compatible, 7-degree, 50 mm length\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eXL\u003cbr\u003e\u003c\/span\u003e\u003ca href=\"https:\/\/www.trekbikes.com\/b2b\/gb\/en_GB\/p\/W565208\" class=\"block underline\"\u003eBontrager Comp, 31.8 mm, Blendr compatible, 7-degree, 60 mm length\u003c\/a\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n
\u003cspan\u003eSize:\u003c\/span\u003e\u003cspan\u003e \u003c\/span\u003e\u003cspan\u003eXXL\u003cbr\u003e\u003c\/span\u003e\u003ca href=\"https:\/\/www.trekbikes.com\/b2b\/gb\/en_GB\/p\/567621\" class=\"block underline\"\u003eBontrager Comp, 31.8 mm, Blendr compatible, 7-degree, 70 mm length\u003c\/a\u003e\n\u003c\/div\u003e\n\u003c\/dd\u003e\n\u003cdt class=\"flex-none w-full md:w-1\/5 mb-0 py-2 pr-1 font-medium border-b-2 md:border-r-2 border-gray-10\"\u003eHead set\u003c\/dt\u003e\n\u003cdd class=\"flex-none w-full md:w-4\/5 font-normal\"\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cdiv\u003eSemi-integrated, 1-1\/8\"\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/dd\u003e\n\u003cdt class=\"flex-none w-full md:w-1\/5 mb-0 py-2 pr-1 font-medium border-b-2 md:border-r-2 border-gray-10\"\u003eBrake\u003c\/dt\u003e\n\u003cdd class=\"flex-none w-full md:w-4\/5 font-normal\"\u003e\n\u003cdiv class=\"p-2 border-b-2 border-gray-10\"\u003e\n\u003cdiv\u003eShimano MT200 hydraulic disc\u003c\hts may vary in final production.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e"};
window._RestockRocketConfig.variantsInventoryPolicy = {56385027506559 : "deny",56385027539327 : "deny",56385027572095 : "deny",56385027604863 : "deny",56385027637631 : "deny",56385027670399 : "deny",56385027703167 : "deny",56385027735935 : "deny",56385027768703 : "deny",56385027801471 : "deny",56385027834239 : "deny",56385027867007 : "deny",56385027899775 : "deny",56385027932543 : "deny",56385027965311 : "deny",56385027998079 : "deny",56385028030847 : "deny",56385028063615 : "deny",56385028096383 : "deny",56385028129151 : "deny",56385028161919 : "deny",};
window._RestockRocketConfig.variantsInventoryQuantity = {56385027506559 : parseInt("20"),56385027539327 : parseInt("20"),56385027572095 : parseInt("20"),56385027604863 : parseInt("20"),56385027637631 : parseInt("20"),56385027670399 : parseInt("20"),56385027703167 : parseInt("20"),56385027735935 : parseInt("20"),56385027768703 : parseInt("20"),56385027801471 : pa
rseInt("20"),56385027834239 : parseInt("20"),56385027867007 : parseInt("20"),56385027899775 : parseInt("20"),56385027932543 : parseInt("20"),56385027965311 : parseInt("20"),56385027998079 : parseInt("20"),56385028030847 : parseInt("20"),56385028063615 : parseInt("20"),56385028096383 : parseInt("6"),56385028129151 : parseInt("20"),56385028161919 : parseInt("20"),};
window._RestockRocketConfig.variantsPreorderCount = {56385027506559 : parseInt(""),56385027539327 : parseInt(""),56385027572095 : parseInt(""),56385027604863 : parseInt(""),56385027637631 : parseInt(""),56385027670399 : parseInt(""),56385027703167 : parseInt(""),56385027735935 : parseInt(""),56385027768703 : parseInt(""),56385027801471 : parseInt(""),56385027834239 : parseInt(""),56385027867007 : parseInt(""),56385027899775 : parseInt(""),56385027932543 : parseInt(""),56385027965311 : parseInt(""),56385027998079 : parseInt(""),56385028030847 : parseInt(""),56385028063615 : parseInt(""),56385028096383 : parseInt(""),56385028129151 : parseInt(""),56385028161919 : parseInt(""),};
window._RestockRocketConfig.variantsPreorderCountForMarket = {56385027506559 : null,56385027539327 : null,56385027572095 : null,56385027604863 : null,56385027637631 : null,56385027670399 : null,56385027703167 : null,56385027735935 : null,56385027768703 : null,56385027801471 : null,56385027834239 : null,56385027867007 : null,56385027899775 : null,56385027932543 : null,56385027965311 : null,56385027998079 : null,56385028030847 : null,56385028063615 : null,56385028096383 : null,56385028129151 : null,56385028161919 : null,};
window._RestockRocketConfig.variantsPreorderMaxCount = {56385027506559 : parseInt(""),56385027539327 : parseInt(""),56385027572095 : parseInt(""),56385027604863 : parseInt(""),56385027637631 : parseInt(""),56385027670399 : parseInt(""),56385027703167 : parseInt(""),56385027735935 : parseInt(""),56385027768703 : parseInt(""),56385027801471 : parseInt(""),56385027834239 : parseInt(""),56385027867007 : parseInt(""),56385027899775 : parseInt(""),5638502793
2543 : parseInt(""),56385027965311 : parseInt(""),56385027998079 : parseInt(""),56385028030847 : parseInt(""),56385028063615 : parseInt(""),56385028096383 : parseInt(""),56385028129151 : parseInt(""),56385028161919 : parseInt(""),};
window._RestockRocketConfig.variantsPreorderMaxCountForMarket = {56385027506559 : null,56385027539327 : null,56385027572095 : null,56385027604863 : null,56385027637631 : null,56385027670399 : null,56385027703167 : null,56385027735935 : null,56385027768703 : null,56385027801471 : null,56385027834239 : null,56385027867007 : null,56385027899775 : null,56385027932543 : null,56385027965311 : null,56385027998079 : null,56385028030847 : null,56385028063615 : null,56385028096383 : null,56385028129151 : null,56385028161919 : null,};
window._RestockRocketConfig.variantsShippingText = {56385027506559 : "",56385027539327 : "",56385027572095 : "",56385027604863 : "",56385027637631 : "",56385027670399 : "",56385027703167 : "",56385027735935 : "",56385027768703 : "",56385027801471 : "",56385027834239 : "",56385027867007 : "",56385027899775 : "",56385027932543 : "",56385027965311 : "",56385027998079 : "",56385028030847 : "",56385028063615 : "",56385028096383 : "",56385028129151 : "",56385028161919 : "",};
window._RestockRocketConfig.variantsShippingTextForMarket = {56385027506559 : null,56385027539327 : null,56385027572095 : null,56385027604863 : null,56385027637631 : null,56385027670399 : null,56385027703167 : null,56385027735935 : null,56385027768703 : null,56385027801471 : null,56385027834239 : null,56385027867007 : null,56385027899775 : null,56385027932543 : null,56385027965311 : null,56385027998079 : null,56385028030847 : null,56385028063615 : null,56385028096383 : null,56385028129151 : null,56385028161919 : null,};
window._RestockRocketConfig.selected_variant_id = 56385027506559;
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/019bf9e0-3016-7510-aaea-4318e35b6645/restock-rocket-shopify-436/assets/restockrocket-product.js'
window._RestockRocketConfig.scriptUrlCollection = 'https://cdn.shopify.com/extensions/019bf9e0-3016-7510-aaea-4318e35b6645/restock-rocket-shopify-436/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
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 - continu
e 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 preorder-api-ready event dispatched by preorder.js
window.addEventListener('stoq:preorder-api-ready', function(event) {
console.debug('STOQ - Preorder API ready, 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('STO
Q - using cached settings');
initializeScripts(validCachedSettings);
} else {
console.debug('STOQ - fetching fresh settings');
const headers = {
'X-Shopify-Shop-Domain': window._RestockRocketConfig.shop || window.Shopify.shop,
'ngrok-skip-browser-warning': 'skip'
};
if (window.Shopify?.theme?.role === 'main') {
headers['X-Shopify-Theme-Schema-Name'] = window.Shopify.theme.schema_name;
headers['X-Shopify-Theme-Schema-Version'] = window.Shopify.theme.schema_version;
headers['X-Shopify-Theme-Store-Id'] = window.Shopify.theme.theme_store_id;
}
fetch(
`${window._RestockRocketConfig.host}/api/v1/setting.json?translation_locale=${window._RestockRocketConfig.normalizedLocale}`,
{ headers }
)
.then(function(response) {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(function(settings) {
initializeScripts(settings);
})
.catch(function(er
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 - continu
e 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 preorder-api-ready event dispatched by preorder.js
window.addEventListener('stoq:preorder-api-ready', function(event) {
console.debug('STOQ - Preorder API ready, 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('STO
Q - using cached settings');
initializeScripts(validCachedSettings);
} else {
console.debug('STOQ - fetching fresh settings');
const headers = {
'X-Shopify-Shop-Domain': window._RestockRocketConfig.shop || window.Shopify.shop,
'ngrok-skip-browser-warning': 'skip'
};
if (window.Shopify?.theme?.role === 'main') {
headers['X-Shopify-Theme-Schema-Name'] = window.Shopify.theme.schema_name;
headers['X-Shopify-Theme-Schema-Version'] = window.Shopify.theme.schema_version;
headers['X-Shopify-Theme-Store-Id'] = window.Shopify.theme.theme_store_id;
}
fetch(
`${window._RestockRocketConfig.host}/api/v1/setting.json?translation_locale=${window._RestockRocketConfig.normalizedLocale}`,
{ headers }
)
.then(function(response) {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(function(settings) {
initializeScripts(settings);
})
.catch(function(er
SKU: 5264914
