Socket
Socket
Sign inDemoInstall

react-adobe-embed

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-adobe-embed - npm Package Compare versions

Comparing version 11.1.0 to 11.1.5

16

dist/react-adobe-embed.cdn.js
/* react-adobe-embed */
!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)}
!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 c={clientId:d,divId:e};return(n||new window.AdobeDC.View(c)).previewFile({content:{location:{url:i}},metaData:o||a.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 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"})};
*/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"})};
/**

@@ -16,8 +16,12 @@ * @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 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("Adobe SDK Check","Reloading and Rerendering Adobe SDK"),
*/function o(o){const[n,c]=e.useState(!1),[r,s]=e.useState(!1),[l,f]=e.useState(!1),u=(0,e[o?.useReactHookForAdobeAPIConfigs||"useMemo"])((()=>{if(!0===n){const e=window.AdobeDC?.View;return e}}),[n]),[b,w]=e.useState(null);(0,e[o?.useReactHookWhenLoadingAdobeAPI||"useEffect"])((()=>{if(null==b){const t=e.createRef();w(t)}if(!1===l){const i=document.querySelector(`script.react-adobe-embed-handholding-adobe-api-loading-idiocy[data-adobe-pdf-id="${o.id||a.staticDivId}"]`),d=b;if(d&&i)o.debug&&console.info("Adobe SDK Check","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("Adobe SDK Check","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"}};
"LIGHT_BOX"!==o.previewConfig?.embedMode&&s(!0),d.current.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-reused");else{o.debug&&console.info("Adobe SDK Check","Initial Adobe SDK Load");const i=()=>{const[t,i]=e.useState(!1),[d,n]=e.useState(!1);return e.useEffect((()=>{if(!1===t&&i(!0),t&&!1===d){const e=document.createElement("script");
// const script = document.createElement("script");
e.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),e.setAttribute("data-adobe-pdf-id",o.id||a.staticDivId),e.setAttribute("class","react-adobe-embed-handholding-adobe-api-loading-idiocy"),e.src=o.previewConfig?.viewSdkViewerScript||a.staticDefaultConfig.viewSdkViewerScript,e.async=!0,e.onload=()=>{f(!0)},document.body.appendChild(e),n(!0)}}),[t,l,o]),e.createElement("script",{"data-testid":"react-adobe-embed-handholding-adobe-api-loading-idiocy-initial","data-adobe-pdf-id":o.id||a.staticDivId,className:"react-adobe-embed-handholding-adobe-api-loading-idiocy",src:o.previewConfig?.viewSdkViewerScript||a.staticDefaultConfig.viewSdkViewerScript,async:!0,ref:b})},d=document.createElement("script");
// render by appending to body, via creating a div element, and then appending the script to the div element
d.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),d.setAttribute("data-adobe-pdf-id",o.id||a.staticDivId),document.body.appendChild(d),t.createRoot(d).render(e.createElement(i,null))}}}),[o.id,l,n]);(0,e[o?.useReactHookWhenCallingAdobeAPI||"useEffect"])((()=>{!1===n&&!0===l&&document.addEventListener("adobe_dc_view_sdk.ready",(()=>{c(!0)}));!0===l&&!0===n&&(e=>{e.debug&&console.info("Adobe PDF Viewer SDK Ready Event",u,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,l,o,u]);return(0,e[o?.useReactHookForComponentDidUpdate||"useEffect"])((()=>{if(!0===r){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}),s(!1)}}),[r,o]),e.createElement(d,{...o})}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"}};
// expose ReactViewAdobe to the global object window,
// for cdn usage
"undefined"!=typeof window&&void 0===window.ReactViewAdobe&&void 0===window.ReactViewAdobe&&(window.ReactViewAdobe=d)}));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVhY3QtYWRvYmUtZW1iZWQuY2RuLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
"undefined"!=typeof window&&void 0===window.ReactViewAdobe&&void 0===window.ReactViewAdobe&&(window.ReactViewAdobe=o)}));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVhY3QtYWRvYmUtZW1iZWQuY2RuLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0=
/* react-adobe-embed */
"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("Adobe SDK Check","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("Adobe SDK Check","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=
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-dom"),i={},d=t,o=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function a({divId:e,viewerConfig:t,url:i,clientID:d,_fileMeta:o,_dcView:a}){const n={clientId:d,divId:e};return(a||new window.AdobeDC.View(n)).previewFile({content:{location:{url:i}},metaData:o||r.demoMetaData},t)}i.createRoot=function(e,t){o.usingClientEntryPoint=!0;try{return d.createRoot(e,t)}finally{o.usingClientEntryPoint=!1}},i.hydrateRoot=function(e,t,i){o.usingClientEntryPoint=!0;try{return d.hydrateRoot(e,t,i)}finally{o.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"})};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[d,o]=e.useState(!1),[c,s]=e.useState(!1),[l,u]=e.useState(!1),f=(0,e[t?.useReactHookForAdobeAPIConfigs||"useMemo"])((()=>{if(!0===d){const e=window.AdobeDC?.View;return e}}),[d]),[b,g]=e.useState(null);return(0,e[t?.useReactHookWhenLoadingAdobeAPI||"useEffect"])((()=>{if(null==b){const t=e.createRef();g(t)}if(!1===l){const d=document.querySelector(`script.react-adobe-embed-handholding-adobe-api-loading-idiocy[data-adobe-pdf-id="${t.id||r.staticDivId}"]`),o=b;if(o&&d)t.debug&&console.info("Adobe SDK Check","Reloading and Rerendering Adobe SDK"),"LIGHT_BOX"!==t.previewConfig?.embedMode&&s(!0),o.current.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-reused");else{t.debug&&console.info("Adobe SDK Check","Initial Adobe SDK Load");const d=()=>{const[i,d]=e.useState(!1),[o,a]=e.useState(!1);return e.useEffect((()=>{if(!1===i&&d(!0),i&&!1===o){const e=document.createElement("script");e.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),e.setAttribute("data-adobe-pdf-id",t.id||r.staticDivId),e.setAttribute("class","react-adobe-embed-handholding-adobe-api-loading-idiocy"),e.src=t.previewConfig?.viewSdkViewerScript||r.staticDefaultConfig.viewSdkViewerScript,e.async=!0,e.onload=()=>{u(!0)},document.body.appendChild(e),a(!0)}}),[i,l,t]),e.createElement("script",{"data-testid":"react-adobe-embed-handholding-adobe-api-loading-idiocy-initial","data-adobe-pdf-id":t.id||r.staticDivId,className:"react-adobe-embed-handholding-adobe-api-loading-idiocy",src:t.previewConfig?.viewSdkViewerScript||r.staticDefaultConfig.viewSdkViewerScript,async:!0,ref:b})},o=document.createElement("script");o.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),o.setAttribute("data-adobe-pdf-id",t.id||r.staticDivId),document.body.appendChild(o),i.createRoot(o).render(e.createElement(d,null))}}}),[t.id,l,d]),(0,e[t?.useReactHookWhenCallingAdobeAPI||"useEffect"])((()=>{!1===d&&!0===l&&document.addEventListener("adobe_dc_view_sdk.ready",(()=>{o(!0)}));!0===l&&!0===d&&(e=>{e.debug&&console.info("Adobe PDF Viewer SDK Ready Event",f,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)}),[d,l,t,f]),(0,e[t?.useReactHookForComponentDidUpdate||"useEffect"])((()=>{if(!0===c){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}),s(!1)}}),[c,t]),e.createElement(n,{...t})},exports.previewFile=a;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmNqcy5qcyIsInNvdXJjZXMiOlsiLi4vbm9kZV9tb2R1bGVzL3JlYWN0LWRvbS9jbGllbnQuanMiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgbSA9IHJlcXVpcmUoJ3JlYWN0LWRvbScpO1xuaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSAncHJvZHVjdGlvbicpIHtcbiAgZXhwb3J0cy5jcmVhdGVSb290ID0gbS5jcmVhdGVSb290O1xuICBleHBvcnRzLmh5ZHJhdGVSb290ID0gbS5oeWRyYXRlUm9vdDtcbn0gZWxzZSB7XG4gIHZhciBpID0gbS5fX1NFQ1JFVF9JTlRFUk5BTFNfRE9fTk9UX1VTRV9PUl9ZT1VfV0lMTF9CRV9GSVJFRDtcbiAgZXhwb3J0cy5jcmVhdGVSb290ID0gZnVuY3Rpb24oYywgbykge1xuICAgIGkudXNpbmdDbGllbnRFbnRyeVBvaW50ID0gdHJ1ZTtcbiAgICB0cnkge1xuICAgICAgcmV0dXJuIG0uY3JlYXRlUm9vdChjLCBvKTtcbiAgICB9IGZpbmFsbHkge1xuICAgICAgaS51c2luZ0NsaWVudEVudHJ5UG9pbnQgPSBmYWxzZTtcbiAgICB9XG4gIH07XG4gIGV4cG9ydHMuaHlkcmF0ZVJvb3QgPSBmdW5jdGlvbihjLCBoLCBvKSB7XG4gICAgaS51c2luZ0NsaWVudEVudHJ5UG9pbnQgPSB0cnVlO1xuICAgIHRyeSB7XG4gICAgICByZXR1cm4gbS5oeWRyYXRlUm9vdChjLCBoLCBvKTtcbiAgICB9IGZpbmFsbHkge1xuICAgICAgaS51c2luZ0NsaWVudEVudHJ5UG9pbnQgPSBmYWxzZTtcbiAgICB9XG4gIH07XG59XG4iXSwibmFtZXMiOlsibSIsInJlcXVpcmUiLCJpIiwiX19TRUNSRVRfSU5URVJOQUxTX0RPX05PVF9VU0VfT1JfWU9VX1dJTExfQkVfRklSRUQiLCJjIiwibyIsInVzaW5nQ2xpZW50RW50cnlQb2ludCIsImNyZWF0ZVJvb3QiLCJleHBvcnRzIiwiaCIsImh5ZHJhdGVSb290Il0sIm1hcHBpbmdzIjoiO3VIQUVJQSxFQUFJQyxFQUtGQyxFQUFJRixFQUFFRyxzUkFDVyxTQUFTQyxFQUFHQyxHQUMvQkgsRUFBRUksdUJBQXdCLEVBQzFCLElBQ0UsT0FBT04sRUFBRU8sV0FBV0gsRUFBR0MsRUFDekIsQ0FBVSxRQUNSSCxFQUFFSSx1QkFBd0IsQ0FDNUIsR0FFRkUsRUFBQUEsWUFBc0IsU0FBU0osRUFBR0ssRUFBR0osR0FDbkNILEVBQUVJLHVCQUF3QixFQUMxQixJQUNFLE9BQU9OLEVBQUVVLFlBQVlOLEVBQUdLLEVBQUdKLEVBQzdCLENBQVUsUUFDUkgsRUFBRUksdUJBQXdCLENBQzVCIiwieF9nb29nbGVfaWdub3JlTGlzdCI6WzBdfQ==
/* react-adobe-embed */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactScriptTag={},e.React)}(this,(function(e,t){"use strict";function i({divId:e,viewerConfig:t,url:i,clientID:d,_fileMeta:a,_dcView:n}){const s={clientId:d,divId:e};return(n||new window.AdobeDC.View(s)).previewFile({content:{location:{url:i}},metaData:a||o.demoMetaData},t)}const d=e=>{const i=t.useRef(document.getElementById(e.id||o.staticDivId));return t.createElement("div",{ref:i,id:e.id||o.staticDivId,className:e.className||"adobe-viewer-of-amazon-corporate-retaliations",style:e.style,title:e.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 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"}};e.DefaultConfigs=o,e.default=function(e){const[a,n]=t.useState(!1),[s,c]=t.useState(!1),[r,l]=t.useState(!1),f=(0,t[e?.useReactHookForAdobeAPIConfigs||"useMemo"])((()=>{if(!0===a){const e=window.AdobeDC?.View;return e}}),[a]);return(0,t[e?.useReactHookWhenLoadingAdobeAPI||"useEffect"])((()=>{if(!1===r){const t=document.querySelector(`script.react-adobe-embed-handholding-adobe-api-loading-idiocy[data-adobe-pdf-id="${e.id||o.staticDivId}"]`);if(t)e.debug&&console.info("Adobe SDK Check","Reloading and Rerendering Adobe SDK"),"LIGHT_BOX"!==e.previewConfig?.embedMode&&c(!0),t.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-reused");else{e.debug&&console.info("Adobe SDK Check","Initial Adobe SDK Load");const t=document.createElement("script");t.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),t.setAttribute("data-adobe-pdf-id",e.id||o.staticDivId),t.setAttribute("class","react-adobe-embed-handholding-adobe-api-loading-idiocy"),t.src=e.previewConfig?.viewSdkViewerScript||o.staticDefaultConfig.viewSdkViewerScript,t.async=!0,t.onload=()=>{l(!0)},document.body.appendChild(t)}}}),[e.id,r,a]),(0,t[e?.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 t=e.id||o.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||o.staticDefaultConfig,url:e.url||o.demoUrl,clientID:e.clientId,_fileMeta:e.fileMeta})):"LIGHT_BOX"===e.previewConfig?.embedMode&&e?.triggerAdobeDCViewRender&&i({divId:e.id||o.staticDivId,viewerConfig:e.previewConfig||o.staticDefaultConfig,url:e.url||o.demoUrl,clientID:e.clientId})})(e)}),[a,r,e,f]),(0,t[e?.useReactHookForComponentDidUpdate||"useEffect"])((()=>{if(!0===s){const t=e.id||o.staticDivId;document.getElementById(t)&&i({divId:t,viewerConfig:e.previewConfig||o.staticDefaultConfig,url:e.url||o.demoUrl,clientID:e.clientId,_fileMeta:e.fileMeta}),c(!1)}}),[s,e]),t.createElement(d,{...e})},e.previewFile=i,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjsifQ==
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactScriptTag={},e.React,e.require$$0)}(this,(function(e,t,i){"use strict";var d={},o=i,a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n({divId:e,viewerConfig:t,url:i,clientID:d,_fileMeta:o,_dcView:a}){const n={clientId:d,divId:e};return(a||new window.AdobeDC.View(n)).previewFile({content:{location:{url:i}},metaData:o||c.demoMetaData},t)}d.createRoot=function(e,t){a.usingClientEntryPoint=!0;try{return o.createRoot(e,t)}finally{a.usingClientEntryPoint=!1}},d.hydrateRoot=function(e,t,i){a.usingClientEntryPoint=!0;try{return o.hydrateRoot(e,t,i)}finally{a.usingClientEntryPoint=!1}};const r=e=>{const i=t.useRef(document.getElementById(e.id||c.staticDivId));return t.createElement("div",{ref:i,id:e.id||c.staticDivId,className:e.className||"adobe-viewer-of-amazon-corporate-retaliations",style:e.style,title:e.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 c={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"}};e.DefaultConfigs=c,e.default=function(e){const[i,o]=t.useState(!1),[a,s]=t.useState(!1),[l,f]=t.useState(!1),u=(0,t[e?.useReactHookForAdobeAPIConfigs||"useMemo"])((()=>{if(!0===i){const e=window.AdobeDC?.View;return e}}),[i]),[b,g]=t.useState(null);return(0,t[e?.useReactHookWhenLoadingAdobeAPI||"useEffect"])((()=>{if(null==b){const e=t.createRef();g(e)}if(!1===l){const i=document.querySelector(`script.react-adobe-embed-handholding-adobe-api-loading-idiocy[data-adobe-pdf-id="${e.id||c.staticDivId}"]`),o=b;if(o&&i)e.debug&&console.info("Adobe SDK Check","Reloading and Rerendering Adobe SDK"),"LIGHT_BOX"!==e.previewConfig?.embedMode&&s(!0),o.current.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-reused");else{e.debug&&console.info("Adobe SDK Check","Initial Adobe SDK Load");const i=()=>{const[i,d]=t.useState(!1),[o,a]=t.useState(!1);return t.useEffect((()=>{if(!1===i&&d(!0),i&&!1===o){const t=document.createElement("script");t.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),t.setAttribute("data-adobe-pdf-id",e.id||c.staticDivId),t.setAttribute("class","react-adobe-embed-handholding-adobe-api-loading-idiocy"),t.src=e.previewConfig?.viewSdkViewerScript||c.staticDefaultConfig.viewSdkViewerScript,t.async=!0,t.onload=()=>{f(!0)},document.body.appendChild(t),a(!0)}}),[i,l,e]),t.createElement("script",{"data-testid":"react-adobe-embed-handholding-adobe-api-loading-idiocy-initial","data-adobe-pdf-id":e.id||c.staticDivId,className:"react-adobe-embed-handholding-adobe-api-loading-idiocy",src:e.previewConfig?.viewSdkViewerScript||c.staticDefaultConfig.viewSdkViewerScript,async:!0,ref:b})},o=document.createElement("script");o.setAttribute("data-testid","react-adobe-embed-handholding-adobe-api-loading-idiocy-initial"),o.setAttribute("data-adobe-pdf-id",e.id||c.staticDivId),document.body.appendChild(o),d.createRoot(o).render(t.createElement(i,null))}}}),[e.id,l,i]),(0,t[e?.useReactHookWhenCallingAdobeAPI||"useEffect"])((()=>{!1===i&&!0===l&&document.addEventListener("adobe_dc_view_sdk.ready",(()=>{o(!0)}));!0===l&&!0===i&&(e=>{e.debug&&console.info("Adobe PDF Viewer SDK Ready Event",u,window.adobe_dc_view_sdk);const t=e.id||c.staticDivId;document.getElementById(t)&&"LIGHT_BOX"!==e.previewConfig?.embedMode?(e.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),n({divId:t,viewerConfig:e.previewConfig||c.staticDefaultConfig,url:e.url||c.demoUrl,clientID:e.clientId,_fileMeta:e.fileMeta})):"LIGHT_BOX"===e.previewConfig?.embedMode&&e?.triggerAdobeDCViewRender&&n({divId:e.id||c.staticDivId,viewerConfig:e.previewConfig||c.staticDefaultConfig,url:e.url||c.demoUrl,clientID:e.clientId})})(e)}),[i,l,e,u]),(0,t[e?.useReactHookForComponentDidUpdate||"useEffect"])((()=>{if(!0===a){const t=e.id||c.staticDivId;document.getElementById(t)&&n({divId:t,viewerConfig:e.previewConfig||c.staticDefaultConfig,url:e.url||c.demoUrl,clientID:e.clientId,_fileMeta:e.fileMeta}),s(!1)}}),[a,e]),t.createElement(r,{...e})},e.previewFile=n,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmpzIiwic291cmNlcyI6WyIuLi9ub2RlX21vZHVsZXMvcmVhY3QtZG9tL2NsaWVudC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBtID0gcmVxdWlyZSgncmVhY3QtZG9tJyk7XG5pZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgPT09ICdwcm9kdWN0aW9uJykge1xuICBleHBvcnRzLmNyZWF0ZVJvb3QgPSBtLmNyZWF0ZVJvb3Q7XG4gIGV4cG9ydHMuaHlkcmF0ZVJvb3QgPSBtLmh5ZHJhdGVSb290O1xufSBlbHNlIHtcbiAgdmFyIGkgPSBtLl9fU0VDUkVUX0lOVEVSTkFMU19ET19OT1RfVVNFX09SX1lPVV9XSUxMX0JFX0ZJUkVEO1xuICBleHBvcnRzLmNyZWF0ZVJvb3QgPSBmdW5jdGlvbihjLCBvKSB7XG4gICAgaS51c2luZ0NsaWVudEVudHJ5UG9pbnQgPSB0cnVlO1xuICAgIHRyeSB7XG4gICAgICByZXR1cm4gbS5jcmVhdGVSb290KGMsIG8pO1xuICAgIH0gZmluYWxseSB7XG4gICAgICBpLnVzaW5nQ2xpZW50RW50cnlQb2ludCA9IGZhbHNlO1xuICAgIH1cbiAgfTtcbiAgZXhwb3J0cy5oeWRyYXRlUm9vdCA9IGZ1bmN0aW9uKGMsIGgsIG8pIHtcbiAgICBpLnVzaW5nQ2xpZW50RW50cnlQb2ludCA9IHRydWU7XG4gICAgdHJ5IHtcbiAgICAgIHJldHVybiBtLmh5ZHJhdGVSb290KGMsIGgsIG8pO1xuICAgIH0gZmluYWxseSB7XG4gICAgICBpLnVzaW5nQ2xpZW50RW50cnlQb2ludCA9IGZhbHNlO1xuICAgIH1cbiAgfTtcbn1cbiJdLCJuYW1lcyI6WyJtIiwicmVxdWlyZSIsImkiLCJfX1NFQ1JFVF9JTlRFUk5BTFNfRE9fTk9UX1VTRV9PUl9ZT1VfV0lMTF9CRV9GSVJFRCIsImMiLCJvIiwidXNpbmdDbGllbnRFbnRyeVBvaW50IiwiY3JlYXRlUm9vdCIsImV4cG9ydHMiLCJoIiwiaHlkcmF0ZVJvb3QiXSwibWFwcGluZ3MiOiI7a1ZBRUlBLEVBQUlDLEVBS0ZDLEVBQUlGLEVBQUVHLHNSQUNXLFNBQVNDLEVBQUdDLEdBQy9CSCxFQUFFSSx1QkFBd0IsRUFDMUIsSUFDRSxPQUFPTixFQUFFTyxXQUFXSCxFQUFHQyxFQUN6QixDQUFVLFFBQ1JILEVBQUVJLHVCQUF3QixDQUM1QixHQUVGRSxFQUFBQSxZQUFzQixTQUFTSixFQUFHSyxFQUFHSixHQUNuQ0gsRUFBRUksdUJBQXdCLEVBQzFCLElBQ0UsT0FBT04sRUFBRVUsWUFBWU4sRUFBR0ssRUFBR0osRUFDN0IsQ0FBVSxRQUNSSCxFQUFFSSx1QkFBd0IsQ0FDNUIiLCJ4X2dvb2dsZV9pZ25vcmVMaXN0IjpbMF19
import React from "react";
import ReactDOM from "react-dom/client";
export function previewFile({ divId, viewerConfig, url, clientID, _fileMeta, _dcView, }) {

@@ -47,7 +48,13 @@ const config = {

}, [adobePDFProgrammeInstalled]);
const [scriptRef, setScriptRef] = React.useState(null);
const useHooksForLoading = React[props?.useReactHookWhenLoadingAdobeAPI || "useEffect"];
useHooksForLoading(() => {
if (scriptRef == null) {
const newRef = React.createRef();
setScriptRef(newRef);
}
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) {
const scriptExistsALreadyElem = document.querySelector(`script.react-adobe-embed-handholding-adobe-api-loading-idiocy[data-adobe-pdf-id="${props.id || DefaultConfigs.staticDivId}"]`);
const scriptExistsALready = scriptRef;
if (scriptExistsALready && scriptExistsALreadyElem) {
if (props.debug)

@@ -59,3 +66,3 @@ console.info(`\x1b[1mAdobe SDK Check\x1b[0m`, 'Reloading and Rerendering Adobe SDK');

}
scriptExistsALready.setAttribute("data-testid", "react-adobe-embed-handholding-adobe-api-loading-idiocy-reused");
scriptExistsALready.current.setAttribute("data-testid", "react-adobe-embed-handholding-adobe-api-loading-idiocy-reused");
}

@@ -65,14 +72,36 @@ else {

console.info(`\x1b[1mAdobe SDK Check\x1b[0m`, 'Initial Adobe SDK Load');
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);
const ScriptNew = () => {
const [componentDidMount, setComponentDidMount] = React.useState(false);
const [componentDidUpdate, setComponentDidUpdate] = React.useState(false);
React.useEffect(() => {
if (componentDidMount === false) {
setComponentDidMount(true);
}
if (componentDidMount
&& componentDidUpdate === false) {
const script = document.createElement("script");
// 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);
setComponentDidUpdate(true);
}
}, [componentDidMount, scriptViewerLoaded, props]);
return React.createElement("script", { "data-testid": "react-adobe-embed-handholding-adobe-api-loading-idiocy-initial", "data-adobe-pdf-id": props.id || DefaultConfigs.staticDivId, className: "react-adobe-embed-handholding-adobe-api-loading-idiocy", src: props.previewConfig?.viewSdkViewerScript ||
DefaultConfigs.staticDefaultConfig.viewSdkViewerScript, async: true, ref: scriptRef });
};
document.body.appendChild(script);
// render by appending to body, via creating a div element, and then appending the script to the div element
const scriptElement = document.createElement("script");
scriptElement.setAttribute("data-testid", "react-adobe-embed-handholding-adobe-api-loading-idiocy-initial");
scriptElement.setAttribute("data-adobe-pdf-id", props.id || DefaultConfigs.staticDivId);
document.body.appendChild(scriptElement);
ReactDOM.createRoot(scriptElement).render(React.createElement(ScriptNew, null));
}

@@ -79,0 +108,0 @@ }

{
"name": "react-adobe-embed",
"version": "11.1.0",
"version": "11.1.5",
"homepage": "https://ziping-liu-corporation.github.io/react-adobe-embed/#/home",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc