/** * Initialize the product from Snippet * * @param {string} recid * @param {object} options * @param {object} product - the options of product **/function t_catalog_productInit(recid, options, product) { t_onReady(function () { const allRecords = document.getElementById('allrecords'); if (allRecords) { t_catalog__setupEndpoint(); } t_catalog_snippet_initProduct(recid, options, 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_2function t_catalog_snippet_initProduct(recid, options, product) { var rec = document.querySelector('#rec' + recid); // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 var el_product = rec.querySelector('.t-catalog__product-snippet.js-catalog-product'); // @ts-expect-error ST-2949_3 el_product.setAttribute('data-card-size', 'large'); var urlSearch = t_catalog_snippet_getJsonFromUrl(); if (options.popup_opts.popupContainer === '100') { // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 var productContainer = el_product.querySelector('.t-container'); // @ts-expect-error ST-2949_3 productContainer.classList.add('t-container_fluid'); // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 productContainer.style.maxWidth = '100%'; // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 if (productContainer.firstElementChild) { // @ts-expect-error ST-2949_3 productContainer.firstElementChild.classList.add('t-container_fluid'); } } t_catalog_snippet_copyTypographyToSnippet(recid, options); t_catalog_drawProdPopup_drawGallery(recid, el_product, product, options); // 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 initProductSnippetBreadcrumbs(recid, el_product, product, options); var addOptionsAndChooseEdition = function () { // @ts-expect-error ST-2949_5 t_catalog_addProductOptions(recid, product, el_product, options, 'largecard'); t_catalog_snippet_chooseEditionFromUrl(recid, product, el_product, options); t_catalog_onFuncLoad('t_prod__init', function () { // TODO ST-2949_4: cannot find name / missing jQuery types (TS2304, TS2592) // @ts-expect-error ST-2949_4 t_prod__init(recid); }); }; if (!window.tCatalogDict) { t_catalog__setGlobalDictObj(); } // Snippet relevants title fallback (same logic as popup) // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 var relevantsTitle = rec.querySelector('.t-catalog__relevants__title'); // @ts-expect-error ST-2949_3 if (relevantsTitle && !relevantsTitle.textContent.trim()) { // @ts-expect-error ST-2949_3 relevantsTitle.textContent = options.titleRelevants ? options.titleRelevants : window.tCatalogDict['seeAlso']; if (Object.prototype.hasOwnProperty.call(options.typo, 'title') && options.typo.title) { relevantsTitle.setAttribute('style', options.typo.title); } } // add SKU text // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) // @ts-expect-error ST-2949_3 var storeProdSKU = el_product.querySelector('.js-catalog-prod-sku');