block.json
6 months ago
controller.php
6 months ago
index-rtl.css
6 months ago
index.asset.php
1 month ago
index.css
6 months ago
index.js
1 month ago
style-index-rtl.css
6 months ago
style-index.css
6 months ago
view.php
6 months ago
index.js
1 lines
| 1 | !function(){"use strict";var e,t={7005:function(e,t,n){var r=n(1609),o=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,n){var r,c={},s=null,u=null;for(r in void 0!==n&&(s=""+n),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!i.hasOwnProperty(r)&&(c[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===c[r]&&(c[r]=t[r]);return{$$typeof:o,type:e,key:s,ref:u,props:c,_owner:l.current}}},9255:function(e,t,n){e.exports=n(7005)},8806:function(e,t,n){var r=window.wp.blocks,o=window.wp.primitives,a=n(9255),l=(0,a.jsx)(o.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(o.Path,{d:"M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z"})}),i=window.wp.i18n,c=window.wp.blockEditor,s=window.wp.components,u=window.wp.element,f=(0,a.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(o.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})}),p=(0,a.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(o.Path,{d:"M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"})}),h=n(1609),m=n.n(h);function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_.apply(null,arguments)}function d(e){let{name:t,...n}=e;const[r,o]=(0,h.useState)(null),a=window?.scData?.plugin_url+"/dist/icon-assets",l=/^[a-zA-Z0-9_-]+$/.test(t);if((0,h.useEffect)((()=>{l&&fetch(`${a}/${t}.svg`).then((e=>e.text())).then((e=>{const t=(new DOMParser).parseFromString(e,"image/svg+xml"),n=t?.documentElement;"svg"===n?.tagName?.toLowerCase()&&o(n)})).catch(console.error)}),[t,l]),!r)return null;const i={class:"className","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation-filters":"colorInterpolationFilters","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-opacity":"floodOpacity","font-size":"fontSize","stop-color":"stopColor","stop-opacity":"stopOpacity","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth"},c={};for(const e of r.attributes)c[i[e.name]||e.name]=e.value;return m().createElement("svg",_({},c,n,{dangerouslySetInnerHTML:{__html:r.innerHTML}}))}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w.apply(null,arguments)}const v=e=>{if(!e||e===document.body)return null;const t=e.parentElement;if(!t)return null;const n=window.getComputedStyle(t).overflowY;return"visible"!==n&&"hidden"!==n&&t.scrollHeight>t.clientHeight?t:v(t)};function k(e){let{name:t,selected:n,...r}=e;const[o,a]=(0,u.useState)(void 0),l=(0,u.useRef)(null);return(0,u.useEffect)((()=>{const e=l.current?v(l.current):null,n=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&(a(t),n.disconnect())}))}),{root:e,rootMargin:"50px",threshold:.01});return l.current&&n.observe(l.current),()=>{n&&n.disconnect()}}),[t]),React.createElement("button",w({ref:l,className:"surecart-icon-picker__item "+(n?"is-selected":""),"aria-label":t},r),!!o&&React.createElement(d,{name:o}))}let g=null;(0,r.registerBlockType)("surecart/icon",{icon:l,edit:function(e){let{attributes:t,setAttributes:n}=e;const{icon_name:r,size:o,stroke_width:a,link_url:l,link_target:h,link_rel:m,nofollow:_}=t,[w,v]=(0,u.useState)(!1),[b,x]=(0,u.useState)(""),[y,E]=(0,u.useState)([]),[R,O]=(0,u.useState)(!1);(0,u.useEffect)((()=>{O(!0),(async()=>{if(g)return g;try{g=[];const e=await fetch(`${window?.scData?.plugin_url}/dist/icon-assets/icons.json`);if(!e.ok)throw new Error(e.statusText);return g=await e.json(),g}catch(e){return console.error("Failed to load icons:",e),[]}})().then((e=>{E(e)})).finally((()=>{O(!1)}))}),[]);const S=(0,u.useMemo)((()=>b?y.filter((e=>e.toLowerCase().includes(b.toLowerCase()))):y),[b,y]),C=(0,c.useBlockProps)({className:"wp-block-surecart-icon"});return React.createElement(React.Fragment,null,React.createElement(c.BlockControls,{group:"block"},React.createElement(s.Button,{icon:l?f:p,label:l?(0,i.__)("Edit link","surecart"):(0,i.__)("Add link","surecart"),onClick:()=>v(!0)})),React.createElement(c.InspectorControls,null,React.createElement(s.PanelBody,{title:(0,i.__)("Icon Settings","surecart"),initialOpen:!0},React.createElement(s.SearchControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,i.__)("Search Icons","surecart"),value:b,onChange:x,placeholder:(0,i.__)("Search for an icon...","surecart")}),React.createElement("div",{className:"surecart-icon-picker"},R?React.createElement(s.ProgressBar,null):React.createElement("div",{className:"surecart-icon-picker_items"},(S||[]).map((e=>React.createElement(k,{onClick:()=>n({icon_name:e}),selected:r===e,title:e,key:e,name:e})))),!R&&!S?.length&&React.createElement("p",{style:{textAlign:"center",color:"#666",fontSize:"12px",margin:0}},(0,i.__)("No icons found. Try a different search.","surecart"))),React.createElement(s.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,i.__)("Size (px)","surecart"),value:o,onChange:e=>n({size:e}),min:16,max:200,step:1}),React.createElement(s.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,i.__)("Stroke Width","surecart"),value:a,onChange:e=>n({stroke_width:e}),min:.25,max:10,step:.25}),l&&React.createElement(s.TextControl,{__next40pxDefaultSize:!0,label:(0,i.__)("Link relation","surecart"),help:(0,u.createInterpolateElement)((0,i.__)("The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.","surecart"),{a:React.createElement(s.ExternalLink,{href:"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel"})}),value:m||"",onChange:e=>n({link_rel:e})}))),React.createElement("div",C,React.createElement("span",{style:{width:`${o}px`,height:`${o}px`,display:"inline-block"}},React.createElement(d,{name:r,width:o,height:o,strokeWidth:a}))),w&&React.createElement(s.Popover,{placement:"bottom",onClose:()=>v(!1)},React.createElement(c.__experimentalLinkControl,{settings:[...c.__experimentalLinkControl.DEFAULT_LINK_SETTINGS,{id:"nofollow",title:(0,i.__)("Mark as nofollow","surecart")}],value:{url:l,opensInNewTab:"_blank"===h,nofollow:_},onChange:e=>{let{url:t,opensInNewTab:r,nofollow:o}=e;n({link_url:t,link_target:r?"_blank":"_self",nofollow:o})},onRemove:()=>{n({link_url:void 0,link_target:"_self",link_rel:void 0,nofollow:!1}),v(!1)}})))}})},1609:function(e){e.exports=window.React}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,r),a.exports}r.m=t,e=[],r.O=function(t,n,o,a){if(!n){var l=1/0;for(u=0;u<e.length;u++){n=e[u][0],o=e[u][1],a=e[u][2];for(var i=!0,c=0;c<n.length;c++)(!1&a||l>=a)&&Object.keys(r.O).every((function(e){return r.O[e](n[c])}))?n.splice(c--,1):(i=!1,a<l&&(l=a));if(i){e.splice(u--,1);var s=o();void 0!==s&&(t=s)}}return t}a=a||0;for(var u=e.length;u>0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[n,o,a]},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={6022:0,3690:0};r.O.j=function(t){return 0===e[t]};var t=function(t,n){var o,a,l=n[0],i=n[1],c=n[2],s=0;if(l.some((function(t){return 0!==e[t]}))){for(o in i)r.o(i,o)&&(r.m[o]=i[o]);if(c)var u=c(r)}for(t&&t(n);s<l.length;s++)a=l[s],r.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return r.O(u)},n=self.webpackChunk_surecart_blocks_next=self.webpackChunk_surecart_blocks_next||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var o=r.O(void 0,[3690],(function(){return r(8806)}));o=r.O(o)}(); |