Skip to content

Commit

Permalink
MWPW-159098
Browse files Browse the repository at this point in the history
  • Loading branch information
Blainegunn committed Sep 25, 2024
1 parent 482d705 commit 688e929
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions acrobat/blocks/verb-widget/verb-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,32 @@ import verbAnalytics from '../../scripts/alloy/verb-widget.js';
const miloLibs = setLibs('/libs');
const { createTag } = await import(`${miloLibs}/utils/utils.js`);

const fallBack = 'https://www.adobe.com/go/acrobat-overview';
const EOLBrowserPage = 'https://acrobat.adobe.com/home/index-browser-eol.html';

const verbRedirMap = {
createpdf: 'createpdf',
'crop-pages': 'crop',
'delete-pages': 'deletepages',
'extract-pages': 'extract',
'combine-pdf': 'combine',
'protect-pdf': 'protect',
'add-comment': 'addcomment',
'pdf-to-image': 'pdftoimage',
'reorder-pages': 'reorderpages',
sendforsignature: 'sendforsignature',
'rotate-pages': 'rotatepages',
fillsign: 'fillsign',
'split-pdf': 'split',
'insert-pdf': 'insert',
'compress-pdf': 'compress',
'png-to-pdf': 'jpgtopdf',
'number-pages': 'number',
'ocr-pdf': 'ocr',
'chat-pdf': 'chat',
'chat-pdf-student': 'study',
};

const setUser = () => {
localStorage.setItem('unity.user', 'true');
};
Expand Down Expand Up @@ -36,6 +60,19 @@ function initiatePrefetch(verb) {
}
}

function redDir(verb) {
const hostname = window?.location?.hostname;
const ENV = getEnv();
const VERB = verb;
let newLocation;
if (hostname !== 'www.adobe.com' && hostname !== 'sign.ing' && hostname !== 'edit.ing') {
newLocation = `https://www.adobe.com/go/acrobat-${verbRedirMap[VERB] || VERB.split('-').join('')}-${ENV}`;
} else {
newLocation = `https://www.adobe.com/go/acrobat-${verbRedirMap[VERB] || VERB.split('-').join('')}` || fallBack;
}
window.location.href = newLocation;
}

export default async function init(element) {
if (isOldBrowser()) {
window.location.href = EOLBrowserPage;
Expand Down Expand Up @@ -99,6 +136,13 @@ export default async function init(element) {

element.append(widget, footer);

window.addEventListener('IMS:Ready', async () => {
if (window.adobeIMS?.isSignedInUser()
&& window.adobeIMS?.getAccountType() !== 'type1') {
redDir(VERB);
}
});

// Analytics
verbAnalytics('landing:shown', VERB);

Expand Down

0 comments on commit 688e929

Please sign in to comment.