react-adobe-embed
Advanced tools
Comparing version 11.2.0 to 11.2.7
/* 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 c={clientId:d,divId:e};return(n||new window.AdobeDC.View(c)).previewFile({content:{location:{url:i}},metaData:o||a.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 r={clientId:d,divId:e};return(n||new window.AdobeDC.View(r)).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 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"})}; | ||
*/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)}; | ||
/** | ||
@@ -16,12 +16,6 @@ * @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,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("[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"!==o.previewConfig?.embedMode&&s(!0),d.current.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 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"}}; | ||
*/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"}}; | ||
// 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVhY3QtYWRvYmUtZW1iZWQuY2RuLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0= | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVhY3QtYWRvYmUtZW1iZWQuY2RuLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7In0= |
/* react-adobe-embed */ | ||
"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("[1mAdobe SDK Check[0m","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("[1mAdobe SDK Check[0m","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; | ||
"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== |
@@ -29,3 +29,3 @@ import React from "react"; | ||
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" })); | ||
"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)); | ||
}; | ||
@@ -40,2 +40,3 @@ /** | ||
const [adobePDFProgrammeInstalled, setAdobePDFProgrammeInstalled] = React.useState(false); | ||
const [scriptLoaderRef, setScriptLoaderRef] = React.useState(null); | ||
const [componentNeedsRendering, setComponentNeedsRendering] = React.useState(false); | ||
@@ -50,20 +51,40 @@ const [scriptViewerLoaded, setScriptViewerLoaded] = React.useState(false); | ||
}, [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 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) | ||
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") { | ||
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 (scriptExistsALready) { | ||
scriptExistsALready.setAttribute('data-testid', 'react-adobe-embed-handholding-adobe-api-loading-idiocy-reused'); | ||
if (props.previewConfig?.embedMode !== 'LIGHT_BOX') { | ||
setComponentNeedsRendering(true); | ||
} | ||
scriptExistsALready.current.setAttribute("data-testid", "react-adobe-embed-handholding-adobe-api-loading-idiocy-reused"); | ||
if (props.debug) | ||
console.info(`\x1b[1mAdobe SDK Check\x1b[0m`, 'Adobe SDK Already Loaded so Setting Flag for Rerender Needed'); | ||
} | ||
@@ -73,39 +94,12 @@ else { | ||
console.info(`\x1b[1mAdobe SDK Check\x1b[0m`, 'Initial Adobe SDK Load'); | ||
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 }); | ||
}; | ||
// 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)); | ||
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); | ||
} })); | ||
} | ||
} | ||
} | ||
}, [props.id, scriptViewerLoaded, adobePDFProgrammeInstalled]); | ||
}, [props.id, scriptViewerLoaded, adobePDFProgrammeInstalled, props.previewConfig?.viewSdkViewerScript, scriptLoaderRef]); | ||
const useHooksForCall = React[props?.useReactHookWhenCallingAdobeAPI || "useEffect"]; | ||
@@ -167,3 +161,4 @@ useHooksForCall(() => { | ||
}, [componentNeedsRendering, props]); | ||
return React.createElement(AdobeDiv, { ...props }); | ||
return React.createElement(AdobeDiv, { ...props }, | ||
React.createElement("div", { id: "adobe-pdf-viewer-sdk-script-loader" })); | ||
} | ||
@@ -170,0 +165,0 @@ export const DefaultConfigs = { |
{ | ||
"name": "react-adobe-embed", | ||
"version": "11.2.0", | ||
"version": "11.2.7", | ||
"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
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
2
91717
36
939