OwlCyberSecurity - MANAGER
Edit File: marketplace.js
"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[9669],{56592:(e,o,t)=>{t.d(o,{Z:()=>s});var r=t(70444),c=t(81514);const s=(0,c.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(r.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})})},58176:(e,o,t)=>{t.d(o,{Z:()=>s});var r=t(70444),c=t(81514);const s=(0,c.jsx)(r.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(r.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})})},91667:(e,o,t)=>{t.d(o,{Z:()=>s});var r=t(70444),c=t(81514);const s=(0,c.jsx)(r.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(r.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})})},7637:(e,o,t)=>{t.d(o,{Z:()=>s});var r=t(70444),c=t(81514);const s=(0,c.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(r.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})})},33002:(e,o,t)=>{t.d(o,{Z:()=>s});var r=t(70444),c=t(81514);const s=(0,c.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(r.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"})})},25869:(e,o,t)=>{t.d(o,{Z:()=>s});var r=t(70444),c=t(81514);const s=(0,c.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(r.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})})},10865:(e,o,t)=>{t.d(o,{Z:()=>s});var r=t(70444),c=t(81514);const s=(0,c.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(r.Path,{fillRule:"evenodd",d:"M6.5 8a1.5 1.5 0 103 0 1.5 1.5 0 00-3 0zM8 5a3 3 0 100 6 3 3 0 000-6zm6.5 11a1.5 1.5 0 103 0 1.5 1.5 0 00-3 0zm1.5-3a3 3 0 100 6 3 3 0 000-6zM5.47 17.41a.75.75 0 001.06 1.06L18.47 6.53a.75.75 0 10-1.06-1.06L5.47 17.41z",clipRule:"evenodd"})})},28682:(e,o,t)=>{t.d(o,{A:()=>i});var r=t(14812),c=t(28302),s=t(86020),n=t(14599),a=t(81514);const i=({textProps:e,message:o,eventName:t="",eventProperties:i={},targetUrl:l,linkType:m="wc-admin",onClickCallback:u})=>(0,a.jsx)(r.Text,{...e,children:(0,c.Z)({mixedString:o,components:{Link:(0,a.jsx)(s.Link,{onClick:()=>(u?u():(0,n.recordEvent)(t,i),window.location.href=l,!1),href:l,type:m})}})})},9845:(e,o,t)=>{t.d(o,{ZP:()=>n});var r=t(25209);const c=["a","b","em","i","strong","p","br"],s=["target","href","rel","name","download"],n=e=>({__html:(0,r.sanitize)(e,{ALLOWED_TAGS:c,ALLOWED_ATTR:s})})},84884:(e,o,t)=>{t.d(o,{Z:()=>p});var r=t(80225),c=t(69307),s=t(33002),n=t(56592),a=t(10865),i=t(59550),l=t(7637),m=t(9845),u=t(81514);const d={info:s.Z,check:n.Z,percent:a.Z};function p(e){const{id:o,description:t,children:s,icon:n,isDismissible:a=!0,variant:p="info",className:_,onClose:g,onLoad:w}=e,[h,x]=(0,c.useState)("true"!==localStorage.getItem(`wc-marketplaceNoticeClosed-${o}`));if((0,c.useEffect)((()=>{h&&"function"==typeof w&&w()}),[h]),!h)return null;const M=(0,r.Z)("woocommerce-marketplace__notice",`woocommerce-marketplace__notice--${p}`,{"is-dismissible":a},_),j=d[n||"info"],y=(0,r.Z)("woocommerce-marketplace__notice-icon",`woocommerce-marketplace__notice-icon--${p}`);return(0,u.jsxs)("div",{className:M,children:[n&&(0,u.jsx)("span",{className:y,children:(0,u.jsx)(i.Z,{icon:j})}),(0,u.jsxs)("div",{className:"woocommerce-marketplace__notice-content",children:[(0,u.jsx)("p",{className:"woocommerce-marketplace__notice-description",dangerouslySetInnerHTML:(0,m.ZP)(t)}),s&&(0,u.jsx)("div",{className:"woocommerce-marketplace__notice-children",children:s})]}),a&&(0,u.jsx)("button",{className:"woocommerce-marketplace__notice-close","aria-label":"Close",onClick:()=>{x(!1),localStorage.setItem(`wc-marketplaceNoticeClosed-${o}`,"true"),"function"==typeof g&&g()},children:(0,u.jsx)(i.Z,{icon:l.Z})})]})}},22252:(e,o,t)=>{t.d(o,{Z:()=>c});var r=t(81514);function c(){return(0,r.jsxs)("svg",{width:"72",height:"60",viewBox:"0 0 72 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsxs)("g",{clipPath:"url(#clip0_4074_10418)",children:[(0,r.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,r.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,r.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,r.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,r.jsx)("defs",{children:(0,r.jsx)("clipPath",{id:"clip0_4074_10418",children:(0,r.jsx)("rect",{width:"72",height:"60",fill:"white"})})})]})}},55291:(e,o,t)=>{t.d(o,{Z:()=>u});var r=t(55609),c=t(65736),s=t(69307),n=t(14599),a=t(9845),i=t(22252),l=t(81514);const m={percent:i.Z},u=({promotion:e})=>{var o,t;const i=window.location.pathname+window.location.search,u=()=>JSON.parse(localStorage.getItem("wc-marketplaceDismissedPromos")||"[]"),[d,p]=(0,s.useState)(!u().includes(i));if((0,s.useEffect)((()=>{d&&(0,n.recordEvent)("marketplace_promotion_viewed",{path:i,format:"promo-card"})}),[d]),!d)return null;const _="promo-card"+(e.style?` ${e.style}`:""),g=(0,l.jsxs)("div",{className:"promo-content",children:[(0,l.jsx)("h2",{className:"promo-title",children:e.title?.en_US}),(0,l.jsx)("div",{className:"promo-text",dangerouslySetInnerHTML:(0,a.ZP)(e.content?.en_US)})]}),w=(0,l.jsxs)("div",{className:"promo-links",children:[(0,l.jsx)(r.Button,{className:"promo-cta",href:null!==(o=e.cta_link)&&void 0!==o?o:"",onClick:()=>((0,n.recordEvent)("marketplace_promotion_actioned",{path:i,target_uri:e.cta_link,format:"promo-card"}),!0),children:null!==(t=e.cta_label?.en_US)&&void 0!==t?t:""}),(0,l.jsx)(r.Button,{className:"promo-cta-link",onClick:()=>{p(!1),localStorage.setItem("wc-marketplaceDismissedPromos",JSON.stringify(u().concat(i))),(0,n.recordEvent)("marketplace_promotion_dismissed",{path:i,format:"promo-card"})},children:(0,c.__)("Dismiss","woocommerce")})]});function h(){if(e.icon&&Object.hasOwn(m,e.icon)){const o=m[e.icon];return o?(0,l.jsx)("div",{className:"promo-image",children:(0,s.createElement)(o)}):null}return null}return(0,l.jsx)("div",{className:_,children:"has-background"===e?.style?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"promo-content-links",children:[g,w]}),h()]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"promo-content-image",children:[g,h()]}),w]})})}},87287:(e,o,t)=>{t.d(o,{Z:()=>i});var r=t(14599),c=t(91978),s=t(84884),n=t(55291),a=t(81514);const i=({format:e})=>{var o;if(!window?.wcMarketplace?.promotions||!Array.isArray(window?.wcMarketplace?.promotions))return null;const t=(null!==(o=window?.wcMarketplace?.promotions)&&void 0!==o?o:[]).filter((o=>o.format===e)),i=new URLSearchParams(window.location.search),l=i.get("page"),m=Date.now(),u=decodeURIComponent(i.get("path")||""),d=i.get("tab"),p=window.location.pathname+window.location.search,_=()=>{(0,r.recordEvent)("marketplace_promotion_viewed",{path:p,format:e})},g=()=>{(0,r.recordEvent)("marketplace_promotion_dismissed",{path:p,format:e})};return(0,a.jsx)(a.Fragment,{children:t.map(((e,o)=>{if(!e.pages)return null;if(!e.pages.some((e=>{if(e.pathname)return e.pathname===p;if(!e.path)return!1;const o=e=>e.startsWith("/")?e:`/${e}`,t=o(e.path),r=o(u);return e.page===l&&t===r&&(e.tab?d:!d)})))return null;const t=new Date(e.date_from_gmt).getTime(),r=new Date(e.date_to_gmt).getTime();return m<t||m>r?null:"promo-card"===e.format?(0,a.jsx)(n.Z,{promotion:e},o):"notice"===e.format&&e?.content?(0,a.jsx)(s.Z,{id:null!==(i=e.menu_item_id)&&void 0!==i?i:`promotion-${o}`,description:e.content[c.MV.userLocale]||e.content.en_US,variant:e.style?e.style:"info",icon:e?.icon||"",isDismissible:e.is_dismissible||!1,onLoad:_,onClose:g},o):null;var i}))})}},78378:(e,o,t)=>{t.r(o),t.d(o,{default:()=>ho});var r=t(69307),c=t(91978),s=t(81514);const n=(0,r.createContext)({isLoading:!1,setIsLoading:()=>{},selectedTab:"",setSelectedTab:()=>{},isProductInstalled:()=>!1,addInstalledProduct:()=>{},searchResultsCount:{extensions:0,themes:0,"business-services":0},setSearchResultsCount:()=>{}});function a(e){const[o,t]=(0,r.useState)(!0),[a,i]=(0,r.useState)(""),[l,m]=(0,r.useState)([]),[u,d]=(0,r.useState)({extensions:0,themes:0,"business-services":0}),p=(0,r.useCallback)((e=>{d((o=>({...o,...e})))}),[]);(0,r.useEffect)((()=>{const e=(0,c.O3)("wccomHelper",{}),o=e?.installedProducts;m(o)}),[]);const _={isLoading:o,setIsLoading:t,selectedTab:a,setSelectedTab:i,isProductInstalled:function(e){return l.includes(e)},addInstalledProduct:function(e){m([...l,e])},searchResultsCount:u,setSearchResultsCount:p};return(0,s.jsx)(n.Provider,{value:_,children:e.children})}var i=t(65736),l=t(55609),m=t(14599),u=t(56592),d=t(70444);const p=(0,s.jsx)(d.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(d.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6.68822 16.625L5.5 17.8145L5.5 5.5L18.5 5.5L18.5 16.625L6.68822 16.625ZM7.31 18.125L19 18.125C19.5523 18.125 20 17.6773 20 17.125L20 5C20 4.44772 19.5523 4 19 4H5C4.44772 4 4 4.44772 4 5V19.5247C4 19.8173 4.16123 20.086 4.41935 20.2237C4.72711 20.3878 5.10601 20.3313 5.35252 20.0845L7.31 18.125ZM16 9.99997H8V8.49997H16V9.99997ZM8 14H13V12.5H8V14Z"})}),_=(0,s.jsx)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(d.Path,{d:"M12 3.176l6.75 3.068v4.574c0 3.9-2.504 7.59-6.035 8.755a2.283 2.283 0 01-1.43 0c-3.53-1.164-6.035-4.856-6.035-8.755V6.244L12 3.176zM6.75 7.21v3.608c0 3.313 2.145 6.388 5.005 7.33.159.053.331.053.49 0 2.86-.942 5.005-4.017 5.005-7.33V7.21L12 4.824 6.75 7.21z",fillRule:"evenodd",clipRule:"evenodd"})}),g=(0,s.jsx)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(d.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})});var w=t(59550);function h(e){const{icon:o,title:t,description:r}=e;return(0,s.jsxs)("div",{className:"woocommerce-marketplace__icon-group",children:[(0,s.jsxs)("div",{className:"woocommerce-marketplace__icon-group-headline",children:[(0,s.jsx)(w.Z,{icon:o,size:20,className:"woocommerce-marketplace__icon-group-icon"}),(0,s.jsx)("h3",{className:"woocommerce-marketplace__icon-group-title",children:t})]}),(0,s.jsx)("p",{className:"woocommerce-marketplace__icon-group-description",children:r})]})}var x=t(58684),M=t(28682);const j=e=>(0,s.jsx)(M.A,{targetUrl:x.kh+"/refund-policy/",linkType:"external",eventName:`marketplace_${e}_link_click`,eventProperties:{feature_clicked:"money_back_guarantee"},message:(0,i.__)("30-day {{Link}}money-back guarantee{{/Link}}","woocommerce")}),y=e=>(0,s.jsx)(M.A,{targetUrl:x.kh+"/docs/",linkType:"external",eventName:`marketplace_${e}_link_click`,eventProperties:{feature_clicked:"get_help"},message:(0,i.__)("{{Link}}Get help{{/Link}} when you need it","woocommerce")}),N=e=>(0,s.jsx)(M.A,{targetUrl:x.kh+"/products/",linkType:"external",eventName:`marketplace_${e}_link_click`,eventProperties:{feature_clicked:"products_you_can_trust"},message:(0,i.__)("{{Link}}Products{{/Link}} you can trust","woocommerce")});function v(){return(0,s.jsxs)("div",{className:"woocommerce-marketplace__footer-content",children:[(0,s.jsx)("h2",{className:"woocommerce-marketplace__footer-title",children:(0,i.__)("Hundreds of vetted products and services. Unlimited potential.","woocommerce")}),(0,s.jsxs)("div",{className:"woocommerce-marketplace__footer-columns",children:[(0,s.jsx)(h,{icon:u.Z,title:j("footer"),description:(0,i.__)("If you change your mind within 30 days of your purchase, we'll give you a full refund — hassle-free.","woocommerce")}),(0,s.jsx)(h,{icon:p,title:y("footer"),description:(0,i.__)("With detailed documentation and a global support team, help is always available if you need it.","woocommerce")}),(0,s.jsx)(h,{icon:_,title:N("footer"),description:(0,i.__)("Everything in the Marketplace has been built by our own team or by our trusted partners, so you can be sure of its quality.","woocommerce")}),(0,s.jsx)(h,{icon:g,title:(0,i.__)("Support the ecosystem","woocommerce"),description:(0,i.__)("Our team and partners are continuously improving your extensions, themes, and WooCommerce experience.","woocommerce")})]})]})}function b(){return(0,s.jsx)("div",{className:"woocommerce-marketplace__footer",children:(0,s.jsx)(v,{})})}const k=[{imageUrl:"data:image/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NiAxMi41NzY4IDEzLjgxODUgMTIuMDk2NyAxMy4yMjAzIDEyLjA5NjdDMTIuNjIyMSAxMi4wOTY3IDEyLjEzNyAxMi41NzY4IDEyLjEzNyAxMy4xNjg5QzEyLjEzNyAxMy43NjA5IDEyLjYyMjEgMTQuMjQxIDEzLjIyMDMgMTQuMjQxWiIgZmlsbD0iIzg3M0VGRiIvPgo8L3N2Zz4=",title:y("banner"),textTitle:(0,i.__)("Get help when you need it","woocommerce")},{imageUrl:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMyIgaGVpZ2h0PSIyNiIgdmlld0JveD0iMCAwIDIzIDI2IiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNMTEuMjcyOCAwQzguMzMwNjUgMy4yNTk3OSA0LjU5Njg2IDQuNDgwNTYgMC4zNDA5NDIgNC40ODA1NlYxMi44ODM3QzAuMzQwOTQyIDIwLjM2MDEgNS44NDYzMSAyNC42ODE2IDExLjI3MjggMjZDMTYuNjk5MiAyNC42ODI4IDIyLjIwNDYgMjAuMzYxMyAyMi4yMDQ2IDEyLjg4MzdWNC40ODA1NkMxNy45NDg3IDQuNDgwNTYgMTQuMjE0OSAzLjI1OTc5IDExLjI3MjggMFoiIGZpbGw9IiM4NzNFRkYiLz4KICA8cGF0aCBkPSJNMTAuODQ0IDE3Ljc0NzRMNy43MjQ2MSAxMy4wNjA4TDguNjM2NSAxMi40NjMxTDEwLjgxOTcgMTUuNzQzNEwxNS40MDcxIDguNDc5MDJMMTYuMzMzNiA5LjA1NTA2TDEwLjg0NCAxNy43NDc0WiIgZmlsbD0iI0QxQzFGRiIvPgo8L3N2Zz4=",title:N("banner"),textTitle:(0,i.__)("Products you can trust","woocommerce")},{imageUrl:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNyIgaGVpZ2h0PSIyNy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NTYgMTYuMTk4NyAxMy4yODcyIDE2LjE5ODdaIiBmaWxsPSIjODczRUZGIi8+Cjwvc3ZnPg==",title:(0,i.__)("Support the ecosystem","woocommerce"),textTitle:(0,i.__)("Support the ecosystem","woocommerce")}];function f(){const[e,o]=(0,r.useState)(0),[t,c]=(0,r.useState)(!1),[n,a]=(0,r.useState)(!0),u=(0,r.useRef)(null);(0,r.useEffect)((()=>{let e;return n&&(e=setInterval((()=>{o((e=>(e+1)%k.length))}),5e3)),()=>clearInterval(e)}),[n]),(0,r.useEffect)((()=>{const e=localStorage.getItem("wc_featuredBannerDismissed");c("true"===e)}),[]);const d=()=>a(!1),p=()=>a(!0),_=e=>{"ArrowRight"===e.key?(o((e=>(e+1)%k.length)),setTimeout((()=>{u.current?.focus()}),100)):"ArrowLeft"===e.key&&(o((e=>(e-1+k.length)%k.length)),setTimeout((()=>{u.current?.focus()}),100))};return t?null:(0,s.jsxs)("div",{className:"woocommerce-marketplace__banner",role:"region","aria-roledescription":"carousel","aria-label":(0,i.__)("Marketplace features with four slides","woocommerce"),onMouseEnter:d,onMouseLeave:p,onFocus:d,onBlur:p,children:[(0,s.jsx)("div",{className:"carousel-container",children:(0,s.jsx)("ul",{className:"carousel-list",children:k.map(((o,t)=>(0,s.jsxs)("li",{ref:t===e?u:null,id:`carousel-slide-${t}`,className:"carousel-slide "+(t===e?"active":""),"aria-roledescription":"slide","aria-hidden":t!==e,"aria-live":"off","aria-posinset":t+1,"aria-setsize":k.length,"aria-label":`${o.textTitle} - ${(0,i.__)("Slide","woocommerce")} ${t+1} ${(0,i.__)("of","woocommerce")} ${k.length}`,tabIndex:t===e?0:-1,onKeyDown:_,children:[(0,s.jsx)("img",{src:o.imageUrl,alt:"",className:"woocommerce-marketplace__banner-image"}),(0,s.jsx)("h3",{className:"woocommerce-marketplace__banner-title",children:o.title})]},t)))})}),(0,s.jsx)(l.Button,{className:"dismiss-button",onClick:()=>{localStorage.setItem("wc_featuredBannerDismissed","true"),c(!0),(0,m.recordEvent)("marketplace_features_banner_dismissed",{active_slide:k[e].textTitle})},"aria-label":(0,i.__)("Dismiss Marketplace features carousel","woocommerce"),children:(0,s.jsx)(l.Icon,{icon:"no-alt"})})]})}function I(){return(0,s.jsx)("h1",{className:"woocommerce-marketplace__header-title",children:(0,i.__)("Official WooCommerce Marketplace","woocommerce")})}var D,T=t(94107),C=t(80225),z=t(10431);const A=(0,c.O3)("wccomHelper",{}),S=null!==(D=A?.wooUpdateCount)&&void 0!==D?D:0,L=(e,o,t)=>{const{selectedTab:r,setSelectedTab:c}=e,n=e=>{e!==r&&(c(e),((e,o)=>{const t=o.term?{term:o.term.trim()}:{};(0,z.navigateTo)({url:(0,z.getNewPath)({tab:e===x.KF?void 0:e},x.Bd,t)})})(e,t))},a=[];for(const e in o)a.push(o[e]?.href?(0,s.jsx)("a",{className:(0,C.Z)("woocommerce-marketplace__tab-button","components-button",`woocommerce-marketplace__tab-${e}`),href:o[e]?.href,children:o[e]?.title},e):(0,s.jsxs)(l.Button,{className:(0,C.Z)("woocommerce-marketplace__tab-button",`woocommerce-marketplace__tab-${e}`,{"is-active":e===r}),onClick:()=>n(e),children:[o[e]?.title,o[e]?.showUpdateCount&&(0,s.jsx)("span",{className:(0,C.Z)("woocommerce-marketplace__update-count",`woocommerce-marketplace__update-count-${e}`,{"is-active":e===r}),children:(0,s.jsxs)("span",{children:[" ",o[e]?.updateCount," "]})})]},e));return a},E=e=>{const{additionalClassNames:o}=e,t=(0,r.useContext)(n),{isLoading:c,setSelectedTab:a}=t,{searchResultsCount:l}=t,m=(0,z.useQuery)(),u=(0,r.useMemo)((()=>({discover:{name:"discover",title:(0,i.__)("Discover","woocommerce"),showUpdateCount:!1,updateCount:0},extensions:{name:"extensions",title:(0,i.__)("Extensions","woocommerce"),showUpdateCount:!!m.term&&!c,updateCount:l.extensions},themes:{name:"themes",title:(0,i.__)("Themes","woocommerce"),showUpdateCount:!!m.term&&!c,updateCount:l.themes},"business-services":{name:"business-services",title:(0,i.__)("Business services","woocommerce"),showUpdateCount:!!m.term&&!c,updateCount:l["business-services"]},"my-subscriptions":{name:"my-subscriptions",title:(0,i.__)("My subscriptions","woocommerce"),showUpdateCount:S>0,updateCount:S}})),[m,c,l]);return(0,r.useEffect)((()=>{m?.tab&&u[m.tab]?a(m.tab):Object.keys(m).length>0&&a(x.KF)}),[m,a,u]),(0,s.jsx)("nav",{className:(0,C.Z)("woocommerce-marketplace__tabs",o||[]),children:L(t,u,m)})},O=function(){const[e,o]=(0,r.useState)(""),t=(0,i.__)("Search Marketplace","woocommerce"),c=(0,z.useQuery)();(0,r.useEffect)((()=>{c.term?o(c.term):o("")}),[c.term]);const n=o=>{const t=c;return t.tab&&"my-subscriptions"!==t.tab||(t.tab="extensions"),t.term=void 0!==o?o:e.trim(),t.search="1",t.term||delete t.term,(0,z.navigateTo)({url:(0,z.getNewPath)(t,x.Bd,{})}),[]};return(0,s.jsx)(l.SearchControl,{label:t,placeholder:t,value:e,onChange:o,onKeyUp:e=>{"Enter"===e.key&&n(),"Escape"===e.key&&o("")},onClose:()=>{o(""),n("")},onFocus:()=>{(0,m.recordEvent)("marketplace_search_start",{current_search_term:e,current_tab:c.tab})},className:"woocommerce-marketplace__search"})};function U(){return(0,s.jsxs)("div",{className:"woocommerce-marketplace__header-container",children:[(0,s.jsx)(f,{}),(0,s.jsxs)("header",{className:"woocommerce-marketplace__header",children:[(0,s.jsx)(I,{}),(0,s.jsx)(E,{additionalClassNames:["woocommerce-marketplace__header-tabs"]}),(0,s.jsx)(O,{}),(0,s.jsx)("div",{className:"woocommerce-marketplace__header-meta",children:(0,s.jsx)(T.Z,{page:"wc-addons"})})]})]})}var Q=t(25158),P=t(32277),Y=t(96483),Z=t(22629),B=t(67221);const R=function(e){const{product:o}=e,{user:t,currentUserCan:c}=(0,B.useUser)(),{selectedTab:a,isProductInstalled:u}=(0,r.useContext)(n),d={USD:"$%s",AUD:"A$%s",CAD:"C$%s",EUR:"€%s",GBP:"£%s"},p=e=>d[e]||"%s";function _(){return 0===o.price?(0,i.__)("Free download","woocommerce"):"primary"===o.freemium_type?(0,i.__)("Free plan available","woocommerce"):(0,i.sprintf)(p(o.currency),o.price)}function g(){return"primary"===o.freemium_type?"":0!==o.price?function(){if(1===o.billingPeriodInterval||""===o.billingPeriod)switch(o.billingPeriod){case"day":return(0,i.__)("daily","woocommerce");case"week":return(0,i.__)("weekly","woocommerce");case"month":return(0,i.__)("monthly","woocommerce");case"year":case"":return(0,i.__)("annually","woocommerce");default:return""}let e;switch(o.billingPeriod){case"day":e=(0,i.__)("days","woocommerce");break;case"week":e=(0,i.__)("weeks","woocommerce");break;case"month":e=(0,i.__)("months","woocommerce");break;default:e=(0,i.__)("years","woocommerce")}return(0,i.sprintf)((0,i.__)("every %1$d %2$s","woocommerce"),o.billingPeriodInterval,e)}():""}return o.slug&&u(o.slug)?(0,s.jsx)("span",{className:"woocommerce-marketplace__product-card__installed-label",children:(0,i.__)("Installed","woocommerce")}):(w=o,!(t&&w&&c("install_plugins")&&w.isInstallable&&"theme"!==w.type&&"discover"!==a)||w.slug&&u(w.slug)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"woocommerce-marketplace__product-card__price",children:[(0,s.jsxs)("span",{className:"woocommerce-marketplace__product-card__price-label",children:[(0,s.jsx)("span",{className:"screen-reader-text",children:o.isOnSale?(0,i.sprintf)((0,i.__)("Sale Price %1$s %3$s, regular price %2$s %3$s","woocommerce"),_(),(0,i.sprintf)(p(o.currency),o.regularPrice),g()):0!==o.price&&"primary"!==o.freemium_type?(0,i.sprintf)((0,i.__)(" %1$s, %2$s ","woocommerce"),_(),g()):_()}),(0,s.jsx)("span",{"aria-hidden":!0,children:_()})]}),o.isOnSale&&(0,s.jsx)("span",{className:"woocommerce-marketplace__product-card__on-sale","aria-hidden":!0,children:(0,i.sprintf)(p(o.currency),o.regularPrice)}),(0,s.jsx)("span",{className:"woocommerce-marketplace__product-card__price-billing","aria-hidden":!0,children:g()})]}),(0,s.jsx)("div",{className:"woocommerce-marketplace__product-card__rating",children:null!==o.averageRating&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"woocommerce-marketplace__product-card__rating-icon",children:(0,s.jsx)(l.Icon,{icon:"star-filled",size:16})}),(0,s.jsxs)("span",{className:"woocommerce-marketplace__product-card__rating-average",children:[(0,s.jsx)("span",{"aria-hidden":!0,children:o.averageRating}),(0,s.jsx)("span",{className:"screen-reader-text",children:(0,i.sprintf)((0,i.__)("%.1f stars","woocommerce"),o.averageRating)})]}),(0,s.jsxs)("span",{className:"woocommerce-marketplace__product-card__rating-count",children:[(0,s.jsxs)("span",{"aria-hidden":!0,children:["(",o.reviewsCount,")"]}),(0,s.jsx)("span",{className:"screen-reader-text",children:(0,i.sprintf)((0,i.__)("from %d reviews","woocommerce"),o.reviewsCount)})]})]})})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("span",{className:"woocommerce-marketplace__product-card__add-to-store",children:(0,s.jsx)(l.Button,{variant:"secondary",onClick:function(){(0,m.recordEvent)("marketplace_add_to_store_clicked",{product_id:o.id}),(0,z.navigateTo)({url:(0,z.getNewPath)({installProduct:o.id})})},children:(0,i.__)("Add to Store","woocommerce")})})}));var w};var G=t(24668);const F=function(e){var o;const{isLoading:t,type:r}=e,c=(0,z.useQuery)(),n=null!==(o=e.product)&&void 0!==o?o:{id:null,title:"",description:"",vendorName:"",vendorUrl:"",icon:"",label:null,primary_color:null,url:"",price:0,image:"",averageRating:null,reviewsCount:null,featuredImage:"",color:"",productCategory:"",billingPeriod:"",billingPeriodInterval:0,currency:"",isOnSale:!1,regularPrice:0,type:""};function a(){return"promoted"===n.label}function u(o,t){const{tracksData:r}=e;r.position&&(t.position=r.position),r.label&&(t.label=r.label),r.group&&(t.group=r.group),r.group_id&&(t.group_id=r.group_id),r.searchTerm&&(t.search_term=r.searchTerm),r.category&&(t.category=r.category),t.tab=c.tab||"discover",(0,m.queueRecordEvent)(o,t)}const d=r===P.k.theme,p=r===P.k.businessService;let _=n?.vendorName;n?.vendorName&&n?.vendorUrl&&(_=(0,s.jsx)("a",{href:n.vendorUrl,rel:"noopener noreferrer",onClick:()=>{u("marketplace_product_card_vendor_clicked",{product:n.title,vendor:n.vendorName,product_type:r})},children:n.vendorName}));const g=(0,C.Z)("woocommerce-marketplace__product-card",`woocommerce-marketplace__product-card--${r}`,{"is-loading":t,"is-small":e.small,"is-sponsored":a()}),w=()=>(0,s.jsx)("a",{className:"woocommerce-marketplace__product-card__link",href:c.ref?(0,G.lk)(n.url,[["utm_content",c.ref]]):n.url,rel:"noopener noreferrer",target:"_blank",onClick:()=>{u("marketplace_product_card_clicked",{product_id:n.id,product_name:n.title,vendor:n.vendorName,product_type:r})},children:t?" ":n.title}),h=(0,Z.decodeEntities)(n.description),x=()=>(0,s.jsxs)("div",{className:"woocommerce-marketplace__business-card",children:[(0,s.jsx)("div",{className:"woocommerce-marketplace__business-card__header",style:{backgroundColor:n.color},children:(0,s.jsx)("img",{src:`${n.featuredImage}?h=288`,alt:""})}),(0,s.jsxs)("div",{className:"woocommerce-marketplace__business-card__content",children:[(0,s.jsxs)("div",{className:"woocommerce-marketplace__business-card__main-content",children:[(0,s.jsx)("h2",{children:(0,s.jsx)(w,{})}),(0,s.jsx)("p",{className:"woocommerce-marketplace__product-card__description",children:h})]}),(0,s.jsx)("div",{className:"woocommerce-marketplace__business-card__badge",children:(0,s.jsx)("span",{children:n.productCategory})})]})]});return(0,s.jsx)(l.Card,{className:g,id:`product-${n.id}`,tabIndex:-1,"aria-hidden":t,style:a()&&n.primary_color?{background:`linear-gradient(${n.primary_color} 0, ${n.primary_color} 5px, white 5px, white)`}:{},children:p?(0,s.jsx)(x,{}):(0,s.jsxs)("div",{className:"woocommerce-marketplace__product-card__content",children:[d&&(0,s.jsx)("div",{className:"woocommerce-marketplace__product-card__image",children:!t&&(0,s.jsx)("img",{className:"woocommerce-marketplace__product-card__image-inner",src:n.image,alt:n.title})}),(0,s.jsx)("div",{className:"woocommerce-marketplace__product-card__header",children:(0,s.jsxs)("div",{className:"woocommerce-marketplace__product-card__details",children:[!d&&(0,s.jsxs)(s.Fragment,{children:[t&&(0,s.jsx)("div",{className:"woocommerce-marketplace__product-card__icon"}),!t&&n.icon&&(0,s.jsx)("img",{className:"woocommerce-marketplace__product-card__icon",src:n.icon,alt:n.title})]}),(0,s.jsxs)("div",{className:"woocommerce-marketplace__product-card__meta",children:[(0,s.jsx)("h2",{className:"woocommerce-marketplace__product-card__title",children:(0,s.jsx)(w,{})}),t&&(0,s.jsx)("p",{className:"woocommerce-marketplace__product-card__vendor-details",children:(0,s.jsx)("span",{className:"woocommerce-marketplace__product-card__vendor"})}),!t&&(0,s.jsxs)("p",{className:"woocommerce-marketplace__product-card__vendor-details",children:[_&&(0,s.jsxs)("span",{className:"woocommerce-marketplace__product-card__vendor",children:[(0,s.jsx)("span",{children:(0,i.__)("By ","woocommerce")}),_]}),_&&a()&&(0,s.jsx)("span",{"aria-hidden":"true",className:"woocommerce-marketplace__product-card__vendor-details__separator",children:"·"}),a()&&(0,s.jsx)("span",{className:"woocommerce-marketplace__product-card__sponsored-label",children:(0,i.__)("Sponsored","woocommerce")})]})]})]})}),!d&&(0,s.jsx)("p",{className:"woocommerce-marketplace__product-card__description",children:!t&&h}),P.k.businessService!==e?.product?.type&&(0,s.jsxs)("footer",{className:"woocommerce-marketplace__product-card__footer",children:[t&&(0,s.jsx)("div",{className:"woocommerce-marketplace__product-card__price"}),!t&&e.product&&(0,s.jsx)(R,{product:e.product})]})]})})};var V=t(74639);function W(e){const o=(0,c.O3)("wccomHelper",{}),[t,n]=(0,r.useState)(e.products),[a,i]=(0,r.useState)(1),l=()=>{const e=window.innerWidth;i(e>=1920?4:e>=1024?3:e>=769?2:1)};(0,r.useEffect)((()=>(l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l))),[]),(0,r.useEffect)((()=>{if(!e.productGroup)return;if(e.products.length<a)return void n(e.products);let o=Math.floor(e.products.length/a);1===a&&(o=Math.min(o,4)),2===a&&(o=Math.min(o,2)),n(e.products.slice(0,o*a))}),[a,e.products,e.productGroup]);const m=2*a-1,u=(0,C.Z)("woocommerce-marketplace__product-list-content",e.className);return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:u,children:t.map(((t,n)=>(0,s.jsxs)(r.Fragment,{children:[(0,s.jsx)(F,{type:e.type,product:{id:t.id,slug:t.slug,title:t.title,image:t.image,type:t.type,freemium_type:t.freemium_type,icon:t.icon,label:t.label,primary_color:t.primary_color,vendorName:t.vendorName,vendorUrl:t.vendorUrl?(0,G.lk)(t.vendorUrl,[["utm_source","extensionsscreen"],["utm_medium","product"],["utm_campaign","wcaddons"],["utm_content","devpartner"]]):"",price:t.price,url:(0,G.lk)(t.url,Object.entries({...o.inAppPurchaseURLParams,...void 0!==e.productGroup?{utm_group:e.productGroup}:{}})),averageRating:t.averageRating,reviewsCount:t.reviewsCount,description:t.description,isInstallable:t.isInstallable,color:t.color,featuredImage:t.featuredImage,productCategory:t.productCategory,billingPeriod:t.billingPeriod,billingPeriodInterval:t.billingPeriodInterval,currency:t.currency,isOnSale:t.isOnSale,regularPrice:t.regularPrice},tracksData:{position:n+1,...t.label&&{label:t.label},...e.productGroup&&{group_id:e.productGroup},...e.group&&{group:e.group},...e.searchTerm&&{searchTerm:e.searchTerm},...e.category&&{category:e.category}}},t.id),n===m&&"theme"===e.type&&(0,s.jsx)(V.$p,{redirectToCYSFlow:()=>{const e=(0,Y.addQueryArgs)(`${c.SX}admin.php`,{page:"wc-admin",path:"/customize-store/design"});window.location.href=e}})]},t.id)))})})}var H=t(86020);function $(e){const{title:o,description:t,groupURL:r,groupURLText:c,groupURLType:n}=e,a=""===o,l=(0,C.Z)("woocommerce-marketplace__product-list-header",{"is-loading":a});return(0,s.jsxs)("div",{className:l,"aria-hidden":a,children:[(0,s.jsx)("h2",{className:"woocommerce-marketplace__product-list-title",children:o}),t&&(0,s.jsx)("p",{className:"woocommerce-marketplace__product-list-description",children:t}),null!==r&&(0,s.jsx)("span",{className:"woocommerce-marketplace__product-list-link",children:(0,s.jsx)(H.Link,{href:r,type:n,target:"external"===n?"_blank":void 0,onClick:()=>{(0,m.recordEvent)("marketplace_see_more_clicked",{group_title:o,group_url:r})},children:null!=c?c:(0,i.__)("See more","woocommerce")})})]})}function J(e){const{title:o,description:t,products:r,groupURL:c,type:n,productGroup:a,groupURLText:i,groupURLType:l}=e;return(0,s.jsxs)("div",{className:"woocommerce-marketplace__product-list",children:[(0,s.jsx)($,{title:o,groupURL:c,groupURLText:i,description:t,groupURLType:l}),(0,s.jsx)(W,{group:o,products:r,type:n,productGroup:a})]})}function K(e){const{hasTitle:o,type:t}=e,r=e.placeholderCount||12;return(0,s.jsxs)("div",{className:"woocommerce-marketplace__product-list",children:[!1!==o&&(0,s.jsx)($,{title:"",groupURL:null,description:"",groupURLText:null,groupURLType:void 0}),(0,s.jsx)("div",{className:"woocommerce-marketplace__product-list-content",children:[...Array(r)].map(((e,o)=>(0,s.jsx)(F,{isLoading:!0,type:t,tracksData:{}},o)))})]})}function q(e){if(""===e.category)return;const o=e.view||"discover",t=e.search_term||null,r=e.product_type||null,c=e.category||null,s={...o&&{view:o},...t&&{search_term:t},...r&&{product_type:r},...c&&{category:c}};o&&["extensions","themes","business-services"].includes(o)&&!c&&(s.category="_all"),(0,m.recordEvent)("marketplace_view",s)}function X(){const[e,o]=(0,r.useState)([]),t=(0,r.useContext)(n),{isLoading:c,setIsLoading:a}=t;if((0,r.useEffect)((()=>{a(!0),(0,G.DS)().then((e=>Array.isArray(e)?e:[])).then((e=>{o(e),function(e){const o=e.flatMap((e=>e.items)).map((e=>e.id));(0,m.recordEvent)("marketplace_discover_viewed",{view:"discover",product_ids:o}),q({view:"discover"})}(e)})).finally((()=>{a(!1)}))}),[]),c)return(0,s.jsx)("div",{className:"woocommerce-marketplace__discover",children:(0,s.jsx)(K,{placeholderCount:9,type:P.k.extension})});const i=e.flatMap((e=>e));return(0,s.jsx)("div",{className:"woocommerce-marketplace__discover",children:i.map((e=>(0,s.jsx)(J,{productGroup:e.id,title:e.title,description:e.description,products:e.items,groupURL:e.url,groupURLText:e.url_text,groupURLType:e.url_type,type:e.itemType},e.id)))})}var ee=t(9818),oe=t(94333);function te(e){const o=""===e.label,t=(0,C.Z)("woocommerce-marketplace__category-item-button",{"woocommerce-marketplace__category-item-button--selected":e.selected,"is-loading":o});return(0,s.jsx)("button",{className:t,onClick:function(e){const o=e.currentTarget.value;o&&(0,z.navigateTo)({url:(0,z.getNewPath)({category:o})})},value:e.slug,"aria-hidden":o,children:e.label})}var re=t(91667),ce=t(58176);function se(e){function o(o){const t=o.currentTarget.value;t&&(e.onClick(),(0,z.navigateTo)({url:(0,z.getNewPath)({category:t})}))}return(0,s.jsx)("ul",{className:"woocommerce-marketplace__category-dropdown-list",children:e.categories.map((t=>(0,s.jsx)("li",{className:"woocommerce-marketplace__category-dropdown-item",children:(0,s.jsx)("button",{className:(0,C.Z)("woocommerce-marketplace__category-dropdown-item-button",{"woocommerce-marketplace__category-dropdown-item-button--selected":t.slug===e.selected?.slug}),value:t.slug,onClick:o,children:t.label})},t.slug)))})}function ne(e){return(0,s.jsx)(l.Dropdown,{renderToggle:({isOpen:o,onToggle:t})=>(0,s.jsxs)("button",{onClick:()=>{o||(0,m.recordEvent)("marketplace_category_dropdown_opened",{type:e.type}),t()},className:e.buttonClassName,"aria-label":(0,i.__)("Toggle category dropdown","woocommerce"),children:[e.label,(0,s.jsx)(w.Z,{icon:o?re.Z:ce.Z,size:e.arrowIconSize})]}),className:e.className,renderContent:({onToggle:o})=>(0,s.jsx)(se,{categories:e.categories,selected:e.selected,onClick:o}),contentClassName:e.contentClassName})}const ae={[P.k.extension]:"_all",[P.k.theme]:"themes",[P.k.businessService]:"business-services"};function ie(e){const[o,t]=(0,r.useState)(),[c,n]=(0,r.useState)(!1),[a,m]=(0,r.useState)([]),[u,d]=(0,r.useState)(!1),[p,_]=(0,r.useState)("start"),g=(0,r.useRef)(null),w=(0,r.useRef)(null),h=(0,z.useQuery)();function x(){if(g.current&&g.current.parentElement?.scrollWidth){const e=g.current.scrollWidth>g.current.parentElement.scrollWidth;d(e)}}(0,r.useEffect)((()=>{n(!0),(0,G.pE)(e.type).then((e=>{const o=e.map((e=>({...e,selected:!1}))).filter((e=>"_featured"!==e.slug));m(o)})).catch((()=>{m([])})).finally((()=>{n(!1)}))}),[e.type,m]),(0,r.useEffect)((()=>{let o=ae[e.type];h.category&&(o=h.category);const r=a.find((e=>e.slug===o));r&&t(r)}),[h.category,e.type,a]),(0,r.useEffect)((()=>{w.current&&w.current.scrollIntoView({block:"nearest",inline:"center"})}),[o]);const M=(0,oe.useDebounce)(x,300),j=(0,oe.useDebounce)((function(){const e=g.current;if(!e)return;const{scrollLeft:o,scrollWidth:t,clientWidth:r}=e;o<10?_("start"):o+r<t?_("middle"):o+r===t&&_("end")}),100);function y(e){g.current&&g.current.scrollTo({left:g.current.scrollLeft+e,behavior:"smooth"})}return(0,r.useEffect)((()=>{window.addEventListener("resize",M);const e=g.current;return e&&e.addEventListener("scroll",j),()=>{window.removeEventListener("resize",M),e&&e.removeEventListener("scroll",j)}}),[M,j]),(0,r.useEffect)((()=>{x()}),[a]),c?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("ul",{className:"woocommerce-marketplace__category-selector",children:[...Array(5)].map(((e,o)=>(0,s.jsx)("li",{className:"woocommerce-marketplace__category-item",children:(0,s.jsx)(te,{slug:"",label:"",selected:!1})},o)))})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("ul",{className:"woocommerce-marketplace__category-selector","aria-label":"Categories",ref:g,children:a.map((e=>(0,s.jsx)("li",{className:"woocommerce-marketplace__category-item",ref:e.slug===o?.slug?w:null,children:(0,s.jsx)(te,{...e,selected:e.slug===o?.slug,"aria-current":e.slug===o?.slug})},e.slug)))}),(0,s.jsx)("div",{className:"woocommerce-marketplace__category-selector--full-width",children:(0,s.jsx)(ne,{type:e.type,label:function(){const e=(0,i.__)("All Categories","woocommerce");return o?"All"===o.label?e:o.label:e}(),categories:a,buttonClassName:"woocommerce-marketplace__category-dropdown-button",className:"woocommerce-marketplace__category-dropdown",contentClassName:"woocommerce-marketplace__category-dropdown-content",selected:o})}),u&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:function(){y(-200)},className:"woocommerce-marketplace__category-navigation-button woocommerce-marketplace__category-navigation-button--prev",hidden:"start"===p,"aria-label":"Scroll to previous categories",tabIndex:-1,children:(0,s.jsx)(l.Icon,{icon:"arrow-left-alt2"})}),(0,s.jsx)("button",{onClick:function(){y(200)},className:"woocommerce-marketplace__category-navigation-button woocommerce-marketplace__category-navigation-button--next",hidden:"end"===p,"aria-label":"Scroll to next categories",tabIndex:-1,children:(0,s.jsx)(l.Icon,{icon:"arrow-right-alt2"})})]})]})}function le(e){const[o,t]=(0,r.useState)(),[c,n]=(0,r.useState)(!1),a={[P.B.all]:["most-popular","popular-themes","business-services"],[P.B.theme]:["popular-themes"],[P.B.extension]:["most-popular"],[P.B.businessService]:["business-services"]};return(0,r.useEffect)((()=>{n(!0),(0,G.DS)().then((o=>{const r=a[e.type];if(!r)return;const c=o.filter((e=>r.includes(e.id)));c&&(c.forEach((e=>{e.items=e.items.slice(0,4)})),t(c))})).catch((()=>{t(void 0)})).finally((()=>{n(!1)}))}),[]),(0,s.jsxs)("div",{className:"woocommerce-marketplace__no-results",children:[function(){if(e.type===P.B.all)return(0,s.jsx)(s.Fragment,{});let o=P.k.extension;return e.type===P.B.theme&&(o=P.k.theme),e.type===P.B.businessService&&(o=P.k.businessService),(0,s.jsx)(ie,{type:o})}(),(0,s.jsxs)("div",{className:"woocommerce-marketplace__no-results__content",children:[(0,s.jsx)("h2",{className:"woocommerce-marketplace__no-results__heading",children:e.showHeading?e.heading:""}),(0,s.jsx)("p",{className:"woocommerce-marketplace__no-results__description",children:(0,i.__)("Try searching again using a different term, or take a look at our recommendations below.","woocommerce")})]}),(0,s.jsx)("div",{className:"woocommerce-marketplace__no-results__product-groups",children:c?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(K,{type:P.k.extension,placeholderCount:4}),(0,s.jsx)(K,{type:P.k.theme,placeholderCount:4}),(0,s.jsx)(K,{type:P.k.businessService,placeholderCount:4})]}):o&&0!==o.length?(0,s.jsx)(s.Fragment,{children:o.map((e=>{return(0,s.jsx)(J,{title:(o=e.id,"popular-themes"===o?(0,i.__)("Our favorite themes","woocommerce"):"business-services"===o?(0,i.__)("Services to help your business grow","woocommerce"):(0,i.__)("Most popular extensions","woocommerce")),description:e.description,products:e.items,groupURL:e.url,productGroup:e.id,type:e.itemType,groupURLText:e.url_text,groupURLType:e.url_type},e.id);var o}))}):(0,s.jsx)(s.Fragment,{})})]})}var me=t(35530);const ue={[P.k.extension]:{label:(0,i.__)("extensions","woocommerce"),singularLabel:(0,i.__)("extension","woocommerce")},[P.k.theme]:{label:(0,i.__)("themes","woocommerce"),singularLabel:(0,i.__)("theme","woocommerce")},[P.k.businessService]:{label:(0,i.__)("business services","woocommerce"),singularLabel:(0,i.__)("business service","woocommerce")}};function de(e){var o,t;const a=(0,r.useContext)(n),{isLoading:m}=a,u=ue[e.type].label,d=(0,z.useQuery)(),p=d?.category,_=(0,ee.useSelect)((e=>e("core").getCurrentTheme()),[]),g="twentytwentyfour"===_?.stylesheet,[w,h]=(0,r.useState)(!1),x=(0,Y.addQueryArgs)(`${c.SX}admin.php`,{page:"wc-admin",path:"/customize-store/design"}),M=(0,Y.addQueryArgs)(`${c.SX}admin.php`,{page:"wc-admin",path:"/customize-store/assembler-hub"}),j=(0,ee.useSelect)((e=>e(B.onboardingStore).getTask("customize-store")),[]),y=null!==(o=e.showAllButton)&&void 0!==o&&o,N=null!==(t=e.products)&&void 0!==t?t:[],v="business services"===u?"business-services":u,b="woocommerce-marketplace__search-",k=(0,C.Z)(b+v),f=(0,C.Z)("woocommerce-marketplace__view-all-button",b+"button-"+v);if(m)return(0,s.jsxs)(s.Fragment,{children:[e.categorySelector&&(0,s.jsx)(ie,{type:e.type}),(0,s.jsx)(K,{hasTitle:!1,type:e.type})]});if(0===N.length){let o=P.B.all;switch(e.type){case P.k.extension:o=P.B.extension;break;case P.k.theme:o=P.B.theme;break;case P.k.businessService:o=P.B.businessService}return(0,s.jsx)(le,{type:o,showHeading:!1})}const I=(0,C.Z)(y?"woocommerce-marketplace__product-list-content--collapsed":"");return(0,s.jsxs)("div",{className:k,children:[(0,s.jsxs)("nav",{className:"woocommerce-marketplace__sub-header",children:[(0,s.jsx)("div",{className:"woocommerce-marketplace__sub-header__categories",children:e.categorySelector&&(0,s.jsx)(ie,{type:e.type})}),"theme"===e.type&&(0,s.jsx)(l.Button,{className:"woocommerce-marketplace__customize-your-store-button",variant:"secondary",text:(0,i.__)("Design your own","woocommerce"),onClick:()=>{g?window.location.href=j?.isComplete?M:x:h(!0)}})]}),w&&(0,s.jsx)(me.Nh,{setIsModalOpen:h,redirectToCYSFlow:()=>{window.location.href=x}}),(0,s.jsx)(W,{products:N,type:e.type,className:I,searchTerm:e.searchTerm,category:p}),"theme"===e.type&&(0,s.jsxs)("div",{className:"woocommerce-marketplace__browse-wp-theme-directory",children:[(0,s.jsx)("b",{children:(0,i.__)("Didn’t find a theme you like?","woocommerce")}),(0,r.createInterpolateElement)((0,i.__)(" Browse the <a>WordPress.org theme directory</a> to discover more.","woocommerce"),{a:(0,s.jsx)("a",{href:c.SX+"theme-install.php?search=e-commerce"})})]}),y&&(0,s.jsx)(l.Button,{className:f,variant:"secondary",text:(0,i.__)("View all","woocommerce"),onClick:()=>{return o=e.type,void(0,z.navigateTo)({url:(0,z.getNewPath)({section:o})});var o}})]})}var pe=t(85800),_e=t(86989),ge=t.n(_e),we=t(42879);const he=(0,r.createContext)({subscriptions:[],setSubscriptions:()=>{},loadSubscriptions:()=>new Promise((()=>{})),refreshSubscriptions:()=>new Promise((()=>{})),isLoading:!0,setIsLoading:()=>{}});function xe(e){const[o,t]=(0,r.useState)([]),[c,n]=(0,r.useState)(!0),a=e=>(!0===e&&n(!0),(0,G.jg)().then((e=>{t(e)})).finally((()=>{e&&n(!1)}))),l=e=>(e&&n(!0),(0,G.bn)().then((e=>{t(e)})).finally((()=>{e&&n(!1)})));(0,r.useEffect)((()=>{new URLSearchParams(window.location.search).get("install")?l(!0).catch((e=>{(0,G.Fy)("woocommerce-marketplace-refresh-subscriptions",(0,i.sprintf)((0,i.__)("Error refreshing subscriptions: %s","woocommerce"),e.message),we.Q.Error)})):a(!0).catch((e=>{(0,G.Fy)("woocommerce-marketplace-load-subscriptions",(0,i.sprintf)((0,i.__)("Error loading subscriptions: %s","woocommerce"),e.message),we.Q.Error)}))}),[]);const m={subscriptions:o,setSubscriptions:t,loadSubscriptions:a,refreshSubscriptions:l,isLoading:c,setIsLoading:n};return(0,s.jsx)(he.Provider,{value:m,children:e.children})}const Me=[{key:"name",label:(0,i.__)("Name","woocommerce")},{key:"expiry",label:(0,i.__)("Expires/Renews on","woocommerce")},{key:"subscription",label:(0,i.__)("Subscription","woocommerce")},{key:"version",label:(0,i.__)("Version","woocommerce")}];function je(e){if(e.isLoading)return(0,s.jsx)(H.TablePlaceholder,{caption:(0,i.__)("Loading your subscriptions","woocommerce"),headers:e.headers});const o=e.headers.map((e=>({...e,cellClassName:"woocommerce-marketplace__my-subscriptions__table__header--"+e.key})));return(0,s.jsx)(H.Table,{className:"woocommerce-marketplace__my-subscriptions__table",headers:o,rows:e.rows})}function ye(e){const o=[...Me,{key:"actions",label:(0,i.__)("Actions","woocommerce")}];if(!(e.isLoading||e.rows&&0!==e.rows.length)){const e=(0,z.getNewPath)({},x.Bd,{}),o=(0,r.createInterpolateElement)((0,i.__)("No extensions or themes installed. <a>Browse the Marketplace</a>","woocommerce"),{a:(0,s.jsx)("a",{href:e})});return(0,s.jsx)(H.EmptyTable,{numberOfRows:4,children:o})}return(0,s.jsx)(je,{rows:e.rows,isLoading:e.isLoading,headers:o})}function Ne(e){const o=[...Me,{key:"actions",label:(0,i.__)("Actions","woocommerce")}];return(0,s.jsx)(je,{rows:e.rows,isLoading:e.isLoading,headers:o})}var ve=t(69771),be=t(10961);let ke=function(e){return e.Warning="warning",e.Error="error",e.Info="info",e}({});function fe(e){var o;const[t,c]=(0,r.useState)(!1),{loadSubscriptions:n}=(0,r.useContext)(he),a=()=>{(0,m.recordEvent)("marketplace_product_connect_button_clicked",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id}),c(!0),(0,G.qq)(e.subscription.product_key),(0,G.Ts)(e.subscription).then((()=>{n(!1).then((()=>{(0,G.Fy)(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s successfully connected.","woocommerce"),e.subscription.product_name),we.Q.Success),c(!1),e.onClose&&e.onClose()}))})).catch((()=>{(0,G.Fy)(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s couldn’t be connected.","woocommerce"),e.subscription.product_name),we.Q.Error,{actions:[{label:(0,i.__)("Try again","woocommerce"),onClick:a,url:""}]}),c(!1),e.onClose&&e.onClose()}))};return(0,s.jsx)(l.Button,{onClick:a,variant:null!==(o=e.variant)&&void 0!==o?o:"secondary",isBusy:t,disabled:t,children:(0,i.__)("Connect","woocommerce")})}const Ie={installingProducts:[]},De=(0,ee.createReduxStore)("woocommerce-admin/installing",{reducer(e=Ie,o){switch(o.type){case"START_INSTALLING":return{...e,installingProducts:[...e.installingProducts,o.productKey]};case"STOP_INSTALLING":return{...e,installingProducts:[...e.installingProducts.filter((e=>e!==o.productKey))]}}return e},actions:{startInstalling:e=>({type:"START_INSTALLING",productKey:e}),stopInstalling:e=>({type:"STOP_INSTALLING",productKey:e})},selectors:{isInstalling:(e,o)=>!!e&&e.installingProducts.includes(o)}});function Te(e){var o;const{loadSubscriptions:t}=(0,r.useContext)(he),c=(0,ee.useSelect)((o=>o(De).isInstalling(e.subscription.product_key)),[e.subscription.product_key]),n=()=>{(0,ee.dispatch)(De).stopInstalling(e.subscription.product_key)},a=o=>{t(!1).then((()=>{let t=(0,i.sprintf)((0,i.__)("%s couldn’t be installed.","woocommerce"),e.subscription.product_name);!1===o?.success&&o?.data.message&&(t+=" "+o.data.message),(0,G.Fy)(e.subscription.product_key,t,we.Q.Error,{actions:[{label:(0,i.__)("Download and install manually","woocommerce"),url:"https://woocommerce.com/my-account/downloads/",onClick:()=>{}}]}),n(),e.onError&&e.onError()})),(0,m.recordEvent)("marketplace_product_install_failed",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id,product_current_version:e.subscription.version,error_message:o?.data?.message})};return(0,s.jsx)(l.Button,{variant:null!==(o=e.variant)&&void 0!==o?o:"link",isBusy:c,disabled:c,onClick:()=>{(0,m.recordEvent)("marketplace_product_install_button_clicked",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id,product_current_version:e.subscription.version}),(0,ee.dispatch)(De).startInstalling(e.subscription.product_key),(0,G.qq)(e.subscription.product_key),e.subscription.is_installable?(0,G.ot)(e.subscription).then((()=>{t(!1).then((()=>{(0,G.Fy)(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s successfully installed.","woocommerce"),e.subscription.product_name),we.Q.Success),n()})),(0,m.recordEvent)("marketplace_product_installed",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id,product_current_version:e.subscription.version}),e.onSuccess&&e.onSuccess()})).catch(a):(0,G.P0)(e.subscription).then((o=>{if((0,m.recordEvent)("marketplace_product_install_url",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id,product_current_version:e.subscription.version,product_install_url:o}),n(),!o)throw new Error;window.open(o,"_self")})).catch(a)},children:(0,i.__)("Install","woocommerce")})}function Ce(e){var o;return(0,s.jsx)(l.Button,{href:(0,G.oS)(e.subscription),variant:null!==(o=e.variant)&&void 0!==o?o:"secondary",onClick:function(){(0,m.queueRecordEvent)("marketplace_renew_button_clicked",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id})},children:(0,i.__)("Renew","woocommerce")})}function ze(e){var o;return(0,s.jsx)(l.Button,{href:(0,G.dG)(e.subscription),variant:null!==(o=e.variant)&&void 0!==o?o:"secondary",onClick:function(){(0,m.queueRecordEvent)("marketplace_auto_renew_button_clicked",{order_id:e.subscription.order_id,product_id:e.subscription.product_id})},children:(0,i.__)("Renew","woocommerce")})}function Ae(e){var o;return(0,s.jsx)(l.Button,{href:(0,G.SU)(e.subscription),variant:null!==(o=e.variant)&&void 0!==o?o:"secondary",onClick:function(){(0,m.queueRecordEvent)("marketplace_subscribe_button_clicked",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id})},children:(0,i.__)("Subscribe","woocommerce")})}function Se(e){return(0,s.jsxs)(l.Modal,{title:(0,i.__)("Connect to update","woocommerce"),onRequestClose:e.onClose,focusOnMount:!0,className:"woocommerce-marketplace__header-account-modal",style:{borderRadius:4},overlayClassName:"woocommerce-marketplace__header-account-modal-overlay",children:[(0,s.jsx)("p",{className:"woocommerce-marketplace__header-account-modal-text",children:(0,i.sprintf)((0,i.__)("Version %s is available. To enable this update you need to connect your subscription to this store.","woocommerce"),e.subscription.version)}),(0,s.jsxs)(l.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(l.Button,{variant:"tertiary",onClick:e.onClose,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Cancel","woocommerce")}),(0,s.jsx)(fe,{subscription:e.subscription,onClose:e.onClose,variant:"primary"})]})]})}function Le(e){return(0,s.jsxs)(l.Modal,{title:(0,i.__)("Renew to update","woocommerce"),onRequestClose:e.onClose,focusOnMount:!0,className:"woocommerce-marketplace__header-account-modal",style:{borderRadius:4},overlayClassName:"woocommerce-marketplace__header-account-modal-overlay",children:[(0,s.jsx)("p",{className:"woocommerce-marketplace__header-account-modal-text",children:(0,i.sprintf)((0,i.__)("Version %s is available. To enable this update you need to renew your subscription.","woocommerce"),e.subscription.version)}),(0,s.jsxs)(l.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(l.Button,{variant:"tertiary",onClick:e.onClose,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Cancel","woocommerce")}),(0,s.jsx)(Ce,{subscription:e.subscription,variant:"primary"})]})]})}function Ee(e){return(0,s.jsxs)(l.Modal,{title:(0,i.__)("Subscribe to update","woocommerce"),onRequestClose:e.onClose,focusOnMount:!0,className:"woocommerce-marketplace__header-account-modal",style:{borderRadius:4},overlayClassName:"woocommerce-marketplace__header-account-modal-overlay",children:[(0,s.jsx)("p",{className:"woocommerce-marketplace__header-account-modal-text",children:(0,i.sprintf)((0,i.__)("Version %s is available. To enable this update you need to purchase a subscription.","woocommerce"),e.subscription.version)}),(0,s.jsxs)(l.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(l.Button,{variant:"tertiary",onClick:e.onClose,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Cancel","woocommerce")}),(0,s.jsx)(Ae,{subscription:e.subscription,variant:"primary"})]})]})}(0,ee.register)(De);var Oe=t(9845);function Ue(e){const o=(0,c.O3)("wccomHelper",{});return o?.wooUpdateManagerInstalled?o?.wooUpdateManagerActive?null:(0,s.jsxs)(l.Modal,{title:(0,i.__)("Access your updates","woocommerce"),onRequestClose:e.onClose,focusOnMount:!0,className:"woocommerce-marketplace__header-account-modal",style:{borderRadius:4},overlayClassName:"woocommerce-marketplace__header-account-modal-overlay",children:[(0,s.jsx)("p",{className:"woocommerce-marketplace__header-account-modal-text",children:(0,s.jsx)("span",{dangerouslySetInnerHTML:(0,Oe.ZP)((0,i.sprintf)((0,i.__)("Version %s is available. To access this update, please <b>activate the WooCommerce.com Update Manager</b> extension.","woocommerce"),e.subscription.version))})}),(0,s.jsxs)(l.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(l.Button,{onClick:e.onClose,variant:"link",children:(0,i.__)("Cancel","woocommerce")}),(0,s.jsx)(l.Button,{href:x.DS,variant:"primary",children:(0,i.__)("Activate","woocommerce")})]})]}):(0,s.jsxs)(l.Modal,{title:(0,i.__)("Access your updates","woocommerce"),onRequestClose:e.onClose,focusOnMount:!0,className:"woocommerce-marketplace__header-account-modal",style:{borderRadius:4},overlayClassName:"woocommerce-marketplace__header-account-modal-overlay",children:[(0,s.jsx)("p",{className:"woocommerce-marketplace__header-account-modal-text",children:(0,s.jsx)("span",{dangerouslySetInnerHTML:(0,Oe.ZP)((0,i.sprintf)((0,i.__)("Version %s is available. To access this update, please first <b>install the WooCommerce.com Update Manager</b> extension. Alternatively, you can download and install it manually.","woocommerce"),e.subscription.version))})}),(0,s.jsxs)(l.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(l.Button,{href:x.eS,variant:"secondary",children:(0,i.__)("Download","woocommerce")}),(0,s.jsx)(l.Button,{href:o?.wooUpdateManagerInstallUrl,variant:"primary",children:(0,i.__)("Install","woocommerce")})]})]})}function Qe(e){const[o,t]=(0,r.useState)(!1),[c,n]=(0,r.useState)(!1),{loadSubscriptions:a}=(0,r.useContext)(he),u=e.subscription.active&&e.subscription.local&&e.subscription.local.slug&&e.subscription.local.path&&e.wooUpdateManagerActive;return(0,s.jsxs)(s.Fragment,{children:[o?""===e.subscription.product_key?(0,s.jsx)(Ee,{onClose:()=>t(!1),subscription:e.subscription}):e.subscription.expired?(0,s.jsx)(Le,{subscription:e.subscription,onClose:()=>t(!1)}):e.subscription.active?e.wooUpdateManagerActive?null:(0,s.jsx)(Ue,{subscription:e.subscription,onClose:()=>t(!1)}):(0,s.jsx)(Se,{subscription:e.subscription,onClose:()=>t(!1)}):null,(0,s.jsx)(l.Button,{variant:"link",className:"woocommerce-marketplace__my-subscriptions-update",onClick:function o(){(0,m.recordEvent)("marketplace_product_update_button_clicked",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id,product_installed_version:e.subscription.local.installed,product_current_version:e.subscription.version}),u?((0,G.qq)(e.subscription.product_key),window.wp.updates?(n(!0),(0,G.nM)(e.subscription).then((()=>{a(!1).then((()=>{(0,G.Fy)(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s updated successfully.","woocommerce"),e.subscription.product_name),we.Q.Success),n(!1)})),(0,m.recordEvent)("marketplace_product_updated",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id,product_installed_version:e.subscription.local.installed,product_current_version:e.subscription.version})})).catch((()=>{(0,G.Fy)(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s couldn’t be updated.","woocommerce"),e.subscription.product_name),we.Q.Error,{actions:[{label:(0,i.__)("Try again","woocommerce"),onClick:o,url:""}]}),n(!1),(0,m.recordEvent)("marketplace_product_update_failed",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id,product_installed_version:e.subscription.local.installed,product_current_version:e.subscription.version})}))):(0,G.Fy)(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s couldn’t be updated.","woocommerce"),e.subscription.product_name),we.Q.Error,{actions:[{label:(0,i.__)("Reload page and try again","woocommerce"),onClick:()=>{window.location.reload()},url:""}]})):t(!0)},isBusy:c,disabled:c,label:(0,i.sprintf)((0,i.__)("Update to %s","woocommerce"),e.subscription.version),showTooltip:!0,tooltipPosition:"top center",children:c?(0,i.__)("Updating","woocommerce"):(0,i.__)("Update","woocommerce")})]})}function Pe(e){const[o,t]=(0,r.useState)(!1),[c,n]=(0,r.useState)(!1),a=(0,r.useRef)(null);(0,r.useEffect)((()=>()=>{a.current&&clearTimeout(a.current)}),[]);const i=()=>{e.explanationOnHover&&(a.current&&clearTimeout(a.current),t(!0))},m=()=>{e.explanationOnHover&&(a.current&&clearTimeout(a.current),a.current=setTimeout((()=>{t(!1)}),350))};return(0,s.jsxs)("button",{onClick:()=>n(!c),onMouseOver:i,onFocus:i,onMouseOut:m,onBlur:m,className:(0,C.Z)("woocommerce-marketplace__my-subscriptions__product-status",`woocommerce-marketplace__my-subscriptions__product-status--${e.level}`),children:[e.text,""!==e.explanation&&(c||e.explanationOnHover&&o)&&(0,s.jsx)(l.Popover,{className:"woocommerce-marketplace__my-subscriptions__popover",position:"top center",focusOnMount:!1,onMouseOver:i,onMouseOut:m,onFocus:i,onBlur:m,children:e.explanation})]})}var Ye=t(25869);function Ze(e){const o=[{title:(0,i.__)("Manage in Plugins","woocommerce"),onClick:()=>{window.location.href=c.SX+"plugins.php"}}];return e.subscription.is_shared||o.unshift({title:(0,i.__)("Manage on WooCommerce.com","woocommerce"),onClick:()=>{window.open("https://woocommerce.com/my-account/my-subscriptions","_blank")}}),e.subscription.documentation_url&&o.unshift({title:(0,i.__)("View documentation","woocommerce"),onClick:()=>{window.open(e.subscription.documentation_url,"_blank")}}),(0,s.jsx)(l.DropdownMenu,{icon:Ye.Z,label:(0,i.__)("Actions","woocommerce"),controls:o})}function Be(e){return(0,s.jsx)("span",{className:"woocommerce-marketplace__my-subscriptions-version",children:e.span})}function Re(e,o){const t=(0,c.O3)("wccomHelper",{});return e.local.version===e.version?(0,s.jsx)(Be,{span:e.local.version}):e.local.version&&e.version&&"installed"===o?(0,s.jsx)(Qe,{subscription:e,wooUpdateManagerActive:t?.wooUpdateManagerActive}):e.version?(0,s.jsx)(Be,{span:e.version}):e.local.version?(0,s.jsx)(Be,{span:e.local.version}):""}function Ge(e){return(0,G.lk)(e,[["utm_source","subscriptionsscreen"],["utm_medium","product"],["utm_campaign","wcaddons"],["utm_content","product-name"]])}function Fe(e){let o=(0,s.jsx)(w.Z,{icon:be.Z,size:40});return e.product_icon&&(o=(0,s.jsx)("img",{src:e.product_icon,alt:(0,i.sprintf)((0,i.__)("%s icon","woocommerce"),e.product_name)})),{display:(0,s.jsxs)("div",{className:"woocommerce-marketplace__my-subscriptions__product",children:[(0,s.jsx)("a",{href:Ge(e.product_url),target:"_blank",rel:"noreferrer",children:(0,s.jsx)("span",{className:"woocommerce-marketplace__my-subscriptions__product-icon",children:o})}),(0,s.jsx)("a",{href:Ge(e.product_url),className:"woocommerce-marketplace__my-subscriptions__product-name",target:"_blank",rel:"noreferrer",children:e.product_name}),(0,s.jsx)("span",{className:"woocommerce-marketplace__my-subscriptions__product-statuses",children:e.is_shared&&(0,s.jsx)(Pe,{text:(0,i.__)("Shared with you","woocommerce"),level:ke.Info,explanation:(0,r.createInterpolateElement)((0,i.sprintf)((0,i.__)("This subscription was shared by <email>%s</email>. <link>Learn more</link>.","woocommerce"),e.owner_email),{email:(0,s.jsx)("strong",{style:{overflowWrap:"anywhere"},children:"email"}),link:(0,s.jsx)("a",{href:x.TC,rel:"nofollow noopener noreferrer",children:"Learn more"})})})})]}),value:e.product_name}}function Ve(e){const o=e.expires;if(!0===e.local.installed&&""===e.product_key)return{display:"",value:""};let t=(0,i.__)("Never expires","woocommerce");return o&&(t=(0,ve.gmdateI18n)("j M, Y",new Date(1e3*o))),{display:(0,s.jsx)("span",{className:"woocommerce-marketplace__my-subscriptions__expiry-date",children:t}),value:o}}function We(e,o){return{display:function(){const t=function(e,o){return""===e.product_key?{text:(0,i.__)("No subscription","woocommerce"),level:ke.Error,explanation:(0,r.createInterpolateElement)((0,i.__)("To receive updates and support, please <purchase>purchase</purchase> a subscription or use a subscription from another account by <sharing>sharing</sharing> or <transferring>transferring</transferring>.","woocommerce"),{purchase:(0,s.jsx)("a",{href:(0,G.SU)(e),rel:"nofollow noopener noreferrer",children:"renew"}),sharing:(0,s.jsx)("a",{href:x.TC,rel:"nofollow noopener noreferrer",children:"sharing"}),transferring:(0,s.jsx)("a",{href:x.Dc,rel:"nofollow noopener noreferrer",children:"sharing"})})}:e.expired?{text:(0,i.__)("Expired","woocommerce"),level:ke.Error,explanation:(0,r.createInterpolateElement)((0,i.__)("To receive updates and support, please <renew>renew</renew> this subscription or use a subscription from another account by <sharing>sharing</sharing> or <transferring>transferring</transferring>.","woocommerce"),{renew:(0,s.jsx)("a",{href:(0,G.oS)(e),rel:"nofollow noopener noreferrer",children:"renew"}),sharing:(0,s.jsx)("a",{href:x.TC,rel:"nofollow noopener noreferrer",children:"sharing"}),transferring:(0,s.jsx)("a",{href:x.Dc,rel:"nofollow noopener noreferrer",children:"sharing"})})}:e.expiring&&!e.autorenew?{text:(0,i.__)("Expires soon","woocommerce"),level:ke.Error,explanation:(0,r.createInterpolateElement)((0,i.__)("To receive updates and support, please <renew>renew</renew> this subscription before it expires or use a subscription from another account by <sharing>sharing</sharing> or <transferring>transferring</transferring>.","woocommerce"),{renew:(0,s.jsx)("a",{href:(0,G.dG)(e),rel:"nofollow noopener noreferrer",children:"renew"}),sharing:(0,s.jsx)("a",{href:x.TC,rel:"nofollow noopener noreferrer",children:"sharing"}),transferring:(0,s.jsx)("a",{href:x.Dc,rel:"nofollow noopener noreferrer",children:"sharing"})})}:!("installed"!==o||!e.local.installed||e.active)&&{text:(0,i.__)("Not connected","woocommerce"),level:ke.Warning,explanation:(0,i.__)("To receive updates and support, please connect your subscription to this store.","woocommerce")}}(e,o);var c;if(t)return(0,s.jsx)(Pe,{text:t.text,level:t.level,explanation:null!==(c=t.explanation)&&void 0!==c?c:"",explanationOnHover:!0});let n;return n=e.lifetime?(0,i.__)("Lifetime","woocommerce"):e.autorenew?(0,i.__)("Active","woocommerce"):(0,i.__)("Cancelled","woocommerce"),n}()}}function He(e,o){return{display:Re(e,o)}}function $e(e){let o=null;return""===e.product_key?o=(0,s.jsx)(Ae,{subscription:e}):e.expired&&!e.lifetime?o=(0,s.jsx)(Ce,{subscription:e}):!1===e.local.installed&&!1===e.subscription_installed?o=(0,s.jsx)(Te,{subscription:e}):!1===e.active&&!0===e.subscription_available?o=(0,s.jsx)(fe,{subscription:e,variant:"link"}):e.autorenew||e.lifetime||(o=(0,s.jsx)(ze,{subscription:e})),{display:(0,s.jsxs)("div",{className:"woocommerce-marketplace__my-subscriptions__actions",children:[o,(0,s.jsx)(Ze,{subscription:e})]})}}function Je(e,o){return[Fe(e),Ve(e),We(e,o),He(e,o),$e(e)]}const Ke="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1s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My45NDc0IDE4LjIwMzJDMTYuNTg1OSAxNy4zNzU4IDE4LjUgMTQuOTExNCAxOC41IDEyQzE4LjUgOC40MTAyMyAxNS41OSA1LjUwMDEzIDEyLjAwMDIgNS41VjcuMjVMOS4wMDAyNCA0Ljc1TDEyLjAwMDIgMi4yNVoiIGZpbGw9IiMwMDdDQkEiLz4KPC9zdmc+",qe="woocommerce-marketplace-refresh-subscriptions";function Xe(){const{refreshSubscriptions:e}=(0,r.useContext)(he),[o,t]=(0,r.useState)(!1),c=()=>{o||((0,G.qq)(qe),t(!0),e().then((()=>{(0,G.Fy)(qe,(0,i.__)("Subscriptions refreshed.","woocommerce"),we.Q.Success)})).catch((e=>{(0,G.Fy)(qe,(0,i.sprintf)((0,i.__)("Error refreshing subscriptions: %s","woocommerce"),e.message),we.Q.Error,{actions:[{label:(0,i.__)("Try again","woocommerce"),onClick:c,url:""}]})})).finally((()=>{t(!1)})))};return(0,s.jsxs)(l.Button,{className:"woocommerce-marketplace__refresh-subscriptions",onClick:c,isBusy:o,children:[(0,s.jsx)("img",{src:Ke,alt:(0,i.__)("Refresh subscriptions","woocommerce"),className:"woocommerce-marketplace__refresh-subscriptions-icon"}),(0,i.__)("Refresh","woocommerce")]})}const eo="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgaWQ9ImFsZXJ0Ij4KPHBhdGggaWQ9IlZlY3RvciIgZD0iTTEyIDIwQzE2LjQxODMgMjAgMjAgMTYuNDE4MyAyMCAxMkMyMCA3LjU4MTcyIDE2LjQxODMgNCAxMiA0QzcuNTgxNzIgNCA0IDcuNTgxNzIgNCAxMkM0IDE2LjQxODMgNy41ODE3MiAyMCAxMiAyMFoiIHN0cm9rZT0iI0NDMTgxOCIgc3Ryb2tlLXdpZHRoPSIxLjUiLz4KPHBhdGggaWQ9IlZlY3Rvcl8yIiBkPSJNMTMgN0gxMVYxM0gxM1Y3WiIgZmlsbD0iI0NDMTgxOCIvPgo8cGF0aCBpZD0iVmVjdG9yXzMiIGQ9Ik0xMyAxNUgxMVYxN0gxM1YxNVoiIGZpbGw9IiNDQzE4MTgiLz4KPC9nPgo8L3N2Zz4K";var oo=t(78152);function to(){const e=(0,ee.useSelect)((e=>e(oo.I).notices()),[]),o=e=>e.options?.actions?e.options?.actions.map((e=>({...e,variant:"link",className:"is-link"}))):[],t=[];for(const r of e)t.push((0,s.jsxs)(l.Notice,{className:"woocommerce-marketplace__notice--error",status:r.status,onRemove:()=>(0,G.qq)(r.productKey),actions:o(r),children:[(0,s.jsx)("img",{src:eo,alt:"",width:24,height:24}),r.message]},r.productKey));return(0,s.jsx)(s.Fragment,{children:t})}function ro(e){var o;const t=new URL((0,G.pS)());return e.install&&t.searchParams.set("install",e.install),(0,s.jsx)(l.Button,{href:t.href,variant:null!==(o=e.variant)&&void 0!==o?o:"secondary",children:(0,i.__)("Connect Account","woocommerce")})}function co(){const e=(0,z.useQuery)(),o=e?.install,t=(0,c.O3)("wccomHelper",{}),n=!!t?.isConnected,[a,m]=(0,r.useState)(!1),[u,d]=(0,r.useState)(!1),{subscriptions:p,isLoading:_}=(0,r.useContext)(he),g=p.find((e=>e.product_key===o)),w=(0,r.useCallback)((()=>{(0,z.navigateTo)({url:(0,z.getNewPath)({...e,install:void 0},x.Bd,{})})}),[e]);(0,r.useEffect)((()=>{_||(o&&n&&!_&&!g?((0,G.Fy)(o,(0,i.sprintf)((0,i.__)("Could not find subscription with product key %s.","woocommerce"),o),we.Q.Error),w()):m(!!o))}),[n,_,o,w,g]),(0,r.useEffect)((()=>{g&&g.local.installed&&d(!0)}),[g]);const h=()=>{w(),m(!1)};return a?(0,s.jsxs)(l.Modal,{title:u?(0,i.__)("You are ready to go!","woocommerce"):(0,i.__)("Add to store","woocommerce"),onRequestClose:h,focusOnMount:!0,className:"woocommerce-marketplace__header-account-modal has-size-medium",style:{borderRadius:4},overlayClassName:"woocommerce-marketplace__header-account-modal-overlay",children:[(()=>{if(!n)return(0,s.jsx)(l.Notice,{status:"warning",isDismissible:!1,children:(0,i.__)("In order to install a product, you need to first connect your account.","woocommerce")});if(g){const e=u?(0,i.__)("Keep the momentum going and start setting up your extension.","woocommerce"):(0,i.__)("Would you like to install this extension?","woocommerce");return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"woocommerce-marketplace__header-account-modal-text",children:e}),(0,s.jsx)(F,{product:(0,G.i1)(g),small:!0,tracksData:{position:1,group:"subscriptions",label:"install"}})]})}})(),(()=>{const e=[];return u?(e.push((0,s.jsx)(l.Button,{variant:"secondary",href:g?.documentation_url,target:"_blank",className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("View docs","woocommerce")},"docs")),e.push((0,s.jsx)(l.Button,{variant:"primary",href:x.DS,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("View in Plugins","woocommerce")},"plugin-list"))):(e.push((0,s.jsx)(l.Button,{variant:"tertiary",onClick:h,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Cancel","woocommerce")},"cancel")),n?g&&e.push((0,s.jsx)(Te,{subscription:g,variant:"primary",onError:h},"install")):e.push((0,s.jsx)(ro,{variant:"primary",install:o},"connect"))),(0,s.jsx)(l.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:e})})()]}):null}var so=t(84884);function no(){const{subscriptions:e,isLoading:o}=(0,r.useContext)(he),t=(0,c.O3)("wccomHelper",{}),n=(0,r.createInterpolateElement)((0,i.__)("WooCommerce.com extensions and themes installed on this store. To see all your subscriptions go to <a>your account<custom_icon /></a> on WooCommerce.com.","woocommerce"),{a:(0,s.jsx)("a",{href:"https://woocommerce.com/my-account/my-subscriptions",target:"_blank",rel:"nofollow noopener noreferrer",children:"your account"}),custom_icon:(0,s.jsx)(w.Z,{icon:pe.Z,size:12})}),a=e.filter((e=>e.subscription_installed)),m=e.filter((e=>!e.subscription_installed&&t?.wooUpdateManagerPluginSlug!==e.product_slug&&!e.maxed));if(!t?.isConnected){const e=(0,i.__)("Connect your WooCommerce.com account to get product updates, manage your subscriptions from your store admin, and get streamlined support.","woocommerce"),o=()=>{const e={notice_id:"woo-disconnect-notice",dismiss_notice_nonce:t?.dismissNoticeNonce||""};ge()({path:"/wc-admin/notice/dismiss",method:"POST",data:e}),localStorage.setItem("wc-marketplaceNoticeClosed-woo-disconnect-notice","false")};return(0,s.jsxs)(s.Fragment,{children:[t?.disconnected_notice&&(0,s.jsx)(so.Z,{id:"woo-disconnect-notice",description:t?.disconnected_notice,isDismissible:!0,variant:"info",onClose:o}),(0,s.jsxs)("div",{className:"woocommerce-marketplace__my-subscriptions--connect",children:[(0,s.jsx)(co,{}),(0,s.jsx)("div",{className:"woocommerce-marketplace__my-subscriptions__icon"}),(0,s.jsx)("h2",{className:"woocommerce-marketplace__my-subscriptions__header",children:(0,i.__)("Connect your WooCommerce.com account","woocommerce")}),(0,s.jsx)("p",{className:"woocommerce-marketplace__my-subscriptions__description",children:e}),(0,s.jsx)(l.Button,{href:(0,G.pS)(),variant:"primary",children:(0,i.__)("Connect","woocommerce")})]})]})}return(0,s.jsxs)(s.Fragment,{children:[t?.connected_notice&&(0,s.jsx)(so.Z,{id:"woo-connect-notice",description:t?.connected_notice,isDismissible:!0,variant:"success",onClose:()=>{const e={notice_id:"woo-connect-notice",dismiss_notice_nonce:t?.dismissNoticeNonce||""};ge()({path:"/wc-admin/notice/dismiss",method:"POST",data:e}),localStorage.setItem("wc-marketplaceNoticeClosed-woo-connect-notice","false")}}),(0,s.jsxs)("div",{className:"woocommerce-marketplace__my-subscriptions",children:[(0,s.jsx)(co,{}),(0,s.jsx)("section",{className:"woocommerce-marketplace__my-subscriptions__notices",children:(0,s.jsx)(to,{})}),(0,s.jsxs)("section",{className:"woocommerce-marketplace__my-subscriptions-section woocommerce-marketplace__my-subscriptions__installed",children:[(0,s.jsxs)("header",{className:"woocommerce-marketplace__my-subscriptions__header",children:[(0,s.jsxs)("div",{className:"woocommerce-marketplace__my-subscriptions__header-content",children:[(0,s.jsx)("h2",{className:"woocommerce-marketplace__my-subscriptions__heading",children:(0,i.__)("Installed on this store","woocommerce")}),(0,s.jsx)("p",{className:"woocommerce-marketplace__my-subscriptions__table-description",children:n})]}),(0,s.jsx)("div",{className:"woocommerce-marketplace__my-subscriptions__header-refresh",children:(0,s.jsx)(Xe,{})})]}),(0,s.jsx)("div",{className:"woocommerce-marketplace__my-subscriptions__table-wrapper",children:(0,s.jsx)(ye,{isLoading:o,rows:a.map((e=>Je(e,"installed")))})})]}),m.length>0&&(0,s.jsxs)("section",{className:"woocommerce-marketplace__my-subscriptions-section woocommerce-marketplace__my-subscriptions__available",children:[(0,s.jsx)("h2",{className:"woocommerce-marketplace__my-subscriptions__heading",children:(0,i.__)("Available to use","woocommerce")}),(0,s.jsx)("p",{className:"woocommerce-marketplace__my-subscriptions__table-description",children:(0,i.__)("WooCommerce.com subscriptions you haven't used yet.","woocommerce")}),(0,s.jsx)("div",{className:"woocommerce-marketplace__my-subscriptions__table-wrapper",children:(0,s.jsx)(Ne,{isLoading:o,rows:m.map((e=>Je(e,"available")))})})]})]})]})}var ao=function(e){return e[e.notConnected=0]="notConnected",e[e.notInstalled=1]="notInstalled",e[e.installing=2]="installing",e[e.installedCanActivate=3]="installedCanActivate",e[e.installedCannotActivate=4]="installedCannotActivate",e[e.installFailed=5]="installFailed",e[e.activating=6]="activating",e[e.activated=7]="activated",e[e.activationFailed=8]="activationFailed",e}(ao||{});const io=function(e){const[o,t]=(0,r.useState)(ao.notInstalled),[a,u]=(0,r.useState)(),[d,p]=(0,r.useState)(),[_,g]=(0,r.useState)(),[w,h]=(0,r.useState)(),[M,j]=(0,r.useState)(),[y,N]=(0,r.useState)(!1),[v,b]=(0,r.useState)(),{addInstalledProduct:k}=(0,r.useContext)(n),f=(0,z.useQuery)();function I(){t(ao.notInstalled),b(void 0),(0,z.navigateTo)({url:(0,z.getNewPath)({...f,install:void 0,installProduct:void 0},x.Bd,{})})}return(0,r.useEffect)((()=>{const e=(0,c.O3)("wccomHelper",{});p(e?.installedProducts),g(e?.isConnected)}),[]),(0,r.useEffect)((()=>{if(N(!1),!f.installProduct)return;const o=parseInt(f.installProduct,10),r=e.products.find((e=>e.id===o));if(r){if(d&&d.find((e=>e===r.slug)))return;_?t(ao.notInstalled):(t(ao.notConnected),b({status:"warning",message:(0,i.__)("In order to install a product, you need to first connect your account.","woocommerce")})),N(!0),u(r)}}),[f,e.products,d,_]),a&&y?(0,s.jsxs)(l.Modal,{title:o===ao.activated?(0,i.__)("You are ready to go!","woocommerce"):(0,i.__)("Add to Store","woocommerce"),onRequestClose:I,focusOnMount:!0,className:"woocommerce-marketplace__header-account-modal has-size-medium",style:{borderRadius:4},overlayClassName:"woocommerce-marketplace__header-account-modal-overlay",children:[v&&(0,s.jsx)(l.Notice,{status:v.status,isDismissible:!1,children:v.message}),(0,s.jsx)("p",{className:"woocommerce-marketplace__header-account-modal-text",children:o===ao.notConnected?"":o===ao.installedCanActivate||o===ao.activating?(0,i.__)("Extension successfully installed. Would you like to activate it?","woocommerce"):o===ao.installedCannotActivate?(0,i.__)("Extension successfully installed but we can't activate it at the moment. Please visit the plugins page to see more.","woocommerce"):o===ao.activated?(0,i.__)("Keep the momentum going and start setting up your extension.","woocommerce"):(0,i.__)("Would you like to install this extension?","woocommerce")}),a&&(0,s.jsx)(F,{product:a,small:!0,tracksData:{position:1,group:"install-flow",label:"install"}}),(0,s.jsxs)(l.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[o===ao.activated?M?(0,s.jsx)(l.Button,{variant:"tertiary",href:M,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("View Docs","woocommerce")},"docs"):(0,s.jsx)(s.Fragment,{}):(0,s.jsx)(l.Button,{variant:"tertiary",onClick:I,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Cancel","woocommerce")},"cancel"),o===ao.notConnected?(0,s.jsx)(ro,{variant:"primary"},"connect"):o===ao.installedCanActivate||o===ao.activating?(0,s.jsx)(l.Button,{variant:"primary",onClick:function(){w&&(t(ao.activating),(0,m.recordEvent)("marketplace_activate_new_product_clicked",{product_id:a?a.id:0}),fetch(w).then((()=>{t(ao.activated)})).catch((()=>{t(ao.activationFailed),b({status:"error",message:(0,i.__)("Activation failed. Please try again from the plugins page.","woocommerce")})})))},isBusy:o===ao.activating,disabled:o===ao.activating,children:(0,i.__)("Activate","woocommerce")},"activate"):o===ao.activated||o===ao.installedCannotActivate||o===ao.activationFailed?(0,s.jsx)(l.Button,{variant:"primary",href:x.DS,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("View in Plugins","woocommerce")},"plugin-list"):(0,s.jsx)(l.Button,{variant:"primary",onClick:function(){var e;a&&a.id&&((0,m.recordEvent)("marketplace_install_new_product_clicked",{product_id:a.id}),t(ao.installing),(e=a.id,ge()({path:"/wc/v3/marketplace/create-order",method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({product_id:e})})).then((e=>{var o,r;if(!e.success)throw e;return(0,ee.dispatch)(De).startInstalling(String(null!==(o=a.id)&&void 0!==o?o:"")),j(e.data.documentation_url),a.slug&&k(null!==(r=a.slug)&&void 0!==r?r:""),(0,G.CH)(e.data.product_type,e.data.zip_slug).then((e=>{var o;(0,ee.dispatch)(De).stopInstalling(String(null!==(o=a.id)&&void 0!==o?o:"")),e.data.activateUrl?(h(e.data.activateUrl),t(ao.installedCanActivate)):t(ao.installedCannotActivate)}))})).catch((e=>{var o;e.data.redirect_location?(b({status:"warning",message:(0,i.__)("We need your address to complete installing this product. We will redirect you to WooCommerce.com checkout. Afterwards, you will be able to install the product.","woocommerce")}),setTimeout((()=>{window.location.href=e.data.redirect_location}),5e3)):(t(ao.installFailed),b({status:"error",message:null!==(o=e.data.message)&&void 0!==o?o:(0,i.__)("An error occurred. Please try again later.","woocommerce")}))})))},isBusy:o===ao.installing,disabled:o===ao.installing||o===ao.installFailed,children:(0,i.__)("Install","woocommerce")},"install")]})]}):(0,s.jsx)(s.Fragment,{})};var lo=t(87287);function mo(){const e="woo-connect-notice-marketplace-dismissed",o=(0,c.O3)("wccomHelper",{}),t=o?.woocomConnectNoticeType||"none",r=(0,i.__)("Your store","woocommerce"),n=o?.storeName||r,a=n!==r?`<strong>${n}</strong>`:n;if("none"===t)return null;const u=localStorage.getItem(e),d=new Date(u||""),p=new Date;p.setMonth(p.getMonth()-1),(null===u||isNaN(d.valueOf())||p.valueOf()>d.valueOf())&&(localStorage.removeItem("wc-marketplaceNoticeClosed-woo-connect-notice"),localStorage.removeItem(e));const _={long:(0,i.sprintf)((0,i.__)("%s might be at risk because it’s running outdated WooCommerce plugins and is not yet connected to a WooCommerce.com account. Please complete the connection to get updates and streamlined support.","woocommerce"),a),short:(0,i.sprintf)((0,i.__)("%s is not yet connected to a WooCommerce.com account. Please complete the connection to get updates and streamlined support.","woocommerce"),a)}[t],g=(0,G.lk)((0,G.pS)(),[["utm_source","pu"],["utm_campaign","pu_in_apps_screen_connect"]]);return(0,s.jsxs)(so.Z,{id:"woo-connect-notice",description:_,isDismissible:!0,variant:"warning",className:"woocommerce-marketplace__connect-notice",onClose:()=>{localStorage.setItem(e,(new Date).toString()),(0,m.recordEvent)("woo_connect_notice_in_marketplace_dismissed")},onLoad:()=>{(0,m.recordEvent)("woo_connect_notice_in_marketplace_shown")},children:[(0,s.jsx)(l.Button,{href:g,variant:"primary",onClick:()=>((0,m.recordEvent)("woo_connect_notice_in_marketplace_clicked"),!0),children:(0,i.__)("Connect your store","woocommerce")}),(0,s.jsx)(l.Button,{href:"https://woocommerce.com/document/managing-woocommerce-com-subscriptions/#connect-your-site-woocommercecom-account",target:"_blank",variant:"tertiary",onClick:()=>((0,m.recordEvent)("woo_connect_notice_learn_more_clicked"),!0),children:(0,i.__)("Learn more","woocommerce")})]})}function uo(e){const o=(0,c.O3)("wccomHelper",{});if(!o?.isConnected)return null;const{selectedTab:t}=e;return"my-subscriptions"!==t&&o?.mySubscriptionsTabLoaded?null:o?.wooUpdateManagerActive||o?.wooUpdateManagerInstalled?o?.wooUpdateManagerInstalled&&!o?.wooUpdateManagerActive?(0,s.jsx)("section",{className:"woocommerce-marketplace__woo-update-manager-plugin__notices",children:(0,s.jsxs)(l.Notice,{status:"error",isDismissible:!1,children:[(0,s.jsx)("span",{dangerouslySetInnerHTML:(0,Oe.ZP)((0,i.__)("Activate the <b>WooCommerce.com Update Manager</b> to continue receiving the updates and streamlined support included in your WooCommerce.com subscriptions.","woocommerce"))}),(0,s.jsx)("div",{className:"components-notice__buttons",children:(0,s.jsx)(l.Button,{href:x.DS,variant:"secondary",children:(0,i.__)("Activate","woocommerce")})})]})}):null:(0,s.jsx)("section",{className:"woocommerce-marketplace__woo-update-manager-plugin__notices",children:(0,s.jsxs)(l.Notice,{status:"error",isDismissible:!1,children:[(0,s.jsx)("span",{dangerouslySetInnerHTML:(0,Oe.ZP)((0,i.__)("Please install the <b>WooCommerce.com Update Manager</b> to continue receiving the updates and streamlined support included in your WooCommerce.com subscriptions.<br/>Alternatively, you can download and install it manually.","woocommerce"))}),(0,s.jsxs)("div",{className:"components-notice__buttons",children:[(0,s.jsx)(l.Button,{href:o?.wooUpdateManagerInstallUrl,variant:"secondary",children:(0,i.__)("Install","woocommerce")}),(0,s.jsx)(l.Button,{href:x.eS,variant:"link",children:(0,i.__)("Download","woocommerce")})]})]})})}function po(e){const{type:o}=e,t=(0,c.O3)("wccomHelper",{}),r={"woo-subscription-expired-notice":{shown:"woo_subscription_expired_notice_in_marketplace_shown",clicked:"woo_subscription_expired_notice_in_marketplace_clicked",dismissed:"woo_subscription_expired_notice_in_marketplace_dismissed"},"woo-subscription-expiring-notice":{shown:"woo_subscription_expiring_notice_in_marketplace_shown",clicked:"woo_subscription_expiring_notice_in_marketplace_clicked",dismissed:"woo_subscription_expiring_notice_in_marketplace_dismissed"},"woo-subscription-missing-notice":{shown:"woo_subscription_missing_notice_in_marketplace_shown",clicked:"woo_subscription_missing_notice_in_marketplace_clicked",dismissed:"woo_subscription_missing_notice_in_marketplace_dismissed"}};let n=null,a="";const i=t?.dismissNoticeNonce||"";if("expired"===o)n=t?.subscription_expired_notice||{},a="woo-subscription-expired-notice";else if("expiring"===o)n=t?.subscription_expiring_notice||{},a="woo-subscription-expiring-notice";else{if("missing"!==o)return null;n=t?.subscription_missing_notice||{},a="woo-subscription-missing-notice"}return t.isConnected&&n?.description?(0,s.jsx)(so.Z,{id:a,description:n.description,isDismissible:!0,variant:"error",onClose:()=>{(0,m.recordEvent)(r[a].dismissed);const e={notice_id:a,dismiss_notice_nonce:i};ge()({path:"/wc-admin/notice/dismiss",method:"POST",data:e})},onLoad:function(){(0,m.recordEvent)(r[a].shown)},children:(0,s.jsx)(l.Button,{href:n.button_link,variant:"secondary",onClick:function(){(0,m.recordEvent)(r[a].clicked)},children:n.button_text})}):null}function _o(e){const{onLoadMore:o,isBusy:t,disabled:r}=e;return t&&(0,Q.speak)((0,i.__)("Loading more products","woocommerce")),(0,s.jsx)(l.Button,{className:"woocommerce-marketplace__load-more",variant:"secondary",onClick:function(){(0,m.queueRecordEvent)("marketplace_load_more_button_clicked",{}),o()},isBusy:t,disabled:r,children:(0,i.__)("Load more","woocommerce")})}function go(){const e=(0,r.useContext)(n),[o,t]=(0,r.useState)([]),[a,l]=(0,r.useState)([]),[u,d]=(0,r.useState)(1),[p,_]=(0,r.useState)(1),[g,w]=(0,r.useState)(1),[h,x]=(0,r.useState)(1),[M,j]=(0,r.useState)(1),[y,N]=(0,r.useState)(0),[v,b]=(0,r.useState)(!1),{isLoading:k,setIsLoading:f,selectedTab:I,setSearchResultsCount:D}=e,T=(0,z.useQuery)(),C=e=>{(0,Q.speak)((0,i.sprintf)((0,i.__)("%d products found","woocommerce"),e))},A=(0,r.useCallback)((()=>{b(!0);const e=new URLSearchParams,o=new AbortController;T.category&&"_all"!==T.category&&e.append("category",T.category),"themes"!==T.tab&&"business-services"!==T.tab||e.append("category",T.tab),T.term&&e.append("term",T.term);const r=(0,c.O3)("wccomHelper",!1);return r.storeCountry&&e.append("country",r.storeCountry),e.append("page",(u+1).toString()),(0,G.w6)(e,o.signal).then((e=>{t((o=>{const t=Array.isArray(o[0])?o.flat():o,r=e.products.filter((e=>!t.some((o=>o.id===e.id))));var c;return r.length>0&&N(null!==(c=r[0].id)&&void 0!==c?c:0),[...t,...r]})),(0,Q.speak)((0,i.__)("More products loaded","woocommerce")),d((e=>e+1)),b(!1)})).catch((()=>{(0,Q.speak)((0,i.__)("Error loading more products","woocommerce"))})).finally((()=>{b(!1)})),()=>{o.abort()}}),[u,T.category,T.term,T.tab,b]);return(0,r.useEffect)((()=>{if(u>1)return;const e=[{category:"extensions",type:P.k.extension},{category:"themes",type:P.k.theme},{category:"business-services",type:P.k.businessService}],o=e.map((()=>new AbortController));f(!0),t([]);const r=e=>{if(T.search){(0,m.recordEvent)("marketplace_search_finish",{tab:T.tab,total_products:e,category:T.category||"_all",search_term:T.term||""});const o=new URL(window.location.href);o.searchParams.delete("search"),window.history.replaceState(null,"",o.pathname+o.search)}};if(T.category&&"_all"!==T.category){const e=new URLSearchParams;e.append("category",T.category),T.term&&e.append("term",T.term);const s=(0,c.O3)("wccomHelper",!1);s.storeCountry&&e.append("country",s.storeCountry),(0,G.w6)(e,o[0].signal).then((e=>{t(e.products),_(e.totalPages),D({[T.tab]:e.totalProducts}),C(e.totalProducts),r(e.totalProducts)})).catch((()=>{t([])})).finally((()=>{f(!1)}))}else Promise.all(e.map((({category:e,type:t},r)=>{const s=new URLSearchParams;"extensions"!==e&&s.append("category",e),T.term&&s.append("term",T.term);const n=(0,c.O3)("wccomHelper",!1);return n.storeCountry&&s.append("country",n.storeCountry),(0,G.w6)(s,o[r].signal).then((e=>{const o=((e,o)=>e.map((e=>({...e,type:o}))))(e.products,t);return{products:o,totalPages:e.totalPages,totalProducts:e.totalProducts,type:t}}))}))).then((e=>{const o=e.flatMap((e=>e.products));t(o);const c={extensions:e.find((e=>"extension"===e.type))?.totalProducts,themes:e.find((e=>"theme"===e.type))?.totalProducts,"business-services":e.find((e=>"business-service"===e.type))?.totalProducts};D(c),e.forEach((e=>{switch(e.type){case P.k.extension:w(e.totalPages);break;case P.k.theme:x(e.totalPages);break;case P.k.businessService:j(e.totalPages)}}));const s=T.tab;r(c[s]),C(e.reduce(((e,o)=>e+o.totalProducts),0))})).catch((()=>{t([])})).finally((()=>{f(!1)}));return()=>{o.forEach((e=>{e.abort()}))}}),[T.tab,T.term,T.category,f,D,u]),(0,r.useEffect)((()=>{let e;switch(I){case"extensions":e=o.filter((e=>e.type===P.k.extension));break;case"themes":e=o.filter((e=>e.type===P.k.theme));break;case"business-services":e=o.filter((e=>e.type===P.k.businessService));break;default:e=[]}l(e)}),[I,o]),(0,r.useEffect)((()=>{const e={view:T?.tab,search_term:T?.term,product_type:T?.section,category:T?.category};q(e),function(e){if(e.product_type)return;let o="extensions_view";const t=e.view||"_featured",r=e.search_term||null,c=e.category||null,s={...t&&{section:t},...r&&{search_term:r},version:"2"};switch(t){case"extensions":s.section=c||"_all";break;case"themes":s.section="themes";break;case"my-subscriptions":o="subscriptions_view",s.section="helper"}(0,m.recordEvent)(o,s)}(e)}),[T?.tab,T?.term,T?.section,T?.category]),(0,r.useEffect)((()=>{d(1),N(0)}),[I,T?.category,T?.term]),(0,r.useEffect)((()=>{y&&setTimeout((()=>{const e=document.getElementById(`product-${y}`);e&&e.focus()}),0)}),[y]),(0,s.jsxs)("div",{className:"woocommerce-marketplace__content",children:[(0,s.jsx)(lo.Z,{format:"promo-card"}),(0,s.jsx)(lo.Z,{format:"notice"}),(0,s.jsx)(io,{products:a}),"business-services"!==I&&"my-subscriptions"!==I&&(0,s.jsx)(mo,{}),"business-services"!==I&&(0,s.jsx)(uo,{selectedTab:I}),"business-services"!==I&&(0,s.jsx)(po,{type:"expired"}),"business-services"!==I&&(0,s.jsx)(po,{type:"expiring"}),(()=>{switch(I){case"extensions":case"themes":case"business-services":return(0,s.jsx)(de,{products:a,categorySelector:!0,type:(0,G.rC)(I),searchTerm:T.term});case"discover":return(0,s.jsx)(X,{});case"my-subscriptions":return(0,s.jsx)(xe,{children:(0,s.jsx)(no,{})});default:return(0,s.jsx)(s.Fragment,{})}})(),!k&&(()=>{if(T.category&&"_all"!==T.category)return u<p;switch(I){case"extensions":return u<g;case"themes":return u<h;case"business-services":return u<M;default:return!1}})()&&(0,s.jsx)(_o,{onLoadMore:A,isBusy:v,disabled:v})]})}function wo(){const{selectedTab:e}=(0,r.useContext)(n),o="woocommerce-marketplace"+(e?" woocommerce-marketplace--"+e:"");return(0,s.jsxs)("div",{className:o,children:[(0,s.jsx)(U,{}),(0,s.jsx)(go,{}),(0,s.jsx)(b,{})]})}function ho(){return(0,s.jsx)(a,{children:(0,s.jsx)(wo,{})})}}}]);