File "product-page.js"

Full Path: /home/jlklyejr/public_html/wp-content/test/wp-content/plugins/woocommerce/assets/client/admin/chunks/product-page.js
File size: 4.1 KB
MIME-type: text/plain
Charset: utf-8

"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[7387],{38485:(e,t,o)=>{o.r(t),o.d(t,{default:()=>g});var r=o(69307),n=o(51393),c=o(14599),s=o(98817),i=o(85597),l=o(46530),d=o(9818),u=o(65736),a=o(86020),p=o(40182),m=o(16686);const _=({shouldTourBeShown:e,dismissModal:t})=>{const{isNewUser:o,loadingPublishedProductsCount:s}=(0,m.E)();(0,r.useEffect)((()=>{e&&(0,c.recordEvent)("block_product_editor_spotlight_view")}),[e]);const[i,l]=(0,r.useState)(!1),{maybeShowFeedbackBar:d}=(0,n.__experimentalUseFeedbackBar)();if(s)return null;if(i)return(0,r.createElement)(p.Z,{isNewUser:o,onCloseGuide:(e,o)=>{t(),"finish"===o?(0,c.recordEvent)("block_product_editor_spotlight_tell_me_more_click"):(0,c.recordEvent)("block_product_editor_spotlight_dismissed",{current_page:e+1}),l(!1),d()}});if(e){const{heading:e,description:n}={heading:o?(0,u.__)("Meet the product editing form","woocommerce"):(0,u.__)("Welcome to the new product form!","woocommerce"),description:o?(0,u.__)("Discover the product form's unique features with a quick overview of what's included.","woocommerce"):(0,u.__)("Discover its new features and improvements with a quick overview of what's included.","woocommerce")};return(0,r.createElement)(a.TourKit,{config:{steps:[{meta:{name:"woocommerce-block-editor-tour",primaryButton:{text:(0,u.__)("View highlights","woocommerce")},descriptions:{desktop:n},heading:(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",null,e),(0,r.createElement)(a.Pill,null,(0,u.__)("Beta","woocommerce")))},referenceElements:{desktop:"#adminmenuback"}}],closeHandler:(e,o,r)=>{"done-btn"===r?((0,c.recordEvent)("block_product_editor_spotlight_view_highlights"),l(!0)):(t(),(0,c.recordEvent)("block_product_editor_spotlight_dismissed",{current_page:0}),d())},options:{effects:{arrowIndicator:!1,overlay:!1,liveResize:{rootElementSelector:"#adminmenuback",resize:!0}},portalParentElement:document.getElementById("wpbody"),popperModifiers:[{name:"bottom-left",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.top="auto",e.styles.popper.left="auto",e.styles.popper.bottom="10px",e.styles.popper.transform="translate3d(10px, 0px, 0px)"}}],classNames:"woocommerce-block-editor-tourkit"}}})}return null};var h=o(67221);const E="woocommerce_block_product_tour_shown",w=()=>{const e=(()=>{const{updateOptions:e}=(0,d.useDispatch)(h.OPTIONS_STORE_NAME),{shouldTourBeShown:t}=(0,d.useSelect)((e=>{const{getOption:t,hasFinishedResolution:o}=e(h.OPTIONS_STORE_NAME);return{shouldTourBeShown:!("yes"===t(E)||!o("getOption",[E]))}}));return{dismissModal:()=>{e({[E]:"yes"})},shouldTourBeShown:t}})();return(0,r.createElement)(_,e)};var f=o(69220);function g(){const{productId:e}=(0,i.UO)(),t=function(e){const{saveEntityRecord:t}=(0,d.useDispatch)("core"),[o,c]=(0,r.useState)(void 0);return(0,r.useEffect)((()=>{(e?(0,d.resolveSelect)("core").getEntityRecord("postType","product",Number.parseInt(e,10)):t("postType","product",{title:n.AUTO_DRAFT_NAME,status:"auto-draft"})).then((e=>{c(e)})).catch((e=>{throw c(void 0),e}))}),[e]),o}(e);return(0,r.useEffect)((()=>{(0,s.registerPlugin)("wc-admin-product-editor",{scope:"woocommerce-product-block-editor",render:()=>(0,r.useContext)(n.__experimentalEditorLoadingContext)?null:(0,r.createElement)(r.Fragment,null,(0,r.createElement)(n.__experimentalWooProductMoreMenuItem,null,(({onClose:e})=>(0,r.createElement)(f.e,{onClose:e}))),(0,r.createElement)(l.WooFooterItem,null,(0,r.createElement)(r.Fragment,null,(0,r.createElement)(n.__experimentalProductMVPCESFooter,{productType:"product"}),(0,r.createElement)(n.__experimentalProductMVPFeedbackModalContainer,{productId:e?parseInt(e,10):void 0}))),(0,r.createElement)(w,null))});const t=(0,n.__experimentalInitBlocks)();return()=>{(0,s.unregisterPlugin)("wc-admin-more-menu"),t()}}),[e]),(0,r.useEffect)((function(){e?(0,c.recordEvent)("product_edit_view",{source:n.TRACKS_SOURCE,product_id:e}):(0,c.recordEvent)("product_add_view",{source:n.TRACKS_SOURCE})}),[e]),(0,r.createElement)(r.Fragment,null,(0,r.createElement)(n.__experimentalEditor,{product:t}))}(0,n.productApiFetchMiddleware)()}}]);