Skip to content

MWPW-188624: support promo override in grouped variations#736

Merged
afmicka merged 31 commits intomainfrom
MWPW-188624
Apr 30, 2026
Merged

MWPW-188624: support promo override in grouped variations#736
afmicka merged 31 commits intomainfrom
MWPW-188624

Conversation

@yesil
Copy link
Copy Markdown
Contributor

@yesil yesil commented Apr 2, 2026

Resolves https://jira.corp.adobe.com/browse/MWPW-188624

Adds grouped-variation preview locale selection in Studio and introduces a per-fragment compatVersion gate so the new fragment-level promo-code behavior only activates on cards authored after this change.

Studio

  • Preview panel shows a locale dropdown for grouped variations, populated from pznTags.
  • Preview card and localized prices re-render when the preview locale changes.
  • Preview locale override lives on the merch-card editor instead of global store state.
  • Editor applies the card promoCode as the default promotion code for price rendering and passes it to OST as a contextual promotionCode, separate from placeholder-level storedPromoOverride.
  • Rendered prices refresh when the promoCode field changes.
  • RTE external sync fix: restore flows no longer immediately recreate footer overrides.
  • On open, the editor stamps compatVersion = 1 onto the fragment so re-save migrates it forward.

QA Checklist: https://wiki.corp.adobe.com/display/adobedotcom/M@S+Engineering+QA+Use+Cases

