Skip to content
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

implemented support for susi buttons #819

Merged
merged 9 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions acrobat/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ document.querySelectorAll('a').forEach((p, idx) => {
}
});

document.querySelectorAll('a[href*="susi-"]').forEach((el) => {
el.style.display = 'none';
saragajic11 marked this conversation as resolved.
Show resolved Hide resolved
});

/**
* The decision engine for where to get Milo's libs from.
*/
Expand Down Expand Up @@ -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) {
saragajic11 marked this conversation as resolved.
Show resolved Hide resolved
const { default: handleImsSusi } = await import('./susiAuthHandler.js');
handleImsSusi(susiSignUpElems, susiSignInElems);
}
});

loadIms().then(() => {
const imsIsReady = new CustomEvent('IMS:Ready');
window.dispatchEvent(imsIsReady);
Expand Down
17 changes: 17 additions & 0 deletions acrobat/scripts/susiAuthHandler.js
Original file line number Diff line number Diff line change
@@ -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 = '';
});
}
Loading