From 0ba19e08137040822349bf82739e65568ce5b61c Mon Sep 17 00:00:00 2001 From: Blaine Gunn Date: Tue, 22 Oct 2024 18:02:16 -0600 Subject: [PATCH 1/2] MWPW-160726 --- acrobat/blocks/verb-widget/verb-widget.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index f4c8b4d1..d1bc66c5 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -74,6 +74,13 @@ function redDir(verb) { window.location.href = newLocation; } +let exitFlag; +function handleExit(event) { + if (exitFlag) { return; } + event.preventDefault(); + event.returnValue = true; +} + export default async function init(element) { if (isOldBrowser()) { window.location.href = EOLBrowserPage; @@ -251,9 +258,7 @@ export default async function init(element) { document.cookie = `UTS_Uploading=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; window.addEventListener('beforeunload', (w) => { - w.preventDefault(); - // Included for legacy support, e.g. Chrome/Edge < 119 - w.returnValue = true; + handleExit(w); }); } @@ -264,15 +269,11 @@ export default async function init(element) { } if (e.detail?.event === 'redirect to product') { + exitFlag = true; verbAnalytics('transition', VERB); setUser(); document.cookie = `UTS_Redirect=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; } - - if (e.detail?.event === 'redirect to product') { - verbAnalytics('transition', VERB); - setUser(); - } }); // Errors, Analytics & Logging From 4b8c1384542d92baf7871c02e708d4797d53242d Mon Sep 17 00:00:00 2001 From: Joaquin Rivero Date: Thu, 24 Oct 2024 02:12:34 +0800 Subject: [PATCH 2/2] Moving to uploaded --- acrobat/blocks/verb-widget/verb-widget.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 89f96e05..557e17ee 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -263,17 +263,11 @@ export default async function init(element) { } if (e.detail?.event === 'uploaded') { + exitFlag = true; verbAnalytics('job:uploaded', VERB, e.detail?.data); setUser(); document.cookie = `UTS_Uploaded=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; } - - if (e.detail?.event === 'redirect to product') { - exitFlag = true; - verbAnalytics('transition', VERB); - setUser(); - document.cookie = `UTS_Redirect=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; - } }); // Errors, Analytics & Logging