generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 191
[Release] Stage to Main #3772
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
Merged
Merged
[Release] Stage to Main #3772
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8952d6d
[MWPW-167349] - Added a default logo for the 'A' icon displayed on th…
Deva309 1ae67fd
MWPW-164660: [3-in-1][Milo] Implement a link converter for CTAs using…
mirafedas 80c79b5
MWPW-167928 Override Marketo POI (#3702)
Brandon32 0f54535
replace overflow x with contain layout (#3706)
patel-prince a3ebf74
[MWPW-168309] 2 small MEP button updates (#3719)
AdobeLinhart ed79397
MWPW-168334 Load georoutingv2.json and georoutingv2.js in parallel (#…
sharmrj 4df71c9
[MWPW-167309] - Table h tags replace (#3721)
DKos95 f8eb7e2
MWPW-166176 - Stop initial tabs click propagation (#3726)
rgclayton 005379e
Fix(mwpw-168006): Viewport bug fix. (#3730)
sharath-kannan 0ff9d06
Remove file overlap condition from merge to stage workflow (#3736)
mokimo 076ee63
Revert "replace overflow x with contain layout" (#3776)
sharmrj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* eslint-disable import/no-relative-packages */ | ||
import { createTag } from '../../utils/utils.js'; | ||
import { MODAL_TYPE_3_IN_1 } from '../../deps/mas/mas.js'; | ||
import '../../features/spectrum-web-components/dist/theme.js'; | ||
import '../../features/spectrum-web-components/dist/progress-circle.js'; | ||
|
||
export const MSG_SUBTYPE = { | ||
AppLoaded: 'AppLoaded', | ||
EXTERNAL: 'EXTERNAL', | ||
SWITCH: 'SWITCH', | ||
RETURN_BACK: 'RETURN_BACK', | ||
OrderComplete: 'OrderComplete', | ||
Error: 'Error', | ||
Close: 'Close', | ||
}; | ||
|
||
export const LANA_OPTIONS = { | ||
clientId: 'merch-at-scale', | ||
sampleRate: 10, | ||
tags: 'three-in-one', | ||
}; | ||
|
||
export const handle3in1IFrameEvents = ({ data: msgData }) => { | ||
let parsedMsg = null; | ||
try { | ||
parsedMsg = JSON.parse(msgData); | ||
} catch (error) { | ||
return; | ||
} | ||
const { app, subType, data } = parsedMsg || {}; | ||
if (app !== 'ucv3') return; | ||
window.lana?.log(`3-in-1 modal: ${subType}`, LANA_OPTIONS); | ||
const threeInOne = document.querySelector('.three-in-one'); | ||
const closeBtn = threeInOne?.querySelector('.dialog-close'); | ||
if (!threeInOne) return; | ||
switch (subType) { | ||
case MSG_SUBTYPE.AppLoaded: | ||
threeInOne.querySelector('iframe')?.classList.remove('loading'); | ||
threeInOne.querySelector('sp-theme')?.remove(); | ||
if (closeBtn) { | ||
closeBtn.setAttribute('aria-hidden', 'true'); | ||
closeBtn.style.opacity = '0'; | ||
} | ||
break; | ||
case MSG_SUBTYPE.EXTERNAL: | ||
case MSG_SUBTYPE.SWITCH: | ||
case MSG_SUBTYPE.RETURN_BACK: | ||
if (data?.externalUrl && data.target) { | ||
window.open(data.externalUrl, data.target); | ||
} | ||
break; | ||
case MSG_SUBTYPE.Close: | ||
document.querySelector('.dialog-modal.three-in-one')?.dispatchEvent(new Event('closeModal')); | ||
window.removeEventListener('message', handle3in1IFrameEvents); | ||
break; | ||
default: | ||
break; | ||
} | ||
}; | ||
|
||
export async function createContent(iframeUrl, modalType) { | ||
const content = createTag('div', { class: 'milo-iframe' }); | ||
content.innerHTML = `<sp-theme system="light" color="light" scale="medium" dir="ltr"> | ||
<sp-progress-circle label="progress circle" indeterminate="" size="l" dir="ltr" role="progressbar" aria-label="progress circle"></sp-progress-circle> | ||
</sp-theme> | ||
<iframe src="${iframeUrl}" title="${modalType === MODAL_TYPE_3_IN_1.CRM ? 'Single App' : modalType}" frameborder="0" marginwidth="0" marginheight="0" allowfullscreen="true" loading="lazy" class="loading" style="height: 100%;"></iframe>`; | ||
return content; | ||
} | ||
|
||
export default async function openThreeInOneModal(el) { | ||
const iframeUrl = el?.href; | ||
const modalType = el?.getAttribute('data-modal-type'); | ||
if (!modalType || !iframeUrl) return undefined; | ||
const { getModal } = await import('../modal/modal.js'); | ||
const content = await createContent(iframeUrl, modalType); | ||
return getModal(null, { | ||
id: 'three-in-one', | ||
content, | ||
closeEvent: 'closeModal', | ||
class: 'three-in-one', | ||
}); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
Copilot Autofix
AI 4 months ago
To fix the problem, we need to ensure that the
modalType
value is properly sanitized or escaped before being used in the HTML. One effective way to do this is to use a library likeDOMPurify
to sanitize themodalType
value. This will prevent any malicious scripts from being executed.DOMPurify
library.modalType
value before using it in theinnerHTML
assignment.