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-160015: M@S: support for mnemonic multifield #3075

Merged
merged 5 commits into from
Oct 30, 2024

Conversation

Copy link
Contributor

aem-code-sync bot commented Oct 22, 2024

Page Scores Audits Google
📱 /drafts/ilyas/merch-card?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /drafts/ilyas/merch-card?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.44%. Comparing base (12dbfff) to head (88a0ba6).
Report is 10 commits behind head on stage.

Additional details and impacted files
@@           Coverage Diff           @@
##            stage    #3075   +/-   ##
=======================================
  Coverage   96.44%   96.44%           
=======================================
  Files         246      246           
  Lines       55988    55989    +1     
=======================================
+ Hits        53999    54001    +2     
+ Misses       1989     1988    -1     

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

@@ -12,29 +12,33 @@ export async function hydrate(fragmentData, merchCard) {
if (!variant) return;
fragment.model = fragment.model;

merchCard.variantLayout?.refs?.forEach((ref) => ref.remove());
// remove all previous slotted content except the default slot
merchCard.querySelectorAll('[slot]').forEach((el) => {
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 handle use-case when card is refreshed?
how about we have a method inside merch-card to do it? We might need to also remove all the previous attributes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since merch-card is intended to be modular, I think keeping this fragment related logic in hydrate.js ok.
Also, for Milo cards, it doesn't really make sense as we don't support refetching the content.

const { aemFragmentMapping } = merchCard.variantLayout;

if (!aemFragmentMapping) return;

const appendFn = (el) => {
merchCard.variantLayout.refs.push(el);
Copy link
Contributor

Choose a reason for hiding this comment

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

actually, what was merchCard.variantLayout.refs? what was merchCard.variantLayout.refs.push(el); needed for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

with merchCard.variantLayout.refs I initially tried to track elements that were added, but it seemed a bit unnecessary and clearing all named slots is easier and safer. (especially when you change card variant in MAS Studio)

Copy link
Contributor

@3ch023 3ch023 Oct 23, 2024

Choose a reason for hiding this comment

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

got it.thx

link: fragment.mnemonicLink[index] ?? '',
}));

fragmentData.computed = { mnemonics };
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we are building merch-card out of fragmentData, but why setting computed? How is it used afterwards?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As we design mnemonic icon, alt text and link as 3 multi fields, these values need to be pre-processed before mapping them to fields in Studio.

Copy link
Contributor

Choose a reason for hiding this comment

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

imo we should have no trace of Studio related logic in Milo, why not doing it in Studio when the edit window is opened?
there is a risk of someone removing it in the future because it looks in milo like it's not used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@3ch023 since MAS changes already have been merged, I raised https://jira.corp.adobe.com/browse/MWPW-160932 to track this.
I propose to address it post PR merge.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure np with that

Copy link
Contributor

@3ch023 3ch023 left a comment

Choose a reason for hiding this comment

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

few questions, overall lgtm

@yesil yesil added the commerce label Oct 23, 2024
Copy link
Contributor

@seanchoi-dev seanchoi-dev left a comment

Choose a reason for hiding this comment

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

Looks good for me

@Roycethan
Copy link

Roycethan commented Oct 23, 2024

@yesil The authored target mnemonic link is not getting opened up from studio - 3rd AC - Can you plz check ?
https://main--mas--adobecom.hlx.live/studio.html?milolibs=mwpw-160015-final--milo--yesil
Marked comment in https://jira.corp.adobe.com/browse/MWPW-160015
Meanwhile marking as Ready for stage, since covered regressions on Milo.

@Roycethan Roycethan added verified PR has been E2E tested by a reviewer Ready for Stage labels Oct 23, 2024
@yesil
Copy link
Contributor Author

yesil commented Oct 23, 2024

@Roycethan yes it is by design. It is to prevent Studio users from leaving after unintended link clicks.

@milo-pr-merge
Copy link
Contributor

milo-pr-merge bot commented Oct 28, 2024

Skipped 3075: "MWPW-160015: M@S: support for mnemonic multifield" due to file "libs/deps/mas/mas.js" overlap. Merging will be attempted in the next batch

@milo-pr-merge milo-pr-merge bot merged commit fa39a05 into adobecom:stage Oct 30, 2024
14 checks passed
@milo-pr-merge milo-pr-merge bot mentioned this pull request Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commerce Ready for Stage verified PR has been E2E tested by a reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants