From 95fb0041c9d1f035b2851ecaf00ca164cc285038 Mon Sep 17 00:00:00 2001 From: Blaine Gunn Date: Thu, 15 Aug 2024 08:02:23 -0600 Subject: [PATCH] MWPW-156372 --- .../dc-converter-widget.js | 39 ----------- .../dc-converter-widget.jest.js | 65 ------------------- 2 files changed, 104 deletions(-) diff --git a/acrobat/blocks/dc-converter-widget/dc-converter-widget.js b/acrobat/blocks/dc-converter-widget/dc-converter-widget.js index dff39646..0437851b 100644 --- a/acrobat/blocks/dc-converter-widget/dc-converter-widget.js +++ b/acrobat/blocks/dc-converter-widget/dc-converter-widget.js @@ -92,29 +92,6 @@ const localeMap = { vn_vi: 'vi-vn', }; -// import verbToRedirectLinkSuffix from './verbRedirMap.js' -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', -}; - const exhLimitCookieMap = { 'to-pdf': 'ac_cr_p_c', 'pdf-to': 'ac_ex_p_c', @@ -210,16 +187,6 @@ export default async function init(element) { GENERATE_CACHE_URL_DIV.remove(); } - // Redirect - const fallBack = 'https://www.adobe.com/go/acrobat-overview'; - const redDir = () => { - if (window.location.hostname !== 'www.adobe.com' && window.location.hostname !== 'sign.ing' && window.location.hostname !== 'edit.ing') { - window.location = `https://www.adobe.com/go/acrobat-${verbRedirMap[VERB] || VERB.split('-').join('')}-${ENV}` || REDIRECT_URL; - } else { - window.location = REDIRECT_URL || `https://www.adobe.com/go/acrobat-${verbRedirMap[VERB] || VERB.split('-').join('')}` || fallBack; - } - }; - const widgetContainer = document.createElement('div'); widgetContainer.id = 'CID'; widgetContainer.className = `fsw wapper-${VERB}`; @@ -260,12 +227,6 @@ export default async function init(element) { } window.addEventListener('IMS:Ready', async () => { - // Redirect Usage - if (window.adobeIMS.isSignedInUser()) { - redDir(); - return; - } - const { default: frictionless } = await import('../../scripts/frictionless.js'); frictionless(VERB); }); diff --git a/test/blocks/dc-converter-widget/dc-converter-widget.jest.js b/test/blocks/dc-converter-widget/dc-converter-widget.jest.js index f7cdef3d..3f3dc26e 100644 --- a/test/blocks/dc-converter-widget/dc-converter-widget.jest.js +++ b/test/blocks/dc-converter-widget/dc-converter-widget.jest.js @@ -136,71 +136,6 @@ describe('dc-converter-widget', () => { expect(document.querySelector('#CID').children).toHaveLength(0); }); - it.each` - hostname - ${'stage--dc--adobecom.hlx.page'} - ${'main--dc--adobecom.hlx.page'} - ${'stage--dc--adobecom.hlx.live'} - ${'www.stage.adobe.com'} - ${'main--dc--adobecom.hlx.live'} - `('redirects when signed in on stage', async ({ hostname }) => { - window.fetch = jest.fn(() => Promise.resolve( - { - status: 200, - text: () => Promise.resolve(fs.readFileSync(path.resolve(__dirname, './mocks/widget.html'))), - }, - )); - window.adobeIMS = { isSignedInUser: jest.fn(() => true) }; - delete window.location; - window.location = new URL(`https://${hostname}/acrobat/online/pdf-to-ppt.html`); - const block = document.querySelector('.dc-converter-widget'); - await init(block); - window.dispatchEvent(new CustomEvent('IMS:Ready')); - expect(window.location).toBe('https://www.adobe.com/go/acrobat-pdftoppt-stage'); - }); - - it.each` - hostname - ${'www.adobe.com'} - `('redirects when signed in', async ({ hostname }) => { - window.fetch = jest.fn(() => Promise.resolve( - { - status: 200, - text: () => Promise.resolve(fs.readFileSync(path.resolve(__dirname, './mocks/widget.html'))), - }, - )); - window.adobeIMS = { isSignedInUser: jest.fn(() => true) }; - delete window.location; - window.location = new URL(`https://${hostname}/acrobat/online/pdf-to-ppt.html`); - const block = document.querySelector('.dc-converter-widget'); - await init(block); - window.dispatchEvent(new CustomEvent('IMS:Ready')); - expect(window.location).toBe('https://www.adobe.com/go/acrobat-pdftoppt'); - }); - - it.each` - hostname - ${'www.adobe.com'} - `('redirects when signed in - redirect link in block', async ({ hostname }) => { - document.body.innerHTML = fs.readFileSync( - path.resolve(__dirname, './mocks/body_redirect.html'), - 'utf8', - ); - window.fetch = jest.fn(() => Promise.resolve( - { - status: 200, - text: () => Promise.resolve(fs.readFileSync(path.resolve(__dirname, './mocks/widget.html'))), - }, - )); - window.adobeIMS = { isSignedInUser: jest.fn(() => true) }; - delete window.location; - window.location = new URL(`https://${hostname}/acrobat/online/pdf-to-ppt.html`); - const block = document.querySelector('.dc-converter-widget'); - await init(block); - window.dispatchEvent(new CustomEvent('IMS:Ready')); - expect(window.location).toBe('https://www.adobe.com/go/testredirect'); - }); - it.each` name | version ${'Internet Explorer'} | ${'10.0.0.0'}