Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-156372 #814

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Comment on lines 1 to 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <no-multiple-empty-lines> reported by reviewdog 🐶
Too many blank lines at the beginning of file. Max of 0 allowed.

Suggested change
import LIMITS from './limits.js';
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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <chai-friendly/no-unused-expressions> reported by reviewdog 🐶
Expected an assignment or function call and instead saw an expression.

};

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);
}
});
}
Loading