diff --git a/acrobat/blocks/verb-widget/verb-widget.css b/acrobat/blocks/verb-widget/verb-widget.css index 539cb36b..b5c705c5 100644 --- a/acrobat/blocks/verb-widget/verb-widget.css +++ b/acrobat/blocks/verb-widget/verb-widget.css @@ -153,7 +153,7 @@ .verb-cta { cursor: pointer; - background: #1473e6; + background: var(--link-color); border-radius: 8px; padding: 11px 27px; color: white; diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 5e8204a7..6d559290 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -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(); + } }); } diff --git a/acrobat/scripts/susiAuthHandler.js b/acrobat/scripts/susiAuthHandler.js index 1416d79b..e676aad4 100644 --- a/acrobat/scripts/susiAuthHandler.js +++ b/acrobat/scripts/susiAuthHandler.js @@ -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'; }); }