"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[2333],{21604:(e,t,o)=>{o.r(t),o.d(t,{Products:()=>T});var c=o(69307),s=o(65736),r=o(49471),n=o(14812),a=o(98817),i=o(55609),l=o(74617),d=o(60247),m=o(70902),p=o(13608),u=o(14599),k=o(92694),w=o(88679),_=o(81257),E=o(79926),h=o(57948),C=o(55480),b=o(27826),g=o(74375),y=o(3582),Z=o(70118);const v=({isExpanded:e,onClick:t})=>(0,c.createElement)(i.Button,{className:"woocommerce-task-products__button-view-less-product-types",onClick:t},e?(0,s.__)("View less product types","woocommerce"):(0,s.__)("View more product types","woocommerce"),(0,c.createElement)(d.Z,{icon:e?m.Z:p.Z})),T=()=>{const[e,t]=(0,c.useState)(!1),[o,r]=(0,c.useState)(!1),a=(0,_.r)((()=>{const e=(0,w.O3)("onboarding");return e?.profile&&e?.profile.product_types||["physical"]})()),{productTypes:i,isRequesting:d}=(0,E.Z)((0,_.Q)(),a),{recordCompletionTime:m}=(0,y.Z)("products"),p=(0,c.useMemo)((()=>i.map((e=>({...e,onClick:()=>{e.onClick(),m()}})))),[m,i]),{loadSampleProduct:T,isLoadingSampleProducts:f}=(0,b.Z)({redirectUrlAfterSuccess:(0,l.getAdminLink)("edit.php?post_type=product&wc_onboarding_active_task=products")}),A=(0,c.useMemo)((()=>{const t=p.filter((e=>a.includes(e.key)));return e&&p.forEach((e=>!t.includes(e)&&t.push(e))),(0,k.applyFilters)(Z.x,t)}),[a,e,p]),O=(0,c.useMemo)((()=>{const e=[],t={...Z.RC,onClick:()=>{Z.RC.onClick(),m()}};return e.push(t),window.wcAdminFeatures&&!0===window.wcAdminFeatures.printful&&e.push(Z.xz),e}),[m]);return(0,c.createElement)("div",{className:"woocommerce-task-products"},(0,c.createElement)(n.Text,{variant:"title",as:"h2",className:"woocommerce-task-products__title"},(0,s.__)("What product do you want to add?","woocommerce")),(0,c.createElement)("div",{className:"woocommerce-product-content"},(0,c.createElement)(h.Z,{items:A,onClickLoadSampleProduct:()=>r(!0),showOtherOptions:e,isTaskListItemClicked:d}),(0,c.createElement)(v,{isExpanded:e,onClick:()=>{e||(0,u.recordEvent)("tasklist_view_more_product_types_click"),t(!e)}}),(0,c.createElement)(h.Z,{items:O,showOtherOptions:!1,isTaskListItemClicked:d})),f?(0,c.createElement)(C.Z,null):o&&(0,c.createElement)(g.Z,{onCancel:()=>{r(!1),(0,u.recordEvent)("tasklist_cancel_load_sample_products_click")},onImport:()=>{r(!1),T()}}))},f=()=>(0,c.createElement)(r.WooOnboardingTask,{id:"products"},(0,c.createElement)(T,null));(0,a.registerPlugin)("wc-admin-onboarding-task-products",{scope:"woocommerce-tasks",render:()=>(0,c.createElement)(f,null)})}}]);