console.error(text + '. Please, try again later.');
9817 * Обрабатывает ответ запроса и если в нем есть редирект на другую зону, обновляет конечную точку API 9818 * @param {string | object} responseData 9819 * @param {string} previousEndpoint - конечная точка API, которая была до выполнения запроса. Из нее извлекается рутзона 9820 * @returns {boolean} была ли изменена рутзона 9822function t_catalog__handleRootzoneRedirect(responseData, previousEndpoint) { 9823 let json = responseData; 9824 if (typeof responseData === 'string') { 9826 json = JSON.parse(responseData); 9831 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 9832 // @ts-expect-error ST-2949_1 9833 const newRootZone = json?.redirectto; 9838 const previousRootZone = t_catalog__getRootZoneFromEndpoint(previousEndpoint); 9839 const isRootzoneChanged = previousRootZone !== newRootZone; 9840 if (isRootzoneChanged) { 9841 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 9842 // @ts-expect-error ST-2949_1 9843 window.t_catalog_endpoint = window.t_catalog_endpoint.split('.').slice(0, -1).join('.') + '.' + newRootZone; 9845 t_catalog__setRootZone(newRootZone); 9846 return isRootzoneChanged; 9849// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) 9850// @ts-expect-error ST-2949_2 9851function t_catalog__getRootZoneFromEndpoint(endpoint) { 9852 const match = endpoint.match(/\.([a-z]{2,})(?:[\/:]|$)/i); 9853 return match ? match[1] : ''; 9856// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) 9857// @ts-expect-error ST-2949_2 9858function t_catalog_snippet_chooseEditionFromUrl(recid, product, el_product, options) { 9860 var urlParams = t_catalog_snippet_getJsonFromUrl(); 9861 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 9862 // @ts-expect-error ST-2949_1 9863 var uid = urlParams.editionuid; 9864 if (uid && el_product.getAttribute('data-product-uid') !== uid) { 9865 console.info('show product by uid from url = ' + uid); 9866 /* find data for edition */ 9868 // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) 9869 // @ts-expect-error ST-2949_2 9870 product.editions.forEach(function (edtn) { 9871 if (edtn.uid === parseInt(uid, 10)) { 9879 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) 9880 // @ts-expect-error ST-2949_5 9881 t_catalog_product_updateEdition(recid, el_product, edObj, product, options); 9882 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 9883 // @ts-expect-error ST-2949_1 9884 var isSoldOut = parseInt(edObj.quantity) === 0; 9885 t_catalog_product_triggerSoldOutMsg(recid, el_product, isSoldOut, options); 9888 console.error('Error decode url:' + error); 9892// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) 9893// @ts-expect-error ST-2949_2 9894function t_catalog_moveSearhSort(recid, opts) { 9895 // sidebar может быть пустым, его функция должна находиться всегда в каталоге 9896 var rec = document.getElementById('rec' + recid); 9898 var searchSort = rec.querySelector('.t-catalog__filter__search-and-sort'); 9900 // If search was hidden on mobile, show it again on window resize