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-156672: refactor commerce & optimize pandora dependencies #2723

Merged
merged 17 commits into from
Sep 2, 2024

Conversation

3ch023
Copy link
Contributor

@3ch023 3ch023 commented Aug 12, 2024

This PR is a follow up of #2725 and:

Resolves: https://jira.corp.adobe.com/browse/MWPW-156672
Original discussion: https://git.corp.adobe.com/orgs/wcms/discussions/38

Test URLs:

@3ch023 3ch023 added run-nala Run Nala Test Automation against PR commerce labels Aug 12, 2024
@3ch023 3ch023 requested a review from a team as a code owner August 12, 2024 13:39
Copy link
Contributor

aem-code-sync bot commented Aug 12, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

Copy link
Contributor

aem-code-sync bot commented Aug 12, 2024

Copy link

codecov bot commented Aug 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.89%. Comparing base (d90dcc0) to head (7ea8bf6).
Report is 16 commits behind head on stage.

Additional details and impacted files
@@            Coverage Diff             @@
##            stage    #2723      +/-   ##
==========================================
- Coverage   95.90%   95.89%   -0.02%     
==========================================
  Files         173      173              
  Lines       45842    45842              
==========================================
- Hits        43967    43958       -9     
- Misses       1875     1884       +9     

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

Copy link
Contributor

@mokimo mokimo left a comment

Choose a reason for hiding this comment

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

fancy, is it also planned to support subdomains? E.g. same domain requests from business.adobe.com

@3ch023
Copy link
Contributor Author

3ch023 commented Aug 12, 2024

todo: test on adobe-students

@3ch023
Copy link
Contributor Author

3ch023 commented Aug 12, 2024

fancy, is it also planned to support subdomains? E.g. same domain requests from business.adobe.com

from business.adobe.com most likely browser will initiate a preflight, since its a different domain, but without testing I can't say for sure.
Iirc right now bacom is not using commerce?

Copy link
Contributor

@yesil yesil left a comment

Choose a reason for hiding this comment

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

these are good changes that are needed, but I find it a bit risky to combine it with CDN change.

libs/features/mas/commerce/src/wcs.js Outdated Show resolved Hide resolved
Copy link
Contributor

@overmyheadandbody overmyheadandbody left a comment

Choose a reason for hiding this comment

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

No local issues sounds nice :) I'll let the MAS people approve this, as I don't have sufficient context.

Comment on lines 138 to 140
let wcsURL = 'https://www.adobe.com/web_commerce_artifact';
if (lowHostEnv) {
wcsURL = 'https://www.stage.adobe.com/web_commerce_artifact';
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: maybe string repetition could be avoided by determining the environment and then using a template literal to form the URL? Or maybe even a simple replace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

refactored a bit

Copy link
Contributor

@npeltier npeltier 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 to me, let's still discuss with both @yesil & @afmicka probably around here wether we split this in 2 or keep it unified as one big change for WCS

@3ch023
Copy link
Contributor Author

3ch023 commented Aug 12, 2024

FYI tested adobe-students domain and it will keep working fine with CDN change.
image

However I agree with Ilyas, it feels also too risky to me and we can't afford even a small CSO with this.
I am going to split the PR in two.
First will be CDN change, 2 lines only, we will give it some time and then this PR will follow after its all good.

@3ch023 3ch023 added the do not merge PR should not be merged yet label Aug 12, 2024
@3ch023
Copy link
Contributor Author

3ch023 commented Aug 12, 2024

smaller PR: #2725
this PR should be a follow up of the one above.

Copy link
Contributor

Reminder to set the Ready for Stage label - to queue this to get merged to stage & production.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

@yesil yesil dismissed their stale review August 23, 2024 12:46

will re-review

@3ch023
Copy link
Contributor Author

3ch023 commented Aug 23, 2024

added some changes on this PR so will need a re-review:

  • there was an issue with UK - if the language is undefined we shouldn't add this request param (MULT/EN)
  • added back few packages because of checkout builder depending on them.. unfortunately we need them for now to avoid corp artifactory in package-lock
  • added credentials:omit to not send cookies over to WCS

@3ch023 3ch023 requested review from npeltier, yesil and mokimo August 23, 2024 12:48
"@pandora/react-auth-provider": "file:./internal/react-auth-provider-1.2.1.tgz",
"@pandora/react-env-provider": "file:./internal/react-env-provider-1.2.2.tgz",
"@pandora/react-fetch-provider": "file:./internal/react-fetch-provider-1.2.2.tgz"
"@pandora/logger": "file:./internal/logger-1.3.0.tgz"
Copy link
Contributor

Choose a reason for hiding this comment

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

we should not depend on this anymore.
Did you try removing package-lock.json and npm install againg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, the checkout builder is pulling the data source package, which pulls logger etc

@@ -5,12 +5,6 @@ import {
buildCheckoutUrl,
} from '@pandora/commerce-checkout-url-builder';
import { Term, Commitment } from '@pandora/data-models-odm';
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't need these imports/we can replace them, I propose to remove them as well.

/**
* Cache of promises resolving to arrays of Wcs offers grouped by osi-based keys.
* @type {Map<string, Promise<Commerce.Wcs.Offer[]>>}
*/
const cache = new Map();
/**
* Queue of pending requests to Wcs grouped by locale and promo.
* @type {Map<string, { options: WcsOptions, promises: WcsPromises }>}
Copy link
Contributor

Choose a reason for hiding this comment

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

We could define WcsOptions here in this file as well.

@afmicka afmicka added verified PR has been E2E tested by a reviewer Ready for Stage labels Aug 29, 2024
@milo-pr-merge milo-pr-merge bot merged commit 5417762 into stage Sep 2, 2024
20 checks passed
@milo-pr-merge milo-pr-merge bot deleted the killwcs branch September 2, 2024 08:17
@milo-pr-merge milo-pr-merge bot mentioned this pull request Sep 2, 2024
@3ch023 3ch023 restored the killwcs branch September 3, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commerce 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