Каталог файловtilda-catalog-1.2.js
2201 var link = 'tilda.' + domainParts[domainParts.length - 1];2202 apiUrl = 'https://' + link + '/projects/store/getproductsbyuid/';2203 }2204 2205 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046)2206 // @ts-expect-error ST-2949_52207 dataObj = JSON.stringify(dataObj);2208 2209 var xhr = new XMLHttpRequest();2210 xhr.onload = function () {2211 if (xhr.readyState === xhr.DONE && xhr.status === 200) {
История файла и сравнение версий
if (typeof xhr.responseText !== 'string' || xhr.responseText.substring(0, 1) !== '{') {
2213 console.error("Can't get products array by uid list"); 2215 if (t_catalog__handleRootzoneRedirect(xhr.responseText, apiUrl)) { 2216 t_catalog_loadProducts_byId(idArr, options, onDone, onFail); 2219 onDone(JSON.parse(xhr.responseText)); 2223 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) 2224 // @ts-expect-error ST-2949_2 2225 function onError(error) { 2226 console.error("Can't get getproductsbyuid. Requesting idArr: " + idArr); 2228 if (typeof onFail === 'function') { 2233 xhr.ontimeout = onError; 2234 xhr.onerror = onError; 2236 xhr.open('POST', apiUrl); 2237 xhr.timeout = 20000; 2238 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) 2239 // @ts-expect-error ST-2949_5 2244 * Sends a request to the server to get the filters for the store part 2246 * @param {object} options 2247 * @param {Function} onDone - callback on success 2248 * @param {Function} onFail - callback on error 2250function t_catalog_loadFilters(options, onDone, onFail) { 2252 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 2253 // @ts-expect-error ST-2949_1 2254 var storepartuid = options.storepart; 2257 storepartuid: storepartuid, 2261 var allRecords = document.getElementById('allrecords'); 2263 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 2264 // @ts-expect-error ST-2949_1 2265 if (options && options.defaultSort && options.defaultSort.in_stock) { 2266 // @ts-expect-error ST-2949_1 2267 if (!dataObj.filters) dataObj.filters = {}; 2268 // @ts-expect-error ST-2949_1 2269 dataObj.filters['quantity'] = 'y'; 2272 // @ts-expect-error ST-2949_1 2273 var apiUrl = 'https://' + window.t_catalog_endpoint + '/api/getfilters/'; 2275 // inside tilda we get data from another url 2276 // @ts-expect-error ST-2949_1 2277 if (!options.isPublishedPage) { 2279 // @ts-expect-error ST-2949_1 2280 dataObj.projectid = allRecords.getAttribute('data-tilda-project-id'); 2282 var domainParts = window.location.hostname.split('.'); 2283 var link = 'tilda.' + domainParts[domainParts.length - 1]; 2284 apiUrl = 'https://' + link + '/projects/store/getfilters/'; 2288 * Обрабатывает ответ getfilters: из сети или из кэша редактора 2289 * @param {string} text - текст ответа 2291 function handleFiltersResponse(text) { 2293 onDone(JSON.parse(text)); 2295 console.error(error); 2300 // В редакторе повторный рендер записи берёт фильтры из кэша (микрозадачей, без сети). Ключ берём до отправки.