milo icon indicating copy to clipboard operation
milo copied to clipboard

MWPW-159257 refactor mas enablement

Open npeltier opened this issue 1 year ago • 4 comments

  • move of wcms-commerce -> mas-commerce-service
  • move of some public functions to mas-commerce-service,
  • remove mas.js code for initialization, everything needs to go through the component,
  • split of settings code with locale settings, make milo locale settings an explicit function,
  • unit tests,
  • updates of docs, especially mas.js.html with that component

Resolves: MWPW-159257

Test URLs:

  • Before: https://main--milo--adobecom.hlx.page/libs/features/mas/docs/mas.js.html
  • After: https://MWPW-159257--milo--npeltier.hlx.page/libs/features/mas/docs/mas.js.html

npeltier avatar Oct 04 '24 09:10 npeltier

Page Scores Audits Google
:iphone: /libs/features/mas/docs/mas.js.html PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
:desktop_computer: /libs/features/mas/docs/mas.js.html PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

aem-code-sync[bot] avatar Oct 04 '24 09:10 aem-code-sync[bot]

Codecov Report

Attention: Patch coverage is 99.91817% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.42%. Comparing base (332c3a5) to head (d0c0d92). Report is 5 commits behind head on stage.

Files with missing lines Patch % Lines
libs/features/mas/commerce/src/inline-price.js 99.24% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##            stage    #3012      +/-   ##
==========================================
+ Coverage   96.40%   96.42%   +0.01%     
==========================================
  Files         243      245       +2     
  Lines       55415    55648     +233     
==========================================
+ Hits        53425    53659     +234     
+ Misses       1990     1989       -1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 04 '24 09:10 codecov[bot]

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.

github-actions[bot] avatar Oct 05 '24 01:10 github-actions[bot]

@npeltier can you also rename events from wcms:placeholder:* to mas:* ?

yesil avatar Oct 07 '24 08:10 yesil

@npeltier Your changes are breaking commerce in UK locale (the prices have promo code).

With your changes, the old price is rendered only as a regular price, and optical price has a different value

  • https://mwpw-159257--milo--npeltier.hlx.live/uk/drafts/nala/features/commerce/promo-placeholders Screenshot 2024-10-15 at 12 01 54

It should be:

  • https://main--milo--adobecom.hlx.live/uk/drafts/nala/features/commerce/promo-placeholders Screenshot 2024-10-15 at 12 03 10

afmicka avatar Oct 15 '24 10:10 afmicka

@npeltier Your changes are breaking commerce in UK locale (the prices have promo code).

With your changes, the old price is rendered only as a regular price, and optical price has a different value

* https://mwpw-159257--milo--npeltier.hlx.live/uk/drafts/nala/features/commerce/promo-placeholders
Screenshot 2024-10-15 at 12 01 54

It should be:

* https://main--milo--adobecom.hlx.live/uk/drafts/nala/features/commerce/promo-placeholders
Screenshot 2024-10-15 at 12 03 10

thanks, @afmicka, requests are the same, only difference is my PR does the request on stage for a reason i need to understand :)

npeltier avatar Oct 15 '24 11:10 npeltier

@yesil @3ch023 (cc @afmicka ) so basically milo's getConfig() on Mili's page returns

env = {
  name: 'stage', 
  ims: 'stg1', 
  adobeIO: 'cc-collab-stage.adobe.io', 
  adminconsole: 'stage.adminconsole.adobe.com', 
  account: 'stage.account.adobe.com', 
  …
}

i guess here env.name=stage is bound to IMS, not commerce. we agree the only way to put commerce stage should be commerce.env, right?

npeltier avatar Oct 15 '24 12:10 npeltier

we agree the only way to put commerce stage should be commerce.env, right?

right. ?commerce.env=stage should result in https://www.stage.adobe.com/web_commerce_artifact_stage ?env=stage should result in https://www.adobe.com/web_commerce_artifact

3ch023 avatar Oct 15 '24 12:10 3ch023

ok @3ch023 for commerce.env, but env=stage, here it's IMS, not commerce. Typically if you look at https://main--milo--adobecom.hlx.live/uk/drafts/nala/features/commerce/promo-placeholders env=stage but it's just prod & prod uri

npeltier avatar Oct 15 '24 12:10 npeltier

ok @3ch023 for commerce.env, but env=stage, here it's IMS, not commerce. Typically if you look at https://main--milo--adobecom.hlx.live/uk/drafts/nala/features/commerce/promo-placeholders env=stage but it's just prod & prod uri

yes, I had a typo, sorry. confirming once again ?env=stage has no effect on Commerce. It should go to prod + prod uri. ?env=stage should result in https://www.adobe.com/web_commerce_artifact

3ch023 avatar Oct 15 '24 12:10 3ch023

@yesil wrt to checkout & inline price, i find it confusing to have file names not corresponding to the classes, nor the "is". That's why i just kept those two names, and reused them all over (before you had the registered class & the placeholder element with two different names which i found really confusing, now you have that class + MasElement sub item) i'm fine renaming as you wish though, i'm passed the will to do any discussion :)

npeltier avatar Oct 15 '24 16:10 npeltier

@npeltier for instance checkout link element inherits from the native HTMLAnchorElement. I find AnchorElement is a good suffix what all custom elements inheriting from it should be using. That way, when you look at the stack trace, not only you know it is CheckoutLinkAnchorElement, but also you know it is a custom element that is a link that renders content. Since we already have npm modules(hopefully we can combine commerce & web-components) and folders to organise files, I think giving long file names is not necessary.

yesil avatar Oct 16 '24 06:10 yesil

@npeltier

  1. commerce.env=stage is making requests to www.adobe.com instead of www.stage.adobe.com https://mwpw-159257--milo--npeltier.hlx.page/drafts/nala/features/commerce/promo-placeholders?commerce.env=stage
Screenshot 2024-10-18 at 12 40 42
  1. commerce.landscape does not work (has effect) on your branch, https://mwpw-159257--milo--npeltier.hlx.page/drafts/nala/features/commerce/promo-placeholders?commerce.landscape=draft
Screenshot 2024-10-18 at 12 46 36

on main branch: https://main--milo--adobecom.hlx.page/drafts/nala/features/commerce/promo-placeholders?commerce.landscape=draft Screenshot 2024-10-18 at 12 47 43

the rest of the regression looks OK but after fixing this, it needs another round. @Roycethan could you follow-up after the fix? I will be away starting this afternoon until Thursday morning.

afmicka avatar Oct 18 '24 10:10 afmicka

Regressions covered for this branch - Once above mentioned issues get fixed let me know @npeltier @3ch023 @yesil

Roycethan avatar Oct 18 '24 23:10 Roycethan

Reported issues fixed and - regressions covered

Roycethan avatar Oct 21 '24 18:10 Roycethan