JezK
Edit File: marketplace-orders-promo.js
/*! For license information please see marketplace-orders-promo.js.LICENSE.txt */ (()=>{"use strict";var e={94931:(e,o,r)=>{var t=r(51609),n=Symbol.for("react.element"),s=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,c=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function l(e,o,r){var t,s={},l=null,d=null;for(t in void 0!==r&&(l=""+r),void 0!==o.key&&(l=""+o.key),void 0!==o.ref&&(d=o.ref),o)i.call(o,t)&&!a.hasOwnProperty(t)&&(s[t]=o[t]);if(e&&e.defaultProps)for(t in o=e.defaultProps)void 0===s[t]&&(s[t]=o[t]);return{$$typeof:n,type:e,key:l,ref:d,props:s,_owner:c.current}}o.Fragment=s,o.jsx=l,o.jsxs=l},39793:(e,o,r)=>{e.exports=r(94931)},51609:e=>{e.exports=window.React}},o={};const r=window.wp.element,t=window.wp.components,n=window.wp.i18n,s=window.wc.tracks,i=window.wc.sanitize;var c=function r(t){var n=o[t];if(void 0!==n)return n.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,r),s.exports}(39793);const a={percent:function(){return(0,c.jsxs)("svg",{width:"72",height:"60",viewBox:"0 0 72 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,c.jsxs)("g",{clipPath:"url(#clip0_4074_10418)",children:[(0,c.jsx)("path",{d:"M68.5301 33.3144C68.0263 32.1006 66.3348 32.344 65.8443 31.1636C65.3538 29.9832 66.7251 28.9562 66.2213 27.7458C65.7175 26.5354 64.0259 26.7755 63.5355 25.5951C63.045 24.4147 64.4163 23.3877 63.9125 22.1773C63.4087 20.9669 61.7171 21.207 61.2267 20.0266C60.7362 18.8462 62.1075 17.8192 61.6037 16.6088C61.0999 15.395 59.4083 15.6385 58.9179 14.4581C58.4274 13.2777 59.7987 12.2507 59.2949 11.0403C58.7911 9.82652 57.0995 10.0699 56.6091 8.88955C56.1186 7.70915 57.4899 6.68214 56.9861 5.47174C56.4823 4.26134 54.7907 4.50142 54.3003 3.32102C53.8465 2.22733 55.0476 1.11696 54.8274 -0.00341797L0 22.5941C0.5038 23.8079 2.19537 23.5644 2.68582 24.7448C3.17627 25.9252 1.805 26.9522 2.3088 28.1626C2.8126 29.373 4.50417 29.133 4.99462 30.3134C5.48508 31.4937 4.11381 32.5208 4.61761 33.7312C5.12141 34.9416 6.81297 34.7015 7.30343 35.8819C7.79388 37.0623 6.42261 38.0893 6.92641 39.2997C7.43021 40.5134 9.12178 40.27 9.61223 41.4504C10.1027 42.6308 8.73142 43.6578 9.23522 44.8682C9.73902 46.0786 11.4306 45.8385 11.921 47.0189C12.4115 48.1993 11.0402 49.2263 11.544 50.4367C12.0478 51.6471 13.7394 51.4071 14.2298 52.5874C14.6836 53.6811 13.4825 54.7915 13.7027 55.9119L28.1928 49.9232L68.5368 33.3177L68.5301 33.3144Z",fill:"#720EEC"}),(0,c.jsx)("path",{d:"M13.696 55.912L28.1861 49.9234L52.3851 39.9634H7.46021C8.17086 40.4802 9.23852 40.5569 9.60886 41.4539C10.0993 42.6343 8.72805 43.6613 9.23185 44.8717C9.73565 46.0821 11.4272 45.842 11.9177 47.0224C12.4081 48.2028 11.0368 49.2298 11.5406 50.4402C12.0444 51.6506 13.736 51.4105 14.2265 52.5909C14.6802 53.6846 13.4791 54.795 13.6993 55.9154L13.696 55.912Z",fill:"#3C087E"}),(0,c.jsx)("path",{d:"M63.8523 41.9907C63.8523 37.4925 67.499 33.848 71.9998 33.848V23.988H17.873V33.848C22.3739 33.848 26.0206 37.4925 26.0206 41.9907C26.0206 46.4889 22.3739 50.1334 17.873 50.1334V59.9934H71.9998V50.1334C67.499 50.1334 63.8523 46.4889 63.8523 41.9907Z",fill:"#D1C1FF"}),(0,c.jsx)("path",{d:"M35.2527 37.676C35.2527 35.2051 37.0143 33.2878 39.6968 33.2878C42.3793 33.2878 44.1643 35.2051 44.1643 37.676C44.1643 40.1468 42.4026 42.0107 39.6968 42.0107C36.991 42.0107 35.2527 40.1201 35.2527 37.676ZM41.7954 37.676C41.7954 36.2288 40.9046 35.3385 39.6935 35.3385C38.4823 35.3385 37.6182 36.2288 37.6182 37.676C37.6182 39.1231 38.509 39.9601 39.6935 39.9601C40.8779 39.9601 41.7954 39.0664 41.7954 37.676ZM37.9852 51.0704L49.1789 33.5513H51.1774L39.9537 51.0704H37.9819H37.9852ZM44.8983 47.0524C44.8983 44.5849 46.6566 42.641 49.3391 42.641C52.0215 42.641 53.8065 44.5849 53.8065 47.0524C53.8065 49.5199 52.0182 51.3872 49.3391 51.3872C46.6599 51.3872 44.8983 49.4966 44.8983 47.0524ZM51.441 47.0524C51.441 45.6053 50.5468 44.715 49.3357 44.715C48.1246 44.715 47.2605 45.6053 47.2605 47.0524C47.2605 48.4996 48.1279 49.3365 49.3357 49.3365C50.5435 49.3365 51.441 48.4696 51.441 47.0524Z",fill:"#720EEC"})]}),(0,c.jsx)("defs",{children:(0,c.jsx)("clipPath",{id:"clip0_4074_10418",children:(0,c.jsx)("rect",{width:"72",height:"60",fill:"white"})})})]})}},l=({promotion:e,eventProperties:o={},onDismiss:l})=>{const d=window.location.pathname+window.location.search,m=()=>JSON.parse(localStorage.getItem("wc-marketplaceDismissedPromos")||"[]"),[p,C]=(0,r.useState)(!!l||!m().includes(d));if((0,r.useEffect)(()=>{p&&(0,s.recordEvent)("marketplace_promotion_viewed",{...o,path:d,format:"promo-card"})},[p]),!p)return null;const w="promo-card"+(e.style?` ${e.style}`:""),h=(0,c.jsxs)("div",{className:"promo-content",children:[(0,c.jsx)("h2",{className:"promo-title",children:e.title?.en_US}),(0,c.jsx)("div",{className:"promo-text",dangerouslySetInnerHTML:(u=e.content?.en_US,{__html:(0,i.sanitizeHTML)(u)})})]});var u;const f=(0,c.jsxs)("div",{className:"promo-links",children:[(0,c.jsx)(t.Button,{className:"promo-cta",href:e.cta_link??"",variant:"secondary",onClick:()=>((0,s.recordEvent)("marketplace_promotion_actioned",{...o,path:d,target_uri:e.cta_link,format:"promo-card"}),!0),children:e.cta_label?.en_US??""}),(0,c.jsx)(t.Button,{className:"promo-cta-link woocommerce-admin-dismiss-notification",onClick:()=>{C(!1),l?l():localStorage.setItem("wc-marketplaceDismissedPromos",JSON.stringify(m().concat(d))),(0,s.recordEvent)("marketplace_promotion_dismissed",{...o,path:d,format:"promo-card"})},children:(0,n.__)("Dismiss","woocommerce")})]});function _(){if(e.icon&&Object.hasOwn(a,e.icon)){const o=a[e.icon];return o?(0,c.jsx)("div",{className:"promo-image",children:(0,r.createElement)(o)}):null}return null}return(0,c.jsx)(t.Card,{className:w,children:(0,c.jsx)(t.CardBody,{className:"promo-card__body",children:"has-background"===e?.style?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"promo-content-links",children:[h,f]}),_()]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"promo-content-image",children:[h,_()]}),f]})})})},d=window.wcOrdersPromo,m=document.querySelector(".subsubsub")||document.getElementById("wc-orders-filter")||document.getElementById("posts-filter");if(d&&d.promotion&&m&&m.parentNode){const e=document.createElement("div");e.className="woocommerce-marketplace-orders-promo",m.parentNode.insertBefore(e,m);const o=d.id,t={surface:"orders"};"number"==typeof d.order_count&&(t.order_count=d.order_count);const n=d.dismiss_url,s=d.dismiss_nonce,i=o&&n&&s?()=>{fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":s},body:JSON.stringify({id:o})}).catch(()=>{})}:void 0;(0,r.createRoot)(e).render((0,c.jsx)(l,{promotion:d.promotion,eventProperties:t,onDismiss:i}))}(window.wc=window.wc||{}).marketplaceOrdersPromo={}})();