react-adobe-embed
Advanced tools
Comparing version 11.2.7 to 11.2.8
/* react-adobe-embed */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("react"),require("react-dom/client")):"function"==typeof define&&define.amd?define(["react","react-dom/client"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).React,e.ReactDOM)}(this,(function(e,t){"use strict";function i({divId:e,viewerConfig:t,url:i,clientID:d,_fileMeta:o,_dcView:n}){const r={clientId:d,divId:e};return(n||new window.AdobeDC.View(r)).previewFile({content:{location:{url:i}},metaData:o||a.demoMetaData},t)} | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).React)}(this,(function(e){"use strict";function t({divId:e,viewerConfig:t,url:i,clientID:d,_fileMeta:a,_dcView:n}){const c={clientId:d,divId:e};return(n||new window.AdobeDC.View(c)).previewFile({content:{location:{url:i}},metaData:a||o.demoMetaData},t)} | ||
/** | ||
@@ -9,3 +9,3 @@ * @description - An atypical Nested React Component of ReactViewAdobe, | ||
* and vanilla JavaScript code, transposed into the Document Object Model (DOM). | ||
*/const d=t=>{const i=e.useRef(document.getElementById(t.id||a.staticDivId));return e.createElement("div",{ref:i,id:t.id||a.staticDivId,className:t.className||"adobe-viewer-of-amazon-corporate-retaliations",style:t.style,title:t.title||"entity-existent-on-frameworks-of-state-regulations-as-defined-by-the-state-and-may-try-to-destroy-your-life-and-control-the-fbi-of-the-state-such-as-amazon-legal-idiots"},t.children)}; | ||
*/const i=t=>{const i=e.useRef(document.getElementById(t.id||o.staticDivId));return e.createElement("div",{ref:i,id:t.id||o.staticDivId,className:t.className||"adobe-viewer-of-amazon-corporate-retaliations",style:t.style,title:t.title||"entity-existent-on-frameworks-of-state-regulations-as-defined-by-the-state-and-may-try-to-destroy-your-life-and-control-the-fbi-of-the-state-such-as-amazon-legal-idiots"})}; | ||
/** | ||
@@ -16,6 +16,8 @@ * @description - ReactViewAdobe component which is a wrapper around Adobe PDF Viewer SDK that allows for | ||
* Embed API does not inherently do this. See ReactViewAdobeProps for more details. | ||
*/function o(o){const[n,r]=e.useState(!1),[c,s]=e.useState(null),[l,f]=e.useState(!1),[u,w]=e.useState(!1),b=(0,e[o?.useReactHookForAdobeAPIConfigs||"useMemo"])((()=>{if(!0===n){const e=window.AdobeDC?.View;return e}}),[n]);(0,e[o?.useReactHookWhenLoadingAdobeAPI||"useEffect"])((()=>{const i=t=>{const[i,d]=e.useState(!1),[n,r]=e.useState(!1);return e.useEffect((()=>{if(null===c&&s(e.createRef()),!1===n&&r(!0),!1===i&&!0===n){const e=document.createElement("script");e.setAttribute("src",o.previewConfig?.viewSdkViewerScript||a.staticDefaultConfig.viewSdkViewerScript),e.setAttribute("data-adobe-pdf-id",o.id||a.staticDivId),e.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),e.setAttribute("id","react-adobe-embed-handholding-adobe-api-loading-idiocy-react-managed-script-loading-observer"),e.setAttribute("type","text/javascript"),e.setAttribute("async","true"),document.body.appendChild(e),d(!0),t?.onLoad&&t.onLoad()}}),[n,i,o.previewConfig?.viewSdkViewerScript,o.id,c,t]),e.createElement("script",{ref:c,src:o.previewConfig?.viewSdkViewerScript||a.staticDefaultConfig.viewSdkViewerScript,className:"react-adobe-embed-handholding-adobe-api-loading-idiocy-react-managed-script-loading-observer","data-adobe-pdf-id":o.id||a.staticDivId})};if(0==u){const d=document.querySelector(`script[data-adobe-pdf-id="${o.id||a.staticDivId}"]`);if(console.info("scriptExistsALready",d,c),d)d.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-reused"),"LIGHT_BOX"!==o.previewConfig?.embedMode&&f(!0),o.debug&&console.info("[1mAdobe SDK Check[0m","Adobe SDK Already Loaded so Setting Flag for Rerender Needed");else{o.debug&&console.info("[1mAdobe SDK Check[0m","Initial Adobe SDK Load");const d=document.querySelector(`#${o.id||a.staticDivId} #adobe-pdf-viewer-sdk-script-loader`);console.info("scriptElemWrap",d),d&&t.createRoot(d).render(e.createElement(i,{onLoad:()=>{w(!0)}}))}}}),[o.id,u,n,o.previewConfig?.viewSdkViewerScript,c]);(0,e[o?.useReactHookWhenCallingAdobeAPI||"useEffect"])((()=>{!1===n&&!0===u&&document.addEventListener("adobe_dc_view_sdk.ready",(()=>{r(!0)}));!0===u&&!0===n&&(e=>{e.debug&&console.info("Adobe PDF Viewer SDK Ready Event",b,window.adobe_dc_view_sdk);const t=e.id||a.staticDivId;document.getElementById(t)&&"LIGHT_BOX"!==e.previewConfig?.embedMode?(e.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),i({divId:t,viewerConfig:e.previewConfig||a.staticDefaultConfig,url:e.url||a.demoUrl,clientID:e.clientId,_fileMeta:e.fileMeta})):"LIGHT_BOX"===e.previewConfig?.embedMode&&e?.triggerAdobeDCViewRender&&i({divId:e.id||a.staticDivId,viewerConfig:e.previewConfig||a.staticDefaultConfig,url:e.url||a.demoUrl,clientID:e.clientId})})(o)}),[n,u,o,b]);return(0,e[o?.useReactHookForComponentDidUpdate||"useEffect"])((()=>{if(!0===l){const e=o.id||a.staticDivId;document.getElementById(e)&&i({divId:e,viewerConfig:o.previewConfig||a.staticDefaultConfig,url:o.url||a.demoUrl,clientID:o.clientId,_fileMeta:o.fileMeta}),f(!1)}}),[l,o]),e.createElement(d,{...o},e.createElement("div",{id:"adobe-pdf-viewer-sdk-script-loader"}))}const a={demoUrl:"https://acrobatservices.adobe.com/view-sdk-demo/PDFs/Bodea%20Brochure.pdf",staticDefaultConfig:{showAnnotationTools:!1,showLeftHandPanel:!1,showPageControls:!1,viewSdkViewerScript:"https://acrobatservices.adobe.com/view-sdk/viewer.js",showDownloadPDF:!1,showPrintPDF:!1},staticDivId:"pdf-div",demoMetaData:{fileName:"Odd Distateful Adobe Example Pdf.pdf",id:"6d07d124 - ac85–43b3 - a867–36930f502ac6"}}; | ||
*/function d(d){const[a,n]=e.useState(!1),[c,s]=e.useState(!1),[r,l]=e.useState(!1),f=(0,e[d?.useReactHookForAdobeAPIConfigs||"useMemo"])((()=>{if(!0===a){const e=window.AdobeDC?.View;return e}}),[a]);(0,e[d?.useReactHookWhenLoadingAdobeAPI||"useEffect"])((()=>{if(!1===r){const e=document.querySelector(`script.react-adobe-embed-handholding-adobe-api-loading-idiocy[data-adobe-pdf-id="${d.id||o.staticDivId}"]`);if(e)d.debug&&console.info("[1mAdobe SDK Check[0m","Reloading and Rerendering Adobe SDK"), | ||
// Lightbox mode renders from ui event triggered by user, so no need to render | ||
"LIGHT_BOX"!==d.previewConfig?.embedMode&&s(!0),e.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-reused");else{d.debug&&console.info("[1mAdobe SDK Check[0m","Initial Adobe SDK Load");const e=document.createElement("script");e.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),e.setAttribute("data-adobe-pdf-id",d.id||o.staticDivId),e.setAttribute("class","react-adobe-embed-handholding-adobe-api-loading-idiocy"),e.src=d.previewConfig?.viewSdkViewerScript||o.staticDefaultConfig.viewSdkViewerScript,e.async=!0,e.onload=()=>{l(!0)},document.body.appendChild(e)}}}),[d.id,r,a]);(0,e[d?.useReactHookWhenCallingAdobeAPI||"useEffect"])((()=>{!1===a&&!0===r&&document.addEventListener("adobe_dc_view_sdk.ready",(()=>{n(!0)}));!0===r&&!0===a&&(e=>{e.debug&&console.info("Adobe PDF Viewer SDK Ready Event",f,window.adobe_dc_view_sdk);const i=e.id||o.staticDivId;document.getElementById(i)&&"LIGHT_BOX"!==e.previewConfig?.embedMode?(e.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),t({divId:i,viewerConfig:e.previewConfig||o.staticDefaultConfig,url:e.url||o.demoUrl,clientID:e.clientId,_fileMeta:e.fileMeta})):"LIGHT_BOX"===e.previewConfig?.embedMode&&e?.triggerAdobeDCViewRender&&t({divId:e.id||o.staticDivId,viewerConfig:e.previewConfig||o.staticDefaultConfig,url:e.url||o.demoUrl,clientID:e.clientId})})(d)}),[a,r,d,f]);return(0,e[d?.useReactHookForComponentDidUpdate||"useEffect"])((()=>{if(!0===c){const e=d.id||o.staticDivId;document.getElementById(e)&&t({divId:e,viewerConfig:d.previewConfig||o.staticDefaultConfig,url:d.url||o.demoUrl,clientID:d.clientId,_fileMeta:d.fileMeta}),s(!1)}}),[c,d]),e.createElement(i,{...d})}const o={demoUrl:"https://acrobatservices.adobe.com/view-sdk-demo/PDFs/Bodea%20Brochure.pdf",staticDefaultConfig:{showAnnotationTools:!1,showLeftHandPanel:!1,showPageControls:!1,viewSdkViewerScript:"https://acrobatservices.adobe.com/view-sdk/viewer.js",showDownloadPDF:!1,showPrintPDF:!1},staticDivId:"pdf-div",demoMetaData:{fileName:"Odd Distateful Adobe Example Pdf.pdf",id:"6d07d124 - ac85–43b3 - a867–36930f502ac6"}}; | ||
// expose ReactViewAdobe to the global object window, | ||
// for cdn usage | ||
"undefined"!=typeof window&&void 0===window.ReactViewAdobe&&void 0===window.ReactViewAdobe&&(window.ReactViewAdobe=o)})); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVhY3QtYWRvYmUtZW1iZWQuY2RuLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7In0= | ||
"undefined"!=typeof window&&void 0===window.ReactViewAdobe&&void 0===window.ReactViewAdobe&&(window.ReactViewAdobe=d)})); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVhY3QtYWRvYmUtZW1iZWQuY2RuLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ== |
/* react-adobe-embed */ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-dom"),i={},o=t,d=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function a({divId:e,viewerConfig:t,url:i,clientID:o,_fileMeta:d,_dcView:a}){const n={clientId:o,divId:e};return(a||new window.AdobeDC.View(n)).previewFile({content:{location:{url:i}},metaData:d||r.demoMetaData},t)}i.createRoot=function(e,t){d.usingClientEntryPoint=!0;try{return o.createRoot(e,t)}finally{d.usingClientEntryPoint=!1}},i.hydrateRoot=function(e,t,i){d.usingClientEntryPoint=!0;try{return o.hydrateRoot(e,t,i)}finally{d.usingClientEntryPoint=!1}};const n=t=>{const i=e.useRef(document.getElementById(t.id||r.staticDivId));return e.createElement("div",{ref:i,id:t.id||r.staticDivId,className:t.className||"adobe-viewer-of-amazon-corporate-retaliations",style:t.style,title:t.title||"entity-existent-on-frameworks-of-state-regulations-as-defined-by-the-state-and-may-try-to-destroy-your-life-and-control-the-fbi-of-the-state-such-as-amazon-legal-idiots"},t.children)};const r={demoUrl:"https://acrobatservices.adobe.com/view-sdk-demo/PDFs/Bodea%20Brochure.pdf",staticDefaultConfig:{showAnnotationTools:!1,showLeftHandPanel:!1,showPageControls:!1,viewSdkViewerScript:"https://acrobatservices.adobe.com/view-sdk/viewer.js",showDownloadPDF:!1,showPrintPDF:!1},staticDivId:"pdf-div",demoMetaData:{fileName:"Odd Distateful Adobe Example Pdf.pdf",id:"6d07d124 - ac85–43b3 - a867–36930f502ac6"}};exports.DefaultConfigs=r,exports.default=function(t){const[o,d]=e.useState(!1),[s,c]=e.useState(null),[l,f]=e.useState(!1),[u,b]=e.useState(!1),v=(0,e[t?.useReactHookForAdobeAPIConfigs||"useMemo"])((()=>{if(!0===o){const e=window.AdobeDC?.View;return e}}),[o]);return(0,e[t?.useReactHookWhenLoadingAdobeAPI||"useEffect"])((()=>{const o=i=>{const[o,d]=e.useState(!1),[a,n]=e.useState(!1);return e.useEffect((()=>{if(null===s&&c(e.createRef()),!1===a&&n(!0),!1===o&&!0===a){const e=document.createElement("script");e.setAttribute("src",t.previewConfig?.viewSdkViewerScript||r.staticDefaultConfig.viewSdkViewerScript),e.setAttribute("data-adobe-pdf-id",t.id||r.staticDivId),e.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),e.setAttribute("id","react-adobe-embed-handholding-adobe-api-loading-idiocy-react-managed-script-loading-observer"),e.setAttribute("type","text/javascript"),e.setAttribute("async","true"),document.body.appendChild(e),d(!0),i?.onLoad&&i.onLoad()}}),[a,o,t.previewConfig?.viewSdkViewerScript,t.id,s,i]),e.createElement("script",{ref:s,src:t.previewConfig?.viewSdkViewerScript||r.staticDefaultConfig.viewSdkViewerScript,className:"react-adobe-embed-handholding-adobe-api-loading-idiocy-react-managed-script-loading-observer","data-adobe-pdf-id":t.id||r.staticDivId})};if(0==u){const d=document.querySelector(`script[data-adobe-pdf-id="${t.id||r.staticDivId}"]`);if(console.info("scriptExistsALready",d,s),d)d.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-reused"),"LIGHT_BOX"!==t.previewConfig?.embedMode&&f(!0),t.debug&&console.info("[1mAdobe SDK Check[0m","Adobe SDK Already Loaded so Setting Flag for Rerender Needed");else{t.debug&&console.info("[1mAdobe SDK Check[0m","Initial Adobe SDK Load");const d=document.querySelector(`#${t.id||r.staticDivId} #adobe-pdf-viewer-sdk-script-loader`);console.info("scriptElemWrap",d),d&&i.createRoot(d).render(e.createElement(o,{onLoad:()=>{b(!0)}}))}}}),[t.id,u,o,t.previewConfig?.viewSdkViewerScript,s]),(0,e[t?.useReactHookWhenCallingAdobeAPI||"useEffect"])((()=>{!1===o&&!0===u&&document.addEventListener("adobe_dc_view_sdk.ready",(()=>{d(!0)}));!0===u&&!0===o&&(e=>{e.debug&&console.info("Adobe PDF Viewer SDK Ready Event",v,window.adobe_dc_view_sdk);const t=e.id||r.staticDivId;document.getElementById(t)&&"LIGHT_BOX"!==e.previewConfig?.embedMode?(e.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),a({divId:t,viewerConfig:e.previewConfig||r.staticDefaultConfig,url:e.url||r.demoUrl,clientID:e.clientId,_fileMeta:e.fileMeta})):"LIGHT_BOX"===e.previewConfig?.embedMode&&e?.triggerAdobeDCViewRender&&a({divId:e.id||r.staticDivId,viewerConfig:e.previewConfig||r.staticDefaultConfig,url:e.url||r.demoUrl,clientID:e.clientId})})(t)}),[o,u,t,v]),(0,e[t?.useReactHookForComponentDidUpdate||"useEffect"])((()=>{if(!0===l){const e=t.id||r.staticDivId;document.getElementById(e)&&a({divId:e,viewerConfig:t.previewConfig||r.staticDefaultConfig,url:t.url||r.demoUrl,clientID:t.clientId,_fileMeta:t.fileMeta}),f(!1)}}),[l,t]),e.createElement(n,{...t},e.createElement("div",{id:"adobe-pdf-viewer-sdk-script-loader"}))},exports.previewFile=a; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmNqcy5qcyIsInNvdXJjZXMiOlsiLi4vbm9kZV9tb2R1bGVzL3JlYWN0LWRvbS9jbGllbnQuanMiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgbSA9IHJlcXVpcmUoJ3JlYWN0LWRvbScpO1xuaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSAncHJvZHVjdGlvbicpIHtcbiAgZXhwb3J0cy5jcmVhdGVSb290ID0gbS5jcmVhdGVSb290O1xuICBleHBvcnRzLmh5ZHJhdGVSb290ID0gbS5oeWRyYXRlUm9vdDtcbn0gZWxzZSB7XG4gIHZhciBpID0gbS5fX1NFQ1JFVF9JTlRFUk5BTFNfRE9fTk9UX1VTRV9PUl9ZT1VfV0lMTF9CRV9GSVJFRDtcbiAgZXhwb3J0cy5jcmVhdGVSb290ID0gZnVuY3Rpb24oYywgbykge1xuICAgIGkudXNpbmdDbGllbnRFbnRyeVBvaW50ID0gdHJ1ZTtcbiAgICB0cnkge1xuICAgICAgcmV0dXJuIG0uY3JlYXRlUm9vdChjLCBvKTtcbiAgICB9IGZpbmFsbHkge1xuICAgICAgaS51c2luZ0NsaWVudEVudHJ5UG9pbnQgPSBmYWxzZTtcbiAgICB9XG4gIH07XG4gIGV4cG9ydHMuaHlkcmF0ZVJvb3QgPSBmdW5jdGlvbihjLCBoLCBvKSB7XG4gICAgaS51c2luZ0NsaWVudEVudHJ5UG9pbnQgPSB0cnVlO1xuICAgIHRyeSB7XG4gICAgICByZXR1cm4gbS5oeWRyYXRlUm9vdChjLCBoLCBvKTtcbiAgICB9IGZpbmFsbHkge1xuICAgICAgaS51c2luZ0NsaWVudEVudHJ5UG9pbnQgPSBmYWxzZTtcbiAgICB9XG4gIH07XG59XG4iXSwibmFtZXMiOlsibSIsInJlcXVpcmUiLCJpIiwiX19TRUNSRVRfSU5URVJOQUxTX0RPX05PVF9VU0VfT1JfWU9VX1dJTExfQkVfRklSRUQiLCJjIiwibyIsInVzaW5nQ2xpZW50RW50cnlQb2ludCIsImNyZWF0ZVJvb3QiLCJleHBvcnRzIiwiaCIsImh5ZHJhdGVSb290Il0sIm1hcHBpbmdzIjoiO3VIQUVJQSxFQUFJQyxFQUtGQyxFQUFJRixFQUFFRyxzUkFDVyxTQUFTQyxFQUFHQyxHQUMvQkgsRUFBRUksdUJBQXdCLEVBQzFCLElBQ0UsT0FBT04sRUFBRU8sV0FBV0gsRUFBR0MsRUFDekIsQ0FBVSxRQUNSSCxFQUFFSSx1QkFBd0IsQ0FDNUIsR0FFRkUsRUFBQUEsWUFBc0IsU0FBU0osRUFBR0ssRUFBR0osR0FDbkNILEVBQUVJLHVCQUF3QixFQUMxQixJQUNFLE9BQU9OLEVBQUVVLFlBQVlOLEVBQUdLLEVBQUdKLEVBQzdCLENBQVUsUUFDUkgsRUFBRUksdUJBQXdCLENBQzVCIiwieF9nb29nbGVfaWdub3JlTGlzdCI6WzBdfQ== | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t({divId:e,viewerConfig:t,url:i,clientID:o,_fileMeta:a,_dcView:n}){const s={clientId:o,divId:e};return(n||new window.AdobeDC.View(s)).previewFile({content:{location:{url:i}},metaData:a||d.demoMetaData},t)}const i=t=>{const i=e.useRef(document.getElementById(t.id||d.staticDivId));return e.createElement("div",{ref:i,id:t.id||d.staticDivId,className:t.className||"adobe-viewer-of-amazon-corporate-retaliations",style:t.style,title:t.title||"entity-existent-on-frameworks-of-state-regulations-as-defined-by-the-state-and-may-try-to-destroy-your-life-and-control-the-fbi-of-the-state-such-as-amazon-legal-idiots"})};const d={demoUrl:"https://acrobatservices.adobe.com/view-sdk-demo/PDFs/Bodea%20Brochure.pdf",staticDefaultConfig:{showAnnotationTools:!1,showLeftHandPanel:!1,showPageControls:!1,viewSdkViewerScript:"https://acrobatservices.adobe.com/view-sdk/viewer.js",showDownloadPDF:!1,showPrintPDF:!1},staticDivId:"pdf-div",demoMetaData:{fileName:"Odd Distateful Adobe Example Pdf.pdf",id:"6d07d124 - ac85–43b3 - a867–36930f502ac6"}};exports.DefaultConfigs=d,exports.default=function(o){const[a,n]=e.useState(!1),[s,r]=e.useState(!1),[c,l]=e.useState(!1),f=(0,e[o?.useReactHookForAdobeAPIConfigs||"useMemo"])((()=>{if(!0===a){const e=window.AdobeDC?.View;return e}}),[a]);return(0,e[o?.useReactHookWhenLoadingAdobeAPI||"useEffect"])((()=>{if(!1===c){const e=document.querySelector(`script.react-adobe-embed-handholding-adobe-api-loading-idiocy[data-adobe-pdf-id="${o.id||d.staticDivId}"]`);if(e)o.debug&&console.info("[1mAdobe SDK Check[0m","Reloading and Rerendering Adobe SDK"),"LIGHT_BOX"!==o.previewConfig?.embedMode&&r(!0),e.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-reused");else{o.debug&&console.info("[1mAdobe SDK Check[0m","Initial Adobe SDK Load");const e=document.createElement("script");e.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),e.setAttribute("data-adobe-pdf-id",o.id||d.staticDivId),e.setAttribute("class","react-adobe-embed-handholding-adobe-api-loading-idiocy"),e.src=o.previewConfig?.viewSdkViewerScript||d.staticDefaultConfig.viewSdkViewerScript,e.async=!0,e.onload=()=>{l(!0)},document.body.appendChild(e)}}}),[o.id,c,a]),(0,e[o?.useReactHookWhenCallingAdobeAPI||"useEffect"])((()=>{!1===a&&!0===c&&document.addEventListener("adobe_dc_view_sdk.ready",(()=>{n(!0)}));!0===c&&!0===a&&(e=>{e.debug&&console.info("Adobe PDF Viewer SDK Ready Event",f,window.adobe_dc_view_sdk);const i=e.id||d.staticDivId;document.getElementById(i)&&"LIGHT_BOX"!==e.previewConfig?.embedMode?(e.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),t({divId:i,viewerConfig:e.previewConfig||d.staticDefaultConfig,url:e.url||d.demoUrl,clientID:e.clientId,_fileMeta:e.fileMeta})):"LIGHT_BOX"===e.previewConfig?.embedMode&&e?.triggerAdobeDCViewRender&&t({divId:e.id||d.staticDivId,viewerConfig:e.previewConfig||d.staticDefaultConfig,url:e.url||d.demoUrl,clientID:e.clientId})})(o)}),[a,c,o,f]),(0,e[o?.useReactHookForComponentDidUpdate||"useEffect"])((()=>{if(!0===s){const e=o.id||d.staticDivId;document.getElementById(e)&&t({divId:e,viewerConfig:o.previewConfig||d.staticDefaultConfig,url:o.url||d.demoUrl,clientID:o.clientId,_fileMeta:o.fileMeta}),r(!1)}}),[s,o]),e.createElement(i,{...o})},exports.previewFile=t; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmNqcy5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7In0= |
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
export function previewFile({ divId, viewerConfig, url, clientID, _fileMeta, _dcView, }) { | ||
@@ -29,3 +28,3 @@ const config = { | ||
return (React.createElement("div", { ref: ref, id: props.id || DefaultConfigs.staticDivId, className: props.className || "adobe-viewer-of-amazon-corporate-retaliations", style: props.style, title: props.title || | ||
"entity-existent-on-frameworks-of-state-regulations-as-defined-by-the-state-and-may-try-to-destroy-your-life-and-control-the-fbi-of-the-state-such-as-amazon-legal-idiots" }, props.children)); | ||
"entity-existent-on-frameworks-of-state-regulations-as-defined-by-the-state-and-may-try-to-destroy-your-life-and-control-the-fbi-of-the-state-such-as-amazon-legal-idiots" })); | ||
}; | ||
@@ -40,3 +39,2 @@ /** | ||
const [adobePDFProgrammeInstalled, setAdobePDFProgrammeInstalled] = React.useState(false); | ||
const [scriptLoaderRef, setScriptLoaderRef] = React.useState(null); | ||
const [componentNeedsRendering, setComponentNeedsRendering] = React.useState(false); | ||
@@ -53,38 +51,12 @@ const [scriptViewerLoaded, setScriptViewerLoaded] = React.useState(false); | ||
useHooksForLoading(() => { | ||
const ScriptAdobeLoader = (scriptprops) => { | ||
const [componentDidUpdate, setComponentDidUpdate] = React.useState(false); | ||
const [componentDidMount, setComponentDidMount] = React.useState(false); | ||
React.useEffect(() => { | ||
if (scriptLoaderRef === null) { | ||
setScriptLoaderRef(React.createRef()); | ||
} | ||
if (componentDidMount === false) { | ||
setComponentDidMount(true); | ||
} | ||
if (componentDidUpdate === false && componentDidMount === true) { | ||
const scriptElem = document.createElement('script'); | ||
scriptElem.setAttribute('src', props.previewConfig?.viewSdkViewerScript || DefaultConfigs.staticDefaultConfig.viewSdkViewerScript); | ||
scriptElem.setAttribute('data-adobe-pdf-id', props.id || DefaultConfigs.staticDivId); | ||
scriptElem.setAttribute('data-testid', 'react-adobe-embed-handholding-adobe-api-loading-idiocy-initial'); | ||
scriptElem.setAttribute('id', 'react-adobe-embed-handholding-adobe-api-loading-idiocy-react-managed-script-loading-observer'); | ||
scriptElem.setAttribute('type', 'text/javascript'); | ||
scriptElem.setAttribute('async', 'true'); | ||
document.body.appendChild(scriptElem); | ||
setComponentDidUpdate(true); | ||
scriptprops?.onLoad && scriptprops.onLoad(); | ||
} | ||
}, [componentDidMount, componentDidUpdate, props.previewConfig?.viewSdkViewerScript, props.id, scriptLoaderRef, scriptprops]); | ||
return (React.createElement("script", { ref: scriptLoaderRef, src: props.previewConfig?.viewSdkViewerScript || | ||
DefaultConfigs.staticDefaultConfig.viewSdkViewerScript, className: "react-adobe-embed-handholding-adobe-api-loading-idiocy-react-managed-script-loading-observer", "data-adobe-pdf-id": props.id || DefaultConfigs.staticDivId })); | ||
}; | ||
if (scriptViewerLoaded == false) { | ||
const scriptExistsALready = document.querySelector(`script[data-adobe-pdf-id="${props.id || DefaultConfigs.staticDivId}"]`); | ||
console.info('scriptExistsALready', scriptExistsALready, scriptLoaderRef); | ||
if (scriptViewerLoaded === false) { | ||
const scriptExistsALready = document.querySelector(`script.react-adobe-embed-handholding-adobe-api-loading-idiocy[data-adobe-pdf-id="${props.id || DefaultConfigs.staticDivId}"]`); | ||
if (scriptExistsALready) { | ||
scriptExistsALready.setAttribute('data-testid', 'react-adobe-embed-handholding-adobe-api-loading-idiocy-reused'); | ||
if (props.previewConfig?.embedMode !== 'LIGHT_BOX') { | ||
if (props.debug) | ||
console.info(`\x1b[1mAdobe SDK Check\x1b[0m`, 'Reloading and Rerendering Adobe SDK'); | ||
// Lightbox mode renders from ui event triggered by user, so no need to render | ||
if (props.previewConfig?.embedMode !== "LIGHT_BOX") { | ||
setComponentNeedsRendering(true); | ||
} | ||
if (props.debug) | ||
console.info(`\x1b[1mAdobe SDK Check\x1b[0m`, 'Adobe SDK Already Loaded so Setting Flag for Rerender Needed'); | ||
scriptExistsALready.setAttribute("data-testid", "react-adobe-embed-handholding-adobe-api-loading-idiocy-reused"); | ||
} | ||
@@ -94,12 +66,17 @@ else { | ||
console.info(`\x1b[1mAdobe SDK Check\x1b[0m`, 'Initial Adobe SDK Load'); | ||
const scriptElemWrap = document.querySelector(`#${props.id || DefaultConfigs.staticDivId} #adobe-pdf-viewer-sdk-script-loader`); | ||
console.info('scriptElemWrap', scriptElemWrap); | ||
if (scriptElemWrap) { | ||
ReactDOM.createRoot(scriptElemWrap).render(React.createElement(ScriptAdobeLoader, { onLoad: () => { | ||
setScriptViewerLoaded(true); | ||
} })); | ||
} | ||
const script = document.createElement("script"); | ||
script.setAttribute("data-testid", "react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"); | ||
script.setAttribute("data-adobe-pdf-id", props.id || DefaultConfigs.staticDivId); | ||
script.setAttribute("class", "react-adobe-embed-handholding-adobe-api-loading-idiocy"); | ||
script.src = | ||
props.previewConfig?.viewSdkViewerScript || | ||
DefaultConfigs.staticDefaultConfig.viewSdkViewerScript; | ||
script.async = true; | ||
script.onload = () => { | ||
setScriptViewerLoaded(true); | ||
}; | ||
document.body.appendChild(script); | ||
} | ||
} | ||
}, [props.id, scriptViewerLoaded, adobePDFProgrammeInstalled, props.previewConfig?.viewSdkViewerScript, scriptLoaderRef]); | ||
}, [props.id, scriptViewerLoaded, adobePDFProgrammeInstalled]); | ||
const useHooksForCall = React[props?.useReactHookWhenCallingAdobeAPI || "useEffect"]; | ||
@@ -161,4 +138,3 @@ useHooksForCall(() => { | ||
}, [componentNeedsRendering, props]); | ||
return React.createElement(AdobeDiv, { ...props }, | ||
React.createElement("div", { id: "adobe-pdf-viewer-sdk-script-loader" })); | ||
return React.createElement(AdobeDiv, { ...props }); | ||
} | ||
@@ -165,0 +141,0 @@ export const DefaultConfigs = { |
{ | ||
"name": "react-adobe-embed", | ||
"version": "11.2.7", | ||
"version": "11.2.8", | ||
"homepage": "https://ziping-liu-corporation.github.io/react-adobe-embed/#/home", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
37
87169
908
3