File "3945.js"

Full Path: /home/warrior1/public_html/plugins/woocommerce/assets/client/admin/chunks/3945.js
File size: 14.97 KB
MIME-type: text/plain
Charset: utf-8

"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[3945],{10314:(e,t,o)=>{o.d(t,{Z:()=>a});var r=o(69307),c=o(70444);const a=(0,r.createElement)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(c.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}))},46582:(e,t,o)=>{o.d(t,{UM:()=>a,aT:()=>r,ec:()=>c});const r="[^-0-9%s1%s2]",c="[^-\\d\\%s]+",a="[%s](?=%s*[%s])"},55429:(e,t,o)=>{o.d(t,{a:()=>c});var r=o(69307);const c=e=>{let{children:t}=e;return(0,r.createElement)("div",{className:"product-form-layout"},t)}},98795:(e,t,o)=>{o.d(t,{N:()=>u});var r=o(69307),c=o(86020),a=(o(99196),o(55609)),n=o(92819),l=o(70481);const i=e=>{let{children:t,fieldName:o,categoryName:c,location:i,order:s=1}=e;const u=(0,n.snakeCase)(c),m=(0,n.snakeCase)(o);return(0,r.createElement)(a.Fill,{name:`woocommerce_product_${u}_${m}_${i}`},(e=>(0,l.uh)(t,s,e)))};i.Slot=e=>{let{fillProps:t,fieldName:o,categoryName:c,location:i}=e;const s=(0,n.snakeCase)(c),u=(0,n.snakeCase)(o);return(0,r.createElement)(a.Slot,{name:`woocommerce_product_${s}_${u}_${i}`,fillProps:t},l.qk)};const s=e=>{let{fieldName:t,categoryName:o,children:c}=e;return(0,r.createElement)("div",{className:"product-field-layout"},(0,r.createElement)(i.Slot,{fieldName:t,categoryName:o,location:"before"}),c,(0,r.createElement)(i.Slot,{fieldName:t,categoryName:o,location:"after"}))},u=e=>{let{title:t,description:o,children:a}=e;return(0,r.createElement)(c.FormSection,{title:t,description:o},r.Children.map(a,(e=>(0,r.isValidElement)(e)&&e.props.onChange?(0,r.createElement)(s,{fieldName:e.props.name,categoryName:t},e):e)))}},59150:(e,t,o)=>{o.d(t,{p:()=>d});var r=o(69307),c=o(65736),a=o(55609),n=o(62907),l=o(86158),i=o(10314),s=o(86020),u=o(14599),m=o(66623);const d=()=>{const{createProductWithStatus:e,updateProductWithStatus:t,deleteProductAndRedirect:o,copyProductWithStatus:d,isUpdatingDraft:p,isUpdatingPublished:_,isDeleting:h}=(0,m.g)(),{isDirty:g,values:w,resetForm:f}=(0,s.useFormContext)(),b=()=>({product_id:w.id,product_type:w.type,is_downloadable:w.downloadable,is_virtual:w.virtual,manage_stock:w.manage_stock}),k=async()=>{(0,u.recordEvent)("product_publish_and_copy",{new_product_page:!0,...b()}),w.id?await t(w.id,w,"publish"):await e(w,"publish",!1,!0),await d(w)},E=async()=>{(0,u.recordEvent)("product_copy",{new_product_page:!0,...b()}),w.id&&await t(w.id,w,w.status||"draft"),await d(w)},v=()=>{(0,u.recordEvent)("product_delete",{new_product_page:!0,...b()}),w.id&&o(w.id)},y=w.id&&"publish"===w.status;return(0,r.createElement)("div",{className:"woocommerce-product-form-actions"},(0,r.createElement)(a.Button,{onClick:async()=>{if((0,u.recordEvent)("product_edit",{new_product_page:!0,...b()}),w.id){const e=await t(w.id,w,"draft");e&&e.id&&f(e)}else e(w,"draft")},disabled:!g&&!!w.id&&"publish"!==w.status||p||_||h},!g&&w.id&&"publish"!==w.status&&(0,r.createElement)(n.Z,{icon:l.Z}),p?(0,c.__)("Saving","woocommerce"):null,!g&&w.id||p||"publish"===w.status?null:(0,c.__)("Save draft","woocommerce"),"publish"!==w.status||p?null:(0,c.__)("Switch to draft","woocommerce"),g||!w.id||p||"publish"===w.status?null:(0,c.__)("Saved","woocommerce")),(0,r.createElement)(a.Button,{onClick:()=>(0,u.recordEvent)("product_preview_changes",{new_product_page:!0,...b()}),href:w.permalink+"?preview=true",disabled:!w.permalink,target:"_blank"},(0,c.__)("Preview","woocommerce")),(0,r.createElement)(a.ButtonGroup,{className:"woocommerce-product-form-actions__publish-button-group"},(0,r.createElement)(a.Button,{onClick:async()=>{if((0,u.recordEvent)("product_update",{new_product_page:!0,...b()}),w.id){const e=await t(w.id,w,"publish");e&&e.id&&f(e)}else e(w,"publish")},variant:"primary",isBusy:_,disabled:!g&&!!y||p||_||h},_?(0,c.__)("Updating","woocommerce"):null,y&&!_?(0,c.__)("Update","woocommerce"):null,y||_?null:(0,c.__)("Publish","woocommerce")),(0,r.createElement)(a.DropdownMenu,{className:"woocommerce-product-form-actions__publish-dropdown",label:(0,c.__)("Publish options","woocommerce"),icon:i.Z,popoverProps:{position:"bottom left"},toggleProps:{variant:"primary"}},(()=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.MenuGroup,null,(0,r.createElement)(a.MenuItem,{onClick:k},y?(0,c.__)("Update & duplicate","woocommerce"):(0,c.__)("Publish & duplicate","woocommerce")),(0,r.createElement)(a.MenuItem,{onClick:E},(0,c.__)("Copy to a new draft","woocommerce")),(0,r.createElement)(a.MenuItem,{onClick:v,isDestructive:!0,disabled:!w.id},(0,c.__)("Move to trash","woocommerce"))))))))}},57194:(e,t,o)=>{o.d(t,{G:()=>c});var r=o(65736);const c=e=>{const t={};return e.name?.length||(t.name=(0,r.__)("This field is required.","woocommerce")),e.name&&e.name.length>120&&(t.name=(0,r.__)("Please enter a product name shorter than 120 characters.","woocommerce")),e.regular_price&&!/^[0-9.,]+$/.test(e.regular_price)&&(t.regular_price=(0,r.__)("Please enter a price with one monetary decimal point without thousand separators and currency symbols.","woocommerce")),e.sale_price&&!/^[0-9.,]+$/.test(e.sale_price)&&(t.sale_price=(0,r.__)("Please enter a price with one monetary decimal point without thousand separators and currency symbols.","woocommerce")),e.sale_price&&(!e.regular_price||parseFloat(e.sale_price)>=parseFloat(e?.regular_price))&&(t.sale_price=(0,r.__)("Sale price cannot be equal to or higher than list price.","woocommerce")),t}},25942:(e,t,o)=>{o.d(t,{t:()=>b});var r=o(5267),c=o(69307),a=o(65736),n=o(86020),l=o(67221),i=o(14599),s=o(9818),u=o(51432),m=o(83849),d=o.n(m),p=o(55609),_=o(98795),h=o(22073),g=o(27182),w=o(20964),f=o(66623);const b=()=>{const{getInputProps:e,setValue:t}=(0,n.useFormContext)(),{sanitizePrice:o}=(0,f.g)(),{isResolving:m,taxSettings:b}=(0,s.useSelect)((e=>{const{getSettings:t,hasFinishedResolution:o}=e(l.SETTINGS_STORE_NAME);return{isResolving:!o("getSettings",["tax"]),taxSettings:t("tax").tax||{}}})),k="yes"===b.woocommerce_prices_include_tax,E=(0,c.useContext)(w.$),v=(0,a.__)("Per your {{link}}store settings{{/link}}, tax is {{strong}}included{{/strong}} in the price.","woocommerce"),y=(0,a.__)("Per your {{link}}store settings{{/link}}, tax is {{strong}}not included{{/strong}} in the price.","woocommerce"),C=(0,u.Z)({mixedString:k?v:y,components:{link:(0,c.createElement)(n.Link,{href:`${g.SX}admin.php?page=wc-settings&tab=tax`,target:"_blank",type:"external",onClick:()=>{(0,i.recordEvent)("product_pricing_list_price_help_tax_settings_click")}},(0,c.createElement)(c.Fragment,null)),strong:(0,c.createElement)("strong",null)}}),S=(0,u.Z)({mixedString:(0,a.__)("Sale price {{span}}(optional){{/span}}","woocommerce"),components:{span:(0,c.createElement)("span",{className:"woocommerce-product-form__optional-input"})}}),x=(0,h.o9)({...e("sale_price"),context:E});return(0,c.createElement)(_.N,{title:(0,a.__)("Pricing","woocommerce"),description:(0,c.createElement)(c.Fragment,null,(0,c.createElement)("span",null,(0,a.__)("Set a competitive price, put the product on sale, and manage tax calculations.","woocommerce")),(0,c.createElement)(n.Link,{className:"woocommerce-form-section__header-link",href:"https://woocommerce.com/posts/how-to-price-products-strategies-expert-tips/",target:"_blank",type:"external",onClick:()=>{(0,i.recordEvent)("add_product_pricing_help")}},"How to price your product: expert tips"))},(0,c.createElement)("div",{className:"woocommerce-product-form__custom-label-input"},(0,c.createElement)(p.__experimentalInputControl,(0,r.Z)({label:(0,a.__)("List price","woocommerce"),placeholder:(0,a.__)("10.59","woocommerce")},(0,h.o9)({...e("regular_price"),context:E}),{onChange:e=>{const r=o(e);t("regular_price",r)}})),!m&&(0,c.createElement)("span",{className:"woocommerce-product-form__secondary-text"},C)),(0,c.createElement)("div",{className:d()("woocommerce-product-form__custom-label-input",{"has-error":""!==x?.help})},(0,c.createElement)(p.BaseControl,{id:"sale_price",help:x&&x.help?x.help:""},(0,c.createElement)(p.__experimentalInputControl,(0,r.Z)({label:S,placeholder:(0,a.__)("8.59","woocommerce")},x,{onChange:e=>{const r=o(e);t("sale_price",r)}})))))}},70770:(e,t,o)=>{o.d(t,{o:()=>w});var r=o(5267),c=o(69307),a=o(55609),n=o(9818),l=o(65736),i=o(96483),s=o(86020),u=o(67221),m=o(14599),d=o(98795),p=o(14812),_=o(66623);const h=e=>{let{product:t,permalinkPrefix:o,permalinkSuffix:r,onCancel:u,onSaved:d}=e;const{createNotice:h}=(0,n.useDispatch)("core/notices"),{updateProductWithStatus:g,isUpdatingDraft:w,isUpdatingPublished:f}=(0,_.g)(),[b,k]=(0,c.useState)(t.slug||(0,i.cleanForSlug)(t.name)),{resetForm:E,changedFields:v,touched:y,errors:C}=(0,s.useFormContext)(),S=o+(0,i.cleanForSlug)(b)+r;return(0,c.createElement)(a.Modal,{title:(0,l.__)("Edit product link","woocommerce"),onRequestClose:()=>u(),className:"woocommerce-product-link-edit-modal"},(0,c.createElement)("div",{className:"woocommerce-product-link-edit-modal__wrapper"},(0,c.createElement)(a.TextControl,{label:S,name:"slug",value:b,onChange:k}),(0,c.createElement)(p.Text,{size:12},(0,l.__)("Use simple, descriptive words and numbers. We'll replace spaces with hyphens (-).","woocommerce")),(0,c.createElement)("div",{className:"woocommerce-product-link-edit-modal__buttons"},(0,c.createElement)(a.Button,{isSecondary:!0,onClick:()=>u()},(0,l.__)("Cancel","woocommerce")),(0,c.createElement)(a.Button,{isPrimary:!0,isBusy:w||f,disabled:w||f||b===t.slug,onClick:()=>{(async()=>{(0,m.recordEvent)("product_update_slug",{new_product_page:!0,product_id:t.id,product_type:t.type});const e=await g(t.id,{slug:b},t.status,!0);e&&e.id?(E({...t,slug:e.slug,permalink:e.permalink},v,y,C),h(e.slug===(0,i.cleanForSlug)(b)?"success":"info",e.slug===(0,i.cleanForSlug)(b)?(0,l.__)("Product link successfully updated.","woocommerce"):(0,l.__)("Product link already existed, updated to ","woocommerce")+e.permalink)):h("error",(0,l.__)("Failed to update product link.","woocommerce")),d()})()}},(0,l.__)("Save","woocommerce")))))};var g=o(22073);const w=()=>{const{getInputProps:e,values:t}=(0,s.useFormContext)(),[o,p]=(0,c.useState)(!1),{permalinkPrefix:_,permalinkSuffix:w}=(0,n.useSelect)((e=>{const{getPermalinkParts:o}=e(u.PRODUCTS_STORE_NAME);if(t.id){const e=o(t.id);return{permalinkPrefix:e?.prefix,permalinkSuffix:e?.suffix}}return{}}));return(0,c.createElement)(d.N,{title:(0,l.__)("Product info","woocommerce"),description:(0,l.__)("This info will be displayed on the product page, category pages, social media, and search results.","woocommerce")},(0,c.createElement)("div",null,(0,c.createElement)(a.TextControl,(0,r.Z)({label:(0,l.__)("Name","woocommerce"),name:"product-details-name",placeholder:(0,l.__)("e.g. 12 oz Coffee Mug","woocommerce")},(0,g.g$)(e("name")))),t.id&&_&&(0,c.createElement)("div",{className:"product-details-section__product-link"},(0,l.__)("Product link","woocommerce"),": ",(0,c.createElement)("a",{href:t.permalink,target:"_blank",rel:"noreferrer"},_,t.slug||(0,i.cleanForSlug)(t.name),w),(0,c.createElement)(a.Button,{variant:"link",onClick:()=>p(!0)},(0,l.__)("Edit","woocommerce")))),(0,c.createElement)(a.CheckboxControl,(0,r.Z)({label:(0,c.createElement)(s.EnrichedLabel,{label:(0,l.__)("Feature this product","woocommerce"),helpDescription:(0,l.__)("Include this product in a featured section on your website with a widget or shortcode.","woocommerce"),moreUrl:"https://woocommerce.com/document/woocommerce-shortcodes/#products",tooltipLinkCallback:()=>(0,m.recordEvent)("add_product_learn_more",{category:"product-details"})})},(0,g.A_)({...e("featured"),name:"featured",className:"product-details-section__feature-checkbox"}))),o&&(0,c.createElement)(h,{permalinkPrefix:_||"",permalinkSuffix:w||"",product:t,onCancel:()=>p(!1),onSaved:()=>p(!1)}))}},22073:(e,t,o)=>{o.d(t,{A_:()=>l,g$:()=>i,o9:()=>s});var r=o(83849),c=o.n(r),a=o(14599),n=o(46582);const l=e=>{let{checked:t=!1,className:o,name:r,onBlur:n,onChange:l}=e;return{checked:t,className:c()("woocommerce-product__checkbox",o),onChange:e=>((0,a.recordEvent)(`product_checkbox_${r}`,{checked:e}),l(e)),onBlur:n}},i=e=>{let{className:t,onBlur:o,onChange:r,value:a="",help:n}=e;return{value:a,className:c()("woocommerce-product__text",t),onChange:r,onBlur:o,help:n}},s=e=>{let{className:t,context:o,onBlur:r,onChange:a,value:l="",help:i}=e;if(!o)return;const{formatAmount:s,getCurrencyConfig:u}=o,{decimalSeparator:m,symbol:d,symbolPosition:p,thousandSeparator:_}=u(),h=p.includes("left")?"prefix":"suffix",g=new RegExp(n.aT.replace("%s1",m).replace("%s2",_),"g");return{value:void 0===l?l:s(l).replace(g,""),[h]:d,className:c()("woocommerce-product__input",t),onChange:a,onBlur:r,help:i}}},66623:(e,t,o)=>{o.d(t,{g:()=>p});var r=o(65736),c=o(9818),a=o(69307),n=o(67221),l=o(14599),i=o(10431),s=o(20964),u=o(46582);function m(e){return n.productReadOnlyProperties.forEach((t=>delete e[t])),e}function d(e,t){return"publish"===e&&t?[{label:(0,r.__)("View in store","woocommerce"),onClick:()=>{(0,l.recordEvent)("product_preview_changes",{new_product_page:!0}),window.open(t,"_blank")}}]:[]}function p(){const{createProduct:e,updateProduct:t,deleteProduct:o}=(0,c.useDispatch)(n.PRODUCTS_STORE_NAME),{createNotice:l}=(0,c.useDispatch)("core/notices"),[p,_]=(0,a.useState)(!1),[h,g]=(0,a.useState)({draft:!1,publish:!1}),w=(0,a.useContext)(s.$),f=(0,a.useCallback)((async function(t,o){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];g({...h,[o]:!0}),e({...t,status:o}).then((e=>{c||l("success","publish"===e.status?(0,r.__)("🎉 Product published. View in store","woocommerce"):(0,r.__)("🎉 Product successfully created.","woocommerce"),{actions:d(e.status,e.permalink)}),g({...h,[o]:!1}),a||(0,i.navigateTo)({url:"admin.php?page=wc-admin&path=/product/"+e.id})}),(()=>{c||l("error","publish"===o?(0,r.__)("Failed to publish product.","woocommerce"):(0,r.__)("Failed to create product.","woocommerce")),g({...h,[o]:!1})}))}),[h]),b=(0,a.useCallback)((async function(e,o,c){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return g({...h,[c]:!0}),t(e,{...o,status:c}).then((e=>(a||l("success","draft"===o.status&&"publish"===e.status?(0,r.__)("🎉 Product published. View in store.","woocommerce"):(0,r.__)("🎉 Product successfully updated.","woocommerce"),{actions:d(e.status,e.permalink)}),g({...h,[c]:!1}),e)),(e=>(a||l("error",(0,r.__)("Failed to update product.","woocommerce")),g({...h,[c]:!1}),e)))}),[h]),k=(0,a.useCallback)((async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"draft";return f(m({...e,name:(e.name||"AUTO-DRAFT")+" - Copy"}),t)}),[]),E=(0,a.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"edit.php?post_type=product";return _(!0),o(e).then((()=>{l("success",(0,r.__)("🎉 Successfully moved product to Trash.","woocommerce")),(0,i.navigateTo)({url:t}),_(!1)}))}),[]),v=(0,a.useCallback)((e=>{const{getCurrencyConfig:t}=w,{decimalSeparator:o}=t(),r=new RegExp(u.ec.replace("%s",o),"g"),c=new RegExp(u.UM.replaceAll("%s",o),"g");return e.replace(r,"").replace(c,"").replace(o,".")}),[w]);return{createProductWithStatus:f,updateProductWithStatus:b,copyProductWithStatus:k,deleteProductAndRedirect:E,sanitizePrice:v,isUpdatingDraft:h.draft,isUpdatingPublished:h.publish,isDeleting:p}}}}]);