adalo-pdf-viewer 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # Adalo PDF Viewer Plugin
2
+
3
+ Display any PDF document from a URL directly inside your Adalo app — works on **iOS**, **Android**, and **Web**.
4
+
5
+ ---
6
+
7
+ ## Features
8
+
9
+ - Renders PDFs from any public URL or Adalo File field
10
+ - Native rendering on iOS & Android (react-native-pdf)
11
+ - Browser-native iframe on desktop web, Google Docs viewer on mobile web
12
+ - Pinch-to-zoom and scroll (mobile)
13
+ - Optional Previous / Next page controls with page counter
14
+ - Fit-to-width or fit-page mode
15
+ - Configurable colors, loading text, and error text
16
+ - Action triggers: `onLoadComplete`, `onPageChange`, `onError`
17
+
18
+ ---
19
+
20
+ ## Project Structure
21
+
22
+ ```
23
+ adalo-pdf-viewer/
24
+ ├── adalo.json ← Library config & marketplace listing
25
+ ├── package.json ← npm package
26
+ ├── logo.png ← Marketplace logo (add your own, 90x90px min)
27
+ ├── scripts/
28
+ │ ├── install_ios.sh ← Adds iOS CocoaPods
29
+ │ └── install_android.sh ← Adds Android Gradle dependency
30
+ └── src/
31
+ └── components/
32
+ └── PDFViewer/
33
+ ├── manifest.json ← Adalo prop definitions
34
+ ├── index.js ← Mobile component (iOS + Android)
35
+ ├── index.web.js ← Web component
36
+ └── icon.png ← Component thumbnail (312x268px min)
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Setup & Local Development
42
+
43
+ ### 1. Prerequisites
44
+
45
+ - Node.js >= 10.2
46
+ - macOS or Linux
47
+ - Adalo account with Developer Mode enabled (`adalo.com` → Settings → Developer Mode)
48
+
49
+ ### 2. Install dependencies
50
+
51
+ ```bash
52
+ cd adalo-pdf-viewer
53
+ npm install
54
+ npm install -g @adalo/cli
55
+ ```
56
+
57
+ ### 3. Link your Adalo account
58
+
59
+ ```bash
60
+ adalo login
61
+ ```
62
+
63
+ ### 4. Start the dev server
64
+
65
+ ```bash
66
+ adalo start
67
+ ```
68
+
69
+ This starts a local component server. Open any Adalo app in your browser, go to the Component Panel, scroll to "Local Components" and you'll see PDFViewer available to drag in.
70
+
71
+ ### 5. Add required assets
72
+
73
+ Before publishing, you need two image files:
74
+ - `logo.png` — your library logo (min 90×90px, square)
75
+ - `src/components/PDFViewer/icon.png` — component thumbnail shown in the panel (min 312×268px)
76
+
77
+ ---
78
+
79
+ ## Publishing to the Marketplace
80
+
81
+ ### 1. Build the library
82
+
83
+ ```bash
84
+ adalo build
85
+ ```
86
+
87
+ ### 2. Publish
88
+
89
+ ```bash
90
+ adalo publish
91
+ ```
92
+
93
+ This will prompt you to:
94
+ - Confirm your library name and description (from `adalo.json`)
95
+ - Choose public or private
96
+ - Set a price (0 = free)
97
+
98
+ After submission, Adalo reviews the component (usually 1–5 business days). They check:
99
+ - Cross-platform compatibility (iOS, Android, Web)
100
+ - Standards compliance (single-purpose, configurable, no crashes)
101
+ - Logo and icon quality
102
+
103
+ ### 3. After approval
104
+
105
+ Your library appears in the Adalo Component Marketplace. Users can install it and use the PDFViewer component in any of their apps.
106
+
107
+ ---
108
+
109
+ ## How App Makers Use It
110
+
111
+ 1. Install **PDF Viewer** from the Component Marketplace
112
+ 2. Drag the **PDF Viewer** component onto any screen
113
+ 3. In the left panel, set **PDF URL** to a static URL or a dynamic File field from their database
114
+ 4. Optionally configure colors, controls, and action triggers
115
+ 5. Done — PDFs render on all platforms with no code
116
+
117
+ ---
118
+
119
+ ## Dependencies
120
+
121
+ | Package | Version | Purpose |
122
+ |---|---|---|
123
+ | react-native-pdf | 6.7.3 | Native PDF rendering on iOS & Android |
124
+ | react-native-blob-util | 0.19.4 | Required peer dep for react-native-pdf |
125
+
126
+ Web rendering uses the browser's built-in PDF engine (no extra libraries).
127
+
128
+ ---
129
+
130
+ ## Platform Notes
131
+
132
+ | Platform | Rendering Method | Zoom | Page Nav |
133
+ |---|---|---|---|
134
+ | iOS | Native (PDFKit) | Pinch-to-zoom | Controls + gesture |
135
+ | Android | Native (PdfRenderer) | Pinch-to-zoom | Controls + gesture |
136
+ | Desktop Web | Browser iframe | Browser native | Browser native |
137
+ | Mobile Web | Google Docs Viewer | Pinch-to-zoom | Swipe |
138
+
139
+ ---
140
+
141
+ ## Troubleshooting
142
+
143
+ **PDF shows blank on mobile:** Make sure the URL is publicly accessible (not behind auth). Adalo File fields generate public URLs automatically.
144
+
145
+ **"Could not load PDF" error:** Check that the URL ends in `.pdf` or the server returns `Content-Type: application/pdf`.
146
+
147
+ **Web shows loading spinner forever:** Some servers block iframe embedding via `X-Frame-Options`. In that case, the PDF needs to be hosted on a server that allows embedding (e.g. Adalo storage, AWS S3 with public access).
148
+
149
+ ---
150
+
151
+ ## License
152
+
153
+ MIT © Seif Shinnawy
package/adalo.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "displayName": "PDF Viewer",
3
+ "author": "Seif Shinnawy",
4
+ "description": "Display any PDF document from a URL directly in your Adalo app — works on iOS, Android, and Web.",
5
+ "details": "**PDF Viewer** lets you embed any PDF file into your Adalo app using a URL from your database or a static link.\n\n**Features:**\n- Supports iOS, Android, and Web\n- Pinch-to-zoom and scroll through pages\n- Configurable loading indicator text and color\n- Fit-to-width or fit-to-page mode\n- Optional page navigation controls (Previous / Next)\n- Action triggers: onLoadComplete, onPageChange, onError\n- Fully customizable background and control colors\n\n**Use cases:** Contracts, invoices, menus, reports, instruction manuals, e-books — any PDF your users need to read inside your app.",
6
+ "logo": "./logo.png",
7
+ "price": 29.99,
8
+ "supportURL": "https://forum.adalo.com",
9
+ "demoAppURL": "https://previewer.adalo.com/0aeafdf7-3598-4886-8882-f5ebc8ac3fab",
10
+ "requiresThirdPartySubscription": false,
11
+ "components": [
12
+ {
13
+ "name": "PDFViewer",
14
+ "manifest": "./src/components/PDFViewer/manifest.json"
15
+ }
16
+ ],
17
+ "iosInstallScript": "./scripts/install_ios.ts",
18
+ "androidInstallScript": "./scripts/install_android.ts"
19
+ }
package/dist/editor.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see editor.js.LICENSE.txt */
2
+ (()=>{"use strict";const e={n:t=>{const r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{if(Array.isArray(r))for(var n=0;n<r.length;){var o=r[n++],a=r[n++];e.o(t,o)?0===a&&n++:0===a?Object.defineProperty(t,o,{enumerable:!0,value:r[n++]}):Object.defineProperty(t,o,{enumerable:!0,get:a})}else for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{components:()=>x,config:()=>k});const r=window.React;var n=e.n(r);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach(function(t){m(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function l(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var l=n&&n.prototype instanceof s?n:s,d=Object.create(l.prototype);return c(d,"_invoke",function(r,n,o){var a,l,c,s=0,d=o||[],u=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,r){return a=t,l=0,c=e,p.n=r,i}};function f(r,n){for(l=r,c=n,t=0;!u&&s&&!o&&t<d.length;t++){var o,a=d[t],f=p.p,h=a[2];r>3?(o=h===n)&&(c=a[(l=a[4])?5:(l=3,3)],a[4]=a[5]=e):a[0]<=f&&((o=r<2&&f<a[1])?(l=0,p.v=n,p.n=a[1]):f<h&&(o=r<3||a[0]>n||n>h)&&(a[4]=r,a[5]=n,p.n=h,l=0))}if(o||r>1)return i;throw u=!0,n}return function(o,d,h){if(s>1)throw TypeError("Generator is already running");for(u&&1===d&&f(d,h),l=d,c=h;(t=l<2?e:c)||!u;){a||(l?l<3?(l>1&&(p.n=-1),f(l,c)):p.n=c:p.v=c);try{if(s=2,a){if(l||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,l<2&&(l=0)}else 1===l&&(t=a.return)&&t.call(a),l<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),l=1);a=e}else if((t=(u=p.n<0)?c:r.call(n,p))!==i)break}catch(t){a=e,l=1,c=t}finally{s=1}}return{value:t,done:u}}}(r,o,a),!0),d}var i={};function s(){}function d(){}function u(){}t=Object.getPrototypeOf;var p=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),f=u.prototype=s.prototype=Object.create(p);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,c(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=u,c(f,"constructor",u),c(u,"constructor",d),d.displayName="GeneratorFunction",c(u,o,"GeneratorFunction"),c(f),c(f,o,"Generator"),c(f,n,function(){return this}),c(f,"toString",function(){return"[object Generator]"}),(l=function(){return{w:a,m:h}})()}function c(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,r,n){function a(t,r){c(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},c(e,t,r,n)}function s(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){s(a,n,o,i,l,"next",e)}function l(e){s(a,n,o,i,l,"throw",e)}i(void 0)})}}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function m(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var b=function(){return"undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream},g=function(){return n().createElement("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none"},n().createElement("path",{d:"M8.5 10.5V1.5",stroke:"white",strokeWidth:"1.6",strokeLinecap:"round"}),n().createElement("path",{d:"M5.5 4.5l3-3 3 3",stroke:"white",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),n().createElement("path",{d:"M4.5 7.5H3a1 1 0 00-1 1v6a1 1 0 001 1h11a1 1 0 001-1v-6a1 1 0 00-1-1h-1.5",stroke:"white",strokeWidth:"1.6",strokeLinecap:"round"}))},v=function(){return n().createElement("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none"},n().createElement("circle",{cx:"7.5",cy:"7.5",r:"5",stroke:"white",strokeWidth:"1.6"}),n().createElement("path",{d:"M11.5 11.5l3 3",stroke:"white",strokeWidth:"1.6",strokeLinecap:"round"}))},w=function(){return n().createElement("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none"},n().createElement("path",{d:"M1.5 1.5l10 10M11.5 1.5l-10 10",stroke:"rgba(255,255,255,0.7)",strokeWidth:"1.6",strokeLinecap:"round"}))},x={PDFViewer:function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),m(r=function(e,t,r){return t=f(t),function(e,t){if(t&&("object"==o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,p()?Reflect.construct(t,r||[],f(e).constructor):t.apply(e,r))}(this,t,[e]),"handleLoad",function(){var e=r.props.onLoadComplete;r.setState({loading:!1,error:!1}),e&&e(0)}),m(r,"handleError",function(){var e=r.props.onError;r.setState({loading:!1,error:!0}),e&&e()}),m(r,"handleShare",d(l().m(function e(){var t,n,o,a,i,c,s;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if((t=r.props.pdfUrl)&&!r.state.sharing){e.n=1;break}return e.a(2);case 1:if(r.setState({sharing:!0}),e.p=2,n=!1,!navigator.share){e.n=13;break}return e.p=3,e.n=4,fetch(t);case 4:return o=e.v,e.n=5,o.blob();case 5:if(a=e.v,i=decodeURIComponent(t.split("/").pop().split("?")[0])||"document",c=i.endsWith(".pdf")?i:i+".pdf",s=new File([a],c,{type:"application/pdf"}),!navigator.canShare||!navigator.canShare({files:[s]})){e.n=7;break}return e.n=6,navigator.share({files:[s],title:"PDF Document"});case 6:n=!0;case 7:e.n=9;break;case 8:e.p=8,e.v;case 9:if(n){e.n=13;break}return e.p=10,e.n=11,navigator.share({url:t,title:"PDF Document"});case 11:n=!0,e.n=13;break;case 12:e.p=12,"AbortError"===e.v.name&&(n=!0);case 13:n||window.open(t,"_blank");case 14:return e.p=14,r.setState({sharing:!1}),e.f(14);case 15:return e.a(2)}},e,null,[[10,12],[3,8],[2,,14,15]])}))),m(r,"handleSearchToggle",function(){r.setState(function(e){return{searchActive:!e.searchActive,searchQuery:""}},function(){!r.state.searchActive&&r.iframeRef&&(r.iframeRef.src=r.buildEmbedUrl(r.props.pdfUrl))})}),m(r,"handleSearchChange",function(e){r.setState({searchQuery:e.target.value})}),m(r,"handleSearchSubmit",function(e){e.preventDefault();var t=r.props.pdfUrl,n=r.state.searchQuery;if(t&&r.iframeRef){var o=r.buildEmbedUrl(t),a=o.includes("#")?"&":"#";r.iframeRef.src=n?"".concat(o).concat(a,"search=").concat(encodeURIComponent(n)):o}}),m(r,"buildEmbedUrl",function(e){if(!e)return null;if(!b()){var t=e.includes("#")?"&":"#";return"".concat(e).concat(t,"zoom=FitH")}return e}),r.state={loading:!0,error:!1,searchActive:!1,searchQuery:"",sharing:!1},r.containerRef=null,r.iframeRef=null,function(){if("undefined"!=typeof document){var e="adalo-pdf-viewer-styles";if(!document.getElementById(e)){var t=document.createElement("style");t.id=e,t.textContent="\n @keyframes adalo-pdf-spin {\n to { transform: rotate(360deg); }\n }\n @keyframes adalo-pdf-fadein {\n from { opacity: 0; transform: translateY(6px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes adalo-pdf-toolbar-in {\n from { opacity: 0; transform: translateX(-50%) translateY(12px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n ",document.head.appendChild(t)}}}(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(t,e),r=t,(a=[{key:"render",value:function(){var e=this,t=this.props,r=t.pdfUrl,o=t.backgroundColor,a=t.controlColor,l=t.loadingText,c=t.loadingTextColor,s=t.errorText,d=t.errorTextColor,u=t._height,p=t._width,f=this.state,h=f.loading,m=f.error,y=f.searchActive,x=f.searchQuery,k=f.sharing,P=a||"#0066CC",E=o||"#FFFFFF",F="undefined"!=typeof navigator&&/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),S={position:"relative",display:"flex",flexDirection:"column",width:p?"".concat(p,"px"):"100%",height:u?"".concat(u,"px"):"100%",backgroundColor:E,overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},O={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:E,zIndex:2,animation:"adalo-pdf-fadein 0.2s ease both"},C={position:"absolute",bottom:18,left:"50%",transform:"translateX(-50%)",zIndex:10,display:"flex",flexDirection:"row",alignItems:"center",gap:2,background:"rgba(20, 20, 22, 0.72)",backdropFilter:"blur(28px) saturate(1.8)",WebkitBackdropFilter:"blur(28px) saturate(1.8)",borderRadius:40,border:"0.5px solid rgba(255,255,255,0.16)",boxShadow:["0 8px 32px rgba(0,0,0,0.28)","inset 0 1px 0 rgba(255,255,255,0.10)","inset 0 -1px 0 rgba(0,0,0,0.20)"].join(", "),padding:"5px 5px",animation:"adalo-pdf-toolbar-in 0.3s cubic-bezier(0.34,1.56,0.64,1) both",maxWidth:"calc(100% - 32px)"},j=function(e){return{width:38,height:38,borderRadius:19,border:"none",background:e?"rgba(255,255,255,0.14)":"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,flexShrink:0,transition:"background 0.12s"}};if(!r)return n().createElement("div",{ref:function(t){e.containerRef=t},style:S},n().createElement("div",{style:i(i({},O),{},{border:"1.5px dashed",borderColor:P+"55",borderRadius:10,top:4,left:4,right:4,bottom:4})},n().createElement("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",style:{marginBottom:12,opacity:.75}},n().createElement("rect",{x:"8",y:"4",width:"28",height:"36",rx:"3",fill:P,opacity:"0.12"}),n().createElement("rect",{x:"8",y:"4",width:"28",height:"36",rx:"3",stroke:P,strokeWidth:"1.5"}),n().createElement("path",{d:"M28 4v9h9",stroke:P,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n().createElement("path",{d:"M16 20h16M16 26h10",stroke:P,strokeWidth:"1.5",strokeLinecap:"round"})),n().createElement("span",{style:{fontSize:15,fontWeight:600,color:"#1A1A1A",marginBottom:4}},"PDF Viewer"),n().createElement("span",{style:{fontSize:13,color:c||"#8E8E93",textAlign:"center",lineHeight:"18px"}},"Set a PDF URL to preview")));var T,D,L,R,W,_=this.buildEmbedUrl(r);return n().createElement("div",{ref:function(t){e.containerRef=t},style:S},h&&n().createElement("div",{style:O},n().createElement("div",{style:{width:36,height:36,borderRadius:"50%",border:"3px solid ".concat(P,"22"),borderTopColor:P,animation:"adalo-pdf-spin 0.75s linear infinite",marginBottom:14}}),n().createElement("span",{style:{fontSize:13,color:c||"#8E8E93"}},l||"Loading PDF…")),m&&n().createElement("div",{style:O},n().createElement("div",{style:{width:44,height:44,borderRadius:"50%",backgroundColor:(d||"#FF3B30")+"15",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:12}},n().createElement("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none"},n().createElement("circle",{cx:"11",cy:"11",r:"10",stroke:d||"#FF3B30",strokeWidth:"1.5"}),n().createElement("path",{d:"M11 7v5M11 15v.5",stroke:d||"#FF3B30",strokeWidth:"1.75",strokeLinecap:"round"}))),n().createElement("span",{style:{fontSize:14,color:d||"#FF3B30",textAlign:"center",lineHeight:"20px",maxWidth:220}},s||"Could not load PDF.\nPlease check the URL.")),!m&&(T=b(),D=parseInt(p||"400",10)||400,L=parseInt(u||"687",10)||687,R=D/612,W=Math.round(L/R),n().createElement("div",{style:{position:"relative",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden",minHeight:0}},n().createElement("iframe",{ref:function(t){e.iframeRef=t},src:_,onLoad:e.handleLoad,onError:e.handleError,title:"PDF Viewer",allow:"fullscreen",style:T?{display:"block",border:"none",width:"".concat(612,"px"),height:"".concat(W,"px"),transform:"scale(".concat(R,")"),transformOrigin:"0 0"}:{display:"block",border:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0}}))),F&&!h&&!m&&n().createElement("div",{style:C},n().createElement("button",{onClick:this.handleSearchToggle,style:j(!1),title:y?"Close search":"Search PDF","aria-label":y?"Close search":"Search PDF"},y?n().createElement(w,null):n().createElement(v,null)),y&&n().createElement("form",{onSubmit:this.handleSearchSubmit,style:{display:"flex",alignItems:"center",overflow:"hidden"}},n().createElement("input",{type:"text",autoFocus:!0,placeholder:"Search…",value:x,onChange:this.handleSearchChange,style:{width:160,height:30,background:"rgba(255,255,255,0.10)",border:"none",borderRadius:8,color:"white",fontSize:15,padding:"0 10px",outline:"none",caretColor:"white"}})),!y&&n().createElement("div",{style:{width:.5,height:22,background:"rgba(255,255,255,0.18)",margin:"0 2px",flexShrink:0}}),n().createElement("button",{onClick:this.handleShare,disabled:k,style:i(i({},j(!1)),{},{opacity:k?.5:1,cursor:k?"default":"pointer"}),title:"Share PDF","aria-label":"Share PDF"},k?n().createElement("div",{style:{width:16,height:16,borderRadius:"50%",border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"white",animation:"adalo-pdf-spin 0.7s linear infinite"}}):n().createElement(g,null))))}}])&&u(r.prototype,a),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,a}(r.Component)},k={displayName:"PDF Viewer",author:"Seif Shinnawy",description:"Display any PDF document from a URL directly in your Adalo app — works on iOS, Android, and Web.",details:"**PDF Viewer** lets you embed any PDF file into your Adalo app using a URL from your database or a static link.\n\n**Features:**\n- Supports iOS, Android, and Web\n- Pinch-to-zoom and scroll through pages\n- Configurable loading indicator text and color\n- Fit-to-width or fit-to-page mode\n- Optional page navigation controls (Previous / Next)\n- Action triggers: onLoadComplete, onPageChange, onError\n- Fully customizable background and control colors\n\n**Use cases:** Contracts, invoices, menus, reports, instruction manuals, e-books — any PDF your users need to read inside your app.",logo:"./logo.png",price:29.99,supportURL:"https://forum.adalo.com",demoAppURL:"https://previewer.adalo.com/0aeafdf7-3598-4886-8882-f5ebc8ac3fab",requiresThirdPartySubscription:!1,iosInstallScript:"./scripts/install_ios.ts",androidInstallScript:"./scripts/install_android.ts",name:"adalo-pdf-viewer",version:"1.2.2",components:[{name:"PDFViewer",displayName:"PDF Viewer",icon:"./icon.png",defaultWidth:320,defaultHeight:480,props:[{name:"pdfUrl",displayName:"PDF URL",type:"text",helpText:"Link to a PDF file — can be a static URL or a dynamic value from your database (e.g. a File field)."},{name:"fitWidth",displayName:"Fit to Width",type:"boolean",default:!0,helpText:"When ON, the PDF scales to fill the component width. When OFF, the full page fits inside the component."},{name:"showControls",displayName:"Show Page Controls",type:"boolean",default:!0,helpText:"Show Previous / Next buttons and the current page number at the bottom."},{name:"backgroundColor",displayName:"Background Color",type:"color",default:"@background"},{name:"controlColor",displayName:"Control Color",type:"color",default:"@primary",enabled:{showControls:!0}},{name:"controlTextColor",displayName:"Control Text Color",type:"color",default:"#FFFFFF",enabled:{showControls:!0}},{name:"loadingText",displayName:"Loading Text",type:"text",default:"Loading PDF…",helpText:"Text shown while the PDF is being fetched."},{name:"loadingTextColor",displayName:"Loading Text Color",type:"color",default:"@text"},{name:"errorText",displayName:"Error Text",type:"text",default:"Could not load PDF. Please check the URL.",helpText:"Text shown when the PDF fails to load."},{name:"errorTextColor",displayName:"Error Text Color",type:"color",default:"#E53E3E"},{name:"onLoadComplete",displayName:"On Load Complete",type:"action",helpText:"Fires when the PDF has finished loading.",arguments:[{type:"number",displayName:"Total Pages"}]},{name:"onPageChange",displayName:"On Page Change",type:"action",helpText:"Fires when the user navigates to a different page.",arguments:[{type:"number",displayName:"Current Page"},{type:"number",displayName:"Total Pages"}]},{name:"onError",displayName:"On Error",type:"action",helpText:"Fires when the PDF fails to load."}],resizeX:!0,resizeY:!0}]};((window.protonLibraries=window.protonLibraries||{})["adalo-pdf-viewer"]=window.protonLibraries["adalo-pdf-viewer"]||{})["1.2.2"]=t})();
@@ -0,0 +1 @@
1
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
Binary file
@@ -0,0 +1,9 @@
1
+ import {
2
+ PDFViewer
3
+ } from '../../src/components/PDFViewer/index.js'
4
+
5
+ export const components = {
6
+ PDFViewer
7
+ }
8
+
9
+ export const config = {"displayName":"PDF Viewer","author":"Seif Shinnawy","description":"Display any PDF document from a URL directly in your Adalo app — works on iOS, Android, and Web.","details":"**PDF Viewer** lets you embed any PDF file into your Adalo app using a URL from your database or a static link.\n\n**Features:**\n- Supports iOS, Android, and Web\n- Pinch-to-zoom and scroll through pages\n- Configurable loading indicator text and color\n- Fit-to-width or fit-to-page mode\n- Optional page navigation controls (Previous / Next)\n- Action triggers: onLoadComplete, onPageChange, onError\n- Fully customizable background and control colors\n\n**Use cases:** Contracts, invoices, menus, reports, instruction manuals, e-books — any PDF your users need to read inside your app.","logo":"./logo.png","price":29.99,"supportURL":"https://forum.adalo.com","demoAppURL":"https://previewer.adalo.com/0aeafdf7-3598-4886-8882-f5ebc8ac3fab","requiresThirdPartySubscription":false,"iosInstallScript":"./scripts/install_ios.ts","androidInstallScript":"./scripts/install_android.ts","name":"adalo-pdf-viewer","version":"1.2.2","components":[{"name":"PDFViewer","displayName":"PDF Viewer","icon":"./icon.png","defaultWidth":320,"defaultHeight":480,"props":[{"name":"pdfUrl","displayName":"PDF URL","type":"text","helpText":"Link to a PDF file — can be a static URL or a dynamic value from your database (e.g. a File field)."},{"name":"fitWidth","displayName":"Fit to Width","type":"boolean","default":true,"helpText":"When ON, the PDF scales to fill the component width. When OFF, the full page fits inside the component."},{"name":"showControls","displayName":"Show Page Controls","type":"boolean","default":true,"helpText":"Show Previous / Next buttons and the current page number at the bottom."},{"name":"backgroundColor","displayName":"Background Color","type":"color","default":"@background"},{"name":"controlColor","displayName":"Control Color","type":"color","default":"@primary","enabled":{"showControls":true}},{"name":"controlTextColor","displayName":"Control Text Color","type":"color","default":"#FFFFFF","enabled":{"showControls":true}},{"name":"loadingText","displayName":"Loading Text","type":"text","default":"Loading PDF…","helpText":"Text shown while the PDF is being fetched."},{"name":"loadingTextColor","displayName":"Loading Text Color","type":"color","default":"@text"},{"name":"errorText","displayName":"Error Text","type":"text","default":"Could not load PDF. Please check the URL.","helpText":"Text shown when the PDF fails to load."},{"name":"errorTextColor","displayName":"Error Text Color","type":"color","default":"#E53E3E"},{"name":"onLoadComplete","displayName":"On Load Complete","type":"action","helpText":"Fires when the PDF has finished loading.","arguments":[{"type":"number","displayName":"Total Pages"}]},{"name":"onPageChange","displayName":"On Page Change","type":"action","helpText":"Fires when the user navigates to a different page.","arguments":[{"type":"number","displayName":"Current Page"},{"type":"number","displayName":"Total Pages"}]},{"name":"onError","displayName":"On Error","type":"action","helpText":"Fires when the PDF fails to load."}],"resizeX":true,"resizeY":true}]}
@@ -0,0 +1 @@
1
+ export { PDFViewer as PDFViewer, } from '../../src/components/PDFViewer/index.js'
package/dist/logo.png ADDED
Binary file
@@ -0,0 +1 @@
1
+ {"PDFViewer":{"displayName":"PDF Viewer","defaultWidth":320,"defaultHeight":480,"resizeX":true,"resizeY":true,"icon":"./icon.png","props":[{"name":"pdfUrl","displayName":"PDF URL","type":"text","helpText":"Link to a PDF file — can be a static URL or a dynamic value from your database (e.g. a File field)."},{"name":"fitWidth","displayName":"Fit to Width","type":"boolean","default":true,"helpText":"When ON, the PDF scales to fill the component width. When OFF, the full page fits inside the component."},{"name":"showControls","displayName":"Show Page Controls","type":"boolean","default":true,"helpText":"Show Previous / Next buttons and the current page number at the bottom."},{"name":"backgroundColor","displayName":"Background Color","type":"color","default":"@background"},{"name":"controlColor","displayName":"Control Color","type":"color","default":"@primary","enabled":{"showControls":true}},{"name":"controlTextColor","displayName":"Control Text Color","type":"color","default":"#FFFFFF","enabled":{"showControls":true}},{"name":"loadingText","displayName":"Loading Text","type":"text","default":"Loading PDF…","helpText":"Text shown while the PDF is being fetched."},{"name":"loadingTextColor","displayName":"Loading Text Color","type":"color","default":"@text"},{"name":"errorText","displayName":"Error Text","type":"text","default":"Could not load PDF. Please check the URL.","helpText":"Text shown when the PDF fails to load."},{"name":"errorTextColor","displayName":"Error Text Color","type":"color","default":"#E53E3E"},{"name":"onLoadComplete","displayName":"On Load Complete","type":"action","helpText":"Fires when the PDF has finished loading.","arguments":[{"type":"number","displayName":"Total Pages"}]},{"name":"onPageChange","displayName":"On Page Change","type":"action","helpText":"Fires when the user navigates to a different page.","arguments":[{"type":"number","displayName":"Current Page"},{"type":"number","displayName":"Total Pages"}]},{"name":"onError","displayName":"On Error","type":"action","helpText":"Fires when the PDF fails to load."}],"name":"PDFViewer"}}
@@ -0,0 +1,2 @@
1
+ /*! For license information please see runtime.js.LICENSE.txt */
2
+ (()=>{"use strict";const e={n:t=>{const r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{if(Array.isArray(r))for(var n=0;n<r.length;){var o=r[n++],i=r[n++];e.o(t,o)?0===i&&n++:0===i?Object.defineProperty(t,o,{enumerable:!0,value:r[n++]}):Object.defineProperty(t,o,{enumerable:!0,get:i})}else for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{PDFViewer:()=>k});const r=window.React;var n=e.n(r);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach(function(t){b(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function c(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof s?n:s,u=Object.create(c.prototype);return l(u,"_invoke",function(r,n,o){var i,c,l,s=0,u=o||[],d=!1,f={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return i=t,c=0,l=e,f.n=r,a}};function p(r,n){for(c=r,l=n,t=0;!d&&s&&!o&&t<u.length;t++){var o,i=u[t],p=f.p,h=i[2];r>3?(o=h===n)&&(l=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=r<2&&p<i[1])?(c=0,f.v=n,f.n=i[1]):p<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,f.n=h,c=0))}if(o||r>1)return a;throw d=!0,n}return function(o,u,h){if(s>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,h),c=u,l=h;(t=c<2?e:l)||!d;){i||(c?c<3?(c>1&&(f.n=-1),p(c,l)):f.n=l:f.v=l);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(d=f.n<0)?l:r.call(n,f))!==a)break}catch(t){i=e,c=1,l=t}finally{s=1}}return{value:t,done:d}}}(r,o,i),!0),u}var a={};function s(){}function u(){}function d(){}t=Object.getPrototypeOf;var f=[][n]?t(t([][n]())):(l(t={},n,function(){return this}),t),p=d.prototype=s.prototype=Object.create(f);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,l(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return u.prototype=d,l(p,"constructor",d),l(d,"constructor",u),u.displayName="GeneratorFunction",l(d,o,"GeneratorFunction"),l(p),l(p,o,"Generator"),l(p,n,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(c=function(){return{w:i,m:h}})()}function l(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}l=function(e,t,r,n){function i(t,r){l(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},l(e,t,r,n)}function s(e,t,r,n,o,i,a){try{var c=e[i](a),l=c.value}catch(e){return void r(e)}c.done?t(l):Promise.resolve(l).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){s(i,n,o,a,c,"next",e)}function c(e){s(i,n,o,a,c,"throw",e)}a(void 0)})}}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,m(n.key),n)}}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function b(e,t,r){return(t=m(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var y=function(){return"undefined"!=typeof navigator&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream},g=function(){return n().createElement("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none"},n().createElement("path",{d:"M8.5 10.5V1.5",stroke:"white",strokeWidth:"1.6",strokeLinecap:"round"}),n().createElement("path",{d:"M5.5 4.5l3-3 3 3",stroke:"white",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),n().createElement("path",{d:"M4.5 7.5H3a1 1 0 00-1 1v6a1 1 0 001 1h11a1 1 0 001-1v-6a1 1 0 00-1-1h-1.5",stroke:"white",strokeWidth:"1.6",strokeLinecap:"round"}))},v=function(){return n().createElement("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none"},n().createElement("circle",{cx:"7.5",cy:"7.5",r:"5",stroke:"white",strokeWidth:"1.6"}),n().createElement("path",{d:"M11.5 11.5l3 3",stroke:"white",strokeWidth:"1.6",strokeLinecap:"round"}))},w=function(){return n().createElement("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none"},n().createElement("path",{d:"M1.5 1.5l10 10M11.5 1.5l-10 10",stroke:"rgba(255,255,255,0.7)",strokeWidth:"1.6",strokeLinecap:"round"}))},k=function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),b(r=function(e,t,r){return t=p(t),function(e,t){if(t&&("object"==o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,r||[],p(e).constructor):t.apply(e,r))}(this,t,[e]),"handleLoad",function(){var e=r.props.onLoadComplete;r.setState({loading:!1,error:!1}),e&&e(0)}),b(r,"handleError",function(){var e=r.props.onError;r.setState({loading:!1,error:!0}),e&&e()}),b(r,"handleShare",u(c().m(function e(){var t,n,o,i,a,l,s;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:if((t=r.props.pdfUrl)&&!r.state.sharing){e.n=1;break}return e.a(2);case 1:if(r.setState({sharing:!0}),e.p=2,n=!1,!navigator.share){e.n=13;break}return e.p=3,e.n=4,fetch(t);case 4:return o=e.v,e.n=5,o.blob();case 5:if(i=e.v,a=decodeURIComponent(t.split("/").pop().split("?")[0])||"document",l=a.endsWith(".pdf")?a:a+".pdf",s=new File([i],l,{type:"application/pdf"}),!navigator.canShare||!navigator.canShare({files:[s]})){e.n=7;break}return e.n=6,navigator.share({files:[s],title:"PDF Document"});case 6:n=!0;case 7:e.n=9;break;case 8:e.p=8,e.v;case 9:if(n){e.n=13;break}return e.p=10,e.n=11,navigator.share({url:t,title:"PDF Document"});case 11:n=!0,e.n=13;break;case 12:e.p=12,"AbortError"===e.v.name&&(n=!0);case 13:n||window.open(t,"_blank");case 14:return e.p=14,r.setState({sharing:!1}),e.f(14);case 15:return e.a(2)}},e,null,[[10,12],[3,8],[2,,14,15]])}))),b(r,"handleSearchToggle",function(){r.setState(function(e){return{searchActive:!e.searchActive,searchQuery:""}},function(){!r.state.searchActive&&r.iframeRef&&(r.iframeRef.src=r.buildEmbedUrl(r.props.pdfUrl))})}),b(r,"handleSearchChange",function(e){r.setState({searchQuery:e.target.value})}),b(r,"handleSearchSubmit",function(e){e.preventDefault();var t=r.props.pdfUrl,n=r.state.searchQuery;if(t&&r.iframeRef){var o=r.buildEmbedUrl(t),i=o.includes("#")?"&":"#";r.iframeRef.src=n?"".concat(o).concat(i,"search=").concat(encodeURIComponent(n)):o}}),b(r,"buildEmbedUrl",function(e){if(!e)return null;if(!y()){var t=e.includes("#")?"&":"#";return"".concat(e).concat(t,"zoom=FitH")}return e}),r.state={loading:!0,error:!1,searchActive:!1,searchQuery:"",sharing:!1},r.containerRef=null,r.iframeRef=null,function(){if("undefined"!=typeof document){var e="adalo-pdf-viewer-styles";if(!document.getElementById(e)){var t=document.createElement("style");t.id=e,t.textContent="\n @keyframes adalo-pdf-spin {\n to { transform: rotate(360deg); }\n }\n @keyframes adalo-pdf-fadein {\n from { opacity: 0; transform: translateY(6px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes adalo-pdf-toolbar-in {\n from { opacity: 0; transform: translateX(-50%) translateY(12px); }\n to { opacity: 1; transform: translateX(-50%) translateY(0); }\n }\n ",document.head.appendChild(t)}}}(),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(t,e),r=t,(i=[{key:"render",value:function(){var e=this,t=this.props,r=t.pdfUrl,o=t.backgroundColor,i=t.controlColor,c=t.loadingText,l=t.loadingTextColor,s=t.errorText,u=t.errorTextColor,d=t._height,f=t._width,p=this.state,h=p.loading,b=p.error,m=p.searchActive,k=p.searchQuery,x=p.sharing,E=i||"#0066CC",S=o||"#FFFFFF",O="undefined"!=typeof navigator&&/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent),P={position:"relative",display:"flex",flexDirection:"column",width:f?"".concat(f,"px"):"100%",height:d?"".concat(d,"px"):"100%",backgroundColor:S,overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},j={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:S,zIndex:2,animation:"adalo-pdf-fadein 0.2s ease both"},F={position:"absolute",bottom:18,left:"50%",transform:"translateX(-50%)",zIndex:10,display:"flex",flexDirection:"row",alignItems:"center",gap:2,background:"rgba(20, 20, 22, 0.72)",backdropFilter:"blur(28px) saturate(1.8)",WebkitBackdropFilter:"blur(28px) saturate(1.8)",borderRadius:40,border:"0.5px solid rgba(255,255,255,0.16)",boxShadow:["0 8px 32px rgba(0,0,0,0.28)","inset 0 1px 0 rgba(255,255,255,0.10)","inset 0 -1px 0 rgba(0,0,0,0.20)"].join(", "),padding:"5px 5px",animation:"adalo-pdf-toolbar-in 0.3s cubic-bezier(0.34,1.56,0.64,1) both",maxWidth:"calc(100% - 32px)"},C=function(e){return{width:38,height:38,borderRadius:19,border:"none",background:e?"rgba(255,255,255,0.14)":"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,flexShrink:0,transition:"background 0.12s"}};if(!r)return n().createElement("div",{ref:function(t){e.containerRef=t},style:P},n().createElement("div",{style:a(a({},j),{},{border:"1.5px dashed",borderColor:E+"55",borderRadius:10,top:4,left:4,right:4,bottom:4})},n().createElement("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",style:{marginBottom:12,opacity:.75}},n().createElement("rect",{x:"8",y:"4",width:"28",height:"36",rx:"3",fill:E,opacity:"0.12"}),n().createElement("rect",{x:"8",y:"4",width:"28",height:"36",rx:"3",stroke:E,strokeWidth:"1.5"}),n().createElement("path",{d:"M28 4v9h9",stroke:E,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n().createElement("path",{d:"M16 20h16M16 26h10",stroke:E,strokeWidth:"1.5",strokeLinecap:"round"})),n().createElement("span",{style:{fontSize:15,fontWeight:600,color:"#1A1A1A",marginBottom:4}},"PDF Viewer"),n().createElement("span",{style:{fontSize:13,color:l||"#8E8E93",textAlign:"center",lineHeight:"18px"}},"Set a PDF URL to preview")));var R,D,_,T,B,M=this.buildEmbedUrl(r);return n().createElement("div",{ref:function(t){e.containerRef=t},style:P},h&&n().createElement("div",{style:j},n().createElement("div",{style:{width:36,height:36,borderRadius:"50%",border:"3px solid ".concat(E,"22"),borderTopColor:E,animation:"adalo-pdf-spin 0.75s linear infinite",marginBottom:14}}),n().createElement("span",{style:{fontSize:13,color:l||"#8E8E93"}},c||"Loading PDF…")),b&&n().createElement("div",{style:j},n().createElement("div",{style:{width:44,height:44,borderRadius:"50%",backgroundColor:(u||"#FF3B30")+"15",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:12}},n().createElement("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none"},n().createElement("circle",{cx:"11",cy:"11",r:"10",stroke:u||"#FF3B30",strokeWidth:"1.5"}),n().createElement("path",{d:"M11 7v5M11 15v.5",stroke:u||"#FF3B30",strokeWidth:"1.75",strokeLinecap:"round"}))),n().createElement("span",{style:{fontSize:14,color:u||"#FF3B30",textAlign:"center",lineHeight:"20px",maxWidth:220}},s||"Could not load PDF.\nPlease check the URL.")),!b&&(R=y(),D=parseInt(f||"400",10)||400,_=parseInt(d||"687",10)||687,T=D/612,B=Math.round(_/T),n().createElement("div",{style:{position:"relative",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden",minHeight:0}},n().createElement("iframe",{ref:function(t){e.iframeRef=t},src:M,onLoad:e.handleLoad,onError:e.handleError,title:"PDF Viewer",allow:"fullscreen",style:R?{display:"block",border:"none",width:"".concat(612,"px"),height:"".concat(B,"px"),transform:"scale(".concat(T,")"),transformOrigin:"0 0"}:{display:"block",border:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0}}))),O&&!h&&!b&&n().createElement("div",{style:F},n().createElement("button",{onClick:this.handleSearchToggle,style:C(!1),title:m?"Close search":"Search PDF","aria-label":m?"Close search":"Search PDF"},m?n().createElement(w,null):n().createElement(v,null)),m&&n().createElement("form",{onSubmit:this.handleSearchSubmit,style:{display:"flex",alignItems:"center",overflow:"hidden"}},n().createElement("input",{type:"text",autoFocus:!0,placeholder:"Search…",value:k,onChange:this.handleSearchChange,style:{width:160,height:30,background:"rgba(255,255,255,0.10)",border:"none",borderRadius:8,color:"white",fontSize:15,padding:"0 10px",outline:"none",caretColor:"white"}})),!m&&n().createElement("div",{style:{width:.5,height:22,background:"rgba(255,255,255,0.18)",margin:"0 2px",flexShrink:0}}),n().createElement("button",{onClick:this.handleShare,disabled:x,style:a(a({},C(!1)),{},{opacity:x?.5:1,cursor:x?"default":"pointer"}),title:"Share PDF","aria-label":"Share PDF"},x?n().createElement("div",{style:{width:16,height:16,borderRadius:"50%",border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"white",animation:"adalo-pdf-spin 0.7s linear infinite"}}):n().createElement(g,null))))}}])&&d(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i}(r.Component);(window.protonRuntime=window.protonRuntime||{})["adalo-pdf-viewer"]=t})();
@@ -0,0 +1 @@
1
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
package/logo.png ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "adalo-pdf-viewer",
3
+ "version": "1.2.2",
4
+ "description": "A cross-platform PDF Viewer component for Adalo — display any PDF from a URL on iOS, Android, and Web.",
5
+ "main": "src/components/PDFViewer/index.js",
6
+ "scripts": {
7
+ "start": "adalo start",
8
+ "build": "adalo build"
9
+ },
10
+ "keywords": [
11
+ "adalo",
12
+ "pdf",
13
+ "viewer",
14
+ "document",
15
+ "reader"
16
+ ],
17
+ "author": "Seif Shinnawy",
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "react-native-pdf": "6.6.2",
21
+ "react-native-blob-util": "0.19.4"
22
+ },
23
+ "peerDependencies": {
24
+ "react": "*",
25
+ "react-native": "*"
26
+ },
27
+ "devDependencies": {
28
+ "@adalo/cli": "latest"
29
+ }
30
+ }
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+ # Android install script for adalo-pdf-viewer
3
+ # Adds required Gradle dependencies for react-native-blob-util
4
+
5
+ set -e
6
+
7
+ GRADLE_FILE=$1
8
+
9
+ echo "Adding react-native-blob-util to Android build..."
10
+
11
+ # Add the dependency to the app build.gradle
12
+ cat >> "$GRADLE_FILE" << 'EOF'
13
+
14
+ // Added by adalo-pdf-viewer
15
+ dependencies {
16
+ implementation project(':react-native-blob-util')
17
+ }
18
+ EOF
19
+
20
+ echo "Android install script complete."
@@ -0,0 +1,22 @@
1
+ import { join } from "https://deno.land/std@0.224.0/path/mod.ts"
2
+
3
+ const projectPath = Deno.env.get('ADALO_APP_PROJECT_PATH') ?? ''
4
+
5
+ const buildGradlePath = join(projectPath, 'android', 'app', 'build.gradle')
6
+
7
+ try {
8
+ const content = await Deno.readTextFile(buildGradlePath)
9
+
10
+ if (!content.includes('react-native-blob-util')) {
11
+ const updated = content.replace(
12
+ /dependencies\s*\{/,
13
+ `dependencies {\n implementation project(':react-native-blob-util')`
14
+ )
15
+ await Deno.writeTextFile(buildGradlePath, updated)
16
+ console.log('Android: Added react-native-blob-util to build.gradle')
17
+ } else {
18
+ console.log('Android: react-native-blob-util already present')
19
+ }
20
+ } catch (e) {
21
+ console.error('Android install script error:', e)
22
+ }
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+ # iOS install script for adalo-pdf-viewer
3
+ # Adds required CocoaPods for react-native-pdf and react-native-blob-util
4
+
5
+ set -e
6
+
7
+ PODFILE=$1
8
+
9
+ # react-native-blob-util is required by react-native-pdf
10
+ echo "Adding react-native-blob-util pod..."
11
+ echo "pod 'RNBlobUtil', :path => '../node_modules/react-native-blob-util'" >> "$PODFILE"
12
+
13
+ echo "iOS install script complete."
@@ -0,0 +1,23 @@
1
+ import { join } from "https://deno.land/std@0.224.0/path/mod.ts"
2
+
3
+ const projectPath = Deno.env.get('ADALO_APP_PROJECT_PATH') ?? ''
4
+ const projectName = Deno.env.get('ADALO_APP_PROJECT_NAME') ?? ''
5
+
6
+ const podfilePath = join(projectPath, 'ios', 'Podfile')
7
+
8
+ try {
9
+ const podfileContent = await Deno.readTextFile(podfilePath)
10
+
11
+ if (!podfileContent.includes('RNBlobUtil')) {
12
+ const updated = podfileContent.replace(
13
+ /^end\s*$/m,
14
+ ` pod 'RNBlobUtil', :path => '../node_modules/react-native-blob-util'\nend`
15
+ )
16
+ await Deno.writeTextFile(podfilePath, updated)
17
+ console.log('iOS: Added RNBlobUtil pod to Podfile')
18
+ } else {
19
+ console.log('iOS: RNBlobUtil already present in Podfile')
20
+ }
21
+ } catch (e) {
22
+ console.error('iOS install script error:', e)
23
+ }