Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-pdf-viewer/get-file

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf-viewer/get-file - npm Package Compare versions

Comparing version 3.3.0 to 3.3.1

2

lib/cjs/get-file.js

@@ -28,3 +28,3 @@ 'use strict';

/*! *****************************************************************************
/******************************************************************************
Copyright (c) Microsoft Corporation.

@@ -31,0 +31,0 @@

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@react-pdf-viewer/core");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var o=n(e),r=function(){return r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r.apply(this,arguments)},a=function(){return o.createElement(t.Icon,{size:16},o.createElement("path",{d:"M11.5 19.5L11.5 5"}),o.createElement("path",{d:"M17 14L11.5 19.5 6 14"}),o.createElement("path",{d:"M17.5.5h5a1,1,0,0,1,1,1v21a1,1,0,0,1-1,1h-5"}),o.createElement("path",{d:"M6.5.5h-5a1,1,0,0,0-1,1v21a1,1,0,0,0,1,1h5"}))},i={left:0,top:8},c=function(e){var n=e.onClick,r=o.useContext(t.LocalizationContext).l10n,c=r&&r.download?r.download.download:"Download";return o.createElement(t.Tooltip,{ariaControlsSuffix:"get-file",position:t.Position.BottomCenter,target:o.createElement(t.MinimalButton,{ariaLabel:c,testId:"get-file__download-button",onClick:n},o.createElement(a,null)),content:function(){return c},offset:i})},l=function(e,t){var n=document.createElement("a");n.style.display="none",n.href=e,n.setAttribute("download",t),document.body.appendChild(n),n.click(),document.body.removeChild(n)},u=function(e,t,n){var o=URL.createObjectURL(new Blob([e],{type:n}));l(o,t),o&&URL.revokeObjectURL(o)},f=function(e,t){e.getData().then((function(e){/iphone|ipod|ipad/i.test(navigator.userAgent)&&!/CriOS/i.test(navigator.userAgent)?u(e,t,"application/octet-stream"):/iphone|ipod|ipad/i.test(navigator.userAgent)&&/CriOS/i.test(navigator.userAgent)?l("data:application/pdf;base64,".concat(function(e){return btoa(Array(e.length).fill("").map((function(t,n){return String.fromCharCode(e[n])})).join(""))}(e)),t):u(e,t,"application/pdf")}))},d=function(e){var t=e.children,n=e.fileNameGenerator,r=e.store,a=o.useState(r.get("file")),i=a[0],l=a[1],u=o.useState(r.get("doc")),d=u[0],s=u[1],p=function(e){s(e)},m=function(e){l(e)};o.useEffect((function(){return r.subscribe("doc",p),r.subscribe("file",m),function(){r.subscribe("doc",p),r.unsubscribe("file",m)}}),[]);return(t||function(e){return o.createElement(c,{onClick:e.onClick})})({onClick:function(){d&&i&&f(d,n(i))}})},s=function(e){var n=e.onClick,r=o.useContext(t.LocalizationContext).l10n,i=r&&r.download?r.download.download:"Download";return o.createElement(t.MenuItem,{icon:o.createElement(a,null),testId:"get-file__download-menu",onClick:n},i)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */exports.DownloadIcon=a,exports.getFilePlugin=function(e){var n=o.useMemo((function(){return t.createStore({})}),[]),a=function(e){return e.name?(t=e.name,(n=t.split("/").pop())?n.split("#")[0].split("?")[0]:t):"document.pdf";var t,n},i=function(t){return o.createElement(d,r({},t,{fileNameGenerator:e&&e.fileNameGenerator||a,store:n}))};return{onDocumentLoad:function(e){n.update("doc",e.doc),n.update("file",e.file)},Download:i,DownloadButton:function(){return o.createElement(i,null,(function(e){return o.createElement(c,r({},e))}))},DownloadMenuItem:function(e){return o.createElement(i,null,(function(t){return o.createElement(s,{onClick:function(){t.onClick(),e.onClick()}})}))}}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@react-pdf-viewer/core");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var o=n(e),r=function(){return r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r.apply(this,arguments)},a=function(){return o.createElement(t.Icon,{size:16},o.createElement("path",{d:"M11.5 19.5L11.5 5"}),o.createElement("path",{d:"M17 14L11.5 19.5 6 14"}),o.createElement("path",{d:"M17.5.5h5a1,1,0,0,1,1,1v21a1,1,0,0,1-1,1h-5"}),o.createElement("path",{d:"M6.5.5h-5a1,1,0,0,0-1,1v21a1,1,0,0,0,1,1h5"}))},i={left:0,top:8},c=function(e){var n=e.onClick,r=o.useContext(t.LocalizationContext).l10n,c=r&&r.download?r.download.download:"Download";return o.createElement(t.Tooltip,{ariaControlsSuffix:"get-file",position:t.Position.BottomCenter,target:o.createElement(t.MinimalButton,{ariaLabel:c,testId:"get-file__download-button",onClick:n},o.createElement(a,null)),content:function(){return c},offset:i})},l=function(e,t){var n=document.createElement("a");n.style.display="none",n.href=e,n.setAttribute("download",t),document.body.appendChild(n),n.click(),document.body.removeChild(n)},u=function(e,t,n){var o=URL.createObjectURL(new Blob([e],{type:n}));l(o,t),o&&URL.revokeObjectURL(o)},f=function(e,t){e.getData().then((function(e){/iphone|ipod|ipad/i.test(navigator.userAgent)&&!/CriOS/i.test(navigator.userAgent)?u(e,t,"application/octet-stream"):/iphone|ipod|ipad/i.test(navigator.userAgent)&&/CriOS/i.test(navigator.userAgent)?l("data:application/pdf;base64,".concat(function(e){return btoa(Array(e.length).fill("").map((function(t,n){return String.fromCharCode(e[n])})).join(""))}(e)),t):u(e,t,"application/pdf")}))},d=function(e){var t=e.children,n=e.fileNameGenerator,r=e.store,a=o.useState(r.get("file")),i=a[0],l=a[1],u=o.useState(r.get("doc")),d=u[0],s=u[1],p=function(e){s(e)},m=function(e){l(e)};o.useEffect((function(){return r.subscribe("doc",p),r.subscribe("file",m),function(){r.subscribe("doc",p),r.unsubscribe("file",m)}}),[]);return(t||function(e){return o.createElement(c,{onClick:e.onClick})})({onClick:function(){d&&i&&f(d,n(i))}})},s=function(e){var n=e.onClick,r=o.useContext(t.LocalizationContext).l10n,i=r&&r.download?r.download.download:"Download";return o.createElement(t.MenuItem,{icon:o.createElement(a,null),testId:"get-file__download-menu",onClick:n},i)};exports.DownloadIcon=a,exports.getFilePlugin=function(e){var n=o.useMemo((function(){return t.createStore({})}),[]),a=function(e){return e.name?(t=e.name,(n=t.split("/").pop())?n.split("#")[0].split("?")[0]:t):"document.pdf";var t,n},i=function(t){return o.createElement(d,r({},t,{fileNameGenerator:e&&e.fileNameGenerator||a,store:n}))};return{onDocumentLoad:function(e){n.update("doc",e.doc),n.update("file",e.file)},Download:i,DownloadButton:function(){return o.createElement(i,null,(function(e){return o.createElement(c,r({},e))}))},DownloadMenuItem:function(e){return o.createElement(i,null,(function(t){return o.createElement(s,{onClick:function(){t.onClick(),e.onClick()}})}))}}};
{
"name": "@react-pdf-viewer/get-file",
"version": "3.3.0",
"version": "3.3.1",
"description": "A React component to view a PDF document",

@@ -36,3 +36,3 @@ "license": "https://react-pdf-viewer.dev/license",

"dependencies": {
"@react-pdf-viewer/core": "3.3.0"
"@react-pdf-viewer/core": "3.3.1"
},

@@ -50,3 +50,3 @@ "peerDependencies": {

},
"gitHead": "fc1c00e3802d538f2f96b6a241e995493a601f61"
"gitHead": "3cffac5b07d0745738913f28797527363c0b0594"
}
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