Skip to content

Commit b29cd68

Browse files
authored
Merge pull request #1603 from algolia/release/3.14.1
Release/3.14.1 - patch release
2 parents 8214531 + e68d413 commit b29cd68

19 files changed

+122
-20
lines changed

CHANGELOG.md

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

3+
## 3.14.1
4+
5+
### Updates
6+
- Token clean up on session expiration
7+
8+
### Bug Fixes
9+
- Query string append issue addressed
10+
- Fixed issue with "base table not found" in integration tests due to new CLI command classes
11+
- Removed a warning during indexing of entities with no `created_at` attribute
12+
- Fixed incorrect Recommend paths resulting from earlier JS asset reorg
13+
- README.md updated
14+
315
## 3.14.0
416

517
GA release

Console/Command/ReplicaRebuildCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class ReplicaRebuildCommand
2626
use ReplicaDeleteCommandTrait;
2727

2828
public function __construct(
29-
protected ProductHelper $productHelper,
3029
protected ReplicaManagerInterface $replicaManager,
30+
protected ProductHelper $productHelper,
3131
protected StoreManagerInterface $storeManager,
3232
protected ReplicaState $replicaState,
3333
AppState $appState,

Console/Command/ReplicaSyncCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ class ReplicaSyncCommand extends AbstractReplicaCommand implements ReplicaSyncCo
2424
use ReplicaSyncCommandTrait;
2525

2626
public function __construct(
27-
28-
protected ProductHelper $productHelper,
2927
protected ReplicaManagerInterface $replicaManager,
28+
protected ProductHelper $productHelper,
3029
protected StoreManagerInterface $storeManager,
3130
State $state,
3231
StoreNameFetcher $storeNameFetcher,

Helper/AlgoliaHelper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,9 @@ protected function prepareRecords(array &$objects, string $indexName): void
593593
foreach ($objects as $key => &$object) {
594594
$object['algoliaLastUpdateAtCET'] = $currentCET;
595595
// Convert created_at to UTC timestamp
596-
$object['created_at'] = strtotime($object['created_at']);
596+
if (isset($object['created_at'])) {
597+
$object['created_at'] = strtotime($object['created_at']);
598+
}
597599

598600
$previousObject = $object;
599601

Helper/ConfigHelper.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class ConfigHelper
8181
public const CC_ANALYTICS_IS_SELECTOR = 'algoliasearch_cc_analytics/cc_analytics_group/is_selector';
8282
public const CC_CONVERSION_ANALYTICS_MODE = 'algoliasearch_cc_analytics/cc_analytics_group/conversion_analytics_mode';
8383
public const CC_ADD_TO_CART_SELECTOR = 'algoliasearch_cc_analytics/cc_analytics_group/add_to_cart_selector';
84+
public const COOKIE_LIFETIME = 'web/cookie/cookie_lifetime';
8485

8586
public const GA_ENABLE = 'algoliasearch_analytics/analytics_group/enable';
8687
public const GA_DELAY = 'algoliasearch_analytics/analytics_group/delay';
@@ -142,7 +143,7 @@ class ConfigHelper
142143
protected const IS_LOOKING_SIMILAR_ENABLED_IN_PDP = 'algoliasearch_recommend/recommend/looking_similar/is_looking_similar_enabled_on_pdp';
143144
protected const IS_LOOKING_SIMILAR_ENABLED_IN_SHOPPING_CART = 'algoliasearch_recommend/recommend/looking_similar/is_looking_similar_enabled_on_cart_page';
144145
protected const LOOKING_SIMILAR_TITLE = 'algoliasearch_recommend/recommend/looking_similar/title';
145-
public const LEGACY_USE_VIRTUAL_REPLICA_ENABLED = 'algoliasearch_instant/instant/use_virtual_replica';
146+
public const LEGACY_USE_VIRTUAL_REPLICA_ENABLED = 'algoliasearch_instant/instant/use_virtual_replica';
146147
protected const AUTOCOMPLETE_KEYBORAD_NAVIAGATION = 'algoliasearch_autocomplete/autocomplete/navigator';
147148
protected const FREQUENTLY_BOUGHT_TOGETHER_TITLE = 'algoliasearch_recommend/recommend/frequently_bought_together/title';
148149
protected const RELATED_PRODUCTS_TITLE = 'algoliasearch_recommend/recommend/related_product/title';
@@ -1872,4 +1873,13 @@ public function isCookieRestrictionModeEnabled()
18721873
{
18731874
return (bool)$this->cookieHelper->isCookieRestrictionModeEnabled();
18741875
}
1876+
1877+
/**
1878+
* @param $storeId
1879+
* @return mixed
1880+
*/
1881+
public function getCookieLifetime($storeId = null)
1882+
{
1883+
return $this->configInterface->getValue(self::COOKIE_LIFETIME, ScopeInterface::SCOPE_STORE, $storeId);
1884+
}
18751885
}

Helper/InsightsHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function setAuthenticatedUserToken(Customer $customer): string|null
142142
$userToken = $this->generateAuthenticatedUserToken($customer);
143143

144144
$metaData = $this->cookieMetadataFactory->createPublicCookieMetadata()
145-
->setDurationOneYear()
145+
->setDuration($this->configHelper->getCookieLifetime())
146146
->setPath('/')
147147
->setHttpOnly(false)
148148
->setSecure(false);
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Algolia\AlgoliaSearch\Observer\Insights;
4+
5+
use Algolia\AlgoliaSearch\Helper\InsightsHelper;
6+
use Magento\Customer\Model\Session as CustomerSession;
7+
use Magento\Framework\Event\Observer;
8+
use Magento\Framework\Event\ObserverInterface;
9+
10+
class CookieRefresherObserver implements ObserverInterface
11+
{
12+
/**
13+
* CookieRefresherObserver observer constructor.
14+
*
15+
* @param CustomerSession $customerSession
16+
* @param InsightsHelper $insightsHelper
17+
*
18+
*/
19+
public function __construct(
20+
private readonly CustomerSession $customerSession,
21+
private readonly InsightsHelper $insightsHelper,
22+
) {}
23+
24+
/**
25+
* Renew anonymous or customer session token to update the lifetime
26+
*
27+
* @param Observer $observer
28+
*
29+
* @return void
30+
*/
31+
public function execute(Observer $observer): void
32+
{
33+
if ($this->customerSession->isLoggedIn()) {
34+
$this->insightsHelper->setAuthenticatedUserToken($this->customerSession->getCustomer());
35+
}
36+
}
37+
}

Observer/Insights/CustomerLogout.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function execute(\Magento\Framework\Event\Observer $observer): void
4747
try {
4848
$this->cookieManager->setPublicCookie(self::UNSET_AUTHENTICATION_USER_TOKEN_COOKIE_NAME, 1, $metaDataUnset);
4949
$this->cookieManager->deleteCookie(InsightsHelper::ALGOLIA_CUSTOMER_USER_TOKEN_COOKIE_NAME, $metadata);
50+
$this->cookieManager->deleteCookie(InsightsHelper::ALGOLIA_ANON_USER_TOKEN_COOKIE_NAME, $metadata);
5051
} catch (LocalizedException $e) {
5152
$this->logger->error("Error writing Algolia customer cookies: " . $e->getMessage());
5253
}

README.md

Lines changed: 15 additions & 6 deletions
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.14.0-green)
4+
![Latest version](https://img.shields.io/badge/latest-3.14.1-green)
55
![Magento 2](https://img.shields.io/badge/Magento-2.4.x-orange)
66

77
![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
3535

3636
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.
3737

38-
| Extension Version | End of Life | Magento | PHP |
39-
|-------------------| --- |----------| ---------|
40-
| v3.13.x | N/A | `2.4.x` | `^7.2 \|\| ^8.0` |
41-
| v3.14.x | N/A | `2.4.x` | `>=8.1` |
38+
| Extension Version | End of Life | Magento | PHP |
39+
|-------------------|-------------|------------------------------|----------------------------------------|
40+
| 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` |
41+
| v3.8.x | 3/8/2023 | `~2.4.5\|\|~2.4.6` | `~7.4.0\|\|~8.1.0\|\|~8.2.0` |
42+
| v3.9.x | 10/13/2023 | `~2.4.5\|\|~2.4.6` | `~7.4.0\|\|~8.1.0\|\|~8.2.0` |
43+
| v3.10.x | 12/12/2023 | `~2.4.6` | `~8.1.0\|\|~8.2.0` |
44+
| v3.11.x | 1/26/2024 | `~2.4.6` | `~8.1.0\|\|~8.2.0` |
45+
| v3.12.x | 8/2/2024 | `~2.4.6` | `~8.1.0\|\|~8.2.0` |
46+
| v3.13.x | N/A | `~2.4.6` | `~8.1.0\|\|~8.2.0` |
47+
| v3.14.x | N/A | `~2.4.6\|\|~2.4.7` | `~8.1.0\|\|~8.2.0\|\|~8.3.0` |
4248

4349
## Documentation
4450

@@ -56,7 +62,7 @@ The easiest way to install the extension is to use [Composer](https://getcompose
5662

5763
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.
5864

59-
`"algolia/algoliasearch-magento-2": "~3.14.0"`
65+
`"algolia/algoliasearch-magento-2": "~3.14.1"`
6066

6167
### Customisation
6268

@@ -77,8 +83,11 @@ Knowing the version of the library will help you understand what is available in
7783
| 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) |
7884
| 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) |
7985
| >=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) |
86+
8087
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:
8188

89+
v3.x latest bundle: https://github.com/algolia/algoliasearch-extensions-bundle/blob/ISv4/package.json
90+
8291
The search-insights.js library is standalone.
8392

8493
Refer to these docs when customising your Algolia Magento extension frontend features:

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.14.0",
6+
"version": "3.14.1",
77
"require": {
88
"php": "~8.1|~8.2|~8.3",
99
"magento/framework": "~103.0",

0 commit comments

Comments
 (0)