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

Experience Fragment enhancement to allow remote offer from Adobe Target #1424

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

epsilon-asutosh
Copy link

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Minor: New Feature?
Major: Breaking Change?
Tests Added + Pass? Yes
Documentation Provided Yes (code comments and or markdown)
Any Dependency Changes?
License Apache License, Version 2.0

@codecov
Copy link

codecov bot commented Mar 3, 2021

Codecov Report

Merging #1424 (f9e0048) into main (8400645) will decrease coverage by 0.89%.
The diff coverage is n/a.

❗ Current head f9e0048 differs from pull request most recent head 0cb3061. Consider uploading reports for the commit 0cb3061 to get more accurate results

@@             Coverage Diff              @@
##               main    #1424      +/-   ##
============================================
- Coverage     86.98%   86.08%   -0.90%     
+ Complexity     2475     1939     -536     
============================================
  Files           217      181      -36     
  Lines          6623     5355    -1268     
  Branches       1011      814     -197     
============================================
- Hits           5761     4610    -1151     
+ Misses          342      299      -43     
+ Partials        520      446      -74     
Impacted Files Coverage Δ
...omponents/internal/models/v1/RedirectItemImpl.java 77.77% <0.00%> (-15.08%) ⬇️
...core/components/internal/models/v1/ButtonImpl.java 86.66% <0.00%> (-13.34%) ⬇️
...nts/internal/models/v1/ExperienceFragmentImpl.java 87.34% <0.00%> (-12.66%) ⬇️
...omponents/internal/models/v2/HtmlPageItemImpl.java 80.48% <0.00%> (-10.43%) ⬇️
...s/internal/services/CaConfigReferenceProvider.java 72.22% <0.00%> (-9.26%) ⬇️
...nents/internal/models/v1/AbstractListItemImpl.java 93.33% <0.00%> (-6.67%) ⬇️
...components/internal/servlets/ContainerServlet.java 68.75% <0.00%> (-4.59%) ⬇️
.../core/components/internal/models/v2/ImageImpl.java 79.68% <0.00%> (-3.77%) ⬇️
...cq/wcm/core/components/models/LayoutContainer.java 75.00% <0.00%> (-3.58%) ⬇️
...ents/internal/services/embed/OEmbedClientImpl.java 61.64% <0.00%> (-2.92%) ⬇️
... and 135 more

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

<sly data-sly-call="${template.placeholder @ isEmpty=!fragment.configured, classAppend='cmp-dd-experiencefragment'}"></sly>

<script data-sly-test="${properties.enableRemoteOffer && properties.id}" data-sly-set.mboxId="${properties.id}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if we moved the script to a clientlib instead of inlining it. It could activate on page load and process all elements that have a certain data attribute (for example: data-enable-remote-offer).

Also, shouldn't the mboxId leverage component.id instead o properties.id. It's a subtle difference but sometime they could be different.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladbailescu I have moved the inline scripts into clientlib and added the data-attibutes.

Explicetely we are reading the mboxId from properties.id because that field is optional and if someone does not want to use the experience targeting offer, they will not configure the field in which case the backend sling model will generate a random id and which we do not want to use for target. So if any customer wants to use the target offer they will need to provide an id explicitly and the same will be used by both component.id and properties.id


<script data-sly-test="${properties.enableRemoteOffer && properties.id}" data-sly-set.mboxId="${properties.id}">
adobe.target.getOffer({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make sure the global adobe.target is available before calling getOffer.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladbailescu added the check to make sure adobe.target is available before it's called.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Mar 21, 2021

This pull request introduces 1 alert when merging f1d7183 into b192bdc - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@sonarcloud
Copy link

sonarcloud bot commented Mar 21, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@epsilon-asutosh
Copy link
Author

@vladbailescu Can you please review and let me know if all looks good?

@epsilon-asutosh epsilon-asutosh marked this pull request as draft April 15, 2021 16:33
@epsilon-asutosh epsilon-asutosh marked this pull request as ready for review April 15, 2021 16:33
@epsilon-asutosh
Copy link
Author

@vladbailescu Can you please review and let me know if all looks good?

@epsilon-asutosh
Copy link
Author

@richardhand @bpauli @jckautzmann
Can you please review this and let me know if all looks good?

@epsilon-asutosh
Copy link
Author

epsilon-asutosh commented Aug 20, 2021

@vladbailescu @richardhand @bpauli @jckautzmann
Can you please review this and let me know if all looks good?

@sonarcloud
Copy link

sonarcloud bot commented Sep 1, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants