geno/wp-content/plugins/woocommerce/assets/client/admin/chunks/4891.js

1 line
14 KiB
JavaScript
Raw Permalink Normal View History

2024-02-01 17:24:18 +05:30
"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[4891],{68589:(e,t,o)=>{o.d(t,{Z:()=>i});var r=o(69307),c=o(65736),a=o(55609),n=o(14812);const i=e=>{let{onCancel:t,onImport:o}=e;return(0,r.createElement)(a.Modal,{className:"woocommerce-products-load-sample-product-confirm-modal",overlayClassName:"woocommerce-products-load-sample-product-confirm-modal-overlay",title:(0,c.__)("Load sample products","woocommerce"),onRequestClose:t},(0,r.createElement)(n.Text,{className:"woocommerce-confirmation-modal__message"},(0,c.__)("We'll import images from Woo.com to set up your sample products.","woocommerce")),(0,r.createElement)("div",{className:"woocommerce-confirmation-modal-actions"},(0,r.createElement)(a.Button,{isSecondary:!0,onClick:t},(0,c.__)("Cancel","woocommerce")),(0,r.createElement)(a.Button,{isPrimary:!0,onClick:o},(0,c.__)("Import sample products","woocommerce"))))}},48451:(e,t,o)=>{o.d(t,{Z:()=>s});var r=o(69307),c=o(65736),a=o(55609),n=o(34928),i=o(14812);const s=()=>(0,r.createElement)(a.Modal,{className:"woocommerce-products-load-sample-product-modal",overlayClassName:"woocommerce-products-load-sample-product-modal-overlay",title:"",onRequestClose:()=>{}},(0,r.createElement)(n.Spinner,{color:"#007cba",size:48}),(0,r.createElement)(i.Text,{className:"woocommerce-load-sample-product-modal__title"},(0,c.__)("Loading sample products","woocommerce")),(0,r.createElement)(i.Text,{className:"woocommerce-load-sample-product-modal__description"},(0,c.__)("We are loading 9 sample products into your store","woocommerce")))},42896:(e,t,o)=>{o.d(t,{Z:()=>d});var r=o(65736),c=o(86989),a=o.n(c),n=o(67221),i=o(9818),s=o(69307),l=o(14599),m=o(31611);const d=e=>{let{redirectUrlAfterSuccess:t}=e;const[o,c]=(0,s.useState)(!1),{createNotice:d}=(0,i.useDispatch)("core/notices"),{recordCompletionTime:p}=(0,m.Z)("products");return{loadSampleProduct:async()=>{(0,l.recordEvent)("tasklist_add_product",{method:"sample_product"}),p(),c(!0);try{if(await a()({path:`${n.WC_ADMIN_NAMESPACE}/onboarding/tasks/import_sample_products`,method:"POST"}),t)return void(window.location.href=t)}catch(e){const t=e instanceof Error&&e.message?e.message:(0,r.__)("There was an error importing the sample products","woocommerce");d("error",t)}c(!1)},isLoadingSampleProducts:o}}},14891:(e,t,o)=>{o.r(t),o.d(t,{Products:()=>C});var r=o(69307),c=o(72456),a=o(98817),n=o(65736),i=o(23374),s=o(86241),l=o(73224),m=o(55609),d=o(74617),p=o(14599),u=o(25247),_=o(86020);const w=e=>{let{items:t}=e;return(0,r.createElement)("div",{className:"woocommerce-products-card-list"},(0,r.createElement)(_.List,{items:t}))};var h=o(3680);const k=[{key:"from-csv",title:(0,n.__)("FROM A CSV FILE","woocommerce"),content:(0,n.__)("Import all products at once by uploading a CSV file.","woocommerce"),before:(0,r.createElement)(h.Z,null),onClick:()=>{(0,p.recordEvent)("tasklist_add_product",{method:"import"}),window.location.href=(0,d.getAdminLink)("edit.php?post_type=product&page=product_importer&wc_onboarding_active_task=products")}}];var g=o(19460),v=o(70422),f=o(48451),y=o(42896),E=o(68589),b=o(31611);const C=()=>{const[e,t]=(0,r.useState)(!1),{recordCompletionTime:o}=(0,b.Z)("products"),[c,a]=(0,r.useState)(!1),_=(0,r.useMemo)((()=>k.map((e=>({...e,onClick:()=>{e.onClick(),o()}})))),[o]),{loadSampleProduct:h,isLoadingSampleProducts:C}=(0,y.Z)({redirectUrlAfterSuccess:(0,d.getAdminLink)("edit.php?post_type=product&wc_onboarding_active_task=products")}),{productTypes:Z}=(0,g.Z)((0,v.Q)({exclude:["subscription"]}),[],{onClick:o}),L=(0,r.createElement)(u.Z,{items:Z,onClickLoadSampleProduct:()=>a(!0)});return(0,r.createElement)("div",{className:"woocommerce-task-import-products"},(0,r.createElement)("h1",null,(0,n.__)("Import your products","woocommerce")),(0,r.createElement)(w,{items:_}),(0,r.createElement)("div",{className:"woocommerce-task-import-products-stacks"},(0,r.createElement)(m.Button,{onClick:()=>{(0,p.recordEvent)("tasklist_add_product_from_scratch_click"),t(!e)}},(0,n.__)("Or add your products from scratch","woocomm