"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[9605],{75516:(e,t,o)=>{o.r(t),o.d(t,{Products:()=>L});var c=o(69307),r=o(65736),s=o(71310),n=o(14812),a=o(98817),i=o(55609),m=o(74617),l=o(23374),p=o(86241),d=o(73224),u=o(14599),_=o(92694),k=o(17062),w=o(73838),E=o(35231),h=o(53389),g=o(76357),C=o(86020),y=o(69987);const v=()=>{const{recordCompletionTime:e}=(0,y.Z)("products");return(0,c.createElement)("div",{className:"woocommerce-products-footer"},(0,c.createElement)(n.Text,{className:"woocommerce-products-footer__selling-somewhere-else"},(0,r.__)("Are you already selling somewhere else?","woocommerce")),(0,c.createElement)(n.Text,{className:"woocommerce-products-footer__import-options"},(0,g.Z)({mixedString:(0,r.__)("{{importCSVLink}}Import your products from a CSV file{{/importCSVLink}}.","woocommerce"),components:{importCSVLink:(0,c.createElement)(C.Link,{onClick:()=>((0,u.recordEvent)("tasklist_add_product",{method:"import"}),e(),window.location.href=(0,m.getAdminLink)("edit.php?post_type=product&page=product_importer&wc_onboarding_active_task=products"),!1),href:"",type:"wc-admin"},(0,c.createElement)(c.Fragment,null))}})))};var b=o(69359),f=o(35192),S=o(93914),Z=o(12266);const T=({isExpanded:e,onClick:t})=>(0,c.createElement)(i.Button,{className:"woocommerce-task-products__button-view-less-product-types",onClick:t},e?(0,r.__)("View less product types","woocommerce"):(0,r.__)("View more product types","woocommerce"),(0,c.createElement)(l.Z,{icon:e?p.Z:d.Z})),L=()=>{const[e,t]=(0,c.useState)(!1),[o,s]=(0,c.useState)(!1),a=(0,w.r)((()=>{const e=(0,k.O3)("onboarding");return e?.profile&&e?.profile.product_types||["physical"]})()),{productTypes:i,isRequesting:l}=(0,E.Z)((0,w.Q)(),a),{recordCompletionTime:p}=(0,y.Z)("products"),d=(0,c.useMemo)((()=>i.map((e=>({...e,onClick:()=>{e.onClick(),p()}})))),[p,i]),{loadSampleProduct:g,isLoadingSampleProducts:C}=(0,f.Z)({redirectUrlAfterSuccess:(0,m.getAdminLink)("edit.php?post_type=product&wc_onboarding_active_task=products")}),L=(0,c.useMemo)((()=>{const t=d.filter((e=>a.includes(e.key)));return e&&d.forEach((e=>!t.includes(e)&&t.push(e))),(0,_.applyFilters)(Z.x,t)}),[a,e,d]);return(0,c.createElement)("div",{className:"woocommerce-task-products"},(0,c.createElement)(n.Text,{variant:"title",as:"h2",className:"woocommerce-task-products__title"},(0,r.__)("What product do you want to add?","woocommerce")),(0,c.createElement)("div",{className:"woocommerce-product-content"},(0,c.createElement)(h.Z,{items:L,onClickLoadSampleProduct:()=>s(!0),showOtherOptions:e,isTaskListItemClicked:l}),(0,c.createElement)(T,{isExpanded:e,onClick:()=>{e||(0,u.recordEvent)("tasklist_view_more_product_types_click"),t(!e)}}),(0,c.createElement)(v,null)),C?(0,c.createElement)(b.Z,null):o&&(0,c.createElement)(S.Z,{onCancel:()=>{s(!1),(0,u.recordEvent)("tasklist_cancel_load_sample_products_click")},onImport:()=>{s(!1),g()}}))},x=()=>(0,c.createElement)(s.WooOnboardingTask,{id:"products"},(0,c.createElement)(L,null));(0,a.registerPlugin)("wc-admin-onboarding-task-products",{scope:"woocommerce-tasks",render:()=>(0,c.createElement)(x,null)})}}]);