2101// @ts-expect-error ST-2949_32102gridContainer.insertAdjacentHTML('beforeend', el_errorBox);2103// @ts-expect-error ST-2949_32104t_catalog__fadeIn(rec.querySelector('.js-catalog-error-msg'));2105}2106}21072108xhr.ontimeout = onError;2109xhr.onerror = onError;21102111// TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046)2112
// @ts-expect-error ST-2949_5 xhr.open('GET', apiUrl + '?' + t_catalog__serializeData(dataObj)); xhr.timeout = 20000; xhr.send();}/** * Loads one product from the store * * @param {string} recid - the id of the product in the store * @param {object} options * @param {string} curProdUid - the product's UID that we want to load * @param {Function} onDone - callback on success * @param {Function} onFail - callback on error **/function t_catalog_loadOneProduct(recid, options, curProdUid, onDone, onFail) { var c = Date.now(); // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 var storepartuid = options.storepart; var dataObj = { storepartuid: storepartuid, recid: recid, productuid: curProdUid, c: c, }; // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 var apiUrl = 'https://' + window.t_catalog_endpoint + '/api/getproduct/?' + t_catalog__serializeData(dataObj); var xhr = new XMLHttpRequest(); xhr.onload = function () { if (xhr.readyState === xhr.DONE && xhr.status === 200) { if (t_catalog__handleRootzoneRedirect(xhr.responseText, apiUrl)) { t_catalog_loadOneProduct(recid, options, curProdUid, onDone, onFail); return; } onDone(); } }; // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2 function onError(error) { // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 console.error("Can't get product with uid = " + curProdUid + ' in storepart = ' + options.storepart); if (typeof onFail === 'function') { onFail(error); } } xhr.ontimeout = onError; xhr.onerror = onError; xhr.open('GET', apiUrl); xhr.timeout = 20000; xhr.send();}/** * An array of product IDs and returns an array of products * * @param {Array<*>} idArr - array of product ids * @param {object} options * @param {Function} onDone - callback on success * @param {Function} onFail - callback on error **/function t_catalog_loadProducts_byId(idArr, options, onDone, onFail) { var c = Date.now(); var dataObj = { productsuid: idArr, c: c, }; // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 var apiUrl = 'https://' + window.t_catalog_endpoint + '/api/getproductsbyuid/'; // inside tilda we get data from another url // @ts-expect-error ST-2949_1 if (options && !options.isPublishedPage) { // @ts-expect-error ST-2949_1 dataObj.projectid = document.getElementById('allrecords').getAttribute('data-tilda-project-id'); var domainParts = window.location.hostname.split('.');