diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a6fc559..f57f0e76f 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # CHANGE LOG +## 3.14.1 + +### Updates +- Token clean up on session expiration + +### Bug Fixes +- Query string append issue addressed +- Fixed issue with "base table not found" in integration tests due to new CLI command classes +- Removed a warning during indexing of entities with no `created_at` attribute +- Fixed incorrect Recommend paths resulting from earlier JS asset reorg +- README.md updated + ## 3.14.0 GA release diff --git a/Console/Command/ReplicaRebuildCommand.php b/Console/Command/ReplicaRebuildCommand.php index 0dd9fe277..b52c82aa6 100644 --- a/Console/Command/ReplicaRebuildCommand.php +++ b/Console/Command/ReplicaRebuildCommand.php @@ -26,8 +26,8 @@ class ReplicaRebuildCommand use ReplicaDeleteCommandTrait; public function __construct( - protected ProductHelper $productHelper, protected ReplicaManagerInterface $replicaManager, + protected ProductHelper $productHelper, protected StoreManagerInterface $storeManager, protected ReplicaState $replicaState, AppState $appState, diff --git a/Console/Command/ReplicaSyncCommand.php b/Console/Command/ReplicaSyncCommand.php index 13dbe6497..edff1333a 100644 --- a/Console/Command/ReplicaSyncCommand.php +++ b/Console/Command/ReplicaSyncCommand.php @@ -24,9 +24,8 @@ class ReplicaSyncCommand extends AbstractReplicaCommand implements ReplicaSyncCo use ReplicaSyncCommandTrait; public function __construct( - - protected ProductHelper $productHelper, protected ReplicaManagerInterface $replicaManager, + protected ProductHelper $productHelper, protected StoreManagerInterface $storeManager, State $state, StoreNameFetcher $storeNameFetcher, diff --git a/Helper/AlgoliaHelper.php b/Helper/AlgoliaHelper.php index e7f7ba872..593bb96ff 100755 --- a/Helper/AlgoliaHelper.php +++ b/Helper/AlgoliaHelper.php @@ -593,7 +593,9 @@ protected function prepareRecords(array &$objects, string $indexName): void foreach ($objects as $key => &$object) { $object['algoliaLastUpdateAtCET'] = $currentCET; // Convert created_at to UTC timestamp - $object['created_at'] = strtotime($object['created_at']); + if (isset($object['created_at'])) { + $object['created_at'] = strtotime($object['created_at']); + } $previousObject = $object; diff --git a/Helper/ConfigHelper.php b/Helper/ConfigHelper.php index 4bfaac5a2..c45133330 100755 --- a/Helper/ConfigHelper.php +++ b/Helper/ConfigHelper.php @@ -81,6 +81,7 @@ class ConfigHelper public const CC_ANALYTICS_IS_SELECTOR = 'algoliasearch_cc_analytics/cc_analytics_group/is_selector'; public const CC_CONVERSION_ANALYTICS_MODE = 'algoliasearch_cc_analytics/cc_analytics_group/conversion_analytics_mode'; public const CC_ADD_TO_CART_SELECTOR = 'algoliasearch_cc_analytics/cc_analytics_group/add_to_cart_selector'; + public const COOKIE_LIFETIME = 'web/cookie/cookie_lifetime'; public const GA_ENABLE = 'algoliasearch_analytics/analytics_group/enable'; public const GA_DELAY = 'algoliasearch_analytics/analytics_group/delay'; @@ -142,7 +143,7 @@ class ConfigHelper protected const IS_LOOKING_SIMILAR_ENABLED_IN_PDP = 'algoliasearch_recommend/recommend/looking_similar/is_looking_similar_enabled_on_pdp'; protected const IS_LOOKING_SIMILAR_ENABLED_IN_SHOPPING_CART = 'algoliasearch_recommend/recommend/looking_similar/is_looking_similar_enabled_on_cart_page'; protected const LOOKING_SIMILAR_TITLE = 'algoliasearch_recommend/recommend/looking_similar/title'; - public const LEGACY_USE_VIRTUAL_REPLICA_ENABLED = 'algoliasearch_instant/instant/use_virtual_replica'; + public const LEGACY_USE_VIRTUAL_REPLICA_ENABLED = 'algoliasearch_instant/instant/use_virtual_replica'; protected const AUTOCOMPLETE_KEYBORAD_NAVIAGATION = 'algoliasearch_autocomplete/autocomplete/navigator'; protected const FREQUENTLY_BOUGHT_TOGETHER_TITLE = 'algoliasearch_recommend/recommend/frequently_bought_together/title'; protected const RELATED_PRODUCTS_TITLE = 'algoliasearch_recommend/recommend/related_product/title'; @@ -1872,4 +1873,13 @@ public function isCookieRestrictionModeEnabled() { return (bool)$this->cookieHelper->isCookieRestrictionModeEnabled(); } + + /** + * @param $storeId + * @return mixed + */ + public function getCookieLifetime($storeId = null) + { + return $this->configInterface->getValue(self::COOKIE_LIFETIME, ScopeInterface::SCOPE_STORE, $storeId); + } } diff --git a/Helper/InsightsHelper.php b/Helper/InsightsHelper.php index 3f6f1075a..89f0c37ff 100644 --- a/Helper/InsightsHelper.php +++ b/Helper/InsightsHelper.php @@ -142,7 +142,7 @@ public function setAuthenticatedUserToken(Customer $customer): string|null $userToken = $this->generateAuthenticatedUserToken($customer); $metaData = $this->cookieMetadataFactory->createPublicCookieMetadata() - ->setDurationOneYear() + ->setDuration($this->configHelper->getCookieLifetime()) ->setPath('/') ->setHttpOnly(false) ->setSecure(false); diff --git a/Observer/Insights/CookieRefresherObserver.php b/Observer/Insights/CookieRefresherObserver.php new file mode 100644 index 000000000..98b6edded --- /dev/null +++ b/Observer/Insights/CookieRefresherObserver.php @@ -0,0 +1,37 @@ +customerSession->isLoggedIn()) { + $this->insightsHelper->setAuthenticatedUserToken($this->customerSession->getCustomer()); + } + } +} diff --git a/Observer/Insights/CustomerLogout.php b/Observer/Insights/CustomerLogout.php index 0d0a69365..bd5ad4d4a 100644 --- a/Observer/Insights/CustomerLogout.php +++ b/Observer/Insights/CustomerLogout.php @@ -47,6 +47,7 @@ public function execute(\Magento\Framework\Event\Observer $observer): void try { $this->cookieManager->setPublicCookie(self::UNSET_AUTHENTICATION_USER_TOKEN_COOKIE_NAME, 1, $metaDataUnset); $this->cookieManager->deleteCookie(InsightsHelper::ALGOLIA_CUSTOMER_USER_TOKEN_COOKIE_NAME, $metadata); + $this->cookieManager->deleteCookie(InsightsHelper::ALGOLIA_ANON_USER_TOKEN_COOKIE_NAME, $metadata); } catch (LocalizedException $e) { $this->logger->error("Error writing Algolia customer cookies: " . $e->getMessage()); } diff --git a/README.md b/README.md index 30b652a23..194a90780 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.14.0-green) +![Latest version](https://img.shields.io/badge/latest-3.14.1-green) ![Magento 2](https://img.shields.io/badge/Magento-2.4.x-orange) ![PHP](https://img.shields.io/badge/PHP-8.1%2C8.2%2C8.3-blue) @@ -35,10 +35,16 @@ Magento 2.3 and earlier versions are no longer supported by the Algolia extensio Version 3.x of our extension is compatible with Magento 2.4. Review the [Customisation](https://github.com/algolia/algoliasearch-magento-2#customisation) section to learn more about the differences between our extension versions. -| Extension Version | End of Life | Magento | PHP | -|-------------------| --- |----------| ---------| -| v3.13.x | N/A | `2.4.x` | `^7.2 \|\| ^8.0` | -| v3.14.x | N/A | `2.4.x` | `>=8.1` | +| Extension Version | End of Life | Magento | PHP | +|-------------------|-------------|------------------------------|----------------------------------------| +| v3.7.x | 10/10/2023 | `~2.3.7\|\|~2.4.5\|\|~2.4.6` | `~7.3.0\|\|~7.4.0\|\|~8.1.0\|\|~8.2.0` | +| v3.8.x | 3/8/2023 | `~2.4.5\|\|~2.4.6` | `~7.4.0\|\|~8.1.0\|\|~8.2.0` | +| v3.9.x | 10/13/2023 | `~2.4.5\|\|~2.4.6` | `~7.4.0\|\|~8.1.0\|\|~8.2.0` | +| v3.10.x | 12/12/2023 | `~2.4.6` | `~8.1.0\|\|~8.2.0` | +| v3.11.x | 1/26/2024 | `~2.4.6` | `~8.1.0\|\|~8.2.0` | +| v3.12.x | 8/2/2024 | `~2.4.6` | `~8.1.0\|\|~8.2.0` | +| v3.13.x | N/A | `~2.4.6` | `~8.1.0\|\|~8.2.0` | +| v3.14.x | N/A | `~2.4.6\|\|~2.4.7` | `~8.1.0\|\|~8.2.0\|\|~8.3.0` | ## Documentation @@ -56,7 +62,7 @@ The easiest way to install the extension is to use [Composer](https://getcompose If you would like to stay on a minor version, please upgrade your composer to only accept minor versions. The following example will keep you on the minor version and will update patches automatically. -`"algolia/algoliasearch-magento-2": "~3.14.0"` +`"algolia/algoliasearch-magento-2": "~3.14.1"` ### Customisation @@ -77,8 +83,11 @@ Knowing the version of the library will help you understand what is available in | v3.11.0 | [1.6.3](https://github.com/algolia/autocomplete.js/tree/v1.6.3) | [4.41.0](https://github.com/algolia/instantsearch.js/tree/v4.41.0) | [2.6.0](https://github.com/algolia/search-insights.js/tree/v2.6.0) | [1.8.0](https://github.com/algolia/recommend/tree/v1.8.0) | | v3.13.0 | [1.6.3](https://github.com/algolia/autocomplete.js/tree/v1.6.3) | [4.63.0](https://github.com/algolia/instantsearch/tree/instantsearch.js%404.63.0) | [2.6.0](https://github.com/algolia/search-insights.js/tree/v2.6.0) | [1.8.0](https://github.com/algolia/recommend/tree/v1.8.0) | | >=v3.14.x | [1.6.3](https://github.com/algolia/autocomplete.js/tree/v1.6.3) | [4.63.0](https://github.com/algolia/instantsearch/tree/instantsearch.js%404.63.0) | [2.6.0](https://github.com/algolia/search-insights.js/tree/v2.6.0) | [1.15.0](https://github.com/algolia/recommend/tree/v1.15.0) | + The autocomplete and instantsearch libraries are accessible in the `algoliaBundle` global. This bundle is a prepackage javascript file that contains it's dependencies. What is included in this bundle can be seen here: +v3.x latest bundle: https://github.com/algolia/algoliasearch-extensions-bundle/blob/ISv4/package.json + The search-insights.js library is standalone. Refer to these docs when customising your Algolia Magento extension frontend features: diff --git a/composer.json b/composer.json index 258fd5772..983191af6 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.14.0", + "version": "3.14.1", "require": { "php": "~8.1|~8.2|~8.3", "magento/framework": "~103.0", diff --git a/etc/di.xml b/etc/di.xml index a09c94a63..2c43c8f87 100755 --- a/etc/di.xml +++ b/etc/di.xml @@ -154,4 +154,33 @@ + + + + Algolia\AlgoliaSearch\Api\Product\ReplicaManagerInterface\Proxy + Algolia\AlgoliaSearch\Helper\Entity\ProductHelper\Proxy + + + + + + Algolia\AlgoliaSearch\Api\Product\ReplicaManagerInterface\Proxy + + + + + + Algolia\AlgoliaSearch\Api\Product\ReplicaManagerInterface\Proxy + Algolia\AlgoliaSearch\Helper\Entity\ProductHelper\Proxy + + + + + + Algolia\AlgoliaSearch\Helper\ConfigHelper\Proxy + Algolia\AlgoliaSearch\Api\Product\ReplicaManagerInterface\Proxy + Algolia\AlgoliaSearch\Helper\Entity\ProductHelper\Proxy + + + diff --git a/etc/frontend/events.xml b/etc/frontend/events.xml index 2d7fac52f..b0ab7e148 100755 --- a/etc/frontend/events.xml +++ b/etc/frontend/events.xml @@ -32,4 +32,7 @@ + + + diff --git a/etc/module.xml b/etc/module.xml index 584c8720a..f6707058e 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - + diff --git a/view/frontend/templates/recommend/cart/recommend_items.phtml b/view/frontend/templates/recommend/cart/recommend_items.phtml index e3e222671..b20dedfd8 100644 --- a/view/frontend/templates/recommend/cart/recommend_items.phtml +++ b/view/frontend/templates/recommend/cart/recommend_items.phtml @@ -14,7 +14,7 @@ if (!empty($recommendConfig['enabledRelatedInCart']) || !empty($recommendConfig[