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

MWPW-135160: Mnemonics inside merch card #2024

Merged
merged 8 commits into from
Apr 30, 2024

Conversation

Axelcureno
Copy link
Member

@Axelcureno Axelcureno commented Mar 16, 2024

  • Adds ability to display inline mnemonic list block inside merch card.
  • Simplifies Mnemonic list code.

Screenshot 2024-03-15 at 7 44 42 PM

Resolves: MWPW-135160

Test URLs:

@Axelcureno Axelcureno added run-nala Run Nala Test Automation against PR commerce needs-verification PR requires E2E testing by a reviewer merch card labels Mar 16, 2024
@Axelcureno Axelcureno self-assigned this Mar 16, 2024
Copy link
Contributor

aem-code-sync bot commented Mar 16, 2024

Page Scores Audits Google
/drafts/axel/mwpw-135160?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@Axelcureno Axelcureno marked this pull request as draft March 16, 2024 03:07
@Axelcureno Axelcureno marked this pull request as ready for review March 22, 2024 16:36
const mnemonicList = el.querySelector('.mnemonic-list');
if (mnemonicList) {
bodySlot.append(mnemonicList);
await decorateMnemonicList(bodySlot);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder whether bodySlot already has some content here. If so, we should limit the scope of decoration to mnemonicList.

suggestion:

await decorateMnemonicList(mnemonicList);
bodySlot.append(mnemonicList);

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated. Mnemonics need to be inserted after paragraph content, so first decoration happens then insertion into body slot. LMK if this looks okay, otherwise I can make the foreach async and do all at once.

];
const parseContent = async (el, merchCard) => {
const allElements = el.querySelectorAll('h2, h3, h4, h5, p, ul, em');
const innerElements = Array.from(allElements).filter((element) => !element.closest('.mnemonic-list'));
Copy link
Contributor

Choose a reason for hiding this comment

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

this is getting complicated.
Let's first process mnemonic, then you would not need to change this part.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

Copy link
Contributor

This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried.

@@ -3,7 +3,8 @@
*/

import { decorateButtons, getBlockSize, decorateBlockBg } from '../../utils/decorate.js';
import { createTag, getConfig, loadStyle } from '../../utils/utils.js';
import { createTag } from '../../utils/utils.js';
import { decorateMnemonicList } from '../mnemonic-list/mnemonic-list.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

if mnemonic-list is not needed for all marquees on adobe.com, it should be imported dynamically.

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed. It is now dynamically imported.

@@ -64,20 +65,6 @@ const decorateImage = (media) => {
}
};

export async function loadMnemonicList(foreground) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why remove ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Reverted

@@ -3,12 +3,15 @@ import { getConfig, createTag } from '../../utils/utils.js';
import { getMetadata } from '../section-metadata/section-metadata.js';
import { processTrackingLabels } from '../../martech/attributes.js';
import { replaceKey } from '../../features/placeholders.js';
import { decorateMnemonicList } from '../mnemonic-list/mnemonic-list.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

decorateMnemonicList is not needed for majority of the cards, hence should be loaded dynamically and conditionally.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, now dynamically imported.

@Axelcureno Axelcureno requested a review from yesil April 4, 2024 05:49
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 56.25000% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 96.39%. Comparing base (fa5f12a) to head (8e5045f).
Report is 140 commits behind head on stage.

❗ Current head 8e5045f differs from pull request most recent head 678dcdc. Consider uploading reports for the commit 678dcdc to get more accurate results

Files Patch % Lines
libs/blocks/merch-card/merch-card.js 53.33% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            stage    #2024      +/-   ##
==========================================
+ Coverage   96.36%   96.39%   +0.02%     
==========================================
  Files         166      166              
  Lines       42531    43486     +955     
==========================================
+ Hits        40986    41918     +932     
- Misses       1545     1568      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Axelcureno
Copy link
Member Author

@Roycethan this is ready for verification. Thanks.

Copy link
Contributor

This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried. If a test absolutely can not pass for a good reason, please add a comment with an explanation to the PR.

@@ -78,6 +78,7 @@ export async function loadMnemonicList(foreground) {
}
}


Copy link
Contributor

Choose a reason for hiding this comment

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

@Axelcureno can you fix this eslint issue. Looks like this file shouldn't even be in the change list?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

Copy link

@Roycethan Roycethan left a comment

Choose a reason for hiding this comment

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

@Axelcureno
Copy link
Member Author

I didn't push any changes and I see it displaying properly in tablet. Probably got fixed in a different PR. Please check @Roycethan

Screenshot 2024-04-29 at 2 35 19 PM
Screenshot 2024-04-29 at 2 36 34 PM
Screenshot 2024-04-29 at 2 36 22 PM
Screenshot 2024-04-29 at 2 36 44 PM

Copy link

@Roycethan Roycethan left a comment

Choose a reason for hiding this comment

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

@Axelcureno So the example where i can repro this is on 3 col width card as mentioned earlier:
https://main--cc--adobecom.hlx.page/drafts/axel/defects/mwpw-135160?milolibs=MWPW-135160--milo--axelcureno#

@Axelcureno
Copy link
Member Author

@Axelcureno So the example where i can repro this is on 3 col width card as mentioned earlier: https://main--cc--adobecom.hlx.page/drafts/axel/defects/mwpw-135160?milolibs=MWPW-135160--milo--axelcureno#

@Roycethan thanks, I was able to reproduce this time. I have pushed the fix, please check once more.

@Roycethan Roycethan self-requested a review April 30, 2024 01:46
Copy link

@Roycethan Roycethan left a comment

Choose a reason for hiding this comment

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

Thanks @Axelcureno Fixed now

@Roycethan Roycethan added verified PR has been E2E tested by a reviewer and removed needs-verification PR requires E2E testing by a reviewer labels Apr 30, 2024
@Blainegunn Blainegunn merged commit 3b3149a into adobecom:stage Apr 30, 2024
10 checks passed
yesil added a commit to yesil/milo that referenced this pull request May 21, 2024
* MWPW-135160: Mnemonics inside merch card

* Update merch-card.js

---------

Co-authored-by: Blaine Gunn <Blainegunn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commerce merch card Ready for Stage run-nala Run Nala Test Automation against PR verified PR has been E2E tested by a reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants