4301console.error("Can't get JSON.", data);4302}43034304if (!productsArr || productsArr.length === 0) {4305t_cart__loadLostCartStyles();4306tcart__showWrongOrderPopup();43074308tcart__clearLostCartUrl();4309var msg = dataObj && dataObj.error ? dataObj.error : "Something went wrong. Can't get products array.";43104311console.error(msg);4312
} else { tcart__getProductsInfoById(productsArr); } } }; var paramsString = JSON.stringify(params); xhr.send(paramsString);}function tcart__clearLostCartUrl() { var currentUrl = window.location.href; var indexToRemove = currentUrl.indexOf('#!/torder/'); if (indexToRemove > -1) { try { window.history.replaceState('', '', currentUrl.substring(0, indexToRemove)); } catch (e) {} }}// 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_2function tcart__restoreLostCart(restoredProducts) { // @ts-expect-error ST-2949_2 if (window.tcart['products'].length !== 0) { t_cart__loadLostCartStyles(); tcart__showClearCartDialog(); var dialog = document.querySelector('#clear-cart-dialog'); // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 var saveItems = dialog.querySelector('.js-clearcart-no'); // @ts-expect-error ST-2949_3 var cleartCart = dialog.querySelector('.js-clearcart-yes'); var closeDialog = function () { t_triggerEvent(document.body, 'popupHidden'); document.body.classList.remove('t-body_popupshowed'); // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 if (dialog.parentNode !== null) { // @ts-expect-error ST-2949_3 dialog.parentNode.removeChild(dialog); } }; // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 saveItems.addEventListener('click', function () { closeDialog(); tcart__openRestoredCart(restoredProducts); }); // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 cleartCart.addEventListener('click', function () { closeDialog(); window.tcart = { // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) // @ts-expect-error ST-2949_5 amount: 0, currency: '', system: '', products: [], }; if (typeof localStorage === 'object') { try { localStorage.removeItem('tcart'); } catch (e) { console.error('Your web browser does not support localStorage.'); } } try { delete window.tcart; tcart__loadLocalObj(); } catch (e) {} tcart__openRestoredCart(restoredProducts); }); } else { tcart__openRestoredCart(restoredProducts); }}// 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_2function tcart__saveRestoredProducts(restoredProducts) { if (!restoredProducts) return; // @ts-expect-error ST-2949_2 restoredProducts.forEach(function (product) { tcart__addProduct(product); });}