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-159257 refactor mas enablement #3012

Merged
merged 76 commits into from
Oct 22, 2024
Merged

Conversation

npeltier
Copy link
Contributor

@npeltier npeltier commented Oct 4, 2024

  • 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:

@npeltier npeltier requested a review from a team as a code owner October 4, 2024 09:21
@npeltier npeltier requested review from yesil and removed request for a team October 4, 2024 09:21
@yesil
Copy link
Contributor

yesil commented Oct 16, 2024

@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.

@@ -3,7 +3,7 @@ import {
} from '../../utils/utils.js';
import { replaceKey } from '../../features/placeholders.js';

export const CHECKOUT_LINK_CONFIG_PATH = '/commerce/checkout-link.json'; // relative to libs.
export const CHECKOUT_LINK_CONFIG_PATH = '/commerce/checkout-link-anchor-element.json'; // relative to libs.
Copy link
Contributor

Choose a reason for hiding this comment

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

@npeltier this is an excel file, I don't think we should rename it, especially now.

});
//commerce parameters
['checkoutWorkflowStep', 'forceTaxExclusive', 'checkoutClientId'].forEach((attribute) => {
const value = this.getAttribute(attribute);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should adopt html friendly attribute names: checkout-workflow-step, force-tax-exclusive checkout-client-id

Copy link
Contributor

Choose a reason for hiding this comment

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

might be a unintentional commit, let's remove this.

@@ -25,6 +24,8 @@ styles.innerHTML = `
--consonant-merch-card-cta-font-size: 15px;

/* headings */
--merch-card-heading-xxs-font-size: 16px;
Copy link
Contributor

Choose a reason for hiding this comment

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

these changes that are supposed to be shipped as part of @Axelcureno's PRs, if shipped earlier, might cause regression.
I recommend to met his PRs first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the other way around i would say

Copy link
Contributor

Choose a reason for hiding this comment

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

rename to mas-commerce-service-element ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i would rather not, a web component is an element, we know it

@3ch023 3ch023 added the high priority Why is this a high priority? Blocker? Critical? Dependency? label Oct 17, 2024
cis_ru: 'AZ_ru',
sea: 'SG_en',
th_en: 'TH_en',
th_th: 'TH_th',
Copy link
Contributor

Choose a reason for hiding this comment

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

I see there are missing locales here, is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the locales we are living with at the moment, i just moved them to a different place. Do you have an example?

document.head.append(service);
await service.readyPromise;
service.imsSignedInPromise?.then((isSignedIn) => {
if (isSignedIn) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (isSignedIn) {
if (isSignedIn) fetchEntitlements();

also, we might not need to wrap the outside function

'MY_ms',
'NZ_en',
'TH_en',
'TH_th',
Copy link
Contributor

Choose a reason for hiding this comment

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

Locales missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are locales where tax is displayed for all segments by default, not all of them

@afmicka
Copy link
Contributor

afmicka commented Oct 18, 2024

@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.

@Roycethan
Copy link

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

yesil added 4 commits October 21, 2024 14:42
Milo only consumes WCS prod.
However with this PR, on local and stage environments, `allow-override`
parameter will be added to `mas-commerce-service` allowing to override
the commerce env/landscape via query parameters.
@Roycethan
Copy link

Reported issues fixed and - regressions covered

@Roycethan Roycethan added verified PR has been E2E tested by a reviewer Ready for Stage labels Oct 21, 2024
@milo-pr-merge milo-pr-merge bot merged commit 9bd25e6 into adobecom:stage Oct 22, 2024
22 checks passed
@milo-pr-merge milo-pr-merge bot mentioned this pull request Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commerce high priority Why is this a high priority? Blocker? Critical? Dependency? 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.

7 participants