701// @ts-expect-error ST-2949_3702let minimumOrderAmount = cartBlock.getAttribute('data-cart-minorder');703// TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)704// @ts-expect-error ST-2949_1705if (minimumOrderAmount > 0 && typeof window.tcart_minorder == 'undefined') {706// TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538)707// @ts-expect-error ST-2949_3708minimumOrderAmount = minimumOrderAmount * 1;709// TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)710// @ts-expect-error ST-2949_1711window.tcart_minorder = minimumOrderAmount;
} // минимальное количество товара // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 let minimumQuantity = cartBlock.getAttribute('data-cart-mincntorder'); // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 if (minimumQuantity > 0 && typeof window.tcart_mincntorder == 'undefined') { // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 minimumQuantity = minimumQuantity * 1; // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 window.tcart_mincntorder = minimumQuantity; } tcart__addDelivery(); tcart__updateTotalProductsinCartObj();}/** * Сохраняет объект window.tcart в localStorage, обновляет дату изменения **/function tcart__saveLocalObj() { // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 if (window.tcart_newDeliveryActive && window.tcart.amount && window.tcart.total) { // TODO ST-2949_4: cannot find name / missing jQuery types (TS2304, TS2592) // @ts-expect-error ST-2949_4 tcart__rerenderDeliveryServices(); } // 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 t_cart__saveCartDataToLS(window.tcart);}/** * Синхронизирует товары в объекте window.tcart и localStorage **/function tcart__syncProductsObject__LStoObj() { if (window.tcart_dontstore === 'y') return; if (typeof window.tcart_maxstoredays != 'undefined' && window.tcart_maxstoredays == 0) return; if (typeof localStorage === 'object') { try { var lsJsonStr = localStorage.getItem('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 var lsJsonObj = JSON.parse(lsJsonStr); if (typeof lsJsonObj['products'] === 'object') { // удаляет из window.tcart пустые или удаленные товары // 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 var actualProductsObj = []; var oldCountProducts = lsJsonObj['products'].length; // @ts-expect-error ST-2949_2 lsJsonObj['products'].forEach(function (product) { if (!tcart__isEmptyObject(product) && product.deleted !== 'yes' && product.quantity > 0) { actualProductsObj.push(product); } }); // 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 window.tcart['products'] = actualProductsObj; // @ts-expect-error ST-2949_2 var actualCountProducts = window.tcart['products'].length; if (actualCountProducts !== oldCountProducts) { tcart__saveLocalObj(); } tcart__updateTotalProductsinCartObj(); } } catch (e) {} }}/** * События виджета корзины и localStorage **/function tcart__addEvents() { var body = document.querySelector('body'); // 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 addClickEvent(query, handler) { var element = document.querySelector(query); if (element) {