diff --git a/CHANGELOG.md b/CHANGELOG.md index 9325a4491..f88a18d5a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # CHANGE LOG +## 3.13.5 + +### Updates +- Polyfill.io removed from CSP whitelist - Thank you @hostep +- Hide Recommend Titles when not in use +- Incorporate community fix for higher specificity CSS selectors on Recommend - Thank you @sgeleon + +### Bug Fixes +- Incorporate community fix for missing DOM element selector - Thank you @sgeleon + ## 3.13.4 ### Bug Fixes diff --git a/README.md b/README.md index ecfcbd4d2..fd3672075 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Algolia Search & Discovery extension for Magento 2 ================================================== -![Latest version](https://img.shields.io/badge/latest-3.13.4-green) +![Latest version](https://img.shields.io/badge/latest-3.13.5-green) ![Magento 2](https://img.shields.io/badge/Magento-2.4.x-orange) ![PHP](https://img.shields.io/badge/PHP-8.2%2C8.1%2C7.4-blue) diff --git a/composer.json b/composer.json index c22b268a7..e39a0b106 100755 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Algolia Search & Discovery extension for Magento 2", "type": "magento2-module", "license": ["MIT"], - "version": "3.13.4", + "version": "3.13.5", "require": { "magento/framework": "~102.0|~103.0", "algolia/algoliasearch-client-php": "3.3.2", diff --git a/etc/csp_whitelist.xml b/etc/csp_whitelist.xml index ac29534de..0dbb8c572 100644 --- a/etc/csp_whitelist.xml +++ b/etc/csp_whitelist.xml @@ -2,11 +2,6 @@ - - - polyfill.io - - *.algolia.net diff --git a/etc/module.xml b/etc/module.xml index 3b5633cc7..3253219c6 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - + diff --git a/view/frontend/templates/internals/configuration.phtml b/view/frontend/templates/internals/configuration.phtml index 47621ce1c..6525c266c 100755 --- a/view/frontend/templates/internals/configuration.phtml +++ b/view/frontend/templates/internals/configuration.phtml @@ -1,18 +1,31 @@ getConfiguration(); -?> +if (class_exists('\Magento\Framework\View\Helper\SecureHtmlRenderer')) : ?> + renderTag('style', [], $configuration['instant']['selector'] . ' {display:none}', false); + /* @noEscape */ echo $secureRenderer->renderTag('script', [], 'document.write(\'' . $css . '\');' , false); + } + ?> -renderTag('style', [], $configuration['instant']['selector'] . ' {display:none}', false); - /* @noEscape */ echo $secureRenderer->renderTag('script', [], 'document.write(\'' . $css . '\');' , false); -} -?> - -renderTag('script', [], "window.algoliaConfig = " . json_encode($configuration) . ';' , false); ?> + renderTag('script', [], "window.algoliaConfig = " . json_encode($configuration) . ';' , false); ?> + + + diff --git a/view/frontend/templates/layer/view.phtml b/view/frontend/templates/layer/view.phtml index f444d6318..fed6c8e61 100644 --- a/view/frontend/templates/layer/view.phtml +++ b/view/frontend/templates/layer/view.phtml @@ -1,7 +1,3 @@ - - canShowBlock()) : ?>
getLayer()->getState()->getFilters()) ?> @@ -34,15 +30,25 @@
- - renderTag('script', [], $scriptString, false); ?> + + renderTag('script', [], $scriptString, false); ?> + + + diff --git a/view/frontend/templates/recommend/cart/recommend_items.phtml b/view/frontend/templates/recommend/cart/recommend_items.phtml index ba4c90a0d..e48dcff48 100644 --- a/view/frontend/templates/recommend/cart/recommend_items.phtml +++ b/view/frontend/templates/recommend/cart/recommend_items.phtml @@ -5,9 +5,11 @@ $recommendConfig = $viewModel->getAlgoliaRecommendConfiguration(); if (!empty($recommendConfig['enabledRelatedInCart']) || !empty($recommendConfig['enabledFBTInCart']) || !empty($recommendConfig['isTrendItemsEnabledInCartPage'])): $cartItems = $viewModel->getAllCartItems(); ?> -
-
-
+
+
+
+
+
- \ No newline at end of file + diff --git a/view/frontend/web/internals/common.js b/view/frontend/web/internals/common.js index 2e130bc8b..7d42fbb0f 100755 --- a/view/frontend/web/internals/common.js +++ b/view/frontend/web/internals/common.js @@ -14,7 +14,7 @@ define(['jquery', 'algoliaBundle'], function ($, algoliaBundle) { return acc; }, {}); - window.algolia = { + window.algolia = { deprecatedHooks: [ 'beforeAutocompleteProductSourceOptions', 'beforeAutocompleteSources' @@ -85,7 +85,7 @@ define(['jquery', 'algoliaBundle'], function ($, algoliaBundle) { htmlspecialcharsEncode: string => { const regex = new RegExp(`[${Object.keys(SPECIAL_CHAR_ENCODE_MAP).join('')}]`, 'g'); return string.replace(regex, (m) => SPECIAL_CHAR_ENCODE_MAP[m]); - } + } }; window.isMobile = function () { @@ -629,7 +629,9 @@ define(['jquery', 'algoliaBundle'], function ($, algoliaBundle) { var input = $(this).closest('#algolia-searchbox').find('input'); input.val(''); - input.get(0).dispatchEvent(new Event('input')); + if (input.length) { + input.get(0).dispatchEvent(new Event('input')); + } handleInputCrossAutocomplete(input); }); diff --git a/view/frontend/web/internals/recommend.css b/view/frontend/web/internals/recommend.css index 815246bf9..021b2cab9 100644 --- a/view/frontend/web/internals/recommend.css +++ b/view/frontend/web/internals/recommend.css @@ -1,33 +1,42 @@ -.recommend-item .product-img { +#algoliaRecommend .recommend-item .product-img { width: 180px; } -.auc-Recommend-list { +#algoliaRecommend .auc-Recommend-list { display: flex; justify-content: space-evenly; list-style: none; } -.recommend-item .product-name { +#algoliaRecommend .recommend-item .product-name { height: 50px; width: 110px; margin: 0 auto; } -.recommend-component { +#algoliaRecommend .recommend-component { margin-bottom: 80px; } -#relatedProducts .auc-Recommend-list, #frequentlyBoughtTogether .auc-Recommend-list, .trendsItem .auc-Recommend-list{ +#algoliaRecommend #relatedProducts .auc-Recommend-list, +#algoliaRecommend #frequentlyBoughtTogether .auc-Recommend-list, +#algoliaRecommend .trendsItem .auc-Recommend-list { flex-wrap: wrap; justify-content: flex-start; } -#relatedProducts li, #frequentlyBoughtTogether li, .trendsItem li { +#algoliaRecommend #relatedProducts li, +#algoliaRecommend #frequentlyBoughtTogether li, +#algoliaRecommend .trendsItem li { display: flex; justify-content: center; width: 16.66666667%; } -#relatedProducts li a, #frequentlyBoughtTogether li a, .trendsItem li a { +#algoliaRecommend #relatedProducts li a, +#algoliaRecommend #frequentlyBoughtTogether li a, +#algoliaRecommend .trendsItem li a { color: inherit; display: block; } -#relatedProducts .product-name, #frequentlyBoughtTogether .product-name, #trendItems .product-name, .trendsItem .product-name{ +#algoliaRecommend #relatedProducts .product-name, +#algoliaRecommend #frequentlyBoughtTogether .product-name, +#algoliaRecommend #trendItems .product-name, +#algoliaRecommend .trendsItem .product-name{ text-align: center; width: 150px; text-overflow: ellipsis; @@ -40,37 +49,45 @@ -webkit-box-orient: vertical; display: -webkit-box; } -#trendItems a, #trendItems a:hover, .trendsItem a, .trendsItem a:hover{ +#algoliaRecommend #trendItems a, +#algoliaRecommend #trendItems a:hover, +#algoliaRecommend .trendsItem a, +#algoliaRecommend .trendsItem a:hover{ color:#333; } -.auc-Recommend-item .product-details { +#algoliaRecommend .auc-Recommend-item .product-details { text-align: center; } -#trendItems .auc-Recommend-list{ +#algoliaRecommend #trendItems .auc-Recommend-list{ flex-wrap: wrap; justify-content: flex-start; } -.product-details .recommend-item .action.primary, .action-primary{ +#algoliaRecommend .product-details .recommend-item .action.primary, +#algoliaRecommend .action-primary{ background: #f4f4f4; border: 1px solid #f4f4f4; color: #666666; } -.product-details .recommend-item .action.primary:hover, .action-primary:hover { +#algoliaRecommend .product-details .recommend-item .action.primary:hover, +#algoliaRecommend .action-primary:hover { border-color: #1979c3; background: #1979c3; color: #FFFFFF; } @media (min-width: 768px) and (max-width: 1023px) { - #relatedProducts li, #frequentlyBoughtTogether li, #trendItems li { + #algoliaRecommend #relatedProducts li, + #algoliaRecommend #frequentlyBoughtTogether li, + #algoliaRecommend #trendItems li { width: 33.33333333%; } } @media (max-width: 767px) { - #relatedProducts li, #frequentlyBoughtTogether li, #trendItems li { + #algoliaRecommend #relatedProducts li, + #algoliaRecommend #frequentlyBoughtTogether li, + #algoliaRecommend #trendItems li { width: 50%; } } -h3.auc-Recommend-title { - padding: 20p; +#algoliaRecommend h3.auc-Recommend-title { padding-bottom: 20px; } diff --git a/view/frontend/web/recommend.js b/view/frontend/web/recommend.js index f98ec6c31..bf8f58d57 100644 --- a/view/frontend/web/recommend.js +++ b/view/frontend/web/recommend.js @@ -34,7 +34,10 @@ define([ position: index + 1, })); }, - headerComponent({html}) { + headerComponent({html, recommendations}) { + if (!recommendations.length) { + return ''; + } return recommendProductsHtml.getHeaderHtml(html,algoliaConfig.recommend.FBTTitle); }, itemComponent({item, html}) { @@ -55,7 +58,10 @@ define([ position: index + 1, })); }, - headerComponent({html}) { + headerComponent({html, recommendations}) { + if (!recommendations.length) { + return ''; + } return recommendProductsHtml.getHeaderHtml(html,algoliaConfig.recommend.relatedProductsTitle); }, itemComponent({item, html}) { @@ -79,7 +85,10 @@ define([ position: index + 1, })); }, - headerComponent({html}) { + headerComponent({html, recommendations}) { + if (!recommendations.length) { + return ''; + } return recommendProductsHtml.getHeaderHtml(html,algoliaConfig.recommend.trendingItemsTitle); }, itemComponent({item, html}) {