Skip to content

Commit 72622b6

Browse files
mrahman3177damcousgeleonandreishichkohostep
authored
Release/3.13.5 (#1570)
* Bugfix/MAGE-948: DOM selector check (#1550) * MAGE-3 Checking on exists element fix (#1516) Co-authored-by: andreishichko <[email protected]> * MAGE-948: use if statement over ternary * MAGE-948: remove optional chaining --------- Co-authored-by: sgeleon <[email protected]> Co-authored-by: andreishichko <[email protected]> * MAGE-947: restrict recommend CSS to algolia managed blocks (#1553) * MAGE-947: restrict recommend CSS to algolia managed blocks * MAGE-947: add css identifer to all rules * MAGE-949: add fallback for secureRenderer (#1556) * Removed polyfill.io from csp_whitelist, was forgotten in MAGE-822 * MAGE-901: showing title for empty recommendation issue addressed * MAGE-901: code updated as per code review suggestions * MAGE-958: release number increased and change log updated * MAGE-958: change log updated. --------- Co-authored-by: Damien Couchez <[email protected]> Co-authored-by: sgeleon <[email protected]> Co-authored-by: andreishichko <[email protected]> Co-authored-by: Pieter Hoste <[email protected]> Co-authored-by: Eric Wright <[email protected]>
1 parent 1a26fce commit 72622b6

File tree

13 files changed

+120
-62
lines changed

13 files changed

+120
-62
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# CHANGE LOG
22

3+
## 3.13.5
4+
5+
### Updates
6+
- Polyfill.io removed from CSP whitelist - Thank you @hostep
7+
- Hide Recommend Titles when not in use
8+
- Incorporate community fix for higher specificity CSS selectors on Recommend - Thank you @sgeleon
9+
10+
### Bug Fixes
11+
- Incorporate community fix for missing DOM element selector - Thank you @sgeleon
12+
313
## 3.13.4
414

515
### Bug Fixes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Algolia Search & Discovery extension for Magento 2
22
==================================================
33

4-
![Latest version](https://img.shields.io/badge/latest-3.13.4-green)
4+
![Latest version](https://img.shields.io/badge/latest-3.13.5-green)
55
![Magento 2](https://img.shields.io/badge/Magento-2.4.x-orange)
66

77
![PHP](https://img.shields.io/badge/PHP-8.2%2C8.1%2C7.4-blue)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Algolia Search & Discovery extension for Magento 2",
44
"type": "magento2-module",
55
"license": ["MIT"],
6-
"version": "3.13.4",
6+
"version": "3.13.5",
77
"require": {
88
"magento/framework": "~102.0|~103.0",
99
"algolia/algoliasearch-client-php": "3.3.2",

etc/csp_whitelist.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd">
44
<policies>
5-
<policy id="script-src">
6-
<values>
7-
<value id="polyfill" type="host">polyfill.io</value>
8-
</values>
9-
</policy>
105
<policy id="connect-src">
116
<values>
127
<value id="algolia-api" type="host">*.algolia.net</value>

etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="Algolia_AlgoliaSearch" setup_version="3.13.4">
3+
<module name="Algolia_AlgoliaSearch" setup_version="3.13.5">
44
<sequence>
55
<module name="Magento_Theme"/>
66
<module name="Magento_Backend"/>
Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
<?php
22

33
/** @var \Algolia\AlgoliaSearch\Block\Configuration $block */
4-
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
54

65
$configuration = $block->getConfiguration();
76

8-
?>
7+
if (class_exists('\Magento\Framework\View\Helper\SecureHtmlRenderer')) : ?>
8+
<?php
9+
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
10+
if ($configuration['instant']['enabled'] === true && $configuration['isSearchPage'] === true) {
11+
$css = /* @noEscape */ $secureRenderer->renderTag('style', [], $configuration['instant']['selector'] . ' {display:none}', false);
12+
/* @noEscape */ echo $secureRenderer->renderTag('script', [], 'document.write(\'' . $css . '\');' , false);
13+
}
14+
?>
915

10-
<?php
11-
if ($configuration['instant']['enabled'] === true && $configuration['isSearchPage'] === true) {
12-
$css = /* @noEscape */ $secureRenderer->renderTag('style', [], $configuration['instant']['selector'] . ' {display:none}', false);
13-
/* @noEscape */ echo $secureRenderer->renderTag('script', [], 'document.write(\'' . $css . '\');' , false);
14-
}
15-
?>
16-
17-
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], "window.algoliaConfig = " . json_encode($configuration) . ';' , false); ?>
16+
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], "window.algoliaConfig = " . json_encode($configuration) . ';' , false); ?>
17+
<?php else: ?>
18+
<script>
19+
<?php
20+
if ($configuration['instant']['enabled'] === true && $configuration['isSearchPage'] === true) :
21+
$css = '<style type="text/css">' . $configuration['instant']['selector'] . ' {display:none}</style>';
22+
?>
23+
// Hide the instant-search selector ASAP to remove flickering. Will be re-displayed later with JS.
24+
document.write('<?php /* @noEscape */ echo $css; ?>');
25+
<?php
26+
endif;
27+
?>
1828

29+
window.algoliaConfig = <?php /* @noEscape */ echo json_encode($configuration); ?>;
30+
</script>
31+
<?php endif; ?>

view/frontend/templates/layer/view.phtml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
<?php
2-
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
3-
?>
4-
51
<?php if ($block->canShowBlock()) : ?>
62
<div class="block filter algolia-filter-list" id="layered-filter-block" data-mage-init='{"collapsible":{"openedState": "active", "collapsible": true, "active": false, "collateral": { "openedState": "filter-active", "element": "body" } }}'>
73
<?php $filtered = count($block->getLayer()->getState()->getFilters()) ?>
@@ -34,15 +30,25 @@
3430
<?php if ($wrapOptions) : ?>
3531
</div>
3632
<?php else : ?>
37-
<?php $scriptString = <<<script
38-
require([
39-
'jquery'
40-
], function ($) {
41-
$('#layered-filter-block').addClass('filter-no-options');
42-
});
43-
script;
44-
?>
45-
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false); ?>
33+
<?php if (class_exists('\Magento\Framework\View\Helper\SecureHtmlRenderer')) : ?>
34+
<?php
35+
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
36+
$scriptString = "require([
37+
'jquery'
38+
], function ($) {
39+
$('#layered-filter-block').addClass('filter-no-options');
40+
});";
41+
42+
/* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false); ?>
43+
<?php else : ?>
44+
<script>
45+
require([
46+
'jquery'
47+
], function ($) {
48+
$('#layered-filter-block').addClass('filter-no-options');
49+
});
50+
</script>
51+
<?php endif; ?>
4652
<?php endif; ?>
4753
</div>
4854
</div>

view/frontend/templates/recommend/cart/recommend_items.phtml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ $recommendConfig = $viewModel->getAlgoliaRecommendConfiguration();
55
if (!empty($recommendConfig['enabledRelatedInCart']) || !empty($recommendConfig['enabledFBTInCart']) || !empty($recommendConfig['isTrendItemsEnabledInCartPage'])):
66
$cartItems = $viewModel->getAllCartItems();
77
?>
8-
<div id="frequentlyBoughtTogether" class="recommend-component"></div>
9-
<div id="relatedProducts" class="recommend-component"></div>
10-
<div id="trendItems" class="trendsItem recommend-component"></div>
8+
<div id="algoliaRecommend">
9+
<div id="frequentlyBoughtTogether" class="recommend-component"></div>
10+
<div id="relatedProducts" class="recommend-component"></div>
11+
<div id="trendItems" class="trendsItem recommend-component"></div>
12+
</div>
1113
<script type="text/x-magento-init">
1214
{
1315
"*": {

view/frontend/templates/recommend/products.phtml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ $recommendConfig = $viewModel->getAlgoliaRecommendConfiguration();
55

66
if (!empty($recommendConfig['enabledFBT']) || !empty($recommendConfig['enabledRelated']) || !empty($recommendConfig['isTrendItemsEnabledInPDP'])):
77
$product = $viewModel->getProduct(); ?>
8-
<div id="frequentlyBoughtTogether" class="recommend-component"></div>
9-
<div id="relatedProducts" class="recommend-component"></div>
10-
<div id="trendItems" class="trendsItem recommend-component"></div>
8+
<div id="algoliaRecommend">
9+
<div id="frequentlyBoughtTogether" class="recommend-component"></div>
10+
<div id="relatedProducts" class="recommend-component"></div>
11+
<div id="trendItems" class="trendsItem recommend-component"></div>
12+
</div>
1113
<script type="text/x-magento-init">
1214
{
1315
"*": {

view/frontend/templates/recommend/widget/trends-item.phtml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
$isEnabled = $block->isTrendingItemEnabled();
44
if ($isEnabled):
55
$trendConstainer = 'trendItems' . $block->generateUniqueToken(); ?>
6-
<div id="<?= $trendConstainer ?>" class="trendsItem recommend-component"></div>
6+
<div id="algoliaRecommend">
7+
<div id="<?= $trendConstainer ?>" class="trendsItem recommend-component"></div>
8+
</div>
79
<script type="text/x-magento-init">
810
{
911
"*": {
@@ -23,4 +25,4 @@ if ($isEnabled):
2325
}
2426
}
2527
</script>
26-
<?php endif; ?>
28+
<?php endif; ?>

0 commit comments

Comments
 (0)