"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[8859],{41119:(e,s,t)=>{t.r(s),t.d(s,{Products:()=>T});var o=t(27723),i=t(32478),c=t(14908),n=t(92279),r=t(86087),a=t(56427),l=t(15703),d=t(77871),p=t(97934),u=t(44971),m=t(83306),k=t(52619),_=t(40314),w=t(47143),g=t(90212),h=t(82004),x=t(81858),A=t(58467),C=t(63042),j=t(90815),y=t(59529),b=t(39148),P=t(27883),v=t(36661),f=t(39793);const S=({isExpanded:e,onClick:s})=>(0,f.jsxs)(a.Button,{className:"woocommerce-task-products__button-view-less-product-types",onClick:s,children:[e?(0,o.__)("View less product types","woocommerce"):(0,o.__)("View more product types","woocommerce"),(0,f.jsx)(d.A,{icon:e?p.A:u.A})]}),T=()=>{const[e,s]=(0,r.useState)(!1),[t,i]=(0,r.useState)(!1),{installedPlugins:n,isRequestingPlugins:a}=(0,w.useSelect)(e=>{const{getInstalledPlugins:s,isPluginsRequesting:t}=e(_.pluginsStore);return{isRequestingPlugins:t("installPlugins"),installedPlugins:s()}},[]),d=(0,h.p)((()=>{const e=(0,g.Qk)("onboarding");return e?.profile&&e?.profile.product_types||["physical"]})()),{productTypes:p,isRequesting:u}=(0,x.A)((0,h.h)(),d),{recordCompletionTime:T}=(0,b.A)("products"),L=(0,r.useMemo)(()=>p.map(e=>({...e,onClick:()=>{e.onClick(),T()}})),[T,p]),{loadSampleProduct:N,isLoadingSampleProducts:E}=(0,j.A)({redirectUrlAfterSuccess:(0,l.getAdminLink)("edit.php?post_type=product&wc_onboarding_active_task=products")}),O=(0,r.useMemo)(()=>{const s=L.filter(e=>d.includes(e.key));return e&&L.forEach(e=>!s.includes(e)&&s.push(e)),(0,k.applyFilters)(P.j1,s)},[d,e,L]),q=(0,r.useMemo)(()=>{const e=[{...P.p3,onClick:()=>{P.p3.onClick(),T()}}];return!window.wcAdminFeatures?.printful||a||n.includes("printful-shipping-for-woocommerce")||e.push(P.tF),e},[T,a,n]);return(0,f.jsxs)("div",{className:"woocommerce-task-products",children:[(0,f.jsx)(c.Text,{variant:"title",as:"h2",className:"woocommerce-task-products__title",children:(0,o.__)("What product do you want to add?","woocommerce")}),(0,f.jsxs)("div",{className:"woocommerce-product-content",children:[(0,f.jsx)(A.A,{items:O,onClickLoadSampleProduct:()=>i(!0),showOtherOptions:e,isTaskListItemClicked:u}),(0,f.jsx)(S,{isExpanded:e,onClick:()=>{e||(0,m.recordEvent)("tasklist_view_more_product_types_click"),s(!e)}}),(0,f.jsx)(A.A,{items:q,showOtherOptions:!1,isTaskListItemClicked:u}),(0,f.jsx)(v.d,{textProps:{className:"woocommerce-products-marketplace-link"},message:(0,o.__)("Visit {{Link}}the WooCommerce Marketplace{{/Link}} to enhance your store with additional options such as Subscriptions, Gift Cards, and more.","woocommerce"),eventName:"tasklist_add_product_visit_marketplace_click",targetUrl:(0,l.getAdminLink)("admin.php?page=wc-admin&tab=extensions&path=/extensions&category=merchandising"),linkType:"wc-admin"})]}),E?(0,f.jsx)(C.A,{}):t&&(0,f.jsx)(y.A,{onCancel:()=>{i(!1),(0,m.recordEvent)("tasklist_cancel_load_sample_products_click")},onImport:()=>{i(!1),N()}})]})},L=()=>(0,f.jsx)(i.WooOnboardingTask,{id:"products",children:(0,f.jsx)(T,{})});(0,n.registerPlugin)("wc-admin-onboarding-task-products",{scope:"woocommerce-tasks",render:()=>(0,f.jsx)(L,{})})}}]);