Guardar en la lista de la compra
Crear una nueva lista de la compra
Perth Mint 125. rocznica powstania 1 uncja Srebra 2024
Perth Mint 125. rocznica powstania 1 uncja Srebra 2024
Perth Mint 125. rocznica powstania 1 uncja Srebra 2024
Perth Mint 125. rocznica powstania 1 uncja Srebra 2024
Perth Mint 125. rocznica powstania 1 uncja Srebra 2024
Perth Mint 125. rocznica powstania 1 uncja Srebra 2024

Perth Mint 125. rocznica powstania 1 uncja Srebra 2024

96,82 EUR
bruto / szt.
El precio más bajo del producto en los 30 días anteriores al descuento: / szt.
Precio normal: / szt.
Este producto no está disponible en la papelería
Compras seguras
`; } //

${listauncje}

//

${listauncjeUncje}

// ${ indx + 1 } ///// //

${name.listauncje}

//

${amount.listauncjeUncje}

if (type === "bigsix") { return ` `; } if (type === "promotion") { return ` `; } //

${name}

return ""; } var __allProductsPromise = null; var cacheVersion = 0; function normalizeIds(ids) { if (!ids) return []; if (Array.isArray(ids)) return ids; if (typeof ids === "string") return ids.split(",").map(s => s.trim()).filter(Boolean); return []; } function collectAllIds() { const all = []; Object.values(IDS).forEach(val => { all.push(...normalizeIds(val)); }); const unique = Array.from(new Set(all.map(String))); return unique; } const CACHE_KEY = "mll_products_cache_v1"; const CACHE_TTL_MS = 30 * 60 * 1000; const COOKIE_CACHE_KEY = "mll_products_loaded"; const COOKIE_MAX_AGE_SECONDS = 30 * 60; function getStorage() { try { if (typeof localStorage !== "undefined") return localStorage; } catch (e) { // ignore } try { if (typeof sessionStorage !== "undefined") return sessionStorage; } catch (e) { // ignore } return null; } function readCache() { try { const storage = getStorage(); if (!storage) return null; const raw = storage.getItem(CACHE_KEY); if (!raw) return null; const parsed = JSON.parse(raw); if (!parsed || !Array.isArray(parsed.items)) return null; const expectedCount = collectAllIds().length; if (parsed.version !== cacheVersion) { clearCache(); return null; } if (Date.now() - parsed.ts > CACHE_TTL_MS) { clearCache(); return null; } if (!parsed.expectedCount || parsed.expectedCount !== expectedCount) { clearCache(); return null; } if (parsed.items.length < expectedCount) { clearCache(); return null; } return parsed.items; } catch (e) { return null; } } function slimProduct(product) { const descriptions = (product && Array.isArray(product.productDescriptionsLangData)) ? product.productDescriptionsLangData.map(d => ({ productName: d && d.productName ? d.productName : "" })) : [{ productName: "" }]; const priceSite = product && product.productShopsAttributes && product.productShopsAttributes[2] && product.productShopsAttributes[2].productShopPriceComparisonSitesPrices && product.productShopsAttributes[2].productShopPriceComparisonSitesPrices[0] ? product.productShopsAttributes[2].productShopPriceComparisonSitesPrices[0] : { productPriceComparisonSitePrice: 0 }; const stockInfo = product && product.productStocksData && product.productStocksData.productSizesDispositions && product.productStocksData.productSizesDispositions.productSizesDispositionsInSales && product.productStocksData.productSizesDispositions.productSizesDispositionsInSales[0] ? product.productStocksData.productSizesDispositions.productSizesDispositionsInSales[0] : {}; return { productId: product && product.productId ? product.productId : "", producerName: product && product.producerName ? product.producerName : "", productIcon: { productIconLargeUrl: product && product.productIcon ? product.productIcon.productIconLargeUrl : "" }, productDescriptionsLangData: descriptions, productStocksData: { productSizesDispositions: { productSizesDispositionsInSales: [ { productSizeQuantityAllStocks: stockInfo.productSizeQuantityAllStocks || 0, productSizeQuantityOutsideStock: stockInfo.productSizeQuantityOutsideStock || 0 } ] } }, productShopsAttributes: [ { productSuggestedPrice: product && product.productShopsAttributes && product.productShopsAttributes[0] ? product.productShopsAttributes[0].productSuggestedPrice : 0 }, {}, { productSuggestedPrice: product && product.productShopsAttributes && product.productShopsAttributes[2] ? product.productShopsAttributes[2].productSuggestedPrice : 0, productWholesalePrice: product && product.productShopsAttributes && product.productShopsAttributes[2] ? product.productShopsAttributes[2].productWholesalePrice : 0, productShopPriceComparisonSitesPrices: [ { productPriceComparisonSitePrice: priceSite.productPriceComparisonSitePrice || 0 } ] } ] }; } function writeCache(items) { try { const storage = getStorage(); if (!storage) return; const expectedCount = collectAllIds().length; const slimItems = items.map(slimProduct); storage.setItem(CACHE_KEY, JSON.stringify({ ts: Date.now(), expectedCount, items: slimItems, version: cacheVersion })); } catch (e) { // ignore cache errors } } function clearCache() { try { const storage = getStorage(); if (!storage) return; storage.removeItem(CACHE_KEY); cacheVersion++; __allProductsPromise = null; } catch (e) { // ignore cache errors } } function setCookie(name, value, maxAgeSeconds) { const encoded = encodeURIComponent(value); document.cookie = `${name}=${encoded}; Max-Age=${maxAgeSeconds}; Path=/; SameSite=Lax`; } function readCookie(name) { const cookies = document.cookie ? document.cookie.split(";") : []; const prefix = `${name}=`; for (let i = 0; i < cookies.length; i++) { const c = cookies[i].trim(); if (c.startsWith(prefix)) return decodeURIComponent(c.substring(prefix.length)); } return null; } function chunkArray(arr, size) { const out = []; for (let i = 0; i < arr.length; i += size) { out.push(arr.slice(i, i + size)); } return out; } async function fetchAllProducts() { if (__allProductsPromise) return __allProductsPromise; const cached = readCache(); if (cached) { __allProductsPromise = Promise.resolve(cached); return __allProductsPromise; } const allIds = collectAllIds(); const chunks = chunkArray(allIds, 25); __allProductsPromise = Promise.all( chunks.map((chunk, index) => { const url = `https://admin.metalapi.co.pl/idosell/products/products?productIds=${chunk.join(",")}`; return fetch(url) .then(res => { if (!res.ok) throw new Error(`HTTP ${res.status}`); return res.json(); }) .then(data => { return (data && data.results ? data.results : []); }) .catch(error => { console.error(`Error fetching chunk ${index + 1}:`, error); return []; }); }) ).then(list => { const flatList = list.flat(); return flatList; }); return __allProductsPromise; } async function fetchAndRender(ids, selector, type, limit, options = {}) { const { filterFn, onRendered } = options; const allProducts = await fetchAllProducts(); const idsArr = normalizeIds(ids); const idSet = new Set(idsArr.map(String)); let products = allProducts.filter(p => idSet.has(String(p.productId))); if (typeof filterFn === "function") { products = products.filter(filterFn); } products.sort((a, b) => { const aPrice = a?.productShopsAttributes?.[2]?.productWholesalePrice || 0; const bPrice = b?.productShopsAttributes?.[2]?.productWholesalePrice || 0; return aPrice - bPrice; }); if (typeof limit === "number") { products = products.slice(0, limit); } const el = document.querySelector(selector); if (!el) return; if (!products.length) { el.innerHTML = "---"; return; } const html = products.map(p => { try { return renderProduct(p, type); } catch (e) { return ""; } }).filter(Boolean).join(""); el.innerHTML = html; if (typeof onRendered === "function") { onRendered({ selector, type, products, ids: idsArr }); } } async function renderGroups(groups, onAllRendered) { await Promise.all(groups.map(g => fetchAndRender(g.ids, g.selector, g.type, g.limit, g.options) )); if (typeof onAllRendered === "function") onAllRendered(); } function renderFromItems(items, ids, selector, type, limit, options = {}) { const { filterFn, onRendered } = options; const idsArr = normalizeIds(ids); const idSet = new Set(idsArr.map(String)); let products = items.filter(p => idSet.has(String(p.productId))); if (typeof filterFn === "function") { products = products.filter(filterFn); } products.sort((a, b) => { const aPrice = a?.productShopsAttributes?.[2]?.productWholesalePrice || 0; const bPrice = b?.productShopsAttributes?.[2]?.productWholesalePrice || 0; return aPrice - bPrice; }); if (typeof limit === "number") { products = products.slice(0, limit); } const el = document.querySelector(selector); if (!el) return; if (!products.length) { el.innerHTML = "---"; return; } const html = products.map(p => { try { return renderProduct(p, type); } catch (e) { return ""; } }).filter(Boolean).join(""); el.innerHTML = html; if (typeof onRendered === "function") { onRendered({ selector, type, products, ids: idsArr }); } } function renderGroupsFromItems(items, groups, onAllRendered) { groups.forEach(g => renderFromItems(items, g.ids, g.selector, g.type, g.limit, g.options)); if (typeof onAllRendered === "function") onAllRendered(); } var __renderStarted = false; var __renderedFresh = false; async function startRender() { console.log('startRender called'); __renderStarted = true; // Check if #container has class main_page const container = document.querySelector('#container'); const isMainPage = container && container.classList.contains('main_page'); console.log('isMainPage:', isMainPage); var GROUPS = []; // Only render these groups if on main_page if (isMainPage) { GROUPS = [ // { ids: IDS.goldozdwa, selector: SELECTORS.gold, type: "bar", limit: 14 }, // { ids: IDS.silveroz, selector: SELECTORS.silver, type: "bar", limit: 14 }, // { ids: IDS.wiede, selector: SELECTORS.wiede, type: "list", limit: IDS.wiede.length }, // { ids: IDS.brit, selector: SELECTORS.brit, type: "list", limit: IDS.brit.length }, // { ids: IDS.maple, selector: SELECTORS.maple, type: "list", limit: IDS.maple.length }, // { ids: IDS.kanguro, selector: SELECTORS.kangur, type: "list", limit: IDS.kanguro.length }, // { ids: IDS.eagle, selector: SELECTORS.eagle, type: "list", limit: 6 }, // { ids: IDS.krugerant, selector: SELECTORS.krugerant, type: "list", limit: IDS.krugerant.length }, // { ids: IDS.extra, selector: SELECTORS.basket, type: "buy", limit: 9 }, { ids: IDS.getIDSgoldozdwa, selector: SELECTORS.goldsix, type: "bigsix", limit: 6 }, { ids: IDS.getIDsilveroz, selector: SELECTORS.silversix, type: "bigsix", limit: 6 }, { ids: IDS.getIDpromotion, selector: SELECTORS.carusel_promotion_a, type: "promotion", limit: 6 }, ]; } console.log('GROUPS:', GROUPS); const cached = readCache(); if (cached && cached.length && isMainPage) { __allProductsPromise = Promise.resolve(cached); renderGroupsFromItems(cached, GROUPS, function () { // showBestPrice(".gold_blockBid_betst_price", ".produkty_main_cena.gold_constn .price_item", 0); // showBestPrice(".silver_blockBid_betst_price", ".produkty_main_cena.silver_constn .price_item", 11); }); } if (!isMainPage) { __renderStarted = false; return; } __allProductsPromise = __allProductsPromise || fetchAllProducts(); const allProducts = await __allProductsPromise; if (!Array.isArray(allProducts) || allProducts.length === 0) { __renderStarted = false; setTimeout(startRender, 0); return; } __renderedFresh = true; renderGroups(GROUPS, function () { // showBestPrice(".gold_blockBid_betst_price", ".produkty_main_cena.gold_constn .price_item", 0); // showBestPrice(".silver_blockBid_betst_price", ".produkty_main_cena.silver_constn .price_item", 11); }); if (allProducts.length) { writeCache(allProducts); setCookie(COOKIE_CACHE_KEY, `${Date.now()}|${allProducts.length}`, COOKIE_MAX_AGE_SECONDS); } else { clearCache(); } } /** * Find and display best price */ function showBestPrice(blockSelector, priceSelector, index) { setTimeout(() => { const block = document.querySelector(blockSelector); const prices = Array.from(document.querySelectorAll(priceSelector)).map(x => x.textContent); if (block && prices[index]) block.innerHTML = prices[index]; }, 1000); } // Cache enabled - 30 minutes TTL if (document.readyState === "loading") { window.addEventListener("DOMContentLoaded", startRender); } else { startRender(); }
A pagar
Punkty odbioru
Dostępność
Resultados:
pixel