laipower/wp-content/plugins/easy-digital-downloads/includes/blocks/build/downloads/index.js

1 line
13 KiB
JavaScript

(()=>{"use strict";var e,a={737:(e,a,l)=>{const o=window.wp.blocks,t=window.wp.element,n=window.wp.i18n,i=window.wp.components,d=window.wp.serverSideRender;var s=l.n(d);const r=[{value:"none",label:(0,n.__)("None","easy-digital-downloads")},{value:"center",label:(0,n.__)("Center","easy-digital-downloads")},{value:"left",label:(0,n.__)("Left","easy-digital-downloads")},{value:"right",label:(0,n.__)("Right","easy-digital-downloads")}],c=[{value:"ASC",label:(0,n.__)("Ascending","easy-digital-downloads")},{value:"DESC",label:(0,n.__)("Descending","easy-digital-downloads")}],g=[{value:"thumbnail",label:(0,n.__)("Thumbnail","easy-digital-downloads")},{value:"medium",label:(0,n.__)("Medium","easy-digital-downloads")},{value:"large",label:(0,n.__)("Large","easy-digital-downloads")}],_=window.wp.blockEditor,w=[{value:"",label:(0,n.__)("Default","easy-digital-downloads")},{value:"center",label:(0,n.__)("Center","easy-digital-downloads")},{value:"left",label:(0,n.__)("Left","easy-digital-downloads")},{value:"right",label:(0,n.__)("Right","easy-digital-downloads")},{value:"wide",label:(0,n.__)("Wide","easy-digital-downloads")}],m=[{value:"date",label:(0,n.__)("Date Published","easy-digital-downloads")},{value:"price",label:(0,n.__)("Price","easy-digital-downloads")},{value:"ID",label:(0,n.__)("ID","easy-digital-downloads")},{value:"title",label:(0,n.__)("Title","easy-digital-downloads")},{value:"sales",label:(0,n.__)("Sales","easy-digital-downloads")},{value:"earnings",label:(0,n.__)("Earnings","easy-digital-downloads")},{value:"modified",label:(0,n.__)("Date Modified","easy-digital-downloads")},{value:"rand",label:(0,n.__)("Random","easy-digital-downloads")}],u=window.wp.data,h=(e,a)=>{const l=[{value:"",label:a}],o=(0,u.useSelect)((a=>a("core").getEntityRecords("taxonomy",e,{per_page:-1})));return(0,u.useSelect)((a=>a("core/data").isResolving("core","getEntityRecords",["taxonomy",e])))||o&&o.map((e=>{let{id:a,name:o}=e;l.push({value:a,label:o})})),l},v=[{value:"",label:(0,n.__)("No Content","easy-digital-downloads")},{value:"content",label:(0,n.__)("Full Content","easy-digital-downloads")},{value:"excerpt",label:(0,n.__)("Excerpt","easy-digital-downloads")}],p=[{value:"",label:(0,n.__)("No Image","easy-digital-downloads")},{value:"before_entry_title",label:(0,n.__)("Before Title","easy-digital-downloads")},{value:"after_entry_title",label:(0,n.__)("After Title","easy-digital-downloads")}],b={edd_blocks_is_block_editor:EDDBlocks.current_user},k=JSON.parse('{"u2":"edd/downloads","qv":"download"}'),y={button:(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"edd-blocks__icon"},(0,t.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 002.25-2.25V6.75A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25v10.5A2.25 2.25 0 004.5 19.5z"})),cart:(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"edd-blocks__icon"},(0,t.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 3h1.386c.51 0 .955.343 1.087.835l.383 1.437M7.5 14.25a3 3 0 00-3 3h15.75m-12.75-3h11.218c1.121-2.3 2.1-4.684 2.924-7.138a60.114 60.114 0 00-16.536-1.84M7.5 14.25L5.106 5.272M6 20.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm12.75 0a.75.75 0 11-1.5 0 .75.75 0 011.5 0z"})),products:(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"edd-blocks__icon"},(0,t.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 10.5V6a3.75 3.75 0 10-7.5 0v4.5m11.356-1.993l1.263 12c.07.665-.45 1.243-1.119 1.243H4.25a1.125 1.125 0 01-1.12-1.243l1.264-12A1.125 1.125 0 015.513 7.5h12.974c.576 0 1.059.435 1.119 1.007zM8.625 10.5a.375.375 0 11-.75 0 .375.375 0 01.75 0zm7.5 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})),"yes-alt":(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"edd-blocks__icon"},(0,t.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12c0 1.268-.63 2.39-1.593 3.068a3.745 3.745 0 01-1.043 3.296 3.745 3.745 0 01-3.296 1.043A3.745 3.745 0 0112 21c-1.268 0-2.39-.63-3.068-1.593a3.746 3.746 0 01-3.296-1.043 3.745 3.745 0 01-1.043-3.296A3.745 3.745 0 013 12c0-1.268.63-2.39 1.593-3.068a3.745 3.745 0 011.043-3.296 3.746 3.746 0 013.296-1.043A3.746 3.746 0 0112 3c1.268 0 2.39.63 3.068 1.593a3.746 3.746 0 013.296 1.043 3.746 3.746 0 011.043 3.296A3.745 3.745 0 0121 12z"})),download:(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"edd-blocks__icon-downloads"},(0,t.createElement)("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})),unlock:(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"edd-blocks__icon"},(0,t.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 10.5V6.75a4.5 4.5 0 119 0v3.75M3.75 21.75h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H3.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z"})),"editor-table":(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"edd-blocks__icon"},(0,t.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 010 3.75H5.625a1.875 1.875 0 010-3.75z"})),money:(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"edd-blocks__icon"},(0,t.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 18.75a60.07 60.07 0 0115.797 2.101c.727.198 1.453-.342 1.453-1.096V18.75M3.75 4.5v.75A.75.75 0 013 6h-.75m0 0v-.375c0-.621.504-1.125 1.125-1.125H20.25M2.25 6v9m18-10.5v.75c0 .414.336.75.75.75h.75m-1.5-1.5h.375c.621 0 1.125.504 1.125 1.125v9.75c0 .621-.504 1.125-1.125 1.125h-.375m1.5-1.5H21a.75.75 0 00-.75.75v.75m0 0H3.75m0 0h-.375a1.125 1.125 0 01-1.125-1.125V15m1.5 1.5v-.75A.75.75 0 003 15h-.75M15 10.5a3 3 0 11-6 0 3 3 0 016 0zm3 0h.008v.008H18V10.5zm-12 0h.008v.008H6V10.5z"})),id:(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"edd-blocks__icon"},(0,t.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 9h3.75M15 12h3.75M15 15h3.75M4.5 19.5h15a2.25 2.25 0 002.25-2.25V6.75A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25v10.5A2.25 2.25 0 004.5 19.5zm6-10.125a1.875 1.875 0 11-3.75 0 1.875 1.875 0 013.75 0zm1.294 6.336a6.721 6.721 0 01-3.17.789 6.721 6.721 0 01-3.168-.789 3.376 3.376 0 016.338 0z"})),category:(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"edd-blocks__icon"},(0,t.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"})),links:(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"edd-blocks__icon"},(0,t.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244"}))};var C;(0,o.registerBlockType)(k.u2,{icon:(C=k.qv,y[C]),edit:function(e){let{attributes:a,setAttributes:l}=e;const o=e=>a=>l({[e]:a}),d=h("download_category",(0,n.__)("All Categories","easy-digital-downloads")),u=h("download_tag",(0,n.__)("All Categories","easy-digital-downloads"));return(0,t.createElement)("div",(0,_.useBlockProps)(),(0,t.createElement)(_.InspectorControls,null,(0,t.createElement)(i.PanelBody,{title:(0,n.__)("Product Block Settings","easy-digital-downloads")},(0,t.createElement)("p",{className:"description"},(0,n.__)("Decide how to display your products.","easy-digital-downloads")),(0,t.createElement)(i.RangeControl,{label:(0,n.__)("Downloads per Page","easy-digital-downloads"),value:a.number,onChange:o("number"),min:1,max:100}),!!EDDBlocks.all_access&&(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Show All Access Downloads","easy-digital-downloads"),checked:!!a.all_access,onChange:o("all_access")}),(0,t.createElement)(i.RangeControl,{label:(0,n.__)("Number of Columns","easy-digital-downloads"),value:a.columns,onChange:o("columns"),min:1,max:6}),(0,t.createElement)(i.SelectControl,{label:(0,n.__)("Order By","easy-digital-downloads"),value:a.orderby,options:m,onChange:o("orderby")}),(0,t.createElement)(i.SelectControl,{label:(0,n.__)("Order","easy-digital-downloads"),value:a.order,options:c,onChange:o("order")}),"rand"!==a.orderby&&(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Show Pagination","easy-digital-downloads"),checked:!!a.pagination,onChange:o("pagination")})),!a.all_access&&(0,t.createElement)(i.PanelBody,{title:(0,n.__)("Download Term Settings","easy-digital-downloads"),initialOpen:!1},(0,t.createElement)(i.SelectControl,{multiple:!0,className:"edd-blocks-term-selector",label:(0,n.__)("Show Downloads From Categories","easy-digital-downloads"),value:a.category,options:d,onChange:o("category")}),(0,t.createElement)(i.SelectControl,{multiple:!0,className:"edd-blocks-term-selector",label:(0,n.__)("Show Downloads From Tags","easy-digital-downloads"),value:a.tag,options:u,onChange:o("tag")})),(0,t.createElement)(i.PanelBody,{title:(0,n.__)("Individual Product Settings","easy-digital-downloads"),initialOpen:!1},(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Show Title","easy-digital-downloads"),checked:!!a.title,onChange:o("title")}),(0,t.createElement)(i.SelectControl,{label:(0,n.__)("Featured Image Location","easy-digital-downloads"),value:a.image_location,options:p,onChange:o("image_location")}),!!a.image_location&&(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Should the featured image link to the product?","easy-digital-downloads"),checked:!!a.image_link,onChange:o("image_link")}),!!a.image_location&&(0,t.createElement)(i.SelectControl,{label:(0,n.__)("Featured Image Size","easy-digital-downloads"),value:a.image_size,options:g,onChange:o("image_size")}),!!a.image_location&&(0,t.createElement)(i.SelectControl,{label:(0,n.__)("Featured Image Alignment","easy-digital-downloads"),value:a.image_alignment,options:r,onChange:o("image_alignment")}),(0,t.createElement)(i.SelectControl,{label:(0,n.__)("Content","easy-digital-downloads"),value:a.content,options:v,onChange:o("content")}),(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Show Price","easy-digital-downloads"),checked:!!a.price,onChange:o("price")}),(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Show Purchase Button","easy-digital-downloads"),checked:!!a.purchase_link,onChange:o("purchase_link")}),!!a.purchase_link&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(i.SelectControl,{label:(0,n.__)("Purchase Button Alignment","easy-digital-downloads"),value:a.purchase_link_align,options:w,onChange:o("purchase_link_align")}),(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Show Price on Button","easy-digital-downloads"),checked:!!a.show_price,onChange:o("show_price")})))),(0,t.createElement)(i.Disabled,null,(0,t.createElement)(s(),{block:"edd/downloads",attributes:{...a},urlQueryArgs:b})))}})}},l={};function o(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return a[e](n,n.exports,o),n.exports}o.m=a,e=[],o.O=(a,l,t,n)=>{if(!l){var i=1/0;for(c=0;c<e.length;c++){l=e[c][0],t=e[c][1],n=e[c][2];for(var d=!0,s=0;s<l.length;s++)(!1&n||i>=n)&&Object.keys(o.O).every((e=>o.O[e](l[s])))?l.splice(s--,1):(d=!1,n<i&&(i=n));if(d){e.splice(c--,1);var r=t();void 0!==r&&(a=r)}}return a}n=n||0;for(var c=e.length;c>0&&e[c-1][2]>n;c--)e[c]=e[c-1];e[c]=[l,t,n]},o.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return o.d(a,{a}),a},o.d=(e,a)=>{for(var l in a)o.o(a,l)&&!o.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:a[l]})},o.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={411:0,342:0};o.O.j=a=>0===e[a];var a=(a,l)=>{var t,n,i=l[0],d=l[1],s=l[2],r=0;if(i.some((a=>0!==e[a]))){for(t in d)o.o(d,t)&&(o.m[t]=d[t]);if(s)var c=s(o)}for(a&&a(l);r<i.length;r++)n=i[r],o.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return o.O(c)},l=self.webpackChunkedd_blocks=self.webpackChunkedd_blocks||[];l.forEach(a.bind(null,0)),l.push=a.bind(null,l.push.bind(l))})();var t=o.O(void 0,[342],(()=>o(737)));t=o.O(t)})();