Skip to content

Commit

Permalink
Merge pull request #814 from adobecom/MWPW-156372_
Browse files Browse the repository at this point in the history
MWPW-156372
  • Loading branch information
Blainegunn committed Sep 18, 2024
2 parents 1366533 + e36d111 commit 8bce0c7
Showing 1 changed file with 1 addition and 44 deletions.
45 changes: 1 addition & 44 deletions acrobat/blocks/verb-widget/verb-widget.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@

import LIMITS from './limits.js';
import { setLibs, getEnv, isOldBrowser } from '../../scripts/utils.js';
import { setLibs, isOldBrowser } from '../../scripts/utils.js';
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 handleError = (err, errTxt, str, strTwo) => {
// err.classList.add('verb-error');
// err.classList.remove('hide');
Expand Down Expand Up @@ -73,19 +49,6 @@ const setDraggingClass = (widget, shouldToggle) => {
shouldToggle ? widget.classList.add('dragging') : widget.classList.remove('dragging');
};

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 @@ -176,10 +139,4 @@ export default async function init(element) {
setDraggingClass(widget, false);
}
});

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

0 comments on commit 8bce0c7

Please sign in to comment.