Skip to content

MWPW-202435: Tech debt: avoid relocating mas-field CTA content outside the mas-field wrapper - #1185

Merged
Roycethan merged 7 commits into
mainfrom
MWPW-202435
Sep 1, 2026
Merged

MWPW-202435: Tech debt: avoid relocating mas-field CTA content outside the mas-field wrapper#1185
Roycethan merged 7 commits into
mainfrom
MWPW-202435

Conversation

@joaquinrivero

@joaquinrivero joaquinrivero commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

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

mas-field now stamps its context onto the CTA and price directly (dropping the old copy helpers) and holds the CTA until the price resolves

Companion PR (milo): adobecom/milo#6586

  • 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
  • C.6 read your Jira one more time to validate that you've addressed all AC's

Test URLs:

…k unwrap

Generalize #stampContext to stamp fragment/variation/mask ids + promo code onto every commerce element mas-field renders (checkout anchors/buttons and inline prices), and make price/checkout option providers dataset-first so a CTA or price relocated out of <mas-field> by Milo's autoblock still resolves. mas is now the single source of truth; Milo only unwraps. MWPW-202435.
@aem-code-sync

aem-code-sync Bot commented Aug 27, 2026

Copy link
Copy Markdown

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

@joaquinrivero joaquinrivero changed the title MWPW-202435: mas-field owns commerce context across autoblock unwrap MWPW-202435: merge mas-field into merch-card element to share MAS context Aug 27, 2026
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.64%. Comparing base (fa87839) to head (4fbf5ec).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1185      +/-   ##
==========================================
+ Coverage   90.62%   90.64%   +0.01%     
==========================================
  Files         308      308              
  Lines       99175    99198      +23     
==========================================
+ Hits        89877    89915      +38     
+ Misses       9298     9283      -15     
Files with missing lines Coverage Δ
web-components/src/mas-field.js 98.91% <100.00%> (+0.02%) ⬆️

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4db7c8...4fbf5ec. 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.

@TsayAdobe TsayAdobe left a comment

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.

I would use an early return when element is undefined rather than relying on multiple optional chaining checks.

@Axelcureno Axelcureno left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving — nice fix. Went and checked the actual mechanism this depends on: the new global-ish data-promotion-code/fragment-id ownership check in priceOptionsProvider/checkoutOptionsProvider now runs on every price/checkout element, not just mas-field's own, but collectPriceOptions/collectCheckoutOptions always re-merge the element's own dataset after providers run, so it can't clobber merch-card's own promo (including cancel-context) resolution. Also cross-checked the companion milo#6586 diff — it deletes Milo's own re-stamping and fully trusts this, and checkReady() already guarantees #stampContext runs before Milo unwraps, so no race there either.

Small nit: #stampContext's selector is hardcoded (a[data-wcs-osi],button[is="checkout-button"],span[is="inline-price"]) instead of reusing SELECTOR_MAS_CHECKOUT_LINK/SELECTOR_MAS_INLINE_PRICE from constants.js — worth a follow-up so it doesn't drift.

@yesil yesil left a comment

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.

@joaquinrivero I think the PR title is wrong, but looking at the JIRA, LGTM.

@joaquinrivero joaquinrivero changed the title MWPW-202435: merge mas-field into merch-card element to share MAS context MWPW-202435: Tech debt: avoid relocating mas-field CTA content outside the mas-field wrapper Aug 28, 2026
* origin/main:
  MWPW-205209 Merch Icon URLs Relative (#1188)
  MWPW-200943: load entitlements from the offer found by ID search (#1156)
  MWPW-206050: limit executions to only our runners (#1189)
  MWPW-204765 CTA data-key field in RTE (#1167)
  MWPW-204645: Reduce promotions editor Odin load for large projects (#1160)

# Conflicts:
#	web-components/dist/commerce.js
#	web-components/dist/mas-field.js
#	web-components/dist/mas.js
* origin/main:
  MWPW-204106 fix(pro): drop obsolete one-merch-card top-spacing override (#1181)
  MWPW-202718: use geo tags for settings overrides (#1192)

# Conflicts:
#	web-components/dist/commerce.js
#	web-components/dist/mas-field.js
#	web-components/dist/mas.js
@Roycethan

Copy link
Copy Markdown
Collaborator

@joaquinrivero Plz see the error in https://github.com/adobecom/mas/actions/runs/33438620327/job/99641065094?pr=1185
Its happening previous PR merge on Settings (annual pricing)

priceOptionsProvider read masField.settings without optional-chaining
masField itself. masField is null for a CTA unwrapped from mas-field
(fragment-id marker only, no ancestor), so the check threw instead of
falling through.
* upstream/main:
  MWPW-204248 Wait for mas-commerce-service (#1183)

# Conflicts:
#	web-components/dist/commerce.js
#	web-components/dist/mas.js
@Roycethan
Roycethan merged commit 5b0774a into main Sep 1, 2026
20 of 21 checks passed
@Roycethan
Roycethan deleted the MWPW-202435 branch September 1, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants