var virtooalMirrorSettings = { apiKey: "f5353b7034a01a27da3c712b00e23384", mirrorVersion: "2", }; if (typeof virtooalCrossmirrorScript === 'undefined') { var virtooalCrossmirrorScript = document.createElement('script'); virtooalCrossmirrorScript.type = 'text/javascript'; virtooalCrossmirrorScript.async = true; (function() { var url = window.location.href; var apiKey = virtooalMirrorSettings.apiKey; var mirrorVersion = virtooalMirrorSettings.mirrorVersion; var urlParams = new URLSearchParams(window.location.search); // Helper functions to get query parameters as boolean function getQueryParamAsBool(param) { return urlParams.has(param) && urlParams.get(param) === '1'; } // Determine environment and features var isDuos = url.includes('duosshop.hr') || url.includes('duosshop.ro'); var isV2 = mirrorVersion === "2"; var isPreview = getQueryParamAsBool('preview') || getQueryParamAsBool('auglioPreview'); var isPresentation = getQueryParamAsBool('presentation') || getQueryParamAsBool('auglioPresentation'); var isKiosk = getQueryParamAsBool('kiosk') || getQueryParamAsBool('auglioKiosk'); var isIgnorePublished = getQueryParamAsBool('auglioIgnorePublished'); var auglioHtmlTemplate = urlParams.get('auglioHtmlTemplate') || ''; var auglioCssTemplate = urlParams.get('auglioCssTemplate') || ''; // Base URLs var baseUrls = { prod: `https://tryon.auglio.com/${apiKey}`, dev: `https://tryon.aws.dev.auglio.com/${apiKey}`, test: `https://tryon.aws.test.auglio.com/${apiKey}` }; // Determine the environment var scriptUrl; if (url.includes('auglioTest=1')) { scriptUrl = baseUrls.test; } else if (url.includes('auglioDev=1')) { scriptUrl = baseUrls.dev; } else { scriptUrl = baseUrls.prod; } // Construct URL with search params var constructedUrl = new URL(scriptUrl); constructedUrl.searchParams.set('legacy', '1'); constructedUrl.searchParams.set('preview', isPreview ? '1' : '0'); constructedUrl.searchParams.set('presentation', isPresentation ? '1' : '0'); constructedUrl.searchParams.set('kiosk', isKiosk ? '1' : '0'); constructedUrl.searchParams.set('ignore_published', isIgnorePublished ? '1' : '0'); if (auglioHtmlTemplate) { constructedUrl.searchParams.set('html_code', auglioHtmlTemplate); } if (auglioCssTemplate) { constructedUrl.searchParams.set('css_code', auglioCssTemplate); } if (isDuos) { // Duos specific case virtooalCrossmirrorScript.src = ''; } else if (isV2) { // New version AWS virtooalCrossmirrorScript.src = constructedUrl.toString(); } else { // Old version virtooalCrossmirrorScript.src = `https://mirror.auglio.com/assets/js/automirror.php?a=${apiKey}`; } var s_virtooal = document.getElementsByTagName('script')[0]; s_virtooal.parentNode.insertBefore(virtooalCrossmirrorScript, s_virtooal); })(); }