Skip to content
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

Add missing Experience Platform Connector events to Core Components #949

Merged
merged 44 commits into from
Sep 21, 2022

Conversation

laurentiumagureanu
Copy link
Collaborator

@laurentiumagureanu laurentiumagureanu commented Aug 17, 2022

Description

Add necessary context and data for add to cart storefront event.

For Product Carousel, Product List, Product Teaser:

  • the data layer data of the items is used to provide the storefrontData to the useAddToCartEvent() hook
  • the data layer got extended with a xdm:discountAmount to calculate the regularPrice (before discount)

For Product:

  • for grouped products I added a data-cif-grouped-product-context to the <tr> element of each product in the group.
  • the grouped product context is used to provide the storefrontData to the useAddToCartEvent() hook

For Search:

  • defined a search unit id using the component id from the datalayer
  • defined a search request id as random uuid (I guess this is needed to link a request and response event, at least this is the case for other SRP analytics use cases)
  • sent the search request / response events on initialisation using the existing contexts (after server side rendering)

In general

  • Made the useEventsCollector a Context that can be used to obtain the storefront events sdk and pass it to the hooks/components of the core cif components and product recs
  • the storefront-events clientlib is not needed anymore when using the EventCollectorContext (removed redundancy)

Related Issue

CIF-2898

Motivation and Context

enables Beacon tracking

How Has This Been Tested?

Unit test

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

@laurentiumagureanu laurentiumagureanu requested review from buuhuu, herzog31 and LSantha and removed request for buuhuu August 17, 2022 11:57
@codecov
Copy link

codecov bot commented Aug 17, 2022

Codecov Report

Merging #949 (181aadb) into master (2dd2b2c) will increase coverage by 0.02%.
The diff coverage is 96.50%.

@@             Coverage Diff              @@
##             master     #949      +/-   ##
============================================
+ Coverage     89.46%   89.49%   +0.02%     
- Complexity     2204     2211       +7     
============================================
  Files           351      354       +3     
  Lines          9857     9967     +110     
  Branches       1422     1436      +14     
============================================
+ Hits           8819     8920     +101     
- Misses          742      750       +8     
- Partials        296      297       +1     
Flag Coverage Δ
integration 52.22% <43.75%> (+0.04%) ⬆️
jest 86.68% <100.00%> (+0.13%) ⬆️
karma 95.53% <100.00%> (+0.20%) ⬆️
unittests 88.00% <81.25%> (-0.14%) ⬇️

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

Impacted Files Coverage Δ
...ommerce/core/components/datalayer/ProductData.java 0.00% <0.00%> (ø)
...internal/models/v1/common/ProductListItemImpl.java 95.09% <0.00%> (-0.95%) ⬇️
...erce/core/components/models/product/GroupItem.java 0.00% <0.00%> (ø)
...ts/storefrontcontext/ProductStorefrontContext.java 0.00% <0.00%> (ø)
...torefrontcontext/ProductStorefrontContextImpl.java 90.00% <75.00%> (-10.00%) ⬇️
...ponents/internal/datalayer/DataLayerComponent.java 80.95% <100.00%> (+0.46%) ⬆️
...components/internal/datalayer/ProductDataImpl.java 100.00% <100.00%> (ø)
...ents/internal/models/v1/product/GroupItemImpl.java 100.00% <100.00%> (ø)
...onents/internal/models/v1/product/ProductImpl.java 87.55% <100.00%> (+0.05%) ⬆️
...nal/models/v1/productteaser/ProductTeaserImpl.java 90.66% <100.00%> (+0.12%) ⬆️
... and 18 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@herzog31 herzog31 changed the base branch from master to issue/CIF-2905 August 17, 2022 13:40
@buuhuu buuhuu requested a review from herzog31 September 1, 2022 14:45
@buuhuu buuhuu changed the base branch from issue/CIF-2905 to master September 2, 2022 10:24
@buuhuu buuhuu mentioned this pull request Sep 2, 2022
10 tasks
@LSantha LSantha merged commit 3d4e44d into master Sep 21, 2022
@LSantha LSantha deleted the issue/CIF-2898 branch September 21, 2022 08:51
@LSantha LSantha added the feature New feature or request label Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants