OwlCyberSecurity - MANAGER
Edit File: classic-shortcode.js
(()=>{var e,t,o,c={598:(e,t,o)=>{"use strict";o.r(t);var c={};o.r(c),o.d(c,{blockifyConfig:()=>R,getDescription:()=>C,getTitle:()=>_,isConversionPossible:()=>E});var r={};o.r(r),o.d(r,{blockifyConfig:()=>I,getDescription:()=>j,getTitle:()=>P,isConversionPossible:()=>B});var i=o(1609);const l=window.wp.blocks,n=window.wp.blockEditor,a=window.wp.components;var s=o(7723),h=o(7104),m=o(3707);const d=window.wp.data;var w=o(6087);const p=window.wp.notices,u=({blocks:e,findCondition:t})=>{for(const o of e){if(t(o))return o;if(o.innerBlocks){const e=u({blocks:o.innerBlocks,findCondition:t});if(e)return e}}};o(4918),o(120);var k=o(5573);const g=()=>(0,i.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 892 516"},(0,i.createElement)(k.G,{fill:"currentColor",transform:"translate(-1)"},(0,i.createElement)(k.Rect,{width:"100",height:"20",x:"1",rx:"2"}),(0,i.createElement)(k.Rect,{width:"100",height:"20",x:"421",rx:"2"}),(0,i.createElement)(k.Rect,{width:"100",height:"20",x:"793",rx:"2"}),(0,i.createElement)(k.Rect,{width:"150",height:"24",x:"125",y:"48",rx:"2"}),(0,i.createElement)(k.Rect,{width:"50",height:"24",x:"125",y:"86",rx:"2"}),(0,i.createElement)(k.Rect,{width:"50",height:"24",x:"457",y:"48",rx:"2"}),(0,i.createElement)(k.Rect,{width:"100",height:"100",x:"15",y:"48",rx:"2"}),(0,i.createElement)(k.Rect,{width:"150",height:"150",x:"1",y:"318",rx:"2"}),(0,i.createElement)(k.Rect,{width:"150",height:"150",x:"373",y:"318",rx:"2"}),(0,i.createElement)(k.Rect,{width:"150",height:"150",x:"187",y:"318",rx:"2"}),(0,i.createElement)(k.Rect,{width:"150",height:"24",x:"125",y:"178",rx:"2"}),(0,i.createElement)(k.Rect,{width:"50",height:"24",x:"125",y:"216",rx:"2"}),(0,i.createElement)(k.Rect,{width:"50",height:"24",x:"457",y:"178",rx:"2"}),(0,i.createElement)(k.Rect,{width:"100",height:"100",x:"15",y:"178",rx:"2"}),(0,i.createElement)(k.Rect,{width:"304",height:"359",x:"588",y:"34",rx:"2"}),(0,i.createElement)(k.Rect,{width:"520",height:"1",x:"1",y:"34",rx:".5"}),(0,i.createElement)(k.Rect,{width:"520",height:"1",y:"162",rx:".5"}),(0,i.createElement)(k.Rect,{width:"520",height:"1",x:"1",y:"292",rx:".5"}),(0,i.createElement)(k.Rect,{width:"304",height:"64",x:"589",y:"407",rx:"2"}),(0,i.createElement)(k.Rect,{width:"100",height:"38",x:"26",y:"478",rx:"2"}),(0,i.createElement)(k.Rect,{width:"100",height:"38",x:"212",y:"478",rx:"2"}),(0,i.createElement)(k.Rect,{width:"100",height:"38",x:"398",y:"478",rx:"2"}))),x=()=>(0,i.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 892 726"},(0,i.createElement)(k.G,{fill:"currentColor",transform:"translate(-1)"},(0,i.createElement)(k.Rect,{width:"203",height:"38",x:"1",rx:"2"}),(0,i.createElement)(k.Rect,{width:"434",height:"38",x:"1",y:"62",rx:"2"}),(0,i.createElement)(k.Rect,{width:"434",height:"38",y:"124",rx:"2"}),(0,i.createElement)(k.Rect,{width:"434",height:"38",x:"1",y:"186",rx:"2"}),(0,i.createElement)(k.Rect,{width:"434",height:"38",x:"2",y:"248",rx:"2"}),(0,i.createElement)(k.Rect,{width:"434",height:"38",x:"3",y:"310",rx:"2"}),(0,i.createElement)(k.Rect,{width:"434",height:"38",x:"3",y:"372",rx:"2"}),(0,i.createElement)(k.Rect,{width:"892",height:"204",x:"2",y:"434",rx:"2"}),(0,i.createElement)(k.Rect,{width:"203",height:"38",x:"231",rx:"2"}),(0,i.createElement)(k.Rect,{width:"203",height:"38",x:"514",rx:"2"}),(0,i.createElement)(k.Rect,{width:"427",height:"100",x:"466",y:"62",rx:"2"}),(0,i.createElement)(k.Rect,{width:"304",height:"64",x:"588",y:"662",rx:"2"}),(0,i.createElement)(k.Rect,{width:"38",height:"38",x:"466",rx:"2"}),(0,i.createElement)(k.Rect,{width:"203",height:"38",x:"48",y:"662",rx:"2"}),(0,i.createElement)(k.Rect,{width:"38",height:"38",y:"662",rx:"2"}))),b="cart",f="checkout",y={cart:{type:b,title:(0,s.__)("Cart Shortcode","woocommerce"),description:(0,s.__)("Renders the classic cart shortcode.","woocommerce"),placeholder:"cart"},checkout:{type:f,title:(0,s.__)("Checkout Cart","woocommerce"),description:(0,s.__)("Renders the classic checkout shortcode.","woocommerce"),placeholder:"checkout"}},E=()=>!0,v=e=>[(0,l.createBlock)("woocommerce/checkout",{...e,className:"wc-block-checkout"})].filter(Boolean),_=()=>(0,s.__)("Classic Checkout","woocommerce"),C=()=>(0,s.__)("This block will render the classic checkout shortcode. You can optionally transform it into blocks for more control over the checkout experience.","woocommerce"),R={getButtonLabel:()=>(0,s.__)("Transform into blocks","woocommerce"),onClickCallback:({clientId:e,attributes:t,getBlocks:o,replaceBlock:c,selectBlock:r})=>{c(e,v(t));const i=o().find((e=>"core/group"===e.name&&e.innerBlocks.some((e=>"woocommerce/store-notices"===e.name))));i&&r(i.clientId)},getBlockifiedTemplate:v},B=()=>!0,O=e=>[(0,l.createBlock)("woocommerce/cart",{...e,className:"wc-block-cart"})].filter(Boolean),P=()=>(0,s.__)("Classic Cart","woocommerce"),j=()=>(0,s.__)("This block will render the classic cart shortcode. You can optionally transform it into blocks for more control over the cart experience.","woocommerce"),I={getButtonLabel:()=>(0,s.__)("Transform into blocks","woocommerce"),onClickCallback:({clientId:e,attributes:t,getBlocks:o,replaceBlock:c,selectBlock:r})=>{c(e,O(t));const i=o().find((e=>"core/group"===e.name&&e.innerBlocks.some((e=>"woocommerce/store-notices"===e.name))));i&&r(i.clientId)},getBlockifiedTemplate:O},T=JSON.parse('{"name":"woocommerce/classic-shortcode","version":"1.0.0","title":"Classic Shortcode","description":"Renders classic WooCommerce shortcodes.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"align":true,"html":false,"multiple":false,"reusable":false,"inserter":true},"attributes":{"shortcode":{"type":"string","default":"cart","enum":["cart","checkout"]},"align":{"type":"string","default":"wide"}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),S={[b]:r,[f]:c,fallback:{isConversionPossible:()=>!1,getBlockifiedTemplate:()=>[],getDescription:()=>"",onClickCallback:()=>{}}},N=({blockifyConfig:e,clientId:t,attributes:o})=>{const{getButtonLabel:c,onClickCallback:r,getBlockifiedTemplate:h}=e,[m,k]=(0,w.useState)(!1),{replaceBlock:g,selectBlock:x}=(0,d.useDispatch)(n.store),{createInfoNotice:b}=(0,d.useDispatch)(p.store),{getBlocks:f}=(0,d.useSelect)((e=>({getBlocks:e(n.store).getBlocks})),[]);return(0,i.createElement)(a.TabbableContainer,{className:"wp-block-woocommerce-classic-shortcode__placeholder-migration-button-container"},(0,i.createElement)(a.Button,{variant:"primary",onClick:()=>{r({clientId:t,getBlocks:f,attributes:o,replaceBlock:g,selectBlock:x}),b((0,s.__)("Classic shortcode transformed to blocks.","woocommerce"),{actions:[{label:(0,s.__)("Undo","woocommerce"),onClick:()=>{const e=["woocommerce/cart","woocommerce/checkout"],t=u({blocks:f(),findCondition:t=>e.includes(t.name)});t&&g(t.clientId,(0,l.createBlock)("woocommerce/classic-shortcode",{shortcode:o.shortcode}))}}],type:"snackbar"})},onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),text:c?c():"",tabIndex:0},m&&(0,i.createElement)(a.Popover,{resize:!1,placement:"right-end"},(0,i.createElement)("div",{style:{minWidth:"250px",width:"250px",maxWidth:"250px",minHeight:"300px",height:"300px",maxHeight:"300px",cursor:"pointer"}},(0,i.createElement)(n.BlockPreview,{blocks:h({...o,isPreview:!0}),viewportWidth:1200,additionalStyles:[{css:"body { padding: 20px !important; height: fit-content !important; overflow:hidden}"}]})))),(0,i.createElement)(a.Button,{variant:"secondary",href:"https://woocommerce.com/document/woocommerce-store-editing/customizing-cart-and-checkout/",target:"_blank",tabIndex:0},(0,s.__)("Learn more","woocommerce")))},M=({clientId:e,attributes:t})=>{var o,c;const r=(0,n.useBlockProps)(),l=function(e,t){const o=Object.keys(t);let c=null;for(let r=0;o.length>r;r++){const i=t[e.substr(0,o[r].length)];if(i){c=i;break}}return c}(t.shortcode,y),h=t.shortcode,m=null!==(o=null==l?void 0:l.placeholder)&&void 0!==o?o:"cart",d=null!==(c=null==l?void 0:l.type)&&void 0!==c?c:"fallback",{isConversionPossible:p,getDescription:u,getTitle:k,blockifyConfig:b}=S[d],f=p(),E=k?k():(0,s.__)("Classic Shortcode Placeholder","woocommerce"),v=u(h,f),_=(0,w.createInterpolateElement)((0,s.__)("You can learn more about the benefits of switching to blocks, compatibility with extensions, and how to switch back to shortcodes <a>in our documentation</a>.","woocommerce"),{a:(0,i.createElement)(a.ExternalLink,{href:"https://woocommerce.com/document/woocommerce-store-editing/customizing-cart-and-checkout/"})});return(0,i.createElement)("div",{...r},(0,i.createElement)(a.Placeholder,{className:"wp-block-woocommerce-classic-shortcode__placeholder"},(0,i.createElement)("div",{className:"wp-block-woocommerce-classic-shortcode__placeholder-wireframe"},"cart"===m?(0,i.createElement)(g,null):(0,i.createElement)(x,null)),(0,i.createElement)("div",{className:"wp-block-woocommerce-classic-shortcode__placeholder-copy"},(0,i.createElement)("div",{className:"wp-block-woocommerce-classic-shortcode__placeholder-copy__icon-container"},(0,i.createElement)("h1",null,(0,s.__)("WooCommerce","woocommerce")),(0,i.createElement)("span",null,E)),(0,i.createElement)("p",null,v),(0,i.createElement)("p",null,_),f&&b&&(0,i.createElement)(N,{clientId:e,blockifyConfig:b,attributes:t}))))},W={icon:(0,i.createElement)(h.A,{icon:m.A,className:"wc-block-editor-components-block-icon"}),edit:({attributes:e,clientId:t,setAttributes:o})=>(0,i.createElement)(M,{attributes:e,setAttributes:o,clientId:t}),save:()=>null,variations:[{name:"checkout",title:(0,s.__)("Classic Checkout","woocommerce"),attributes:{shortcode:"checkout"},isActive:(e,t)=>e.shortcode===t.shortcode,scope:["inserter"]},{name:"cart",title:(0,s.__)("Classic Cart","woocommerce"),attributes:{shortcode:"cart"},isActive:(e,t)=>e.shortcode===t.shortcode,scope:["inserter"],isDefault:!0}],apiVersion:3};(0,l.registerBlockType)(T,W)},4918:()=>{},120:()=>{},1609:e=>{"use strict";e.exports=window.React},6087:e=>{"use strict";e.exports=window.wp.element},7723:e=>{"use strict";e.exports=window.wp.i18n},5573:e=>{"use strict";e.exports=window.wp.primitives}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var o=r[e]={exports:{}};return c[e].call(o.exports,o,o.exports,i),o.exports}i.m=c,e=[],i.O=(t,o,c,r)=>{if(!o){var l=1/0;for(h=0;h<e.length;h++){for(var[o,c,r]=e[h],n=!0,a=0;a<o.length;a++)(!1&r||l>=r)&&Object.keys(i.O).every((e=>i.O[e](o[a])))?o.splice(a--,1):(n=!1,r<l&&(l=r));if(n){e.splice(h--,1);var s=c();void 0!==s&&(t=s)}}return t}r=r||0;for(var h=e.length;h>0&&e[h-1][2]>r;h--)e[h]=e[h-1];e[h]=[o,c,r]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var r=Object.create(null);i.r(r);var l={};t=t||[null,o({}),o([]),o(o)];for(var n=2&c&&e;"object"==typeof n&&!~t.indexOf(n);n=o(n))Object.getOwnPropertyNames(n).forEach((t=>l[t]=()=>e[t]));return l.default=()=>e,i.d(r,l),r},i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.j=3035,(()=>{var e={3035:0};i.O.j=t=>0===e[t];var t=(t,o)=>{var c,r,[l,n,a]=o,s=0;if(l.some((t=>0!==e[t]))){for(c in n)i.o(n,c)&&(i.m[c]=n[c]);if(a)var h=a(i)}for(t&&t(o);s<l.length;s++)r=l[s],i.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return i.O(h)},o=self.webpackChunkwebpackWcBlocksMainJsonp=self.webpackChunkwebpackWcBlocksMainJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var l=i.O(void 0,[94],(()=>i(598)));l=i.O(l),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["classic-shortcode"]=l})();