"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[823],{78591:(e,o,s)=>{s.r(o),s.d(o,{Products:()=>A});var t=s(65736),c=s(44698),i=s(14812),r=s(98817),n=s(69307),a=s(55609),d=s(74617),p=s(59550),l=s(91667),m=s(58176),u=s(14599),k=s(92694),_=s(91978),w=s(76731),h=s(55684),x=s(639),C=s(43378),g=s(19987),j=s(24304),b=s(80945),y=s(40955),v=s(28682),Z=s(81514);const f=({isExpanded:e,onClick:o})=>(0,Z.jsxs)(a.Button,{className:"woocommerce-task-products__button-view-less-product-types",onClick:o,children:[e?(0,t.__)("View less product types","woocommerce"):(0,t.__)("View more product types","woocommerce"),(0,Z.jsx)(p.Z,{icon:e?l.Z:m.Z})]}),A=()=>{const[e,o]=(0,n.useState)(!1),[s,c]=(0,n.useState)(!1),r=(0,w.r)((()=>{const e=(0,_.O3)("onboarding");return e?.profile&&e?.profile.product_types||["physical"]})()),{productTypes:a,isRequesting:p}=(0,h.Z)((0,w.Q)(),r),{recordCompletionTime:l}=(0,b.Z)("products"),m=(0,n.useMemo)((()=>a.map((e=>({...e,onClick:()=>{e.onClick(),l()}})))),[l,a]),{loadSampleProduct:A,isLoadingSampleProducts:L}=(0,g.Z)({redirectUrlAfterSuccess:(0,d.getAdminLink)("edit.php?post_type=product&wc_onboarding_active_task=products")}),T=(0,n.useMemo)((()=>{const o=m.filter((e=>r.includes(e.key)));return e&&m.forEach((e=>!o.includes(e)&&o.push(e))),(0,k.applyFilters)(y.x,o)}),[r,e,m]),O=(0,n.useMemo)((()=>{const e=[],o={...y.RC,onClick:()=>{y.RC.onClick(),l()}};return e.push(o),window.wcAdminFeatures&&!0===window.wcAdminFeatures.printful&&e.push(y.xz),e}),[l]);return(0,Z.jsxs)("div",{className:"woocommerce-task-products",children:[(0,Z.jsx)(i.Text,{variant:"title",as:"h2",className:"woocommerce-task-products__title",children:(0,t.__)("What product do you want to add?","woocommerce")}),(0,Z.jsxs)("div",{className:"woocommerce-product-content",children:[(0,Z.jsx)(x.Z,{items:T,onClickLoadSampleProduct:()=>c(!0),showOtherOptions:e,isTaskListItemClicked:p}),(0,Z.jsx)(f,{isExpanded:e,onClick:()=>{e||(0,u.recordEvent)("tasklist_view_more_product_types_click"),o(!e)}}),(0,Z.jsx)(x.Z,{items:O,showOtherOptions:!1,isTaskListItemClicked:p}),(0,Z.jsx)(v.A,{textProps:{className:"woocommerce-products-marketplace-link"},message:(0,t.__)("Visit the {{Link}}Official 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,d.getAdminLink)("admin.php?page=wc-admin&tab=extensions&path=/extensions&category=merchandising")})]}),L?(0,Z.jsx)(C.Z,{}):s&&(0,Z.jsx)(j.Z,{onCancel:()=>{c(!1),(0,u.recordEvent)("tasklist_cancel_load_sample_products_click")},onImport:()=>{c(!1),A()}})]})},L=()=>(0,Z.jsx)(c.WooOnboardingTask,{id:"products",children:(0,Z.jsx)(A,{})});(0,r.registerPlugin)("wc-admin-onboarding-task-products",{scope:"woocommerce-tasks",render:()=>(0,Z.jsx)(L,{})})}}]);