Please do the steps below before submitting your PR for a code review or QA

  • C1. Cover code with Unit Tests
  • C2. Add a Nala test (double check with #fishbags if nala test is needed)
  • C3. Verify all Checks are green (unit tests, nala tests)
  • C4. PR description contains working Test Page link where the feature can be tested
  • C5: you are ready to do a demo from Test Page in PR (bonus: write a working demo script that you'll use on Thursday, you can eventually put in your PR)
  • C.6 read your Jira one more time to validate that you've addressed all AC's and nothing is missing

🧪 Nala E2E Tests

Nala tests run automatically when you open this PR.

To run Nala tests again:

  1. Add the run nala label to this PR (in the right sidebar)
  2. Tests will run automatically on the current commit
  3. Any future commits will also trigger tests as long as the label remains

To stop automatic Nala tests:

  • Remove the run nala label

Note: Tests only run on commits if the run nala label is present. Add the label whenever you need tests to run on new changes.

Test URLs:

Test fragments:

parent: https://mwpw-188624--mas--adobecom.aem.live/studio.html#fragmentId=37620c59-39b7-4340-9042-792aabad8206&page=fragment-editor&path=sandbox

grouped variation: https://mwpw-188624--mas--adobecom.aem.live/studio.html#fragmentId=a010c8e9-683c-4c61-ba09-85ad1337c51f&page=fragment-editor&path=sandbox

compatVersion:1

global promo applied
https://main--da-cc--adobecom.aem.page/drafts/ilyas/grouped-variation?maslibs=mwpw-188624--mas--adobecom&akamaiLocale=IT&mas-geo-detection=on

compatVersion:0

global promo skipped
https://main--da-cc--adobecom.aem.page/drafts/ilyas/grouped-variation?maslibs=mwpw-188624--mas--adobecom&akamaiLocale=FR&mas-geo-detection=on

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented Apr 2, 2026

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

  • Re-sync branch
Commits

@honstar
Copy link
Copy Markdown
Contributor

honstar commented Apr 13, 2026

There are test issues, please check!

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 76.80251% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.44%. Comparing base (48b2264) to head (2d21e87).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
studio/src/editors/merch-card-editor.js 76.42% 33 Missing ⚠️
studio/src/mas-repository.js 37.50% 25 Missing ⚠️
studio/src/mas-fragment-editor.js 90.00% 6 Missing ⚠️
studio/src/rte/ost.js 20.00% 4 Missing ⚠️
web-components/src/merch-card.js 91.30% 4 Missing ⚠️
studio/src/reactivity/source-fragment-store.js 50.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #736      +/-   ##
==========================================
- Coverage   87.46%   87.44%   -0.03%     
==========================================
  Files         210      211       +1     
  Lines       63107    63410     +303     
==========================================
+ Hits        55198    55447     +249     
- Misses       7909     7963      +54     
Files with missing lines Coverage Δ
studio/src/aem/fragment.js 97.12% <100.00%> (ø)
studio/src/mas-create-dialog.js 86.46% <100.00%> (+0.04%) ⬆️
studio/src/reactivity/preview-fragment-store.js 73.65% <100.00%> (+0.95%) ⬆️
studio/src/rte/rte-field.js 77.51% <100.00%> (+0.17%) ⬆️
web-components/src/compat-version.js 100.00% <100.00%> (ø)
web-components/src/hydrate.js 91.12% <100.00%> (+0.02%) ⬆️
studio/src/reactivity/source-fragment-store.js 83.00% <50.00%> (+4.33%) ⬆️
studio/src/rte/ost.js 69.96% <20.00%> (-0.82%) ⬇️
web-components/src/merch-card.js 87.98% <91.30%> (+0.08%) ⬆️
studio/src/mas-fragment-editor.js 89.48% <90.00%> (+0.59%) ⬆️
... and 2 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48b2264...2d21e87. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@honstar
Copy link
Copy Markdown
Contributor

honstar commented Apr 14, 2026

There are conflicts with files in web-components/dist, please resolve.

Comment thread studio/src/editors/merch-card-editor.js
Comment thread studio/src/editors/merch-card-editor.js Outdated
}

#handleCommerceReady = (event) => {
this.#registerCommercePriceProviders(event.detail || event.target);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

event.target for a wcms:commerce:ready event dispatched on document is document, not the commerce service element. So this fallback would pass document to the registration function, which would silently fail the service?.providers?.price guard. The fallback is effectively dead code.
The function already has document.querySelector('mas-commerce-service') as its default arg, so the event.target path adds noise without benefit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done.

Comment thread studio/src/editors/merch-card-editor.js Outdated
super.updated(changedProperties);
if (changedProperties.has('previewLocaleOverride')) {
const oldValue = changedProperties.get('previewLocaleOverride');
if (oldValue !== this.previewLocaleOverride) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LitElement only populates changedProperties with properties that actually changed, so this check is always true. It's harmless but misleading.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread studio/src/editors/merch-card-editor.js
@yesil yesil requested a review from honstar April 15, 2026 10:50
@afmicka
Copy link
Copy Markdown
Contributor

afmicka commented Apr 28, 2026

@yesil when i open the card that is used in Nala tests, in the editor and the card preview the promo is applied to the price in the description (on prod there is no promo applied to this price). At the same time, the Save button is disabled so user cannot save this new option if they want to. On the card preview in the render view there is not strikethrough price. This is confusing for the user. They might think that they need to correct something once they open the editor.

https://mwpw-188624--mas--adobecom.aem.live/studio.html#fragmentId=df357350-95b2-47f2-844f-df2e491eecef&page=fragment-editor&path=nala

Screenshot 2026-04-28 at 12 57 43

render view:
Screenshot 2026-04-28 at 13 00 37

If the changes have to be applied once the editor is opened, then maybe better to at least have a Save option back?

@afmicka
Copy link
Copy Markdown
Contributor

afmicka commented Apr 28, 2026

@yesil saving the fragment does not resolve the issue. The save button is always enabled, no matter how many times i save it or make a real change and save. The next time i open the fragment, save button is again enabled

https://mwpw-188624--mas--adobecom.aem.live/studio.html#fragmentId=6f189be0-d64b-468f-b340-92888206cce8&page=fragment-editor&path=nala

@afmicka
Copy link
Copy Markdown
Contributor

afmicka commented Apr 29, 2026

@yesil could you please check one thing. When you apply promo on the price from the promo code field, there is no data-promotion-code attribute on the price element. See prod how the price looks when promo is applied

Screenshot 2026-04-29 at 15 17 54

price on this fragment on your branch does not have it but the promo is obviously applied
https://mwpw-188624--mas--adobecom.aem.live/studio.html#fragmentId=9713e893-6180-492f-a053-27302d18517c&page=fragment-editor&path=sandbox
Screenshot 2026-04-29 at 15 18 14

@yesil
Copy link
Copy Markdown
Contributor Author

yesil commented Apr 29, 2026

@yesil could you please check one thing. When you apply promo on the price from the promo code field, there is no data-promotion-code attribute on the price element. See prod how the price looks when promo is applied

as discussed with @afmicka on slack, this is intended behavior.

@afmicka afmicka merged commit c2f1a8e into main Apr 30, 2026
15 checks passed
@afmicka afmicka deleted the MWPW-188624 branch April 30, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants