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-136317 Dropzone enabled on L1 verbs (plus compress) except rotate #381

Merged
merged 9 commits into from
Sep 26, 2023
33 changes: 18 additions & 15 deletions acrobat/blocks/dc-converter-widget/dc-converter-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,24 +195,24 @@ export default async function init(element) {
window?.browser?.name === 'Microsoft Edge' && window?.browser?.version?.split('.')[0] < 86 ||
window?.browser?.name === 'Microsoft Edge' && !window?.browser?.version ||
window?.browser?.name === 'Safari' && window?.browser?.version?.split('.')[0] < 14 ||
window?.browser?.name === 'Safari' && !window?.browser?.version ) {
window?.browser?.name === 'Safari' && !window?.browser?.version) {
window.location.href = EOLBrowserPage;
}

// Generate cache url
const GENERATE_CACHE_URL_DIV = widget.querySelectorAll('div')[4];
if (GENERATE_CACHE_URL_DIV) {
// GENERATE_CACHE_URL_DIV.id = 'GENERATE_CACHE_URL';
DC_GENERATE_CACHE_URL = GENERATE_CACHE_URL_DIV.textContent.trim();
GENERATE_CACHE_URL_DIV.remove();
}
// Generate cache url
const GENERATE_CACHE_URL_DIV = widget.querySelectorAll('div')[4];
if (GENERATE_CACHE_URL_DIV) {
// GENERATE_CACHE_URL_DIV.id = 'GENERATE_CACHE_URL';
DC_GENERATE_CACHE_URL = GENERATE_CACHE_URL_DIV.textContent.trim();
GENERATE_CACHE_URL_DIV.remove();
}

// Redirect
const fallBack = 'https://www.adobe.com/go/acrobat-overview';
const redDir = () => {
if (window.location.hostname != 'main--dc--adobecom.hlx.live'
&& window.location.hostname != 'www.adobe.com' ) {
window.location = `https://www.adobe.com/go/acrobat-${verbRedirMap[VERB] || VERB.split('-').join('')}-${ENV}`|| REDIRECT_URL;
&& window.location.hostname != 'www.adobe.com') {
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;
}
Expand Down Expand Up @@ -268,7 +268,7 @@ export default async function init(element) {
if (!cacheLoad) {
widgetContainer.appendChild(skeletonWrapper);

setTimeout( () => {
setTimeout(() => {
skeletonInnerWrapper.className = 'shimmer skeleton-inner';
}, 6000);
}
Expand Down Expand Up @@ -318,7 +318,10 @@ export default async function init(element) {
})
}

if (VERB === 'compress-pdf' || VERB === 'reorder-pages' || preRenderDropZone) {
const verbIncludeList = ['compress-pdf', 'fillsign', 'sendforsignature', 'add-comment',
'delete-pages', 'reorder-pages', 'split-pdf', 'insert-pdf', 'extract-pages', 'crop-pages', 'number-pages'];

if (verbIncludeList.includes(VERB) || preRenderDropZone) {
const verbFromURL = window.location.pathname.split('/').pop().split('.')[0];
const response = await fetch(DC_GENERATE_CACHE_URL || `${DC_DOMAIN}/dc-generate-cache/dc-hosted-${DC_GENERATE_CACHE_VERSION}/${VERB}-${pageLang}.html`);
switch (response.status) {
Expand All @@ -334,8 +337,8 @@ export default async function init(element) {
// const skel = widgetContainer.querySelector('.skeleton-wrapper');
// skel.replaceWith(doc.body.firstElementChild);
} else {
console.log('loaded dc snap');
widgetContainer.appendChild(doc.body.firstElementChild);
console.log('loaded dc snap');
widgetContainer.appendChild(doc.body.firstElementChild);
}
performance.mark("milo-insert-snippet");
}
Expand Down Expand Up @@ -380,7 +383,7 @@ export default async function init(element) {

window.addEventListener('IMS:Ready', () => {
let evt;
evt = new CustomEvent('dc.imslib.ready', { detail: { instance: window.adobeIMS }});
evt = new CustomEvent('dc.imslib.ready', { detail: { instance: window.adobeIMS } });
evt.initEvent('dc.imslib.ready', true, true);
document.dispatchEvent(evt);
// window.adobe_dc_sdk.imsReady = true;
Expand Down