adobe / aem-core-cif-components

A set of configurations and components to get you started with AEM Commerce development
Apache License 2.0
103 stars 80 forks source link

CIF-2738: support client side price loading in product teaser and carousel #926

Closed buuhuu closed 2 years ago

buuhuu commented 2 years ago

Description

To support clientside price loading for product teasers and product carousels a new data-product-base-sku attribute was added to the product teaser and each item of the product carousel. This was necessary as both components can be configured with variants but querying the prices of those requires the base product' sku. To provide this attribute the ProductTeaser interface and ProductListItem interface (used by the product carousel) have a new getCombinedSku() method that returns the sku as object containing the base sku and variant sku.

Both components were also extended to query the maximum price range for bundled products to have a consistent result of serverside and client side price rendering.

Prices are loaded for all teasers and all carousels on a single page at once.

This change also changes the approach to enable client-side price loading site-wide using the CIF Cloud Configuration. There were no changes made to the policy properties of the product teaser and product carousel. The "Load prices" property of product v3 was removed. The per-component policy configuration for product v1 and v2 and the for the product list and search results remains working as before but the respective java API got deprecated.

Additional changes:

Related Issue

https://github.com/adobe/aem-cif-guides-venia/pull/296

Motivation and Context

How Has This Been Tested?

Unit tests and locally

Screenshots (if appropriate):

Types of changes

Checklist:

codecov[bot] commented 2 years ago

Codecov Report

Merging #926 (af4b151) into master (29e57c8) will decrease coverage by 0.04%. The diff coverage is 93.64%.

@@             Coverage Diff              @@
##             master     #926      +/-   ##
============================================
- Coverage     89.71%   89.66%   -0.05%     
- Complexity     2125     2134       +9     
============================================
  Files           343      346       +3     
  Lines          9517     9569      +52     
  Branches       1378     1377       -1     
============================================
+ Hits           8538     8580      +42     
- Misses          699      710      +11     
+ Partials        280      279       -1     
Flag Coverage Δ
integration 52.45% <61.11%> (+0.10%) :arrow_up:
jest 86.49% <ø> (ø)
karma 95.25% <95.50%> (-0.41%) :arrow_down:
unittests 88.75% <83.33%> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rce/core/components/models/common/CombinedSku.java 75.00% <0.00%> (-25.00%) :arrow_down:
...core/components/models/common/ProductListItem.java 0.00% <0.00%> (ø)
...mmerce/core/components/models/product/Product.java 92.85% <ø> (ø)
...onents/models/productcarousel/ProductCarousel.java 0.00% <ø> (ø)
...ts/models/productcollection/ProductCollection.java 0.00% <ø> (ø)
...components/models/productteaser/ProductTeaser.java 50.00% <ø> (ø)
...models/v1/relatedproducts/RelatedProductsImpl.java 79.16% <50.00%> (+1.61%) :arrow_up:
...odels/storeconfigexporter/StoreConfigExporter.java 50.00% <50.00%> (ø)
...oductcollection/clientlibs/js/productcollection.js 87.93% <80.00%> (-4.30%) :arrow_down:
...oductcollection/clientlibs/js/productcollection.js 89.70% <85.71%> (-4.05%) :arrow_down:
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 29e57c8...af4b151. Read the comment docs.