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 6.9.2026 to 7.0.0

2

dist/react-adobe-embed.cdn.js

@@ -1,1 +0,1 @@

(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(require("react"),require("react-dom/client")):"function"==typeof define&&define.amd?define(["react","react-dom/client"],b):(a="undefined"==typeof globalThis?a||self:globalThis,b(a.React,a.ReactDOM))})(this,function(a,b){"use strict";function c(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}function d({divId:a,viewerConfig:b,url:c,clientID:d,_fileMeta:e,_dcView:f}){const g=f||new window.AdobeDC.View({clientId:d,divId:a}),i=g.previewFile({content:{location:{url:c}},metaData:e||h.demoMetaData},b);return i}function e(a){return a.adobe_dc_view_sdk!==void 0}var f=c(a),g=c(b);const h={demoUrl:"https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf",staticDefaultConfig:{showAnnotationTools:!1,showLeftHandPanel:!1,showPageControls:!1,showDownloadPDF:!1,showPrintPDF:!1},staticDivId:"pdf-div",demoMetaData:{fileName:"Menu.pdf",id:"6d07d124 - ac85\u201343b3 - a867\u201336930f502ac6"}},i=a=>{const[b,c]=f["default"].useState(!1),[i,j]=f["default"].useState(null),k=f["default"].useCallback(()=>{const b=document.getElementById("adobe-pdf-viewer-script-"+a.id);if(b){const c=b.parentElement;g["default"].hydrateRoot(c,f["default"].createElement("script",{id:"adobe-pdf-viewer-script-"+a.id,async:!0,defer:!0,src:"https://documentservices.adobe.com/view-sdk/viewer.js"}))}else{const b=document.createElement("script");b.src="https://documentservices.adobe.com/view-sdk/viewer.js",b.async=!0,b.defer=!0,b.id="adobe-pdf-viewer-script-"+a.id;const d=document.createElement("script");g["default"].createRoot(d).render(f["default"].createElement("script",{src:"https://documentservices.adobe.com/view-sdk/viewer.js"}));const e=document.getElementById(a.id||h.staticDivId);e.appendChild(b),a.debug&&console.info("Adobe PDF Viewer Script Appended"),c(!0)}},[c]);return f["default"].useEffect(()=>{!1===b&&(!1===e(window)?k():c(!0)),b&&document.addEventListener("adobe_dc_view_sdk.ready",()=>{a.debug&&console.info("Adobe PDF Viewer SDK Ready Event");const b=a.id||h.staticDivId,c=document.getElementById(b);c&&"LIGHT_BOX"!==a.previewConfig?.embedMode?(a.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),d({divId:b,viewerConfig:a.previewConfig||h.staticDefaultConfig,url:a.url||h.demoUrl,clientID:a.clientId,_fileMeta:a.fileMeta})):"LIGHT_BOX"===a.previewConfig?.embedMode&&a.setDcViewer&&a.setDcViewer(i)})},[b]),f["default"].createElement("div",{id:a.id||h.staticDivId,className:a.className||"adobe-viewer-of-amazon-corporate-retaliations",style:a.style,title:a.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"})};(function(){window&&window.ReactViewAdobe||(window.ReactViewAdobe=i)})()});
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(require("react")):"function"==typeof define&&define.amd?define(["react"],b):(a="undefined"==typeof globalThis?a||self:globalThis,b(a.React))})(this,function(a){"use strict";function b(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}function c({divId:a,viewerConfig:b,url:c,clientID:d,_fileMeta:e,_dcView:g}){const h=g||new window.AdobeDC.View({clientId:d,divId:a}),i=h.previewFile({content:{location:{url:c}},metaData:e||f.demoMetaData},b);return i}function d(a){const[b,d]=e["default"].useState(!1),[h,i]=e["default"].useState(!1),j=e["default"][a?.useReactHookForAdobeAPIConfigs||"useMemo"],k=j(()=>{if(!0===b){const a=window.AdobeDC?.["View"];return a}},[b]),l=e["default"][a?.useReactHookWhenLoadingAdobeAPI||"useEffect"];l(()=>{if(!1===h){const c=document.querySelector(".react-adobe-embed-handholding-adobe-api-loading-idiocy");if(c)!1===b&&document.addEventListener("adobe_dc_view_sdk.ready",()=>{d(!0)}),i(!0);else{const b=document.createElement("script");b.setAttribute("data-adobe-pdf-id",a.id||f.staticDivId),b.setAttribute("class","react-adobe-embed-handholding-adobe-api-loading-idiocy"),b.src="https://documentcloud.adobe.com/view-sdk/viewer.js",b.async=!0,b.onload=()=>{i(!0)},document.body.appendChild(b)}}},[a.id,h,b]);const m=e["default"][a?.useReactHookWhenCallingAdobeAPI||"useEffect"];return m(()=>{!1===b&&!0===h&&document.addEventListener("adobe_dc_view_sdk.ready",()=>{d(!0)});!0===h&&!0===b&&(a=>{a.debug&&console.info("Adobe PDF Viewer SDK Ready Event",k,window.adobe_dc_view_sdk);const b=a.id||f.staticDivId,d=document.getElementById(b);d&&"LIGHT_BOX"!==a.previewConfig?.embedMode?(a.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),c({divId:b,viewerConfig:a.previewConfig||f.staticDefaultConfig,url:a.url||f.demoUrl,clientID:a.clientId,_fileMeta:a.fileMeta})):"LIGHT_BOX"===a.previewConfig?.embedMode&&a?.triggerAdobeDCViewRender&&c({divId:a.id||f.staticDivId,viewerConfig:a.previewConfig||f.staticDefaultConfig,url:a.url||f.demoUrl,clientID:a.clientId})})(a)},[b,h,a,k]),e["default"].createElement(g,{...a})}var e=b(a);const f={demoUrl:"https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf",staticDefaultConfig:{showAnnotationTools:!1,showLeftHandPanel:!1,showPageControls:!1,showDownloadPDF:!1,showPrintPDF:!1},staticDivId:"pdf-div",demoMetaData:{fileName:"Menu.pdf",id:"6d07d124 - ac85\u201343b3 - a867\u201336930f502ac6"}},g=a=>{const b=e["default"].useRef(document.getElementById(a.id||f.staticDivId));return e["default"].createElement("div",{ref:b,id:a.id||f.staticDivId,className:a.className||"adobe-viewer-of-amazon-corporate-retaliations",style:a.style,title:a.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"})};(function(){window&&window.ReactViewAdobe||(window.ReactViewAdobe=d)})()});

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),reactDom=require("react-dom");function _interopDefaultLegacy(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React),reactDom__default=_interopDefaultLegacy(reactDom);function createCommonjsModule(a,b){return b={exports:{}},a(b,b.exports),b.exports}var client=createCommonjsModule(function(a,b){{var d=reactDom__default["default"].__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;b.createRoot=function(a,b){d.usingClientEntryPoint=!0;try{return reactDom__default["default"].createRoot(a,b)}finally{d.usingClientEntryPoint=!1}},b.hydrateRoot=function(a,b,c){d.usingClientEntryPoint=!0;try{return reactDom__default["default"].hydrateRoot(a,b,c)}finally{d.usingClientEntryPoint=!1}}}});client.createRoot,client.hydrateRoot;const DefaultConfigs={demoUrl:"https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf",staticDefaultConfig:{showAnnotationTools:!1,showLeftHandPanel:!1,showPageControls:!1,showDownloadPDF:!1,showPrintPDF:!1},staticDivId:"pdf-div",demoMetaData:{fileName:"Menu.pdf",id:"6d07d124 - ac85\u201343b3 - a867\u201336930f502ac6"}};function previewFile({divId:a,viewerConfig:b,url:c,clientID:d,_fileMeta:e,_dcView:f}){const g=f||new window.AdobeDC.View({clientId:d,divId:a}),h=g.previewFile({content:{location:{url:c}},metaData:e||DefaultConfigs.demoMetaData},b);return h}const ReactViewAdobe=a=>{const[b,c]=React__default["default"].useState(!1),[d,e]=React__default["default"].useState(null),f=React__default["default"].useCallback(()=>{const b=document.getElementById("adobe-pdf-viewer-script-"+a.id);if(b){const c=b.parentElement;client.hydrateRoot(c,React__default["default"].createElement("script",{id:"adobe-pdf-viewer-script-"+a.id,async:!0,defer:!0,src:"https://documentservices.adobe.com/view-sdk/viewer.js"}))}else{const b=document.createElement("script");b.src="https://documentservices.adobe.com/view-sdk/viewer.js",b.async=!0,b.defer=!0,b.id="adobe-pdf-viewer-script-"+a.id;const d=document.createElement("script");client.createRoot(d).render(React__default["default"].createElement("script",{src:"https://documentservices.adobe.com/view-sdk/viewer.js"}));const e=document.getElementById(a.id||DefaultConfigs.staticDivId);e.appendChild(b),a.debug&&console.info("Adobe PDF Viewer Script Appended"),c(!0)}},[c]);return React__default["default"].useEffect(()=>{!1===b&&(!1===AdobeViewerGlobalExists(window)?f():c(!0)),b&&document.addEventListener("adobe_dc_view_sdk.ready",()=>{a.debug&&console.info("Adobe PDF Viewer SDK Ready Event");const b=a.id||DefaultConfigs.staticDivId,c=document.getElementById(b);c&&"LIGHT_BOX"!==a.previewConfig?.embedMode?(a.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),previewFile({divId:b,viewerConfig:a.previewConfig||DefaultConfigs.staticDefaultConfig,url:a.url||DefaultConfigs.demoUrl,clientID:a.clientId,_fileMeta:a.fileMeta})):"LIGHT_BOX"===a.previewConfig?.embedMode&&a.setDcViewer&&a.setDcViewer(d)})},[b]),React__default["default"].createElement("div",{id:a.id||DefaultConfigs.staticDivId,className:a.className||"adobe-viewer-of-amazon-corporate-retaliations",style:a.style,title:a.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"})};function AdobeViewerGlobalExists(a){return a.adobe_dc_view_sdk!==void 0}exports.AdobeViewerGlobalExists=AdobeViewerGlobalExists,exports.ReactViewAdobe=ReactViewAdobe,exports.previewFile=previewFile;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react");function _interopDefaultLegacy(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}var React__default=_interopDefaultLegacy(React);const DefaultConfigs={demoUrl:"https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf",staticDefaultConfig:{showAnnotationTools:!1,showLeftHandPanel:!1,showPageControls:!1,showDownloadPDF:!1,showPrintPDF:!1},staticDivId:"pdf-div",demoMetaData:{fileName:"Menu.pdf",id:"6d07d124 - ac85\u201343b3 - a867\u201336930f502ac6"}};function previewFile({divId:a,viewerConfig:b,url:c,clientID:d,_fileMeta:e,_dcView:f}){const g=f||new window.AdobeDC.View({clientId:d,divId:a}),h=g.previewFile({content:{location:{url:c}},metaData:e||DefaultConfigs.demoMetaData},b);return h}const AdobeDiv=a=>{const b=React__default["default"].useRef(document.getElementById(a.id||DefaultConfigs.staticDivId));return React__default["default"].createElement("div",{ref:b,id:a.id||DefaultConfigs.staticDivId,className:a.className||"adobe-viewer-of-amazon-corporate-retaliations",style:a.style,title:a.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"})};function ReactViewAdobe(a){const[b,c]=React__default["default"].useState(!1),[d,e]=React__default["default"].useState(!1),f=React__default["default"][a?.useReactHookForAdobeAPIConfigs||"useMemo"],g=f(()=>{if(!0===b){const a=window.AdobeDC?.["View"];return a}},[b]),h=React__default["default"][a?.useReactHookWhenLoadingAdobeAPI||"useEffect"];h(()=>{if(!1===d){const d=document.querySelector(".react-adobe-embed-handholding-adobe-api-loading-idiocy");if(d)!1===b&&document.addEventListener("adobe_dc_view_sdk.ready",()=>{c(!0)}),e(!0);else{const b=document.createElement("script");b.setAttribute("data-adobe-pdf-id",a.id||DefaultConfigs.staticDivId),b.setAttribute("class","react-adobe-embed-handholding-adobe-api-loading-idiocy"),b.src="https://documentcloud.adobe.com/view-sdk/viewer.js",b.async=!0,b.onload=()=>{e(!0)},document.body.appendChild(b)}}},[a.id,d,b]);const i=React__default["default"][a?.useReactHookWhenCallingAdobeAPI||"useEffect"];return i(()=>{!1===b&&!0===d&&document.addEventListener("adobe_dc_view_sdk.ready",()=>{c(!0)});!0===d&&!0===b&&(a=>{a.debug&&console.info("Adobe PDF Viewer SDK Ready Event",g,window.adobe_dc_view_sdk);const b=a.id||DefaultConfigs.staticDivId,c=document.getElementById(b);c&&"LIGHT_BOX"!==a.previewConfig?.embedMode?(a.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),previewFile({divId:b,viewerConfig:a.previewConfig||DefaultConfigs.staticDefaultConfig,url:a.url||DefaultConfigs.demoUrl,clientID:a.clientId,_fileMeta:a.fileMeta})):"LIGHT_BOX"===a.previewConfig?.embedMode&&a?.triggerAdobeDCViewRender&&previewFile({divId:a.id||DefaultConfigs.staticDivId,viewerConfig:a.previewConfig||DefaultConfigs.staticDefaultConfig,url:a.url||DefaultConfigs.demoUrl,clientID:a.clientId})})(a)},[b,d,a,g]),React__default["default"].createElement(AdobeDiv,{...a})}exports["default"]=ReactViewAdobe,exports.previewFile=previewFile;

@@ -1,1 +0,1 @@

(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],b):(a="undefined"==typeof globalThis?a||self:globalThis,b(a.ReactAdobeEmbed={},a.React,a.ReactDOM))})(this,function(a,b,c){"use strict";function d(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}function e({divId:a,viewerConfig:b,url:c,clientID:d,_fileMeta:e,_dcView:f}){const g=f||new window.AdobeDC.View({clientId:d,divId:a}),h=g.previewFile({content:{location:{url:c}},metaData:e||l.demoMetaData},b);return h}function f(a){return a.adobe_dc_view_sdk!==void 0}var g=d(b),j=d(c),k=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(a,b){{var d=j["default"].__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;b.createRoot=function(a,b){d.usingClientEntryPoint=!0;try{return j["default"].createRoot(a,b)}finally{d.usingClientEntryPoint=!1}},b.hydrateRoot=function(a,b,c){d.usingClientEntryPoint=!0;try{return j["default"].hydrateRoot(a,b,c)}finally{d.usingClientEntryPoint=!1}}}});k.createRoot,k.hydrateRoot;const l={demoUrl:"https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf",staticDefaultConfig:{showAnnotationTools:!1,showLeftHandPanel:!1,showPageControls:!1,showDownloadPDF:!1,showPrintPDF:!1},staticDivId:"pdf-div",demoMetaData:{fileName:"Menu.pdf",id:"6d07d124 - ac85\u201343b3 - a867\u201336930f502ac6"}};a.AdobeViewerGlobalExists=f,a.ReactViewAdobe=a=>{const[b,c]=g["default"].useState(!1),[d,h]=g["default"].useState(null),i=g["default"].useCallback(()=>{const b=document.getElementById("adobe-pdf-viewer-script-"+a.id);if(b){const c=b.parentElement;k.hydrateRoot(c,g["default"].createElement("script",{id:"adobe-pdf-viewer-script-"+a.id,async:!0,defer:!0,src:"https://documentservices.adobe.com/view-sdk/viewer.js"}))}else{const b=document.createElement("script");b.src="https://documentservices.adobe.com/view-sdk/viewer.js",b.async=!0,b.defer=!0,b.id="adobe-pdf-viewer-script-"+a.id;const d=document.createElement("script");k.createRoot(d).render(g["default"].createElement("script",{src:"https://documentservices.adobe.com/view-sdk/viewer.js"}));const e=document.getElementById(a.id||l.staticDivId);e.appendChild(b),a.debug&&console.info("Adobe PDF Viewer Script Appended"),c(!0)}},[c]);return g["default"].useEffect(()=>{!1===b&&(!1===f(window)?i():c(!0)),b&&document.addEventListener("adobe_dc_view_sdk.ready",()=>{a.debug&&console.info("Adobe PDF Viewer SDK Ready Event");const b=a.id||l.staticDivId,c=document.getElementById(b);c&&"LIGHT_BOX"!==a.previewConfig?.embedMode?(a.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),e({divId:b,viewerConfig:a.previewConfig||l.staticDefaultConfig,url:a.url||l.demoUrl,clientID:a.clientId,_fileMeta:a.fileMeta})):"LIGHT_BOX"===a.previewConfig?.embedMode&&a.setDcViewer&&a.setDcViewer(d)})},[b]),g["default"].createElement("div",{id:a.id||l.staticDivId,className:a.className||"adobe-viewer-of-amazon-corporate-retaliations",style:a.style,title:a.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"})},a.previewFile=e,Object.defineProperty(a,"__esModule",{value:!0})});
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],b):(a="undefined"==typeof globalThis?a||self:globalThis,b(a.ReactAdobeEmbed={},a.React))})(this,function(a,b){"use strict";function c(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}function d({divId:a,viewerConfig:b,url:c,clientID:d,_fileMeta:e,_dcView:g}){const h=g||new window.AdobeDC.View({clientId:d,divId:a}),i=h.previewFile({content:{location:{url:c}},metaData:e||f.demoMetaData},b);return i}var e=c(b);const f={demoUrl:"https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf",staticDefaultConfig:{showAnnotationTools:!1,showLeftHandPanel:!1,showPageControls:!1,showDownloadPDF:!1,showPrintPDF:!1},staticDivId:"pdf-div",demoMetaData:{fileName:"Menu.pdf",id:"6d07d124 - ac85\u201343b3 - a867\u201336930f502ac6"}},g=a=>{const b=e["default"].useRef(document.getElementById(a.id||f.staticDivId));return e["default"].createElement("div",{ref:b,id:a.id||f.staticDivId,className:a.className||"adobe-viewer-of-amazon-corporate-retaliations",style:a.style,title:a.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"})};a["default"]=function(a){const[b,c]=e["default"].useState(!1),[h,i]=e["default"].useState(!1),j=e["default"][a?.useReactHookForAdobeAPIConfigs||"useMemo"],k=j(()=>{if(!0===b){const a=window.AdobeDC?.["View"];return a}},[b]),l=e["default"][a?.useReactHookWhenLoadingAdobeAPI||"useEffect"];l(()=>{if(!1===h){const d=document.querySelector(".react-adobe-embed-handholding-adobe-api-loading-idiocy");if(d)!1===b&&document.addEventListener("adobe_dc_view_sdk.ready",()=>{c(!0)}),i(!0);else{const b=document.createElement("script");b.setAttribute("data-adobe-pdf-id",a.id||f.staticDivId),b.setAttribute("class","react-adobe-embed-handholding-adobe-api-loading-idiocy"),b.src="https://documentcloud.adobe.com/view-sdk/viewer.js",b.async=!0,b.onload=()=>{i(!0)},document.body.appendChild(b)}}},[a.id,h,b]);const m=e["default"][a?.useReactHookWhenCallingAdobeAPI||"useEffect"];return m(()=>{!1===b&&!0===h&&document.addEventListener("adobe_dc_view_sdk.ready",()=>{c(!0)});!0===h&&!0===b&&(a=>{a.debug&&console.info("Adobe PDF Viewer SDK Ready Event",k,window.adobe_dc_view_sdk);const b=a.id||f.staticDivId,c=document.getElementById(b);c&&"LIGHT_BOX"!==a.previewConfig?.embedMode?(a.debug&&console.info("Adobe PDF Viewer SDK Ready Rendering"),d({divId:b,viewerConfig:a.previewConfig||f.staticDefaultConfig,url:a.url||f.demoUrl,clientID:a.clientId,_fileMeta:a.fileMeta})):"LIGHT_BOX"===a.previewConfig?.embedMode&&a?.triggerAdobeDCViewRender&&d({divId:a.id||f.staticDivId,viewerConfig:a.previewConfig||f.staticDefaultConfig,url:a.url||f.demoUrl,clientID:a.clientId})})(a)},[b,h,a,k]),e["default"].createElement(g,{...a})},a.previewFile=d,Object.defineProperty(a,"__esModule",{value:!0})});
import React from "react";
import ReactDOM from "react-dom/client";
const DefaultConfigs = {

@@ -24,3 +23,4 @@ demoUrl: "https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf",

const dcView = _dcView || new window.AdobeDC.View(config);
{ }
{
}
const previewFilePromise = dcView.previewFile({

@@ -36,66 +36,88 @@ content: {

}
export const ReactViewAdobe = (props) => {
const AdobeDiv = (props) => {
const ref = React.useRef(document.getElementById(props.id || DefaultConfigs.staticDivId));
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" }));
};
/**
* @description - ReactViewAdobe component which is a wrapper around Adobe PDF Viewer SDK that allows for
* rendering PDFs via Adobe's PDF Engine. Ensures that Adobe Embed API Services are
* compartmentalized and fully encapsulated and configured within a rendered page. Not sure why Adobe
* Embed API does not inherently do this. See ReactViewAdobeProps for more details.
*/
export default function ReactViewAdobe(props) {
const [adobePDFProgrammeInstalled, setAdobePDFProgrammeInstalled] = React.useState(false);
const [adobeDCView, setAdobeDCView] = React.useState(null);
const appendAdobeScriptLoader = React.useCallback(() => {
const scriptExists = document.getElementById("adobe-pdf-viewer-script-" + props.id);
if (scriptExists) {
const rootEleme = scriptExists.parentElement;
ReactDOM.hydrateRoot(rootEleme, React.createElement("script", { id: "adobe-pdf-viewer-script-" + props.id, async: true, defer: true, src: "https://documentservices.adobe.com/view-sdk/viewer.js" }));
const [scriptViewerLoaded, setScriptViewerLoaded] = React.useState(false);
const useHooksForConfig = React[props?.useReactHookForAdobeAPIConfigs || "useMemo"];
const adobeDCView = useHooksForConfig(() => {
if (adobePDFProgrammeInstalled === true) {
const adobedcview = window["AdobeDC"]?.["View"];
return adobedcview;
}
else {
const script = document.createElement("script");
script.src = "https://documentservices.adobe.com/view-sdk/viewer.js";
script.async = true;
script.defer = true;
script.id = "adobe-pdf-viewer-script-" + props.id;
const p = document.createElement("script");
ReactDOM.createRoot(p).render(React.createElement("script", { src: "https://documentservices.adobe.com/view-sdk/viewer.js" }));
const pdfdiv = document.getElementById(props.id || DefaultConfigs.staticDivId);
pdfdiv.appendChild(script);
if (props.debug)
console.info("Adobe PDF Viewer Script Appended");
setAdobePDFProgrammeInstalled(true);
}
}, [
setAdobePDFProgrammeInstalled
]);
React.useEffect(() => {
if (adobePDFProgrammeInstalled === false) {
if (AdobeViewerGlobalExists(window) === false) {
appendAdobeScriptLoader();
}, [adobePDFProgrammeInstalled]);
const useHooksForLoading = React[props?.useReactHookWhenLoadingAdobeAPI || "useEffect"];
(useHooksForLoading)(() => {
if (scriptViewerLoaded === false) {
const scriptExistsALready = document.querySelector(".react-adobe-embed-handholding-adobe-api-loading-idiocy");
if (scriptExistsALready) {
if (adobePDFProgrammeInstalled === false) {
document.addEventListener("adobe_dc_view_sdk.ready", () => {
setAdobePDFProgrammeInstalled(true);
});
}
setScriptViewerLoaded(true);
}
else {
setAdobePDFProgrammeInstalled(true);
const script = document.createElement("script");
script.setAttribute("data-adobe-pdf-id", props.id || DefaultConfigs.staticDivId);
script.setAttribute("class", "react-adobe-embed-handholding-adobe-api-loading-idiocy");
script.src = "https://documentcloud.adobe.com/view-sdk/viewer.js";
script.async = true;
script.onload = () => {
setScriptViewerLoaded(true);
};
document.body.appendChild(script);
}
}
if (adobePDFProgrammeInstalled) {
}, [props.id, scriptViewerLoaded, adobePDFProgrammeInstalled]);
const useHooksForCall = React[props?.useReactHookWhenCallingAdobeAPI || "useEffect"];
useHooksForCall(() => {
if (adobePDFProgrammeInstalled === false && scriptViewerLoaded === true) {
document.addEventListener("adobe_dc_view_sdk.ready", () => {
setAdobePDFProgrammeInstalled(true);
});
}
const callAdobeApi = (props) => {
if (props.debug)
console.info("Adobe PDF Viewer SDK Ready Event", adobeDCView, window["adobe_dc_view_sdk"]);
const divId = props.id || DefaultConfigs.staticDivId;
const divElm = document.getElementById(divId);
if (divElm && props.previewConfig?.embedMode !== "LIGHT_BOX") {
if (props.debug)
console.info("Adobe PDF Viewer SDK Ready Event");
const divId = props.id || DefaultConfigs.staticDivId;
const divElm = document.getElementById(divId);
if (divElm && props.previewConfig?.embedMode !== 'LIGHT_BOX') {
if (props.debug)
console.info("Adobe PDF Viewer SDK Ready Rendering");
console.info("Adobe PDF Viewer SDK Ready Rendering");
previewFile({
divId,
viewerConfig: props.previewConfig || DefaultConfigs.staticDefaultConfig,
url: props.url || DefaultConfigs.demoUrl,
clientID: props.clientId,
_fileMeta: props.fileMeta,
});
}
else if (props.previewConfig?.embedMode === "LIGHT_BOX") {
if (props?.triggerAdobeDCViewRender) {
previewFile({
divId,
divId: props.id || DefaultConfigs.staticDivId,
viewerConfig: props.previewConfig || DefaultConfigs.staticDefaultConfig,
url: props.url || DefaultConfigs.demoUrl,
clientID: props.clientId,
_fileMeta: props.fileMeta,
});
}
else if (props.previewConfig?.embedMode === 'LIGHT_BOX') {
props.setDcViewer && props.setDcViewer(adobeDCView);
}
});
}
};
if (scriptViewerLoaded === true && adobePDFProgrammeInstalled === true) {
callAdobeApi(props);
}
}, [adobePDFProgrammeInstalled]);
return (React.createElement("div", { 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" }));
};
export function AdobeViewerGlobalExists(window) {
return window["adobe_dc_view_sdk"] !== undefined;
}, [adobePDFProgrammeInstalled, scriptViewerLoaded, props, adobeDCView]);
return React.createElement(AdobeDiv, { ...props });
}
;

@@ -1,2 +0,2 @@

import { ReactViewAdobe } from "index";
import ReactViewAdobe from './index';
(function () {

@@ -3,0 +3,0 @@ if (window && window['ReactViewAdobe']) {

{
"name": "react-adobe-embed",
"version": "6.9.2026",
"version": "7.0.0",
"homepage": "https://aboutamazon.me/react-adobe-embed",

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

@@ -5,3 +5,3 @@ [![wakatime](https://wakatime.com/badge/github/ZIPING-LIU-CORPORATION/react-adobe-embed.svg)](https://wakatime.com/badge/github/ZIPING-LIU-CORPORATION/react-adobe-embed)

## Changes
## [ADOBE PDF EMBED API](https://developer.adobe.com/document-services/apis/pdf-embed/) is a Great Tool for Displaying PDF's with rich features,

@@ -22,8 +22,4 @@

import React from 'react';
/**
* *Import of ReactDOM/client is required as the ReactAdobeEmbed*
* uses this and expects its existance as an external
*/
import ReactDOM from 'react-dom/client';
import {ReactViewAdobe} from 'react-adobe-embed'
import ReactViewAdobe from 'react-adobe-embed'

@@ -35,5 +31,5 @@ const App = () => {

title="A Story of Wages"
url="https://storage.googleapis.com/laotzu/awslegal/"
url={"https://storage.googleapis.com/laotzu/awslegal/"
+ "notarized/EXHIBIT_"
+ "A_Story%20of%20WagesOFNONPAIDAges_encrypted_.pdf"
+ "A_Story%20of%20WagesOFNONPAIDAges_encrypted_.pdf"}
/**

@@ -58,4 +54,49 @@ * This is required and must be unique because adobe devs are coupled like that

```
#### 2. As the current implementation of creating [LIGHT_BOX](https://acrobatservices.adobe.com/view-sdk-demo/index.html#/view/LIGHT_BOX/Bodea%20Brochure.pdf) embed pdf's is quite complicated, you can view a live code example of how to use LIGHT_BOX mode with react-adobe-embed [here](https://codesandbox.io/p/sandbox/react-adobe-embed-pdf-galleria-showcase-yq5zz6?file=%2Fsrc%2FSections%2FMain.tsx%3A65%2C79)
##### Lightbox Example
```ts
import React from 'react';
import ReactViewAdobe from 'react-adobe-embed'
const App = () => {
const [viewDocumentTriggered, setViewDocumentTriggered] = React.useState(false);
return (
<div>
<button onClick={(e)=>{
e.preventDefault();
setViewDocumentTriggered(true);
}}>
View Document
</button>
<ReactViewAdobe
triggerAdobeDCViewRender={viewDocumentTriggered}
clientId="6e19a1dc2e3e43fc9fe0109f928bdf71"
title="A Story of Wages"
url={"https://storage.googleapis.com/laotzu/awslegal/"
+ "notarized/EXHIBIT_"
+ "A_Story%20of%20WagesOFNONPAIDAges_encrypted_.pdf"}
/**
* This is required and must be unique because adobe devs are coupled like that
*/
id="exhbit-a-pdf"
fileMeta={{
fileName: "A Story of Wages"
}}
previewConfig={{
defaultViewMode: "FIT_WIDTH",
showAnnotationTools: false,
showPageControls: false,
showDownloadPDF: false
}}
style={{
height: "50vh"
}}
/>
</div>
)
}
```
#### 2. ~~As the current implementation of creating [LIGHT_BOX](https://acrobatservices.adobe.com/view-sdk-demo/index.html#/view/LIGHT_BOX/Bodea%20Brochure.pdf) embed pdf's is quite complicated~~, you can view a live code example of how to use LIGHT_BOX mode with react-adobe-embed [here](https://codesandbox.io/p/sandbox/react-adobe-embed-pdf-galleria-showcase-yq5zz6?file=%2Fsrc%2FSections%2FMain.tsx%3A65%2C79)
#### 3. Note on adobe sdk `<script>` tag:

@@ -62,0 +103,0 @@ - You don't need to worry about handling outside script tags. The react wrapper handles any script downloading. Simple call the React Component as shown above.

@@ -1,2 +0,2 @@

import React, { Dispatch } from "react";
import React from "react";
export type PreviewFileConfig = {

@@ -7,15 +7,15 @@ showZoomControl: boolean;

/**
* This variable takes a string value of "FIT_WIDTH", "FIT_PAGE", "TWO_COLUMN" or "TWO_COLUMN_FIT_PAGE".
1. FIT_WIDTH: Expands the page horizontally to the full width of the document pane.
2. FIT_PAGE: Displays the entire page in the current view pane.
3. TWO_COLUMN: Displays two pages of the PDF side by side in the current view pane.
4. TWO_COLUMN_FIT_PAGE: Displays two pages of the PDF side by side where the entire two pages are displayed in
the current view pane. Note that end users can also toggle the view mode via the Fit Width, Fit Page
or Two-Column button on the right-hand panel.
In addition to these, there are two other view modes which are supported only in mobile browsers:
1. CONTINUOUS: This mode displays all the document pages one after the other and users can easily navigate through the pages by scrolling up or down.
2. SINGLE_PAGE: This mode displays only a single document page at a time and doesn’t show any adjoining page.
Users can use the swipe gesture to navigate to other pages which will be displayed one at a time.
*/
* This variable takes a string value of "FIT_WIDTH", "FIT_PAGE", "TWO_COLUMN" or "TWO_COLUMN_FIT_PAGE".
1. FIT_WIDTH: Expands the page horizontally to the full width of the document pane.
2. FIT_PAGE: Displays the entire page in the current view pane.
3. TWO_COLUMN: Displays two pages of the PDF side by side in the current view pane.
4. TWO_COLUMN_FIT_PAGE: Displays two pages of the PDF side by side where the entire two pages are displayed in
the current view pane. Note that end users can also toggle the view mode via the Fit Width, Fit Page
or Two-Column button on the right-hand panel.
In addition to these, there are two other view modes which are supported only in mobile browsers:
1. CONTINUOUS: This mode displays all the document pages one after the other and users can easily navigate through the pages by scrolling up or down.
2. SINGLE_PAGE: This mode displays only a single document page at a time and doesn’t show any adjoining page.
Users can use the swipe gesture to navigate to other pages which will be displayed one at a time.
*/
defaultViewMode: "FIT_WIDTH" | "FIT_PAGE" | "TWO_COLUMN" | "TWO_COLUMN_FIT_PAGE" | "CONTINUOUS" | "SINGLE_PAGE";

@@ -66,16 +66,38 @@ enableFormFilling: boolean;

}): any;
export declare const ReactViewAdobe: (props: {
id?: string | undefined;
setDcViewer?: React.Dispatch<any> | undefined;
className?: string | undefined;
title?: string | undefined;
style?: React.CSSProperties | undefined;
previewConfig?: Partial<PreviewFileConfig> | undefined;
export type ReactHooks = {
[key in (Extract<keyof typeof React, `use${string}`>)]: [
] extends Parameters<typeof React[key]> ? never : key extends 'useReducer' ? never : key extends 'useDeferredValue' ? never : typeof React[key] extends (factory: React.EffectCallback, deps?: React.DependencyList | undefined) => void ? key : typeof React[key] extends (factory: () => any, deps: React.DependencyList | undefined) => void ? key : never;
}[Extract<keyof typeof React, `use${string}`>];
/**
* @description - props for ReactViewAdobe component which is a wrapper around Adobe PDF Viewer SDK
* @param useReactHookWhenLoadingAdobeAPI - provides customizability in specifying a certain type of React Hook to use when loading the Adobe Embed API SDK into the DOM
* @param useReactHookWhenCallingAdobeAPI - provides customizability in specifying a certain type of React Hook to use when calling the Adobe Embed API Services
* @param useReactHookForAdobeAPIConfigs - provides customizability in specifying a certain type of React Hook to use for creating parameters or inputs required by Adobe Embed API Services
* @param triggerAdobeDCViewRender - when true, a call to Adobe Embed API Services is made that also ensures that a React Render is triggered in tandem. This is particularly useful when using Adobe Embed API Services in a Lightbox mode, in which
* expects that by default, the PDF is only rendered after a form of trigger or user interaction. E.g., for instance, if there is a button that is clicked which then toggles a React
* state variable, passing this variable here will allow for the button to hence trigger rendering of the Lightbox mode PDF.
*/
export type ReactViewAdobeProps = {
id?: string;
useReactHookWhenLoadingAdobeAPI?: ReactHooks;
useReactHookWhenCallingAdobeAPI?: ReactHooks;
useReactHookForAdobeAPIConfigs?: ReactHooks;
triggerAdobeDCViewRender?: boolean;
className?: string;
title?: string;
style?: React.CSSProperties;
previewConfig?: Partial<PreviewFileConfig>;
url: string;
clientId: string;
fileMeta?: {
[key: string]: any;
} | undefined;
debug?: boolean | undefined;
}) => JSX.Element;
export declare function AdobeViewerGlobalExists(window: Window): boolean;
[key: string | "fileName" | "id"]: any;
};
debug?: boolean;
};
/**
* @description - ReactViewAdobe component which is a wrapper around Adobe PDF Viewer SDK that allows for
* rendering PDFs via Adobe's PDF Engine. Ensures that Adobe Embed API Services are
* compartmentalized and fully encapsulated and configured within a rendered page. Not sure why Adobe
* Embed API does not inherently do this. See ReactViewAdobeProps for more details.
*/
export default function ReactViewAdobe(props: ReactViewAdobeProps): JSX.Element;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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