????

Your IP : 18.191.194.2


Current Path : /home/multihiv/www/store/wp-content/plugins/woocommerce/assets/client/admin/chunks/
Upload File :
Current File : /home/multihiv/www/store/wp-content/plugins/woocommerce/assets/client/admin/chunks/marketplace.js

"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[9669],{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"})})},32196:(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:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})})},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"})})},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"})})},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",onClose:_,onLoad:h}=e,[w,g]=(0,c.useState)("true"!==localStorage.getItem(`wc-marketplaceNoticeClosed-${o}`));if((0,c.useEffect)((()=>{w&&"function"==typeof h&&h()}),[w]),!w)return null;const x=(0,r.Z)("woocommerce-marketplace__notice",`woocommerce-marketplace__notice--${p}`,{"is-dismissible":a}),v=d[n||"info"],y=(0,r.Z)("woocommerce-marketplace__notice-icon",`woocommerce-marketplace__notice-icon--${p}`);return(0,u.jsxs)("div",{className:x,children:[n&&(0,u.jsx)("span",{className:y,children:(0,u.jsx)(i.Z,{icon:v})}),(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:()=>{g(!1),localStorage.setItem(`wc-marketplaceNoticeClosed-${o}`,"true"),"function"==typeof _&&_()},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}`:""),h=(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 g(){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:[h,w]}),g()]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"promo-content-image",children:[h,g()]}),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})},h=()=>{(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:h},o):null;var i}))})}},32813:(e,o,t)=>{t.r(o),t.d(o,{default:()=>Ko});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);function l(){return(0,s.jsx)("h1",{className:"woocommerce-marketplace__header-title",children:(0,i.__)("Extensions","woocommerce")})}var m=t(55609),u=t(70444);const d=(0,s.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(u.Path,{fillRule:"evenodd",d:"M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",clipRule:"evenodd"})});var p=t(59550),_=t(85800);const h=(0,s.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(u.Path,{d:"M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"})});function w(e){const{setIsModalOpen:o,disconnectURL:t}=e,[c,n]=(0,r.useState)(!1),a=()=>o(!1);return(0,s.jsxs)(m.Modal,{title:(0,i.__)("Are you sure you want to disconnect?","woocommerce"),onRequestClose:a,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.__)("Keep your store connected to WooCommerce.com to get updates, manage your subscriptions, and receive streamlined support for your extensions and themes.","woocommerce")}),(0,s.jsxs)(m.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(m.Button,{variant:"tertiary",href:t,onClick:()=>n(!c),isBusy:c,isDestructive:!0,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Disconnect","woocommerce")}),(0,s.jsx)(m.Button,{variant:"primary",onClick:a,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Keep connected","woocommerce")})]})]})}const g="discover",x="https://woocommerce.com",v="/extensions",y="/wp-json/wccom-extensions/1.0/search",b="/wp-json/wccom-extensions/1.0/categories",j=x+"/cart/",f=x+"/my-account/my-subscriptions/",k=x+"/document/managing-woocommerce-com-subscriptions/#transfer-a-woocommerce-com-subscription",N=x+"/document/managing-woocommerce-com-subscriptions/#share-a-subscription",M=c.SX+"plugins.php",C=x+"/product-download/woo-update-manager";var S=t(86989),I=t.n(S),T=t(9818),E=t(53961);let L=function(e){return e.theme="theme",e.extension="extension",e.businessService="business-service",e}({}),A=function(e){return e.theme="theme",e.extension="extension",e.businessService="business-service",e.all="all",e}({}),D=function(e){return e.Success="success",e.Error="error",e}({});const z={notices:{}},O=(0,T.createReduxStore)("woocommerce-admin/subscription-notices",{reducer(e=z,o){switch(o.type){case"ADD_NOTICE":return{...e,notices:{...e.notices,[o.productKey]:{productKey:o.productKey,message:o.message,status:o.status,options:o.options}}};case"REMOVE_NOTICE":const t={...e.notices};return t[o.productKey]&&delete t[o.productKey],{...e,notices:t}}return e},actions:{addNotice:(e,o,t,r)=>({type:"ADD_NOTICE",productKey:e,message:o,status:t,options:r}),removeNotice:e=>({type:"REMOVE_NOTICE",productKey:e})},selectors:{notices:e=>e?Object.values(e.notices):[],getNotice(e,o){if(e)return e.notices[o]}}});(0,T.register)(O);const P=100,U=new Map;function Z(){for(;U.size>P;)U.delete(U.keys().next().value)}async function R(e,o){return U.get(e)?new Promise((o=>{o(U.get(e))})):new Promise(((t,r)=>{fetch(e,{signal:o}).then((e=>{if(!e.ok)throw new Error(e.statusText);return e.json()})).then((o=>{U.set(e,o),Z(),t(o)})).catch((()=>{r()}))}))}async function B(e,o){c.MV.userLocale&&!e.get("locale")&&e.set("locale",c.MV.userLocale);const t=x+y+"?"+e.toString();return new Promise(((e,r)=>{R(t,o).then((o=>{const t=o.products.map((e=>{var o,t,r;return{id:e.id,slug:e.slug,title:e.title,image:e.image,type:e.type,freemium_type:e.freemium_type,description:e.excerpt,vendorName:e.vendor_name,vendorUrl:e.vendor_url,icon:e.icon,url:e.link,price:null!==(o=e.raw_price)&&void 0!==o?o:e.price,regularPrice:e.regular_price,isOnSale:e.is_on_sale,averageRating:null!==(t=e.rating)&&void 0!==t?t:null,reviewsCount:null!==(r=e.reviews_count)&&void 0!==r?r:null,isInstallable:e.is_installable,featuredImage:e.featured_image,productCategory:e.product_category,color:e.color,billingPeriod:e.billing_period,billingPeriodInterval:e.billing_period_interval,currency:e.currency}})),r=o.total_pages,c=o.total_products;e({products:t,totalPages:r,totalProducts:c})})).catch(r)}))}async function Q(){let e="/wc/v3/marketplace/featured";c.MV.userLocale&&(e=`${e}?locale=${c.MV.userLocale}`);try{return await async function(e){const o=JSON.stringify(e);return U.get(o)?new Promise((e=>{e(U.get(o))})):new Promise(((t,r)=>{I()(e).then((e=>{U.set(o,e),Z(),t(e)})).catch((()=>{r()}))}))}({path:e.toString()})}catch(e){return[]}}function V(e){switch(e){case"themes":return L.theme;case"business-services":return L.businessService;default:return L.extension}}function H(e){if(!0===e.active)return Promise.resolve();const o=new URLSearchParams;return o.append("product_key",e.product_key),I()({path:"/wc/v3/marketplace/subscriptions/connect".toString(),method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o})}function G(e,o){return new Promise(((t,r)=>{window.wp.updates?window.wp.updates.ajax(e,{...o,success:e=>{t({success:!0,data:e})},error:e=>{r({success:!1,data:{message:e.errorMessage}})}}):r((0,i.__)("Please reload and try again","woocommerce"))}))}function F(e,o){return G("install-"+e,{slug:o})}function Y(e,o,t,r){t===D.Error?(0,T.dispatch)(O).addNotice(e,o,t,r):(r?.icon||(r={...r,icon:(0,s.jsx)(m.Icon,{icon:"saved"})}),(0,T.dispatch)(E.store).createSuccessNotice(o,r))}const W=e=>{(0,T.dispatch)(O).removeNotice(e)},$=e=>({id:e.product_id,title:e.product_name,image:"",type:e.product_type,description:"",vendorName:"",vendorUrl:"",icon:e.product_icon,url:e.product_url,price:-1,regularPrice:-1,isOnSale:!1,averageRating:null,reviewsCount:null,isInstallable:!1,currency:""}),K=(e,o)=>{if(!e)return e;const t=new URL(e);return t?(o.forEach((([e,o])=>{t.searchParams.set(e,o)})),t.toString()):e},q=e=>e.product_key?K(f,[["key",e.product_key.toString()]]):f,J=e=>K(j,[["renew_product",e.product_id.toString()],["product_key",e.product_key],["order_id",e.order_id.toString()]]),X=e=>K(j,[["add-to-cart",e.product_id.toString()]]),ee=()=>{const e=(0,c.O3)("wccomHelper",{});return e.connectURL?K(e.connectURL,[["redirect_admin_url",encodeURIComponent(window.location.href)]]):""},oe=e=>(0,s.jsx)(m.MenuItem,{...e});function te(){var e,o;const[t,n]=(0,r.useState)(!1),a=()=>n(!0),l=(0,c.O3)("wccomHelper",{}),u=null!==(e=l?.isConnected)&&void 0!==e&&e,g=ee(),v=l?.userEmail,y=null!==(o=l?.userAvatar)&&void 0!==o?o:d,b=x+"/my-dashboard/",j=u?b:g,f=u?(0,i.__)("Connected","woocommerce"):(0,i.__)("Not Connected","woocommerce");return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m.DropdownMenu,{className:"woocommerce-marketplace__user-menu",icon:u?(0,s.jsx)("img",{src:y,alt:"",className:"woocommerce-marketplace__menu-avatar-image"}):d,label:(0,i.__)("User options","woocommerce"),children:()=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(m.MenuGroup,{className:"woocommerce-layout__homescreen-display-options",label:f,children:[(0,s.jsx)(oe,{className:"woocommerce-marketplace__menu-item",href:j,children:u?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.Z,{icon:d,size:24,className:"woocommerce-marketplace__menu-icon"}),(0,s.jsx)("span",{className:"woocommerce-marketplace__main-text",children:v})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.Z,{icon:d,size:24,className:"woocommerce-marketplace__menu-icon"}),(0,s.jsxs)("div",{className:"woocommerce-marketplace__menu-text",children:[(0,i.__)("Connect account","woocommerce"),(0,s.jsx)("span",{className:"woocommerce-marketplace__sub-text",children:(0,i.__)("Manage your subscriptions, get updates and support for your extensions and themes.","woocommerce")})]})]})}),(0,s.jsxs)(oe,{href:b,children:[(0,s.jsx)(p.Z,{icon:_.Z,size:24,className:"woocommerce-marketplace__menu-icon"}),(0,i.__)("WooCommerce.com account","woocommerce")]})]}),u&&(0,s.jsx)(m.MenuGroup,{className:"woocommerce-layout__homescreen-display-options",children:(0,s.jsxs)(oe,{onClick:a,children:[(0,s.jsx)(p.Z,{icon:h,size:24,className:"woocommerce-marketplace__menu-icon"}),(0,i.__)("Disconnect account","woocommerce")]})})]})}),t&&(0,s.jsx)(w,{setIsModalOpen:n,disconnectURL:g})]})}var re,ce=t(80225),se=t(10431);const ne=(0,c.O3)("wccomHelper",{}),ae=null!==(re=ne?.wooUpdateCount)&&void 0!==re?re:0,ie=(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,se.navigateTo)({url:(0,se.getNewPath)({tab:e===g?void 0:e},v,t)})})(e,t))},a=[];for(const e in o)a.push(o[e]?.href?(0,s.jsx)("a",{className:(0,ce.Z)("woocommerce-marketplace__tab-button","components-button",`woocommerce-marketplace__tab-${e}`),href:o[e]?.href,children:o[e]?.title},e):(0,s.jsxs)(m.Button,{className:(0,ce.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,ce.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},le=e=>{const{additionalClassNames:o}=e,t=(0,r.useContext)(n),{isLoading:c,setSelectedTab:a}=t,{searchResultsCount:l}=t,m=(0,se.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:ae>0,updateCount:ae}})),[m,c,l]);return(0,r.useEffect)((()=>{m?.tab&&u[m.tab]?a(m.tab):Object.keys(m).length>0&&a(g)}),[m,a,u]),(0,s.jsx)("nav",{className:(0,ce.Z)("woocommerce-marketplace__tabs",o||[]),children:ie(t,u,m)})};var me=t(14599);const ue=function(){const[e,o]=(0,r.useState)(""),t=(0,i.__)("Search Marketplace","woocommerce"),c=(0,se.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,se.navigateTo)({url:(0,se.getNewPath)(t,v,{})}),[]};return(0,s.jsx)(m.SearchControl,{label:t,placeholder:t,value:e,onChange:o,onKeyUp:e=>{"Enter"===e.key&&n(),"Escape"===e.key&&o("")},onClose:()=>{o(""),n("")},onFocus:()=>{(0,me.recordEvent)("marketplace_search_start",{current_search_term:e,current_tab:c.tab})},className:"woocommerce-marketplace__search"})};function de(){return(0,s.jsxs)("header",{className:"woocommerce-marketplace__header",children:[(0,s.jsx)(l,{}),(0,s.jsx)(le,{additionalClassNames:["woocommerce-marketplace__header-tabs"]}),(0,s.jsx)(ue,{}),(0,s.jsx)("div",{className:"woocommerce-marketplace__header-meta",children:(0,s.jsx)(te,{})})]})}var pe=t(25158),_e=t(96483),he=t(22629),we=t(67221);const ge=function(e){const{product:o}=e,{user:t,currentUserCan:c}=(0,we.useUser)(),{selectedTab:a,isProductInstalled:l}=(0,r.useContext)(n),u={USD:"$%s",AUD:"A$%s",CAD:"C$%s",EUR:"€%s",GBP:"£%s"},d=e=>u[e]||"%s";function p(){return 0===o.price?(0,i.__)("Free download","woocommerce"):"primary"===o.freemium_type?(0,i.__)("Free plan available","woocommerce"):(0,i.sprintf)(d(o.currency),o.price)}function _(){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 h=o,!(t&&h&&c("install_plugins")&&h.isInstallable&&"theme"!==h.type&&"discover"!==a)||h.slug&&l(h.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"),p(),(0,i.sprintf)(d(o.currency),o.regularPrice),_()):0!==o.price&&"primary"!==o.freemium_type?(0,i.sprintf)((0,i.__)(" %1$s, %2$s ","woocommerce"),p(),_()):p()}),(0,s.jsx)("span",{"aria-hidden":!0,children:p()})]}),o.isOnSale&&(0,s.jsx)("span",{className:"woocommerce-marketplace__product-card__on-sale","aria-hidden":!0,children:(0,i.sprintf)(d(o.currency),o.regularPrice)}),(0,s.jsx)("span",{className:"woocommerce-marketplace__product-card__price-billing","aria-hidden":!0,children:_()})]}),(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)(m.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)(m.Button,{variant:"secondary",onClick:function(){(0,me.recordEvent)("marketplace_add_to_store_clicked",{product_id:o.id}),(0,se.navigateTo)({url:(0,se.getNewPath)({installProduct:o.id})})},children:(0,i.__)("Add to Store","woocommerce")})})});var h},xe=function(e){var o;const{isLoading:t,type:r}=e,c=(0,se.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 l(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,me.queueRecordEvent)(o,t)}const u=r===L.theme,d=r===L.businessService;let p=n?.vendorName;n?.vendorName&&n?.vendorUrl&&(p=(0,s.jsx)("a",{href:n.vendorUrl,rel:"noopener noreferrer",onClick:()=>{l("marketplace_product_card_vendor_clicked",{product:n.title,vendor:n.vendorName,product_type:r})},children:n.vendorName}));const _=(0,ce.Z)("woocommerce-marketplace__product-card",`woocommerce-marketplace__product-card--${r}`,{"is-loading":t,"is-small":e.small,"is-sponsored":a()}),h=()=>(0,s.jsx)("a",{className:"woocommerce-marketplace__product-card__link",href:c.ref?K(n.url,[["utm_content",c.ref]]):n.url,rel:"noopener noreferrer",onClick:()=>{l("marketplace_product_card_clicked",{product_id:n.id,product_name:n.title,vendor:n.vendorName,product_type:r})},children:t?" ":n.title}),w=(0,he.decodeEntities)(n.description),g=()=>(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)(h,{})}),(0,s.jsx)("p",{className:"woocommerce-marketplace__product-card__description",children:w})]}),(0,s.jsx)("div",{className:"woocommerce-marketplace__business-card__badge",children:(0,s.jsx)("span",{children:n.productCategory})})]})]});return(0,s.jsx)(m.Card,{className:_,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:d?(0,s.jsx)(g,{}):(0,s.jsxs)("div",{className:"woocommerce-marketplace__product-card__content",children:[u&&(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:[!u&&(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)(h,{})}),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:[p&&(0,s.jsxs)("span",{className:"woocommerce-marketplace__product-card__vendor",children:[(0,s.jsx)("span",{children:(0,i.__)("By ","woocommerce")}),p]}),p&&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")})]})]})]})}),!u&&(0,s.jsx)("p",{className:"woocommerce-marketplace__product-card__description",children:!t&&w}),L.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)(ge,{product:e.product})]})]})})};var ve=t(74639);function ye(e){const o=(0,c.O3)("wccomHelper",{}),t=(0,ce.Z)("woocommerce-marketplace__product-list-content",e.className),[n,a]=(0,r.useState)(1),i=()=>{const e=window.innerWidth;a(e>=1920?4:e>=1024?3:e>=769?2:1)};(0,r.useEffect)((()=>(i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i))),[]);const l=2*n-1;return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:t,children:e.products.map(((t,n)=>(0,s.jsxs)(r.Fragment,{children:[(0,s.jsx)(xe,{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?K(t.vendorUrl,[["utm_source","extensionsscreen"],["utm_medium","product"],["utm_campaign","wcaddons"],["utm_content","devpartner"]]):"",price:t.price,url:K(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===l&&"theme"===e.type&&(0,s.jsx)(ve.$p,{redirectToCYSFlow:()=>{const e=(0,_e.addQueryArgs)(`${c.SX}admin.php`,{page:"wc-admin",path:"/customize-store/design"});window.location.href=e}})]},t.id)))})})}var be=t(2514),je=t(32196),fe=t(86020);function ke(e){const{title:o,groupURL:t}=e,r=""===o,c=(0,ce.Z)("woocommerce-marketplace__product-list-header",{"is-loading":r});return(0,s.jsxs)("div",{className:c,"aria-hidden":r,children:[(0,s.jsx)("h2",{className:"woocommerce-marketplace__product-list-title",children:o}),null!==t&&(0,s.jsx)("span",{className:"woocommerce-marketplace__product-list-link",children:(0,s.jsxs)(fe.Link,{href:t,target:"_blank",onClick:()=>{(0,me.recordEvent)("marketplace_see_more_clicked",{group_title:o,group_url:t})},children:[(0,i.__)("See more","woocommerce"),(0,s.jsx)(p.Z,{icon:(0,i.isRTL)()?be.Z:je.Z})]})})]})}function Ne(e){const{title:o,products:t,groupURL:r,type:c,productGroup:n}=e;return(0,s.jsxs)("div",{className:"woocommerce-marketplace__product-list",children:[(0,s.jsx)(ke,{title:o,groupURL:r}),(0,s.jsx)(ye,{group:o,products:t,type:c,productGroup:n})]})}function Me(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)(ke,{title:"",groupURL:null}),(0,s.jsx)("div",{className:"woocommerce-marketplace__product-list-content",children:[...Array(r)].map(((e,o)=>(0,s.jsx)(xe,{isLoading:!0,type:t,tracksData:{}},o)))})]})}function Ce(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,me.recordEvent)("marketplace_view",s)}function Se(){const[e,o]=(0,r.useState)([]),t=(0,r.useContext)(n),{isLoading:c,setIsLoading:a}=t;if((0,r.useEffect)((()=>{a(!0),Q().then((e=>Array.isArray(e)?e:[])).then((e=>{o(e),function(e){const o=e.flatMap((e=>e.items)).map((e=>e.id));(0,me.recordEvent)("marketplace_discover_viewed",{view:"discover",product_ids:o}),Ce({view:"discover"})}(e)})).finally((()=>{a(!1)}))}),[]),c)return(0,s.jsx)("div",{className:"woocommerce-marketplace__discover",children:(0,s.jsx)(Me,{placeholderCount:9,type:L.extension})});const i=e.flatMap((e=>e));return(0,s.jsx)("div",{className:"woocommerce-marketplace__discover",children:i.map((e=>(0,s.jsx)(Ne,{productGroup:e.id,title:e.title,products:e.items,groupURL:e.url,type:e.itemType},e.id)))})}var Ie=t(94333);function Te(e){const o=""===e.label,t=(0,ce.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,se.navigateTo)({url:(0,se.getNewPath)({category:o})})},value:e.slug,"aria-hidden":o,children:e.label})}var Ee=t(91667),Le=t(58176);function Ae(e){function o(o){const t=o.currentTarget.value;t&&(e.onClick(),(0,se.navigateTo)({url:(0,se.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,ce.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 De(e){return(0,s.jsx)(m.Dropdown,{renderToggle:({isOpen:o,onToggle:t})=>(0,s.jsxs)("button",{onClick:()=>{o||(0,me.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)(p.Z,{icon:o?Ee.Z:Le.Z,size:e.arrowIconSize})]}),className:e.className,renderContent:({onToggle:o})=>(0,s.jsx)(Ae,{categories:e.categories,selected:e.selected,onClick:o}),contentClassName:e.contentClassName})}const ze={[L.extension]:"_all",[L.theme]:"themes",[L.businessService]:"business-services"};function Oe(e){const[o,t]=(0,r.useState)(),[n,a]=(0,r.useState)(!1),[l,u]=(0,r.useState)([]),[d,p]=(0,r.useState)(!1),[_,h]=(0,r.useState)("start"),w=(0,r.useRef)(null),g=(0,r.useRef)(null),v=(0,se.useQuery)();function y(){if(w.current&&w.current.parentElement?.scrollWidth){const e=w.current.scrollWidth>w.current.parentElement.scrollWidth;p(e)}}(0,r.useEffect)((()=>{a(!0),function(e){const o=new URL(x+b);return c.MV.userLocale&&o.searchParams.set("locale",c.MV.userLocale),e===L.theme?o.searchParams.set("parent","themes"):e===L.businessService&&o.searchParams.set("parent","business-services"),R(o.toString()).then((e=>e)).catch((()=>[]))}(e.type).then((e=>{const o=e.map((e=>({...e,selected:!1}))).filter((e=>"_featured"!==e.slug));u(o)})).catch((()=>{u([])})).finally((()=>{a(!1)}))}),[e.type,u]),(0,r.useEffect)((()=>{let o=ze[e.type];v.category&&(o=v.category);const r=l.find((e=>e.slug===o));r&&t(r)}),[v.category,e.type,l]),(0,r.useEffect)((()=>{g.current&&g.current.scrollIntoView({block:"nearest",inline:"center"})}),[o]);const j=(0,Ie.useDebounce)(y,300),f=(0,Ie.useDebounce)((function(){const e=w.current;if(!e)return;const{scrollLeft:o,scrollWidth:t,clientWidth:r}=e;o<10?h("start"):o+r<t?h("middle"):o+r===t&&h("end")}),100);function k(e){w.current&&w.current.scrollTo({left:w.current.scrollLeft+e,behavior:"smooth"})}return(0,r.useEffect)((()=>{window.addEventListener("resize",j);const e=w.current;return e&&e.addEventListener("scroll",f),()=>{window.removeEventListener("resize",j),e&&e.removeEventListener("scroll",f)}}),[j,f]),(0,r.useEffect)((()=>{y()}),[l]),n?(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:w,children:l.map((e=>(0,s.jsx)("li",{className:"woocommerce-marketplace__category-item",ref:e.slug===o?.slug?g: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)(De,{type:e.type,label:function(){const e=(0,i.__)("All Categories","woocommerce");return o?"All"===o.label?e:o.label:e}(),categories:l,buttonClassName:"woocommerce-marketplace__category-dropdown-button",className:"woocommerce-marketplace__category-dropdown",contentClassName:"woocommerce-marketplace__category-dropdown-content",selected:o})}),d&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:function(){k(-200)},className:"woocommerce-marketplace__category-navigation-button woocommerce-marketplace__category-navigation-button--prev",hidden:"start"===_,"aria-label":"Scroll to previous categories",tabIndex:-1,children:(0,s.jsx)(m.Icon,{icon:"arrow-left-alt2"})}),(0,s.jsx)("button",{onClick:function(){k(200)},className:"woocommerce-marketplace__category-navigation-button woocommerce-marketplace__category-navigation-button--next",hidden:"end"===_,"aria-label":"Scroll to next categories",tabIndex:-1,children:(0,s.jsx)(m.Icon,{icon:"arrow-right-alt2"})})]})]})}function Pe(e){const[o,t]=(0,r.useState)(),[c,n]=(0,r.useState)(!1),a={[A.all]:["most-popular","popular-themes","business-services"],[A.theme]:["popular-themes"],[A.extension]:["most-popular"],[A.businessService]:["business-services"]};return(0,r.useEffect)((()=>{n(!0),Q().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===A.all)return(0,s.jsx)(s.Fragment,{});let o=L.extension;return e.type===A.theme&&(o=L.theme),e.type===A.businessService&&(o=L.businessService),(0,s.jsx)(Oe,{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)(Me,{type:L.extension,placeholderCount:4}),(0,s.jsx)(Me,{type:L.theme,placeholderCount:4}),(0,s.jsx)(Me,{type:L.businessService,placeholderCount:4})]}):o&&0!==o.length?(0,s.jsx)(s.Fragment,{children:o.map((e=>{return(0,s.jsx)(Ne,{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")),products:e.items,groupURL:e.url,productGroup:e.id,type:e.itemType},e.id);var o}))}):(0,s.jsx)(s.Fragment,{})})]})}var Ue=t(35530);const Ze={[L.extension]:{label:(0,i.__)("extensions","woocommerce"),singularLabel:(0,i.__)("extension","woocommerce")},[L.theme]:{label:(0,i.__)("themes","woocommerce"),singularLabel:(0,i.__)("theme","woocommerce")},[L.businessService]:{label:(0,i.__)("business services","woocommerce"),singularLabel:(0,i.__)("business service","woocommerce")}};function Re(e){var o,t;const a=(0,r.useContext)(n),{isLoading:l}=a,u=Ze[e.type].label,d=(0,se.useQuery)(),p=d?.category,_=(0,T.useSelect)((e=>e("core").getCurrentTheme()),[]),h="twentytwentyfour"===_?.stylesheet,[w,g]=(0,r.useState)(!1),x=(0,_e.addQueryArgs)(`${c.SX}admin.php`,{page:"wc-admin",path:"/customize-store/design"}),v=(0,_e.addQueryArgs)(`${c.SX}admin.php`,{page:"wc-admin",path:"/customize-store/assembler-hub"}),y=(0,T.useSelect)((e=>e(we.ONBOARDING_STORE_NAME).getTask("customize-store")),[]),b=null!==(o=e.showAllButton)&&void 0!==o&&o,j=null!==(t=e.products)&&void 0!==t?t:[],f="business services"===u?"business-services":u,k="woocommerce-marketplace__search-",N=(0,ce.Z)(k+f),M=(0,ce.Z)("woocommerce-marketplace__view-all-button",k+"button-"+f);if(l)return(0,s.jsxs)(s.Fragment,{children:[e.categorySelector&&(0,s.jsx)(Oe,{type:e.type}),(0,s.jsx)(Me,{hasTitle:!1,type:e.type})]});if(0===j.length){let o=A.all;switch(e.type){case L.extension:o=A.extension;break;case L.theme:o=A.theme;break;case L.businessService:o=A.businessService}return(0,s.jsx)(Pe,{type:o,showHeading:!1})}const C=(0,ce.Z)(b?"woocommerce-marketplace__product-list-content--collapsed":"");return(0,s.jsxs)("div",{className:N,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)(Oe,{type:e.type})}),"theme"===e.type&&(0,s.jsx)(m.Button,{className:"woocommerce-marketplace__customize-your-store-button",variant:"secondary",text:(0,i.__)("Design your own","woocommerce"),onClick:()=>{h?window.location.href=y?.isComplete?v:x:g(!0)}})]}),w&&(0,s.jsx)(Ue.Nh,{setIsModalOpen:g,redirectToCYSFlow:()=>{window.location.href=x}}),(0,s.jsx)(ye,{products:j,type:e.type,className:C,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"})})]}),b&&(0,s.jsx)(m.Button,{className:M,variant:"secondary",text:(0,i.__)("View all","woocommerce"),onClick:()=>{return o=e.type,void(0,se.navigateTo)({url:(0,se.getNewPath)({section:o})});var o}})]})}const Be=(0,r.createContext)({subscriptions:[],setSubscriptions:()=>{},loadSubscriptions:()=>new Promise((()=>{})),refreshSubscriptions:()=>new Promise((()=>{})),isLoading:!0,setIsLoading:()=>{}});function Qe(e){const[o,t]=(0,r.useState)([]),[c,n]=(0,r.useState)(!0),a=e=>(!0===e&&n(!0),async function(){return await I()({path:"/wc/v3/marketplace/subscriptions".toString()})}().then((e=>{t(e)})).finally((()=>{e&&n(!1)}))),l=e=>(e&&n(!0),async function(){return await I()({path:"/wc/v3/marketplace/refresh".toString(),method:"POST"})}().then((e=>{t(e)})).finally((()=>{e&&n(!1)})));(0,r.useEffect)((()=>{new URLSearchParams(window.location.search).get("install")?l(!0).catch((e=>{Y("woocommerce-marketplace-refresh-subscriptions",(0,i.sprintf)((0,i.__)("Error refreshing subscriptions: %s","woocommerce"),e.message),D.Error)})):a(!0).catch((e=>{Y("woocommerce-marketplace-load-subscriptions",(0,i.sprintf)((0,i.__)("Error loading subscriptions: %s","woocommerce"),e.message),D.Error)}))}),[]);const m={subscriptions:o,setSubscriptions:t,loadSubscriptions:a,refreshSubscriptions:l,isLoading:c,setIsLoading:n};return(0,s.jsx)(Be.Provider,{value:m,children:e.children})}const Ve=[{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 He(e){if(e.isLoading)return(0,s.jsx)(fe.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)(fe.Table,{className:"woocommerce-marketplace__my-subscriptions__table",headers:o,rows:e.rows})}function Ge(e){const o=[...Ve,{key:"actions",label:(0,i.__)("Actions","woocommerce")}];if(!(e.isLoading||e.rows&&0!==e.rows.length)){const e=(0,se.getNewPath)({},v,{}),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)(fe.EmptyTable,{numberOfRows:4,children:o})}return(0,s.jsx)(He,{rows:e.rows,isLoading:e.isLoading,headers:o})}function Fe(e){const o=[...Ve,{key:"actions",label:(0,i.__)("Actions","woocommerce")}];return(0,s.jsx)(He,{rows:e.rows,isLoading:e.isLoading,headers:o})}var Ye=t(69771),We=t(10961);let $e=function(e){return e.Warning="warning",e.Error="error",e.Info="info",e}({});function Ke(e){var o;const[t,c]=(0,r.useState)(!1),{loadSubscriptions:n}=(0,r.useContext)(Be),a=()=>{(0,me.recordEvent)("marketplace_product_connect_button_clicked",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id}),c(!0),W(e.subscription.product_key),H(e.subscription).then((()=>{n(!1).then((()=>{Y(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s successfully connected.","woocommerce"),e.subscription.product_name),D.Success),c(!1),e.onClose&&e.onClose()}))})).catch((()=>{Y(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s couldn’t be connected.","woocommerce"),e.subscription.product_name),D.Error,{actions:[{label:(0,i.__)("Try again","woocommerce"),onClick:a,url:""}]}),c(!1),e.onClose&&e.onClose()}))};return(0,s.jsx)(m.Button,{onClick:a,variant:null!==(o=e.variant)&&void 0!==o?o:"secondary",isBusy:t,disabled:t,children:(0,i.__)("Connect","woocommerce")})}const qe={installingProducts:[]},Je=(0,T.createReduxStore)("woocommerce-admin/installing",{reducer(e=qe,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 Xe(e){var o;const{loadSubscriptions:t}=(0,r.useContext)(Be),c=(0,T.useSelect)((o=>o(Je).isInstalling(e.subscription.product_key)),[e.subscription.product_key]),n=()=>{(0,T.dispatch)(Je).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),Y(e.subscription.product_key,t,D.Error,{actions:[{label:(0,i.__)("Download and install manually","woocommerce"),url:"https://woocommerce.com/my-account/downloads/",onClick:()=>{}}]}),n(),e.onError&&e.onError()})),(0,me.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)(m.Button,{variant:null!==(o=e.variant)&&void 0!==o?o:"link",isBusy:c,disabled:c,onClick:()=>{var o;(0,me.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,T.dispatch)(Je).startInstalling(e.subscription.product_key),W(e.subscription.product_key),e.subscription.is_installable?function(e){return H(e).then((()=>F(e.product_type,e.zip_slug).then((()=>function(e){if(!0===e.local.active)return Promise.resolve();const o=new URLSearchParams;return o.append("product_key",e.product_key),I()({path:"/wc/v3/marketplace/subscriptions/activate".toString(),method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o}).then((()=>Promise.resolve())).catch((()=>Promise.reject({success:!1,data:{message:(0,i.sprintf)((0,i.__)("%s could not be activated. Please activate it manually.","woocommerce"),e.product_name)}})))}(e))).catch((o=>function(e){if(!1===e.active)return Promise.resolve();const o=new URLSearchParams;return o.append("product_key",e.product_key),I()({path:"/wc/v3/marketplace/subscriptions/disconnect".toString(),method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o})}(e).finally((()=>Promise.reject(o)))))))}(e.subscription).then((()=>{t(!1).then((()=>{Y(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s successfully installed.","woocommerce"),e.subscription.product_name),D.Success),n()})),(0,me.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):(o=e.subscription,I()({path:"/wc/v3/marketplace/subscriptions/install-url?product_key="+o.product_key}).then((e=>e?.data.url))).then((o=>{if((0,me.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 eo(e){var o;return(0,s.jsx)(m.Button,{href:J(e.subscription),variant:null!==(o=e.variant)&&void 0!==o?o:"secondary",onClick:function(){(0,me.queueRecordEvent)("marketplace_renew_button_clicked",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id})},children:(0,i.__)("Renew","woocommerce")})}function oo(e){var o;return(0,s.jsx)(m.Button,{href:q(e.subscription),variant:null!==(o=e.variant)&&void 0!==o?o:"secondary",onClick:function(){(0,me.queueRecordEvent)("marketplace_auto_renew_button_clicked",{order_id:e.subscription.order_id,product_id:e.subscription.product_id})},children:(0,i.__)("Renew","woocommerce")})}function to(e){var o;return(0,s.jsx)(m.Button,{href:X(e.subscription),variant:null!==(o=e.variant)&&void 0!==o?o:"secondary",onClick:function(){(0,me.queueRecordEvent)("marketplace_subscribe_button_clicked",{product_zip_slug:e.subscription.zip_slug,product_id:e.subscription.product_id})},children:(0,i.__)("Subscribe","woocommerce")})}function ro(e){return(0,s.jsxs)(m.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)(m.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(m.Button,{variant:"tertiary",onClick:e.onClose,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Cancel","woocommerce")}),(0,s.jsx)(Ke,{subscription:e.subscription,onClose:e.onClose,variant:"primary"})]})]})}function co(e){return(0,s.jsxs)(m.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)(m.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(m.Button,{variant:"tertiary",onClick:e.onClose,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Cancel","woocommerce")}),(0,s.jsx)(eo,{subscription:e.subscription,variant:"primary"})]})]})}function so(e){return(0,s.jsxs)(m.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)(m.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(m.Button,{variant:"tertiary",onClick:e.onClose,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Cancel","woocommerce")}),(0,s.jsx)(to,{subscription:e.subscription,variant:"primary"})]})]})}(0,T.register)(Je);var no=t(9845);function ao(e){const o=(0,c.O3)("wccomHelper",{});return o?.wooUpdateManagerInstalled?o?.wooUpdateManagerActive?null:(0,s.jsxs)(m.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,no.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)(m.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(m.Button,{onClick:e.onClose,variant:"link",children:(0,i.__)("Cancel","woocommerce")}),(0,s.jsx)(m.Button,{href:M,variant:"primary",children:(0,i.__)("Activate","woocommerce")})]})]}):(0,s.jsxs)(m.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,no.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)(m.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[(0,s.jsx)(m.Button,{href:C,variant:"secondary",children:(0,i.__)("Download","woocommerce")}),(0,s.jsx)(m.Button,{href:o?.wooUpdateManagerInstallUrl,variant:"primary",children:(0,i.__)("Install","woocommerce")})]})]})}function io(e){const[o,t]=(0,r.useState)(!1),[c,n]=(0,r.useState)(!1),{loadSubscriptions:a}=(0,r.useContext)(Be),l=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)(so,{onClose:()=>t(!1),subscription:e.subscription}):e.subscription.expired?(0,s.jsx)(co,{subscription:e.subscription,onClose:()=>t(!1)}):e.subscription.active?e.wooUpdateManagerActive?null:(0,s.jsx)(ao,{subscription:e.subscription,onClose:()=>t(!1)}):(0,s.jsx)(ro,{subscription:e.subscription,onClose:()=>t(!1)}):null,(0,s.jsx)(m.Button,{variant:"link",className:"woocommerce-marketplace__my-subscriptions-update",onClick:function o(){var r;(0,me.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}),l?(W(e.subscription.product_key),window.wp.updates?(n(!0),(r=e.subscription,G("update-"+r.product_type,{slug:r.local.slug,[r.product_type]:r.local.path})).then((()=>{a(!1).then((()=>{Y(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s updated successfully.","woocommerce"),e.subscription.product_name),D.Success),n(!1)})),(0,me.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((()=>{Y(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s couldn’t be updated.","woocommerce"),e.subscription.product_name),D.Error,{actions:[{label:(0,i.__)("Try again","woocommerce"),onClick:o,url:""}]}),n(!1),(0,me.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})}))):Y(e.subscription.product_key,(0,i.sprintf)((0,i.__)("%s couldn’t be updated.","woocommerce"),e.subscription.product_name),D.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 lo(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))},l=()=>{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:l,onBlur:l,className:(0,ce.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)(m.Popover,{className:"woocommerce-marketplace__my-subscriptions__popover",position:"top center",focusOnMount:!1,onMouseOver:i,onMouseOut:l,onFocus:i,onBlur:l,children:e.explanation})]})}var mo=t(25869);function uo(e){const o=[{title:(0,i.__)("Manage in Plugins","woocommerce"),icon:(0,s.jsx)(s.Fragment,{}),onClick:()=>{window.location.href=c.SX+"plugins.php"}}];return e.subscription.is_shared||o.unshift({title:(0,i.__)("Manage on WooCommerce.com","woocommerce"),icon:(0,s.jsx)(s.Fragment,{}),onClick:()=>{window.open("https://woocommerce.com/my-account/my-subscriptions","_blank")}}),e.subscription.documentation_url&&o.unshift({title:(0,i.__)("View documentation","woocommerce"),icon:(0,s.jsx)(s.Fragment,{}),onClick:()=>{window.open(e.subscription.documentation_url,"_blank")}}),(0,s.jsx)(m.DropdownMenu,{icon:mo.Z,label:(0,i.__)("Actions","woocommerce"),controls:o})}function po(e){return(0,s.jsx)("span",{className:"woocommerce-marketplace__my-subscriptions-version",children:e.span})}function _o(e,o){const t=(0,c.O3)("wccomHelper",{});return e.local.version===e.version?(0,s.jsx)(po,{span:e.local.version}):e.local.version&&e.version&&"installed"===o?(0,s.jsx)(io,{subscription:e,wooUpdateManagerActive:t?.wooUpdateManagerActive}):e.version?(0,s.jsx)(po,{span:e.version}):e.local.version?(0,s.jsx)(po,{span:e.local.version}):""}function ho(e){return K(e,[["utm_source","subscriptionsscreen"],["utm_medium","product"],["utm_campaign","wcaddons"],["utm_content","product-name"]])}function wo(e){let o=(0,s.jsx)(p.Z,{icon:We.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:ho(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:ho(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)(lo,{text:(0,i.__)("Shared with you","woocommerce"),level:$e.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:N,rel:"nofollow noopener noreferrer",children:"Learn more"})})})})]}),value:e.product_name}}function go(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,Ye.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 xo(e,o){return{display:function(){const t=function(e,o){return""===e.product_key?{text:(0,i.__)("No subscription","woocommerce"),level:$e.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:X(e),rel:"nofollow noopener noreferrer",children:"renew"}),sharing:(0,s.jsx)("a",{href:N,rel:"nofollow noopener noreferrer",children:"sharing"}),transferring:(0,s.jsx)("a",{href:k,rel:"nofollow noopener noreferrer",children:"sharing"})})}:e.expired?{text:(0,i.__)("Expired","woocommerce"),level:$e.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:J(e),rel:"nofollow noopener noreferrer",children:"renew"}),sharing:(0,s.jsx)("a",{href:N,rel:"nofollow noopener noreferrer",children:"sharing"}),transferring:(0,s.jsx)("a",{href:k,rel:"nofollow noopener noreferrer",children:"sharing"})})}:e.expiring&&!e.autorenew?{text:(0,i.__)("Expires soon","woocommerce"),level:$e.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:q(e),rel:"nofollow noopener noreferrer",children:"renew"}),sharing:(0,s.jsx)("a",{href:N,rel:"nofollow noopener noreferrer",children:"sharing"}),transferring:(0,s.jsx)("a",{href:k,rel:"nofollow noopener noreferrer",children:"sharing"})})}:!("installed"!==o||!e.local.installed||e.active)&&{text:(0,i.__)("Not connected","woocommerce"),level:$e.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)(lo,{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 vo(e,o){return{display:_o(e,o)}}function yo(e){let o=null;return""===e.product_key?o=(0,s.jsx)(to,{subscription:e}):e.expired&&!e.lifetime?o=(0,s.jsx)(eo,{subscription:e}):!1===e.local.installed&&!1===e.subscription_installed?o=(0,s.jsx)(Xe,{subscription:e}):!1===e.active&&!0===e.subscription_available?o=(0,s.jsx)(Ke,{subscription:e,variant:"link"}):e.autorenew||e.lifetime||(o=(0,s.jsx)(oo,{subscription:e})),{display:(0,s.jsxs)("div",{className:"woocommerce-marketplace__my-subscriptions__actions",children:[o,(0,s.jsx)(uo,{subscription:e})]})}}function bo(e,o){return[wo(e),go(e),xo(e,o),vo(e,o),yo(e)]}const jo="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEyLjAwMDIgMi4yNVY0QzE2LjQxODUgNCAyMC4wMDAzIDcuNTgxNzIgMjAuMDAwMyAxMkMyMC4wMDAzIDE1LjcyNzcgMTcuNDUwNyAxOC44NTk5IDE0LjAwMDMgMTkuNzQ4VjE5Ljc0NzlDMTMuODMwMSAxOS43OTE3IDEzLjY1NzcgMTkuODMwMSAxMy40ODMzIDE5Ljg2MjhDMTMuMzM3MSAxOS44OTA1IDEzLjE5MDYgMTkuOTE0IDEzLjA0NDIgMTkuOTMzNEwxMy4wNDQxIDE5LjkzMjVDMTIuNzAyNCAxOS45NzcgMTIuMzUzOSAyMCAxMiAyMEMxMS42NDYgMjAgMTEuMjk3NSAxOS45NzcgMTAuOTU1NiAxOS45MzI0TDEwLjk1NTYgMTkuOTMyN0MxMC45MTQ4IDE5LjkyNzMgMTAuODc0IDE5LjkyMTYgMTAuODMzMyAxOS45MTU1QzkuNjEwMzYgMTkuNzM2OSA4LjQ3NzIyIDE5LjI4MTUgNy40OTk0OSAxOC42MTVDNy4zNzM2NSAxOC41Mjk1IDcuMjUwMTEgMTguNDQwNCA3LjEyOTA0IDE4LjM0NzdMNy4xMjk1NCAxOC4zNDdDNi41NzU0NiAxNy45MjEyIDYuMDc4NzIgMTcuNDI0NSA1LjY1MjkxIDE2Ljg3MDRMNS42NTE3MSAxNi44NzEzQzUuNDg1NTEgMTYuNjU0NSA1LjMyOTQxIDE2LjQyNzYgNS4xODQzOCAxNi4xOTExQzQuNjk0NTMgMTUuMzk2MiA0LjMzOTg1IDE0LjUwOTEgNC4xNTIzOSAxMy41NjE5QzQuMTE3ODggMTMuMzg5NSA0LjA4OTI1IDEzLjIxNjggNC4wNjY0MSAxMy4wNDQxTDQuMDY3NDkgMTMuMDQzOUM0LjAyMjk3IDEyLjcwMjIgNCAxMi4zNTM4IDQgMTJDNCAxMS42NDYgNC4wMjI5OSAxMS4yOTc0IDQuMDY3NTYgMTAuOTU1NUw0LjA2NzA4IDEwLjk1NTVDNC4wNzY5NCAxMC44ODExIDQuMDg3ODQgMTAuODA3IDQuMDk5NzYgMTAuNzMzQzQuMjgxIDkuNTk0IDQuNzAyNjYgOC41MzUwNyA1LjMxMTA5IDcuNjA5OTJDNS40MTg2NCA3LjQ0NTcyIDUuNTMyMzYgNy4yODUyNSA1LjY1MjEgNy4xMjg5MUw1LjY1Mjk0IDcuMTI5NTVDNS42NTUzNSA3LjEyNjQxIDUuNjU3NzcgNy4xMjMyNyA1LjY2MDE4IDcuMTIwMTRMNi44NjAzNyA4LjAyMDI4QzYuNzQwMTUgOC4xNzUzMSA2LjYyNjc5IDguMzM1OTMgNi41MjA3NCA4LjUwMTY4QzYuMDYwNDMgOS4yMjQzOSA1Ljc0NTQgMTAuMDMzMyA1LjU5NjM5IDEwLjg3ODVDNS41MzMwMyAxMS4yNDI4IDUuNSAxMS42MTc2IDUuNSAxMkM1LjUgMTIuNDc1MSA1LjU1MDk2IDEyLjkzODIgNS42NDc3MiAxMy4zODQzQzUuNzI4OTQgMTMuNzU0NCA1Ljg0Mzk3IDE0LjEyMzMgNS45OTQ3NSAxNC40ODczQzYuMTE3NTQgMTQuNzgzNyA2LjI1OTM4IDE1LjA2NTcgNi40MTgxMyAxNS4zMzI1QzYuOTE2NzIgMTYuMTY1OCA3LjU5NjYzIDE2Ljg3ODIgOC40MDMzNSAxNy40MTUxQzkuMTc2ODIgMTcuOTI3NSAxMC4wNTQgMTguMjcxIDEwLjk3MTQgMTguNDE5MUMxMS4zMDY0IDE4LjQ3MjMgMTEuNjUgMTguNSAxMiAxOC41QzEyLjQ1MDYgMTguNSAxMi44OTA0IDE4LjQ1NDIgMTMuMzE1MSAxOC4zNjY5QzEzLjUyNjMgMTguMzIzIDEzLjczNzIgMTguMjY4MSAxMy45NDcgMTguMjAxOUwxMy45NDc0IDE4LjIwMzJDMTYuNTg1OSAxNy4zNzU4IDE4LjUgMTQuOTExNCAxOC41IDEyQzE4LjUgOC40MTAyMyAxNS41OSA1LjUwMDEzIDEyLjAwMDIgNS41VjcuMjVMOS4wMDAyNCA0Ljc1TDEyLjAwMDIgMi4yNVoiIGZpbGw9IiMwMDdDQkEiLz4KPC9zdmc+",fo="woocommerce-marketplace-refresh-subscriptions";function ko(){const{refreshSubscriptions:e}=(0,r.useContext)(Be),[o,t]=(0,r.useState)(!1),c=()=>{o||(W(fo),t(!0),e().then((()=>{Y(fo,(0,i.__)("Subscriptions refreshed.","woocommerce"),D.Success)})).catch((e=>{Y(fo,(0,i.sprintf)((0,i.__)("Error refreshing subscriptions: %s","woocommerce"),e.message),D.Error,{actions:[{label:(0,i.__)("Try again","woocommerce"),onClick:c,url:""}]})})).finally((()=>{t(!1)})))};return(0,s.jsxs)(m.Button,{className:"woocommerce-marketplace__refresh-subscriptions",onClick:c,isBusy:o,children:[(0,s.jsx)("img",{src:jo,alt:(0,i.__)("Refresh subscriptions","woocommerce"),className:"woocommerce-marketplace__refresh-subscriptions-icon"}),(0,i.__)("Refresh","woocommerce")]})}const No="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgaWQ9ImFsZXJ0Ij4KPHBhdGggaWQ9IlZlY3RvciIgZD0iTTEyIDIwQzE2LjQxODMgMjAgMjAgMTYuNDE4MyAyMCAxMkMyMCA3LjU4MTcyIDE2LjQxODMgNCAxMiA0QzcuNTgxNzIgNCA0IDcuNTgxNzIgNCAxMkM0IDE2LjQxODMgNy41ODE3MiAyMCAxMiAyMFoiIHN0cm9rZT0iI0NDMTgxOCIgc3Ryb2tlLXdpZHRoPSIxLjUiLz4KPHBhdGggaWQ9IlZlY3Rvcl8yIiBkPSJNMTMgN0gxMVYxM0gxM1Y3WiIgZmlsbD0iI0NDMTgxOCIvPgo8cGF0aCBpZD0iVmVjdG9yXzMiIGQ9Ik0xMyAxNUgxMVYxN0gxM1YxNVoiIGZpbGw9IiNDQzE4MTgiLz4KPC9nPgo8L3N2Zz4K";function Mo(){const e=(0,T.useSelect)((e=>e(O).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)(m.Notice,{className:"woocommerce-marketplace__notice--error",status:r.status,onRemove:()=>W(r.productKey),actions:o(r),children:[(0,s.jsx)("img",{src:No,alt:"",width:24,height:24}),r.message]},r.productKey));return(0,s.jsx)(s.Fragment,{children:t})}function Co(e){var o;const t=new URL(ee());return e.install&&t.searchParams.set("install",e.install),(0,s.jsx)(m.Button,{href:t.href,variant:null!==(o=e.variant)&&void 0!==o?o:"secondary",children:(0,i.__)("Connect Account","woocommerce")})}function So(){const e=(0,se.useQuery)(),o=e?.install,t=(0,c.O3)("wccomHelper",{}),n=!!t?.isConnected,[a,l]=(0,r.useState)(!1),[u,d]=(0,r.useState)(!1),{subscriptions:p,isLoading:_}=(0,r.useContext)(Be),h=p.find((e=>e.product_key===o)),w=(0,r.useCallback)((()=>{(0,se.navigateTo)({url:(0,se.getNewPath)({...e,install:void 0},v,{})})}),[e]);(0,r.useEffect)((()=>{_||(o&&n&&!_&&!h?(Y(o,(0,i.sprintf)((0,i.__)("Could not find subscription with product key %s.","woocommerce"),o),D.Error),w()):l(!!o))}),[n,_,o,w,h]),(0,r.useEffect)((()=>{h&&h.local.installed&&d(!0)}),[h]);const g=()=>{w(),l(!1)};return a?(0,s.jsxs)(m.Modal,{title:u?(0,i.__)("You are ready to go!","woocommerce"):(0,i.__)("Add to store","woocommerce"),onRequestClose:g,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)(m.Notice,{status:"warning",isDismissible:!1,children:(0,i.__)("In order to install a product, you need to first connect your account.","woocommerce")});if(h){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)(xe,{product:$(h),small:!0,tracksData:{position:1,group:"subscriptions",label:"install"}})]})}})(),(()=>{const e=[];return u?(e.push((0,s.jsx)(m.Button,{variant:"secondary",href:h?.documentation_url,target:"_blank",className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("View docs","woocommerce")},"docs")),e.push((0,s.jsx)(m.Button,{variant:"primary",href:M,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("View in Plugins","woocommerce")},"plugin-list"))):(e.push((0,s.jsx)(m.Button,{variant:"tertiary",onClick:g,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Cancel","woocommerce")},"cancel")),n?h&&e.push((0,s.jsx)(Xe,{subscription:h,variant:"primary",onError:g},"install")):e.push((0,s.jsx)(Co,{variant:"primary",install:o},"connect"))),(0,s.jsx)(m.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:e})})()]}):null}var Io=t(84884);function To(){const{subscriptions:e,isLoading:o}=(0,r.useContext)(Be),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)(p.Z,{icon:_.Z,size:12})}),a=e.filter((e=>e.subscription_installed)),l=e.filter((e=>!e.subscription_installed&&t?.wooUpdateManagerPluginSlug!==e.product_slug&&!e.maxed));if(!t?.isConnected){const e=(0,i.__)("Connect your store to WooCommerce.com using the WooCommerce.com Update Manager. Once connected, you'll be able to manage your subscriptions, receive product updates, and access streamlined support from this screen.","woocommerce"),o=()=>{const e={notice_id:"woo-disconnect-notice",dismiss_notice_nonce:t?.dismissNoticeNonce||""};I()({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)(Io.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)(So,{}),(0,s.jsx)("div",{className:"woocommerce-marketplace__my-subscriptions__icon"}),(0,s.jsx)("h2",{className:"woocommerce-marketplace__my-subscriptions__header",children:(0,i.__)("Manage your subscriptions","woocommerce")}),(0,s.jsx)("p",{className:"woocommerce-marketplace__my-subscriptions__description",children:e}),(0,s.jsx)(m.Button,{href:ee(),variant:"primary",children:(0,i.__)("Connect your store","woocommerce")})]})]})}return(0,s.jsxs)("div",{className:"woocommerce-marketplace__my-subscriptions",children:[(0,s.jsx)(So,{}),(0,s.jsx)("section",{className:"woocommerce-marketplace__my-subscriptions__notices",children:(0,s.jsx)(Mo,{})}),(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)(ko,{})})]}),(0,s.jsx)("div",{className:"woocommerce-marketplace__my-subscriptions__table-wrapper",children:(0,s.jsx)(Ge,{isLoading:o,rows:a.map((e=>bo(e,"installed")))})})]}),l.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)(Fe,{isLoading:o,rows:l.map((e=>bo(e,"available")))})})]})]})}var Eo=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}(Eo||{});const Lo=function(e){const[o,t]=(0,r.useState)(Eo.notInstalled),[a,l]=(0,r.useState)(),[u,d]=(0,r.useState)(),[p,_]=(0,r.useState)(),[h,w]=(0,r.useState)(),[g,x]=(0,r.useState)(),[y,b]=(0,r.useState)(!1),[j,f]=(0,r.useState)(),{addInstalledProduct:k}=(0,r.useContext)(n),N=(0,se.useQuery)();function C(){t(Eo.notInstalled),f(void 0),(0,se.navigateTo)({url:(0,se.getNewPath)({...N,install:void 0,installProduct:void 0},v,{})})}return(0,r.useEffect)((()=>{const e=(0,c.O3)("wccomHelper",{});d(e?.installedProducts),_(e?.isConnected)}),[]),(0,r.useEffect)((()=>{if(b(!1),!N.installProduct)return;const o=parseInt(N.installProduct,10),r=e.products.find((e=>e.id===o));if(r){if(u&&u.find((e=>e===r.slug)))return;p?t(Eo.notInstalled):(t(Eo.notConnected),f({status:"warning",message:(0,i.__)("In order to install a product, you need to first connect your account.","woocommerce")})),b(!0),l(r)}}),[N,e.products,u,p]),a&&y?(0,s.jsxs)(m.Modal,{title:o===Eo.activated?(0,i.__)("You are ready to go!","woocommerce"):(0,i.__)("Add to Store","woocommerce"),onRequestClose:C,focusOnMount:!0,className:"woocommerce-marketplace__header-account-modal has-size-medium",style:{borderRadius:4},overlayClassName:"woocommerce-marketplace__header-account-modal-overlay",children:[j&&(0,s.jsx)(m.Notice,{status:j.status,isDismissible:!1,children:j.message}),(0,s.jsx)("p",{className:"woocommerce-marketplace__header-account-modal-text",children:o===Eo.notConnected?"":o===Eo.installedCanActivate||o===Eo.activating?(0,i.__)("Extension successfully installed. Would you like to activate it?","woocommerce"):o===Eo.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===Eo.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)(xe,{product:a,small:!0,tracksData:{position:1,group:"install-flow",label:"install"}}),(0,s.jsxs)(m.ButtonGroup,{className:"woocommerce-marketplace__header-account-modal-button-group",children:[o===Eo.activated?g?(0,s.jsx)(m.Button,{variant:"tertiary",href:g,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("View Docs","woocommerce")},"docs"):(0,s.jsx)(s.Fragment,{}):(0,s.jsx)(m.Button,{variant:"tertiary",onClick:C,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("Cancel","woocommerce")},"cancel"),o===Eo.notConnected?(0,s.jsx)(Co,{variant:"primary"},"connect"):o===Eo.installedCanActivate||o===Eo.activating?(0,s.jsx)(m.Button,{variant:"primary",onClick:function(){h&&(t(Eo.activating),(0,me.recordEvent)("marketplace_activate_new_product_clicked",{product_id:a?a.id:0}),fetch(h).then((()=>{t(Eo.activated)})).catch((()=>{t(Eo.activationFailed),f({status:"error",message:(0,i.__)("Activation failed. Please try again from the plugins page.","woocommerce")})})))},isBusy:o===Eo.activating,disabled:o===Eo.activating,children:(0,i.__)("Activate","woocommerce")},"activate"):o===Eo.activated||o===Eo.installedCannotActivate||o===Eo.activationFailed?(0,s.jsx)(m.Button,{variant:"primary",href:M,className:"woocommerce-marketplace__header-account-modal-button",children:(0,i.__)("View in Plugins","woocommerce")},"plugin-list"):(0,s.jsx)(m.Button,{variant:"primary",onClick:function(){var e;a&&a.id&&((0,me.recordEvent)("marketplace_install_new_product_clicked",{product_id:a.id}),t(Eo.installing),(e=a.id,I()({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,T.dispatch)(Je).startInstalling(String(null!==(o=a.id)&&void 0!==o?o:"")),x(e.data.documentation_url),a.slug&&k(null!==(r=a.slug)&&void 0!==r?r:""),F(e.data.product_type,e.data.zip_slug).then((e=>{var o;(0,T.dispatch)(Je).stopInstalling(String(null!==(o=a.id)&&void 0!==o?o:"")),e.data.activateUrl?(w(e.data.activateUrl),t(Eo.installedCanActivate)):t(Eo.installedCannotActivate)}))})).catch((e=>{var o;e.data.redirect_location?(f({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(Eo.installFailed),f({status:"error",message:null!==(o=e.data.message)&&void 0!==o?o:(0,i.__)("An error occurred. Please try again later.","woocommerce")}))})))},isBusy:o===Eo.installing,disabled:o===Eo.installing||o===Eo.installFailed,children:(0,i.__)("Install","woocommerce")},"install")]})]}):(0,s.jsx)(s.Fragment,{})};var Ao=t(87287);function Do(){const e="woo-connect-notice-marketplace-dismissed",o=(0,c.O3)("wccomHelper",{}),t=o?.woocomConnectNoticeType||"none";if("none"===t)return null;const r=localStorage.getItem(e),n=new Date(r||""),a=new Date;a.setMonth(a.getMonth()-1),(null===r||isNaN(n.valueOf())||a.valueOf()>n.valueOf())&&(localStorage.removeItem("wc-marketplaceNoticeClosed-woo-connect-notice"),localStorage.removeItem(e));let l="";"long"===t&&(l=l.concat((0,i.__)("Your store might be at risk as you are running old versions of WooCommerce plugins.","woocommerce")),l=l.concat(" ")),l=l.concat((0,i.__)("<strong>Connect your store to WooCommerce.com</strong> to get updates and streamlined support for your subscriptions.","woocommerce"));const u=K(ee(),[["utm_source","pu"],["utm_campaign","pu_in_apps_screen_connect"]]);return(0,s.jsx)(Io.Z,{id:"woo-connect-notice",description:l,isDismissible:!0,variant:"error",onClose:()=>{localStorage.setItem(e,(new Date).toString()),(0,me.recordEvent)("woo_connect_notice_in_marketplace_dismissed")},onLoad:()=>{(0,me.recordEvent)("woo_connect_notice_in_marketplace_shown")},children:(0,s.jsx)(m.Button,{href:u,variant:"secondary",onClick:()=>((0,me.recordEvent)("woo_connect_notice_in_marketplace_clicked"),!0),children:(0,i.__)("Connect","woocommerce")})})}function zo(){const e=(0,c.O3)("wccomHelper",{});return e?.isConnected?e?.wooUpdateManagerActive||e?.wooUpdateManagerInstalled?e?.wooUpdateManagerInstalled&&!e?.wooUpdateManagerActive?(0,s.jsx)("section",{className:"woocommerce-marketplace__woo-update-manager-plugin__notices",children:(0,s.jsxs)(m.Notice,{status:"error",isDismissible:!1,children:[(0,s.jsx)("span",{dangerouslySetInnerHTML:(0,no.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)(m.Button,{href:M,variant:"secondary",children:(0,i.__)("Activate","woocommerce")})})]})}):null:(0,s.jsx)("section",{className:"woocommerce-marketplace__woo-update-manager-plugin__notices",children:(0,s.jsxs)(m.Notice,{status:"error",isDismissible:!1,children:[(0,s.jsx)("span",{dangerouslySetInnerHTML:(0,no.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)(m.Button,{href:e?.wooUpdateManagerInstallUrl,variant:"secondary",children:(0,i.__)("Install","woocommerce")}),(0,s.jsx)(m.Button,{href:C,variant:"link",children:(0,i.__)("Download","woocommerce")})]})]})}):null}function Oo(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)(Io.Z,{id:a,description:n.description,isDismissible:!0,variant:"error",onClose:()=>{(0,me.recordEvent)(r[a].dismissed);const e={notice_id:a,dismiss_notice_nonce:i};I()({path:"/wc-admin/notice/dismiss",method:"POST",data:e})},onLoad:function(){(0,me.recordEvent)(r[a].shown)},children:(0,s.jsx)(m.Button,{href:n.button_link,variant:"secondary",onClick:function(){(0,me.recordEvent)(r[a].clicked)},children:n.button_text})}):null}function Po(e){const{onLoadMore:o,isBusy:t,disabled:r}=e;return t&&(0,pe.speak)((0,i.__)("Loading more products","woocommerce")),(0,s.jsx)(m.Button,{className:"woocommerce-marketplace__load-more",variant:"secondary",onClick:function(){(0,me.queueRecordEvent)("marketplace_load_more_button_clicked",{}),o()},isBusy:t,disabled:r,children:(0,i.__)("Load more","woocommerce")})}function Uo(){const e=(0,r.useContext)(n),[o,t]=(0,r.useState)([]),[a,l]=(0,r.useState)([]),[m,u]=(0,r.useState)(1),[d,p]=(0,r.useState)(1),[_,h]=(0,r.useState)(1),[w,g]=(0,r.useState)(1),[x,v]=(0,r.useState)(1),[y,b]=(0,r.useState)(0),[j,f]=(0,r.useState)(!1),{isLoading:k,setIsLoading:N,selectedTab:M,setSearchResultsCount:C}=e,S=(0,se.useQuery)(),I=e=>{(0,pe.speak)((0,i.sprintf)((0,i.__)("%d products found","woocommerce"),e))},T=(0,r.useCallback)((()=>{f(!0);const e=new URLSearchParams,o=new AbortController;S.category&&"_all"!==S.category&&e.append("category",S.category),"themes"!==S.tab&&"business-services"!==S.tab||e.append("category",S.tab),S.term&&e.append("term",S.term);const r=(0,c.O3)("wccomHelper",!1);return r.storeCountry&&e.append("country",r.storeCountry),e.append("page",(m+1).toString()),B(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&&b(null!==(c=r[0].id)&&void 0!==c?c:0),[...t,...r]})),(0,pe.speak)((0,i.__)("More products loaded","woocommerce")),u((e=>e+1)),f(!1)})).catch((()=>{(0,pe.speak)((0,i.__)("Error loading more products","woocommerce"))})).finally((()=>{f(!1)})),()=>{o.abort()}}),[m,S.category,S.term,S.tab,f]);return(0,r.useEffect)((()=>{if(m>1)return;const e=[{category:"extensions",type:L.extension},{category:"themes",type:L.theme},{category:"business-services",type:L.businessService}],o=e.map((()=>new AbortController));N(!0),t([]);const r=e=>{if(S.search){(0,me.recordEvent)("marketplace_search_finish",{tab:S.tab,total_products:e,category:S.category||"_all",search_term:S.term||""});const o=new URL(window.location.href);o.searchParams.delete("search"),window.history.replaceState(null,"",o.pathname+o.search)}};if(S.category&&"_all"!==S.category){const e=new URLSearchParams;e.append("category",S.category),S.term&&e.append("term",S.term);const s=(0,c.O3)("wccomHelper",!1);s.storeCountry&&e.append("country",s.storeCountry),B(e,o[0].signal).then((e=>{t(e.products),p(e.totalPages),C({[S.tab]:e.totalProducts}),I(e.totalProducts),r(e.totalProducts)})).catch((()=>{t([])})).finally((()=>{N(!1)}))}else Promise.all(e.map((({category:e,type:t},r)=>{const s=new URLSearchParams;"extensions"!==e&&s.append("category",e),S.term&&s.append("term",S.term);const n=(0,c.O3)("wccomHelper",!1);return n.storeCountry&&s.append("country",n.storeCountry),B(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};C(c),e.forEach((e=>{switch(e.type){case L.extension:h(e.totalPages);break;case L.theme:g(e.totalPages);break;case L.businessService:v(e.totalPages)}}));const s=S.tab;r(c[s]),I(e.reduce(((e,o)=>e+o.totalProducts),0))})).catch((()=>{t([])})).finally((()=>{N(!1)}));return()=>{o.forEach((e=>{e.abort()}))}}),[S.tab,S.term,S.category,N,C,m]),(0,r.useEffect)((()=>{let e;switch(M){case"extensions":e=o.filter((e=>e.type===L.extension));break;case"themes":e=o.filter((e=>e.type===L.theme));break;case"business-services":e=o.filter((e=>e.type===L.businessService));break;default:e=[]}l(e)}),[M,o]),(0,r.useEffect)((()=>{const e={view:S?.tab,search_term:S?.term,product_type:S?.section,category:S?.category};Ce(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,me.recordEvent)(o,s)}(e)}),[S?.tab,S?.term,S?.section,S?.category]),(0,r.useEffect)((()=>{u(1),b(0)}),[M,S?.category,S?.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)(Ao.Z,{format:"promo-card"}),(0,s.jsx)(Ao.Z,{format:"notice"}),(0,s.jsx)(Lo,{products:a}),"business-services"!==M&&"my-subscriptions"!==M&&(0,s.jsx)(Do,{}),"business-services"!==M&&(0,s.jsx)(zo,{}),"business-services"!==M&&(0,s.jsx)(Oo,{type:"expired"}),"business-services"!==M&&(0,s.jsx)(Oo,{type:"expiring"}),(()=>{switch(M){case"extensions":case"themes":case"business-services":return(0,s.jsx)(Re,{products:a,categorySelector:!0,type:V(M),searchTerm:S.term});case"discover":return(0,s.jsx)(Se,{});case"my-subscriptions":return(0,s.jsx)(Qe,{children:(0,s.jsx)(To,{})});default:return(0,s.jsx)(s.Fragment,{})}})(),!k&&(()=>{if(S.category&&"_all"!==S.category)return m<d;switch(M){case"extensions":return m<_;case"themes":return m<w;case"business-services":return m<x;default:return!1}})()&&(0,s.jsx)(Po,{onLoadMore:T,isBusy:j,disabled:j})]})}var Zo=t(56592);const Ro=(0,s.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)(u.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"})}),Bo=(0,s.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(u.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"})}),Qo=(0,s.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(u.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"})});function Vo(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)(p.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})]})}const Ho=(0,r.createInterpolateElement)((0,i.__)("30-day <a>money-back guarantee</a>","woocommerce"),{a:(0,s.jsx)("a",{href:x+"/refund-policy/"})}),Go=(0,r.createInterpolateElement)((0,i.__)("<a>Get help</a> when you need it","woocommerce"),{a:(0,s.jsx)("a",{href:x+"/docs/"})}),Fo=(0,r.createInterpolateElement)((0,i.__)("<a>Products</a> you can trust","woocommerce"),{a:(0,s.jsx)("a",{href:x+"/products/"})});function Yo(){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)(Vo,{icon:Zo.Z,title:Ho,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)(Vo,{icon:Ro,title:Go,description:(0,i.__)("With detailed documentation and a global support team, help is always available if you need it.","woocommerce")}),(0,s.jsx)(Vo,{icon:Bo,title:Fo,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)(Vo,{icon:Qo,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 Wo(){return(0,s.jsx)("div",{className:"woocommerce-marketplace__footer",children:(0,s.jsx)(Yo,{})})}function $o(){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)(de,{}),(0,s.jsx)(Uo,{}),(0,s.jsx)(Wo,{})]})}function Ko(){return(0,s.jsx)(a,{children:(0,s.jsx)($o,{})})}}}]);