diff --git a/acrobat/scripts/scripts.js b/acrobat/scripts/scripts.js index 2fcecfa8..1b6b24a7 100644 --- a/acrobat/scripts/scripts.js +++ b/acrobat/scripts/scripts.js @@ -18,6 +18,10 @@ document.querySelectorAll('a').forEach((p, idx) => { } }); +document.querySelectorAll('a[href*="susi-"]').forEach((el) => { + el.style.display = 'none'; +}); + /** * The decision engine for where to get Milo's libs from. */ @@ -460,6 +464,15 @@ const { ietf } = getLocale(locales); setConfig({ ...CONFIG, miloLibs }); + window.addEventListener('IMS:Ready', async () => { + const susiSignUpElems = document.querySelectorAll('a[href*="susi-sign-up"]'); + const susiSignInElems = document.querySelectorAll('a[href*="susi-sign-in"]'); + if(susiSignUpElems.length > 0 || susiSignInElems.length > 0) { + const { default: handleImsSusi } = await import('./susiAuthHandler.js'); + handleImsSusi(susiSignUpElems, susiSignInElems); + } + }); + loadIms().then(() => { const imsIsReady = new CustomEvent('IMS:Ready'); window.dispatchEvent(imsIsReady); diff --git a/acrobat/scripts/susiAuthHandler.js b/acrobat/scripts/susiAuthHandler.js new file mode 100644 index 00000000..59c3c862 --- /dev/null +++ b/acrobat/scripts/susiAuthHandler.js @@ -0,0 +1,17 @@ +export default function handleImsSusi(susiSignUpElems, susiSignInElems) { + susiSignUpElems.forEach((link) => { + link.addEventListener('click', (e) => { + e.preventDefault(); + window.adobeIMS.signUp(); + }); + link.style.display = ''; + }); + + susiSignInElems.forEach((link) => { + link.addEventListener('click', (e) => { + e.preventDefault(); + window.adobeIMS.signIn(); + }); + link.style.display = ''; + }); +}