Skip to content

Commit

Permalink
Merge pull request #918 from adobecom/2450
Browse files Browse the repository at this point in the history
DC MILO Release 0.2450
  • Loading branch information
joaquinrivero authored Dec 10, 2024
2 parents c3e20b8 + 847d448 commit 70160c2
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 19 deletions.
2 changes: 1 addition & 1 deletion acrobat/blocks/verb-widget/verb-widget.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@

.verb-cta {
cursor: pointer;
background: #1473e6;
background: var(--link-color);
border-radius: 8px;
padding: 11px 27px;
color: white;
Expand Down
11 changes: 8 additions & 3 deletions acrobat/blocks/verb-widget/verb-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,14 @@ export default async function init(element) {
handleError(e.detail, true, lanaOptions);
verbAnalytics('error', VERB);
}
});

// acrobat:verb-fillsign:error:page_count_missing_from_metadata_api
// acrobat:verb-fillsign:error:403
// LANA for 403
window.addEventListener('pageshow', (event) => {
const historyTraversal = event.persisted
|| (typeof window.performance !== 'undefined'
&& window.performance.getEntriesByType('navigation')[0].type === 'back_forward');
if (historyTraversal) {
window.location.reload();
}
});
}
53 changes: 38 additions & 15 deletions acrobat/scripts/susiAuthHandler.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,44 @@
import susiAnalytics from './alloy/susi-auth-handler.js';

export default function handleImsSusi(susiElems) {
function handleButton(link, action) {
link.classList.add('susi-cta');
link.href = window.mph['susi-default-redirect'] || 'https://acrobat.adobe.com/link/home/';
link.addEventListener('click', (e) => {
e.preventDefault();
susiAnalytics(link.text, action, window.browser.isMobile ? 'mobile' : 'desktop');
if (action === 'sign-up') {
window.adobeIMS.signUp();
} else if (action === 'sign-in') {
window.adobeIMS.signIn();
}
});
}

export default async function handleImsSusi(susiElems) {
const { setLibs } = await import('./utils.js');
const miloLibs = setLibs('/libs');
const { getConfig } = await import(`${miloLibs}/utils/utils.js`);
const config = getConfig();

if (!Object.keys(window.mph || {}).length) {
const placeholdersPath = `${config.locale.contentRoot}/placeholders.json`;
try {
const response = await fetch(placeholdersPath);
if (response.ok) {
const placeholderData = await response.json();
placeholderData.data.forEach(({ key, value }) => {
window.mph[key] = value.replace(/\u00A0/g, ' ');
});
}
} catch (error) {
window.lana?.log(`Failed to load placeholders: ${error?.message}`);
}
}

susiElems.forEach((link) => {
if (link.href.includes('-sign-up')) {
link.addEventListener('click', (e) => {
e.preventDefault();
susiAnalytics(link.text, 'sign-up', window.browser.isMobile ? 'mobile' : 'desktop');
window.adobeIMS.signUp();
});
} else if (link.href.includes('-sign-in')) {
link.addEventListener('click', (e) => {
e.preventDefault();
susiAnalytics(link.text, 'sign-in', window.browser.isMobile ? 'mobile' : 'desktop');
window.adobeIMS.signIn();
});
const match = link.href.match(/-(sign-up|sign-in)/);
if (match) {
handleButton(link, match[1]);
}
link.style.pointerEvents = 'auto';
link.style.cursor = 'pointer';
});
}

0 comments on commit 70160c2

Please sign in to comment.