-
Notifications
You must be signed in to change notification settings - Fork 174
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-161289 Catalog CTA IMS country used in commerce calls #3136
Changes from 7 commits
9f8b990
cc9dc12
dd8a4cc
2ba5ab3
9f9a24d
79c4d23
0b3c70c
5c5064b
242c5ae
6035cac
f6bf603
9d8116e
ff0ad3d
df6a693
5367e28
3a3688e
53c8870
d053704
64586cd
20d376b
c1ffe9f
b0aec3a
f4b66c5
7a29c6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,6 @@ export class CheckoutLink extends HTMLAnchorElement { | |
'data-checkout-workflow', | ||
'data-checkout-workflow-step', | ||
'data-extra-options', | ||
'data-ims-country', | ||
'data-perpetual', | ||
'data-promotion-code', | ||
'data-quantity', | ||
|
@@ -121,6 +120,7 @@ export class CheckoutLink extends HTMLAnchorElement { | |
if (countryCode) this.dataset.imsCountry = countryCode; | ||
}, ignore); | ||
} | ||
overrides.imsCountry = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need this line? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yesil Yes, this will annul the IMS country in options and then the "page country" will be used, the same country that was used in the first render. And since we already have offers loaded for that country, no new WCS call will be triggered. |
||
const options = service.collectCheckoutOptions(overrides, this); | ||
if (!options.wcsOsi.length) return false; | ||
let extraOptions; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,15 +88,15 @@ describe('class "CheckoutLink"', () => { | |
); | ||
}); | ||
|
||
it('renders link with ims country', async () => { | ||
it('renders link with page country, not ims country', async () => { | ||
bozojovicic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mockIms('CH'); | ||
const service = await initMasCommerceService(); | ||
const checkoutLink = mockCheckoutLink('abm'); | ||
await service.imsCountryPromise; | ||
await delay(1); | ||
await checkoutLink.onceSettled(); | ||
expect(checkoutLink.href).to.equal( | ||
'https://commerce.adobe.com/store/email?items%5B0%5D%5Bid%5D=632B3ADD940A7FBB7864AA5AD19B8D28&cli=adobe_com&ctx=fp&co=CH&lang=en', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CH is expected here, what is NOT expect is an extra WCS call. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tests are fully reverted. So what I did is : Is it ok now? |
||
'https://commerce.adobe.com/store/email?items%5B0%5D%5Bid%5D=632B3ADD940A7FBB7864AA5AD19B8D28&cli=adobe_com&ctx=fp&co=US&lang=en', | ||
); | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should stay, it will cause a re-render which is expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, if re-render is expected, I returned it back.
On re-render the line
overrides.imsCountry = null
will override the country from IMS, and the page country will be used and since offers for the page country are already loaded on the first render, we will not have another WCS call.