Skip to content

MAGE-1228 Rebase 3.16 with 3.15 pre-release updates #1713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7c13a42
MAGE-1228 Fix unit test for 3.15.0 release
cammonro Mar 5, 2025
61a91c6
Merge pull request #1703 from algolia/fix/MAGE-1228-fix-unit-test
damcou Mar 6, 2025
a649418
Reset customer group collection after filtering
damcou Mar 6, 2025
5ffad34
Merge pull request #1704 from algolia/fix/MAGE-1217-excluded-websites
damcou Mar 6, 2025
6a653f6
MAGE-1228: update extension for 3.15.0 release
damcou Mar 6, 2025
4e3acc2
MAGE-1228: remove old beta changelogs
damcou Mar 10, 2025
34c7316
Merge pull request #1707 from algolia/feat/MAGE-1228-3.15.0-release
damcou Mar 10, 2025
8576d44
MAGE-1228 Add proxies to constructor to defer store ops
cammonro Mar 18, 2025
c0ae4e0
Merge pull request #1711 from algolia/fix/MAGE-1228-ce-install
cammonro Mar 24, 2025
14962f5
MAGE-1245 Add deprecation messages
cammonro Mar 20, 2025
5aaa929
MAGE-1245 Remove sourceMappingURLs (not ignored)
cammonro Mar 21, 2025
64e1d1b
MAGE-1245 Modify plugin to trigger via getVaryString method
cammonro Mar 24, 2025
7333144
MAGE-1245 Add integration test for caching with plugin spy
cammonro Mar 26, 2025
42d5e70
MAGE-1245 Add cache tag assertion
cammonro Mar 26, 2025
169ae34
MAGE-1245 Refactor plugin
cammonro Mar 26, 2025
e74742c
MAGE-1245 Add logic to check for empty controller on page HIT with no…
cammonro Mar 26, 2025
0a766d3
MAGE-1245 Restore getData implementation with improved data consisten…
cammonro Mar 26, 2025
2adb8ce
MAGE-1245 Add unit tests
cammonro Mar 26, 2025
9df76ff
MAGE-1245 Fix raw route eval bug
cammonro Mar 26, 2025
eb0c43c
MAGE-1245 Correct magentoConfigFixtures
cammonro Mar 26, 2025
fe5a92a
MAGE-1245 Add indexing for backend render content evaluation
cammonro Mar 27, 2025
4ad6144
MAGE-1245 Test backend render on and off
cammonro Mar 27, 2025
7277fe3
MAGE-1245 Add allowed user agent testing
cammonro Mar 27, 2025
aebe90e
MAGE-1245 Add custom dispatch method to pass URI for cache ID gen
cammonro Mar 27, 2025
afebfa9
MAGE-1245 Selectively refresh cache for miss method tests
cammonro Mar 27, 2025
26275c7
MAGE-1245 Test hit on backend render with user agent
cammonro Mar 27, 2025
4963f2a
MAGE-1245 Add testing of static block categories
cammonro Mar 27, 2025
bd8fa8c
MAGE-1245 Refactor integration test
cammonro Mar 27, 2025
94fc086
MAGE-1245 Separate frontend integration tests
cammonro Mar 27, 2025
875e089
MAGE-1245 Separate indexing integration tests
cammonro Mar 27, 2025
001adf5
MAGE-1245 Relocate config and base test case classes
cammonro Mar 27, 2025
48a3aca
MAGE-1245 Organize unit tests
cammonro Mar 27, 2025
9af321c
Merge pull request #1712 from algolia/fix/MAGE-1245-fix-category-fpc
cammonro Mar 27, 2025
db7700b
MAGE-1228 Update 3.16 with latest changes to 3.15 pre-release
cammonro Mar 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 7 additions & 40 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# CHANGE LOG

## 3.15.0-beta.2
## 3.15.0

### Features
- Added support for Multi-Application IDs (see [preview documentation](https://deploy-preview-9703--algolia-docs.netlify.app/doc/integration/magento-2/getting-started/quick-start/#support-for-multiple-application-ids))
- Refactored frontend library to no longer utilize the legacy `algoliaBundle` (see [preview documentation](https://deploy-preview-9703--algolia-docs.netlify.app/doc/integration/magento-2/customize/custom-front-end-events/?client=php#frontend-javascript-libraries-and-the-legacy-bundle))
- Added support for Multi-Application IDs (see [documentation](https://www.algolia.com/doc/integration/magento-2/getting-started/quick-start/#support-for-multiple-application-ids))
- Refactored frontend library to no longer utilize the legacy `algoliaBundle` (see [documentation](https://www.algolia.com/doc/integration/magento-2/customize/custom-front-end-events/?client=php#frontend-javascript-libraries-and-the-legacy-bundle))
- Added support for core Algolia UI library overrides via RequireJS
- Added support for mixins through RequireJS in addition to [front end custom events](https://www.algolia.com/doc/integration/magento-2/customize/custom-front-end-events)
- See our `CustomAlgolia` demo extension's [1.4.0 release](https://github.com/algolia/algoliasearch-custom-algolia-magento-2/releases/tag/1.4.0) for examples on how to take advantage of these changes
- Added granular profiling through the [Magento Profiler](https://experienceleague.adobe.com/en/docs/commerce-operations/configuration-guide/setup/mage-profiler) to aid in troubleshooting indexing performance issues
- Added a feature to enable automatic price indexing within the Advanced section of the configuration (This feature should help alleviate issues where missing pricing records prevent Algolia from being able to index products. See [preview documentation](https://deploy-preview-9703--algolia-docs.netlify.app/doc/integration/magento-2/troubleshooting/data-indexes-queues/#price-index-dependencies) for further details.)
- Added a feature to enable automatic price indexing within the Advanced section of the configuration (This feature should help alleviate issues where missing pricing records prevent Algolia from being able to index products. See [documentation](https://www.algolia.com/doc/integration/magento-2/troubleshooting/data-indexes-queues/#price-index-dependencies) for further details.)

### Updates
- Tests: Added possibility to run tests with multiple applications IDs.
Expand All @@ -22,17 +22,17 @@
- Debugging information now writes to `algolia.log`
- Removed dependency on `algoliaBundle` package
- Removed dependency on JavaScript global `window` objects with the exception of `algoliaConfig`
- The Hogan.js library is still packaged for injection as needed but be advised that Mustache.js is now used internally instead (see [preview documentation](https://deploy-preview-9703--algolia-docs.netlify.app/doc/integration/magento-2/customize/instant-search-page/?client=php#mustache-templates))
- The Hogan.js library is still packaged for injection as needed but be advised that Mustache.js is now used internally instead (see [documentation](https://www.algolia.com/doc/integration/magento-2/customize/instant-search-page/?client=php#mustache-templates))
- JavaScript bundling is supported but to use the RequireJS Optimizer transpiling will be needed for ES6 constructs

### Bug Fixes
- Fixed a bug where admin menus didn't display properly on Magento 2.4.7
- Fixed customer groups prices ranges on configurable products
- Fixed a bug where categories highlighting didn't work as expected on PLP powered by InstantSearch
- Fixed a bug where excluded websites weren't taken into account while indexing customer prices on products. (thanks @kamilszewczyk)

### Breaking Changes
- If you have customized your front end implementation based on the `algoliaBundle` you may need to shim your application accordingly (Full details are shared in [our preview documentation](https://deploy-preview-9703--algolia-docs.netlify.app/doc/integration/magento-2/troubleshooting/front-end-issues/))

- If you have customized your front end implementation based on the `algoliaBundle` you may need to shim your application accordingly (Full details are shared in [our documentation](https://www.algolia.com/doc/integration/magento-2/troubleshooting/front-end-issues/))


## 3.14.4
Expand Down Expand Up @@ -128,25 +128,6 @@ If you have customized your Algolia implementation or are running on an older ve
- Dropped support for Magento 2.3
- PHP 8.1+ required

## 3.14.0-beta.2

### Updates

- Introduced new admin groups to InstantSearch for improved UX
- Updated `ConfigHelper` to use new paths
- Added data patch to migrate old configurations
- Bugfix for query rule disable on facets with new admin groupings
- Added new sorting admin option via source model
- Added derived virtual replica enablement to `ConfigHelper` based on `ArraySerialized`
- Intro’d simplified data structures to avoid array diff mismatches
- Intro’d new `ReplicaManager` abstraction to map Magento sorting to Algolia replica configuration
- Removed dependencies in backend models to handle replica config updates in Algolia addressing stale data
- Added `ReplicaState` registry for tracking changes to sorting configuration to minimize number of replica build operations
- Added logic to preserve replicas created outside of Magento such as Merchandising Studio "sorting strategies"
- Introduced PHP 8 constructor property promotion on affected classes
- Added stronger typing to affected classes and methods
- Added Looking Similar recommendations

## 3.13.8

### Bug Fixes
Expand Down Expand Up @@ -188,20 +169,6 @@ If you have customized your Algolia implementation or are running on an older ve
- Fixed lock timeout issue on indexing queue integration test
- Community fix added - job queue dropping jobs from sandwiched full reindexes - thank you @pikulsky

## 3.14.0-beta.1

### Updates:

- New PHP API client (v4) under the hood for communicating with Algolia
- Authenticated user tokens now utilized for backend and frontend events to track entire customer journey
- Revenue data now sent with all events including application of Magento specific discounts such as catalog price rules and customer group pricing
- Support for event subtypes allowing the capture of conversion data for both "Add to cart" and "Place order" events
- Increased protection of PII in the event data

### Bug fixes:
- Fixed issue with how Algolia extension handles end user consent for allowing cookies
- Improved handling of user tokens across insights events and corresponding queries

## 3.13.3

### Updates
Expand Down
1 change: 1 addition & 0 deletions Helper/ConfigHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ public function getExtraSettings($section, $storeId = null)
/**
* @param $storeId
* @return bool
* @deprecated This feature is deprecated and will be replaced in an upcoming version
*/
public function preventBackendRendering($storeId = null)
{
Expand Down
91 changes: 69 additions & 22 deletions Plugin/RenderingCacheContextPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
use Magento\Framework\App\Http\Context as HttpContext;
use Magento\Framework\App\Request\Http;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;
use Magento\UrlRewrite\Model\UrlFinderInterface;

/**
* The purpose of this class is to render different cached versions of the pages according to the user agent.
Expand All @@ -15,39 +17,36 @@
*/
class RenderingCacheContextPlugin
{
public const RENDERING_CONTEXT = 'rendering_context';
public const RENDERING_CONTEXT = 'algolia_rendering_context';
public const RENDERING_WITH_BACKEND = 'with_backend';
public const RENDERING_WITHOUT_BACKEND = 'without_backend';

private $configHelper;
private $storeManager;
private $request;
public const CATEGORY_CONTROLLER = 'category';
public const CATEGORY_ROUTE = 'catalog/category/view';

public function __construct(
ConfigHelper $configHelper,
StoreManagerInterface $storeManager,
Http $request
) {
$this->configHelper = $configHelper;
$this->storeManager = $storeManager;
$this->request = $request;
}
protected ConfigHelper $configHelper,
protected StoreManagerInterface $storeManager,
protected Http $request,
protected UrlFinderInterface $urlFinder
) { }

/**
* Add Rendering context for caching purposes
* (If the prevent rendering configuration is enabled and the user agent has no white card to display it,
* Add a rendering context to the vary string data to distinguish which versions of the category PLP should be cached
* (If the "prevent backend rendering" configuration is enabled and the user agent is not whitelisted to display it,
* we set a different page variation, and the FPC stores a different cached page)
*
* @param HttpContext $subject
* @param string[] $data
* IMPORTANT:
* Magento\Framework\App\Http\Context::getData can be called multiple times over the course of the request lifecycle
* it is important that this plugin return the data consistently - or the cache will be invalidated unexpectedly!
*
* @return array
* @param HttpContext $subject
* @param array $data
* @return array original params
* @throws NoSuchEntityException
*/
public function afterGetData(HttpContext $subject, $data)
{
$storeId = $this->storeManager->getStore()->getId();
if (!($this->request->getControllerName() === 'category'
&& $this->configHelper->replaceCategories($storeId) === true)) {
public function afterGetData(HttpContext $subject, array $data): array {
if (!$this->shouldApplyCacheContext()) {
return $data;
}

Expand All @@ -59,4 +58,52 @@ public function afterGetData(HttpContext $subject, $data)

return $data;
}

/**
* @param int $storeId
* @return string
*/
protected function getOriginalRoute(int $storeId): string
{
$requestUri = $this->request->getRequestUri();

$rewrite = $this->urlFinder->findOneByData([
'request_path' => ltrim($requestUri, '/'),
'store_id' => $storeId,
]);

return $rewrite?->getTargetPath() ?? "";
}

/**
* @param string $path
* @return bool
*/
protected function isCategoryRoute(string $path): bool {
$path = ltrim($path, '/');
return str_starts_with($path, self::CATEGORY_ROUTE);
}

/**
* This can be called in a variety of contexts - so this should always be called consistently
*
* @param int $storeId
* @return bool
*/
protected function isCategoryPage(int $storeId): bool
{
return $this->request->getControllerName() === self::CATEGORY_CONTROLLER
|| $this->isCategoryRoute($this->request->getRequestUri())
|| $this->isCategoryRoute($this->getOriginalRoute($storeId));
}

/**
* @return bool
* @throws NoSuchEntityException
*/
protected function shouldApplyCacheContext(): bool
{
$storeId = $this->storeManager->getStore()->getId();
return $this->isCategoryPage($storeId) && $this->configHelper->replaceCategories($storeId);
}
}
Loading