From 5c07c49243181c70c1869997dd81954858d8374a Mon Sep 17 00:00:00 2001 From: James Tsay <65299136+TsayAdobe@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:17:56 -0800 Subject: [PATCH 1/3] MWPW-161195 Reload page if going backward (#910) * Reload page if going back forward * Remove comment --- acrobat/blocks/verb-widget/verb-widget.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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(); + } }); } From 6b2c83e686abea556d8321e41aa01ac7ea7f8077 Mon Sep 17 00:00:00 2001 From: James Tsay <65299136+TsayAdobe@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:04:03 -0800 Subject: [PATCH 2/3] Use Spectrum Blue (#915) --- acrobat/blocks/verb-widget/verb-widget.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From 847d4488b8c411125480aa036d8947f9fb541332 Mon Sep 17 00:00:00 2001 From: Joaquin Rivero Date: Mon, 9 Dec 2024 13:16:55 -0800 Subject: [PATCH 3/3] MWPW-161779: SUSI Link scenario when open in new tab or window (#914) * SUSI default using placeholders link for scenario when users use open in new (tab, window) * Refactoring SUSI Handler --------- Co-authored-by: James Tsay <65299136+TsayAdobe@users.noreply.github.com> --- acrobat/scripts/susiAuthHandler.js | 53 +++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 15 deletions(-) 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'; }); }